@needle-tools/engine 4.7.1 → 4.7.2-alpha
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.
- package/CHANGELOG.md +3782 -3782
- package/LICENSE.md +10 -10
- package/README.md +64 -64
- package/components.needle.json +1 -1
- package/dist/generateMeshBVH.worker-Cdfpaq5W.js +25 -0
- package/dist/gltf-progressive-YjtQYFa9.js +1052 -0
- package/dist/gltf-progressive-yOP1mp5W.min.js +8 -0
- package/dist/gltf-progressive-zdhlW609.umd.cjs +8 -0
- package/dist/{needle-engine.bundle-CN9UC6Ju.min.js → needle-engine.bundle-BhDF-YSv.min.js} +65 -65
- package/dist/{needle-engine.bundle-B7M9iBIa.umd.cjs → needle-engine.bundle-D2myV4E4.umd.cjs} +61 -61
- package/dist/{needle-engine.bundle-BpCihhaP.js → needle-engine.bundle-gp00DTS4.js} +641 -641
- package/dist/needle-engine.d.ts +129 -130
- package/dist/needle-engine.js +4 -4
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing-CjW23fio.umd.cjs → postprocessing-8AQTeZsr.umd.cjs} +2 -2
- package/dist/{postprocessing-xYQWCHFu.min.js → postprocessing-BDScN9yu.min.js} +2 -2
- package/dist/{postprocessing-DYLNOL3W.js → postprocessing-BkxN_08g.js} +3 -3
- package/dist/{three-DuDKwKB8.min.js → three-Boa-jOq-.min.js} +33 -33
- package/dist/{three-DrqIzZTH.js → three-Bz6X1mrw.js} +4198 -4198
- package/dist/{three-B_hneGZr.umd.cjs → three-DMrv-4ar.umd.cjs} +4 -4
- package/dist/{three-examples-X3OadjXB.umd.cjs → three-examples-C7ryg8vN.umd.cjs} +3 -3
- package/dist/{three-examples-DaDLBuy6.min.js → three-examples-DuVhxqft.min.js} +14 -14
- package/dist/{three-examples-B50TT3Iu.js → three-examples-GggCDHv0.js} +5 -5
- package/dist/{three-mesh-ui-CxuWt7m-.js → three-mesh-ui-CLNOfsWn.js} +1 -1
- package/dist/{three-mesh-ui-B3p3gyUz.min.js → three-mesh-ui-CY6Izc7C.min.js} +1 -1
- package/dist/{three-mesh-ui-CQiIQIlA.umd.cjs → three-mesh-ui-CwlN0FUC.umd.cjs} +1 -1
- package/dist/{vendor-BmYIgaS1.js → vendor-BSD1RQIh.js} +3 -3
- package/dist/{vendor-Cavtu3CP.umd.cjs → vendor-DHr4aqIZ.umd.cjs} +3 -3
- package/dist/{vendor-BlSxe9JJ.min.js → vendor-zxXa3Dmr.min.js} +3 -3
- package/lib/asap/needle-asap.d.ts +1 -1
- package/lib/asap/needle-asap.js +95 -95
- package/lib/asap/sessiongranted.d.ts +3 -3
- package/lib/asap/sessiongranted.js +65 -65
- package/lib/asap/utils.d.ts +1 -1
- package/lib/asap/utils.js +3 -3
- package/lib/engine/analytics/index.d.ts +6 -6
- package/lib/engine/analytics/index.js +12 -12
- package/lib/engine/analytics/lcp.d.ts +3 -3
- package/lib/engine/analytics/lcp.js +34 -34
- package/lib/engine/api.d.ts +82 -82
- package/lib/engine/api.js +81 -81
- package/lib/engine/assets/index.d.ts +11 -11
- package/lib/engine/assets/index.js +47 -47
- package/lib/engine/assets/static.d.ts +1 -1
- package/lib/engine/assets/static.js +4 -4
- package/lib/engine/codegen/register_types.d.ts +1 -1
- package/lib/engine/codegen/register_types.js +300 -300
- package/lib/engine/debug/debug.d.ts +15 -15
- package/lib/engine/debug/debug.js +44 -44
- package/lib/engine/debug/debug_console.d.ts +2 -2
- package/lib/engine/debug/debug_console.js +307 -307
- package/lib/engine/debug/debug_overlay.d.ts +22 -22
- package/lib/engine/debug/debug_overlay.js +316 -316
- package/lib/engine/debug/debug_spatial_console.d.ts +2 -2
- package/lib/engine/debug/debug_spatial_console.js +390 -390
- package/lib/engine/debug/index.d.ts +2 -2
- package/lib/engine/debug/index.js +2 -2
- package/lib/engine/engine_addressables.d.ts +164 -164
- package/lib/engine/engine_addressables.js +601 -601
- package/lib/engine/engine_animation.d.ts +43 -43
- package/lib/engine/engine_animation.js +133 -133
- package/lib/engine/engine_application.d.ts +45 -45
- package/lib/engine/engine_application.js +104 -104
- package/lib/engine/engine_assetdatabase.d.ts +25 -25
- package/lib/engine/engine_assetdatabase.js +346 -346
- package/lib/engine/engine_audio.d.ts +4 -4
- package/lib/engine/engine_audio.js +23 -23
- package/lib/engine/engine_camera.d.ts +13 -13
- package/lib/engine/engine_camera.js +30 -30
- package/lib/engine/engine_components.d.ts +110 -110
- package/lib/engine/engine_components.js +374 -374
- package/lib/engine/engine_components_internal.d.ts +9 -9
- package/lib/engine/engine_components_internal.js +36 -36
- package/lib/engine/engine_constants.d.ts +10 -10
- package/lib/engine/engine_constants.js +41 -41
- package/lib/engine/engine_context.d.ts +475 -475
- package/lib/engine/engine_context.js +1673 -1673
- package/lib/engine/engine_context_registry.d.ts +71 -71
- package/lib/engine/engine_context_registry.js +117 -117
- package/lib/engine/engine_coroutine.d.ts +35 -35
- package/lib/engine/engine_coroutine.js +52 -52
- package/lib/engine/engine_create_objects.d.ts +119 -119
- package/lib/engine/engine_create_objects.js +320 -320
- package/lib/engine/engine_default_parameters.d.ts +2 -2
- package/lib/engine/engine_default_parameters.js +3 -3
- package/lib/engine/engine_editor-sync.d.ts +21 -21
- package/lib/engine/engine_editor-sync.js +4 -4
- package/lib/engine/engine_fileloader.d.ts +2 -2
- package/lib/engine/engine_fileloader.js +8 -8
- package/lib/engine/engine_gameobject.d.ts +68 -68
- package/lib/engine/engine_gameobject.js +619 -619
- package/lib/engine/engine_generic_utils.d.ts +1 -1
- package/lib/engine/engine_generic_utils.js +13 -13
- package/lib/engine/engine_gizmos.d.ts +149 -149
- package/lib/engine/engine_gizmos.js +530 -530
- package/lib/engine/engine_gltf.d.ts +12 -12
- package/lib/engine/engine_gltf.js +15 -15
- package/lib/engine/engine_gltf_builtin_components.d.ts +11 -11
- package/lib/engine/engine_gltf_builtin_components.js +341 -341
- package/lib/engine/engine_hot_reload.d.ts +8 -8
- package/lib/engine/engine_hot_reload.js +197 -197
- package/lib/engine/engine_input.d.ts +362 -362
- package/lib/engine/engine_input.js +1294 -1294
- package/lib/engine/engine_input_utils.d.ts +2 -2
- package/lib/engine/engine_input_utils.js +22 -22
- package/lib/engine/engine_instancing.d.ts +19 -19
- package/lib/engine/engine_instancing.js +39 -39
- package/lib/engine/engine_license.d.ts +11 -11
- package/lib/engine/engine_license.js +369 -369
- package/lib/engine/engine_lifecycle_api.d.ts +83 -83
- package/lib/engine/engine_lifecycle_api.js +106 -106
- package/lib/engine/engine_lifecycle_functions_internal.d.ts +32 -32
- package/lib/engine/engine_lifecycle_functions_internal.js +146 -146
- package/lib/engine/engine_lightdata.d.ts +23 -23
- package/lib/engine/engine_lightdata.js +101 -101
- package/lib/engine/engine_loaders.callbacks.d.ts +97 -97
- package/lib/engine/engine_loaders.callbacks.js +86 -86
- package/lib/engine/engine_loaders.d.ts +48 -48
- package/lib/engine/engine_loaders.gltf.d.ts +13 -13
- package/lib/engine/engine_loaders.gltf.js +62 -62
- package/lib/engine/engine_loaders.js +337 -337
- package/lib/engine/engine_lods.d.ts +35 -35
- package/lib/engine/engine_lods.js +160 -160
- package/lib/engine/engine_lods.js.map +1 -1
- package/lib/engine/engine_mainloop_utils.d.ts +32 -32
- package/lib/engine/engine_mainloop_utils.js +466 -466
- package/lib/engine/engine_math.d.ts +114 -114
- package/lib/engine/engine_math.js +247 -247
- package/lib/engine/engine_modules.d.ts +36 -36
- package/lib/engine/engine_modules.js +85 -85
- package/lib/engine/engine_networking.d.ts +260 -260
- package/lib/engine/engine_networking.js +764 -764
- package/lib/engine/engine_networking_auto.d.ts +24 -24
- package/lib/engine/engine_networking_auto.js +310 -310
- package/lib/engine/engine_networking_blob.d.ts +48 -48
- package/lib/engine/engine_networking_blob.js +228 -228
- package/lib/engine/engine_networking_files.d.ts +35 -35
- package/lib/engine/engine_networking_files.js +172 -172
- package/lib/engine/engine_networking_files_default_components.d.ts +6 -6
- package/lib/engine/engine_networking_files_default_components.js +42 -42
- package/lib/engine/engine_networking_instantiate.d.ts +100 -100
- package/lib/engine/engine_networking_instantiate.js +345 -345
- package/lib/engine/engine_networking_peer.d.ts +15 -15
- package/lib/engine/engine_networking_peer.js +132 -132
- package/lib/engine/engine_networking_streams.d.ts +123 -123
- package/lib/engine/engine_networking_streams.js +645 -645
- package/lib/engine/engine_networking_types.d.ts +22 -22
- package/lib/engine/engine_networking_types.js +7 -7
- package/lib/engine/engine_networking_utils.d.ts +2 -2
- package/lib/engine/engine_networking_utils.js +20 -20
- package/lib/engine/engine_networking_websocket.d.ts +1 -1
- package/lib/engine/engine_networking_websocket.js +2 -2
- package/lib/engine/engine_patcher.d.ts +10 -10
- package/lib/engine/engine_patcher.js +142 -142
- package/lib/engine/engine_physics.d.ts +152 -152
- package/lib/engine/engine_physics.js +645 -645
- package/lib/engine/engine_physics.types.d.ts +40 -40
- package/lib/engine/engine_physics.types.js +33 -33
- package/lib/engine/engine_physics_rapier.d.ts +147 -147
- package/lib/engine/engine_physics_rapier.js +1433 -1433
- package/lib/engine/engine_playerview.d.ts +26 -26
- package/lib/engine/engine_playerview.js +64 -64
- package/lib/engine/engine_scenelighting.d.ts +71 -71
- package/lib/engine/engine_scenelighting.js +226 -226
- package/lib/engine/engine_serialization.d.ts +3 -3
- package/lib/engine/engine_serialization.js +3 -3
- package/lib/engine/engine_serialization_builtin_serializer.d.ts +72 -72
- package/lib/engine/engine_serialization_builtin_serializer.js +403 -403
- package/lib/engine/engine_serialization_core.d.ts +94 -94
- package/lib/engine/engine_serialization_core.js +607 -607
- package/lib/engine/engine_serialization_decorator.d.ts +23 -23
- package/lib/engine/engine_serialization_decorator.js +66 -66
- package/lib/engine/engine_setup.d.ts +1 -1
- package/lib/engine/engine_setup.js +2 -2
- package/lib/engine/engine_shaders.d.ts +53 -53
- package/lib/engine/engine_shaders.js +252 -252
- package/lib/engine/engine_shims.d.ts +4 -4
- package/lib/engine/engine_shims.js +24 -24
- package/lib/engine/engine_test_utils.d.ts +39 -39
- package/lib/engine/engine_test_utils.js +83 -83
- package/lib/engine/engine_texture.d.ts +28 -28
- package/lib/engine/engine_texture.js +64 -64
- package/lib/engine/engine_three_utils.d.ts +204 -204
- package/lib/engine/engine_three_utils.js +788 -788
- package/lib/engine/engine_time.d.ts +51 -51
- package/lib/engine/engine_time.js +82 -82
- package/lib/engine/engine_time_utils.d.ts +88 -88
- package/lib/engine/engine_time_utils.js +215 -215
- package/lib/engine/engine_tonemapping.d.ts +6 -6
- package/lib/engine/engine_tonemapping.js +197 -197
- package/lib/engine/engine_types.d.ts +578 -578
- package/lib/engine/engine_types.js +95 -95
- package/lib/engine/engine_typestore.d.ts +28 -28
- package/lib/engine/engine_typestore.js +55 -55
- package/lib/engine/engine_util_decorator.d.ts +13 -13
- package/lib/engine/engine_util_decorator.js +116 -116
- package/lib/engine/engine_utils.d.ts +248 -248
- package/lib/engine/engine_utils.js +1012 -1012
- package/lib/engine/engine_utils_format.d.ts +24 -24
- package/lib/engine/engine_utils_format.js +239 -239
- package/lib/engine/engine_utils_screenshot.d.ts +159 -159
- package/lib/engine/engine_utils_screenshot.js +522 -522
- package/lib/engine/engine_utils_screenshot.xr.d.ts +5 -5
- package/lib/engine/engine_utils_screenshot.xr.js +90 -90
- package/lib/engine/engine_xr.d.ts +1 -1
- package/lib/engine/engine_xr.js +1 -1
- package/lib/engine/export/gltf/Writers.d.ts +19 -19
- package/lib/engine/export/gltf/Writers.js +24 -24
- package/lib/engine/export/gltf/index.d.ts +11 -11
- package/lib/engine/export/gltf/index.js +123 -123
- package/lib/engine/export/index.d.ts +2 -2
- package/lib/engine/export/index.js +2 -2
- package/lib/engine/export/state.d.ts +7 -7
- package/lib/engine/export/state.js +17 -17
- package/lib/engine/export/utils.d.ts +2 -2
- package/lib/engine/export/utils.js +7 -7
- package/lib/engine/extensions/EXT_texture_exr.d.ts +8 -8
- package/lib/engine/extensions/EXT_texture_exr.js +32 -32
- package/lib/engine/extensions/NEEDLE_animator_controller_model.d.ts +122 -122
- package/lib/engine/extensions/NEEDLE_animator_controller_model.js +95 -95
- package/lib/engine/extensions/NEEDLE_components.d.ts +35 -35
- package/lib/engine/extensions/NEEDLE_components.js +220 -220
- package/lib/engine/extensions/NEEDLE_gameobject_data.d.ts +10 -10
- package/lib/engine/extensions/NEEDLE_gameobject_data.js +57 -57
- package/lib/engine/extensions/NEEDLE_lighting_settings.d.ts +37 -37
- package/lib/engine/extensions/NEEDLE_lighting_settings.js +157 -157
- package/lib/engine/extensions/NEEDLE_lightmaps.d.ts +18 -18
- package/lib/engine/extensions/NEEDLE_lightmaps.js +99 -99
- package/lib/engine/extensions/NEEDLE_persistent_assets.d.ts +11 -11
- package/lib/engine/extensions/NEEDLE_persistent_assets.js +63 -63
- package/lib/engine/extensions/NEEDLE_progressive.d.ts +1 -1
- package/lib/engine/extensions/NEEDLE_progressive.js +1 -1
- package/lib/engine/extensions/NEEDLE_render_objects.d.ts +13 -13
- package/lib/engine/extensions/NEEDLE_render_objects.js +159 -159
- package/lib/engine/extensions/NEEDLE_techniques_webgl.d.ts +38 -38
- package/lib/engine/extensions/NEEDLE_techniques_webgl.js +564 -564
- package/lib/engine/extensions/extension_resolver.d.ts +4 -4
- package/lib/engine/extensions/extension_resolver.js +1 -1
- package/lib/engine/extensions/extension_utils.d.ts +12 -12
- package/lib/engine/extensions/extension_utils.js +152 -152
- package/lib/engine/extensions/extensions.d.ts +32 -32
- package/lib/engine/extensions/extensions.js +107 -107
- package/lib/engine/extensions/index.d.ts +6 -6
- package/lib/engine/extensions/index.js +6 -6
- package/lib/engine/extensions/usage_tracker.d.ts +13 -13
- package/lib/engine/extensions/usage_tracker.js +65 -65
- package/lib/engine/js-extensions/Camera.d.ts +1 -1
- package/lib/engine/js-extensions/Camera.js +39 -39
- package/lib/engine/js-extensions/ExtensionUtils.d.ts +9 -9
- package/lib/engine/js-extensions/ExtensionUtils.js +67 -67
- package/lib/engine/js-extensions/Layers.d.ts +6 -6
- package/lib/engine/js-extensions/Layers.js +22 -22
- package/lib/engine/js-extensions/Object3D.d.ts +120 -120
- package/lib/engine/js-extensions/Object3D.js +136 -136
- package/lib/engine/js-extensions/RGBAColor.d.ts +23 -23
- package/lib/engine/js-extensions/RGBAColor.js +111 -111
- package/lib/engine/js-extensions/Vector.d.ts +3 -3
- package/lib/engine/js-extensions/Vector.js +13 -13
- package/lib/engine/js-extensions/index.d.ts +5 -5
- package/lib/engine/js-extensions/index.js +5 -5
- package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.d.ts +4 -4
- package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +79 -79
- package/lib/engine/shaders/shaderData.d.ts +55 -55
- package/lib/engine/shaders/shaderData.js +58 -58
- package/lib/engine/tests/test_utils.d.ts +2 -2
- package/lib/engine/tests/test_utils.js +53 -53
- package/lib/engine/webcomponents/WebXRButtons.d.ts +56 -56
- package/lib/engine/webcomponents/WebXRButtons.js +230 -230
- package/lib/engine/webcomponents/api.d.ts +5 -5
- package/lib/engine/webcomponents/api.js +4 -4
- package/lib/engine/webcomponents/buttons.d.ts +51 -51
- package/lib/engine/webcomponents/buttons.js +264 -264
- package/lib/engine/webcomponents/fonts.d.ts +9 -9
- package/lib/engine/webcomponents/fonts.js +32 -32
- package/lib/engine/webcomponents/icons.d.ts +9 -9
- package/lib/engine/webcomponents/icons.js +52 -52
- package/lib/engine/webcomponents/index.d.ts +1 -1
- package/lib/engine/webcomponents/index.js +1 -1
- package/lib/engine/webcomponents/logo-element.d.ts +10 -10
- package/lib/engine/webcomponents/logo-element.js +67 -67
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.d.ts +37 -37
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +513 -513
- package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +155 -155
- package/lib/engine/webcomponents/needle menu/needle-menu.js +1029 -1029
- package/lib/engine/webcomponents/needle-button.d.ts +34 -34
- package/lib/engine/webcomponents/needle-button.js +161 -161
- package/lib/engine/webcomponents/needle-engine.ar-overlay.d.ts +21 -21
- package/lib/engine/webcomponents/needle-engine.ar-overlay.js +166 -166
- package/lib/engine/webcomponents/needle-engine.attributes.d.ts +69 -69
- package/lib/engine/webcomponents/needle-engine.attributes.js +1 -1
- package/lib/engine/webcomponents/needle-engine.d.ts +116 -116
- package/lib/engine/webcomponents/needle-engine.extras.d.ts +6 -6
- package/lib/engine/webcomponents/needle-engine.extras.js +13 -13
- package/lib/engine/webcomponents/needle-engine.js +821 -821
- package/lib/engine/webcomponents/needle-engine.loading.d.ts +44 -44
- package/lib/engine/webcomponents/needle-engine.loading.js +341 -341
- package/lib/engine/xr/NeedleXRController.d.ts +313 -313
- package/lib/engine/xr/NeedleXRController.js +1007 -1007
- package/lib/engine/xr/NeedleXRSession.d.ts +340 -340
- package/lib/engine/xr/NeedleXRSession.js +1463 -1463
- package/lib/engine/xr/NeedleXRSync.d.ts +22 -22
- package/lib/engine/xr/NeedleXRSync.js +188 -188
- package/lib/engine/xr/SceneTransition.d.ts +18 -18
- package/lib/engine/xr/SceneTransition.js +69 -69
- package/lib/engine/xr/TempXRContext.d.ts +34 -34
- package/lib/engine/xr/TempXRContext.js +187 -187
- package/lib/engine/xr/XRRig.d.ts +7 -7
- package/lib/engine/xr/XRRig.js +1 -1
- package/lib/engine/xr/api.d.ts +6 -6
- package/lib/engine/xr/api.js +6 -6
- package/lib/engine/xr/events.d.ts +66 -66
- package/lib/engine/xr/events.js +93 -93
- package/lib/engine/xr/internal.d.ts +12 -12
- package/lib/engine/xr/internal.js +25 -25
- package/lib/engine/xr/usdz.d.ts +12 -12
- package/lib/engine/xr/usdz.js +29 -29
- package/lib/engine/xr/utils.d.ts +11 -11
- package/lib/engine/xr/utils.js +34 -34
- package/lib/engine-components/AlignmentConstraint.d.ts +10 -10
- package/lib/engine-components/AlignmentConstraint.js +39 -39
- package/lib/engine-components/Animation.d.ts +156 -156
- package/lib/engine-components/Animation.js +508 -508
- package/lib/engine-components/AnimationCurve.d.ts +40 -40
- package/lib/engine-components/AnimationCurve.js +159 -159
- package/lib/engine-components/AnimationUtils.d.ts +8 -8
- package/lib/engine-components/AnimationUtils.js +27 -27
- package/lib/engine-components/AnimationUtilsAutoplay.d.ts +1 -1
- package/lib/engine-components/AnimationUtilsAutoplay.js +39 -39
- package/lib/engine-components/Animator.d.ts +217 -217
- package/lib/engine-components/Animator.js +354 -354
- package/lib/engine-components/AnimatorController.d.ts +227 -227
- package/lib/engine-components/AnimatorController.js +1152 -1152
- package/lib/engine-components/AudioListener.d.ts +33 -33
- package/lib/engine-components/AudioListener.js +86 -86
- package/lib/engine-components/AudioSource.d.ts +217 -217
- package/lib/engine-components/AudioSource.js +635 -635
- package/lib/engine-components/AvatarLoader.d.ts +80 -80
- package/lib/engine-components/AvatarLoader.js +231 -231
- package/lib/engine-components/AxesHelper.d.ts +32 -32
- package/lib/engine-components/AxesHelper.js +67 -67
- package/lib/engine-components/BasicIKConstraint.d.ts +9 -9
- package/lib/engine-components/BasicIKConstraint.js +43 -43
- package/lib/engine-components/BoxCollider.d.ts +2 -2
- package/lib/engine-components/BoxCollider.js +2 -2
- package/lib/engine-components/BoxHelperComponent.d.ts +47 -47
- package/lib/engine-components/BoxHelperComponent.js +102 -102
- package/lib/engine-components/Camera.d.ts +231 -231
- package/lib/engine-components/Camera.js +700 -700
- package/lib/engine-components/CameraUtils.d.ts +1 -1
- package/lib/engine-components/CameraUtils.js +123 -123
- package/lib/engine-components/CharacterController.d.ts +55 -55
- package/lib/engine-components/CharacterController.js +236 -236
- package/lib/engine-components/Collider.d.ts +188 -188
- package/lib/engine-components/Collider.js +369 -369
- package/lib/engine-components/Component.d.ts +792 -792
- package/lib/engine-components/Component.js +920 -920
- package/lib/engine-components/ContactShadows.d.ts +94 -94
- package/lib/engine-components/ContactShadows.js +453 -453
- package/lib/engine-components/DeleteBox.d.ts +19 -19
- package/lib/engine-components/DeleteBox.js +58 -58
- package/lib/engine-components/DeviceFlag.d.ts +16 -16
- package/lib/engine-components/DeviceFlag.js +47 -47
- package/lib/engine-components/DragControls.d.ts +170 -170
- package/lib/engine-components/DragControls.js +1421 -1421
- package/lib/engine-components/DropListener.d.ts +215 -215
- package/lib/engine-components/DropListener.js +642 -642
- package/lib/engine-components/Duplicatable.d.ts +35 -35
- package/lib/engine-components/Duplicatable.js +202 -202
- package/lib/engine-components/EventList.d.ts +54 -54
- package/lib/engine-components/EventList.js +232 -232
- package/lib/engine-components/EventTrigger.d.ts +33 -33
- package/lib/engine-components/EventTrigger.js +75 -75
- package/lib/engine-components/EventType.d.ts +22 -22
- package/lib/engine-components/EventType.js +23 -23
- package/lib/engine-components/Fog.d.ts +22 -22
- package/lib/engine-components/Fog.js +61 -61
- package/lib/engine-components/Gizmos.d.ts +17 -17
- package/lib/engine-components/Gizmos.js +64 -64
- package/lib/engine-components/GridHelper.d.ts +20 -20
- package/lib/engine-components/GridHelper.js +54 -54
- package/lib/engine-components/GroundProjection.d.ts +67 -67
- package/lib/engine-components/GroundProjection.js +343 -343
- package/lib/engine-components/Interactable.d.ts +12 -12
- package/lib/engine-components/Interactable.js +12 -12
- package/lib/engine-components/Joints.d.ts +19 -19
- package/lib/engine-components/Joints.js +51 -51
- package/lib/engine-components/LODGroup.d.ts +35 -35
- package/lib/engine-components/LODGroup.js +152 -152
- package/lib/engine-components/Light.d.ts +180 -180
- package/lib/engine-components/Light.js +535 -535
- package/lib/engine-components/LookAtConstraint.d.ts +19 -19
- package/lib/engine-components/LookAtConstraint.js +35 -35
- package/lib/engine-components/NeedleMenu.d.ts +50 -50
- package/lib/engine-components/NeedleMenu.js +92 -92
- package/lib/engine-components/NestedGltf.d.ts +25 -25
- package/lib/engine-components/NestedGltf.js +88 -88
- package/lib/engine-components/Networking.d.ts +54 -54
- package/lib/engine-components/Networking.js +112 -112
- package/lib/engine-components/OffsetConstraint.d.ts +14 -14
- package/lib/engine-components/OffsetConstraint.js +65 -65
- package/lib/engine-components/OrbitControls.d.ts +268 -268
- package/lib/engine-components/OrbitControls.js +1015 -1015
- package/lib/engine-components/PlayerColor.d.ts +19 -19
- package/lib/engine-components/PlayerColor.js +94 -94
- package/lib/engine-components/ReflectionProbe.d.ts +28 -28
- package/lib/engine-components/ReflectionProbe.js +204 -204
- package/lib/engine-components/Renderer.d.ts +153 -153
- package/lib/engine-components/Renderer.js +834 -834
- package/lib/engine-components/RendererInstancing.d.ts +140 -140
- package/lib/engine-components/RendererInstancing.js +744 -744
- package/lib/engine-components/RendererInstancing.js.map +1 -1
- package/lib/engine-components/RendererLightmap.d.ts +24 -24
- package/lib/engine-components/RendererLightmap.js +182 -182
- package/lib/engine-components/RigidBody.d.ts +155 -155
- package/lib/engine-components/RigidBody.js +517 -517
- package/lib/engine-components/SceneSwitcher.d.ts +263 -263
- package/lib/engine-components/SceneSwitcher.js +971 -971
- package/lib/engine-components/ScreenCapture.d.ts +144 -144
- package/lib/engine-components/ScreenCapture.js +547 -547
- package/lib/engine-components/ShadowCatcher.d.ts +33 -33
- package/lib/engine-components/ShadowCatcher.js +166 -166
- package/lib/engine-components/Skybox.d.ts +88 -88
- package/lib/engine-components/Skybox.js +469 -469
- package/lib/engine-components/SmoothFollow.d.ts +34 -34
- package/lib/engine-components/SmoothFollow.js +82 -82
- package/lib/engine-components/SpatialTrigger.d.ts +102 -102
- package/lib/engine-components/SpatialTrigger.js +225 -225
- package/lib/engine-components/SpectatorCamera.d.ts +111 -111
- package/lib/engine-components/SpectatorCamera.js +715 -715
- package/lib/engine-components/SphereCollider.d.ts +2 -2
- package/lib/engine-components/SphereCollider.js +2 -2
- package/lib/engine-components/SpriteRenderer.d.ts +132 -132
- package/lib/engine-components/SpriteRenderer.js +472 -472
- package/lib/engine-components/SyncedCamera.d.ts +41 -41
- package/lib/engine-components/SyncedCamera.js +199 -199
- package/lib/engine-components/SyncedRoom.d.ts +106 -106
- package/lib/engine-components/SyncedRoom.js +371 -371
- package/lib/engine-components/SyncedTransform.d.ts +94 -94
- package/lib/engine-components/SyncedTransform.js +331 -331
- package/lib/engine-components/TestRunner.d.ts +16 -16
- package/lib/engine-components/TestRunner.js +102 -102
- package/lib/engine-components/TransformGizmo.d.ts +75 -75
- package/lib/engine-components/TransformGizmo.js +209 -209
- package/lib/engine-components/VideoPlayer.d.ts +184 -184
- package/lib/engine-components/VideoPlayer.js +978 -978
- package/lib/engine-components/Voip.d.ts +67 -67
- package/lib/engine-components/Voip.js +360 -360
- package/lib/engine-components/api.d.ts +51 -51
- package/lib/engine-components/api.js +50 -50
- package/lib/engine-components/avatar/AvatarBlink_Simple.d.ts +11 -11
- package/lib/engine-components/avatar/AvatarBlink_Simple.js +76 -76
- package/lib/engine-components/avatar/AvatarEyeLook_Rotation.d.ts +14 -14
- package/lib/engine-components/avatar/AvatarEyeLook_Rotation.js +68 -68
- package/lib/engine-components/avatar/Avatar_Brain_LookAt.d.ts +29 -29
- package/lib/engine-components/avatar/Avatar_Brain_LookAt.js +121 -121
- package/lib/engine-components/avatar/Avatar_MouthShapes.d.ts +15 -15
- package/lib/engine-components/avatar/Avatar_MouthShapes.js +79 -79
- package/lib/engine-components/avatar/Avatar_MustacheShake.d.ts +9 -9
- package/lib/engine-components/avatar/Avatar_MustacheShake.js +29 -29
- package/lib/engine-components/codegen/components.d.ts +216 -216
- package/lib/engine-components/codegen/components.js +218 -218
- package/lib/engine-components/debug/LogStats.d.ts +5 -5
- package/lib/engine-components/debug/LogStats.js +18 -18
- package/lib/engine-components/export/gltf/GltfExport.d.ts +30 -30
- package/lib/engine-components/export/gltf/GltfExport.js +246 -246
- package/lib/engine-components/export/gltf/index.d.ts +1 -1
- package/lib/engine-components/export/gltf/index.js +1 -1
- package/lib/engine-components/export/index.d.ts +1 -1
- package/lib/engine-components/export/index.js +1 -1
- package/lib/engine-components/export/usdz/Extension.d.ts +22 -22
- package/lib/engine-components/export/usdz/Extension.js +1 -1
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.d.ts +162 -162
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.js +1789 -1789
- package/lib/engine-components/export/usdz/USDZExporter.d.ts +130 -130
- package/lib/engine-components/export/usdz/USDZExporter.js +663 -663
- package/lib/engine-components/export/usdz/extensions/Animation.d.ts +106 -106
- package/lib/engine-components/export/usdz/extensions/Animation.js +1071 -1071
- package/lib/engine-components/export/usdz/extensions/DocumentExtension.d.ts +5 -5
- package/lib/engine-components/export/usdz/extensions/DocumentExtension.js +6 -6
- package/lib/engine-components/export/usdz/extensions/NodeMaterialConverter.d.ts +10 -10
- package/lib/engine-components/export/usdz/extensions/NodeMaterialConverter.js +451 -451
- package/lib/engine-components/export/usdz/extensions/USDZText.d.ts +54 -54
- package/lib/engine-components/export/usdz/extensions/USDZText.js +203 -203
- package/lib/engine-components/export/usdz/extensions/USDZUI.d.ts +8 -8
- package/lib/engine-components/export/usdz/extensions/USDZUI.js +158 -158
- package/lib/engine-components/export/usdz/extensions/behavior/Actions.d.ts +30 -30
- package/lib/engine-components/export/usdz/extensions/behavior/Actions.js +88 -88
- package/lib/engine-components/export/usdz/extensions/behavior/AudioExtension.d.ts +10 -10
- package/lib/engine-components/export/usdz/extensions/behavior/AudioExtension.js +86 -86
- package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.d.ts +28 -28
- package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.js +290 -290
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +190 -190
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +1060 -1060
- package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.d.ts +135 -135
- package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js +548 -548
- package/lib/engine-components/export/usdz/extensions/behavior/PhysicsExtension.d.ts +7 -7
- package/lib/engine-components/export/usdz/extensions/behavior/PhysicsExtension.js +115 -115
- package/lib/engine-components/export/usdz/index.d.ts +3 -3
- package/lib/engine-components/export/usdz/index.js +2 -2
- package/lib/engine-components/export/usdz/utils/animationutils.d.ts +7 -7
- package/lib/engine-components/export/usdz/utils/animationutils.js +163 -163
- package/lib/engine-components/export/usdz/utils/quicklook.d.ts +2 -2
- package/lib/engine-components/export/usdz/utils/quicklook.js +43 -43
- package/lib/engine-components/particlesystem/ParticleSystem.d.ts +177 -177
- package/lib/engine-components/particlesystem/ParticleSystem.js +1176 -1176
- package/lib/engine-components/particlesystem/ParticleSystemModules.d.ts +526 -526
- package/lib/engine-components/particlesystem/ParticleSystemModules.js +1930 -1930
- package/lib/engine-components/particlesystem/ParticleSystemSubEmitter.d.ts +25 -25
- package/lib/engine-components/particlesystem/ParticleSystemSubEmitter.js +87 -87
- package/lib/engine-components/particlesystem/api.d.ts +2 -2
- package/lib/engine-components/particlesystem/api.js +2 -2
- package/lib/engine-components/postprocessing/Effects/Antialiasing.d.ts +17 -17
- package/lib/engine-components/postprocessing/Effects/Antialiasing.js +59 -59
- package/lib/engine-components/postprocessing/Effects/BloomEffect.d.ts +46 -46
- package/lib/engine-components/postprocessing/Effects/BloomEffect.js +113 -113
- package/lib/engine-components/postprocessing/Effects/ChromaticAberration.d.ts +11 -11
- package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js +39 -39
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.d.ts +23 -23
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js +111 -111
- package/lib/engine-components/postprocessing/Effects/DepthOfField.d.ts +25 -25
- package/lib/engine-components/postprocessing/Effects/DepthOfField.js +104 -104
- package/lib/engine-components/postprocessing/Effects/EffectWrapper.d.ts +12 -12
- package/lib/engine-components/postprocessing/Effects/EffectWrapper.js +18 -18
- package/lib/engine-components/postprocessing/Effects/Pixelation.d.ts +11 -11
- package/lib/engine-components/postprocessing/Effects/Pixelation.js +32 -32
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.d.ts +18 -18
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js +91 -91
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.d.ts +70 -70
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js +176 -176
- package/lib/engine-components/postprocessing/Effects/Sharpening.d.ts +18 -18
- package/lib/engine-components/postprocessing/Effects/Sharpening.js +127 -127
- package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.d.ts +17 -17
- package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.js +70 -70
- package/lib/engine-components/postprocessing/Effects/Tonemapping.d.ts +19 -19
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js +94 -94
- package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.d.ts +13 -13
- package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.js +51 -51
- package/lib/engine-components/postprocessing/Effects/Vignette.d.ts +15 -15
- package/lib/engine-components/postprocessing/Effects/Vignette.js +60 -60
- package/lib/engine-components/postprocessing/PostProcessingEffect.d.ts +90 -90
- package/lib/engine-components/postprocessing/PostProcessingEffect.js +168 -168
- package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +42 -42
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +494 -494
- package/lib/engine-components/postprocessing/Volume.d.ts +90 -90
- package/lib/engine-components/postprocessing/Volume.js +385 -385
- package/lib/engine-components/postprocessing/VolumeParameter.d.ts +26 -26
- package/lib/engine-components/postprocessing/VolumeParameter.js +136 -136
- package/lib/engine-components/postprocessing/VolumeProfile.d.ts +15 -15
- package/lib/engine-components/postprocessing/VolumeProfile.js +60 -60
- package/lib/engine-components/postprocessing/index.d.ts +6 -6
- package/lib/engine-components/postprocessing/index.js +6 -6
- package/lib/engine-components/postprocessing/utils.d.ts +55 -55
- package/lib/engine-components/postprocessing/utils.js +119 -119
- package/lib/engine-components/timeline/PlayableDirector.d.ts +163 -163
- package/lib/engine-components/timeline/PlayableDirector.js +686 -686
- package/lib/engine-components/timeline/SignalAsset.d.ts +24 -24
- package/lib/engine-components/timeline/SignalAsset.js +130 -130
- package/lib/engine-components/timeline/TimelineModels.d.ts +89 -89
- package/lib/engine-components/timeline/TimelineModels.js +22 -22
- package/lib/engine-components/timeline/TimelineTracks.d.ts +110 -110
- package/lib/engine-components/timeline/TimelineTracks.js +879 -879
- package/lib/engine-components/timeline/index.d.ts +4 -4
- package/lib/engine-components/timeline/index.js +3 -3
- package/lib/engine-components/ui/BaseUIComponent.d.ts +48 -48
- package/lib/engine-components/ui/BaseUIComponent.js +170 -170
- package/lib/engine-components/ui/Button.d.ts +64 -64
- package/lib/engine-components/ui/Button.js +315 -315
- package/lib/engine-components/ui/Canvas.d.ts +74 -74
- package/lib/engine-components/ui/Canvas.js +407 -407
- package/lib/engine-components/ui/CanvasGroup.d.ts +19 -19
- package/lib/engine-components/ui/CanvasGroup.js +58 -58
- package/lib/engine-components/ui/EventSystem.d.ts +125 -125
- package/lib/engine-components/ui/EventSystem.js +765 -765
- package/lib/engine-components/ui/Graphic.d.ts +55 -55
- package/lib/engine-components/ui/Graphic.js +255 -255
- package/lib/engine-components/ui/Image.d.ts +35 -35
- package/lib/engine-components/ui/Image.js +116 -116
- package/lib/engine-components/ui/InputField.d.ts +42 -42
- package/lib/engine-components/ui/InputField.js +268 -268
- package/lib/engine-components/ui/Interfaces.d.ts +38 -38
- package/lib/engine-components/ui/Interfaces.js +12 -12
- package/lib/engine-components/ui/Layout.d.ts +84 -84
- package/lib/engine-components/ui/Layout.js +330 -330
- package/lib/engine-components/ui/Outline.d.ts +7 -7
- package/lib/engine-components/ui/Outline.js +20 -20
- package/lib/engine-components/ui/PointerEvents.d.ts +115 -115
- package/lib/engine-components/ui/PointerEvents.js +145 -145
- package/lib/engine-components/ui/RaycastUtils.d.ts +11 -11
- package/lib/engine-components/ui/RaycastUtils.js +67 -67
- package/lib/engine-components/ui/Raycaster.d.ts +30 -30
- package/lib/engine-components/ui/Raycaster.js +95 -95
- package/lib/engine-components/ui/RectTransform.d.ts +61 -61
- package/lib/engine-components/ui/RectTransform.js +356 -356
- package/lib/engine-components/ui/SpatialHtml.d.ts +8 -8
- package/lib/engine-components/ui/SpatialHtml.js +79 -79
- package/lib/engine-components/ui/Symbols.d.ts +1 -1
- package/lib/engine-components/ui/Symbols.js +1 -1
- package/lib/engine-components/ui/Text.d.ts +78 -78
- package/lib/engine-components/ui/Text.js +539 -539
- package/lib/engine-components/ui/Utils.d.ts +24 -24
- package/lib/engine-components/ui/Utils.js +90 -90
- package/lib/engine-components/ui/index.d.ts +1 -1
- package/lib/engine-components/ui/index.js +1 -1
- package/lib/engine-components/utils/EnvironmentScene.d.ts +5 -5
- package/lib/engine-components/utils/EnvironmentScene.js +205 -205
- package/lib/engine-components/utils/LookAt.d.ts +31 -31
- package/lib/engine-components/utils/LookAt.js +82 -82
- package/lib/engine-components/utils/OpenURL.d.ts +42 -42
- package/lib/engine-components/utils/OpenURL.js +119 -119
- package/lib/engine-components/webxr/Avatar.d.ts +25 -25
- package/lib/engine-components/webxr/Avatar.js +255 -255
- package/lib/engine-components/webxr/TeleportTarget.d.ts +7 -7
- package/lib/engine-components/webxr/TeleportTarget.js +7 -7
- package/lib/engine-components/webxr/WebARCameraBackground.d.ts +30 -30
- package/lib/engine-components/webxr/WebARCameraBackground.js +155 -155
- package/lib/engine-components/webxr/WebARSessionRoot.d.ts +98 -98
- package/lib/engine-components/webxr/WebARSessionRoot.js +770 -770
- package/lib/engine-components/webxr/WebXR.d.ts +232 -232
- package/lib/engine-components/webxr/WebXR.js +561 -561
- package/lib/engine-components/webxr/WebXRAvatar.d.ts +27 -27
- package/lib/engine-components/webxr/WebXRAvatar.js +44 -44
- package/lib/engine-components/webxr/WebXRImageTracking.d.ts +86 -86
- package/lib/engine-components/webxr/WebXRImageTracking.js +471 -471
- package/lib/engine-components/webxr/WebXRPlaneTracking.d.ts +92 -92
- package/lib/engine-components/webxr/WebXRPlaneTracking.js +500 -500
- package/lib/engine-components/webxr/WebXRRig.d.ts +32 -32
- package/lib/engine-components/webxr/WebXRRig.js +72 -72
- package/lib/engine-components/webxr/XRFlag.d.ts +38 -38
- package/lib/engine-components/webxr/XRFlag.js +139 -139
- package/lib/engine-components/webxr/controllers/XRControllerFollow.d.ts +47 -47
- package/lib/engine-components/webxr/controllers/XRControllerFollow.js +120 -120
- package/lib/engine-components/webxr/controllers/XRControllerModel.d.ts +43 -43
- package/lib/engine-components/webxr/controllers/XRControllerModel.js +352 -352
- package/lib/engine-components/webxr/controllers/XRControllerMovement.d.ts +78 -78
- package/lib/engine-components/webxr/controllers/XRControllerMovement.js +506 -506
- package/lib/engine-components/webxr/index.d.ts +3 -3
- package/lib/engine-components/webxr/index.js +3 -3
- package/lib/engine-components/webxr/types.d.ts +3 -3
- package/lib/engine-components/webxr/types.js +1 -1
- package/lib/engine-components-experimental/Presentation.d.ts +6 -6
- package/lib/engine-components-experimental/Presentation.js +9 -9
- package/lib/engine-components-experimental/api.d.ts +4 -4
- package/lib/engine-components-experimental/api.js +4 -4
- package/lib/engine-components-experimental/networking/PlayerSync.d.ts +156 -156
- package/lib/engine-components-experimental/networking/PlayerSync.js +377 -377
- package/lib/engine-schemes/api.d.ts +12 -12
- package/lib/engine-schemes/api.js +12 -12
- package/lib/engine-schemes/schemes.d.ts +7 -7
- package/lib/engine-schemes/schemes.js +19 -19
- package/lib/engine-schemes/synced-camera-model.d.ts +25 -25
- package/lib/engine-schemes/synced-camera-model.js +67 -67
- package/lib/engine-schemes/synced-transform-model.d.ts +31 -31
- package/lib/engine-schemes/synced-transform-model.js +66 -66
- package/lib/engine-schemes/transform.d.ts +12 -12
- package/lib/engine-schemes/transform.js +39 -39
- package/lib/engine-schemes/vec2.d.ts +10 -10
- package/lib/engine-schemes/vec2.js +25 -25
- package/lib/engine-schemes/vec3.d.ts +11 -11
- package/lib/engine-schemes/vec3.js +29 -29
- package/lib/engine-schemes/vec4.d.ts +12 -12
- package/lib/engine-schemes/vec4.js +33 -33
- package/lib/engine-schemes/vr-user-state-buffer.d.ts +37 -37
- package/lib/engine-schemes/vr-user-state-buffer.js +110 -110
- package/lib/include/three/EXT_mesh_gpu_instancing_exporter.d.ts +6 -6
- package/lib/include/three/EXT_mesh_gpu_instancing_exporter.js +45 -45
- package/lib/needle-engine.d.ts +7 -7
- package/lib/needle-engine.js +64 -64
- package/package.json +2 -2
- package/plugins/common/buildinfo.js +64 -64
- package/plugins/common/cloud.js +1 -1
- package/plugins/common/config.cjs +31 -31
- package/plugins/common/config.js +35 -35
- package/plugins/common/files.js +31 -31
- package/plugins/common/generator.js +10 -10
- package/plugins/common/license.js +452 -452
- package/plugins/common/logger.js +327 -327
- package/plugins/common/npm.js +15 -15
- package/plugins/common/timers.js +7 -7
- package/plugins/common/version.js +37 -37
- package/plugins/gltf-packer.mjs +1 -1
- package/plugins/next/alias.cjs +39 -39
- package/plugins/next/license.cjs +24 -24
- package/plugins/next/meshbvhworker.cjs +18 -18
- package/plugins/next/next.js +141 -141
- package/plugins/types/index.d.ts +2 -2
- package/plugins/types/license.d.ts +24 -24
- package/plugins/types/needleConfig.d.ts +27 -27
- package/plugins/types/next.d.ts +2 -2
- package/plugins/types/userconfig.d.ts +124 -124
- package/plugins/types/vite.d.ts +13 -13
- package/plugins/types/webmanifest.d.ts +32 -32
- package/plugins/vite/alias.js +189 -189
- package/plugins/vite/asap.js +251 -251
- package/plugins/vite/build-pipeline.js +371 -371
- package/plugins/vite/build.js +19 -19
- package/plugins/vite/buildinfo.js +41 -41
- package/plugins/vite/config.js +106 -106
- package/plugins/vite/copyfiles.js +138 -138
- package/plugins/vite/defines.js +70 -70
- package/plugins/vite/dependencies.js +232 -232
- package/plugins/vite/dependency-watcher.js +237 -237
- package/plugins/vite/drop-client.js +76 -76
- package/plugins/vite/drop.js +87 -87
- package/plugins/vite/editor-connection.js +124 -124
- package/plugins/vite/facebook-instant-games.js +102 -102
- package/plugins/vite/gzip.js +5 -5
- package/plugins/vite/imports-logger.js +143 -143
- package/plugins/vite/index.js +147 -147
- package/plugins/vite/license.js +56 -56
- package/plugins/vite/local-files.js +440 -440
- package/plugins/vite/logger.client.js +272 -272
- package/plugins/vite/logger.js +100 -100
- package/plugins/vite/materialx.js +31 -31
- package/plugins/vite/meta.js +163 -163
- package/plugins/vite/npm.js +7 -7
- package/plugins/vite/peer.js +29 -29
- package/plugins/vite/poster-client.js +73 -73
- package/plugins/vite/poster.js +79 -79
- package/plugins/vite/pwa.js +604 -604
- package/plugins/vite/reload-client.js +15 -15
- package/plugins/vite/reload.js +351 -351
- package/plugins/vite/server.js +66 -66
- package/plugins/vite/transform-codegen.js +55 -55
- package/plugins/vite/transform.js +32 -32
- package/plugins/vite/vite-4.4-hack.js +31 -31
- package/src/asap/needle-asap.ts +111 -111
- package/src/asap/sessiongranted.ts +75 -75
- package/src/asap/utils.ts +4 -4
- package/src/engine/analytics/index.ts +10 -10
- package/src/engine/analytics/lcp.ts +35 -35
- package/src/engine/api.ts +82 -82
- package/src/engine/assets/index.ts +59 -59
- package/src/engine/assets/static.js +5 -5
- package/src/engine/codegen/register_types.ts +300 -300
- package/src/engine/debug/debug.ts +51 -51
- package/src/engine/debug/debug_console.ts +333 -333
- package/src/engine/debug/debug_overlay.ts +332 -332
- package/src/engine/debug/debug_spatial_console.ts +429 -429
- package/src/engine/debug/index.ts +1 -1
- package/src/engine/engine_addressables.ts +671 -671
- package/src/engine/engine_animation.ts +145 -145
- package/src/engine/engine_application.ts +113 -113
- package/src/engine/engine_assetdatabase.ts +389 -389
- package/src/engine/engine_audio.ts +24 -24
- package/src/engine/engine_camera.ts +39 -39
- package/src/engine/engine_components.ts +366 -366
- package/src/engine/engine_components_internal.ts +40 -40
- package/src/engine/engine_constants.ts +52 -52
- package/src/engine/engine_context.ts +1824 -1824
- package/src/engine/engine_context_registry.ts +129 -129
- package/src/engine/engine_coroutine.ts +54 -54
- package/src/engine/engine_create_objects.ts +411 -411
- package/src/engine/engine_default_parameters.ts +3 -3
- package/src/engine/engine_editor-sync.ts +28 -28
- package/src/engine/engine_fileloader.js +9 -9
- package/src/engine/engine_gameobject.ts +712 -712
- package/src/engine/engine_generic_utils.js +13 -13
- package/src/engine/engine_gizmos.ts +577 -577
- package/src/engine/engine_gltf.ts +29 -29
- package/src/engine/engine_gltf_builtin_components.ts +403 -403
- package/src/engine/engine_hot_reload.ts +210 -210
- package/src/engine/engine_input.ts +1500 -1500
- package/src/engine/engine_input_utils.ts +23 -23
- package/src/engine/engine_instancing.ts +45 -45
- package/src/engine/engine_license.ts +386 -386
- package/src/engine/engine_lifecycle_api.ts +113 -113
- package/src/engine/engine_lifecycle_functions_internal.ts +193 -193
- package/src/engine/engine_lightdata.ts +125 -125
- package/src/engine/engine_loaders.callbacks.ts +136 -136
- package/src/engine/engine_loaders.gltf.ts +82 -82
- package/src/engine/engine_loaders.ts +378 -378
- package/src/engine/engine_lods.ts +186 -186
- package/src/engine/engine_mainloop_utils.ts +472 -472
- package/src/engine/engine_math.ts +282 -282
- package/src/engine/engine_modules.ts +83 -83
- package/src/engine/engine_networking.ts +862 -862
- package/src/engine/engine_networking_auto.ts +352 -352
- package/src/engine/engine_networking_blob.ts +275 -275
- package/src/engine/engine_networking_files.ts +217 -217
- package/src/engine/engine_networking_files_default_components.ts +58 -58
- package/src/engine/engine_networking_instantiate.ts +419 -419
- package/src/engine/engine_networking_peer.ts +159 -159
- package/src/engine/engine_networking_streams.ts +713 -713
- package/src/engine/engine_networking_types.ts +24 -24
- package/src/engine/engine_networking_utils.ts +23 -23
- package/src/engine/engine_networking_websocket.ts +2 -2
- package/src/engine/engine_patcher.ts +199 -199
- package/src/engine/engine_physics.ts +783 -783
- package/src/engine/engine_physics.types.ts +46 -46
- package/src/engine/engine_physics_rapier.ts +1577 -1577
- package/src/engine/engine_playerview.ts +80 -80
- package/src/engine/engine_scenelighting.ts +294 -294
- package/src/engine/engine_serialization.ts +2 -2
- package/src/engine/engine_serialization_builtin_serializer.ts +473 -473
- package/src/engine/engine_serialization_core.ts +720 -720
- package/src/engine/engine_serialization_decorator.ts +80 -80
- package/src/engine/engine_setup.ts +1 -1
- package/src/engine/engine_shaders.ts +267 -267
- package/src/engine/engine_shims.ts +32 -32
- package/src/engine/engine_test_utils.ts +109 -109
- package/src/engine/engine_texture.ts +82 -82
- package/src/engine/engine_three_utils.ts +928 -928
- package/src/engine/engine_time.ts +94 -94
- package/src/engine/engine_time_utils.ts +237 -237
- package/src/engine/engine_tonemapping.ts +208 -208
- package/src/engine/engine_types.ts +730 -730
- package/src/engine/engine_typestore.ts +63 -63
- package/src/engine/engine_util_decorator.ts +136 -136
- package/src/engine/engine_utils.ts +1115 -1115
- package/src/engine/engine_utils_format.ts +273 -273
- package/src/engine/engine_utils_screenshot.ts +708 -708
- package/src/engine/engine_utils_screenshot.xr.ts +103 -103
- package/src/engine/export/gltf/Writers.ts +34 -34
- package/src/engine/export/gltf/index.ts +158 -158
- package/src/engine/export/index.ts +2 -2
- package/src/engine/export/state.ts +19 -19
- package/src/engine/export/utils.ts +9 -9
- package/src/engine/extensions/EXT_texture_exr.ts +50 -50
- package/src/engine/extensions/NEEDLE_animator_controller_model.ts +195 -195
- package/src/engine/extensions/NEEDLE_components.ts +268 -268
- package/src/engine/extensions/NEEDLE_gameobject_data.ts +81 -81
- package/src/engine/extensions/NEEDLE_lighting_settings.ts +185 -185
- package/src/engine/extensions/NEEDLE_lightmaps.ts +119 -119
- package/src/engine/extensions/NEEDLE_persistent_assets.ts +76 -76
- package/src/engine/extensions/NEEDLE_render_objects.ts +209 -209
- package/src/engine/extensions/NEEDLE_techniques_webgl.ts +640 -640
- package/src/engine/extensions/extension_resolver.ts +4 -4
- package/src/engine/extensions/extension_utils.ts +166 -166
- package/src/engine/extensions/extensions.ts +140 -140
- package/src/engine/extensions/index.ts +5 -5
- package/src/engine/extensions/usage_tracker.ts +100 -100
- package/src/engine/js-extensions/Camera.ts +37 -37
- package/src/engine/js-extensions/ExtensionUtils.ts +85 -85
- package/src/engine/js-extensions/Layers.ts +23 -23
- package/src/engine/js-extensions/Object3D.ts +296 -296
- package/src/engine/js-extensions/RGBAColor.ts +126 -126
- package/src/engine/js-extensions/Vector.ts +18 -18
- package/src/engine/js-extensions/index.ts +4 -4
- package/src/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +125 -125
- package/src/engine/shaders/shaderData.ts +67 -67
- package/src/engine/tests/test_utils.ts +63 -63
- package/src/engine/webcomponents/WebXRButtons.ts +260 -260
- package/src/engine/webcomponents/api.ts +6 -6
- package/src/engine/webcomponents/buttons.ts +292 -292
- package/src/engine/webcomponents/fonts.ts +41 -41
- package/src/engine/webcomponents/icons.ts +57 -57
- package/src/engine/webcomponents/index.ts +1 -1
- package/src/engine/webcomponents/logo-element.ts +78 -78
- package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +573 -573
- package/src/engine/webcomponents/needle menu/needle-menu.ts +1118 -1118
- package/src/engine/webcomponents/needle-button.ts +181 -181
- package/src/engine/webcomponents/needle-engine.ar-overlay.ts +186 -186
- package/src/engine/webcomponents/needle-engine.attributes.ts +82 -82
- package/src/engine/webcomponents/needle-engine.extras.ts +16 -16
- package/src/engine/webcomponents/needle-engine.loading.ts +373 -373
- package/src/engine/webcomponents/needle-engine.ts +860 -860
- package/src/engine/xr/NeedleXRController.ts +1125 -1125
- package/src/engine/xr/NeedleXRSession.ts +1624 -1624
- package/src/engine/xr/NeedleXRSync.ts +220 -220
- package/src/engine/xr/SceneTransition.ts +78 -78
- package/src/engine/xr/TempXRContext.ts +216 -216
- package/src/engine/xr/XRRig.ts +9 -9
- package/src/engine/xr/api.ts +5 -5
- package/src/engine/xr/events.ts +102 -102
- package/src/engine/xr/internal.ts +34 -34
- package/src/engine/xr/usdz.ts +30 -30
- package/src/engine/xr/utils.ts +39 -39
- package/src/engine-components/AlignmentConstraint.ts +36 -36
- package/src/engine-components/Animation.ts +557 -557
- package/src/engine-components/AnimationCurve.ts +150 -150
- package/src/engine-components/AnimationUtils.ts +28 -28
- package/src/engine-components/AnimationUtilsAutoplay.ts +43 -43
- package/src/engine-components/Animator.ts +397 -397
- package/src/engine-components/AnimatorController.ts +1293 -1293
- package/src/engine-components/AudioListener.ts +92 -92
- package/src/engine-components/AudioSource.ts +644 -644
- package/src/engine-components/AvatarLoader.ts +263 -263
- package/src/engine-components/AxesHelper.ts +59 -59
- package/src/engine-components/BasicIKConstraint.ts +54 -54
- package/src/engine-components/BoxCollider.ts +1 -1
- package/src/engine-components/BoxHelperComponent.ts +114 -114
- package/src/engine-components/Camera.ts +719 -719
- package/src/engine-components/CameraUtils.ts +138 -138
- package/src/engine-components/CharacterController.ts +253 -253
- package/src/engine-components/Collider.ts +374 -374
- package/src/engine-components/Component.ts +1297 -1297
- package/src/engine-components/ContactShadows.ts +506 -506
- package/src/engine-components/DeleteBox.ts +62 -62
- package/src/engine-components/DeviceFlag.ts +46 -46
- package/src/engine-components/DragControls.ts +1623 -1623
- package/src/engine-components/DropListener.ts +713 -713
- package/src/engine-components/Duplicatable.ts +198 -198
- package/src/engine-components/EventList.ts +266 -266
- package/src/engine-components/EventTrigger.ts +74 -74
- package/src/engine-components/EventType.ts +22 -22
- package/src/engine-components/Fog.ts +60 -60
- package/src/engine-components/Gizmos.ts +56 -56
- package/src/engine-components/GridHelper.ts +48 -48
- package/src/engine-components/GroundProjection.ts +356 -356
- package/src/engine-components/Interactable.ts +14 -14
- package/src/engine-components/Joints.ts +52 -52
- package/src/engine-components/LODGroup.ts +153 -153
- package/src/engine-components/Light.ts +558 -558
- package/src/engine-components/LookAtConstraint.ts +25 -25
- package/src/engine-components/NeedleMenu.ts +84 -84
- package/src/engine-components/NestedGltf.ts +86 -86
- package/src/engine-components/Networking.ts +114 -114
- package/src/engine-components/OffsetConstraint.ts +60 -60
- package/src/engine-components/OrbitControls.ts +1074 -1074
- package/src/engine-components/PlayerColor.ts +103 -103
- package/src/engine-components/ReflectionProbe.ts +220 -220
- package/src/engine-components/Renderer.ts +903 -903
- package/src/engine-components/RendererInstancing.ts +855 -855
- package/src/engine-components/RendererLightmap.ts +198 -198
- package/src/engine-components/RigidBody.ts +526 -526
- package/src/engine-components/SceneSwitcher.ts +1030 -1030
- package/src/engine-components/ScreenCapture.ts +592 -592
- package/src/engine-components/ShadowCatcher.ts +172 -172
- package/src/engine-components/Skybox.ts +475 -475
- package/src/engine-components/SmoothFollow.ts +76 -76
- package/src/engine-components/SpatialTrigger.ts +229 -229
- package/src/engine-components/SpectatorCamera.ts +787 -787
- package/src/engine-components/SphereCollider.ts +1 -1
- package/src/engine-components/SpriteRenderer.ts +468 -468
- package/src/engine-components/SyncedCamera.ts +220 -220
- package/src/engine-components/SyncedRoom.ts +380 -380
- package/src/engine-components/SyncedTransform.ts +383 -383
- package/src/engine-components/TestRunner.ts +118 -118
- package/src/engine-components/TransformGizmo.ts +219 -219
- package/src/engine-components/VideoPlayer.ts +1025 -1025
- package/src/engine-components/Voip.ts +363 -363
- package/src/engine-components/api.ts +60 -60
- package/src/engine-components/avatar/AvatarBlink_Simple.ts +69 -69
- package/src/engine-components/avatar/AvatarEyeLook_Rotation.ts +63 -63
- package/src/engine-components/avatar/Avatar_Brain_LookAt.ts +139 -139
- package/src/engine-components/avatar/Avatar_MouthShapes.ts +83 -83
- package/src/engine-components/avatar/Avatar_MustacheShake.ts +31 -31
- package/src/engine-components/codegen/components.ts +217 -217
- package/src/engine-components/debug/LogStats.ts +21 -21
- package/src/engine-components/export/gltf/GltfExport.ts +265 -265
- package/src/engine-components/export/usdz/Extension.ts +24 -24
- package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +2426 -2426
- package/src/engine-components/export/usdz/USDZExporter.ts +705 -705
- package/src/engine-components/export/usdz/extensions/Animation.ts +1204 -1204
- package/src/engine-components/export/usdz/extensions/DocumentExtension.ts +9 -9
- package/src/engine-components/export/usdz/extensions/NodeMaterialConverter.ts +532 -532
- package/src/engine-components/export/usdz/extensions/USDZText.ts +240 -240
- package/src/engine-components/export/usdz/extensions/USDZUI.ts +189 -189
- package/src/engine-components/export/usdz/extensions/behavior/Actions.ts +99 -99
- package/src/engine-components/export/usdz/extensions/behavior/AudioExtension.ts +102 -102
- package/src/engine-components/export/usdz/extensions/behavior/Behaviour.ts +320 -320
- package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +1225 -1225
- package/src/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.ts +646 -646
- package/src/engine-components/export/usdz/extensions/behavior/PhysicsExtension.ts +132 -132
- package/src/engine-components/export/usdz/index.ts +2 -2
- package/src/engine-components/export/usdz/utils/animationutils.ts +191 -191
- package/src/engine-components/export/usdz/utils/quicklook.ts +50 -50
- package/src/engine-components/particlesystem/ParticleSystem.ts +1287 -1287
- package/src/engine-components/particlesystem/ParticleSystemModules.ts +1765 -1765
- package/src/engine-components/particlesystem/ParticleSystemSubEmitter.ts +111 -111
- package/src/engine-components/particlesystem/api.ts +1 -1
- package/src/engine-components/postprocessing/Effects/Antialiasing.ts +64 -64
- package/src/engine-components/postprocessing/Effects/BloomEffect.ts +116 -116
- package/src/engine-components/postprocessing/Effects/ChromaticAberration.ts +37 -37
- package/src/engine-components/postprocessing/Effects/ColorAdjustments.ts +106 -106
- package/src/engine-components/postprocessing/Effects/DepthOfField.ts +103 -103
- package/src/engine-components/postprocessing/Effects/EffectWrapper.ts +25 -25
- package/src/engine-components/postprocessing/Effects/Pixelation.ts +32 -32
- package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts +90 -90
- package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.ts +192 -192
- package/src/engine-components/postprocessing/Effects/Sharpening.ts +143 -143
- package/src/engine-components/postprocessing/Effects/TiltShiftEffect.ts +61 -61
- package/src/engine-components/postprocessing/Effects/Tonemapping.ts +103 -103
- package/src/engine-components/postprocessing/Effects/Tonemapping.utils.ts +60 -60
- package/src/engine-components/postprocessing/Effects/Vignette.ts +59 -59
- package/src/engine-components/postprocessing/PostProcessingEffect.ts +192 -192
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +572 -572
- package/src/engine-components/postprocessing/Volume.ts +426 -426
- package/src/engine-components/postprocessing/VolumeParameter.ts +158 -158
- package/src/engine-components/postprocessing/VolumeProfile.ts +61 -61
- package/src/engine-components/postprocessing/index.ts +5 -5
- package/src/engine-components/postprocessing/utils.ts +154 -154
- package/src/engine-components/timeline/PlayableDirector.ts +722 -722
- package/src/engine-components/timeline/SignalAsset.ts +144 -144
- package/src/engine-components/timeline/TimelineModels.ts +92 -92
- package/src/engine-components/timeline/TimelineTracks.ts +967 -967
- package/src/engine-components/timeline/index.ts +3 -3
- package/src/engine-components/ui/BaseUIComponent.ts +203 -203
- package/src/engine-components/ui/Button.ts +307 -307
- package/src/engine-components/ui/Canvas.ts +419 -419
- package/src/engine-components/ui/CanvasGroup.ts +54 -54
- package/src/engine-components/ui/EventSystem.ts +854 -854
- package/src/engine-components/ui/Graphic.ts +275 -275
- package/src/engine-components/ui/Image.ts +112 -112
- package/src/engine-components/ui/InputField.ts +321 -321
- package/src/engine-components/ui/Interfaces.ts +57 -57
- package/src/engine-components/ui/Layout.ts +334 -334
- package/src/engine-components/ui/Outline.ts +13 -13
- package/src/engine-components/ui/PointerEvents.ts +206 -206
- package/src/engine-components/ui/RaycastUtils.ts +69 -69
- package/src/engine-components/ui/Raycaster.ts +102 -102
- package/src/engine-components/ui/RectTransform.ts +375 -375
- package/src/engine-components/ui/SpatialHtml.ts +79 -79
- package/src/engine-components/ui/Symbols.ts +1 -1
- package/src/engine-components/ui/Text.ts +578 -578
- package/src/engine-components/ui/Utils.ts +113 -113
- package/src/engine-components/utils/EnvironmentScene.ts +245 -245
- package/src/engine-components/utils/LookAt.ts +88 -88
- package/src/engine-components/utils/OpenURL.ts +114 -114
- package/src/engine-components/webxr/Avatar.ts +265 -265
- package/src/engine-components/webxr/TeleportTarget.ts +9 -9
- package/src/engine-components/webxr/WebARCameraBackground.ts +175 -175
- package/src/engine-components/webxr/WebARSessionRoot.ts +880 -880
- package/src/engine-components/webxr/WebXR.ts +585 -585
- package/src/engine-components/webxr/WebXRAvatar.ts +66 -66
- package/src/engine-components/webxr/WebXRImageTracking.ts +519 -519
- package/src/engine-components/webxr/WebXRPlaneTracking.ts +570 -570
- package/src/engine-components/webxr/WebXRRig.ts +77 -77
- package/src/engine-components/webxr/XRFlag.ts +147 -147
- package/src/engine-components/webxr/controllers/XRControllerFollow.ts +118 -118
- package/src/engine-components/webxr/controllers/XRControllerModel.ts +373 -373
- package/src/engine-components/webxr/controllers/XRControllerMovement.ts +550 -550
- package/src/engine-components/webxr/index.ts +2 -2
- package/src/engine-components/webxr/types.ts +3 -3
- package/src/engine-components-experimental/Presentation.ts +12 -12
- package/src/engine-components-experimental/api.ts +4 -4
- package/src/engine-components-experimental/networking/PlayerSync.ts +401 -401
- package/src/engine-schemes/COMPILE_SCHEMES.bat +3 -3
- package/src/engine-schemes/COMPILE_TS.bat +11 -11
- package/src/engine-schemes/README.md +1 -1
- package/src/engine-schemes/api.ts +12 -12
- package/src/engine-schemes/dist/api.js +17 -0
- package/src/engine-schemes/dist/api.js.meta +7 -0
- package/src/engine-schemes/dist/schemes.js +25 -0
- package/src/engine-schemes/dist/schemes.js.meta +7 -0
- package/src/engine-schemes/dist/synced-camera-model.js +74 -0
- package/src/engine-schemes/dist/synced-camera-model.js.meta +7 -0
- package/src/engine-schemes/dist/synced-transform-model.js +73 -0
- package/src/engine-schemes/dist/synced-transform-model.js.meta +7 -0
- package/src/engine-schemes/dist/transform.js +46 -0
- package/src/engine-schemes/dist/transform.js.meta +7 -0
- package/src/engine-schemes/dist/vec2.js +32 -0
- package/src/engine-schemes/dist/vec2.js.meta +7 -0
- package/src/engine-schemes/dist/vec3.js +36 -0
- package/src/engine-schemes/dist/vec3.js.meta +7 -0
- package/src/engine-schemes/dist/vec4.js +40 -0
- package/src/engine-schemes/dist/vec4.js.meta +7 -0
- package/src/engine-schemes/dist/vr-user-state-buffer.js +110 -0
- package/src/engine-schemes/dist/vr-user-state-buffer.js.meta +7 -0
- package/src/engine-schemes/schemes.ts +28 -28
- package/src/engine-schemes/synced-camera-model.ts +92 -92
- package/src/engine-schemes/synced-transform-model.ts +90 -90
- package/src/engine-schemes/syncedCamera.fbs +10 -10
- package/src/engine-schemes/transform.ts +50 -50
- package/src/engine-schemes/transforms.fbs +25 -25
- package/src/engine-schemes/vec.fbs +19 -19
- package/src/engine-schemes/vec2.ts +33 -33
- package/src/engine-schemes/vec3.ts +38 -38
- package/src/engine-schemes/vec4.ts +43 -43
- package/src/engine-schemes/vr-user-state-buffer.ts +145 -145
- package/src/engine-schemes/vrUserStateBuffer.fbs +17 -17
- package/src/include/draco/draco_decoder.js +34 -34
- package/src/include/ktx2/basis_transcoder.js +21 -21
- package/src/include/needle/arial-msdf.json +1471 -1471
- package/src/include/three/DragControls.js +231 -231
- package/src/include/three/EXT_mesh_gpu_instancing_exporter.js +66 -66
- package/src/needle-engine.ts +70 -70
- package/dist/generateMeshBVH.worker-BaNp_Xtp.js +0 -25
- package/dist/gltf-progressive-60Qk5ebF.min.js +0 -8
- package/dist/gltf-progressive-DM5ZiecW.js +0 -1060
- package/dist/gltf-progressive-wxtaVmio.umd.cjs +0 -8
|
@@ -3771,7 +3771,7 @@ void main() {
|
|
|
3771
3771
|
`;return s.precision==="highp"?e+=`
|
|
3772
3772
|
#define HIGH_PRECISION`:s.precision==="mediump"?e+=`
|
|
3773
3773
|
#define MEDIUM_PRECISION`:s.precision==="lowp"&&(e+=`
|
|
3774
|
-
#define LOW_PRECISION`),e}function cR(s){let e="SHADOWMAP_TYPE_BASIC";return s.shadowMapType===Rf?e="SHADOWMAP_TYPE_PCF":s.shadowMapType===If?e="SHADOWMAP_TYPE_PCF_SOFT":s.shadowMapType===oi&&(e="SHADOWMAP_TYPE_VSM"),e}function lR(s){let e="ENVMAP_TYPE_CUBE";if(s.envMap)switch(s.envMapMode){case wi:case Vi:e="ENVMAP_TYPE_CUBE";break;case to:e="ENVMAP_TYPE_CUBE_UV";break}return e}function uR(s){let e="ENVMAP_MODE_REFLECTION";if(s.envMap)switch(s.envMapMode){case Vi:e="ENVMAP_MODE_REFRACTION";break}return e}function hR(s){let e="ENVMAP_BLENDING_NONE";if(s.envMap)switch(s.combine){case da:e="ENVMAP_BLENDING_MULTIPLY";break;case Df:e="ENVMAP_BLENDING_MIX";break;case Uf:e="ENVMAP_BLENDING_ADD";break}return e}function dR(s){const e=s.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),
|
|
3774
|
+
#define LOW_PRECISION`),e}function cR(s){let e="SHADOWMAP_TYPE_BASIC";return s.shadowMapType===Rf?e="SHADOWMAP_TYPE_PCF":s.shadowMapType===If?e="SHADOWMAP_TYPE_PCF_SOFT":s.shadowMapType===oi&&(e="SHADOWMAP_TYPE_VSM"),e}function lR(s){let e="ENVMAP_TYPE_CUBE";if(s.envMap)switch(s.envMapMode){case wi:case Vi:e="ENVMAP_TYPE_CUBE";break;case to:e="ENVMAP_TYPE_CUBE_UV";break}return e}function uR(s){let e="ENVMAP_MODE_REFLECTION";if(s.envMap)switch(s.envMapMode){case Vi:e="ENVMAP_MODE_REFRACTION";break}return e}function hR(s){let e="ENVMAP_BLENDING_NONE";if(s.envMap)switch(s.combine){case da:e="ENVMAP_BLENDING_MULTIPLY";break;case Df:e="ENVMAP_BLENDING_MIX";break;case Uf:e="ENVMAP_BLENDING_ADD";break}return e}function dR(s){const e=s.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function pR(s,e,t,n){const i=s.getContext(),r=t.defines;let o=t.vertexShader,a=t.fragmentShader;const c=cR(t),l=lR(t),u=uR(t),h=hR(t),d=dR(t),p=eR(t),f=tR(r),x=i.createProgram();let m,g,y=t.glslVersion?"#version "+t.glslVersion+`
|
|
3775
3775
|
`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,f].filter(Za).join(`
|
|
3776
3776
|
`),m.length>0&&(m+=`
|
|
3777
3777
|
`),g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,f].filter(Za).join(`
|
|
@@ -3844,7 +3844,7 @@ void main() {
|
|
|
3844
3844
|
|
|
3845
3845
|
}
|
|
3846
3846
|
|
|
3847
|
-
}`;class kR{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const i=new Xt,r=e.properties.get(i);r.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new ki({vertexShader:BR,fragmentShader:zR,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new kt(new so(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class GR extends Ai{constructor(e,t){super();const n=this;let i=null,r=1,o=null,a="local-floor",c=1,l=null,u=null,h=null,d=null,p=null,f=null;const x=new kR,m=t.getContextAttributes();let g=null,y=null;const _=[],v=[],I=new J;let T=null;const w=new hn;w.layers.enable(1),w.viewport=new st;const C=new hn;C.layers.enable(2),C.viewport=new st;const F=[w,C],M=new sm;M.layers.enable(1),M.layers.enable(2);let b=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.controllerAutoUpdate=!0,this.getController=function(ne){let ue=_[ne];return ue===void 0&&(ue=new gp,_[ne]=ue),ue.getTargetRaySpace()},this.getControllerGrip=function(ne){let ue=_[ne];return ue===void 0&&(ue=new gp,_[ne]=ue),ue.getGripSpace()},this.getHand=function(ne){let ue=_[ne];return ue===void 0&&(ue=new gp,_[ne]=ue),ue.getHandSpace()};function W(ne){const ue=v.indexOf(ne.inputSource);if(ue===-1)return;const Ae=_[ue];Ae!==void 0&&(Ae.update(ne.inputSource,ne.frame,l||o),Ae.dispatchEvent({type:ne.type,data:ne.inputSource}))}function $(){i.removeEventListener("select",W),i.removeEventListener("selectstart",W),i.removeEventListener("selectend",W),i.removeEventListener("squeeze",W),i.removeEventListener("squeezestart",W),i.removeEventListener("squeezeend",W),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",ie);for(let ne=0;ne<_.length;ne++){const ue=v[ne];ue!==null&&(v[ne]=null,_[ne]&&_[ne].disconnect(ue))}b=null,G=null,x.reset(),e.setRenderTarget(g),p=null,d=null,h=null,i=null,y=null,ht.stop(),n.isPresenting=!1,e.setPixelRatio(T),e.setSize(I.width,I.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ne){r=ne,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ne){a=ne,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(ne){l=ne},this.getBaseLayer=function(){return d!==null?d:p},this.getBinding=function(){return h},this.getFrame=function(){return f},this.getSession=function(){return i},this.setSession=async function(ne){if(i=ne,i!==null){if(g=e.getRenderTarget(),i.addEventListener("select",W),i.addEventListener("selectstart",W),i.addEventListener("selectend",W),i.addEventListener("squeeze",W),i.addEventListener("squeezestart",W),i.addEventListener("squeezeend",W),i.addEventListener("end",$),i.addEventListener("inputsourceschange",ie),m.xrCompatible!==!0&&await t.makeXRCompatible(),T=e.getPixelRatio(),e.getSize(I),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let Ae=null,ge=null,Ze=null;m.depth&&(Ze=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Ae=m.stencil?ar:Qs,ge=m.stencil?or:Bi);const Xe={colorFormat:t.RGBA8,depthFormat:Ze,scaleFactor:r};h=new XRWebGLBinding(i,t),d=h.createProjectionLayer(Xe),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),y=new zi(d.textureWidth,d.textureHeight,{format:Rn,type:Qi,depthTexture:new oo(d.textureWidth,d.textureHeight,ge,void 0,void 0,void 0,void 0,void 0,void 0,Ae),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1})}else{const Ae={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};p=new XRWebGLLayer(i,t,Ae),i.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),y=new zi(p.framebufferWidth,p.framebufferHeight,{format:Rn,type:Qi,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}y.isXRRenderTarget=!0,this.setFoveation(c),l=null,o=await i.requestReferenceSpace(a),ht.setContext(i),ht.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return x.getDepthTexture()};function ie(ne){for(let ue=0;ue<ne.removed.length;ue++){const Ae=ne.removed[ue],ge=v.indexOf(Ae);ge>=0&&(v[ge]=null,_[ge]&&_[ge].disconnect(Ae))}for(let ue=0;ue<ne.added.length;ue++){const Ae=ne.added[ue];let ge=v.indexOf(Ae);if(ge===-1){for(let Xe=0;Xe<_.length;Xe++)if(Xe>=v.length){v.push(Ae),ge=Xe;break}else if(v[Xe]===null){v[Xe]=Ae,ge=Xe;break}if(ge===-1)break}const Ze=_[ge];Ze&&Ze.connect(Ae)}}const q=new E,he=new E;function Q(ne,ue,Ae){q.setFromMatrixPosition(ue.matrixWorld),he.setFromMatrixPosition(Ae.matrixWorld);const ge=q.distanceTo(he),Ze=ue.projectionMatrix.elements,Xe=Ae.projectionMatrix.elements,Je=Ze[14]/(Ze[10]-1),dt=Ze[14]/(Ze[10]+1),ae=(Ze[9]+1)/Ze[5],P=(Ze[9]-1)/Ze[5],Me=(Ze[8]-1)/Ze[0],ye=(Xe[8]+1)/Xe[0],de=Je*Me,Te=Je*ye,qe=ge/(-Me+ye),Ie=qe*-Me;if(ue.matrixWorld.decompose(ne.position,ne.quaternion,ne.scale),ne.translateX(Ie),ne.translateZ(qe),ne.matrixWorld.compose(ne.position,ne.quaternion,ne.scale),ne.matrixWorldInverse.copy(ne.matrixWorld).invert(),Ze[10]===-1)ne.projectionMatrix.copy(ue.projectionMatrix),ne.projectionMatrixInverse.copy(ue.projectionMatrixInverse);else{const R=Je+qe,S=dt+qe,X=de-Ie,se=Te+(ge-Ie),ce=ae*dt/S*R,re=P*dt/S*R;ne.projectionMatrix.makePerspective(X,se,ce,re,R,S),ne.projectionMatrixInverse.copy(ne.projectionMatrix).invert()}}function we(ne,ue){ue===null?ne.matrixWorld.copy(ne.matrix):ne.matrixWorld.multiplyMatrices(ue.matrixWorld,ne.matrix),ne.matrixWorldInverse.copy(ne.matrixWorld).invert()}this.updateCamera=function(ne){if(i===null)return;let ue=ne.near,Ae=ne.far;x.texture!==null&&(x.depthNear>0&&(ue=x.depthNear),x.depthFar>0&&(Ae=x.depthFar)),M.near=C.near=w.near=ue,M.far=C.far=w.far=Ae,(b!==M.near||G!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),b=M.near,G=M.far);const ge=ne.parent,Ze=M.cameras;we(M,ge);for(let Xe=0;Xe<Ze.length;Xe++)we(Ze[Xe],ge);Ze.length===2?Q(M,w,C):M.projectionMatrix.copy(w.projectionMatrix),Ne(ne,M,ge)};function Ne(ne,ue,Ae){Ae===null?ne.matrix.copy(ue.matrixWorld):(ne.matrix.copy(Ae.matrixWorld),ne.matrix.invert(),ne.matrix.multiply(ue.matrixWorld)),ne.matrix.decompose(ne.position,ne.quaternion,ne.scale),ne.updateMatrixWorld(!0),ne.projectionMatrix.copy(ue.projectionMatrix),ne.projectionMatrixInverse.copy(ue.projectionMatrixInverse),ne.isPerspectiveCamera&&(ne.fov=ia*2*Math.atan(1/ne.projectionMatrix.elements[5]),ne.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(d===null&&p===null))return c},this.setFoveation=function(ne){c=ne,d!==null&&(d.fixedFoveation=ne),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=ne)},this.hasDepthSensing=function(){return x.texture!==null},this.getDepthSensingMesh=function(){return x.getMesh(M)};let Ee=null;function Qe(ne,ue){if(u=ue.getViewerPose(l||o),f=ue,u!==null){const Ae=u.views;p!==null&&(e.setRenderTargetFramebuffer(y,p.framebuffer),e.setRenderTarget(y));let ge=!1;Ae.length!==M.cameras.length&&(M.cameras.length=0,ge=!0);for(let Xe=0;Xe<Ae.length;Xe++){const Je=Ae[Xe];let dt=null;if(p!==null)dt=p.getViewport(Je);else{const P=h.getViewSubImage(d,Je);dt=P.viewport,Xe===0&&(e.setRenderTargetTextures(y,P.colorTexture,d.ignoreDepthValues?void 0:P.depthStencilTexture),e.setRenderTarget(y))}let ae=F[Xe];ae===void 0&&(ae=new hn,ae.layers.enable(Xe),ae.viewport=new st,F[Xe]=ae),ae.matrix.fromArray(Je.transform.matrix),ae.matrix.decompose(ae.position,ae.quaternion,ae.scale),ae.projectionMatrix.fromArray(Je.projectionMatrix),ae.projectionMatrixInverse.copy(ae.projectionMatrix).invert(),ae.viewport.set(dt.x,dt.y,dt.width,dt.height),Xe===0&&(M.matrix.copy(ae.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),ge===!0&&M.cameras.push(ae)}const Ze=i.enabledFeatures;if(Ze&&Ze.includes("depth-sensing")){const Xe=h.getDepthInformation(Ae[0]);Xe&&Xe.isValid&&Xe.texture&&x.init(e,Xe,i.renderState)}}if(n.controllerAutoUpdate)for(let Ae=0;Ae<_.length;Ae++){const ge=v[Ae],Ze=_[Ae];ge!==null&&Ze!==void 0&&Ze.update(ge,ue,l||o)}Ee&&Ee(ne,ue),ue.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ue}),f=null}const ht=new zy;ht.setAnimationLoop(Qe),this.setAnimationLoop=function(ne){Ee=ne},this.dispose=function(){}}}const br=new ui,HR=new Fe;function WR(s,e){function t(m,g){m.matrixAutoUpdate===!0&&m.updateMatrix(),g.value.copy(m.matrix)}function n(m,g){g.color.getRGB(m.fogColor.value,By(s)),g.isFog?(m.fogNear.value=g.near,m.fogFar.value=g.far):g.isFogExp2&&(m.fogDensity.value=g.density)}function i(m,g,y,_,v){g.isMeshBasicMaterial||g.isMeshLambertMaterial?r(m,g):g.isMeshToonMaterial?(r(m,g),h(m,g)):g.isMeshPhongMaterial?(r(m,g),u(m,g)):g.isMeshStandardMaterial?(r(m,g),d(m,g),g.isMeshPhysicalMaterial&&p(m,g,v)):g.isMeshMatcapMaterial?(r(m,g),f(m,g)):g.isMeshDepthMaterial?r(m,g):g.isMeshDistanceMaterial?(r(m,g),x(m,g)):g.isMeshNormalMaterial?r(m,g):g.isLineBasicMaterial?(o(m,g),g.isLineDashedMaterial&&a(m,g)):g.isPointsMaterial?c(m,g,y,_):g.isSpriteMaterial?l(m,g):g.isShadowMaterial?(m.color.value.copy(g.color),m.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function r(m,g){m.opacity.value=g.opacity,g.color&&m.diffuse.value.copy(g.color),g.emissive&&m.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(m.map.value=g.map,t(g.map,m.mapTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,t(g.alphaMap,m.alphaMapTransform)),g.bumpMap&&(m.bumpMap.value=g.bumpMap,t(g.bumpMap,m.bumpMapTransform),m.bumpScale.value=g.bumpScale,g.side===ln&&(m.bumpScale.value*=-1)),g.normalMap&&(m.normalMap.value=g.normalMap,t(g.normalMap,m.normalMapTransform),m.normalScale.value.copy(g.normalScale),g.side===ln&&m.normalScale.value.negate()),g.displacementMap&&(m.displacementMap.value=g.displacementMap,t(g.displacementMap,m.displacementMapTransform),m.displacementScale.value=g.displacementScale,m.displacementBias.value=g.displacementBias),g.emissiveMap&&(m.emissiveMap.value=g.emissiveMap,t(g.emissiveMap,m.emissiveMapTransform)),g.specularMap&&(m.specularMap.value=g.specularMap,t(g.specularMap,m.specularMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);const y=e.get(g),_=y.envMap,v=y.envMapRotation;_&&(m.envMap.value=_,br.copy(v),br.x*=-1,br.y*=-1,br.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(br.y*=-1,br.z*=-1),m.envMapRotation.value.setFromMatrix4(HR.makeRotationFromEuler(br)),m.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=g.reflectivity,m.ior.value=g.ior,m.refractionRatio.value=g.refractionRatio),g.lightMap&&(m.lightMap.value=g.lightMap,m.lightMapIntensity.value=g.lightMapIntensity,t(g.lightMap,m.lightMapTransform)),g.aoMap&&(m.aoMap.value=g.aoMap,m.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,m.aoMapTransform))}function o(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,g.map&&(m.map.value=g.map,t(g.map,m.mapTransform))}function a(m,g){m.dashSize.value=g.dashSize,m.totalSize.value=g.dashSize+g.gapSize,m.scale.value=g.scale}function c(m,g,y,_){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.size.value=g.size*y,m.scale.value=_*.5,g.map&&(m.map.value=g.map,t(g.map,m.uvTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,t(g.alphaMap,m.alphaMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest)}function l(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.rotation.value=g.rotation,g.map&&(m.map.value=g.map,t(g.map,m.mapTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,t(g.alphaMap,m.alphaMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest)}function u(m,g){m.specular.value.copy(g.specular),m.shininess.value=Math.max(g.shininess,1e-4)}function h(m,g){g.gradientMap&&(m.gradientMap.value=g.gradientMap)}function d(m,g){m.metalness.value=g.metalness,g.metalnessMap&&(m.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,m.metalnessMapTransform)),m.roughness.value=g.roughness,g.roughnessMap&&(m.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,m.roughnessMapTransform)),g.envMap&&(m.envMapIntensity.value=g.envMapIntensity)}function p(m,g,y){m.ior.value=g.ior,g.sheen>0&&(m.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),m.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(m.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,m.sheenColorMapTransform)),g.sheenRoughnessMap&&(m.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,m.sheenRoughnessMapTransform))),g.clearcoat>0&&(m.clearcoat.value=g.clearcoat,m.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(m.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,m.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(m.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===ln&&m.clearcoatNormalScale.value.negate())),g.dispersion>0&&(m.dispersion.value=g.dispersion),g.iridescence>0&&(m.iridescence.value=g.iridescence,m.iridescenceIOR.value=g.iridescenceIOR,m.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(m.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,m.iridescenceMapTransform)),g.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),g.transmission>0&&(m.transmission.value=g.transmission,m.transmissionSamplerMap.value=y.texture,m.transmissionSamplerSize.value.set(y.width,y.height),g.transmissionMap&&(m.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,m.transmissionMapTransform)),m.thickness.value=g.thickness,g.thicknessMap&&(m.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=g.attenuationDistance,m.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(m.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(m.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=g.specularIntensity,m.specularColor.value.copy(g.specularColor),g.specularColorMap&&(m.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,m.specularColorMapTransform)),g.specularIntensityMap&&(m.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,m.specularIntensityMapTransform))}function f(m,g){g.matcap&&(m.matcap.value=g.matcap)}function x(m,g){const y=e.get(g).light;m.referencePosition.value.setFromMatrixPosition(y.matrixWorld),m.nearDistance.value=y.shadow.camera.near,m.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function XR(s,e,t,n){let i={},r={},o=[];const a=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function c(y,_){const v=_.program;n.uniformBlockBinding(y,v)}function l(y,_){let v=i[y.id];v===void 0&&(f(y),v=u(y),i[y.id]=v,y.addEventListener("dispose",m));const I=_.program;n.updateUBOMapping(y,I);const T=e.render.frame;r[y.id]!==T&&(d(y),r[y.id]=T)}function u(y){const _=h();y.__bindingPointIndex=_;const v=s.createBuffer(),I=y.__size,T=y.usage;return s.bindBuffer(s.UNIFORM_BUFFER,v),s.bufferData(s.UNIFORM_BUFFER,I,T),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,_,v),v}function h(){for(let y=0;y<a;y++)if(o.indexOf(y)===-1)return o.push(y),y;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(y){const _=i[y.id],v=y.uniforms,I=y.__cache;s.bindBuffer(s.UNIFORM_BUFFER,_);for(let T=0,w=v.length;T<w;T++){const C=Array.isArray(v[T])?v[T]:[v[T]];for(let F=0,M=C.length;F<M;F++){const b=C[F];if(p(b,T,F,I)===!0){const G=b.__offset,W=Array.isArray(b.value)?b.value:[b.value];let $=0;for(let ie=0;ie<W.length;ie++){const q=W[ie],he=x(q);typeof q=="number"||typeof q=="boolean"?(b.__data[0]=q,s.bufferSubData(s.UNIFORM_BUFFER,G+$,b.__data)):q.isMatrix3?(b.__data[0]=q.elements[0],b.__data[1]=q.elements[1],b.__data[2]=q.elements[2],b.__data[3]=0,b.__data[4]=q.elements[3],b.__data[5]=q.elements[4],b.__data[6]=q.elements[5],b.__data[7]=0,b.__data[8]=q.elements[6],b.__data[9]=q.elements[7],b.__data[10]=q.elements[8],b.__data[11]=0):(q.toArray(b.__data,$),$+=he.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,G,b.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function p(y,_,v,I){const T=y.value,w=_+"_"+v;if(I[w]===void 0)return typeof T=="number"||typeof T=="boolean"?I[w]=T:I[w]=T.clone(),!0;{const C=I[w];if(typeof T=="number"||typeof T=="boolean"){if(C!==T)return I[w]=T,!0}else if(C.equals(T)===!1)return C.copy(T),!0}return!1}function f(y){const _=y.uniforms;let v=0;const I=16;for(let w=0,C=_.length;w<C;w++){const F=Array.isArray(_[w])?_[w]:[_[w]];for(let M=0,b=F.length;M<b;M++){const G=F[M],W=Array.isArray(G.value)?G.value:[G.value];for(let $=0,ie=W.length;$<ie;$++){const q=W[$],he=x(q),Q=v%I,we=Q%he.boundary,Ne=Q+we;v+=we,Ne!==0&&I-Ne<he.storage&&(v+=I-Ne),G.__data=new Float32Array(he.storage/Float32Array.BYTES_PER_ELEMENT),G.__offset=v,v+=he.storage}}}const T=v%I;return T>0&&(v+=I-T),y.__size=v,y.__cache={},this}function x(y){const _={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(_.boundary=4,_.storage=4):y.isVector2?(_.boundary=8,_.storage=8):y.isVector3||y.isColor?(_.boundary=16,_.storage=12):y.isVector4?(_.boundary=16,_.storage=16):y.isMatrix3?(_.boundary=48,_.storage=48):y.isMatrix4?(_.boundary=64,_.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),_}function m(y){const _=y.target;_.removeEventListener("dispose",m);const v=o.indexOf(_.__bindingPointIndex);o.splice(v,1),s.deleteBuffer(i[_.id]),delete i[_.id],delete r[_.id]}function g(){for(const y in i)s.deleteBuffer(i[y]);o=[],i={},r={}}return{bind:c,update:l,dispose:g}}class qy{constructor(e={}){const{canvas:t=Dy(),context:n=null,depth:i=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=o;const p=new Uint32Array(4),f=new Int32Array(4);let x=null,m=null;const g=[],y=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=kn,this.toneMapping=Ti,this.toneMappingExposure=1;const _=this;let v=!1,I=0,T=0,w=null,C=-1,F=null;const M=new st,b=new st;let G=null;const W=new _e(0);let $=0,ie=t.width,q=t.height,he=1,Q=null,we=null;const Ne=new st(0,0,ie,q),Ee=new st(0,0,ie,q);let Qe=!1;const ht=new ma;let ne=!1,ue=!1;const Ae=new Fe,ge=new Fe,Ze=new E,Xe=new st,Je={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let dt=!1;function ae(){return w===null?he:1}let P=n;function Me(N,B){return t.getContext(N,B)}try{const N={alpha:!0,depth:i,stencil:r,antialias:a,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ks}`),t.addEventListener("webglcontextlost",le,!1),t.addEventListener("webglcontextrestored",Ce,!1),t.addEventListener("webglcontextcreationerror",Le,!1),P===null){const B="webgl2";if(P=Me(B,N),P===null)throw Me(B)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(N){throw console.error("THREE.WebGLRenderer: "+N.message),N}let ye,de,Te,qe,Ie,R,S,X,se,ce,re,ke,be,De,vt,me,Ue,tt,nt,Be,Mt,ct,Ot,O;function Pe(){ye=new KE(P),ye.init(),ct=new Xy(P,ye),de=new qE(P,ye,e,ct),Te=new IR(P),de.reverseDepthBuffer&&Te.buffers.depth.setReversed(!0),qe=new eC(P),Ie=new _R,R=new OR(P,ye,Te,Ie,de,ct,qe),S=new YE(_),X=new JE(_),se=new c1(P),Ot=new WE(P,se),ce=new jE(P,se,qe,Ot),re=new nC(P,ce,se,qe),nt=new tC(P,de,R),me=new $E(Ie),ke=new xR(_,S,X,ye,de,Ot,me),be=new WR(_,Ie),De=new vR,vt=new AR(ye),tt=new HE(_,S,X,Te,re,d,c),Ue=new CR(_,re,de),O=new XR(P,qe,de,Te),Be=new XE(P,ye,qe),Mt=new QE(P,ye,qe),qe.programs=ke.programs,_.capabilities=de,_.extensions=ye,_.properties=Ie,_.renderLists=De,_.shadowMap=Ue,_.state=Te,_.info=qe}Pe();const ee=new GR(_,P);this.xr=ee,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){const N=ye.get("WEBGL_lose_context");N&&N.loseContext()},this.forceContextRestore=function(){const N=ye.get("WEBGL_lose_context");N&&N.restoreContext()},this.getPixelRatio=function(){return he},this.setPixelRatio=function(N){N!==void 0&&(he=N,this.setSize(ie,q,!1))},this.getSize=function(N){return N.set(ie,q)},this.setSize=function(N,B,Y=!0){if(ee.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}ie=N,q=B,t.width=Math.floor(N*he),t.height=Math.floor(B*he),Y===!0&&(t.style.width=N+"px",t.style.height=B+"px"),this.setViewport(0,0,N,B)},this.getDrawingBufferSize=function(N){return N.set(ie*he,q*he).floor()},this.setDrawingBufferSize=function(N,B,Y){ie=N,q=B,he=Y,t.width=Math.floor(N*Y),t.height=Math.floor(B*Y),this.setViewport(0,0,N,B)},this.getCurrentViewport=function(N){return N.copy(M)},this.getViewport=function(N){return N.copy(Ne)},this.setViewport=function(N,B,Y,Z){N.isVector4?Ne.set(N.x,N.y,N.z,N.w):Ne.set(N,B,Y,Z),Te.viewport(M.copy(Ne).multiplyScalar(he).round())},this.getScissor=function(N){return N.copy(Ee)},this.setScissor=function(N,B,Y,Z){N.isVector4?Ee.set(N.x,N.y,N.z,N.w):Ee.set(N,B,Y,Z),Te.scissor(b.copy(Ee).multiplyScalar(he).round())},this.getScissorTest=function(){return Qe},this.setScissorTest=function(N){Te.setScissorTest(Qe=N)},this.setOpaqueSort=function(N){Q=N},this.setTransparentSort=function(N){we=N},this.getClearColor=function(N){return N.copy(tt.getClearColor())},this.setClearColor=function(){tt.setClearColor.apply(tt,arguments)},this.getClearAlpha=function(){return tt.getClearAlpha()},this.setClearAlpha=function(){tt.setClearAlpha.apply(tt,arguments)},this.clear=function(N=!0,B=!0,Y=!0){let Z=0;if(N){let k=!1;if(w!==null){const xe=w.texture.format;k=xe===Oh||xe===Fh||xe===Wc}if(k){const xe=w.texture.type,Re=xe===Qi||xe===Bi||xe===Qo||xe===or||xe===Dh||xe===Uh,ze=tt.getClearColor(),Ge=tt.getClearAlpha(),je=ze.r,et=ze.g,He=ze.b;Re?(p[0]=je,p[1]=et,p[2]=He,p[3]=Ge,P.clearBufferuiv(P.COLOR,0,p)):(f[0]=je,f[1]=et,f[2]=He,f[3]=Ge,P.clearBufferiv(P.COLOR,0,f))}else Z|=P.COLOR_BUFFER_BIT}B&&(Z|=P.DEPTH_BUFFER_BIT,P.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Y&&(Z|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),P.clear(Z)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",le,!1),t.removeEventListener("webglcontextrestored",Ce,!1),t.removeEventListener("webglcontextcreationerror",Le,!1),De.dispose(),vt.dispose(),Ie.dispose(),S.dispose(),X.dispose(),re.dispose(),Ot.dispose(),O.dispose(),ke.dispose(),ee.dispose(),ee.removeEventListener("sessionstart",c0),ee.removeEventListener("sessionend",l0),_r.stop()};function le(N){N.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),v=!0}function Ce(){console.log("THREE.WebGLRenderer: Context Restored."),v=!1;const N=qe.autoReset,B=Ue.enabled,Y=Ue.autoUpdate,Z=Ue.needsUpdate,k=Ue.type;Pe(),qe.autoReset=N,Ue.enabled=B,Ue.autoUpdate=Y,Ue.needsUpdate=Z,Ue.type=k}function Le(N){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",N.statusMessage)}function bt(N){const B=N.target;B.removeEventListener("dispose",bt),on(B)}function on(N){ni(N),Ie.remove(N)}function ni(N){const B=Ie.get(N).programs;B!==void 0&&(B.forEach(function(Y){ke.releaseProgram(Y)}),N.isShaderMaterial&&ke.releaseShaderCache(N))}this.renderBufferDirect=function(N,B,Y,Z,k,xe){B===null&&(B=Je);const Re=k.isMesh&&k.matrixWorld.determinant()<0,ze=Jw(N,B,Y,Z,k);Te.setMaterial(Z,Re);let Ge=Y.index,je=1;if(Z.wireframe===!0){if(Ge=ce.getWireframeAttribute(Y),Ge===void 0)return;je=2}const et=Y.drawRange,He=Y.attributes.position;let Lt=et.start*je,Gt=(et.start+et.count)*je;xe!==null&&(Lt=Math.max(Lt,xe.start*je),Gt=Math.min(Gt,(xe.start+xe.count)*je)),Ge!==null?(Lt=Math.max(Lt,0),Gt=Math.min(Gt,Ge.count)):He!=null&&(Lt=Math.max(Lt,0),Gt=Math.min(Gt,He.count));const Jt=Gt-Lt;if(Jt<0||Jt===1/0)return;Ot.setup(k,Z,ze,Y,Ge);let fi,Rt=Be;if(Ge!==null&&(fi=se.get(Ge),Rt=Mt,Rt.setIndex(fi)),k.isMesh)Z.wireframe===!0?(Te.setLineWidth(Z.wireframeLinewidth*ae()),Rt.setMode(P.LINES)):Rt.setMode(P.TRIANGLES);else if(k.isLine){let $e=Z.linewidth;$e===void 0&&($e=1),Te.setLineWidth($e*ae()),k.isLineSegments?Rt.setMode(P.LINES):k.isLineLoop?Rt.setMode(P.LINE_LOOP):Rt.setMode(P.LINE_STRIP)}else k.isPoints?Rt.setMode(P.POINTS):k.isSprite&&Rt.setMode(P.TRIANGLES);if(k.isBatchedMesh)if(k._multiDrawInstances!==null)Rt.renderMultiDrawInstances(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount,k._multiDrawInstances);else if(ye.get("WEBGL_multi_draw"))Rt.renderMultiDraw(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount);else{const $e=k._multiDrawStarts,An=k._multiDrawCounts,It=k._multiDrawCount,Wi=Ge?se.get(Ge).bytesPerElement:1,fo=Ie.get(Z).currentProgram.getUniforms();for(let mi=0;mi<It;mi++)fo.setValue(P,"_gl_DrawID",mi),Rt.render($e[mi]/Wi,An[mi])}else if(k.isInstancedMesh)Rt.renderInstances(Lt,Jt,k.count);else if(Y.isInstancedBufferGeometry){const $e=Y._maxInstanceCount!==void 0?Y._maxInstanceCount:1/0,An=Math.min(Y.instanceCount,$e);Rt.renderInstances(Lt,Jt,An)}else Rt.render(Lt,Jt)};function Et(N,B,Y){N.transparent===!0&&N.side===Zi&&N.forceSinglePass===!1?(N.side=ln,N.needsUpdate=!0,bl(N,B,Y),N.side=fs,N.needsUpdate=!0,bl(N,B,Y),N.side=Zi):bl(N,B,Y)}this.compile=function(N,B,Y=null){Y===null&&(Y=N),m=vt.get(Y),m.init(B),y.push(m),Y.traverseVisible(function(k){k.isLight&&k.layers.test(B.layers)&&(m.pushLight(k),k.castShadow&&m.pushShadow(k))}),N!==Y&&N.traverseVisible(function(k){k.isLight&&k.layers.test(B.layers)&&(m.pushLight(k),k.castShadow&&m.pushShadow(k))}),m.setupLights();const Z=new Set;return N.traverse(function(k){if(!(k.isMesh||k.isPoints||k.isLine||k.isSprite))return;const xe=k.material;if(xe)if(Array.isArray(xe))for(let Re=0;Re<xe.length;Re++){const ze=xe[Re];Et(ze,Y,k),Z.add(ze)}else Et(xe,Y,k),Z.add(xe)}),y.pop(),m=null,Z},this.compileAsync=function(N,B,Y=null){const Z=this.compile(N,B,Y);return new Promise(k=>{function xe(){if(Z.forEach(function(Re){Ie.get(Re).currentProgram.isReady()&&Z.delete(Re)}),Z.size===0){k(N);return}setTimeout(xe,10)}ye.get("KHR_parallel_shader_compile")!==null?xe():setTimeout(xe,10)})};let ii=null;function vs(N){ii&&ii(N)}function c0(){_r.stop()}function l0(){_r.start()}const _r=new zy;_r.setAnimationLoop(vs),typeof self<"u"&&_r.setContext(self),this.setAnimationLoop=function(N){ii=N,ee.setAnimationLoop(N),N===null?_r.stop():_r.start()},ee.addEventListener("sessionstart",c0),ee.addEventListener("sessionend",l0),this.render=function(N,B){if(B!==void 0&&B.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;if(N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),B.parent===null&&B.matrixWorldAutoUpdate===!0&&B.updateMatrixWorld(),ee.enabled===!0&&ee.isPresenting===!0&&(ee.cameraAutoUpdate===!0&&ee.updateCamera(B),B=ee.getCamera()),N.isScene===!0&&N.onBeforeRender(_,N,B,w),m=vt.get(N,y.length),m.init(B),y.push(m),ge.multiplyMatrices(B.projectionMatrix,B.matrixWorldInverse),ht.setFromProjectionMatrix(ge),ue=this.localClippingEnabled,ne=me.init(this.clippingPlanes,ue),x=De.get(N,g.length),x.init(),g.push(x),ee.enabled===!0&&ee.isPresenting===!0){const xe=_.xr.getDepthSensingMesh();xe!==null&&Bd(xe,B,-1/0,_.sortObjects)}Bd(N,B,0,_.sortObjects),x.finish(),_.sortObjects===!0&&x.sort(Q,we),dt=ee.enabled===!1||ee.isPresenting===!1||ee.hasDepthSensing()===!1,dt&&tt.addToRenderList(x,N),this.info.render.frame++,ne===!0&&me.beginShadows();const Y=m.state.shadowsArray;Ue.render(Y,N,B),ne===!0&&me.endShadows(),this.info.autoReset===!0&&this.info.reset();const Z=x.opaque,k=x.transmissive;if(m.setupLights(),B.isArrayCamera){const xe=B.cameras;if(k.length>0)for(let Re=0,ze=xe.length;Re<ze;Re++){const Ge=xe[Re];h0(Z,k,N,Ge)}dt&&tt.render(N);for(let Re=0,ze=xe.length;Re<ze;Re++){const Ge=xe[Re];u0(x,N,Ge,Ge.viewport)}}else k.length>0&&h0(Z,k,N,B),dt&&tt.render(N),u0(x,N,B);w!==null&&(R.updateMultisampleRenderTarget(w),R.updateRenderTargetMipmap(w)),N.isScene===!0&&N.onAfterRender(_,N,B),Ot.resetDefaultState(),C=-1,F=null,y.pop(),y.length>0?(m=y[y.length-1],ne===!0&&me.setGlobalState(_.clippingPlanes,m.state.camera)):m=null,g.pop(),g.length>0?x=g[g.length-1]:x=null};function Bd(N,B,Y,Z){if(N.visible===!1)return;if(N.layers.test(B.layers)){if(N.isGroup)Y=N.renderOrder;else if(N.isLOD)N.autoUpdate===!0&&N.update(B);else if(N.isLight)m.pushLight(N),N.castShadow&&m.pushShadow(N);else if(N.isSprite){if(!N.frustumCulled||ht.intersectsSprite(N)){Z&&Xe.setFromMatrixPosition(N.matrixWorld).applyMatrix4(ge);const Re=re.update(N),ze=N.material;ze.visible&&x.push(N,Re,ze,Y,Xe.z,null)}}else if((N.isMesh||N.isLine||N.isPoints)&&(!N.frustumCulled||ht.intersectsObject(N))){const Re=re.update(N),ze=N.material;if(Z&&(N.boundingSphere!==void 0?(N.boundingSphere===null&&N.computeBoundingSphere(),Xe.copy(N.boundingSphere.center)):(Re.boundingSphere===null&&Re.computeBoundingSphere(),Xe.copy(Re.boundingSphere.center)),Xe.applyMatrix4(N.matrixWorld).applyMatrix4(ge)),Array.isArray(ze)){const Ge=Re.groups;for(let je=0,et=Ge.length;je<et;je++){const He=Ge[je],Lt=ze[He.materialIndex];Lt&&Lt.visible&&x.push(N,Re,Lt,Y,Xe.z,He)}}else ze.visible&&x.push(N,Re,ze,Y,Xe.z,null)}}const xe=N.children;for(let Re=0,ze=xe.length;Re<ze;Re++)Bd(xe[Re],B,Y,Z)}function u0(N,B,Y,Z){const k=N.opaque,xe=N.transmissive,Re=N.transparent;m.setupLightsView(Y),ne===!0&&me.setGlobalState(_.clippingPlanes,Y),Z&&Te.viewport(M.copy(Z)),k.length>0&&Tl(k,B,Y),xe.length>0&&Tl(xe,B,Y),Re.length>0&&Tl(Re,B,Y),Te.buffers.depth.setTest(!0),Te.buffers.depth.setMask(!0),Te.buffers.color.setMask(!0),Te.setPolygonOffset(!1)}function h0(N,B,Y,Z){if((Y.isScene===!0?Y.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[Z.id]===void 0&&(m.state.transmissionRenderTarget[Z.id]=new zi(1,1,{generateMipmaps:!0,type:ye.has("EXT_color_buffer_half_float")||ye.has("EXT_color_buffer_float")?Ln:Qi,minFilter:Jn,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:gt.workingColorSpace}));const xe=m.state.transmissionRenderTarget[Z.id],Re=Z.viewport||M;xe.setSize(Re.z,Re.w);const ze=_.getRenderTarget();_.setRenderTarget(xe),_.getClearColor(W),$=_.getClearAlpha(),$<1&&_.setClearColor(16777215,.5),_.clear(),dt&&tt.render(Y);const Ge=_.toneMapping;_.toneMapping=Ti;const je=Z.viewport;if(Z.viewport!==void 0&&(Z.viewport=void 0),m.setupLightsView(Z),ne===!0&&me.setGlobalState(_.clippingPlanes,Z),Tl(N,Y,Z),R.updateMultisampleRenderTarget(xe),R.updateRenderTargetMipmap(xe),ye.has("WEBGL_multisampled_render_to_texture")===!1){let et=!1;for(let He=0,Lt=B.length;He<Lt;He++){const Gt=B[He],Jt=Gt.object,fi=Gt.geometry,Rt=Gt.material,$e=Gt.group;if(Rt.side===Zi&&Jt.layers.test(Z.layers)){const An=Rt.side;Rt.side=ln,Rt.needsUpdate=!0,d0(Jt,Y,Z,fi,Rt,$e),Rt.side=An,Rt.needsUpdate=!0,et=!0}}et===!0&&(R.updateMultisampleRenderTarget(xe),R.updateRenderTargetMipmap(xe))}_.setRenderTarget(ze),_.setClearColor(W,$),je!==void 0&&(Z.viewport=je),_.toneMapping=Ge}function Tl(N,B,Y){const Z=B.isScene===!0?B.overrideMaterial:null;for(let k=0,xe=N.length;k<xe;k++){const Re=N[k],ze=Re.object,Ge=Re.geometry,je=Z===null?Re.material:Z,et=Re.group;ze.layers.test(Y.layers)&&d0(ze,B,Y,Ge,je,et)}}function d0(N,B,Y,Z,k,xe){N.onBeforeRender(_,B,Y,Z,k,xe),N.modelViewMatrix.multiplyMatrices(Y.matrixWorldInverse,N.matrixWorld),N.normalMatrix.getNormalMatrix(N.modelViewMatrix),k.onBeforeRender(_,B,Y,Z,N,xe),k.transparent===!0&&k.side===Zi&&k.forceSinglePass===!1?(k.side=ln,k.needsUpdate=!0,_.renderBufferDirect(Y,B,Z,k,N,xe),k.side=fs,k.needsUpdate=!0,_.renderBufferDirect(Y,B,Z,k,N,xe),k.side=Zi):_.renderBufferDirect(Y,B,Z,k,N,xe),N.onAfterRender(_,B,Y,Z,k,xe)}function bl(N,B,Y){B.isScene!==!0&&(B=Je);const Z=Ie.get(N),k=m.state.lights,xe=m.state.shadowsArray,Re=k.state.version,ze=ke.getParameters(N,k.state,xe,B,Y),Ge=ke.getProgramCacheKey(ze);let je=Z.programs;Z.environment=N.isMeshStandardMaterial?B.environment:null,Z.fog=B.fog,Z.envMap=(N.isMeshStandardMaterial?X:S).get(N.envMap||Z.environment),Z.envMapRotation=Z.environment!==null&&N.envMap===null?B.environmentRotation:N.envMapRotation,je===void 0&&(N.addEventListener("dispose",bt),je=new Map,Z.programs=je);let et=je.get(Ge);if(et!==void 0){if(Z.currentProgram===et&&Z.lightsStateVersion===Re)return f0(N,ze),et}else ze.uniforms=ke.getUniforms(N),N.onBuild(Y,ze,_),N.onBeforeCompile(ze,_),et=ke.acquireProgram(ze,Ge),je.set(Ge,et),Z.uniforms=ze.uniforms;const He=Z.uniforms;return(!N.isShaderMaterial&&!N.isRawShaderMaterial||N.clipping===!0)&&(He.clippingPlanes=me.uniform),f0(N,ze),Z.needsLights=jw(N),Z.lightsStateVersion=Re,Z.needsLights&&(He.ambientLightColor.value=k.state.ambient,He.lightProbe.value=k.state.probe,He.directionalLights.value=k.state.directional,He.directionalLightShadows.value=k.state.directionalShadow,He.spotLights.value=k.state.spot,He.spotLightShadows.value=k.state.spotShadow,He.rectAreaLights.value=k.state.rectArea,He.ltc_1.value=k.state.rectAreaLTC1,He.ltc_2.value=k.state.rectAreaLTC2,He.pointLights.value=k.state.point,He.pointLightShadows.value=k.state.pointShadow,He.hemisphereLights.value=k.state.hemi,He.directionalShadowMap.value=k.state.directionalShadowMap,He.directionalShadowMatrix.value=k.state.directionalShadowMatrix,He.spotShadowMap.value=k.state.spotShadowMap,He.spotLightMatrix.value=k.state.spotLightMatrix,He.spotLightMap.value=k.state.spotLightMap,He.pointShadowMap.value=k.state.pointShadowMap,He.pointShadowMatrix.value=k.state.pointShadowMatrix),Z.currentProgram=et,Z.uniformsList=null,et}function p0(N){if(N.uniformsList===null){const B=N.currentProgram.getUniforms();N.uniformsList=Ru.seqWithValue(B.seq,N.uniforms)}return N.uniformsList}function f0(N,B){const Y=Ie.get(N);Y.outputColorSpace=B.outputColorSpace,Y.batching=B.batching,Y.batchingColor=B.batchingColor,Y.instancing=B.instancing,Y.instancingColor=B.instancingColor,Y.instancingMorph=B.instancingMorph,Y.skinning=B.skinning,Y.morphTargets=B.morphTargets,Y.morphNormals=B.morphNormals,Y.morphColors=B.morphColors,Y.morphTargetsCount=B.morphTargetsCount,Y.numClippingPlanes=B.numClippingPlanes,Y.numIntersection=B.numClipIntersection,Y.vertexAlphas=B.vertexAlphas,Y.vertexTangents=B.vertexTangents,Y.toneMapping=B.toneMapping}function Jw(N,B,Y,Z,k){B.isScene!==!0&&(B=Je),R.resetTextureUnits();const xe=B.fog,Re=Z.isMeshStandardMaterial?B.environment:null,ze=w===null?_.outputColorSpace:w.isXRRenderTarget===!0?w.texture.colorSpace:li,Ge=(Z.isMeshStandardMaterial?X:S).get(Z.envMap||Re),je=Z.vertexColors===!0&&!!Y.attributes.color&&Y.attributes.color.itemSize===4,et=!!Y.attributes.tangent&&(!!Z.normalMap||Z.anisotropy>0),He=!!Y.morphAttributes.position,Lt=!!Y.morphAttributes.normal,Gt=!!Y.morphAttributes.color;let Jt=Ti;Z.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&(Jt=_.toneMapping);const fi=Y.morphAttributes.position||Y.morphAttributes.normal||Y.morphAttributes.color,Rt=fi!==void 0?fi.length:0,$e=Ie.get(Z),An=m.state.lights;if(ne===!0&&(ue===!0||N!==F)){const Ni=N===F&&Z.id===C;me.setState(Z,N,Ni)}let It=!1;Z.version===$e.__version?($e.needsLights&&$e.lightsStateVersion!==An.state.version||$e.outputColorSpace!==ze||k.isBatchedMesh&&$e.batching===!1||!k.isBatchedMesh&&$e.batching===!0||k.isBatchedMesh&&$e.batchingColor===!0&&k.colorTexture===null||k.isBatchedMesh&&$e.batchingColor===!1&&k.colorTexture!==null||k.isInstancedMesh&&$e.instancing===!1||!k.isInstancedMesh&&$e.instancing===!0||k.isSkinnedMesh&&$e.skinning===!1||!k.isSkinnedMesh&&$e.skinning===!0||k.isInstancedMesh&&$e.instancingColor===!0&&k.instanceColor===null||k.isInstancedMesh&&$e.instancingColor===!1&&k.instanceColor!==null||k.isInstancedMesh&&$e.instancingMorph===!0&&k.morphTexture===null||k.isInstancedMesh&&$e.instancingMorph===!1&&k.morphTexture!==null||$e.envMap!==Ge||Z.fog===!0&&$e.fog!==xe||$e.numClippingPlanes!==void 0&&($e.numClippingPlanes!==me.numPlanes||$e.numIntersection!==me.numIntersection)||$e.vertexAlphas!==je||$e.vertexTangents!==et||$e.morphTargets!==He||$e.morphNormals!==Lt||$e.morphColors!==Gt||$e.toneMapping!==Jt||$e.morphTargetsCount!==Rt)&&(It=!0):(It=!0,$e.__version=Z.version);let Wi=$e.currentProgram;It===!0&&(Wi=bl(Z,B,k));let fo=!1,mi=!1,zd=!1;const tn=Wi.getUniforms(),Vs=$e.uniforms;if(Te.useProgram(Wi.program)&&(fo=!0,mi=!0,zd=!0),Z.id!==C&&(C=Z.id,mi=!0),fo||F!==N){de.reverseDepthBuffer?(Ae.copy(N.projectionMatrix),DA(Ae),UA(Ae),tn.setValue(P,"projectionMatrix",Ae)):tn.setValue(P,"projectionMatrix",N.projectionMatrix),tn.setValue(P,"viewMatrix",N.matrixWorldInverse);const Ni=tn.map.cameraPosition;Ni!==void 0&&Ni.setValue(P,Ze.setFromMatrixPosition(N.matrixWorld)),de.logarithmicDepthBuffer&&tn.setValue(P,"logDepthBufFC",2/(Math.log(N.far+1)/Math.LN2)),(Z.isMeshPhongMaterial||Z.isMeshToonMaterial||Z.isMeshLambertMaterial||Z.isMeshBasicMaterial||Z.isMeshStandardMaterial||Z.isShaderMaterial)&&tn.setValue(P,"isOrthographic",N.isOrthographicCamera===!0),F!==N&&(F=N,mi=!0,zd=!0)}if(k.isSkinnedMesh){tn.setOptional(P,k,"bindMatrix"),tn.setOptional(P,k,"bindMatrixInverse");const Ni=k.skeleton;Ni&&(Ni.boneTexture===null&&Ni.computeBoneTexture(),tn.setValue(P,"boneTexture",Ni.boneTexture,R))}k.isBatchedMesh&&(tn.setOptional(P,k,"batchingTexture"),tn.setValue(P,"batchingTexture",k._matricesTexture,R),tn.setOptional(P,k,"batchingIdTexture"),tn.setValue(P,"batchingIdTexture",k._indirectTexture,R),tn.setOptional(P,k,"batchingColorTexture"),k._colorsTexture!==null&&tn.setValue(P,"batchingColorTexture",k._colorsTexture,R));const kd=Y.morphAttributes;if((kd.position!==void 0||kd.normal!==void 0||kd.color!==void 0)&&nt.update(k,Y,Wi),(mi||$e.receiveShadow!==k.receiveShadow)&&($e.receiveShadow=k.receiveShadow,tn.setValue(P,"receiveShadow",k.receiveShadow)),Z.isMeshGouraudMaterial&&Z.envMap!==null&&(Vs.envMap.value=Ge,Vs.flipEnvMap.value=Ge.isCubeTexture&&Ge.isRenderTargetTexture===!1?-1:1),Z.isMeshStandardMaterial&&Z.envMap===null&&B.environment!==null&&(Vs.envMapIntensity.value=B.environmentIntensity),mi&&(tn.setValue(P,"toneMappingExposure",_.toneMappingExposure),$e.needsLights&&Kw(Vs,zd),xe&&Z.fog===!0&&be.refreshFogUniforms(Vs,xe),be.refreshMaterialUniforms(Vs,Z,he,q,m.state.transmissionRenderTarget[N.id]),Ru.upload(P,p0($e),Vs,R)),Z.isShaderMaterial&&Z.uniformsNeedUpdate===!0&&(Ru.upload(P,p0($e),Vs,R),Z.uniformsNeedUpdate=!1),Z.isSpriteMaterial&&tn.setValue(P,"center",k.center),tn.setValue(P,"modelViewMatrix",k.modelViewMatrix),tn.setValue(P,"normalMatrix",k.normalMatrix),tn.setValue(P,"modelMatrix",k.matrixWorld),Z.isShaderMaterial||Z.isRawShaderMaterial){const Ni=Z.uniformsGroups;for(let Gd=0,Qw=Ni.length;Gd<Qw;Gd++){const m0=Ni[Gd];O.update(m0,Wi),O.bind(m0,Wi)}}return Wi}function Kw(N,B){N.ambientLightColor.needsUpdate=B,N.lightProbe.needsUpdate=B,N.directionalLights.needsUpdate=B,N.directionalLightShadows.needsUpdate=B,N.pointLights.needsUpdate=B,N.pointLightShadows.needsUpdate=B,N.spotLights.needsUpdate=B,N.spotLightShadows.needsUpdate=B,N.rectAreaLights.needsUpdate=B,N.hemisphereLights.needsUpdate=B}function jw(N){return N.isMeshLambertMaterial||N.isMeshToonMaterial||N.isMeshPhongMaterial||N.isMeshStandardMaterial||N.isShadowMaterial||N.isShaderMaterial&&N.lights===!0}this.getActiveCubeFace=function(){return I},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(N,B,Y){Ie.get(N.texture).__webglTexture=B,Ie.get(N.depthTexture).__webglTexture=Y;const Z=Ie.get(N);Z.__hasExternalTextures=!0,Z.__autoAllocateDepthBuffer=Y===void 0,Z.__autoAllocateDepthBuffer||ye.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),Z.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(N,B){const Y=Ie.get(N);Y.__webglFramebuffer=B,Y.__useDefaultFramebuffer=B===void 0},this.setRenderTarget=function(N,B=0,Y=0){w=N,I=B,T=Y;let Z=!0,k=null,xe=!1,Re=!1;if(N){const Ge=Ie.get(N);if(Ge.__useDefaultFramebuffer!==void 0)Te.bindFramebuffer(P.FRAMEBUFFER,null),Z=!1;else if(Ge.__webglFramebuffer===void 0)R.setupRenderTarget(N);else if(Ge.__hasExternalTextures)R.rebindTextures(N,Ie.get(N.texture).__webglTexture,Ie.get(N.depthTexture).__webglTexture);else if(N.depthBuffer){const He=N.depthTexture;if(Ge.__boundDepthTexture!==He){if(He!==null&&Ie.has(He)&&(N.width!==He.image.width||N.height!==He.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");R.setupDepthRenderbuffer(N)}}const je=N.texture;(je.isData3DTexture||je.isDataArrayTexture||je.isCompressedArrayTexture)&&(Re=!0);const et=Ie.get(N).__webglFramebuffer;N.isWebGLCubeRenderTarget?(Array.isArray(et[B])?k=et[B][Y]:k=et[B],xe=!0):N.samples>0&&R.useMultisampledRTT(N)===!1?k=Ie.get(N).__webglMultisampledFramebuffer:Array.isArray(et)?k=et[Y]:k=et,M.copy(N.viewport),b.copy(N.scissor),G=N.scissorTest}else M.copy(Ne).multiplyScalar(he).floor(),b.copy(Ee).multiplyScalar(he).floor(),G=Qe;if(Te.bindFramebuffer(P.FRAMEBUFFER,k)&&Z&&Te.drawBuffers(N,k),Te.viewport(M),Te.scissor(b),Te.setScissorTest(G),xe){const Ge=Ie.get(N.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+B,Ge.__webglTexture,Y)}else if(Re){const Ge=Ie.get(N.texture),je=B||0;P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,Ge.__webglTexture,Y||0,je)}C=-1},this.readRenderTargetPixels=function(N,B,Y,Z,k,xe,Re){if(!(N&&N.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ze=Ie.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&Re!==void 0&&(ze=ze[Re]),ze){Te.bindFramebuffer(P.FRAMEBUFFER,ze);try{const Ge=N.texture,je=Ge.format,et=Ge.type;if(!de.textureFormatReadable(je)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!de.textureTypeReadable(et)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}B>=0&&B<=N.width-Z&&Y>=0&&Y<=N.height-k&&P.readPixels(B,Y,Z,k,ct.convert(je),ct.convert(et),xe)}finally{const Ge=w!==null?Ie.get(w).__webglFramebuffer:null;Te.bindFramebuffer(P.FRAMEBUFFER,Ge)}}},this.readRenderTargetPixelsAsync=async function(N,B,Y,Z,k,xe,Re){if(!(N&&N.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ze=Ie.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&Re!==void 0&&(ze=ze[Re]),ze){const Ge=N.texture,je=Ge.format,et=Ge.type;if(!de.textureFormatReadable(je))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!de.textureTypeReadable(et))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(B>=0&&B<=N.width-Z&&Y>=0&&Y<=N.height-k){Te.bindFramebuffer(P.FRAMEBUFFER,ze);const He=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,He),P.bufferData(P.PIXEL_PACK_BUFFER,xe.byteLength,P.STREAM_READ),P.readPixels(B,Y,Z,k,ct.convert(je),ct.convert(et),0);const Lt=w!==null?Ie.get(w).__webglFramebuffer:null;Te.bindFramebuffer(P.FRAMEBUFFER,Lt);const Gt=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await LA(P,Gt,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,He),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,xe),P.deleteBuffer(He),P.deleteSync(Gt),xe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(N,B=null,Y=0){N.isTexture!==!0&&(Cu("WebGLRenderer: copyFramebufferToTexture function signature has changed."),B=arguments[0]||null,N=arguments[1]);const Z=Math.pow(2,-Y),k=Math.floor(N.image.width*Z),xe=Math.floor(N.image.height*Z),Re=B!==null?B.x:0,ze=B!==null?B.y:0;R.setTexture2D(N,0),P.copyTexSubImage2D(P.TEXTURE_2D,Y,0,0,Re,ze,k,xe),Te.unbindTexture()},this.copyTextureToTexture=function(N,B,Y=null,Z=null,k=0){N.isTexture!==!0&&(Cu("WebGLRenderer: copyTextureToTexture function signature has changed."),Z=arguments[0]||null,N=arguments[1],B=arguments[2],k=arguments[3]||0,Y=null);let xe,Re,ze,Ge,je,et;Y!==null?(xe=Y.max.x-Y.min.x,Re=Y.max.y-Y.min.y,ze=Y.min.x,Ge=Y.min.y):(xe=N.image.width,Re=N.image.height,ze=0,Ge=0),Z!==null?(je=Z.x,et=Z.y):(je=0,et=0);const He=ct.convert(B.format),Lt=ct.convert(B.type);R.setTexture2D(B,0),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,B.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,B.unpackAlignment);const Gt=P.getParameter(P.UNPACK_ROW_LENGTH),Jt=P.getParameter(P.UNPACK_IMAGE_HEIGHT),fi=P.getParameter(P.UNPACK_SKIP_PIXELS),Rt=P.getParameter(P.UNPACK_SKIP_ROWS),$e=P.getParameter(P.UNPACK_SKIP_IMAGES),An=N.isCompressedTexture?N.mipmaps[k]:N.image;P.pixelStorei(P.UNPACK_ROW_LENGTH,An.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,An.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,ze),P.pixelStorei(P.UNPACK_SKIP_ROWS,Ge),N.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,k,je,et,xe,Re,He,Lt,An.data):N.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,k,je,et,An.width,An.height,He,An.data):P.texSubImage2D(P.TEXTURE_2D,k,je,et,xe,Re,He,Lt,An),P.pixelStorei(P.UNPACK_ROW_LENGTH,Gt),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Jt),P.pixelStorei(P.UNPACK_SKIP_PIXELS,fi),P.pixelStorei(P.UNPACK_SKIP_ROWS,Rt),P.pixelStorei(P.UNPACK_SKIP_IMAGES,$e),k===0&&B.generateMipmaps&&P.generateMipmap(P.TEXTURE_2D),Te.unbindTexture()},this.copyTextureToTexture3D=function(N,B,Y=null,Z=null,k=0){N.isTexture!==!0&&(Cu("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Y=arguments[0]||null,Z=arguments[1]||null,N=arguments[2],B=arguments[3],k=arguments[4]||0);let xe,Re,ze,Ge,je,et,He,Lt,Gt;const Jt=N.isCompressedTexture?N.mipmaps[k]:N.image;Y!==null?(xe=Y.max.x-Y.min.x,Re=Y.max.y-Y.min.y,ze=Y.max.z-Y.min.z,Ge=Y.min.x,je=Y.min.y,et=Y.min.z):(xe=Jt.width,Re=Jt.height,ze=Jt.depth,Ge=0,je=0,et=0),Z!==null?(He=Z.x,Lt=Z.y,Gt=Z.z):(He=0,Lt=0,Gt=0);const fi=ct.convert(B.format),Rt=ct.convert(B.type);let $e;if(B.isData3DTexture)R.setTexture3D(B,0),$e=P.TEXTURE_3D;else if(B.isDataArrayTexture||B.isCompressedArrayTexture)R.setTexture2DArray(B,0),$e=P.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,B.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,B.unpackAlignment);const An=P.getParameter(P.UNPACK_ROW_LENGTH),It=P.getParameter(P.UNPACK_IMAGE_HEIGHT),Wi=P.getParameter(P.UNPACK_SKIP_PIXELS),fo=P.getParameter(P.UNPACK_SKIP_ROWS),mi=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,Jt.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Jt.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Ge),P.pixelStorei(P.UNPACK_SKIP_ROWS,je),P.pixelStorei(P.UNPACK_SKIP_IMAGES,et),N.isDataTexture||N.isData3DTexture?P.texSubImage3D($e,k,He,Lt,Gt,xe,Re,ze,fi,Rt,Jt.data):B.isCompressedArrayTexture?P.compressedTexSubImage3D($e,k,He,Lt,Gt,xe,Re,ze,fi,Jt.data):P.texSubImage3D($e,k,He,Lt,Gt,xe,Re,ze,fi,Rt,Jt),P.pixelStorei(P.UNPACK_ROW_LENGTH,An),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,It),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Wi),P.pixelStorei(P.UNPACK_SKIP_ROWS,fo),P.pixelStorei(P.UNPACK_SKIP_IMAGES,mi),k===0&&B.generateMipmaps&&P.generateMipmap($e),Te.unbindTexture()},this.initRenderTarget=function(N){Ie.get(N).__webglFramebuffer===void 0&&R.setupRenderTarget(N)},this.initTexture=function(N){N.isCubeTexture?R.setTextureCube(N,0):N.isData3DTexture?R.setTexture3D(N,0):N.isDataArrayTexture||N.isCompressedArrayTexture?R.setTexture2DArray(N,0):R.setTexture2D(N,0),Te.unbindTexture()},this.resetState=function(){I=0,T=0,w=null,Te.reset(),Ot.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Di}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Xc?"display-p3":"srgb",t.unpackColorSpace=gt.workingColorSpace===fa?"display-p3":"srgb"}}class qh{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new _e(e),this.density=t}clone(){return new qh(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}let rm=class $y{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new _e(e),this.near=t,this.far=n}clone(){return new $y(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}};class $h extends yt{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 ui,this.environmentIntensity=1,this.environmentRotation=new ui,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class xa{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=na,this.updateRanges=[],this.version=0,this.uuid=bi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=bi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=bi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const qn=new E;class Ds{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)qn.fromBufferAttribute(this,t),qn.applyMatrix4(e),this.setXYZ(t,qn.x,qn.y,qn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)qn.fromBufferAttribute(this,t),qn.applyNormalMatrix(e),this.setXYZ(t,qn.x,qn.y,qn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)qn.fromBufferAttribute(this,t),qn.transformDirection(e),this.setXYZ(t,qn.x,qn.y,qn.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Yn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=ut(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=ut(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=ut(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=ut(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=ut(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Yn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Yn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Yn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Yn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array),i=ut(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array),i=ut(i,this.array),r=ut(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new At(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Ds(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Zc extends mn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new _e(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Co;const La=new E,Ro=new E,Io=new E,Po=new J,Da=new J,Yy=new Fe,Xl=new E,Ua=new E,ql=new E,ix=new J,xp=new J,sx=new J;class om extends yt{constructor(e=new Zc){if(super(),this.isSprite=!0,this.type="Sprite",Co===void 0){Co=new at;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new xa(t,5);Co.setIndex([0,1,2,0,2,3]),Co.setAttribute("position",new Ds(n,3,0,!1)),Co.setAttribute("uv",new Ds(n,2,3,!1))}this.geometry=Co,this.material=e,this.center=new J(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ro.setFromMatrixScale(this.matrixWorld),Yy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Io.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Ro.multiplyScalar(-Io.z);const n=this.material.rotation;let i,r;n!==0&&(r=Math.cos(n),i=Math.sin(n));const o=this.center;$l(Xl.set(-.5,-.5,0),Io,o,Ro,i,r),$l(Ua.set(.5,-.5,0),Io,o,Ro,i,r),$l(ql.set(.5,.5,0),Io,o,Ro,i,r),ix.set(0,0),xp.set(1,0),sx.set(1,1);let a=e.ray.intersectTriangle(Xl,Ua,ql,!1,La);if(a===null&&($l(Ua.set(-.5,.5,0),Io,o,Ro,i,r),xp.set(0,1),a=e.ray.intersectTriangle(Xl,ql,Ua,!1,La),a===null))return;const c=e.ray.origin.distanceTo(La);c<e.near||c>e.far||t.push({distance:c,point:La.clone(),uv:Zn.getInterpolation(La,Xl,Ua,ql,ix,xp,sx,new J),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function $l(s,e,t,n,i,r){Po.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(Da.x=r*Po.x-i*Po.y,Da.y=i*Po.x+r*Po.y):Da.copy(Po),s.copy(e),s.x+=Da.x,s.y+=Da.y,s.applyMatrix4(Yy)}const Yl=new E,rx=new E;class am extends yt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const r=t[n];this.addLevel(r.object.clone(),r.distance,r.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let r;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let r=t[n].distance;if(t[n].object.visible&&(r-=r*t[n].hysteresis),e<r)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Yl.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Yl);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Yl.setFromMatrixPosition(e.matrixWorld),rx.setFromMatrixPosition(this.matrixWorld);const n=Yl.distanceTo(rx)/e.zoom;t[0].object.visible=!0;let i,r;for(i=1,r=t.length;i<r;i++){let o=t[i].distance;if(t[i].object.visible&&(o-=o*t[i].hysteresis),n>=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,r=n.length;i<r;i++){const o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const ox=new E,ax=new st,cx=new st,qR=new E,lx=new Fe,Zl=new E,_p=new Dn,ux=new Fe,yp=new no;class cm extends kt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=sf,this.bindMatrix=new Fe,this.bindMatrixInverse=new Fe,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Hn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Zl),this.boundingBox.expandByPoint(Zl)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Dn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Zl),this.boundingSphere.expandByPoint(Zl)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_p.copy(this.boundingSphere),_p.applyMatrix4(i),e.ray.intersectsSphere(_p)!==!1&&(ux.copy(i).invert(),yp.copy(e.ray).applyMatrix4(ux),!(this.boundingBox!==null&&yp.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,yp)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new st,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===sf?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===ay?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;ax.fromBufferAttribute(i.attributes.skinIndex,e),cx.fromBufferAttribute(i.attributes.skinWeight,e),ox.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const o=cx.getComponent(r);if(o!==0){const a=ax.getComponent(r);lx.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(qR.copy(ox).applyMatrix4(lx),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Yh extends yt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Oi extends Xt{constructor(e=null,t=1,n=1,i,r,o,a,c,l=Qt,u=Qt,h,d){super(null,o,a,c,l,u,i,r,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const hx=new Fe,$R=new Fe;class Jc{constructor(e=[],t=[]){this.uuid=bi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Fe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Fe;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,o=e.length;r<o;r++){const a=e[r]?e[r].matrixWorld:$R;hx.multiplyMatrices(a,t[r]),hx.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Jc(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Oi(t,e,e,Rn,Gn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const r=e.bones[n];let o=t[r];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),o=new Yh),this.bones.push(o),this.boneInverses.push(new Fe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const o=t[i];e.bones.push(o.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class Us extends At{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Lo=new Fe,dx=new Fe,Jl=[],px=new Hn,YR=new Fe,Fa=new kt,Oa=new Dn;class lm extends kt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Us(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,YR)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Hn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Lo),px.copy(e.boundingBox).applyMatrix4(Lo),this.boundingBox.union(px)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Dn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Lo),Oa.copy(e.boundingSphere).applyMatrix4(Lo),this.boundingSphere.union(Oa)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=n.length+1,o=e*r+1;for(let a=0;a<n.length;a++)n[a]=i[o+a]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Fa.geometry=this.geometry,Fa.material=this.material,Fa.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Oa.copy(this.boundingSphere),Oa.applyMatrix4(n),e.ray.intersectsSphere(Oa)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,Lo),dx.multiplyMatrices(n,Lo),Fa.matrixWorld=dx,Fa.raycast(e,Jl);for(let o=0,a=Jl.length;o<a;o++){const c=Jl[o];c.instanceId=r,c.object=this,t.push(c)}Jl.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Us(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new Oi(new Float32Array(i*this.count),i,this.count,Hc,Gn));const r=this.morphTexture.source.data.data;let o=0;for(let l=0;l<n.length;l++)o+=n[l];const a=this.geometry.morphTargetsRelative?1:1-o,c=i*e;r[c]=a,r.set(n,c+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function ZR(s,e){return s.z-e.z}function JR(s,e){return e.z-s.z}class KR{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n){const i=this.pool,r=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const o=i[this.index];r.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=t,o.index=n}reset(){this.list.length=0,this.index=0}}const Xs=new Fe,vp=new Fe,jR=new Fe,QR=new _e(1,1,1),fx=new Fe,Mp=new ma,Kl=new Hn,wr=new Dn,Va=new E,mx=new E,eI=new E,Sp=new KR,zn=new kt,jl=[];function tI(s,e,t=0){const n=e.itemSize;if(s.isInterleavedBufferAttribute||s.array.constructor!==e.array.constructor){const i=s.count;for(let r=0;r<i;r++)for(let o=0;o<n;o++)e.setComponent(r+t,o,s.getComponent(r,o))}else e.array.set(s.array,t*n);e.needsUpdate=!0}class um extends kt{get maxInstanceCount(){return this._maxInstanceCount}constructor(e,t,n=t*2,i){super(new at,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawInfo=[],this._availableInstanceIds=[],this._drawRanges=[],this._reservedRanges=[],this._bounds=[],this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._visibilityChanged=!0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Oi(t,e,e,Rn,Gn);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new Oi(t,e,e,Wc,Bi);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new Oi(t,e,e,Rn,Gn);n.colorSpace=gt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const r in e.attributes){const o=e.getAttribute(r),{array:a,itemSize:c,normalized:l}=o,u=new a.constructor(n*c),h=new At(u,c,l);t.setAttribute(r,h)}if(e.getIndex()!==null){const r=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new At(r,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Hn);const e=this.boundingBox,t=this._drawInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const r=t[n].geometryIndex;this.getMatrixAt(n,Xs),this.getBoundingBoxAt(r,Kl).applyMatrix4(Xs),e.union(Kl)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Dn);const e=this.boundingSphere,t=this._drawInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const r=t[n].geometryIndex;this.getMatrixAt(n,Xs),this.getBoundingSphereAt(r,wr).applyMatrix4(Xs),e.union(wr)}}addInstance(e){if(this._drawInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(i=this._availableInstanceIds.pop(),this._drawInfo[i]=n):(i=this._drawInfo.length,this._drawInfo.push(n));const r=this._matricesTexture,o=r.image.data;jR.toArray(o,i*16),r.needsUpdate=!0;const a=this._colorsTexture;return a&&(QR.toArray(a.image.data,i*4),a.needsUpdate=!0),i}addGeometry(e,t=-1,n=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let r=null;const o=this._reservedRanges,a=this._drawRanges,c=this._bounds;this._geometryCount!==0&&(r=o[o.length-1]),t===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=t,r===null?i.vertexStart=0:i.vertexStart=r.vertexStart+r.vertexCount;const l=e.getIndex(),u=l!==null;if(u&&(n===-1?i.indexCount=l.count:i.indexCount=n,r===null?i.indexStart=0:i.indexStart=r.indexStart+r.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._geometryCount;return this._geometryCount++,o.push(i),a.push({start:u?i.indexStart:i.vertexStart,count:-1}),c.push({boxInitialized:!1,box:new Hn,sphereInitialized:!1,sphere:new Dn}),this.setGeometryAt(h,e),h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,r=n.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const c=a.vertexStart,l=a.vertexCount;for(const p in n.attributes){const f=t.getAttribute(p),x=n.getAttribute(p);tI(f,x,c);const m=f.itemSize;for(let g=f.count,y=l;g<y;g++){const _=c+g;for(let v=0;v<m;v++)x.setComponent(_,v,0)}x.needsUpdate=!0,x.addUpdateRange(c*m,l*m)}if(i){const p=a.indexStart;for(let f=0;f<o.count;f++)r.setX(p+f,c+o.getX(f));for(let f=o.count,x=a.indexCount;f<x;f++)r.setX(p+f,c);r.needsUpdate=!0,r.addUpdateRange(p,a.indexCount)}const u=this._bounds[e];t.boundingBox!==null?(u.box.copy(t.boundingBox),u.boxInitialized=!0):u.boxInitialized=!1,t.boundingSphere!==null?(u.sphere.copy(t.boundingSphere),u.sphereInitialized=!0):u.sphereInitialized=!1;const h=this._drawRanges[e],d=t.getAttribute("position");return h.count=i?o.count:d.count,this._visibilityChanged=!0,e}deleteInstance(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?this:(t[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this._bounds[e],i=n.box,r=this.geometry;if(n.boxInitialized===!1){i.makeEmpty();const o=r.index,a=r.attributes.position,c=this._drawRanges[e];for(let l=c.start,u=c.start+c.count;l<u;l++){let h=l;o&&(h=o.getX(h)),i.expandByPoint(Va.fromBufferAttribute(a,h))}n.boxInitialized=!0}return t.copy(i),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this._bounds[e],i=n.sphere,r=this.geometry;if(n.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,Kl),Kl.getCenter(i.center);const o=r.index,a=r.attributes.position,c=this._drawRanges[e];let l=0;for(let u=c.start,h=c.start+c.count;u<h;u++){let d=u;o&&(d=o.getX(d)),Va.fromBufferAttribute(a,d),l=Math.max(l,i.center.distanceToSquared(Va))}i.radius=Math.sqrt(l),n.sphereInitialized=!0}return t.copy(i),t}setMatrixAt(e,t){const n=this._drawInfo,i=this._matricesTexture,r=this._matricesTexture.image.data;return e>=n.length||n[e].active===!1?this:(t.toArray(r,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,t){const n=this._drawInfo,i=this._matricesTexture.image.data;return e>=n.length||n[e].active===!1?null:t.fromArray(i,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const n=this._colorsTexture,i=this._colorsTexture.image.data,r=this._drawInfo;return e>=r.length||r[e].active===!1?this:(t.toArray(i,e*4),n.needsUpdate=!0,this)}getColorAt(e,t){const n=this._colorsTexture.image.data,i=this._drawInfo;return e>=i.length||i[e].active===!1?null:t.fromArray(n,e*4)}setVisibleAt(e,t){const n=this._drawInfo;return e>=n.length||n[e].active===!1||n[e].visible===t?this:(n[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?!1:t[e].visible}setGeometryIdAt(e,t){const n=this._drawInfo;return e>=n.length||n[e].active===!1||t<0||t>=this._geometryCount?null:(n[e].geometryIndex=t,this)}getGeometryIdAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?-1:t[e].geometryIndex}getGeometryRangeAt(e,t={}){if(e<0||e>=this._geometryCount)return null;const n=this._drawRanges[e];return t.start=n.start,t.count=n.count,t}raycast(e,t){const n=this._drawInfo,i=this._drawRanges,r=this.matrixWorld,o=this.geometry;zn.material=this.material,zn.geometry.index=o.index,zn.geometry.attributes=o.attributes,zn.geometry.boundingBox===null&&(zn.geometry.boundingBox=new Hn),zn.geometry.boundingSphere===null&&(zn.geometry.boundingSphere=new Dn);for(let a=0,c=n.length;a<c;a++){if(!n[a].visible||!n[a].active)continue;const l=n[a].geometryIndex,u=i[l];zn.geometry.setDrawRange(u.start,u.count),this.getMatrixAt(a,zn.matrixWorld).premultiply(r),this.getBoundingBoxAt(l,zn.geometry.boundingBox),this.getBoundingSphereAt(l,zn.geometry.boundingSphere),zn.raycast(e,jl);for(let h=0,d=jl.length;h<d;h++){const p=jl[h];p.object=this,p.batchId=a,t.push(p)}jl.length=0}zn.material=null,zn.geometry.index=null,zn.geometry.attributes={},zn.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(t=>({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._drawInfo=e._drawInfo.map(t=>({...t})),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,c=this._drawInfo,l=this._multiDrawStarts,u=this._multiDrawCounts,h=this._drawRanges,d=this.perObjectFrustumCulled,p=this._indirectTexture,f=p.image.data;d&&(fx.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Mp.setFromProjectionMatrix(fx,e.coordinateSystem));let x=0;if(this.sortObjects){vp.copy(this.matrixWorld).invert(),Va.setFromMatrixPosition(n.matrixWorld).applyMatrix4(vp),mx.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(vp);for(let y=0,_=c.length;y<_;y++)if(c[y].visible&&c[y].active){const v=c[y].geometryIndex;this.getMatrixAt(y,Xs),this.getBoundingSphereAt(v,wr).applyMatrix4(Xs);let I=!1;if(d&&(I=!Mp.intersectsSphere(wr)),!I){const T=eI.subVectors(wr.center,Va).dot(mx);Sp.push(h[v],T,y)}}const m=Sp.list,g=this.customSort;g===null?m.sort(r.transparent?JR:ZR):g.call(this,m,n);for(let y=0,_=m.length;y<_;y++){const v=m[y];l[x]=v.start*a,u[x]=v.count,f[x]=v.index,x++}Sp.reset()}else for(let m=0,g=c.length;m<g;m++)if(c[m].visible&&c[m].active){const y=c[m].geometryIndex;let _=!1;if(d&&(this.getMatrixAt(m,Xs),this.getBoundingSphereAt(y,wr).applyMatrix4(Xs),_=!Mp.intersectsSphere(wr)),!_){const v=h[y];l[x]=v.start*a,u[x]=v.count,f[x]=m,x++}}p.needsUpdate=!0,this._multiDrawCount=x,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,r,o){this.onBeforeRender(e,null,i,r,o)}}class Fn extends mn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new _e(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const ah=new E,ch=new E,gx=new Fe,Ba=new no,Ql=new Dn,Tp=new E,xx=new E;class Fs extends yt{constructor(e=new at,t=new Fn){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,r=t.count;i<r;i++)ah.fromBufferAttribute(t,i-1),ch.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=ah.distanceTo(ch);e.setAttribute("lineDistance",new Ve(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ql.copy(n.boundingSphere),Ql.applyMatrix4(i),Ql.radius+=r,e.ray.intersectsSphere(Ql)===!1)return;gx.copy(i).invert(),Ba.copy(e.ray).applyMatrix4(gx);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=this.isLineSegments?2:1,u=n.index,d=n.attributes.position;if(u!==null){const p=Math.max(0,o.start),f=Math.min(u.count,o.start+o.count);for(let x=p,m=f-1;x<m;x+=l){const g=u.getX(x),y=u.getX(x+1),_=eu(this,e,Ba,c,g,y);_&&t.push(_)}if(this.isLineLoop){const x=u.getX(f-1),m=u.getX(p),g=eu(this,e,Ba,c,x,m);g&&t.push(g)}}else{const p=Math.max(0,o.start),f=Math.min(d.count,o.start+o.count);for(let x=p,m=f-1;x<m;x+=l){const g=eu(this,e,Ba,c,x,x+1);g&&t.push(g)}if(this.isLineLoop){const x=eu(this,e,Ba,c,f-1,p);x&&t.push(x)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}function eu(s,e,t,n,i,r){const o=s.geometry.attributes.position;if(ah.fromBufferAttribute(o,i),ch.fromBufferAttribute(o,r),t.distanceSqToSegment(ah,ch,Tp,xx)>n)return;Tp.applyMatrix4(s.matrixWorld);const c=e.ray.origin.distanceTo(Tp);if(!(c<e.near||c>e.far))return{distance:c,point:xx.clone().applyMatrix4(s.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:s}}const _x=new E,yx=new E;class ss extends Fs{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,r=t.count;i<r;i+=2)_x.fromBufferAttribute(t,i),yx.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+_x.distanceTo(yx);e.setAttribute("lineDistance",new Ve(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class hm extends Fs{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class _a extends mn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new _e(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const vx=new Fe,af=new no,tu=new Dn,nu=new E;class dm extends yt{constructor(e=new at,t=new _a){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),tu.copy(n.boundingSphere),tu.applyMatrix4(i),tu.radius+=r,e.ray.intersectsSphere(tu)===!1)return;vx.copy(i).invert(),af.copy(e.ray).applyMatrix4(vx);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=n.index,h=n.attributes.position;if(l!==null){const d=Math.max(0,o.start),p=Math.min(l.count,o.start+o.count);for(let f=d,x=p;f<x;f++){const m=l.getX(f);nu.fromBufferAttribute(h,m),Mx(nu,m,c,i,e,t,this)}}else{const d=Math.max(0,o.start),p=Math.min(h.count,o.start+o.count);for(let f=d,x=p;f<x;f++)nu.fromBufferAttribute(h,f),Mx(nu,f,c,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}function Mx(s,e,t,n,i,r,o){const a=af.distanceSqToPoint(s);if(a<t){const c=new E;af.closestPointToPoint(s,c),c.applyMatrix4(n);const l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;r.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class Zy extends Xt{constructor(e,t,n,i,r,o,a,c,l){super(e,t,n,i,r,o,a,c,l),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Ut,this.magFilter=r!==void 0?r:Ut,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class pm extends Xt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Qt,this.minFilter=Qt,this.generateMipmaps=!1,this.needsUpdate=!0}}class Kc extends Xt{constructor(e,t,n,i,r,o,a,c,l,u,h,d){super(null,o,a,c,l,u,i,r,h,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Jy extends Kc{constructor(e,t,n,i,r,o){super(e,t,n,r,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Si,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Ky extends Kc{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,wi),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class jy extends Xt{constructor(e,t,n,i,r,o,a,c,l){super(e,t,n,i,r,o,a,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Gi{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let o;t?o=t:o=e*n[r-1];let a=0,c=r-1,l;for(;a<=c;)if(i=Math.floor(a+(c-a)/2),l=n[i]-o,l<0)a=i+1;else if(l>0)c=i-1;else{c=i;break}if(i=c,n[i]===o)return i/(r-1);const u=n[i],d=n[i+1]-u,p=(o-u)/d;return(i+p)/(r-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);const o=this.getPoint(i),a=this.getPoint(r),c=t||(o.isVector2?new J:new E);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new E,i=[],r=[],o=[],a=new E,c=new Fe;for(let p=0;p<=e;p++){const f=p/e;i[p]=this.getTangentAt(f,new E)}r[0]=new E,o[0]=new E;let l=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);u<=l&&(l=u,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),d<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),o[0].crossVectors(i[0],r[0]);for(let p=1;p<=e;p++){if(r[p]=r[p-1].clone(),o[p]=o[p-1].clone(),a.crossVectors(i[p-1],i[p]),a.length()>Number.EPSILON){a.normalize();const f=Math.acos(jt(i[p-1].dot(i[p]),-1,1));r[p].applyMatrix4(c.makeRotationAxis(a,f))}o[p].crossVectors(i[p],r[p])}if(t===!0){let p=Math.acos(jt(r[0].dot(r[e]),-1,1));p/=e,i[0].dot(a.crossVectors(r[0],r[e]))>0&&(p=-p);for(let f=1;f<=e;f++)r[f].applyMatrix4(c.makeRotationAxis(i[f],p*f)),o[f].crossVectors(i[f],r[f])}return{tangents:i,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Zh extends Gi{constructor(e=0,t=0,n=1,i=1,r=0,o=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t=new J){const n=t,i=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(o?r=0:r=i),this.aClockwise===!0&&!o&&(r===i?r=-i:r=r-i);const a=this.aStartAngle+e*r;let c=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=c-this.aX,p=l-this.aY;c=d*u-p*h+this.aX,l=d*h+p*u+this.aY}return n.set(c,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class Qy extends Zh{constructor(e,t,n,i,r,o){super(e,t,n,n,i,r,o),this.isArcCurve=!0,this.type="ArcCurve"}}function fm(){let s=0,e=0,t=0,n=0;function i(r,o,a,c){s=r,e=a,t=-3*r+3*o-2*a-c,n=2*r-2*o+a+c}return{initCatmullRom:function(r,o,a,c,l){i(o,a,l*(a-r),l*(c-o))},initNonuniformCatmullRom:function(r,o,a,c,l,u,h){let d=(o-r)/l-(a-r)/(l+u)+(a-o)/u,p=(a-o)/u-(c-o)/(u+h)+(c-a)/h;d*=u,p*=u,i(o,a,d,p)},calc:function(r){const o=r*r,a=o*r;return s+e*r+t*o+n*a}}}const iu=new E,bp=new fm,wp=new fm,Ap=new fm;class ev extends Gi{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new E){const n=t,i=this.points,r=i.length,o=(r-(this.closed?0:1))*e;let a=Math.floor(o),c=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/r)+1)*r:c===0&&a===r-1&&(a=r-2,c=1);let l,u;this.closed||a>0?l=i[(a-1)%r]:(iu.subVectors(i[0],i[1]).add(i[0]),l=iu);const h=i[a%r],d=i[(a+1)%r];if(this.closed||a+2<r?u=i[(a+2)%r]:(iu.subVectors(i[r-1],i[r-2]).add(i[r-1]),u=iu),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let f=Math.pow(l.distanceToSquared(h),p),x=Math.pow(h.distanceToSquared(d),p),m=Math.pow(d.distanceToSquared(u),p);x<1e-4&&(x=1),f<1e-4&&(f=x),m<1e-4&&(m=x),bp.initNonuniformCatmullRom(l.x,h.x,d.x,u.x,f,x,m),wp.initNonuniformCatmullRom(l.y,h.y,d.y,u.y,f,x,m),Ap.initNonuniformCatmullRom(l.z,h.z,d.z,u.z,f,x,m)}else this.curveType==="catmullrom"&&(bp.initCatmullRom(l.x,h.x,d.x,u.x,this.tension),wp.initCatmullRom(l.y,h.y,d.y,u.y,this.tension),Ap.initCatmullRom(l.z,h.z,d.z,u.z,this.tension));return n.set(bp.calc(c),wp.calc(c),Ap.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new E().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Sx(s,e,t,n,i){const r=(n-e)*.5,o=(i-t)*.5,a=s*s,c=s*a;return(2*t-2*n+r+o)*c+(-3*t+3*n-2*r-o)*a+r*s+t}function nI(s,e){const t=1-s;return t*t*e}function iI(s,e){return 2*(1-s)*s*e}function sI(s,e){return s*s*e}function Qa(s,e,t,n){return nI(s,e)+iI(s,t)+sI(s,n)}function rI(s,e){const t=1-s;return t*t*t*e}function oI(s,e){const t=1-s;return 3*t*t*s*e}function aI(s,e){return 3*(1-s)*s*s*e}function cI(s,e){return s*s*s*e}function ec(s,e,t,n,i){return rI(s,e)+oI(s,t)+aI(s,n)+cI(s,i)}class mm extends Gi{constructor(e=new J,t=new J,n=new J,i=new J){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new J){const n=t,i=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(ec(e,i.x,r.x,o.x,a.x),ec(e,i.y,r.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class tv extends Gi{constructor(e=new E,t=new E,n=new E,i=new E){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new E){const n=t,i=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(ec(e,i.x,r.x,o.x,a.x),ec(e,i.y,r.y,o.y,a.y),ec(e,i.z,r.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class gm extends Gi{constructor(e=new J,t=new J){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new J){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new J){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class nv extends Gi{constructor(e=new E,t=new E){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new E){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new E){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class xm extends Gi{constructor(e=new J,t=new J,n=new J){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new J){const n=t,i=this.v0,r=this.v1,o=this.v2;return n.set(Qa(e,i.x,r.x,o.x),Qa(e,i.y,r.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class _m extends Gi{constructor(e=new E,t=new E,n=new E){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new E){const n=t,i=this.v0,r=this.v1,o=this.v2;return n.set(Qa(e,i.x,r.x,o.x),Qa(e,i.y,r.y,o.y),Qa(e,i.z,r.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class ym extends Gi{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new J){const n=t,i=this.points,r=(i.length-1)*e,o=Math.floor(r),a=r-o,c=i[o===0?o:o-1],l=i[o],u=i[o>i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(Sx(a,c.x,l.x,u.x,h.x),Sx(a,c.y,l.y,u.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new J().fromArray(i))}return this}}var lh=Object.freeze({__proto__:null,ArcCurve:Qy,CatmullRomCurve3:ev,CubicBezierCurve:mm,CubicBezierCurve3:tv,EllipseCurve:Zh,LineCurve:gm,LineCurve3:nv,QuadraticBezierCurve:xm,QuadraticBezierCurve3:_m,SplineCurve:ym});class iv extends Gi{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new lh[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const o=i[r]-n,a=this.curves[r],c=a.getLength(),l=c===0?0:1-o/c;return a.getPointAt(l,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const o=r[i],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,c=o.getPoints(a);for(let l=0;l<c.length;l++){const u=c[l];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new lh[i.type]().fromJSON(i))}return this}}class Rc extends iv{constructor(e){super(),this.type="Path",this.currentPoint=new J,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new gm(this.currentPoint.clone(),new J(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new xm(this.currentPoint.clone(),new J(e,t),new J(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,o){const a=new mm(this.currentPoint.clone(),new J(e,t),new J(n,i),new J(r,o));return this.curves.push(a),this.currentPoint.set(r,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new ym(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,o){const a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,n,i,r,o),this}absarc(e,t,n,i,r,o){return this.absellipse(e,t,n,n,i,r,o),this}ellipse(e,t,n,i,r,o,a,c){const l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,n,i,r,o,a,c),this}absellipse(e,t,n,i,r,o,a,c){const l=new Zh(e,t,n,i,r,o,a,c);if(this.curves.length>0){const h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);const u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class jc extends at{constructor(e=[new J(0,-.5),new J(.5,0),new J(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=jt(i,0,Math.PI*2);const r=[],o=[],a=[],c=[],l=[],u=1/t,h=new E,d=new J,p=new E,f=new E,x=new E;let m=0,g=0;for(let y=0;y<=e.length-1;y++)switch(y){case 0:m=e[y+1].x-e[y].x,g=e[y+1].y-e[y].y,p.x=g*1,p.y=-m,p.z=g*0,x.copy(p),p.normalize(),c.push(p.x,p.y,p.z);break;case e.length-1:c.push(x.x,x.y,x.z);break;default:m=e[y+1].x-e[y].x,g=e[y+1].y-e[y].y,p.x=g*1,p.y=-m,p.z=g*0,f.copy(p),p.x+=x.x,p.y+=x.y,p.z+=x.z,p.normalize(),c.push(p.x,p.y,p.z),x.copy(f)}for(let y=0;y<=t;y++){const _=n+y*u*i,v=Math.sin(_),I=Math.cos(_);for(let T=0;T<=e.length-1;T++){h.x=e[T].x*v,h.y=e[T].y,h.z=e[T].x*I,o.push(h.x,h.y,h.z),d.x=y/t,d.y=T/(e.length-1),a.push(d.x,d.y);const w=c[3*T+0]*v,C=c[3*T+1],F=c[3*T+0]*I;l.push(w,C,F)}}for(let y=0;y<t;y++)for(let _=0;_<e.length-1;_++){const v=_+y*e.length,I=v,T=v+e.length,w=v+e.length+1,C=v+1;r.push(I,T,C),r.push(w,C,T)}this.setIndex(r),this.setAttribute("position",new Ve(o,3)),this.setAttribute("uv",new Ve(a,2)),this.setAttribute("normal",new Ve(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new jc(e.points,e.segments,e.phiStart,e.phiLength)}}class Jh extends jc{constructor(e=1,t=1,n=4,i=8){const r=new Rc;r.absarc(0,-t/2,e,Math.PI*1.5,0),r.absarc(0,t/2,e,0,Math.PI*.5),super(r.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:n,radialSegments:i}}static fromJSON(e){return new Jh(e.radius,e.length,e.capSegments,e.radialSegments)}}class Kh extends at{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const r=[],o=[],a=[],c=[],l=new E,u=new J;o.push(0,0,0),a.push(0,0,1),c.push(.5,.5);for(let h=0,d=3;h<=t;h++,d+=3){const p=n+h/t*i;l.x=e*Math.cos(p),l.y=e*Math.sin(p),o.push(l.x,l.y,l.z),a.push(0,0,1),u.x=(o[d]/e+1)/2,u.y=(o[d+1]/e+1)/2,c.push(u.x,u.y)}for(let h=1;h<=t;h++)r.push(h,h+1,0);this.setIndex(r),this.setAttribute("position",new Ve(o,3)),this.setAttribute("normal",new Ve(a,3)),this.setAttribute("uv",new Ve(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Kh(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class ao extends at{constructor(e=1,t=1,n=1,i=32,r=1,o=!1,a=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:c};const l=this;i=Math.floor(i),r=Math.floor(r);const u=[],h=[],d=[],p=[];let f=0;const x=[],m=n/2;let g=0;y(),o===!1&&(e>0&&_(!0),t>0&&_(!1)),this.setIndex(u),this.setAttribute("position",new Ve(h,3)),this.setAttribute("normal",new Ve(d,3)),this.setAttribute("uv",new Ve(p,2));function y(){const v=new E,I=new E;let T=0;const w=(t-e)/n;for(let C=0;C<=r;C++){const F=[],M=C/r,b=M*(t-e)+e;for(let G=0;G<=i;G++){const W=G/i,$=W*c+a,ie=Math.sin($),q=Math.cos($);I.x=b*ie,I.y=-M*n+m,I.z=b*q,h.push(I.x,I.y,I.z),v.set(ie,w,q).normalize(),d.push(v.x,v.y,v.z),p.push(W,1-M),F.push(f++)}x.push(F)}for(let C=0;C<i;C++)for(let F=0;F<r;F++){const M=x[F][C],b=x[F+1][C],G=x[F+1][C+1],W=x[F][C+1];e>0&&(u.push(M,b,W),T+=3),t>0&&(u.push(b,G,W),T+=3)}l.addGroup(g,T,0),g+=T}function _(v){const I=f,T=new J,w=new E;let C=0;const F=v===!0?e:t,M=v===!0?1:-1;for(let G=1;G<=i;G++)h.push(0,m*M,0),d.push(0,M,0),p.push(.5,.5),f++;const b=f;for(let G=0;G<=i;G++){const $=G/i*c+a,ie=Math.cos($),q=Math.sin($);w.x=F*q,w.y=m*M,w.z=F*ie,h.push(w.x,w.y,w.z),d.push(0,M,0),T.x=ie*.5+.5,T.y=q*.5*M+.5,p.push(T.x,T.y),f++}for(let G=0;G<i;G++){const W=I+G,$=b+G;v===!0?u.push($,$+1,W):u.push($+1,$,W),C+=3}l.addGroup(g,C,v===!0?1:2),g+=C}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ao(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class jh extends ao{constructor(e=1,t=1,n=32,i=1,r=!1,o=0,a=Math.PI*2){super(0,e,t,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}static fromJSON(e){return new jh(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class hr extends at{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],o=[];a(i),l(n),u(),this.setAttribute("position",new Ve(r,3)),this.setAttribute("normal",new Ve(r.slice(),3)),this.setAttribute("uv",new Ve(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(y){const _=new E,v=new E,I=new E;for(let T=0;T<t.length;T+=3)p(t[T+0],_),p(t[T+1],v),p(t[T+2],I),c(_,v,I,y)}function c(y,_,v,I){const T=I+1,w=[];for(let C=0;C<=T;C++){w[C]=[];const F=y.clone().lerp(v,C/T),M=_.clone().lerp(v,C/T),b=T-C;for(let G=0;G<=b;G++)G===0&&C===T?w[C][G]=F:w[C][G]=F.clone().lerp(M,G/b)}for(let C=0;C<T;C++)for(let F=0;F<2*(T-C)-1;F++){const M=Math.floor(F/2);F%2===0?(d(w[C][M+1]),d(w[C+1][M]),d(w[C][M])):(d(w[C][M+1]),d(w[C+1][M+1]),d(w[C+1][M]))}}function l(y){const _=new E;for(let v=0;v<r.length;v+=3)_.x=r[v+0],_.y=r[v+1],_.z=r[v+2],_.normalize().multiplyScalar(y),r[v+0]=_.x,r[v+1]=_.y,r[v+2]=_.z}function u(){const y=new E;for(let _=0;_<r.length;_+=3){y.x=r[_+0],y.y=r[_+1],y.z=r[_+2];const v=m(y)/2/Math.PI+.5,I=g(y)/Math.PI+.5;o.push(v,1-I)}f(),h()}function h(){for(let y=0;y<o.length;y+=6){const _=o[y+0],v=o[y+2],I=o[y+4],T=Math.max(_,v,I),w=Math.min(_,v,I);T>.9&&w<.1&&(_<.2&&(o[y+0]+=1),v<.2&&(o[y+2]+=1),I<.2&&(o[y+4]+=1))}}function d(y){r.push(y.x,y.y,y.z)}function p(y,_){const v=y*3;_.x=e[v+0],_.y=e[v+1],_.z=e[v+2]}function f(){const y=new E,_=new E,v=new E,I=new E,T=new J,w=new J,C=new J;for(let F=0,M=0;F<r.length;F+=9,M+=6){y.set(r[F+0],r[F+1],r[F+2]),_.set(r[F+3],r[F+4],r[F+5]),v.set(r[F+6],r[F+7],r[F+8]),T.set(o[M+0],o[M+1]),w.set(o[M+2],o[M+3]),C.set(o[M+4],o[M+5]),I.copy(y).add(_).add(v).divideScalar(3);const b=m(I);x(T,M+0,y,b),x(w,M+2,_,b),x(C,M+4,v,b)}}function x(y,_,v,I){I<0&&y.x===1&&(o[_]=y.x-1),v.x===0&&v.z===0&&(o[_]=I/2/Math.PI+.5)}function m(y){return Math.atan2(y.z,-y.x)}function g(y){return Math.atan2(-y.y,Math.sqrt(y.x*y.x+y.z*y.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new hr(e.vertices,e.indices,e.radius,e.details)}}class Qh extends hr{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],o=[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];super(r,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Qh(e.radius,e.detail)}}const su=new E,ru=new E,Np=new E,ou=new Zn;class vm extends at{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),r=Math.cos(Xr*t),o=e.getIndex(),a=e.getAttribute("position"),c=o?o.count:a.count,l=[0,0,0],u=["a","b","c"],h=new Array(3),d={},p=[];for(let f=0;f<c;f+=3){o?(l[0]=o.getX(f),l[1]=o.getX(f+1),l[2]=o.getX(f+2)):(l[0]=f,l[1]=f+1,l[2]=f+2);const{a:x,b:m,c:g}=ou;if(x.fromBufferAttribute(a,l[0]),m.fromBufferAttribute(a,l[1]),g.fromBufferAttribute(a,l[2]),ou.getNormal(Np),h[0]=`${Math.round(x.x*i)},${Math.round(x.y*i)},${Math.round(x.z*i)}`,h[1]=`${Math.round(m.x*i)},${Math.round(m.y*i)},${Math.round(m.z*i)}`,h[2]=`${Math.round(g.x*i)},${Math.round(g.y*i)},${Math.round(g.z*i)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let y=0;y<3;y++){const _=(y+1)%3,v=h[y],I=h[_],T=ou[u[y]],w=ou[u[_]],C=`${v}_${I}`,F=`${I}_${v}`;F in d&&d[F]?(Np.dot(d[F].normal)<=r&&(p.push(T.x,T.y,T.z),p.push(w.x,w.y,w.z)),d[F]=null):C in d||(d[C]={index0:l[y],index1:l[_],normal:Np.clone()})}}for(const f in d)if(d[f]){const{index0:x,index1:m}=d[f];su.fromBufferAttribute(a,x),ru.fromBufferAttribute(a,m),p.push(su.x,su.y,su.z),p.push(ru.x,ru.y,ru.z)}this.setAttribute("position",new Ve(p,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class er extends Rc{constructor(e){super(e),this.uuid=bi(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new Rc().fromJSON(i))}return this}}const lI={triangulate:function(s,e,t=2){const n=e&&e.length,i=n?e[0]*t:s.length;let r=sv(s,0,i,t,!0);const o=[];if(!r||r.next===r.prev)return o;let a,c,l,u,h,d,p;if(n&&(r=fI(s,e,r,t)),s.length>80*t){a=l=s[0],c=u=s[1];for(let f=t;f<i;f+=t)h=s[f],d=s[f+1],h<a&&(a=h),d<c&&(c=d),h>l&&(l=h),d>u&&(u=d);p=Math.max(l-a,u-c),p=p!==0?32767/p:0}return Ic(r,o,t,a,c,p,0),o}};function sv(s,e,t,n,i){let r,o;if(i===wI(s,e,t,n)>0)for(r=e;r<t;r+=n)o=Tx(r,s[r],s[r+1],o);else for(r=t-n;r>=e;r-=n)o=Tx(r,s[r],s[r+1],o);return o&&ed(o,o.next)&&(Lc(o),o=o.next),o}function jr(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(ed(t,t.next)||Zt(t.prev,t,t.next)===0)){if(Lc(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Ic(s,e,t,n,i,r,o){if(!s)return;!o&&r&&yI(s,n,i,r);let a=s,c,l;for(;s.prev!==s.next;){if(c=s.prev,l=s.next,r?hI(s,n,i,r):uI(s)){e.push(c.i/t|0),e.push(s.i/t|0),e.push(l.i/t|0),Lc(s),s=l.next,a=l.next;continue}if(s=l,s===a){o?o===1?(s=dI(jr(s),e,t),Ic(s,e,t,n,i,r,2)):o===2&&pI(s,e,t,n,i,r):Ic(jr(s),e,t,n,i,r,1);break}}}function uI(s){const e=s.prev,t=s,n=s.next;if(Zt(e,t,n)>=0)return!1;const i=e.x,r=t.x,o=n.x,a=e.y,c=t.y,l=n.y,u=i<r?i<o?i:o:r<o?r:o,h=a<c?a<l?a:l:c<l?c:l,d=i>r?i>o?i:o:r>o?r:o,p=a>c?a>l?a:l:c>l?c:l;let f=n.next;for(;f!==e;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&Ho(i,a,r,c,o,l,f.x,f.y)&&Zt(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function hI(s,e,t,n){const i=s.prev,r=s,o=s.next;if(Zt(i,r,o)>=0)return!1;const a=i.x,c=r.x,l=o.x,u=i.y,h=r.y,d=o.y,p=a<c?a<l?a:l:c<l?c:l,f=u<h?u<d?u:d:h<d?h:d,x=a>c?a>l?a:l:c>l?c:l,m=u>h?u>d?u:d:h>d?h:d,g=cf(p,f,e,t,n),y=cf(x,m,e,t,n);let _=s.prevZ,v=s.nextZ;for(;_&&_.z>=g&&v&&v.z<=y;){if(_.x>=p&&_.x<=x&&_.y>=f&&_.y<=m&&_!==i&&_!==o&&Ho(a,u,c,h,l,d,_.x,_.y)&&Zt(_.prev,_,_.next)>=0||(_=_.prevZ,v.x>=p&&v.x<=x&&v.y>=f&&v.y<=m&&v!==i&&v!==o&&Ho(a,u,c,h,l,d,v.x,v.y)&&Zt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;_&&_.z>=g;){if(_.x>=p&&_.x<=x&&_.y>=f&&_.y<=m&&_!==i&&_!==o&&Ho(a,u,c,h,l,d,_.x,_.y)&&Zt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;v&&v.z<=y;){if(v.x>=p&&v.x<=x&&v.y>=f&&v.y<=m&&v!==i&&v!==o&&Ho(a,u,c,h,l,d,v.x,v.y)&&Zt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function dI(s,e,t){let n=s;do{const i=n.prev,r=n.next.next;!ed(i,r)&&rv(i,n,n.next,r)&&Pc(i,r)&&Pc(r,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(r.i/t|0),Lc(n),Lc(n.next),n=s=r),n=n.next}while(n!==s);return jr(n)}function pI(s,e,t,n,i,r){let o=s;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&SI(o,a)){let c=ov(o,a);o=jr(o,o.next),c=jr(c,c.next),Ic(o,e,t,n,i,r,0),Ic(c,e,t,n,i,r,0);return}a=a.next}o=o.next}while(o!==s)}function fI(s,e,t,n){const i=[];let r,o,a,c,l;for(r=0,o=e.length;r<o;r++)a=e[r]*n,c=r<o-1?e[r+1]*n:s.length,l=sv(s,a,c,n,!1),l===l.next&&(l.steiner=!0),i.push(MI(l));for(i.sort(mI),r=0;r<i.length;r++)t=gI(i[r],t);return t}function mI(s,e){return s.x-e.x}function gI(s,e){const t=xI(s,e);if(!t)return e;const n=ov(t,s);return jr(n,n.next),jr(t,t.next)}function xI(s,e){let t=e,n=-1/0,i;const r=s.x,o=s.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){const d=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=r&&d>n&&(n=d,i=t.x<t.next.x?t:t.next,d===r))return i}t=t.next}while(t!==e);if(!i)return null;const a=i,c=i.x,l=i.y;let u=1/0,h;t=i;do r>=t.x&&t.x>=c&&r!==t.x&&Ho(o<l?r:n,o,c,l,o<l?n:r,o,t.x,t.y)&&(h=Math.abs(o-t.y)/(r-t.x),Pc(t,s)&&(h<u||h===u&&(t.x>i.x||t.x===i.x&&_I(i,t)))&&(i=t,u=h)),t=t.next;while(t!==a);return i}function _I(s,e){return Zt(s.prev,s,e.prev)<0&&Zt(e.next,s,s.next)<0}function yI(s,e,t,n){let i=s;do i.z===0&&(i.z=cf(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,vI(i)}function vI(s){let e,t,n,i,r,o,a,c,l=1;do{for(t=s,s=null,r=null,o=0;t;){for(o++,n=t,a=0,e=0;e<l&&(a++,n=n.nextZ,!!n);e++);for(c=l;a>0||c>0&&n;)a!==0&&(c===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,c--),r?r.nextZ=i:s=i,i.prevZ=r,r=i;t=n}r.nextZ=null,l*=2}while(o>1);return s}function cf(s,e,t,n,i){return s=(s-t)*i|0,e=(e-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function MI(s){let e=s,t=s;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==s);return t}function Ho(s,e,t,n,i,r,o,a){return(i-o)*(e-a)>=(s-o)*(r-a)&&(s-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(r-a)>=(i-o)*(n-a)}function SI(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!TI(s,e)&&(Pc(s,e)&&Pc(e,s)&&bI(s,e)&&(Zt(s.prev,s,e.prev)||Zt(s,e.prev,e))||ed(s,e)&&Zt(s.prev,s,s.next)>0&&Zt(e.prev,e,e.next)>0)}function Zt(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function ed(s,e){return s.x===e.x&&s.y===e.y}function rv(s,e,t,n){const i=cu(Zt(s,e,t)),r=cu(Zt(s,e,n)),o=cu(Zt(t,n,s)),a=cu(Zt(t,n,e));return!!(i!==r&&o!==a||i===0&&au(s,t,e)||r===0&&au(s,n,e)||o===0&&au(t,s,n)||a===0&&au(t,e,n))}function au(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function cu(s){return s>0?1:s<0?-1:0}function TI(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&rv(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function Pc(s,e){return Zt(s.prev,s,s.next)<0?Zt(s,e,s.next)>=0&&Zt(s,s.prev,e)>=0:Zt(s,e,s.prev)<0||Zt(s,s.next,e)<0}function bI(s,e){let t=s,n=!1;const i=(s.x+e.x)/2,r=(s.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&i<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function ov(s,e){const t=new lf(s.i,s.x,s.y),n=new lf(e.i,e.x,e.y),i=s.next,r=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,r.next=n,n.prev=r,n}function Tx(s,e,t,n){const i=new lf(s,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Lc(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function lf(s,e,t){this.i=s,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function wI(s,e,t,n){let i=0;for(let r=e,o=t-n;r<t;r+=n)i+=(s[o]-s[r])*(s[r+1]+s[o+1]),o=r;return i}class Ki{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return n*.5}static isClockWise(e){return Ki.area(e)<0}static triangulateShape(e,t){const n=[],i=[],r=[];bx(e),wx(n,e);let o=e.length;t.forEach(bx);for(let c=0;c<t.length;c++)i.push(o),o+=t[c].length,wx(n,t[c]);const a=lI.triangulate(n,i);for(let c=0;c<a.length;c+=3)r.push(a.slice(c,c+3));return r}}function bx(s){const e=s.length;e>2&&s[e-1].equals(s[0])&&s.pop()}function wx(s,e){for(let t=0;t<e.length;t++)s.push(e[t].x),s.push(e[t].y)}class Qc extends at{constructor(e=new er([new J(.5,.5),new J(-.5,.5),new J(-.5,-.5),new J(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let a=0,c=e.length;a<c;a++){const l=e[a];o(l)}this.setAttribute("position",new Ve(i,3)),this.setAttribute("uv",new Ve(r,2)),this.computeVertexNormals();function o(a){const c=[],l=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1;let d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,p=t.bevelThickness!==void 0?t.bevelThickness:.2,f=t.bevelSize!==void 0?t.bevelSize:p-.1,x=t.bevelOffset!==void 0?t.bevelOffset:0,m=t.bevelSegments!==void 0?t.bevelSegments:3;const g=t.extrudePath,y=t.UVGenerator!==void 0?t.UVGenerator:AI;let _,v=!1,I,T,w,C;g&&(_=g.getSpacedPoints(u),v=!0,d=!1,I=g.computeFrenetFrames(u,!1),T=new E,w=new E,C=new E),d||(m=0,p=0,f=0,x=0);const F=a.extractPoints(l);let M=F.shape;const b=F.holes;if(!Ki.isClockWise(M)){M=M.reverse();for(let ae=0,P=b.length;ae<P;ae++){const Me=b[ae];Ki.isClockWise(Me)&&(b[ae]=Me.reverse())}}const W=Ki.triangulateShape(M,b),$=M;for(let ae=0,P=b.length;ae<P;ae++){const Me=b[ae];M=M.concat(Me)}function ie(ae,P,Me){return P||console.error("THREE.ExtrudeGeometry: vec does not exist"),ae.clone().addScaledVector(P,Me)}const q=M.length,he=W.length;function Q(ae,P,Me){let ye,de,Te;const qe=ae.x-P.x,Ie=ae.y-P.y,R=Me.x-ae.x,S=Me.y-ae.y,X=qe*qe+Ie*Ie,se=qe*S-Ie*R;if(Math.abs(se)>Number.EPSILON){const ce=Math.sqrt(X),re=Math.sqrt(R*R+S*S),ke=P.x-Ie/ce,be=P.y+qe/ce,De=Me.x-S/re,vt=Me.y+R/re,me=((De-ke)*S-(vt-be)*R)/(qe*S-Ie*R);ye=ke+qe*me-ae.x,de=be+Ie*me-ae.y;const Ue=ye*ye+de*de;if(Ue<=2)return new J(ye,de);Te=Math.sqrt(Ue/2)}else{let ce=!1;qe>Number.EPSILON?R>Number.EPSILON&&(ce=!0):qe<-Number.EPSILON?R<-Number.EPSILON&&(ce=!0):Math.sign(Ie)===Math.sign(S)&&(ce=!0),ce?(ye=-Ie,de=qe,Te=Math.sqrt(X)):(ye=qe,de=Ie,Te=Math.sqrt(X/2))}return new J(ye/Te,de/Te)}const we=[];for(let ae=0,P=$.length,Me=P-1,ye=ae+1;ae<P;ae++,Me++,ye++)Me===P&&(Me=0),ye===P&&(ye=0),we[ae]=Q($[ae],$[Me],$[ye]);const Ne=[];let Ee,Qe=we.concat();for(let ae=0,P=b.length;ae<P;ae++){const Me=b[ae];Ee=[];for(let ye=0,de=Me.length,Te=de-1,qe=ye+1;ye<de;ye++,Te++,qe++)Te===de&&(Te=0),qe===de&&(qe=0),Ee[ye]=Q(Me[ye],Me[Te],Me[qe]);Ne.push(Ee),Qe=Qe.concat(Ee)}for(let ae=0;ae<m;ae++){const P=ae/m,Me=p*Math.cos(P*Math.PI/2),ye=f*Math.sin(P*Math.PI/2)+x;for(let de=0,Te=$.length;de<Te;de++){const qe=ie($[de],we[de],ye);ge(qe.x,qe.y,-Me)}for(let de=0,Te=b.length;de<Te;de++){const qe=b[de];Ee=Ne[de];for(let Ie=0,R=qe.length;Ie<R;Ie++){const S=ie(qe[Ie],Ee[Ie],ye);ge(S.x,S.y,-Me)}}}const ht=f+x;for(let ae=0;ae<q;ae++){const P=d?ie(M[ae],Qe[ae],ht):M[ae];v?(w.copy(I.normals[0]).multiplyScalar(P.x),T.copy(I.binormals[0]).multiplyScalar(P.y),C.copy(_[0]).add(w).add(T),ge(C.x,C.y,C.z)):ge(P.x,P.y,0)}for(let ae=1;ae<=u;ae++)for(let P=0;P<q;P++){const Me=d?ie(M[P],Qe[P],ht):M[P];v?(w.copy(I.normals[ae]).multiplyScalar(Me.x),T.copy(I.binormals[ae]).multiplyScalar(Me.y),C.copy(_[ae]).add(w).add(T),ge(C.x,C.y,C.z)):ge(Me.x,Me.y,h/u*ae)}for(let ae=m-1;ae>=0;ae--){const P=ae/m,Me=p*Math.cos(P*Math.PI/2),ye=f*Math.sin(P*Math.PI/2)+x;for(let de=0,Te=$.length;de<Te;de++){const qe=ie($[de],we[de],ye);ge(qe.x,qe.y,h+Me)}for(let de=0,Te=b.length;de<Te;de++){const qe=b[de];Ee=Ne[de];for(let Ie=0,R=qe.length;Ie<R;Ie++){const S=ie(qe[Ie],Ee[Ie],ye);v?ge(S.x,S.y+_[u-1].y,_[u-1].x+Me):ge(S.x,S.y,h+Me)}}}ne(),ue();function ne(){const ae=i.length/3;if(d){let P=0,Me=q*P;for(let ye=0;ye<he;ye++){const de=W[ye];Ze(de[2]+Me,de[1]+Me,de[0]+Me)}P=u+m*2,Me=q*P;for(let ye=0;ye<he;ye++){const de=W[ye];Ze(de[0]+Me,de[1]+Me,de[2]+Me)}}else{for(let P=0;P<he;P++){const Me=W[P];Ze(Me[2],Me[1],Me[0])}for(let P=0;P<he;P++){const Me=W[P];Ze(Me[0]+q*u,Me[1]+q*u,Me[2]+q*u)}}n.addGroup(ae,i.length/3-ae,0)}function ue(){const ae=i.length/3;let P=0;Ae($,P),P+=$.length;for(let Me=0,ye=b.length;Me<ye;Me++){const de=b[Me];Ae(de,P),P+=de.length}n.addGroup(ae,i.length/3-ae,1)}function Ae(ae,P){let Me=ae.length;for(;--Me>=0;){const ye=Me;let de=Me-1;de<0&&(de=ae.length-1);for(let Te=0,qe=u+m*2;Te<qe;Te++){const Ie=q*Te,R=q*(Te+1),S=P+ye+Ie,X=P+de+Ie,se=P+de+R,ce=P+ye+R;Xe(S,X,se,ce)}}}function ge(ae,P,Me){c.push(ae),c.push(P),c.push(Me)}function Ze(ae,P,Me){Je(ae),Je(P),Je(Me);const ye=i.length/3,de=y.generateTopUV(n,i,ye-3,ye-2,ye-1);dt(de[0]),dt(de[1]),dt(de[2])}function Xe(ae,P,Me,ye){Je(ae),Je(P),Je(ye),Je(P),Je(Me),Je(ye);const de=i.length/3,Te=y.generateSideWallUV(n,i,de-6,de-3,de-2,de-1);dt(Te[0]),dt(Te[1]),dt(Te[3]),dt(Te[1]),dt(Te[2]),dt(Te[3])}function Je(ae){i.push(c[ae*3+0]),i.push(c[ae*3+1]),i.push(c[ae*3+2])}function dt(ae){r.push(ae.x),r.push(ae.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return NI(t,n,e)}static fromJSON(e,t){const n=[];for(let r=0,o=e.shapes.length;r<o;r++){const a=t[e.shapes[r]];n.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new lh[i.type]().fromJSON(i)),new Qc(n,e.options)}}const AI={generateTopUV:function(s,e,t,n,i){const r=e[t*3],o=e[t*3+1],a=e[n*3],c=e[n*3+1],l=e[i*3],u=e[i*3+1];return[new J(r,o),new J(a,c),new J(l,u)]},generateSideWallUV:function(s,e,t,n,i,r){const o=e[t*3],a=e[t*3+1],c=e[t*3+2],l=e[n*3],u=e[n*3+1],h=e[n*3+2],d=e[i*3],p=e[i*3+1],f=e[i*3+2],x=e[r*3],m=e[r*3+1],g=e[r*3+2];return Math.abs(a-u)<Math.abs(o-l)?[new J(o,1-c),new J(l,1-h),new J(d,1-f),new J(x,1-g)]:[new J(a,1-c),new J(u,1-h),new J(p,1-f),new J(m,1-g)]}};function NI(s,e,t){if(t.shapes=[],Array.isArray(s))for(let n=0,i=s.length;n<i;n++){const r=s[n];t.shapes.push(r.uuid)}else t.shapes.push(s.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class td extends hr{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,r,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new td(e.radius,e.detail)}}class ya extends hr{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ya(e.radius,e.detail)}}class el extends at{constructor(e=.5,t=1,n=32,i=1,r=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const a=[],c=[],l=[],u=[];let h=e;const d=(t-e)/i,p=new E,f=new J;for(let x=0;x<=i;x++){for(let m=0;m<=n;m++){const g=r+m/n*o;p.x=h*Math.cos(g),p.y=h*Math.sin(g),c.push(p.x,p.y,p.z),l.push(0,0,1),f.x=(p.x/t+1)/2,f.y=(p.y/t+1)/2,u.push(f.x,f.y)}h+=d}for(let x=0;x<i;x++){const m=x*(n+1);for(let g=0;g<n;g++){const y=g+m,_=y,v=y+n+1,I=y+n+2,T=y+1;a.push(_,v,T),a.push(v,I,T)}}this.setIndex(a),this.setAttribute("position",new Ve(c,3)),this.setAttribute("normal",new Ve(l,3)),this.setAttribute("uv",new Ve(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new el(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class nd extends at{constructor(e=new er([new J(0,.5),new J(-.5,-.5),new J(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],o=[];let a=0,c=0;if(Array.isArray(e)===!1)l(e);else for(let u=0;u<e.length;u++)l(e[u]),this.addGroup(a,c,u),a+=c,c=0;this.setIndex(n),this.setAttribute("position",new Ve(i,3)),this.setAttribute("normal",new Ve(r,3)),this.setAttribute("uv",new Ve(o,2));function l(u){const h=i.length/3,d=u.extractPoints(t);let p=d.shape;const f=d.holes;Ki.isClockWise(p)===!1&&(p=p.reverse());for(let m=0,g=f.length;m<g;m++){const y=f[m];Ki.isClockWise(y)===!0&&(f[m]=y.reverse())}const x=Ki.triangulateShape(p,f);for(let m=0,g=f.length;m<g;m++){const y=f[m];p=p.concat(y)}for(let m=0,g=p.length;m<g;m++){const y=p[m];i.push(y.x,y.y,0),r.push(0,0,1),o.push(y.x,y.y)}for(let m=0,g=x.length;m<g;m++){const y=x[m],_=y[0]+h,v=y[1]+h,I=y[2]+h;n.push(_,v,I),c+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return EI(t,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const o=t[e.shapes[i]];n.push(o)}return new nd(n,e.curveSegments)}}function EI(s,e){if(e.shapes=[],Array.isArray(s))for(let t=0,n=s.length;t<n;t++){const i=s[t];e.shapes.push(i.uuid)}else e.shapes.push(s.uuid);return e}class va extends at{constructor(e=1,t=32,n=16,i=0,r=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const c=Math.min(o+a,Math.PI);let l=0;const u=[],h=new E,d=new E,p=[],f=[],x=[],m=[];for(let g=0;g<=n;g++){const y=[],_=g/n;let v=0;g===0&&o===0?v=.5/t:g===n&&c===Math.PI&&(v=-.5/t);for(let I=0;I<=t;I++){const T=I/t;h.x=-e*Math.cos(i+T*r)*Math.sin(o+_*a),h.y=e*Math.cos(o+_*a),h.z=e*Math.sin(i+T*r)*Math.sin(o+_*a),f.push(h.x,h.y,h.z),d.copy(h).normalize(),x.push(d.x,d.y,d.z),m.push(T+v,1-_),y.push(l++)}u.push(y)}for(let g=0;g<n;g++)for(let y=0;y<t;y++){const _=u[g][y+1],v=u[g][y],I=u[g+1][y],T=u[g+1][y+1];(g!==0||o>0)&&p.push(_,v,T),(g!==n-1||c<Math.PI)&&p.push(v,I,T)}this.setIndex(p),this.setAttribute("position",new Ve(f,3)),this.setAttribute("normal",new Ve(x,3)),this.setAttribute("uv",new Ve(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new va(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class id extends hr{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new id(e.radius,e.detail)}}class tl extends at{constructor(e=1,t=.4,n=12,i=48,r=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],c=[],l=[],u=new E,h=new E,d=new E;for(let p=0;p<=n;p++)for(let f=0;f<=i;f++){const x=f/i*r,m=p/n*Math.PI*2;h.x=(e+t*Math.cos(m))*Math.cos(x),h.y=(e+t*Math.cos(m))*Math.sin(x),h.z=t*Math.sin(m),a.push(h.x,h.y,h.z),u.x=e*Math.cos(x),u.y=e*Math.sin(x),d.subVectors(h,u).normalize(),c.push(d.x,d.y,d.z),l.push(f/i),l.push(p/n)}for(let p=1;p<=n;p++)for(let f=1;f<=i;f++){const x=(i+1)*p+f-1,m=(i+1)*(p-1)+f-1,g=(i+1)*(p-1)+f,y=(i+1)*p+f;o.push(x,m,y),o.push(m,g,y)}this.setIndex(o),this.setAttribute("position",new Ve(a,3)),this.setAttribute("normal",new Ve(c,3)),this.setAttribute("uv",new Ve(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tl(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class sd extends at{constructor(e=1,t=.4,n=64,i=8,r=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:o},n=Math.floor(n),i=Math.floor(i);const a=[],c=[],l=[],u=[],h=new E,d=new E,p=new E,f=new E,x=new E,m=new E,g=new E;for(let _=0;_<=n;++_){const v=_/n*r*Math.PI*2;y(v,r,o,e,p),y(v+.01,r,o,e,f),m.subVectors(f,p),g.addVectors(f,p),x.crossVectors(m,g),g.crossVectors(x,m),x.normalize(),g.normalize();for(let I=0;I<=i;++I){const T=I/i*Math.PI*2,w=-t*Math.cos(T),C=t*Math.sin(T);h.x=p.x+(w*g.x+C*x.x),h.y=p.y+(w*g.y+C*x.y),h.z=p.z+(w*g.z+C*x.z),c.push(h.x,h.y,h.z),d.subVectors(h,p).normalize(),l.push(d.x,d.y,d.z),u.push(_/n),u.push(I/i)}}for(let _=1;_<=n;_++)for(let v=1;v<=i;v++){const I=(i+1)*(_-1)+(v-1),T=(i+1)*_+(v-1),w=(i+1)*_+v,C=(i+1)*(_-1)+v;a.push(I,T,C),a.push(T,w,C)}this.setIndex(a),this.setAttribute("position",new Ve(c,3)),this.setAttribute("normal",new Ve(l,3)),this.setAttribute("uv",new Ve(u,2));function y(_,v,I,T,w){const C=Math.cos(_),F=Math.sin(_),M=I/v*_,b=Math.cos(M);w.x=T*(2+b)*.5*C,w.y=T*(2+b)*F*.5,w.z=T*Math.sin(M)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sd(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class rd extends at{constructor(e=new _m(new E(-1,-1,0),new E(-1,1,0),new E(1,1,0)),t=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const o=e.computeFrenetFrames(t,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new E,c=new E,l=new J;let u=new E;const h=[],d=[],p=[],f=[];x(),this.setIndex(f),this.setAttribute("position",new Ve(h,3)),this.setAttribute("normal",new Ve(d,3)),this.setAttribute("uv",new Ve(p,2));function x(){for(let _=0;_<t;_++)m(_);m(r===!1?t:0),y(),g()}function m(_){u=e.getPointAt(_/t,u);const v=o.normals[_],I=o.binormals[_];for(let T=0;T<=i;T++){const w=T/i*Math.PI*2,C=Math.sin(w),F=-Math.cos(w);c.x=F*v.x+C*I.x,c.y=F*v.y+C*I.y,c.z=F*v.z+C*I.z,c.normalize(),d.push(c.x,c.y,c.z),a.x=u.x+n*c.x,a.y=u.y+n*c.y,a.z=u.z+n*c.z,h.push(a.x,a.y,a.z)}}function g(){for(let _=1;_<=t;_++)for(let v=1;v<=i;v++){const I=(i+1)*(_-1)+(v-1),T=(i+1)*_+(v-1),w=(i+1)*_+v,C=(i+1)*(_-1)+v;f.push(I,T,C),f.push(T,w,C)}}function y(){for(let _=0;_<=t;_++)for(let v=0;v<=i;v++)l.x=_/t,l.y=v/i,p.push(l.x,l.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new rd(new lh[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Mm extends at{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new E,r=new E;if(e.index!==null){const o=e.attributes.position,a=e.index;let c=e.groups;c.length===0&&(c=[{start:0,count:a.count,materialIndex:0}]);for(let l=0,u=c.length;l<u;++l){const h=c[l],d=h.start,p=h.count;for(let f=d,x=d+p;f<x;f+=3)for(let m=0;m<3;m++){const g=a.getX(f+m),y=a.getX(f+(m+1)%3);i.fromBufferAttribute(o,g),r.fromBufferAttribute(o,y),Ax(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}}else{const o=e.attributes.position;for(let a=0,c=o.count/3;a<c;a++)for(let l=0;l<3;l++){const u=3*a+l,h=3*a+(l+1)%3;i.fromBufferAttribute(o,u),r.fromBufferAttribute(o,h),Ax(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}this.setAttribute("position",new Ve(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Ax(s,e,t){const n=`${s.x},${s.y},${s.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${s.x},${s.y},${s.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var Nx=Object.freeze({__proto__:null,BoxGeometry:_s,CapsuleGeometry:Jh,CircleGeometry:Kh,ConeGeometry:jh,CylinderGeometry:ao,DodecahedronGeometry:Qh,EdgesGeometry:vm,ExtrudeGeometry:Qc,IcosahedronGeometry:td,LatheGeometry:jc,OctahedronGeometry:ya,PlaneGeometry:so,PolyhedronGeometry:hr,RingGeometry:el,ShapeGeometry:nd,SphereGeometry:va,TetrahedronGeometry:id,TorusGeometry:tl,TorusKnotGeometry:sd,TubeGeometry:rd,WireframeGeometry:Mm});class od extends mn{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new _e(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class Sm extends ki{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class nl extends mn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new _e(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ms,this.normalScale=new J(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 ui,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class ad extends nl{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new J(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return jt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new _e(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 _e(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new _e(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class cd extends mn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new _e(16777215),this.specular=new _e(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ms,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ui,this.combine=da,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Tm extends mn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new _e(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ms,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class ld extends mn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ms,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class ud extends mn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new _e(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ms,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ui,this.combine=da,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class bm extends mn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new _e(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ms,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hd extends Fn{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Gr(s,e,t){return!s||!t&&s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function av(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function cv(s){function e(i,r){return s[i]-s[r]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function uf(s,e,t){const n=s.length,i=new s.constructor(n);for(let r=0,o=0;o!==n;++r){const a=t[r]*e;for(let c=0;c!==e;++c)i[o++]=s[a+c]}return i}function wm(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let o=r[n];if(o!==void 0)if(Array.isArray(o))do o=r[n],o!==void 0&&(e.push(r.time),t.push.apply(t,o)),r=s[i++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[n],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do o=r[n],o!==void 0&&(e.push(r.time),t.push(o)),r=s[i++];while(r!==void 0)}function CI(s,e,t,n,i=30){const r=s.clone();r.name=e;const o=[];for(let c=0;c<r.tracks.length;++c){const l=r.tracks[c],u=l.getValueSize(),h=[],d=[];for(let p=0;p<l.times.length;++p){const f=l.times[p]*i;if(!(f<t||f>=n)){h.push(l.times[p]);for(let x=0;x<u;++x)d.push(l.values[p*u+x])}}h.length!==0&&(l.times=Gr(h,l.times.constructor),l.values=Gr(d,l.values.constructor),o.push(l))}r.tracks=o;let a=1/0;for(let c=0;c<r.tracks.length;++c)a>r.tracks[c].times[0]&&(a=r.tracks[c].times[0]);for(let c=0;c<r.tracks.length;++c)r.tracks[c].shift(-1*a);return r.resetDuration(),r}function RI(s,e=0,t=s,n=30){n<=0&&(n=30);const i=t.tracks.length,r=e/n;for(let o=0;o<i;++o){const a=t.tracks[o],c=a.ValueTypeName;if(c==="bool"||c==="string")continue;const l=s.tracks.find(function(g){return g.name===a.name&&g.ValueTypeName===c});if(l===void 0)continue;let u=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let d=0;const p=l.getValueSize();l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=p/3);const f=a.times.length-1;let x;if(r<=a.times[0]){const g=u,y=h-u;x=a.values.slice(g,y)}else if(r>=a.times[f]){const g=f*h+u,y=g+h-u;x=a.values.slice(g,y)}else{const g=a.createInterpolant(),y=u,_=h-u;g.evaluate(r),x=g.resultBuffer.slice(y,_)}c==="quaternion"&&new Qn().fromArray(x).normalize().conjugate().toArray(x);const m=l.times.length;for(let g=0;g<m;++g){const y=g*p+d;if(c==="quaternion")Qn.multiplyQuaternionsFlat(l.values,y,x,0,l.values,y);else{const _=p-d*2;for(let v=0;v<_;++v)l.values[y+v]-=x[v]}}}return s.blendMode=$f,s}const II={convertArray:Gr,isTypedArray:av,getKeyframeOrder:cv,sortedArray:uf,flattenJSON:wm,subclip:CI,makeClipAdditive:RI};class Ma{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(r=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=r)){const a=t[1];e<a&&(n=2,r=a);for(let c=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=r,r=t[--n-1],e>=r)break t}o=n,n=0;break n}break e}for(;n<o;){const a=n+o>>>1;e<t[a]?o=a:n=a+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let o=0;o!==i;++o)t[o]=n[r+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class lv extends Ma{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Vr,endingEnd:Vr}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,o=e+1,a=i[r],c=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case Br:r=e,a=2*t-n;break;case wc:r=i.length-2,a=t+i[r]-i[r+1];break;default:r=e,a=n}if(c===void 0)switch(this.getSettings_().endingEnd){case Br:o=e,c=2*n-t;break;case wc:o=1,c=n+i[1]-i[0];break;default:o=e-1,c=t}const l=(n-t)*.5,u=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(c-n),this._offsetPrev=r*u,this._offsetNext=o*u}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,p=this._weightNext,f=(n-t)/(i-t),x=f*f,m=x*f,g=-d*m+2*d*x-d*f,y=(1+d)*m+(-1.5-2*d)*x+(-.5+d)*f+1,_=(-1-p)*m+(1.5+p)*x+.5*f,v=p*m-p*x;for(let I=0;I!==a;++I)r[I]=g*o[u+I]+y*o[l+I]+_*o[c+I]+v*o[h+I];return r}}class Am extends Ma{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=(n-t)/(i-t),h=1-u;for(let d=0;d!==a;++d)r[d]=o[l+d]*h+o[c+d]*u;return r}}class uv extends Ma{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class rs{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Gr(t,this.TimeBufferType),this.values=Gr(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Gr(e.times,Array),values:Gr(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new uv(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Am(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new lv(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case ta:t=this.InterpolantFactoryMethodDiscrete;break;case bc:t=this.InterpolantFactoryMethodLinear;break;case Eu:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ta;case this.InterpolantFactoryMethodLinear:return bc;case this.InterpolantFactoryMethodSmooth:return Eu}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,o=i-1;for(;r!==i&&n[r]<e;)++r;for(;o!==-1&&n[o]>t;)--o;if(++o,r!==0||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);const a=this.getValueSize();this.times=n.slice(r,o),this.values=this.values.slice(r*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){const c=n[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(i!==void 0&&av(i))for(let a=0,c=i.length;a!==c;++a){const l=i[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Eu,r=e.length-1;let o=1;for(let a=1;a<r;++a){let c=!1;const l=e[a],u=e[a+1];if(l!==u&&(a!==1||l!==e[0]))if(i)c=!0;else{const h=a*n,d=h-n,p=h+n;for(let f=0;f!==n;++f){const x=t[h+f];if(x!==t[d+f]||x!==t[p+f]){c=!0;break}}}if(c){if(a!==o){e[o]=e[a];const h=a*n,d=o*n;for(let p=0;p!==n;++p)t[d+p]=t[h+p]}++o}}if(r>0){e[o]=e[r];for(let a=r*n,c=o*n,l=0;l!==n;++l)t[c+l]=t[a+l];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}rs.prototype.TimeBufferType=Float32Array;rs.prototype.ValueBufferType=Float32Array;rs.prototype.DefaultInterpolation=bc;class co extends rs{constructor(e,t,n){super(e,t,n)}}co.prototype.ValueTypeName="bool";co.prototype.ValueBufferType=Array;co.prototype.DefaultInterpolation=ta;co.prototype.InterpolantFactoryMethodLinear=void 0;co.prototype.InterpolantFactoryMethodSmooth=void 0;class dd extends rs{}dd.prototype.ValueTypeName="color";class ra extends rs{}ra.prototype.ValueTypeName="number";class hv extends Ma{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(n-t)/(i-t);let l=e*a;for(let u=l+a;l!==u;l+=4)Qn.slerpFlat(r,0,o,l-a,o,l,c);return r}}class Sa extends rs{InterpolantFactoryMethodLinear(e){return new hv(this.times,this.values,this.getValueSize(),e)}}Sa.prototype.ValueTypeName="quaternion";Sa.prototype.InterpolantFactoryMethodSmooth=void 0;class lo extends rs{constructor(e,t,n){super(e,t,n)}}lo.prototype.ValueTypeName="string";lo.prototype.ValueBufferType=Array;lo.prototype.DefaultInterpolation=ta;lo.prototype.InterpolantFactoryMethodLinear=void 0;lo.prototype.InterpolantFactoryMethodSmooth=void 0;class oa extends rs{}oa.prototype.ValueTypeName="vector";class aa{constructor(e="",t=-1,n=[],i=Vh){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=bi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(LI(n[o]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=n.length;r!==o;++r)t.push(rs.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,o=[];for(let a=0;a<r;a++){let c=[],l=[];c.push((a+r-1)%r,a,(a+1)%r),l.push(0,1,0);const u=cv(c);c=uf(c,1,u),l=uf(l,1,u),!i&&c[0]===0&&(c.push(r),l.push(l[0])),o.push(new ra(".morphTargetInfluences["+t[a].name+"]",c,l).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let a=0,c=e.length;a<c;a++){const l=e[a],u=l.name.match(r);if(u&&u.length>1){const h=u[1];let d=i[h];d||(i[h]=d=[]),d.push(l)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,d,p,f,x){if(p.length!==0){const m=[],g=[];wm(p,m,g,f),m.length!==0&&x.push(new h(d,m,g))}},i=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let c=e.length||-1;const l=e.hierarchy||[];for(let h=0;h<l.length;h++){const d=l[h].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const p={};let f;for(f=0;f<d.length;f++)if(d[f].morphTargets)for(let x=0;x<d[f].morphTargets.length;x++)p[d[f].morphTargets[x]]=-1;for(const x in p){const m=[],g=[];for(let y=0;y!==d[f].morphTargets.length;++y){const _=d[f];m.push(_.time),g.push(_.morphTarget===x?1:0)}i.push(new ra(".morphTargetInfluence["+x+"]",m,g))}c=p.length*o}else{const p=".bones["+t[h].name+"]";n(oa,p+".position",d,"pos",i),n(Sa,p+".quaternion",d,"rot",i),n(oa,p+".scale",d,"scl",i)}}return i.length===0?null:new this(r,c,i,a)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function PI(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ra;case"vector":case"vector2":case"vector3":case"vector4":return oa;case"color":return dd;case"quaternion":return Sa;case"bool":case"boolean":return co;case"string":return lo}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function LI(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=PI(s.type);if(s.times===void 0){const t=[],n=[];wm(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const Rs={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(this.files[s]=e)},get:function(s){if(this.enabled!==!1)return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};class pd{constructor(e,t,n){const i=this;let r=!1,o=0,a=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){a++,r===!1&&i.onStart!==void 0&&i.onStart(u,o,a),r=!0},this.itemEnd=function(u){o++,i.onProgress!==void 0&&i.onProgress(u,o,a),o===a&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return c?c(u):u},this.setURLModifier=function(u){return c=u,this},this.addHandler=function(u,h){return l.push(u,h),this},this.removeHandler=function(u){const h=l.indexOf(u);return h!==-1&&l.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=l.length;h<d;h+=2){const p=l[h],f=l[h+1];if(p.global&&(p.lastIndex=0),p.test(u))return f}return null}}}const Nm=new pd;class Xn{constructor(e){this.manager=e!==void 0?e:Nm,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Xn.DEFAULT_MATERIAL_NAME="__DEFAULT";const As={};class DI extends Error{constructor(e,t){super(e),this.response=t}}class es extends Xn{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=Rs.get(e);if(r!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(As[e]!==void 0){As[e].push({onLoad:t,onProgress:n,onError:i});return}As[e]=[],As[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,c=this.responseType;fetch(o).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const u=As[e],h=l.body.getReader(),d=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),p=d?parseInt(d):0,f=p!==0;let x=0;const m=new ReadableStream({start(g){y();function y(){h.read().then(({done:_,value:v})=>{if(_)g.close();else{x+=v.byteLength;const I=new ProgressEvent("progress",{lengthComputable:f,loaded:x,total:p});for(let T=0,w=u.length;T<w;T++){const C=u[T];C.onProgress&&C.onProgress(I)}g.enqueue(v),y()}},_=>{g.error(_)})}}});return new Response(m)}else throw new DI(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return l.json();default:if(a===void 0)return l.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),d=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(d);return l.arrayBuffer().then(f=>p.decode(f))}}}).then(l=>{Rs.add(e,l);const u=As[e];delete As[e];for(let h=0,d=u.length;h<d;h++){const p=u[h];p.onLoad&&p.onLoad(l)}}).catch(l=>{const u=As[e];if(u===void 0)throw this.manager.itemError(e),l;delete As[e];for(let h=0,d=u.length;h<d;h++){const p=u[h];p.onError&&p.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class UI extends Xn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new es(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=aa.parse(e[n]);t.push(i)}return t}}class FI extends Xn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=[],a=new Kc,c=new es(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(r.withCredentials);let l=0;function u(h){c.load(e[h],function(d){const p=r.parse(d,!0);o[h]={width:p.width,height:p.height,format:p.format,mipmaps:p.mipmaps},l+=1,l===6&&(p.mipmapCount===1&&(a.minFilter=Ut),a.image=o,a.format=p.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let h=0,d=e.length;h<d;++h)u(h);else c.load(e,function(h){const d=r.parse(h,!0);if(d.isCubemap){const p=d.mipmaps.length/d.mipmapCount;for(let f=0;f<p;f++){o[f]={mipmaps:[]};for(let x=0;x<d.mipmapCount;x++)o[f].mipmaps.push(d.mipmaps[f*d.mipmapCount+x]),o[f].format=d.format,o[f].width=d.width,o[f].height=d.height}a.image=o}else a.image.width=d.width,a.image.height=d.height,a.mipmaps=d.mipmaps;d.mipmapCount===1&&(a.minFilter=Ut),a.format=d.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}}class Dc extends Xn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=Rs.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a=Cc("img");function c(){u(),Rs.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(h){u(),i&&i(h),r.manager.itemError(e),r.manager.itemEnd(e)}function u(){a.removeEventListener("load",c,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",c,!1),a.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class OI extends Xn{constructor(e){super(e)}load(e,t,n,i){const r=new io;r.colorSpace=kn;const o=new Dc(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function c(l){o.load(e[l],function(u){r.images[l]=u,a++,a===6&&(r.needsUpdate=!0,t&&t(r))},void 0,i)}for(let l=0;l<e.length;++l)c(l);return r}}class dv extends Xn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new Oi,a=new es(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(e,function(c){let l;try{l=r.parse(c)}catch(u){if(i!==void 0)i(u);else{console.error(u);return}}l.image!==void 0?o.image=l.image:l.data!==void 0&&(o.image.width=l.width,o.image.height=l.height,o.image.data=l.data),o.wrapS=l.wrapS!==void 0?l.wrapS:Si,o.wrapT=l.wrapT!==void 0?l.wrapT:Si,o.magFilter=l.magFilter!==void 0?l.magFilter:Ut,o.minFilter=l.minFilter!==void 0?l.minFilter:Ut,o.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.colorSpace!==void 0&&(o.colorSpace=l.colorSpace),l.flipY!==void 0&&(o.flipY=l.flipY),l.format!==void 0&&(o.format=l.format),l.type!==void 0&&(o.type=l.type),l.mipmaps!==void 0&&(o.mipmaps=l.mipmaps,o.minFilter=Jn),l.mipmapCount===1&&(o.minFilter=Ut),l.generateMipmaps!==void 0&&(o.generateMipmaps=l.generateMipmaps),o.needsUpdate=!0,t&&t(o,l)},n,i),o}}class pv extends Xn{constructor(e){super(e)}load(e,t,n,i){const r=new Xt,o=new Dc(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){r.image=a,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}}class dr extends yt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new _e(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class fd extends dr{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(yt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new _e(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Ep=new Fe,Ex=new E,Cx=new E;class Em{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new J(512,512),this.map=null,this.mapPass=null,this.matrix=new Fe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ma,this._frameExtents=new J(1,1),this._viewportCount=1,this._viewports=[new st(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Ex.setFromMatrixPosition(e.matrixWorld),t.position.copy(Ex),Cx.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Cx),t.updateMatrixWorld(),Ep.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ep),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Ep)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class VI extends Em{constructor(){super(new hn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=ia*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class il extends dr{constructor(e,t,n=0,i=Math.PI/3,r=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(yt.DEFAULT_UP),this.updateMatrix(),this.target=new yt,this.distance=n,this.angle=i,this.penumbra=r,this.decay=o,this.map=null,this.shadow=new VI}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const Rx=new Fe,za=new E,Cp=new E;class BI extends Em{constructor(){super(new hn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new J(4,2),this._viewportCount=6,this._viewports=[new st(2,1,1,1),new st(0,1,1,1),new st(3,1,1,1),new st(1,1,1,1),new st(3,0,1,1),new st(1,0,1,1)],this._cubeDirections=[new E(1,0,0),new E(-1,0,0),new E(0,0,1),new E(0,0,-1),new E(0,1,0),new E(0,-1,0)],this._cubeUps=[new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,0,1),new E(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),za.setFromMatrixPosition(e.matrixWorld),n.position.copy(za),Cp.copy(n.position),Cp.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Cp),n.updateMatrixWorld(),i.makeTranslation(-za.x,-za.y,-za.z),Rx.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Rx)}}class md extends dr{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new BI}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class zI extends Em{constructor(){super(new ro(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class gd extends dr{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(yt.DEFAULT_UP),this.updateMatrix(),this.target=new yt,this.shadow=new zI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class xd extends dr{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Cm extends dr{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class fv{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new E)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*r),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*r)),t.addScaledVector(o[6],.315392*(3*r*r-1)),t.addScaledVector(o[7],1.092548*(n*r)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*r),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*r),t.addScaledVector(o[6],.743125*r*r-.247708),t.addScaledVector(o[7],2*.429043*n*r),t.addScaledVector(o[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}class Rm extends dr{constructor(e=new fv,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class sl extends Xn{constructor(e){super(e),this.textures={}}load(e,t,n,i){const r=this,o=new es(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(r){return t[r]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",r),t[r]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new _e().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const r in e.uniforms){const o=e.uniforms[r];switch(i.uniforms[r]={},o.type){case"t":i.uniforms[r].value=n(o.value);break;case"c":i.uniforms[r].value=new _e().setHex(o.value);break;case"v2":i.uniforms[r].value=new J().fromArray(o.value);break;case"v3":i.uniforms[r].value=new E().fromArray(o.value);break;case"v4":i.uniforms[r].value=new st().fromArray(o.value);break;case"m3":i.uniforms[r].value=new Ke().fromArray(o.value);break;case"m4":i.uniforms[r].value=new Fe().fromArray(o.value);break;default:i.uniforms[r].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const r in e.extensions)i.extensions[r]=e.extensions[r];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),i.normalScale=new J().fromArray(r)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new J().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return sl.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:od,SpriteMaterial:Zc,RawShaderMaterial:Sm,ShaderMaterial:ki,PointsMaterial:_a,MeshPhysicalMaterial:ad,MeshStandardMaterial:nl,MeshPhongMaterial:cd,MeshToonMaterial:Tm,MeshNormalMaterial:ld,MeshLambertMaterial:ud,MeshDepthMaterial:Xh,MeshDistanceMaterial:im,MeshBasicMaterial:is,MeshMatcapMaterial:bm,LineDashedMaterial:hd,LineBasicMaterial:Fn,Material:mn};return new t[e]}}class uh{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Im extends at{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class mv extends Xn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new es(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(p,f){if(t[f]!==void 0)return t[f];const m=p.interleavedBuffers[f],g=r(p,m.buffer),y=ko(m.type,g),_=new xa(y,m.stride);return _.uuid=m.uuid,t[f]=_,_}function r(p,f){if(n[f]!==void 0)return n[f];const m=p.arrayBuffers[f],g=new Uint32Array(m).buffer;return n[f]=g,g}const o=e.isInstancedBufferGeometry?new Im:new at,a=e.data.index;if(a!==void 0){const p=ko(a.type,a.array);o.setIndex(new At(p,1))}const c=e.data.attributes;for(const p in c){const f=c[p];let x;if(f.isInterleavedBufferAttribute){const m=i(e.data,f.data);x=new Ds(m,f.itemSize,f.offset,f.normalized)}else{const m=ko(f.type,f.array),g=f.isInstancedBufferAttribute?Us:At;x=new g(m,f.itemSize,f.normalized)}f.name!==void 0&&(x.name=f.name),f.usage!==void 0&&x.setUsage(f.usage),o.setAttribute(p,x)}const l=e.data.morphAttributes;if(l)for(const p in l){const f=l[p],x=[];for(let m=0,g=f.length;m<g;m++){const y=f[m];let _;if(y.isInterleavedBufferAttribute){const v=i(e.data,y.data);_=new Ds(v,y.itemSize,y.offset,y.normalized)}else{const v=ko(y.type,y.array);_=new At(v,y.itemSize,y.normalized)}y.name!==void 0&&(_.name=y.name),x.push(_)}o.morphAttributes[p]=x}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let p=0,f=h.length;p!==f;++p){const x=h[p];o.addGroup(x.start,x.count,x.materialIndex)}const d=e.data.boundingSphere;if(d!==void 0){const p=new E;d.center!==void 0&&p.fromArray(d.center),o.boundingSphere=new Dn(p,d.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class gv extends Xn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=this.path===""?uh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new es(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){let l=null;try{l=JSON.parse(c)}catch(h){i!==void 0&&i(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const u=l.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}r.parse(l,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?uh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const r=new es(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);const o=await r.loadAsync(e,t),a=JSON.parse(o),c=a.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(a)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(l)}),a=this.parseTextures(e.textures,o),c=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,r,c,a,n),u=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,u),this.bindLightTargets(l),t!==void 0){let h=!1;for(const d in o)if(o[d].data instanceof HTMLImageElement){h=!0;break}h===!1&&t(l)}return l}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),r=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,r),a=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,i,a,o,t),l=this.parseSkeletons(e.skeletons,c);return this.bindSkeletons(c,l),this.bindLightTargets(c),c}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const r=new er().fromJSON(e[n]);t[r.uuid]=r}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(r){r.isBone&&(i[r.uuid]=r)}),e!==void 0)for(let r=0,o=e.length;r<o;r++){const a=new Jc().fromJSON(e[r],i);n[a.uuid]=a}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new mv;for(let r=0,o=e.length;r<o;r++){let a;const c=e[r];switch(c.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(c);break;default:c.type in Nx?a=Nx[c.type].fromJSON(c,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${c.type}"`)}a.uuid=c.uuid,c.name!==void 0&&(a.name=c.name),c.userData!==void 0&&(a.userData=c.userData),n[c.uuid]=a}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const r=new sl;r.setTextures(t);for(let o=0,a=e.length;o<a;o++){const c=e[o];n[c.uuid]===void 0&&(n[c.uuid]=r.parse(c)),i[c.uuid]=n[c.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],r=aa.parse(i);t[r.uuid]=r}return t}parseImages(e,t){const n=this,i={};let r;function o(c){return n.manager.itemStart(c),r.load(c,function(){n.manager.itemEnd(c)},void 0,function(){n.manager.itemError(c),n.manager.itemEnd(c)})}function a(c){if(typeof c=="string"){const l=c,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l)?l:n.resourcePath+l;return o(u)}else return c.data?{data:ko(c.type,c.data),width:c.width,height:c.height}:null}if(e!==void 0&&e.length>0){const c=new pd(t);r=new Dc(c),r.setCrossOrigin(this.crossOrigin);for(let l=0,u=e.length;l<u;l++){const h=e[l],d=h.url;if(Array.isArray(d)){const p=[];for(let f=0,x=d.length;f<x;f++){const m=d[f],g=a(m);g!==null&&(g instanceof HTMLImageElement?p.push(g):p.push(new Oi(g.data,g.width,g.height)))}i[h.uuid]=new Js(p)}else{const p=a(h.url);i[h.uuid]=new Js(p)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function r(o){if(typeof o=="string"){const a=o,c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await i.loadAsync(c)}else return o.data?{data:ko(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new Dc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const c=e[o],l=c.url;if(Array.isArray(l)){const u=[];for(let h=0,d=l.length;h<d;h++){const p=l[h],f=await r(p);f!==null&&(f instanceof HTMLImageElement?u.push(f):u.push(new Oi(f.data,f.width,f.height)))}n[c.uuid]=new Js(u)}else{const u=await r(c.url);n[c.uuid]=new Js(u)}}}return n}parseTextures(e,t){function n(r,o){return typeof r=="number"?r:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",r),o[r])}const i={};if(e!==void 0)for(let r=0,o=e.length;r<o;r++){const a=e[r];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const c=t[a.image],l=c.data;let u;Array.isArray(l)?(u=new io,l.length===6&&(u.needsUpdate=!0)):(l&&l.data?u=new Oi:u=new Xt,l&&(u.needsUpdate=!0)),u.source=c,u.uuid=a.uuid,a.name!==void 0&&(u.name=a.name),a.mapping!==void 0&&(u.mapping=n(a.mapping,kI)),a.channel!==void 0&&(u.channel=a.channel),a.offset!==void 0&&u.offset.fromArray(a.offset),a.repeat!==void 0&&u.repeat.fromArray(a.repeat),a.center!==void 0&&u.center.fromArray(a.center),a.rotation!==void 0&&(u.rotation=a.rotation),a.wrap!==void 0&&(u.wrapS=n(a.wrap[0],Ix),u.wrapT=n(a.wrap[1],Ix)),a.format!==void 0&&(u.format=a.format),a.internalFormat!==void 0&&(u.internalFormat=a.internalFormat),a.type!==void 0&&(u.type=a.type),a.colorSpace!==void 0&&(u.colorSpace=a.colorSpace),a.minFilter!==void 0&&(u.minFilter=n(a.minFilter,Px)),a.magFilter!==void 0&&(u.magFilter=n(a.magFilter,Px)),a.anisotropy!==void 0&&(u.anisotropy=a.anisotropy),a.flipY!==void 0&&(u.flipY=a.flipY),a.generateMipmaps!==void 0&&(u.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(u.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(u.compareFunction=a.compareFunction),a.userData!==void 0&&(u.userData=a.userData),i[a.uuid]=u}return i}parseObject(e,t,n,i,r){let o;function a(d){return t[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",d),t[d]}function c(d){if(d!==void 0){if(Array.isArray(d)){const p=[];for(let f=0,x=d.length;f<x;f++){const m=d[f];n[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",m),p.push(n[m])}return p}return n[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),n[d]}}function l(d){return i[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",d),i[d]}let u,h;switch(e.type){case"Scene":o=new $h,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new _e(e.background):o.background=l(e.background)),e.environment!==void 0&&(o.environment=l(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new rm(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new qh(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new hn(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new ro(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new xd(e.color,e.intensity);break;case"DirectionalLight":o=new gd(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new md(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new Cm(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new il(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new fd(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new Rm().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),h=c(e.material),o=new cm(u,h),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":u=a(e.geometry),h=c(e.material),o=new kt(u,h);break;case"InstancedMesh":u=a(e.geometry),h=c(e.material);const d=e.count,p=e.instanceMatrix,f=e.instanceColor;o=new lm(u,h,d),o.instanceMatrix=new Us(new Float32Array(p.array),16),f!==void 0&&(o.instanceColor=new Us(new Float32Array(f.array),f.itemSize));break;case"BatchedMesh":u=a(e.geometry),h=c(e.material),o=new um(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,h),o.geometry=u,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._visibility=e.visibility,o._active=e.active,o._bounds=e.bounds.map(x=>{const m=new Hn;m.min.fromArray(x.boxMin),m.max.fromArray(x.boxMax);const g=new Dn;return g.radius=x.sphereRadius,g.center.fromArray(x.sphereCenter),{boxInitialized:x.boxInitialized,box:m,sphereInitialized:x.sphereInitialized,sphere:g}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=l(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=l(e.colorsTexture.uuid));break;case"LOD":o=new am;break;case"Line":o=new Fs(a(e.geometry),c(e.material));break;case"LineLoop":o=new hm(a(e.geometry),c(e.material));break;case"LineSegments":o=new ss(a(e.geometry),c(e.material));break;case"PointCloud":case"Points":o=new dm(a(e.geometry),c(e.material));break;case"Sprite":o=new om(c(e.material));break;case"Group":o=new kr;break;case"Bone":o=new Yh;break;default:o=new yt}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const d=e.children;for(let p=0;p<d.length;p++)o.add(this.parseObject(d[p],t,n,i,r))}if(e.animations!==void 0){const d=e.animations;for(let p=0;p<d.length;p++){const f=d[p];o.animations.push(r[f])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const d=e.levels;for(let p=0;p<d.length;p++){const f=d[p],x=o.getObjectByProperty("uuid",f.object);x!==void 0&&o.addLevel(x,f.distance,f.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new yt}})}}const kI={UVMapping:Ph,CubeReflectionMapping:wi,CubeRefractionMapping:Vi,EquirectangularReflectionMapping:ir,EquirectangularRefractionMapping:sr,CubeUVReflectionMapping:to},Ix={RepeatWrapping:rr,ClampToEdgeWrapping:Si,MirroredRepeatWrapping:jo},Px={NearestFilter:Qt,NearestMipmapNearestFilter:Lh,NearestMipmapLinearFilter:Cs,LinearFilter:Ut,LinearMipmapNearestFilter:js,LinearMipmapLinearFilter:Jn};class xv extends Xn{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=Rs.get(e);if(o!==void 0){if(r.manager.itemStart(e),o.then){o.then(l=>{t&&t(l),r.manager.itemEnd(e)}).catch(l=>{i&&i(l)});return}return setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const c=fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(l){return Rs.add(e,l),t&&t(l),r.manager.itemEnd(e),l}).catch(function(l){i&&i(l),Rs.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});Rs.add(e,c),r.manager.itemStart(e)}}let lu;class _d{static getContext(){return lu===void 0&&(lu=new(window.AudioContext||window.webkitAudioContext)),lu}static setContext(e){lu=e}}class _v extends Xn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new es(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(c){try{const l=c.slice(0);_d.getContext().decodeAudioData(l,function(h){t(h)}).catch(a)}catch(l){a(l)}},n,i);function a(c){i?i(c):console.error(c),r.manager.itemError(e)}}}const Lx=new Fe,Dx=new Fe,Ar=new Fe;class Pm{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new hn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new hn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Ar.copy(e.projectionMatrix);const i=t.eyeSep/2,r=i*t.near/t.focus,o=t.near*Math.tan(Xr*t.fov*.5)/t.zoom;let a,c;Dx.elements[12]=-i,Lx.elements[12]=i,a=-o*t.aspect+r,c=o*t.aspect+r,Ar.elements[0]=2*t.near/(c-a),Ar.elements[8]=(c+a)/(c-a),this.cameraL.projectionMatrix.copy(Ar),a=-o*t.aspect-r,c=o*t.aspect-r,Ar.elements[0]=2*t.near/(c-a),Ar.elements[8]=(c+a)/(c-a),this.cameraR.projectionMatrix.copy(Ar)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Dx),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Lx)}}class Lm{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Ux(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Ux();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Ux(){return performance.now()}const as=new E,Fx=new Qn,GI=new E,Nr=new E;let yv=class extends yt{constructor(){super(),this.type="AudioListener",this.context=_d.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Lm}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(as,Fx,GI),!(!Number.isFinite(as.x)||!Number.isFinite(as.y)||!Number.isFinite(as.z)))if(Nr.set(0,0,-1).applyQuaternion(Fx),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(as.x,i),t.positionY.linearRampToValueAtTime(as.y,i),t.positionZ.linearRampToValueAtTime(as.z,i),t.forwardX.linearRampToValueAtTime(Nr.x,i),t.forwardY.linearRampToValueAtTime(Nr.y,i),t.forwardZ.linearRampToValueAtTime(Nr.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(as.x,as.y,as.z),t.setOrientation(Nr.x,Nr.y,Nr.z,n.x,n.y,n.z)}};class Dm extends yt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||(this.buffer?this.buffer.duration:Number.MAX_VALUE))),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const Er=new E,Ox=new Qn,HI=new E,Cr=new E;class vv extends Dm{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Er,Ox,HI),Cr.set(0,0,1).applyQuaternion(Ox);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Er.x,n),t.positionY.linearRampToValueAtTime(Er.y,n),t.positionZ.linearRampToValueAtTime(Er.z,n),t.orientationX.linearRampToValueAtTime(Cr.x,n),t.orientationY.linearRampToValueAtTime(Cr.y,n),t.orientationZ.linearRampToValueAtTime(Cr.z,n)}else t.setPosition(Er.x,Er.y,Er.z),t.setOrientation(Cr.x,Cr.y,Cr.z)}}class WI{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class Mv{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,o;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,r=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)n[r+a]=n[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(n,r,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const c=t*this._origIndex;this._mixBufferRegion(n,i,c,1-r,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,o=i;r!==o;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let o=0;o!==r;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){Qn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const o=this._workIndex*r;Qn.multiplyQuaternionsFlat(e,o,e,t,e,n),Qn.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,r){const o=1-i;for(let a=0;a!==r;++a){const c=t+a;e[c]=e[c]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,r){for(let o=0;o!==r;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const Um="\\[\\]\\.:\\/",XI=new RegExp("["+Um+"]","g"),Fm="[^"+Um+"]",qI="[^"+Um.replace("\\.","")+"]",$I=/((?:WC+[\/:])*)/.source.replace("WC",Fm),YI=/(WCOD+)?/.source.replace("WCOD",qI),ZI=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Fm),JI=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Fm),KI=new RegExp("^"+$I+YI+ZI+JI+"$"),jI=["material","materials","bones","map"];class QI{constructor(e,t,n){const i=n||St.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class St{constructor(e,t,n){this.path=t,this.parsedPath=n||St.parseTrackName(t),this.node=St.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new St.Composite(e,t,n):new St(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(XI,"")}static parseTrackName(e){const t=KI.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const r=n.nodeName.substring(i+1);jI.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(r,o){for(let a=0;a<r.length;a++){const c=r[a];if(!o&&(c.name===t||c.uuid===t))return c;if(o&&c.userData&&c.userData.name===t)return c;const l=n(c.children,o);if(l)return l}return null},i=n(e.children);if(i)return i;{const r=n(e.children,!0);if(r)return r}}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=St.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===l){l=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}const o=e[i];if(o===void 0){const l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}St.Composite=QI;St.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};St.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};St.prototype.GetterByBindingType=[St.prototype._getValue_direct,St.prototype._getValue_array,St.prototype._getValue_arrayElement,St.prototype._getValue_toArray];St.prototype.SetterByBindingTypeAndVersioning=[[St.prototype._setValue_direct,St.prototype._setValue_direct_setNeedsUpdate,St.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[St.prototype._setValue_array,St.prototype._setValue_array_setNeedsUpdate,St.prototype._setValue_array_setMatrixWorldNeedsUpdate],[St.prototype._setValue_arrayElement,St.prototype._setValue_arrayElement_setNeedsUpdate,St.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[St.prototype._setValue_fromArray,St.prototype._setValue_fromArray_setNeedsUpdate,St.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class eP{constructor(){this.isAnimationObjectGroup=!0,this.uuid=bi(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,o=r.length;let a,c=e.length,l=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const d=arguments[u],p=d.uuid;let f=t[p];if(f===void 0){f=c++,t[p]=f,e.push(d);for(let x=0,m=o;x!==m;++x)r[x].push(new St(d,n[x],i[x]))}else if(f<l){a=e[f];const x=--l,m=e[x];t[m.uuid]=f,e[f]=m,t[p]=x,e[x]=d;for(let g=0,y=o;g!==y;++g){const _=r[g],v=_[x];let I=_[f];_[f]=v,I===void 0&&(I=new St(d,n[g],i[g])),_[x]=I}}else e[f]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const c=arguments[o],l=c.uuid,u=t[l];if(u!==void 0&&u>=r){const h=r++,d=e[h];t[d.uuid]=u,e[u]=d,t[l]=h,e[h]=c;for(let p=0,f=i;p!==f;++p){const x=n[p],m=x[h],g=x[u];x[u]=m,x[h]=g}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,o=e.length;for(let a=0,c=arguments.length;a!==c;++a){const l=arguments[a],u=l.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<r){const d=--r,p=e[d],f=--o,x=e[f];t[p.uuid]=h,e[h]=p,t[x.uuid]=d,e[d]=x,e.pop();for(let m=0,g=i;m!==g;++m){const y=n[m],_=y[d],v=y[f];y[h]=_,y[d]=v,y.pop()}}else{const d=--o,p=e[d];d>0&&(t[p.uuid]=h),e[h]=p,e.pop();for(let f=0,x=i;f!==x;++f){const m=n[f];m[h]=m[d],m.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(i!==void 0)return r[i];const o=this._paths,a=this._parsedPaths,c=this._objects,l=c.length,u=this.nCachedObjects_,h=new Array(l);i=r.length,n[e]=i,o.push(e),a.push(t),r.push(h);for(let d=u,p=c.length;d!==p;++d){const f=c[d];h[d]=new St(f,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,c=o[a],l=e[a];t[l]=n,o[n]=c,o.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}class Sv{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,o=r.length,a=new Array(o),c={endingStart:Vr,endingEnd:Vr};for(let l=0;l!==o;++l){const u=r[l].createInterpolant(null);a[l]=u,u.settings=c}this._interpolantSettings=c,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=qf,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&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,r=e._clip.duration,o=r/i,a=i/r;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const c=a.parameterPositions,l=a.sampleValues;return c[0]=r,c[1]=r+n,l[0]=e/o,l[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const c=(e-r)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case $f:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulateAdditive(a);break;case Vh:default:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const o=n===ly;if(e===0)return r===-1?i:o&&(r&1)===1?t-i:i;if(n===Xf){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,r+=Math.abs(a);const c=this.repetitions-r;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const l=e<0;this._setEndings(l,!l,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Br,i.endingEnd=Br):(e?i.endingStart=this.zeroSlopeAtStart?Br:Vr:i.endingStart=wc,t?i.endingEnd=this.zeroSlopeAtEnd?Br:Vr:i.endingEnd=wc)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,c=o.sampleValues;return a[0]=r,c[0]=t,a[1]=r+e,c[1]=n,this}}const tP=new Float32Array(1);class Tv extends Ai{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,o=e._propertyBindings,a=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName;let u=l[c];u===void 0&&(u={},l[c]=u);for(let h=0;h!==r;++h){const d=i[h],p=d.name;let f=u[p];if(f!==void 0)++f.referenceCount,o[h]=f;else{if(f=o[h],f!==void 0){f._cacheIndex===null&&(++f.referenceCount,this._addInactiveBinding(f,c,p));continue}const x=t&&t._propertyBindings[h].binding.parsedPath;f=new Mv(St.create(n,p,x),d.ValueTypeName,d.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,c,p),o[h]=f}a[h].resultBuffer=f.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,r=this._actionsByClip;let o=r[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const r=e._clip.uuid,o=this._actionsByClip,a=o[r],c=a.knownActions,l=c[c.length-1],u=e._byClipCacheIndex;l._byClipCacheIndex=u,c[u]=l,c.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,d=(e._localRoot||this._root).uuid;delete h[d],c.length===0&&delete o[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,o=this._bindingsByRootAndName,a=o[i],c=t[t.length-1],l=e._cacheIndex;c._cacheIndex=l,t[l]=c,t.pop(),delete a[r],Object.keys(a).length===0&&delete o[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Am(new Float32Array(2),new Float32Array(2),1,tP),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let o=typeof e=="string"?aa.findByName(i,e):e;const a=o!==null?o.uuid:e,c=this._actionsByClip[a];let l=null;if(n===void 0&&(o!==null?n=o.blendMode:n=Vh),c!==void 0){const h=c.actionByRoot[r];if(h!==void 0&&h.blendMode===n)return h;l=c.knownActions[0],o===null&&(o=l._clip)}if(o===null)return null;const u=new Sv(this,o,t,n);return this._bindAction(u,l),this._addInactiveAction(u,a,r),u}existingAction(e,t){const n=t||this._root,i=n.uuid,r=typeof e=="string"?aa.findByName(n,e):e,o=r?r.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,r,o);const a=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)a[l].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){const o=r.knownActions;for(let a=0,c=o.length;a!==c;++a){const l=o[a];this._deactivateAction(l);const u=l._cacheIndex,h=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const a=n[o].actionByRoot,c=a[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const i=this._bindingsByRootAndName,r=i[t];if(r!==void 0)for(const o in r){const a=r[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}let bv=class wv{constructor(e){this.value=e}clone(){return new wv(this.value.clone===void 0?this.value:this.value.clone())}},nP=0;class iP extends Ai{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:nP++}),this.name="",this.usage=na,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const r=Array.isArray(t[n])?t[n]:[t[n]];for(let o=0;o<r.length;o++)this.uniforms.push(r[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class Om extends xa{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class sP{constructor(e,t,n,i,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Vx=new Fe;class Av{constructor(e,t,n=0,i=1/0){this.ray=new no(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new $c,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Vx.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Vx),this}intersectObject(e,t=!0,n=[]){return hf(e,this,n,t),n.sort(Bx),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)hf(e[i],this,n,t);return n.sort(Bx),n}}function Bx(s,e){return s.distance-e.distance}function hf(s,e,t,n){let i=!0;if(s.layers.test(e.layers)&&s.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const r=s.children;for(let o=0,a=r.length;o<a;o++)hf(r[o],e,t,!0)}}class Nv{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(jt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class rP{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class Vm{constructor(e,t,n,i){Vm.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}}const zx=new J;class oP{constructor(e=new J(1/0,1/0),t=new J(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=zx.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,zx).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const kx=new E,uu=new E;class Ev{constructor(e=new E,t=new E){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){kx.subVectors(e,this.start),uu.subVectors(this.end,this.start);const n=uu.dot(uu);let r=uu.dot(kx)/n;return t&&(r=jt(r,0,1)),r}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Gx=new E;class aP extends yt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new at,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,c=32;o<c;o++,a++){const l=o/c*Math.PI*2,u=a/c*Math.PI*2;i.push(Math.cos(l),Math.sin(l),1,Math.cos(u),Math.sin(u),1)}n.setAttribute("position",new Ve(i,3));const r=new Fn({fog:!1,toneMapped:!1});this.cone=new ss(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Gx.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Gx),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const qs=new E,hu=new Fe,Rp=new Fe;class cP extends ss{constructor(e){const t=Cv(e),n=new at,i=[],r=[],o=new _e(0,0,1),a=new _e(0,1,0);for(let l=0;l<t.length;l++){const u=t[l];u.parent&&u.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(o.r,o.g,o.b),r.push(a.r,a.g,a.b))}n.setAttribute("position",new Ve(i,3)),n.setAttribute("color",new Ve(r,3));const c=new Fn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,c),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Rp.copy(this.root.matrixWorld).invert();for(let r=0,o=0;r<t.length;r++){const a=t[r];a.parent&&a.parent.isBone&&(hu.multiplyMatrices(Rp,a.matrixWorld),qs.setFromMatrixPosition(hu),i.setXYZ(o,qs.x,qs.y,qs.z),hu.multiplyMatrices(Rp,a.parent.matrixWorld),qs.setFromMatrixPosition(hu),i.setXYZ(o+1,qs.x,qs.y,qs.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Cv(s){const e=[];s.isBone===!0&&e.push(s);for(let t=0;t<s.children.length;t++)e.push.apply(e,Cv(s.children[t]));return e}class lP extends kt{constructor(e,t,n){const i=new va(t,4,2),r=new is({wireframe:!0,fog:!1,toneMapped:!1});super(i,r),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const uP=new E,Hx=new _e,Wx=new _e;class hP extends yt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new ya(t);i.rotateY(Math.PI*.5),this.material=new is({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),o=new Float32Array(r.count*3);i.setAttribute("color",new At(o,3)),this.add(new kt(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Hx.copy(this.light.color),Wx.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const r=n<i/2?Hx:Wx;t.setXYZ(n,r.r,r.g,r.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(uP.setFromMatrixPosition(this.light.matrixWorld).negate())}}let Rv=class extends ss{constructor(e=10,t=10,n=4473924,i=8947848){n=new _e(n),i=new _e(i);const r=t/2,o=e/t,a=e/2,c=[],l=[];for(let d=0,p=0,f=-a;d<=t;d++,f+=o){c.push(-a,0,f,a,0,f),c.push(f,0,-a,f,0,a);const x=d===r?n:i;x.toArray(l,p),p+=3,x.toArray(l,p),p+=3,x.toArray(l,p),p+=3,x.toArray(l,p),p+=3}const u=new at;u.setAttribute("position",new Ve(c,3)),u.setAttribute("color",new Ve(l,3));const h=new Fn({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}};class dP extends ss{constructor(e=10,t=16,n=8,i=64,r=4473924,o=8947848){r=new _e(r),o=new _e(o);const a=[],c=[];if(t>1)for(let h=0;h<t;h++){const d=h/t*(Math.PI*2),p=Math.sin(d)*e,f=Math.cos(d)*e;a.push(0,0,0),a.push(p,0,f);const x=h&1?r:o;c.push(x.r,x.g,x.b),c.push(x.r,x.g,x.b)}for(let h=0;h<n;h++){const d=h&1?r:o,p=e-e/n*h;for(let f=0;f<i;f++){let x=f/i*(Math.PI*2),m=Math.sin(x)*p,g=Math.cos(x)*p;a.push(m,0,g),c.push(d.r,d.g,d.b),x=(f+1)/i*(Math.PI*2),m=Math.sin(x)*p,g=Math.cos(x)*p,a.push(m,0,g),c.push(d.r,d.g,d.b)}}const l=new at;l.setAttribute("position",new Ve(a,3)),l.setAttribute("color",new Ve(c,3));const u=new Fn({vertexColors:!0,toneMapped:!1});super(l,u),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Xx=new E,du=new E,qx=new E;class Iv extends yt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new at;i.setAttribute("position",new Ve([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new Fn({fog:!1,toneMapped:!1});this.lightPlane=new Fs(i,r),this.add(this.lightPlane),i=new at,i.setAttribute("position",new Ve([0,0,0,0,0,1],3)),this.targetLine=new Fs(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Xx.setFromMatrixPosition(this.light.matrixWorld),du.setFromMatrixPosition(this.light.target.matrixWorld),qx.subVectors(du,Xx),this.lightPlane.lookAt(du),this.color!==void 0?(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(du),this.targetLine.scale.z=qx.length()}}const pu=new E,Kt=new Yc;class Pv extends ss{constructor(e){const t=new at,n=new Fn({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(f,x){c(f),c(x)}function c(f){i.push(0,0,0),r.push(0,0,0),o[f]===void 0&&(o[f]=[]),o[f].push(i.length/3-1)}t.setAttribute("position",new Ve(i,3)),t.setAttribute("color",new Ve(r,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const l=new _e(16755200),u=new _e(16711680),h=new _e(43775),d=new _e(16777215),p=new _e(3355443);this.setColors(l,u,h,d,p)}setColors(e,t,n,i,r){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,r.r,r.g,r.b),a.setXYZ(41,r.r,r.g,r.b),a.setXYZ(42,r.r,r.g,r.b),a.setXYZ(43,r.r,r.g,r.b),a.setXYZ(44,r.r,r.g,r.b),a.setXYZ(45,r.r,r.g,r.b),a.setXYZ(46,r.r,r.g,r.b),a.setXYZ(47,r.r,r.g,r.b),a.setXYZ(48,r.r,r.g,r.b),a.setXYZ(49,r.r,r.g,r.b),a.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;Kt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),nn("c",t,e,Kt,0,0,-1),nn("t",t,e,Kt,0,0,1),nn("n1",t,e,Kt,-1,-1,-1),nn("n2",t,e,Kt,n,-1,-1),nn("n3",t,e,Kt,-1,i,-1),nn("n4",t,e,Kt,n,i,-1),nn("f1",t,e,Kt,-1,-1,1),nn("f2",t,e,Kt,n,-1,1),nn("f3",t,e,Kt,-1,i,1),nn("f4",t,e,Kt,n,i,1),nn("u1",t,e,Kt,n*.7,i*1.1,-1),nn("u2",t,e,Kt,-1*.7,i*1.1,-1),nn("u3",t,e,Kt,0,i*2,-1),nn("cf1",t,e,Kt,-1,0,1),nn("cf2",t,e,Kt,n,0,1),nn("cf3",t,e,Kt,0,-1,1),nn("cf4",t,e,Kt,0,i,1),nn("cn1",t,e,Kt,-1,0,-1),nn("cn2",t,e,Kt,n,0,-1),nn("cn3",t,e,Kt,0,-1,-1),nn("cn4",t,e,Kt,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function nn(s,e,t,n,i,r,o){pu.set(i,r,o).unproject(n);const a=e[s];if(a!==void 0){const c=t.getAttribute("position");for(let l=0,u=a.length;l<u;l++)c.setXYZ(a[l],pu.x,pu.y,pu.z)}}const fu=new Hn;class Lv extends ss{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new at;r.setIndex(new At(n,1)),r.setAttribute("position",new At(i,3)),super(r,new Fn({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&fu.setFromObject(this.object),fu.isEmpty())return;const t=fu.min,n=fu.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Dv extends ss{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],r=new at;r.setIndex(new At(n,1)),r.setAttribute("position",new Ve(i,3)),super(r,new Fn({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class pP extends Fs{constructor(e,t=1,n=16776960){const i=n,r=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new at;o.setAttribute("position",new Ve(r,3)),o.computeBoundingSphere(),super(o,new Fn({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],c=new at;c.setAttribute("position",new Ve(a,3)),c.computeBoundingSphere(),this.add(new kt(c,new is({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const $x=new E;let mu,Ip;class fP extends yt{constructor(e=new E(0,0,1),t=new E(0,0,0),n=1,i=16776960,r=n*.2,o=r*.2){super(),this.type="ArrowHelper",mu===void 0&&(mu=new at,mu.setAttribute("position",new Ve([0,0,0,0,1,0],3)),Ip=new ao(0,.5,1,5,1),Ip.translate(0,-.5,0)),this.position.copy(t),this.line=new Fs(mu,new Fn({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new kt(Ip,new is({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{$x.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle($x,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}let Uv=class extends ss{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new at;i.setAttribute("position",new Ve(t,3)),i.setAttribute("color",new Ve(n,3));const r=new Fn({vertexColors:!0,toneMapped:!1});super(i,r),this.type="AxesHelper"}setColors(e,t,n){const i=new _e,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}};class Fv{constructor(){this.type="ShapePath",this.color=new _e,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Rc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,o){return this.currentPath.bezierCurveTo(e,t,n,i,r,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(g){const y=[];for(let _=0,v=g.length;_<v;_++){const I=g[_],T=new er;T.curves=I.curves,y.push(T)}return y}function n(g,y){const _=y.length;let v=!1;for(let I=_-1,T=0;T<_;I=T++){let w=y[I],C=y[T],F=C.x-w.x,M=C.y-w.y;if(Math.abs(M)>Number.EPSILON){if(M<0&&(w=y[T],F=-F,C=y[I],M=-M),g.y<w.y||g.y>C.y)continue;if(g.y===w.y){if(g.x===w.x)return!0}else{const b=M*(g.x-w.x)-F*(g.y-w.y);if(b===0)return!0;if(b<0)continue;v=!v}}else{if(g.y!==w.y)continue;if(C.x<=g.x&&g.x<=w.x||w.x<=g.x&&g.x<=C.x)return!0}}return v}const i=Ki.isClockWise,r=this.subPaths;if(r.length===0)return[];let o,a,c;const l=[];if(r.length===1)return a=r[0],c=new er,c.curves=a.curves,l.push(c),l;let u=!i(r[0].getPoints());u=e?!u:u;const h=[],d=[];let p=[],f=0,x;d[f]=void 0,p[f]=[];for(let g=0,y=r.length;g<y;g++)a=r[g],x=a.getPoints(),o=i(x),o=e?!o:o,o?(!u&&d[f]&&f++,d[f]={s:new er,p:x},d[f].s.curves=a.curves,u&&f++,p[f]=[]):p[f].push({h:a,p:x[0]});if(!d[0])return t(r);if(d.length>1){let g=!1,y=0;for(let _=0,v=d.length;_<v;_++)h[_]=[];for(let _=0,v=d.length;_<v;_++){const I=p[_];for(let T=0;T<I.length;T++){const w=I[T];let C=!0;for(let F=0;F<d.length;F++)n(w.p,d[F].p)&&(_!==F&&y++,C?(C=!1,h[F].push(w)):g=!0);C&&h[_].push(w)}}y>0&&g===!1&&(p=h)}let m;for(let g=0,y=d.length;g<y;g++){c=d[g].s,l.push(c),m=p[g];for(let _=0,v=m.length;_<v;_++)c.holes.push(m[_].h)}return l}}class Ov extends Ai{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}class mP extends zi{constructor(e=1,t=1,n=1,i={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,t,{...i,count:n}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}const gP=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveMap","envMap","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"];class Vv{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=gP,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}getRenderObjectData(e){let t=this.renderObjects.get(e);return t===void 0&&(t={material:this.getMaterialData(e.material),worldMatrix:e.object.matrixWorld.clone()},e.object.center&&(t.center=e.object.center.clone()),e.object.morphTargetInfluences&&(t.morphTargetInfluences=e.object.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),this.renderObjects.set(e,t)),t}containsNode(e){const t=e.material;for(const n in t)if(t[n]&&t[n].isNode)return!0;return e.renderer.nodes.modelViewMatrix!==null||e.renderer.nodes.modelNormalViewMatrix!==null}getMaterialData(e){const t={};for(const n of this.refreshUniforms){const i=e[n];i!=null&&(typeof i=="object"&&i.clone!==void 0?i.isTexture===!0?t[n]={id:i.id,version:i.version}:t[n]=i.clone():t[n]=i)}return t}equals(e){const{object:t,material:n}=e,i=this.getRenderObjectData(e);if(i.worldMatrix.equals(t.matrixWorld)!==!0)return i.worldMatrix.copy(t.matrixWorld),!1;const r=i.material;for(const o in r){const a=r[o],c=n[o];if(a.equals!==void 0){if(a.equals(c)===!1)return a.copy(c),!1}else if(c.isTexture===!0){if(a.id!==c.id||a.version!==c.version)return a.id=c.id,a.version=c.version,!1}else if(a!==c)return r[o]=c,!1}if(i.morphTargetInfluences){let o=!1;for(let a=0;a<i.morphTargetInfluences.length;a++)i.morphTargetInfluences[a]!==t.morphTargetInfluences[a]&&(o=!0);if(o)return!0}return i.center&&i.center.equals(t.center)===!1?(i.center.copy(t.center),!0):(e.bundle!==null&&(i.version=e.bundle.version),!0)}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e))return!0;const{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;const i=e.object.static===!0,r=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;return i||r?!1:this.equals(e)!==!0}}function Uc(s,e=0){let t=3735928559^e,n=1103547991^e;if(s instanceof Array)for(let i=0,r;i<s.length;i++)r=s[i],t=Math.imul(t^r,2654435761),n=Math.imul(n^r,1597334677);else for(let i=0,r;i<s.length;i++)r=s.charCodeAt(i),t=Math.imul(t^r,2654435761),n=Math.imul(n^r,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}const Bv=s=>Uc(s),zv=s=>Uc(s),Bm=(...s)=>Uc(s);function zm(s,e=!1){const t=[];s.isNode===!0&&(t.push(s.id),s=s.getSelf());for(const{property:n,childNode:i}of Fc(s))t.push(t,Uc(n.slice(0,-4)),i.getCacheKey(e));return Uc(t)}function*Fc(s,e=!1){for(const t in s){if(t.startsWith("_")===!0)continue;const n=s[t];if(Array.isArray(n)===!0)for(let i=0;i<n.length;i++){const r=n[i];r&&(r.isNode===!0||e&&typeof r.toJSON=="function")&&(yield{property:t,index:i,childNode:r})}else if(n&&n.isNode===!0)yield{property:t,childNode:n};else if(typeof n=="object")for(const i in n){const r=n[i];r&&(r.isNode===!0||e&&typeof r.toJSON=="function")&&(yield{property:t,index:i,childNode:r})}}}function Is(s){if(s==null)return null;const e=typeof s;return s.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":s.isVector2===!0?"vec2":s.isVector3===!0?"vec3":s.isVector4===!0?"vec4":s.isMatrix3===!0?"mat3":s.isMatrix4===!0?"mat4":s.isColor===!0?"color":s instanceof ArrayBuffer?"ArrayBuffer":null}function km(s,...e){const t=s?s.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),s==="color"?new _e(...e):t==="vec2"?new J(...e):t==="vec3"?new E(...e):t==="vec4"?new st(...e):t==="mat3"?new Ke(...e):t==="mat4"?new Fe(...e):s==="bool"?e[0]||!1:s==="float"||s==="int"||s==="uint"?e[0]||0:s==="string"?e[0]||"":s==="ArrayBuffer"?Hm(e[0]):null}function Gm(s){let e="";const t=new Uint8Array(s);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function Hm(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0)).buffer}var xP=Object.freeze({__proto__:null,arrayBufferToBase64:Gm,base64ToArrayBuffer:Hm,getCacheKey:zm,getNodeChildren:Fc,getValueFromType:km,getValueType:Is,hash:Bm,hashArray:zv,hashString:Bv});const df={VERTEX:"vertex",FRAGMENT:"fragment"},We={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},_P={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Wm=["fragment","vertex"],pf=["setup","analyze","generate"],ff=[...Wm,"compute"],Ta=["x","y","z","w"];let yP=0;class Ye extends Ai{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=We.NONE,this.updateBeforeType=We.NONE,this.updateAfterType=We.NONE,this.uuid=Bh.generateUUID(),this.version=0,this._cacheKey=null,this._cacheKeyVersion=0,this.global=!1,this.isNode=!0,Object.defineProperty(this,"id",{value:yP++})}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this.getSelf()),this}onFrameUpdate(e){return this.onUpdate(e,We.FRAME)}onRenderUpdate(e){return this.onUpdate(e,We.RENDER)}onObjectUpdate(e){return this.onUpdate(e,We.OBJECT)}onReference(e){return this.updateReference=e.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of Fc(this))yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}getCacheKey(e=!1){return e=e||this.version!==this._cacheKeyVersion,(e===!0||this._cacheKey===null)&&(this._cacheKey=zm(this,e),this._cacheKeyVersion=this.version),this._cacheKey}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){const t=this.getNodeType(e);return e.getElementType(t)}getNodeType(e){const t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){const t=this.getHash(e);return e.getNodeFromHash(t)||this}setup(e){const t=e.getNodeProperties(this);let n=0;for(const i of this.getChildren())t["node"+n++]=i;return null}analyze(e){if(e.increaseUsage(this)===1){const n=e.getNodeProperties(this);for(const i of Object.values(n))i&&i.isNode===!0&&i.build(e)}}generate(e,t){const{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){console.warn("Abstract function.")}updateAfter(){console.warn("Abstract function.")}update(){console.warn("Abstract function.")}build(e,t=null){const n=this.getShared(e);if(this!==n)return n.build(e,t);e.addNode(this),e.addChain(this);let i=null;const r=e.getBuildStage();if(r==="setup"){this.updateReference(e);const o=e.getNodeProperties(this);if(o.initialized!==!0){const a=e.stack.nodes.length;o.initialized=!0,o.outputNode=this.setup(e),o.outputNode!==null&&e.stack.nodes.length;for(const c of Object.values(o))c&&c.isNode===!0&&c.build(e)}}else if(r==="analyze")this.analyze(e);else if(r==="generate")if(this.generate.length===1){const a=this.getNodeType(e),c=e.getDataFromNode(this);i=c.snippet,i===void 0?(i=this.generate(e)||"",c.snippet=i):c.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),i=e.format(i,a,t)}else i=this.generate(e,t)||"";return e.removeChain(this),i}getSerializeChildren(){return Fc(this)}serialize(e){const t=this.getSerializeChildren(),n={};for(const{property:i,index:r,childNode:o}of t)r!==void 0?(n[i]===void 0&&(n[i]=Number.isInteger(r)?[]:{}),n[i][r]=o.toJSON(e.meta).uuid):n[i]=o.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){const t=e.meta.nodes;for(const n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){const i=[];for(const r of e.inputNodes[n])i.push(t[r]);this[n]=i}else if(typeof e.inputNodes[n]=="object"){const i={};for(const r in e.inputNodes[n]){const o=e.inputNodes[n][r];i[r]=t[o]}this[n]=i}else{const i=e.inputNodes[n];this[n]=t[i]}}}toJSON(e){const{uuid:t,type:n}=this,i=e===void 0||typeof e=="string";i&&(e={textures:{},images:{},nodes:{}});let r=e.nodes[t];r===void 0&&(r={uuid:t,type:n,meta:e,metadata:{version:4.6,type:"Node",generator:"Node.toJSON"}},i!==!0&&(e.nodes[r.uuid]=r),this.serialize(r),delete r.meta);function o(a){const c=[];for(const l in a){const u=a[l];delete u.metadata,c.push(u)}return c}if(i){const a=o(e.textures),c=o(e.images),l=o(e.nodes);a.length>0&&(r.textures=a),c.length>0&&(r.images=c),l.length>0&&(r.nodes=l)}return r}}class pr extends Ye{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}generate(e){const t=this.node.build(e),n=this.indexNode.build(e,"uint");return`${t}[ ${n} ]`}}class Xm extends Ye{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){const t=this.node.getNodeType(e);let n=null;for(const i of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(i))&&(n=i);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const n=this.node,i=this.getNodeType(e),r=n.build(e,i);return e.format(r,i,t)}}class pt extends Ye{static get type(){return"TempNode"}constructor(e){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){const i=e.getVectorType(this.getNodeType(e,t)),r=e.getDataFromNode(this);if(r.propertyName!==void 0)return e.format(r.propertyName,i,t);if(i!=="void"&&t!=="void"&&this.hasDependencies(e)){const o=super.build(e,i),a=e.getVarFromNode(this,null,i),c=e.getPropertyName(a);return e.addLineFlowCode(`${c} = ${o}`,this),r.snippet=o,r.propertyName=c,e.format(r.propertyName,i,t)}}return super.build(e,t)}}class kv extends pt{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){const n=this.getNodeType(e),i=this.nodes,r=e.getComponentType(n),o=[];for(const c of i){let l=c.build(e);const u=e.getComponentType(c.getNodeType(e));u!==r&&(l=e.format(l,u,r)),o.push(l)}const a=`${e.getType(n)}( ${o.join(", ")} )`;return e.format(a,n,t)}}const vP=Ta.join("");class hh extends Ye{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(Ta.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}generate(e,t){const n=this.node,i=e.getTypeLength(n.getNodeType(e));let r=null;if(i>1){let o=null;this.getVectorLength()>=i&&(o=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const c=n.build(e,o);this.components.length===i&&this.components===vP.slice(0,this.components.length)?r=e.format(c,o,t):r=e.format(`${c}.${this.components}`,this.getNodeType(e),t)}else r=n.build(e,t);return r}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class Gv extends pt{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:n,targetNode:i}=this,r=this.getNodeType(e),o=e.getTypeFromLength(n.length,i.getNodeType(e)),a=i.build(e,o),c=t.build(e,r),l=e.getTypeLength(r),u=[];for(let h=0;h<l;h++){const d=Ta[h];d===n[0]?(u.push(a),h+=n.length-1):u.push(c+"."+d)}return`${e.getType(r)}( ${u.join(", ")} )`}}class MP extends pt{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{components:t,sourceNode:n}=this,i=this.getNodeType(e),r=n.build(e),o=e.getVarFromNode(this),a=e.getPropertyName(o);e.addLineFlowCode(a+" = "+r,this);const c=e.getTypeLength(i),l=[];let u=0;for(let h=0;h<c;h++){const d=Ta[h];d===t[u]?(l.push("1.0 - "+(a+"."+d)),u++):l.push(a+"."+d)}return`${e.getType(i)}( ${l.join(", ")} )`}}class qm extends Ye{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return this.nodeType===null?Is(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=Is(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=Gm(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?km(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){console.warn("Abstract function.")}}class Hi extends qm{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){const n=this.getNodeType(e);return e.format(this.generateConst(e),n,t)}}let ca=null;const Wo=new Map;function te(s,e){if(Wo.has(s)){console.warn(`Redefinition of method chaining ${s}`);return}if(typeof e!="function")throw new Error(`Node element ${s} is not a function`);Wo.set(s,e)}const Hv=s=>s.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),Yx=s=>Hv(s).split("").sort().join(""),Wv={setup(s,e){const t=e.shift();return s(rl(t),...e)},get(s,e,t){if(typeof e=="string"&&s[e]===void 0){if(s.isStackNode!==!0&&e==="assign")return(...n)=>(ca.assign(t,...n),t);if(Wo.has(e)){const n=Wo.get(e);return s.isStackNode?(...i)=>t.add(n(...i)):(...i)=>n(t,...i)}else{if(e==="self")return s;if(e.endsWith("Assign")&&Wo.has(e.slice(0,e.length-6))){const n=Wo.get(e.slice(0,e.length-6));return s.isStackNode?(...i)=>t.assign(i[0],n(...i)):(...i)=>t.assign(n(t,...i))}else{if(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0)return e=Hv(e),H(new hh(t,e));if(/^set[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=Yx(e.slice(3).toLowerCase()),n=>H(new Gv(s,e,n));if(/^flip[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=Yx(e.slice(4).toLowerCase()),()=>H(new MP(H(s),e));if(e==="width"||e==="height"||e==="depth")return e==="width"?e="x":e==="height"?e="y":e==="depth"&&(e="z"),H(new hh(s,e));if(/^\d+$/.test(e)===!0)return H(new pr(t,new Hi(Number(e),"uint")))}}}return Reflect.get(s,e,t)},set(s,e,t,n){return typeof e=="string"&&s[e]===void 0&&(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0||e==="width"||e==="height"||e==="depth"||/^\d+$/.test(e)===!0)?(n[e].assign(t),!0):Reflect.set(s,e,t,n)}},Pp=new WeakMap,Zx=new WeakMap,SP=function(s,e=null){const t=Is(s);if(t==="node"){let n=Pp.get(s);return n===void 0&&(n=new Proxy(s,Wv),Pp.set(s,n),Pp.set(n,n)),n}else{if(e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string")return H(mf(s,e));if(t==="shader")return U(s)}return s},TP=function(s,e=null){for(const t in s)s[t]=H(s[t],e);return s},bP=function(s,e=null){const t=s.length;for(let n=0;n<t;n++)s[n]=H(s[n],e);return s},wP=function(s,e=null,t=null,n=null){const i=r=>H(n!==null?Object.assign(r,n):r);return e===null?(...r)=>i(new s(...qr(r))):t!==null?(t=H(t),(...r)=>i(new s(e,...qr(r),t))):(...r)=>i(new s(e,...qr(r)))},AP=function(s,...e){return H(new s(...qr(e)))};class NP extends Ye{constructor(e,t){super(),this.shaderNode=e,this.inputNodes=t}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}call(e){const{shaderNode:t,inputNodes:n}=this,i=e.getNodeProperties(t);if(i.onceOutput)return i.onceOutput;let r=null;if(t.layout){let o=Zx.get(e.constructor);o===void 0&&(o=new WeakMap,Zx.set(e.constructor,o));let a=o.get(t);a===void 0&&(a=H(e.buildFunctionNode(t)),o.set(t,a)),e.currentFunctionNode!==null&&e.currentFunctionNode.includes.push(a),r=H(a.call(n))}else{const o=t.jsFunc,a=n!==null?o(n,e):o(e);r=H(a)}return t.once&&(i.onceOutput=r),r}getOutputNode(e){const t=e.getNodeProperties(this);return t.outputNode===null&&(t.outputNode=this.setupOutput(e)),t.outputNode}setup(e){return this.getOutputNode(e)}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}generate(e,t){return this.getOutputNode(e).build(e,t)}}class EP extends Ye{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}call(e=null){return rl(e),H(new NP(this,e))}setup(){return this.call()}}const CP=[!1,!0],RP=[0,1,2,3],IP=[-1,-2],Xv=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],$m=new Map;for(const s of CP)$m.set(s,new Hi(s));const Ym=new Map;for(const s of RP)Ym.set(s,new Hi(s,"uint"));const Zm=new Map([...Ym].map(s=>new Hi(s.value,"int")));for(const s of IP)Zm.set(s,new Hi(s,"int"));const yd=new Map([...Zm].map(s=>new Hi(s.value)));for(const s of Xv)yd.set(s,new Hi(s));for(const s of Xv)yd.set(-s,new Hi(-s));const vd={bool:$m,uint:Ym,ints:Zm,float:yd},Jx=new Map([...$m,...yd]),mf=(s,e)=>Jx.has(s)?Jx.get(s):s.isNode===!0?s:new Hi(s,e),PP=s=>{try{return s.getNodeType()}catch{return}},un=function(s,e=null){return(...t)=>{if((t.length===0||!["bool","float","int","uint"].includes(s)&&t.every(i=>typeof i!="object"))&&(t=[km(s,...t)]),t.length===1&&e!==null&&e.has(t[0]))return H(e.get(t[0]));if(t.length===1){const i=mf(t[0],s);return PP(i)===s?H(i):H(new Xm(i,s))}const n=t.map(i=>mf(i));return H(new kv(n,s))}},Oc=s=>typeof s=="object"&&s!==null?s.value:s,qv=s=>s!=null?s.nodeType||s.convertTo||(typeof s=="string"?s:null):null;function tc(s,e){return new Proxy(new EP(s,e),Wv)}const H=(s,e=null)=>SP(s,e),rl=(s,e=null)=>new TP(s,e),qr=(s,e=null)=>new bP(s,e),K=(...s)=>new wP(...s),fe=(...s)=>new AP(...s),U=(s,e)=>{const t=new tc(s,e),n=(...i)=>{let r;return rl(i),i[0]&&i[0].isNode?r=[...i]:r=i[0],t.call(r)};return n.shaderNode=t,n.setLayout=i=>(t.setLayout(i),n),n.once=()=>(t.once=!0,n),n},LP=(...s)=>(console.warn("TSL.ShaderNode: tslFn() has been renamed to Fn()."),U(...s));te("toGlobal",s=>(s.global=!0,s));const Vc=s=>{ca=s},Jm=()=>ca,Oe=(...s)=>ca.If(...s);function $v(s){return ca&&ca.add(s),s}te("append",$v);const Yv=new un("color"),A=new un("float",vd.float),L=new un("int",vd.ints),ve=new un("uint",vd.uint),cr=new un("bool",vd.bool),z=new un("vec2"),ls=new un("ivec2"),Zv=new un("uvec2"),Jv=new un("bvec2"),D=new un("vec3"),Kv=new un("ivec3"),ba=new un("uvec3"),Km=new un("bvec3"),oe=new un("vec4"),jv=new un("ivec4"),Qv=new un("uvec4"),eM=new un("bvec4"),ol=new un("mat2"),Tn=new un("mat3"),$r=new un("mat4"),DP=(s="")=>H(new Hi(s,"string")),UP=s=>H(new Hi(s,"ArrayBuffer"));te("toColor",Yv);te("toFloat",A);te("toInt",L);te("toUint",ve);te("toBool",cr);te("toVec2",z);te("toIVec2",ls);te("toUVec2",Zv);te("toBVec2",Jv);te("toVec3",D);te("toIVec3",Kv);te("toUVec3",ba);te("toBVec3",Km);te("toVec4",oe);te("toIVec4",jv);te("toUVec4",Qv);te("toBVec4",eM);te("toMat2",ol);te("toMat3",Tn);te("toMat4",$r);const tM=K(pr),nM=(s,e)=>H(new Xm(H(s),e)),FP=(s,e)=>H(new hh(H(s),e));te("element",tM);te("convert",nM);class jm extends Ye{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1){super("string"),this.name=e,this.version=0,this.shared=t,this.order=n,this.isUniformGroup=!0}set needsUpdate(e){e===!0&&this.version++}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const iM=s=>new jm(s),Qm=(s,e=0)=>new jm(s,!0,e),OP=Qm("frame"),_t=Qm("render"),sM=iM("object");class uo extends qm{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=sM}label(e){return this.name=e,this}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){const n=this.getSelf();return e=e.bind(n),super.onUpdate(i=>{const r=e(i,n);r!==void 0&&(this.value=r)},t)}generate(e,t){const n=this.getNodeType(e),i=this.getUniformHash(e);let r=e.getNodeFromHash(i);r===void 0&&(e.setHashNode(this,i),r=this);const o=r.getInputType(e),a=e.getUniformFromNode(r,o,e.shaderStage,this.name||e.context.label),c=e.getPropertyName(a);return e.context.label!==void 0&&delete e.context.label,e.format(c,n,t)}}const pe=(s,e)=>{const t=qv(e||s),n=s&&s.isNode===!0?s.node&&s.node.value||s.value:s;return H(new uo(n,t))};class Nt extends Ye{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1){super(e),this.name=t,this.varying=n,this.isPropertyNode=!0}getHash(e){return this.name||super.getHash(e)}isGlobal(){return!0}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const ai=(s,e)=>H(new Nt(s,e)),Yi=(s,e)=>H(new Nt(s,e,!0)),Ct=fe(Nt,"vec4","DiffuseColor"),gf=fe(Nt,"vec3","EmissiveColor"),hs=fe(Nt,"float","Roughness"),Bc=fe(Nt,"float","Metalness"),dh=fe(Nt,"float","Clearcoat"),zc=fe(Nt,"float","ClearcoatRoughness"),Hr=fe(Nt,"vec3","Sheen"),Md=fe(Nt,"float","SheenRoughness"),Sd=fe(Nt,"float","Iridescence"),eg=fe(Nt,"float","IridescenceIOR"),tg=fe(Nt,"float","IridescenceThickness"),ph=fe(Nt,"float","AlphaT"),Ys=fe(Nt,"float","Anisotropy"),nc=fe(Nt,"vec3","AnisotropyT"),Yr=fe(Nt,"vec3","AnisotropyB"),ri=fe(Nt,"color","SpecularColor"),kc=fe(Nt,"float","SpecularF90"),fh=fe(Nt,"float","Shininess"),ng=fe(Nt,"vec4","Output"),Zr=fe(Nt,"float","dashSize"),Gc=fe(Nt,"float","gapSize"),VP=fe(Nt,"float","pointWidth"),ic=fe(Nt,"float","IOR"),mh=fe(Nt,"float","Transmission"),ig=fe(Nt,"float","Thickness"),sg=fe(Nt,"float","AttenuationDistance"),rg=fe(Nt,"color","AttenuationColor"),og=fe(Nt,"float","Dispersion");class rM extends pt{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t}hasDependencies(){return!1}getNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){const n=e.getTypeLength(t.node.getNodeType(e));return Ta.join("").slice(0,n)!==t.components}return!1}generate(e,t){const{targetNode:n,sourceNode:i}=this,r=this.needsSplitAssign(e),o=n.getNodeType(e),a=n.context({assign:!0}).build(e),c=i.build(e,o),l=i.getNodeType(e),u=e.getDataFromNode(this);let h;if(u.initialized===!0)t!=="void"&&(h=a);else if(r){const d=e.getVarFromNode(this,null,o),p=e.getPropertyName(d);e.addLineFlowCode(`${p} = ${c}`,this);const f=n.node.context({assign:!0}).build(e);for(let x=0;x<n.components.length;x++){const m=n.components[x];e.addLineFlowCode(`${f}.${m} = ${p}[ ${x} ]`,this)}t!=="void"&&(h=a)}else h=`${a} = ${c}`,(t==="void"||l==="void")&&(e.addLineFlowCode(h,this),t!=="void"&&(h=a));return u.initialized=!0,e.format(h,o,t)}}const oM=K(rM);te("assign",oM);class aM extends pt{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}generate(e){const t=[],n=this.functionNode,i=n.getInputs(e),r=this.parameters;if(Array.isArray(r))for(let a=0;a<r.length;a++){const c=i[a],l=r[a];t.push(l.build(e,c.type))}else for(const a of i){const c=r[a.name];if(c!==void 0)t.push(c.build(e,a.type));else throw new Error(`FunctionCallNode: Input '${a.name}' not found in FunctionNode.`)}return`${n.build(e,"property")}( ${t.join(", ")} )`}}const cM=(s,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?qr(e):rl(e[0]),H(new aM(H(s),e)));te("call",cM);class qt extends pt{static get type(){return"OperatorNode"}constructor(e,t,n,...i){if(super(),i.length>0){let r=new qt(e,t,n);for(let o=0;o<i.length-1;o++)r=new qt(e,r,i[o]);t=r,n=i[i.length-1]}this.op=e,this.aNode=t,this.bNode=n}getNodeType(e,t){const n=this.op,i=this.aNode,r=this.bNode,o=i.getNodeType(e),a=typeof r<"u"?r.getNodeType(e):null;if(o==="void"||a==="void")return"void";if(n==="%")return o;if(n==="~"||n==="&"||n==="|"||n==="^"||n===">>"||n==="<<")return e.getIntegerType(o);if(n==="!"||n==="=="||n==="&&"||n==="||"||n==="^^")return"bool";if(n==="<"||n===">"||n==="<="||n===">="){const c=t?e.getTypeLength(t):Math.max(e.getTypeLength(o),e.getTypeLength(a));return c>1?`bvec${c}`:"bool"}else return o==="float"&&e.isMatrix(a)?a:e.isMatrix(o)&&e.isVector(a)?e.getVectorFromMatrix(o):e.isVector(o)&&e.isMatrix(a)?e.getVectorFromMatrix(a):e.getTypeLength(a)>e.getTypeLength(o)?a:o}generate(e,t){const n=this.op,i=this.aNode,r=this.bNode,o=this.getNodeType(e,t);let a=null,c=null;o!=="void"?(a=i.getNodeType(e),c=typeof r<"u"?r.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="?e.isVector(a)?c=a:a!==c&&(a=c="float"):n===">>"||n==="<<"?(a=o,c=e.changeComponentType(c,"uint")):e.isMatrix(a)&&e.isVector(c)?c=e.getVectorFromMatrix(a):e.isVector(a)&&e.isMatrix(c)?a=e.getVectorFromMatrix(c):a=c=o):a=c=o;const l=i.build(e,a),u=typeof r<"u"?r.build(e,c):null,h=e.getTypeLength(t),d=e.getFunctionOperator(n);if(t!=="void")return n==="<"&&h>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThan",t)}( ${l}, ${u} )`,o,t):e.format(`( ${l} < ${u} )`,o,t):n==="<="&&h>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThanEqual",t)}( ${l}, ${u} )`,o,t):e.format(`( ${l} <= ${u} )`,o,t):n===">"&&h>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThan",t)}( ${l}, ${u} )`,o,t):e.format(`( ${l} > ${u} )`,o,t):n===">="&&h>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThanEqual",t)}( ${l}, ${u} )`,o,t):e.format(`( ${l} >= ${u} )`,o,t):n==="!"||n==="~"?e.format(`(${n}${l})`,a,t):d?e.format(`${d}( ${l}, ${u} )`,o,t):e.format(`( ${l} ${n} ${u} )`,o,t);if(a!=="void")return d?e.format(`${d}( ${l}, ${u} )`,o,t):e.format(`${l} ${n} ${u}`,o,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const Wt=K(qt,"+"),Ft=K(qt,"-"),ot=K(qt,"*"),ts=K(qt,"/"),ag=K(qt,"%"),lM=K(qt,"=="),uM=K(qt,"!="),hM=K(qt,"<"),cg=K(qt,">"),dM=K(qt,"<="),pM=K(qt,">="),fM=K(qt,"&&"),mM=K(qt,"||"),gM=K(qt,"!"),xM=K(qt,"^^"),_M=K(qt,"&"),yM=K(qt,"~"),vM=K(qt,"|"),MM=K(qt,"^"),SM=K(qt,"<<"),TM=K(qt,">>");te("add",Wt);te("sub",Ft);te("mul",ot);te("div",ts);te("modInt",ag);te("equal",lM);te("notEqual",uM);te("lessThan",hM);te("greaterThan",cg);te("lessThanEqual",dM);te("greaterThanEqual",pM);te("and",fM);te("or",mM);te("not",gM);te("xor",xM);te("bitAnd",_M);te("bitNot",yM);te("bitOr",vM);te("bitXor",MM);te("shiftLeft",SM);te("shiftRight",TM);const bM=(...s)=>(console.warn("TSL.OperatorNode: .remainder() has been renamed to .modInt()."),ag(...s));te("remainder",bM);class V extends pt{static get type(){return"MathNode"}constructor(e,t,n=null,i=null){super(),this.method=e,this.aNode=t,this.bNode=n,this.cNode=i}getInputType(e){const t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,i=this.cNode?this.cNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),o=e.isMatrix(n)?0:e.getTypeLength(n),a=e.isMatrix(i)?0:e.getTypeLength(i);return r>o&&r>a?t:o>a?n:a>r?i:t}getNodeType(e){const t=this.method;return t===V.LENGTH||t===V.DISTANCE||t===V.DOT?"float":t===V.CROSS?"vec3":t===V.ALL?"bool":t===V.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):t===V.MOD?this.aNode.getNodeType(e):this.getInputType(e)}generate(e,t){const n=this.method,i=this.getNodeType(e),r=this.getInputType(e),o=this.aNode,a=this.bNode,c=this.cNode,l=e.renderer.isWebGLRenderer===!0;if(n===V.TRANSFORM_DIRECTION){let u=o,h=a;e.isMatrix(u.getNodeType(e))?h=oe(D(h),0):u=oe(D(u),0);const d=ot(u,h).xyz;return vi(d).build(e,t)}else{if(n===V.NEGATE)return e.format("( - "+o.build(e,r)+" )",i,t);if(n===V.ONE_MINUS)return Ft(1,o).build(e,t);if(n===V.RECIPROCAL)return ts(1,o).build(e,t);if(n===V.DIFFERENCE)return Dt(Ft(o,a)).build(e,t);{const u=[];return n===V.CROSS||n===V.MOD?u.push(o.build(e,i),a.build(e,i)):l&&n===V.STEP?u.push(o.build(e,e.getTypeLength(o.getNodeType(e))===1?"float":r),a.build(e,r)):l&&(n===V.MIN||n===V.MAX)||n===V.MOD?u.push(o.build(e,r),a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":r)):n===V.REFRACT?u.push(o.build(e,r),a.build(e,r),c.build(e,"float")):n===V.MIX?u.push(o.build(e,r),a.build(e,r),c.build(e,e.getTypeLength(c.getNodeType(e))===1?"float":r)):(u.push(o.build(e,r)),a!==null&&u.push(a.build(e,r)),c!==null&&u.push(c.build(e,r))),e.format(`${e.getMethod(n,i)}( ${u.join(", ")} )`,i,t)}}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}V.ALL="all";V.ANY="any";V.EQUALS="equals";V.RADIANS="radians";V.DEGREES="degrees";V.EXP="exp";V.EXP2="exp2";V.LOG="log";V.LOG2="log2";V.SQRT="sqrt";V.INVERSE_SQRT="inversesqrt";V.FLOOR="floor";V.CEIL="ceil";V.NORMALIZE="normalize";V.FRACT="fract";V.SIN="sin";V.COS="cos";V.TAN="tan";V.ASIN="asin";V.ACOS="acos";V.ATAN="atan";V.ABS="abs";V.SIGN="sign";V.LENGTH="length";V.NEGATE="negate";V.ONE_MINUS="oneMinus";V.DFDX="dFdx";V.DFDY="dFdy";V.ROUND="round";V.RECIPROCAL="reciprocal";V.TRUNC="trunc";V.FWIDTH="fwidth";V.BITCAST="bitcast";V.TRANSPOSE="transpose";V.ATAN2="atan2";V.MIN="min";V.MAX="max";V.MOD="mod";V.STEP="step";V.REFLECT="reflect";V.DISTANCE="distance";V.DIFFERENCE="difference";V.DOT="dot";V.CROSS="cross";V.POW="pow";V.TRANSFORM_DIRECTION="transformDirection";V.MIX="mix";V.CLAMP="clamp";V.REFRACT="refract";V.SMOOTHSTEP="smoothstep";V.FACEFORWARD="faceforward";const wM=A(1e-6),BP=A(1e6),Qr=A(Math.PI),zP=A(Math.PI*2),lg=K(V,V.ALL),AM=K(V,V.ANY),NM=K(V,V.EQUALS),EM=K(V,V.RADIANS),CM=K(V,V.DEGREES),ug=K(V,V.EXP),gh=K(V,V.EXP2),hg=K(V,V.LOG),al=K(V,V.LOG2),os=K(V,V.SQRT),RM=K(V,V.INVERSE_SQRT),fr=K(V,V.FLOOR),dg=K(V,V.CEIL),vi=K(V,V.NORMALIZE),mr=K(V,V.FRACT),Cn=K(V,V.SIN),Mi=K(V,V.COS),IM=K(V,V.TAN),PM=K(V,V.ASIN),xh=K(V,V.ACOS),LM=K(V,V.ATAN),Dt=K(V,V.ABS),cl=K(V,V.SIGN),Jr=K(V,V.LENGTH),DM=K(V,V.NEGATE),UM=K(V,V.ONE_MINUS),FM=K(V,V.DFDX),OM=K(V,V.DFDY),VM=K(V,V.ROUND),BM=K(V,V.RECIPROCAL),pg=K(V,V.TRUNC),zM=K(V,V.FWIDTH),kP=K(V,V.BITCAST),kM=K(V,V.TRANSPOSE),GM=K(V,V.ATAN2),Mn=K(V,V.MIN),ft=K(V,V.MAX),Td=K(V,V.MOD),ll=K(V,V.STEP),HM=K(V,V.REFLECT),WM=K(V,V.DISTANCE),XM=K(V,V.DIFFERENCE),$t=K(V,V.DOT),Ko=K(V,V.CROSS),Kn=K(V,V.POW),fg=K(V,V.POW,2),qM=K(V,V.POW,3),$M=K(V,V.POW,4),YM=K(V,V.TRANSFORM_DIRECTION),ZM=s=>ot(cl(s),Kn(Dt(s),1/3)),mg=s=>$t(s,s),it=K(V,V.MIX),cn=(s,e=0,t=1)=>H(new V(V.CLAMP,H(s),H(e),H(t))),JM=s=>cn(s),gg=K(V,V.REFRACT),ti=K(V,V.SMOOTHSTEP),KM=K(V,V.FACEFORWARD),xg=U(([s])=>{const n=43758.5453,i=$t(s.xy,z(12.9898,78.233)),r=Td(i,Qr);return mr(Cn(r).mul(n))}),jM=(s,e,t)=>it(e,t,s),QM=(s,e,t)=>ti(e,t,s);te("all",lg);te("any",AM);te("equals",NM);te("radians",EM);te("degrees",CM);te("exp",ug);te("exp2",gh);te("log",hg);te("log2",al);te("sqrt",os);te("inverseSqrt",RM);te("floor",fr);te("ceil",dg);te("normalize",vi);te("fract",mr);te("sin",Cn);te("cos",Mi);te("tan",IM);te("asin",PM);te("acos",xh);te("atan",LM);te("abs",Dt);te("sign",cl);te("length",Jr);te("lengthSq",mg);te("negate",DM);te("oneMinus",UM);te("dFdx",FM);te("dFdy",OM);te("round",VM);te("reciprocal",BM);te("trunc",pg);te("fwidth",zM);te("atan2",GM);te("min",Mn);te("max",ft);te("mod",Td);te("step",ll);te("reflect",HM);te("distance",WM);te("dot",$t);te("cross",Ko);te("pow",Kn);te("pow2",fg);te("pow3",qM);te("pow4",$M);te("transformDirection",YM);te("mix",jM);te("clamp",cn);te("refract",gg);te("smoothstep",QM);te("faceForward",KM);te("difference",XM);te("saturate",JM);te("cbrt",ZM);te("transpose",kM);te("rand",xg);class GP extends Ye{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}getNodeType(e){const t=this.ifNode.getNodeType(e);if(this.elseNode!==null){const n=this.elseNode.getNodeType(e);if(e.getTypeLength(n)>e.getTypeLength(t))return n}return t}setup(e){const t=this.condNode.cache(),n=this.ifNode.cache(),i=this.elseNode?this.elseNode.cache():null,r=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=r,i!==null&&(e.getDataFromNode(i).parentNodeBlock=r);const o=e.getNodeProperties(this);o.condNode=t,o.ifNode=n.context({nodeBlock:n}),o.elseNode=i?i.context({nodeBlock:i}):null}generate(e,t){const n=this.getNodeType(e),i=e.getDataFromNode(this);if(i.nodeProperty!==void 0)return i.nodeProperty;const{condNode:r,ifNode:o,elseNode:a}=e.getNodeProperties(this),c=t!=="void",l=c?ai(n).build(e):"";i.nodeProperty=l;const u=r.build(e,"bool");e.addFlowCode(`
|
|
3847
|
+
}`;class kR{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const i=new Xt,r=e.properties.get(i);r.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new ki({vertexShader:BR,fragmentShader:zR,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new kt(new so(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class GR extends Ai{constructor(e,t){super();const n=this;let i=null,r=1,o=null,a="local-floor",c=1,l=null,u=null,h=null,d=null,p=null,f=null;const x=new kR,m=t.getContextAttributes();let g=null,y=null;const _=[],v=[],I=new J;let T=null;const w=new hn;w.layers.enable(1),w.viewport=new st;const C=new hn;C.layers.enable(2),C.viewport=new st;const F=[w,C],M=new sm;M.layers.enable(1),M.layers.enable(2);let b=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.controllerAutoUpdate=!0,this.getController=function(ne){let ue=_[ne];return ue===void 0&&(ue=new gp,_[ne]=ue),ue.getTargetRaySpace()},this.getControllerGrip=function(ne){let ue=_[ne];return ue===void 0&&(ue=new gp,_[ne]=ue),ue.getGripSpace()},this.getHand=function(ne){let ue=_[ne];return ue===void 0&&(ue=new gp,_[ne]=ue),ue.getHandSpace()};function W(ne){const ue=v.indexOf(ne.inputSource);if(ue===-1)return;const Ae=_[ue];Ae!==void 0&&(Ae.update(ne.inputSource,ne.frame,l||o),Ae.dispatchEvent({type:ne.type,data:ne.inputSource}))}function $(){i.removeEventListener("select",W),i.removeEventListener("selectstart",W),i.removeEventListener("selectend",W),i.removeEventListener("squeeze",W),i.removeEventListener("squeezestart",W),i.removeEventListener("squeezeend",W),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",ie);for(let ne=0;ne<_.length;ne++){const ue=v[ne];ue!==null&&(v[ne]=null,_[ne]&&_[ne].disconnect(ue))}b=null,G=null,x.reset(),e.setRenderTarget(g),p=null,d=null,h=null,i=null,y=null,ht.stop(),n.isPresenting=!1,e.setPixelRatio(T),e.setSize(I.width,I.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ne){r=ne,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ne){a=ne,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(ne){l=ne},this.getBaseLayer=function(){return d!==null?d:p},this.getBinding=function(){return h},this.getFrame=function(){return f},this.getSession=function(){return i},this.setSession=async function(ne){if(i=ne,i!==null){if(g=e.getRenderTarget(),i.addEventListener("select",W),i.addEventListener("selectstart",W),i.addEventListener("selectend",W),i.addEventListener("squeeze",W),i.addEventListener("squeezestart",W),i.addEventListener("squeezeend",W),i.addEventListener("end",$),i.addEventListener("inputsourceschange",ie),m.xrCompatible!==!0&&await t.makeXRCompatible(),T=e.getPixelRatio(),e.getSize(I),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let Ae=null,ge=null,Ze=null;m.depth&&(Ze=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Ae=m.stencil?ar:Qs,ge=m.stencil?or:Bi);const Xe={colorFormat:t.RGBA8,depthFormat:Ze,scaleFactor:r};h=new XRWebGLBinding(i,t),d=h.createProjectionLayer(Xe),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),y=new zi(d.textureWidth,d.textureHeight,{format:Rn,type:Qi,depthTexture:new oo(d.textureWidth,d.textureHeight,ge,void 0,void 0,void 0,void 0,void 0,void 0,Ae),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1})}else{const Ae={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};p=new XRWebGLLayer(i,t,Ae),i.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),y=new zi(p.framebufferWidth,p.framebufferHeight,{format:Rn,type:Qi,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}y.isXRRenderTarget=!0,this.setFoveation(c),l=null,o=await i.requestReferenceSpace(a),ht.setContext(i),ht.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return x.getDepthTexture()};function ie(ne){for(let ue=0;ue<ne.removed.length;ue++){const Ae=ne.removed[ue],ge=v.indexOf(Ae);ge>=0&&(v[ge]=null,_[ge]&&_[ge].disconnect(Ae))}for(let ue=0;ue<ne.added.length;ue++){const Ae=ne.added[ue];let ge=v.indexOf(Ae);if(ge===-1){for(let Xe=0;Xe<_.length;Xe++)if(Xe>=v.length){v.push(Ae),ge=Xe;break}else if(v[Xe]===null){v[Xe]=Ae,ge=Xe;break}if(ge===-1)break}const Ze=_[ge];Ze&&Ze.connect(Ae)}}const q=new E,he=new E;function Q(ne,ue,Ae){q.setFromMatrixPosition(ue.matrixWorld),he.setFromMatrixPosition(Ae.matrixWorld);const ge=q.distanceTo(he),Ze=ue.projectionMatrix.elements,Xe=Ae.projectionMatrix.elements,Je=Ze[14]/(Ze[10]-1),dt=Ze[14]/(Ze[10]+1),ae=(Ze[9]+1)/Ze[5],P=(Ze[9]-1)/Ze[5],Me=(Ze[8]-1)/Ze[0],ye=(Xe[8]+1)/Xe[0],de=Je*Me,Te=Je*ye,qe=ge/(-Me+ye),Ie=qe*-Me;if(ue.matrixWorld.decompose(ne.position,ne.quaternion,ne.scale),ne.translateX(Ie),ne.translateZ(qe),ne.matrixWorld.compose(ne.position,ne.quaternion,ne.scale),ne.matrixWorldInverse.copy(ne.matrixWorld).invert(),Ze[10]===-1)ne.projectionMatrix.copy(ue.projectionMatrix),ne.projectionMatrixInverse.copy(ue.projectionMatrixInverse);else{const R=Je+qe,S=dt+qe,X=de-Ie,se=Te+(ge-Ie),ce=ae*dt/S*R,re=P*dt/S*R;ne.projectionMatrix.makePerspective(X,se,ce,re,R,S),ne.projectionMatrixInverse.copy(ne.projectionMatrix).invert()}}function we(ne,ue){ue===null?ne.matrixWorld.copy(ne.matrix):ne.matrixWorld.multiplyMatrices(ue.matrixWorld,ne.matrix),ne.matrixWorldInverse.copy(ne.matrixWorld).invert()}this.updateCamera=function(ne){if(i===null)return;let ue=ne.near,Ae=ne.far;x.texture!==null&&(x.depthNear>0&&(ue=x.depthNear),x.depthFar>0&&(Ae=x.depthFar)),M.near=C.near=w.near=ue,M.far=C.far=w.far=Ae,(b!==M.near||G!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),b=M.near,G=M.far);const ge=ne.parent,Ze=M.cameras;we(M,ge);for(let Xe=0;Xe<Ze.length;Xe++)we(Ze[Xe],ge);Ze.length===2?Q(M,w,C):M.projectionMatrix.copy(w.projectionMatrix),Ne(ne,M,ge)};function Ne(ne,ue,Ae){Ae===null?ne.matrix.copy(ue.matrixWorld):(ne.matrix.copy(Ae.matrixWorld),ne.matrix.invert(),ne.matrix.multiply(ue.matrixWorld)),ne.matrix.decompose(ne.position,ne.quaternion,ne.scale),ne.updateMatrixWorld(!0),ne.projectionMatrix.copy(ue.projectionMatrix),ne.projectionMatrixInverse.copy(ue.projectionMatrixInverse),ne.isPerspectiveCamera&&(ne.fov=ia*2*Math.atan(1/ne.projectionMatrix.elements[5]),ne.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(d===null&&p===null))return c},this.setFoveation=function(ne){c=ne,d!==null&&(d.fixedFoveation=ne),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=ne)},this.hasDepthSensing=function(){return x.texture!==null},this.getDepthSensingMesh=function(){return x.getMesh(M)};let Ee=null;function Qe(ne,ue){if(u=ue.getViewerPose(l||o),f=ue,u!==null){const Ae=u.views;p!==null&&(e.setRenderTargetFramebuffer(y,p.framebuffer),e.setRenderTarget(y));let ge=!1;Ae.length!==M.cameras.length&&(M.cameras.length=0,ge=!0);for(let Xe=0;Xe<Ae.length;Xe++){const Je=Ae[Xe];let dt=null;if(p!==null)dt=p.getViewport(Je);else{const P=h.getViewSubImage(d,Je);dt=P.viewport,Xe===0&&(e.setRenderTargetTextures(y,P.colorTexture,d.ignoreDepthValues?void 0:P.depthStencilTexture),e.setRenderTarget(y))}let ae=F[Xe];ae===void 0&&(ae=new hn,ae.layers.enable(Xe),ae.viewport=new st,F[Xe]=ae),ae.matrix.fromArray(Je.transform.matrix),ae.matrix.decompose(ae.position,ae.quaternion,ae.scale),ae.projectionMatrix.fromArray(Je.projectionMatrix),ae.projectionMatrixInverse.copy(ae.projectionMatrix).invert(),ae.viewport.set(dt.x,dt.y,dt.width,dt.height),Xe===0&&(M.matrix.copy(ae.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),ge===!0&&M.cameras.push(ae)}const Ze=i.enabledFeatures;if(Ze&&Ze.includes("depth-sensing")){const Xe=h.getDepthInformation(Ae[0]);Xe&&Xe.isValid&&Xe.texture&&x.init(e,Xe,i.renderState)}}if(n.controllerAutoUpdate)for(let Ae=0;Ae<_.length;Ae++){const ge=v[Ae],Ze=_[Ae];ge!==null&&Ze!==void 0&&Ze.update(ge,ue,l||o)}Ee&&Ee(ne,ue),ue.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ue}),f=null}const ht=new zy;ht.setAnimationLoop(Qe),this.setAnimationLoop=function(ne){Ee=ne},this.dispose=function(){}}}const br=new ui,HR=new Fe;function WR(s,e){function t(m,g){m.matrixAutoUpdate===!0&&m.updateMatrix(),g.value.copy(m.matrix)}function n(m,g){g.color.getRGB(m.fogColor.value,By(s)),g.isFog?(m.fogNear.value=g.near,m.fogFar.value=g.far):g.isFogExp2&&(m.fogDensity.value=g.density)}function i(m,g,y,_,v){g.isMeshBasicMaterial||g.isMeshLambertMaterial?r(m,g):g.isMeshToonMaterial?(r(m,g),h(m,g)):g.isMeshPhongMaterial?(r(m,g),u(m,g)):g.isMeshStandardMaterial?(r(m,g),d(m,g),g.isMeshPhysicalMaterial&&p(m,g,v)):g.isMeshMatcapMaterial?(r(m,g),f(m,g)):g.isMeshDepthMaterial?r(m,g):g.isMeshDistanceMaterial?(r(m,g),x(m,g)):g.isMeshNormalMaterial?r(m,g):g.isLineBasicMaterial?(o(m,g),g.isLineDashedMaterial&&a(m,g)):g.isPointsMaterial?c(m,g,y,_):g.isSpriteMaterial?l(m,g):g.isShadowMaterial?(m.color.value.copy(g.color),m.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function r(m,g){m.opacity.value=g.opacity,g.color&&m.diffuse.value.copy(g.color),g.emissive&&m.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(m.map.value=g.map,t(g.map,m.mapTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,t(g.alphaMap,m.alphaMapTransform)),g.bumpMap&&(m.bumpMap.value=g.bumpMap,t(g.bumpMap,m.bumpMapTransform),m.bumpScale.value=g.bumpScale,g.side===ln&&(m.bumpScale.value*=-1)),g.normalMap&&(m.normalMap.value=g.normalMap,t(g.normalMap,m.normalMapTransform),m.normalScale.value.copy(g.normalScale),g.side===ln&&m.normalScale.value.negate()),g.displacementMap&&(m.displacementMap.value=g.displacementMap,t(g.displacementMap,m.displacementMapTransform),m.displacementScale.value=g.displacementScale,m.displacementBias.value=g.displacementBias),g.emissiveMap&&(m.emissiveMap.value=g.emissiveMap,t(g.emissiveMap,m.emissiveMapTransform)),g.specularMap&&(m.specularMap.value=g.specularMap,t(g.specularMap,m.specularMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);const y=e.get(g),_=y.envMap,v=y.envMapRotation;_&&(m.envMap.value=_,br.copy(v),br.x*=-1,br.y*=-1,br.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(br.y*=-1,br.z*=-1),m.envMapRotation.value.setFromMatrix4(HR.makeRotationFromEuler(br)),m.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=g.reflectivity,m.ior.value=g.ior,m.refractionRatio.value=g.refractionRatio),g.lightMap&&(m.lightMap.value=g.lightMap,m.lightMapIntensity.value=g.lightMapIntensity,t(g.lightMap,m.lightMapTransform)),g.aoMap&&(m.aoMap.value=g.aoMap,m.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,m.aoMapTransform))}function o(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,g.map&&(m.map.value=g.map,t(g.map,m.mapTransform))}function a(m,g){m.dashSize.value=g.dashSize,m.totalSize.value=g.dashSize+g.gapSize,m.scale.value=g.scale}function c(m,g,y,_){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.size.value=g.size*y,m.scale.value=_*.5,g.map&&(m.map.value=g.map,t(g.map,m.uvTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,t(g.alphaMap,m.alphaMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest)}function l(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.rotation.value=g.rotation,g.map&&(m.map.value=g.map,t(g.map,m.mapTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,t(g.alphaMap,m.alphaMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest)}function u(m,g){m.specular.value.copy(g.specular),m.shininess.value=Math.max(g.shininess,1e-4)}function h(m,g){g.gradientMap&&(m.gradientMap.value=g.gradientMap)}function d(m,g){m.metalness.value=g.metalness,g.metalnessMap&&(m.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,m.metalnessMapTransform)),m.roughness.value=g.roughness,g.roughnessMap&&(m.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,m.roughnessMapTransform)),g.envMap&&(m.envMapIntensity.value=g.envMapIntensity)}function p(m,g,y){m.ior.value=g.ior,g.sheen>0&&(m.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),m.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(m.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,m.sheenColorMapTransform)),g.sheenRoughnessMap&&(m.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,m.sheenRoughnessMapTransform))),g.clearcoat>0&&(m.clearcoat.value=g.clearcoat,m.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(m.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,m.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(m.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===ln&&m.clearcoatNormalScale.value.negate())),g.dispersion>0&&(m.dispersion.value=g.dispersion),g.iridescence>0&&(m.iridescence.value=g.iridescence,m.iridescenceIOR.value=g.iridescenceIOR,m.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(m.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,m.iridescenceMapTransform)),g.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),g.transmission>0&&(m.transmission.value=g.transmission,m.transmissionSamplerMap.value=y.texture,m.transmissionSamplerSize.value.set(y.width,y.height),g.transmissionMap&&(m.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,m.transmissionMapTransform)),m.thickness.value=g.thickness,g.thicknessMap&&(m.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=g.attenuationDistance,m.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(m.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(m.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=g.specularIntensity,m.specularColor.value.copy(g.specularColor),g.specularColorMap&&(m.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,m.specularColorMapTransform)),g.specularIntensityMap&&(m.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,m.specularIntensityMapTransform))}function f(m,g){g.matcap&&(m.matcap.value=g.matcap)}function x(m,g){const y=e.get(g).light;m.referencePosition.value.setFromMatrixPosition(y.matrixWorld),m.nearDistance.value=y.shadow.camera.near,m.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function XR(s,e,t,n){let i={},r={},o=[];const a=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function c(y,_){const v=_.program;n.uniformBlockBinding(y,v)}function l(y,_){let v=i[y.id];v===void 0&&(f(y),v=u(y),i[y.id]=v,y.addEventListener("dispose",m));const I=_.program;n.updateUBOMapping(y,I);const T=e.render.frame;r[y.id]!==T&&(d(y),r[y.id]=T)}function u(y){const _=h();y.__bindingPointIndex=_;const v=s.createBuffer(),I=y.__size,T=y.usage;return s.bindBuffer(s.UNIFORM_BUFFER,v),s.bufferData(s.UNIFORM_BUFFER,I,T),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,_,v),v}function h(){for(let y=0;y<a;y++)if(o.indexOf(y)===-1)return o.push(y),y;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(y){const _=i[y.id],v=y.uniforms,I=y.__cache;s.bindBuffer(s.UNIFORM_BUFFER,_);for(let T=0,w=v.length;T<w;T++){const C=Array.isArray(v[T])?v[T]:[v[T]];for(let F=0,M=C.length;F<M;F++){const b=C[F];if(p(b,T,F,I)===!0){const G=b.__offset,W=Array.isArray(b.value)?b.value:[b.value];let $=0;for(let ie=0;ie<W.length;ie++){const q=W[ie],he=x(q);typeof q=="number"||typeof q=="boolean"?(b.__data[0]=q,s.bufferSubData(s.UNIFORM_BUFFER,G+$,b.__data)):q.isMatrix3?(b.__data[0]=q.elements[0],b.__data[1]=q.elements[1],b.__data[2]=q.elements[2],b.__data[3]=0,b.__data[4]=q.elements[3],b.__data[5]=q.elements[4],b.__data[6]=q.elements[5],b.__data[7]=0,b.__data[8]=q.elements[6],b.__data[9]=q.elements[7],b.__data[10]=q.elements[8],b.__data[11]=0):(q.toArray(b.__data,$),$+=he.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,G,b.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function p(y,_,v,I){const T=y.value,w=_+"_"+v;if(I[w]===void 0)return typeof T=="number"||typeof T=="boolean"?I[w]=T:I[w]=T.clone(),!0;{const C=I[w];if(typeof T=="number"||typeof T=="boolean"){if(C!==T)return I[w]=T,!0}else if(C.equals(T)===!1)return C.copy(T),!0}return!1}function f(y){const _=y.uniforms;let v=0;const I=16;for(let w=0,C=_.length;w<C;w++){const F=Array.isArray(_[w])?_[w]:[_[w]];for(let M=0,b=F.length;M<b;M++){const G=F[M],W=Array.isArray(G.value)?G.value:[G.value];for(let $=0,ie=W.length;$<ie;$++){const q=W[$],he=x(q),Q=v%I,we=Q%he.boundary,Ne=Q+we;v+=we,Ne!==0&&I-Ne<he.storage&&(v+=I-Ne),G.__data=new Float32Array(he.storage/Float32Array.BYTES_PER_ELEMENT),G.__offset=v,v+=he.storage}}}const T=v%I;return T>0&&(v+=I-T),y.__size=v,y.__cache={},this}function x(y){const _={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(_.boundary=4,_.storage=4):y.isVector2?(_.boundary=8,_.storage=8):y.isVector3||y.isColor?(_.boundary=16,_.storage=12):y.isVector4?(_.boundary=16,_.storage=16):y.isMatrix3?(_.boundary=48,_.storage=48):y.isMatrix4?(_.boundary=64,_.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),_}function m(y){const _=y.target;_.removeEventListener("dispose",m);const v=o.indexOf(_.__bindingPointIndex);o.splice(v,1),s.deleteBuffer(i[_.id]),delete i[_.id],delete r[_.id]}function g(){for(const y in i)s.deleteBuffer(i[y]);o=[],i={},r={}}return{bind:c,update:l,dispose:g}}class qy{constructor(e={}){const{canvas:t=Dy(),context:n=null,depth:i=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=o;const p=new Uint32Array(4),f=new Int32Array(4);let x=null,m=null;const g=[],y=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=kn,this.toneMapping=Ti,this.toneMappingExposure=1;const _=this;let v=!1,I=0,T=0,w=null,C=-1,F=null;const M=new st,b=new st;let G=null;const W=new _e(0);let $=0,ie=t.width,q=t.height,he=1,Q=null,we=null;const Ne=new st(0,0,ie,q),Ee=new st(0,0,ie,q);let Qe=!1;const ht=new ma;let ne=!1,ue=!1;const Ae=new Fe,ge=new Fe,Ze=new E,Xe=new st,Je={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let dt=!1;function ae(){return w===null?he:1}let P=n;function Me(N,B){return t.getContext(N,B)}try{const N={alpha:!0,depth:i,stencil:r,antialias:a,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ks}`),t.addEventListener("webglcontextlost",le,!1),t.addEventListener("webglcontextrestored",Ce,!1),t.addEventListener("webglcontextcreationerror",Le,!1),P===null){const B="webgl2";if(P=Me(B,N),P===null)throw Me(B)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(N){throw console.error("THREE.WebGLRenderer: "+N.message),N}let ye,de,Te,qe,Ie,R,S,X,se,ce,re,ke,be,De,vt,me,Ue,tt,nt,Be,Mt,ct,Ot,O;function Pe(){ye=new KE(P),ye.init(),ct=new Xy(P,ye),de=new qE(P,ye,e,ct),Te=new IR(P),de.reverseDepthBuffer&&Te.buffers.depth.setReversed(!0),qe=new eC(P),Ie=new _R,R=new OR(P,ye,Te,Ie,de,ct,qe),S=new YE(_),X=new JE(_),se=new c1(P),Ot=new WE(P,se),ce=new jE(P,se,qe,Ot),re=new nC(P,ce,se,qe),nt=new tC(P,de,R),me=new $E(Ie),ke=new xR(_,S,X,ye,de,Ot,me),be=new WR(_,Ie),De=new vR,vt=new AR(ye),tt=new HE(_,S,X,Te,re,d,c),Ue=new CR(_,re,de),O=new XR(P,qe,de,Te),Be=new XE(P,ye,qe),Mt=new QE(P,ye,qe),qe.programs=ke.programs,_.capabilities=de,_.extensions=ye,_.properties=Ie,_.renderLists=De,_.shadowMap=Ue,_.state=Te,_.info=qe}Pe();const ee=new GR(_,P);this.xr=ee,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){const N=ye.get("WEBGL_lose_context");N&&N.loseContext()},this.forceContextRestore=function(){const N=ye.get("WEBGL_lose_context");N&&N.restoreContext()},this.getPixelRatio=function(){return he},this.setPixelRatio=function(N){N!==void 0&&(he=N,this.setSize(ie,q,!1))},this.getSize=function(N){return N.set(ie,q)},this.setSize=function(N,B,Y=!0){if(ee.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}ie=N,q=B,t.width=Math.floor(N*he),t.height=Math.floor(B*he),Y===!0&&(t.style.width=N+"px",t.style.height=B+"px"),this.setViewport(0,0,N,B)},this.getDrawingBufferSize=function(N){return N.set(ie*he,q*he).floor()},this.setDrawingBufferSize=function(N,B,Y){ie=N,q=B,he=Y,t.width=Math.floor(N*Y),t.height=Math.floor(B*Y),this.setViewport(0,0,N,B)},this.getCurrentViewport=function(N){return N.copy(M)},this.getViewport=function(N){return N.copy(Ne)},this.setViewport=function(N,B,Y,Z){N.isVector4?Ne.set(N.x,N.y,N.z,N.w):Ne.set(N,B,Y,Z),Te.viewport(M.copy(Ne).multiplyScalar(he).round())},this.getScissor=function(N){return N.copy(Ee)},this.setScissor=function(N,B,Y,Z){N.isVector4?Ee.set(N.x,N.y,N.z,N.w):Ee.set(N,B,Y,Z),Te.scissor(b.copy(Ee).multiplyScalar(he).round())},this.getScissorTest=function(){return Qe},this.setScissorTest=function(N){Te.setScissorTest(Qe=N)},this.setOpaqueSort=function(N){Q=N},this.setTransparentSort=function(N){we=N},this.getClearColor=function(N){return N.copy(tt.getClearColor())},this.setClearColor=function(){tt.setClearColor.apply(tt,arguments)},this.getClearAlpha=function(){return tt.getClearAlpha()},this.setClearAlpha=function(){tt.setClearAlpha.apply(tt,arguments)},this.clear=function(N=!0,B=!0,Y=!0){let Z=0;if(N){let k=!1;if(w!==null){const xe=w.texture.format;k=xe===Oh||xe===Fh||xe===Wc}if(k){const xe=w.texture.type,Re=xe===Qi||xe===Bi||xe===Qo||xe===or||xe===Dh||xe===Uh,ze=tt.getClearColor(),Ge=tt.getClearAlpha(),je=ze.r,et=ze.g,He=ze.b;Re?(p[0]=je,p[1]=et,p[2]=He,p[3]=Ge,P.clearBufferuiv(P.COLOR,0,p)):(f[0]=je,f[1]=et,f[2]=He,f[3]=Ge,P.clearBufferiv(P.COLOR,0,f))}else Z|=P.COLOR_BUFFER_BIT}B&&(Z|=P.DEPTH_BUFFER_BIT,P.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Y&&(Z|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),P.clear(Z)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",le,!1),t.removeEventListener("webglcontextrestored",Ce,!1),t.removeEventListener("webglcontextcreationerror",Le,!1),De.dispose(),vt.dispose(),Ie.dispose(),S.dispose(),X.dispose(),re.dispose(),Ot.dispose(),O.dispose(),ke.dispose(),ee.dispose(),ee.removeEventListener("sessionstart",c0),ee.removeEventListener("sessionend",l0),_r.stop()};function le(N){N.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),v=!0}function Ce(){console.log("THREE.WebGLRenderer: Context Restored."),v=!1;const N=qe.autoReset,B=Ue.enabled,Y=Ue.autoUpdate,Z=Ue.needsUpdate,k=Ue.type;Pe(),qe.autoReset=N,Ue.enabled=B,Ue.autoUpdate=Y,Ue.needsUpdate=Z,Ue.type=k}function Le(N){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",N.statusMessage)}function bt(N){const B=N.target;B.removeEventListener("dispose",bt),on(B)}function on(N){ni(N),Ie.remove(N)}function ni(N){const B=Ie.get(N).programs;B!==void 0&&(B.forEach(function(Y){ke.releaseProgram(Y)}),N.isShaderMaterial&&ke.releaseShaderCache(N))}this.renderBufferDirect=function(N,B,Y,Z,k,xe){B===null&&(B=Je);const Re=k.isMesh&&k.matrixWorld.determinant()<0,ze=Jw(N,B,Y,Z,k);Te.setMaterial(Z,Re);let Ge=Y.index,je=1;if(Z.wireframe===!0){if(Ge=ce.getWireframeAttribute(Y),Ge===void 0)return;je=2}const et=Y.drawRange,He=Y.attributes.position;let Lt=et.start*je,Gt=(et.start+et.count)*je;xe!==null&&(Lt=Math.max(Lt,xe.start*je),Gt=Math.min(Gt,(xe.start+xe.count)*je)),Ge!==null?(Lt=Math.max(Lt,0),Gt=Math.min(Gt,Ge.count)):He!=null&&(Lt=Math.max(Lt,0),Gt=Math.min(Gt,He.count));const Jt=Gt-Lt;if(Jt<0||Jt===1/0)return;Ot.setup(k,Z,ze,Y,Ge);let fi,Rt=Be;if(Ge!==null&&(fi=se.get(Ge),Rt=Mt,Rt.setIndex(fi)),k.isMesh)Z.wireframe===!0?(Te.setLineWidth(Z.wireframeLinewidth*ae()),Rt.setMode(P.LINES)):Rt.setMode(P.TRIANGLES);else if(k.isLine){let $e=Z.linewidth;$e===void 0&&($e=1),Te.setLineWidth($e*ae()),k.isLineSegments?Rt.setMode(P.LINES):k.isLineLoop?Rt.setMode(P.LINE_LOOP):Rt.setMode(P.LINE_STRIP)}else k.isPoints?Rt.setMode(P.POINTS):k.isSprite&&Rt.setMode(P.TRIANGLES);if(k.isBatchedMesh)if(k._multiDrawInstances!==null)Rt.renderMultiDrawInstances(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount,k._multiDrawInstances);else if(ye.get("WEBGL_multi_draw"))Rt.renderMultiDraw(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount);else{const $e=k._multiDrawStarts,An=k._multiDrawCounts,It=k._multiDrawCount,Wi=Ge?se.get(Ge).bytesPerElement:1,fo=Ie.get(Z).currentProgram.getUniforms();for(let mi=0;mi<It;mi++)fo.setValue(P,"_gl_DrawID",mi),Rt.render($e[mi]/Wi,An[mi])}else if(k.isInstancedMesh)Rt.renderInstances(Lt,Jt,k.count);else if(Y.isInstancedBufferGeometry){const $e=Y._maxInstanceCount!==void 0?Y._maxInstanceCount:1/0,An=Math.min(Y.instanceCount,$e);Rt.renderInstances(Lt,Jt,An)}else Rt.render(Lt,Jt)};function Et(N,B,Y){N.transparent===!0&&N.side===Zi&&N.forceSinglePass===!1?(N.side=ln,N.needsUpdate=!0,bl(N,B,Y),N.side=fs,N.needsUpdate=!0,bl(N,B,Y),N.side=Zi):bl(N,B,Y)}this.compile=function(N,B,Y=null){Y===null&&(Y=N),m=vt.get(Y),m.init(B),y.push(m),Y.traverseVisible(function(k){k.isLight&&k.layers.test(B.layers)&&(m.pushLight(k),k.castShadow&&m.pushShadow(k))}),N!==Y&&N.traverseVisible(function(k){k.isLight&&k.layers.test(B.layers)&&(m.pushLight(k),k.castShadow&&m.pushShadow(k))}),m.setupLights();const Z=new Set;return N.traverse(function(k){if(!(k.isMesh||k.isPoints||k.isLine||k.isSprite))return;const xe=k.material;if(xe)if(Array.isArray(xe))for(let Re=0;Re<xe.length;Re++){const ze=xe[Re];Et(ze,Y,k),Z.add(ze)}else Et(xe,Y,k),Z.add(xe)}),y.pop(),m=null,Z},this.compileAsync=function(N,B,Y=null){const Z=this.compile(N,B,Y);return new Promise(k=>{function xe(){if(Z.forEach(function(Re){Ie.get(Re).currentProgram.isReady()&&Z.delete(Re)}),Z.size===0){k(N);return}setTimeout(xe,10)}ye.get("KHR_parallel_shader_compile")!==null?xe():setTimeout(xe,10)})};let ii=null;function vs(N){ii&&ii(N)}function c0(){_r.stop()}function l0(){_r.start()}const _r=new zy;_r.setAnimationLoop(vs),typeof self<"u"&&_r.setContext(self),this.setAnimationLoop=function(N){ii=N,ee.setAnimationLoop(N),N===null?_r.stop():_r.start()},ee.addEventListener("sessionstart",c0),ee.addEventListener("sessionend",l0),this.render=function(N,B){if(B!==void 0&&B.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;if(N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),B.parent===null&&B.matrixWorldAutoUpdate===!0&&B.updateMatrixWorld(),ee.enabled===!0&&ee.isPresenting===!0&&(ee.cameraAutoUpdate===!0&&ee.updateCamera(B),B=ee.getCamera()),N.isScene===!0&&N.onBeforeRender(_,N,B,w),m=vt.get(N,y.length),m.init(B),y.push(m),ge.multiplyMatrices(B.projectionMatrix,B.matrixWorldInverse),ht.setFromProjectionMatrix(ge),ue=this.localClippingEnabled,ne=me.init(this.clippingPlanes,ue),x=De.get(N,g.length),x.init(),g.push(x),ee.enabled===!0&&ee.isPresenting===!0){const xe=_.xr.getDepthSensingMesh();xe!==null&&Bd(xe,B,-1/0,_.sortObjects)}Bd(N,B,0,_.sortObjects),x.finish(),_.sortObjects===!0&&x.sort(Q,we),dt=ee.enabled===!1||ee.isPresenting===!1||ee.hasDepthSensing()===!1,dt&&tt.addToRenderList(x,N),this.info.render.frame++,ne===!0&&me.beginShadows();const Y=m.state.shadowsArray;Ue.render(Y,N,B),ne===!0&&me.endShadows(),this.info.autoReset===!0&&this.info.reset();const Z=x.opaque,k=x.transmissive;if(m.setupLights(),B.isArrayCamera){const xe=B.cameras;if(k.length>0)for(let Re=0,ze=xe.length;Re<ze;Re++){const Ge=xe[Re];h0(Z,k,N,Ge)}dt&&tt.render(N);for(let Re=0,ze=xe.length;Re<ze;Re++){const Ge=xe[Re];u0(x,N,Ge,Ge.viewport)}}else k.length>0&&h0(Z,k,N,B),dt&&tt.render(N),u0(x,N,B);w!==null&&(R.updateMultisampleRenderTarget(w),R.updateRenderTargetMipmap(w)),N.isScene===!0&&N.onAfterRender(_,N,B),Ot.resetDefaultState(),C=-1,F=null,y.pop(),y.length>0?(m=y[y.length-1],ne===!0&&me.setGlobalState(_.clippingPlanes,m.state.camera)):m=null,g.pop(),g.length>0?x=g[g.length-1]:x=null};function Bd(N,B,Y,Z){if(N.visible===!1)return;if(N.layers.test(B.layers)){if(N.isGroup)Y=N.renderOrder;else if(N.isLOD)N.autoUpdate===!0&&N.update(B);else if(N.isLight)m.pushLight(N),N.castShadow&&m.pushShadow(N);else if(N.isSprite){if(!N.frustumCulled||ht.intersectsSprite(N)){Z&&Xe.setFromMatrixPosition(N.matrixWorld).applyMatrix4(ge);const Re=re.update(N),ze=N.material;ze.visible&&x.push(N,Re,ze,Y,Xe.z,null)}}else if((N.isMesh||N.isLine||N.isPoints)&&(!N.frustumCulled||ht.intersectsObject(N))){const Re=re.update(N),ze=N.material;if(Z&&(N.boundingSphere!==void 0?(N.boundingSphere===null&&N.computeBoundingSphere(),Xe.copy(N.boundingSphere.center)):(Re.boundingSphere===null&&Re.computeBoundingSphere(),Xe.copy(Re.boundingSphere.center)),Xe.applyMatrix4(N.matrixWorld).applyMatrix4(ge)),Array.isArray(ze)){const Ge=Re.groups;for(let je=0,et=Ge.length;je<et;je++){const He=Ge[je],Lt=ze[He.materialIndex];Lt&&Lt.visible&&x.push(N,Re,Lt,Y,Xe.z,He)}}else ze.visible&&x.push(N,Re,ze,Y,Xe.z,null)}}const xe=N.children;for(let Re=0,ze=xe.length;Re<ze;Re++)Bd(xe[Re],B,Y,Z)}function u0(N,B,Y,Z){const k=N.opaque,xe=N.transmissive,Re=N.transparent;m.setupLightsView(Y),ne===!0&&me.setGlobalState(_.clippingPlanes,Y),Z&&Te.viewport(M.copy(Z)),k.length>0&&Tl(k,B,Y),xe.length>0&&Tl(xe,B,Y),Re.length>0&&Tl(Re,B,Y),Te.buffers.depth.setTest(!0),Te.buffers.depth.setMask(!0),Te.buffers.color.setMask(!0),Te.setPolygonOffset(!1)}function h0(N,B,Y,Z){if((Y.isScene===!0?Y.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[Z.id]===void 0&&(m.state.transmissionRenderTarget[Z.id]=new zi(1,1,{generateMipmaps:!0,type:ye.has("EXT_color_buffer_half_float")||ye.has("EXT_color_buffer_float")?Ln:Qi,minFilter:Jn,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:gt.workingColorSpace}));const xe=m.state.transmissionRenderTarget[Z.id],Re=Z.viewport||M;xe.setSize(Re.z,Re.w);const ze=_.getRenderTarget();_.setRenderTarget(xe),_.getClearColor(W),$=_.getClearAlpha(),$<1&&_.setClearColor(16777215,.5),_.clear(),dt&&tt.render(Y);const Ge=_.toneMapping;_.toneMapping=Ti;const je=Z.viewport;if(Z.viewport!==void 0&&(Z.viewport=void 0),m.setupLightsView(Z),ne===!0&&me.setGlobalState(_.clippingPlanes,Z),Tl(N,Y,Z),R.updateMultisampleRenderTarget(xe),R.updateRenderTargetMipmap(xe),ye.has("WEBGL_multisampled_render_to_texture")===!1){let et=!1;for(let He=0,Lt=B.length;He<Lt;He++){const Gt=B[He],Jt=Gt.object,fi=Gt.geometry,Rt=Gt.material,$e=Gt.group;if(Rt.side===Zi&&Jt.layers.test(Z.layers)){const An=Rt.side;Rt.side=ln,Rt.needsUpdate=!0,d0(Jt,Y,Z,fi,Rt,$e),Rt.side=An,Rt.needsUpdate=!0,et=!0}}et===!0&&(R.updateMultisampleRenderTarget(xe),R.updateRenderTargetMipmap(xe))}_.setRenderTarget(ze),_.setClearColor(W,$),je!==void 0&&(Z.viewport=je),_.toneMapping=Ge}function Tl(N,B,Y){const Z=B.isScene===!0?B.overrideMaterial:null;for(let k=0,xe=N.length;k<xe;k++){const Re=N[k],ze=Re.object,Ge=Re.geometry,je=Z===null?Re.material:Z,et=Re.group;ze.layers.test(Y.layers)&&d0(ze,B,Y,Ge,je,et)}}function d0(N,B,Y,Z,k,xe){N.onBeforeRender(_,B,Y,Z,k,xe),N.modelViewMatrix.multiplyMatrices(Y.matrixWorldInverse,N.matrixWorld),N.normalMatrix.getNormalMatrix(N.modelViewMatrix),k.onBeforeRender(_,B,Y,Z,N,xe),k.transparent===!0&&k.side===Zi&&k.forceSinglePass===!1?(k.side=ln,k.needsUpdate=!0,_.renderBufferDirect(Y,B,Z,k,N,xe),k.side=fs,k.needsUpdate=!0,_.renderBufferDirect(Y,B,Z,k,N,xe),k.side=Zi):_.renderBufferDirect(Y,B,Z,k,N,xe),N.onAfterRender(_,B,Y,Z,k,xe)}function bl(N,B,Y){B.isScene!==!0&&(B=Je);const Z=Ie.get(N),k=m.state.lights,xe=m.state.shadowsArray,Re=k.state.version,ze=ke.getParameters(N,k.state,xe,B,Y),Ge=ke.getProgramCacheKey(ze);let je=Z.programs;Z.environment=N.isMeshStandardMaterial?B.environment:null,Z.fog=B.fog,Z.envMap=(N.isMeshStandardMaterial?X:S).get(N.envMap||Z.environment),Z.envMapRotation=Z.environment!==null&&N.envMap===null?B.environmentRotation:N.envMapRotation,je===void 0&&(N.addEventListener("dispose",bt),je=new Map,Z.programs=je);let et=je.get(Ge);if(et!==void 0){if(Z.currentProgram===et&&Z.lightsStateVersion===Re)return f0(N,ze),et}else ze.uniforms=ke.getUniforms(N),N.onBuild(Y,ze,_),N.onBeforeCompile(ze,_),et=ke.acquireProgram(ze,Ge),je.set(Ge,et),Z.uniforms=ze.uniforms;const He=Z.uniforms;return(!N.isShaderMaterial&&!N.isRawShaderMaterial||N.clipping===!0)&&(He.clippingPlanes=me.uniform),f0(N,ze),Z.needsLights=jw(N),Z.lightsStateVersion=Re,Z.needsLights&&(He.ambientLightColor.value=k.state.ambient,He.lightProbe.value=k.state.probe,He.directionalLights.value=k.state.directional,He.directionalLightShadows.value=k.state.directionalShadow,He.spotLights.value=k.state.spot,He.spotLightShadows.value=k.state.spotShadow,He.rectAreaLights.value=k.state.rectArea,He.ltc_1.value=k.state.rectAreaLTC1,He.ltc_2.value=k.state.rectAreaLTC2,He.pointLights.value=k.state.point,He.pointLightShadows.value=k.state.pointShadow,He.hemisphereLights.value=k.state.hemi,He.directionalShadowMap.value=k.state.directionalShadowMap,He.directionalShadowMatrix.value=k.state.directionalShadowMatrix,He.spotShadowMap.value=k.state.spotShadowMap,He.spotLightMatrix.value=k.state.spotLightMatrix,He.spotLightMap.value=k.state.spotLightMap,He.pointShadowMap.value=k.state.pointShadowMap,He.pointShadowMatrix.value=k.state.pointShadowMatrix),Z.currentProgram=et,Z.uniformsList=null,et}function p0(N){if(N.uniformsList===null){const B=N.currentProgram.getUniforms();N.uniformsList=Ru.seqWithValue(B.seq,N.uniforms)}return N.uniformsList}function f0(N,B){const Y=Ie.get(N);Y.outputColorSpace=B.outputColorSpace,Y.batching=B.batching,Y.batchingColor=B.batchingColor,Y.instancing=B.instancing,Y.instancingColor=B.instancingColor,Y.instancingMorph=B.instancingMorph,Y.skinning=B.skinning,Y.morphTargets=B.morphTargets,Y.morphNormals=B.morphNormals,Y.morphColors=B.morphColors,Y.morphTargetsCount=B.morphTargetsCount,Y.numClippingPlanes=B.numClippingPlanes,Y.numIntersection=B.numClipIntersection,Y.vertexAlphas=B.vertexAlphas,Y.vertexTangents=B.vertexTangents,Y.toneMapping=B.toneMapping}function Jw(N,B,Y,Z,k){B.isScene!==!0&&(B=Je),R.resetTextureUnits();const xe=B.fog,Re=Z.isMeshStandardMaterial?B.environment:null,ze=w===null?_.outputColorSpace:w.isXRRenderTarget===!0?w.texture.colorSpace:li,Ge=(Z.isMeshStandardMaterial?X:S).get(Z.envMap||Re),je=Z.vertexColors===!0&&!!Y.attributes.color&&Y.attributes.color.itemSize===4,et=!!Y.attributes.tangent&&(!!Z.normalMap||Z.anisotropy>0),He=!!Y.morphAttributes.position,Lt=!!Y.morphAttributes.normal,Gt=!!Y.morphAttributes.color;let Jt=Ti;Z.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&(Jt=_.toneMapping);const fi=Y.morphAttributes.position||Y.morphAttributes.normal||Y.morphAttributes.color,Rt=fi!==void 0?fi.length:0,$e=Ie.get(Z),An=m.state.lights;if(ne===!0&&(ue===!0||N!==F)){const Ni=N===F&&Z.id===C;me.setState(Z,N,Ni)}let It=!1;Z.version===$e.__version?($e.needsLights&&$e.lightsStateVersion!==An.state.version||$e.outputColorSpace!==ze||k.isBatchedMesh&&$e.batching===!1||!k.isBatchedMesh&&$e.batching===!0||k.isBatchedMesh&&$e.batchingColor===!0&&k.colorTexture===null||k.isBatchedMesh&&$e.batchingColor===!1&&k.colorTexture!==null||k.isInstancedMesh&&$e.instancing===!1||!k.isInstancedMesh&&$e.instancing===!0||k.isSkinnedMesh&&$e.skinning===!1||!k.isSkinnedMesh&&$e.skinning===!0||k.isInstancedMesh&&$e.instancingColor===!0&&k.instanceColor===null||k.isInstancedMesh&&$e.instancingColor===!1&&k.instanceColor!==null||k.isInstancedMesh&&$e.instancingMorph===!0&&k.morphTexture===null||k.isInstancedMesh&&$e.instancingMorph===!1&&k.morphTexture!==null||$e.envMap!==Ge||Z.fog===!0&&$e.fog!==xe||$e.numClippingPlanes!==void 0&&($e.numClippingPlanes!==me.numPlanes||$e.numIntersection!==me.numIntersection)||$e.vertexAlphas!==je||$e.vertexTangents!==et||$e.morphTargets!==He||$e.morphNormals!==Lt||$e.morphColors!==Gt||$e.toneMapping!==Jt||$e.morphTargetsCount!==Rt)&&(It=!0):(It=!0,$e.__version=Z.version);let Wi=$e.currentProgram;It===!0&&(Wi=bl(Z,B,k));let fo=!1,mi=!1,zd=!1;const tn=Wi.getUniforms(),Vs=$e.uniforms;if(Te.useProgram(Wi.program)&&(fo=!0,mi=!0,zd=!0),Z.id!==C&&(C=Z.id,mi=!0),fo||F!==N){de.reverseDepthBuffer?(Ae.copy(N.projectionMatrix),DA(Ae),UA(Ae),tn.setValue(P,"projectionMatrix",Ae)):tn.setValue(P,"projectionMatrix",N.projectionMatrix),tn.setValue(P,"viewMatrix",N.matrixWorldInverse);const Ni=tn.map.cameraPosition;Ni!==void 0&&Ni.setValue(P,Ze.setFromMatrixPosition(N.matrixWorld)),de.logarithmicDepthBuffer&&tn.setValue(P,"logDepthBufFC",2/(Math.log(N.far+1)/Math.LN2)),(Z.isMeshPhongMaterial||Z.isMeshToonMaterial||Z.isMeshLambertMaterial||Z.isMeshBasicMaterial||Z.isMeshStandardMaterial||Z.isShaderMaterial)&&tn.setValue(P,"isOrthographic",N.isOrthographicCamera===!0),F!==N&&(F=N,mi=!0,zd=!0)}if(k.isSkinnedMesh){tn.setOptional(P,k,"bindMatrix"),tn.setOptional(P,k,"bindMatrixInverse");const Ni=k.skeleton;Ni&&(Ni.boneTexture===null&&Ni.computeBoneTexture(),tn.setValue(P,"boneTexture",Ni.boneTexture,R))}k.isBatchedMesh&&(tn.setOptional(P,k,"batchingTexture"),tn.setValue(P,"batchingTexture",k._matricesTexture,R),tn.setOptional(P,k,"batchingIdTexture"),tn.setValue(P,"batchingIdTexture",k._indirectTexture,R),tn.setOptional(P,k,"batchingColorTexture"),k._colorsTexture!==null&&tn.setValue(P,"batchingColorTexture",k._colorsTexture,R));const kd=Y.morphAttributes;if((kd.position!==void 0||kd.normal!==void 0||kd.color!==void 0)&&nt.update(k,Y,Wi),(mi||$e.receiveShadow!==k.receiveShadow)&&($e.receiveShadow=k.receiveShadow,tn.setValue(P,"receiveShadow",k.receiveShadow)),Z.isMeshGouraudMaterial&&Z.envMap!==null&&(Vs.envMap.value=Ge,Vs.flipEnvMap.value=Ge.isCubeTexture&&Ge.isRenderTargetTexture===!1?-1:1),Z.isMeshStandardMaterial&&Z.envMap===null&&B.environment!==null&&(Vs.envMapIntensity.value=B.environmentIntensity),mi&&(tn.setValue(P,"toneMappingExposure",_.toneMappingExposure),$e.needsLights&&Kw(Vs,zd),xe&&Z.fog===!0&&be.refreshFogUniforms(Vs,xe),be.refreshMaterialUniforms(Vs,Z,he,q,m.state.transmissionRenderTarget[N.id]),Ru.upload(P,p0($e),Vs,R)),Z.isShaderMaterial&&Z.uniformsNeedUpdate===!0&&(Ru.upload(P,p0($e),Vs,R),Z.uniformsNeedUpdate=!1),Z.isSpriteMaterial&&tn.setValue(P,"center",k.center),tn.setValue(P,"modelViewMatrix",k.modelViewMatrix),tn.setValue(P,"normalMatrix",k.normalMatrix),tn.setValue(P,"modelMatrix",k.matrixWorld),Z.isShaderMaterial||Z.isRawShaderMaterial){const Ni=Z.uniformsGroups;for(let Gd=0,Qw=Ni.length;Gd<Qw;Gd++){const m0=Ni[Gd];O.update(m0,Wi),O.bind(m0,Wi)}}return Wi}function Kw(N,B){N.ambientLightColor.needsUpdate=B,N.lightProbe.needsUpdate=B,N.directionalLights.needsUpdate=B,N.directionalLightShadows.needsUpdate=B,N.pointLights.needsUpdate=B,N.pointLightShadows.needsUpdate=B,N.spotLights.needsUpdate=B,N.spotLightShadows.needsUpdate=B,N.rectAreaLights.needsUpdate=B,N.hemisphereLights.needsUpdate=B}function jw(N){return N.isMeshLambertMaterial||N.isMeshToonMaterial||N.isMeshPhongMaterial||N.isMeshStandardMaterial||N.isShadowMaterial||N.isShaderMaterial&&N.lights===!0}this.getActiveCubeFace=function(){return I},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(N,B,Y){Ie.get(N.texture).__webglTexture=B,Ie.get(N.depthTexture).__webglTexture=Y;const Z=Ie.get(N);Z.__hasExternalTextures=!0,Z.__autoAllocateDepthBuffer=Y===void 0,Z.__autoAllocateDepthBuffer||ye.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),Z.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(N,B){const Y=Ie.get(N);Y.__webglFramebuffer=B,Y.__useDefaultFramebuffer=B===void 0},this.setRenderTarget=function(N,B=0,Y=0){w=N,I=B,T=Y;let Z=!0,k=null,xe=!1,Re=!1;if(N){const Ge=Ie.get(N);if(Ge.__useDefaultFramebuffer!==void 0)Te.bindFramebuffer(P.FRAMEBUFFER,null),Z=!1;else if(Ge.__webglFramebuffer===void 0)R.setupRenderTarget(N);else if(Ge.__hasExternalTextures)R.rebindTextures(N,Ie.get(N.texture).__webglTexture,Ie.get(N.depthTexture).__webglTexture);else if(N.depthBuffer){const He=N.depthTexture;if(Ge.__boundDepthTexture!==He){if(He!==null&&Ie.has(He)&&(N.width!==He.image.width||N.height!==He.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");R.setupDepthRenderbuffer(N)}}const je=N.texture;(je.isData3DTexture||je.isDataArrayTexture||je.isCompressedArrayTexture)&&(Re=!0);const et=Ie.get(N).__webglFramebuffer;N.isWebGLCubeRenderTarget?(Array.isArray(et[B])?k=et[B][Y]:k=et[B],xe=!0):N.samples>0&&R.useMultisampledRTT(N)===!1?k=Ie.get(N).__webglMultisampledFramebuffer:Array.isArray(et)?k=et[Y]:k=et,M.copy(N.viewport),b.copy(N.scissor),G=N.scissorTest}else M.copy(Ne).multiplyScalar(he).floor(),b.copy(Ee).multiplyScalar(he).floor(),G=Qe;if(Te.bindFramebuffer(P.FRAMEBUFFER,k)&&Z&&Te.drawBuffers(N,k),Te.viewport(M),Te.scissor(b),Te.setScissorTest(G),xe){const Ge=Ie.get(N.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+B,Ge.__webglTexture,Y)}else if(Re){const Ge=Ie.get(N.texture),je=B||0;P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,Ge.__webglTexture,Y||0,je)}C=-1},this.readRenderTargetPixels=function(N,B,Y,Z,k,xe,Re){if(!(N&&N.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ze=Ie.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&Re!==void 0&&(ze=ze[Re]),ze){Te.bindFramebuffer(P.FRAMEBUFFER,ze);try{const Ge=N.texture,je=Ge.format,et=Ge.type;if(!de.textureFormatReadable(je)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!de.textureTypeReadable(et)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}B>=0&&B<=N.width-Z&&Y>=0&&Y<=N.height-k&&P.readPixels(B,Y,Z,k,ct.convert(je),ct.convert(et),xe)}finally{const Ge=w!==null?Ie.get(w).__webglFramebuffer:null;Te.bindFramebuffer(P.FRAMEBUFFER,Ge)}}},this.readRenderTargetPixelsAsync=async function(N,B,Y,Z,k,xe,Re){if(!(N&&N.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ze=Ie.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&Re!==void 0&&(ze=ze[Re]),ze){const Ge=N.texture,je=Ge.format,et=Ge.type;if(!de.textureFormatReadable(je))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!de.textureTypeReadable(et))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(B>=0&&B<=N.width-Z&&Y>=0&&Y<=N.height-k){Te.bindFramebuffer(P.FRAMEBUFFER,ze);const He=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,He),P.bufferData(P.PIXEL_PACK_BUFFER,xe.byteLength,P.STREAM_READ),P.readPixels(B,Y,Z,k,ct.convert(je),ct.convert(et),0);const Lt=w!==null?Ie.get(w).__webglFramebuffer:null;Te.bindFramebuffer(P.FRAMEBUFFER,Lt);const Gt=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await LA(P,Gt,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,He),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,xe),P.deleteBuffer(He),P.deleteSync(Gt),xe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(N,B=null,Y=0){N.isTexture!==!0&&(Cu("WebGLRenderer: copyFramebufferToTexture function signature has changed."),B=arguments[0]||null,N=arguments[1]);const Z=Math.pow(2,-Y),k=Math.floor(N.image.width*Z),xe=Math.floor(N.image.height*Z),Re=B!==null?B.x:0,ze=B!==null?B.y:0;R.setTexture2D(N,0),P.copyTexSubImage2D(P.TEXTURE_2D,Y,0,0,Re,ze,k,xe),Te.unbindTexture()},this.copyTextureToTexture=function(N,B,Y=null,Z=null,k=0){N.isTexture!==!0&&(Cu("WebGLRenderer: copyTextureToTexture function signature has changed."),Z=arguments[0]||null,N=arguments[1],B=arguments[2],k=arguments[3]||0,Y=null);let xe,Re,ze,Ge,je,et;Y!==null?(xe=Y.max.x-Y.min.x,Re=Y.max.y-Y.min.y,ze=Y.min.x,Ge=Y.min.y):(xe=N.image.width,Re=N.image.height,ze=0,Ge=0),Z!==null?(je=Z.x,et=Z.y):(je=0,et=0);const He=ct.convert(B.format),Lt=ct.convert(B.type);R.setTexture2D(B,0),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,B.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,B.unpackAlignment);const Gt=P.getParameter(P.UNPACK_ROW_LENGTH),Jt=P.getParameter(P.UNPACK_IMAGE_HEIGHT),fi=P.getParameter(P.UNPACK_SKIP_PIXELS),Rt=P.getParameter(P.UNPACK_SKIP_ROWS),$e=P.getParameter(P.UNPACK_SKIP_IMAGES),An=N.isCompressedTexture?N.mipmaps[k]:N.image;P.pixelStorei(P.UNPACK_ROW_LENGTH,An.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,An.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,ze),P.pixelStorei(P.UNPACK_SKIP_ROWS,Ge),N.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,k,je,et,xe,Re,He,Lt,An.data):N.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,k,je,et,An.width,An.height,He,An.data):P.texSubImage2D(P.TEXTURE_2D,k,je,et,xe,Re,He,Lt,An),P.pixelStorei(P.UNPACK_ROW_LENGTH,Gt),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Jt),P.pixelStorei(P.UNPACK_SKIP_PIXELS,fi),P.pixelStorei(P.UNPACK_SKIP_ROWS,Rt),P.pixelStorei(P.UNPACK_SKIP_IMAGES,$e),k===0&&B.generateMipmaps&&P.generateMipmap(P.TEXTURE_2D),Te.unbindTexture()},this.copyTextureToTexture3D=function(N,B,Y=null,Z=null,k=0){N.isTexture!==!0&&(Cu("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Y=arguments[0]||null,Z=arguments[1]||null,N=arguments[2],B=arguments[3],k=arguments[4]||0);let xe,Re,ze,Ge,je,et,He,Lt,Gt;const Jt=N.isCompressedTexture?N.mipmaps[k]:N.image;Y!==null?(xe=Y.max.x-Y.min.x,Re=Y.max.y-Y.min.y,ze=Y.max.z-Y.min.z,Ge=Y.min.x,je=Y.min.y,et=Y.min.z):(xe=Jt.width,Re=Jt.height,ze=Jt.depth,Ge=0,je=0,et=0),Z!==null?(He=Z.x,Lt=Z.y,Gt=Z.z):(He=0,Lt=0,Gt=0);const fi=ct.convert(B.format),Rt=ct.convert(B.type);let $e;if(B.isData3DTexture)R.setTexture3D(B,0),$e=P.TEXTURE_3D;else if(B.isDataArrayTexture||B.isCompressedArrayTexture)R.setTexture2DArray(B,0),$e=P.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,B.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,B.unpackAlignment);const An=P.getParameter(P.UNPACK_ROW_LENGTH),It=P.getParameter(P.UNPACK_IMAGE_HEIGHT),Wi=P.getParameter(P.UNPACK_SKIP_PIXELS),fo=P.getParameter(P.UNPACK_SKIP_ROWS),mi=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,Jt.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Jt.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Ge),P.pixelStorei(P.UNPACK_SKIP_ROWS,je),P.pixelStorei(P.UNPACK_SKIP_IMAGES,et),N.isDataTexture||N.isData3DTexture?P.texSubImage3D($e,k,He,Lt,Gt,xe,Re,ze,fi,Rt,Jt.data):B.isCompressedArrayTexture?P.compressedTexSubImage3D($e,k,He,Lt,Gt,xe,Re,ze,fi,Jt.data):P.texSubImage3D($e,k,He,Lt,Gt,xe,Re,ze,fi,Rt,Jt),P.pixelStorei(P.UNPACK_ROW_LENGTH,An),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,It),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Wi),P.pixelStorei(P.UNPACK_SKIP_ROWS,fo),P.pixelStorei(P.UNPACK_SKIP_IMAGES,mi),k===0&&B.generateMipmaps&&P.generateMipmap($e),Te.unbindTexture()},this.initRenderTarget=function(N){Ie.get(N).__webglFramebuffer===void 0&&R.setupRenderTarget(N)},this.initTexture=function(N){N.isCubeTexture?R.setTextureCube(N,0):N.isData3DTexture?R.setTexture3D(N,0):N.isDataArrayTexture||N.isCompressedArrayTexture?R.setTexture2DArray(N,0):R.setTexture2D(N,0),Te.unbindTexture()},this.resetState=function(){I=0,T=0,w=null,Te.reset(),Ot.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Di}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Xc?"display-p3":"srgb",t.unpackColorSpace=gt.workingColorSpace===fa?"display-p3":"srgb"}}class qh{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new _e(e),this.density=t}clone(){return new qh(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}let rm=class $y{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new _e(e),this.near=t,this.far=n}clone(){return new $y(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}};class $h extends yt{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 ui,this.environmentIntensity=1,this.environmentRotation=new ui,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class xa{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=na,this.updateRanges=[],this.version=0,this.uuid=bi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=bi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=bi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const qn=new E;class Ds{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)qn.fromBufferAttribute(this,t),qn.applyMatrix4(e),this.setXYZ(t,qn.x,qn.y,qn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)qn.fromBufferAttribute(this,t),qn.applyNormalMatrix(e),this.setXYZ(t,qn.x,qn.y,qn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)qn.fromBufferAttribute(this,t),qn.transformDirection(e),this.setXYZ(t,qn.x,qn.y,qn.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Yn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=ut(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=ut(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=ut(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=ut(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=ut(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Yn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Yn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Yn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Yn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array),i=ut(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=ut(t,this.array),n=ut(n,this.array),i=ut(i,this.array),r=ut(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new At(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Ds(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Zc extends mn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new _e(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Co;const La=new E,Ro=new E,Io=new E,Po=new J,Da=new J,Yy=new Fe,Xl=new E,Ua=new E,ql=new E,ix=new J,xp=new J,sx=new J;class om extends yt{constructor(e=new Zc){if(super(),this.isSprite=!0,this.type="Sprite",Co===void 0){Co=new at;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new xa(t,5);Co.setIndex([0,1,2,0,2,3]),Co.setAttribute("position",new Ds(n,3,0,!1)),Co.setAttribute("uv",new Ds(n,2,3,!1))}this.geometry=Co,this.material=e,this.center=new J(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ro.setFromMatrixScale(this.matrixWorld),Yy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Io.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Ro.multiplyScalar(-Io.z);const n=this.material.rotation;let i,r;n!==0&&(r=Math.cos(n),i=Math.sin(n));const o=this.center;$l(Xl.set(-.5,-.5,0),Io,o,Ro,i,r),$l(Ua.set(.5,-.5,0),Io,o,Ro,i,r),$l(ql.set(.5,.5,0),Io,o,Ro,i,r),ix.set(0,0),xp.set(1,0),sx.set(1,1);let a=e.ray.intersectTriangle(Xl,Ua,ql,!1,La);if(a===null&&($l(Ua.set(-.5,.5,0),Io,o,Ro,i,r),xp.set(0,1),a=e.ray.intersectTriangle(Xl,ql,Ua,!1,La),a===null))return;const c=e.ray.origin.distanceTo(La);c<e.near||c>e.far||t.push({distance:c,point:La.clone(),uv:Zn.getInterpolation(La,Xl,Ua,ql,ix,xp,sx,new J),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function $l(s,e,t,n,i,r){Po.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(Da.x=r*Po.x-i*Po.y,Da.y=i*Po.x+r*Po.y):Da.copy(Po),s.copy(e),s.x+=Da.x,s.y+=Da.y,s.applyMatrix4(Yy)}const Yl=new E,rx=new E;class am extends yt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const r=t[n];this.addLevel(r.object.clone(),r.distance,r.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let r;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let r=t[n].distance;if(t[n].object.visible&&(r-=r*t[n].hysteresis),e<r)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Yl.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Yl);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Yl.setFromMatrixPosition(e.matrixWorld),rx.setFromMatrixPosition(this.matrixWorld);const n=Yl.distanceTo(rx)/e.zoom;t[0].object.visible=!0;let i,r;for(i=1,r=t.length;i<r;i++){let o=t[i].distance;if(t[i].object.visible&&(o-=o*t[i].hysteresis),n>=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,r=n.length;i<r;i++){const o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const ox=new E,ax=new st,cx=new st,qR=new E,lx=new Fe,Zl=new E,_p=new Dn,ux=new Fe,yp=new no;class cm extends kt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=sf,this.bindMatrix=new Fe,this.bindMatrixInverse=new Fe,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Hn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Zl),this.boundingBox.expandByPoint(Zl)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Dn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Zl),this.boundingSphere.expandByPoint(Zl)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_p.copy(this.boundingSphere),_p.applyMatrix4(i),e.ray.intersectsSphere(_p)!==!1&&(ux.copy(i).invert(),yp.copy(e.ray).applyMatrix4(ux),!(this.boundingBox!==null&&yp.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,yp)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new st,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===sf?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===ay?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;ax.fromBufferAttribute(i.attributes.skinIndex,e),cx.fromBufferAttribute(i.attributes.skinWeight,e),ox.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const o=cx.getComponent(r);if(o!==0){const a=ax.getComponent(r);lx.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(qR.copy(ox).applyMatrix4(lx),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Yh extends yt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Oi extends Xt{constructor(e=null,t=1,n=1,i,r,o,a,c,l=Qt,u=Qt,h,d){super(null,o,a,c,l,u,i,r,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const hx=new Fe,$R=new Fe;class Jc{constructor(e=[],t=[]){this.uuid=bi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Fe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Fe;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,o=e.length;r<o;r++){const a=e[r]?e[r].matrixWorld:$R;hx.multiplyMatrices(a,t[r]),hx.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Jc(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Oi(t,e,e,Rn,Gn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const r=e.bones[n];let o=t[r];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),o=new Yh),this.bones.push(o),this.boneInverses.push(new Fe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const o=t[i];e.bones.push(o.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class Us extends At{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Lo=new Fe,dx=new Fe,Jl=[],px=new Hn,YR=new Fe,Fa=new kt,Oa=new Dn;class lm extends kt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Us(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,YR)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Hn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Lo),px.copy(e.boundingBox).applyMatrix4(Lo),this.boundingBox.union(px)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Dn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Lo),Oa.copy(e.boundingSphere).applyMatrix4(Lo),this.boundingSphere.union(Oa)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=n.length+1,o=e*r+1;for(let a=0;a<n.length;a++)n[a]=i[o+a]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Fa.geometry=this.geometry,Fa.material=this.material,Fa.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Oa.copy(this.boundingSphere),Oa.applyMatrix4(n),e.ray.intersectsSphere(Oa)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,Lo),dx.multiplyMatrices(n,Lo),Fa.matrixWorld=dx,Fa.raycast(e,Jl);for(let o=0,a=Jl.length;o<a;o++){const c=Jl[o];c.instanceId=r,c.object=this,t.push(c)}Jl.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Us(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new Oi(new Float32Array(i*this.count),i,this.count,Hc,Gn));const r=this.morphTexture.source.data.data;let o=0;for(let l=0;l<n.length;l++)o+=n[l];const a=this.geometry.morphTargetsRelative?1:1-o,c=i*e;r[c]=a,r.set(n,c+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function ZR(s,e){return s.z-e.z}function JR(s,e){return e.z-s.z}class KR{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n){const i=this.pool,r=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const o=i[this.index];r.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=t,o.index=n}reset(){this.list.length=0,this.index=0}}const Xs=new Fe,vp=new Fe,jR=new Fe,QR=new _e(1,1,1),fx=new Fe,Mp=new ma,Kl=new Hn,wr=new Dn,Va=new E,mx=new E,eI=new E,Sp=new KR,zn=new kt,jl=[];function tI(s,e,t=0){const n=e.itemSize;if(s.isInterleavedBufferAttribute||s.array.constructor!==e.array.constructor){const i=s.count;for(let r=0;r<i;r++)for(let o=0;o<n;o++)e.setComponent(r+t,o,s.getComponent(r,o))}else e.array.set(s.array,t*n);e.needsUpdate=!0}class um extends kt{get maxInstanceCount(){return this._maxInstanceCount}constructor(e,t,n=t*2,i){super(new at,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawInfo=[],this._availableInstanceIds=[],this._drawRanges=[],this._reservedRanges=[],this._bounds=[],this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._visibilityChanged=!0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Oi(t,e,e,Rn,Gn);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new Oi(t,e,e,Wc,Bi);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new Oi(t,e,e,Rn,Gn);n.colorSpace=gt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const r in e.attributes){const o=e.getAttribute(r),{array:a,itemSize:c,normalized:l}=o,u=new a.constructor(n*c),h=new At(u,c,l);t.setAttribute(r,h)}if(e.getIndex()!==null){const r=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new At(r,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Hn);const e=this.boundingBox,t=this._drawInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const r=t[n].geometryIndex;this.getMatrixAt(n,Xs),this.getBoundingBoxAt(r,Kl).applyMatrix4(Xs),e.union(Kl)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Dn);const e=this.boundingSphere,t=this._drawInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const r=t[n].geometryIndex;this.getMatrixAt(n,Xs),this.getBoundingSphereAt(r,wr).applyMatrix4(Xs),e.union(wr)}}addInstance(e){if(this._drawInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(i=this._availableInstanceIds.pop(),this._drawInfo[i]=n):(i=this._drawInfo.length,this._drawInfo.push(n));const r=this._matricesTexture,o=r.image.data;jR.toArray(o,i*16),r.needsUpdate=!0;const a=this._colorsTexture;return a&&(QR.toArray(a.image.data,i*4),a.needsUpdate=!0),i}addGeometry(e,t=-1,n=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let r=null;const o=this._reservedRanges,a=this._drawRanges,c=this._bounds;this._geometryCount!==0&&(r=o[o.length-1]),t===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=t,r===null?i.vertexStart=0:i.vertexStart=r.vertexStart+r.vertexCount;const l=e.getIndex(),u=l!==null;if(u&&(n===-1?i.indexCount=l.count:i.indexCount=n,r===null?i.indexStart=0:i.indexStart=r.indexStart+r.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._geometryCount;return this._geometryCount++,o.push(i),a.push({start:u?i.indexStart:i.vertexStart,count:-1}),c.push({boxInitialized:!1,box:new Hn,sphereInitialized:!1,sphere:new Dn}),this.setGeometryAt(h,e),h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,r=n.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const c=a.vertexStart,l=a.vertexCount;for(const p in n.attributes){const f=t.getAttribute(p),x=n.getAttribute(p);tI(f,x,c);const m=f.itemSize;for(let g=f.count,y=l;g<y;g++){const _=c+g;for(let v=0;v<m;v++)x.setComponent(_,v,0)}x.needsUpdate=!0,x.addUpdateRange(c*m,l*m)}if(i){const p=a.indexStart;for(let f=0;f<o.count;f++)r.setX(p+f,c+o.getX(f));for(let f=o.count,x=a.indexCount;f<x;f++)r.setX(p+f,c);r.needsUpdate=!0,r.addUpdateRange(p,a.indexCount)}const u=this._bounds[e];t.boundingBox!==null?(u.box.copy(t.boundingBox),u.boxInitialized=!0):u.boxInitialized=!1,t.boundingSphere!==null?(u.sphere.copy(t.boundingSphere),u.sphereInitialized=!0):u.sphereInitialized=!1;const h=this._drawRanges[e],d=t.getAttribute("position");return h.count=i?o.count:d.count,this._visibilityChanged=!0,e}deleteInstance(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?this:(t[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this._bounds[e],i=n.box,r=this.geometry;if(n.boxInitialized===!1){i.makeEmpty();const o=r.index,a=r.attributes.position,c=this._drawRanges[e];for(let l=c.start,u=c.start+c.count;l<u;l++){let h=l;o&&(h=o.getX(h)),i.expandByPoint(Va.fromBufferAttribute(a,h))}n.boxInitialized=!0}return t.copy(i),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this._bounds[e],i=n.sphere,r=this.geometry;if(n.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,Kl),Kl.getCenter(i.center);const o=r.index,a=r.attributes.position,c=this._drawRanges[e];let l=0;for(let u=c.start,h=c.start+c.count;u<h;u++){let d=u;o&&(d=o.getX(d)),Va.fromBufferAttribute(a,d),l=Math.max(l,i.center.distanceToSquared(Va))}i.radius=Math.sqrt(l),n.sphereInitialized=!0}return t.copy(i),t}setMatrixAt(e,t){const n=this._drawInfo,i=this._matricesTexture,r=this._matricesTexture.image.data;return e>=n.length||n[e].active===!1?this:(t.toArray(r,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,t){const n=this._drawInfo,i=this._matricesTexture.image.data;return e>=n.length||n[e].active===!1?null:t.fromArray(i,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const n=this._colorsTexture,i=this._colorsTexture.image.data,r=this._drawInfo;return e>=r.length||r[e].active===!1?this:(t.toArray(i,e*4),n.needsUpdate=!0,this)}getColorAt(e,t){const n=this._colorsTexture.image.data,i=this._drawInfo;return e>=i.length||i[e].active===!1?null:t.fromArray(n,e*4)}setVisibleAt(e,t){const n=this._drawInfo;return e>=n.length||n[e].active===!1||n[e].visible===t?this:(n[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?!1:t[e].visible}setGeometryIdAt(e,t){const n=this._drawInfo;return e>=n.length||n[e].active===!1||t<0||t>=this._geometryCount?null:(n[e].geometryIndex=t,this)}getGeometryIdAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?-1:t[e].geometryIndex}getGeometryRangeAt(e,t={}){if(e<0||e>=this._geometryCount)return null;const n=this._drawRanges[e];return t.start=n.start,t.count=n.count,t}raycast(e,t){const n=this._drawInfo,i=this._drawRanges,r=this.matrixWorld,o=this.geometry;zn.material=this.material,zn.geometry.index=o.index,zn.geometry.attributes=o.attributes,zn.geometry.boundingBox===null&&(zn.geometry.boundingBox=new Hn),zn.geometry.boundingSphere===null&&(zn.geometry.boundingSphere=new Dn);for(let a=0,c=n.length;a<c;a++){if(!n[a].visible||!n[a].active)continue;const l=n[a].geometryIndex,u=i[l];zn.geometry.setDrawRange(u.start,u.count),this.getMatrixAt(a,zn.matrixWorld).premultiply(r),this.getBoundingBoxAt(l,zn.geometry.boundingBox),this.getBoundingSphereAt(l,zn.geometry.boundingSphere),zn.raycast(e,jl);for(let h=0,d=jl.length;h<d;h++){const p=jl[h];p.object=this,p.batchId=a,t.push(p)}jl.length=0}zn.material=null,zn.geometry.index=null,zn.geometry.attributes={},zn.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(t=>({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._drawInfo=e._drawInfo.map(t=>({...t})),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,c=this._drawInfo,l=this._multiDrawStarts,u=this._multiDrawCounts,h=this._drawRanges,d=this.perObjectFrustumCulled,p=this._indirectTexture,f=p.image.data;d&&(fx.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Mp.setFromProjectionMatrix(fx,e.coordinateSystem));let x=0;if(this.sortObjects){vp.copy(this.matrixWorld).invert(),Va.setFromMatrixPosition(n.matrixWorld).applyMatrix4(vp),mx.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(vp);for(let y=0,_=c.length;y<_;y++)if(c[y].visible&&c[y].active){const v=c[y].geometryIndex;this.getMatrixAt(y,Xs),this.getBoundingSphereAt(v,wr).applyMatrix4(Xs);let I=!1;if(d&&(I=!Mp.intersectsSphere(wr)),!I){const T=eI.subVectors(wr.center,Va).dot(mx);Sp.push(h[v],T,y)}}const m=Sp.list,g=this.customSort;g===null?m.sort(r.transparent?JR:ZR):g.call(this,m,n);for(let y=0,_=m.length;y<_;y++){const v=m[y];l[x]=v.start*a,u[x]=v.count,f[x]=v.index,x++}Sp.reset()}else for(let m=0,g=c.length;m<g;m++)if(c[m].visible&&c[m].active){const y=c[m].geometryIndex;let _=!1;if(d&&(this.getMatrixAt(m,Xs),this.getBoundingSphereAt(y,wr).applyMatrix4(Xs),_=!Mp.intersectsSphere(wr)),!_){const v=h[y];l[x]=v.start*a,u[x]=v.count,f[x]=m,x++}}p.needsUpdate=!0,this._multiDrawCount=x,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,r,o){this.onBeforeRender(e,null,i,r,o)}}class Fn extends mn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new _e(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const ah=new E,ch=new E,gx=new Fe,Ba=new no,Ql=new Dn,Tp=new E,xx=new E;class Fs extends yt{constructor(e=new at,t=new Fn){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,r=t.count;i<r;i++)ah.fromBufferAttribute(t,i-1),ch.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=ah.distanceTo(ch);e.setAttribute("lineDistance",new Ve(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ql.copy(n.boundingSphere),Ql.applyMatrix4(i),Ql.radius+=r,e.ray.intersectsSphere(Ql)===!1)return;gx.copy(i).invert(),Ba.copy(e.ray).applyMatrix4(gx);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=this.isLineSegments?2:1,u=n.index,d=n.attributes.position;if(u!==null){const p=Math.max(0,o.start),f=Math.min(u.count,o.start+o.count);for(let x=p,m=f-1;x<m;x+=l){const g=u.getX(x),y=u.getX(x+1),_=eu(this,e,Ba,c,g,y);_&&t.push(_)}if(this.isLineLoop){const x=u.getX(f-1),m=u.getX(p),g=eu(this,e,Ba,c,x,m);g&&t.push(g)}}else{const p=Math.max(0,o.start),f=Math.min(d.count,o.start+o.count);for(let x=p,m=f-1;x<m;x+=l){const g=eu(this,e,Ba,c,x,x+1);g&&t.push(g)}if(this.isLineLoop){const x=eu(this,e,Ba,c,f-1,p);x&&t.push(x)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}function eu(s,e,t,n,i,r){const o=s.geometry.attributes.position;if(ah.fromBufferAttribute(o,i),ch.fromBufferAttribute(o,r),t.distanceSqToSegment(ah,ch,Tp,xx)>n)return;Tp.applyMatrix4(s.matrixWorld);const c=e.ray.origin.distanceTo(Tp);if(!(c<e.near||c>e.far))return{distance:c,point:xx.clone().applyMatrix4(s.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:s}}const _x=new E,yx=new E;class ss extends Fs{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,r=t.count;i<r;i+=2)_x.fromBufferAttribute(t,i),yx.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+_x.distanceTo(yx);e.setAttribute("lineDistance",new Ve(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class hm extends Fs{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class _a extends mn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new _e(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const vx=new Fe,af=new no,tu=new Dn,nu=new E;class dm extends yt{constructor(e=new at,t=new _a){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),tu.copy(n.boundingSphere),tu.applyMatrix4(i),tu.radius+=r,e.ray.intersectsSphere(tu)===!1)return;vx.copy(i).invert(),af.copy(e.ray).applyMatrix4(vx);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=n.index,h=n.attributes.position;if(l!==null){const d=Math.max(0,o.start),p=Math.min(l.count,o.start+o.count);for(let f=d,x=p;f<x;f++){const m=l.getX(f);nu.fromBufferAttribute(h,m),Mx(nu,m,c,i,e,t,this)}}else{const d=Math.max(0,o.start),p=Math.min(h.count,o.start+o.count);for(let f=d,x=p;f<x;f++)nu.fromBufferAttribute(h,f),Mx(nu,f,c,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}function Mx(s,e,t,n,i,r,o){const a=af.distanceSqToPoint(s);if(a<t){const c=new E;af.closestPointToPoint(s,c),c.applyMatrix4(n);const l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;r.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class Zy extends Xt{constructor(e,t,n,i,r,o,a,c,l){super(e,t,n,i,r,o,a,c,l),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Ut,this.magFilter=r!==void 0?r:Ut,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class pm extends Xt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Qt,this.minFilter=Qt,this.generateMipmaps=!1,this.needsUpdate=!0}}class Kc extends Xt{constructor(e,t,n,i,r,o,a,c,l,u,h,d){super(null,o,a,c,l,u,i,r,h,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Jy extends Kc{constructor(e,t,n,i,r,o){super(e,t,n,r,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Si,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Ky extends Kc{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,wi),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class jy extends Xt{constructor(e,t,n,i,r,o,a,c,l){super(e,t,n,i,r,o,a,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Gi{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let o;t?o=t:o=e*n[r-1];let a=0,c=r-1,l;for(;a<=c;)if(i=Math.floor(a+(c-a)/2),l=n[i]-o,l<0)a=i+1;else if(l>0)c=i-1;else{c=i;break}if(i=c,n[i]===o)return i/(r-1);const u=n[i],d=n[i+1]-u,p=(o-u)/d;return(i+p)/(r-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);const o=this.getPoint(i),a=this.getPoint(r),c=t||(o.isVector2?new J:new E);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new E,i=[],r=[],o=[],a=new E,c=new Fe;for(let p=0;p<=e;p++){const f=p/e;i[p]=this.getTangentAt(f,new E)}r[0]=new E,o[0]=new E;let l=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);u<=l&&(l=u,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),d<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),o[0].crossVectors(i[0],r[0]);for(let p=1;p<=e;p++){if(r[p]=r[p-1].clone(),o[p]=o[p-1].clone(),a.crossVectors(i[p-1],i[p]),a.length()>Number.EPSILON){a.normalize();const f=Math.acos(jt(i[p-1].dot(i[p]),-1,1));r[p].applyMatrix4(c.makeRotationAxis(a,f))}o[p].crossVectors(i[p],r[p])}if(t===!0){let p=Math.acos(jt(r[0].dot(r[e]),-1,1));p/=e,i[0].dot(a.crossVectors(r[0],r[e]))>0&&(p=-p);for(let f=1;f<=e;f++)r[f].applyMatrix4(c.makeRotationAxis(i[f],p*f)),o[f].crossVectors(i[f],r[f])}return{tangents:i,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Zh extends Gi{constructor(e=0,t=0,n=1,i=1,r=0,o=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t=new J){const n=t,i=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(o?r=0:r=i),this.aClockwise===!0&&!o&&(r===i?r=-i:r=r-i);const a=this.aStartAngle+e*r;let c=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=c-this.aX,p=l-this.aY;c=d*u-p*h+this.aX,l=d*h+p*u+this.aY}return n.set(c,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class Qy extends Zh{constructor(e,t,n,i,r,o){super(e,t,n,n,i,r,o),this.isArcCurve=!0,this.type="ArcCurve"}}function fm(){let s=0,e=0,t=0,n=0;function i(r,o,a,c){s=r,e=a,t=-3*r+3*o-2*a-c,n=2*r-2*o+a+c}return{initCatmullRom:function(r,o,a,c,l){i(o,a,l*(a-r),l*(c-o))},initNonuniformCatmullRom:function(r,o,a,c,l,u,h){let d=(o-r)/l-(a-r)/(l+u)+(a-o)/u,p=(a-o)/u-(c-o)/(u+h)+(c-a)/h;d*=u,p*=u,i(o,a,d,p)},calc:function(r){const o=r*r,a=o*r;return s+e*r+t*o+n*a}}}const iu=new E,bp=new fm,wp=new fm,Ap=new fm;class ev extends Gi{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new E){const n=t,i=this.points,r=i.length,o=(r-(this.closed?0:1))*e;let a=Math.floor(o),c=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/r)+1)*r:c===0&&a===r-1&&(a=r-2,c=1);let l,u;this.closed||a>0?l=i[(a-1)%r]:(iu.subVectors(i[0],i[1]).add(i[0]),l=iu);const h=i[a%r],d=i[(a+1)%r];if(this.closed||a+2<r?u=i[(a+2)%r]:(iu.subVectors(i[r-1],i[r-2]).add(i[r-1]),u=iu),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let f=Math.pow(l.distanceToSquared(h),p),x=Math.pow(h.distanceToSquared(d),p),m=Math.pow(d.distanceToSquared(u),p);x<1e-4&&(x=1),f<1e-4&&(f=x),m<1e-4&&(m=x),bp.initNonuniformCatmullRom(l.x,h.x,d.x,u.x,f,x,m),wp.initNonuniformCatmullRom(l.y,h.y,d.y,u.y,f,x,m),Ap.initNonuniformCatmullRom(l.z,h.z,d.z,u.z,f,x,m)}else this.curveType==="catmullrom"&&(bp.initCatmullRom(l.x,h.x,d.x,u.x,this.tension),wp.initCatmullRom(l.y,h.y,d.y,u.y,this.tension),Ap.initCatmullRom(l.z,h.z,d.z,u.z,this.tension));return n.set(bp.calc(c),wp.calc(c),Ap.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new E().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Sx(s,e,t,n,i){const r=(n-e)*.5,o=(i-t)*.5,a=s*s,c=s*a;return(2*t-2*n+r+o)*c+(-3*t+3*n-2*r-o)*a+r*s+t}function nI(s,e){const t=1-s;return t*t*e}function iI(s,e){return 2*(1-s)*s*e}function sI(s,e){return s*s*e}function Qa(s,e,t,n){return nI(s,e)+iI(s,t)+sI(s,n)}function rI(s,e){const t=1-s;return t*t*t*e}function oI(s,e){const t=1-s;return 3*t*t*s*e}function aI(s,e){return 3*(1-s)*s*s*e}function cI(s,e){return s*s*s*e}function ec(s,e,t,n,i){return rI(s,e)+oI(s,t)+aI(s,n)+cI(s,i)}class mm extends Gi{constructor(e=new J,t=new J,n=new J,i=new J){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new J){const n=t,i=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(ec(e,i.x,r.x,o.x,a.x),ec(e,i.y,r.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class tv extends Gi{constructor(e=new E,t=new E,n=new E,i=new E){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new E){const n=t,i=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(ec(e,i.x,r.x,o.x,a.x),ec(e,i.y,r.y,o.y,a.y),ec(e,i.z,r.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class gm extends Gi{constructor(e=new J,t=new J){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new J){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new J){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class nv extends Gi{constructor(e=new E,t=new E){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new E){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new E){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class xm extends Gi{constructor(e=new J,t=new J,n=new J){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new J){const n=t,i=this.v0,r=this.v1,o=this.v2;return n.set(Qa(e,i.x,r.x,o.x),Qa(e,i.y,r.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class _m extends Gi{constructor(e=new E,t=new E,n=new E){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new E){const n=t,i=this.v0,r=this.v1,o=this.v2;return n.set(Qa(e,i.x,r.x,o.x),Qa(e,i.y,r.y,o.y),Qa(e,i.z,r.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class ym extends Gi{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new J){const n=t,i=this.points,r=(i.length-1)*e,o=Math.floor(r),a=r-o,c=i[o===0?o:o-1],l=i[o],u=i[o>i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(Sx(a,c.x,l.x,u.x,h.x),Sx(a,c.y,l.y,u.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new J().fromArray(i))}return this}}var lh=Object.freeze({__proto__:null,ArcCurve:Qy,CatmullRomCurve3:ev,CubicBezierCurve:mm,CubicBezierCurve3:tv,EllipseCurve:Zh,LineCurve:gm,LineCurve3:nv,QuadraticBezierCurve:xm,QuadraticBezierCurve3:_m,SplineCurve:ym});class iv extends Gi{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new lh[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const o=i[r]-n,a=this.curves[r],c=a.getLength(),l=c===0?0:1-o/c;return a.getPointAt(l,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const o=r[i],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,c=o.getPoints(a);for(let l=0;l<c.length;l++){const u=c[l];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new lh[i.type]().fromJSON(i))}return this}}class Rc extends iv{constructor(e){super(),this.type="Path",this.currentPoint=new J,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new gm(this.currentPoint.clone(),new J(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new xm(this.currentPoint.clone(),new J(e,t),new J(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,o){const a=new mm(this.currentPoint.clone(),new J(e,t),new J(n,i),new J(r,o));return this.curves.push(a),this.currentPoint.set(r,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new ym(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,o){const a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,n,i,r,o),this}absarc(e,t,n,i,r,o){return this.absellipse(e,t,n,n,i,r,o),this}ellipse(e,t,n,i,r,o,a,c){const l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,n,i,r,o,a,c),this}absellipse(e,t,n,i,r,o,a,c){const l=new Zh(e,t,n,i,r,o,a,c);if(this.curves.length>0){const h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);const u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class jc extends at{constructor(e=[new J(0,-.5),new J(.5,0),new J(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=jt(i,0,Math.PI*2);const r=[],o=[],a=[],c=[],l=[],u=1/t,h=new E,d=new J,p=new E,f=new E,x=new E;let m=0,g=0;for(let y=0;y<=e.length-1;y++)switch(y){case 0:m=e[y+1].x-e[y].x,g=e[y+1].y-e[y].y,p.x=g*1,p.y=-m,p.z=g*0,x.copy(p),p.normalize(),c.push(p.x,p.y,p.z);break;case e.length-1:c.push(x.x,x.y,x.z);break;default:m=e[y+1].x-e[y].x,g=e[y+1].y-e[y].y,p.x=g*1,p.y=-m,p.z=g*0,f.copy(p),p.x+=x.x,p.y+=x.y,p.z+=x.z,p.normalize(),c.push(p.x,p.y,p.z),x.copy(f)}for(let y=0;y<=t;y++){const _=n+y*u*i,v=Math.sin(_),I=Math.cos(_);for(let T=0;T<=e.length-1;T++){h.x=e[T].x*v,h.y=e[T].y,h.z=e[T].x*I,o.push(h.x,h.y,h.z),d.x=y/t,d.y=T/(e.length-1),a.push(d.x,d.y);const w=c[3*T+0]*v,C=c[3*T+1],F=c[3*T+0]*I;l.push(w,C,F)}}for(let y=0;y<t;y++)for(let _=0;_<e.length-1;_++){const v=_+y*e.length,I=v,T=v+e.length,w=v+e.length+1,C=v+1;r.push(I,T,C),r.push(w,C,T)}this.setIndex(r),this.setAttribute("position",new Ve(o,3)),this.setAttribute("uv",new Ve(a,2)),this.setAttribute("normal",new Ve(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new jc(e.points,e.segments,e.phiStart,e.phiLength)}}class Jh extends jc{constructor(e=1,t=1,n=4,i=8){const r=new Rc;r.absarc(0,-t/2,e,Math.PI*1.5,0),r.absarc(0,t/2,e,0,Math.PI*.5),super(r.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:n,radialSegments:i}}static fromJSON(e){return new Jh(e.radius,e.length,e.capSegments,e.radialSegments)}}class Kh extends at{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const r=[],o=[],a=[],c=[],l=new E,u=new J;o.push(0,0,0),a.push(0,0,1),c.push(.5,.5);for(let h=0,d=3;h<=t;h++,d+=3){const p=n+h/t*i;l.x=e*Math.cos(p),l.y=e*Math.sin(p),o.push(l.x,l.y,l.z),a.push(0,0,1),u.x=(o[d]/e+1)/2,u.y=(o[d+1]/e+1)/2,c.push(u.x,u.y)}for(let h=1;h<=t;h++)r.push(h,h+1,0);this.setIndex(r),this.setAttribute("position",new Ve(o,3)),this.setAttribute("normal",new Ve(a,3)),this.setAttribute("uv",new Ve(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Kh(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class ao extends at{constructor(e=1,t=1,n=1,i=32,r=1,o=!1,a=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:c};const l=this;i=Math.floor(i),r=Math.floor(r);const u=[],h=[],d=[],p=[];let f=0;const x=[],m=n/2;let g=0;y(),o===!1&&(e>0&&_(!0),t>0&&_(!1)),this.setIndex(u),this.setAttribute("position",new Ve(h,3)),this.setAttribute("normal",new Ve(d,3)),this.setAttribute("uv",new Ve(p,2));function y(){const v=new E,I=new E;let T=0;const w=(t-e)/n;for(let C=0;C<=r;C++){const F=[],M=C/r,b=M*(t-e)+e;for(let G=0;G<=i;G++){const W=G/i,$=W*c+a,ie=Math.sin($),q=Math.cos($);I.x=b*ie,I.y=-M*n+m,I.z=b*q,h.push(I.x,I.y,I.z),v.set(ie,w,q).normalize(),d.push(v.x,v.y,v.z),p.push(W,1-M),F.push(f++)}x.push(F)}for(let C=0;C<i;C++)for(let F=0;F<r;F++){const M=x[F][C],b=x[F+1][C],G=x[F+1][C+1],W=x[F][C+1];e>0&&(u.push(M,b,W),T+=3),t>0&&(u.push(b,G,W),T+=3)}l.addGroup(g,T,0),g+=T}function _(v){const I=f,T=new J,w=new E;let C=0;const F=v===!0?e:t,M=v===!0?1:-1;for(let G=1;G<=i;G++)h.push(0,m*M,0),d.push(0,M,0),p.push(.5,.5),f++;const b=f;for(let G=0;G<=i;G++){const $=G/i*c+a,ie=Math.cos($),q=Math.sin($);w.x=F*q,w.y=m*M,w.z=F*ie,h.push(w.x,w.y,w.z),d.push(0,M,0),T.x=ie*.5+.5,T.y=q*.5*M+.5,p.push(T.x,T.y),f++}for(let G=0;G<i;G++){const W=I+G,$=b+G;v===!0?u.push($,$+1,W):u.push($+1,$,W),C+=3}l.addGroup(g,C,v===!0?1:2),g+=C}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ao(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class jh extends ao{constructor(e=1,t=1,n=32,i=1,r=!1,o=0,a=Math.PI*2){super(0,e,t,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}static fromJSON(e){return new jh(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class hr extends at{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],o=[];a(i),l(n),u(),this.setAttribute("position",new Ve(r,3)),this.setAttribute("normal",new Ve(r.slice(),3)),this.setAttribute("uv",new Ve(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(y){const _=new E,v=new E,I=new E;for(let T=0;T<t.length;T+=3)p(t[T+0],_),p(t[T+1],v),p(t[T+2],I),c(_,v,I,y)}function c(y,_,v,I){const T=I+1,w=[];for(let C=0;C<=T;C++){w[C]=[];const F=y.clone().lerp(v,C/T),M=_.clone().lerp(v,C/T),b=T-C;for(let G=0;G<=b;G++)G===0&&C===T?w[C][G]=F:w[C][G]=F.clone().lerp(M,G/b)}for(let C=0;C<T;C++)for(let F=0;F<2*(T-C)-1;F++){const M=Math.floor(F/2);F%2===0?(d(w[C][M+1]),d(w[C+1][M]),d(w[C][M])):(d(w[C][M+1]),d(w[C+1][M+1]),d(w[C+1][M]))}}function l(y){const _=new E;for(let v=0;v<r.length;v+=3)_.x=r[v+0],_.y=r[v+1],_.z=r[v+2],_.normalize().multiplyScalar(y),r[v+0]=_.x,r[v+1]=_.y,r[v+2]=_.z}function u(){const y=new E;for(let _=0;_<r.length;_+=3){y.x=r[_+0],y.y=r[_+1],y.z=r[_+2];const v=m(y)/2/Math.PI+.5,I=g(y)/Math.PI+.5;o.push(v,1-I)}f(),h()}function h(){for(let y=0;y<o.length;y+=6){const _=o[y+0],v=o[y+2],I=o[y+4],T=Math.max(_,v,I),w=Math.min(_,v,I);T>.9&&w<.1&&(_<.2&&(o[y+0]+=1),v<.2&&(o[y+2]+=1),I<.2&&(o[y+4]+=1))}}function d(y){r.push(y.x,y.y,y.z)}function p(y,_){const v=y*3;_.x=e[v+0],_.y=e[v+1],_.z=e[v+2]}function f(){const y=new E,_=new E,v=new E,I=new E,T=new J,w=new J,C=new J;for(let F=0,M=0;F<r.length;F+=9,M+=6){y.set(r[F+0],r[F+1],r[F+2]),_.set(r[F+3],r[F+4],r[F+5]),v.set(r[F+6],r[F+7],r[F+8]),T.set(o[M+0],o[M+1]),w.set(o[M+2],o[M+3]),C.set(o[M+4],o[M+5]),I.copy(y).add(_).add(v).divideScalar(3);const b=m(I);x(T,M+0,y,b),x(w,M+2,_,b),x(C,M+4,v,b)}}function x(y,_,v,I){I<0&&y.x===1&&(o[_]=y.x-1),v.x===0&&v.z===0&&(o[_]=I/2/Math.PI+.5)}function m(y){return Math.atan2(y.z,-y.x)}function g(y){return Math.atan2(-y.y,Math.sqrt(y.x*y.x+y.z*y.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new hr(e.vertices,e.indices,e.radius,e.details)}}class Qh extends hr{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],o=[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];super(r,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Qh(e.radius,e.detail)}}const su=new E,ru=new E,Np=new E,ou=new Zn;class vm extends at{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),r=Math.cos(Xr*t),o=e.getIndex(),a=e.getAttribute("position"),c=o?o.count:a.count,l=[0,0,0],u=["a","b","c"],h=new Array(3),d={},p=[];for(let f=0;f<c;f+=3){o?(l[0]=o.getX(f),l[1]=o.getX(f+1),l[2]=o.getX(f+2)):(l[0]=f,l[1]=f+1,l[2]=f+2);const{a:x,b:m,c:g}=ou;if(x.fromBufferAttribute(a,l[0]),m.fromBufferAttribute(a,l[1]),g.fromBufferAttribute(a,l[2]),ou.getNormal(Np),h[0]=`${Math.round(x.x*i)},${Math.round(x.y*i)},${Math.round(x.z*i)}`,h[1]=`${Math.round(m.x*i)},${Math.round(m.y*i)},${Math.round(m.z*i)}`,h[2]=`${Math.round(g.x*i)},${Math.round(g.y*i)},${Math.round(g.z*i)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let y=0;y<3;y++){const _=(y+1)%3,v=h[y],I=h[_],T=ou[u[y]],w=ou[u[_]],C=`${v}_${I}`,F=`${I}_${v}`;F in d&&d[F]?(Np.dot(d[F].normal)<=r&&(p.push(T.x,T.y,T.z),p.push(w.x,w.y,w.z)),d[F]=null):C in d||(d[C]={index0:l[y],index1:l[_],normal:Np.clone()})}}for(const f in d)if(d[f]){const{index0:x,index1:m}=d[f];su.fromBufferAttribute(a,x),ru.fromBufferAttribute(a,m),p.push(su.x,su.y,su.z),p.push(ru.x,ru.y,ru.z)}this.setAttribute("position",new Ve(p,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class er extends Rc{constructor(e){super(e),this.uuid=bi(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new Rc().fromJSON(i))}return this}}const lI={triangulate:function(s,e,t=2){const n=e&&e.length,i=n?e[0]*t:s.length;let r=sv(s,0,i,t,!0);const o=[];if(!r||r.next===r.prev)return o;let a,c,l,u,h,d,p;if(n&&(r=fI(s,e,r,t)),s.length>80*t){a=l=s[0],c=u=s[1];for(let f=t;f<i;f+=t)h=s[f],d=s[f+1],h<a&&(a=h),d<c&&(c=d),h>l&&(l=h),d>u&&(u=d);p=Math.max(l-a,u-c),p=p!==0?32767/p:0}return Ic(r,o,t,a,c,p,0),o}};function sv(s,e,t,n,i){let r,o;if(i===wI(s,e,t,n)>0)for(r=e;r<t;r+=n)o=Tx(r,s[r],s[r+1],o);else for(r=t-n;r>=e;r-=n)o=Tx(r,s[r],s[r+1],o);return o&&ed(o,o.next)&&(Lc(o),o=o.next),o}function jr(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(ed(t,t.next)||Zt(t.prev,t,t.next)===0)){if(Lc(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Ic(s,e,t,n,i,r,o){if(!s)return;!o&&r&&yI(s,n,i,r);let a=s,c,l;for(;s.prev!==s.next;){if(c=s.prev,l=s.next,r?hI(s,n,i,r):uI(s)){e.push(c.i/t|0),e.push(s.i/t|0),e.push(l.i/t|0),Lc(s),s=l.next,a=l.next;continue}if(s=l,s===a){o?o===1?(s=dI(jr(s),e,t),Ic(s,e,t,n,i,r,2)):o===2&&pI(s,e,t,n,i,r):Ic(jr(s),e,t,n,i,r,1);break}}}function uI(s){const e=s.prev,t=s,n=s.next;if(Zt(e,t,n)>=0)return!1;const i=e.x,r=t.x,o=n.x,a=e.y,c=t.y,l=n.y,u=i<r?i<o?i:o:r<o?r:o,h=a<c?a<l?a:l:c<l?c:l,d=i>r?i>o?i:o:r>o?r:o,p=a>c?a>l?a:l:c>l?c:l;let f=n.next;for(;f!==e;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&Ho(i,a,r,c,o,l,f.x,f.y)&&Zt(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function hI(s,e,t,n){const i=s.prev,r=s,o=s.next;if(Zt(i,r,o)>=0)return!1;const a=i.x,c=r.x,l=o.x,u=i.y,h=r.y,d=o.y,p=a<c?a<l?a:l:c<l?c:l,f=u<h?u<d?u:d:h<d?h:d,x=a>c?a>l?a:l:c>l?c:l,m=u>h?u>d?u:d:h>d?h:d,g=cf(p,f,e,t,n),y=cf(x,m,e,t,n);let _=s.prevZ,v=s.nextZ;for(;_&&_.z>=g&&v&&v.z<=y;){if(_.x>=p&&_.x<=x&&_.y>=f&&_.y<=m&&_!==i&&_!==o&&Ho(a,u,c,h,l,d,_.x,_.y)&&Zt(_.prev,_,_.next)>=0||(_=_.prevZ,v.x>=p&&v.x<=x&&v.y>=f&&v.y<=m&&v!==i&&v!==o&&Ho(a,u,c,h,l,d,v.x,v.y)&&Zt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;_&&_.z>=g;){if(_.x>=p&&_.x<=x&&_.y>=f&&_.y<=m&&_!==i&&_!==o&&Ho(a,u,c,h,l,d,_.x,_.y)&&Zt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;v&&v.z<=y;){if(v.x>=p&&v.x<=x&&v.y>=f&&v.y<=m&&v!==i&&v!==o&&Ho(a,u,c,h,l,d,v.x,v.y)&&Zt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function dI(s,e,t){let n=s;do{const i=n.prev,r=n.next.next;!ed(i,r)&&rv(i,n,n.next,r)&&Pc(i,r)&&Pc(r,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(r.i/t|0),Lc(n),Lc(n.next),n=s=r),n=n.next}while(n!==s);return jr(n)}function pI(s,e,t,n,i,r){let o=s;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&SI(o,a)){let c=ov(o,a);o=jr(o,o.next),c=jr(c,c.next),Ic(o,e,t,n,i,r,0),Ic(c,e,t,n,i,r,0);return}a=a.next}o=o.next}while(o!==s)}function fI(s,e,t,n){const i=[];let r,o,a,c,l;for(r=0,o=e.length;r<o;r++)a=e[r]*n,c=r<o-1?e[r+1]*n:s.length,l=sv(s,a,c,n,!1),l===l.next&&(l.steiner=!0),i.push(MI(l));for(i.sort(mI),r=0;r<i.length;r++)t=gI(i[r],t);return t}function mI(s,e){return s.x-e.x}function gI(s,e){const t=xI(s,e);if(!t)return e;const n=ov(t,s);return jr(n,n.next),jr(t,t.next)}function xI(s,e){let t=e,n=-1/0,i;const r=s.x,o=s.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){const d=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=r&&d>n&&(n=d,i=t.x<t.next.x?t:t.next,d===r))return i}t=t.next}while(t!==e);if(!i)return null;const a=i,c=i.x,l=i.y;let u=1/0,h;t=i;do r>=t.x&&t.x>=c&&r!==t.x&&Ho(o<l?r:n,o,c,l,o<l?n:r,o,t.x,t.y)&&(h=Math.abs(o-t.y)/(r-t.x),Pc(t,s)&&(h<u||h===u&&(t.x>i.x||t.x===i.x&&_I(i,t)))&&(i=t,u=h)),t=t.next;while(t!==a);return i}function _I(s,e){return Zt(s.prev,s,e.prev)<0&&Zt(e.next,s,s.next)<0}function yI(s,e,t,n){let i=s;do i.z===0&&(i.z=cf(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,vI(i)}function vI(s){let e,t,n,i,r,o,a,c,l=1;do{for(t=s,s=null,r=null,o=0;t;){for(o++,n=t,a=0,e=0;e<l&&(a++,n=n.nextZ,!!n);e++);for(c=l;a>0||c>0&&n;)a!==0&&(c===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,c--),r?r.nextZ=i:s=i,i.prevZ=r,r=i;t=n}r.nextZ=null,l*=2}while(o>1);return s}function cf(s,e,t,n,i){return s=(s-t)*i|0,e=(e-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function MI(s){let e=s,t=s;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==s);return t}function Ho(s,e,t,n,i,r,o,a){return(i-o)*(e-a)>=(s-o)*(r-a)&&(s-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(r-a)>=(i-o)*(n-a)}function SI(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!TI(s,e)&&(Pc(s,e)&&Pc(e,s)&&bI(s,e)&&(Zt(s.prev,s,e.prev)||Zt(s,e.prev,e))||ed(s,e)&&Zt(s.prev,s,s.next)>0&&Zt(e.prev,e,e.next)>0)}function Zt(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function ed(s,e){return s.x===e.x&&s.y===e.y}function rv(s,e,t,n){const i=cu(Zt(s,e,t)),r=cu(Zt(s,e,n)),o=cu(Zt(t,n,s)),a=cu(Zt(t,n,e));return!!(i!==r&&o!==a||i===0&&au(s,t,e)||r===0&&au(s,n,e)||o===0&&au(t,s,n)||a===0&&au(t,e,n))}function au(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function cu(s){return s>0?1:s<0?-1:0}function TI(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&rv(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function Pc(s,e){return Zt(s.prev,s,s.next)<0?Zt(s,e,s.next)>=0&&Zt(s,s.prev,e)>=0:Zt(s,e,s.prev)<0||Zt(s,s.next,e)<0}function bI(s,e){let t=s,n=!1;const i=(s.x+e.x)/2,r=(s.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&i<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function ov(s,e){const t=new lf(s.i,s.x,s.y),n=new lf(e.i,e.x,e.y),i=s.next,r=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,r.next=n,n.prev=r,n}function Tx(s,e,t,n){const i=new lf(s,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Lc(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function lf(s,e,t){this.i=s,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function wI(s,e,t,n){let i=0;for(let r=e,o=t-n;r<t;r+=n)i+=(s[o]-s[r])*(s[r+1]+s[o+1]),o=r;return i}class Ki{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return n*.5}static isClockWise(e){return Ki.area(e)<0}static triangulateShape(e,t){const n=[],i=[],r=[];bx(e),wx(n,e);let o=e.length;t.forEach(bx);for(let c=0;c<t.length;c++)i.push(o),o+=t[c].length,wx(n,t[c]);const a=lI.triangulate(n,i);for(let c=0;c<a.length;c+=3)r.push(a.slice(c,c+3));return r}}function bx(s){const e=s.length;e>2&&s[e-1].equals(s[0])&&s.pop()}function wx(s,e){for(let t=0;t<e.length;t++)s.push(e[t].x),s.push(e[t].y)}class Qc extends at{constructor(e=new er([new J(.5,.5),new J(-.5,.5),new J(-.5,-.5),new J(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let a=0,c=e.length;a<c;a++){const l=e[a];o(l)}this.setAttribute("position",new Ve(i,3)),this.setAttribute("uv",new Ve(r,2)),this.computeVertexNormals();function o(a){const c=[],l=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1;let d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,p=t.bevelThickness!==void 0?t.bevelThickness:.2,f=t.bevelSize!==void 0?t.bevelSize:p-.1,x=t.bevelOffset!==void 0?t.bevelOffset:0,m=t.bevelSegments!==void 0?t.bevelSegments:3;const g=t.extrudePath,y=t.UVGenerator!==void 0?t.UVGenerator:AI;let _,v=!1,I,T,w,C;g&&(_=g.getSpacedPoints(u),v=!0,d=!1,I=g.computeFrenetFrames(u,!1),T=new E,w=new E,C=new E),d||(m=0,p=0,f=0,x=0);const F=a.extractPoints(l);let M=F.shape;const b=F.holes;if(!Ki.isClockWise(M)){M=M.reverse();for(let ae=0,P=b.length;ae<P;ae++){const Me=b[ae];Ki.isClockWise(Me)&&(b[ae]=Me.reverse())}}const W=Ki.triangulateShape(M,b),$=M;for(let ae=0,P=b.length;ae<P;ae++){const Me=b[ae];M=M.concat(Me)}function ie(ae,P,Me){return P||console.error("THREE.ExtrudeGeometry: vec does not exist"),ae.clone().addScaledVector(P,Me)}const q=M.length,he=W.length;function Q(ae,P,Me){let ye,de,Te;const qe=ae.x-P.x,Ie=ae.y-P.y,R=Me.x-ae.x,S=Me.y-ae.y,X=qe*qe+Ie*Ie,se=qe*S-Ie*R;if(Math.abs(se)>Number.EPSILON){const ce=Math.sqrt(X),re=Math.sqrt(R*R+S*S),ke=P.x-Ie/ce,be=P.y+qe/ce,De=Me.x-S/re,vt=Me.y+R/re,me=((De-ke)*S-(vt-be)*R)/(qe*S-Ie*R);ye=ke+qe*me-ae.x,de=be+Ie*me-ae.y;const Ue=ye*ye+de*de;if(Ue<=2)return new J(ye,de);Te=Math.sqrt(Ue/2)}else{let ce=!1;qe>Number.EPSILON?R>Number.EPSILON&&(ce=!0):qe<-Number.EPSILON?R<-Number.EPSILON&&(ce=!0):Math.sign(Ie)===Math.sign(S)&&(ce=!0),ce?(ye=-Ie,de=qe,Te=Math.sqrt(X)):(ye=qe,de=Ie,Te=Math.sqrt(X/2))}return new J(ye/Te,de/Te)}const we=[];for(let ae=0,P=$.length,Me=P-1,ye=ae+1;ae<P;ae++,Me++,ye++)Me===P&&(Me=0),ye===P&&(ye=0),we[ae]=Q($[ae],$[Me],$[ye]);const Ne=[];let Ee,Qe=we.concat();for(let ae=0,P=b.length;ae<P;ae++){const Me=b[ae];Ee=[];for(let ye=0,de=Me.length,Te=de-1,qe=ye+1;ye<de;ye++,Te++,qe++)Te===de&&(Te=0),qe===de&&(qe=0),Ee[ye]=Q(Me[ye],Me[Te],Me[qe]);Ne.push(Ee),Qe=Qe.concat(Ee)}for(let ae=0;ae<m;ae++){const P=ae/m,Me=p*Math.cos(P*Math.PI/2),ye=f*Math.sin(P*Math.PI/2)+x;for(let de=0,Te=$.length;de<Te;de++){const qe=ie($[de],we[de],ye);ge(qe.x,qe.y,-Me)}for(let de=0,Te=b.length;de<Te;de++){const qe=b[de];Ee=Ne[de];for(let Ie=0,R=qe.length;Ie<R;Ie++){const S=ie(qe[Ie],Ee[Ie],ye);ge(S.x,S.y,-Me)}}}const ht=f+x;for(let ae=0;ae<q;ae++){const P=d?ie(M[ae],Qe[ae],ht):M[ae];v?(w.copy(I.normals[0]).multiplyScalar(P.x),T.copy(I.binormals[0]).multiplyScalar(P.y),C.copy(_[0]).add(w).add(T),ge(C.x,C.y,C.z)):ge(P.x,P.y,0)}for(let ae=1;ae<=u;ae++)for(let P=0;P<q;P++){const Me=d?ie(M[P],Qe[P],ht):M[P];v?(w.copy(I.normals[ae]).multiplyScalar(Me.x),T.copy(I.binormals[ae]).multiplyScalar(Me.y),C.copy(_[ae]).add(w).add(T),ge(C.x,C.y,C.z)):ge(Me.x,Me.y,h/u*ae)}for(let ae=m-1;ae>=0;ae--){const P=ae/m,Me=p*Math.cos(P*Math.PI/2),ye=f*Math.sin(P*Math.PI/2)+x;for(let de=0,Te=$.length;de<Te;de++){const qe=ie($[de],we[de],ye);ge(qe.x,qe.y,h+Me)}for(let de=0,Te=b.length;de<Te;de++){const qe=b[de];Ee=Ne[de];for(let Ie=0,R=qe.length;Ie<R;Ie++){const S=ie(qe[Ie],Ee[Ie],ye);v?ge(S.x,S.y+_[u-1].y,_[u-1].x+Me):ge(S.x,S.y,h+Me)}}}ne(),ue();function ne(){const ae=i.length/3;if(d){let P=0,Me=q*P;for(let ye=0;ye<he;ye++){const de=W[ye];Ze(de[2]+Me,de[1]+Me,de[0]+Me)}P=u+m*2,Me=q*P;for(let ye=0;ye<he;ye++){const de=W[ye];Ze(de[0]+Me,de[1]+Me,de[2]+Me)}}else{for(let P=0;P<he;P++){const Me=W[P];Ze(Me[2],Me[1],Me[0])}for(let P=0;P<he;P++){const Me=W[P];Ze(Me[0]+q*u,Me[1]+q*u,Me[2]+q*u)}}n.addGroup(ae,i.length/3-ae,0)}function ue(){const ae=i.length/3;let P=0;Ae($,P),P+=$.length;for(let Me=0,ye=b.length;Me<ye;Me++){const de=b[Me];Ae(de,P),P+=de.length}n.addGroup(ae,i.length/3-ae,1)}function Ae(ae,P){let Me=ae.length;for(;--Me>=0;){const ye=Me;let de=Me-1;de<0&&(de=ae.length-1);for(let Te=0,qe=u+m*2;Te<qe;Te++){const Ie=q*Te,R=q*(Te+1),S=P+ye+Ie,X=P+de+Ie,se=P+de+R,ce=P+ye+R;Xe(S,X,se,ce)}}}function ge(ae,P,Me){c.push(ae),c.push(P),c.push(Me)}function Ze(ae,P,Me){Je(ae),Je(P),Je(Me);const ye=i.length/3,de=y.generateTopUV(n,i,ye-3,ye-2,ye-1);dt(de[0]),dt(de[1]),dt(de[2])}function Xe(ae,P,Me,ye){Je(ae),Je(P),Je(ye),Je(P),Je(Me),Je(ye);const de=i.length/3,Te=y.generateSideWallUV(n,i,de-6,de-3,de-2,de-1);dt(Te[0]),dt(Te[1]),dt(Te[3]),dt(Te[1]),dt(Te[2]),dt(Te[3])}function Je(ae){i.push(c[ae*3+0]),i.push(c[ae*3+1]),i.push(c[ae*3+2])}function dt(ae){r.push(ae.x),r.push(ae.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return NI(t,n,e)}static fromJSON(e,t){const n=[];for(let r=0,o=e.shapes.length;r<o;r++){const a=t[e.shapes[r]];n.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new lh[i.type]().fromJSON(i)),new Qc(n,e.options)}}const AI={generateTopUV:function(s,e,t,n,i){const r=e[t*3],o=e[t*3+1],a=e[n*3],c=e[n*3+1],l=e[i*3],u=e[i*3+1];return[new J(r,o),new J(a,c),new J(l,u)]},generateSideWallUV:function(s,e,t,n,i,r){const o=e[t*3],a=e[t*3+1],c=e[t*3+2],l=e[n*3],u=e[n*3+1],h=e[n*3+2],d=e[i*3],p=e[i*3+1],f=e[i*3+2],x=e[r*3],m=e[r*3+1],g=e[r*3+2];return Math.abs(a-u)<Math.abs(o-l)?[new J(o,1-c),new J(l,1-h),new J(d,1-f),new J(x,1-g)]:[new J(a,1-c),new J(u,1-h),new J(p,1-f),new J(m,1-g)]}};function NI(s,e,t){if(t.shapes=[],Array.isArray(s))for(let n=0,i=s.length;n<i;n++){const r=s[n];t.shapes.push(r.uuid)}else t.shapes.push(s.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class td extends hr{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,r,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new td(e.radius,e.detail)}}class ya extends hr{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ya(e.radius,e.detail)}}class el extends at{constructor(e=.5,t=1,n=32,i=1,r=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const a=[],c=[],l=[],u=[];let h=e;const d=(t-e)/i,p=new E,f=new J;for(let x=0;x<=i;x++){for(let m=0;m<=n;m++){const g=r+m/n*o;p.x=h*Math.cos(g),p.y=h*Math.sin(g),c.push(p.x,p.y,p.z),l.push(0,0,1),f.x=(p.x/t+1)/2,f.y=(p.y/t+1)/2,u.push(f.x,f.y)}h+=d}for(let x=0;x<i;x++){const m=x*(n+1);for(let g=0;g<n;g++){const y=g+m,_=y,v=y+n+1,I=y+n+2,T=y+1;a.push(_,v,T),a.push(v,I,T)}}this.setIndex(a),this.setAttribute("position",new Ve(c,3)),this.setAttribute("normal",new Ve(l,3)),this.setAttribute("uv",new Ve(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new el(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class nd extends at{constructor(e=new er([new J(0,.5),new J(-.5,-.5),new J(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],o=[];let a=0,c=0;if(Array.isArray(e)===!1)l(e);else for(let u=0;u<e.length;u++)l(e[u]),this.addGroup(a,c,u),a+=c,c=0;this.setIndex(n),this.setAttribute("position",new Ve(i,3)),this.setAttribute("normal",new Ve(r,3)),this.setAttribute("uv",new Ve(o,2));function l(u){const h=i.length/3,d=u.extractPoints(t);let p=d.shape;const f=d.holes;Ki.isClockWise(p)===!1&&(p=p.reverse());for(let m=0,g=f.length;m<g;m++){const y=f[m];Ki.isClockWise(y)===!0&&(f[m]=y.reverse())}const x=Ki.triangulateShape(p,f);for(let m=0,g=f.length;m<g;m++){const y=f[m];p=p.concat(y)}for(let m=0,g=p.length;m<g;m++){const y=p[m];i.push(y.x,y.y,0),r.push(0,0,1),o.push(y.x,y.y)}for(let m=0,g=x.length;m<g;m++){const y=x[m],_=y[0]+h,v=y[1]+h,I=y[2]+h;n.push(_,v,I),c+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return EI(t,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const o=t[e.shapes[i]];n.push(o)}return new nd(n,e.curveSegments)}}function EI(s,e){if(e.shapes=[],Array.isArray(s))for(let t=0,n=s.length;t<n;t++){const i=s[t];e.shapes.push(i.uuid)}else e.shapes.push(s.uuid);return e}class va extends at{constructor(e=1,t=32,n=16,i=0,r=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const c=Math.min(o+a,Math.PI);let l=0;const u=[],h=new E,d=new E,p=[],f=[],x=[],m=[];for(let g=0;g<=n;g++){const y=[],_=g/n;let v=0;g===0&&o===0?v=.5/t:g===n&&c===Math.PI&&(v=-.5/t);for(let I=0;I<=t;I++){const T=I/t;h.x=-e*Math.cos(i+T*r)*Math.sin(o+_*a),h.y=e*Math.cos(o+_*a),h.z=e*Math.sin(i+T*r)*Math.sin(o+_*a),f.push(h.x,h.y,h.z),d.copy(h).normalize(),x.push(d.x,d.y,d.z),m.push(T+v,1-_),y.push(l++)}u.push(y)}for(let g=0;g<n;g++)for(let y=0;y<t;y++){const _=u[g][y+1],v=u[g][y],I=u[g+1][y],T=u[g+1][y+1];(g!==0||o>0)&&p.push(_,v,T),(g!==n-1||c<Math.PI)&&p.push(v,I,T)}this.setIndex(p),this.setAttribute("position",new Ve(f,3)),this.setAttribute("normal",new Ve(x,3)),this.setAttribute("uv",new Ve(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new va(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class id extends hr{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new id(e.radius,e.detail)}}class tl extends at{constructor(e=1,t=.4,n=12,i=48,r=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],c=[],l=[],u=new E,h=new E,d=new E;for(let p=0;p<=n;p++)for(let f=0;f<=i;f++){const x=f/i*r,m=p/n*Math.PI*2;h.x=(e+t*Math.cos(m))*Math.cos(x),h.y=(e+t*Math.cos(m))*Math.sin(x),h.z=t*Math.sin(m),a.push(h.x,h.y,h.z),u.x=e*Math.cos(x),u.y=e*Math.sin(x),d.subVectors(h,u).normalize(),c.push(d.x,d.y,d.z),l.push(f/i),l.push(p/n)}for(let p=1;p<=n;p++)for(let f=1;f<=i;f++){const x=(i+1)*p+f-1,m=(i+1)*(p-1)+f-1,g=(i+1)*(p-1)+f,y=(i+1)*p+f;o.push(x,m,y),o.push(m,g,y)}this.setIndex(o),this.setAttribute("position",new Ve(a,3)),this.setAttribute("normal",new Ve(c,3)),this.setAttribute("uv",new Ve(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tl(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class sd extends at{constructor(e=1,t=.4,n=64,i=8,r=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:o},n=Math.floor(n),i=Math.floor(i);const a=[],c=[],l=[],u=[],h=new E,d=new E,p=new E,f=new E,x=new E,m=new E,g=new E;for(let _=0;_<=n;++_){const v=_/n*r*Math.PI*2;y(v,r,o,e,p),y(v+.01,r,o,e,f),m.subVectors(f,p),g.addVectors(f,p),x.crossVectors(m,g),g.crossVectors(x,m),x.normalize(),g.normalize();for(let I=0;I<=i;++I){const T=I/i*Math.PI*2,w=-t*Math.cos(T),C=t*Math.sin(T);h.x=p.x+(w*g.x+C*x.x),h.y=p.y+(w*g.y+C*x.y),h.z=p.z+(w*g.z+C*x.z),c.push(h.x,h.y,h.z),d.subVectors(h,p).normalize(),l.push(d.x,d.y,d.z),u.push(_/n),u.push(I/i)}}for(let _=1;_<=n;_++)for(let v=1;v<=i;v++){const I=(i+1)*(_-1)+(v-1),T=(i+1)*_+(v-1),w=(i+1)*_+v,C=(i+1)*(_-1)+v;a.push(I,T,C),a.push(T,w,C)}this.setIndex(a),this.setAttribute("position",new Ve(c,3)),this.setAttribute("normal",new Ve(l,3)),this.setAttribute("uv",new Ve(u,2));function y(_,v,I,T,w){const C=Math.cos(_),F=Math.sin(_),M=I/v*_,b=Math.cos(M);w.x=T*(2+b)*.5*C,w.y=T*(2+b)*F*.5,w.z=T*Math.sin(M)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sd(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class rd extends at{constructor(e=new _m(new E(-1,-1,0),new E(-1,1,0),new E(1,1,0)),t=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const o=e.computeFrenetFrames(t,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new E,c=new E,l=new J;let u=new E;const h=[],d=[],p=[],f=[];x(),this.setIndex(f),this.setAttribute("position",new Ve(h,3)),this.setAttribute("normal",new Ve(d,3)),this.setAttribute("uv",new Ve(p,2));function x(){for(let _=0;_<t;_++)m(_);m(r===!1?t:0),y(),g()}function m(_){u=e.getPointAt(_/t,u);const v=o.normals[_],I=o.binormals[_];for(let T=0;T<=i;T++){const w=T/i*Math.PI*2,C=Math.sin(w),F=-Math.cos(w);c.x=F*v.x+C*I.x,c.y=F*v.y+C*I.y,c.z=F*v.z+C*I.z,c.normalize(),d.push(c.x,c.y,c.z),a.x=u.x+n*c.x,a.y=u.y+n*c.y,a.z=u.z+n*c.z,h.push(a.x,a.y,a.z)}}function g(){for(let _=1;_<=t;_++)for(let v=1;v<=i;v++){const I=(i+1)*(_-1)+(v-1),T=(i+1)*_+(v-1),w=(i+1)*_+v,C=(i+1)*(_-1)+v;f.push(I,T,C),f.push(T,w,C)}}function y(){for(let _=0;_<=t;_++)for(let v=0;v<=i;v++)l.x=_/t,l.y=v/i,p.push(l.x,l.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new rd(new lh[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Mm extends at{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new E,r=new E;if(e.index!==null){const o=e.attributes.position,a=e.index;let c=e.groups;c.length===0&&(c=[{start:0,count:a.count,materialIndex:0}]);for(let l=0,u=c.length;l<u;++l){const h=c[l],d=h.start,p=h.count;for(let f=d,x=d+p;f<x;f+=3)for(let m=0;m<3;m++){const g=a.getX(f+m),y=a.getX(f+(m+1)%3);i.fromBufferAttribute(o,g),r.fromBufferAttribute(o,y),Ax(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}}else{const o=e.attributes.position;for(let a=0,c=o.count/3;a<c;a++)for(let l=0;l<3;l++){const u=3*a+l,h=3*a+(l+1)%3;i.fromBufferAttribute(o,u),r.fromBufferAttribute(o,h),Ax(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}this.setAttribute("position",new Ve(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Ax(s,e,t){const n=`${s.x},${s.y},${s.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${s.x},${s.y},${s.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var Nx=Object.freeze({__proto__:null,BoxGeometry:_s,CapsuleGeometry:Jh,CircleGeometry:Kh,ConeGeometry:jh,CylinderGeometry:ao,DodecahedronGeometry:Qh,EdgesGeometry:vm,ExtrudeGeometry:Qc,IcosahedronGeometry:td,LatheGeometry:jc,OctahedronGeometry:ya,PlaneGeometry:so,PolyhedronGeometry:hr,RingGeometry:el,ShapeGeometry:nd,SphereGeometry:va,TetrahedronGeometry:id,TorusGeometry:tl,TorusKnotGeometry:sd,TubeGeometry:rd,WireframeGeometry:Mm});class od extends mn{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new _e(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class Sm extends ki{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class nl extends mn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new _e(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ms,this.normalScale=new J(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 ui,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class ad extends nl{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new J(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return jt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new _e(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 _e(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new _e(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class cd extends mn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new _e(16777215),this.specular=new _e(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ms,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ui,this.combine=da,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Tm extends mn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new _e(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ms,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class ld extends mn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ms,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class ud extends mn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new _e(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ms,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ui,this.combine=da,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class bm extends mn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new _e(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ms,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class hd extends Fn{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Gr(s,e,t){return!s||!t&&s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function av(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function cv(s){function e(i,r){return s[i]-s[r]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function uf(s,e,t){const n=s.length,i=new s.constructor(n);for(let r=0,o=0;o!==n;++r){const a=t[r]*e;for(let c=0;c!==e;++c)i[o++]=s[a+c]}return i}function wm(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let o=r[n];if(o!==void 0)if(Array.isArray(o))do o=r[n],o!==void 0&&(e.push(r.time),t.push.apply(t,o)),r=s[i++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[n],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do o=r[n],o!==void 0&&(e.push(r.time),t.push(o)),r=s[i++];while(r!==void 0)}function CI(s,e,t,n,i=30){const r=s.clone();r.name=e;const o=[];for(let c=0;c<r.tracks.length;++c){const l=r.tracks[c],u=l.getValueSize(),h=[],d=[];for(let p=0;p<l.times.length;++p){const f=l.times[p]*i;if(!(f<t||f>=n)){h.push(l.times[p]);for(let x=0;x<u;++x)d.push(l.values[p*u+x])}}h.length!==0&&(l.times=Gr(h,l.times.constructor),l.values=Gr(d,l.values.constructor),o.push(l))}r.tracks=o;let a=1/0;for(let c=0;c<r.tracks.length;++c)a>r.tracks[c].times[0]&&(a=r.tracks[c].times[0]);for(let c=0;c<r.tracks.length;++c)r.tracks[c].shift(-1*a);return r.resetDuration(),r}function RI(s,e=0,t=s,n=30){n<=0&&(n=30);const i=t.tracks.length,r=e/n;for(let o=0;o<i;++o){const a=t.tracks[o],c=a.ValueTypeName;if(c==="bool"||c==="string")continue;const l=s.tracks.find(function(g){return g.name===a.name&&g.ValueTypeName===c});if(l===void 0)continue;let u=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let d=0;const p=l.getValueSize();l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=p/3);const f=a.times.length-1;let x;if(r<=a.times[0]){const g=u,y=h-u;x=a.values.slice(g,y)}else if(r>=a.times[f]){const g=f*h+u,y=g+h-u;x=a.values.slice(g,y)}else{const g=a.createInterpolant(),y=u,_=h-u;g.evaluate(r),x=g.resultBuffer.slice(y,_)}c==="quaternion"&&new Qn().fromArray(x).normalize().conjugate().toArray(x);const m=l.times.length;for(let g=0;g<m;++g){const y=g*p+d;if(c==="quaternion")Qn.multiplyQuaternionsFlat(l.values,y,x,0,l.values,y);else{const _=p-d*2;for(let v=0;v<_;++v)l.values[y+v]-=x[v]}}}return s.blendMode=$f,s}const II={convertArray:Gr,isTypedArray:av,getKeyframeOrder:cv,sortedArray:uf,flattenJSON:wm,subclip:CI,makeClipAdditive:RI};class Ma{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(r=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=r)){const a=t[1];e<a&&(n=2,r=a);for(let c=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=r,r=t[--n-1],e>=r)break t}o=n,n=0;break n}break e}for(;n<o;){const a=n+o>>>1;e<t[a]?o=a:n=a+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let o=0;o!==i;++o)t[o]=n[r+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class lv extends Ma{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Vr,endingEnd:Vr}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,o=e+1,a=i[r],c=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case Br:r=e,a=2*t-n;break;case wc:r=i.length-2,a=t+i[r]-i[r+1];break;default:r=e,a=n}if(c===void 0)switch(this.getSettings_().endingEnd){case Br:o=e,c=2*n-t;break;case wc:o=1,c=n+i[1]-i[0];break;default:o=e-1,c=t}const l=(n-t)*.5,u=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(c-n),this._offsetPrev=r*u,this._offsetNext=o*u}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,p=this._weightNext,f=(n-t)/(i-t),x=f*f,m=x*f,g=-d*m+2*d*x-d*f,y=(1+d)*m+(-1.5-2*d)*x+(-.5+d)*f+1,_=(-1-p)*m+(1.5+p)*x+.5*f,v=p*m-p*x;for(let I=0;I!==a;++I)r[I]=g*o[u+I]+y*o[l+I]+_*o[c+I]+v*o[h+I];return r}}class Am extends Ma{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=(n-t)/(i-t),h=1-u;for(let d=0;d!==a;++d)r[d]=o[l+d]*h+o[c+d]*u;return r}}class uv extends Ma{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class rs{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Gr(t,this.TimeBufferType),this.values=Gr(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Gr(e.times,Array),values:Gr(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new uv(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Am(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new lv(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case ta:t=this.InterpolantFactoryMethodDiscrete;break;case bc:t=this.InterpolantFactoryMethodLinear;break;case Eu:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ta;case this.InterpolantFactoryMethodLinear:return bc;case this.InterpolantFactoryMethodSmooth:return Eu}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,o=i-1;for(;r!==i&&n[r]<e;)++r;for(;o!==-1&&n[o]>t;)--o;if(++o,r!==0||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);const a=this.getValueSize();this.times=n.slice(r,o),this.values=this.values.slice(r*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){const c=n[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(i!==void 0&&av(i))for(let a=0,c=i.length;a!==c;++a){const l=i[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Eu,r=e.length-1;let o=1;for(let a=1;a<r;++a){let c=!1;const l=e[a],u=e[a+1];if(l!==u&&(a!==1||l!==e[0]))if(i)c=!0;else{const h=a*n,d=h-n,p=h+n;for(let f=0;f!==n;++f){const x=t[h+f];if(x!==t[d+f]||x!==t[p+f]){c=!0;break}}}if(c){if(a!==o){e[o]=e[a];const h=a*n,d=o*n;for(let p=0;p!==n;++p)t[d+p]=t[h+p]}++o}}if(r>0){e[o]=e[r];for(let a=r*n,c=o*n,l=0;l!==n;++l)t[c+l]=t[a+l];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}rs.prototype.TimeBufferType=Float32Array;rs.prototype.ValueBufferType=Float32Array;rs.prototype.DefaultInterpolation=bc;class co extends rs{constructor(e,t,n){super(e,t,n)}}co.prototype.ValueTypeName="bool";co.prototype.ValueBufferType=Array;co.prototype.DefaultInterpolation=ta;co.prototype.InterpolantFactoryMethodLinear=void 0;co.prototype.InterpolantFactoryMethodSmooth=void 0;class dd extends rs{}dd.prototype.ValueTypeName="color";class ra extends rs{}ra.prototype.ValueTypeName="number";class hv extends Ma{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(n-t)/(i-t);let l=e*a;for(let u=l+a;l!==u;l+=4)Qn.slerpFlat(r,0,o,l-a,o,l,c);return r}}class Sa extends rs{InterpolantFactoryMethodLinear(e){return new hv(this.times,this.values,this.getValueSize(),e)}}Sa.prototype.ValueTypeName="quaternion";Sa.prototype.InterpolantFactoryMethodSmooth=void 0;class lo extends rs{constructor(e,t,n){super(e,t,n)}}lo.prototype.ValueTypeName="string";lo.prototype.ValueBufferType=Array;lo.prototype.DefaultInterpolation=ta;lo.prototype.InterpolantFactoryMethodLinear=void 0;lo.prototype.InterpolantFactoryMethodSmooth=void 0;class oa extends rs{}oa.prototype.ValueTypeName="vector";class aa{constructor(e="",t=-1,n=[],i=Vh){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=bi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(LI(n[o]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=n.length;r!==o;++r)t.push(rs.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,o=[];for(let a=0;a<r;a++){let c=[],l=[];c.push((a+r-1)%r,a,(a+1)%r),l.push(0,1,0);const u=cv(c);c=uf(c,1,u),l=uf(l,1,u),!i&&c[0]===0&&(c.push(r),l.push(l[0])),o.push(new ra(".morphTargetInfluences["+t[a].name+"]",c,l).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let a=0,c=e.length;a<c;a++){const l=e[a],u=l.name.match(r);if(u&&u.length>1){const h=u[1];let d=i[h];d||(i[h]=d=[]),d.push(l)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,d,p,f,x){if(p.length!==0){const m=[],g=[];wm(p,m,g,f),m.length!==0&&x.push(new h(d,m,g))}},i=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let c=e.length||-1;const l=e.hierarchy||[];for(let h=0;h<l.length;h++){const d=l[h].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const p={};let f;for(f=0;f<d.length;f++)if(d[f].morphTargets)for(let x=0;x<d[f].morphTargets.length;x++)p[d[f].morphTargets[x]]=-1;for(const x in p){const m=[],g=[];for(let y=0;y!==d[f].morphTargets.length;++y){const _=d[f];m.push(_.time),g.push(_.morphTarget===x?1:0)}i.push(new ra(".morphTargetInfluence["+x+"]",m,g))}c=p.length*o}else{const p=".bones["+t[h].name+"]";n(oa,p+".position",d,"pos",i),n(Sa,p+".quaternion",d,"rot",i),n(oa,p+".scale",d,"scl",i)}}return i.length===0?null:new this(r,c,i,a)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function PI(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ra;case"vector":case"vector2":case"vector3":case"vector4":return oa;case"color":return dd;case"quaternion":return Sa;case"bool":case"boolean":return co;case"string":return lo}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function LI(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=PI(s.type);if(s.times===void 0){const t=[],n=[];wm(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const Rs={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(this.files[s]=e)},get:function(s){if(this.enabled!==!1)return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};class pd{constructor(e,t,n){const i=this;let r=!1,o=0,a=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){a++,r===!1&&i.onStart!==void 0&&i.onStart(u,o,a),r=!0},this.itemEnd=function(u){o++,i.onProgress!==void 0&&i.onProgress(u,o,a),o===a&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return c?c(u):u},this.setURLModifier=function(u){return c=u,this},this.addHandler=function(u,h){return l.push(u,h),this},this.removeHandler=function(u){const h=l.indexOf(u);return h!==-1&&l.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=l.length;h<d;h+=2){const p=l[h],f=l[h+1];if(p.global&&(p.lastIndex=0),p.test(u))return f}return null}}}const Nm=new pd;class Xn{constructor(e){this.manager=e!==void 0?e:Nm,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Xn.DEFAULT_MATERIAL_NAME="__DEFAULT";const As={};class DI extends Error{constructor(e,t){super(e),this.response=t}}class es extends Xn{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=Rs.get(e);if(r!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(As[e]!==void 0){As[e].push({onLoad:t,onProgress:n,onError:i});return}As[e]=[],As[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,c=this.responseType;fetch(o).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const u=As[e],h=l.body.getReader(),d=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),p=d?parseInt(d):0,f=p!==0;let x=0;const m=new ReadableStream({start(g){y();function y(){h.read().then(({done:_,value:v})=>{if(_)g.close();else{x+=v.byteLength;const I=new ProgressEvent("progress",{lengthComputable:f,loaded:x,total:p});for(let T=0,w=u.length;T<w;T++){const C=u[T];C.onProgress&&C.onProgress(I)}g.enqueue(v),y()}},_=>{g.error(_)})}}});return new Response(m)}else throw new DI(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return l.json();default:if(a===void 0)return l.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),d=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(d);return l.arrayBuffer().then(f=>p.decode(f))}}}).then(l=>{Rs.add(e,l);const u=As[e];delete As[e];for(let h=0,d=u.length;h<d;h++){const p=u[h];p.onLoad&&p.onLoad(l)}}).catch(l=>{const u=As[e];if(u===void 0)throw this.manager.itemError(e),l;delete As[e];for(let h=0,d=u.length;h<d;h++){const p=u[h];p.onError&&p.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class UI extends Xn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new es(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=aa.parse(e[n]);t.push(i)}return t}}class FI extends Xn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=[],a=new Kc,c=new es(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(r.withCredentials);let l=0;function u(h){c.load(e[h],function(d){const p=r.parse(d,!0);o[h]={width:p.width,height:p.height,format:p.format,mipmaps:p.mipmaps},l+=1,l===6&&(p.mipmapCount===1&&(a.minFilter=Ut),a.image=o,a.format=p.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let h=0,d=e.length;h<d;++h)u(h);else c.load(e,function(h){const d=r.parse(h,!0);if(d.isCubemap){const p=d.mipmaps.length/d.mipmapCount;for(let f=0;f<p;f++){o[f]={mipmaps:[]};for(let x=0;x<d.mipmapCount;x++)o[f].mipmaps.push(d.mipmaps[f*d.mipmapCount+x]),o[f].format=d.format,o[f].width=d.width,o[f].height=d.height}a.image=o}else a.image.width=d.width,a.image.height=d.height,a.mipmaps=d.mipmaps;d.mipmapCount===1&&(a.minFilter=Ut),a.format=d.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}}class Dc extends Xn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=Rs.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a=Cc("img");function c(){u(),Rs.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(h){u(),i&&i(h),r.manager.itemError(e),r.manager.itemEnd(e)}function u(){a.removeEventListener("load",c,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",c,!1),a.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class OI extends Xn{constructor(e){super(e)}load(e,t,n,i){const r=new io;r.colorSpace=kn;const o=new Dc(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function c(l){o.load(e[l],function(u){r.images[l]=u,a++,a===6&&(r.needsUpdate=!0,t&&t(r))},void 0,i)}for(let l=0;l<e.length;++l)c(l);return r}}class dv extends Xn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new Oi,a=new es(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(e,function(c){let l;try{l=r.parse(c)}catch(u){if(i!==void 0)i(u);else{console.error(u);return}}l.image!==void 0?o.image=l.image:l.data!==void 0&&(o.image.width=l.width,o.image.height=l.height,o.image.data=l.data),o.wrapS=l.wrapS!==void 0?l.wrapS:Si,o.wrapT=l.wrapT!==void 0?l.wrapT:Si,o.magFilter=l.magFilter!==void 0?l.magFilter:Ut,o.minFilter=l.minFilter!==void 0?l.minFilter:Ut,o.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.colorSpace!==void 0&&(o.colorSpace=l.colorSpace),l.flipY!==void 0&&(o.flipY=l.flipY),l.format!==void 0&&(o.format=l.format),l.type!==void 0&&(o.type=l.type),l.mipmaps!==void 0&&(o.mipmaps=l.mipmaps,o.minFilter=Jn),l.mipmapCount===1&&(o.minFilter=Ut),l.generateMipmaps!==void 0&&(o.generateMipmaps=l.generateMipmaps),o.needsUpdate=!0,t&&t(o,l)},n,i),o}}class pv extends Xn{constructor(e){super(e)}load(e,t,n,i){const r=new Xt,o=new Dc(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){r.image=a,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}}class dr extends yt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new _e(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class fd extends dr{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(yt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new _e(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Ep=new Fe,Ex=new E,Cx=new E;class Em{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new J(512,512),this.map=null,this.mapPass=null,this.matrix=new Fe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ma,this._frameExtents=new J(1,1),this._viewportCount=1,this._viewports=[new st(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Ex.setFromMatrixPosition(e.matrixWorld),t.position.copy(Ex),Cx.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Cx),t.updateMatrixWorld(),Ep.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ep),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Ep)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class VI extends Em{constructor(){super(new hn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=ia*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class il extends dr{constructor(e,t,n=0,i=Math.PI/3,r=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(yt.DEFAULT_UP),this.updateMatrix(),this.target=new yt,this.distance=n,this.angle=i,this.penumbra=r,this.decay=o,this.map=null,this.shadow=new VI}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const Rx=new Fe,za=new E,Cp=new E;class BI extends Em{constructor(){super(new hn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new J(4,2),this._viewportCount=6,this._viewports=[new st(2,1,1,1),new st(0,1,1,1),new st(3,1,1,1),new st(1,1,1,1),new st(3,0,1,1),new st(1,0,1,1)],this._cubeDirections=[new E(1,0,0),new E(-1,0,0),new E(0,0,1),new E(0,0,-1),new E(0,1,0),new E(0,-1,0)],this._cubeUps=[new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,0,1),new E(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),za.setFromMatrixPosition(e.matrixWorld),n.position.copy(za),Cp.copy(n.position),Cp.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Cp),n.updateMatrixWorld(),i.makeTranslation(-za.x,-za.y,-za.z),Rx.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Rx)}}class md extends dr{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new BI}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class zI extends Em{constructor(){super(new ro(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class gd extends dr{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(yt.DEFAULT_UP),this.updateMatrix(),this.target=new yt,this.shadow=new zI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class xd extends dr{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Cm extends dr{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class fv{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new E)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*r),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*r)),t.addScaledVector(o[6],.315392*(3*r*r-1)),t.addScaledVector(o[7],1.092548*(n*r)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*r),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*r),t.addScaledVector(o[6],.743125*r*r-.247708),t.addScaledVector(o[7],2*.429043*n*r),t.addScaledVector(o[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}class Rm extends dr{constructor(e=new fv,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class sl extends Xn{constructor(e){super(e),this.textures={}}load(e,t,n,i){const r=this,o=new es(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(r){return t[r]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",r),t[r]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new _e().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const r in e.uniforms){const o=e.uniforms[r];switch(i.uniforms[r]={},o.type){case"t":i.uniforms[r].value=n(o.value);break;case"c":i.uniforms[r].value=new _e().setHex(o.value);break;case"v2":i.uniforms[r].value=new J().fromArray(o.value);break;case"v3":i.uniforms[r].value=new E().fromArray(o.value);break;case"v4":i.uniforms[r].value=new st().fromArray(o.value);break;case"m3":i.uniforms[r].value=new Ke().fromArray(o.value);break;case"m4":i.uniforms[r].value=new Fe().fromArray(o.value);break;default:i.uniforms[r].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const r in e.extensions)i.extensions[r]=e.extensions[r];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),i.normalScale=new J().fromArray(r)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new J().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return sl.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:od,SpriteMaterial:Zc,RawShaderMaterial:Sm,ShaderMaterial:ki,PointsMaterial:_a,MeshPhysicalMaterial:ad,MeshStandardMaterial:nl,MeshPhongMaterial:cd,MeshToonMaterial:Tm,MeshNormalMaterial:ld,MeshLambertMaterial:ud,MeshDepthMaterial:Xh,MeshDistanceMaterial:im,MeshBasicMaterial:is,MeshMatcapMaterial:bm,LineDashedMaterial:hd,LineBasicMaterial:Fn,Material:mn};return new t[e]}}class uh{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Im extends at{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class mv extends Xn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new es(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),r.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(p,f){if(t[f]!==void 0)return t[f];const m=p.interleavedBuffers[f],g=r(p,m.buffer),y=ko(m.type,g),_=new xa(y,m.stride);return _.uuid=m.uuid,t[f]=_,_}function r(p,f){if(n[f]!==void 0)return n[f];const m=p.arrayBuffers[f],g=new Uint32Array(m).buffer;return n[f]=g,g}const o=e.isInstancedBufferGeometry?new Im:new at,a=e.data.index;if(a!==void 0){const p=ko(a.type,a.array);o.setIndex(new At(p,1))}const c=e.data.attributes;for(const p in c){const f=c[p];let x;if(f.isInterleavedBufferAttribute){const m=i(e.data,f.data);x=new Ds(m,f.itemSize,f.offset,f.normalized)}else{const m=ko(f.type,f.array),g=f.isInstancedBufferAttribute?Us:At;x=new g(m,f.itemSize,f.normalized)}f.name!==void 0&&(x.name=f.name),f.usage!==void 0&&x.setUsage(f.usage),o.setAttribute(p,x)}const l=e.data.morphAttributes;if(l)for(const p in l){const f=l[p],x=[];for(let m=0,g=f.length;m<g;m++){const y=f[m];let _;if(y.isInterleavedBufferAttribute){const v=i(e.data,y.data);_=new Ds(v,y.itemSize,y.offset,y.normalized)}else{const v=ko(y.type,y.array);_=new At(v,y.itemSize,y.normalized)}y.name!==void 0&&(_.name=y.name),x.push(_)}o.morphAttributes[p]=x}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let p=0,f=h.length;p!==f;++p){const x=h[p];o.addGroup(x.start,x.count,x.materialIndex)}const d=e.data.boundingSphere;if(d!==void 0){const p=new E;d.center!==void 0&&p.fromArray(d.center),o.boundingSphere=new Dn(p,d.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class gv extends Xn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=this.path===""?uh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new es(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){let l=null;try{l=JSON.parse(c)}catch(h){i!==void 0&&i(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const u=l.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}r.parse(l,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?uh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const r=new es(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);const o=await r.loadAsync(e,t),a=JSON.parse(o),c=a.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(a)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(l)}),a=this.parseTextures(e.textures,o),c=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,r,c,a,n),u=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,u),this.bindLightTargets(l),t!==void 0){let h=!1;for(const d in o)if(o[d].data instanceof HTMLImageElement){h=!0;break}h===!1&&t(l)}return l}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),r=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,r),a=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,i,a,o,t),l=this.parseSkeletons(e.skeletons,c);return this.bindSkeletons(c,l),this.bindLightTargets(c),c}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const r=new er().fromJSON(e[n]);t[r.uuid]=r}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(r){r.isBone&&(i[r.uuid]=r)}),e!==void 0)for(let r=0,o=e.length;r<o;r++){const a=new Jc().fromJSON(e[r],i);n[a.uuid]=a}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new mv;for(let r=0,o=e.length;r<o;r++){let a;const c=e[r];switch(c.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(c);break;default:c.type in Nx?a=Nx[c.type].fromJSON(c,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${c.type}"`)}a.uuid=c.uuid,c.name!==void 0&&(a.name=c.name),c.userData!==void 0&&(a.userData=c.userData),n[c.uuid]=a}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const r=new sl;r.setTextures(t);for(let o=0,a=e.length;o<a;o++){const c=e[o];n[c.uuid]===void 0&&(n[c.uuid]=r.parse(c)),i[c.uuid]=n[c.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],r=aa.parse(i);t[r.uuid]=r}return t}parseImages(e,t){const n=this,i={};let r;function o(c){return n.manager.itemStart(c),r.load(c,function(){n.manager.itemEnd(c)},void 0,function(){n.manager.itemError(c),n.manager.itemEnd(c)})}function a(c){if(typeof c=="string"){const l=c,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l)?l:n.resourcePath+l;return o(u)}else return c.data?{data:ko(c.type,c.data),width:c.width,height:c.height}:null}if(e!==void 0&&e.length>0){const c=new pd(t);r=new Dc(c),r.setCrossOrigin(this.crossOrigin);for(let l=0,u=e.length;l<u;l++){const h=e[l],d=h.url;if(Array.isArray(d)){const p=[];for(let f=0,x=d.length;f<x;f++){const m=d[f],g=a(m);g!==null&&(g instanceof HTMLImageElement?p.push(g):p.push(new Oi(g.data,g.width,g.height)))}i[h.uuid]=new Js(p)}else{const p=a(h.url);i[h.uuid]=new Js(p)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function r(o){if(typeof o=="string"){const a=o,c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await i.loadAsync(c)}else return o.data?{data:ko(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new Dc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const c=e[o],l=c.url;if(Array.isArray(l)){const u=[];for(let h=0,d=l.length;h<d;h++){const p=l[h],f=await r(p);f!==null&&(f instanceof HTMLImageElement?u.push(f):u.push(new Oi(f.data,f.width,f.height)))}n[c.uuid]=new Js(u)}else{const u=await r(c.url);n[c.uuid]=new Js(u)}}}return n}parseTextures(e,t){function n(r,o){return typeof r=="number"?r:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",r),o[r])}const i={};if(e!==void 0)for(let r=0,o=e.length;r<o;r++){const a=e[r];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const c=t[a.image],l=c.data;let u;Array.isArray(l)?(u=new io,l.length===6&&(u.needsUpdate=!0)):(l&&l.data?u=new Oi:u=new Xt,l&&(u.needsUpdate=!0)),u.source=c,u.uuid=a.uuid,a.name!==void 0&&(u.name=a.name),a.mapping!==void 0&&(u.mapping=n(a.mapping,kI)),a.channel!==void 0&&(u.channel=a.channel),a.offset!==void 0&&u.offset.fromArray(a.offset),a.repeat!==void 0&&u.repeat.fromArray(a.repeat),a.center!==void 0&&u.center.fromArray(a.center),a.rotation!==void 0&&(u.rotation=a.rotation),a.wrap!==void 0&&(u.wrapS=n(a.wrap[0],Ix),u.wrapT=n(a.wrap[1],Ix)),a.format!==void 0&&(u.format=a.format),a.internalFormat!==void 0&&(u.internalFormat=a.internalFormat),a.type!==void 0&&(u.type=a.type),a.colorSpace!==void 0&&(u.colorSpace=a.colorSpace),a.minFilter!==void 0&&(u.minFilter=n(a.minFilter,Px)),a.magFilter!==void 0&&(u.magFilter=n(a.magFilter,Px)),a.anisotropy!==void 0&&(u.anisotropy=a.anisotropy),a.flipY!==void 0&&(u.flipY=a.flipY),a.generateMipmaps!==void 0&&(u.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(u.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(u.compareFunction=a.compareFunction),a.userData!==void 0&&(u.userData=a.userData),i[a.uuid]=u}return i}parseObject(e,t,n,i,r){let o;function a(d){return t[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",d),t[d]}function c(d){if(d!==void 0){if(Array.isArray(d)){const p=[];for(let f=0,x=d.length;f<x;f++){const m=d[f];n[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",m),p.push(n[m])}return p}return n[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),n[d]}}function l(d){return i[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",d),i[d]}let u,h;switch(e.type){case"Scene":o=new $h,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new _e(e.background):o.background=l(e.background)),e.environment!==void 0&&(o.environment=l(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new rm(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new qh(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new hn(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new ro(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new xd(e.color,e.intensity);break;case"DirectionalLight":o=new gd(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new md(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new Cm(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new il(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new fd(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new Rm().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),h=c(e.material),o=new cm(u,h),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":u=a(e.geometry),h=c(e.material),o=new kt(u,h);break;case"InstancedMesh":u=a(e.geometry),h=c(e.material);const d=e.count,p=e.instanceMatrix,f=e.instanceColor;o=new lm(u,h,d),o.instanceMatrix=new Us(new Float32Array(p.array),16),f!==void 0&&(o.instanceColor=new Us(new Float32Array(f.array),f.itemSize));break;case"BatchedMesh":u=a(e.geometry),h=c(e.material),o=new um(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,h),o.geometry=u,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._visibility=e.visibility,o._active=e.active,o._bounds=e.bounds.map(x=>{const m=new Hn;m.min.fromArray(x.boxMin),m.max.fromArray(x.boxMax);const g=new Dn;return g.radius=x.sphereRadius,g.center.fromArray(x.sphereCenter),{boxInitialized:x.boxInitialized,box:m,sphereInitialized:x.sphereInitialized,sphere:g}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=l(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=l(e.colorsTexture.uuid));break;case"LOD":o=new am;break;case"Line":o=new Fs(a(e.geometry),c(e.material));break;case"LineLoop":o=new hm(a(e.geometry),c(e.material));break;case"LineSegments":o=new ss(a(e.geometry),c(e.material));break;case"PointCloud":case"Points":o=new dm(a(e.geometry),c(e.material));break;case"Sprite":o=new om(c(e.material));break;case"Group":o=new kr;break;case"Bone":o=new Yh;break;default:o=new yt}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const d=e.children;for(let p=0;p<d.length;p++)o.add(this.parseObject(d[p],t,n,i,r))}if(e.animations!==void 0){const d=e.animations;for(let p=0;p<d.length;p++){const f=d[p];o.animations.push(r[f])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const d=e.levels;for(let p=0;p<d.length;p++){const f=d[p],x=o.getObjectByProperty("uuid",f.object);x!==void 0&&o.addLevel(x,f.distance,f.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new yt}})}}const kI={UVMapping:Ph,CubeReflectionMapping:wi,CubeRefractionMapping:Vi,EquirectangularReflectionMapping:ir,EquirectangularRefractionMapping:sr,CubeUVReflectionMapping:to},Ix={RepeatWrapping:rr,ClampToEdgeWrapping:Si,MirroredRepeatWrapping:jo},Px={NearestFilter:Qt,NearestMipmapNearestFilter:Lh,NearestMipmapLinearFilter:Cs,LinearFilter:Ut,LinearMipmapNearestFilter:js,LinearMipmapLinearFilter:Jn};class xv extends Xn{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=Rs.get(e);if(o!==void 0){if(r.manager.itemStart(e),o.then){o.then(l=>{t&&t(l),r.manager.itemEnd(e)}).catch(l=>{i&&i(l)});return}return setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const c=fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(l){return Rs.add(e,l),t&&t(l),r.manager.itemEnd(e),l}).catch(function(l){i&&i(l),Rs.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});Rs.add(e,c),r.manager.itemStart(e)}}let lu;class _d{static getContext(){return lu===void 0&&(lu=new(window.AudioContext||window.webkitAudioContext)),lu}static setContext(e){lu=e}}class _v extends Xn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new es(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(c){try{const l=c.slice(0);_d.getContext().decodeAudioData(l,function(h){t(h)}).catch(a)}catch(l){a(l)}},n,i);function a(c){i?i(c):console.error(c),r.manager.itemError(e)}}}const Lx=new Fe,Dx=new Fe,Ar=new Fe;class Pm{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new hn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new hn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Ar.copy(e.projectionMatrix);const i=t.eyeSep/2,r=i*t.near/t.focus,o=t.near*Math.tan(Xr*t.fov*.5)/t.zoom;let a,c;Dx.elements[12]=-i,Lx.elements[12]=i,a=-o*t.aspect+r,c=o*t.aspect+r,Ar.elements[0]=2*t.near/(c-a),Ar.elements[8]=(c+a)/(c-a),this.cameraL.projectionMatrix.copy(Ar),a=-o*t.aspect-r,c=o*t.aspect-r,Ar.elements[0]=2*t.near/(c-a),Ar.elements[8]=(c+a)/(c-a),this.cameraR.projectionMatrix.copy(Ar)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Dx),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Lx)}}class Lm{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Ux(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Ux();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Ux(){return performance.now()}const as=new E,Fx=new Qn,GI=new E,Nr=new E;let yv=class extends yt{constructor(){super(),this.type="AudioListener",this.context=_d.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Lm}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(as,Fx,GI),!(!Number.isFinite(as.x)||!Number.isFinite(as.y)||!Number.isFinite(as.z)))if(Nr.set(0,0,-1).applyQuaternion(Fx),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(as.x,i),t.positionY.linearRampToValueAtTime(as.y,i),t.positionZ.linearRampToValueAtTime(as.z,i),t.forwardX.linearRampToValueAtTime(Nr.x,i),t.forwardY.linearRampToValueAtTime(Nr.y,i),t.forwardZ.linearRampToValueAtTime(Nr.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(as.x,as.y,as.z),t.setOrientation(Nr.x,Nr.y,Nr.z,n.x,n.y,n.z)}};class Dm extends yt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||(this.buffer?this.buffer.duration:Number.MAX_VALUE))),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const Er=new E,Ox=new Qn,HI=new E,Cr=new E;class vv extends Dm{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Er,Ox,HI),Cr.set(0,0,1).applyQuaternion(Ox);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Er.x,n),t.positionY.linearRampToValueAtTime(Er.y,n),t.positionZ.linearRampToValueAtTime(Er.z,n),t.orientationX.linearRampToValueAtTime(Cr.x,n),t.orientationY.linearRampToValueAtTime(Cr.y,n),t.orientationZ.linearRampToValueAtTime(Cr.z,n)}else t.setPosition(Er.x,Er.y,Er.z),t.setOrientation(Cr.x,Cr.y,Cr.z)}}class WI{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class Mv{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,o;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,r=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)n[r+a]=n[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(n,r,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const c=t*this._origIndex;this._mixBufferRegion(n,i,c,1-r,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,o=i;r!==o;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let o=0;o!==r;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){Qn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const o=this._workIndex*r;Qn.multiplyQuaternionsFlat(e,o,e,t,e,n),Qn.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,r){const o=1-i;for(let a=0;a!==r;++a){const c=t+a;e[c]=e[c]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,r){for(let o=0;o!==r;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const Um="\\[\\]\\.:\\/",XI=new RegExp("["+Um+"]","g"),Fm="[^"+Um+"]",qI="[^"+Um.replace("\\.","")+"]",$I=/((?:WC+[\/:])*)/.source.replace("WC",Fm),YI=/(WCOD+)?/.source.replace("WCOD",qI),ZI=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Fm),JI=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Fm),KI=new RegExp("^"+$I+YI+ZI+JI+"$"),jI=["material","materials","bones","map"];class QI{constructor(e,t,n){const i=n||St.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class St{constructor(e,t,n){this.path=t,this.parsedPath=n||St.parseTrackName(t),this.node=St.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new St.Composite(e,t,n):new St(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(XI,"")}static parseTrackName(e){const t=KI.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const r=n.nodeName.substring(i+1);jI.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(r,o){for(let a=0;a<r.length;a++){const c=r[a];if(!o&&(c.name===t||c.uuid===t))return c;if(o&&c.userData&&c.userData.name===t)return c;const l=n(c.children,o);if(l)return l}return null},i=n(e.children);if(i)return i;{const r=n(e.children,!0);if(r)return r}}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=St.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===l){l=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}const o=e[i];if(o===void 0){const l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}St.Composite=QI;St.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};St.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};St.prototype.GetterByBindingType=[St.prototype._getValue_direct,St.prototype._getValue_array,St.prototype._getValue_arrayElement,St.prototype._getValue_toArray];St.prototype.SetterByBindingTypeAndVersioning=[[St.prototype._setValue_direct,St.prototype._setValue_direct_setNeedsUpdate,St.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[St.prototype._setValue_array,St.prototype._setValue_array_setNeedsUpdate,St.prototype._setValue_array_setMatrixWorldNeedsUpdate],[St.prototype._setValue_arrayElement,St.prototype._setValue_arrayElement_setNeedsUpdate,St.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[St.prototype._setValue_fromArray,St.prototype._setValue_fromArray_setNeedsUpdate,St.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class eP{constructor(){this.isAnimationObjectGroup=!0,this.uuid=bi(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,o=r.length;let a,c=e.length,l=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const d=arguments[u],p=d.uuid;let f=t[p];if(f===void 0){f=c++,t[p]=f,e.push(d);for(let x=0,m=o;x!==m;++x)r[x].push(new St(d,n[x],i[x]))}else if(f<l){a=e[f];const x=--l,m=e[x];t[m.uuid]=f,e[f]=m,t[p]=x,e[x]=d;for(let g=0,y=o;g!==y;++g){const _=r[g],v=_[x];let I=_[f];_[f]=v,I===void 0&&(I=new St(d,n[g],i[g])),_[x]=I}}else e[f]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const c=arguments[o],l=c.uuid,u=t[l];if(u!==void 0&&u>=r){const h=r++,d=e[h];t[d.uuid]=u,e[u]=d,t[l]=h,e[h]=c;for(let p=0,f=i;p!==f;++p){const x=n[p],m=x[h],g=x[u];x[u]=m,x[h]=g}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,o=e.length;for(let a=0,c=arguments.length;a!==c;++a){const l=arguments[a],u=l.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<r){const d=--r,p=e[d],f=--o,x=e[f];t[p.uuid]=h,e[h]=p,t[x.uuid]=d,e[d]=x,e.pop();for(let m=0,g=i;m!==g;++m){const y=n[m],_=y[d],v=y[f];y[h]=_,y[d]=v,y.pop()}}else{const d=--o,p=e[d];d>0&&(t[p.uuid]=h),e[h]=p,e.pop();for(let f=0,x=i;f!==x;++f){const m=n[f];m[h]=m[d],m.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(i!==void 0)return r[i];const o=this._paths,a=this._parsedPaths,c=this._objects,l=c.length,u=this.nCachedObjects_,h=new Array(l);i=r.length,n[e]=i,o.push(e),a.push(t),r.push(h);for(let d=u,p=c.length;d!==p;++d){const f=c[d];h[d]=new St(f,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,c=o[a],l=e[a];t[l]=n,o[n]=c,o.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}class Sv{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,o=r.length,a=new Array(o),c={endingStart:Vr,endingEnd:Vr};for(let l=0;l!==o;++l){const u=r[l].createInterpolant(null);a[l]=u,u.settings=c}this._interpolantSettings=c,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=qf,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&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,r=e._clip.duration,o=r/i,a=i/r;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const c=a.parameterPositions,l=a.sampleValues;return c[0]=r,c[1]=r+n,l[0]=e/o,l[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const c=(e-r)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case $f:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulateAdditive(a);break;case Vh:default:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const o=n===ly;if(e===0)return r===-1?i:o&&(r&1)===1?t-i:i;if(n===Xf){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,r+=Math.abs(a);const c=this.repetitions-r;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const l=e<0;this._setEndings(l,!l,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Br,i.endingEnd=Br):(e?i.endingStart=this.zeroSlopeAtStart?Br:Vr:i.endingStart=wc,t?i.endingEnd=this.zeroSlopeAtEnd?Br:Vr:i.endingEnd=wc)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,c=o.sampleValues;return a[0]=r,c[0]=t,a[1]=r+e,c[1]=n,this}}const tP=new Float32Array(1);class Tv extends Ai{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,o=e._propertyBindings,a=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName;let u=l[c];u===void 0&&(u={},l[c]=u);for(let h=0;h!==r;++h){const d=i[h],p=d.name;let f=u[p];if(f!==void 0)++f.referenceCount,o[h]=f;else{if(f=o[h],f!==void 0){f._cacheIndex===null&&(++f.referenceCount,this._addInactiveBinding(f,c,p));continue}const x=t&&t._propertyBindings[h].binding.parsedPath;f=new Mv(St.create(n,p,x),d.ValueTypeName,d.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,c,p),o[h]=f}a[h].resultBuffer=f.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,r=this._actionsByClip;let o=r[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const r=e._clip.uuid,o=this._actionsByClip,a=o[r],c=a.knownActions,l=c[c.length-1],u=e._byClipCacheIndex;l._byClipCacheIndex=u,c[u]=l,c.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,d=(e._localRoot||this._root).uuid;delete h[d],c.length===0&&delete o[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,o=this._bindingsByRootAndName,a=o[i],c=t[t.length-1],l=e._cacheIndex;c._cacheIndex=l,t[l]=c,t.pop(),delete a[r],Object.keys(a).length===0&&delete o[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Am(new Float32Array(2),new Float32Array(2),1,tP),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let o=typeof e=="string"?aa.findByName(i,e):e;const a=o!==null?o.uuid:e,c=this._actionsByClip[a];let l=null;if(n===void 0&&(o!==null?n=o.blendMode:n=Vh),c!==void 0){const h=c.actionByRoot[r];if(h!==void 0&&h.blendMode===n)return h;l=c.knownActions[0],o===null&&(o=l._clip)}if(o===null)return null;const u=new Sv(this,o,t,n);return this._bindAction(u,l),this._addInactiveAction(u,a,r),u}existingAction(e,t){const n=t||this._root,i=n.uuid,r=typeof e=="string"?aa.findByName(n,e):e,o=r?r.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,r,o);const a=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)a[l].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){const o=r.knownActions;for(let a=0,c=o.length;a!==c;++a){const l=o[a];this._deactivateAction(l);const u=l._cacheIndex,h=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const a=n[o].actionByRoot,c=a[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const i=this._bindingsByRootAndName,r=i[t];if(r!==void 0)for(const o in r){const a=r[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}let bv=class wv{constructor(e){this.value=e}clone(){return new wv(this.value.clone===void 0?this.value:this.value.clone())}},nP=0;class iP extends Ai{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:nP++}),this.name="",this.usage=na,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const r=Array.isArray(t[n])?t[n]:[t[n]];for(let o=0;o<r.length;o++)this.uniforms.push(r[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class Om extends xa{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class sP{constructor(e,t,n,i,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Vx=new Fe;class Av{constructor(e,t,n=0,i=1/0){this.ray=new no(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new $c,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Vx.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Vx),this}intersectObject(e,t=!0,n=[]){return hf(e,this,n,t),n.sort(Bx),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)hf(e[i],this,n,t);return n.sort(Bx),n}}function Bx(s,e){return s.distance-e.distance}function hf(s,e,t,n){let i=!0;if(s.layers.test(e.layers)&&s.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const r=s.children;for(let o=0,a=r.length;o<a;o++)hf(r[o],e,t,!0)}}class Nv{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(jt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class rP{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class Vm{constructor(e,t,n,i){Vm.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}}const zx=new J;class oP{constructor(e=new J(1/0,1/0),t=new J(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=zx.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,zx).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const kx=new E,uu=new E;class Ev{constructor(e=new E,t=new E){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){kx.subVectors(e,this.start),uu.subVectors(this.end,this.start);const n=uu.dot(uu);let r=uu.dot(kx)/n;return t&&(r=jt(r,0,1)),r}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Gx=new E;class aP extends yt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new at,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,c=32;o<c;o++,a++){const l=o/c*Math.PI*2,u=a/c*Math.PI*2;i.push(Math.cos(l),Math.sin(l),1,Math.cos(u),Math.sin(u),1)}n.setAttribute("position",new Ve(i,3));const r=new Fn({fog:!1,toneMapped:!1});this.cone=new ss(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Gx.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Gx),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const qs=new E,hu=new Fe,Rp=new Fe;class cP extends ss{constructor(e){const t=Cv(e),n=new at,i=[],r=[],o=new _e(0,0,1),a=new _e(0,1,0);for(let l=0;l<t.length;l++){const u=t[l];u.parent&&u.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(o.r,o.g,o.b),r.push(a.r,a.g,a.b))}n.setAttribute("position",new Ve(i,3)),n.setAttribute("color",new Ve(r,3));const c=new Fn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,c),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Rp.copy(this.root.matrixWorld).invert();for(let r=0,o=0;r<t.length;r++){const a=t[r];a.parent&&a.parent.isBone&&(hu.multiplyMatrices(Rp,a.matrixWorld),qs.setFromMatrixPosition(hu),i.setXYZ(o,qs.x,qs.y,qs.z),hu.multiplyMatrices(Rp,a.parent.matrixWorld),qs.setFromMatrixPosition(hu),i.setXYZ(o+1,qs.x,qs.y,qs.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Cv(s){const e=[];s.isBone===!0&&e.push(s);for(let t=0;t<s.children.length;t++)e.push.apply(e,Cv(s.children[t]));return e}class lP extends kt{constructor(e,t,n){const i=new va(t,4,2),r=new is({wireframe:!0,fog:!1,toneMapped:!1});super(i,r),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const uP=new E,Hx=new _e,Wx=new _e;class hP extends yt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new ya(t);i.rotateY(Math.PI*.5),this.material=new is({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),o=new Float32Array(r.count*3);i.setAttribute("color",new At(o,3)),this.add(new kt(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Hx.copy(this.light.color),Wx.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const r=n<i/2?Hx:Wx;t.setXYZ(n,r.r,r.g,r.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(uP.setFromMatrixPosition(this.light.matrixWorld).negate())}}let Rv=class extends ss{constructor(e=10,t=10,n=4473924,i=8947848){n=new _e(n),i=new _e(i);const r=t/2,o=e/t,a=e/2,c=[],l=[];for(let d=0,p=0,f=-a;d<=t;d++,f+=o){c.push(-a,0,f,a,0,f),c.push(f,0,-a,f,0,a);const x=d===r?n:i;x.toArray(l,p),p+=3,x.toArray(l,p),p+=3,x.toArray(l,p),p+=3,x.toArray(l,p),p+=3}const u=new at;u.setAttribute("position",new Ve(c,3)),u.setAttribute("color",new Ve(l,3));const h=new Fn({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}};class dP extends ss{constructor(e=10,t=16,n=8,i=64,r=4473924,o=8947848){r=new _e(r),o=new _e(o);const a=[],c=[];if(t>1)for(let h=0;h<t;h++){const d=h/t*(Math.PI*2),p=Math.sin(d)*e,f=Math.cos(d)*e;a.push(0,0,0),a.push(p,0,f);const x=h&1?r:o;c.push(x.r,x.g,x.b),c.push(x.r,x.g,x.b)}for(let h=0;h<n;h++){const d=h&1?r:o,p=e-e/n*h;for(let f=0;f<i;f++){let x=f/i*(Math.PI*2),m=Math.sin(x)*p,g=Math.cos(x)*p;a.push(m,0,g),c.push(d.r,d.g,d.b),x=(f+1)/i*(Math.PI*2),m=Math.sin(x)*p,g=Math.cos(x)*p,a.push(m,0,g),c.push(d.r,d.g,d.b)}}const l=new at;l.setAttribute("position",new Ve(a,3)),l.setAttribute("color",new Ve(c,3));const u=new Fn({vertexColors:!0,toneMapped:!1});super(l,u),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Xx=new E,du=new E,qx=new E;class Iv extends yt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new at;i.setAttribute("position",new Ve([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new Fn({fog:!1,toneMapped:!1});this.lightPlane=new Fs(i,r),this.add(this.lightPlane),i=new at,i.setAttribute("position",new Ve([0,0,0,0,0,1],3)),this.targetLine=new Fs(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Xx.setFromMatrixPosition(this.light.matrixWorld),du.setFromMatrixPosition(this.light.target.matrixWorld),qx.subVectors(du,Xx),this.lightPlane.lookAt(du),this.color!==void 0?(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(du),this.targetLine.scale.z=qx.length()}}const pu=new E,Kt=new Yc;class Pv extends ss{constructor(e){const t=new at,n=new Fn({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(f,x){c(f),c(x)}function c(f){i.push(0,0,0),r.push(0,0,0),o[f]===void 0&&(o[f]=[]),o[f].push(i.length/3-1)}t.setAttribute("position",new Ve(i,3)),t.setAttribute("color",new Ve(r,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const l=new _e(16755200),u=new _e(16711680),h=new _e(43775),d=new _e(16777215),p=new _e(3355443);this.setColors(l,u,h,d,p)}setColors(e,t,n,i,r){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,r.r,r.g,r.b),a.setXYZ(41,r.r,r.g,r.b),a.setXYZ(42,r.r,r.g,r.b),a.setXYZ(43,r.r,r.g,r.b),a.setXYZ(44,r.r,r.g,r.b),a.setXYZ(45,r.r,r.g,r.b),a.setXYZ(46,r.r,r.g,r.b),a.setXYZ(47,r.r,r.g,r.b),a.setXYZ(48,r.r,r.g,r.b),a.setXYZ(49,r.r,r.g,r.b),a.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;Kt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),nn("c",t,e,Kt,0,0,-1),nn("t",t,e,Kt,0,0,1),nn("n1",t,e,Kt,-1,-1,-1),nn("n2",t,e,Kt,n,-1,-1),nn("n3",t,e,Kt,-1,i,-1),nn("n4",t,e,Kt,n,i,-1),nn("f1",t,e,Kt,-1,-1,1),nn("f2",t,e,Kt,n,-1,1),nn("f3",t,e,Kt,-1,i,1),nn("f4",t,e,Kt,n,i,1),nn("u1",t,e,Kt,n*.7,i*1.1,-1),nn("u2",t,e,Kt,-1*.7,i*1.1,-1),nn("u3",t,e,Kt,0,i*2,-1),nn("cf1",t,e,Kt,-1,0,1),nn("cf2",t,e,Kt,n,0,1),nn("cf3",t,e,Kt,0,-1,1),nn("cf4",t,e,Kt,0,i,1),nn("cn1",t,e,Kt,-1,0,-1),nn("cn2",t,e,Kt,n,0,-1),nn("cn3",t,e,Kt,0,-1,-1),nn("cn4",t,e,Kt,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function nn(s,e,t,n,i,r,o){pu.set(i,r,o).unproject(n);const a=e[s];if(a!==void 0){const c=t.getAttribute("position");for(let l=0,u=a.length;l<u;l++)c.setXYZ(a[l],pu.x,pu.y,pu.z)}}const fu=new Hn;class Lv extends ss{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),r=new at;r.setIndex(new At(n,1)),r.setAttribute("position",new At(i,3)),super(r,new Fn({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&fu.setFromObject(this.object),fu.isEmpty())return;const t=fu.min,n=fu.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Dv extends ss{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],r=new at;r.setIndex(new At(n,1)),r.setAttribute("position",new Ve(i,3)),super(r,new Fn({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class pP extends Fs{constructor(e,t=1,n=16776960){const i=n,r=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new at;o.setAttribute("position",new Ve(r,3)),o.computeBoundingSphere(),super(o,new Fn({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],c=new at;c.setAttribute("position",new Ve(a,3)),c.computeBoundingSphere(),this.add(new kt(c,new is({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const $x=new E;let mu,Ip;class fP extends yt{constructor(e=new E(0,0,1),t=new E(0,0,0),n=1,i=16776960,r=n*.2,o=r*.2){super(),this.type="ArrowHelper",mu===void 0&&(mu=new at,mu.setAttribute("position",new Ve([0,0,0,0,1,0],3)),Ip=new ao(0,.5,1,5,1),Ip.translate(0,-.5,0)),this.position.copy(t),this.line=new Fs(mu,new Fn({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new kt(Ip,new is({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{$x.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle($x,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}let Uv=class extends ss{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new at;i.setAttribute("position",new Ve(t,3)),i.setAttribute("color",new Ve(n,3));const r=new Fn({vertexColors:!0,toneMapped:!1});super(i,r),this.type="AxesHelper"}setColors(e,t,n){const i=new _e,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}};class Fv{constructor(){this.type="ShapePath",this.color=new _e,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Rc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,o){return this.currentPath.bezierCurveTo(e,t,n,i,r,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(g){const y=[];for(let _=0,v=g.length;_<v;_++){const I=g[_],T=new er;T.curves=I.curves,y.push(T)}return y}function n(g,y){const _=y.length;let v=!1;for(let I=_-1,T=0;T<_;I=T++){let w=y[I],C=y[T],F=C.x-w.x,M=C.y-w.y;if(Math.abs(M)>Number.EPSILON){if(M<0&&(w=y[T],F=-F,C=y[I],M=-M),g.y<w.y||g.y>C.y)continue;if(g.y===w.y){if(g.x===w.x)return!0}else{const b=M*(g.x-w.x)-F*(g.y-w.y);if(b===0)return!0;if(b<0)continue;v=!v}}else{if(g.y!==w.y)continue;if(C.x<=g.x&&g.x<=w.x||w.x<=g.x&&g.x<=C.x)return!0}}return v}const i=Ki.isClockWise,r=this.subPaths;if(r.length===0)return[];let o,a,c;const l=[];if(r.length===1)return a=r[0],c=new er,c.curves=a.curves,l.push(c),l;let u=!i(r[0].getPoints());u=e?!u:u;const h=[],d=[];let p=[],f=0,x;d[f]=void 0,p[f]=[];for(let g=0,y=r.length;g<y;g++)a=r[g],x=a.getPoints(),o=i(x),o=e?!o:o,o?(!u&&d[f]&&f++,d[f]={s:new er,p:x},d[f].s.curves=a.curves,u&&f++,p[f]=[]):p[f].push({h:a,p:x[0]});if(!d[0])return t(r);if(d.length>1){let g=!1,y=0;for(let _=0,v=d.length;_<v;_++)h[_]=[];for(let _=0,v=d.length;_<v;_++){const I=p[_];for(let T=0;T<I.length;T++){const w=I[T];let C=!0;for(let F=0;F<d.length;F++)n(w.p,d[F].p)&&(_!==F&&y++,C?(C=!1,h[F].push(w)):g=!0);C&&h[_].push(w)}}y>0&&g===!1&&(p=h)}let m;for(let g=0,y=d.length;g<y;g++){c=d[g].s,l.push(c),m=p[g];for(let _=0,v=m.length;_<v;_++)c.holes.push(m[_].h)}return l}}class Ov extends Ai{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}class mP extends zi{constructor(e=1,t=1,n=1,i={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,t,{...i,count:n}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}const gP=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveMap","envMap","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"];class Vv{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=gP,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}getRenderObjectData(e){let t=this.renderObjects.get(e);return t===void 0&&(t={material:this.getMaterialData(e.material),worldMatrix:e.object.matrixWorld.clone()},e.object.center&&(t.center=e.object.center.clone()),e.object.morphTargetInfluences&&(t.morphTargetInfluences=e.object.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),this.renderObjects.set(e,t)),t}containsNode(e){const t=e.material;for(const n in t)if(t[n]&&t[n].isNode)return!0;return e.renderer.nodes.modelViewMatrix!==null||e.renderer.nodes.modelNormalViewMatrix!==null}getMaterialData(e){const t={};for(const n of this.refreshUniforms){const i=e[n];i!=null&&(typeof i=="object"&&i.clone!==void 0?i.isTexture===!0?t[n]={id:i.id,version:i.version}:t[n]=i.clone():t[n]=i)}return t}equals(e){const{object:t,material:n}=e,i=this.getRenderObjectData(e);if(i.worldMatrix.equals(t.matrixWorld)!==!0)return i.worldMatrix.copy(t.matrixWorld),!1;const r=i.material;for(const o in r){const a=r[o],c=n[o];if(a.equals!==void 0){if(a.equals(c)===!1)return a.copy(c),!1}else if(c.isTexture===!0){if(a.id!==c.id||a.version!==c.version)return a.id=c.id,a.version=c.version,!1}else if(a!==c)return r[o]=c,!1}if(i.morphTargetInfluences){let o=!1;for(let a=0;a<i.morphTargetInfluences.length;a++)i.morphTargetInfluences[a]!==t.morphTargetInfluences[a]&&(o=!0);if(o)return!0}return i.center&&i.center.equals(t.center)===!1?(i.center.copy(t.center),!0):(e.bundle!==null&&(i.version=e.bundle.version),!0)}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e))return!0;const{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;const i=e.object.static===!0,r=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;return i||r?!1:this.equals(e)!==!0}}function Uc(s,e=0){let t=3735928559^e,n=1103547991^e;if(s instanceof Array)for(let i=0,r;i<s.length;i++)r=s[i],t=Math.imul(t^r,2654435761),n=Math.imul(n^r,1597334677);else for(let i=0,r;i<s.length;i++)r=s.charCodeAt(i),t=Math.imul(t^r,2654435761),n=Math.imul(n^r,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}const Bv=s=>Uc(s),zv=s=>Uc(s),Bm=(...s)=>Uc(s);function zm(s,e=!1){const t=[];s.isNode===!0&&(t.push(s.id),s=s.getSelf());for(const{property:n,childNode:i}of Fc(s))t.push(t,Uc(n.slice(0,-4)),i.getCacheKey(e));return Uc(t)}function*Fc(s,e=!1){for(const t in s){if(t.startsWith("_")===!0)continue;const n=s[t];if(Array.isArray(n)===!0)for(let i=0;i<n.length;i++){const r=n[i];r&&(r.isNode===!0||e&&typeof r.toJSON=="function")&&(yield{property:t,index:i,childNode:r})}else if(n&&n.isNode===!0)yield{property:t,childNode:n};else if(typeof n=="object")for(const i in n){const r=n[i];r&&(r.isNode===!0||e&&typeof r.toJSON=="function")&&(yield{property:t,index:i,childNode:r})}}}function Is(s){if(s==null)return null;const e=typeof s;return s.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":s.isVector2===!0?"vec2":s.isVector3===!0?"vec3":s.isVector4===!0?"vec4":s.isMatrix3===!0?"mat3":s.isMatrix4===!0?"mat4":s.isColor===!0?"color":s instanceof ArrayBuffer?"ArrayBuffer":null}function km(s,...e){const t=s?s.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),s==="color"?new _e(...e):t==="vec2"?new J(...e):t==="vec3"?new E(...e):t==="vec4"?new st(...e):t==="mat3"?new Ke(...e):t==="mat4"?new Fe(...e):s==="bool"?e[0]||!1:s==="float"||s==="int"||s==="uint"?e[0]||0:s==="string"?e[0]||"":s==="ArrayBuffer"?Hm(e[0]):null}function Gm(s){let e="";const t=new Uint8Array(s);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function Hm(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0)).buffer}var xP=Object.freeze({__proto__:null,arrayBufferToBase64:Gm,base64ToArrayBuffer:Hm,getCacheKey:zm,getNodeChildren:Fc,getValueFromType:km,getValueType:Is,hash:Bm,hashArray:zv,hashString:Bv});const df={VERTEX:"vertex",FRAGMENT:"fragment"},We={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},_P={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Wm=["fragment","vertex"],pf=["setup","analyze","generate"],ff=[...Wm,"compute"],Ta=["x","y","z","w"];let yP=0;class Ye extends Ai{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=We.NONE,this.updateBeforeType=We.NONE,this.updateAfterType=We.NONE,this.uuid=Bh.generateUUID(),this.version=0,this._cacheKey=null,this._cacheKeyVersion=0,this.global=!1,this.isNode=!0,Object.defineProperty(this,"id",{value:yP++})}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this.getSelf()),this}onFrameUpdate(e){return this.onUpdate(e,We.FRAME)}onRenderUpdate(e){return this.onUpdate(e,We.RENDER)}onObjectUpdate(e){return this.onUpdate(e,We.OBJECT)}onReference(e){return this.updateReference=e.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of Fc(this))yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}getCacheKey(e=!1){return e=e||this.version!==this._cacheKeyVersion,(e===!0||this._cacheKey===null)&&(this._cacheKey=zm(this,e),this._cacheKeyVersion=this.version),this._cacheKey}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){const t=this.getNodeType(e);return e.getElementType(t)}getNodeType(e){const t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){const t=this.getHash(e);return e.getNodeFromHash(t)||this}setup(e){const t=e.getNodeProperties(this);let n=0;for(const i of this.getChildren())t["node"+n++]=i;return null}analyze(e){if(e.increaseUsage(this)===1){const n=e.getNodeProperties(this);for(const i of Object.values(n))i&&i.isNode===!0&&i.build(e)}}generate(e,t){const{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){console.warn("Abstract function.")}updateAfter(){console.warn("Abstract function.")}update(){console.warn("Abstract function.")}build(e,t=null){const n=this.getShared(e);if(this!==n)return n.build(e,t);e.addNode(this),e.addChain(this);let i=null;const r=e.getBuildStage();if(r==="setup"){this.updateReference(e);const o=e.getNodeProperties(this);if(o.initialized!==!0){const a=e.stack.nodes.length;o.initialized=!0,o.outputNode=this.setup(e),o.outputNode!==null&&e.stack.nodes.length;for(const c of Object.values(o))c&&c.isNode===!0&&c.build(e)}}else if(r==="analyze")this.analyze(e);else if(r==="generate")if(this.generate.length===1){const a=this.getNodeType(e),c=e.getDataFromNode(this);i=c.snippet,i===void 0?(i=this.generate(e)||"",c.snippet=i):c.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),i=e.format(i,a,t)}else i=this.generate(e,t)||"";return e.removeChain(this),i}getSerializeChildren(){return Fc(this)}serialize(e){const t=this.getSerializeChildren(),n={};for(const{property:i,index:r,childNode:o}of t)r!==void 0?(n[i]===void 0&&(n[i]=Number.isInteger(r)?[]:{}),n[i][r]=o.toJSON(e.meta).uuid):n[i]=o.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){const t=e.meta.nodes;for(const n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){const i=[];for(const r of e.inputNodes[n])i.push(t[r]);this[n]=i}else if(typeof e.inputNodes[n]=="object"){const i={};for(const r in e.inputNodes[n]){const o=e.inputNodes[n][r];i[r]=t[o]}this[n]=i}else{const i=e.inputNodes[n];this[n]=t[i]}}}toJSON(e){const{uuid:t,type:n}=this,i=e===void 0||typeof e=="string";i&&(e={textures:{},images:{},nodes:{}});let r=e.nodes[t];r===void 0&&(r={uuid:t,type:n,meta:e,metadata:{version:4.6,type:"Node",generator:"Node.toJSON"}},i!==!0&&(e.nodes[r.uuid]=r),this.serialize(r),delete r.meta);function o(a){const c=[];for(const l in a){const u=a[l];delete u.metadata,c.push(u)}return c}if(i){const a=o(e.textures),c=o(e.images),l=o(e.nodes);a.length>0&&(r.textures=a),c.length>0&&(r.images=c),l.length>0&&(r.nodes=l)}return r}}class pr extends Ye{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}generate(e){const t=this.node.build(e),n=this.indexNode.build(e,"uint");return`${t}[ ${n} ]`}}class Xm extends Ye{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){const t=this.node.getNodeType(e);let n=null;for(const i of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(i))&&(n=i);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const n=this.node,i=this.getNodeType(e),r=n.build(e,i);return e.format(r,i,t)}}class pt extends Ye{static get type(){return"TempNode"}constructor(e){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){const i=e.getVectorType(this.getNodeType(e,t)),r=e.getDataFromNode(this);if(r.propertyName!==void 0)return e.format(r.propertyName,i,t);if(i!=="void"&&t!=="void"&&this.hasDependencies(e)){const o=super.build(e,i),a=e.getVarFromNode(this,null,i),c=e.getPropertyName(a);return e.addLineFlowCode(`${c} = ${o}`,this),r.snippet=o,r.propertyName=c,e.format(r.propertyName,i,t)}}return super.build(e,t)}}class kv extends pt{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){const n=this.getNodeType(e),i=this.nodes,r=e.getComponentType(n),o=[];for(const c of i){let l=c.build(e);const u=e.getComponentType(c.getNodeType(e));u!==r&&(l=e.format(l,u,r)),o.push(l)}const a=`${e.getType(n)}( ${o.join(", ")} )`;return e.format(a,n,t)}}const vP=Ta.join("");class hh extends Ye{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(Ta.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}generate(e,t){const n=this.node,i=e.getTypeLength(n.getNodeType(e));let r=null;if(i>1){let o=null;this.getVectorLength()>=i&&(o=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const c=n.build(e,o);this.components.length===i&&this.components===vP.slice(0,this.components.length)?r=e.format(c,o,t):r=e.format(`${c}.${this.components}`,this.getNodeType(e),t)}else r=n.build(e,t);return r}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class Gv extends pt{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:n,targetNode:i}=this,r=this.getNodeType(e),o=e.getTypeFromLength(n.length,i.getNodeType(e)),a=i.build(e,o),c=t.build(e,r),l=e.getTypeLength(r),u=[];for(let h=0;h<l;h++){const d=Ta[h];d===n[0]?(u.push(a),h+=n.length-1):u.push(c+"."+d)}return`${e.getType(r)}( ${u.join(", ")} )`}}class MP extends pt{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{components:t,sourceNode:n}=this,i=this.getNodeType(e),r=n.build(e),o=e.getVarFromNode(this),a=e.getPropertyName(o);e.addLineFlowCode(a+" = "+r,this);const c=e.getTypeLength(i),l=[];let u=0;for(let h=0;h<c;h++){const d=Ta[h];d===t[u]?(l.push("1.0 - "+(a+"."+d)),u++):l.push(a+"."+d)}return`${e.getType(i)}( ${l.join(", ")} )`}}class qm extends Ye{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return this.nodeType===null?Is(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=Is(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=Gm(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?km(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){console.warn("Abstract function.")}}class Hi extends qm{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){const n=this.getNodeType(e);return e.format(this.generateConst(e),n,t)}}let ca=null;const Wo=new Map;function te(s,e){if(Wo.has(s)){console.warn(`Redefinition of method chaining ${s}`);return}if(typeof e!="function")throw new Error(`Node element ${s} is not a function`);Wo.set(s,e)}const Hv=s=>s.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),Yx=s=>Hv(s).split("").sort().join(""),Wv={setup(s,e){const t=e.shift();return s(rl(t),...e)},get(s,e,t){if(typeof e=="string"&&s[e]===void 0){if(s.isStackNode!==!0&&e==="assign")return(...n)=>(ca.assign(t,...n),t);if(Wo.has(e)){const n=Wo.get(e);return s.isStackNode?(...i)=>t.add(n(...i)):(...i)=>n(t,...i)}else{if(e==="self")return s;if(e.endsWith("Assign")&&Wo.has(e.slice(0,e.length-6))){const n=Wo.get(e.slice(0,e.length-6));return s.isStackNode?(...i)=>t.assign(i[0],n(...i)):(...i)=>t.assign(n(t,...i))}else{if(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0)return e=Hv(e),H(new hh(t,e));if(/^set[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=Yx(e.slice(3).toLowerCase()),n=>H(new Gv(s,e,n));if(/^flip[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=Yx(e.slice(4).toLowerCase()),()=>H(new MP(H(s),e));if(e==="width"||e==="height"||e==="depth")return e==="width"?e="x":e==="height"?e="y":e==="depth"&&(e="z"),H(new hh(s,e));if(/^\d+$/.test(e)===!0)return H(new pr(t,new Hi(Number(e),"uint")))}}}return Reflect.get(s,e,t)},set(s,e,t,n){return typeof e=="string"&&s[e]===void 0&&(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0||e==="width"||e==="height"||e==="depth"||/^\d+$/.test(e)===!0)?(n[e].assign(t),!0):Reflect.set(s,e,t,n)}},Pp=new WeakMap,Zx=new WeakMap,SP=function(s,e=null){const t=Is(s);if(t==="node"){let n=Pp.get(s);return n===void 0&&(n=new Proxy(s,Wv),Pp.set(s,n),Pp.set(n,n)),n}else{if(e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string")return H(mf(s,e));if(t==="shader")return U(s)}return s},TP=function(s,e=null){for(const t in s)s[t]=H(s[t],e);return s},bP=function(s,e=null){const t=s.length;for(let n=0;n<t;n++)s[n]=H(s[n],e);return s},wP=function(s,e=null,t=null,n=null){const i=r=>H(n!==null?Object.assign(r,n):r);return e===null?(...r)=>i(new s(...qr(r))):t!==null?(t=H(t),(...r)=>i(new s(e,...qr(r),t))):(...r)=>i(new s(e,...qr(r)))},AP=function(s,...e){return H(new s(...qr(e)))};class NP extends Ye{constructor(e,t){super(),this.shaderNode=e,this.inputNodes=t}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}call(e){const{shaderNode:t,inputNodes:n}=this,i=e.getNodeProperties(t);if(i.onceOutput)return i.onceOutput;let r=null;if(t.layout){let o=Zx.get(e.constructor);o===void 0&&(o=new WeakMap,Zx.set(e.constructor,o));let a=o.get(t);a===void 0&&(a=H(e.buildFunctionNode(t)),o.set(t,a)),e.currentFunctionNode!==null&&e.currentFunctionNode.includes.push(a),r=H(a.call(n))}else{const o=t.jsFunc,a=n!==null?o(n,e):o(e);r=H(a)}return t.once&&(i.onceOutput=r),r}getOutputNode(e){const t=e.getNodeProperties(this);return t.outputNode===null&&(t.outputNode=this.setupOutput(e)),t.outputNode}setup(e){return this.getOutputNode(e)}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}generate(e,t){return this.getOutputNode(e).build(e,t)}}class EP extends Ye{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}call(e=null){return rl(e),H(new NP(this,e))}setup(){return this.call()}}const CP=[!1,!0],RP=[0,1,2,3],IP=[-1,-2],Xv=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],$m=new Map;for(const s of CP)$m.set(s,new Hi(s));const Ym=new Map;for(const s of RP)Ym.set(s,new Hi(s,"uint"));const Zm=new Map([...Ym].map(s=>new Hi(s.value,"int")));for(const s of IP)Zm.set(s,new Hi(s,"int"));const yd=new Map([...Zm].map(s=>new Hi(s.value)));for(const s of Xv)yd.set(s,new Hi(s));for(const s of Xv)yd.set(-s,new Hi(-s));const vd={bool:$m,uint:Ym,ints:Zm,float:yd},Jx=new Map([...$m,...yd]),mf=(s,e)=>Jx.has(s)?Jx.get(s):s.isNode===!0?s:new Hi(s,e),PP=s=>{try{return s.getNodeType()}catch{return}},un=function(s,e=null){return(...t)=>{if((t.length===0||!["bool","float","int","uint"].includes(s)&&t.every(i=>typeof i!="object"))&&(t=[km(s,...t)]),t.length===1&&e!==null&&e.has(t[0]))return H(e.get(t[0]));if(t.length===1){const i=mf(t[0],s);return PP(i)===s?H(i):H(new Xm(i,s))}const n=t.map(i=>mf(i));return H(new kv(n,s))}},Oc=s=>typeof s=="object"&&s!==null?s.value:s,qv=s=>s!=null?s.nodeType||s.convertTo||(typeof s=="string"?s:null):null;function tc(s,e){return new Proxy(new EP(s,e),Wv)}const H=(s,e=null)=>SP(s,e),rl=(s,e=null)=>new TP(s,e),qr=(s,e=null)=>new bP(s,e),K=(...s)=>new wP(...s),fe=(...s)=>new AP(...s),U=(s,e)=>{const t=new tc(s,e),n=(...i)=>{let r;return rl(i),i[0]&&i[0].isNode?r=[...i]:r=i[0],t.call(r)};return n.shaderNode=t,n.setLayout=i=>(t.setLayout(i),n),n.once=()=>(t.once=!0,n),n},LP=(...s)=>(console.warn("TSL.ShaderNode: tslFn() has been renamed to Fn()."),U(...s));te("toGlobal",s=>(s.global=!0,s));const Vc=s=>{ca=s},Jm=()=>ca,Oe=(...s)=>ca.If(...s);function $v(s){return ca&&ca.add(s),s}te("append",$v);const Yv=new un("color"),A=new un("float",vd.float),L=new un("int",vd.ints),ve=new un("uint",vd.uint),cr=new un("bool",vd.bool),z=new un("vec2"),ls=new un("ivec2"),Zv=new un("uvec2"),Jv=new un("bvec2"),D=new un("vec3"),Kv=new un("ivec3"),ba=new un("uvec3"),Km=new un("bvec3"),oe=new un("vec4"),jv=new un("ivec4"),Qv=new un("uvec4"),eM=new un("bvec4"),ol=new un("mat2"),Tn=new un("mat3"),$r=new un("mat4"),DP=(s="")=>H(new Hi(s,"string")),UP=s=>H(new Hi(s,"ArrayBuffer"));te("toColor",Yv);te("toFloat",A);te("toInt",L);te("toUint",ve);te("toBool",cr);te("toVec2",z);te("toIVec2",ls);te("toUVec2",Zv);te("toBVec2",Jv);te("toVec3",D);te("toIVec3",Kv);te("toUVec3",ba);te("toBVec3",Km);te("toVec4",oe);te("toIVec4",jv);te("toUVec4",Qv);te("toBVec4",eM);te("toMat2",ol);te("toMat3",Tn);te("toMat4",$r);const tM=K(pr),nM=(s,e)=>H(new Xm(H(s),e)),FP=(s,e)=>H(new hh(H(s),e));te("element",tM);te("convert",nM);class jm extends Ye{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1){super("string"),this.name=e,this.version=0,this.shared=t,this.order=n,this.isUniformGroup=!0}set needsUpdate(e){e===!0&&this.version++}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const iM=s=>new jm(s),Qm=(s,e=0)=>new jm(s,!0,e),OP=Qm("frame"),_t=Qm("render"),sM=iM("object");class uo extends qm{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=sM}label(e){return this.name=e,this}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){const n=this.getSelf();return e=e.bind(n),super.onUpdate(i=>{const r=e(i,n);r!==void 0&&(this.value=r)},t)}generate(e,t){const n=this.getNodeType(e),i=this.getUniformHash(e);let r=e.getNodeFromHash(i);r===void 0&&(e.setHashNode(this,i),r=this);const o=r.getInputType(e),a=e.getUniformFromNode(r,o,e.shaderStage,this.name||e.context.label),c=e.getPropertyName(a);return e.context.label!==void 0&&delete e.context.label,e.format(c,n,t)}}const pe=(s,e)=>{const t=qv(e||s),n=s&&s.isNode===!0?s.node&&s.node.value||s.value:s;return H(new uo(n,t))};class Nt extends Ye{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1){super(e),this.name=t,this.varying=n,this.isPropertyNode=!0}getHash(e){return this.name||super.getHash(e)}isGlobal(){return!0}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const ai=(s,e)=>H(new Nt(s,e)),Yi=(s,e)=>H(new Nt(s,e,!0)),Ct=fe(Nt,"vec4","DiffuseColor"),gf=fe(Nt,"vec3","EmissiveColor"),hs=fe(Nt,"float","Roughness"),Bc=fe(Nt,"float","Metalness"),dh=fe(Nt,"float","Clearcoat"),zc=fe(Nt,"float","ClearcoatRoughness"),Hr=fe(Nt,"vec3","Sheen"),Md=fe(Nt,"float","SheenRoughness"),Sd=fe(Nt,"float","Iridescence"),eg=fe(Nt,"float","IridescenceIOR"),tg=fe(Nt,"float","IridescenceThickness"),ph=fe(Nt,"float","AlphaT"),Ys=fe(Nt,"float","Anisotropy"),nc=fe(Nt,"vec3","AnisotropyT"),Yr=fe(Nt,"vec3","AnisotropyB"),ri=fe(Nt,"color","SpecularColor"),kc=fe(Nt,"float","SpecularF90"),fh=fe(Nt,"float","Shininess"),ng=fe(Nt,"vec4","Output"),Zr=fe(Nt,"float","dashSize"),Gc=fe(Nt,"float","gapSize"),VP=fe(Nt,"float","pointWidth"),ic=fe(Nt,"float","IOR"),mh=fe(Nt,"float","Transmission"),ig=fe(Nt,"float","Thickness"),sg=fe(Nt,"float","AttenuationDistance"),rg=fe(Nt,"color","AttenuationColor"),og=fe(Nt,"float","Dispersion");class rM extends pt{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t}hasDependencies(){return!1}getNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){const n=e.getTypeLength(t.node.getNodeType(e));return Ta.join("").slice(0,n)!==t.components}return!1}generate(e,t){const{targetNode:n,sourceNode:i}=this,r=this.needsSplitAssign(e),o=n.getNodeType(e),a=n.context({assign:!0}).build(e),c=i.build(e,o),l=i.getNodeType(e),u=e.getDataFromNode(this);let h;if(u.initialized===!0)t!=="void"&&(h=a);else if(r){const d=e.getVarFromNode(this,null,o),p=e.getPropertyName(d);e.addLineFlowCode(`${p} = ${c}`,this);const f=n.node.context({assign:!0}).build(e);for(let x=0;x<n.components.length;x++){const m=n.components[x];e.addLineFlowCode(`${f}.${m} = ${p}[ ${x} ]`,this)}t!=="void"&&(h=a)}else h=`${a} = ${c}`,(t==="void"||l==="void")&&(e.addLineFlowCode(h,this),t!=="void"&&(h=a));return u.initialized=!0,e.format(h,o,t)}}const oM=K(rM);te("assign",oM);class aM extends pt{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}generate(e){const t=[],n=this.functionNode,i=n.getInputs(e),r=this.parameters;if(Array.isArray(r))for(let a=0;a<r.length;a++){const c=i[a],l=r[a];t.push(l.build(e,c.type))}else for(const a of i){const c=r[a.name];if(c!==void 0)t.push(c.build(e,a.type));else throw new Error(`FunctionCallNode: Input '${a.name}' not found in FunctionNode.`)}return`${n.build(e,"property")}( ${t.join(", ")} )`}}const cM=(s,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?qr(e):rl(e[0]),H(new aM(H(s),e)));te("call",cM);class qt extends pt{static get type(){return"OperatorNode"}constructor(e,t,n,...i){if(super(),i.length>0){let r=new qt(e,t,n);for(let o=0;o<i.length-1;o++)r=new qt(e,r,i[o]);t=r,n=i[i.length-1]}this.op=e,this.aNode=t,this.bNode=n}getNodeType(e,t){const n=this.op,i=this.aNode,r=this.bNode,o=i.getNodeType(e),a=typeof r<"u"?r.getNodeType(e):null;if(o==="void"||a==="void")return"void";if(n==="%")return o;if(n==="~"||n==="&"||n==="|"||n==="^"||n===">>"||n==="<<")return e.getIntegerType(o);if(n==="!"||n==="=="||n==="&&"||n==="||"||n==="^^")return"bool";if(n==="<"||n===">"||n==="<="||n===">="){const c=t?e.getTypeLength(t):Math.max(e.getTypeLength(o),e.getTypeLength(a));return c>1?`bvec${c}`:"bool"}else return o==="float"&&e.isMatrix(a)?a:e.isMatrix(o)&&e.isVector(a)?e.getVectorFromMatrix(o):e.isVector(o)&&e.isMatrix(a)?e.getVectorFromMatrix(a):e.getTypeLength(a)>e.getTypeLength(o)?a:o}generate(e,t){const n=this.op,i=this.aNode,r=this.bNode,o=this.getNodeType(e,t);let a=null,c=null;o!=="void"?(a=i.getNodeType(e),c=typeof r<"u"?r.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="?e.isVector(a)?c=a:a!==c&&(a=c="float"):n===">>"||n==="<<"?(a=o,c=e.changeComponentType(c,"uint")):e.isMatrix(a)&&e.isVector(c)?c=e.getVectorFromMatrix(a):e.isVector(a)&&e.isMatrix(c)?a=e.getVectorFromMatrix(c):a=c=o):a=c=o;const l=i.build(e,a),u=typeof r<"u"?r.build(e,c):null,h=e.getTypeLength(t),d=e.getFunctionOperator(n);if(t!=="void")return n==="<"&&h>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThan",t)}( ${l}, ${u} )`,o,t):e.format(`( ${l} < ${u} )`,o,t):n==="<="&&h>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThanEqual",t)}( ${l}, ${u} )`,o,t):e.format(`( ${l} <= ${u} )`,o,t):n===">"&&h>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThan",t)}( ${l}, ${u} )`,o,t):e.format(`( ${l} > ${u} )`,o,t):n===">="&&h>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThanEqual",t)}( ${l}, ${u} )`,o,t):e.format(`( ${l} >= ${u} )`,o,t):n==="!"||n==="~"?e.format(`(${n}${l})`,a,t):d?e.format(`${d}( ${l}, ${u} )`,o,t):e.format(`( ${l} ${n} ${u} )`,o,t);if(a!=="void")return d?e.format(`${d}( ${l}, ${u} )`,o,t):e.format(`${l} ${n} ${u}`,o,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const Wt=K(qt,"+"),Ft=K(qt,"-"),ot=K(qt,"*"),ts=K(qt,"/"),ag=K(qt,"%"),lM=K(qt,"=="),uM=K(qt,"!="),hM=K(qt,"<"),cg=K(qt,">"),dM=K(qt,"<="),pM=K(qt,">="),fM=K(qt,"&&"),mM=K(qt,"||"),gM=K(qt,"!"),xM=K(qt,"^^"),_M=K(qt,"&"),yM=K(qt,"~"),vM=K(qt,"|"),MM=K(qt,"^"),SM=K(qt,"<<"),TM=K(qt,">>");te("add",Wt);te("sub",Ft);te("mul",ot);te("div",ts);te("modInt",ag);te("equal",lM);te("notEqual",uM);te("lessThan",hM);te("greaterThan",cg);te("lessThanEqual",dM);te("greaterThanEqual",pM);te("and",fM);te("or",mM);te("not",gM);te("xor",xM);te("bitAnd",_M);te("bitNot",yM);te("bitOr",vM);te("bitXor",MM);te("shiftLeft",SM);te("shiftRight",TM);const bM=(...s)=>(console.warn("TSL.OperatorNode: .remainder() has been renamed to .modInt()."),ag(...s));te("remainder",bM);class V extends pt{static get type(){return"MathNode"}constructor(e,t,n=null,i=null){super(),this.method=e,this.aNode=t,this.bNode=n,this.cNode=i}getInputType(e){const t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,i=this.cNode?this.cNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),o=e.isMatrix(n)?0:e.getTypeLength(n),a=e.isMatrix(i)?0:e.getTypeLength(i);return r>o&&r>a?t:o>a?n:a>r?i:t}getNodeType(e){const t=this.method;return t===V.LENGTH||t===V.DISTANCE||t===V.DOT?"float":t===V.CROSS?"vec3":t===V.ALL?"bool":t===V.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):t===V.MOD?this.aNode.getNodeType(e):this.getInputType(e)}generate(e,t){const n=this.method,i=this.getNodeType(e),r=this.getInputType(e),o=this.aNode,a=this.bNode,c=this.cNode,l=e.renderer.isWebGLRenderer===!0;if(n===V.TRANSFORM_DIRECTION){let u=o,h=a;e.isMatrix(u.getNodeType(e))?h=oe(D(h),0):u=oe(D(u),0);const d=ot(u,h).xyz;return vi(d).build(e,t)}else{if(n===V.NEGATE)return e.format("( - "+o.build(e,r)+" )",i,t);if(n===V.ONE_MINUS)return Ft(1,o).build(e,t);if(n===V.RECIPROCAL)return ts(1,o).build(e,t);if(n===V.DIFFERENCE)return Dt(Ft(o,a)).build(e,t);{const u=[];return n===V.CROSS||n===V.MOD?u.push(o.build(e,i),a.build(e,i)):l&&n===V.STEP?u.push(o.build(e,e.getTypeLength(o.getNodeType(e))===1?"float":r),a.build(e,r)):l&&(n===V.MIN||n===V.MAX)||n===V.MOD?u.push(o.build(e,r),a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":r)):n===V.REFRACT?u.push(o.build(e,r),a.build(e,r),c.build(e,"float")):n===V.MIX?u.push(o.build(e,r),a.build(e,r),c.build(e,e.getTypeLength(c.getNodeType(e))===1?"float":r)):(u.push(o.build(e,r)),a!==null&&u.push(a.build(e,r)),c!==null&&u.push(c.build(e,r))),e.format(`${e.getMethod(n,i)}( ${u.join(", ")} )`,i,t)}}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}V.ALL="all";V.ANY="any";V.EQUALS="equals";V.RADIANS="radians";V.DEGREES="degrees";V.EXP="exp";V.EXP2="exp2";V.LOG="log";V.LOG2="log2";V.SQRT="sqrt";V.INVERSE_SQRT="inversesqrt";V.FLOOR="floor";V.CEIL="ceil";V.NORMALIZE="normalize";V.FRACT="fract";V.SIN="sin";V.COS="cos";V.TAN="tan";V.ASIN="asin";V.ACOS="acos";V.ATAN="atan";V.ABS="abs";V.SIGN="sign";V.LENGTH="length";V.NEGATE="negate";V.ONE_MINUS="oneMinus";V.DFDX="dFdx";V.DFDY="dFdy";V.ROUND="round";V.RECIPROCAL="reciprocal";V.TRUNC="trunc";V.FWIDTH="fwidth";V.BITCAST="bitcast";V.TRANSPOSE="transpose";V.ATAN2="atan2";V.MIN="min";V.MAX="max";V.MOD="mod";V.STEP="step";V.REFLECT="reflect";V.DISTANCE="distance";V.DIFFERENCE="difference";V.DOT="dot";V.CROSS="cross";V.POW="pow";V.TRANSFORM_DIRECTION="transformDirection";V.MIX="mix";V.CLAMP="clamp";V.REFRACT="refract";V.SMOOTHSTEP="smoothstep";V.FACEFORWARD="faceforward";const wM=A(1e-6),BP=A(1e6),Qr=A(Math.PI),zP=A(Math.PI*2),lg=K(V,V.ALL),AM=K(V,V.ANY),NM=K(V,V.EQUALS),EM=K(V,V.RADIANS),CM=K(V,V.DEGREES),ug=K(V,V.EXP),gh=K(V,V.EXP2),hg=K(V,V.LOG),al=K(V,V.LOG2),os=K(V,V.SQRT),RM=K(V,V.INVERSE_SQRT),fr=K(V,V.FLOOR),dg=K(V,V.CEIL),vi=K(V,V.NORMALIZE),mr=K(V,V.FRACT),Cn=K(V,V.SIN),Mi=K(V,V.COS),IM=K(V,V.TAN),PM=K(V,V.ASIN),xh=K(V,V.ACOS),LM=K(V,V.ATAN),Dt=K(V,V.ABS),cl=K(V,V.SIGN),Jr=K(V,V.LENGTH),DM=K(V,V.NEGATE),UM=K(V,V.ONE_MINUS),FM=K(V,V.DFDX),OM=K(V,V.DFDY),VM=K(V,V.ROUND),BM=K(V,V.RECIPROCAL),pg=K(V,V.TRUNC),zM=K(V,V.FWIDTH),kP=K(V,V.BITCAST),kM=K(V,V.TRANSPOSE),GM=K(V,V.ATAN2),Mn=K(V,V.MIN),ft=K(V,V.MAX),Td=K(V,V.MOD),ll=K(V,V.STEP),HM=K(V,V.REFLECT),WM=K(V,V.DISTANCE),XM=K(V,V.DIFFERENCE),$t=K(V,V.DOT),Ko=K(V,V.CROSS),Kn=K(V,V.POW),fg=K(V,V.POW,2),qM=K(V,V.POW,3),$M=K(V,V.POW,4),YM=K(V,V.TRANSFORM_DIRECTION),ZM=s=>ot(cl(s),Kn(Dt(s),1/3)),mg=s=>$t(s,s),it=K(V,V.MIX),cn=(s,e=0,t=1)=>H(new V(V.CLAMP,H(s),H(e),H(t))),JM=s=>cn(s),gg=K(V,V.REFRACT),ti=K(V,V.SMOOTHSTEP),KM=K(V,V.FACEFORWARD),xg=U(([s])=>{const n=43758.5453,i=$t(s.xy,z(12.9898,78.233)),r=Td(i,Qr);return mr(Cn(r).mul(n))}),jM=(s,e,t)=>it(e,t,s),QM=(s,e,t)=>ti(e,t,s);te("all",lg);te("any",AM);te("equals",NM);te("radians",EM);te("degrees",CM);te("exp",ug);te("exp2",gh);te("log",hg);te("log2",al);te("sqrt",os);te("inverseSqrt",RM);te("floor",fr);te("ceil",dg);te("normalize",vi);te("fract",mr);te("sin",Cn);te("cos",Mi);te("tan",IM);te("asin",PM);te("acos",xh);te("atan",LM);te("abs",Dt);te("sign",cl);te("length",Jr);te("lengthSq",mg);te("negate",DM);te("oneMinus",UM);te("dFdx",FM);te("dFdy",OM);te("round",VM);te("reciprocal",BM);te("trunc",pg);te("fwidth",zM);te("atan2",GM);te("min",Mn);te("max",ft);te("mod",Td);te("step",ll);te("reflect",HM);te("distance",WM);te("dot",$t);te("cross",Ko);te("pow",Kn);te("pow2",fg);te("pow3",qM);te("pow4",$M);te("transformDirection",YM);te("mix",jM);te("clamp",cn);te("refract",gg);te("smoothstep",QM);te("faceForward",KM);te("difference",XM);te("saturate",JM);te("cbrt",ZM);te("transpose",kM);te("rand",xg);class GP extends Ye{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}getNodeType(e){const t=this.ifNode.getNodeType(e);if(this.elseNode!==null){const n=this.elseNode.getNodeType(e);if(e.getTypeLength(n)>e.getTypeLength(t))return n}return t}setup(e){const t=this.condNode.cache(),n=this.ifNode.cache(),i=this.elseNode?this.elseNode.cache():null,r=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=r,i!==null&&(e.getDataFromNode(i).parentNodeBlock=r);const o=e.getNodeProperties(this);o.condNode=t,o.ifNode=n.context({nodeBlock:n}),o.elseNode=i?i.context({nodeBlock:i}):null}generate(e,t){const n=this.getNodeType(e),i=e.getDataFromNode(this);if(i.nodeProperty!==void 0)return i.nodeProperty;const{condNode:r,ifNode:o,elseNode:a}=e.getNodeProperties(this),c=t!=="void",l=c?ai(n).build(e):"";i.nodeProperty=l;const u=r.build(e,"bool");e.addFlowCode(`
|
|
3848
3848
|
${e.tab}if ( ${u} ) {
|
|
3849
3849
|
|
|
3850
3850
|
`).addFlowTab();let h=o.build(e,n);if(h&&(c?h=l+" = "+h+";":h="return "+h+";"),e.removeFlowTab().addFlowCode(e.tab+" "+h+`
|
|
@@ -3863,7 +3863,7 @@ ${e.tab}if ( ${u} ) {
|
|
|
3863
3863
|
`).addFlowTab()}const r=i.build(e,"void"),o=t.returnsNode?t.returnsNode.build(e):"";e.removeFlowTab().addFlowCode(`
|
|
3864
3864
|
`+e.tab+r);for(let a=0,c=this.params.length-1;a<c;a++)e.addFlowCode((a===0?"":e.tab)+`}
|
|
3865
3865
|
|
|
3866
|
-
`).removeFlowTab();return e.addFlowTab(),o}}const mt=(...s)=>H(new IT(qr(s,"int"))).append(),bL=()=>lr("continue").append(),Rd=()=>lr("break").append(),wL=(...s)=>(console.warn("TSL.LoopNode: loop() has been renamed to Loop()."),mt(...s)),Lp=new WeakMap,_i=new st,e_=U(({bufferMap:s,influence:e,stride:t,width:n,depth:i,offset:r})=>{const o=L(bT).mul(t).add(r),a=o.div(n),c=o.sub(a.mul(n));return Ci(s,ls(c,a)).depth(i).mul(e)});function AL(s){const e=s.morphAttributes.position!==void 0,t=s.morphAttributes.normal!==void 0,n=s.morphAttributes.color!==void 0,i=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,r=i!==void 0?i.length:0;let o=Lp.get(s);if(o===void 0||o.count!==r){let g=function(){x.dispose(),Lp.delete(s),s.removeEventListener("dispose",g)};o!==void 0&&o.texture.dispose();const a=s.morphAttributes.position||[],c=s.morphAttributes.normal||[],l=s.morphAttributes.color||[];let u=0;e===!0&&(u=1),t===!0&&(u=2),n===!0&&(u=3);let h=s.attributes.position.count*u,d=1;const p=4096;h>p&&(d=Math.ceil(h/p),h=p);const f=new Float32Array(h*d*4*r),x=new qc(f,h,d,r);x.type=Gn,x.needsUpdate=!0;const m=u*4;for(let y=0;y<r;y++){const _=a[y],v=c[y],I=l[y],T=h*d*4*y;for(let w=0;w<_.count;w++){const C=w*m;e===!0&&(_i.fromBufferAttribute(_,w),f[T+C+0]=_i.x,f[T+C+1]=_i.y,f[T+C+2]=_i.z,f[T+C+3]=0),t===!0&&(_i.fromBufferAttribute(v,w),f[T+C+4]=_i.x,f[T+C+5]=_i.y,f[T+C+6]=_i.z,f[T+C+7]=0),n===!0&&(_i.fromBufferAttribute(I,w),f[T+C+8]=_i.x,f[T+C+9]=_i.y,f[T+C+10]=_i.z,f[T+C+11]=I.itemSize===4?_i.w:1)}}o={count:r,texture:x,stride:u,size:new J(h,d)},Lp.set(s,o),s.addEventListener("dispose",g)}return o}class PT extends Ye{static get type(){return"MorphNode"}constructor(e){super("void"),this.mesh=e,this.morphBaseInfluence=pe(1),this.updateType=We.OBJECT}setup(e){const{geometry:t}=e,n=t.morphAttributes.position!==void 0,i=t.hasAttribute("normal")&&t.morphAttributes.normal!==void 0,r=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,o=r!==void 0?r.length:0,{texture:a,stride:c,size:l}=AL(t);n===!0&&en.mulAssign(this.morphBaseInfluence),i===!0&&hi.mulAssign(this.morphBaseInfluence);const u=L(l.width);mt(o,({i:h})=>{const d=A(0).toVar();this.mesh.count>1&&this.mesh.morphTexture!==null&&this.mesh.morphTexture!==void 0?d.assign(Ci(this.mesh.morphTexture,ls(L(h).add(1),L(yl))).r):d.assign(dn("morphTargetInfluences","float").element(h).toVar()),n===!0&&en.addAssign(e_({bufferMap:a,influence:d,stride:c,width:u,depth:h,offset:L(0)})),i===!0&&hi.addAssign(e_({bufferMap:a,influence:d,stride:c,width:u,depth:h,offset:L(1)}))})}update(){const e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((t,n)=>t+n,0)}}const LT=K(PT),NL=s=>s.sort((e,t)=>e.id-t.id),EL=(s,e)=>{for(const t of e)if(t.isAnalyticLightNode&&t.light.id===s)return t;return null},Dp=new WeakMap;class DT extends Ye{static get type(){return"LightsNode"}constructor(e=[]){super("vec3"),this.totalDiffuseNode=D().toVar("totalDiffuse"),this.totalSpecularNode=D().toVar("totalSpecular"),this.outgoingLightNode=D().toVar("outgoingLight"),this._lights=e,this._lightNodes=null,this._lightNodesHash=null,this.global=!0}getHash(e){if(this._lightNodesHash===null){this._lightNodes===null&&this.setupLightsNode(e);const t=[];for(const n of this._lightNodes)t.push(n.getHash());this._lightNodesHash="lights-"+t.join(",")}return this._lightNodesHash}analyze(e){const t=e.getDataFromNode(this);for(const n of t.nodes)n.build(e)}setupLightsNode(e){const t=[],n=this._lightNodes,i=NL(this._lights),r=e.renderer.nodes.library;for(const o of i)if(o.isNode)t.push(H(o));else{let a=null;if(n!==null&&(a=EL(o.id,n)),a===null){const c=r.getLightNodeClass(o.constructor);if(c===null){console.warn(`LightsNode.setupNodeLights: Light node not found for ${o.constructor.name}`);continue}let l=null;Dp.has(o)?l=Dp.get(o):(l=new c(o),Dp.set(o,l)),t.push(l)}}this._lightNodes=t}setup(e){this._lightNodes===null&&this.setupLightsNode(e);const t=e.context,n=t.lightingModel;let i=this.outgoingLightNode;if(n){const{_lightNodes:r,totalDiffuseNode:o,totalSpecularNode:a}=this;t.outgoingLight=i;const c=e.addStack(),l=e.getDataFromNode(this);l.nodes=c.nodes,n.start(t,c,e);for(const g of r)g.build(e);n.indirect(t,c,e);const{backdrop:u,backdropAlpha:h}=t,{directDiffuse:d,directSpecular:p,indirectDiffuse:f,indirectSpecular:x}=t.reflectedLight;let m=d.add(f);u!==null&&(h!==null?m=D(h.mix(m,u)):m=D(u),t.material.transparent=!0),o.assign(m),a.assign(p.add(x)),i.assign(o.add(a)),n.finish(t,c,e),i=i.bypass(e.removeStack())}return i}setLights(e){return this._lights=e,this._lightNodes=null,this._lightNodesHash=null,this}getLights(){return this._lights}}const UT=K(DT);class ho extends Ye{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}generate(){console.warn("Abstract function.")}}class FT extends ho{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class OT extends _g{static get type(){return"LightingContextNode"}constructor(e,t=null,n=null,i=null){super(e),this.lightingModel=t,this.backdropNode=n,this.backdropAlphaNode=i,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,n=D().toVar("directDiffuse"),i=D().toVar("directSpecular"),r=D().toVar("indirectDiffuse"),o=D().toVar("indirectSpecular"),a={directDiffuse:n,directSpecular:i,indirectDiffuse:r,indirectSpecular:o};return{radiance:D().toVar("radiance"),irradiance:D().toVar("irradiance"),iblIrradiance:D().toVar("iblIrradiance"),ambientOcclusion:A(1).toVar("ambientOcclusion"),reflectedLight:a,backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}const VT=K(OT);class BT extends ho{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}let ka,Ga;class sn extends Ye{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this.isViewportNode=!0}getNodeType(){return this.scope===sn.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=We.NONE;return(this.scope===sn.SIZE||this.scope===sn.VIEWPORT)&&(e=We.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===sn.VIEWPORT?t!==null?Ga.copy(t.viewport):(e.getViewport(Ga),Ga.multiplyScalar(e.getPixelRatio())):t!==null?(ka.width=t.width,ka.height=t.height):e.getDrawingBufferSize(ka)}setup(){const e=this.scope;let t=null;return e===sn.SIZE?t=pe(ka||(ka=new J)):e===sn.VIEWPORT?t=pe(Ga||(Ga=new st)):t=z(wa.div(ua)),t}generate(e){if(this.scope===sn.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const n=e.getNodeProperties(ua).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}}sn.COORDINATE="coordinate";sn.VIEWPORT="viewport";sn.SIZE="size";sn.UV="uv";const gr=fe(sn,sn.UV),ua=fe(sn,sn.SIZE),wa=fe(sn,sn.COORDINATE),Ls=fe(sn,sn.VIEWPORT),zT=Ls.zw,kT=wa.sub(Ls.xy),CL=kT.div(zT),RL=U(()=>(console.warn('TSL.ViewportNode: "viewportResolution" is deprecated. Use "screenSize" instead.'),ua),"vec2").once()(),IL=U(()=>(console.warn('TSL.ViewportNode: "viewportTopLeft" is deprecated. Use "screenUV" instead.'),gr),"vec2").once()(),PL=U(()=>(console.warn('TSL.ViewportNode: "viewportBottomLeft" is deprecated. Use "screenUV.flipY()" instead.'),gr.flipY()),"vec2").once()(),Ha=new J;class vl extends gs{static get type(){return"ViewportTextureNode"}constructor(e=gr,t=null,n=null){n===null&&(n=new pm,n.minFilter=Jn),super(n,e,t),this.generateMipmaps=!1,this.isOutputTextureNode=!0,this.updateBeforeType=We.FRAME}updateBefore(e){const t=e.renderer;t.getDrawingBufferSize(Ha);const n=this.value;(n.image.width!==Ha.width||n.image.height!==Ha.height)&&(n.image.width=Ha.width,n.image.height=Ha.height,n.needsUpdate=!0);const i=n.generateMipmaps;n.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(n),n.generateMipmaps=i}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const LL=K(vl),GT=K(vl,null,null,{generateMipmaps:!0});let Up=null;class HT extends vl{static get type(){return"ViewportDepthTextureNode"}constructor(e=gr,t=null){Up===null&&(Up=new oo),super(e,t,Up)}}const Ug=K(HT);class jn extends Ye{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){const{scope:t}=this;return t===jn.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,n=this.valueNode;let i=null;if(t===jn.DEPTH_BASE)n!==null&&(i=XT().assign(n));else if(t===jn.DEPTH)e.isPerspectiveCamera?i=WT(Pn.z,Vo,Bo):i=oc(Pn.z,Vo,Bo);else if(t===jn.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){const r=Fg(n,Vo,Bo);i=oc(r,Vo,Bo)}else i=n;else i=oc(Pn.z,Vo,Bo);return i}}jn.DEPTH_BASE="depthBase";jn.DEPTH="depth";jn.LINEAR_DEPTH="linearDepth";const oc=(s,e,t)=>s.add(e).div(e.sub(t)),DL=(s,e,t)=>e.sub(t).mul(s).sub(e),WT=(s,e,t)=>e.add(s).mul(t).div(t.sub(e).mul(s)),Fg=(s,e,t)=>e.mul(t).div(t.sub(e).mul(s).sub(t)),XT=K(jn,jn.DEPTH_BASE),Og=fe(jn,jn.DEPTH),Th=K(jn,jn.LINEAR_DEPTH),UL=Th(Ug());Og.assign=s=>XT(s);class ur extends Ye{static get type(){return"ClippingNode"}constructor(e=ur.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{localClipIntersection:n,localClippingCount:i,globalClippingCount:r}=t,o=r+i,a=n?o-i:o;return this.scope===ur.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(t.planes,o,a):this.setupDefault(t.planes,o,a)}setupAlphaToCoverage(e,t,n){return U(()=>{const i=ds(e),r=ai("float","distanceToPlane"),o=ai("float","distanceToGradient"),a=ai("float","clipOpacity");a.assign(1);let c;if(mt(n,({i:l})=>{c=i.element(l),r.assign(Pn.dot(c.xyz).negate().add(c.w)),o.assign(r.fwidth().div(2)),a.mulAssign(ti(o.negate(),o,r)),a.equal(0).discard()}),n<t){const l=ai("float","unionclipOpacity");l.assign(1),mt({start:n,end:t},({i:u})=>{c=i.element(u),r.assign(Pn.dot(c.xyz).negate().add(c.w)),o.assign(r.fwidth().div(2)),l.mulAssign(ti(o.negate(),o,r).oneMinus())}),a.mulAssign(l.oneMinus())}Ct.a.mulAssign(a),Ct.a.equal(0).discard()})()}setupDefault(e,t,n){return U(()=>{const i=ds(e);let r;if(mt(n,({i:o})=>{r=i.element(o),Pn.dot(r.xyz).greaterThan(r.w).discard()}),n<t){const o=ai("bool","clipped");o.assign(!0),mt({start:n,end:t},({i:a})=>{r=i.element(a),o.assign(Pn.dot(r.xyz).greaterThan(r.w).and(o))}),o.discard()}})()}}ur.ALPHA_TO_COVERAGE="alphaToCoverage";ur.DEFAULT="default";const FL=()=>H(new ur),OL=()=>H(new ur(ur.ALPHA_TO_COVERAGE));class Tt extends mn{static get type(){return"NodeMaterial"}constructor(){super(),this.isNodeMaterial=!0,this.type=this.constructor.type,this.forceSinglePass=!1,this.fog=!0,this.lights=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.positionNode=null,this.depthNode=null,this.shadowNode=null,this.shadowPositionNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null}customProgramCacheKey(){return this.type+zm(this)}build(e){this.setup(e)}setupObserver(e){return new Vv(e)}setup(e){e.context.setupNormal=()=>this.setupNormal(e),e.addStack(),e.stack.outputNode=this.vertexNode||this.setupPosition(e),e.addFlow("vertex",e.removeStack()),e.addStack();let t;const n=this.setupClipping(e);if(this.depthWrite===!0&&this.setupDepth(e),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupVariants(e);const i=this.setupLighting(e);n!==null&&e.stack.add(n);const r=oe(i,Ct.a).max(0);if(t=this.setupOutput(e,r),ng.assign(t),this.outputNode!==null&&(t=this.outputNode),e.renderer.getRenderTarget()!==null){const a=e.renderer.getMRT(),c=this.mrtNode;a!==null?(t=a,c!==null&&(t=a.merge(c))):c!==null&&(t=c)}}else{let i=this.fragmentNode;i.isOutputStructNode!==!0&&(i=oe(i)),t=this.setupOutput(e,i)}e.stack.outputNode=t,e.addFlow("fragment",e.removeStack()),e.monitor=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;const{globalClippingCount:t,localClippingCount:n}=e.clippingContext;let i=null;if(t||n){const r=e.renderer.samples;this.alphaToCoverage&&r>1?i=OL():e.stack.add(FL())}return i}setupDepth(e){const{renderer:t}=e;let n=this.depthNode;if(n===null){const i="getMRT"in t&&t.getMRT();i&&i.has("depth")?n=i.get("depth"):t.logarithmicDepthBuffer===!0&&(n=Sf().w.add(1).log2().mul(CS).mul(.5))}n!==null&&Og.assign(n).append()}setupPosition(e){const{object:t}=e,n=t.geometry;if(e.addStack(),(n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&<(t).append(),t.isSkinnedMesh===!0&&RT(t).append(),this.displacementMap){const r=Ji("displacementMap","texture"),o=Ji("displacementScale","float"),a=Ji("displacementBias","float");en.addAssign(hi.normalize().mul(r.x.mul(o).add(a)))}t.isBatchedMesh&&CT(t).append(),t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&NT(t).append(),this.positionNode!==null&&en.assign(this.positionNode);const i=Sf();return e.context.vertex=e.removeStack(),e.context.mvp=i,i}setupDiffuseColor({object:e,geometry:t}){let n=this.colorNode?oe(this.colorNode):la;this.vertexColors===!0&&t.hasAttribute("color")&&(n=oe(n.xyz.mul(vn("color","vec3")),n.a)),e.instanceColor&&(n=Yi("vec3","vInstanceColor").mul(n)),e.isBatchedMesh&&e._colorsTexture&&(n=Yi("vec3","vBatchColor").mul(n)),Ct.assign(n);const i=this.opacityNode?A(this.opacityNode):Cd;if(Ct.a.assign(Ct.a.mul(i)),this.alphaTestNode!==null||this.alphaTest>0){const r=this.alphaTestNode!==null?A(this.alphaTestNode):KS;Ct.a.lessThanEqual(r).discard()}this.transparent===!1&&this.blending===Ps&&this.alphaToCoverage===!1&&Ct.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?D(0):Ct.rgb}setupNormal(){return this.normalNode?D(this.normalNode):sT}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Ji("envMap","cubeTexture"):Ji("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new BT(Lg)),t}setupLights(e){const t=[],n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);const i=this.setupLightMap(e);if(i&&i.isLightingNode&&t.push(i),this.aoNode!==null||e.material.aoMap){const o=this.aoNode!==null?this.aoNode:ST;t.push(new FT(o))}let r=this.lightsNode||e.lightsNode;return t.length>0&&(r=UT([...r.getLights(),...t])),r}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:n,backdropAlphaNode:i,emissiveNode:r}=this,a=this.lights===!0||this.lightsNode!==null?this.setupLights(e):null;let c=this.setupOutgoingLight(e);if(a&&a.getScope().getLights().length>0){const l=this.setupLightingModel(e);c=VT(a,l,n,i)}else n!==null&&(c=D(i!==null?it(c,n,i):n));return(r&&r.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(gf.assign(D(r||QS)),c=c.add(gf)),c}setupOutput(e,t){if(this.fog===!0){const n=e.fogNode;n&&(t=oe(n.mix(t.rgb,n.colorNode),t.a))}return t}setDefaultValues(e){for(const n in e){const i=e[n];this[n]===void 0&&(this[n]=i,i&&i.clone&&(this[n]=i.clone()))}const t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(const n in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,n)===void 0&&t[n].get!==void 0&&Object.defineProperty(this.constructor.prototype,n,t[n])}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});const n=mn.prototype.toJSON.call(this,e),i=Fc(this);n.inputNodes={};for(const{property:o,childNode:a}of i)n.inputNodes[o]=a.toJSON(e).uuid;function r(o){const a=[];for(const c in o){const l=o[c];delete l.metadata,a.push(l)}return a}if(t){const o=r(e.textures),a=r(e.images),c=r(e.nodes);o.length>0&&(n.textures=o),a.length>0&&(n.images=a),c.length>0&&(n.nodes=c)}return n}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.positionNode=e.positionNode,this.depthNode=e.depthNode,this.shadowNode=e.shadowNode,this.shadowPositionNode=e.shadowPositionNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,super.copy(e)}}const VL=new _a;class BL extends Tt{static get type(){return"InstancedPointsNodeMaterial"}constructor(e={}){super(),this.lights=!1,this.useAlphaToCoverage=!0,this.useColor=e.vertexColors,this.pointWidth=1,this.pointColorNode=null,this.pointWidthNode=null,this.setDefaultValues(VL),this.setValues(e)}setup(e){this.setupShaders(e),super.setup(e)}setupShaders({renderer:e}){const t=this.alphaToCoverage,n=this.useColor;this.vertexNode=U(()=>{const i=vn("instancePosition").xyz,r=oe(xs.mul(oe(i,1))),o=Ls.z.div(Ls.w),a=ci.mul(r),c=Nn.xy.toVar();return c.mulAssign(this.pointWidthNode?this.pointWidthNode:vT),c.assign(c.div(Ls.z)),c.y.assign(c.y.mul(o)),c.assign(c.mul(a.w)),a.addAssign(oe(c,0,0)),a})(),this.fragmentNode=U(()=>{const i=A(1).toVar(),r=mg(rt().mul(2).sub(1));if(t&&e.samples>1){const a=A(r.fwidth()).toVar();i.assign(ti(a.oneMinus(),a.add(1),r).oneMinus())}else r.greaterThan(1).discard();let o;return this.pointColorNode?o=this.pointColorNode:n?o=vn("instanceColor").mul(la):o=la,i.mulAssign(Cd),oe(o,i)})()}get alphaToCoverage(){return this.useAlphaToCoverage}set alphaToCoverage(e){this.useAlphaToCoverage!==e&&(this.useAlphaToCoverage=e,this.needsUpdate=!0)}}const zL=new Fn;class kL extends Tt{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.lights=!1,this.setDefaultValues(zL),this.setValues(e)}}const GL=new hd;class HL extends Tt{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.lights=!1,this.setDefaultValues(GL),this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode,t=this.dashScaleNode?A(this.dashScaleNode):Sh,n=this.dashSizeNode?A(this.dashSizeNode):Ig,i=this.dashSizeNode?A(this.dashGapNode):Pg;Zr.assign(n),Gc.assign(i);const r=Un(vn("lineDistance").mul(t));(e?r.add(e):r).mod(Zr.add(Gc)).greaterThan(Zr).discard()}}const WL=new hd;class XL extends Tt{static get type(){return"Line2NodeMaterial"}constructor(e={}){super(),this.lights=!1,this.setDefaultValues(WL),this.useAlphaToCoverage=!0,this.useColor=e.vertexColors,this.useDash=e.dashed,this.useWorldUnits=!1,this.dashOffset=0,this.lineWidth=1,this.lineColorNode=null,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setup(e){this.setupShaders(e),super.setup(e)}setupShaders({renderer:e}){const t=this.alphaToCoverage,n=this.useColor,i=this.dashed,r=this.worldUnits,o=U(({start:c,end:l})=>{const u=ci.element(2).element(2),p=ci.element(3).element(2).mul(-.5).div(u).sub(c.z).div(l.z.sub(c.z));return oe(it(c.xyz,l.xyz,p),l.w)}).setLayout({name:"trimSegment",type:"vec4",inputs:[{name:"start",type:"vec4"},{name:"end",type:"vec4"}]});this.vertexNode=U(()=>{const c=vn("instanceStart"),l=vn("instanceEnd"),u=oe(xs.mul(oe(c,1))).toVar("start"),h=oe(xs.mul(oe(l,1))).toVar("end");r&&(Yi("vec3","worldStart").assign(u.xyz),Yi("vec3","worldEnd").assign(h.xyz));const d=Ls.z.div(Ls.w),p=ci.element(2).element(3).equal(-1);Oe(p,()=>{Oe(u.z.lessThan(0).and(h.z.greaterThan(0)),()=>{h.assign(o({start:u,end:h}))}).ElseIf(h.z.lessThan(0).and(u.z.greaterThanEqual(0)),()=>{u.assign(o({start:h,end:u}))})});const f=ci.mul(u),x=ci.mul(h),m=f.xyz.div(f.w),g=x.xyz.div(x.w),y=g.xy.sub(m.xy).toVar();y.x.assign(y.x.mul(d)),y.assign(y.normalize());const _=oe().toVar();if(r){const v=h.xyz.sub(u.xyz).normalize(),I=it(u.xyz,h.xyz,.5).normalize(),T=v.cross(I).normalize(),w=v.cross(T),C=Yi("vec4","worldPos");C.assign(Nn.y.lessThan(.5).select(u,h));const F=Pu.mul(.5);C.addAssign(oe(Nn.x.lessThan(0).select(T.mul(F),T.mul(F).negate()),0)),i||(C.addAssign(oe(Nn.y.lessThan(.5).select(v.mul(F).negate(),v.mul(F)),0)),C.addAssign(oe(w.mul(F),0)),Oe(Nn.y.greaterThan(1).or(Nn.y.lessThan(0)),()=>{C.subAssign(oe(w.mul(2).mul(F),0))})),_.assign(ci.mul(C));const M=D().toVar();M.assign(Nn.y.lessThan(.5).select(m,g)),_.z.assign(M.z.mul(_.w))}else{const v=z(y.y,y.x.negate()).toVar("offset");y.x.assign(y.x.div(d)),v.x.assign(v.x.div(d)),v.assign(Nn.x.lessThan(0).select(v.negate(),v)),Oe(Nn.y.lessThan(0),()=>{v.assign(v.sub(y))}).ElseIf(Nn.y.greaterThan(1),()=>{v.assign(v.add(y))}),v.assign(v.mul(Pu)),v.assign(v.div(Ls.w)),_.assign(Nn.y.lessThan(.5).select(f,x)),v.assign(v.mul(_.w)),_.assign(_.add(oe(v,0,0)))}return _})();const a=U(({p1:c,p2:l,p3:u,p4:h})=>{const d=c.sub(u),p=h.sub(u),f=l.sub(c),x=d.dot(p),m=p.dot(f),g=d.dot(f),y=p.dot(p),v=f.dot(f).mul(y).sub(m.mul(m)),T=x.mul(m).sub(g.mul(y)).div(v).clamp(),w=x.add(m.mul(T)).div(y).clamp();return z(T,w)});this.fragmentNode=U(()=>{const c=rt();if(i){const h=this.offsetNode?A(this.offsetNodeNode):Mf,d=this.dashScaleNode?A(this.dashScaleNode):Sh,p=this.dashSizeNode?A(this.dashSizeNode):Ig,f=this.dashSizeNode?A(this.dashGapNode):Pg;Zr.assign(p),Gc.assign(f);const x=vn("instanceDistanceStart"),m=vn("instanceDistanceEnd"),g=Nn.y.lessThan(.5).select(d.mul(x),Sh.mul(m)),y=Un(g.add(Mf)),_=h?y.add(h):y;c.y.lessThan(-1).or(c.y.greaterThan(1)).discard(),_.mod(Zr.add(Gc)).greaterThan(Zr).discard()}const l=A(1).toVar("alpha");if(r){const h=Yi("vec3","worldStart"),d=Yi("vec3","worldEnd"),p=Yi("vec4","worldPos").xyz.normalize().mul(1e5),f=d.sub(h),x=a({p1:h,p2:d,p3:D(0,0,0),p4:p}),m=h.add(f.mul(x.x)),g=p.mul(x.y),v=m.sub(g).length().div(Pu);if(!i)if(t&&e.samples>1){const I=v.fwidth();l.assign(ti(I.negate().add(.5),I.add(.5),v).oneMinus())}else v.greaterThan(.5).discard()}else if(t&&e.samples>1){const h=c.x,d=c.y.greaterThan(0).select(c.y.sub(1),c.y.add(1)),p=h.mul(h).add(d.mul(d)),f=A(p.fwidth()).toVar("dlen");Oe(c.y.abs().greaterThan(1),()=>{l.assign(ti(f.oneMinus(),f.add(1),p).oneMinus())})}else Oe(c.y.abs().greaterThan(1),()=>{const h=c.x,d=c.y.greaterThan(0).select(c.y.sub(1),c.y.add(1));h.mul(h).add(d.mul(d)).greaterThan(1).discard()});let u;if(this.lineColorNode)u=this.lineColorNode;else if(n){const h=vn("instanceColorStart"),d=vn("instanceColorEnd");u=Nn.y.lessThan(.5).select(h,d).mul(la)}else u=la;return oe(u,l)})()}get worldUnits(){return this.useWorldUnits}set worldUnits(e){this.useWorldUnits!==e&&(this.useWorldUnits=e,this.needsUpdate=!0)}get dashed(){return this.useDash}set dashed(e){this.useDash!==e&&(this.useDash=e,this.needsUpdate=!0)}get alphaToCoverage(){return this.useAlphaToCoverage}set alphaToCoverage(e){this.useAlphaToCoverage!==e&&(this.useAlphaToCoverage=e,this.needsUpdate=!0)}}const qT=s=>H(s).mul(.5).add(.5),qL=s=>H(s).mul(2).sub(1),$L=new ld;class YL extends Tt{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.lights=!1,this.isMeshNormalNodeMaterial=!0,this.setDefaultValues($L),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?A(this.opacityNode):Cd;Ct.assign(oe(qT(Yt),e))}}class $T extends pt{static get type(){return"EquirectUVNode"}constructor(e=Ag){super("vec2"),this.dirNode=e}setup(){const e=this.dirNode,t=e.z.atan2(e.x).mul(1/(Math.PI*2)).add(.5),n=e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return z(t,n)}}const Vg=K($T);class YT extends Hh{constructor(e=1,t={}){super(e,t),this.isCubeRenderTarget=!0}fromEquirectangularTexture(e,t){const n=t.minFilter,i=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r=new _s(5,5,5),o=Vg(Ag),a=new Tt;a.colorNode=xt(t,o,0),a.side=ln,a.blending=Fi;const c=new kt(r,a),l=new $h;l.add(c),t.minFilter===Jn&&(t.minFilter=Ut);const u=new Gh(1,10,this),h=e.getMRT();return e.setMRT(null),u.update(e,l),e.setMRT(h),t.minFilter=n,t.currentGenerateMipmaps=i,c.geometry.dispose(),c.material.dispose(),this}}const ac=new WeakMap;class ZL extends pt{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Ad();const t=new io;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=We.RENDER}updateBefore(e){const{renderer:t,material:n}=e,i=this.envNode;if(i.isTextureNode||i.isMaterialReferenceNode){const r=i.isTextureNode?i.value:n[i.property];if(r&&r.isTexture){const o=r.mapping;if(o===ir||o===sr){if(ac.has(r)){const a=ac.get(r);t_(a,r.mapping),this._cubeTexture=a}else{const a=r.image;if(JL(a)){const c=new YT(a.height);c.fromEquirectangularTexture(t,r),t_(c.texture,r.mapping),this._cubeTexture=c.texture,ac.set(r,c.texture),r.addEventListener("dispose",ZT)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function JL(s){return s==null?!1:s.height>0}function ZT(s){const e=s.target;e.removeEventListener("dispose",ZT);const t=ac.get(e);t!==void 0&&(ac.delete(e),t.dispose())}function t_(s,e){e===ir?s.mapping=wi:e===sr&&(s.mapping=Vi)}const KL=K(ZL);class Id extends ho{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=KL(this.envNode)}}class jL extends ho{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=A(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class Ml{start(){}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class JT extends Ml{constructor(){super()}indirect(e,t,n){const i=e.ambientOcclusion,r=e.reflectedLight,o=n.context.irradianceLightMap;r.indirectDiffuse.assign(oe(0)),o?r.indirectDiffuse.addAssign(o):r.indirectDiffuse.addAssign(oe(1,1,1,0)),r.indirectDiffuse.mulAssign(i),r.indirectDiffuse.mulAssign(Ct.rgb)}finish(e,t,n){const i=n.material,r=e.outgoingLight,o=n.context.environment;if(o)switch(i.combine){case da:r.rgb.assign(it(r.rgb,r.rgb.mul(o.rgb),rc.mul(Iu)));break;case Df:r.rgb.assign(it(r.rgb,o.rgb,rc.mul(Iu)));break;case Uf:r.rgb.addAssign(o.rgb.mul(rc.mul(Iu)));break;default:console.warn("THREE.BasicLightingModel: Unsupported .combine value:",i.combine);break}}}const QL=new is;class e2 extends Tt{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(QL),this.setValues(e)}setupNormal(){return di}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Id(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new jL(Lg)),t}setupOutgoingLight(){return Ct.rgb}setupLightingModel(){return new JT}}const ha=U(({f0:s,f90:e,dotVH:t})=>{const n=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return s.mul(n.oneMinus()).add(e.mul(n))}),eo=U(s=>s.diffuseColor.mul(1/Math.PI)),t2=()=>A(.25),n2=U(({dotNH:s})=>fh.mul(A(.5)).add(1).mul(A(1/Math.PI)).mul(s.pow(fh))),i2=U(({lightDirection:s})=>{const e=s.add(Bt).normalize(),t=Yt.dot(e).clamp(),n=Bt.dot(e).clamp(),i=ha({f0:ri,f90:1,dotVH:n}),r=t2(),o=n2({dotNH:t});return i.mul(r).mul(o)});class Bg extends JT{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const r=Yt.dot(e).clamp().mul(t);n.directDiffuse.addAssign(r.mul(eo({diffuseColor:Ct.rgb}))),this.specular===!0&&n.directSpecular.addAssign(r.mul(i2({lightDirection:e})).mul(rc))}indirect({ambientOcclusion:e,irradiance:t,reflectedLight:n}){n.indirectDiffuse.addAssign(t.mul(eo({diffuseColor:Ct}))),n.indirectDiffuse.mulAssign(e)}}const s2=new ud;class r2 extends Tt{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(s2),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Id(t):null}setupLightingModel(){return new Bg(!1)}}const o2=new cd;class a2 extends Tt{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(o2),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Id(t):null}setupLightingModel(){return new Bg}setupVariants(){const e=(this.shininessNode?A(this.shininessNode):jS).max(1e-4);fh.assign(e);const t=this.specularNode||eT;ri.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}}const KT=U(()=>{const s=di.dFdx().abs().max(di.dFdy().abs());return s.x.max(s.y).max(s.z)}),zg=U(s=>{const{roughness:e}=s,t=KT();let n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),jT=U(({alpha:s,dotNL:e,dotNV:t})=>{const n=s.pow2(),i=e.mul(n.add(n.oneMinus().mul(t.pow2())).sqrt()),r=t.mul(n.add(n.oneMinus().mul(e.pow2())).sqrt());return ts(.5,i.add(r).max(wM))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),c2=U(({alphaT:s,alphaB:e,dotTV:t,dotBV:n,dotTL:i,dotBL:r,dotNV:o,dotNL:a})=>{const c=a.mul(D(s.mul(t),e.mul(n),o).length()),l=o.mul(D(s.mul(i),e.mul(r),a).length());return ts(.5,c.add(l)).saturate()}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),QT=U(({alpha:s,dotNH:e})=>{const t=s.pow2(),n=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(n.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),l2=A(1/Math.PI),u2=U(({alphaT:s,alphaB:e,dotNH:t,dotTH:n,dotBH:i})=>{const r=s.mul(e),o=D(e.mul(n),s.mul(i),r.mul(t)),a=o.dot(o),c=r.div(a);return l2.mul(r.mul(c.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),Tf=U(s=>{const{lightDirection:e,f0:t,f90:n,roughness:i,f:r,USE_IRIDESCENCE:o,USE_ANISOTROPY:a}=s,c=s.normalView||Yt,l=i.pow2(),u=e.add(Bt).normalize(),h=c.dot(e).clamp(),d=c.dot(Bt).clamp(),p=c.dot(u).clamp(),f=Bt.dot(u).clamp();let x=ha({f0:t,f90:n,dotVH:f}),m,g;if(Oc(o)&&(x=Sd.mix(x,r)),Oc(a)){const y=nc.dot(e),_=nc.dot(Bt),v=nc.dot(u),I=Yr.dot(e),T=Yr.dot(Bt),w=Yr.dot(u);m=c2({alphaT:ph,alphaB:l,dotTV:_,dotBV:T,dotTL:y,dotBL:I,dotNV:d,dotNL:h}),g=u2({alphaT:ph,alphaB:l,dotNH:p,dotTH:v,dotBH:w})}else m=jT({alpha:l,dotNL:h,dotNV:d}),g=QT({alpha:l,dotNH:p});return x.mul(m).mul(g)}),kg=U(({roughness:s,dotNV:e})=>{const t=oe(-1,-.0275,-.572,.022),n=oe(1,.0425,1.04,-.04),i=s.mul(t).add(n),r=i.x.mul(i.x).min(e.mul(-9.28).exp2()).mul(i.x).add(i.y);return z(-1.04,1.04).mul(r).add(i.zw)}).setLayout({name:"DFGApprox",type:"vec2",inputs:[{name:"roughness",type:"float"},{name:"dotNV",type:"vec3"}]}),eb=U(s=>{const{dotNV:e,specularColor:t,specularF90:n,roughness:i}=s,r=kg({dotNV:e,roughness:i});return t.mul(r.x).add(n.mul(r.y))}),tb=U(({f:s,f90:e,dotVH:t})=>{const n=t.oneMinus().saturate(),i=n.mul(n),r=n.mul(i,i).clamp(0,.9999);return s.sub(D(e).mul(r)).div(r.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),h2=U(({roughness:s,dotNH:e})=>{const t=s.pow2(),n=A(1).div(t),r=e.pow2().oneMinus().max(.0078125);return A(2).add(n).mul(r.pow(n.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),d2=U(({dotNV:s,dotNL:e})=>A(1).div(A(4).mul(e.add(s).sub(e.mul(s))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),p2=U(({lightDirection:s})=>{const e=s.add(Bt).normalize(),t=Yt.dot(s).clamp(),n=Yt.dot(Bt).clamp(),i=Yt.dot(e).clamp(),r=h2({roughness:Md,dotNH:i}),o=d2({dotNV:n,dotNL:t});return Hr.mul(r).mul(o)}),f2=U(({N:s,V:e,roughness:t})=>{const r=.0078125,o=s.dot(e).saturate(),a=z(t,o.oneMinus().sqrt());return a.assign(a.mul(.984375).add(r)),a}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),m2=U(({f:s})=>{const e=s.length();return ft(e.mul(e).add(s.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),gu=U(({v1:s,v2:e})=>{const t=s.dot(e),n=t.abs().toVar(),i=n.mul(.0145206).add(.4965155).mul(n).add(.8543985).toVar(),r=n.add(4.1616724).mul(n).add(3.417594).toVar(),o=i.div(r),a=t.greaterThan(0).select(o,ft(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(o));return s.cross(e).mul(a)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),n_=U(({N:s,V:e,P:t,mInv:n,p0:i,p1:r,p2:o,p3:a})=>{const c=r.sub(i).toVar(),l=a.sub(i).toVar(),u=c.cross(l),h=D().toVar();return Oe(u.dot(t.sub(i)).greaterThanEqual(0),()=>{const d=e.sub(s.mul(e.dot(s))).normalize(),p=s.cross(d).negate(),f=n.mul(Tn(d,p,s).transpose()).toVar(),x=f.mul(i.sub(t)).normalize().toVar(),m=f.mul(r.sub(t)).normalize().toVar(),g=f.mul(o.sub(t)).normalize().toVar(),y=f.mul(a.sub(t)).normalize().toVar(),_=D(0).toVar();_.addAssign(gu({v1:x,v2:m})),_.addAssign(gu({v1:m,v2:g})),_.addAssign(gu({v1:g,v2:y})),_.addAssign(gu({v1:y,v2:x})),h.assign(D(m2({f:_})))}),h}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),Pd=1/6,nb=s=>ot(Pd,ot(s,ot(s,s.negate().add(3)).sub(3)).add(1)),bf=s=>ot(Pd,ot(s,ot(s,ot(3,s).sub(6))).add(4)),ib=s=>ot(Pd,ot(s,ot(s,ot(-3,s).add(3)).add(3)).add(1)),wf=s=>ot(Pd,Kn(s,3)),i_=s=>nb(s).add(bf(s)),s_=s=>ib(s).add(wf(s)),r_=s=>Wt(-1,bf(s).div(nb(s).add(bf(s)))),o_=s=>Wt(1,wf(s).div(ib(s).add(wf(s)))),a_=(s,e,t)=>{const n=s.uvNode,i=ot(n,e.zw).add(.5),r=fr(i),o=mr(i),a=i_(o.x),c=s_(o.x),l=r_(o.x),u=o_(o.x),h=r_(o.y),d=o_(o.y),p=z(r.x.add(l),r.y.add(h)).sub(.5).mul(e.xy),f=z(r.x.add(u),r.y.add(h)).sub(.5).mul(e.xy),x=z(r.x.add(l),r.y.add(d)).sub(.5).mul(e.xy),m=z(r.x.add(u),r.y.add(d)).sub(.5).mul(e.xy),g=i_(o.y).mul(Wt(a.mul(s.uv(p).level(t)),c.mul(s.uv(f).level(t)))),y=s_(o.y).mul(Wt(a.mul(s.uv(x).level(t)),c.mul(s.uv(m).level(t))));return g.add(y)},sb=U(([s,e=A(3)])=>{const t=z(s.size(L(e))),n=z(s.size(L(e.add(1)))),i=ts(1,t),r=ts(1,n),o=a_(s,oe(i,t),fr(e)),a=a_(s,oe(r,n),dg(e));return mr(e).mix(o,a)}),c_=U(([s,e,t,n,i])=>{const r=D(gg(e.negate(),vi(s),ts(1,n))),o=D(Jr(i[0].xyz),Jr(i[1].xyz),Jr(i[2].xyz));return vi(r).mul(t.mul(o))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),g2=U(([s,e])=>s.mul(cn(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),x2=GT(),l_=U(([s,e,t])=>{const n=x2.uv(s),i=al(A(ua.x)).mul(g2(e,t));return sb(n,i)}),u_=U(([s,e,t])=>(Oe(t.notEqual(0),()=>{const n=hg(e).negate().div(t);return ug(n.negate().mul(s))}),D(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),_2=U(([s,e,t,n,i,r,o,a,c,l,u,h,d,p,f])=>{let x,m;if(f){x=oe().toVar(),m=D().toVar();const I=u.sub(1).mul(f.mul(.025)),T=D(u.sub(I),u,u.add(I));mt({start:0,end:3},({i:w})=>{const C=T.element(w),F=c_(s,e,h,C,a),M=o.add(F),b=l.mul(c.mul(oe(M,1))),G=z(b.xy.div(b.w)).toVar();G.addAssign(1),G.divAssign(2),G.assign(z(G.x,G.y.oneMinus()));const W=l_(G,t,C);x.element(w).assign(W.element(w)),x.a.addAssign(W.a),m.element(w).assign(n.element(w).mul(u_(Jr(F),d,p).element(w)))}),x.a.divAssign(3)}else{const I=c_(s,e,h,u,a),T=o.add(I),w=l.mul(c.mul(oe(T,1))),C=z(w.xy.div(w.w)).toVar();C.addAssign(1),C.divAssign(2),C.assign(z(C.x,C.y.oneMinus())),x=l_(C,t,u),m=n.mul(u_(Jr(I),d,p))}const g=m.rgb.mul(x.rgb),y=s.dot(e).clamp(),_=D(eb({dotNV:y,specularColor:i,specularF90:r,roughness:t})),v=m.r.add(m.g,m.b).div(3);return oe(_.oneMinus().mul(g),x.a.oneMinus().mul(v).oneMinus())}),y2=Tn(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),v2=s=>{const e=s.sqrt();return D(1).add(e).div(D(1).sub(e))},h_=(s,e)=>s.sub(e).div(s.add(e)).pow2(),M2=(s,e)=>{const t=s.mul(2*Math.PI*1e-9),n=D(54856e-17,44201e-17,52481e-17),i=D(1681e3,1795300,2208400),r=D(43278e5,93046e5,66121e5),o=A(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp());let a=n.mul(r.mul(2*Math.PI).sqrt()).mul(i.mul(t).add(e).cos()).mul(t.pow2().negate().mul(r).exp());return a=D(a.x.add(o),a.y,a.z).div(10685e-11),y2.mul(a)},S2=U(({outsideIOR:s,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:i})=>{const r=it(s,e,ti(0,.03,n)),o=s.div(r).pow2().mul(A(1).sub(t.pow2())),c=A(1).sub(o).sqrt(),l=h_(r,s),u=ha({f0:l,f90:1,dotVH:t}),h=u.oneMinus(),d=r.lessThan(s).select(Math.PI,0),p=A(Math.PI).sub(d),f=v2(i.clamp(0,.9999)),x=h_(f,r.toVec3()),m=ha({f0:x,f90:1,dotVH:c}),g=D(f.x.lessThan(r).select(Math.PI,0),f.y.lessThan(r).select(Math.PI,0),f.z.lessThan(r).select(Math.PI,0)),y=r.mul(n,c,2),_=D(p).add(g),v=u.mul(m).clamp(1e-5,.9999),I=v.sqrt(),T=h.pow2().mul(m).div(D(1).sub(v));let C=u.add(T),F=T.sub(h);for(let M=1;M<=2;++M){F=F.mul(I);const b=M2(A(M).mul(y),A(M).mul(_)).mul(2);C=C.add(F.mul(b))}return C.max(D(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),T2=U(({normal:s,viewDir:e,roughness:t})=>{const n=s.dot(e).saturate(),i=t.pow2(),r=In(t.lessThan(.25),A(-339.2).mul(i).add(A(161.4).mul(t)).sub(25.9),A(-8.48).mul(i).add(A(14.3).mul(t)).sub(9.95)),o=In(t.lessThan(.25),A(44).mul(i).sub(A(23.7).mul(t)).add(3.26),A(1.97).mul(i).sub(A(3.27).mul(t)).add(.72));return In(t.lessThan(.25),0,A(.1).mul(t).sub(.025)).add(r.mul(n).add(o).exp()).mul(1/Math.PI).saturate()}),Fp=D(.04),Op=A(1);class Ld extends Ml{constructor(e=!1,t=!1,n=!1,i=!1,r=!1,o=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=i,this.transmission=r,this.dispersion=o,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=D().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=D().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=D().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=D().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=D().toVar("sheenSpecularIndirect")),this.iridescence===!0){const t=Yt.dot(Bt).clamp();this.iridescenceFresnel=S2({outsideIOR:A(1),eta2:eg,cosTheta1:t,thinFilmThickness:tg,baseF0:ri}),this.iridescenceF0=tb({f:this.iridescenceFresnel,f90:1,dotVH:t})}if(this.transmission===!0){const t=Mh,n=wg.sub(Mh).normalize(),i=Ng;e.backdrop=_2(i,n,hs,Ct,ri,kc,t,Ui,pi,ci,ic,ig,rg,sg,this.dispersion?og:null),e.backdropAlpha=mh,Ct.a.mulAssign(it(1,e.backdrop.a,mh))}}computeMultiscattering(e,t,n){const i=Yt.dot(Bt).clamp(),r=kg({roughness:hs,dotNV:i}),a=(this.iridescenceF0?Sd.mix(ri,this.iridescenceF0):ri).mul(r.x).add(n.mul(r.y)),l=r.x.add(r.y).oneMinus(),u=ri.add(ri.oneMinus().mul(.047619)),h=a.mul(u).div(l.mul(u).oneMinus());e.addAssign(a),t.addAssign(h.mul(l))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const r=Yt.dot(e).clamp().mul(t);if(this.sheen===!0&&this.sheenSpecularDirect.addAssign(r.mul(p2({lightDirection:e}))),this.clearcoat===!0){const a=Xo.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(Tf({lightDirection:e,f0:Fp,f90:Op,roughness:zc,normalView:Xo})))}n.directDiffuse.addAssign(r.mul(eo({diffuseColor:Ct.rgb}))),n.directSpecular.addAssign(r.mul(Tf({lightDirection:e,f0:ri,f90:1,roughness:hs,iridescence:this.iridescence,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:i,reflectedLight:r,ltc_1:o,ltc_2:a}){const c=t.add(n).sub(i),l=t.sub(n).sub(i),u=t.sub(n).add(i),h=t.add(n).add(i),d=Yt,p=Bt,f=Pn.toVar(),x=f2({N:d,V:p,roughness:hs}),m=o.uv(x).toVar(),g=a.uv(x).toVar(),y=Tn(D(m.x,0,m.y),D(0,1,0),D(m.z,0,m.w)).toVar(),_=ri.mul(g.x).add(ri.oneMinus().mul(g.y)).toVar();r.directSpecular.addAssign(e.mul(_).mul(n_({N:d,V:p,P:f,mInv:y,p0:c,p1:l,p2:u,p3:h}))),r.directDiffuse.addAssign(e.mul(Ct).mul(n_({N:d,V:p,P:f,mInv:Tn(1,0,0,0,1,0,0,0,1),p0:c,p1:l,p2:u,p3:h})))}indirect(e,t,n){this.indirectDiffuse(e,t,n),this.indirectSpecular(e,t,n),this.ambientOcclusion(e,t,n)}indirectDiffuse({irradiance:e,reflectedLight:t}){t.indirectDiffuse.addAssign(e.mul(eo({diffuseColor:Ct})))}indirectSpecular({radiance:e,iblIrradiance:t,reflectedLight:n}){if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(t.mul(Hr,T2({normal:Yt,viewDir:Bt,roughness:Md}))),this.clearcoat===!0){const l=Xo.dot(Bt).clamp(),u=eb({dotNV:l,specularColor:Fp,specularF90:Op,roughness:zc});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(u))}const i=D().toVar("singleScattering"),r=D().toVar("multiScattering"),o=t.mul(1/Math.PI);this.computeMultiscattering(i,r,kc);const a=i.add(r),c=Ct.mul(a.r.max(a.g).max(a.b).oneMinus());n.indirectSpecular.addAssign(e.mul(i)),n.indirectSpecular.addAssign(r.mul(o)),n.indirectDiffuse.addAssign(c.mul(o))}ambientOcclusion({ambientOcclusion:e,reflectedLight:t}){const i=Yt.dot(Bt).clamp().add(e),r=hs.mul(-16).oneMinus().negate().exp2(),o=e.sub(i.pow(r).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(e),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(e),t.indirectDiffuse.mulAssign(e),t.indirectSpecular.mulAssign(o)}finish(e){const{outgoingLight:t}=e;if(this.clearcoat===!0){const n=Xo.dot(Bt).clamp(),i=ha({dotVH:n,f0:Fp,f90:Op}),r=t.mul(dh.mul(i).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(dh));t.assign(r)}if(this.sheen===!0){const n=Hr.r.max(Hr.g).max(Hr.b).mul(.157).oneMinus(),i=t.mul(n).add(this.sheenSpecularDirect,this.sheenSpecularIndirect);t.assign(i)}}}const d_=A(1),Af=A(-2),xu=A(.8),Vp=A(-1),_u=A(.4),Bp=A(2),yu=A(.305),zp=A(3),p_=A(.21),b2=A(4),f_=A(4),w2=A(16),A2=U(([s])=>{const e=D(Dt(s)).toVar(),t=A(-1).toVar();return Oe(e.x.greaterThan(e.z),()=>{Oe(e.x.greaterThan(e.y),()=>{t.assign(In(s.x.greaterThan(0),0,3))}).Else(()=>{t.assign(In(s.y.greaterThan(0),1,4))})}).Else(()=>{Oe(e.z.greaterThan(e.y),()=>{t.assign(In(s.z.greaterThan(0),2,5))}).Else(()=>{t.assign(In(s.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),N2=U(([s,e])=>{const t=z().toVar();return Oe(e.equal(0),()=>{t.assign(z(s.z,s.y).div(Dt(s.x)))}).ElseIf(e.equal(1),()=>{t.assign(z(s.x.negate(),s.z.negate()).div(Dt(s.y)))}).ElseIf(e.equal(2),()=>{t.assign(z(s.x.negate(),s.y).div(Dt(s.z)))}).ElseIf(e.equal(3),()=>{t.assign(z(s.z.negate(),s.y).div(Dt(s.x)))}).ElseIf(e.equal(4),()=>{t.assign(z(s.x.negate(),s.z).div(Dt(s.y)))}).Else(()=>{t.assign(z(s.x,s.y).div(Dt(s.z)))}),ot(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),E2=U(([s])=>{const e=A(0).toVar();return Oe(s.greaterThanEqual(xu),()=>{e.assign(d_.sub(s).mul(Vp.sub(Af)).div(d_.sub(xu)).add(Af))}).ElseIf(s.greaterThanEqual(_u),()=>{e.assign(xu.sub(s).mul(Bp.sub(Vp)).div(xu.sub(_u)).add(Vp))}).ElseIf(s.greaterThanEqual(yu),()=>{e.assign(_u.sub(s).mul(zp.sub(Bp)).div(_u.sub(yu)).add(Bp))}).ElseIf(s.greaterThanEqual(p_),()=>{e.assign(yu.sub(s).mul(b2.sub(zp)).div(yu.sub(p_)).add(zp))}).Else(()=>{e.assign(A(-2).mul(al(ot(1.16,s))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),rb=U(([s,e])=>{const t=s.toVar();t.assign(ot(2,t).sub(1));const n=D(t,1).toVar();return Oe(e.equal(0),()=>{n.assign(n.zyx)}).ElseIf(e.equal(1),()=>{n.assign(n.xzy),n.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{n.x.mulAssign(-1)}).ElseIf(e.equal(3),()=>{n.assign(n.zyx),n.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{n.assign(n.xzy),n.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{n.z.mulAssign(-1)}),n}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),ob=U(([s,e,t,n,i,r])=>{const o=A(t),a=D(e),c=cn(E2(o),Af,r),l=mr(c),u=fr(c),h=D(Nf(s,a,u,n,i,r)).toVar();return Oe(l.notEqual(0),()=>{const d=D(Nf(s,a,u.add(1),n,i,r)).toVar();h.assign(it(h,d,l))}),h}),Nf=U(([s,e,t,n,i,r])=>{const o=A(t).toVar(),a=D(e),c=A(A2(a)).toVar(),l=A(ft(f_.sub(o),0)).toVar();o.assign(ft(o,f_));const u=A(gh(o)).toVar(),h=z(N2(a,c).mul(u.sub(2)).add(1)).toVar();return Oe(c.greaterThan(2),()=>{h.y.addAssign(u),c.subAssign(3)}),h.x.addAssign(c.mul(u)),h.x.addAssign(l.mul(ot(3,w2))),h.y.addAssign(ot(4,gh(r).sub(u))),h.x.mulAssign(n),h.y.mulAssign(i),s.uv(h).grad(z(),z())}),kp=U(({envMap:s,mipInt:e,outputDirection:t,theta:n,axis:i,CUBEUV_TEXEL_WIDTH:r,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{const c=Mi(n),l=t.mul(c).add(i.cross(t).mul(Cn(n))).add(i.mul(i.dot(t).mul(c.oneMinus())));return Nf(s,l,e,r,o,a)}),ab=U(({n:s,latitudinal:e,poleAxis:t,outputDirection:n,weights:i,samples:r,dTheta:o,mipInt:a,envMap:c,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:h})=>{const d=D(In(e,t,Ko(t,n))).toVar();Oe(lg(d.equals(D(0))),()=>{d.assign(D(n.z,0,n.x.negate()))}),d.assign(vi(d));const p=D().toVar();return p.addAssign(i.element(L(0)).mul(kp({theta:0,axis:d,outputDirection:n,mipInt:a,envMap:c,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:h}))),mt({start:L(1),end:s},({i:f})=>{Oe(f.greaterThanEqual(r),()=>{Rd()});const x=A(o.mul(A(f))).toVar();p.addAssign(i.element(f).mul(kp({theta:x.mul(-1),axis:d,outputDirection:n,mipInt:a,envMap:c,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:h}))),p.addAssign(i.element(f).mul(kp({theta:x,axis:d,outputDirection:n,mipInt:a,envMap:c,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:h})))}),oe(p,1)});let bh=null;const m_=new WeakMap;function C2(s){const e=Math.log2(s)-2,t=1/s;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:t,maxMip:e}}function R2(s){let e=m_.get(s);if((e!==void 0?e.pmremVersion:-1)!==s.pmremVersion){const n=s.image;if(s.isCubeTexture)if(I2(n))e=bh.fromCubemap(s,e);else return null;else if(P2(n))e=bh.fromEquirectangular(s,e);else return null;e.pmremVersion=s.pmremVersion,m_.set(s,e)}return e.texture}class cb extends pt{static get type(){return"PMREMNode"}constructor(e,t=null,n=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;const i=new Xt;i.isRenderTargetTexture=!0,this._texture=xt(i),this._width=pe(0),this._height=pe(0),this._maxMip=pe(0),this.updateBeforeType=We.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=C2(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(){let e=this._pmrem;const t=e?e.pmremVersion:-1,n=this._value;t!==n.pmremVersion&&(n.isPMREMTexture===!0?e=n:e=R2(n),e!==null&&(this._pmrem=e,this.updateFromTexture(e)))}setup(e){bh===null&&(bh=e.createPMREMGenerator()),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this));const n=this.value;e.renderer.coordinateSystem===Di&&n.isPMREMTexture!==!0&&n.isRenderTargetTexture===!0&&(t=D(t.x.negate(),t.yz));let i=this.levelNode;return i===null&&e.context.getTextureLevel&&(i=e.context.getTextureLevel(this)),ob(this._texture,t,i,this._width,this._height,this._maxMip)}}function I2(s){if(s==null)return!1;let e=0;const t=6;for(let n=0;n<t;n++)s[n]!==void 0&&e++;return e===t}function P2(s){return s==null?!1:s.height>0}const lb=K(cb),g_=new WeakMap;class ub extends ho{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){const{material:t}=e;let n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){const p=n.isTextureNode?n.value:t[n.property];let f=g_.get(p);f===void 0&&(f=lb(p),g_.set(p,f)),n=f}const r=t.envMap?dn("envMapIntensity","float",e.material):dn("environmentIntensity","float",e.scene),a=t.useAnisotropy===!0||t.anisotropy>0?$S:Yt,c=n.context(x_(hs,a)).mul(r),l=n.context(L2(Ng)).mul(Math.PI).mul(r),u=sc(c),h=sc(l);e.context.radiance.addAssign(u),e.context.iblIrradiance.addAssign(h);const d=e.context.lightingModel.clearcoatRadiance;if(d){const p=n.context(x_(zc,Xo)).mul(r),f=sc(p);d.addAssign(f)}}}const x_=(s,e)=>{let t=null;return{getUV:()=>(t===null&&(t=Bt.negate().reflect(e),t=s.mul(s).mix(t,e).normalize(),t=t.transformDirection(pi)),t),getTextureLevel:()=>s}},L2=s=>({getUV:()=>s,getTextureLevel:()=>A(1)}),D2=new nl;class hb extends Tt{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(D2),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new ub(t):null}setupLightingModel(){return new Ld}setupSpecular(){const e=it(D(.04),Ct.rgb,Bc);ri.assign(e),kc.assign(1)}setupVariants(){const e=this.metalnessNode?A(this.metalnessNode):iT;Bc.assign(e);let t=this.roughnessNode?A(this.roughnessNode):nT;t=zg({roughness:t}),hs.assign(t),this.setupSpecular(),Ct.assign(oe(Ct.rgb.mul(e.oneMinus()),Ct.a))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}const U2=new ad;class db extends hb{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(U2),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){const e=this.iorNode?A(this.iorNode):xT;ic.assign(e),ri.assign(it(Mn(fg(ic.sub(1).div(ic.add(1))).mul(tT),D(1)).mul(vf),Ct.rgb,Bc)),kc.assign(it(vf,1,Bc))}setupLightingModel(){return new Ld(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const t=this.clearcoatNode?A(this.clearcoatNode):rT,n=this.clearcoatRoughnessNode?A(this.clearcoatRoughnessNode):oT;dh.assign(t),zc.assign(zg({roughness:n}))}if(this.useSheen){const t=this.sheenNode?D(this.sheenNode):lT,n=this.sheenRoughnessNode?A(this.sheenRoughnessNode):uT;Hr.assign(t),Md.assign(n)}if(this.useIridescence){const t=this.iridescenceNode?A(this.iridescenceNode):dT,n=this.iridescenceIORNode?A(this.iridescenceIORNode):pT,i=this.iridescenceThicknessNode?A(this.iridescenceThicknessNode):fT;Sd.assign(t),eg.assign(n),tg.assign(i)}if(this.useAnisotropy){const t=(this.anisotropyNode?z(this.anisotropyNode):hT).toVar();Ys.assign(t.length()),Oe(Ys.equal(0),()=>{t.assign(z(1,0))}).Else(()=>{t.divAssign(z(Ys)),Ys.assign(Ys.saturate())}),ph.assign(Ys.pow2().mix(hs.pow2(),1)),nc.assign(Wr[0].mul(t.x).add(Wr[1].mul(t.y))),Yr.assign(Wr[1].mul(t.x).sub(Wr[0].mul(t.y)))}if(this.useTransmission){const t=this.transmissionNode?A(this.transmissionNode):mT,n=this.thicknessNode?A(this.thicknessNode):gT,i=this.attenuationDistanceNode?A(this.attenuationDistanceNode):_T,r=this.attenuationColorNode?D(this.attenuationColorNode):yT;if(mh.assign(t),ig.assign(n),sg.assign(i),rg.assign(r),this.useDispersion){const o=this.dispersionNode?A(this.dispersionNode):MT;og.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?D(this.clearcoatNormalNode):aT}setup(e){e.context.setupClearcoatNormal=()=>this.setupClearcoatNormal(e),super.setup(e)}copy(e){return this.clearcoatNode=e.clearcoatNode,this.clearcoatRoughnessNode=e.clearcoatRoughnessNode,this.clearcoatNormalNode=e.clearcoatNormalNode,this.sheenNode=e.sheenNode,this.sheenRoughnessNode=e.sheenRoughnessNode,this.iridescenceNode=e.iridescenceNode,this.iridescenceIORNode=e.iridescenceIORNode,this.iridescenceThicknessNode=e.iridescenceThicknessNode,this.specularIntensityNode=e.specularIntensityNode,this.specularColorNode=e.specularColorNode,this.transmissionNode=e.transmissionNode,this.thicknessNode=e.thicknessNode,this.attenuationDistanceNode=e.attenuationDistanceNode,this.attenuationColorNode=e.attenuationColorNode,this.dispersionNode=e.dispersionNode,this.anisotropyNode=e.anisotropyNode,super.copy(e)}}class F2 extends Ld{constructor(e,t,n,i){super(e,t,n),this.useSSS=i}direct({lightDirection:e,lightColor:t,reflectedLight:n},i,r){if(this.useSSS===!0){const o=r.material,{thicknessColorNode:a,thicknessDistortionNode:c,thicknessAmbientNode:l,thicknessAttenuationNode:u,thicknessPowerNode:h,thicknessScaleNode:d}=o,p=e.add(Yt.mul(c)).normalize(),f=A(Bt.dot(p.negate()).saturate().pow(h).mul(d)),x=D(f.add(l).mul(a));n.directDiffuse.addAssign(x.mul(u.mul(t)))}super.direct({lightDirection:e,lightColor:t,reflectedLight:n},i,r)}}class O2 extends db{static get type(){return"MeshSSSNodeMaterial"}constructor(e){super(e),this.thicknessColorNode=null,this.thicknessDistortionNode=A(.1),this.thicknessAmbientNode=A(0),this.thicknessAttenuationNode=A(.1),this.thicknessPowerNode=A(2),this.thicknessScaleNode=A(10)}get useSSS(){return this.thicknessColorNode!==null}setupLightingModel(){return new F2(this.useClearcoat,this.useSheen,this.useIridescence,this.useSSS)}copy(e){return this.thicknessColorNode=e.thicknessColorNode,this.thicknessDistortionNode=e.thicknessDistortionNode,this.thicknessAmbientNode=e.thicknessAmbientNode,this.thicknessAttenuationNode=e.thicknessAttenuationNode,this.thicknessPowerNode=e.thicknessPowerNode,this.thicknessScaleNode=e.thicknessScaleNode,super.copy(e)}}const V2=U(({normal:s,lightDirection:e,builder:t})=>{const n=s.dot(e),i=z(n.mul(.5).add(.5),0);if(t.material.gradientMap){const r=Ji("gradientMap","texture").context({getUV:()=>i});return D(r.r)}else{const r=i.fwidth().mul(.5);return it(D(.7),D(1),ti(A(.7).sub(r.x),A(.7).add(r.x),i.x))}});class B2 extends Ml{direct({lightDirection:e,lightColor:t,reflectedLight:n},i,r){const o=V2({normal:bd,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(o.mul(eo({diffuseColor:Ct.rgb})))}indirect({ambientOcclusion:e,irradiance:t,reflectedLight:n}){n.indirectDiffuse.addAssign(t.mul(eo({diffuseColor:Ct}))),n.indirectDiffuse.mulAssign(e)}}const z2=new Tm;class k2 extends Tt{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(z2),this.setValues(e)}setupLightingModel(){return new B2}}class pb extends pt{static get type(){return"MatcapUVNode"}constructor(){super("vec2")}setup(){const e=D(Bt.z,0,Bt.x.negate()).normalize(),t=Bt.cross(e);return z(e.dot(Yt),t.dot(Yt)).mul(.495).add(.5)}}const fb=fe(pb),G2=new bm;class H2 extends Tt{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.lights=!1,this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(G2),this.setValues(e)}setupVariants(e){const t=fb;let n;e.material.matcap?n=Ji("matcap","texture").context({getUV:()=>t}):n=D(it(.2,.8,t.y)),Ct.rgb.mulAssign(n.rgb)}}const W2=new _a;class X2 extends Tt{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.isPointsNodeMaterial=!0,this.lights=!1,this.transparent=!0,this.sizeNode=null,this.setDefaultValues(W2),this.setValues(e)}copy(e){return this.sizeNode=e.sizeNode,super.copy(e)}}class mb extends pt{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}getNodeType(e){return this.positionNode.getNodeType(e)}setup(e){const{rotationNode:t,positionNode:n}=this;if(this.getNodeType(e)==="vec2"){const r=t.cos(),o=t.sin();return ol(r,o,o.negate(),r).mul(n)}else{const r=t,o=$r(oe(1,0,0,0),oe(0,Mi(r.x),Cn(r.x).negate(),0),oe(0,Cn(r.x),Mi(r.x),0),oe(0,0,0,1)),a=$r(oe(Mi(r.y),0,Cn(r.y),0),oe(0,1,0,0),oe(Cn(r.y).negate(),0,Mi(r.y),0),oe(0,0,0,1)),c=$r(oe(Mi(r.z),Cn(r.z).negate(),0,0),oe(Cn(r.z),Mi(r.z),0,0),oe(0,0,1,0),oe(0,0,0,1));return o.mul(a).mul(c).mul(oe(n,1)).xyz}}}const Gg=K(mb),q2=new Zc;class $2 extends Tt{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this.lights=!1,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.setDefaultValues(q2),this.setValues(e)}setupPosition({object:e,camera:t,context:n}){const i=this.sizeAttenuation,{positionNode:r,rotationNode:o,scaleNode:a}=this,c=en;let l=xs.mul(D(r||0)),u=z(Ui[0].xyz.length(),Ui[1].xyz.length());a!==null&&(u=u.mul(a)),!i&&t.isPerspectiveCamera&&(u=u.mul(l.z.negate()));let h=c.xy;if(e.center&&e.center.isVector2===!0){const x=WP("center","vec2");h=h.sub(x.sub(.5))}h=h.mul(u);const d=A(o||cT),p=Gg(h,d);l=oe(l.xy.add(p),l.zw);const f=ci.mul(l);return n.vertex=c,f}copy(e){return this.positionNode=e.positionNode,this.rotationNode=e.rotationNode,this.scaleNode=e.scaleNode,super.copy(e)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}}class Y2 extends Ml{constructor(){super(),this.shadowNode=A(1).toVar("shadowMask")}direct({shadowMask:e}){this.shadowNode.mulAssign(e)}finish(e){Ct.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Ct.rgb)}}const Z2=new od;class J2 extends Tt{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Z2),this.setValues(e)}setupLightingModel(){return new Y2}}const K2=U(({texture:s,uv:e})=>{const n=D().toVar();return Oe(e.x.lessThan(1e-4),()=>{n.assign(D(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{n.assign(D(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{n.assign(D(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{n.assign(D(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{n.assign(D(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{n.assign(D(0,0,-1))}).Else(()=>{const r=s.uv(e.add(D(-.01,0,0))).r.sub(s.uv(e.add(D(.01,0,0))).r),o=s.uv(e.add(D(0,-.01,0))).r.sub(s.uv(e.add(D(0,.01,0))).r),a=s.uv(e.add(D(0,0,-.01))).r.sub(s.uv(e.add(D(0,0,.01))).r);n.assign(D(r,o,a))}),n.normalize()});class gb extends gs{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return D(.5,.5,.5)}setUpdateMatrix(){}setupUV(e,t){return t}generateUV(e,t){return t.build(e,"vec3")}normal(e){return K2({texture:this,uv:e})}}const xb=K(gb);class j2 extends Tt{static get type(){return"VolumeNodeMaterial"}constructor(e={}){super(),this.lights=!1,this.isVolumeNodeMaterial=!0,this.testNode=null,this.setValues(e)}setup(e){const t=xb(this.map,null,0),n=U(({orig:i,dir:r})=>{const o=D(-.5),a=D(.5),c=r.reciprocal(),l=o.sub(i).mul(c),u=a.sub(i).mul(c),h=Mn(l,u),d=ft(l,u),p=ft(h.x,ft(h.y,h.z)),f=Mn(d.x,Mn(d.y,d.z));return z(p,f)});this.fragmentNode=U(()=>{const i=Un(D(IS.mul(oe(wg,1)))),o=Un(Nn.sub(i)).normalize(),a=z(n({orig:i,dir:o})).toVar();a.x.greaterThan(a.y).discard(),a.assign(z(ft(a.x,0),a.y));const c=D(i.add(a.x.mul(o))).toVar(),l=D(o.abs().reciprocal()).toVar(),u=A(Mn(l.x,Mn(l.y,l.z))).toVar("delta");u.divAssign(Ji("steps","float"));const h=oe(Ji("base","color"),0).toVar();return mt({type:"float",start:a.x,end:a.y,update:"+= delta"},()=>{const d=ai("float","d").assign(t.uv(c.add(.5)).r);this.testNode!==null?this.testNode({map:t,mapValue:d,probe:c,finalColor:h}).append():(h.a.assign(1),Rd()),c.addAssign(o.mul(u))}),h.a.equal(0).discard(),oe(h)})(),super.setup(e)}}class _b extends Xn{constructor(e){super(e),this.textures={},this.nodes={}}load(e,t,n,i){const r=new es(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,o=>{try{t(this.parse(JSON.parse(o)))}catch(a){i?i(a):console.error(a),this.manager.itemError(e)}},n,i)}parseNodes(e){const t={};if(e!==void 0){for(const i of e){const{uuid:r,type:o}=i;t[r]=this.createNodeFromType(o),t[r].uuid=r}const n={nodes:t,textures:this.textures};for(const i of e)i.meta=n,t[i.uuid].deserialize(i),delete i.meta}return t}parse(e){const t=this.createNodeFromType(e.type);t.uuid=e.uuid;const i={nodes:this.parseNodes(e.nodes),textures:this.textures};return e.meta=i,t.deserialize(e),delete e.meta,t}setTextures(e){return this.textures=e,this}setNodes(e){return this.nodes=e,this}createNodeFromType(e){return this.nodes[e]===void 0?(console.error("THREE.NodeLoader: Node type not found:",e),A()):H(new this.nodes[e])}}class yb extends sl{constructor(e){super(e),this.nodes={},this.nodeMaterials={}}parse(e){const t=super.parse(e),n=this.nodes,i=e.inputNodes;for(const r in i){const o=i[r];t[r]=n[o]}return t}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}createMaterialFromType(e){const t=this.nodeMaterials[e];return t!==void 0?new t:super.createMaterialFromType(e)}}class Q2 extends gv{constructor(e){super(e),this.nodes={},this.nodeMaterials={},this._nodesJSON=null}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}parse(e,t){this._nodesJSON=e.nodes;const n=super.parse(e,t);return this._nodesJSON=null,n}parseNodes(e,t){if(e!==void 0){const n=new _b;return n.setNodes(this.nodes),n.setTextures(t),n.parseNodes(e)}return{}}parseMaterials(e,t){const n={};if(e!==void 0){const i=this.parseNodes(this._nodesJSON,t),r=new yb;r.setTextures(t),r.setNodes(i),r.setNodeMaterials(this.nodeMaterials);for(let o=0,a=e.length;o<a;o++){const c=e[o];n[c.uuid]=r.parse(c)}}return n}}class Ef{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}}class vb{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n.getSelf()}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}}class Hg{constructor(e,t){this.isNodeVar=!0,this.name=e,this.type=t}}class Mb extends Hg{constructor(e,t){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0}}class Sb{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}}let e3=0;class Lu{constructor(e=null){this.id=e3++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}}class Wg extends Nt{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getHash(){return this.uuid}generate(){return this.name}}const t3=(s,e)=>H(new Wg(s,e));class Xg extends Ye{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.code=e,this.language=n,this.includes=t}isGlobal(){return!0}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const i of t)i.build(e);const n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}}const Dd=K(Xg),n3=(s,e)=>Dd(s,e,"js"),i3=(s,e)=>Dd(s,e,"wgsl"),s3=(s,e)=>Dd(s,e,"glsl");class qg extends Xg{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}getNodeType(e){return this.getNodeFunction(e).type}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){const t=e.getDataFromNode(this);let n=t.nodeFunction;return n===void 0&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);const n=this.getNodeFunction(e),i=n.name,r=n.type,o=e.getCodeFromNode(this,r);i!==""&&(o.name=i);const a=e.getPropertyName(o),c=this.getNodeFunction(e).getCode(a);return o.code=c+`
|
|
3866
|
+
`).removeFlowTab();return e.addFlowTab(),o}}const mt=(...s)=>H(new IT(qr(s,"int"))).append(),bL=()=>lr("continue").append(),Rd=()=>lr("break").append(),wL=(...s)=>(console.warn("TSL.LoopNode: loop() has been renamed to Loop()."),mt(...s)),Lp=new WeakMap,_i=new st,e_=U(({bufferMap:s,influence:e,stride:t,width:n,depth:i,offset:r})=>{const o=L(bT).mul(t).add(r),a=o.div(n),c=o.sub(a.mul(n));return Ci(s,ls(c,a)).depth(i).mul(e)});function AL(s){const e=s.morphAttributes.position!==void 0,t=s.morphAttributes.normal!==void 0,n=s.morphAttributes.color!==void 0,i=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,r=i!==void 0?i.length:0;let o=Lp.get(s);if(o===void 0||o.count!==r){let g=function(){x.dispose(),Lp.delete(s),s.removeEventListener("dispose",g)};o!==void 0&&o.texture.dispose();const a=s.morphAttributes.position||[],c=s.morphAttributes.normal||[],l=s.morphAttributes.color||[];let u=0;e===!0&&(u=1),t===!0&&(u=2),n===!0&&(u=3);let h=s.attributes.position.count*u,d=1;const p=4096;h>p&&(d=Math.ceil(h/p),h=p);const f=new Float32Array(h*d*4*r),x=new qc(f,h,d,r);x.type=Gn,x.needsUpdate=!0;const m=u*4;for(let y=0;y<r;y++){const _=a[y],v=c[y],I=l[y],T=h*d*4*y;for(let w=0;w<_.count;w++){const C=w*m;e===!0&&(_i.fromBufferAttribute(_,w),f[T+C+0]=_i.x,f[T+C+1]=_i.y,f[T+C+2]=_i.z,f[T+C+3]=0),t===!0&&(_i.fromBufferAttribute(v,w),f[T+C+4]=_i.x,f[T+C+5]=_i.y,f[T+C+6]=_i.z,f[T+C+7]=0),n===!0&&(_i.fromBufferAttribute(I,w),f[T+C+8]=_i.x,f[T+C+9]=_i.y,f[T+C+10]=_i.z,f[T+C+11]=I.itemSize===4?_i.w:1)}}o={count:r,texture:x,stride:u,size:new J(h,d)},Lp.set(s,o),s.addEventListener("dispose",g)}return o}class PT extends Ye{static get type(){return"MorphNode"}constructor(e){super("void"),this.mesh=e,this.morphBaseInfluence=pe(1),this.updateType=We.OBJECT}setup(e){const{geometry:t}=e,n=t.morphAttributes.position!==void 0,i=t.hasAttribute("normal")&&t.morphAttributes.normal!==void 0,r=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,o=r!==void 0?r.length:0,{texture:a,stride:c,size:l}=AL(t);n===!0&&en.mulAssign(this.morphBaseInfluence),i===!0&&hi.mulAssign(this.morphBaseInfluence);const u=L(l.width);mt(o,({i:h})=>{const d=A(0).toVar();this.mesh.count>1&&this.mesh.morphTexture!==null&&this.mesh.morphTexture!==void 0?d.assign(Ci(this.mesh.morphTexture,ls(L(h).add(1),L(yl))).r):d.assign(dn("morphTargetInfluences","float").element(h).toVar()),n===!0&&en.addAssign(e_({bufferMap:a,influence:d,stride:c,width:u,depth:h,offset:L(0)})),i===!0&&hi.addAssign(e_({bufferMap:a,influence:d,stride:c,width:u,depth:h,offset:L(1)}))})}update(){const e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((t,n)=>t+n,0)}}const LT=K(PT),NL=s=>s.sort((e,t)=>e.id-t.id),EL=(s,e)=>{for(const t of e)if(t.isAnalyticLightNode&&t.light.id===s)return t;return null},Dp=new WeakMap;class DT extends Ye{static get type(){return"LightsNode"}constructor(e=[]){super("vec3"),this.totalDiffuseNode=D().toVar("totalDiffuse"),this.totalSpecularNode=D().toVar("totalSpecular"),this.outgoingLightNode=D().toVar("outgoingLight"),this._lights=e,this._lightNodes=null,this._lightNodesHash=null,this.global=!0}getHash(e){if(this._lightNodesHash===null){this._lightNodes===null&&this.setupLightsNode(e);const t=[];for(const n of this._lightNodes)t.push(n.getHash());this._lightNodesHash="lights-"+t.join(",")}return this._lightNodesHash}analyze(e){const t=e.getDataFromNode(this);for(const n of t.nodes)n.build(e)}setupLightsNode(e){const t=[],n=this._lightNodes,i=NL(this._lights),r=e.renderer.nodes.library;for(const o of i)if(o.isNode)t.push(H(o));else{let a=null;if(n!==null&&(a=EL(o.id,n)),a===null){const c=r.getLightNodeClass(o.constructor);if(c===null){console.warn(`LightsNode.setupNodeLights: Light node not found for ${o.constructor.name}`);continue}let l=null;Dp.has(o)?l=Dp.get(o):(l=new c(o),Dp.set(o,l)),t.push(l)}}this._lightNodes=t}setup(e){this._lightNodes===null&&this.setupLightsNode(e);const t=e.context,n=t.lightingModel;let i=this.outgoingLightNode;if(n){const{_lightNodes:r,totalDiffuseNode:o,totalSpecularNode:a}=this;t.outgoingLight=i;const c=e.addStack(),l=e.getDataFromNode(this);l.nodes=c.nodes,n.start(t,c,e);for(const g of r)g.build(e);n.indirect(t,c,e);const{backdrop:u,backdropAlpha:h}=t,{directDiffuse:d,directSpecular:p,indirectDiffuse:f,indirectSpecular:x}=t.reflectedLight;let m=d.add(f);u!==null&&(h!==null?m=D(h.mix(m,u)):m=D(u),t.material.transparent=!0),o.assign(m),a.assign(p.add(x)),i.assign(o.add(a)),n.finish(t,c,e),i=i.bypass(e.removeStack())}return i}setLights(e){return this._lights=e,this._lightNodes=null,this._lightNodesHash=null,this}getLights(){return this._lights}}const UT=K(DT);class ho extends Ye{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}generate(){console.warn("Abstract function.")}}class FT extends ho{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class OT extends _g{static get type(){return"LightingContextNode"}constructor(e,t=null,n=null,i=null){super(e),this.lightingModel=t,this.backdropNode=n,this.backdropAlphaNode=i,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,n=D().toVar("directDiffuse"),i=D().toVar("directSpecular"),r=D().toVar("indirectDiffuse"),o=D().toVar("indirectSpecular"),a={directDiffuse:n,directSpecular:i,indirectDiffuse:r,indirectSpecular:o};return{radiance:D().toVar("radiance"),irradiance:D().toVar("irradiance"),iblIrradiance:D().toVar("iblIrradiance"),ambientOcclusion:A(1).toVar("ambientOcclusion"),reflectedLight:a,backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}const VT=K(OT);class BT extends ho{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}let ka,Ga;class sn extends Ye{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this.isViewportNode=!0}getNodeType(){return this.scope===sn.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=We.NONE;return(this.scope===sn.SIZE||this.scope===sn.VIEWPORT)&&(e=We.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===sn.VIEWPORT?t!==null?Ga.copy(t.viewport):(e.getViewport(Ga),Ga.multiplyScalar(e.getPixelRatio())):t!==null?(ka.width=t.width,ka.height=t.height):e.getDrawingBufferSize(ka)}setup(){const e=this.scope;let t=null;return e===sn.SIZE?t=pe(ka||(ka=new J)):e===sn.VIEWPORT?t=pe(Ga||(Ga=new st)):t=z(wa.div(ua)),t}generate(e){if(this.scope===sn.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const n=e.getNodeProperties(ua).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}}sn.COORDINATE="coordinate";sn.VIEWPORT="viewport";sn.SIZE="size";sn.UV="uv";const gr=fe(sn,sn.UV),ua=fe(sn,sn.SIZE),wa=fe(sn,sn.COORDINATE),Ls=fe(sn,sn.VIEWPORT),zT=Ls.zw,kT=wa.sub(Ls.xy),CL=kT.div(zT),RL=U(()=>(console.warn('TSL.ViewportNode: "viewportResolution" is deprecated. Use "screenSize" instead.'),ua),"vec2").once()(),IL=U(()=>(console.warn('TSL.ViewportNode: "viewportTopLeft" is deprecated. Use "screenUV" instead.'),gr),"vec2").once()(),PL=U(()=>(console.warn('TSL.ViewportNode: "viewportBottomLeft" is deprecated. Use "screenUV.flipY()" instead.'),gr.flipY()),"vec2").once()(),Ha=new J;class vl extends gs{static get type(){return"ViewportTextureNode"}constructor(e=gr,t=null,n=null){n===null&&(n=new pm,n.minFilter=Jn),super(n,e,t),this.generateMipmaps=!1,this.isOutputTextureNode=!0,this.updateBeforeType=We.FRAME}updateBefore(e){const t=e.renderer;t.getDrawingBufferSize(Ha);const n=this.value;(n.image.width!==Ha.width||n.image.height!==Ha.height)&&(n.image.width=Ha.width,n.image.height=Ha.height,n.needsUpdate=!0);const i=n.generateMipmaps;n.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(n),n.generateMipmaps=i}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const LL=K(vl),GT=K(vl,null,null,{generateMipmaps:!0});let Up=null;class HT extends vl{static get type(){return"ViewportDepthTextureNode"}constructor(e=gr,t=null){Up===null&&(Up=new oo),super(e,t,Up)}}const Ug=K(HT);class jn extends Ye{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){const{scope:t}=this;return t===jn.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,n=this.valueNode;let i=null;if(t===jn.DEPTH_BASE)n!==null&&(i=XT().assign(n));else if(t===jn.DEPTH)e.isPerspectiveCamera?i=WT(Pn.z,Vo,Bo):i=oc(Pn.z,Vo,Bo);else if(t===jn.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){const r=Fg(n,Vo,Bo);i=oc(r,Vo,Bo)}else i=n;else i=oc(Pn.z,Vo,Bo);return i}}jn.DEPTH_BASE="depthBase";jn.DEPTH="depth";jn.LINEAR_DEPTH="linearDepth";const oc=(s,e,t)=>s.add(e).div(e.sub(t)),DL=(s,e,t)=>e.sub(t).mul(s).sub(e),WT=(s,e,t)=>e.add(s).mul(t).div(t.sub(e).mul(s)),Fg=(s,e,t)=>e.mul(t).div(t.sub(e).mul(s).sub(t)),XT=K(jn,jn.DEPTH_BASE),Og=fe(jn,jn.DEPTH),Th=K(jn,jn.LINEAR_DEPTH),UL=Th(Ug());Og.assign=s=>XT(s);class ur extends Ye{static get type(){return"ClippingNode"}constructor(e=ur.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{localClipIntersection:n,localClippingCount:i,globalClippingCount:r}=t,o=r+i,a=n?o-i:o;return this.scope===ur.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(t.planes,o,a):this.setupDefault(t.planes,o,a)}setupAlphaToCoverage(e,t,n){return U(()=>{const i=ds(e),r=ai("float","distanceToPlane"),o=ai("float","distanceToGradient"),a=ai("float","clipOpacity");a.assign(1);let c;if(mt(n,({i:l})=>{c=i.element(l),r.assign(Pn.dot(c.xyz).negate().add(c.w)),o.assign(r.fwidth().div(2)),a.mulAssign(ti(o.negate(),o,r)),a.equal(0).discard()}),n<t){const l=ai("float","unionclipOpacity");l.assign(1),mt({start:n,end:t},({i:u})=>{c=i.element(u),r.assign(Pn.dot(c.xyz).negate().add(c.w)),o.assign(r.fwidth().div(2)),l.mulAssign(ti(o.negate(),o,r).oneMinus())}),a.mulAssign(l.oneMinus())}Ct.a.mulAssign(a),Ct.a.equal(0).discard()})()}setupDefault(e,t,n){return U(()=>{const i=ds(e);let r;if(mt(n,({i:o})=>{r=i.element(o),Pn.dot(r.xyz).greaterThan(r.w).discard()}),n<t){const o=ai("bool","clipped");o.assign(!0),mt({start:n,end:t},({i:a})=>{r=i.element(a),o.assign(Pn.dot(r.xyz).greaterThan(r.w).and(o))}),o.discard()}})()}}ur.ALPHA_TO_COVERAGE="alphaToCoverage";ur.DEFAULT="default";const FL=()=>H(new ur),OL=()=>H(new ur(ur.ALPHA_TO_COVERAGE));class Tt extends mn{static get type(){return"NodeMaterial"}constructor(){super(),this.isNodeMaterial=!0,this.type=this.constructor.type,this.forceSinglePass=!1,this.fog=!0,this.lights=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.positionNode=null,this.depthNode=null,this.shadowNode=null,this.shadowPositionNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null}customProgramCacheKey(){return this.type+zm(this)}build(e){this.setup(e)}setupObserver(e){return new Vv(e)}setup(e){e.context.setupNormal=()=>this.setupNormal(e),e.addStack(),e.stack.outputNode=this.vertexNode||this.setupPosition(e),e.addFlow("vertex",e.removeStack()),e.addStack();let t;const n=this.setupClipping(e);if(this.depthWrite===!0&&this.setupDepth(e),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupVariants(e);const i=this.setupLighting(e);n!==null&&e.stack.add(n);const r=oe(i,Ct.a).max(0);if(t=this.setupOutput(e,r),ng.assign(t),this.outputNode!==null&&(t=this.outputNode),e.renderer.getRenderTarget()!==null){const a=e.renderer.getMRT(),c=this.mrtNode;a!==null?(t=a,c!==null&&(t=a.merge(c))):c!==null&&(t=c)}}else{let i=this.fragmentNode;i.isOutputStructNode!==!0&&(i=oe(i)),t=this.setupOutput(e,i)}e.stack.outputNode=t,e.addFlow("fragment",e.removeStack()),e.monitor=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;const{globalClippingCount:t,localClippingCount:n}=e.clippingContext;let i=null;if(t||n){const r=e.renderer.samples;this.alphaToCoverage&&r>1?i=OL():e.stack.add(FL())}return i}setupDepth(e){const{renderer:t}=e;let n=this.depthNode;if(n===null){const i="getMRT"in t&&t.getMRT();i&&i.has("depth")?n=i.get("depth"):t.logarithmicDepthBuffer===!0&&(n=Sf().w.add(1).log2().mul(CS).mul(.5))}n!==null&&Og.assign(n).append()}setupPosition(e){const{object:t}=e,n=t.geometry;if(e.addStack(),(n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&<(t).append(),t.isSkinnedMesh===!0&&RT(t).append(),this.displacementMap){const r=Ji("displacementMap","texture"),o=Ji("displacementScale","float"),a=Ji("displacementBias","float");en.addAssign(hi.normalize().mul(r.x.mul(o).add(a)))}t.isBatchedMesh&&CT(t).append(),t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&NT(t).append(),this.positionNode!==null&&en.assign(this.positionNode);const i=Sf();return e.context.vertex=e.removeStack(),e.context.mvp=i,i}setupDiffuseColor({object:e,geometry:t}){let n=this.colorNode?oe(this.colorNode):la;this.vertexColors===!0&&t.hasAttribute("color")&&(n=oe(n.xyz.mul(vn("color","vec3")),n.a)),e.instanceColor&&(n=Yi("vec3","vInstanceColor").mul(n)),e.isBatchedMesh&&e._colorsTexture&&(n=Yi("vec3","vBatchColor").mul(n)),Ct.assign(n);const i=this.opacityNode?A(this.opacityNode):Cd;if(Ct.a.assign(Ct.a.mul(i)),this.alphaTestNode!==null||this.alphaTest>0){const r=this.alphaTestNode!==null?A(this.alphaTestNode):KS;Ct.a.lessThanEqual(r).discard()}this.transparent===!1&&this.blending===Ps&&this.alphaToCoverage===!1&&Ct.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?D(0):Ct.rgb}setupNormal(){return this.normalNode?D(this.normalNode):sT}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Ji("envMap","cubeTexture"):Ji("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new BT(Lg)),t}setupLights(e){const t=[],n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);const i=this.setupLightMap(e);if(i&&i.isLightingNode&&t.push(i),this.aoNode!==null||e.material.aoMap){const o=this.aoNode!==null?this.aoNode:ST;t.push(new FT(o))}let r=this.lightsNode||e.lightsNode;return t.length>0&&(r=UT([...r.getLights(),...t])),r}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:n,backdropAlphaNode:i,emissiveNode:r}=this,a=this.lights===!0||this.lightsNode!==null?this.setupLights(e):null;let c=this.setupOutgoingLight(e);if(a&&a.getScope().getLights().length>0){const l=this.setupLightingModel(e);c=VT(a,l,n,i)}else n!==null&&(c=D(i!==null?it(c,n,i):n));return(r&&r.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(gf.assign(D(r||QS)),c=c.add(gf)),c}setupOutput(e,t){if(this.fog===!0){const n=e.fogNode;n&&(t=oe(n.mix(t.rgb,n.colorNode),t.a))}return t}setDefaultValues(e){for(const n in e){const i=e[n];this[n]===void 0&&(this[n]=i,i&&i.clone&&(this[n]=i.clone()))}const t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(const n in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,n)===void 0&&t[n].get!==void 0&&Object.defineProperty(this.constructor.prototype,n,t[n])}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});const n=mn.prototype.toJSON.call(this,e),i=Fc(this);n.inputNodes={};for(const{property:o,childNode:a}of i)n.inputNodes[o]=a.toJSON(e).uuid;function r(o){const a=[];for(const c in o){const l=o[c];delete l.metadata,a.push(l)}return a}if(t){const o=r(e.textures),a=r(e.images),c=r(e.nodes);o.length>0&&(n.textures=o),a.length>0&&(n.images=a),c.length>0&&(n.nodes=c)}return n}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.positionNode=e.positionNode,this.depthNode=e.depthNode,this.shadowNode=e.shadowNode,this.shadowPositionNode=e.shadowPositionNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,super.copy(e)}}const VL=new _a;class BL extends Tt{static get type(){return"InstancedPointsNodeMaterial"}constructor(e={}){super(),this.lights=!1,this.useAlphaToCoverage=!0,this.useColor=e.vertexColors,this.pointWidth=1,this.pointColorNode=null,this.pointWidthNode=null,this.setDefaultValues(VL),this.setValues(e)}setup(e){this.setupShaders(e),super.setup(e)}setupShaders({renderer:e}){const t=this.alphaToCoverage,n=this.useColor;this.vertexNode=U(()=>{const i=vn("instancePosition").xyz,r=oe(xs.mul(oe(i,1))),o=Ls.z.div(Ls.w),a=ci.mul(r),c=Nn.xy.toVar();return c.mulAssign(this.pointWidthNode?this.pointWidthNode:vT),c.assign(c.div(Ls.z)),c.y.assign(c.y.mul(o)),c.assign(c.mul(a.w)),a.addAssign(oe(c,0,0)),a})(),this.fragmentNode=U(()=>{const i=A(1).toVar(),r=mg(rt().mul(2).sub(1));if(t&&e.samples>1){const a=A(r.fwidth()).toVar();i.assign(ti(a.oneMinus(),a.add(1),r).oneMinus())}else r.greaterThan(1).discard();let o;return this.pointColorNode?o=this.pointColorNode:n?o=vn("instanceColor").mul(la):o=la,i.mulAssign(Cd),oe(o,i)})()}get alphaToCoverage(){return this.useAlphaToCoverage}set alphaToCoverage(e){this.useAlphaToCoverage!==e&&(this.useAlphaToCoverage=e,this.needsUpdate=!0)}}const zL=new Fn;class kL extends Tt{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.lights=!1,this.setDefaultValues(zL),this.setValues(e)}}const GL=new hd;class HL extends Tt{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.lights=!1,this.setDefaultValues(GL),this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode,t=this.dashScaleNode?A(this.dashScaleNode):Sh,n=this.dashSizeNode?A(this.dashSizeNode):Ig,i=this.dashSizeNode?A(this.dashGapNode):Pg;Zr.assign(n),Gc.assign(i);const r=Un(vn("lineDistance").mul(t));(e?r.add(e):r).mod(Zr.add(Gc)).greaterThan(Zr).discard()}}const WL=new hd;class XL extends Tt{static get type(){return"Line2NodeMaterial"}constructor(e={}){super(),this.lights=!1,this.setDefaultValues(WL),this.useAlphaToCoverage=!0,this.useColor=e.vertexColors,this.useDash=e.dashed,this.useWorldUnits=!1,this.dashOffset=0,this.lineWidth=1,this.lineColorNode=null,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setup(e){this.setupShaders(e),super.setup(e)}setupShaders({renderer:e}){const t=this.alphaToCoverage,n=this.useColor,i=this.dashed,r=this.worldUnits,o=U(({start:c,end:l})=>{const u=ci.element(2).element(2),p=ci.element(3).element(2).mul(-.5).div(u).sub(c.z).div(l.z.sub(c.z));return oe(it(c.xyz,l.xyz,p),l.w)}).setLayout({name:"trimSegment",type:"vec4",inputs:[{name:"start",type:"vec4"},{name:"end",type:"vec4"}]});this.vertexNode=U(()=>{const c=vn("instanceStart"),l=vn("instanceEnd"),u=oe(xs.mul(oe(c,1))).toVar("start"),h=oe(xs.mul(oe(l,1))).toVar("end");r&&(Yi("vec3","worldStart").assign(u.xyz),Yi("vec3","worldEnd").assign(h.xyz));const d=Ls.z.div(Ls.w),p=ci.element(2).element(3).equal(-1);Oe(p,()=>{Oe(u.z.lessThan(0).and(h.z.greaterThan(0)),()=>{h.assign(o({start:u,end:h}))}).ElseIf(h.z.lessThan(0).and(u.z.greaterThanEqual(0)),()=>{u.assign(o({start:h,end:u}))})});const f=ci.mul(u),x=ci.mul(h),m=f.xyz.div(f.w),g=x.xyz.div(x.w),y=g.xy.sub(m.xy).toVar();y.x.assign(y.x.mul(d)),y.assign(y.normalize());const _=oe().toVar();if(r){const v=h.xyz.sub(u.xyz).normalize(),I=it(u.xyz,h.xyz,.5).normalize(),T=v.cross(I).normalize(),w=v.cross(T),C=Yi("vec4","worldPos");C.assign(Nn.y.lessThan(.5).select(u,h));const F=Pu.mul(.5);C.addAssign(oe(Nn.x.lessThan(0).select(T.mul(F),T.mul(F).negate()),0)),i||(C.addAssign(oe(Nn.y.lessThan(.5).select(v.mul(F).negate(),v.mul(F)),0)),C.addAssign(oe(w.mul(F),0)),Oe(Nn.y.greaterThan(1).or(Nn.y.lessThan(0)),()=>{C.subAssign(oe(w.mul(2).mul(F),0))})),_.assign(ci.mul(C));const M=D().toVar();M.assign(Nn.y.lessThan(.5).select(m,g)),_.z.assign(M.z.mul(_.w))}else{const v=z(y.y,y.x.negate()).toVar("offset");y.x.assign(y.x.div(d)),v.x.assign(v.x.div(d)),v.assign(Nn.x.lessThan(0).select(v.negate(),v)),Oe(Nn.y.lessThan(0),()=>{v.assign(v.sub(y))}).ElseIf(Nn.y.greaterThan(1),()=>{v.assign(v.add(y))}),v.assign(v.mul(Pu)),v.assign(v.div(Ls.w)),_.assign(Nn.y.lessThan(.5).select(f,x)),v.assign(v.mul(_.w)),_.assign(_.add(oe(v,0,0)))}return _})();const a=U(({p1:c,p2:l,p3:u,p4:h})=>{const d=c.sub(u),p=h.sub(u),f=l.sub(c),x=d.dot(p),m=p.dot(f),g=d.dot(f),y=p.dot(p),v=f.dot(f).mul(y).sub(m.mul(m)),T=x.mul(m).sub(g.mul(y)).div(v).clamp(),w=x.add(m.mul(T)).div(y).clamp();return z(T,w)});this.fragmentNode=U(()=>{const c=rt();if(i){const h=this.offsetNode?A(this.offsetNodeNode):Mf,d=this.dashScaleNode?A(this.dashScaleNode):Sh,p=this.dashSizeNode?A(this.dashSizeNode):Ig,f=this.dashSizeNode?A(this.dashGapNode):Pg;Zr.assign(p),Gc.assign(f);const x=vn("instanceDistanceStart"),m=vn("instanceDistanceEnd"),g=Nn.y.lessThan(.5).select(d.mul(x),Sh.mul(m)),y=Un(g.add(Mf)),_=h?y.add(h):y;c.y.lessThan(-1).or(c.y.greaterThan(1)).discard(),_.mod(Zr.add(Gc)).greaterThan(Zr).discard()}const l=A(1).toVar("alpha");if(r){const h=Yi("vec3","worldStart"),d=Yi("vec3","worldEnd"),p=Yi("vec4","worldPos").xyz.normalize().mul(1e5),f=d.sub(h),x=a({p1:h,p2:d,p3:D(0,0,0),p4:p}),m=h.add(f.mul(x.x)),g=p.mul(x.y),v=m.sub(g).length().div(Pu);if(!i)if(t&&e.samples>1){const I=v.fwidth();l.assign(ti(I.negate().add(.5),I.add(.5),v).oneMinus())}else v.greaterThan(.5).discard()}else if(t&&e.samples>1){const h=c.x,d=c.y.greaterThan(0).select(c.y.sub(1),c.y.add(1)),p=h.mul(h).add(d.mul(d)),f=A(p.fwidth()).toVar("dlen");Oe(c.y.abs().greaterThan(1),()=>{l.assign(ti(f.oneMinus(),f.add(1),p).oneMinus())})}else Oe(c.y.abs().greaterThan(1),()=>{const h=c.x,d=c.y.greaterThan(0).select(c.y.sub(1),c.y.add(1));h.mul(h).add(d.mul(d)).greaterThan(1).discard()});let u;if(this.lineColorNode)u=this.lineColorNode;else if(n){const h=vn("instanceColorStart"),d=vn("instanceColorEnd");u=Nn.y.lessThan(.5).select(h,d).mul(la)}else u=la;return oe(u,l)})()}get worldUnits(){return this.useWorldUnits}set worldUnits(e){this.useWorldUnits!==e&&(this.useWorldUnits=e,this.needsUpdate=!0)}get dashed(){return this.useDash}set dashed(e){this.useDash!==e&&(this.useDash=e,this.needsUpdate=!0)}get alphaToCoverage(){return this.useAlphaToCoverage}set alphaToCoverage(e){this.useAlphaToCoverage!==e&&(this.useAlphaToCoverage=e,this.needsUpdate=!0)}}const qT=s=>H(s).mul(.5).add(.5),qL=s=>H(s).mul(2).sub(1),$L=new ld;class YL extends Tt{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.lights=!1,this.isMeshNormalNodeMaterial=!0,this.setDefaultValues($L),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?A(this.opacityNode):Cd;Ct.assign(oe(qT(Yt),e))}}class $T extends pt{static get type(){return"EquirectUVNode"}constructor(e=Ag){super("vec2"),this.dirNode=e}setup(){const e=this.dirNode,t=e.z.atan2(e.x).mul(1/(Math.PI*2)).add(.5),n=e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return z(t,n)}}const Vg=K($T);class YT extends Hh{constructor(e=1,t={}){super(e,t),this.isCubeRenderTarget=!0}fromEquirectangularTexture(e,t){const n=t.minFilter,i=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r=new _s(5,5,5),o=Vg(Ag),a=new Tt;a.colorNode=xt(t,o,0),a.side=ln,a.blending=Fi;const c=new kt(r,a),l=new $h;l.add(c),t.minFilter===Jn&&(t.minFilter=Ut);const u=new Gh(1,10,this),h=e.getMRT();return e.setMRT(null),u.update(e,l),e.setMRT(h),t.minFilter=n,t.currentGenerateMipmaps=i,c.geometry.dispose(),c.material.dispose(),this}}const ac=new WeakMap;class ZL extends pt{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Ad();const t=new io;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=We.RENDER}updateBefore(e){const{renderer:t,material:n}=e,i=this.envNode;if(i.isTextureNode||i.isMaterialReferenceNode){const r=i.isTextureNode?i.value:n[i.property];if(r&&r.isTexture){const o=r.mapping;if(o===ir||o===sr){if(ac.has(r)){const a=ac.get(r);t_(a,r.mapping),this._cubeTexture=a}else{const a=r.image;if(JL(a)){const c=new YT(a.height);c.fromEquirectangularTexture(t,r),t_(c.texture,r.mapping),this._cubeTexture=c.texture,ac.set(r,c.texture),r.addEventListener("dispose",ZT)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function JL(s){return s==null?!1:s.height>0}function ZT(s){const e=s.target;e.removeEventListener("dispose",ZT);const t=ac.get(e);t!==void 0&&(ac.delete(e),t.dispose())}function t_(s,e){e===ir?s.mapping=wi:e===sr&&(s.mapping=Vi)}const KL=K(ZL);class Id extends ho{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=KL(this.envNode)}}class jL extends ho{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=A(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class Ml{start(){}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class JT extends Ml{constructor(){super()}indirect(e,t,n){const i=e.ambientOcclusion,r=e.reflectedLight,o=n.context.irradianceLightMap;r.indirectDiffuse.assign(oe(0)),o?r.indirectDiffuse.addAssign(o):r.indirectDiffuse.addAssign(oe(1,1,1,0)),r.indirectDiffuse.mulAssign(i),r.indirectDiffuse.mulAssign(Ct.rgb)}finish(e,t,n){const i=n.material,r=e.outgoingLight,o=n.context.environment;if(o)switch(i.combine){case da:r.rgb.assign(it(r.rgb,r.rgb.mul(o.rgb),rc.mul(Iu)));break;case Df:r.rgb.assign(it(r.rgb,o.rgb,rc.mul(Iu)));break;case Uf:r.rgb.addAssign(o.rgb.mul(rc.mul(Iu)));break;default:console.warn("THREE.BasicLightingModel: Unsupported .combine value:",i.combine);break}}}const QL=new is;class e2 extends Tt{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(QL),this.setValues(e)}setupNormal(){return di}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Id(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new jL(Lg)),t}setupOutgoingLight(){return Ct.rgb}setupLightingModel(){return new JT}}const ha=U(({f0:s,f90:e,dotVH:t})=>{const n=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return s.mul(n.oneMinus()).add(e.mul(n))}),eo=U(s=>s.diffuseColor.mul(1/Math.PI)),t2=()=>A(.25),n2=U(({dotNH:s})=>fh.mul(A(.5)).add(1).mul(A(1/Math.PI)).mul(s.pow(fh))),i2=U(({lightDirection:s})=>{const e=s.add(Bt).normalize(),t=Yt.dot(e).clamp(),n=Bt.dot(e).clamp(),i=ha({f0:ri,f90:1,dotVH:n}),r=t2(),o=n2({dotNH:t});return i.mul(r).mul(o)});class Bg extends JT{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const r=Yt.dot(e).clamp().mul(t);n.directDiffuse.addAssign(r.mul(eo({diffuseColor:Ct.rgb}))),this.specular===!0&&n.directSpecular.addAssign(r.mul(i2({lightDirection:e})).mul(rc))}indirect({ambientOcclusion:e,irradiance:t,reflectedLight:n}){n.indirectDiffuse.addAssign(t.mul(eo({diffuseColor:Ct}))),n.indirectDiffuse.mulAssign(e)}}const s2=new ud;class r2 extends Tt{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(s2),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Id(t):null}setupLightingModel(){return new Bg(!1)}}const o2=new cd;class a2 extends Tt{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(o2),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Id(t):null}setupLightingModel(){return new Bg}setupVariants(){const e=(this.shininessNode?A(this.shininessNode):jS).max(1e-4);fh.assign(e);const t=this.specularNode||eT;ri.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}}const KT=U(()=>{const s=di.dFdx().abs().max(di.dFdy().abs());return s.x.max(s.y).max(s.z)}),zg=U(s=>{const{roughness:e}=s,t=KT();let n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),jT=U(({alpha:s,dotNL:e,dotNV:t})=>{const n=s.pow2(),i=e.mul(n.add(n.oneMinus().mul(t.pow2())).sqrt()),r=t.mul(n.add(n.oneMinus().mul(e.pow2())).sqrt());return ts(.5,i.add(r).max(wM))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),c2=U(({alphaT:s,alphaB:e,dotTV:t,dotBV:n,dotTL:i,dotBL:r,dotNV:o,dotNL:a})=>{const c=a.mul(D(s.mul(t),e.mul(n),o).length()),l=o.mul(D(s.mul(i),e.mul(r),a).length());return ts(.5,c.add(l)).saturate()}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),QT=U(({alpha:s,dotNH:e})=>{const t=s.pow2(),n=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(n.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),l2=A(1/Math.PI),u2=U(({alphaT:s,alphaB:e,dotNH:t,dotTH:n,dotBH:i})=>{const r=s.mul(e),o=D(e.mul(n),s.mul(i),r.mul(t)),a=o.dot(o),c=r.div(a);return l2.mul(r.mul(c.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),Tf=U(s=>{const{lightDirection:e,f0:t,f90:n,roughness:i,f:r,USE_IRIDESCENCE:o,USE_ANISOTROPY:a}=s,c=s.normalView||Yt,l=i.pow2(),u=e.add(Bt).normalize(),h=c.dot(e).clamp(),d=c.dot(Bt).clamp(),p=c.dot(u).clamp(),f=Bt.dot(u).clamp();let x=ha({f0:t,f90:n,dotVH:f}),m,g;if(Oc(o)&&(x=Sd.mix(x,r)),Oc(a)){const y=nc.dot(e),_=nc.dot(Bt),v=nc.dot(u),I=Yr.dot(e),T=Yr.dot(Bt),w=Yr.dot(u);m=c2({alphaT:ph,alphaB:l,dotTV:_,dotBV:T,dotTL:y,dotBL:I,dotNV:d,dotNL:h}),g=u2({alphaT:ph,alphaB:l,dotNH:p,dotTH:v,dotBH:w})}else m=jT({alpha:l,dotNL:h,dotNV:d}),g=QT({alpha:l,dotNH:p});return x.mul(m).mul(g)}),kg=U(({roughness:s,dotNV:e})=>{const t=oe(-1,-.0275,-.572,.022),n=oe(1,.0425,1.04,-.04),i=s.mul(t).add(n),r=i.x.mul(i.x).min(e.mul(-9.28).exp2()).mul(i.x).add(i.y);return z(-1.04,1.04).mul(r).add(i.zw)}).setLayout({name:"DFGApprox",type:"vec2",inputs:[{name:"roughness",type:"float"},{name:"dotNV",type:"vec3"}]}),eb=U(s=>{const{dotNV:e,specularColor:t,specularF90:n,roughness:i}=s,r=kg({dotNV:e,roughness:i});return t.mul(r.x).add(n.mul(r.y))}),tb=U(({f:s,f90:e,dotVH:t})=>{const n=t.oneMinus().saturate(),i=n.mul(n),r=n.mul(i,i).clamp(0,.9999);return s.sub(D(e).mul(r)).div(r.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),h2=U(({roughness:s,dotNH:e})=>{const t=s.pow2(),n=A(1).div(t),r=e.pow2().oneMinus().max(.0078125);return A(2).add(n).mul(r.pow(n.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),d2=U(({dotNV:s,dotNL:e})=>A(1).div(A(4).mul(e.add(s).sub(e.mul(s))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),p2=U(({lightDirection:s})=>{const e=s.add(Bt).normalize(),t=Yt.dot(s).clamp(),n=Yt.dot(Bt).clamp(),i=Yt.dot(e).clamp(),r=h2({roughness:Md,dotNH:i}),o=d2({dotNV:n,dotNL:t});return Hr.mul(r).mul(o)}),f2=U(({N:s,V:e,roughness:t})=>{const r=.0078125,o=s.dot(e).saturate(),a=z(t,o.oneMinus().sqrt());return a.assign(a.mul(.984375).add(r)),a}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),m2=U(({f:s})=>{const e=s.length();return ft(e.mul(e).add(s.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),gu=U(({v1:s,v2:e})=>{const t=s.dot(e),n=t.abs().toVar(),i=n.mul(.0145206).add(.4965155).mul(n).add(.8543985).toVar(),r=n.add(4.1616724).mul(n).add(3.417594).toVar(),o=i.div(r),a=t.greaterThan(0).select(o,ft(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(o));return s.cross(e).mul(a)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),n_=U(({N:s,V:e,P:t,mInv:n,p0:i,p1:r,p2:o,p3:a})=>{const c=r.sub(i).toVar(),l=a.sub(i).toVar(),u=c.cross(l),h=D().toVar();return Oe(u.dot(t.sub(i)).greaterThanEqual(0),()=>{const d=e.sub(s.mul(e.dot(s))).normalize(),p=s.cross(d).negate(),f=n.mul(Tn(d,p,s).transpose()).toVar(),x=f.mul(i.sub(t)).normalize().toVar(),m=f.mul(r.sub(t)).normalize().toVar(),g=f.mul(o.sub(t)).normalize().toVar(),y=f.mul(a.sub(t)).normalize().toVar(),_=D(0).toVar();_.addAssign(gu({v1:x,v2:m})),_.addAssign(gu({v1:m,v2:g})),_.addAssign(gu({v1:g,v2:y})),_.addAssign(gu({v1:y,v2:x})),h.assign(D(m2({f:_})))}),h}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),Pd=1/6,nb=s=>ot(Pd,ot(s,ot(s,s.negate().add(3)).sub(3)).add(1)),bf=s=>ot(Pd,ot(s,ot(s,ot(3,s).sub(6))).add(4)),ib=s=>ot(Pd,ot(s,ot(s,ot(-3,s).add(3)).add(3)).add(1)),wf=s=>ot(Pd,Kn(s,3)),i_=s=>nb(s).add(bf(s)),s_=s=>ib(s).add(wf(s)),r_=s=>Wt(-1,bf(s).div(nb(s).add(bf(s)))),o_=s=>Wt(1,wf(s).div(ib(s).add(wf(s)))),a_=(s,e,t)=>{const n=s.uvNode,i=ot(n,e.zw).add(.5),r=fr(i),o=mr(i),a=i_(o.x),c=s_(o.x),l=r_(o.x),u=o_(o.x),h=r_(o.y),d=o_(o.y),p=z(r.x.add(l),r.y.add(h)).sub(.5).mul(e.xy),f=z(r.x.add(u),r.y.add(h)).sub(.5).mul(e.xy),x=z(r.x.add(l),r.y.add(d)).sub(.5).mul(e.xy),m=z(r.x.add(u),r.y.add(d)).sub(.5).mul(e.xy),g=i_(o.y).mul(Wt(a.mul(s.uv(p).level(t)),c.mul(s.uv(f).level(t)))),y=s_(o.y).mul(Wt(a.mul(s.uv(x).level(t)),c.mul(s.uv(m).level(t))));return g.add(y)},sb=U(([s,e=A(3)])=>{const t=z(s.size(L(e))),n=z(s.size(L(e.add(1)))),i=ts(1,t),r=ts(1,n),o=a_(s,oe(i,t),fr(e)),a=a_(s,oe(r,n),dg(e));return mr(e).mix(o,a)}),c_=U(([s,e,t,n,i])=>{const r=D(gg(e.negate(),vi(s),ts(1,n))),o=D(Jr(i[0].xyz),Jr(i[1].xyz),Jr(i[2].xyz));return vi(r).mul(t.mul(o))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),g2=U(([s,e])=>s.mul(cn(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),x2=GT(),l_=U(([s,e,t])=>{const n=x2.uv(s),i=al(A(ua.x)).mul(g2(e,t));return sb(n,i)}),u_=U(([s,e,t])=>(Oe(t.notEqual(0),()=>{const n=hg(e).negate().div(t);return ug(n.negate().mul(s))}),D(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),_2=U(([s,e,t,n,i,r,o,a,c,l,u,h,d,p,f])=>{let x,m;if(f){x=oe().toVar(),m=D().toVar();const I=u.sub(1).mul(f.mul(.025)),T=D(u.sub(I),u,u.add(I));mt({start:0,end:3},({i:w})=>{const C=T.element(w),F=c_(s,e,h,C,a),M=o.add(F),b=l.mul(c.mul(oe(M,1))),G=z(b.xy.div(b.w)).toVar();G.addAssign(1),G.divAssign(2),G.assign(z(G.x,G.y.oneMinus()));const W=l_(G,t,C);x.element(w).assign(W.element(w)),x.a.addAssign(W.a),m.element(w).assign(n.element(w).mul(u_(Jr(F),d,p).element(w)))}),x.a.divAssign(3)}else{const I=c_(s,e,h,u,a),T=o.add(I),w=l.mul(c.mul(oe(T,1))),C=z(w.xy.div(w.w)).toVar();C.addAssign(1),C.divAssign(2),C.assign(z(C.x,C.y.oneMinus())),x=l_(C,t,u),m=n.mul(u_(Jr(I),d,p))}const g=m.rgb.mul(x.rgb),y=s.dot(e).clamp(),_=D(eb({dotNV:y,specularColor:i,specularF90:r,roughness:t})),v=m.r.add(m.g,m.b).div(3);return oe(_.oneMinus().mul(g),x.a.oneMinus().mul(v).oneMinus())}),y2=Tn(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),v2=s=>{const e=s.sqrt();return D(1).add(e).div(D(1).sub(e))},h_=(s,e)=>s.sub(e).div(s.add(e)).pow2(),M2=(s,e)=>{const t=s.mul(2*Math.PI*1e-9),n=D(54856e-17,44201e-17,52481e-17),i=D(1681e3,1795300,2208400),r=D(43278e5,93046e5,66121e5),o=A(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp());let a=n.mul(r.mul(2*Math.PI).sqrt()).mul(i.mul(t).add(e).cos()).mul(t.pow2().negate().mul(r).exp());return a=D(a.x.add(o),a.y,a.z).div(10685e-11),y2.mul(a)},S2=U(({outsideIOR:s,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:i})=>{const r=it(s,e,ti(0,.03,n)),o=s.div(r).pow2().mul(A(1).sub(t.pow2())),c=A(1).sub(o).sqrt(),l=h_(r,s),u=ha({f0:l,f90:1,dotVH:t}),h=u.oneMinus(),d=r.lessThan(s).select(Math.PI,0),p=A(Math.PI).sub(d),f=v2(i.clamp(0,.9999)),x=h_(f,r.toVec3()),m=ha({f0:x,f90:1,dotVH:c}),g=D(f.x.lessThan(r).select(Math.PI,0),f.y.lessThan(r).select(Math.PI,0),f.z.lessThan(r).select(Math.PI,0)),y=r.mul(n,c,2),_=D(p).add(g),v=u.mul(m).clamp(1e-5,.9999),I=v.sqrt(),T=h.pow2().mul(m).div(D(1).sub(v));let C=u.add(T),F=T.sub(h);for(let M=1;M<=2;++M){F=F.mul(I);const b=M2(A(M).mul(y),A(M).mul(_)).mul(2);C=C.add(F.mul(b))}return C.max(D(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),T2=U(({normal:s,viewDir:e,roughness:t})=>{const n=s.dot(e).saturate(),i=t.pow2(),r=In(t.lessThan(.25),A(-339.2).mul(i).add(A(161.4).mul(t)).sub(25.9),A(-8.48).mul(i).add(A(14.3).mul(t)).sub(9.95)),o=In(t.lessThan(.25),A(44).mul(i).sub(A(23.7).mul(t)).add(3.26),A(1.97).mul(i).sub(A(3.27).mul(t)).add(.72));return In(t.lessThan(.25),0,A(.1).mul(t).sub(.025)).add(r.mul(n).add(o).exp()).mul(1/Math.PI).saturate()}),Fp=D(.04),Op=A(1);class Ld extends Ml{constructor(e=!1,t=!1,n=!1,i=!1,r=!1,o=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=i,this.transmission=r,this.dispersion=o,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=D().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=D().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=D().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=D().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=D().toVar("sheenSpecularIndirect")),this.iridescence===!0){const t=Yt.dot(Bt).clamp();this.iridescenceFresnel=S2({outsideIOR:A(1),eta2:eg,cosTheta1:t,thinFilmThickness:tg,baseF0:ri}),this.iridescenceF0=tb({f:this.iridescenceFresnel,f90:1,dotVH:t})}if(this.transmission===!0){const t=Mh,n=wg.sub(Mh).normalize(),i=Ng;e.backdrop=_2(i,n,hs,Ct,ri,kc,t,Ui,pi,ci,ic,ig,rg,sg,this.dispersion?og:null),e.backdropAlpha=mh,Ct.a.mulAssign(it(1,e.backdrop.a,mh))}}computeMultiscattering(e,t,n){const i=Yt.dot(Bt).clamp(),r=kg({roughness:hs,dotNV:i}),a=(this.iridescenceF0?Sd.mix(ri,this.iridescenceF0):ri).mul(r.x).add(n.mul(r.y)),l=r.x.add(r.y).oneMinus(),u=ri.add(ri.oneMinus().mul(.047619)),h=a.mul(u).div(l.mul(u).oneMinus());e.addAssign(a),t.addAssign(h.mul(l))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const r=Yt.dot(e).clamp().mul(t);if(this.sheen===!0&&this.sheenSpecularDirect.addAssign(r.mul(p2({lightDirection:e}))),this.clearcoat===!0){const a=Xo.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(Tf({lightDirection:e,f0:Fp,f90:Op,roughness:zc,normalView:Xo})))}n.directDiffuse.addAssign(r.mul(eo({diffuseColor:Ct.rgb}))),n.directSpecular.addAssign(r.mul(Tf({lightDirection:e,f0:ri,f90:1,roughness:hs,iridescence:this.iridescence,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:i,reflectedLight:r,ltc_1:o,ltc_2:a}){const c=t.add(n).sub(i),l=t.sub(n).sub(i),u=t.sub(n).add(i),h=t.add(n).add(i),d=Yt,p=Bt,f=Pn.toVar(),x=f2({N:d,V:p,roughness:hs}),m=o.uv(x).toVar(),g=a.uv(x).toVar(),y=Tn(D(m.x,0,m.y),D(0,1,0),D(m.z,0,m.w)).toVar(),_=ri.mul(g.x).add(ri.oneMinus().mul(g.y)).toVar();r.directSpecular.addAssign(e.mul(_).mul(n_({N:d,V:p,P:f,mInv:y,p0:c,p1:l,p2:u,p3:h}))),r.directDiffuse.addAssign(e.mul(Ct).mul(n_({N:d,V:p,P:f,mInv:Tn(1,0,0,0,1,0,0,0,1),p0:c,p1:l,p2:u,p3:h})))}indirect(e,t,n){this.indirectDiffuse(e,t,n),this.indirectSpecular(e,t,n),this.ambientOcclusion(e,t,n)}indirectDiffuse({irradiance:e,reflectedLight:t}){t.indirectDiffuse.addAssign(e.mul(eo({diffuseColor:Ct})))}indirectSpecular({radiance:e,iblIrradiance:t,reflectedLight:n}){if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(t.mul(Hr,T2({normal:Yt,viewDir:Bt,roughness:Md}))),this.clearcoat===!0){const l=Xo.dot(Bt).clamp(),u=eb({dotNV:l,specularColor:Fp,specularF90:Op,roughness:zc});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(u))}const i=D().toVar("singleScattering"),r=D().toVar("multiScattering"),o=t.mul(1/Math.PI);this.computeMultiscattering(i,r,kc);const a=i.add(r),c=Ct.mul(a.r.max(a.g).max(a.b).oneMinus());n.indirectSpecular.addAssign(e.mul(i)),n.indirectSpecular.addAssign(r.mul(o)),n.indirectDiffuse.addAssign(c.mul(o))}ambientOcclusion({ambientOcclusion:e,reflectedLight:t}){const i=Yt.dot(Bt).clamp().add(e),r=hs.mul(-16).oneMinus().negate().exp2(),o=e.sub(i.pow(r).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(e),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(e),t.indirectDiffuse.mulAssign(e),t.indirectSpecular.mulAssign(o)}finish(e){const{outgoingLight:t}=e;if(this.clearcoat===!0){const n=Xo.dot(Bt).clamp(),i=ha({dotVH:n,f0:Fp,f90:Op}),r=t.mul(dh.mul(i).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(dh));t.assign(r)}if(this.sheen===!0){const n=Hr.r.max(Hr.g).max(Hr.b).mul(.157).oneMinus(),i=t.mul(n).add(this.sheenSpecularDirect,this.sheenSpecularIndirect);t.assign(i)}}}const d_=A(1),Af=A(-2),xu=A(.8),Vp=A(-1),_u=A(.4),Bp=A(2),yu=A(.305),zp=A(3),p_=A(.21),b2=A(4),f_=A(4),w2=A(16),A2=U(([s])=>{const e=D(Dt(s)).toVar(),t=A(-1).toVar();return Oe(e.x.greaterThan(e.z),()=>{Oe(e.x.greaterThan(e.y),()=>{t.assign(In(s.x.greaterThan(0),0,3))}).Else(()=>{t.assign(In(s.y.greaterThan(0),1,4))})}).Else(()=>{Oe(e.z.greaterThan(e.y),()=>{t.assign(In(s.z.greaterThan(0),2,5))}).Else(()=>{t.assign(In(s.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),N2=U(([s,e])=>{const t=z().toVar();return Oe(e.equal(0),()=>{t.assign(z(s.z,s.y).div(Dt(s.x)))}).ElseIf(e.equal(1),()=>{t.assign(z(s.x.negate(),s.z.negate()).div(Dt(s.y)))}).ElseIf(e.equal(2),()=>{t.assign(z(s.x.negate(),s.y).div(Dt(s.z)))}).ElseIf(e.equal(3),()=>{t.assign(z(s.z.negate(),s.y).div(Dt(s.x)))}).ElseIf(e.equal(4),()=>{t.assign(z(s.x.negate(),s.z).div(Dt(s.y)))}).Else(()=>{t.assign(z(s.x,s.y).div(Dt(s.z)))}),ot(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),E2=U(([s])=>{const e=A(0).toVar();return Oe(s.greaterThanEqual(xu),()=>{e.assign(d_.sub(s).mul(Vp.sub(Af)).div(d_.sub(xu)).add(Af))}).ElseIf(s.greaterThanEqual(_u),()=>{e.assign(xu.sub(s).mul(Bp.sub(Vp)).div(xu.sub(_u)).add(Vp))}).ElseIf(s.greaterThanEqual(yu),()=>{e.assign(_u.sub(s).mul(zp.sub(Bp)).div(_u.sub(yu)).add(Bp))}).ElseIf(s.greaterThanEqual(p_),()=>{e.assign(yu.sub(s).mul(b2.sub(zp)).div(yu.sub(p_)).add(zp))}).Else(()=>{e.assign(A(-2).mul(al(ot(1.16,s))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),rb=U(([s,e])=>{const t=s.toVar();t.assign(ot(2,t).sub(1));const n=D(t,1).toVar();return Oe(e.equal(0),()=>{n.assign(n.zyx)}).ElseIf(e.equal(1),()=>{n.assign(n.xzy),n.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{n.x.mulAssign(-1)}).ElseIf(e.equal(3),()=>{n.assign(n.zyx),n.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{n.assign(n.xzy),n.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{n.z.mulAssign(-1)}),n}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),ob=U(([s,e,t,n,i,r])=>{const o=A(t),a=D(e),c=cn(E2(o),Af,r),l=mr(c),u=fr(c),h=D(Nf(s,a,u,n,i,r)).toVar();return Oe(l.notEqual(0),()=>{const d=D(Nf(s,a,u.add(1),n,i,r)).toVar();h.assign(it(h,d,l))}),h}),Nf=U(([s,e,t,n,i,r])=>{const o=A(t).toVar(),a=D(e),c=A(A2(a)).toVar(),l=A(ft(f_.sub(o),0)).toVar();o.assign(ft(o,f_));const u=A(gh(o)).toVar(),h=z(N2(a,c).mul(u.sub(2)).add(1)).toVar();return Oe(c.greaterThan(2),()=>{h.y.addAssign(u),c.subAssign(3)}),h.x.addAssign(c.mul(u)),h.x.addAssign(l.mul(ot(3,w2))),h.y.addAssign(ot(4,gh(r).sub(u))),h.x.mulAssign(n),h.y.mulAssign(i),s.uv(h).grad(z(),z())}),kp=U(({envMap:s,mipInt:e,outputDirection:t,theta:n,axis:i,CUBEUV_TEXEL_WIDTH:r,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{const c=Mi(n),l=t.mul(c).add(i.cross(t).mul(Cn(n))).add(i.mul(i.dot(t).mul(c.oneMinus())));return Nf(s,l,e,r,o,a)}),ab=U(({n:s,latitudinal:e,poleAxis:t,outputDirection:n,weights:i,samples:r,dTheta:o,mipInt:a,envMap:c,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:h})=>{const d=D(In(e,t,Ko(t,n))).toVar();Oe(lg(d.equals(D(0))),()=>{d.assign(D(n.z,0,n.x.negate()))}),d.assign(vi(d));const p=D().toVar();return p.addAssign(i.element(L(0)).mul(kp({theta:0,axis:d,outputDirection:n,mipInt:a,envMap:c,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:h}))),mt({start:L(1),end:s},({i:f})=>{Oe(f.greaterThanEqual(r),()=>{Rd()});const x=A(o.mul(A(f))).toVar();p.addAssign(i.element(f).mul(kp({theta:x.mul(-1),axis:d,outputDirection:n,mipInt:a,envMap:c,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:h}))),p.addAssign(i.element(f).mul(kp({theta:x,axis:d,outputDirection:n,mipInt:a,envMap:c,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:h})))}),oe(p,1)});let bh=null;const m_=new WeakMap;function C2(s){const e=Math.log2(s)-2,t=1/s;return{texelWidth:1/(3*Math.max(Math.pow(2,e),7*16)),texelHeight:t,maxMip:e}}function R2(s){let e=m_.get(s);if((e!==void 0?e.pmremVersion:-1)!==s.pmremVersion){const n=s.image;if(s.isCubeTexture)if(I2(n))e=bh.fromCubemap(s,e);else return null;else if(P2(n))e=bh.fromEquirectangular(s,e);else return null;e.pmremVersion=s.pmremVersion,m_.set(s,e)}return e.texture}class cb extends pt{static get type(){return"PMREMNode"}constructor(e,t=null,n=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;const i=new Xt;i.isRenderTargetTexture=!0,this._texture=xt(i),this._width=pe(0),this._height=pe(0),this._maxMip=pe(0),this.updateBeforeType=We.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=C2(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(){let e=this._pmrem;const t=e?e.pmremVersion:-1,n=this._value;t!==n.pmremVersion&&(n.isPMREMTexture===!0?e=n:e=R2(n),e!==null&&(this._pmrem=e,this.updateFromTexture(e)))}setup(e){bh===null&&(bh=e.createPMREMGenerator()),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this));const n=this.value;e.renderer.coordinateSystem===Di&&n.isPMREMTexture!==!0&&n.isRenderTargetTexture===!0&&(t=D(t.x.negate(),t.yz));let i=this.levelNode;return i===null&&e.context.getTextureLevel&&(i=e.context.getTextureLevel(this)),ob(this._texture,t,i,this._width,this._height,this._maxMip)}}function I2(s){if(s==null)return!1;let e=0;const t=6;for(let n=0;n<t;n++)s[n]!==void 0&&e++;return e===t}function P2(s){return s==null?!1:s.height>0}const lb=K(cb),g_=new WeakMap;class ub extends ho{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){const{material:t}=e;let n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){const p=n.isTextureNode?n.value:t[n.property];let f=g_.get(p);f===void 0&&(f=lb(p),g_.set(p,f)),n=f}const r=t.envMap?dn("envMapIntensity","float",e.material):dn("environmentIntensity","float",e.scene),a=t.useAnisotropy===!0||t.anisotropy>0?$S:Yt,c=n.context(x_(hs,a)).mul(r),l=n.context(L2(Ng)).mul(Math.PI).mul(r),u=sc(c),h=sc(l);e.context.radiance.addAssign(u),e.context.iblIrradiance.addAssign(h);const d=e.context.lightingModel.clearcoatRadiance;if(d){const p=n.context(x_(zc,Xo)).mul(r),f=sc(p);d.addAssign(f)}}}const x_=(s,e)=>{let t=null;return{getUV:()=>(t===null&&(t=Bt.negate().reflect(e),t=s.mul(s).mix(t,e).normalize(),t=t.transformDirection(pi)),t),getTextureLevel:()=>s}},L2=s=>({getUV:()=>s,getTextureLevel:()=>A(1)}),D2=new nl;class hb extends Tt{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(D2),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new ub(t):null}setupLightingModel(){return new Ld}setupSpecular(){const e=it(D(.04),Ct.rgb,Bc);ri.assign(e),kc.assign(1)}setupVariants(){const e=this.metalnessNode?A(this.metalnessNode):iT;Bc.assign(e);let t=this.roughnessNode?A(this.roughnessNode):nT;t=zg({roughness:t}),hs.assign(t),this.setupSpecular(),Ct.assign(oe(Ct.rgb.mul(e.oneMinus()),Ct.a))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}const U2=new ad;class db extends hb{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(U2),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){const e=this.iorNode?A(this.iorNode):xT;ic.assign(e),ri.assign(it(Mn(fg(ic.sub(1).div(ic.add(1))).mul(tT),D(1)).mul(vf),Ct.rgb,Bc)),kc.assign(it(vf,1,Bc))}setupLightingModel(){return new Ld(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const t=this.clearcoatNode?A(this.clearcoatNode):rT,n=this.clearcoatRoughnessNode?A(this.clearcoatRoughnessNode):oT;dh.assign(t),zc.assign(zg({roughness:n}))}if(this.useSheen){const t=this.sheenNode?D(this.sheenNode):lT,n=this.sheenRoughnessNode?A(this.sheenRoughnessNode):uT;Hr.assign(t),Md.assign(n)}if(this.useIridescence){const t=this.iridescenceNode?A(this.iridescenceNode):dT,n=this.iridescenceIORNode?A(this.iridescenceIORNode):pT,i=this.iridescenceThicknessNode?A(this.iridescenceThicknessNode):fT;Sd.assign(t),eg.assign(n),tg.assign(i)}if(this.useAnisotropy){const t=(this.anisotropyNode?z(this.anisotropyNode):hT).toVar();Ys.assign(t.length()),Oe(Ys.equal(0),()=>{t.assign(z(1,0))}).Else(()=>{t.divAssign(z(Ys)),Ys.assign(Ys.saturate())}),ph.assign(Ys.pow2().mix(hs.pow2(),1)),nc.assign(Wr[0].mul(t.x).add(Wr[1].mul(t.y))),Yr.assign(Wr[1].mul(t.x).sub(Wr[0].mul(t.y)))}if(this.useTransmission){const t=this.transmissionNode?A(this.transmissionNode):mT,n=this.thicknessNode?A(this.thicknessNode):gT,i=this.attenuationDistanceNode?A(this.attenuationDistanceNode):_T,r=this.attenuationColorNode?D(this.attenuationColorNode):yT;if(mh.assign(t),ig.assign(n),sg.assign(i),rg.assign(r),this.useDispersion){const o=this.dispersionNode?A(this.dispersionNode):MT;og.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?D(this.clearcoatNormalNode):aT}setup(e){e.context.setupClearcoatNormal=()=>this.setupClearcoatNormal(e),super.setup(e)}copy(e){return this.clearcoatNode=e.clearcoatNode,this.clearcoatRoughnessNode=e.clearcoatRoughnessNode,this.clearcoatNormalNode=e.clearcoatNormalNode,this.sheenNode=e.sheenNode,this.sheenRoughnessNode=e.sheenRoughnessNode,this.iridescenceNode=e.iridescenceNode,this.iridescenceIORNode=e.iridescenceIORNode,this.iridescenceThicknessNode=e.iridescenceThicknessNode,this.specularIntensityNode=e.specularIntensityNode,this.specularColorNode=e.specularColorNode,this.transmissionNode=e.transmissionNode,this.thicknessNode=e.thicknessNode,this.attenuationDistanceNode=e.attenuationDistanceNode,this.attenuationColorNode=e.attenuationColorNode,this.dispersionNode=e.dispersionNode,this.anisotropyNode=e.anisotropyNode,super.copy(e)}}class F2 extends Ld{constructor(e,t,n,i){super(e,t,n),this.useSSS=i}direct({lightDirection:e,lightColor:t,reflectedLight:n},i,r){if(this.useSSS===!0){const o=r.material,{thicknessColorNode:a,thicknessDistortionNode:c,thicknessAmbientNode:l,thicknessAttenuationNode:u,thicknessPowerNode:h,thicknessScaleNode:d}=o,p=e.add(Yt.mul(c)).normalize(),f=A(Bt.dot(p.negate()).saturate().pow(h).mul(d)),x=D(f.add(l).mul(a));n.directDiffuse.addAssign(x.mul(u.mul(t)))}super.direct({lightDirection:e,lightColor:t,reflectedLight:n},i,r)}}class O2 extends db{static get type(){return"MeshSSSNodeMaterial"}constructor(e){super(e),this.thicknessColorNode=null,this.thicknessDistortionNode=A(.1),this.thicknessAmbientNode=A(0),this.thicknessAttenuationNode=A(.1),this.thicknessPowerNode=A(2),this.thicknessScaleNode=A(10)}get useSSS(){return this.thicknessColorNode!==null}setupLightingModel(){return new F2(this.useClearcoat,this.useSheen,this.useIridescence,this.useSSS)}copy(e){return this.thicknessColorNode=e.thicknessColorNode,this.thicknessDistortionNode=e.thicknessDistortionNode,this.thicknessAmbientNode=e.thicknessAmbientNode,this.thicknessAttenuationNode=e.thicknessAttenuationNode,this.thicknessPowerNode=e.thicknessPowerNode,this.thicknessScaleNode=e.thicknessScaleNode,super.copy(e)}}const V2=U(({normal:s,lightDirection:e,builder:t})=>{const n=s.dot(e),i=z(n.mul(.5).add(.5),0);if(t.material.gradientMap){const r=Ji("gradientMap","texture").context({getUV:()=>i});return D(r.r)}else{const r=i.fwidth().mul(.5);return it(D(.7),D(1),ti(A(.7).sub(r.x),A(.7).add(r.x),i.x))}});class B2 extends Ml{direct({lightDirection:e,lightColor:t,reflectedLight:n},i,r){const o=V2({normal:bd,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(o.mul(eo({diffuseColor:Ct.rgb})))}indirect({ambientOcclusion:e,irradiance:t,reflectedLight:n}){n.indirectDiffuse.addAssign(t.mul(eo({diffuseColor:Ct}))),n.indirectDiffuse.mulAssign(e)}}const z2=new Tm;class k2 extends Tt{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(z2),this.setValues(e)}setupLightingModel(){return new B2}}class pb extends pt{static get type(){return"MatcapUVNode"}constructor(){super("vec2")}setup(){const e=D(Bt.z,0,Bt.x.negate()).normalize(),t=Bt.cross(e);return z(e.dot(Yt),t.dot(Yt)).mul(.495).add(.5)}}const fb=fe(pb),G2=new bm;class H2 extends Tt{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.lights=!1,this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(G2),this.setValues(e)}setupVariants(e){const t=fb;let n;e.material.matcap?n=Ji("matcap","texture").context({getUV:()=>t}):n=D(it(.2,.8,t.y)),Ct.rgb.mulAssign(n.rgb)}}const W2=new _a;class X2 extends Tt{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.isPointsNodeMaterial=!0,this.lights=!1,this.transparent=!0,this.sizeNode=null,this.setDefaultValues(W2),this.setValues(e)}copy(e){return this.sizeNode=e.sizeNode,super.copy(e)}}class mb extends pt{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}getNodeType(e){return this.positionNode.getNodeType(e)}setup(e){const{rotationNode:t,positionNode:n}=this;if(this.getNodeType(e)==="vec2"){const r=t.cos(),o=t.sin();return ol(r,o,o.negate(),r).mul(n)}else{const r=t,o=$r(oe(1,0,0,0),oe(0,Mi(r.x),Cn(r.x).negate(),0),oe(0,Cn(r.x),Mi(r.x),0),oe(0,0,0,1)),a=$r(oe(Mi(r.y),0,Cn(r.y),0),oe(0,1,0,0),oe(Cn(r.y).negate(),0,Mi(r.y),0),oe(0,0,0,1)),c=$r(oe(Mi(r.z),Cn(r.z).negate(),0,0),oe(Cn(r.z),Mi(r.z),0,0),oe(0,0,1,0),oe(0,0,0,1));return o.mul(a).mul(c).mul(oe(n,1)).xyz}}}const Gg=K(mb),q2=new Zc;class $2 extends Tt{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this.lights=!1,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.setDefaultValues(q2),this.setValues(e)}setupPosition({object:e,camera:t,context:n}){const i=this.sizeAttenuation,{positionNode:r,rotationNode:o,scaleNode:a}=this,c=en;let l=xs.mul(D(r||0)),u=z(Ui[0].xyz.length(),Ui[1].xyz.length());a!==null&&(u=u.mul(a)),!i&&t.isPerspectiveCamera&&(u=u.mul(l.z.negate()));let h=c.xy;if(e.center&&e.center.isVector2===!0){const x=WP("center","vec2");h=h.sub(x.sub(.5))}h=h.mul(u);const d=A(o||cT),p=Gg(h,d);l=oe(l.xy.add(p),l.zw);const f=ci.mul(l);return n.vertex=c,f}copy(e){return this.positionNode=e.positionNode,this.rotationNode=e.rotationNode,this.scaleNode=e.scaleNode,super.copy(e)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}}class Y2 extends Ml{constructor(){super(),this.shadowNode=A(1).toVar("shadowMask")}direct({shadowMask:e}){this.shadowNode.mulAssign(e)}finish(e){Ct.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Ct.rgb)}}const Z2=new od;class J2 extends Tt{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Z2),this.setValues(e)}setupLightingModel(){return new Y2}}const K2=U(({texture:s,uv:e})=>{const n=D().toVar();return Oe(e.x.lessThan(1e-4),()=>{n.assign(D(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{n.assign(D(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{n.assign(D(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{n.assign(D(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{n.assign(D(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{n.assign(D(0,0,-1))}).Else(()=>{const r=s.uv(e.add(D(-.01,0,0))).r.sub(s.uv(e.add(D(.01,0,0))).r),o=s.uv(e.add(D(0,-.01,0))).r.sub(s.uv(e.add(D(0,.01,0))).r),a=s.uv(e.add(D(0,0,-.01))).r.sub(s.uv(e.add(D(0,0,.01))).r);n.assign(D(r,o,a))}),n.normalize()});class gb extends gs{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return D(.5,.5,.5)}setUpdateMatrix(){}setupUV(e,t){return t}generateUV(e,t){return t.build(e,"vec3")}normal(e){return K2({texture:this,uv:e})}}const xb=K(gb);class j2 extends Tt{static get type(){return"VolumeNodeMaterial"}constructor(e={}){super(),this.lights=!1,this.isVolumeNodeMaterial=!0,this.testNode=null,this.setValues(e)}setup(e){const t=xb(this.map,null,0),n=U(({orig:i,dir:r})=>{const o=D(-.5),a=D(.5),c=r.reciprocal(),l=o.sub(i).mul(c),u=a.sub(i).mul(c),h=Mn(l,u),d=ft(l,u),p=ft(h.x,ft(h.y,h.z)),f=Mn(d.x,Mn(d.y,d.z));return z(p,f)});this.fragmentNode=U(()=>{const i=Un(D(IS.mul(oe(wg,1)))),o=Un(Nn.sub(i)).normalize(),a=z(n({orig:i,dir:o})).toVar();a.x.greaterThan(a.y).discard(),a.assign(z(ft(a.x,0),a.y));const c=D(i.add(a.x.mul(o))).toVar(),l=D(o.abs().reciprocal()).toVar(),u=A(Mn(l.x,Mn(l.y,l.z))).toVar("delta");u.divAssign(Ji("steps","float"));const h=oe(Ji("base","color"),0).toVar();return mt({type:"float",start:a.x,end:a.y,update:"+= delta"},()=>{const d=ai("float","d").assign(t.uv(c.add(.5)).r);this.testNode!==null?this.testNode({map:t,mapValue:d,probe:c,finalColor:h}).append():(h.a.assign(1),Rd()),c.addAssign(o.mul(u))}),h.a.equal(0).discard(),oe(h)})(),super.setup(e)}}class _b extends Xn{constructor(e){super(e),this.textures={},this.nodes={}}load(e,t,n,i){const r=new es(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,o=>{try{t(this.parse(JSON.parse(o)))}catch(a){i?i(a):console.error(a),this.manager.itemError(e)}},n,i)}parseNodes(e){const t={};if(e!==void 0){for(const i of e){const{uuid:r,type:o}=i;t[r]=this.createNodeFromType(o),t[r].uuid=r}const n={nodes:t,textures:this.textures};for(const i of e)i.meta=n,t[i.uuid].deserialize(i),delete i.meta}return t}parse(e){const t=this.createNodeFromType(e.type);t.uuid=e.uuid;const i={nodes:this.parseNodes(e.nodes),textures:this.textures};return e.meta=i,t.deserialize(e),delete e.meta,t}setTextures(e){return this.textures=e,this}setNodes(e){return this.nodes=e,this}createNodeFromType(e){return this.nodes[e]===void 0?(console.error("THREE.NodeLoader: Node type not found:",e),A()):H(new this.nodes[e])}}class yb extends sl{constructor(e){super(e),this.nodes={},this.nodeMaterials={}}parse(e){const t=super.parse(e),n=this.nodes,i=e.inputNodes;for(const r in i){const o=i[r];t[r]=n[o]}return t}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}createMaterialFromType(e){const t=this.nodeMaterials[e];return t!==void 0?new t:super.createMaterialFromType(e)}}class Q2 extends gv{constructor(e){super(e),this.nodes={},this.nodeMaterials={},this._nodesJSON=null}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}parse(e,t){this._nodesJSON=e.nodes;const n=super.parse(e,t);return this._nodesJSON=null,n}parseNodes(e,t){if(e!==void 0){const n=new _b;return n.setNodes(this.nodes),n.setTextures(t),n.parseNodes(e)}return{}}parseMaterials(e,t){const n={};if(e!==void 0){const i=this.parseNodes(this._nodesJSON,t),r=new yb;r.setTextures(t),r.setNodes(i),r.setNodeMaterials(this.nodeMaterials);for(let o=0,a=e.length;o<a;o++){const c=e[o];n[c.uuid]=r.parse(c)}}return n}}class Ef{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}}class vb{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n.getSelf()}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}}class Hg{constructor(e,t){this.isNodeVar=!0,this.name=e,this.type=t}}class Mb extends Hg{constructor(e,t){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0}}class Sb{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}}let e3=0;class Lu{constructor(e=null){this.id=e3++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}}class Wg extends Nt{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getHash(){return this.uuid}generate(){return this.name}}const t3=(s,e)=>H(new Wg(s,e));class Xg extends Ye{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.code=e,this.language=n,this.includes=t}isGlobal(){return!0}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const i of t)i.build(e);const n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}}const Dd=K(Xg),n3=(s,e)=>Dd(s,e,"js"),i3=(s,e)=>Dd(s,e,"wgsl"),s3=(s,e)=>Dd(s,e,"glsl");class qg extends Xg{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}getNodeType(e){return this.getNodeFunction(e).type}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){const t=e.getDataFromNode(this);let n=t.nodeFunction;return n===void 0&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);const n=this.getNodeFunction(e),i=n.name,r=n.type,o=e.getCodeFromNode(this,r);i!==""&&(o.name=i);const a=e.getPropertyName(o),c=this.getNodeFunction(e).getCode(a);return o.code=c+`
|
|
3867
3867
|
`,t==="property"?a:e.format(`${a}()`,r,t)}}const Tb=(s,e=[],t="")=>{for(let r=0;r<e.length;r++){const o=e[r];typeof o=="function"&&(e[r]=o.functionNode)}const n=H(new qg(s,e,t)),i=(...r)=>n.call(...r);return i.functionNode=n,i},r3=(s,e)=>Tb(s,e,"glsl"),o3=(s,e)=>Tb(s,e,"wgsl");class po{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0}setValue(e){this.value=e}getValue(){return this.value}}class a3 extends po{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class c3 extends po{constructor(e,t=new J){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class l3 extends po{constructor(e,t=new E){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class u3 extends po{constructor(e,t=new st){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class h3 extends po{constructor(e,t=new _e){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class d3 extends po{constructor(e,t=new Ke){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class p3 extends po{constructor(e,t=new Fe){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class f3 extends a3{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}}class m3 extends c3{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}}class g3 extends l3{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}}class x3 extends u3{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}}class _3 extends h3{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}}class y3 extends d3{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}}class v3 extends p3{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}}class bb extends Ye{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this.isStackNode=!0}getNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}add(e){return this.nodes.push(e),this}If(e,t){const n=new tc(t);return this._currentCond=In(e,n),this.add(this._currentCond)}ElseIf(e,t){const n=new tc(t),i=In(e,n);return this._currentCond.elseNode=i,this._currentCond=i,this}Else(e){return this._currentCond.elseNode=new tc(e),this}build(e,...t){const n=Jm();Vc(this);for(const i of this.nodes)i.build(e,"void");return Vc(n),this.outputNode?this.outputNode.build(e,...t):super.build(e,...t)}else(...e){return console.warn("TSL.StackNode: .else() has been renamed to .Else()."),this.Else(...e)}elseif(...e){return console.warn("TSL.StackNode: .elseif() has been renamed to .ElseIf()."),this.ElseIf(...e)}}const Du=K(bb);class M3{constructor(){this.weakMap=new WeakMap}get(e){let t=this.weakMap;for(let n=0;n<e.length;n++)if(t=t.get(e[n]),t===void 0)return;return t.get(e[e.length-1])}set(e,t){let n=this.weakMap;for(let i=0;i<e.length;i++){const r=e[i];n.has(r)===!1&&n.set(r,new WeakMap),n=n.get(r)}return n.set(e[e.length-1],t)}delete(e){let t=this.weakMap;for(let n=0;n<e.length;n++)if(t=t.get(e[n]),t===void 0)return!1;return t.delete(e[e.length-1])}}const qo=4,__=[.125,.215,.35,.446,.526,.582],Or=20,Gp=new ro(-1,1,1,-1,0,1),S3=new hn(90,1),y_=new _e;let Hp=null,Wp=0,Xp=0;const Ur=(1+Math.sqrt(5))/2,Do=1/Ur,v_=[new E(-Ur,Do,0),new E(Ur,Do,0),new E(-Do,0,Ur),new E(Do,0,Ur),new E(0,Ur,-Do),new E(0,Ur,Do),new E(-1,1,-1),new E(1,1,-1),new E(-1,1,1),new E(1,1,1)],T3=[3,1,5,0,4,2],qp=rb(rt(),vn("faceIndex")).normalize(),$g=D(qp.x,qp.y.negate(),qp.z);class b3{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}fromScene(e,t=0,n=.1,i=100){Hp=this._renderer.getRenderTarget(),Wp=this._renderer.getActiveCubeFace(),Xp=this._renderer.getActiveMipmapLevel(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=S_(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=T_(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Hp,Wp,Xp),e.scissorTest=!1,vu(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===wi||e.mapping===Vi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Hp=this._renderer.getRenderTarget(),Wp=this._renderer.getActiveCubeFace(),Xp=this._renderer.getActiveMipmapLevel();const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Ut,minFilter:Ut,generateMipmaps:!1,type:Ln,format:Rn,colorSpace:li},i=M_(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=M_(e,t,n);const{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas,lodMeshes:this._lodMeshes}=w3(r)),this._blurMaterial=A3(r,e,t)}return i}async _compileMaterial(e){const t=new kt(this._lodPlanes[0],e);await this._renderer.compile(t,Gp)}_sceneToCubeUV(e,t,n,i){const r=S3;r.near=t,r.far=n;const o=[-1,1,-1,-1,-1,-1],a=[1,1,1,-1,-1,-1],c=this._renderer,l=c.autoClear;c.getClearColor(y_),c.autoClear=!1;let u=this._backgroundBox;if(u===null){const p=new is({name:"PMREM.Background",side:ln,depthWrite:!1,depthTest:!1});u=new kt(new _s,p)}let h=!1;const d=e.background;d?d.isColor&&(u.material.color.copy(d),e.background=null,h=!0):(u.material.color.copy(y_),h=!0),c.setRenderTarget(i),c.clear(),h&&c.render(u,r);for(let p=0;p<6;p++){const f=p%3;f===0?(r.up.set(0,o[p],0),r.lookAt(a[p],0,0)):f===1?(r.up.set(0,0,o[p]),r.lookAt(0,a[p],0)):(r.up.set(0,o[p],0),r.lookAt(0,0,a[p]));const x=this._cubeSize;vu(i,f*x,p>2?x:0,x,x),c.render(e,r)}c.autoClear=l,e.background=d}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===wi||e.mapping===Vi;i?this._cubemapMaterial===null&&(this._cubemapMaterial=S_(e)):this._equirectMaterial===null&&(this._equirectMaterial=T_(e));const r=i?this._cubemapMaterial:this._equirectMaterial;r.fragmentNode.value=e;const o=this._lodMeshes[0];o.material=r;const a=this._cubeSize;vu(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(o,Gp)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let r=1;r<i;r++){const o=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=v_[(i-r-1)%v_.length];this._blur(e,r-1,r,o,a)}t.autoClear=n}_blur(e,t,n,i,r){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,i,"latitudinal",r),this._halfBlur(o,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,o,a){const c=this._renderer,l=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,h=this._lodMeshes[i];h.material=l;const d=l.uniforms,p=this._sizeLods[n]-1,f=isFinite(r)?Math.PI/(2*p):2*Math.PI/(2*Or-1),x=r/f,m=isFinite(r)?1+Math.floor(u*x):Or;m>Or&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Or}`);const g=[];let y=0;for(let w=0;w<Or;++w){const C=w/x,F=Math.exp(-C*C/2);g.push(F),w===0?y+=F:w<m&&(y+=2*F)}for(let w=0;w<g.length;w++)g[w]=g[w]/y;e.texture.frame=(e.texture.frame||0)+1,d.envMap.value=e.texture,d.samples.value=m,d.weights.array=g,d.latitudinal.value=o==="latitudinal"?1:0,a&&(d.poleAxis.value=a);const{_lodMax:_}=this;d.dTheta.value=f,d.mipInt.value=_-n;const v=this._sizeLods[i],I=3*v*(i>_-qo?i-_+qo:0),T=4*(this._cubeSize-v);vu(t,I,T,3*v,2*v),c.setRenderTarget(t),c.render(h,Gp)}}function w3(s){const e=[],t=[],n=[],i=[];let r=s;const o=s-qo+1+__.length;for(let a=0;a<o;a++){const c=Math.pow(2,r);t.push(c);let l=1/c;a>s-qo?l=__[a-s+qo-1]:a===0&&(l=0),n.push(l);const u=1/(c-2),h=-u,d=1+u,p=[h,h,d,h,d,d,h,h,d,d,h,d],f=6,x=6,m=3,g=2,y=1,_=new Float32Array(m*x*f),v=new Float32Array(g*x*f),I=new Float32Array(y*x*f);for(let w=0;w<f;w++){const C=w%3*2/3-1,F=w>2?0:-1,M=[C,F,0,C+2/3,F,0,C+2/3,F+1,0,C,F,0,C+2/3,F+1,0,C,F+1,0],b=T3[w];_.set(M,m*x*b),v.set(p,g*x*b);const G=[b,b,b,b,b,b];I.set(G,y*x*b)}const T=new at;T.setAttribute("position",new At(_,m)),T.setAttribute("uv",new At(v,g)),T.setAttribute("faceIndex",new At(I,y)),e.push(T),i.push(new kt(T,null)),r>qo&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n,lodMeshes:i}}function M_(s,e,t){const n=new fn(s,e,t);return n.texture.mapping=to,n.texture.name="PMREM.cubeUv",n.texture.isPMREMTexture=!0,n.scissorTest=!0,n}function vu(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function Yg(s){const e=new Tt;return e.depthTest=!1,e.depthWrite=!1,e.blending=Fi,e.name=`PMREM_${s}`,e}function A3(s,e,t){const n=ds(new Array(Or).fill(0)),i=pe(new E(0,1,0)),r=pe(0),o=A(Or),a=pe(0),c=pe(1),l=xt(null),u=pe(0),h=A(1/e),d=A(1/t),p=A(s),f={n:o,latitudinal:a,weights:n,poleAxis:i,outputDirection:$g,dTheta:r,samples:c,envMap:l,mipInt:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:p},x=Yg("blur");return x.uniforms=f,x.fragmentNode=ab({...f,latitudinal:a.equal(1)}),x}function S_(s){const e=Yg("cubemap");return e.fragmentNode=Ad(s,$g),e}function T_(s){const e=Yg("equirect");return e.fragmentNode=xt(s,Vg($g),0),e}let N3=0;class b_{constructor(e="",t=[],n=0,i=[]){this.name=e,this.bindings=t,this.index=n,this.bindingsReference=i,this.id=N3++}}const w_=new WeakMap,E3=new Map([[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),C3=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),Mu=s=>(s=Number(s),s+(s%1?"":".0"));class wb{constructor(e,t,n){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=n,this.scene=null,this.camera=null,this.nodes=[],this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.monitor=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.flow={code:""},this.chaining=[],this.stack=Du(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new Lu,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.useComparisonMethod=!1}getBindGroupsCache(){let e=w_.get(this.renderer);return e===void 0&&(e=new M3,w_.set(this.renderer,e)),e}createRenderTarget(e,t,n){return new fn(e,t,n)}createCubeRenderTarget(e,t){return new YT(e,t)}createPMREMGenerator(){return new b3(this.renderer)}includes(e){return this.nodes.includes(e)}_getBindGroup(e,t){const n=this.getBindGroupsCache(),i=[];let r=!0;for(const a of t)i.push(a),r=r&&a.groupNode.shared!==!0;let o;return r?(o=n.get(i),o===void 0&&(o=new b_(e,i,this.bindingsIndexes[e].group,i),n.set(i,o))):o=new b_(e,i,this.bindingsIndexes[e].group,i),o}getBindGroupArray(e,t){const n=this.bindings[t];let i=n[e];return i===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=i=[]),i}getBindings(){let e=this.bindGroups;if(e===null){const t={},n=this.bindings;for(const i of ff)for(const r in n[i]){const o=n[i][r];(t[r]||(t[r]=[])).push(...o)}e=[];for(const i in t){const r=t[i],o=this._getBindGroup(i,r);e.push(o)}this.bindGroups=e}return e}sortBindingGroups(){const e=this.getBindings();e.sort((t,n)=>t.bindings[0].groupNode.order-n.bindings[0].groupNode.order);for(let t=0;t<e.length;t++){const n=e[t];this.bindingsIndexes[n.name].group=t,n.index=t}}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){this.nodes.includes(e)===!1&&(this.nodes.push(e),this.setHashNode(e,e.getHash(this)))}buildUpdateNodes(){for(const e of this.nodes){const t=e.getUpdateType(),n=e.getUpdateBeforeType(),i=e.getUpdateAfterType();t!==We.NONE&&this.updateNodes.push(e.getSelf()),n!==We.NONE&&this.updateBeforeNodes.push(e.getSelf()),i!==We.NONE&&this.updateAfterNodes.push(e.getSelf())}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===Ut||e.magFilter===js||e.magFilter===Cs||e.magFilter===Jn||e.minFilter===Ut||e.minFilter===js||e.minFilter===Cs||e.minFilter===Jn}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error("NodeBuilder: Invalid node chaining!")}getMethod(e){return e}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}getSharedContext(){return{...this.context},this.context}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){const n=this.getDataFromNode(e);return n.cache===void 0&&(n.cache=new Lu(t?this.getCache():null)),n.cache}isAvailable(){return!1}getVertexIndex(){console.warn("Abstract function.")}getInstanceIndex(){console.warn("Abstract function.")}getDrawIndex(){console.warn("Abstract function.")}getFrontFacing(){console.warn("Abstract function.")}getFragCoord(){console.warn("Abstract function.")}isFlipY(){return!1}increaseUsage(e){const t=this.getDataFromNode(e);return t.usageCount=t.usageCount===void 0?1:t.usageCount+1,t.usageCount}generateTexture(){console.warn("Abstract function.")}generateTextureLod(){console.warn("Abstract function.")}generateConst(e,t=null){if(t===null&&(e==="float"||e==="int"||e==="uint"?t=0:e==="bool"?t=!1:e==="color"?t=new _e:e==="vec2"?t=new J:e==="vec3"?t=new E:e==="vec4"&&(t=new st)),e==="float")return Mu(t);if(e==="int")return`${Math.round(t)}`;if(e==="uint")return t>=0?`${Math.round(t)}u`:"0u";if(e==="bool")return t?"true":"false";if(e==="color")return`${this.getType("vec3")}( ${Mu(t.r)}, ${Mu(t.g)}, ${Mu(t.b)} )`;const n=this.getTypeLength(e),i=this.getComponentType(e),r=o=>this.generateConst(i,o);if(n===2)return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)} )`;if(n===3)return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)}, ${r(t.z)} )`;if(n===4)return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)}, ${r(t.z)}, ${r(t.w)} )`;if(n>4&&t&&(t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(r).join(", ")} )`;if(n>4)return`${this.getType(e)}()`;throw new Error(`NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e==="color"?"vec3":e}hasGeometryAttribute(e){return this.geometry&&this.geometry.getAttribute(e)!==void 0}getAttribute(e,t){const n=this.attributes;for(const r of n)if(r.name===e)return r;const i=new Ef(e,t);return n.push(i),i}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return e==="void"||e==="property"||e==="sampler"||e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){const t=e.type;if(e.isDataTexture){if(t===pa)return"int";if(t===Bi)return"uint"}return"float"}getElementType(e){return e==="mat2"?"vec2":e==="mat3"?"vec3":e==="mat4"?"vec4":this.getComponentType(e)}getComponentType(e){if(e=this.getVectorType(e),e==="float"||e==="bool"||e==="int"||e==="uint")return e;const t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return t===null?null:t[1]==="b"?"bool":t[1]==="i"?"int":t[1]==="u"?"uint":"float"}getVectorType(e){return e==="color"?"vec3":e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="texture3D"?"vec4":e}getTypeFromLength(e,t="float"){if(e===1)return t;const n=E3.get(e);return(t==="float"?"":t[0])+n}getTypeFromArray(e){return C3.get(e.constructor)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);const n=t.array,i=e.itemSize,r=e.normalized;let o;return!(e instanceof Vy)&&r!==!0&&(o=this.getTypeFromArray(n)),this.getTypeFromLength(i,o)}getTypeLength(e){const t=this.getVectorType(e),n=/vec([2-4])/.exec(t);return n!==null?Number(n[1]):t==="float"||t==="bool"||t==="int"||t==="uint"?1:/mat2/.test(e)===!0?4:/mat3/.test(e)===!0?9:/mat4/.test(e)===!0?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){const t=this.getComponentType(e);return t==="int"||t==="uint"?e:this.changeComponentType(e,"int")}addStack(){return this.stack=Du(this.stack),this.stacks.push(Jm()||this.stack),Vc(this.stack),this.stack}removeStack(){const e=this.stack;return this.stack=e.parent,Vc(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){n=n===null?e.isGlobal(this)?this.globalCache:this.cache:n;let i=n.getData(e);return i===void 0&&(i={},n.setData(e,i)),i[t]===void 0&&(i[t]={}),i[t]}getNodeProperties(e,t="any"){const n=this.getDataFromNode(e,t);return n.properties||(n.properties={outputNode:null})}getBufferAttributeFromNode(e,t){const n=this.getDataFromNode(e);let i=n.bufferAttribute;if(i===void 0){const r=this.uniforms.index++;i=new Ef("nodeAttribute"+r,t,e),this.bufferAttributes.push(i),n.bufferAttribute=i}return i}getStructTypeFromNode(e,t=this.shaderStage){const n=this.getDataFromNode(e,t);if(n.structType===void 0){const i=this.structs.index++;e.name=`StructType${i}`,this.structs[t].push(e),n.structType=e}return e}getUniformFromNode(e,t,n=this.shaderStage,i=null){i==="in"&&(console.warn('NodeBuilder: "in" is a reserved word, using "inValue" instead.',e,i),e.name="inValue",i=e.name);const r=this.getDataFromNode(e,n,this.globalCache);let o=r.uniform;if(o===void 0){const a=this.uniforms.index++;o=new vb(i||"nodeUniform"+a,t,e),this.uniforms[n].push(o),r.uniform=o}return o}getVarFromNode(e,t=null,n=e.getNodeType(this),i=this.shaderStage){const r=this.getDataFromNode(e,i);let o=r.variable;if(o===void 0){const a=this.vars[i]||(this.vars[i]=[]);t===null&&(t="nodeVar"+a.length),o=new Hg(t,n),a.push(o),r.variable=o}return o}getVaryingFromNode(e,t=null,n=e.getNodeType(this)){const i=this.getDataFromNode(e,"any");let r=i.varying;if(r===void 0){const o=this.varyings,a=o.length;t===null&&(t="nodeVarying"+a),r=new Mb(t,n),o.push(r),i.varying=r}return r}getCodeFromNode(e,t,n=this.shaderStage){const i=this.getDataFromNode(e);let r=i.code;if(r===void 0){const o=this.codes[n]||(this.codes[n]=[]),a=o.length;r=new Sb("nodeCode"+a,t),o.push(r),i.code=r}return r}addFlowCodeHierarchy(e,t){const{flowCodes:n,flowCodeBlock:i}=this.getDataFromNode(e);let r=!0,o=t;for(;o;){if(i.get(o)===!0){r=!1;break}o=this.getDataFromNode(o).parentNodeBlock}if(r)for(const a of n)this.addLineFlowCode(a)}addLineFlowCodeBlock(e,t,n){const i=this.getDataFromNode(e),r=i.flowCodes||(i.flowCodes=[]),o=i.flowCodeBlock||(i.flowCodeBlock=new WeakMap);r.push(t),o.set(n,!0)}addLineFlowCode(e,t=null){return e===""?this:(t!==null&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e=e+`;
|
|
3868
3868
|
`),this.flow.code+=e,this)}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=" ",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){const t=e.getNodeType(this),n=this.flowChildNode(e,t);return this.flowsData.set(e,n),n}buildFunctionNode(e){const t=new qg,n=this.currentFunctionNode;return this.currentFunctionNode=t,t.code=this.buildFunctionCode(e),this.currentFunctionNode=n,t}flowShaderNode(e){const t=e.layout,n={[Symbol.iterator](){let o=0;const a=Object.values(this);return{next:()=>({value:a[o],done:o++>=a.length})}}};for(const o of t.inputs)n[o.name]=new Wg(o.type,o.name);e.layout=null;const i=e.call(n),r=this.flowStagesNode(i,t.type);return e.layout=t,r}flowStagesNode(e,t=null){const n=this.flow,i=this.vars,r=this.cache,o=this.buildStage,a=this.stack,c={code:""};this.flow=c,this.vars={},this.cache=new Lu,this.stack=Du();for(const l of pf)this.setBuildStage(l),c.result=e.build(this,t);return c.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=i,this.cache=r,this.stack=a,this.setBuildStage(o),c}getFunctionOperator(){return null}flowChildNode(e,t=null){const n=this.flow,i={code:""};return this.flow=i,i.result=e.build(this,t),this.flow=n,i}flowNodeFromShaderStage(e,t,n=null,i=null){const r=this.shaderStage;this.setShaderStage(e);const o=this.flowChildNode(t,n);return i!==null&&(o.code+=`${this.tab+i} = ${o.result};
|
|
3869
3869
|
`),this.flowCode[e]=this.flowCode[e]+o.code,this.setShaderStage(r),o}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){console.warn("Abstract function.")}getVaryings(){console.warn("Abstract function.")}getVar(e,t){return`${this.getType(e)} ${t}`}getVars(e){let t="";const n=this.vars[e];if(n!==void 0)for(const i of n)t+=`${this.getVar(i.type,i.name)}; `;return t}getUniforms(){console.warn("Abstract function.")}getCodes(e){const t=this.codes[e];let n="";if(t!==void 0)for(const i of t)n+=i.code+`
|
|
@@ -3871,4 +3871,4 @@ ${e.tab}if ( ${u} ) {
|
|
|
3871
3871
|
`}}class Ab{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.startTime=null,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return n===void 0&&(n={renderMap:new WeakMap,frameMap:new WeakMap},e.set(t,n)),n}updateBeforeNode(e){const t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===We.FRAME){const{frameMap:i}=this._getMaps(this.updateBeforeMap,n);i.get(n)!==this.frameId&&e.updateBefore(this)!==!1&&i.set(n,this.frameId)}else if(t===We.RENDER){const{renderMap:i}=this._getMaps(this.updateBeforeMap,n);i.get(n)!==this.renderId&&e.updateBefore(this)!==!1&&i.set(n,this.renderId)}else t===We.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===We.FRAME){const{frameMap:i}=this._getMaps(this.updateAfterMap,n);i.get(n)!==this.frameId&&e.updateAfter(this)!==!1&&i.set(n,this.frameId)}else if(t===We.RENDER){const{renderMap:i}=this._getMaps(this.updateAfterMap,n);i.get(n)!==this.renderId&&e.updateAfter(this)!==!1&&i.set(n,this.renderId)}else t===We.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),n=e.updateReference(this);if(t===We.FRAME){const{frameMap:i}=this._getMaps(this.updateMap,n);i.get(n)!==this.frameId&&e.update(this)!==!1&&i.set(n,this.frameId)}else if(t===We.RENDER){const{renderMap:i}=this._getMaps(this.updateMap,n);i.get(n)!==this.renderId&&e.update(this)!==!1&&i.set(n,this.renderId)}else t===We.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class Zg{constructor(e,t,n=null,i="",r=!1){this.type=e,this.name=t,this.count=n,this.qualifier=i,this.isConst=r}}Zg.isNodeFunctionInput=!0;class R3 extends Ye{static get type(){return"StructTypeNode"}constructor(e){super(),this.types=e,this.isStructTypeNode=!0}getMemberTypes(){return this.types}}class Jg extends Ye{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}setup(e){super.setup(e);const t=this.members,n=[];for(let i=0;i<t.length;i++)n.push(t[i].getNodeType(e));this.nodeType=e.getStructTypeFromNode(new R3(n)).name}generate(e,t){const n=e.getOutputStructName(),i=this.members,r=n!==""?n+".":"";for(let o=0;o<i.length;o++){const a=i[o].build(e,t);e.addLineFlowCode(`${r}m${o} = ${a}`,this)}return n}}const I3=K(Jg);function Kg(s,e){for(let t=0;t<s.length;t++)if(s[t].name===e)return t;return-1}class Nb extends Jg{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.isMRTNode=!0}has(e){return this.outputNodes[e]!==void 0}get(e){return this.outputNodes[e]}merge(e){const t={...this.outputNodes,...e.outputNodes};return Ud(t)}setup(e){const t=this.outputNodes,n=e.renderer.getRenderTarget(),i=[],r=n.textures;for(const o in t){const a=Kg(r,o);i[a]=oe(t[o])}return this.members=i,super.setup(e)}}const Ud=K(Nb);class Eb extends Ye{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFnCall=null,this.global=!0}getNodeType(){return this.functionNodes[0].shaderNode.layout.type}setup(e){const t=this.parametersNodes;let n=this._candidateFnCall;if(n===null){let i=null,r=-1;for(const o of this.functionNodes){const c=o.shaderNode.layout;if(c===null)throw new Error("FunctionOverloadingNode: FunctionNode must be a layout.");const l=c.inputs;if(t.length===l.length){let u=0;for(let h=0;h<t.length;h++){const d=t[h],p=l[h];d.getNodeType(e)===p.type?u++:u=0}u>r&&(i=o,r=u)}}this._candidateFnCall=n=i(...t)}return n}}const P3=K(Eb),On=s=>(...e)=>P3(s,...e);class Sn extends uo{static get type(){return"TimerNode"}constructor(e=Sn.LOCAL,t=1,n=0){super(n),this.scope=e,this.scale=t,this.updateType=We.FRAME}update(e){const t=this.scope,n=this.scale;t===Sn.LOCAL?this.value+=e.deltaTime*n:t===Sn.DELTA?this.value=e.deltaTime*n:t===Sn.FRAME?this.value=e.frameId:this.value=e.time*n}serialize(e){super.serialize(e),e.scope=this.scope,e.scale=this.scale}deserialize(e){super.deserialize(e),this.scope=e.scope,this.scale=e.scale}}Sn.LOCAL="local";Sn.GLOBAL="global";Sn.DELTA="delta";Sn.FRAME="frame";const jg=(s,e=0)=>H(new Sn(Sn.LOCAL,s,e)),L3=(s,e=0)=>H(new Sn(Sn.GLOBAL,s,e)),D3=(s,e=0)=>H(new Sn(Sn.DELTA,s,e)),U3=fe(Sn,Sn.FRAME).toUint();class pn extends Ye{static get type(){return"OscNode"}constructor(e=pn.SINE,t=jg()){super(),this.method=e,this.timeNode=t}getNodeType(e){return this.timeNode.getNodeType(e)}setup(){const e=this.method,t=H(this.timeNode);let n=null;return e===pn.SINE?n=t.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5):e===pn.SQUARE?n=t.fract().round():e===pn.TRIANGLE?n=t.add(.5).fract().mul(2).sub(1).abs():e===pn.SAWTOOTH&&(n=t.fract()),n}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}pn.SINE="sine";pn.SQUARE="square";pn.TRIANGLE="triangle";pn.SAWTOOTH="sawtooth";const F3=K(pn,pn.SINE),O3=K(pn,pn.SQUARE),V3=K(pn,pn.TRIANGLE),B3=K(pn,pn.SAWTOOTH);class Cb extends Ye{static get type(){return"SpriteSheetUVNode"}constructor(e,t=rt(),n=A(0)){super("vec2"),this.countNode=e,this.uvNode=t,this.frameNode=n}setup(){const{frameNode:e,uvNode:t,countNode:n}=this,{width:i,height:r}=n,o=e.mod(i.mul(r)).floor(),a=o.mod(i),c=r.sub(o.add(1).div(i).ceil()),l=n.reciprocal(),u=z(a,c);return t.add(u).mul(l)}}const z3=K(Cb);class Rb extends pr{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.bufferObject===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n;const i=e.context.assign;if(e.isAvailable("storageBuffer")===!1?this.node.bufferObject===!0&&i!==!0?n=e.generatePBO(this):n=this.node.build(e):n=super.generate(e),i!==!0){const r=this.getNodeType(e);n=e.format(n,r,t)}return n}}const k3=K(Rb);class Ib extends Ye{static get type(){return"TriplanarTexturesNode"}constructor(e,t=null,n=null,i=A(1),r=en,o=hi){super("vec4"),this.textureXNode=e,this.textureYNode=t,this.textureZNode=n,this.scaleNode=i,this.positionNode=r,this.normalNode=o}setup(){const{textureXNode:e,textureYNode:t,textureZNode:n,scaleNode:i,positionNode:r,normalNode:o}=this;let a=o.abs().normalize();a=a.div(a.dot(D(1)));const c=r.yz.mul(i),l=r.zx.mul(i),u=r.xy.mul(i),h=e.value,d=t!==null?t.value:h,p=n!==null?n.value:h,f=xt(h,c).mul(a.x),x=xt(d,l).mul(a.y),m=xt(p,u).mul(a.z);return Wt(f,x,m)}}const Pb=K(Ib),G3=(...s)=>Pb(...s),Uo=new cs,Rr=new E,Fo=new E,$p=new E,Wa=new Fe,Su=new E(0,0,-1),Ns=new st,Xa=new E,Tu=new E,qa=new st,bu=new J,A_=new fn,H3=gr.flipX();let Yp=!1;class Lb extends gs{static get type(){return"ReflectorNode"}constructor(e={}){super(A_.texture,H3);const{target:t=new yt,resolution:n=1,generateMipmaps:i=!1,bounces:r=!0}=e;this.target=t,this.resolution=n,this.generateMipmaps=i,this.bounces=r,this.updateBeforeType=r?We.RENDER:We.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new WeakMap}_updateResolution(e,t){const n=this.resolution;t.getDrawingBufferSize(bu),e.setSize(Math.round(bu.width*n),Math.round(bu.height*n))}setup(e){return this._updateResolution(A_,e.renderer),super.setup(e)}getTextureNode(){return this.textureNode}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new fn(0,0,{type:Ln}),this.generateMipmaps===!0&&(t.texture.minFilter=cy,t.texture.generateMipmaps=!0),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&Yp)return!1;Yp=!0;const{scene:t,camera:n,renderer:i,material:r}=e,{target:o}=this,a=this.getVirtualCamera(n),c=this.getRenderTarget(a);if(i.getDrawingBufferSize(bu),this._updateResolution(c,i),Fo.setFromMatrixPosition(o.matrixWorld),$p.setFromMatrixPosition(n.matrixWorld),Wa.extractRotation(o.matrixWorld),Rr.set(0,0,1),Rr.applyMatrix4(Wa),Xa.subVectors(Fo,$p),Xa.dot(Rr)>0)return;Xa.reflect(Rr).negate(),Xa.add(Fo),Wa.extractRotation(n.matrixWorld),Su.set(0,0,-1),Su.applyMatrix4(Wa),Su.add($p),Tu.subVectors(Fo,Su),Tu.reflect(Rr).negate(),Tu.add(Fo),a.coordinateSystem=n.coordinateSystem,a.position.copy(Xa),a.up.set(0,1,0),a.up.applyMatrix4(Wa),a.up.reflect(Rr),a.lookAt(Tu),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),Uo.setFromNormalAndCoplanarPoint(Rr,Fo),Uo.applyMatrix4(a.matrixWorldInverse),Ns.set(Uo.normal.x,Uo.normal.y,Uo.normal.z,Uo.constant);const l=a.projectionMatrix;qa.x=(Math.sign(Ns.x)+l.elements[8])/l.elements[0],qa.y=(Math.sign(Ns.y)+l.elements[9])/l.elements[5],qa.z=-1,qa.w=(1+l.elements[10])/l.elements[14],Ns.multiplyScalar(1/Ns.dot(qa));const u=0;l.elements[2]=Ns.x,l.elements[6]=Ns.y,l.elements[10]=Ns.z-u,l.elements[14]=Ns.w,this.value=c.texture,r.visible=!1;const h=i.getRenderTarget(),d=i.getMRT();i.setMRT(null),i.setRenderTarget(c),i.render(t,a),i.setMRT(d),i.setRenderTarget(h),r.visible=!0,Yp=!1}}const W3=s=>H(new Lb(s)),Zp=new ro(-1,1,1,-1,0,1);class X3 extends at{constructor(e=!1){super();const t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Ve([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Ve(t,2))}}const q3=new X3;class ys extends kt{constructor(e=null){super(q3,e),this.camera=Zp,this.isQuadMesh=!0}renderAsync(e){return e.renderAsync(this,Zp)}render(e){e.render(this,Zp)}}const $3=new J;class Db extends gs{static get type(){return"RTTNode"}constructor(e,t=null,n=null,i={type:Ln}){const r=new fn(t,n,i);super(r.texture,rt()),this.node=e,this.width=t,this.height=n,this.renderTarget=r,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this.updateMap=new WeakMap,this._rttNode=null,this._quadMesh=new ys(new Tt),this.updateBeforeType=We.RENDER}get autoSize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){this.width=e,this.height=t;const n=e*this.pixelRatio,i=t*this.pixelRatio;this.renderTarget.setSize(n,i),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;if(this.textureNeedsUpdate=!1,this.autoSize===!0){this.pixelRatio=e.getPixelRatio();const n=e.getSize($3);this.setSize(n.width,n.height)}this._quadMesh.material.fragmentNode=this._rttNode;const t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){const e=new gs(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const Ub=(s,...e)=>H(new Db(H(s),...e)),ei=(s,...e)=>s.isTextureNode?s:Ub(s,...e);class Fb extends bg{static get type(){return"VertexColorNode"}constructor(e=0){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){const e=this.index;return"color"+(e>0?e:"")}generate(e){const t=this.getAttributeName(e),n=e.hasGeometryAttribute(t);let i;return n===!0?i=super.generate(e):i=e.generateConst(this.nodeType,new st(1,1,1,1)),i}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const Y3=(...s)=>H(new Fb(...s));class Ob extends Ye{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const Z3=fe(Ob);class ji extends Ye{static get type(){return"SceneNode"}constructor(e=ji.BACKGROUND_BLURRINESS,t=null){super(),this.scope=e,this.scene=t}setup(e){const t=this.scope,n=this.scene!==null?this.scene:e.scene;let i;return t===ji.BACKGROUND_BLURRINESS?i=dn("backgroundBlurriness","float",n):t===ji.BACKGROUND_INTENSITY?i=dn("backgroundIntensity","float",n):console.error("THREE.SceneNode: Unknown scope:",t),i}}ji.BACKGROUND_BLURRINESS="backgroundBlurriness";ji.BACKGROUND_INTENSITY="backgroundIntensity";const J3=fe(ji,ji.BACKGROUND_BLURRINESS),K3=fe(ji,ji.BACKGROUND_INTENSITY),N_={Storage:"storage",ReadOnlyStorage:"read-only-storage"},Jp={WriteOnly:"write-only",ReadOnly:"read-only"};class Qg extends Nd{static get type(){return"StorageBufferNode"}constructor(e,t,n=0){super(e,t,n),this.isStorageBufferNode=!0,this.access=N_.Storage,this.isAtomic=!1,this.bufferObject=!1,this.bufferCount=n,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){if(this.bufferCount===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getInputType(){return"storageBuffer"}element(e){return k3(this,e)}setBufferObject(e){return this.bufferObject=e,this}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(N_.ReadOnlyStorage)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}generate(e){if(e.isAvailable("storageBuffer"))return super.generate(e);const t=this.getNodeType(e);this._attribute===null&&(this._attribute=dl(this.value),this._varying=Un(this._attribute));const n=this._varying.build(e,t);return e.registerTransform(n,this._attribute),n}}const j3=(s,e,t)=>H(new Qg(s,e,t)),Q3=(s,e,t)=>H(new Qg(s,e,t).setBufferObject(!0));class Vb extends gs{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.isStorageTextureNode=!0,this.access=Jp.WriteOnly}getInputType(){return"storageTexture"}setup(e){super.setup(e);const t=e.getNodeProperties(this);t.storeNode=this.storeNode}setAccess(e){return this.access=e,this}generate(e,t){let n;return this.storeNode!==null?n=this.generateStore(e):n=super.generate(e,t),n}toReadOnly(){return this.setAccess(Jp.ReadOnly)}toWriteOnly(){return this.setAccess(Jp.WriteOnly)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:n,storeNode:i}=t,r=super.generate(e,"property"),o=n.build(e,"uvec2"),a=i.build(e,"vec4"),c=e.generateTextureStore(e,r,o,a);e.addLineFlowCode(c,this)}}const Bb=K(Vb),eD=(s,e,t)=>{const n=Bb(s,e,t);return t!==null&&n.append(),n};class zb extends ml{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}}const tD=(s,e,t)=>H(new zb(s,e,t));class kb extends pt{static get type(){return"PosterizeNode"}constructor(e,t){super(),this.sourceNode=e,this.stepsNode=t}setup(){const{sourceNode:e,stepsNode:t}=this;return e.mul(t).floor().div(t)}}const nD=K(kb);let Kp=null;class Gb extends vl{static get type(){return"ViewportSharedTextureNode"}constructor(e=gr,t=null){Kp===null&&(Kp=new pm),super(e,t,Kp)}updateReference(){return this}}const iD=K(Gb),sD=new J;class Hb extends gs{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.setUpdateMatrix(!1)}setup(e){return e.object.isQuadMesh&&this.passNode.build(e),super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class E_ extends Hb{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){return new this.constructor(this.passNode,this.textureName,this.previousTexture)}}class bn extends pt{static get type(){return"PassNode"}constructor(e,t,n,i={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=i,this._pixelRatio=1,this._width=1,this._height=1;const r=new oo;r.isRenderTargetTexture=!0,r.name="depth";const o=new fn(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Ln,...i});o.texture.name="output",o.depthTexture=r,this.renderTarget=o,this.updateBeforeType=We.FRAME,this._textures={output:o.texture,depth:r},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=pe(0),this._cameraFar=pe(0),this._mrt=null,this.isPassNode=!0}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}isGlobal(){return!0}getTexture(e){let t=this._textures[e];return t===void 0&&(t=this.renderTarget.texture.clone(),t.isRenderTargetTexture=!0,t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)),t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),t.isRenderTargetTexture=!0,this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(t!==void 0){const n=this._textures[e],i=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[i]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(this._textureNodes[e]=t=H(new E_(this,e)),this._textureNodes[e].updateTexture()),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),this._previousTextureNodes[e]=t=H(new E_(this,e,!0)),this._previousTextureNodes[e].updateTexture()),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){const n=this._cameraNear,i=this._cameraFar;this._viewZNodes[e]=t=Fg(this.getTextureNode(e),n,i)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){const n=this._cameraNear,i=this._cameraFar,r=this.getViewZNode(e);this._linearDepthNodes[e]=t=oc(r,n,i)}return t}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,e.backend.isWebGLBackend===!0&&(this.renderTarget.samples=0),this.renderTarget.depthTexture.isMultisampleRenderTargetTexture=this.renderTarget.samples>1,this.scope===bn.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:n,camera:i}=this;this._pixelRatio=t.getPixelRatio();const r=t.getSize(sD);this.setSize(r.width,r.height);const o=t.getRenderTarget(),a=t.getMRT();this._cameraNear.value=i.near,this._cameraFar.value=i.far;for(const c in this._previousTextures)this.toggleTexture(c);t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.render(n,i),t.setRenderTarget(o),t.setMRT(a)}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,i=this._height*this._pixelRatio;this.renderTarget.setSize(n,i)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}bn.COLOR="color";bn.DEPTH="depth";const rD=(s,e,t)=>H(new bn(bn.COLOR,s,e,t)),Aa=(s,e)=>H(new Hb(s,e)),oD=(s,e)=>H(new bn(bn.DEPTH,s,e)),C_=new ys,R_=new ys;class Wb extends pt{static get type(){return"GaussianBlurNode"}constructor(e,t=null,n=2){super("vec4"),this.textureNode=e,this.directionNode=t,this.sigma=n,this._invSize=pe(new J),this._passDirection=pe(new J),this._horizontalRT=new fn,this._horizontalRT.texture.name="GaussianBlurNode.horizontal",this._verticalRT=new fn,this._verticalRT.texture.name="GaussianBlurNode.vertical",this._textureNode=Aa(this,this._verticalRT.texture),this.updateBeforeType=We.RENDER,this.resolution=new J(1,1)}setSize(e,t){e=Math.max(Math.round(e*this.resolution.x),1),t=Math.max(Math.round(t*this.resolution.y),1),this._invSize.value.set(1/e,1/t),this._horizontalRT.setSize(e,t),this._verticalRT.setSize(e,t)}updateBefore(e){const{renderer:t}=e,n=this.textureNode,i=n.value,r=t.getRenderTarget(),o=t.getMRT(),a=n.value;C_.material=this._material,R_.material=this._material,this.setSize(i.image.width,i.image.height);const c=i.type;this._horizontalRT.texture.type=c,this._verticalRT.texture.type=c,t.setMRT(null),t.setRenderTarget(this._horizontalRT),this._passDirection.value.set(1,0),C_.render(t),n.value=this._horizontalRT.texture,t.setRenderTarget(this._verticalRT),this._passDirection.value.set(0,1),R_.render(t),t.setRenderTarget(r),t.setMRT(o),n.value=a}getTextureNode(){return this._textureNode}setup(e){const t=this.textureNode;if(t.isTextureNode!==!0)return console.error("GaussianBlurNode requires a TextureNode."),oe();const n=t.uvNode||rt(),i=z(this.directionNode||1),r=l=>t.uv(l),o=U(()=>{const l=3+2*this.sigma,u=this._getCoefficients(l),h=this._invSize,d=i.mul(this._passDirection),p=A(u[0]).toVar(),f=oe(r(n).mul(p)).toVar();for(let x=1;x<l;x++){const m=A(x),g=A(u[x]),y=z(d.mul(h.mul(m))).toVar(),_=oe(r(n.add(y))),v=oe(r(n.sub(y)));f.addAssign(_.add(v).mul(g)),p.addAssign(ot(2,g))}return f.div(p)}),a=this._material||(this._material=new Tt);a.fragmentNode=o().context(e.getSharedContext()),a.name="Gaussian_blur",a.needsUpdate=!0;const c=e.getNodeProperties(this);return c.textureNode=t,this._textureNode}dispose(){this._horizontalRT.dispose(),this._verticalRT.dispose()}_getCoefficients(e){const t=[];for(let n=0;n<e;n++)t.push(.39894*Math.exp(-.5*n*n/(e*e))/e);return t}}const aD=(s,e,t)=>H(new Wb(ei(s),e,t)),jp=new J,I_=new ys;class Xb extends pt{static get type(){return"AfterImageNode"}constructor(e,t=.96){super(e),this.textureNode=e,this.textureNodeOld=xt(),this.damp=pe(t),this._compRT=new fn,this._compRT.texture.name="AfterImageNode.comp",this._oldRT=new fn,this._oldRT.texture.name="AfterImageNode.old",this._textureNode=Aa(this,this._compRT.texture),this.updateBeforeType=We.RENDER}getTextureNode(){return this._textureNode}setSize(e,t){this._compRT.setSize(e,t),this._oldRT.setSize(e,t)}updateBefore(e){const{renderer:t}=e,n=this.textureNode,r=n.value.type;this._compRT.texture.type=r,this._oldRT.texture.type=r,t.getDrawingBufferSize(jp),this.setSize(jp.x,jp.y);const o=t.getRenderTarget(),a=n.value;this.textureNodeOld.value=this._oldRT.texture,t.setRenderTarget(this._compRT),I_.render(t);const c=this._oldRT;this._oldRT=this._compRT,this._compRT=c,t.setRenderTarget(o),n.value=a}setup(e){const t=this.textureNode,n=this.textureNodeOld,i=t.uvNode||rt();n.uvNode=i;const r=u=>t.uv(u),o=U(([u,h])=>{const d=A(h).toVar(),p=oe(u).toVar();return ft(cl(p.sub(d)),0)}),a=U(()=>{const u=oe(n),h=oe(r(i));return u.mulAssign(this.damp.mul(o(u,.1))),ft(h,u)}),c=this._materialComposed||(this._materialComposed=new Tt);c.name="AfterImage",c.fragmentNode=a(),I_.material=c;const l=e.getNodeProperties(this);return l.textureNode=t,this._textureNode}dispose(){this._compRT.dispose(),this._oldRT.dispose()}}const cD=(s,e)=>H(new Xb(ei(s),e)),lD=U(([s])=>En(s.rgb)),uD=U(([s,e=A(1)])=>e.mix(En(s.rgb),s.rgb)),hD=U(([s,e=A(1)])=>{const t=Wt(s.r,s.g,s.b).div(3),n=s.r.max(s.g.max(s.b)),i=n.sub(t).mul(e).mul(-3);return it(s.rgb,n,i)}),dD=U(([s,e=A(1)])=>{const t=D(.57735,.57735,.57735),n=e.cos();return D(s.rgb.mul(n).add(t.cross(s.rgb).mul(e.sin()).add(t.mul($t(t,s.rgb).mul(n.oneMinus())))))}),pD=new E,En=(s,e=D(...gt.getLuminanceCoefficients(pD)))=>$t(s,e),qb=(s,e)=>it(D(0),s,En(s).sub(e).max(0)),P_=new ys;class $b extends pt{static get type(){return"AnamorphicNode"}constructor(e,t,n,i){super("vec4"),this.textureNode=e,this.tresholdNode=t,this.scaleNode=n,this.colorNode=D(.1,0,1),this.samples=i,this.resolution=new J(1,1),this._renderTarget=new fn,this._renderTarget.texture.name="anamorphic",this._invSize=pe(new J),this._textureNode=Aa(this,this._renderTarget.texture),this.updateBeforeType=We.RENDER}getTextureNode(){return this._textureNode}setSize(e,t){this._invSize.value.set(1/e,1/t),e=Math.max(Math.round(e*this.resolution.x),1),t=Math.max(Math.round(t*this.resolution.y),1),this._renderTarget.setSize(e,t)}updateBefore(e){const{renderer:t}=e,n=this.textureNode,i=n.value;this._renderTarget.texture.type=i.type;const r=t.getRenderTarget(),o=n.value;P_.material=this._material,this.setSize(i.image.width,i.image.height),t.setRenderTarget(this._renderTarget),P_.render(t),t.setRenderTarget(r),n.value=o}setup(e){const t=this.textureNode,n=t.uvNode||rt(),i=c=>t.uv(c),r=U(()=>{const c=this.samples,l=Math.floor(c/2),u=D(0).toVar();return mt({start:-l,end:l},({i:h})=>{const d=A(h).abs().div(l).oneMinus(),p=z(n.x.add(this._invSize.x.mul(h).mul(this.scaleNode)),n.y),f=i(p),x=qb(f,this.tresholdNode).mul(d);u.addAssign(x)}),u.mul(this.colorNode)}),o=this._material||(this._material=new Tt);o.name="Anamorphic",o.fragmentNode=r();const a=e.getNodeProperties(this);return a.textureNode=t,this._textureNode}dispose(){this._renderTarget.dispose()}}const fD=(s,e=.9,t=3,n=32)=>H(new $b(ei(s),H(e),H(t),n));class Yb extends pt{static get type(){return"SobelOperatorNode"}constructor(e){super(),this.textureNode=e,this.updateBeforeType=We.RENDER,this._invSize=pe(new J)}updateBefore(){const e=this.textureNode.value;this._invSize.value.set(1/e.image.width,1/e.image.height)}setup(){const{textureNode:e}=this,t=e.uvNode||rt(),n=o=>e.uv(o);return U(()=>{const o=this._invSize,a=Tn(-1,-2,-1,0,0,0,1,2,1),c=Tn(-1,0,1,-2,0,2,-1,0,1),l=En(n(t.add(o.mul(z(-1,-1)))).xyz),u=En(n(t.add(o.mul(z(-1,0)))).xyz),h=En(n(t.add(o.mul(z(-1,1)))).xyz),d=En(n(t.add(o.mul(z(0,-1)))).xyz),p=En(n(t.add(o.mul(z(0,0)))).xyz),f=En(n(t.add(o.mul(z(0,1)))).xyz),x=En(n(t.add(o.mul(z(1,-1)))).xyz),m=En(n(t.add(o.mul(z(1,0)))).xyz),g=En(n(t.add(o.mul(z(1,1)))).xyz),y=Wt(a[0][0].mul(l),a[1][0].mul(d),a[2][0].mul(x),a[0][1].mul(u),a[1][1].mul(p),a[2][1].mul(m),a[0][2].mul(h),a[1][2].mul(f),a[2][2].mul(g)),_=Wt(c[0][0].mul(l),c[1][0].mul(d),c[2][0].mul(x),c[0][1].mul(u),c[1][1].mul(p),c[2][1].mul(m),c[0][2].mul(h),c[1][2].mul(f),c[2][2].mul(g)),v=y.mul(y).add(_.mul(_)).sqrt();return oe(D(v),1)})()}}const mD=s=>H(new Yb(ei(s)));class Zb extends pt{static get type(){return"DepthOfFieldNode"}constructor(e,t,n,i,r){super(),this.textureNode=e,this.viewZNode=t,this.focusNode=n,this.apertureNode=i,this.maxblurNode=r,this._aspect=pe(0),this.updateBeforeType=We.RENDER}updateBefore(){const e=this.textureNode.value;this._aspect.value=e.image.width/e.image.height}setup(){const e=this.textureNode,t=e.uvNode||rt(),n=o=>e.uv(o);return U(()=>{const o=z(1,this._aspect),a=this.focusNode.add(this.viewZNode),c=z(cn(a.mul(this.apertureNode),this.maxblurNode.negate(),this.maxblurNode)),l=c.mul(.9),u=c.mul(.7),h=c.mul(.4);let d=oe(0);return d=d.add(n(t)),d=d.add(n(t.add(z(0,.4).mul(o).mul(c)))),d=d.add(n(t.add(z(.15,.37).mul(o).mul(c)))),d=d.add(n(t.add(z(.29,.29).mul(o).mul(c)))),d=d.add(n(t.add(z(-.37,.15).mul(o).mul(c)))),d=d.add(n(t.add(z(.4,0).mul(o).mul(c)))),d=d.add(n(t.add(z(.37,-.15).mul(o).mul(c)))),d=d.add(n(t.add(z(.29,-.29).mul(o).mul(c)))),d=d.add(n(t.add(z(-.15,-.37).mul(o).mul(c)))),d=d.add(n(t.add(z(0,-.4).mul(o).mul(c)))),d=d.add(n(t.add(z(-.15,.37).mul(o).mul(c)))),d=d.add(n(t.add(z(-.29,.29).mul(o).mul(c)))),d=d.add(n(t.add(z(.37,.15).mul(o).mul(c)))),d=d.add(n(t.add(z(-.4,0).mul(o).mul(c)))),d=d.add(n(t.add(z(-.37,-.15).mul(o).mul(c)))),d=d.add(n(t.add(z(-.29,-.29).mul(o).mul(c)))),d=d.add(n(t.add(z(.15,-.37).mul(o).mul(c)))),d=d.add(n(t.add(z(.15,.37).mul(o).mul(l)))),d=d.add(n(t.add(z(-.37,.15).mul(o).mul(l)))),d=d.add(n(t.add(z(.37,-.15).mul(o).mul(l)))),d=d.add(n(t.add(z(-.15,-.37).mul(o).mul(l)))),d=d.add(n(t.add(z(-.15,.37).mul(o).mul(l)))),d=d.add(n(t.add(z(.37,.15).mul(o).mul(l)))),d=d.add(n(t.add(z(-.37,-.15).mul(o).mul(l)))),d=d.add(n(t.add(z(.15,-.37).mul(o).mul(l)))),d=d.add(n(t.add(z(.29,.29).mul(o).mul(u)))),d=d.add(n(t.add(z(.4,0).mul(o).mul(u)))),d=d.add(n(t.add(z(.29,-.29).mul(o).mul(u)))),d=d.add(n(t.add(z(0,-.4).mul(o).mul(u)))),d=d.add(n(t.add(z(-.29,.29).mul(o).mul(u)))),d=d.add(n(t.add(z(-.4,0).mul(o).mul(u)))),d=d.add(n(t.add(z(-.29,-.29).mul(o).mul(u)))),d=d.add(n(t.add(z(0,.4).mul(o).mul(u)))),d=d.add(n(t.add(z(.29,.29).mul(o).mul(h)))),d=d.add(n(t.add(z(.4,0).mul(o).mul(h)))),d=d.add(n(t.add(z(.29,-.29).mul(o).mul(h)))),d=d.add(n(t.add(z(0,-.4).mul(o).mul(h)))),d=d.add(n(t.add(z(-.29,.29).mul(o).mul(h)))),d=d.add(n(t.add(z(-.4,0).mul(o).mul(h)))),d=d.add(n(t.add(z(-.29,-.29).mul(o).mul(h)))),d=d.add(n(t.add(z(0,.4).mul(o).mul(h)))),d=d.div(41),d.a=1,oe(d)})()}}const gD=(s,e,t=1,n=.025,i=1)=>H(new Zb(ei(s),H(e),H(t),H(n),H(i)));class Jb extends pt{static get type(){return"DotScreenNode"}constructor(e,t=new J(.5,.5),n=1.57,i=1){super("vec4"),this.inputNode=e,this.center=pe(t),this.angle=pe(n),this.scale=pe(i)}setup(){const e=this.inputNode,t=U(()=>{const r=Cn(this.angle),o=Mi(this.angle),a=rt().mul(ua).sub(this.center),c=z(o.mul(a.x).sub(r.mul(a.y)),r.mul(a.x).add(o.mul(a.y))).mul(this.scale);return Cn(c.x).mul(Cn(c.y)).mul(4)});return U(()=>{const r=e,o=Wt(r.r,r.g,r.b).div(3);return oe(D(o.mul(10).sub(5).add(t())),r.a)})()}}const xD=(s,e,t,n)=>H(new Jb(H(s),e,t,n));class Kb extends pt{static get type(){return"RGBShiftNode"}constructor(e,t=.005,n=0){super("vec4"),this.textureNode=e,this.amount=pe(t),this.angle=pe(n)}setup(){const{textureNode:e}=this,t=e.uvNode||rt(),n=r=>e.uv(r);return U(()=>{const r=z(Mi(this.angle),Cn(this.angle)).mul(this.amount),o=n(t.add(r)),a=n(t),c=n(t.sub(r));return oe(o.r,a.g,c.b,a.a)})()}}const _D=(s,e,t)=>H(new Kb(ei(s),e,t));class jb extends pt{static get type(){return"FilmNode"}constructor(e,t=null,n=null){super(),this.inputNode=e,this.intensityNode=t,this.uvNode=n}setup(){const e=this.uvNode||rt();return U(()=>{const i=this.inputNode.rgb,r=xg(mr(e.add(jg())));let o=i.add(i.mul(cn(r.add(.1),0,1)));return this.intensityNode!==null&&(o=it(i,o,this.intensityNode)),oe(o,this.inputNode.a)})()}}const yD=K(jb);class Qb extends pt{static get type(){return"Lut3DNode"}constructor(e,t,n,i){super(),this.inputNode=e,this.lutNode=t,this.size=pe(n),this.intensityNode=i}setup(){const{inputNode:e,lutNode:t}=this,n=o=>t.uv(o);return U(()=>{const o=e,a=A(1).div(this.size),c=A(.5).div(this.size),l=D(c).add(o.rgb.mul(A(1).sub(a))),u=oe(n(l).rgb,o.a);return oe(it(o,u,this.intensityNode))})()}}const vD=(s,e,t,n)=>H(new Qb(H(s),H(e),t,H(n))),L_=new ys,D_=new _e,MD=new J;class ew extends pt{static get type(){return"GTAONode"}constructor(e,t,n){super(),this.depthNode=e,this.normalNode=t,this.radius=pe(.25),this.resolution=pe(new J),this.thickness=pe(1),this.distanceExponent=pe(1),this.distanceFallOff=pe(1),this.scale=pe(1),this.noiseNode=xt(SD()),this.cameraProjectionMatrix=pe(n.projectionMatrix),this.cameraProjectionMatrixInverse=pe(n.projectionMatrixInverse),this.SAMPLES=pe(16),this._aoRenderTarget=new fn,this._aoRenderTarget.texture.name="GTAONode.AO",this._material=null,this._textureNode=Aa(this,this._aoRenderTarget.texture),this.updateBeforeType=We.FRAME}getTextureNode(){return this._textureNode}setSize(e,t){this.resolution.value.set(e,t),this._aoRenderTarget.setSize(e,t)}updateBefore(e){const{renderer:t}=e,n=t.getDrawingBufferSize(MD),i=t.getRenderTarget(),r=t.getMRT();t.getClearColor(D_);const o=t.getClearAlpha();L_.material=this._material,this.setSize(n.width,n.height),t.setMRT(null),t.setClearColor(16777215,1),t.setRenderTarget(this._aoRenderTarget),L_.render(t),t.setRenderTarget(i),t.setMRT(r),t.setClearColor(D_,o)}setup(e){const t=rt(),n=l=>this.depthNode.uv(l).x,i=l=>this.noiseNode.uv(l),r=U(([l])=>{const u=this.cameraProjectionMatrix.mul(oe(l,1));let h=u.xy.div(u.w).mul(.5).add(.5).toVar();h=z(h.x,h.y.oneMinus());const d=n(h);return D(h,d)}),o=U(([l,u])=>{l=z(l.x,l.y.oneMinus()).mul(2).sub(1);const h=oe(D(l,u),1),d=oe(this.cameraProjectionMatrixInverse.mul(h));return d.xyz.div(d.w)}),a=U(()=>{const l=n(t);l.greaterThanEqual(1).discard();const u=o(t,l),h=this.normalNode.rgb.normalize(),d=this.radius,p=tr(this.noiseNode,0);let f=z(t.x,t.y.oneMinus());f=f.mul(this.resolution.div(p));const x=i(f),m=x.xyz.mul(2).sub(1),g=D(m.xy,0).normalize(),y=D(g.y.mul(-1),g.x,0),_=Tn(g,y,D(0,0,1)),v=this.SAMPLES.lessThan(30).select(3,5),I=Wt(this.SAMPLES,v.sub(1)).div(v),T=A(0).toVar();return mt({start:L(0),end:v,type:"int",condition:"<"},({i:w})=>{const C=A(w).div(A(v)).mul(Qr),F=oe(Mi(C),Cn(C),0,Wt(.5,ot(.5,x.w)));F.xyz=vi(_.mul(F.xyz));const M=vi(u.xyz.negate()),b=vi(Ko(F.xyz,M)),G=Ko(b,M),W=vi(h.sub(b.mul($t(h,b)))),$=Ko(W,b),ie=z($t(M,$),$t(M,$.negate())).toVar();mt({end:I,type:"int",name:"j",condition:"<"},({j:Qe})=>{const ht=F.xyz.mul(d).mul(F.w).mul(Kn(ts(A(Qe).add(1),A(I)),this.distanceExponent)),ne=r(u.add(ht)),Ae=o(ne.xy,ne.z).sub(u);Oe(Dt(Ae.z).lessThan(this.thickness),()=>{const Je=$t(M,vi(Ae));ie.x.addAssign(ft(0,ot(Je.sub(ie.x),it(1,A(2).div(A(Qe).add(2)),this.distanceFallOff))))});const ge=r(u.sub(ht)),Xe=o(ge.xy,ge.z).sub(u);Oe(Dt(Xe.z).lessThan(this.thickness),()=>{const Je=$t(M,vi(Xe));ie.y.addAssign(ft(0,ot(Je.sub(ie.y),it(1,A(2).div(A(Qe).add(2)),this.distanceFallOff))))})});const q=os(Ft(1,ie.mul(ie))),he=$t(W,G),Q=$t(W,M),we=ot(.5,xh(ie.y).sub(xh(ie.x)).add(q.x.mul(ie.x).sub(q.y.mul(ie.y)))),Ne=ot(.5,Ft(2,ie.x.mul(ie.x)).sub(ie.y.mul(ie.y))),Ee=he.mul(we).add(Q.mul(Ne));T.addAssign(Ee)}),T.assign(cn(T.div(v),0,1)),T.assign(Kn(T,this.scale)),oe(D(T),1)}),c=this._material||(this._material=new Tt);return c.fragmentNode=a().context(e.getSharedContext()),c.name="GTAO",c.needsUpdate=!0,this._textureNode}dispose(){this._aoRenderTarget.dispose()}}function SD(s=5){const e=Math.floor(s)%2===0?Math.floor(s)+1:Math.floor(s),t=TD(e),n=t.length,i=new Uint8Array(n*4);for(let o=0;o<n;++o){const a=t[o],c=2*Math.PI*a/n,l=new E(Math.cos(c),Math.sin(c),0).normalize();i[o*4]=(l.x*.5+.5)*255,i[o*4+1]=(l.y*.5+.5)*255,i[o*4+2]=127,i[o*4+3]=255}const r=new Oi(i,e,e);return r.wrapS=rr,r.wrapT=rr,r.needsUpdate=!0,r}function TD(s){const e=Math.floor(s)%2===0?Math.floor(s)+1:Math.floor(s),t=e*e,n=Array(t).fill(0);let i=Math.floor(e/2),r=e-1;for(let o=1;o<=t;){if(i===-1&&r===e?(r=e-2,i=0):(r===e&&(r=0),i<0&&(i=e-1)),n[i*e+r]!==0){r-=2,i++;continue}else n[i*e+r]=o++;r++,i--}return n}const bD=(s,e,t)=>H(new ew(H(s),H(e),t));class tw extends pt{static get type(){return"DenoiseNode"}constructor(e,t,n,i,r){super(),this.textureNode=e,this.depthNode=t,this.normalNode=n,this.noiseNode=i,this.cameraProjectionMatrixInverse=pe(r.projectionMatrixInverse),this.lumaPhi=pe(5),this.depthPhi=pe(5),this.normalPhi=pe(5),this.radius=pe(5),this.index=pe(0),this._resolution=pe(new J),this._sampleVectors=ds(wD(16,2,1)),this.updateBeforeType=We.RENDER}updateBefore(){const e=this.textureNode.value;this._resolution.value.set(e.image.width,e.image.height)}setup(){const e=rt(),t=h=>this.textureNode.uv(h),n=h=>this.depthNode.uv(h).x,i=h=>this.normalNode.uv(h),r=h=>this.noiseNode.uv(h),o=U(([h,d])=>{h=z(h.x,h.y.oneMinus()).mul(2).sub(1);const p=oe(D(h,d),1),f=oe(this.cameraProjectionMatrixInverse.mul(p));return f.xyz.div(f.w)}),a=U(([h,d,p,f])=>{const x=t(f),m=n(f),g=i(f).rgb.normalize(),y=x.rgb,_=o(f,m),v=$t(d,g).toVar(),I=Kn(ft(v,0),this.normalPhi).toVar(),T=Dt(En(y).sub(En(h))).toVar(),w=ft(A(1).sub(T.div(this.lumaPhi)),0).toVar(),C=Dt($t(p.sub(_),d)).toVar(),F=ft(A(1).sub(C.div(this.depthPhi)),0),M=w.mul(F).mul(I);return oe(y.mul(M),M)}),c=U(([h])=>{const d=n(h),p=i(h).rgb.normalize(),f=t(h);Oe(d.greaterThanEqual(1).or($t(p,p).equal(0)),()=>f);const x=D(f.rgb),m=o(h,d),g=tr(this.noiseNode,0);let y=z(h.x,h.y.oneMinus());y=y.mul(this._resolution.div(g));const _=r(y),v=Cn(_.element(this.index.mod(4).mul(2).mul(Qr))),I=Mi(_.element(this.index.mod(4).mul(2).mul(Qr))),T=z(v,I),w=ol(T.x,T.y.negate(),T.x,T.y),C=A(1).toVar(),F=D(f.rgb).toVar();return mt({start:L(0),end:L(16),type:"int",condition:"<"},({i:M})=>{const b=this._sampleVectors.element(M).toVar(),G=w.mul(b.xy.mul(A(1).add(b.z.mul(this.radius.sub(1))))).div(this._resolution).toVar(),W=h.add(G).toVar(),$=a(x,p,m,W);F.addAssign($.xyz),C.addAssign($.w)}),Oe(C.greaterThan(A(0)),()=>{F.divAssign(C)}),oe(F,f.a)}).setLayout({name:"denoise",type:"vec4",inputs:[{name:"uv",type:"vec2"}]});return U(()=>c(e))()}}function wD(s,e,t){const n=AD(s,e,t),i=[];for(let r=0;r<s;r++){const o=n[r];i.push(o)}return i}function AD(s,e,t){const n=[];for(let i=0;i<s;i++){const r=2*Math.PI*e*i/s,o=Math.pow(i/(s-1),t);n.push(new E(Math.cos(r),Math.sin(r),o))}return n}const ND=(s,e,t,n,i)=>H(new tw(ei(s),H(e),H(t),H(n),i));class nw extends pt{static get type(){return"FXAANode"}constructor(e){super(),this.textureNode=e,this.updateBeforeType=We.RENDER,this._invSize=pe(new J)}updateBefore(){const e=this.textureNode.value;this._invSize.value.set(1/e.image.width,1/e.image.height)}setup(){const e=this.textureNode.bias(-100),t=e.uvNode||rt(),n=u=>e.uv(u),i=(u,h,d)=>e.uv(u.add(h.mul(d))),r=L(5),o=U(([u,h])=>{const d=oe(h).toVar(),p=oe(u).toVar(),f=oe(Dt(p.sub(d))).toVar();return ft(ft(ft(f.r,f.g),f.b),f.a)}),a=U(([u,h,d,p])=>{const f=n(u).toVar(),x=i(u,z(0,-1),h.xy).toVar(),m=i(u,z(1,0),h.xy).toVar(),g=i(u,z(0,1),h.xy).toVar(),y=i(u,z(-1,0),h.xy).toVar(),_=o(f,g).toVar(),v=o(f,x).toVar(),I=o(f,m).toVar(),T=o(f,y).toVar(),w=ft(_,ft(v,ft(I,T))).toVar();Oe(w.lessThan(d),()=>f);const C=Ft(_.add(v),I.add(T)).toVar();C.mulAssign(p),Oe(Dt(C).lessThan(.3),()=>{const ht=I.greaterThan(T).select(1,-1).toVar(),ne=v.greaterThan(_).select(1,-1).toVar(),ue=z(ht,ne).toVar(),Ae=i(u,z(ue.x,ue.y),h.xy),ge=o(f,Ae).toVar(),Ze=i(u,z(ue.x.negate(),ue.y.negate()),h.xy),Xe=o(f,Ze).toVar();C.assign(Xe.sub(ge)),C.mulAssign(p),Oe(Dt(C).lessThan(.3),()=>{const Je=g.add(x).add(m).add(y);return it(f,Je.mul(.25),.4)})});const F=z().toVar();Oe(C.lessThanEqual(0),()=>{g.assign(y),x.assign(m),F.x.assign(0),F.y.assign(h.y)}).Else(()=>{F.x.assign(h.x),F.y.assign(0)});const M=o(f,g).toVar(),b=o(f,x).toVar();Oe(M.lessThanEqual(b),()=>{g.assign(x)});const G=L(0).toVar(),W=L(0).toVar(),$=A(0).toVar(),ie=A(0).toVar(),q=z(u).toVar(),he=z(u).toVar(),Q=L(0).toVar(),we=L(0).toVar();mt(r,({i:ht})=>{const ne=ht.add(1).toVar();Oe(G.equal(0),()=>{$.addAssign(ne),q.assign(u.add(F.mul($)));const ue=n(q.xy),Ae=o(ue,f).toVar(),ge=o(ue,g).toVar();Oe(Ae.greaterThan(ge),()=>{G.assign(1)}),Q.assign(ht)}),Oe(W.equal(0),()=>{ie.addAssign(ne),he.assign(u.sub(F.mul(ie)));const ue=n(he.xy),Ae=o(ue,f).toVar(),ge=o(ue,g).toVar();Oe(Ae.greaterThan(ge),()=>{W.assign(1)}),we.assign(ht)}),Oe(G.equal(1).or(W.equal(1)),()=>{Rd()})}),Oe(G.equal(0).and(W.equal(0)),()=>f);const Ne=A(1).toVar(),Ee=A(1).toVar();Oe(G.equal(1),()=>{Ne.assign(A(Q).div(A(r.sub(1))))}),Oe(W.equal(1),()=>{Ee.assign(A(we).div(A(r.sub(1))))});const Qe=Mn(Ne,Ee);return Qe.assign(Kn(Qe,.5)),Qe.assign(A(1).sub(Qe)),it(f,g,Qe.mul(.5))}).setLayout({name:"FxaaPixelShader",type:"vec4",inputs:[{name:"uv",type:"vec2"},{name:"fxaaQualityRcpFrame",type:"vec2"},{name:"fxaaQualityEdgeThreshold",type:"float"},{name:"fxaaQualityinvEdgeThreshold",type:"float"}]});return U(()=>{const u=A(.2),h=A(1).div(u);return a(t,this._invSize,u,h)})()}}const ED=s=>H(new nw(ei(s))),Ir=new ys,CD=new _e(0,0,0),U_=new _e,RD=new J,ID=new J(1,0),PD=new J(0,1);class iw extends pt{static get type(){return"BloomNode"}constructor(e,t=1,n=0,i=0){super(),this.inputNode=e,this.strength=pe(t),this.radius=pe(n),this.threshold=pe(i),this.smoothWidth=pe(.01),this._renderTargetsHorizontal=[],this._renderTargetsVertical=[],this._nMips=5,this._renderTargetBright=new fn(1,1,{type:Ln}),this._renderTargetBright.texture.name="UnrealBloomPass.bright",this._renderTargetBright.texture.generateMipmaps=!1;for(let r=0;r<this._nMips;r++){const o=new fn(1,1,{type:Ln});o.texture.name="UnrealBloomPass.h"+r,o.texture.generateMipmaps=!1,this._renderTargetsHorizontal.push(o);const a=new fn(1,1,{type:Ln});a.texture.name="UnrealBloomPass.v"+r,a.texture.generateMipmaps=!1,this._renderTargetsVertical.push(a)}this._compositeMaterial=null,this._highPassFilterMaterial=null,this._separableBlurMaterials=[],this._textureNodeBright=xt(this._renderTargetBright.texture),this._textureNodeBlur0=xt(this._renderTargetsVertical[0].texture),this._textureNodeBlur1=xt(this._renderTargetsVertical[1].texture),this._textureNodeBlur2=xt(this._renderTargetsVertical[2].texture),this._textureNodeBlur3=xt(this._renderTargetsVertical[3].texture),this._textureNodeBlur4=xt(this._renderTargetsVertical[4].texture),this._textureOutput=Aa(this,this._renderTargetsHorizontal[0].texture),this.updateBeforeType=We.FRAME}getTextureNode(){return this._textureOutput}setSize(e,t){let n=Math.round(e/2),i=Math.round(t/2);this._renderTargetBright.setSize(n,i);for(let r=0;r<this._nMips;r++)this._renderTargetsHorizontal[r].setSize(n,i),this._renderTargetsVertical[r].setSize(n,i),this._separableBlurMaterials[r].invSize.value.set(1/n,1/i),n=Math.round(n/2),i=Math.round(i/2)}updateBefore(e){const{renderer:t}=e,n=t.getDrawingBufferSize(RD);this.setSize(n.width,n.height);const i=t.getRenderTarget(),r=t.getMRT();t.getClearColor(U_);const o=t.getClearAlpha();this.setSize(n.width,n.height),t.setMRT(null),t.setClearColor(CD,0),t.setRenderTarget(this._renderTargetBright),Ir.material=this._highPassFilterMaterial,Ir.render(t);let a=this._renderTargetBright;for(let c=0;c<this._nMips;c++)Ir.material=this._separableBlurMaterials[c],this._separableBlurMaterials[c].colorTexture.value=a.texture,this._separableBlurMaterials[c].direction.value=ID,t.setRenderTarget(this._renderTargetsHorizontal[c]),t.clear(),Ir.render(t),this._separableBlurMaterials[c].colorTexture.value=this._renderTargetsHorizontal[c].texture,this._separableBlurMaterials[c].direction.value=PD,t.setRenderTarget(this._renderTargetsVertical[c]),t.clear(),Ir.render(t),a=this._renderTargetsVertical[c];t.setRenderTarget(this._renderTargetsHorizontal[0]),t.clear(),Ir.material=this._compositeMaterial,Ir.render(t),t.setRenderTarget(i),t.setMRT(r),t.setClearColor(U_,o)}setup(e){const t=U(()=>{const c=this.inputNode,l=En(c.rgb),u=ti(this.threshold,this.threshold.add(this.smoothWidth),l);return it(oe(0),c,u)});this._highPassFilterMaterial=this._highPassFilterMaterial||new Tt,this._highPassFilterMaterial.fragmentNode=t().context(e.getSharedContext()),this._highPassFilterMaterial.name="Bloom_highPass",this._highPassFilterMaterial.needsUpdate=!0;const n=[3,5,7,9,11];for(let c=0;c<this._nMips;c++)this._separableBlurMaterials.push(this._getSeperableBlurMaterial(e,n[c]));const i=ds([1,.8,.6,.4,.2]),r=ds([new E(1,1,1),new E(1,1,1),new E(1,1,1),new E(1,1,1),new E(1,1,1)]),o=U(([c,l])=>{const u=A(1.2).sub(c);return it(c,u,l)}).setLayout({name:"lerpBloomFactor",type:"float",inputs:[{name:"factor",type:"float"},{name:"radius",type:"float"}]}),a=U(()=>{const c=o(i.element(0),this.radius).mul(oe(r.element(0),1)).mul(this._textureNodeBlur0),l=o(i.element(1),this.radius).mul(oe(r.element(1),1)).mul(this._textureNodeBlur1),u=o(i.element(2),this.radius).mul(oe(r.element(2),1)).mul(this._textureNodeBlur2),h=o(i.element(3),this.radius).mul(oe(r.element(3),1)).mul(this._textureNodeBlur3),d=o(i.element(4),this.radius).mul(oe(r.element(4),1)).mul(this._textureNodeBlur4);return c.add(l).add(u).add(h).add(d).mul(this.strength)});return this._compositeMaterial=this._compositeMaterial||new Tt,this._compositeMaterial.fragmentNode=a().context(e.getSharedContext()),this._compositeMaterial.name="Bloom_comp",this._compositeMaterial.needsUpdate=!0,this._textureOutput}dispose(){for(let e=0;e<this._renderTargetsHorizontal.length;e++)this._renderTargetsHorizontal[e].dispose();for(let e=0;e<this._renderTargetsVertical.length;e++)this._renderTargetsVertical[e].dispose();this._renderTargetBright.dispose()}_getSeperableBlurMaterial(e,t){const n=[];for(let d=0;d<t;d++)n.push(.39894*Math.exp(-.5*d*d/(t*t))/t);const i=xt(),r=ds(n),o=pe(new J),a=pe(new J(.5,.5)),c=rt(),l=d=>i.uv(d),u=U(()=>{const d=r.element(0).toVar(),p=l(c).rgb.mul(d).toVar();return mt({start:L(1),end:L(t),type:"int",condition:"<"},({i:f})=>{const x=A(f),m=r.element(f),g=a.mul(o).mul(x),y=l(c.add(g)).rgb,_=l(c.sub(g)).rgb;p.addAssign(Wt(y,_).mul(m)),d.addAssign(A(2).mul(m))}),oe(p.div(d),1)}),h=new Tt;return h.fragmentNode=u().context(e.getSharedContext()),h.name="Bloom_seperable",h.needsUpdate=!0,h.colorTexture=i,h.direction=a,h.invSize=o,h}}const LD=(s,e,t,n)=>H(new iw(H(s),e,t,n));class sw extends pt{static get type(){return"TransitionNode"}constructor(e,t,n,i,r,o){super(),this.textureNodeA=e,this.textureNodeB=t,this.mixTextureNode=n,this.mixRatioNode=i,this.thresholdNode=r,this.useTextureNode=o}setup(){const{textureNodeA:e,textureNodeB:t,mixTextureNode:n,mixRatioNode:i,thresholdNode:r,useTextureNode:o}=this,a=u=>{const h=u.uvNode||rt();return u.uv(h)};return U(()=>{const u=a(e),h=a(t),d=oe().toVar();return Oe(o.equal(L(1)),()=>{const p=a(n),f=i.mul(r.mul(2).add(1)).sub(r),x=cn(Ft(p.r,f).mul(A(1).div(r)),0,1);d.assign(it(u,h,x))}).Else(()=>{d.assign(it(h,u,i))}),d})()}}const DD=(s,e,t,n=0,i=.1,r=0)=>H(new sw(ei(s),ei(e),ei(t),H(n),H(i),H(r)));class UD extends pt{static get type(){return"PixelationNode"}constructor(e,t,n,i,r,o){super(),this.textureNode=e,this.depthNode=t,this.normalNode=n,this.pixelSize=i,this.normalEdgeStrength=r,this.depthEdgeStrength=o,this._resolution=pe(new st),this.updateBeforeType=We.RENDER}updateBefore(){const e=this.textureNode.value,t=e.image.width,n=e.image.height;this._resolution.value.set(t,n,1/t,1/n)}setup(){const{textureNode:e,depthNode:t,normalNode:n}=this,i=e.uvNode||rt(),r=t.uvNode||rt(),o=n.uvNode||rt(),a=()=>e.uv(i),c=(x,m)=>t.uv(r.add(z(x,m).mul(this._resolution.zw))).r,l=(x,m)=>n.uv(o.add(z(x,m).mul(this._resolution.zw))).rgb.normalize(),u=x=>{const m=ai("float","diff");return m.addAssign(cn(c(1,0).sub(x))),m.addAssign(cn(c(-1,0).sub(x))),m.addAssign(cn(c(0,1).sub(x))),m.addAssign(cn(c(0,-1).sub(x))),fr(ti(.01,.02,m).mul(2)).div(2)},h=(x,m,g,y)=>{const _=c(x,m).sub(g),v=l(x,m),I=D(1,1,1),T=$t(y.sub(v),I),w=cn(ti(-.01,.01,T),0,1),C=cn(cl(_.mul(.25).add(.0025)),0,1);return A(1).sub($t(y,v)).mul(C).mul(w)},d=(x,m)=>{const g=ai("float","indicator");return g.addAssign(h(0,-1,x,m)),g.addAssign(h(0,1,x,m)),g.addAssign(h(-1,0,x,m)),g.addAssign(h(1,0,x,m)),ll(.1,g)};return U(()=>{const x=a(),m=ai("float","depth"),g=ai("vec3","normal");Oe(this.depthEdgeStrength.greaterThan(0).or(this.normalEdgeStrength.greaterThan(0)),()=>{m.assign(c(0,0)),g.assign(l(0,0))});const y=ai("float","dei");Oe(this.depthEdgeStrength.greaterThan(0),()=>{y.assign(u(m))});const _=ai("float","nei");Oe(this.normalEdgeStrength.greaterThan(0),()=>{_.assign(d(m,g))});const v=y.greaterThan(0).select(A(1).sub(y.mul(this.depthEdgeStrength)),_.mul(this.normalEdgeStrength).add(1));return x.mul(v)})()}}const FD=(s,e,t,n=6,i=.3,r=.4)=>H(new UD(ei(s),ei(e),ei(t),H(n),H(i),H(r)));class rw extends bn{static get type(){return"PixelationPassNode"}constructor(e,t,n=6,i=.3,r=.4){super("color",e,t,{minFilter:Qt,magFilter:Qt}),this.pixelSize=n,this.normalEdgeStrength=i,this.depthEdgeStrength=r,this.isPixelationPassNode=!0,this._mrt=Ud({output:ng,normal:di})}setSize(e,t){const n=this.pixelSize.value?this.pixelSize.value:this.pixelSize,i=Math.floor(e/n),r=Math.floor(t/n);super.setSize(i,r)}setup(){const e=super.getTextureNode("output"),t=super.getTextureNode("depth"),n=super.getTextureNode("normal");return FD(e,t,n,this.pixelSize,this.normalEdgeStrength,this.depthEdgeStrength)}}const OD=(s,e,t,n,i)=>H(new rw(s,e,t,n,i)),VD=new J;class ow extends bn{static get type(){return"SSAAPassNode"}constructor(e,t){super(bn.COLOR,e,t),this.isSSAAPassNode=!0,this.sampleLevel=4,this.unbiased=!0,this.clearColor=new _e(0),this.clearAlpha=0,this._currentClearColor=new _e,this.sampleWeight=pe(1),this.sampleRenderTarget=null,this._quadMesh=new ys}updateBefore(e){const{renderer:t}=e,{scene:n,camera:i}=this;this._pixelRatio=t.getPixelRatio();const r=t.getSize(VD);this.setSize(r.width,r.height),this.sampleRenderTarget.setSize(this.renderTarget.width,this.renderTarget.height),t.getClearColor(this._currentClearColor);const o=t.getClearAlpha(),a=t.getRenderTarget(),c=t.getMRT(),l=t.autoClear;this._cameraNear.value=i.near,this._cameraFar.value=i.far,t.setMRT(this.getMRT()),t.autoClear=!1;const u=BD[Math.max(0,Math.min(this.sampleLevel,5))],h=1/u.length,d=1/32,p={fullWidth:this.renderTarget.width,fullHeight:this.renderTarget.height,offsetX:0,offsetY:0,width:this.renderTarget.width,height:this.renderTarget.height},f=Object.assign({},i.view);f.enabled&&Object.assign(p,f);for(let x=0;x<u.length;x++){const m=u[x];if(i.setViewOffset&&i.setViewOffset(p.fullWidth,p.fullHeight,p.offsetX+m[0]*.0625,p.offsetY+m[1]*.0625,p.width,p.height),this.sampleWeight.value=h,this.unbiased){const g=-.5+(x+.5)/u.length;this.sampleWeight.value+=d*g}t.setClearColor(this.clearColor,this.clearAlpha),t.setRenderTarget(this.sampleRenderTarget),t.clear(),t.render(n,i),t.setRenderTarget(this.renderTarget),x===0&&(t.setClearColor(0,0),t.clear()),this._quadMesh.render(t)}t.copyTextureToTexture(this.sampleRenderTarget.depthTexture,this.renderTarget.depthTexture),i.setViewOffset&&f.enabled?i.setViewOffset(f.fullWidth,f.fullHeight,f.offsetX,f.offsetY,f.width,f.height):i.clearViewOffset&&i.clearViewOffset(),t.setRenderTarget(a),t.setMRT(c),t.autoClear=l,t.setClearColor(this._currentClearColor,o)}setup(e){this.sampleRenderTarget===null&&(this.sampleRenderTarget=this.renderTarget.clone());let t;const n=this.getMRT();if(n!==null){const i={};for(const r in n.outputNodes){const o=Kg(this.sampleRenderTarget.textures,r);o>=0&&(i[r]=xt(this.sampleRenderTarget.textures[o]).mul(this.sampleWeight))}t=Ud(i)}else t=xt(this.sampleRenderTarget.texture).mul(this.sampleWeight);return this._quadMesh.material=new Tt,this._quadMesh.material.fragmentNode=t,this._quadMesh.material.transparent=!0,this._quadMesh.material.depthTest=!1,this._quadMesh.material.depthWrite=!1,this._quadMesh.material.premultipliedAlpha=!0,this._quadMesh.material.blending=lc,this._quadMesh.material.normals=!1,this._quadMesh.material.name="SSAA",super.setup(e)}dispose(){super.dispose(),this.sampleRenderTarget!==null&&this.sampleRenderTarget.dispose()}}const BD=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]],zD=(s,e)=>H(new ow(s,e)),kD=new J;class aw extends bn{static get type(){return"StereoPassNode"}constructor(e,t){super(bn.COLOR,e,t),this.isStereoPassNode=!0,this.stereo=new Pm,this.stereo.aspect=.5}updateBefore(e){const{renderer:t}=e,{scene:n,camera:i,stereo:r,renderTarget:o}=this;this._pixelRatio=t.getPixelRatio(),r.cameraL.coordinateSystem=t.coordinateSystem,r.cameraR.coordinateSystem=t.coordinateSystem,r.update(i);const a=t.getSize(kD);this.setSize(a.width,a.height);const c=t.autoClear;t.autoClear=!1;const l=t.getRenderTarget(),u=t.getMRT();this._cameraNear.value=i.near,this._cameraFar.value=i.far;for(const h in this._previousTextures)this.toggleTexture(h);t.setRenderTarget(o),t.setMRT(this._mrt),t.clear(),o.scissorTest=!0,o.scissor.set(0,0,o.width/2,o.height),o.viewport.set(0,0,o.width/2,o.height),t.render(n,r.cameraL),o.scissor.set(o.width/2,0,o.width/2,o.height),o.viewport.set(o.width/2,0,o.width/2,o.height),t.render(n,r.cameraR),o.scissorTest=!1,t.setRenderTarget(l),t.setMRT(u),t.autoClear=c}}const GD=(s,e)=>H(new aw(s,e)),HD=new J,F_=new ys;class cw extends bn{static get type(){return"StereoCompositePassNode"}constructor(e,t){super(bn.COLOR,e,t),this.isStereoCompositePassNode=!0,this.stereo=new Pm;const n={minFilter:Ut,magFilter:Qt,type:Ln};this._renderTargetL=new fn(1,1,n),this._renderTargetR=new fn(1,1,n),this._mapLeft=xt(this._renderTargetL.texture),this._mapRight=xt(this._renderTargetR.texture),this._material=null}updateStereoCamera(e){this.stereo.cameraL.coordinateSystem=e,this.stereo.cameraR.coordinateSystem=e,this.stereo.update(this.camera)}setSize(e,t){super.setSize(e,t),this._renderTargetL.setSize(this.renderTarget.width,this.renderTarget.height),this._renderTargetR.setSize(this.renderTarget.width,this.renderTarget.height)}updateBefore(e){const{renderer:t}=e,{scene:n,stereo:i,renderTarget:r}=this;this._pixelRatio=t.getPixelRatio(),this.updateStereoCamera(t.coordinateSystem);const o=t.getSize(HD);this.setSize(o.width,o.height);const a=t.getRenderTarget();t.setRenderTarget(this._renderTargetL),t.render(n,i.cameraL),t.setRenderTarget(this._renderTargetR),t.render(n,i.cameraR),t.setRenderTarget(r),F_.material=this._material,F_.render(t),t.setRenderTarget(a)}dispose(){super.dispose(),this._renderTargetL.dispose(),this._renderTargetR.dispose(),this._material!==null&&this._material.dispose()}}class lw extends cw{static get type(){return"AnaglyphPassNode"}constructor(e,t){super(e,t),this.isAnaglyphPassNode=!0,this._colorMatrixLeft=pe(new Ke().fromArray([.4561,-.0400822,-.0152161,.500484,-.0378246,-.0205971,.176381,-.0157589,-.00546856])),this._colorMatrixRight=pe(new Ke().fromArray([-.0434706,.378476,-.0721527,-.0879388,.73364,-.112961,-.00155529,-.0184503,1.2264]))}setup(e){const t=rt(),n=U(()=>{const r=this._mapLeft.uv(t),o=this._mapRight.uv(t),a=cn(this._colorMatrixLeft.mul(r.rgb).add(this._colorMatrixRight.mul(o.rgb)));return oe(a.rgb,ft(r.a,o.a))}),i=this._material||(this._material=new Tt);return i.fragmentNode=n().context(e.getSharedContext()),i.name="Anaglyph",i.needsUpdate=!0,super.setup(e)}}const WD=(s,e)=>H(new lw(s,e));class uw extends cw{static get type(){return"ParallaxBarrierPassNode"}constructor(e,t){super(e,t),this.isParallaxBarrierPassNode=!0}setup(e){const t=rt(),n=U(()=>{const r=oe().toVar();return Oe(Td(wa.y,2).greaterThan(1),()=>{r.assign(this._mapLeft.uv(t))}).Else(()=>{r.assign(this._mapRight.uv(t))}),r}),i=this._material||(this._material=new Tt);return i.fragmentNode=n().context(e.getSharedContext()),i.needsUpdate=!0,super.setup(e)}}const XD=(s,e)=>H(new uw(s,e));class hw extends bn{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,i,r){super(bn.COLOR,e,t),this.colorNode=n,this.thicknessNode=i,this.alphaNode=r,this._materialCache=new WeakMap}updateBefore(e){const{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((i,r,o,a,c,l,u)=>{if((c.isMeshToonMaterial||c.isMeshToonNodeMaterial)&&c.wireframe===!1){const h=this._getOutlineMaterial(c);t.renderObject(i,r,o,a,h,l,u)}t.renderObject(i,r,o,a,c,l,u)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){const e=new Tt;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=ln;const t=hi.negate(),n=ci.mul(xs),i=A(1),r=n.mul(oe(en,1)),o=n.mul(oe(en.add(t),1)),a=vi(r.sub(o));return e.vertexNode=r.add(a.mul(this.thicknessNode).mul(r.w).mul(i)),e.colorNode=oe(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}const qD=(s,e,t=new _e(0,0,0),n=.003,i=1)=>H(new hw(s,e,H(t),H(n),H(i)));class dw extends Ye{static get type(){return"ScriptableValueNode"}constructor(e=null){super(),this._value=e,this._cache=null,this.inputType=null,this.outpuType=null,this.events=new Ai,this.isScriptableValueNode=!0}get isScriptableOutputNode(){return this.outputType!==null}set value(e){this._value!==e&&(this._cache&&this.inputType==="URL"&&this.value.value instanceof ArrayBuffer&&(URL.revokeObjectURL(this._cache),this._cache=null),this._value=e,this.events.dispatchEvent({type:"change"}),this.refresh())}get value(){return this._value}refresh(){this.events.dispatchEvent({type:"refresh"})}getValue(){const e=this.value;if(e&&this._cache===null&&this.inputType==="URL"&&e.value instanceof ArrayBuffer)this._cache=URL.createObjectURL(new Blob([e.value]));else if(e&&e.value!==null&&e.value!==void 0&&((this.inputType==="URL"||this.inputType==="String")&&typeof e.value=="string"||this.inputType==="Number"&&typeof e.value=="number"||this.inputType==="Vector2"&&e.value.isVector2||this.inputType==="Vector3"&&e.value.isVector3||this.inputType==="Vector4"&&e.value.isVector4||this.inputType==="Color"&&e.value.isColor||this.inputType==="Matrix3"&&e.value.isMatrix3||this.inputType==="Matrix4"&&e.value.isMatrix4))return e.value;return this._cache||e}getNodeType(e){return this.value&&this.value.isNode?this.value.getNodeType(e):"float"}setup(){return this.value&&this.value.isNode?this.value:A()}serialize(e){super.serialize(e),this.value!==null?this.inputType==="ArrayBuffer"?e.value=Gm(this.value):e.value=this.value?this.value.toJSON(e.meta).uuid:null:e.value=null,e.inputType=this.inputType,e.outputType=this.outputType}deserialize(e){super.deserialize(e);let t=null;e.value!==null&&(e.inputType==="ArrayBuffer"?t=Hm(e.value):e.inputType==="Texture"?t=e.meta.textures[e.value]:t=e.meta.nodes[e.value]||null),this.value=t,this.inputType=e.inputType,this.outputType=e.outputType}}const Uu=K(dw);class pw extends Map{get(e,t=null,...n){if(this.has(e))return super.get(e);if(t!==null){const i=t(...n);return this.set(e,i),i}}}class $D{constructor(e){this.scriptableNode=e}get parameters(){return this.scriptableNode.parameters}get layout(){return this.scriptableNode.getLayout()}getInputLayout(e){return this.scriptableNode.getInputLayout(e)}get(e){const t=this.parameters[e];return t?t.getValue():null}}const Fu=new pw;class fw extends Ye{static get type(){return"ScriptableNode"}constructor(e=null,t={}){super(),this.codeNode=e,this.parameters=t,this._local=new pw,this._output=Uu(),this._outputs={},this._source=this.source,this._method=null,this._object=null,this._value=null,this._needsOutputUpdate=!0,this.onRefresh=this.onRefresh.bind(this),this.isScriptableNode=!0}get source(){return this.codeNode?this.codeNode.code:""}setLocal(e,t){return this._local.set(e,t)}getLocal(e){return this._local.get(e)}onRefresh(){this._refresh()}getInputLayout(e){for(const t of this.getLayout())if(t.inputType&&(t.id===e||t.name===e))return t}getOutputLayout(e){for(const t of this.getLayout())if(t.outputType&&(t.id===e||t.name===e))return t}setOutput(e,t){const n=this._outputs;return n[e]===void 0?n[e]=Uu(t):n[e].value=t,this}getOutput(e){return this._outputs[e]}getParameter(e){return this.parameters[e]}setParameter(e,t){const n=this.parameters;return t&&t.isScriptableNode?(this.deleteParameter(e),n[e]=t,n[e].getDefaultOutput().events.addEventListener("refresh",this.onRefresh)):t&&t.isScriptableValueNode?(this.deleteParameter(e),n[e]=t,n[e].events.addEventListener("refresh",this.onRefresh)):n[e]===void 0?(n[e]=Uu(t),n[e].events.addEventListener("refresh",this.onRefresh)):n[e].value=t,this}getValue(){return this.getDefaultOutput().getValue()}deleteParameter(e){let t=this.parameters[e];return t&&(t.isScriptableNode&&(t=t.getDefaultOutput()),t.events.removeEventListener("refresh",this.onRefresh)),this}clearParameters(){for(const e of Object.keys(this.parameters))this.deleteParameter(e);return this.needsUpdate=!0,this}call(e,...t){const i=this.getObject()[e];if(typeof i=="function")return i(...t)}async callAsync(e,...t){const i=this.getObject()[e];if(typeof i=="function")return i.constructor.name==="AsyncFunction"?await i(...t):i(...t)}getNodeType(e){return this.getDefaultOutputNode().getNodeType(e)}refresh(e=null){e!==null?this.getOutput(e).refresh():this._refresh()}getObject(){if(this.needsUpdate&&this.dispose(),this._object!==null)return this._object;const e=()=>this.refresh(),t=(l,u)=>this.setOutput(l,u),n=new $D(this),i=Fu.get("THREE"),r=Fu.get("TSL"),o=this.getMethod(this.codeNode),a=[n,this._local,Fu,e,t,i,r];this._object=o(...a);const c=this._object.layout;if(c&&(c.cache===!1&&this._local.clear(),this._output.outputType=c.outputType||null,Array.isArray(c.elements)))for(const l of c.elements){const u=l.id||l.name;l.inputType&&(this.getParameter(u)===void 0&&this.setParameter(u,null),this.getParameter(u).inputType=l.inputType),l.outputType&&(this.getOutput(u)===void 0&&this.setOutput(u,null),this.getOutput(u).outputType=l.outputType)}return this._object}deserialize(e){super.deserialize(e);for(const t in this.parameters){let n=this.parameters[t];n.isScriptableNode&&(n=n.getDefaultOutput()),n.events.addEventListener("refresh",this.onRefresh)}}getLayout(){return this.getObject().layout}getDefaultOutputNode(){const e=this.getDefaultOutput().value;return e&&e.isNode?e:A()}getDefaultOutput(){return this._exec()._output}getMethod(){if(this.needsUpdate&&this.dispose(),this._method!==null)return this._method;const e=["parameters","local","global","refresh","setOutput","THREE","TSL"],n=["layout","init","main","dispose"].join(", "),i="var "+n+`; var output = {};
|
|
3872
3872
|
`,r=`
|
|
3873
3873
|
return { ...output, `+n+" };",o=i+this.codeNode.code+r;return this._method=new Function(...e,o),this._method}dispose(){this._method!==null&&(this._object&&typeof this._object.dispose=="function"&&this._object.dispose(),this._method=null,this._object=null,this._source=null,this._value=null,this._needsOutputUpdate=!0,this._output.value=null,this._outputs={})}setup(){return this.getDefaultOutputNode()}getCacheKey(e){const t=[Bv(this.source),this.getDefaultOutputNode().getCacheKey(e)];for(const n in this.parameters)t.push(this.parameters[n].getCacheKey(e));return zv(t)}set needsUpdate(e){e===!0&&this.dispose()}get needsUpdate(){return this.source!==this._source}_exec(){return this.codeNode===null?this:(this._needsOutputUpdate===!0&&(this._value=this.call("main"),this._needsOutputUpdate=!1),this._output.value=this._value,this)}_refresh(){this.needsUpdate=!0,this._exec(),this._output.refresh()}}const YD=K(fw);class Fd extends Ye{static get type(){return"FogNode"}constructor(e,t){super("float"),this.isFogNode=!0,this.colorNode=e,this.factorNode=t}getViewZNode(e){let t;const n=e.context.getViewZ;return n!==void 0&&(t=n(this)),(t||Pn.z).negate()}setup(){return this.factorNode}}const ZD=K(Fd);class mw extends Fd{static get type(){return"FogRangeNode"}constructor(e,t,n){super(e),this.isFogRangeNode=!0,this.nearNode=t,this.farNode=n}setup(e){const t=this.getViewZNode(e);return ti(this.nearNode,this.farNode,t)}}const JD=K(mw);class gw extends Fd{static get type(){return"FogExp2Node"}constructor(e,t){super(e),this.isFogExp2Node=!0,this.densityNode=t}setup(e){const t=this.getViewZNode(e),n=this.densityNode;return n.mul(n,t,t).negate().exp().oneMinus()}}const KD=K(gw);let Pr=null,Lr=null;class xw extends Ye{static get type(){return"RangeNode"}constructor(e=A(),t=A()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=e.getTypeLength(Is(this.minNode.value)),n=e.getTypeLength(Is(this.maxNode.value));return t>n?t:n}getNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}setup(e){const t=e.object;let n=null;if(t.count>1){const i=this.minNode.value,r=this.maxNode.value,o=e.getTypeLength(Is(i)),a=e.getTypeLength(Is(r));Pr=Pr||new st,Lr=Lr||new st,Pr.setScalar(0),Lr.setScalar(0),o===1?Pr.setScalar(i):i.isColor?Pr.set(i.r,i.g,i.b):Pr.set(i.x,i.y,i.z||0,i.w||0),a===1?Lr.setScalar(r):r.isColor?Lr.set(r.r,r.g,r.b):Lr.set(r.x,r.y,r.z||0,r.w||0);const c=4,l=c*t.count,u=new Float32Array(l);for(let d=0;d<l;d++){const p=d%c,f=Pr.getComponent(p),x=Lr.getComponent(p);u[d]=Bh.lerp(f,x,Math.random())}const h=this.getNodeType(e);if(t.count<=4096)n=fl(u,"vec4",t.count).element(yl).convert(h);else{const d=new Us(u,4);e.geometry.setAttribute("__range"+this.id,d),n=yh(d).convert(h)}}else n=A(0);return n}}const jD=K(xw),QD=U(({depthTexture:s,shadowCoord:e})=>xt(s,e.xy).compare(e.z)),eU=U(({depthTexture:s,shadowCoord:e,shadow:t})=>{const n=(x,m)=>xt(s,x).compare(m),i=dn("mapSize","vec2",t).setGroup(_t),r=dn("radius","float",t).setGroup(_t),o=z(1).div(i),a=o.x.negate().mul(r),c=o.y.negate().mul(r),l=o.x.mul(r),u=o.y.mul(r),h=a.div(2),d=c.div(2),p=l.div(2),f=u.div(2);return Wt(n(e.xy.add(z(a,c)),e.z),n(e.xy.add(z(0,c)),e.z),n(e.xy.add(z(l,c)),e.z),n(e.xy.add(z(h,d)),e.z),n(e.xy.add(z(0,d)),e.z),n(e.xy.add(z(p,d)),e.z),n(e.xy.add(z(a,0)),e.z),n(e.xy.add(z(h,0)),e.z),n(e.xy,e.z),n(e.xy.add(z(p,0)),e.z),n(e.xy.add(z(l,0)),e.z),n(e.xy.add(z(h,f)),e.z),n(e.xy.add(z(0,f)),e.z),n(e.xy.add(z(p,f)),e.z),n(e.xy.add(z(a,u)),e.z),n(e.xy.add(z(0,u)),e.z),n(e.xy.add(z(l,u)),e.z)).mul(1/17)}),tU=U(({depthTexture:s,shadowCoord:e,shadow:t})=>{const n=(u,h)=>xt(s,u).compare(h),i=dn("mapSize","vec2",t).setGroup(_t),r=z(1).div(i),o=r.x,a=r.y,c=e.xy,l=mr(c.mul(i).add(.5));return c.subAssign(l.mul(r)),Wt(n(c,e.z),n(c.add(z(o,0)),e.z),n(c.add(z(0,a)),e.z),n(c.add(r),e.z),it(n(c.add(z(o.negate(),0)),e.z),n(c.add(z(o.mul(2),0)),e.z),l.x),it(n(c.add(z(o.negate(),a)),e.z),n(c.add(z(o.mul(2),a)),e.z),l.x),it(n(c.add(z(0,a.negate())),e.z),n(c.add(z(0,a.mul(2))),e.z),l.y),it(n(c.add(z(o,a.negate())),e.z),n(c.add(z(o,a.mul(2))),e.z),l.y),it(it(n(c.add(z(o.negate(),a.negate())),e.z),n(c.add(z(o.mul(2),a.negate())),e.z),l.x),it(n(c.add(z(o.negate(),a.mul(2))),e.z),n(c.add(z(o.mul(2),a.mul(2))),e.z),l.x),l.y)).mul(1/9)}),nU=U(({depthTexture:s,shadowCoord:e})=>{const t=A(1).toVar(),n=xt(s).uv(e.xy).rg,i=ll(e.z,n.x);return Oe(i.notEqual(A(1)),()=>{const r=e.z.sub(n.x),o=ft(0,n.y.mul(n.y));let a=o.div(o.add(r.mul(r)));a=cn(Ft(a,.3).div(.95-.3)),t.assign(cn(ft(i,a)))}),t}),iU=U(({samples:s,radius:e,size:t,shadowPass:n})=>{const i=A(0).toVar(),r=A(0).toVar(),o=s.lessThanEqual(A(1)).select(A(0),A(2).div(s.sub(1))),a=s.lessThanEqual(A(1)).select(A(0),A(-1));mt({start:L(0),end:L(s),type:"int",condition:"<"},({i:l})=>{const u=a.add(A(l).mul(o)),h=n.uv(Wt(wa.xy,z(0,u).mul(e)).div(t)).x;i.addAssign(h),r.addAssign(h.mul(h))}),i.divAssign(s),r.divAssign(s);const c=os(r.sub(i.mul(i)));return z(i,c)}),sU=U(({samples:s,radius:e,size:t,shadowPass:n})=>{const i=A(0).toVar(),r=A(0).toVar(),o=s.lessThanEqual(A(1)).select(A(0),A(2).div(s.sub(1))),a=s.lessThanEqual(A(1)).select(A(0),A(-1));mt({start:L(0),end:L(s),type:"int",condition:"<"},({i:l})=>{const u=a.add(A(l).mul(o)),h=n.uv(Wt(wa.xy,z(u,0).mul(e)).div(t));i.addAssign(h.x),r.addAssign(Wt(h.y.mul(h.y),h.x.mul(h.x)))}),i.divAssign(s),r.divAssign(s);const c=os(r.sub(i.mul(i)));return z(i,c)}),rU=[QD,eU,tU,nU];let Oo=null;const wu=new ys;class xr extends ho{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.updateType=We.FRAME,this.light=e,this.color=new _e,this.colorNode=pe(this.color).setGroup(_t),this.baseColorNode=null,this.shadowMap=null,this.shadowNode=null,this.shadowColorNode=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this.isAnalyticLightNode=!0}getCacheKey(){return Bm(super.getCacheKey(),this.light.id,this.light.castShadow?1:0)}getHash(){return this.light.uuid}setupShadow(e){const{object:t,renderer:n}=e;if(n.shadowMap.enabled===!1)return;let i=this.shadowColorNode;if(i===null){Oo===null&&(Oo=new Tt,Oo.fragmentNode=oe(0,0,0,1),Oo.isShadowNodeMaterial=!0,Oo.name="ShadowMaterial");const r=n.shadowMap.type,o=this.light.shadow,a=new oo;a.compareFunction=Kf;const c=e.createRenderTarget(o.mapSize.width,o.mapSize.height);if(c.depthTexture=a,o.camera.updateProjectionMatrix(),r===oi){a.compareFunction=null,this.vsmShadowMapVertical=e.createRenderTarget(o.mapSize.width,o.mapSize.height,{format:ea,type:Ln}),this.vsmShadowMapHorizontal=e.createRenderTarget(o.mapSize.width,o.mapSize.height,{format:ea,type:Ln});const _=xt(a),v=xt(this.vsmShadowMapVertical.texture),I=dn("blurSamples","float",o).setGroup(_t),T=dn("radius","float",o).setGroup(_t),w=dn("mapSize","vec2",o).setGroup(_t);let C=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Tt);C.fragmentNode=iU({samples:I,radius:T,size:w,shadowPass:_}).context(e.getSharedContext()),C.name="VSMVertical",C=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Tt),C.fragmentNode=sU({samples:I,radius:T,size:w,shadowPass:v}).context(e.getSharedContext()),C.name="VSMHorizontal"}const l=dn("intensity","float",o).setGroup(_t),u=dn("bias","float",o).setGroup(_t),h=dn("normalBias","float",o).setGroup(_t),d=t.material.shadowPositionNode||Mh;let p=pe(o.matrix).setGroup(_t).mul(d.add(wd.mul(h)));p=p.xyz.div(p.w);let f=p.z.add(u);n.coordinateSystem===Kr&&(f=f.mul(2).sub(1)),p=D(p.x,p.y.oneMinus(),f);const x=p.x.greaterThanEqual(0).and(p.x.lessThanEqual(1)).and(p.y.greaterThanEqual(0)).and(p.y.lessThanEqual(1)).and(p.z.lessThanEqual(1)),m=o.filterNode||rU[n.shadowMap.type]||null;if(m===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const g=xt(c.texture,p),y=x.select(m({depthTexture:r===oi?this.vsmShadowMapHorizontal.texture:a,shadowCoord:p,shadow:o}),A(1));this.shadowMap=c,this.light.shadow.map=c,this.shadowNode=y,this.shadowColorNode=i=this.colorNode.mul(it(1,y.rgb.mix(g,1),l.mul(g.a))),this.baseColorNode=this.colorNode}this.colorNode=i,this.updateBeforeType=We.RENDER}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&this.disposeShadow()}updateShadow(e){const{shadowMap:t,light:n}=this,{renderer:i,scene:r,camera:o}=e,a=i.shadowMap.type,c=t.depthTexture.version;this._depthVersionCached=c;const l=r.overrideMaterial;r.overrideMaterial=Oo,t.setSize(n.shadow.mapSize.width,n.shadow.mapSize.height),n.shadow.updateMatrices(n),n.shadow.camera.layers.mask=o.layers.mask;const u=i.getRenderTarget(),h=i.getRenderObjectFunction();i.setRenderObjectFunction((d,...p)=>{(d.castShadow===!0||d.receiveShadow&&a===oi)&&i.renderObject(d,...p)}),i.setRenderTarget(t),i.render(r,n.shadow.camera),i.setRenderObjectFunction(h),n.isPointLight!==!0&&a===oi&&this.vsmPass(e,n),i.setRenderTarget(u),r.overrideMaterial=l}vsmPass(e,t){const{renderer:n}=e;this.vsmShadowMapVertical.setSize(t.shadow.mapSize.width,t.shadow.mapSize.height),this.vsmShadowMapHorizontal.setSize(t.shadow.mapSize.width,t.shadow.mapSize.height),n.setRenderTarget(this.vsmShadowMapVertical),wu.material=this.vsmMaterialVertical,wu.render(n),n.setRenderTarget(this.vsmShadowMapHorizontal),wu.material=this.vsmMaterialHorizontal,wu.render(n)}disposeShadow(){this.shadowMap.dispose(),this.shadowMap=null,this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null),this.shadowNode=null,this.shadowColorNode=null,this.baseColorNode=null,this.updateBeforeType=We.NONE}updateBefore(e){const t=this.light.shadow;(t.needsUpdate||t.autoUpdate)&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}update(){const{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}const e0=U(s=>{const{lightDistance:e,cutoffDistance:t,decayExponent:n}=s,i=e.pow(n).max(.01).reciprocal();return t.greaterThan(0).select(i.mul(e.div(t).pow4().oneMinus().clamp().pow2()),i)});let Au;function t0(s){Au=Au||new WeakMap;let e=Au.get(s);return e===void 0&&Au.set(s,e={}),e}function n0(s){const e=t0(s);return e.position||(e.position=pe(new E).setGroup(_t).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(s.matrixWorld)))}function _w(s){const e=t0(s);return e.targetPosition||(e.targetPosition=pe(new E).setGroup(_t).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(s.target.matrixWorld)))}function Od(s){const e=t0(s);return e.viewPosition||(e.viewPosition=pe(new E).setGroup(_t).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new E,n.value.setFromMatrixPosition(s.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}const i0=s=>pi.transformDirection(n0(s).sub(_w(s))),oU=U(([s])=>{const e=s.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),Cf=(s,e)=>Kn(ot(4,s.mul(Ft(1,s))),e),aU=(s,e)=>s.lessThan(.5)?Cf(s.mul(2),e).div(2):Ft(1,Cf(ot(Ft(1,s),2),e).div(2)),cU=(s,e,t)=>Kn(ts(Kn(s,e),Wt(Kn(s,e),Kn(Ft(1,s),t))),1/e),lU=(s,e)=>Cn(Qr.mul(e.mul(s).sub(1))).div(Qr.mul(e.mul(s).sub(1))),us=U(([s])=>s.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),yw=U(([s])=>D(us(s.z.add(us(s.y.mul(1)))),us(s.z.add(us(s.x.mul(1)))),us(s.y.add(us(s.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),uU=U(([s,e,t])=>{const n=D(s).toVar(),i=A(1.4).toVar(),r=A(0).toVar(),o=D(n).toVar();return mt({start:A(0),end:A(3),type:"float",condition:"<="},()=>{const a=D(yw(o.mul(2))).toVar();n.addAssign(a.add(t.mul(A(.1).mul(e)))),o.mulAssign(1.8),i.mulAssign(1.5),n.mulAssign(1.2);const c=A(us(n.z.add(us(n.x.add(us(n.y)))))).toVar();r.addAssign(c.div(i)),o.addAssign(.14)}),r}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"p",type:"vec3"},{name:"spd",type:"float"},{name:"time",type:"float"}]}),hU=U(([s,e,t=z(.5)])=>Gg(s.sub(t),e).add(t)),dU=U(([s,e,t=z(.5)])=>{const n=s.sub(t),i=n.dot(n),o=i.mul(i).mul(e);return s.add(n.mul(o))}),pU=U(({position:s=null,horizontal:e=!0,vertical:t=!1})=>{let n;s!==null?(n=Ui.toVar(),n[3][0]=s.x,n[3][1]=s.y,n[3][2]=s.z):n=Ui;const i=pi.mul(n);return Oc(e)&&(i[0][0]=Ui[0].length(),i[0][1]=0,i[0][2]=0),Oc(t)&&(i[1][0]=0,i[1][1]=Ui[1].length(),i[1][2]=0),i[2][0]=0,i[2][1]=0,i[2][2]=1,ci.mul(i).mul(en)}),fU=U(([s=null])=>{const e=Th();return Th(Ug(s)).sub(e).lessThan(0).select(gr,s)}),O_=new WeakMap;class mU extends pt{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.updateType=We.OBJECT,this.updateAfterType=We.OBJECT,this.previousModelWorldMatrix=pe(new Fe),this.previousProjectionMatrix=pe(new Fe).setGroup(_t),this.previousCameraViewMatrix=pe(new Fe)}update({frameId:e,camera:t,object:n}){const i=V_(n);this.previousModelWorldMatrix.value.copy(i);const r=vw(t);r.frameId!==e&&(r.frameId=e,r.previousProjectionMatrix===void 0?(r.previousProjectionMatrix=new Fe,r.previousCameraViewMatrix=new Fe,r.currentProjectionMatrix=new Fe,r.currentCameraViewMatrix=new Fe,r.previousProjectionMatrix.copy(t.projectionMatrix),r.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(r.previousProjectionMatrix.copy(r.currentProjectionMatrix),r.previousCameraViewMatrix.copy(r.currentCameraViewMatrix)),r.currentProjectionMatrix.copy(t.projectionMatrix),r.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(r.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(r.previousCameraViewMatrix))}updateAfter({object:e}){V_(e).copy(e.matrixWorld)}setup(){const e=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),t=ci.mul(xs).mul(en),n=this.previousProjectionMatrix.mul(e).mul(vh),i=t.xy.div(t.w),r=n.xy.div(n.w);return Ft(i,r)}}function vw(s){let e=O_.get(s);return e===void 0&&(e={},O_.set(s,e)),e}function V_(s,e=0){const t=vw(s);let n=t[e];return n===void 0&&(t[e]=n=new Fe),n}const gU=fe(mU),xU=U(([s,e])=>Mn(1,s.oneMinus().div(e)).oneMinus()).setLayout({name:"burnBlend",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),_U=U(([s,e])=>Mn(s.div(e.oneMinus()),1)).setLayout({name:"dodgeBlend",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),yU=U(([s,e])=>s.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"screenBlend",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),vU=U(([s,e])=>it(s.mul(2).mul(e),s.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),ll(.5,s))).setLayout({name:"overlayBlend",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),MU=U(([s,e,t=L(16)])=>{const n=a=>s.uv(a),i=rt(),r=n(i).toVar(),o=A(t);return mt({start:L(1),end:t,type:"int",condition:"<="},({i:a})=>{const c=e.mul(A(a).div(o.sub(1)).sub(.5));r.addAssign(n(i.add(c)))}),r.divAssign(o),r}),SU=U(([s,e=1])=>{const t=s,n=En(t.rgb),i=D(n),r=Mn(1,ft(0,A(10).mul(n.sub(.45)))),o=i.mul(t.rgb).mul(2),a=A(2).mul(i.oneMinus()).mul(t.rgb.oneMinus()).oneMinus(),c=it(o,a,r),l=t.a.mul(e),u=l.mul(c.rgb);return u.addAssign(t.rgb.mul(l.oneMinus())),oe(u,t.a)}),TU=U(([s])=>{const e=D(s);return oe($t(e,D(.393,.769,.189)),$t(e,D(.349,.686,.168)),$t(e,D(.272,.534,.131)),s.a)}),Mw=U(([s])=>{const e=s.mul(.9478672986).add(.0521327014).pow(2.4),t=s.mul(.0773993808),n=s.lessThanEqual(.04045);return it(e,t,n)}).setLayout({name:"sRGBToLinearSRGB",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Sw=U(([s])=>{const e=s.pow(.41666).mul(1.055).sub(.055),t=s.mul(12.92),n=s.lessThanEqual(.0031308);return it(e,t,n)}).setLayout({name:"linearSRGBTosRGB",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Tw=U(([s,e])=>s.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),bw=U(([s,e])=>(s=s.mul(e),s.div(s.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),ww=U(([s,e])=>{s=s.mul(e),s=s.sub(.004).max(0);const t=s.mul(s.mul(6.2).add(.5)),n=s.mul(s.mul(6.2).add(1.7)).add(.06);return t.div(n).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),bU=U(([s])=>{const e=s.mul(s.add(.0245786)).sub(90537e-9),t=s.mul(s.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),Aw=U(([s,e])=>{const t=Tn(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=Tn(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return s=s.mul(e).div(.6),s=t.mul(s),s=bU(s),s=n.mul(s),s.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),wU=Tn(D(1.6605,-.1246,-.0182),D(-.5876,1.1329,-.1006),D(-.0728,-.0083,1.1187)),AU=Tn(D(.6274,.0691,.0164),D(.3293,.9195,.088),D(.0433,.0113,.8956)),NU=U(([s])=>{const e=D(s).toVar(),t=D(e.mul(e)).toVar(),n=D(t.mul(t)).toVar();return A(15.5).mul(n.mul(t)).sub(ot(40.14,n.mul(e))).add(ot(31.96,n).sub(ot(6.868,t.mul(e))).add(ot(.4298,t).add(ot(.1191,e).sub(.00232))))}),Nw=U(([s,e])=>{const t=D(s).toVar(),n=Tn(D(.856627153315983,.137318972929847,.11189821299995),D(.0951212405381588,.761241990602591,.0767994186031903),D(.0482516061458583,.101439036467562,.811302368396859)),i=Tn(D(1.1271005818144368,-.1413297634984383,-.14132976349843826),D(-.11060664309660323,1.157823702216272,-.11060664309660294),D(-.016493938717834573,-.016493938717834257,1.2519364065950405)),r=A(-12.47393),o=A(4.026069);return t.mulAssign(e),t.assign(AU.mul(t)),t.assign(n.mul(t)),t.assign(ft(t,1e-10)),t.assign(al(t)),t.assign(t.sub(r).div(o.sub(r))),t.assign(cn(t,0,1)),t.assign(NU(t)),t.assign(i.mul(t)),t.assign(Kn(ft(D(0),t),D(2.2))),t.assign(wU.mul(t)),t.assign(cn(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Ew=U(([s,e])=>{const t=A(.76),n=A(.15);s=s.mul(e);const i=Mn(s.r,Mn(s.g,s.b)),r=In(i.lessThan(.08),i.sub(ot(6.25,i.mul(i))),.04);s.subAssign(r);const o=ft(s.r,ft(s.g,s.b));Oe(o.lessThan(t),()=>s);const a=Ft(1,t),c=Ft(1,a.mul(a).div(o.add(a.sub(t))));s.mulAssign(c.div(o));const l=Ft(1,ts(1,n.mul(o.sub(c)).add(1)));return it(s,D(c),l)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class EU extends Ye{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}getNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){e.hasBuiltin(this._builtinName)}generate(e,t){const n=this.getBuiltinName(e),i=this.getNodeType(e);return e.shaderStage==="compute"?e.format(n,i,t):(console.warn(`ComputeBuiltinNode: Compute built-in value ${n} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(i))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}}const Vd=(s,e)=>H(new EU(s,e)),CU=Vd("numWorkgroups","uvec3"),RU=Vd("workgroupId","uvec3"),IU=Vd("localId","uvec3"),PU=Vd("subgroupSize","uint");class LU extends Ye{constructor(e){super(),this.scope=e}generate(e){const{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier
|
|
3874
|
-
`):e.addLineFlowCode(`${t}Barrier()`,this)}}const s0=K(LU),DU=()=>s0("workgroup").append(),UU=()=>s0("storage").append(),FU=()=>s0("texture").append();class OU extends pr{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n;const i=e.context.assign;if(n=super.generate(e),i!==!0){const r=this.getNodeType(e);n=e.format(n,r,t)}return n}}class VU extends Ye{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.scope=e}label(e){return this.name=e,this}getHash(){return this.uuid}setScope(e){return this.scope=e,this}getInputType(){return`${this.scope}Array`}element(e){return H(new OU(this,e))}generate(e){return e.getScopedArray(this.name||`${this.scope}Array_${this.id}`,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}const BU=(s,e)=>H(new VU("Workgroup",s,e));class wn extends pt{static get type(){return"AtomicFunctionNode"}constructor(e,t,n,i=null){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.storeNode=i}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){const t=this.method,n=this.getNodeType(e),i=this.getInputType(e),r=this.pointerNode,o=this.valueNode,a=[];a.push(`&${r.build(e,i)}`),a.push(o.build(e,i));const c=`${e.getMethod(t,n)}( ${a.join(", ")} )`;if(this.storeNode!==null){const l=this.storeNode.build(e,i);e.addLineFlowCode(`${l} = ${c}`,this)}else e.addLineFlowCode(c,this)}}wn.ATOMIC_LOAD="atomicLoad";wn.ATOMIC_STORE="atomicStore";wn.ATOMIC_ADD="atomicAdd";wn.ATOMIC_SUB="atomicSub";wn.ATOMIC_MAX="atomicMax";wn.ATOMIC_MIN="atomicMin";wn.ATOMIC_AND="atomicAnd";wn.ATOMIC_OR="atomicOr";wn.ATOMIC_XOR="atomicXor";const zU=K(wn),Os=(s,e,t,n)=>{const i=zU(s,e,t,n);return i.append(),i},kU=(s,e,t=null)=>Os(wn.ATOMIC_STORE,s,e,t),GU=(s,e,t=null)=>Os(wn.ATOMIC_ADD,s,e,t),HU=(s,e,t=null)=>Os(wn.ATOMIC_SUB,s,e,t),WU=(s,e,t=null)=>Os(wn.ATOMIC_MAX,s,e,t),XU=(s,e,t=null)=>Os(wn.ATOMIC_MIN,s,e,t),qU=(s,e,t=null)=>Os(wn.ATOMIC_AND,s,e,t),$U=(s,e,t=null)=>Os(wn.ATOMIC_OR,s,e,t),YU=(s,e,t=null)=>Os(wn.ATOMIC_XOR,s,e,t),ZU=U(([s=rt()])=>{const e=s.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),cc=U(([s,e,t])=>{const n=A(t).toVar(),i=A(e).toVar(),r=cr(s).toVar();return In(r,i,n)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),wh=U(([s,e])=>{const t=cr(e).toVar(),n=A(s).toVar();return In(t,n.negate(),n)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),rn=U(([s])=>{const e=A(s).toVar();return L(fr(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Ht=U(([s,e])=>{const t=A(s).toVar();return e.assign(rn(t)),t.sub(A(e))}),JU=U(([s,e,t,n,i,r])=>{const o=A(r).toVar(),a=A(i).toVar(),c=A(n).toVar(),l=A(t).toVar(),u=A(e).toVar(),h=A(s).toVar(),d=A(Ft(1,a)).toVar();return Ft(1,o).mul(h.mul(d).add(u.mul(a))).add(o.mul(l.mul(d).add(c.mul(a))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),KU=U(([s,e,t,n,i,r])=>{const o=A(r).toVar(),a=A(i).toVar(),c=D(n).toVar(),l=D(t).toVar(),u=D(e).toVar(),h=D(s).toVar(),d=A(Ft(1,a)).toVar();return Ft(1,o).mul(h.mul(d).add(u.mul(a))).add(o.mul(l.mul(d).add(c.mul(a))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),Cw=On([JU,KU]),jU=U(([s,e,t,n,i,r,o,a,c,l,u])=>{const h=A(u).toVar(),d=A(l).toVar(),p=A(c).toVar(),f=A(a).toVar(),x=A(o).toVar(),m=A(r).toVar(),g=A(i).toVar(),y=A(n).toVar(),_=A(t).toVar(),v=A(e).toVar(),I=A(s).toVar(),T=A(Ft(1,p)).toVar(),w=A(Ft(1,d)).toVar();return A(Ft(1,h)).toVar().mul(w.mul(I.mul(T).add(v.mul(p))).add(d.mul(_.mul(T).add(y.mul(p))))).add(h.mul(w.mul(g.mul(T).add(m.mul(p))).add(d.mul(x.mul(T).add(f.mul(p))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),QU=U(([s,e,t,n,i,r,o,a,c,l,u])=>{const h=A(u).toVar(),d=A(l).toVar(),p=A(c).toVar(),f=D(a).toVar(),x=D(o).toVar(),m=D(r).toVar(),g=D(i).toVar(),y=D(n).toVar(),_=D(t).toVar(),v=D(e).toVar(),I=D(s).toVar(),T=A(Ft(1,p)).toVar(),w=A(Ft(1,d)).toVar();return A(Ft(1,h)).toVar().mul(w.mul(I.mul(T).add(v.mul(p))).add(d.mul(_.mul(T).add(y.mul(p))))).add(h.mul(w.mul(g.mul(T).add(m.mul(p))).add(d.mul(x.mul(T).add(f.mul(p))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),Rw=On([jU,QU]),eF=U(([s,e,t])=>{const n=A(t).toVar(),i=A(e).toVar(),r=ve(s).toVar(),o=ve(r.bitAnd(ve(7))).toVar(),a=A(cc(o.lessThan(ve(4)),i,n)).toVar(),c=A(ot(2,cc(o.lessThan(ve(4)),n,i))).toVar();return wh(a,cr(o.bitAnd(ve(1)))).add(wh(c,cr(o.bitAnd(ve(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),tF=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=A(e).toVar(),a=ve(s).toVar(),c=ve(a.bitAnd(ve(15))).toVar(),l=A(cc(c.lessThan(ve(8)),o,r)).toVar(),u=A(cc(c.lessThan(ve(4)),r,cc(c.equal(ve(12)).or(c.equal(ve(14))),o,i))).toVar();return wh(l,cr(c.bitAnd(ve(1)))).add(wh(u,cr(c.bitAnd(ve(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),yn=On([eF,tF]),nF=U(([s,e,t])=>{const n=A(t).toVar(),i=A(e).toVar(),r=ba(s).toVar();return D(yn(r.x,i,n),yn(r.y,i,n),yn(r.z,i,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),iF=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=A(e).toVar(),a=ba(s).toVar();return D(yn(a.x,o,r,i),yn(a.y,o,r,i),yn(a.z,o,r,i))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Ri=On([nF,iF]),sF=U(([s])=>{const e=A(s).toVar();return ot(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),rF=U(([s])=>{const e=A(s).toVar();return ot(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),oF=U(([s])=>{const e=D(s).toVar();return ot(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Iw=On([sF,oF]),aF=U(([s])=>{const e=D(s).toVar();return ot(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Pw=On([rF,aF]),yi=U(([s,e])=>{const t=L(e).toVar(),n=ve(s).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(L(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),Lw=U(([s,e,t])=>{s.subAssign(t),s.bitXorAssign(yi(t,L(4))),t.addAssign(e),e.subAssign(s),e.bitXorAssign(yi(s,L(6))),s.addAssign(t),t.subAssign(e),t.bitXorAssign(yi(e,L(8))),e.addAssign(s),s.subAssign(t),s.bitXorAssign(yi(t,L(16))),t.addAssign(e),e.subAssign(s),e.bitXorAssign(yi(s,L(19))),s.addAssign(t),t.subAssign(e),t.bitXorAssign(yi(e,L(4))),e.addAssign(s)}),Sl=U(([s,e,t])=>{const n=ve(t).toVar(),i=ve(e).toVar(),r=ve(s).toVar();return n.bitXorAssign(i),n.subAssign(yi(i,L(14))),r.bitXorAssign(n),r.subAssign(yi(n,L(11))),i.bitXorAssign(r),i.subAssign(yi(r,L(25))),n.bitXorAssign(i),n.subAssign(yi(i,L(16))),r.bitXorAssign(n),r.subAssign(yi(n,L(4))),i.bitXorAssign(r),i.subAssign(yi(r,L(14))),n.bitXorAssign(i),n.subAssign(yi(i,L(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),Wn=U(([s])=>{const e=ve(s).toVar();return A(e).div(A(ve(L(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),ps=U(([s])=>{const e=A(s).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),cF=U(([s])=>{const e=L(s).toVar(),t=ve(ve(1)).toVar(),n=ve(ve(L(3735928559)).add(t.shiftLeft(ve(2))).add(ve(13))).toVar();return Sl(n.add(ve(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),lF=U(([s,e])=>{const t=L(e).toVar(),n=L(s).toVar(),i=ve(ve(2)).toVar(),r=ve().toVar(),o=ve().toVar(),a=ve().toVar();return r.assign(o.assign(a.assign(ve(L(3735928559)).add(i.shiftLeft(ve(2))).add(ve(13))))),r.addAssign(ve(n)),o.addAssign(ve(t)),Sl(r,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),uF=U(([s,e,t])=>{const n=L(t).toVar(),i=L(e).toVar(),r=L(s).toVar(),o=ve(ve(3)).toVar(),a=ve().toVar(),c=ve().toVar(),l=ve().toVar();return a.assign(c.assign(l.assign(ve(L(3735928559)).add(o.shiftLeft(ve(2))).add(ve(13))))),a.addAssign(ve(r)),c.addAssign(ve(i)),l.addAssign(ve(n)),Sl(a,c,l)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),hF=U(([s,e,t,n])=>{const i=L(n).toVar(),r=L(t).toVar(),o=L(e).toVar(),a=L(s).toVar(),c=ve(ve(4)).toVar(),l=ve().toVar(),u=ve().toVar(),h=ve().toVar();return l.assign(u.assign(h.assign(ve(L(3735928559)).add(c.shiftLeft(ve(2))).add(ve(13))))),l.addAssign(ve(a)),u.addAssign(ve(o)),h.addAssign(ve(r)),Lw(l,u,h),l.addAssign(ve(i)),Sl(l,u,h)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),dF=U(([s,e,t,n,i])=>{const r=L(i).toVar(),o=L(n).toVar(),a=L(t).toVar(),c=L(e).toVar(),l=L(s).toVar(),u=ve(ve(5)).toVar(),h=ve().toVar(),d=ve().toVar(),p=ve().toVar();return h.assign(d.assign(p.assign(ve(L(3735928559)).add(u.shiftLeft(ve(2))).add(ve(13))))),h.addAssign(ve(l)),d.addAssign(ve(c)),p.addAssign(ve(a)),Lw(h,d,p),h.addAssign(ve(o)),d.addAssign(ve(r)),Sl(h,d,p)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),Pt=On([cF,lF,uF,hF,dF]),pF=U(([s,e])=>{const t=L(e).toVar(),n=L(s).toVar(),i=ve(Pt(n,t)).toVar(),r=ba().toVar();return r.x.assign(i.bitAnd(L(255))),r.y.assign(i.shiftRight(L(8)).bitAnd(L(255))),r.z.assign(i.shiftRight(L(16)).bitAnd(L(255))),r}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),fF=U(([s,e,t])=>{const n=L(t).toVar(),i=L(e).toVar(),r=L(s).toVar(),o=ve(Pt(r,i,n)).toVar(),a=ba().toVar();return a.x.assign(o.bitAnd(L(255))),a.y.assign(o.shiftRight(L(8)).bitAnd(L(255))),a.z.assign(o.shiftRight(L(16)).bitAnd(L(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),Ii=On([pF,fF]),mF=U(([s])=>{const e=z(s).toVar(),t=L().toVar(),n=L().toVar(),i=A(Ht(e.x,t)).toVar(),r=A(Ht(e.y,n)).toVar(),o=A(ps(i)).toVar(),a=A(ps(r)).toVar(),c=A(Cw(yn(Pt(t,n),i,r),yn(Pt(t.add(L(1)),n),i.sub(1),r),yn(Pt(t,n.add(L(1))),i,r.sub(1)),yn(Pt(t.add(L(1)),n.add(L(1))),i.sub(1),r.sub(1)),o,a)).toVar();return Iw(c)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),gF=U(([s])=>{const e=D(s).toVar(),t=L().toVar(),n=L().toVar(),i=L().toVar(),r=A(Ht(e.x,t)).toVar(),o=A(Ht(e.y,n)).toVar(),a=A(Ht(e.z,i)).toVar(),c=A(ps(r)).toVar(),l=A(ps(o)).toVar(),u=A(ps(a)).toVar(),h=A(Rw(yn(Pt(t,n,i),r,o,a),yn(Pt(t.add(L(1)),n,i),r.sub(1),o,a),yn(Pt(t,n.add(L(1)),i),r,o.sub(1),a),yn(Pt(t.add(L(1)),n.add(L(1)),i),r.sub(1),o.sub(1),a),yn(Pt(t,n,i.add(L(1))),r,o,a.sub(1)),yn(Pt(t.add(L(1)),n,i.add(L(1))),r.sub(1),o,a.sub(1)),yn(Pt(t,n.add(L(1)),i.add(L(1))),r,o.sub(1),a.sub(1)),yn(Pt(t.add(L(1)),n.add(L(1)),i.add(L(1))),r.sub(1),o.sub(1),a.sub(1)),c,l,u)).toVar();return Pw(h)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),r0=On([mF,gF]),xF=U(([s])=>{const e=z(s).toVar(),t=L().toVar(),n=L().toVar(),i=A(Ht(e.x,t)).toVar(),r=A(Ht(e.y,n)).toVar(),o=A(ps(i)).toVar(),a=A(ps(r)).toVar(),c=D(Cw(Ri(Ii(t,n),i,r),Ri(Ii(t.add(L(1)),n),i.sub(1),r),Ri(Ii(t,n.add(L(1))),i,r.sub(1)),Ri(Ii(t.add(L(1)),n.add(L(1))),i.sub(1),r.sub(1)),o,a)).toVar();return Iw(c)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),_F=U(([s])=>{const e=D(s).toVar(),t=L().toVar(),n=L().toVar(),i=L().toVar(),r=A(Ht(e.x,t)).toVar(),o=A(Ht(e.y,n)).toVar(),a=A(Ht(e.z,i)).toVar(),c=A(ps(r)).toVar(),l=A(ps(o)).toVar(),u=A(ps(a)).toVar(),h=D(Rw(Ri(Ii(t,n,i),r,o,a),Ri(Ii(t.add(L(1)),n,i),r.sub(1),o,a),Ri(Ii(t,n.add(L(1)),i),r,o.sub(1),a),Ri(Ii(t.add(L(1)),n.add(L(1)),i),r.sub(1),o.sub(1),a),Ri(Ii(t,n,i.add(L(1))),r,o,a.sub(1)),Ri(Ii(t.add(L(1)),n,i.add(L(1))),r.sub(1),o,a.sub(1)),Ri(Ii(t,n.add(L(1)),i.add(L(1))),r,o.sub(1),a.sub(1)),Ri(Ii(t.add(L(1)),n.add(L(1)),i.add(L(1))),r.sub(1),o.sub(1),a.sub(1)),c,l,u)).toVar();return Pw(h)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),o0=On([xF,_F]),yF=U(([s])=>{const e=A(s).toVar(),t=L(rn(e)).toVar();return Wn(Pt(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),vF=U(([s])=>{const e=z(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar();return Wn(Pt(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),MF=U(([s])=>{const e=D(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar(),i=L(rn(e.z)).toVar();return Wn(Pt(t,n,i))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),SF=U(([s])=>{const e=oe(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar(),i=L(rn(e.z)).toVar(),r=L(rn(e.w)).toVar();return Wn(Pt(t,n,i,r))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),TF=On([yF,vF,MF,SF]),bF=U(([s])=>{const e=A(s).toVar(),t=L(rn(e)).toVar();return D(Wn(Pt(t,L(0))),Wn(Pt(t,L(1))),Wn(Pt(t,L(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),wF=U(([s])=>{const e=z(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar();return D(Wn(Pt(t,n,L(0))),Wn(Pt(t,n,L(1))),Wn(Pt(t,n,L(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),AF=U(([s])=>{const e=D(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar(),i=L(rn(e.z)).toVar();return D(Wn(Pt(t,n,i,L(0))),Wn(Pt(t,n,i,L(1))),Wn(Pt(t,n,i,L(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),NF=U(([s])=>{const e=oe(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar(),i=L(rn(e.z)).toVar(),r=L(rn(e.w)).toVar();return D(Wn(Pt(t,n,i,r,L(0))),Wn(Pt(t,n,i,r,L(1))),Wn(Pt(t,n,i,r,L(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),Dw=On([bF,wF,AF,NF]),Ah=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=L(e).toVar(),a=D(s).toVar(),c=A(0).toVar(),l=A(1).toVar();return mt(o,()=>{c.addAssign(l.mul(r0(a))),l.mulAssign(i),a.mulAssign(r)}),c}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Uw=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=L(e).toVar(),a=D(s).toVar(),c=D(0).toVar(),l=A(1).toVar();return mt(o,()=>{c.addAssign(l.mul(o0(a))),l.mulAssign(i),a.mulAssign(r)}),c}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),EF=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=L(e).toVar(),a=D(s).toVar();return z(Ah(a,o,r,i),Ah(a.add(D(L(19),L(193),L(17))),o,r,i))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),CF=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=L(e).toVar(),a=D(s).toVar(),c=D(Uw(a,o,r,i)).toVar(),l=A(Ah(a.add(D(L(19),L(193),L(17))),o,r,i)).toVar();return oe(c,l)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),RF=U(([s,e,t,n,i,r,o])=>{const a=L(o).toVar(),c=A(r).toVar(),l=L(i).toVar(),u=L(n).toVar(),h=L(t).toVar(),d=L(e).toVar(),p=z(s).toVar(),f=D(Dw(z(d.add(u),h.add(l)))).toVar(),x=z(f.x,f.y).toVar();x.subAssign(.5),x.mulAssign(c),x.addAssign(.5);const m=z(z(A(d),A(h)).add(x)).toVar(),g=z(m.sub(p)).toVar();return Oe(a.equal(L(2)),()=>Dt(g.x).add(Dt(g.y))),Oe(a.equal(L(3)),()=>ft(Dt(g.x),Dt(g.y))),$t(g,g)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),IF=U(([s,e,t,n,i,r,o,a,c])=>{const l=L(c).toVar(),u=A(a).toVar(),h=L(o).toVar(),d=L(r).toVar(),p=L(i).toVar(),f=L(n).toVar(),x=L(t).toVar(),m=L(e).toVar(),g=D(s).toVar(),y=D(Dw(D(m.add(p),x.add(d),f.add(h)))).toVar();y.subAssign(.5),y.mulAssign(u),y.addAssign(.5);const _=D(D(A(m),A(x),A(f)).add(y)).toVar(),v=D(_.sub(g)).toVar();return Oe(l.equal(L(2)),()=>Dt(v.x).add(Dt(v.y)).add(Dt(v.z))),Oe(l.equal(L(3)),()=>ft(ft(Dt(v.x),Dt(v.y)),Dt(v.z))),$t(v,v)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Na=On([RF,IF]),PF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=z(s).toVar(),o=L().toVar(),a=L().toVar(),c=z(Ht(r.x,o),Ht(r.y,a)).toVar(),l=A(1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:u})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:h})=>{const d=A(Na(c,u,h,o,a,i,n)).toVar();l.assign(Mn(l,d))})}),Oe(n.equal(L(0)),()=>{l.assign(os(l))}),l}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),LF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=z(s).toVar(),o=L().toVar(),a=L().toVar(),c=z(Ht(r.x,o),Ht(r.y,a)).toVar(),l=z(1e6,1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:u})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:h})=>{const d=A(Na(c,u,h,o,a,i,n)).toVar();Oe(d.lessThan(l.x),()=>{l.y.assign(l.x),l.x.assign(d)}).ElseIf(d.lessThan(l.y),()=>{l.y.assign(d)})})}),Oe(n.equal(L(0)),()=>{l.assign(os(l))}),l}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),DF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=z(s).toVar(),o=L().toVar(),a=L().toVar(),c=z(Ht(r.x,o),Ht(r.y,a)).toVar(),l=D(1e6,1e6,1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:u})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:h})=>{const d=A(Na(c,u,h,o,a,i,n)).toVar();Oe(d.lessThan(l.x),()=>{l.z.assign(l.y),l.y.assign(l.x),l.x.assign(d)}).ElseIf(d.lessThan(l.y),()=>{l.z.assign(l.y),l.y.assign(d)}).ElseIf(d.lessThan(l.z),()=>{l.z.assign(d)})})}),Oe(n.equal(L(0)),()=>{l.assign(os(l))}),l}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),UF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=D(s).toVar(),o=L().toVar(),a=L().toVar(),c=L().toVar(),l=D(Ht(r.x,o),Ht(r.y,a),Ht(r.z,c)).toVar(),u=A(1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:h})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:d})=>{mt({start:-1,end:L(1),name:"z",condition:"<="},({z:p})=>{const f=A(Na(l,h,d,p,o,a,c,i,n)).toVar();u.assign(Mn(u,f))})})}),Oe(n.equal(L(0)),()=>{u.assign(os(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),FF=On([PF,UF]),OF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=D(s).toVar(),o=L().toVar(),a=L().toVar(),c=L().toVar(),l=D(Ht(r.x,o),Ht(r.y,a),Ht(r.z,c)).toVar(),u=z(1e6,1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:h})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:d})=>{mt({start:-1,end:L(1),name:"z",condition:"<="},({z:p})=>{const f=A(Na(l,h,d,p,o,a,c,i,n)).toVar();Oe(f.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(f)}).ElseIf(f.lessThan(u.y),()=>{u.y.assign(f)})})})}),Oe(n.equal(L(0)),()=>{u.assign(os(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),VF=On([LF,OF]),BF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=D(s).toVar(),o=L().toVar(),a=L().toVar(),c=L().toVar(),l=D(Ht(r.x,o),Ht(r.y,a),Ht(r.z,c)).toVar(),u=D(1e6,1e6,1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:h})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:d})=>{mt({start:-1,end:L(1),name:"z",condition:"<="},({z:p})=>{const f=A(Na(l,h,d,p,o,a,c,i,n)).toVar();Oe(f.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(f)}).ElseIf(f.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(f)}).ElseIf(f.lessThan(u.z),()=>{u.z.assign(f)})})})}),Oe(n.equal(L(0)),()=>{u.assign(os(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),zF=On([DF,BF]),kF=U(([s])=>{const e=s.y,t=s.z,n=D().toVar();return Oe(e.lessThan(1e-4),()=>{n.assign(D(t,t,t))}).Else(()=>{let i=s.x;i=i.sub(fr(i)).mul(6).toVar();const r=L(pg(i)),o=i.sub(A(r)),a=t.mul(e.oneMinus()),c=t.mul(e.mul(o).oneMinus()),l=t.mul(e.mul(o.oneMinus()).oneMinus());Oe(r.equal(L(0)),()=>{n.assign(D(t,l,a))}).ElseIf(r.equal(L(1)),()=>{n.assign(D(c,t,a))}).ElseIf(r.equal(L(2)),()=>{n.assign(D(a,t,l))}).ElseIf(r.equal(L(3)),()=>{n.assign(D(a,c,t))}).ElseIf(r.equal(L(4)),()=>{n.assign(D(l,a,t))}).Else(()=>{n.assign(D(t,a,c))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),GF=U(([s])=>{const e=D(s).toVar(),t=A(e.x).toVar(),n=A(e.y).toVar(),i=A(e.z).toVar(),r=A(Mn(t,Mn(n,i))).toVar(),o=A(ft(t,ft(n,i))).toVar(),a=A(o.sub(r)).toVar(),c=A().toVar(),l=A().toVar(),u=A().toVar();return u.assign(o),Oe(o.greaterThan(0),()=>{l.assign(a.div(o))}).Else(()=>{l.assign(0)}),Oe(l.lessThanEqual(0),()=>{c.assign(0)}).Else(()=>{Oe(t.greaterThanEqual(o),()=>{c.assign(n.sub(i).div(a))}).ElseIf(n.greaterThanEqual(o),()=>{c.assign(Wt(2,i.sub(t).div(a)))}).Else(()=>{c.assign(Wt(4,t.sub(n).div(a)))}),c.mulAssign(1/6),Oe(c.lessThan(0),()=>{c.addAssign(1)})}),D(c,l,u)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),HF=U(([s])=>{const e=D(s).toVar(),t=Km(cg(e,D(.04045))).toVar(),n=D(e.div(12.92)).toVar(),i=D(Kn(ft(e.add(D(.055)),D(0)).div(1.055),D(2.4))).toVar();return it(n,i,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Fw=(s,e)=>{s=A(s),e=A(e);const t=z(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return ti(s.sub(t),s.add(t),e)},Ow=(s,e,t,n)=>it(s,e,t[n].clamp()),WF=(s,e,t=rt())=>Ow(s,e,t,"x"),XF=(s,e,t=rt())=>Ow(s,e,t,"y"),Vw=(s,e,t,n,i)=>it(s,e,Fw(t,n[i])),qF=(s,e,t,n=rt())=>Vw(s,e,t,n,"x"),$F=(s,e,t,n=rt())=>Vw(s,e,t,n,"y"),YF=(s=1,e=0,t=rt())=>t.mul(s).add(e),ZF=(s,e=1)=>(s=A(s),s.abs().pow(e).mul(s.sign())),JF=(s,e=1,t=.5)=>A(s).sub(t).mul(e).add(t),KF=(s=rt(),e=1,t=0)=>r0(s.convert("vec2|vec3")).mul(e).add(t),jF=(s=rt(),e=1,t=0)=>o0(s.convert("vec2|vec3")).mul(e).add(t),QF=(s=rt(),e=1,t=0)=>(s=s.convert("vec2|vec3"),oe(o0(s),r0(s.add(z(19,73)))).mul(e).add(t)),eO=(s=rt(),e=1)=>FF(s.convert("vec2|vec3"),e,L(1)),tO=(s=rt(),e=1)=>VF(s.convert("vec2|vec3"),e,L(1)),nO=(s=rt(),e=1)=>zF(s.convert("vec2|vec3"),e,L(1)),iO=(s=rt())=>TF(s.convert("vec2|vec3")),sO=(s=rt(),e=3,t=2,n=.5,i=1)=>Ah(s,L(e),t,n).mul(i),rO=(s=rt(),e=3,t=2,n=.5,i=1)=>EF(s,L(e),t,n).mul(i),oO=(s=rt(),e=3,t=2,n=.5,i=1)=>Uw(s,L(e),t,n).mul(i),aO=(s=rt(),e=3,t=2,n=.5,i=1)=>CF(s,L(e),t,n).mul(i),Bw=U(([s,e])=>{const t=s.x,n=s.y,i=s.z;let r=e.element(0).mul(.886227);return r=r.add(e.element(1).mul(2*.511664).mul(n)),r=r.add(e.element(2).mul(2*.511664).mul(i)),r=r.add(e.element(3).mul(2*.511664).mul(t)),r=r.add(e.element(4).mul(2*.429043).mul(t).mul(n)),r=r.add(e.element(5).mul(2*.429043).mul(n).mul(i)),r=r.add(e.element(6).mul(i.mul(i).mul(.743125).sub(.247708))),r=r.add(e.element(7).mul(2*.429043).mul(t).mul(i)),r=r.add(e.element(8).mul(.429043).mul(ot(t,t).sub(ot(n,n)))),r});class zw extends xr{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=pe(0).setGroup(_t),this.decayExponentNode=pe(0).setGroup(_t)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setup(e){const{colorNode:t,cutoffDistanceNode:n,decayExponentNode:i,light:r}=this,o=e.context.lightingModel,a=Od(r).sub(Pn),c=a.normalize(),l=a.length(),u=e0({lightDistance:l,cutoffDistance:n,decayExponent:i}),h=t.mul(u),d=e.context.reflectedLight;o.direct({lightDirection:c,lightColor:h,reflectedLight:d},e.stack,e)}}class kw extends xr{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setup(e){super.setup(e);const t=e.context.lightingModel,n=this.colorNode,i=i0(this.light),r=e.context.reflectedLight;t.direct({lightDirection:i,lightColor:n,reflectedLight:r},e.stack,e)}}const Qp=new Fe,Nu=new Fe;let $a=null;class Gw extends xr{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=pe(new E).setGroup(_t),this.halfWidth=pe(new E).setGroup(_t)}update(e){super.update(e);const{light:t}=this,n=e.camera.matrixWorldInverse;Nu.identity(),Qp.copy(t.matrixWorld),Qp.premultiply(n),Nu.extractRotation(Qp),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(Nu),this.halfHeight.value.applyMatrix4(Nu)}setup(e){super.setup(e);let t,n;e.isAvailable("float32Filterable")?(t=xt($a.LTC_FLOAT_1),n=xt($a.LTC_FLOAT_2)):(t=xt($a.LTC_HALF_1),n=xt($a.LTC_HALF_2));const{colorNode:i,light:r}=this,o=e.context.lightingModel,a=Od(r),c=e.context.reflectedLight;o.directRectArea({lightColor:i,lightPosition:a,halfWidth:this.halfWidth,halfHeight:this.halfHeight,reflectedLight:c,ltc_1:t,ltc_2:n},e.stack,e)}static setLTC(e){$a=e}}class a0 extends xr{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=pe(0).setGroup(_t),this.penumbraCosNode=pe(0).setGroup(_t),this.cutoffDistanceNode=pe(0).setGroup(_t),this.decayExponentNode=pe(0).setGroup(_t)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e){const{coneCosNode:t,penumbraCosNode:n}=this;return ti(t,n,e)}setup(e){super.setup(e);const t=e.context.lightingModel,{colorNode:n,cutoffDistanceNode:i,decayExponentNode:r,light:o}=this,a=Od(o).sub(Pn),c=a.normalize(),l=c.dot(i0(o)),u=this.getSpotAttenuation(l),h=a.length(),d=e0({lightDistance:h,cutoffDistance:i,decayExponent:r}),p=n.mul(u).mul(d),f=e.context.reflectedLight;t.direct({lightDirection:c,lightColor:p,reflectedLight:f},e.stack,e)}}class Hw extends a0{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e){const t=this.light.iesMap;let n=null;if(t&&t.isTexture===!0){const i=e.acos().mul(1/Math.PI);n=xt(t,z(i,0),0).r}else n=super.getSpotAttenuation(e);return n}}class Ww extends xr{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class Xw extends xr{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=n0(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=pe(new _e).setGroup(_t)}update(e){const{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){const{colorNode:t,groundColorNode:n,lightDirectionNode:i}=this,o=di.dot(i).mul(.5).add(.5),a=it(n,t,o);e.context.irradiance.addAssign(a)}}class qw extends xr{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let n=0;n<9;n++)t.push(new E);this.lightProbe=ds(t)}update(e){const{light:t}=this;super.update(e);for(let n=0;n<9;n++)this.lightProbe.array[n].copy(t.sh.coefficients[n]).multiplyScalar(t.intensity)}setup(e){const t=Bw(wd,this.lightProbe);e.context.irradiance.addAssign(t)}}class cO{parseFunction(){console.warn("Abstract function.")}}class $w{constructor(e,t,n="",i=""){this.type=e,this.inputs=t,this.name=n,this.precision=i}getCode(){console.warn("Abstract function.")}}$w.isNodeFunction=!0;const lO=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,uO=/[a-z_0-9]+/ig,B_="#pragma main",hO=s=>{s=s.trim();const e=s.indexOf(B_),t=e!==-1?s.slice(e+B_.length):s,n=t.match(lO);if(n!==null&&n.length===5){const i=n[4],r=[];let o=null;for(;(o=uO.exec(i))!==null;)r.push(o);const a=[];let c=0;for(;c<r.length;){const f=r[c][0]==="const";f===!0&&c++;let x=r[c][0];x==="in"||x==="out"||x==="inout"?c++:x="";const m=r[c++][0];let g=Number.parseInt(r[c][0]);Number.isNaN(g)===!1?c++:g=null;const y=r[c++][0];a.push(new Zg(m,y,g,x,f))}const l=t.substring(n[0].length),u=n[3]!==void 0?n[3]:"",h=n[2],d=n[1]!==void 0?n[1]:"",p=e!==-1?s.slice(0,e):"";return{type:h,inputs:a,name:u,precision:d,inputsCode:i,blockCode:l,headerCode:p}}else throw new Error("FunctionNode: Function is not a GLSL code.")};class dO extends $w{constructor(e){const{type:t,inputs:n,name:i,precision:r,inputsCode:o,blockCode:a,headerCode:c}=hO(e);super(t,n,i,r),this.inputsCode=o,this.blockCode=a,this.headerCode=c}getCode(e=this.name){let t;const n=this.blockCode;if(n!==""){const{type:i,inputsCode:r,headerCode:o,precision:a}=this;let c=`${i} ${e} ( ${r.trim()} )`;a!==""&&(c=`${a} ${c}`),t=o+c+n}else t="";return t}}class Yw extends cO{parseFunction(e){return new dO(e)}}class pO{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map,this.colorSpaceNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null;const n=this.getMaterialNodeClass(e.type);if(n!==null){t=new n;for(const i in e)t[i]=e[i]}return t}addColorSpace(e,t){this.addType(e,t,this.colorSpaceNodes)}getColorSpaceFunction(e){return this.colorSpaceNodes.get(e)||null}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t.name,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,n){if(n.has(t)){console.warn(`Redefinition of node ${t}`);return}if(typeof e!="function")throw new Error(`Node class ${e.name} is not a class.`);if(typeof t=="function"||typeof t=="object")throw new Error(`Base class ${t} is not a class.`);n.set(t,e)}addClass(e,t,n){if(n.has(t)){console.warn(`Redefinition of node ${t.name}`);return}if(typeof e!="function")throw new Error(`Node class ${e.name} is not a class.`);if(typeof t!="function")throw new Error(`Base class ${t.name} is not a class.`);n.set(t,e)}}class fO extends il{constructor(e,t,n,i,r,o){super(e,t,n,i,r,o),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}}class Zw extends pO{constructor(){super(),this.addLight(zw,md),this.addLight(kw,gd),this.addLight(Gw,Cm),this.addLight(a0,il),this.addLight(Ww,xd),this.addLight(Xw,fd),this.addLight(qw,Rm),this.addLight(Hw,fO),this.addToneMapping(Tw,Nh),this.addToneMapping(bw,Eh),this.addToneMapping(ww,Ff),this.addToneMapping(Aw,Ch),this.addToneMapping(Nw,Rh),this.addToneMapping(Ew,Ih),this.addColorSpace(Sw,_h(li,kn)),this.addColorSpace(Mw,_h(kn,li))}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ks}}));if(typeof window<"u"){try{typeof document>"u"?require("url").pathToFileURL(__filename).href:mo&&mo.tagName.toUpperCase()==="SCRIPT"&&mo.src||new URL("three-B_hneGZr.umd.cjs",document.baseURI).href,window.__THREE__IMPORTS__||(window.__THREE__IMPORTS__=[]),window.__THREE__IMPORTS__.push({url:typeof document>"u"?require("url").pathToFileURL(__filename).href:mo&&mo.tagName.toUpperCase()==="SCRIPT"&&mo.src||new URL("three-B_hneGZr.umd.cjs",document.baseURI).href,revision:Ks})}catch{}window.__THREE__?(console.warn("WARNING: Multiple instances of Three.js being imported. Existing: "+window.__THREE__+", new: "+Ks),console.warn(window.__THREE__IMPORTS__)):window.__THREE__=Ks}const mO=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Ch,AONode:FT,AddEquation:Zs,AddOperation:Uf,AdditiveAnimationBlendMode:$f,AdditiveBlending:lc,AfterImageNode:Xb,AgXToneMapping:Rh,AlphaFormat:zf,AlwaysCompare:Py,AlwaysDepth:hc,AlwaysStencilFunc:sh,AmbientLight:xd,AmbientLightNode:Ww,AnaglyphPassNode:lw,AnalyticLightNode:xr,AnamorphicNode:$b,AnimationAction:Sv,AnimationClip:aa,AnimationLoader:UI,AnimationMixer:Tv,AnimationObjectGroup:eP,AnimationUtils:II,ArcCurve:Qy,ArrayCamera:sm,ArrayElementNode:pr,ArrowHelper:fP,AssignNode:rM,AttachedBindMode:sf,AttributeNode:bg,Audio:Dm,AudioAnalyser:WI,AudioContext:_d,AudioListener:yv,AudioLoader:_v,AxesHelper:Uv,BRDF_GGX:Tf,BRDF_Lambert:eo,BackSide:ln,BasicDepthPacking:Yf,BasicEnvironmentNode:Id,BasicNodeLibrary:Zw,BasicShadowMap:tA,BatchNode:ET,BatchedMesh:um,BloomNode:iw,Bone:Yh,BooleanKeyframeTrack:co,Box2:oP,Box3:Hn,Box3Helper:Dv,BoxGeometry:_s,BoxHelper:Lv,Break:Rd,BufferAttribute:At,BufferAttributeNode:pS,BufferGeometry:at,BufferGeometryLoader:mv,BufferNode:Nd,BumpMapNode:ZS,BypassNode:_S,ByteType:Of,Cache:Rs,CacheNode:xS,Camera:Yc,CameraHelper:Pv,CanvasTexture:jy,CapsuleGeometry:Jh,CatmullRomCurve3:ev,CineonToneMapping:Ff,CircleGeometry:Kh,ClampToEdgeWrapping:Si,Clock:Lm,CodeNode:Xg,Color:_e,ColorKeyframeTrack:dd,ColorManagement:gt,ColorSpaceNode:hl,CompressedArrayTexture:Jy,CompressedCubeTexture:Ky,CompressedTexture:Kc,CompressedTextureLoader:FI,ComputeNode:mS,ConeGeometry:jh,ConstNode:Hi,ConstantAlphaFactor:sy,ConstantColorFactor:ny,ContextNode:_g,Continue:bL,Controls:Ov,ConvertNode:Xm,CubeCamera:Gh,CubeReflectionMapping:wi,CubeRefractionMapping:Vi,CubeTexture:io,CubeTextureLoader:OI,CubeTextureNode:kS,CubeUVReflectionMapping:to,CubicBezierCurve:mm,CubicBezierCurve3:tv,CubicInterpolant:lv,CullFaceBack:ef,CullFaceFront:H_,CullFaceFrontBack:eA,CullFaceNone:G_,Curve:Gi,CurvePath:iv,CustomBlending:Pf,CustomToneMapping:oy,CylinderGeometry:ao,Cylindrical:rP,DFGApprox:kg,D_GGX:QT,Data3DTexture:zh,DataArrayTexture:qc,DataTexture:Oi,DataTextureLoader:dv,DataUtils:Oy,DecrementStencilOp:gy,DecrementWrapStencilOp:_y,DefaultLoadingManager:Nm,DenoiseNode:tw,DepthFormat:Qs,DepthOfFieldNode:Zb,DepthStencilFormat:ar,DepthTexture:oo,DetachedBindMode:ay,DirectionalLight:gd,DirectionalLightHelper:Iv,DirectionalLightNode:kw,Discard:TS,DiscreteInterpolant:uv,DisplayP3ColorSpace:Xc,DodecahedronGeometry:Qh,DotScreenNode:Jb,DoubleSide:Zi,DstAlphaFactor:K_,DstColorFactor:Q_,DynamicCopyUsage:pA,DynamicDrawUsage:zr,DynamicReadUsage:uA,EPSILON:wM,EdgesGeometry:vm,EllipseCurve:Zh,EnvironmentNode:ub,EqualCompare:Ey,EqualDepth:pc,EqualStencilFunc:Sy,EquirectUVNode:$T,EquirectangularReflectionMapping:ir,EquirectangularRefractionMapping:sr,Euler:ui,EventDispatcher:Ai,ExpressionNode:SS,ExtrudeGeometry:Qc,FXAANode:nw,F_Schlick:ha,FileLoader:es,FilmNode:jb,Float16BufferAttribute:Vy,Float32BufferAttribute:Ve,FloatType:Gn,Fn:U,Fog:rm,FogExp2:qh,FogExp2Node:gw,FogNode:Fd,FogRangeNode:mw,FramebufferTexture:pm,FrontFacingNode:PS,FrontSide:fs,Frustum:ma,FunctionCallNode:aM,FunctionNode:qg,FunctionOverloadingNode:Eb,GLBufferAttribute:sP,GLSL1:mA,GLSL3:rh,GLSLNodeParser:Yw,GTAONode:ew,GaussianBlurNode:Wb,GreaterCompare:Cy,GreaterDepth:mc,GreaterEqualCompare:Iy,GreaterEqualDepth:fc,GreaterEqualStencilFunc:Ay,GreaterStencilFunc:by,GridHelper:Rv,Group:kr,HalfFloatType:Ln,HemisphereLight:fd,HemisphereLightHelper:hP,HemisphereLightNode:Xw,IESSpotLightNode:Hw,INFINITY:BP,IcosahedronGeometry:td,If:Oe,ImageBitmapLoader:xv,ImageLoader:Dc,ImageUtils:Uy,IncrementStencilOp:my,IncrementWrapStencilOp:xy,IndexNode:zt,InstanceNode:AT,InstancedBufferAttribute:Us,InstancedBufferGeometry:Im,InstancedInterleavedBuffer:Om,InstancedMesh:lm,InstancedPointsNodeMaterial:BL,Int16BufferAttribute:QA,Int32BufferAttribute:e1,Int8BufferAttribute:JA,IntType:pa,InterleavedBuffer:xa,InterleavedBufferAttribute:Ds,Interpolant:Ma,InterpolateDiscrete:ta,InterpolateLinear:bc,InterpolateSmooth:Eu,InvertStencilOp:yy,IrradianceNode:BT,JoinNode:kv,KeepStencilOp:$s,KeyframeTrack:rs,LOD:am,LatheGeometry:jc,Layers:$c,LessCompare:Kf,LessDepth:dc,LessEqualCompare:jf,LessEqualDepth:nr,LessEqualStencilFunc:Ty,LessStencilFunc:My,Light:dr,LightProbe:Rm,LightProbeNode:qw,LightingContextNode:OT,LightingModel:Ml,LightingNode:ho,LightsNode:DT,Line:Fs,Line2NodeMaterial:XL,Line3:Ev,LineBasicMaterial:Fn,LineBasicNodeMaterial:kL,LineCurve:gm,LineCurve3:nv,LineDashedMaterial:hd,LineDashedNodeMaterial:HL,LineLoop:hm,LineSegments:ss,LinearDisplayP3ColorSpace:fa,LinearFilter:Ut,LinearInterpolant:Am,LinearMipMapLinearFilter:cy,LinearMipMapNearestFilter:sA,LinearMipmapLinearFilter:Jn,LinearMipmapNearestFilter:js,LinearSRGBColorSpace:li,LinearToneMapping:Nh,LinearTransfer:Ac,Loader:Xn,LoaderUtils:uh,LoadingManager:pd,Loop:mt,LoopNode:IT,LoopOnce:Xf,LoopPingPong:ly,LoopRepeat:qf,LuminanceAlphaFormat:Hf,LuminanceFormat:Gf,Lut3DNode:Qb,MOUSE:z_,MRTNode:Nb,MatcapUVNode:pb,Material:mn,MaterialLoader:sl,MaterialNode:j,MaterialReferenceNode:GS,MathUtils:Bh,Matrix2:Vm,Matrix3:Ke,Matrix4:Fe,MaxEquation:Lf,MaxMipLevelNode:NS,Mesh:kt,MeshBasicMaterial:is,MeshBasicNodeMaterial:e2,MeshDepthMaterial:Xh,MeshDistanceMaterial:im,MeshLambertMaterial:ud,MeshLambertNodeMaterial:r2,MeshMatcapMaterial:bm,MeshMatcapNodeMaterial:H2,MeshNormalMaterial:ld,MeshNormalNodeMaterial:YL,MeshPhongMaterial:cd,MeshPhongNodeMaterial:a2,MeshPhysicalMaterial:ad,MeshPhysicalNodeMaterial:db,MeshSSSNodeMaterial:O2,MeshStandardMaterial:nl,MeshStandardNodeMaterial:hb,MeshToonMaterial:Tm,MeshToonNodeMaterial:k2,MinEquation:q_,MirroredRepeatWrapping:jo,MixOperation:Df,ModelNode:ns,ModelViewProjectionNode:TT,MorphNode:PT,MultiplyBlending:nf,MultiplyOperation:da,NearestFilter:Qt,NearestMipMapLinearFilter:iA,NearestMipMapNearestFilter:nA,NearestMipmapLinearFilter:Cs,NearestMipmapNearestFilter:Lh,NeutralToneMapping:Ih,NeverCompare:Ny,NeverDepth:uc,NeverStencilFunc:vy,NoBlending:Fi,NoColorSpace:Li,NoToneMapping:Ti,Node:Ye,NodeAttribute:Ef,NodeBuilder:wb,NodeCache:Lu,NodeCode:Sb,NodeFrame:Ab,NodeFunctionInput:Zg,NodeLoader:_b,NodeMaterial:Tt,NodeMaterialLoader:yb,NodeMaterialObserver:Vv,NodeObjectLoader:Q2,NodeShaderStage:df,NodeType:_P,NodeUniform:vb,NodeUpdateType:We,NodeUtils:xP,NodeVar:Hg,NodeVarying:Mb,NormalAnimationBlendMode:Vh,NormalBlending:Ps,NormalMapNode:YS,NotEqualCompare:Ry,NotEqualDepth:gc,NotEqualStencilFunc:wy,NumberKeyframeTrack:ra,Object3D:yt,Object3DNode:wt,ObjectLoader:gv,ObjectSpaceNormalMap:Jf,OctahedronGeometry:ya,OneFactor:Y_,OneMinusConstantAlphaFactor:ry,OneMinusConstantColorFactor:iy,OneMinusDstAlphaFactor:j_,OneMinusDstColorFactor:ey,OneMinusSrcAlphaFactor:Vu,OneMinusSrcColorFactor:J_,OrthographicCamera:ro,OscNode:pn,OutputStructNode:Jg,P3Primaries:Ec,PCFShadowMap:Rf,PCFSoftShadowMap:If,PI:Qr,PI2:zP,PMREMGenerator:oh,PMREMNode:cb,ParallaxBarrierPassNode:uw,ParameterNode:Wg,PassNode:bn,Path:Rc,PerspectiveCamera:hn,PhongLightingModel:Bg,PhysicalLightingModel:Ld,PixelationPassNode:rw,Plane:cs,PlaneGeometry:so,PlaneHelper:pP,PointLight:md,PointLightHelper:lP,PointLightNode:zw,PointUVNode:Ob,Points:dm,PointsMaterial:_a,PointsNodeMaterial:X2,PolarGridHelper:dP,PolyhedronGeometry:hr,PositionalAudio:vv,PosterizeNode:kb,PropertyBinding:St,PropertyMixer:Mv,PropertyNode:Nt,QuadraticBezierCurve:xm,QuadraticBezierCurve3:_m,Quaternion:Qn,QuaternionKeyframeTrack:Sa,QuaternionLinearInterpolant:hv,RED_GREEN_RGTC2_Format:nh,RED_RGTC1_Format:Wf,REVISION:Ks,RGBADepthPacking:Zf,RGBAFormat:Rn,RGBAIntegerFormat:Oh,RGBA_ASTC_10x10_Format:Ju,RGBA_ASTC_10x5_Format:$u,RGBA_ASTC_10x6_Format:Yu,RGBA_ASTC_10x8_Format:Zu,RGBA_ASTC_12x10_Format:Ku,RGBA_ASTC_12x12_Format:ju,RGBA_ASTC_4x4_Format:Sc,RGBA_ASTC_5x4_Format:ku,RGBA_ASTC_5x5_Format:Gu,RGBA_ASTC_6x5_Format:Hu,RGBA_ASTC_6x6_Format:Tc,RGBA_ASTC_8x5_Format:Wu,RGBA_ASTC_8x6_Format:Xu,RGBA_ASTC_8x8_Format:qu,RGBA_BPTC_Format:Zo,RGBA_ETC2_EAC_Format:Mc,RGBA_PVRTC_2BPPV1_Format:zu,RGBA_PVRTC_4BPPV1_Format:_c,RGBA_S3TC_DXT1_Format:$o,RGBA_S3TC_DXT3_Format:Ka,RGBA_S3TC_DXT5_Format:Yo,RGBDepthPacking:oA,RGBFormat:kf,RGBIntegerFormat:rA,RGBShiftNode:Kb,RGB_BPTC_SIGNED_Format:Qu,RGB_BPTC_UNSIGNED_Format:eh,RGB_ETC1_Format:yc,RGB_ETC2_Format:vc,RGB_PVRTC_2BPPV1_Format:Bu,RGB_PVRTC_4BPPV1_Format:xc,RGB_S3TC_DXT1_Format:Ja,RGDepthPacking:aA,RGFormat:ea,RGIntegerFormat:Fh,RTTNode:Db,RangeNode:xw,RawShaderMaterial:Sm,Ray:no,Raycaster:Av,Rec709Primaries:Nc,RectAreaLight:Cm,RectAreaLightNode:Gw,RedFormat:Hc,RedIntegerFormat:Wc,ReferenceNode:ml,ReflectorNode:Lb,ReinhardToneMapping:Eh,RemapNode:Tg,RenderOutputNode:bS,RenderTarget:fn,RendererReferenceNode:cS,RepeatWrapping:rr,ReplaceStencilOp:fy,Return:XP,ReverseSubtractEquation:X_,RingGeometry:el,RotateNode:mb,SIGNED_RED_GREEN_RGTC2_Format:ih,SIGNED_RED_RGTC1_Format:th,SRGBColorSpace:kn,SRGBTransfer:Vt,SSAAPassNode:ow,Scene:$h,SceneNode:ji,Schlick_to_F0:tb,ScreenNode:sn,ScriptableNode:fw,ScriptableValueNode:dw,SetNode:Gv,ShaderChunk:lt,ShaderLib:Pi,ShaderMaterial:ki,ShaderNode:tc,ShadowMaterial:od,ShadowNodeMaterial:J2,Shape:er,ShapeGeometry:nd,ShapePath:Fv,ShapeUtils:Ki,ShortType:Vf,Skeleton:Jc,SkeletonHelper:cP,SkinnedMesh:cm,SkinningNode:Dg,SobelOperatorNode:Yb,Source:Js,Sphere:Dn,SphereGeometry:va,Spherical:Nv,SphericalHarmonics3:fv,SplineCurve:ym,SplitNode:hh,SpotLight:il,SpotLightHelper:aP,SpotLightNode:a0,Sprite:om,SpriteMaterial:Zc,SpriteNodeMaterial:$2,SpriteSheetUVNode:Cb,SrcAlphaFactor:Ou,SrcAlphaSaturateFactor:ty,SrcColorFactor:Z_,StackNode:bb,StaticCopyUsage:dA,StaticDrawUsage:na,StaticReadUsage:lA,StereoCamera:Pm,StereoPassNode:aw,StorageArrayElementNode:Rb,StorageBufferNode:Qg,StorageTextureNode:Vb,StreamCopyUsage:fA,StreamDrawUsage:cA,StreamReadUsage:hA,StringKeyframeTrack:lo,SubtractEquation:W_,SubtractiveBlending:tf,TBNViewMatrix:Wr,TOUCH:k_,TangentSpaceNormalMap:ms,TempNode:pt,TetrahedronGeometry:id,Texture:Xt,Texture3DNode:gb,TextureLoader:pv,TextureNode:gs,TextureSizeNode:AS,TextureUtils:FR,TimerNode:Sn,ToneMappingNode:uS,ToonOutlinePassNode:hw,TorusGeometry:tl,TorusKnotGeometry:sd,TransitionNode:sw,Triangle:Zn,TriangleFanDrawMode:dy,TriangleStripDrawMode:hy,TrianglesDrawMode:uy,TriplanarTexturesNode:Ib,TubeGeometry:rd,UVMapping:Ph,Uint16BufferAttribute:kh,Uint32BufferAttribute:em,Uint8BufferAttribute:KA,Uint8ClampedBufferAttribute:jA,Uniform:bv,UniformArrayNode:Cg,UniformGroupNode:jm,UniformNode:uo,UniformsGroup:iP,UniformsLib:Se,UniformsUtils:tm,UnsignedByteType:Qi,UnsignedInt248Type:or,UnsignedInt5999Type:Bf,UnsignedIntType:Bi,UnsignedShort4444Type:Dh,UnsignedShort5551Type:Uh,UnsignedShortType:Qo,UserDataNode:zb,VSMShadowMap:oi,V_GGX_SmithCorrelated:jT,VarNode:nS,VaryingNode:iS,Vector2:J,Vector3:E,Vector4:st,VectorKeyframeTrack:oa,VertexColorNode:Fb,VideoTexture:Zy,ViewportDepthNode:jn,ViewportDepthTextureNode:HT,ViewportSharedTextureNode:Gb,ViewportTextureNode:vl,VolumeNodeMaterial:j2,WebGL3DRenderTarget:zA,WebGLArrayRenderTarget:BA,WebGLCoordinateSystem:Di,WebGLCubeRenderTarget:Hh,WebGLMultipleRenderTargets:mP,WebGLRenderTarget:zi,WebGLRenderer:qy,WebGLUtils:Xy,WebGPUCoordinateSystem:Kr,WireframeGeometry:Mm,WrapAroundEnding:wc,ZeroCurvatureEnding:Vr,ZeroFactor:$_,ZeroSlopeEnding:Br,ZeroStencilOp:py,abs:Dt,acesFilmicToneMapping:Aw,acos:xh,add:Wt,addMethodChaining:te,addNodeElement:qP,afterImage:cD,agxToneMapping:Nw,all:lg,alphaT:ph,anaglyphPass:WD,anamorphic:fD,and:fM,anisotropy:Ys,anisotropyB:Yr,anisotropyT:nc,any:AM,ao:bD,append:$v,arrayBuffer:UP,asin:PM,assign:oM,atan:LM,atan2:GM,atomicAdd:GU,atomicAnd:qU,atomicFunc:Os,atomicMax:WU,atomicMin:XU,atomicOr:$U,atomicStore:kU,atomicSub:HU,atomicXor:YU,attenuationColor:rg,attenuationDistance:sg,attribute:vn,backgroundBlurriness:J3,backgroundIntensity:K3,batch:CT,billboarding:pU,bitAnd:_M,bitNot:yM,bitOr:vM,bitXor:MM,bitangentGeometry:dL,bitangentLocal:pL,bitangentView:WS,bitangentWorld:fL,bitcast:kP,bleach:SU,bloom:LD,blur:ab,bool:cr,buffer:fl,bufferAttribute:dl,bumpMap:JS,burn:xU,bvec2:Jv,bvec3:Km,bvec4:eM,bypass:yS,cache:sc,call:cM,cameraFar:Bo,cameraLogDepth:CS,cameraNear:Vo,cameraNormalMatrix:JP,cameraPosition:wg,cameraProjectionMatrix:ci,cameraProjectionMatrixInverse:YP,cameraViewMatrix:pi,cameraWorldMatrix:ZP,cbrt:ZM,ceil:dg,checker:ZU,cineonToneMapping:ww,clamp:cn,clearcoat:dh,clearcoatRoughness:zc,code:Dd,color:Yv,colorSpaceToWorking:Sg,colorToDirection:qL,compute:gS,cond:eS,context:yg,convert:nM,convertToTexture:ei,cos:Mi,createCanvasElement:Dy,cross:Ko,cubeTexture:Ad,dFdx:FM,dFdy:OM,dashSize:Zr,defaultBuildStages:pf,defaultShaderStages:Wm,defined:Oc,degrees:CM,denoise:ND,densityFog:KD,depth:Og,depthPass:oD,difference:XM,diffuseColor:Ct,directionToColor:qT,dispersion:og,distance:WM,div:ts,dodge:_U,dof:gD,dot:$t,dotScreen:xD,drawIndex:wT,dynamicBufferAttribute:fS,element:tM,emissive:gf,equal:lM,equals:NM,equirectUV:Vg,exp:ug,exp2:gh,expression:lr,faceDirection:pl,faceForward:KM,film:yD,float:A,floor:fr,fog:ZD,fract:mr,frameGroup:OP,frameId:U3,frontFacing:LS,fwidth:zM,fxaa:ED,gain:aU,gapSize:Gc,gaussianBlur:aD,getColorSpaceMethod:_h,getConstNodeType:qv,getCurrentStack:Jm,getDirection:rb,getDistanceAttenuation:e0,getGeometryRoughness:KT,getRoughness:zg,getShIrradianceAt:Bw,getTextureIndex:Kg,global:Fu,glsl:s3,glslFn:r3,grayscale:lD,greaterThan:cg,greaterThanEqual:pM,hash:oU,highPrecisionModelNormalViewMatrix:aL,highPrecisionModelViewMatrix:oL,hue:dD,instance:NT,instanceIndex:yl,instancedBufferAttribute:yh,instancedDynamicBufferAttribute:xf,int:L,inverseSqrt:RM,invocationLocalIndex:SL,invocationSubgroupIndex:ML,ior:ic,iridescence:Sd,iridescenceIOR:eg,iridescenceThickness:tg,ivec2:ls,ivec3:Kv,ivec4:jv,js:n3,label:tS,length:Jr,lengthSq:mg,lessThan:hM,lessThanEqual:dM,lightPosition:n0,lightTargetDirection:i0,lightTargetPosition:_w,lightViewPosition:Od,lightingContext:VT,lights:UT,linearDepth:Th,linearSRGBTosRGB:Sw,linearToneMapping:Tw,localId:IU,log:hg,log2:al,loop:wL,luminance:En,lut3D:vD,mat2:ol,mat3:Tn,mat4:$r,matcapUV:fb,materialAOMap:ST,materialAlphaTest:KS,materialAnisotropy:hT,materialAnisotropyVector:zo,materialAttenuationColor:yT,materialAttenuationDistance:_T,materialClearcoat:rT,materialClearcoatNormal:aT,materialClearcoatRoughness:oT,materialColor:la,materialDispersion:MT,materialEmissive:QS,materialIOR:xT,materialIridescence:dT,materialIridescenceIOR:pT,materialIridescenceThickness:fT,materialLightMap:Lg,materialLineDashOffset:Mf,materialLineDashSize:Ig,materialLineGapSize:Pg,materialLineScale:Sh,materialLineWidth:Pu,materialMetalness:iT,materialNormal:sT,materialOpacity:Cd,materialPointWidth:vT,materialReference:Ji,materialReflectivity:Iu,materialRefractionRatio:FS,materialRotation:cT,materialRoughness:nT,materialSheen:lT,materialSheenRoughness:uT,materialShininess:jS,materialSpecular:eT,materialSpecularColor:tT,materialSpecularIntensity:vf,materialSpecularStrength:rc,materialThickness:gT,materialTransmission:mT,max:ft,maxMipLevel:ES,metalness:Bc,min:Mn,mix:it,mixElement:jM,mod:Td,modInt:ag,modelDirection:nL,modelNormalMatrix:RS,modelPosition:iL,modelScale:sL,modelViewMatrix:xs,modelViewPosition:rL,modelViewProjection:Sf,modelWorldMatrix:Ui,modelWorldMatrixInverse:IS,morphReference:LT,motionBlur:MU,mrt:Ud,mul:ot,mx_aastep:Fw,mx_cell_noise_float:iO,mx_contrast:JF,mx_fractal_noise_float:sO,mx_fractal_noise_vec2:rO,mx_fractal_noise_vec3:oO,mx_fractal_noise_vec4:aO,mx_hsvtorgb:kF,mx_noise_float:KF,mx_noise_vec3:jF,mx_noise_vec4:QF,mx_ramplr:WF,mx_ramptb:XF,mx_rgbtohsv:GF,mx_safepower:ZF,mx_splitlr:qF,mx_splittb:$F,mx_srgb_texture_to_lin_rec709:HF,mx_transform_uv:YF,mx_worley_noise_float:eO,mx_worley_noise_vec2:tO,mx_worley_noise_vec3:nO,negate:DM,neutralToneMapping:Ew,nodeArray:qr,nodeImmutable:fe,nodeObject:H,nodeObjects:rl,nodeProxy:K,normalFlat:DS,normalGeometry:bd,normalLocal:hi,normalMap:yf,normalView:di,normalWorld:wd,normalize:vi,not:gM,notEqual:uM,numWorkgroups:CU,objectDirection:KP,objectGroup:sM,objectPosition:QP,objectScale:eL,objectViewPosition:tL,objectWorldMatrix:jP,oneMinus:UM,or:mM,orthographicDepthToViewZ:DL,oscSawtooth:B3,oscSine:F3,oscSquare:O3,oscTriangle:V3,output:ng,outputStruct:I3,overlay:vU,overloadingFn:On,parabola:Cf,parallaxBarrierPass:XD,parallaxDirection:qS,parallaxUV:gL,parameter:t3,pass:rD,passTexture:Aa,pcurve:cU,perspectiveDepthToViewZ:Fg,pixelationPass:OD,pmremTexture:lb,pointUV:Z3,pointWidth:VP,positionGeometry:Nn,positionLocal:en,positionPrevious:vh,positionView:Pn,positionViewDirection:Bt,positionWorld:Mh,positionWorldDirection:Ag,posterize:nD,pow:Kn,pow2:fg,pow3:qM,pow4:$M,property:ai,radians:EM,rand:xg,range:jD,rangeFog:JD,reciprocal:BM,reference:dn,referenceBuffer:_f,reflect:HM,reflectVector:BS,reflectView:OS,reflector:W3,refract:gg,refractVector:zS,refractView:VS,reinhardToneMapping:bw,remainder:bM,remap:vS,remapClamp:MS,renderGroup:_t,renderOutput:wS,rendererReference:lS,rgbShift:_D,rotate:Gg,rotateUV:hU,roughness:hs,round:VM,rtt:Ub,sRGBToLinearSRGB:Mw,sampler:$P,saturate:JM,saturation:uD,screen:yU,screenCoordinate:wa,screenSize:ua,screenUV:gr,scriptable:YD,scriptableValue:Uu,select:In,sepia:TU,setCurrentStack:Vc,shaderStages:ff,sharedUniformGroup:Qm,sheen:Hr,sheenRoughness:Md,shiftLeft:SM,shiftRight:TM,shininess:fh,sign:cl,sin:Cn,sinc:lU,skinning:TL,skinningReference:RT,smoothstep:ti,smoothstepElement:QM,sobel:mD,specularColor:ri,specularF90:kc,spherizeUV:dU,split:FP,spritesheetUV:z3,sqrt:os,ssaaPass:zD,stack:Du,step:ll,stereoPass:GD,storage:j3,storageBarrier:UU,storageObject:Q3,storageTexture:Bb,string:DP,sub:Ft,subgroupIndex:vL,subgroupSize:PU,tan:IM,tangentGeometry:Ed,tangentLocal:gl,tangentView:xl,tangentWorld:HS,temp:vg,texture:xt,texture3D:xb,textureBarrier:FU,textureBicubic:sb,textureCubeUV:ob,textureLoad:Ci,textureSize:tr,textureStore:eD,thickness:ig,threshold:qb,timerDelta:D3,timerGlobal:L3,timerLocal:jg,toOutputColorSpace:sS,toWorkingColorSpace:rS,toneMapping:hS,toneMappingExposure:dS,toonOutlinePass:qD,transformDirection:YM,transformNormal:US,transformNormalToView:Eg,transformedBentNormalView:$S,transformedBitangentView:XS,transformedBitangentWorld:mL,transformedClearcoatNormalView:Xo,transformedNormalView:Yt,transformedNormalWorld:Ng,transformedTangentView:Rg,transformedTangentWorld:hL,transition:DD,transmission:mh,transpose:kM,tri:us,tri3:yw,triNoise3D:uU,triplanarTexture:G3,triplanarTextures:Pb,trunc:pg,tslFn:LP,uint:ve,uniform:pe,uniformArray:ds,uniformGroup:iM,uniforms:lL,userData:tD,uv:rt,uvec2:Zv,uvec3:ba,uvec4:Qv,varying:Un,varyingProperty:Yi,vec2:z,vec3:D,vec4:oe,vectorComponents:Ta,velocity:gU,vertexColor:Y3,vertexIndex:bT,vibrance:hD,viewZToOrthographicDepth:oc,viewZToPerspectiveDepth:WT,viewport:Ls,viewportBottomLeft:PL,viewportCoordinate:kT,viewportDepthTexture:Ug,viewportLinearDepth:UL,viewportMipTexture:GT,viewportResolution:RL,viewportSafeUV:fU,viewportSharedTexture:iD,viewportSize:zT,viewportTexture:LL,viewportTopLeft:IL,viewportUV:CL,wgsl:i3,wgslFn:o3,workgroupArray:BU,workgroupBarrier:DU,workgroupId:RU,workingToColorSpace:oS,xor:xM},Symbol.toStringTag,{value:"Module"}));exports.ACESFilmicToneMapping=Ch;exports.AdditiveBlending=lc;exports.AgXToneMapping=Rh;exports.AlwaysDepth=hc;exports.AlwaysStencilFunc=sh;exports.AmbientLight=xd;exports.AnimationClip=aa;exports.AnimationMixer=Tv;exports.ArrayCamera=sm;exports.Audio=Dm;exports.AudioContext=_d;exports.AudioListener=yv;exports.AudioLoader=_v;exports.AxesHelper=Uv;exports.BackSide=ln;exports.BasicDepthPacking=Yf;exports.BasicNodeLibrary=Zw;exports.BatchedMesh=um;exports.Bone=Yh;exports.Box3=Hn;exports.Box3Helper=Dv;exports.BoxGeometry=_s;exports.BoxHelper=Lv;exports.BufferAttribute=At;exports.BufferGeometry=at;exports.Camera=Yc;exports.CameraHelper=Pv;exports.CanvasTexture=jy;exports.ClampToEdgeWrapping=Si;exports.Clock=Lm;exports.Color=_e;exports.ColorKeyframeTrack=dd;exports.ColorManagement=gt;exports.CompressedArrayTexture=Jy;exports.CompressedCubeTexture=Ky;exports.CompressedTexture=Kc;exports.Controls=Ov;exports.CubeCamera=Gh;exports.CubeTexture=io;exports.Curve=Gi;exports.CustomBlending=Pf;exports.CylinderGeometry=ao;exports.Data3DTexture=zh;exports.DataTexture=Oi;exports.DataTextureLoader=dv;exports.DataUtils=Oy;exports.DecrementStencilOp=gy;exports.DecrementWrapStencilOp=_y;exports.DefaultLoadingManager=Nm;exports.DepthFormat=Qs;exports.DepthStencilFormat=ar;exports.DepthTexture=oo;exports.DirectionalLight=gd;exports.DirectionalLightHelper=Iv;exports.DisplayP3ColorSpace=Xc;exports.DoubleSide=Zi;exports.DynamicDrawUsage=zr;exports.EdgesGeometry=vm;exports.EqualDepth=pc;exports.EqualStencilFunc=Sy;exports.EquirectangularReflectionMapping=ir;exports.EquirectangularRefractionMapping=sr;exports.Euler=ui;exports.EventDispatcher=Ai;exports.ExtrudeGeometry=Qc;exports.FileLoader=es;exports.Float32BufferAttribute=Ve;exports.FloatType=Gn;exports.Fog=rm;exports.FrontSide=fs;exports.Frustum=ma;exports.GLSL3=rh;exports.GLSLNodeParser=Yw;exports.GreaterDepth=mc;exports.GreaterEqualDepth=fc;exports.GreaterEqualStencilFunc=Ay;exports.GreaterStencilFunc=by;exports.GridHelper=Rv;exports.Group=kr;exports.HalfFloatType=Ln;exports.HemisphereLight=fd;exports.ImageBitmapLoader=xv;exports.IncrementStencilOp=my;exports.IncrementWrapStencilOp=xy;exports.InstancedBufferAttribute=Us;exports.InstancedBufferGeometry=Im;exports.InstancedInterleavedBuffer=Om;exports.InstancedMesh=lm;exports.InterleavedBuffer=xa;exports.InterleavedBufferAttribute=Ds;exports.Interpolant=Ma;exports.InterpolateDiscrete=ta;exports.InterpolateLinear=bc;exports.InvertStencilOp=yy;exports.KeepStencilOp=$s;exports.LOD=am;exports.Layers=$c;exports.LessDepth=dc;exports.LessEqualDepth=nr;exports.LessEqualStencilFunc=Ty;exports.LessStencilFunc=My;exports.Line=Fs;exports.Line3=Ev;exports.LineBasicMaterial=Fn;exports.LineLoop=hm;exports.LineSegments=ss;exports.LinearDisplayP3ColorSpace=fa;exports.LinearFilter=Ut;exports.LinearMipmapLinearFilter=Jn;exports.LinearMipmapNearestFilter=js;exports.LinearSRGBColorSpace=li;exports.LinearToneMapping=Nh;exports.Loader=Xn;exports.LoaderUtils=uh;exports.LoadingManager=pd;exports.LoopOnce=Xf;exports.LoopRepeat=qf;exports.MOUSE=z_;exports.Material=mn;exports.MathUtils=Bh;exports.Matrix3=Ke;exports.Matrix4=Fe;exports.MaxEquation=Lf;exports.Mesh=kt;exports.MeshBasicMaterial=is;exports.MeshDepthMaterial=Xh;exports.MeshLambertMaterial=ud;exports.MeshNormalMaterial=ld;exports.MeshPhongMaterial=cd;exports.MeshPhysicalMaterial=ad;exports.MeshStandardMaterial=nl;exports.MirroredRepeatWrapping=jo;exports.NearestFilter=Qt;exports.NearestMipmapLinearFilter=Cs;exports.NearestMipmapNearestFilter=Lh;exports.NeutralToneMapping=Ih;exports.NeverDepth=uc;exports.NeverStencilFunc=vy;exports.NoBlending=Fi;exports.NoColorSpace=Li;exports.NoToneMapping=Ti;exports.Node=Ye;exports.NodeBuilder=wb;exports.NodeFrame=Ab;exports.NormalBlending=Ps;exports.NotEqualDepth=gc;exports.NotEqualStencilFunc=wy;exports.NumberKeyframeTrack=ra;exports.Object3D=yt;exports.OctahedronGeometry=ya;exports.OrthographicCamera=ro;exports.PCFSoftShadowMap$1=If;exports.PMREMGenerator$1=oh;exports.PerspectiveCamera=hn;exports.Plane=cs;exports.PlaneGeometry=so;exports.PointLight=md;exports.Points=dm;exports.PointsMaterial=_a;exports.PositionalAudio=vv;exports.PropertyBinding=St;exports.Quaternion=Qn;exports.QuaternionKeyframeTrack=Sa;exports.REVISION=Ks;exports.RGBADepthPacking=Zf;exports.RGBAFormat=Rn;exports.RGBA_ASTC_4x4_Format=Sc;exports.RGBA_ASTC_6x6_Format=Tc;exports.RGBA_BPTC_Format=Zo;exports.RGBA_ETC2_EAC_Format=Mc;exports.RGBA_PVRTC_4BPPV1_Format=_c;exports.RGBA_S3TC_DXT1_Format=$o;exports.RGBA_S3TC_DXT5_Format=Yo;exports.RGB_ETC1_Format=yc;exports.RGB_ETC2_Format=vc;exports.RGB_PVRTC_4BPPV1_Format=xc;exports.RGFormat=ea;exports.RawShaderMaterial=Sm;exports.Ray=no;exports.Raycaster=Av;exports.RedFormat=Hc;exports.ReinhardToneMapping=Eh;exports.RepeatWrapping=rr;exports.ReplaceStencilOp=fy;exports.RingGeometry=el;exports.SRGBColorSpace=kn;exports.Scene=$h;exports.ShaderChunk=lt;exports.ShaderLib=Pi;exports.ShaderMaterial=ki;exports.ShadowMaterial=od;exports.Shape=er;exports.ShapePath=Fv;exports.ShapeUtils=Ki;exports.Skeleton=Jc;exports.SkinnedMesh=cm;exports.Source=Js;exports.Sphere=Dn;exports.SphereGeometry=va;exports.Spherical=Nv;exports.SpotLight=il;exports.Sprite=om;exports.SpriteMaterial=Zc;exports.THREE=mO;exports.TOUCH=k_;exports.Texture=Xt;exports.TextureLoader=pv;exports.TorusGeometry=tl;exports.Triangle=Zn;exports.TriangleFanDrawMode=dy;exports.TriangleStripDrawMode=hy;exports.TrianglesDrawMode=uy;exports.Uint16BufferAttribute=kh;exports.Uniform$1=bv;exports.UniformsLib=Se;exports.UniformsUtils=tm;exports.UnsignedByteType=Qi;exports.UnsignedInt248Type=or;exports.UnsignedIntType=Bi;exports.Vector2=J;exports.Vector3=E;exports.Vector4=st;exports.VectorKeyframeTrack=oa;exports.VideoTexture=Zy;exports.WebGLCubeRenderTarget=Hh;exports.WebGLRenderTarget=zi;exports.WebGLRenderer=qy;exports.WireframeGeometry=Mm;exports.ZeroStencilOp=py;exports.defaultShaderStages=Wm;exports.normalView=di;
|
|
3874
|
+
`):e.addLineFlowCode(`${t}Barrier()`,this)}}const s0=K(LU),DU=()=>s0("workgroup").append(),UU=()=>s0("storage").append(),FU=()=>s0("texture").append();class OU extends pr{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n;const i=e.context.assign;if(n=super.generate(e),i!==!0){const r=this.getNodeType(e);n=e.format(n,r,t)}return n}}class VU extends Ye{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.scope=e}label(e){return this.name=e,this}getHash(){return this.uuid}setScope(e){return this.scope=e,this}getInputType(){return`${this.scope}Array`}element(e){return H(new OU(this,e))}generate(e){return e.getScopedArray(this.name||`${this.scope}Array_${this.id}`,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}const BU=(s,e)=>H(new VU("Workgroup",s,e));class wn extends pt{static get type(){return"AtomicFunctionNode"}constructor(e,t,n,i=null){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.storeNode=i}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){const t=this.method,n=this.getNodeType(e),i=this.getInputType(e),r=this.pointerNode,o=this.valueNode,a=[];a.push(`&${r.build(e,i)}`),a.push(o.build(e,i));const c=`${e.getMethod(t,n)}( ${a.join(", ")} )`;if(this.storeNode!==null){const l=this.storeNode.build(e,i);e.addLineFlowCode(`${l} = ${c}`,this)}else e.addLineFlowCode(c,this)}}wn.ATOMIC_LOAD="atomicLoad";wn.ATOMIC_STORE="atomicStore";wn.ATOMIC_ADD="atomicAdd";wn.ATOMIC_SUB="atomicSub";wn.ATOMIC_MAX="atomicMax";wn.ATOMIC_MIN="atomicMin";wn.ATOMIC_AND="atomicAnd";wn.ATOMIC_OR="atomicOr";wn.ATOMIC_XOR="atomicXor";const zU=K(wn),Os=(s,e,t,n)=>{const i=zU(s,e,t,n);return i.append(),i},kU=(s,e,t=null)=>Os(wn.ATOMIC_STORE,s,e,t),GU=(s,e,t=null)=>Os(wn.ATOMIC_ADD,s,e,t),HU=(s,e,t=null)=>Os(wn.ATOMIC_SUB,s,e,t),WU=(s,e,t=null)=>Os(wn.ATOMIC_MAX,s,e,t),XU=(s,e,t=null)=>Os(wn.ATOMIC_MIN,s,e,t),qU=(s,e,t=null)=>Os(wn.ATOMIC_AND,s,e,t),$U=(s,e,t=null)=>Os(wn.ATOMIC_OR,s,e,t),YU=(s,e,t=null)=>Os(wn.ATOMIC_XOR,s,e,t),ZU=U(([s=rt()])=>{const e=s.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),cc=U(([s,e,t])=>{const n=A(t).toVar(),i=A(e).toVar(),r=cr(s).toVar();return In(r,i,n)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),wh=U(([s,e])=>{const t=cr(e).toVar(),n=A(s).toVar();return In(t,n.negate(),n)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),rn=U(([s])=>{const e=A(s).toVar();return L(fr(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Ht=U(([s,e])=>{const t=A(s).toVar();return e.assign(rn(t)),t.sub(A(e))}),JU=U(([s,e,t,n,i,r])=>{const o=A(r).toVar(),a=A(i).toVar(),c=A(n).toVar(),l=A(t).toVar(),u=A(e).toVar(),h=A(s).toVar(),d=A(Ft(1,a)).toVar();return Ft(1,o).mul(h.mul(d).add(u.mul(a))).add(o.mul(l.mul(d).add(c.mul(a))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),KU=U(([s,e,t,n,i,r])=>{const o=A(r).toVar(),a=A(i).toVar(),c=D(n).toVar(),l=D(t).toVar(),u=D(e).toVar(),h=D(s).toVar(),d=A(Ft(1,a)).toVar();return Ft(1,o).mul(h.mul(d).add(u.mul(a))).add(o.mul(l.mul(d).add(c.mul(a))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),Cw=On([JU,KU]),jU=U(([s,e,t,n,i,r,o,a,c,l,u])=>{const h=A(u).toVar(),d=A(l).toVar(),p=A(c).toVar(),f=A(a).toVar(),x=A(o).toVar(),m=A(r).toVar(),g=A(i).toVar(),y=A(n).toVar(),_=A(t).toVar(),v=A(e).toVar(),I=A(s).toVar(),T=A(Ft(1,p)).toVar(),w=A(Ft(1,d)).toVar();return A(Ft(1,h)).toVar().mul(w.mul(I.mul(T).add(v.mul(p))).add(d.mul(_.mul(T).add(y.mul(p))))).add(h.mul(w.mul(g.mul(T).add(m.mul(p))).add(d.mul(x.mul(T).add(f.mul(p))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),QU=U(([s,e,t,n,i,r,o,a,c,l,u])=>{const h=A(u).toVar(),d=A(l).toVar(),p=A(c).toVar(),f=D(a).toVar(),x=D(o).toVar(),m=D(r).toVar(),g=D(i).toVar(),y=D(n).toVar(),_=D(t).toVar(),v=D(e).toVar(),I=D(s).toVar(),T=A(Ft(1,p)).toVar(),w=A(Ft(1,d)).toVar();return A(Ft(1,h)).toVar().mul(w.mul(I.mul(T).add(v.mul(p))).add(d.mul(_.mul(T).add(y.mul(p))))).add(h.mul(w.mul(g.mul(T).add(m.mul(p))).add(d.mul(x.mul(T).add(f.mul(p))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),Rw=On([jU,QU]),eF=U(([s,e,t])=>{const n=A(t).toVar(),i=A(e).toVar(),r=ve(s).toVar(),o=ve(r.bitAnd(ve(7))).toVar(),a=A(cc(o.lessThan(ve(4)),i,n)).toVar(),c=A(ot(2,cc(o.lessThan(ve(4)),n,i))).toVar();return wh(a,cr(o.bitAnd(ve(1)))).add(wh(c,cr(o.bitAnd(ve(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),tF=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=A(e).toVar(),a=ve(s).toVar(),c=ve(a.bitAnd(ve(15))).toVar(),l=A(cc(c.lessThan(ve(8)),o,r)).toVar(),u=A(cc(c.lessThan(ve(4)),r,cc(c.equal(ve(12)).or(c.equal(ve(14))),o,i))).toVar();return wh(l,cr(c.bitAnd(ve(1)))).add(wh(u,cr(c.bitAnd(ve(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),yn=On([eF,tF]),nF=U(([s,e,t])=>{const n=A(t).toVar(),i=A(e).toVar(),r=ba(s).toVar();return D(yn(r.x,i,n),yn(r.y,i,n),yn(r.z,i,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),iF=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=A(e).toVar(),a=ba(s).toVar();return D(yn(a.x,o,r,i),yn(a.y,o,r,i),yn(a.z,o,r,i))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Ri=On([nF,iF]),sF=U(([s])=>{const e=A(s).toVar();return ot(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),rF=U(([s])=>{const e=A(s).toVar();return ot(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),oF=U(([s])=>{const e=D(s).toVar();return ot(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Iw=On([sF,oF]),aF=U(([s])=>{const e=D(s).toVar();return ot(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Pw=On([rF,aF]),yi=U(([s,e])=>{const t=L(e).toVar(),n=ve(s).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(L(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),Lw=U(([s,e,t])=>{s.subAssign(t),s.bitXorAssign(yi(t,L(4))),t.addAssign(e),e.subAssign(s),e.bitXorAssign(yi(s,L(6))),s.addAssign(t),t.subAssign(e),t.bitXorAssign(yi(e,L(8))),e.addAssign(s),s.subAssign(t),s.bitXorAssign(yi(t,L(16))),t.addAssign(e),e.subAssign(s),e.bitXorAssign(yi(s,L(19))),s.addAssign(t),t.subAssign(e),t.bitXorAssign(yi(e,L(4))),e.addAssign(s)}),Sl=U(([s,e,t])=>{const n=ve(t).toVar(),i=ve(e).toVar(),r=ve(s).toVar();return n.bitXorAssign(i),n.subAssign(yi(i,L(14))),r.bitXorAssign(n),r.subAssign(yi(n,L(11))),i.bitXorAssign(r),i.subAssign(yi(r,L(25))),n.bitXorAssign(i),n.subAssign(yi(i,L(16))),r.bitXorAssign(n),r.subAssign(yi(n,L(4))),i.bitXorAssign(r),i.subAssign(yi(r,L(14))),n.bitXorAssign(i),n.subAssign(yi(i,L(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),Wn=U(([s])=>{const e=ve(s).toVar();return A(e).div(A(ve(L(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),ps=U(([s])=>{const e=A(s).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),cF=U(([s])=>{const e=L(s).toVar(),t=ve(ve(1)).toVar(),n=ve(ve(L(3735928559)).add(t.shiftLeft(ve(2))).add(ve(13))).toVar();return Sl(n.add(ve(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),lF=U(([s,e])=>{const t=L(e).toVar(),n=L(s).toVar(),i=ve(ve(2)).toVar(),r=ve().toVar(),o=ve().toVar(),a=ve().toVar();return r.assign(o.assign(a.assign(ve(L(3735928559)).add(i.shiftLeft(ve(2))).add(ve(13))))),r.addAssign(ve(n)),o.addAssign(ve(t)),Sl(r,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),uF=U(([s,e,t])=>{const n=L(t).toVar(),i=L(e).toVar(),r=L(s).toVar(),o=ve(ve(3)).toVar(),a=ve().toVar(),c=ve().toVar(),l=ve().toVar();return a.assign(c.assign(l.assign(ve(L(3735928559)).add(o.shiftLeft(ve(2))).add(ve(13))))),a.addAssign(ve(r)),c.addAssign(ve(i)),l.addAssign(ve(n)),Sl(a,c,l)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),hF=U(([s,e,t,n])=>{const i=L(n).toVar(),r=L(t).toVar(),o=L(e).toVar(),a=L(s).toVar(),c=ve(ve(4)).toVar(),l=ve().toVar(),u=ve().toVar(),h=ve().toVar();return l.assign(u.assign(h.assign(ve(L(3735928559)).add(c.shiftLeft(ve(2))).add(ve(13))))),l.addAssign(ve(a)),u.addAssign(ve(o)),h.addAssign(ve(r)),Lw(l,u,h),l.addAssign(ve(i)),Sl(l,u,h)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),dF=U(([s,e,t,n,i])=>{const r=L(i).toVar(),o=L(n).toVar(),a=L(t).toVar(),c=L(e).toVar(),l=L(s).toVar(),u=ve(ve(5)).toVar(),h=ve().toVar(),d=ve().toVar(),p=ve().toVar();return h.assign(d.assign(p.assign(ve(L(3735928559)).add(u.shiftLeft(ve(2))).add(ve(13))))),h.addAssign(ve(l)),d.addAssign(ve(c)),p.addAssign(ve(a)),Lw(h,d,p),h.addAssign(ve(o)),d.addAssign(ve(r)),Sl(h,d,p)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),Pt=On([cF,lF,uF,hF,dF]),pF=U(([s,e])=>{const t=L(e).toVar(),n=L(s).toVar(),i=ve(Pt(n,t)).toVar(),r=ba().toVar();return r.x.assign(i.bitAnd(L(255))),r.y.assign(i.shiftRight(L(8)).bitAnd(L(255))),r.z.assign(i.shiftRight(L(16)).bitAnd(L(255))),r}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),fF=U(([s,e,t])=>{const n=L(t).toVar(),i=L(e).toVar(),r=L(s).toVar(),o=ve(Pt(r,i,n)).toVar(),a=ba().toVar();return a.x.assign(o.bitAnd(L(255))),a.y.assign(o.shiftRight(L(8)).bitAnd(L(255))),a.z.assign(o.shiftRight(L(16)).bitAnd(L(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),Ii=On([pF,fF]),mF=U(([s])=>{const e=z(s).toVar(),t=L().toVar(),n=L().toVar(),i=A(Ht(e.x,t)).toVar(),r=A(Ht(e.y,n)).toVar(),o=A(ps(i)).toVar(),a=A(ps(r)).toVar(),c=A(Cw(yn(Pt(t,n),i,r),yn(Pt(t.add(L(1)),n),i.sub(1),r),yn(Pt(t,n.add(L(1))),i,r.sub(1)),yn(Pt(t.add(L(1)),n.add(L(1))),i.sub(1),r.sub(1)),o,a)).toVar();return Iw(c)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),gF=U(([s])=>{const e=D(s).toVar(),t=L().toVar(),n=L().toVar(),i=L().toVar(),r=A(Ht(e.x,t)).toVar(),o=A(Ht(e.y,n)).toVar(),a=A(Ht(e.z,i)).toVar(),c=A(ps(r)).toVar(),l=A(ps(o)).toVar(),u=A(ps(a)).toVar(),h=A(Rw(yn(Pt(t,n,i),r,o,a),yn(Pt(t.add(L(1)),n,i),r.sub(1),o,a),yn(Pt(t,n.add(L(1)),i),r,o.sub(1),a),yn(Pt(t.add(L(1)),n.add(L(1)),i),r.sub(1),o.sub(1),a),yn(Pt(t,n,i.add(L(1))),r,o,a.sub(1)),yn(Pt(t.add(L(1)),n,i.add(L(1))),r.sub(1),o,a.sub(1)),yn(Pt(t,n.add(L(1)),i.add(L(1))),r,o.sub(1),a.sub(1)),yn(Pt(t.add(L(1)),n.add(L(1)),i.add(L(1))),r.sub(1),o.sub(1),a.sub(1)),c,l,u)).toVar();return Pw(h)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),r0=On([mF,gF]),xF=U(([s])=>{const e=z(s).toVar(),t=L().toVar(),n=L().toVar(),i=A(Ht(e.x,t)).toVar(),r=A(Ht(e.y,n)).toVar(),o=A(ps(i)).toVar(),a=A(ps(r)).toVar(),c=D(Cw(Ri(Ii(t,n),i,r),Ri(Ii(t.add(L(1)),n),i.sub(1),r),Ri(Ii(t,n.add(L(1))),i,r.sub(1)),Ri(Ii(t.add(L(1)),n.add(L(1))),i.sub(1),r.sub(1)),o,a)).toVar();return Iw(c)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),_F=U(([s])=>{const e=D(s).toVar(),t=L().toVar(),n=L().toVar(),i=L().toVar(),r=A(Ht(e.x,t)).toVar(),o=A(Ht(e.y,n)).toVar(),a=A(Ht(e.z,i)).toVar(),c=A(ps(r)).toVar(),l=A(ps(o)).toVar(),u=A(ps(a)).toVar(),h=D(Rw(Ri(Ii(t,n,i),r,o,a),Ri(Ii(t.add(L(1)),n,i),r.sub(1),o,a),Ri(Ii(t,n.add(L(1)),i),r,o.sub(1),a),Ri(Ii(t.add(L(1)),n.add(L(1)),i),r.sub(1),o.sub(1),a),Ri(Ii(t,n,i.add(L(1))),r,o,a.sub(1)),Ri(Ii(t.add(L(1)),n,i.add(L(1))),r.sub(1),o,a.sub(1)),Ri(Ii(t,n.add(L(1)),i.add(L(1))),r,o.sub(1),a.sub(1)),Ri(Ii(t.add(L(1)),n.add(L(1)),i.add(L(1))),r.sub(1),o.sub(1),a.sub(1)),c,l,u)).toVar();return Pw(h)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),o0=On([xF,_F]),yF=U(([s])=>{const e=A(s).toVar(),t=L(rn(e)).toVar();return Wn(Pt(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),vF=U(([s])=>{const e=z(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar();return Wn(Pt(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),MF=U(([s])=>{const e=D(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar(),i=L(rn(e.z)).toVar();return Wn(Pt(t,n,i))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),SF=U(([s])=>{const e=oe(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar(),i=L(rn(e.z)).toVar(),r=L(rn(e.w)).toVar();return Wn(Pt(t,n,i,r))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),TF=On([yF,vF,MF,SF]),bF=U(([s])=>{const e=A(s).toVar(),t=L(rn(e)).toVar();return D(Wn(Pt(t,L(0))),Wn(Pt(t,L(1))),Wn(Pt(t,L(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),wF=U(([s])=>{const e=z(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar();return D(Wn(Pt(t,n,L(0))),Wn(Pt(t,n,L(1))),Wn(Pt(t,n,L(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),AF=U(([s])=>{const e=D(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar(),i=L(rn(e.z)).toVar();return D(Wn(Pt(t,n,i,L(0))),Wn(Pt(t,n,i,L(1))),Wn(Pt(t,n,i,L(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),NF=U(([s])=>{const e=oe(s).toVar(),t=L(rn(e.x)).toVar(),n=L(rn(e.y)).toVar(),i=L(rn(e.z)).toVar(),r=L(rn(e.w)).toVar();return D(Wn(Pt(t,n,i,r,L(0))),Wn(Pt(t,n,i,r,L(1))),Wn(Pt(t,n,i,r,L(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),Dw=On([bF,wF,AF,NF]),Ah=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=L(e).toVar(),a=D(s).toVar(),c=A(0).toVar(),l=A(1).toVar();return mt(o,()=>{c.addAssign(l.mul(r0(a))),l.mulAssign(i),a.mulAssign(r)}),c}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Uw=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=L(e).toVar(),a=D(s).toVar(),c=D(0).toVar(),l=A(1).toVar();return mt(o,()=>{c.addAssign(l.mul(o0(a))),l.mulAssign(i),a.mulAssign(r)}),c}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),EF=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=L(e).toVar(),a=D(s).toVar();return z(Ah(a,o,r,i),Ah(a.add(D(L(19),L(193),L(17))),o,r,i))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),CF=U(([s,e,t,n])=>{const i=A(n).toVar(),r=A(t).toVar(),o=L(e).toVar(),a=D(s).toVar(),c=D(Uw(a,o,r,i)).toVar(),l=A(Ah(a.add(D(L(19),L(193),L(17))),o,r,i)).toVar();return oe(c,l)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),RF=U(([s,e,t,n,i,r,o])=>{const a=L(o).toVar(),c=A(r).toVar(),l=L(i).toVar(),u=L(n).toVar(),h=L(t).toVar(),d=L(e).toVar(),p=z(s).toVar(),f=D(Dw(z(d.add(u),h.add(l)))).toVar(),x=z(f.x,f.y).toVar();x.subAssign(.5),x.mulAssign(c),x.addAssign(.5);const m=z(z(A(d),A(h)).add(x)).toVar(),g=z(m.sub(p)).toVar();return Oe(a.equal(L(2)),()=>Dt(g.x).add(Dt(g.y))),Oe(a.equal(L(3)),()=>ft(Dt(g.x),Dt(g.y))),$t(g,g)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),IF=U(([s,e,t,n,i,r,o,a,c])=>{const l=L(c).toVar(),u=A(a).toVar(),h=L(o).toVar(),d=L(r).toVar(),p=L(i).toVar(),f=L(n).toVar(),x=L(t).toVar(),m=L(e).toVar(),g=D(s).toVar(),y=D(Dw(D(m.add(p),x.add(d),f.add(h)))).toVar();y.subAssign(.5),y.mulAssign(u),y.addAssign(.5);const _=D(D(A(m),A(x),A(f)).add(y)).toVar(),v=D(_.sub(g)).toVar();return Oe(l.equal(L(2)),()=>Dt(v.x).add(Dt(v.y)).add(Dt(v.z))),Oe(l.equal(L(3)),()=>ft(ft(Dt(v.x),Dt(v.y)),Dt(v.z))),$t(v,v)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Na=On([RF,IF]),PF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=z(s).toVar(),o=L().toVar(),a=L().toVar(),c=z(Ht(r.x,o),Ht(r.y,a)).toVar(),l=A(1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:u})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:h})=>{const d=A(Na(c,u,h,o,a,i,n)).toVar();l.assign(Mn(l,d))})}),Oe(n.equal(L(0)),()=>{l.assign(os(l))}),l}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),LF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=z(s).toVar(),o=L().toVar(),a=L().toVar(),c=z(Ht(r.x,o),Ht(r.y,a)).toVar(),l=z(1e6,1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:u})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:h})=>{const d=A(Na(c,u,h,o,a,i,n)).toVar();Oe(d.lessThan(l.x),()=>{l.y.assign(l.x),l.x.assign(d)}).ElseIf(d.lessThan(l.y),()=>{l.y.assign(d)})})}),Oe(n.equal(L(0)),()=>{l.assign(os(l))}),l}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),DF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=z(s).toVar(),o=L().toVar(),a=L().toVar(),c=z(Ht(r.x,o),Ht(r.y,a)).toVar(),l=D(1e6,1e6,1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:u})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:h})=>{const d=A(Na(c,u,h,o,a,i,n)).toVar();Oe(d.lessThan(l.x),()=>{l.z.assign(l.y),l.y.assign(l.x),l.x.assign(d)}).ElseIf(d.lessThan(l.y),()=>{l.z.assign(l.y),l.y.assign(d)}).ElseIf(d.lessThan(l.z),()=>{l.z.assign(d)})})}),Oe(n.equal(L(0)),()=>{l.assign(os(l))}),l}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),UF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=D(s).toVar(),o=L().toVar(),a=L().toVar(),c=L().toVar(),l=D(Ht(r.x,o),Ht(r.y,a),Ht(r.z,c)).toVar(),u=A(1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:h})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:d})=>{mt({start:-1,end:L(1),name:"z",condition:"<="},({z:p})=>{const f=A(Na(l,h,d,p,o,a,c,i,n)).toVar();u.assign(Mn(u,f))})})}),Oe(n.equal(L(0)),()=>{u.assign(os(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),FF=On([PF,UF]),OF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=D(s).toVar(),o=L().toVar(),a=L().toVar(),c=L().toVar(),l=D(Ht(r.x,o),Ht(r.y,a),Ht(r.z,c)).toVar(),u=z(1e6,1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:h})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:d})=>{mt({start:-1,end:L(1),name:"z",condition:"<="},({z:p})=>{const f=A(Na(l,h,d,p,o,a,c,i,n)).toVar();Oe(f.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(f)}).ElseIf(f.lessThan(u.y),()=>{u.y.assign(f)})})})}),Oe(n.equal(L(0)),()=>{u.assign(os(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),VF=On([LF,OF]),BF=U(([s,e,t])=>{const n=L(t).toVar(),i=A(e).toVar(),r=D(s).toVar(),o=L().toVar(),a=L().toVar(),c=L().toVar(),l=D(Ht(r.x,o),Ht(r.y,a),Ht(r.z,c)).toVar(),u=D(1e6,1e6,1e6).toVar();return mt({start:-1,end:L(1),name:"x",condition:"<="},({x:h})=>{mt({start:-1,end:L(1),name:"y",condition:"<="},({y:d})=>{mt({start:-1,end:L(1),name:"z",condition:"<="},({z:p})=>{const f=A(Na(l,h,d,p,o,a,c,i,n)).toVar();Oe(f.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(f)}).ElseIf(f.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(f)}).ElseIf(f.lessThan(u.z),()=>{u.z.assign(f)})})})}),Oe(n.equal(L(0)),()=>{u.assign(os(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),zF=On([DF,BF]),kF=U(([s])=>{const e=s.y,t=s.z,n=D().toVar();return Oe(e.lessThan(1e-4),()=>{n.assign(D(t,t,t))}).Else(()=>{let i=s.x;i=i.sub(fr(i)).mul(6).toVar();const r=L(pg(i)),o=i.sub(A(r)),a=t.mul(e.oneMinus()),c=t.mul(e.mul(o).oneMinus()),l=t.mul(e.mul(o.oneMinus()).oneMinus());Oe(r.equal(L(0)),()=>{n.assign(D(t,l,a))}).ElseIf(r.equal(L(1)),()=>{n.assign(D(c,t,a))}).ElseIf(r.equal(L(2)),()=>{n.assign(D(a,t,l))}).ElseIf(r.equal(L(3)),()=>{n.assign(D(a,c,t))}).ElseIf(r.equal(L(4)),()=>{n.assign(D(l,a,t))}).Else(()=>{n.assign(D(t,a,c))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),GF=U(([s])=>{const e=D(s).toVar(),t=A(e.x).toVar(),n=A(e.y).toVar(),i=A(e.z).toVar(),r=A(Mn(t,Mn(n,i))).toVar(),o=A(ft(t,ft(n,i))).toVar(),a=A(o.sub(r)).toVar(),c=A().toVar(),l=A().toVar(),u=A().toVar();return u.assign(o),Oe(o.greaterThan(0),()=>{l.assign(a.div(o))}).Else(()=>{l.assign(0)}),Oe(l.lessThanEqual(0),()=>{c.assign(0)}).Else(()=>{Oe(t.greaterThanEqual(o),()=>{c.assign(n.sub(i).div(a))}).ElseIf(n.greaterThanEqual(o),()=>{c.assign(Wt(2,i.sub(t).div(a)))}).Else(()=>{c.assign(Wt(4,t.sub(n).div(a)))}),c.mulAssign(1/6),Oe(c.lessThan(0),()=>{c.addAssign(1)})}),D(c,l,u)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),HF=U(([s])=>{const e=D(s).toVar(),t=Km(cg(e,D(.04045))).toVar(),n=D(e.div(12.92)).toVar(),i=D(Kn(ft(e.add(D(.055)),D(0)).div(1.055),D(2.4))).toVar();return it(n,i,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Fw=(s,e)=>{s=A(s),e=A(e);const t=z(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return ti(s.sub(t),s.add(t),e)},Ow=(s,e,t,n)=>it(s,e,t[n].clamp()),WF=(s,e,t=rt())=>Ow(s,e,t,"x"),XF=(s,e,t=rt())=>Ow(s,e,t,"y"),Vw=(s,e,t,n,i)=>it(s,e,Fw(t,n[i])),qF=(s,e,t,n=rt())=>Vw(s,e,t,n,"x"),$F=(s,e,t,n=rt())=>Vw(s,e,t,n,"y"),YF=(s=1,e=0,t=rt())=>t.mul(s).add(e),ZF=(s,e=1)=>(s=A(s),s.abs().pow(e).mul(s.sign())),JF=(s,e=1,t=.5)=>A(s).sub(t).mul(e).add(t),KF=(s=rt(),e=1,t=0)=>r0(s.convert("vec2|vec3")).mul(e).add(t),jF=(s=rt(),e=1,t=0)=>o0(s.convert("vec2|vec3")).mul(e).add(t),QF=(s=rt(),e=1,t=0)=>(s=s.convert("vec2|vec3"),oe(o0(s),r0(s.add(z(19,73)))).mul(e).add(t)),eO=(s=rt(),e=1)=>FF(s.convert("vec2|vec3"),e,L(1)),tO=(s=rt(),e=1)=>VF(s.convert("vec2|vec3"),e,L(1)),nO=(s=rt(),e=1)=>zF(s.convert("vec2|vec3"),e,L(1)),iO=(s=rt())=>TF(s.convert("vec2|vec3")),sO=(s=rt(),e=3,t=2,n=.5,i=1)=>Ah(s,L(e),t,n).mul(i),rO=(s=rt(),e=3,t=2,n=.5,i=1)=>EF(s,L(e),t,n).mul(i),oO=(s=rt(),e=3,t=2,n=.5,i=1)=>Uw(s,L(e),t,n).mul(i),aO=(s=rt(),e=3,t=2,n=.5,i=1)=>CF(s,L(e),t,n).mul(i),Bw=U(([s,e])=>{const t=s.x,n=s.y,i=s.z;let r=e.element(0).mul(.886227);return r=r.add(e.element(1).mul(2*.511664).mul(n)),r=r.add(e.element(2).mul(2*.511664).mul(i)),r=r.add(e.element(3).mul(2*.511664).mul(t)),r=r.add(e.element(4).mul(2*.429043).mul(t).mul(n)),r=r.add(e.element(5).mul(2*.429043).mul(n).mul(i)),r=r.add(e.element(6).mul(i.mul(i).mul(.743125).sub(.247708))),r=r.add(e.element(7).mul(2*.429043).mul(t).mul(i)),r=r.add(e.element(8).mul(.429043).mul(ot(t,t).sub(ot(n,n)))),r});class zw extends xr{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=pe(0).setGroup(_t),this.decayExponentNode=pe(0).setGroup(_t)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setup(e){const{colorNode:t,cutoffDistanceNode:n,decayExponentNode:i,light:r}=this,o=e.context.lightingModel,a=Od(r).sub(Pn),c=a.normalize(),l=a.length(),u=e0({lightDistance:l,cutoffDistance:n,decayExponent:i}),h=t.mul(u),d=e.context.reflectedLight;o.direct({lightDirection:c,lightColor:h,reflectedLight:d},e.stack,e)}}class kw extends xr{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setup(e){super.setup(e);const t=e.context.lightingModel,n=this.colorNode,i=i0(this.light),r=e.context.reflectedLight;t.direct({lightDirection:i,lightColor:n,reflectedLight:r},e.stack,e)}}const Qp=new Fe,Nu=new Fe;let $a=null;class Gw extends xr{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=pe(new E).setGroup(_t),this.halfWidth=pe(new E).setGroup(_t)}update(e){super.update(e);const{light:t}=this,n=e.camera.matrixWorldInverse;Nu.identity(),Qp.copy(t.matrixWorld),Qp.premultiply(n),Nu.extractRotation(Qp),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(Nu),this.halfHeight.value.applyMatrix4(Nu)}setup(e){super.setup(e);let t,n;e.isAvailable("float32Filterable")?(t=xt($a.LTC_FLOAT_1),n=xt($a.LTC_FLOAT_2)):(t=xt($a.LTC_HALF_1),n=xt($a.LTC_HALF_2));const{colorNode:i,light:r}=this,o=e.context.lightingModel,a=Od(r),c=e.context.reflectedLight;o.directRectArea({lightColor:i,lightPosition:a,halfWidth:this.halfWidth,halfHeight:this.halfHeight,reflectedLight:c,ltc_1:t,ltc_2:n},e.stack,e)}static setLTC(e){$a=e}}class a0 extends xr{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=pe(0).setGroup(_t),this.penumbraCosNode=pe(0).setGroup(_t),this.cutoffDistanceNode=pe(0).setGroup(_t),this.decayExponentNode=pe(0).setGroup(_t)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e){const{coneCosNode:t,penumbraCosNode:n}=this;return ti(t,n,e)}setup(e){super.setup(e);const t=e.context.lightingModel,{colorNode:n,cutoffDistanceNode:i,decayExponentNode:r,light:o}=this,a=Od(o).sub(Pn),c=a.normalize(),l=c.dot(i0(o)),u=this.getSpotAttenuation(l),h=a.length(),d=e0({lightDistance:h,cutoffDistance:i,decayExponent:r}),p=n.mul(u).mul(d),f=e.context.reflectedLight;t.direct({lightDirection:c,lightColor:p,reflectedLight:f},e.stack,e)}}class Hw extends a0{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e){const t=this.light.iesMap;let n=null;if(t&&t.isTexture===!0){const i=e.acos().mul(1/Math.PI);n=xt(t,z(i,0),0).r}else n=super.getSpotAttenuation(e);return n}}class Ww extends xr{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class Xw extends xr{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=n0(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=pe(new _e).setGroup(_t)}update(e){const{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){const{colorNode:t,groundColorNode:n,lightDirectionNode:i}=this,o=di.dot(i).mul(.5).add(.5),a=it(n,t,o);e.context.irradiance.addAssign(a)}}class qw extends xr{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let n=0;n<9;n++)t.push(new E);this.lightProbe=ds(t)}update(e){const{light:t}=this;super.update(e);for(let n=0;n<9;n++)this.lightProbe.array[n].copy(t.sh.coefficients[n]).multiplyScalar(t.intensity)}setup(e){const t=Bw(wd,this.lightProbe);e.context.irradiance.addAssign(t)}}class cO{parseFunction(){console.warn("Abstract function.")}}class $w{constructor(e,t,n="",i=""){this.type=e,this.inputs=t,this.name=n,this.precision=i}getCode(){console.warn("Abstract function.")}}$w.isNodeFunction=!0;const lO=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,uO=/[a-z_0-9]+/ig,B_="#pragma main",hO=s=>{s=s.trim();const e=s.indexOf(B_),t=e!==-1?s.slice(e+B_.length):s,n=t.match(lO);if(n!==null&&n.length===5){const i=n[4],r=[];let o=null;for(;(o=uO.exec(i))!==null;)r.push(o);const a=[];let c=0;for(;c<r.length;){const f=r[c][0]==="const";f===!0&&c++;let x=r[c][0];x==="in"||x==="out"||x==="inout"?c++:x="";const m=r[c++][0];let g=Number.parseInt(r[c][0]);Number.isNaN(g)===!1?c++:g=null;const y=r[c++][0];a.push(new Zg(m,y,g,x,f))}const l=t.substring(n[0].length),u=n[3]!==void 0?n[3]:"",h=n[2],d=n[1]!==void 0?n[1]:"",p=e!==-1?s.slice(0,e):"";return{type:h,inputs:a,name:u,precision:d,inputsCode:i,blockCode:l,headerCode:p}}else throw new Error("FunctionNode: Function is not a GLSL code.")};class dO extends $w{constructor(e){const{type:t,inputs:n,name:i,precision:r,inputsCode:o,blockCode:a,headerCode:c}=hO(e);super(t,n,i,r),this.inputsCode=o,this.blockCode=a,this.headerCode=c}getCode(e=this.name){let t;const n=this.blockCode;if(n!==""){const{type:i,inputsCode:r,headerCode:o,precision:a}=this;let c=`${i} ${e} ( ${r.trim()} )`;a!==""&&(c=`${a} ${c}`),t=o+c+n}else t="";return t}}class Yw extends cO{parseFunction(e){return new dO(e)}}class pO{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map,this.colorSpaceNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null;const n=this.getMaterialNodeClass(e.type);if(n!==null){t=new n;for(const i in e)t[i]=e[i]}return t}addColorSpace(e,t){this.addType(e,t,this.colorSpaceNodes)}getColorSpaceFunction(e){return this.colorSpaceNodes.get(e)||null}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t.name,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,n){if(n.has(t)){console.warn(`Redefinition of node ${t}`);return}if(typeof e!="function")throw new Error(`Node class ${e.name} is not a class.`);if(typeof t=="function"||typeof t=="object")throw new Error(`Base class ${t} is not a class.`);n.set(t,e)}addClass(e,t,n){if(n.has(t)){console.warn(`Redefinition of node ${t.name}`);return}if(typeof e!="function")throw new Error(`Node class ${e.name} is not a class.`);if(typeof t!="function")throw new Error(`Base class ${t.name} is not a class.`);n.set(t,e)}}class fO extends il{constructor(e,t,n,i,r,o){super(e,t,n,i,r,o),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}}class Zw extends pO{constructor(){super(),this.addLight(zw,md),this.addLight(kw,gd),this.addLight(Gw,Cm),this.addLight(a0,il),this.addLight(Ww,xd),this.addLight(Xw,fd),this.addLight(qw,Rm),this.addLight(Hw,fO),this.addToneMapping(Tw,Nh),this.addToneMapping(bw,Eh),this.addToneMapping(ww,Ff),this.addToneMapping(Aw,Ch),this.addToneMapping(Nw,Rh),this.addToneMapping(Ew,Ih),this.addColorSpace(Sw,_h(li,kn)),this.addColorSpace(Mw,_h(kn,li))}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ks}}));if(typeof window<"u"){try{typeof document>"u"?require("url").pathToFileURL(__filename).href:mo&&mo.tagName.toUpperCase()==="SCRIPT"&&mo.src||new URL("three-DMrv-4ar.umd.cjs",document.baseURI).href,window.__THREE__IMPORTS__||(window.__THREE__IMPORTS__=[]),window.__THREE__IMPORTS__.push({url:typeof document>"u"?require("url").pathToFileURL(__filename).href:mo&&mo.tagName.toUpperCase()==="SCRIPT"&&mo.src||new URL("three-DMrv-4ar.umd.cjs",document.baseURI).href,revision:Ks})}catch{}window.__THREE__?(console.warn("WARNING: Multiple instances of Three.js being imported. Existing: "+window.__THREE__+", new: "+Ks),console.warn(window.__THREE__IMPORTS__)):window.__THREE__=Ks}const mO=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Ch,AONode:FT,AddEquation:Zs,AddOperation:Uf,AdditiveAnimationBlendMode:$f,AdditiveBlending:lc,AfterImageNode:Xb,AgXToneMapping:Rh,AlphaFormat:zf,AlwaysCompare:Py,AlwaysDepth:hc,AlwaysStencilFunc:sh,AmbientLight:xd,AmbientLightNode:Ww,AnaglyphPassNode:lw,AnalyticLightNode:xr,AnamorphicNode:$b,AnimationAction:Sv,AnimationClip:aa,AnimationLoader:UI,AnimationMixer:Tv,AnimationObjectGroup:eP,AnimationUtils:II,ArcCurve:Qy,ArrayCamera:sm,ArrayElementNode:pr,ArrowHelper:fP,AssignNode:rM,AttachedBindMode:sf,AttributeNode:bg,Audio:Dm,AudioAnalyser:WI,AudioContext:_d,AudioListener:yv,AudioLoader:_v,AxesHelper:Uv,BRDF_GGX:Tf,BRDF_Lambert:eo,BackSide:ln,BasicDepthPacking:Yf,BasicEnvironmentNode:Id,BasicNodeLibrary:Zw,BasicShadowMap:tA,BatchNode:ET,BatchedMesh:um,BloomNode:iw,Bone:Yh,BooleanKeyframeTrack:co,Box2:oP,Box3:Hn,Box3Helper:Dv,BoxGeometry:_s,BoxHelper:Lv,Break:Rd,BufferAttribute:At,BufferAttributeNode:pS,BufferGeometry:at,BufferGeometryLoader:mv,BufferNode:Nd,BumpMapNode:ZS,BypassNode:_S,ByteType:Of,Cache:Rs,CacheNode:xS,Camera:Yc,CameraHelper:Pv,CanvasTexture:jy,CapsuleGeometry:Jh,CatmullRomCurve3:ev,CineonToneMapping:Ff,CircleGeometry:Kh,ClampToEdgeWrapping:Si,Clock:Lm,CodeNode:Xg,Color:_e,ColorKeyframeTrack:dd,ColorManagement:gt,ColorSpaceNode:hl,CompressedArrayTexture:Jy,CompressedCubeTexture:Ky,CompressedTexture:Kc,CompressedTextureLoader:FI,ComputeNode:mS,ConeGeometry:jh,ConstNode:Hi,ConstantAlphaFactor:sy,ConstantColorFactor:ny,ContextNode:_g,Continue:bL,Controls:Ov,ConvertNode:Xm,CubeCamera:Gh,CubeReflectionMapping:wi,CubeRefractionMapping:Vi,CubeTexture:io,CubeTextureLoader:OI,CubeTextureNode:kS,CubeUVReflectionMapping:to,CubicBezierCurve:mm,CubicBezierCurve3:tv,CubicInterpolant:lv,CullFaceBack:ef,CullFaceFront:H_,CullFaceFrontBack:eA,CullFaceNone:G_,Curve:Gi,CurvePath:iv,CustomBlending:Pf,CustomToneMapping:oy,CylinderGeometry:ao,Cylindrical:rP,DFGApprox:kg,D_GGX:QT,Data3DTexture:zh,DataArrayTexture:qc,DataTexture:Oi,DataTextureLoader:dv,DataUtils:Oy,DecrementStencilOp:gy,DecrementWrapStencilOp:_y,DefaultLoadingManager:Nm,DenoiseNode:tw,DepthFormat:Qs,DepthOfFieldNode:Zb,DepthStencilFormat:ar,DepthTexture:oo,DetachedBindMode:ay,DirectionalLight:gd,DirectionalLightHelper:Iv,DirectionalLightNode:kw,Discard:TS,DiscreteInterpolant:uv,DisplayP3ColorSpace:Xc,DodecahedronGeometry:Qh,DotScreenNode:Jb,DoubleSide:Zi,DstAlphaFactor:K_,DstColorFactor:Q_,DynamicCopyUsage:pA,DynamicDrawUsage:zr,DynamicReadUsage:uA,EPSILON:wM,EdgesGeometry:vm,EllipseCurve:Zh,EnvironmentNode:ub,EqualCompare:Ey,EqualDepth:pc,EqualStencilFunc:Sy,EquirectUVNode:$T,EquirectangularReflectionMapping:ir,EquirectangularRefractionMapping:sr,Euler:ui,EventDispatcher:Ai,ExpressionNode:SS,ExtrudeGeometry:Qc,FXAANode:nw,F_Schlick:ha,FileLoader:es,FilmNode:jb,Float16BufferAttribute:Vy,Float32BufferAttribute:Ve,FloatType:Gn,Fn:U,Fog:rm,FogExp2:qh,FogExp2Node:gw,FogNode:Fd,FogRangeNode:mw,FramebufferTexture:pm,FrontFacingNode:PS,FrontSide:fs,Frustum:ma,FunctionCallNode:aM,FunctionNode:qg,FunctionOverloadingNode:Eb,GLBufferAttribute:sP,GLSL1:mA,GLSL3:rh,GLSLNodeParser:Yw,GTAONode:ew,GaussianBlurNode:Wb,GreaterCompare:Cy,GreaterDepth:mc,GreaterEqualCompare:Iy,GreaterEqualDepth:fc,GreaterEqualStencilFunc:Ay,GreaterStencilFunc:by,GridHelper:Rv,Group:kr,HalfFloatType:Ln,HemisphereLight:fd,HemisphereLightHelper:hP,HemisphereLightNode:Xw,IESSpotLightNode:Hw,INFINITY:BP,IcosahedronGeometry:td,If:Oe,ImageBitmapLoader:xv,ImageLoader:Dc,ImageUtils:Uy,IncrementStencilOp:my,IncrementWrapStencilOp:xy,IndexNode:zt,InstanceNode:AT,InstancedBufferAttribute:Us,InstancedBufferGeometry:Im,InstancedInterleavedBuffer:Om,InstancedMesh:lm,InstancedPointsNodeMaterial:BL,Int16BufferAttribute:QA,Int32BufferAttribute:e1,Int8BufferAttribute:JA,IntType:pa,InterleavedBuffer:xa,InterleavedBufferAttribute:Ds,Interpolant:Ma,InterpolateDiscrete:ta,InterpolateLinear:bc,InterpolateSmooth:Eu,InvertStencilOp:yy,IrradianceNode:BT,JoinNode:kv,KeepStencilOp:$s,KeyframeTrack:rs,LOD:am,LatheGeometry:jc,Layers:$c,LessCompare:Kf,LessDepth:dc,LessEqualCompare:jf,LessEqualDepth:nr,LessEqualStencilFunc:Ty,LessStencilFunc:My,Light:dr,LightProbe:Rm,LightProbeNode:qw,LightingContextNode:OT,LightingModel:Ml,LightingNode:ho,LightsNode:DT,Line:Fs,Line2NodeMaterial:XL,Line3:Ev,LineBasicMaterial:Fn,LineBasicNodeMaterial:kL,LineCurve:gm,LineCurve3:nv,LineDashedMaterial:hd,LineDashedNodeMaterial:HL,LineLoop:hm,LineSegments:ss,LinearDisplayP3ColorSpace:fa,LinearFilter:Ut,LinearInterpolant:Am,LinearMipMapLinearFilter:cy,LinearMipMapNearestFilter:sA,LinearMipmapLinearFilter:Jn,LinearMipmapNearestFilter:js,LinearSRGBColorSpace:li,LinearToneMapping:Nh,LinearTransfer:Ac,Loader:Xn,LoaderUtils:uh,LoadingManager:pd,Loop:mt,LoopNode:IT,LoopOnce:Xf,LoopPingPong:ly,LoopRepeat:qf,LuminanceAlphaFormat:Hf,LuminanceFormat:Gf,Lut3DNode:Qb,MOUSE:z_,MRTNode:Nb,MatcapUVNode:pb,Material:mn,MaterialLoader:sl,MaterialNode:j,MaterialReferenceNode:GS,MathUtils:Bh,Matrix2:Vm,Matrix3:Ke,Matrix4:Fe,MaxEquation:Lf,MaxMipLevelNode:NS,Mesh:kt,MeshBasicMaterial:is,MeshBasicNodeMaterial:e2,MeshDepthMaterial:Xh,MeshDistanceMaterial:im,MeshLambertMaterial:ud,MeshLambertNodeMaterial:r2,MeshMatcapMaterial:bm,MeshMatcapNodeMaterial:H2,MeshNormalMaterial:ld,MeshNormalNodeMaterial:YL,MeshPhongMaterial:cd,MeshPhongNodeMaterial:a2,MeshPhysicalMaterial:ad,MeshPhysicalNodeMaterial:db,MeshSSSNodeMaterial:O2,MeshStandardMaterial:nl,MeshStandardNodeMaterial:hb,MeshToonMaterial:Tm,MeshToonNodeMaterial:k2,MinEquation:q_,MirroredRepeatWrapping:jo,MixOperation:Df,ModelNode:ns,ModelViewProjectionNode:TT,MorphNode:PT,MultiplyBlending:nf,MultiplyOperation:da,NearestFilter:Qt,NearestMipMapLinearFilter:iA,NearestMipMapNearestFilter:nA,NearestMipmapLinearFilter:Cs,NearestMipmapNearestFilter:Lh,NeutralToneMapping:Ih,NeverCompare:Ny,NeverDepth:uc,NeverStencilFunc:vy,NoBlending:Fi,NoColorSpace:Li,NoToneMapping:Ti,Node:Ye,NodeAttribute:Ef,NodeBuilder:wb,NodeCache:Lu,NodeCode:Sb,NodeFrame:Ab,NodeFunctionInput:Zg,NodeLoader:_b,NodeMaterial:Tt,NodeMaterialLoader:yb,NodeMaterialObserver:Vv,NodeObjectLoader:Q2,NodeShaderStage:df,NodeType:_P,NodeUniform:vb,NodeUpdateType:We,NodeUtils:xP,NodeVar:Hg,NodeVarying:Mb,NormalAnimationBlendMode:Vh,NormalBlending:Ps,NormalMapNode:YS,NotEqualCompare:Ry,NotEqualDepth:gc,NotEqualStencilFunc:wy,NumberKeyframeTrack:ra,Object3D:yt,Object3DNode:wt,ObjectLoader:gv,ObjectSpaceNormalMap:Jf,OctahedronGeometry:ya,OneFactor:Y_,OneMinusConstantAlphaFactor:ry,OneMinusConstantColorFactor:iy,OneMinusDstAlphaFactor:j_,OneMinusDstColorFactor:ey,OneMinusSrcAlphaFactor:Vu,OneMinusSrcColorFactor:J_,OrthographicCamera:ro,OscNode:pn,OutputStructNode:Jg,P3Primaries:Ec,PCFShadowMap:Rf,PCFSoftShadowMap:If,PI:Qr,PI2:zP,PMREMGenerator:oh,PMREMNode:cb,ParallaxBarrierPassNode:uw,ParameterNode:Wg,PassNode:bn,Path:Rc,PerspectiveCamera:hn,PhongLightingModel:Bg,PhysicalLightingModel:Ld,PixelationPassNode:rw,Plane:cs,PlaneGeometry:so,PlaneHelper:pP,PointLight:md,PointLightHelper:lP,PointLightNode:zw,PointUVNode:Ob,Points:dm,PointsMaterial:_a,PointsNodeMaterial:X2,PolarGridHelper:dP,PolyhedronGeometry:hr,PositionalAudio:vv,PosterizeNode:kb,PropertyBinding:St,PropertyMixer:Mv,PropertyNode:Nt,QuadraticBezierCurve:xm,QuadraticBezierCurve3:_m,Quaternion:Qn,QuaternionKeyframeTrack:Sa,QuaternionLinearInterpolant:hv,RED_GREEN_RGTC2_Format:nh,RED_RGTC1_Format:Wf,REVISION:Ks,RGBADepthPacking:Zf,RGBAFormat:Rn,RGBAIntegerFormat:Oh,RGBA_ASTC_10x10_Format:Ju,RGBA_ASTC_10x5_Format:$u,RGBA_ASTC_10x6_Format:Yu,RGBA_ASTC_10x8_Format:Zu,RGBA_ASTC_12x10_Format:Ku,RGBA_ASTC_12x12_Format:ju,RGBA_ASTC_4x4_Format:Sc,RGBA_ASTC_5x4_Format:ku,RGBA_ASTC_5x5_Format:Gu,RGBA_ASTC_6x5_Format:Hu,RGBA_ASTC_6x6_Format:Tc,RGBA_ASTC_8x5_Format:Wu,RGBA_ASTC_8x6_Format:Xu,RGBA_ASTC_8x8_Format:qu,RGBA_BPTC_Format:Zo,RGBA_ETC2_EAC_Format:Mc,RGBA_PVRTC_2BPPV1_Format:zu,RGBA_PVRTC_4BPPV1_Format:_c,RGBA_S3TC_DXT1_Format:$o,RGBA_S3TC_DXT3_Format:Ka,RGBA_S3TC_DXT5_Format:Yo,RGBDepthPacking:oA,RGBFormat:kf,RGBIntegerFormat:rA,RGBShiftNode:Kb,RGB_BPTC_SIGNED_Format:Qu,RGB_BPTC_UNSIGNED_Format:eh,RGB_ETC1_Format:yc,RGB_ETC2_Format:vc,RGB_PVRTC_2BPPV1_Format:Bu,RGB_PVRTC_4BPPV1_Format:xc,RGB_S3TC_DXT1_Format:Ja,RGDepthPacking:aA,RGFormat:ea,RGIntegerFormat:Fh,RTTNode:Db,RangeNode:xw,RawShaderMaterial:Sm,Ray:no,Raycaster:Av,Rec709Primaries:Nc,RectAreaLight:Cm,RectAreaLightNode:Gw,RedFormat:Hc,RedIntegerFormat:Wc,ReferenceNode:ml,ReflectorNode:Lb,ReinhardToneMapping:Eh,RemapNode:Tg,RenderOutputNode:bS,RenderTarget:fn,RendererReferenceNode:cS,RepeatWrapping:rr,ReplaceStencilOp:fy,Return:XP,ReverseSubtractEquation:X_,RingGeometry:el,RotateNode:mb,SIGNED_RED_GREEN_RGTC2_Format:ih,SIGNED_RED_RGTC1_Format:th,SRGBColorSpace:kn,SRGBTransfer:Vt,SSAAPassNode:ow,Scene:$h,SceneNode:ji,Schlick_to_F0:tb,ScreenNode:sn,ScriptableNode:fw,ScriptableValueNode:dw,SetNode:Gv,ShaderChunk:lt,ShaderLib:Pi,ShaderMaterial:ki,ShaderNode:tc,ShadowMaterial:od,ShadowNodeMaterial:J2,Shape:er,ShapeGeometry:nd,ShapePath:Fv,ShapeUtils:Ki,ShortType:Vf,Skeleton:Jc,SkeletonHelper:cP,SkinnedMesh:cm,SkinningNode:Dg,SobelOperatorNode:Yb,Source:Js,Sphere:Dn,SphereGeometry:va,Spherical:Nv,SphericalHarmonics3:fv,SplineCurve:ym,SplitNode:hh,SpotLight:il,SpotLightHelper:aP,SpotLightNode:a0,Sprite:om,SpriteMaterial:Zc,SpriteNodeMaterial:$2,SpriteSheetUVNode:Cb,SrcAlphaFactor:Ou,SrcAlphaSaturateFactor:ty,SrcColorFactor:Z_,StackNode:bb,StaticCopyUsage:dA,StaticDrawUsage:na,StaticReadUsage:lA,StereoCamera:Pm,StereoPassNode:aw,StorageArrayElementNode:Rb,StorageBufferNode:Qg,StorageTextureNode:Vb,StreamCopyUsage:fA,StreamDrawUsage:cA,StreamReadUsage:hA,StringKeyframeTrack:lo,SubtractEquation:W_,SubtractiveBlending:tf,TBNViewMatrix:Wr,TOUCH:k_,TangentSpaceNormalMap:ms,TempNode:pt,TetrahedronGeometry:id,Texture:Xt,Texture3DNode:gb,TextureLoader:pv,TextureNode:gs,TextureSizeNode:AS,TextureUtils:FR,TimerNode:Sn,ToneMappingNode:uS,ToonOutlinePassNode:hw,TorusGeometry:tl,TorusKnotGeometry:sd,TransitionNode:sw,Triangle:Zn,TriangleFanDrawMode:dy,TriangleStripDrawMode:hy,TrianglesDrawMode:uy,TriplanarTexturesNode:Ib,TubeGeometry:rd,UVMapping:Ph,Uint16BufferAttribute:kh,Uint32BufferAttribute:em,Uint8BufferAttribute:KA,Uint8ClampedBufferAttribute:jA,Uniform:bv,UniformArrayNode:Cg,UniformGroupNode:jm,UniformNode:uo,UniformsGroup:iP,UniformsLib:Se,UniformsUtils:tm,UnsignedByteType:Qi,UnsignedInt248Type:or,UnsignedInt5999Type:Bf,UnsignedIntType:Bi,UnsignedShort4444Type:Dh,UnsignedShort5551Type:Uh,UnsignedShortType:Qo,UserDataNode:zb,VSMShadowMap:oi,V_GGX_SmithCorrelated:jT,VarNode:nS,VaryingNode:iS,Vector2:J,Vector3:E,Vector4:st,VectorKeyframeTrack:oa,VertexColorNode:Fb,VideoTexture:Zy,ViewportDepthNode:jn,ViewportDepthTextureNode:HT,ViewportSharedTextureNode:Gb,ViewportTextureNode:vl,VolumeNodeMaterial:j2,WebGL3DRenderTarget:zA,WebGLArrayRenderTarget:BA,WebGLCoordinateSystem:Di,WebGLCubeRenderTarget:Hh,WebGLMultipleRenderTargets:mP,WebGLRenderTarget:zi,WebGLRenderer:qy,WebGLUtils:Xy,WebGPUCoordinateSystem:Kr,WireframeGeometry:Mm,WrapAroundEnding:wc,ZeroCurvatureEnding:Vr,ZeroFactor:$_,ZeroSlopeEnding:Br,ZeroStencilOp:py,abs:Dt,acesFilmicToneMapping:Aw,acos:xh,add:Wt,addMethodChaining:te,addNodeElement:qP,afterImage:cD,agxToneMapping:Nw,all:lg,alphaT:ph,anaglyphPass:WD,anamorphic:fD,and:fM,anisotropy:Ys,anisotropyB:Yr,anisotropyT:nc,any:AM,ao:bD,append:$v,arrayBuffer:UP,asin:PM,assign:oM,atan:LM,atan2:GM,atomicAdd:GU,atomicAnd:qU,atomicFunc:Os,atomicMax:WU,atomicMin:XU,atomicOr:$U,atomicStore:kU,atomicSub:HU,atomicXor:YU,attenuationColor:rg,attenuationDistance:sg,attribute:vn,backgroundBlurriness:J3,backgroundIntensity:K3,batch:CT,billboarding:pU,bitAnd:_M,bitNot:yM,bitOr:vM,bitXor:MM,bitangentGeometry:dL,bitangentLocal:pL,bitangentView:WS,bitangentWorld:fL,bitcast:kP,bleach:SU,bloom:LD,blur:ab,bool:cr,buffer:fl,bufferAttribute:dl,bumpMap:JS,burn:xU,bvec2:Jv,bvec3:Km,bvec4:eM,bypass:yS,cache:sc,call:cM,cameraFar:Bo,cameraLogDepth:CS,cameraNear:Vo,cameraNormalMatrix:JP,cameraPosition:wg,cameraProjectionMatrix:ci,cameraProjectionMatrixInverse:YP,cameraViewMatrix:pi,cameraWorldMatrix:ZP,cbrt:ZM,ceil:dg,checker:ZU,cineonToneMapping:ww,clamp:cn,clearcoat:dh,clearcoatRoughness:zc,code:Dd,color:Yv,colorSpaceToWorking:Sg,colorToDirection:qL,compute:gS,cond:eS,context:yg,convert:nM,convertToTexture:ei,cos:Mi,createCanvasElement:Dy,cross:Ko,cubeTexture:Ad,dFdx:FM,dFdy:OM,dashSize:Zr,defaultBuildStages:pf,defaultShaderStages:Wm,defined:Oc,degrees:CM,denoise:ND,densityFog:KD,depth:Og,depthPass:oD,difference:XM,diffuseColor:Ct,directionToColor:qT,dispersion:og,distance:WM,div:ts,dodge:_U,dof:gD,dot:$t,dotScreen:xD,drawIndex:wT,dynamicBufferAttribute:fS,element:tM,emissive:gf,equal:lM,equals:NM,equirectUV:Vg,exp:ug,exp2:gh,expression:lr,faceDirection:pl,faceForward:KM,film:yD,float:A,floor:fr,fog:ZD,fract:mr,frameGroup:OP,frameId:U3,frontFacing:LS,fwidth:zM,fxaa:ED,gain:aU,gapSize:Gc,gaussianBlur:aD,getColorSpaceMethod:_h,getConstNodeType:qv,getCurrentStack:Jm,getDirection:rb,getDistanceAttenuation:e0,getGeometryRoughness:KT,getRoughness:zg,getShIrradianceAt:Bw,getTextureIndex:Kg,global:Fu,glsl:s3,glslFn:r3,grayscale:lD,greaterThan:cg,greaterThanEqual:pM,hash:oU,highPrecisionModelNormalViewMatrix:aL,highPrecisionModelViewMatrix:oL,hue:dD,instance:NT,instanceIndex:yl,instancedBufferAttribute:yh,instancedDynamicBufferAttribute:xf,int:L,inverseSqrt:RM,invocationLocalIndex:SL,invocationSubgroupIndex:ML,ior:ic,iridescence:Sd,iridescenceIOR:eg,iridescenceThickness:tg,ivec2:ls,ivec3:Kv,ivec4:jv,js:n3,label:tS,length:Jr,lengthSq:mg,lessThan:hM,lessThanEqual:dM,lightPosition:n0,lightTargetDirection:i0,lightTargetPosition:_w,lightViewPosition:Od,lightingContext:VT,lights:UT,linearDepth:Th,linearSRGBTosRGB:Sw,linearToneMapping:Tw,localId:IU,log:hg,log2:al,loop:wL,luminance:En,lut3D:vD,mat2:ol,mat3:Tn,mat4:$r,matcapUV:fb,materialAOMap:ST,materialAlphaTest:KS,materialAnisotropy:hT,materialAnisotropyVector:zo,materialAttenuationColor:yT,materialAttenuationDistance:_T,materialClearcoat:rT,materialClearcoatNormal:aT,materialClearcoatRoughness:oT,materialColor:la,materialDispersion:MT,materialEmissive:QS,materialIOR:xT,materialIridescence:dT,materialIridescenceIOR:pT,materialIridescenceThickness:fT,materialLightMap:Lg,materialLineDashOffset:Mf,materialLineDashSize:Ig,materialLineGapSize:Pg,materialLineScale:Sh,materialLineWidth:Pu,materialMetalness:iT,materialNormal:sT,materialOpacity:Cd,materialPointWidth:vT,materialReference:Ji,materialReflectivity:Iu,materialRefractionRatio:FS,materialRotation:cT,materialRoughness:nT,materialSheen:lT,materialSheenRoughness:uT,materialShininess:jS,materialSpecular:eT,materialSpecularColor:tT,materialSpecularIntensity:vf,materialSpecularStrength:rc,materialThickness:gT,materialTransmission:mT,max:ft,maxMipLevel:ES,metalness:Bc,min:Mn,mix:it,mixElement:jM,mod:Td,modInt:ag,modelDirection:nL,modelNormalMatrix:RS,modelPosition:iL,modelScale:sL,modelViewMatrix:xs,modelViewPosition:rL,modelViewProjection:Sf,modelWorldMatrix:Ui,modelWorldMatrixInverse:IS,morphReference:LT,motionBlur:MU,mrt:Ud,mul:ot,mx_aastep:Fw,mx_cell_noise_float:iO,mx_contrast:JF,mx_fractal_noise_float:sO,mx_fractal_noise_vec2:rO,mx_fractal_noise_vec3:oO,mx_fractal_noise_vec4:aO,mx_hsvtorgb:kF,mx_noise_float:KF,mx_noise_vec3:jF,mx_noise_vec4:QF,mx_ramplr:WF,mx_ramptb:XF,mx_rgbtohsv:GF,mx_safepower:ZF,mx_splitlr:qF,mx_splittb:$F,mx_srgb_texture_to_lin_rec709:HF,mx_transform_uv:YF,mx_worley_noise_float:eO,mx_worley_noise_vec2:tO,mx_worley_noise_vec3:nO,negate:DM,neutralToneMapping:Ew,nodeArray:qr,nodeImmutable:fe,nodeObject:H,nodeObjects:rl,nodeProxy:K,normalFlat:DS,normalGeometry:bd,normalLocal:hi,normalMap:yf,normalView:di,normalWorld:wd,normalize:vi,not:gM,notEqual:uM,numWorkgroups:CU,objectDirection:KP,objectGroup:sM,objectPosition:QP,objectScale:eL,objectViewPosition:tL,objectWorldMatrix:jP,oneMinus:UM,or:mM,orthographicDepthToViewZ:DL,oscSawtooth:B3,oscSine:F3,oscSquare:O3,oscTriangle:V3,output:ng,outputStruct:I3,overlay:vU,overloadingFn:On,parabola:Cf,parallaxBarrierPass:XD,parallaxDirection:qS,parallaxUV:gL,parameter:t3,pass:rD,passTexture:Aa,pcurve:cU,perspectiveDepthToViewZ:Fg,pixelationPass:OD,pmremTexture:lb,pointUV:Z3,pointWidth:VP,positionGeometry:Nn,positionLocal:en,positionPrevious:vh,positionView:Pn,positionViewDirection:Bt,positionWorld:Mh,positionWorldDirection:Ag,posterize:nD,pow:Kn,pow2:fg,pow3:qM,pow4:$M,property:ai,radians:EM,rand:xg,range:jD,rangeFog:JD,reciprocal:BM,reference:dn,referenceBuffer:_f,reflect:HM,reflectVector:BS,reflectView:OS,reflector:W3,refract:gg,refractVector:zS,refractView:VS,reinhardToneMapping:bw,remainder:bM,remap:vS,remapClamp:MS,renderGroup:_t,renderOutput:wS,rendererReference:lS,rgbShift:_D,rotate:Gg,rotateUV:hU,roughness:hs,round:VM,rtt:Ub,sRGBToLinearSRGB:Mw,sampler:$P,saturate:JM,saturation:uD,screen:yU,screenCoordinate:wa,screenSize:ua,screenUV:gr,scriptable:YD,scriptableValue:Uu,select:In,sepia:TU,setCurrentStack:Vc,shaderStages:ff,sharedUniformGroup:Qm,sheen:Hr,sheenRoughness:Md,shiftLeft:SM,shiftRight:TM,shininess:fh,sign:cl,sin:Cn,sinc:lU,skinning:TL,skinningReference:RT,smoothstep:ti,smoothstepElement:QM,sobel:mD,specularColor:ri,specularF90:kc,spherizeUV:dU,split:FP,spritesheetUV:z3,sqrt:os,ssaaPass:zD,stack:Du,step:ll,stereoPass:GD,storage:j3,storageBarrier:UU,storageObject:Q3,storageTexture:Bb,string:DP,sub:Ft,subgroupIndex:vL,subgroupSize:PU,tan:IM,tangentGeometry:Ed,tangentLocal:gl,tangentView:xl,tangentWorld:HS,temp:vg,texture:xt,texture3D:xb,textureBarrier:FU,textureBicubic:sb,textureCubeUV:ob,textureLoad:Ci,textureSize:tr,textureStore:eD,thickness:ig,threshold:qb,timerDelta:D3,timerGlobal:L3,timerLocal:jg,toOutputColorSpace:sS,toWorkingColorSpace:rS,toneMapping:hS,toneMappingExposure:dS,toonOutlinePass:qD,transformDirection:YM,transformNormal:US,transformNormalToView:Eg,transformedBentNormalView:$S,transformedBitangentView:XS,transformedBitangentWorld:mL,transformedClearcoatNormalView:Xo,transformedNormalView:Yt,transformedNormalWorld:Ng,transformedTangentView:Rg,transformedTangentWorld:hL,transition:DD,transmission:mh,transpose:kM,tri:us,tri3:yw,triNoise3D:uU,triplanarTexture:G3,triplanarTextures:Pb,trunc:pg,tslFn:LP,uint:ve,uniform:pe,uniformArray:ds,uniformGroup:iM,uniforms:lL,userData:tD,uv:rt,uvec2:Zv,uvec3:ba,uvec4:Qv,varying:Un,varyingProperty:Yi,vec2:z,vec3:D,vec4:oe,vectorComponents:Ta,velocity:gU,vertexColor:Y3,vertexIndex:bT,vibrance:hD,viewZToOrthographicDepth:oc,viewZToPerspectiveDepth:WT,viewport:Ls,viewportBottomLeft:PL,viewportCoordinate:kT,viewportDepthTexture:Ug,viewportLinearDepth:UL,viewportMipTexture:GT,viewportResolution:RL,viewportSafeUV:fU,viewportSharedTexture:iD,viewportSize:zT,viewportTexture:LL,viewportTopLeft:IL,viewportUV:CL,wgsl:i3,wgslFn:o3,workgroupArray:BU,workgroupBarrier:DU,workgroupId:RU,workingToColorSpace:oS,xor:xM},Symbol.toStringTag,{value:"Module"}));exports.ACESFilmicToneMapping=Ch;exports.AdditiveBlending=lc;exports.AgXToneMapping=Rh;exports.AlwaysDepth=hc;exports.AlwaysStencilFunc=sh;exports.AmbientLight=xd;exports.AnimationClip=aa;exports.AnimationMixer=Tv;exports.ArrayCamera=sm;exports.Audio=Dm;exports.AudioContext=_d;exports.AudioListener=yv;exports.AudioLoader=_v;exports.AxesHelper=Uv;exports.BackSide=ln;exports.BasicDepthPacking=Yf;exports.BasicNodeLibrary=Zw;exports.BatchedMesh=um;exports.Bone=Yh;exports.Box3=Hn;exports.Box3Helper=Dv;exports.BoxGeometry=_s;exports.BoxHelper=Lv;exports.BufferAttribute=At;exports.BufferGeometry=at;exports.Camera=Yc;exports.CameraHelper=Pv;exports.CanvasTexture=jy;exports.ClampToEdgeWrapping=Si;exports.Clock=Lm;exports.Color=_e;exports.ColorKeyframeTrack=dd;exports.ColorManagement=gt;exports.CompressedArrayTexture=Jy;exports.CompressedCubeTexture=Ky;exports.CompressedTexture=Kc;exports.Controls=Ov;exports.CubeCamera=Gh;exports.CubeTexture=io;exports.Curve=Gi;exports.CustomBlending=Pf;exports.CylinderGeometry=ao;exports.Data3DTexture=zh;exports.DataTexture=Oi;exports.DataTextureLoader=dv;exports.DataUtils=Oy;exports.DecrementStencilOp=gy;exports.DecrementWrapStencilOp=_y;exports.DefaultLoadingManager=Nm;exports.DepthFormat=Qs;exports.DepthStencilFormat=ar;exports.DepthTexture=oo;exports.DirectionalLight=gd;exports.DirectionalLightHelper=Iv;exports.DisplayP3ColorSpace=Xc;exports.DoubleSide=Zi;exports.DynamicDrawUsage=zr;exports.EdgesGeometry=vm;exports.EqualDepth=pc;exports.EqualStencilFunc=Sy;exports.EquirectangularReflectionMapping=ir;exports.EquirectangularRefractionMapping=sr;exports.Euler=ui;exports.EventDispatcher=Ai;exports.ExtrudeGeometry=Qc;exports.FileLoader=es;exports.Float32BufferAttribute=Ve;exports.FloatType=Gn;exports.Fog=rm;exports.FrontSide=fs;exports.Frustum=ma;exports.GLSL3=rh;exports.GLSLNodeParser=Yw;exports.GreaterDepth=mc;exports.GreaterEqualDepth=fc;exports.GreaterEqualStencilFunc=Ay;exports.GreaterStencilFunc=by;exports.GridHelper=Rv;exports.Group=kr;exports.HalfFloatType=Ln;exports.HemisphereLight=fd;exports.ImageBitmapLoader=xv;exports.IncrementStencilOp=my;exports.IncrementWrapStencilOp=xy;exports.InstancedBufferAttribute=Us;exports.InstancedBufferGeometry=Im;exports.InstancedInterleavedBuffer=Om;exports.InstancedMesh=lm;exports.InterleavedBuffer=xa;exports.InterleavedBufferAttribute=Ds;exports.Interpolant=Ma;exports.InterpolateDiscrete=ta;exports.InterpolateLinear=bc;exports.InvertStencilOp=yy;exports.KeepStencilOp=$s;exports.LOD=am;exports.Layers=$c;exports.LessDepth=dc;exports.LessEqualDepth=nr;exports.LessEqualStencilFunc=Ty;exports.LessStencilFunc=My;exports.Line=Fs;exports.Line3=Ev;exports.LineBasicMaterial=Fn;exports.LineLoop=hm;exports.LineSegments=ss;exports.LinearDisplayP3ColorSpace=fa;exports.LinearFilter=Ut;exports.LinearMipmapLinearFilter=Jn;exports.LinearMipmapNearestFilter=js;exports.LinearSRGBColorSpace=li;exports.LinearToneMapping=Nh;exports.Loader=Xn;exports.LoaderUtils=uh;exports.LoadingManager=pd;exports.LoopOnce=Xf;exports.LoopRepeat=qf;exports.MOUSE=z_;exports.Material=mn;exports.MathUtils=Bh;exports.Matrix3=Ke;exports.Matrix4=Fe;exports.MaxEquation=Lf;exports.Mesh=kt;exports.MeshBasicMaterial=is;exports.MeshDepthMaterial=Xh;exports.MeshLambertMaterial=ud;exports.MeshNormalMaterial=ld;exports.MeshPhongMaterial=cd;exports.MeshPhysicalMaterial=ad;exports.MeshStandardMaterial=nl;exports.MirroredRepeatWrapping=jo;exports.NearestFilter=Qt;exports.NearestMipmapLinearFilter=Cs;exports.NearestMipmapNearestFilter=Lh;exports.NeutralToneMapping=Ih;exports.NeverDepth=uc;exports.NeverStencilFunc=vy;exports.NoBlending=Fi;exports.NoColorSpace=Li;exports.NoToneMapping=Ti;exports.Node=Ye;exports.NodeBuilder=wb;exports.NodeFrame=Ab;exports.NormalBlending=Ps;exports.NotEqualDepth=gc;exports.NotEqualStencilFunc=wy;exports.NumberKeyframeTrack=ra;exports.Object3D=yt;exports.OctahedronGeometry=ya;exports.OrthographicCamera=ro;exports.PCFSoftShadowMap$1=If;exports.PMREMGenerator$1=oh;exports.PerspectiveCamera=hn;exports.Plane=cs;exports.PlaneGeometry=so;exports.PointLight=md;exports.Points=dm;exports.PointsMaterial=_a;exports.PositionalAudio=vv;exports.PropertyBinding=St;exports.Quaternion=Qn;exports.QuaternionKeyframeTrack=Sa;exports.REVISION=Ks;exports.RGBADepthPacking=Zf;exports.RGBAFormat=Rn;exports.RGBA_ASTC_4x4_Format=Sc;exports.RGBA_ASTC_6x6_Format=Tc;exports.RGBA_BPTC_Format=Zo;exports.RGBA_ETC2_EAC_Format=Mc;exports.RGBA_PVRTC_4BPPV1_Format=_c;exports.RGBA_S3TC_DXT1_Format=$o;exports.RGBA_S3TC_DXT5_Format=Yo;exports.RGB_ETC1_Format=yc;exports.RGB_ETC2_Format=vc;exports.RGB_PVRTC_4BPPV1_Format=xc;exports.RGFormat=ea;exports.RawShaderMaterial=Sm;exports.Ray=no;exports.Raycaster=Av;exports.RedFormat=Hc;exports.ReinhardToneMapping=Eh;exports.RepeatWrapping=rr;exports.ReplaceStencilOp=fy;exports.RingGeometry=el;exports.SRGBColorSpace=kn;exports.Scene=$h;exports.ShaderChunk=lt;exports.ShaderLib=Pi;exports.ShaderMaterial=ki;exports.ShadowMaterial=od;exports.Shape=er;exports.ShapePath=Fv;exports.ShapeUtils=Ki;exports.Skeleton=Jc;exports.SkinnedMesh=cm;exports.Source=Js;exports.Sphere=Dn;exports.SphereGeometry=va;exports.Spherical=Nv;exports.SpotLight=il;exports.Sprite=om;exports.SpriteMaterial=Zc;exports.THREE=mO;exports.TOUCH=k_;exports.Texture=Xt;exports.TextureLoader=pv;exports.TorusGeometry=tl;exports.Triangle=Zn;exports.TriangleFanDrawMode=dy;exports.TriangleStripDrawMode=hy;exports.TrianglesDrawMode=uy;exports.Uint16BufferAttribute=kh;exports.Uniform$1=bv;exports.UniformsLib=Se;exports.UniformsUtils=tm;exports.UnsignedByteType=Qi;exports.UnsignedInt248Type=or;exports.UnsignedIntType=Bi;exports.Vector2=J;exports.Vector3=E;exports.Vector4=st;exports.VectorKeyframeTrack=oa;exports.VideoTexture=Zy;exports.WebGLCubeRenderTarget=Hh;exports.WebGLRenderTarget=zi;exports.WebGLRenderer=qy;exports.WireframeGeometry=Mm;exports.ZeroStencilOp=py;exports.defaultShaderStages=Wm;exports.normalView=di;
|