@supersoniks/concorde 4.9.98-visual-stack.0 → 4.9.98-visual-stack.2
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/.gitlab-ci.yml +0 -13
- package/build-infos.json +1 -1
- package/concorde-3d.bundle.js +201 -152
- package/concorde-3d.es.js +14688 -13906
- package/concorde-core.bundle.js +557 -622
- package/concorde-core.es.js +6025 -5575
- package/concorde-hugging-face-infer.bundle.js +1 -1
- package/concorde-hugging-face-infer.es.js +1 -1
- package/concorde-interactive.bundle.js +1162 -0
- package/concorde-interactive.es.js +10723 -0
- package/concorde-shader.bundle.js +31 -20
- package/concorde-shader.es.js +2773 -2547
- package/concorde-webgpu.bundle.js +43 -32
- package/concorde-webgpu.es.js +1819 -1553
- package/dist/concorde-3d.bundle.js +201 -152
- package/dist/concorde-3d.es.js +14688 -13906
- package/dist/concorde-core.bundle.js +557 -622
- package/dist/concorde-core.es.js +6025 -5575
- package/dist/concorde-hugging-face-infer.bundle.js +1 -1
- package/dist/concorde-hugging-face-infer.es.js +1 -1
- package/dist/concorde-interactive.bundle.js +1162 -0
- package/dist/concorde-interactive.es.js +10723 -0
- package/dist/concorde-shader.bundle.js +31 -20
- package/dist/concorde-shader.es.js +2773 -2547
- package/dist/concorde-webgpu.bundle.js +43 -32
- package/dist/concorde-webgpu.es.js +1819 -1553
- package/dist/docs-mock-api-sw.js +5 -1
- package/dist/docs-mock-api-sw.js.map +2 -2
- package/dist/js/addons/interactive.js +6 -0
- package/dist/js/addons/interactive.js.map +1 -0
- package/dist/js/core/components/functional/3d/3d.js +90 -2
- package/dist/js/core/components/functional/3d/3d.js.map +1 -1
- package/dist/js/core/components/functional/3d/constants.js +1 -0
- package/dist/js/core/components/functional/3d/constants.js.map +1 -1
- package/dist/js/core/components/functional/3d/ensure.js +6 -3
- package/dist/js/core/components/functional/3d/ensure.js.map +1 -1
- package/dist/js/core/components/functional/3d/form-params.js +2 -0
- package/dist/js/core/components/functional/3d/form-params.js.map +1 -1
- package/dist/js/core/components/functional/3d/life.js +2 -1
- package/dist/js/core/components/functional/3d/life.js.map +1 -1
- package/dist/js/core/components/functional/3d/out-publish.js +3 -2
- package/dist/js/core/components/functional/3d/out-publish.js.map +1 -1
- package/dist/js/core/components/functional/3d/playback.js +6 -1
- package/dist/js/core/components/functional/3d/playback.js.map +1 -1
- package/dist/js/core/components/functional/3d/post-bind.js +207 -0
- package/dist/js/core/components/functional/3d/post-bind.js.map +1 -0
- package/dist/js/core/components/functional/3d/post-channels.js +39 -0
- package/dist/js/core/components/functional/3d/post-channels.js.map +1 -0
- package/dist/js/core/components/functional/3d/post-fx.js +495 -0
- package/dist/js/core/components/functional/3d/post-fx.js.map +1 -0
- package/dist/js/core/components/functional/3d/props.js +142 -0
- package/dist/js/core/components/functional/3d/props.js.map +1 -1
- package/dist/js/core/components/functional/3d/reload.js +2 -0
- package/dist/js/core/components/functional/3d/reload.js.map +1 -1
- package/dist/js/core/components/functional/3d/runtime.js +80 -3
- package/dist/js/core/components/functional/3d/runtime.js.map +1 -1
- package/dist/js/core/components/functional/3d/scene-runtime.js +1 -1
- package/dist/js/core/components/functional/3d/scene-runtime.js.map +1 -1
- package/dist/js/core/components/functional/3d/tune.js +21 -0
- package/dist/js/core/components/functional/3d/tune.js.map +1 -1
- package/dist/js/core/components/functional/3d/updated.js +13 -1
- package/dist/js/core/components/functional/3d/updated.js.map +1 -1
- package/dist/js/core/components/functional/if/if.js +65 -7
- package/dist/js/core/components/functional/if/if.js.map +1 -1
- package/dist/js/core/components/functional/interactive/action.js +96 -0
- package/dist/js/core/components/functional/interactive/action.js.map +1 -0
- package/dist/js/core/components/functional/interactive/gamepad.js +206 -0
- package/dist/js/core/components/functional/interactive/gamepad.js.map +1 -0
- package/dist/js/core/components/functional/interactive/gesture.js +148 -0
- package/dist/js/core/components/functional/interactive/gesture.js.map +1 -0
- package/dist/js/core/components/functional/interactive/helpers.js +82 -0
- package/dist/js/core/components/functional/interactive/helpers.js.map +1 -0
- package/dist/js/core/components/functional/interactive/index.js +20 -0
- package/dist/js/core/components/functional/interactive/index.js.map +1 -0
- package/dist/js/core/components/functional/interactive/keyboard.js +183 -0
- package/dist/js/core/components/functional/interactive/keyboard.js.map +1 -0
- package/dist/js/core/components/functional/interactive/matrix.js +201 -0
- package/dist/js/core/components/functional/interactive/matrix.js.map +1 -0
- package/dist/js/core/components/functional/interactive/registry.js +28 -0
- package/dist/js/core/components/functional/interactive/registry.js.map +1 -0
- package/dist/js/core/components/functional/interactive/store.js +264 -0
- package/dist/js/core/components/functional/interactive/store.js.map +1 -0
- package/dist/js/core/components/functional/interactive/ticker.js +182 -0
- package/dist/js/core/components/functional/interactive/ticker.js.map +1 -0
- package/dist/js/core/components/functional/shader/gl-runtime.js +128 -14
- package/dist/js/core/components/functional/shader/gl-runtime.js.map +1 -1
- package/dist/js/core/components/functional/shader/shader.js +154 -57
- package/dist/js/core/components/functional/shader/shader.js.map +1 -1
- package/dist/js/core/components/functional/shader/shadertoy-prelude.js +39 -5
- package/dist/js/core/components/functional/shader/shadertoy-prelude.js.map +1 -1
- package/dist/js/core/components/functional/shader/types.js +58 -7
- package/dist/js/core/components/functional/shader/types.js.map +1 -1
- package/dist/js/core/components/functional/value/value.js +49 -4
- package/dist/js/core/components/functional/value/value.js.map +1 -1
- package/dist/js/core/components/functional/webgpu/gl-fallback.js +27 -6
- package/dist/js/core/components/functional/webgpu/gl-fallback.js.map +1 -1
- package/dist/js/core/components/functional/webgpu/gpu-runtime.js +115 -13
- package/dist/js/core/components/functional/webgpu/gpu-runtime.js.map +1 -1
- package/dist/js/core/components/functional/webgpu/helpers.js +8 -2
- package/dist/js/core/components/functional/webgpu/helpers.js.map +1 -1
- package/dist/js/core/components/functional/webgpu/webgpu.js +34 -1
- package/dist/js/core/components/functional/webgpu/webgpu.js.map +1 -1
- package/dist/js/core/components/ui/_css/rounded.js +34 -0
- package/dist/js/core/components/ui/_css/rounded.js.map +1 -0
- package/dist/js/core/components/ui/_css/type.js +44 -0
- package/dist/js/core/components/ui/_css/type.js.map +1 -1
- package/dist/js/core/components/ui/_i18n/ui-aria-labels.js +95 -0
- package/dist/js/core/components/ui/_i18n/ui-aria-labels.js.map +1 -0
- package/dist/js/core/components/ui/alert/alert.js +72 -87
- package/dist/js/core/components/ui/alert/alert.js.map +1 -1
- package/dist/js/core/components/ui/alert-messages/alert-messages.js +1 -0
- package/dist/js/core/components/ui/alert-messages/alert-messages.js.map +1 -1
- package/dist/js/core/components/ui/badge/badge.js +29 -80
- package/dist/js/core/components/ui/badge/badge.js.map +1 -1
- package/dist/js/core/components/ui/button/button.js +8 -7
- package/dist/js/core/components/ui/button/button.js.map +1 -1
- package/dist/js/core/components/ui/card/card-header.js +7 -2
- package/dist/js/core/components/ui/card/card-header.js.map +1 -1
- package/dist/js/core/components/ui/divider/divider.js +1 -1
- package/dist/js/core/components/ui/divider/divider.js.map +1 -1
- package/dist/js/core/components/ui/form/checkbox/checkbox.js +4 -20
- package/dist/js/core/components/ui/form/checkbox/checkbox.js.map +1 -1
- package/dist/js/core/components/ui/form/fieldset/legend-description.js +1 -1
- package/dist/js/core/components/ui/form/fieldset/legend.js +1 -1
- package/dist/js/core/components/ui/form/input/input.js +12 -15
- package/dist/js/core/components/ui/form/input/input.js.map +1 -1
- package/dist/js/core/components/ui/form/input-autocomplete/input-autocomplete.js +363 -158
- package/dist/js/core/components/ui/form/input-autocomplete/input-autocomplete.js.map +1 -1
- package/dist/js/core/components/ui/form/radio/radio.js +1 -1
- package/dist/js/core/components/ui/form/select/select.js +3 -6
- package/dist/js/core/components/ui/form/select/select.js.map +1 -1
- package/dist/js/core/components/ui/form/textarea/textarea.js +1 -2
- package/dist/js/core/components/ui/form/textarea/textarea.js.map +1 -1
- package/dist/js/core/components/ui/image/image.js +9 -37
- package/dist/js/core/components/ui/image/image.js.map +1 -1
- package/dist/js/core/components/ui/link/link.js +25 -26
- package/dist/js/core/components/ui/link/link.js.map +1 -1
- package/dist/js/core/components/ui/modal/modal-close.js +3 -12
- package/dist/js/core/components/ui/modal/modal-close.js.map +1 -1
- package/dist/js/core/components/ui/modal/modal.js +18 -18
- package/dist/js/core/components/ui/modal/modal.js.map +1 -1
- package/dist/js/core/components/ui/pop/pop.js +131 -112
- package/dist/js/core/components/ui/pop/pop.js.map +1 -1
- package/dist/js/core/components/ui/table/table.js.map +1 -1
- package/dist/js/core/components/ui/theme/theme.js +1 -1
- package/dist/js/core/components/ui/toast/dismissed.js +9 -0
- package/dist/js/core/components/ui/toast/dismissed.js.map +1 -0
- package/dist/js/core/components/ui/toast/render-content.js +14 -0
- package/dist/js/core/components/ui/toast/render-content.js.map +1 -0
- package/dist/js/core/components/ui/toast/toast-item.js +150 -96
- package/dist/js/core/components/ui/toast/toast-item.js.map +1 -1
- package/dist/js/core/components/ui/toast/toast.js +41 -13
- package/dist/js/core/components/ui/toast/toast.js.map +1 -1
- package/dist/js/core/components/ui/tooltip/tooltip.js +144 -143
- package/dist/js/core/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/js/core/decorators/subscriber/ancestorAttribute.js.map +1 -1
- package/dist/js/core/decorators/subscriber/derive.js +3 -1
- package/dist/js/core/decorators/subscriber/derive.js.map +1 -1
- package/dist/js/core/mixins/Fetcher.js.map +1 -1
- package/dist/js/core/mixins/FormCheckable.js +1 -8
- package/dist/js/core/mixins/FormCheckable.js.map +1 -1
- package/dist/js/core/mixins/FormElement.js +26 -53
- package/dist/js/core/mixins/FormElement.js.map +1 -1
- package/dist/js/core/utils/AncestorAttributeObserver.js +130 -55
- package/dist/js/core/utils/AncestorAttributeObserver.js.map +1 -1
- package/dist/js/core/utils/LocationHandler.js +1 -1
- package/dist/js/core/utils/LocationHandler.js.map +1 -1
- package/dist/js/core/utils/dismissed.js +23 -0
- package/dist/js/core/utils/dismissed.js.map +1 -0
- package/dist/js/core/utils/mediaRef.js +37 -0
- package/dist/js/core/utils/mediaRef.js.map +1 -1
- package/dist/js/core/utils/positioning.js +110 -0
- package/dist/js/core/utils/positioning.js.map +1 -0
- package/dist/js/directives.js +1 -2
- package/dist/js/directives.js.map +1 -1
- package/dist/types/addons/interactive.d.ts +6 -0
- package/dist/types/addons/interactive.d.ts.map +1 -0
- package/dist/types/core/components/functional/3d/3d.d.ts +26 -3
- package/dist/types/core/components/functional/3d/3d.d.ts.map +1 -1
- package/dist/types/core/components/functional/3d/constants.d.ts +1 -1
- package/dist/types/core/components/functional/3d/constants.d.ts.map +1 -1
- package/dist/types/core/components/functional/3d/ensure.d.ts +3 -0
- package/dist/types/core/components/functional/3d/ensure.d.ts.map +1 -1
- package/dist/types/core/components/functional/3d/form-params.d.ts.map +1 -1
- package/dist/types/core/components/functional/3d/life.d.ts +2 -0
- package/dist/types/core/components/functional/3d/life.d.ts.map +1 -1
- package/dist/types/core/components/functional/3d/out-publish.d.ts +1 -0
- package/dist/types/core/components/functional/3d/out-publish.d.ts.map +1 -1
- package/dist/types/core/components/functional/3d/playback.d.ts +9 -0
- package/dist/types/core/components/functional/3d/playback.d.ts.map +1 -1
- package/dist/types/core/components/functional/3d/post-bind.d.ts +52 -0
- package/dist/types/core/components/functional/3d/post-bind.d.ts.map +1 -0
- package/dist/types/core/components/functional/3d/post-channels.d.ts +40 -0
- package/dist/types/core/components/functional/3d/post-channels.d.ts.map +1 -0
- package/dist/types/core/components/functional/3d/post-fx.d.ts +73 -0
- package/dist/types/core/components/functional/3d/post-fx.d.ts.map +1 -0
- package/dist/types/core/components/functional/3d/props.d.ts +42 -0
- package/dist/types/core/components/functional/3d/props.d.ts.map +1 -1
- package/dist/types/core/components/functional/3d/reload.d.ts.map +1 -1
- package/dist/types/core/components/functional/3d/runtime.d.ts +16 -1
- package/dist/types/core/components/functional/3d/runtime.d.ts.map +1 -1
- package/dist/types/core/components/functional/3d/scene-runtime.d.ts +1 -1
- package/dist/types/core/components/functional/3d/scene-runtime.d.ts.map +1 -1
- package/dist/types/core/components/functional/3d/tune.d.ts +5 -0
- package/dist/types/core/components/functional/3d/tune.d.ts.map +1 -1
- package/dist/types/core/components/functional/3d/types.d.ts +9 -0
- package/dist/types/core/components/functional/3d/types.d.ts.map +1 -1
- package/dist/types/core/components/functional/3d/updated.d.ts.map +1 -1
- package/dist/types/core/components/functional/if/if.d.ts +14 -5
- package/dist/types/core/components/functional/if/if.d.ts.map +1 -1
- package/dist/types/core/components/functional/interactive/action.d.ts +22 -0
- package/dist/types/core/components/functional/interactive/action.d.ts.map +1 -0
- package/dist/types/core/components/functional/interactive/gamepad.d.ts +37 -0
- package/dist/types/core/components/functional/interactive/gamepad.d.ts.map +1 -0
- package/dist/types/core/components/functional/interactive/gesture.d.ts +26 -0
- package/dist/types/core/components/functional/interactive/gesture.d.ts.map +1 -0
- package/dist/types/core/components/functional/interactive/helpers.d.ts +23 -0
- package/dist/types/core/components/functional/interactive/helpers.d.ts.map +1 -0
- package/dist/types/core/components/functional/interactive/index.d.ts +20 -0
- package/dist/types/core/components/functional/interactive/index.d.ts.map +1 -0
- package/dist/types/core/components/functional/interactive/keyboard.d.ts +37 -0
- package/dist/types/core/components/functional/interactive/keyboard.d.ts.map +1 -0
- package/dist/types/core/components/functional/interactive/matrix.d.ts +31 -0
- package/dist/types/core/components/functional/interactive/matrix.d.ts.map +1 -0
- package/dist/types/core/components/functional/interactive/registry.d.ts +23 -0
- package/dist/types/core/components/functional/interactive/registry.d.ts.map +1 -0
- package/dist/types/core/components/functional/interactive/store.d.ts +46 -0
- package/dist/types/core/components/functional/interactive/store.d.ts.map +1 -0
- package/dist/types/core/components/functional/interactive/ticker.d.ts +33 -0
- package/dist/types/core/components/functional/interactive/ticker.d.ts.map +1 -0
- package/dist/types/core/components/functional/shader/gl-runtime.d.ts +33 -1
- package/dist/types/core/components/functional/shader/gl-runtime.d.ts.map +1 -1
- package/dist/types/core/components/functional/shader/shader.d.ts +28 -7
- package/dist/types/core/components/functional/shader/shader.d.ts.map +1 -1
- package/dist/types/core/components/functional/shader/shadertoy-prelude.d.ts +16 -2
- package/dist/types/core/components/functional/shader/shadertoy-prelude.d.ts.map +1 -1
- package/dist/types/core/components/functional/shader/types.d.ts +29 -5
- package/dist/types/core/components/functional/shader/types.d.ts.map +1 -1
- package/dist/types/core/components/functional/value/value.d.ts +6 -0
- package/dist/types/core/components/functional/value/value.d.ts.map +1 -1
- package/dist/types/core/components/functional/webgpu/gl-fallback.d.ts +4 -0
- package/dist/types/core/components/functional/webgpu/gl-fallback.d.ts.map +1 -1
- package/dist/types/core/components/functional/webgpu/gpu-runtime.d.ts +14 -0
- package/dist/types/core/components/functional/webgpu/gpu-runtime.d.ts.map +1 -1
- package/dist/types/core/components/functional/webgpu/helpers.d.ts +1 -0
- package/dist/types/core/components/functional/webgpu/helpers.d.ts.map +1 -1
- package/dist/types/core/components/functional/webgpu/webgpu.d.ts +7 -1
- package/dist/types/core/components/functional/webgpu/webgpu.d.ts.map +1 -1
- package/dist/types/core/components/ui/_css/rounded.d.ts +3 -0
- package/dist/types/core/components/ui/_css/rounded.d.ts.map +1 -0
- package/dist/types/core/components/ui/_css/type.d.ts +13 -0
- package/dist/types/core/components/ui/_css/type.d.ts.map +1 -1
- package/dist/types/core/components/ui/_i18n/ui-aria-labels.d.ts +83 -0
- package/dist/types/core/components/ui/_i18n/ui-aria-labels.d.ts.map +1 -0
- package/dist/types/core/components/ui/alert/alert.d.ts +14 -12
- package/dist/types/core/components/ui/alert/alert.d.ts.map +1 -1
- package/dist/types/core/components/ui/alert-messages/alert-messages.d.ts.map +1 -1
- package/dist/types/core/components/ui/badge/badge.d.ts +1 -1
- package/dist/types/core/components/ui/badge/badge.d.ts.map +1 -1
- package/dist/types/core/components/ui/button/button.d.ts +13 -29
- package/dist/types/core/components/ui/button/button.d.ts.map +1 -1
- package/dist/types/core/components/ui/card/card-header.d.ts.map +1 -1
- package/dist/types/core/components/ui/divider/divider.d.ts +2 -1
- package/dist/types/core/components/ui/divider/divider.d.ts.map +1 -1
- package/dist/types/core/components/ui/form/checkbox/checkbox.d.ts +25 -73
- package/dist/types/core/components/ui/form/checkbox/checkbox.d.ts.map +1 -1
- package/dist/types/core/components/ui/form/input/input.d.ts +14 -29
- package/dist/types/core/components/ui/form/input/input.d.ts.map +1 -1
- package/dist/types/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +63 -65
- package/dist/types/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts.map +1 -1
- package/dist/types/core/components/ui/form/radio/radio.d.ts +1 -1
- package/dist/types/core/components/ui/form/select/select.d.ts +3 -5
- package/dist/types/core/components/ui/form/select/select.d.ts.map +1 -1
- package/dist/types/core/components/ui/form/textarea/textarea.d.ts +12 -28
- package/dist/types/core/components/ui/form/textarea/textarea.d.ts.map +1 -1
- package/dist/types/core/components/ui/image/image.d.ts +2 -1
- package/dist/types/core/components/ui/image/image.d.ts.map +1 -1
- package/dist/types/core/components/ui/link/link.d.ts +10 -9
- package/dist/types/core/components/ui/link/link.d.ts.map +1 -1
- package/dist/types/core/components/ui/modal/modal-close.d.ts +2 -2
- package/dist/types/core/components/ui/modal/modal-close.d.ts.map +1 -1
- package/dist/types/core/components/ui/pop/pop.d.ts +12 -4
- package/dist/types/core/components/ui/pop/pop.d.ts.map +1 -1
- package/dist/types/core/components/ui/table/table.d.ts +2 -1
- package/dist/types/core/components/ui/table/table.d.ts.map +1 -1
- package/dist/types/core/components/ui/toast/dismissed.d.ts +3 -0
- package/dist/types/core/components/ui/toast/dismissed.d.ts.map +1 -0
- package/dist/types/core/components/ui/toast/render-content.d.ts +7 -0
- package/dist/types/core/components/ui/toast/render-content.d.ts.map +1 -0
- package/dist/types/core/components/ui/toast/toast-item.d.ts +26 -9
- package/dist/types/core/components/ui/toast/toast-item.d.ts.map +1 -1
- package/dist/types/core/components/ui/toast/toast.d.ts +6 -3
- package/dist/types/core/components/ui/toast/toast.d.ts.map +1 -1
- package/dist/types/core/components/ui/toast/types.d.ts +12 -2
- package/dist/types/core/components/ui/toast/types.d.ts.map +1 -1
- package/dist/types/core/components/ui/tooltip/tooltip.d.ts +19 -11
- package/dist/types/core/components/ui/tooltip/tooltip.d.ts.map +1 -1
- package/dist/types/core/decorators/subscriber/ancestorAttribute.d.ts +3 -4
- package/dist/types/core/decorators/subscriber/ancestorAttribute.d.ts.map +1 -1
- package/dist/types/core/decorators/subscriber/derive.d.ts.map +1 -1
- package/dist/types/core/mixins/FormCheckable.d.ts +10 -27
- package/dist/types/core/mixins/FormCheckable.d.ts.map +1 -1
- package/dist/types/core/mixins/FormElement.d.ts +21 -10
- package/dist/types/core/mixins/FormElement.d.ts.map +1 -1
- package/dist/types/core/mixins/FormInput.d.ts +11 -27
- package/dist/types/core/mixins/FormInput.d.ts.map +1 -1
- package/dist/types/core/utils/AncestorAttributeObserver.d.ts +17 -9
- package/dist/types/core/utils/AncestorAttributeObserver.d.ts.map +1 -1
- package/dist/types/core/utils/LocationHandler.d.ts +3 -2
- package/dist/types/core/utils/LocationHandler.d.ts.map +1 -1
- package/dist/types/core/utils/dismissed.d.ts +3 -0
- package/dist/types/core/utils/dismissed.d.ts.map +1 -0
- package/dist/types/core/utils/mediaRef.d.ts +15 -0
- package/dist/types/core/utils/mediaRef.d.ts.map +1 -1
- package/dist/types/core/utils/positioning.d.ts +44 -0
- package/dist/types/core/utils/positioning.d.ts.map +1 -0
- package/dist/types/directives.d.ts +1 -3
- package/dist/types/directives.d.ts.map +1 -1
- package/dist/types/mixins.d.ts +22 -55
- package/dist/types/mixins.d.ts.map +1 -1
- package/docs/assets/{index-FmK4JaIM.js → index-D8MVWqY6.js} +946 -687
- package/docs/assets/index-DiD0qYvE.css +1 -0
- package/docs/crawl/core/components/ui/form/input-autocomplete/input-autocomplete.html +17 -85
- package/docs/crawl/docs/_misc/formelement-subscriber-removal.html +1 -1
- package/docs/crawl/hubs/form-components.html +13 -11
- package/docs/docs-mock-api-sw.js +5 -1
- package/docs/docs-mock-api-sw.js.map +2 -2
- package/docs/index.html +2 -2
- package/docs/llms-full.txt +12 -38
- package/docs/llms.txt +1 -1
- package/docs/src/core/components/functional/sdui/sdui.md +0 -0
- package/docs/src/core/components/ui/form/checkbox/checkbox.md +0 -0
- package/docs/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +14 -118
- package/docs/src/docs/_getting-started/create-a-component.md +0 -0
- package/docs/src/docs/_misc/formelement-subscriber-removal.md +1 -1
- package/docs/src/docs/search/docs-search.json +195 -200
- package/docs/src/tsconfig.json +324 -0
- package/gitlab/job_tests.sh +25 -12
- package/index.html +3 -3
- package/package.json +217 -9
- package/public/docs-mock-api-sw.js +5 -1
- package/public/docs-mock-api-sw.js.map +2 -2
- package/scripts/build-addons.mjs +2 -2
- package/scripts/post-build.mjs +9 -0
- package/src/addons/interactive.ts +5 -0
- package/src/core/components/functional/3d/3d.md +34 -1
- package/src/core/components/functional/3d/3d.spec.ts +42 -0
- package/src/core/components/functional/3d/3d.ts +101 -3
- package/src/core/components/functional/3d/constants.ts +1 -0
- package/src/core/components/functional/3d/ensure.ts +11 -3
- package/src/core/components/functional/3d/form-params.ts +2 -0
- package/src/core/components/functional/3d/life.ts +4 -1
- package/src/core/components/functional/3d/out-publish.ts +4 -3
- package/src/core/components/functional/3d/playback.ts +13 -1
- package/src/core/components/functional/3d/post-bind.ts +262 -0
- package/src/core/components/functional/3d/post-channels.spec.ts +36 -0
- package/src/core/components/functional/3d/post-channels.ts +69 -0
- package/src/core/components/functional/3d/post-fx.ts +594 -0
- package/src/core/components/functional/3d/props.ts +45 -0
- package/src/core/components/functional/3d/reload.ts +2 -0
- package/src/core/components/functional/3d/runtime.ts +93 -4
- package/src/core/components/functional/3d/scene-runtime.ts +3 -0
- package/src/core/components/functional/3d/tune.ts +21 -0
- package/src/core/components/functional/3d/types.ts +9 -0
- package/src/core/components/functional/3d/updated.ts +17 -1
- package/src/core/components/functional/if/if.ts +54 -7
- package/src/core/components/functional/interactive/action.ts +84 -0
- package/src/core/components/functional/interactive/gamepad.ts +197 -0
- package/src/core/components/functional/interactive/gesture.ts +136 -0
- package/src/core/components/functional/interactive/helpers.spec.ts +50 -0
- package/src/core/components/functional/interactive/helpers.ts +97 -0
- package/src/core/components/functional/interactive/index.ts +25 -0
- package/src/core/components/functional/interactive/interactive.md +33 -0
- package/src/core/components/functional/interactive/keyboard.ts +171 -0
- package/src/core/components/functional/interactive/matrix.ts +185 -0
- package/src/core/components/functional/interactive/registry.ts +46 -0
- package/src/core/components/functional/interactive/store.ts +264 -0
- package/src/core/components/functional/interactive/ticker.ts +171 -0
- package/src/core/components/functional/list/list.ts +0 -0
- package/src/core/components/functional/shader/gl-runtime.ts +169 -12
- package/src/core/components/functional/shader/shader.md +27 -4
- package/src/core/components/functional/shader/shader.spec.ts +267 -0
- package/src/core/components/functional/shader/shader.ts +177 -55
- package/src/core/components/functional/shader/shadertoy-prelude.ts +49 -5
- package/src/core/components/functional/shader/types.ts +89 -12
- package/src/core/components/functional/subscriber/subscriber.ts +0 -0
- package/src/core/components/functional/value/value.ts +44 -4
- package/src/core/components/functional/webgpu/gl-fallback.ts +28 -4
- package/src/core/components/functional/webgpu/gpu-runtime.ts +154 -18
- package/src/core/components/functional/webgpu/helpers.ts +8 -2
- package/src/core/components/functional/webgpu/webgpu.md +13 -2
- package/src/core/components/functional/webgpu/webgpu.spec.ts +37 -0
- package/src/core/components/functional/webgpu/webgpu.ts +39 -1
- package/src/core/components/ui/_css/rounded.ts +36 -0
- package/src/core/components/ui/_css/type.ts +49 -0
- package/src/core/components/ui/_i18n/ui-aria-labels.ts +104 -0
- package/src/core/components/ui/alert/alert.md +128 -72
- package/src/core/components/ui/alert/alert.spec.ts +145 -0
- package/src/core/components/ui/alert/alert.ts +86 -91
- package/src/core/components/ui/alert-messages/alert-messages.ts +1 -1
- package/src/core/components/ui/badge/badge.md +126 -78
- package/src/core/components/ui/badge/badge.ts +29 -81
- package/src/core/components/ui/button/button.md +1 -0
- package/src/core/components/ui/button/button.ts +12 -10
- package/src/core/components/ui/card/card-header.ts +7 -2
- package/src/core/components/ui/card/card.md +120 -65
- package/src/core/components/ui/divider/divider.ts +4 -9
- package/src/core/components/ui/form/checkbox/checkbox.md +1 -1
- package/src/core/components/ui/form/checkbox/checkbox.ts +4 -20
- package/src/core/components/ui/form/fieldset/legend-description.ts +1 -1
- package/src/core/components/ui/form/fieldset/legend.ts +1 -1
- package/src/core/components/ui/form/input/input.md +1 -1
- package/src/core/components/ui/form/input/input.ts +25 -27
- package/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +14 -118
- package/src/core/components/ui/form/input-autocomplete/input-autocomplete.ts +419 -187
- package/src/core/components/ui/form/radio/radio.ts +1 -1
- package/src/core/components/ui/form/select/select.ts +3 -6
- package/src/core/components/ui/form/textarea/textarea.md +1 -1
- package/src/core/components/ui/form/textarea/textarea.ts +1 -2
- package/src/core/components/ui/image/image.md +147 -53
- package/src/core/components/ui/image/image.ts +10 -44
- package/src/core/components/ui/link/link.md +2 -2
- package/src/core/components/ui/link/link.ts +42 -37
- package/src/core/components/ui/modal/modal-close.ts +8 -12
- package/src/core/components/ui/modal/modal.ts +18 -18
- package/src/core/components/ui/pop/pop.md +105 -1
- package/src/core/components/ui/pop/pop.ts +145 -141
- package/src/core/components/ui/table/table.ts +2 -8
- package/src/core/components/ui/theme/theme.ts +1 -1
- package/src/core/components/ui/toast/dismissed.ts +14 -0
- package/src/core/components/ui/toast/render-content.ts +13 -0
- package/src/core/components/ui/toast/toast-item.ts +179 -103
- package/src/core/components/ui/toast/toast.ts +58 -21
- package/src/core/components/ui/toast/types.ts +14 -2
- package/src/core/components/ui/tooltip/tooltip.ts +176 -154
- package/src/core/decorators/subscriber/ancestorAttribute.spec.ts +26 -0
- package/src/core/decorators/subscriber/ancestorAttribute.ts +3 -4
- package/src/core/decorators/subscriber/derive.ts +3 -3
- package/src/core/mixins/Fetcher.ts +1 -1
- package/src/core/mixins/FormCheckable.ts +1 -8
- package/src/core/mixins/FormElement.ts +74 -76
- package/src/core/mixins/Subscriber.ts +0 -0
- package/src/core/utils/AncestorAttributeObserver.ts +183 -70
- package/src/core/utils/DataBindObserver.ts +0 -0
- package/src/core/utils/LocationHandler.ts +12 -5
- package/src/core/utils/Objects.ts +0 -0
- package/src/core/utils/dismissed.ts +22 -0
- package/src/core/utils/mediaRef.spec.ts +25 -0
- package/src/core/utils/mediaRef.ts +45 -0
- package/src/core/utils/positioning.spec.ts +208 -0
- package/src/core/utils/positioning.ts +183 -0
- package/src/directives.ts +1 -3
- package/src/docs/_core-concept/dataFlow.md +1 -1
- package/src/docs/_decorators/ancestor-attribute.md +3 -2
- package/src/docs/_getting-started/concorde-outside.md +3 -3
- package/src/docs/_misc/formelement-subscriber-removal.md +115 -0
- package/src/docs/_misc/html-integration.md +2 -0
- package/src/docs/_misc/visual-stack.md +19 -1
- package/src/docs/code.ts +3 -1
- package/src/docs/components/docs-demo-sources.ts +88 -0
- package/src/docs/docs.ts +3 -0
- package/src/docs/example/docs-3d-post-depth-demo.ts +68 -0
- package/src/docs/example/docs-3d-webgpu-live-demo.ts +83 -0
- package/src/docs/example/docs-harris-webgpu-demo.ts +53 -55
- package/src/docs/example/docs-input-autocomplete-demos.ts +110 -0
- package/src/docs/mock-api/router.ts +17 -1
- package/src/docs/navigation/navigation.ts +4 -0
- package/src/docs/search/docs-search.json +922 -1762
- package/src/docs/tailwind/css/tailwind.css +13 -6
- package/src/tsconfig.json +162 -6
- package/src/tsconfig.tsbuildinfo +1 -1
- package/tailwind.config.js +50 -3
- package/vite/config.js +23 -35
- package/vite.config.mts +5 -0
- package/vitest.setup.ts +49 -13
- package/docs/assets/index-BZiZXMU-.css +0 -1
package/concorde-3d.bundle.js
CHANGED
|
@@ -2,44 +2,41 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/var
|
|
5
|
+
*/var pt,Pt;const vs=globalThis,Ta=vs.ShadowRoot&&(vs.ShadyCSS===void 0||vs.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,wa=Symbol(),bc=new WeakMap;let Sc=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==wa)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Ta&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=bc.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&bc.set(t,e))}return e}toString(){return this.cssText}};const Qf=i=>new Sc(typeof i=="string"?i:i+"",void 0,wa),ed=(i,...e)=>{const t=i.length===1?i[0]:e.reduce(((n,r,s)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[s+1]),i[0]);return new Sc(t,i,wa)},td=(i,e)=>{if(Ta)i.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const t of e){const n=document.createElement("style"),r=vs.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=t.cssText,i.appendChild(n)}},Mc=Ta?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Qf(t)})(i):i;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:
|
|
9
|
+
*/const{is:nd,defineProperty:id,getOwnPropertyDescriptor:rd,getOwnPropertyNames:sd,getOwnPropertySymbols:ad,getPrototypeOf:od}=Object,ys=globalThis,Ec=ys.trustedTypes,ld=Ec?Ec.emptyScript:"",cd=ys.reactiveElementPolyfillSupport,Ur=(i,e)=>i,xs={toAttribute(i,e){switch(e){case Boolean:i=i?ld:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},Aa=(i,e)=>!nd(i,e),Tc={attribute:!0,type:String,converter:xs,reflect:!1,useDefault:!1,hasChanged:Aa};Symbol.metadata??=Symbol("metadata"),ys.litPropertyMetadata??=new WeakMap;let Gi=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Tc){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&id(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){const{get:r,set:s}=rd(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:r,set(a){const o=r?.call(this);s?.call(this,a),this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Tc}static _$Ei(){if(this.hasOwnProperty(Ur("elementProperties")))return;const e=od(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ur("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ur("properties"))){const t=this.properties,n=[...sd(t),...ad(t)];for(const r of n)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,r]of t)this.elementProperties.set(n,r)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const r=this._$Eu(t,n);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const r of n)t.unshift(Mc(r))}else e!==void 0&&t.push(Mc(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return td(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&n.reflect===!0){const s=(n.converter?.toAttribute!==void 0?n.converter:xs).toAttribute(t,n.type);this._$Em=e,s==null?this.removeAttribute(r):this.setAttribute(r,s),this._$Em=null}}_$AK(e,t){const n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const s=n.getPropertyOptions(r),a=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:xs;this._$Em=r;const o=a.fromAttribute(t,s.type);this[r]=o??this._$Ej?.get(r)??o,this._$Em=null}}requestUpdate(e,t,n){if(e!==void 0){const r=this.constructor,s=this[e];if(n??=r.getPropertyOptions(e),!((n.hasChanged??Aa)(s,t)||n.useDefault&&n.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:s},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),s!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),r===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[r,s]of this._$Ep)this[r]=s;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[r,s]of n){const{wrapped:a}=s,o=this[r];a!==!0||this._$AL.has(r)||o===void 0||this.C(r,void 0,s,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((n=>n.hostUpdate?.())),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};Gi.elementStyles=[],Gi.shadowRootOptions={mode:"open"},Gi[Ur("elementProperties")]=new Map,Gi[Ur("finalized")]=new Map,cd?.({ReactiveElement:Gi}),(ys.reactiveElementVersions??=[]).push("2.1.1");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const
|
|
14
|
-
\f\r]`,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
13
|
+
*/const Ra=globalThis,bs=Ra.trustedTypes,wc=bs?bs.createPolicy("lit-html",{createHTML:i=>i}):void 0,Ac="$lit$",ai=`lit$${Math.random().toFixed(9).slice(2)}$`,Rc="?"+ai,ud=`<${Rc}>`,Ei=document,Nr=()=>Ei.createComment(""),Or=i=>i===null||typeof i!="object"&&typeof i!="function",Ca=Array.isArray,hd=i=>Ca(i)||typeof i?.[Symbol.iterator]=="function",Pa=`[
|
|
14
|
+
\f\r]`,Fr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Cc=/-->/g,Pc=/>/g,Ti=RegExp(`>|${Pa}(?:([^\\s"'>=/]+)(${Pa}*=${Pa}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Dc=/'/g,Lc=/"/g,Ic=/^(?:script|style|textarea|title)$/i,fd=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),Uc=fd(1),Wi=Symbol.for("lit-noChange"),zt=Symbol.for("lit-nothing"),Nc=new WeakMap,wi=Ei.createTreeWalker(Ei,129);function Oc(i,e){if(!Ca(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return wc!==void 0?wc.createHTML(e):e}const dd=(i,e)=>{const t=i.length-1,n=[];let r,s=e===2?"<svg>":e===3?"<math>":"",a=Fr;for(let o=0;o<t;o++){const l=i[o];let c,h,u=-1,f=0;for(;f<l.length&&(a.lastIndex=f,h=a.exec(l),h!==null);)f=a.lastIndex,a===Fr?h[1]==="!--"?a=Cc:h[1]!==void 0?a=Pc:h[2]!==void 0?(Ic.test(h[2])&&(r=RegExp("</"+h[2],"g")),a=Ti):h[3]!==void 0&&(a=Ti):a===Ti?h[0]===">"?(a=r??Fr,u=-1):h[1]===void 0?u=-2:(u=a.lastIndex-h[2].length,c=h[1],a=h[3]===void 0?Ti:h[3]==='"'?Lc:Dc):a===Lc||a===Dc?a=Ti:a===Cc||a===Pc?a=Fr:(a=Ti,r=void 0);const d=a===Ti&&i[o+1].startsWith("/>")?" ":"";s+=a===Fr?l+ud:u>=0?(n.push(c),l.slice(0,u)+Ac+l.slice(u)+ai+d):l+ai+(u===-2?o:d)}return[Oc(i,s+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};class kr{constructor({strings:e,_$litType$:t},n){let r;this.parts=[];let s=0,a=0;const o=e.length-1,l=this.parts,[c,h]=dd(e,t);if(this.el=kr.createElement(c,n),wi.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(r=wi.nextNode())!==null&&l.length<o;){if(r.nodeType===1){if(r.hasAttributes())for(const u of r.getAttributeNames())if(u.endsWith(Ac)){const f=h[a++],d=r.getAttribute(u).split(ai),_=/([.?@])?(.*)/.exec(f);l.push({type:1,index:s,name:_[2],strings:d,ctor:_[1]==="."?md:_[1]==="?"?gd:_[1]==="@"?_d:Ss}),r.removeAttribute(u)}else u.startsWith(ai)&&(l.push({type:6,index:s}),r.removeAttribute(u));if(Ic.test(r.tagName)){const u=r.textContent.split(ai),f=u.length-1;if(f>0){r.textContent=bs?bs.emptyScript:"";for(let d=0;d<f;d++)r.append(u[d],Nr()),wi.nextNode(),l.push({type:2,index:++s});r.append(u[f],Nr())}}}else if(r.nodeType===8)if(r.data===Rc)l.push({type:2,index:s});else{let u=-1;for(;(u=r.data.indexOf(ai,u+1))!==-1;)l.push({type:7,index:s}),u+=ai.length-1}s++}}static createElement(e,t){const n=Ei.createElement("template");return n.innerHTML=e,n}}function Xi(i,e,t=i,n){if(e===Wi)return e;let r=n!==void 0?t._$Co?.[n]:t._$Cl;const s=Or(e)?void 0:e._$litDirective$;return r?.constructor!==s&&(r?._$AO?.(!1),s===void 0?r=void 0:(r=new s(i),r._$AT(i,t,n)),n!==void 0?(t._$Co??=[])[n]=r:t._$Cl=r),r!==void 0&&(e=Xi(i,r._$AS(i,e.values),r,n)),e}class pd{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??Ei).importNode(t,!0);wi.currentNode=r;let s=wi.nextNode(),a=0,o=0,l=n[0];for(;l!==void 0;){if(a===l.index){let c;l.type===2?c=new Br(s,s.nextSibling,this,e):l.type===1?c=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(c=new vd(s,this,e)),this._$AV.push(c),l=n[++o]}a!==l?.index&&(s=wi.nextNode(),a++)}return wi.currentNode=Ei,r}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class Br{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=zt,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Xi(this,e,t),Or(e)?e===zt||e==null||e===""?(this._$AH!==zt&&this._$AR(),this._$AH=zt):e!==this._$AH&&e!==Wi&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):hd(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==zt&&Or(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ei.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=kr.createElement(Oc(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{const s=new pd(r,this),a=s.u(this.options);s.p(t),this.T(a),this._$AH=s}}_$AC(e){let t=Nc.get(e.strings);return t===void 0&&Nc.set(e.strings,t=new kr(e)),t}k(e){Ca(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,r=0;for(const s of e)r===t.length?t.push(n=new Br(this.O(Nr()),this.O(Nr()),this,this.options)):n=t[r],n._$AI(s),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const n=e.nextSibling;e.remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class Ss{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,s){this.type=1,this._$AH=zt,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=zt}_$AI(e,t=this,n,r){const s=this.strings;let a=!1;if(s===void 0)e=Xi(this,e,t,0),a=!Or(e)||e!==this._$AH&&e!==Wi,a&&(this._$AH=e);else{const o=e;let l,c;for(e=s[0],l=0;l<s.length-1;l++)c=Xi(this,o[n+l],t,l),c===Wi&&(c=this._$AH[l]),a||=!Or(c)||c!==this._$AH[l],c===zt?e=zt:e!==zt&&(e+=(c??"")+s[l+1]),this._$AH[l]=c}a&&!r&&this.j(e)}j(e){e===zt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class md extends Ss{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===zt?void 0:e}}class gd extends Ss{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==zt)}}class _d extends Ss{constructor(e,t,n,r,s){super(e,t,n,r,s),this.type=5}_$AI(e,t=this){if((e=Xi(this,e,t,0)??zt)===Wi)return;const n=this._$AH,r=e===zt&&n!==zt||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==zt&&(n===zt||r);r&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class vd{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Xi(this,e)}}const yd=Ra.litHtmlPolyfillSupport;yd?.(kr,Br),(Ra.litHtmlVersions??=[]).push("3.3.1");const xd=(i,e,t)=>{const n=t?.renderBefore??e;let r=n._$litPart$;if(r===void 0){const s=t?.renderBefore??null;n._$litPart$=r=new Br(e.insertBefore(Nr(),s),s,void 0,t??{})}return r._$AI(i),r};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/const
|
|
19
|
+
*/const Da=globalThis;class zr extends Gi{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=xd(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Wi}}zr._$litElement$=!0,zr.finalized=!0,Da.litElementHydrateSupport?.({LitElement:zr});const bd=Da.litElementPolyfillSupport;bd?.({LitElement:zr}),(Da.litElementVersions??=[]).push("4.2.1");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/const
|
|
23
|
+
*/const Sd=i=>(e,t)=>{t!==void 0?t.addInitializer((()=>{customElements.define(i,e)})):customElements.define(i,e)};/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const
|
|
27
|
+
*/const Md={attribute:!0,type:String,converter:xs,reflect:!1,hasChanged:Aa},Ed=(i=Md,e,t)=>{const{kind:n,metadata:r}=t;let s=globalThis.litPropertyMetadata.get(r);if(s===void 0&&globalThis.litPropertyMetadata.set(r,s=new Map),n==="setter"&&((i=Object.create(i)).wrapped=!0),s.set(t.name,i),n==="accessor"){const{name:a}=t;return{set(o){const l=e.get.call(this);e.set.call(this,o),this.requestUpdate(a,l,i)},init(o){return o!==void 0&&this.C(a,void 0,i,o),o}}}if(n==="setter"){const{name:a}=t;return function(o){const l=this[a];e.call(this,o),this.requestUpdate(a,l,i)}}throw Error("Unsupported decorator location: "+n)};function Xe(i){return(e,t)=>typeof t=="object"?Ed(i,e,t):((n,r,s)=>{const a=r.hasOwnProperty(s);return r.constructor.createProperty(s,n),a?Object.getOwnPropertyDescriptor(r,s):void 0})(i,e,t)}/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2017 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
-
*/function ud(i){return wt({...i,state:!0,attribute:!1})}const Ca="1";function hd(i){const e=i.trim();if(!e)return!1;try{const t=new URL(e,"https://example.invalid/");return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="blob:"}catch{return!1}}let zn=class qt{static getLanguage(){const e=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||e}static getCookies(){return document.cookie.split(";").reduce((e,t)=>{const n=t.indexOf("=");return e[t.substring(0,n).trim()]=t.substring(n+1),e},{})}static nextComposedAncestor(e){return e instanceof Element&&e.assignedSlot?e.assignedSlot:e.parentNode||e.host||null}static everyAncestors(e,t){let n=e;for(;n;){if(!t(n))return;n=n.parentNode||n.host}}static overflowMatches(e,t){return t.includes(e.overflowY)||t.includes(e.overflowX)}static findAncestorByOverflow(e,t){let n=e;for(;n;){if(n instanceof Element&&n.nodeType===1){const r=window.getComputedStyle(n);if(qt.overflowMatches(r,t))return n}n=qt.nextComposedAncestor(n)}return null}static getScrollableAncestor(e){return qt.findAncestorByOverflow(e,["auto","scroll","hidden","overlay"])}static getScrollingAncestor(e){return qt.findAncestorByOverflow(e,["auto","scroll","overlay"])}static scopeAttributeNames(e){const t=e.toLowerCase();return t===e?[e]:[e,t]}static readScopeAttributeOnElement(e,t){for(const n of qt.scopeAttributeNames(t))if(e.hasAttribute(n))return e.getAttribute(n)??"";return null}static getAncestorAttributeValue(e,t){if(!e)return null;let n=e;for(;n;){if(n instanceof HTMLElement){const s=qt.readScopeAttributeOnElement(n,t);if(s!=null)return s}const r=n.parentNode||n.host;if(!r)break;n=r}return null}static getApiConfiguration(e){const t=qt.getAncestorAttributeValue(e,"token"),n=qt.getAncestorAttributeValue(e,"addHTTPResponse")!=null,r=qt.getAncestorAttributeValue(e,"serviceURL");let s=null,a=null;const o=qt.getAncestorAttributeValue(e,"tokenProvider"),l=qt.getAncestorAttributeValue(e,"eventsApiToken");t||(s=qt.getAncestorAttributeValue(e,"userName"),a=qt.getAncestorAttributeValue(e,"password"));const c=qt.getAncestorAttributeValue(e,"credentials")||void 0,h=e.getAttribute("cache"),u=e.hasAttribute("blockUntilDone"),f=e.hasAttribute("keepAlive");return{serviceURL:r,token:t,userName:s,password:a,authToken:l,tokenProvider:o,addHTTPResponse:n,credentials:c,cache:h,blockUntilDone:u,keepAlive:f}}static getClosestElement(e,t){let n=e;for(;n&&!(n.nodeName&&n.nodeName.toLowerCase()===t);){const r=n.parentNode||n.host;if(!r){n=null;break}n=r}return n?.nodeName?n:null}static getClosestForm(e){return qt.getClosestElement(e,"form")}static getAncestorsByTagNames(e,t){const n=new Set(t.map(a=>a.toLowerCase())),r=[];let s=e.parentNode||e.host;for(;s;)s instanceof Element&&n.has(s.tagName.toLowerCase())&&r.push(s),s=s.parentNode||s.host;return r}static getAncestorsBySelectors(e,t){const n=[];let r=e.parentNode||e.host;for(;r;){if(r instanceof Element)for(const s of t)try{if(r.matches(s)){n.push(r);break}}catch{}r=r.parentNode||r.host}return n}static async loadJS(e){if(!hd(e))return!1;const t=typeof document<"u"?new URL(e,document.baseURI).href:e,n=Array.from(document.scripts).find(s=>s.src===t);if(n)return n.dataset.concordeLoaded===Ca?!0:new Promise(s=>{let a=!1;const o=c=>{a||(a=!0,c&&(n.dataset.concordeLoaded=Ca),s(c))};n.addEventListener("load",()=>o(!0),{once:!0}),n.addEventListener("error",()=>o(!1),{once:!0});const l=n.readyState;if(l==="complete"||l==="loaded"){o(!0);return}Promise.resolve().then(()=>{Promise.resolve().then(()=>{a||o(!0)})})});const r=/\.es\.js(\?|#|$)/.test(e)||/[?&]module(?:&|=|$)/.test(e);return new Promise(s=>{const a=document.createElement("script");a.src=e,r&&(a.type="module"),a.onload=()=>{a.dataset.concordeLoaded=Ca,s(!0)},a.onerror=()=>s(!1),document.head.appendChild(a)})}static async loadCSS(e){return new Promise(t=>{const n=document.createElement("link");n.type="text/css",n.rel="stylesheet",n.href=e,n.onload=()=>t(!0),n.onerror=()=>t(!0),document.head.appendChild(n)})}};const gn={Orbit:"orbit",Perspective:"perspective",Ortho:"ortho"},Pa=1e-4,wc=80,fd=16,Ac=250,dd=80,Rc="image/jpeg",pd=.85,vs=45,Da=1,Cc=.5,Pc=50,Dc=8,md=172,Lc=Dc*Math.PI/180,gd=["src","asset","camera","fov","exposure","autoRotate","minDistance","maxDistance","minPolar","maxPolar"],_d=["time","frame","ready","loading","hovering","pointerX","pointerY","camX","camY","camZ","targetX","targetY","targetZ","zoom","hitX","hitY","hitZ","hitObjectId","frameUrl","snapshot","frameSource"];function La(i){return typeof i!="string"?null:i.trim()||null}function vd(i){if(i==null||i==="")return null;if(typeof i=="string")return La(i);if(typeof i!="object")return null;const e=i;return La(e.url)??La(e.blobUrl)}function Ia(i){for(const e of i)try{URL.revokeObjectURL(e)}catch{}}const yd=["gltf","glb","obj","ply","url"];function Ua(i){const e=i.split("?")[0].toLowerCase();return e.endsWith(".glb")?"glb":e.endsWith(".gltf")?"gltf":e.endsWith(".obj")?"obj":e.endsWith(".ply")?"ply":"url"}function xd(i){const e=(i??"").trim().toLowerCase();return e===gn.Perspective||e===gn.Ortho||e===gn.Orbit?e:gn.Orbit}function bd(i){if(i==null||i==="")return null;if(typeof i=="string"){const c=i.trim();return c?{kind:Ua(c),url:c}:null}if(typeof i!="object")return null;const e=i,t=vd(e),r=(typeof e.url=="string"?e.url.trim():"")||t||"",s=e.blob instanceof Blob?e.blob:void 0;if(!r&&!s)return null;const a=typeof e.kind=="string"?e.kind.trim().toLowerCase():"";let o;yd.includes(a)?o=a:r?o=Ua(r):o="url";const l={kind:o};return r&&(l.url=r),s&&(l.blob=s),e.morphTargets&&typeof e.morphTargets=="object"&&(l.morphTargets=e.morphTargets),l}function Sd(i,e){if(typeof i=="number"&&Number.isFinite(i))return i;if(typeof i=="string"&&i.trim()!==""){const t=Number(i);if(Number.isFinite(t))return t}return e}function Md(i){return i===!0||i===1||i==="1"||i==="true"||i==="on"}const It={cameraMode:xd,asset:bd,guessKind:Ua,toNum:Sd,isFormFlagOn:Md};function Ed(i,e){if(i.asset?.url||i.asset?.blob)return i.asset;const t=It.asset(i.src);if(t)return t;const n=e?.get()??{};if("asset"in n){const r=It.asset(n.asset);if(r)return r}return"src"in n?It.asset(n.src):null}const Ic={resolve:Ed};function Na(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function Uc(i){return!i.play||!i.ready||!i.inView||!i.runtime||Na()?!1:i.playOnHover?i.hovering:!0}function Nc(i){const e=i.autoRotate&&i.play&&!Na()&&(!i.playOnHover||i.hovering);i.runtime?.setAutoRotate(!!e)}function Oc(i){i.raf&&(cancelAnimationFrame(i.raf),i.raf=0)}function Td(i,e){i.raf||(i.raf=requestAnimationFrame(e))}function wd(i,e){Nc(i),Uc(i)?Td(i,e):(Oc(i),i.ready&&i.runtime?.render())}const Hn={prefersReducedMotion:Na,shouldAnimate:Uc,syncAutoRotate:Nc,syncPlayback:wd,stopLoop:Oc};function Oa(i,e){return!!i?._proxies_?.get(e)?.hasListener?.()}function Ad(i){if(!i.ready)return;i.outPublisher||i.bindOutPublisher();const e=i.outPublisher;if(!(!e||!Oa(e,"frameSource")))try{e.frameSource?.set({element:i})}catch{}}const Rd={maybePublish:Ad};function Fa(i){return(Number.isFinite(i)?i:0)*Math.PI/180}async function Cd(i){if(!i.runtime)return;const e=++i.loadToken;i.errorMessage="";try{if(await i.runtime.load(Ic.resolve(i,i.formPublisher)),e!==i.loadToken)return;i.ready=!0,i.startTime=performance.now(),i.frame=0,i.lastFormOrbit=null,i.onFormMutation(),Hn.syncAutoRotate(i),i.runtime.render(),i.frameSeq++,i.syncPlayback(),Rd.maybePublish(i),i.dispatchEvent(new CustomEvent("ready",{detail:{ready:!0},bubbles:!0,composed:!0}))}catch(t){if(e!==i.loadToken)return;i.ready=!!i.runtime?.ready,Fc(i,t),i.syncPlayback()}}function Pd(i){i.runtime?.setOrbitLimits({minDistance:i.minDistance,maxDistance:i.maxDistance,minPolar:Fa(i.minPolar),maxPolar:Fa(i.maxPolar)})}function Fc(i,e){const t=e instanceof Error?e.message:String(e);i.errorMessage=t,i.dispatchEvent(new CustomEvent("error",{detail:{message:t},bubbles:!0,composed:!0}))}const An={run:Cd,applyOrbitLimits:Pd,emitError:Fc,degToRad:Fa};function Dd(i,e){"fov"in e&&(i.fov=It.toNum(e.fov,i.fov)),"exposure"in e&&(i.exposure=It.toNum(e.exposure,i.exposure)),"minDistance"in e&&(i.minDistance=It.toNum(e.minDistance,i.minDistance)),"maxDistance"in e&&(i.maxDistance=It.toNum(e.maxDistance,i.maxDistance)),"minPolar"in e&&(i.minPolar=It.toNum(e.minPolar,i.minPolar)),"maxPolar"in e&&(i.maxPolar=It.toNum(e.maxPolar,i.maxPolar)),"autoRotate"in e&&(i.autoRotate=It.isFormFlagOn(e.autoRotate)),"camera"in e&&typeof e.camera=="string"&&(i.camera=It.cameraMode(e.camera))}function Ld(i,e){let t=!1;if("asset"in e){const n=It.asset(e.asset);n&&(i.asset=n,t=!0)}return"src"in e&&typeof e.src=="string"&&!("asset"in e)&&i.src!==e.src&&(i.src=e.src,t=!0),t}function Id(i){return"minDistance"in i||"maxDistance"in i||"minPolar"in i||"maxPolar"in i||"camera"in i}function Ud(i,e){i.runtime&&("exposure"in e&&i.runtime.setExposure(i.exposure),"fov"in e&&i.runtime.setFov(i.fov),"camera"in e&&i.runtime.applyCameraMode(It.cameraMode(i.camera)),Id(e)&&An.applyOrbitLimits(i),"autoRotate"in e&&Hn.syncAutoRotate(i))}const ka={applyScalars:Dd,applyAsset:Ld,pushToRuntime:Ud};function Nd(i,e){return i?Math.abs(i.yaw-e.yaw)>Pa||Math.abs(i.pitch-e.pitch)>Pa||Math.abs(i.distance-e.distance)>Pa:!0}function Od(i,e){const t=i.runtime.snapshot({time:0,frame:i.frame,hovering:i.hovering?1:0,pointerX:i.pointerX,pointerY:i.pointerY});return{yaw:"yaw"in e?It.toNum(e.yaw,t.yaw):t.yaw,pitch:"pitch"in e?It.toNum(e.pitch,t.pitch):t.pitch,distance:"distance"in e?It.toNum(e.distance,t.distance):t.distance}}function kc(i,e){if(!i.runtime||!("distance"in e||"yaw"in e||"pitch"in e))return;const t=Od(i,e),n=i.lastFormOrbit;Nd(n,t)&&(i.lastFormOrbit=t,i.autoRotate&&n&&(i.autoRotate=!1,Hn.syncAutoRotate(i)),i.runtime.setOrbitSpherical(t.yaw,t.pitch,t.distance),i.runtime.render())}function Fd(i,e){ka.applyScalars(i,e);const t=ka.applyAsset(i,e);if(!i.runtime){t&&An.run(i);return}ka.pushToRuntime(i,e),kc(i,e),t&&An.run(i)}const kd={applyFormParams:Fd,applyFormOrbit:kc};function Bc(i,e){const t=e?.trim();return t||zn.getAncestorAttributeValue(i,"dataProvider")||zn.getAncestorAttributeValue(i,"formDataProvider")||""}function Bd(i,e,t){const n=e?.trim();return n||Bc(i,t)}const Ba={resolveFormProviderId:Bc,resolveOutProviderId:Bd,asset:Ic,formParams:kd};let zd=class{static async queueTaskPromise(){return new Promise(e=>{window.queueMicrotask(()=>e(null))})}static async delayPromise(e){return new Promise(t=>{setTimeout(t,e)})}},zc="sonic";typeof __SONIC_PREFIX__<"u"&&(zc=__SONIC_PREFIX__);let Hc=zc.replace(/-([a-z])/g,i=>i[1].toUpperCase());const Hd=Hc.charAt(0).toUpperCase()+Hc.slice(1);let Vd=class zi{static areEqual(e,t){return e.length===t.length?e.every((n,r)=>n===t[r]):!1}static from2d(e){return{to1D:()=>{let t=[];return e.forEach(n=>t=t.concat(n)),this.from(t)}}}static from(e){return{get:()=>e||[],everyItem:()=>({has:()=>({same:()=>({value:()=>({forKey:t=>{if(e.length<1)return!0;const n=(e[0]||{})[t];return e.every(r=>(r||{})[t]==n)}})})}),value:()=>({forKey:t=>zi.from(e.map(n=>n[t]))}),copy:()=>({fromKey:t=>({toKey:n=>{e.forEach(r=>{r[n]=Array.isArray(r[t])?[...r[t]]:typeof r[t]=="object"&&r[t]!=null?{...r[t]}:r[t]})}})})}),map:t=>zi.from(e.map(t)),filter:t=>zi.from(e.filter(t)),find:t=>e.find(t),some:t=>e.some(t),every:t=>e.every(t),group:()=>({byKey:t=>{const n=[],r=new Map;for(const s of e){const a=s[t];if(!r.has(a)){const o=n.length;r.set(a,o);const l={items:[]};l[t]=a,n.push(l)}n[r.get(a)].items.push(s)}return zi.from(n)}}),without:()=>({duplicates:()=>({forKey:t=>{const n=[...new Set(e.map(r=>r[t]))];return zi.from(n.map(r=>e.find(s=>s[t]==r)))}}),itemsIn:t=>({havingSameValue:()=>({forKey:n=>{const r=(s,a)=>o=>s[a]!=o[a];return zi.from(e.filter(s=>t.every(r(s,n))))}})})})}}},za=class{static ucFirst(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.substring(1)}static minutesDuration(e,t="",n="long"){t||(t=zn.getLanguage());const r=(c,h)=>[Math.floor(c/h),c%h];function s(c,h,u){return new Intl.NumberFormat(c,{style:"unit",unit:h,unitDisplay:u}).format}const[a,o]=r(e,60),l=[];return a&&l.push(s(t,"hour",n)(a)),o&&l.push(s(t,"minute",n)(o)),new Intl.ListFormat(t,{style:"long",type:"conjunction"}).format(l)}static js(e){try{return Function("return "+e)()}catch{return""}}};class Vc{constructor(e){this.path=e}toString(){return this.path}}function Gc(i){return new Proxy(i,{get(e,t){if(t==="path")return e.path;if(t==="toString")return e.toString.bind(e);if(t===Symbol.toStringTag)return"DataProviderKey";if(typeof t=="symbol")return e[t];const n=e.path?`${e.path}.${String(t)}`:String(t);return Gc(new Vc(n))}})}const Gd=/\$\{|\{\$/;function Wd(i){return Gd.test(i)}function Xd(i){const e=i;if(Wd(e))throw new Error("Static publisher path required for get/set/dp. Use @subscribe, @publish, or @handle for dynamic DataProviderKey paths.");return e}const ys=function(i){return this instanceof ys?Gc(new Vc(i)):new ys(i)};let xs=class ei{static shallowEqual(e,t,n=!0){const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length&&n)return!1;for(const a of r){const o=e[a],l=t[a];if(n?o!==l:o!=l)return!1}return!0}static deepEqual(e,t,n=!0){const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length&&n)return!1;for(const a of r){const o=e[a],l=t[a],c=ei.isObject(o)&&ei.isObject(l),h=n?o!==l:o!=l;if(c&&!ei.deepEqual(o,l)||!c&&h)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}static isUndefindOrNull(e){return e==null}static isEmpty(e){return ei.isUndefindOrNull(e)?!0:Object.keys(e).length===0}static traverse(e,t,n=!1){for(const r of t){const s=e[r];if(s===void 0)return;n&&ei.isObject(s)?e=Object.assign(Array.isArray(s)?[]:{},e,s):e=e[r]}return e}static traverseDotNotation(e,t,n=!1){return ei.traverse(e,t.split("."),n)}static getURLSearchArray(e,t=""){let n=[];for(let r in e){const s=e[r];t&&(r=t+"["+r+"]"),ei.isObject(s)?n=[...n,...this.getURLSearchArray(s,r)]:n.push(`${r}=${s}`)}return n}static getURLSearchString(e){return ei.getURLSearchArray(e,"").join("&")}};xs.traverseDotNotation;function $d(i){return!1}function bs(i){return Object.prototype.hasOwnProperty.call(i,"__value")}function ni(i){return typeof i=="object"&&i!==null}let Wi="sonic";typeof __SONIC_PREFIX__>"u"&&(Wi="sonic");const Ha=Wi=="sonic"?"publisher-proxies-data":Wi+"-publisher-proxies-data",_i=class _i{constructor(e,t,n){for(this._proxies_=new Map,this._is_savable_=!1,this._expiration_delay_=1e3*60*60*12,this._invalidate_on_page_show_=!1,this._invalidateListeners_=new Set,this._formInvalidateListeners_=new Set,this._assignListeners_=new Set,this._mutationListeners_=new Set,this._fillListeners_=new Set,this._templateFillListeners_=new Set,this._lockInternalMutationPublishing_=!1,this._instanceCounter_=0,this._assignmentId_=0,this._value_=e,this.parent=t||null,this._parentKey_=n,this.root=this,this._instanceCounter_=0;this.root.parent;)this.root=this.root.parent}delete(){for(const e in this._proxies_.keys())e!="_parent_"&&this._proxies_.get(e)?.delete();this._invalidateListeners_.clear(),this._formInvalidateListeners_.clear(),this._assignListeners_.clear(),this._mutationListeners_.clear(),this._fillListeners_.clear(),this._templateFillListeners_.clear(),this._proxies_.clear(),_i.instances.delete(this._instanceCounter_)}hasListener(){return this._templateFillListeners_.size>0||this._assignListeners_.size>0||this._invalidateListeners_.size>0||this._formInvalidateListeners_.size>0||this._mutationListeners_.size>0||this._fillListeners_.size>0}_publishInternalMutation_(e=!1){if(this._mutationListeners_.forEach(t=>t()),this._is_savable_&&!Gt.changed){Gt.changed=!0,Gt.saveId++;const t=Gt.saveId;setTimeout(()=>Gt.getInstance().saveToLocalStorage(t),1e3)}e||this.parent&&this.parent._publishInternalMutation_()}async _publishAssignement_(e=!1){if(this._assignmentId_++,this._assignmentId_!==this._assignmentId_)return;const n=this.get();this._assignListeners_.forEach(r=>{r(n)}),this._publishInternalMutation_(e)}_publishInvalidation_(){this._invalidateListeners_.forEach(e=>e())}_publishFormInvalidation_(){this._formInvalidateListeners_.forEach(e=>e())}_publishDynamicFilling_(e,t){this._fillListeners_.forEach(n=>{n[e]!==t&&(n[e]=t)}),this._publishTemplateFilling_(e,t)}_publishTemplateFilling_(e,t){this._templateFillListeners_.forEach(n=>{const r=Object.getOwnPropertyDescriptor(n,e);r&&!r.set&&!r.writable||(n.propertyMap&&n.propertyMap[e]&&(e=n.propertyMap[e]),typeof n[e]<"u"&&n[e]!==t&&(n[e]=t))})}onAssign(e,t=!0){typeof e=="function"&&(this._assignListeners_.has(e)||(this._assignListeners_.add(e),t&&e(this.get())))}offAssign(e){this._assignListeners_.delete(e)}onInvalidate(e){typeof e=="function"&&this._invalidateListeners_.add(e)}offInvalidate(e){typeof e=="function"&&this._invalidateListeners_.delete(e)}invalidate(){this._publishInvalidation_()}onFormInvalidate(e){typeof e=="function"&&this._formInvalidateListeners_.add(e)}offFormInvalidate(e){typeof e=="function"&&this._formInvalidateListeners_.delete(e)}invalidateForm(){this._publishFormInvalidation_()}onInternalMutation(e){typeof e=="function"&&(this._mutationListeners_.add(e),e())}offInternalMutation(e){typeof e=="function"&&this._mutationListeners_.delete(e)}startTemplateFilling(e){if(this._templateFillListeners_.add(e),typeof this._value_=="object")for(const t in this._value_){let n=t;const r=this._value_[t];e.propertyMap&&e.propertyMap[t]&&(n=e.propertyMap[t]),typeof e[t]<"u"&&e[t]!==r&&(e[n]=r)}}stopTemplateFilling(e){this._templateFillListeners_.delete(e)}startDynamicFilling(e){this._fillListeners_.add(e);for(const t in this._value_){const n=this._value_[t];e[t]!==n&&(e[t]=n)}}stopDynamicFilling(e){this._fillListeners_.delete(e)}set(e,t=!1){if(this._value_===e||ni(this._value_)&&ni(e)&&e&&bs(this._value_)&&bs(e)&&this._value_.__value===e.__value||!ni(e)&&e===this._value_.__value)return!0;this._value_=ni(e)?e:{__value:e},this._cachedGet_=void 0;const n=bs(this._value_);if(this._parentKey_&&this.parent){const r=bs(this._value_)?this._value_.__value:this._value_;if(this.parent?.get()==null&&this.parent?.get()==null)if(isNaN(Number(this._parentKey_)))this.parent.set({[this._parentKey_]:r});else{const s=[];s[Number(this._parentKey_)]=r,this.parent.set(s)}else this.parent._value_[this._parentKey_]=r}if(n)return this._proxies_.forEach((r,s)=>{s!="_parent_"&&(r.set(null),this._publishDynamicFilling_(s,null))}),this._publishAssignement_(t),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_.__value),!0;for(const r in this._value_)this._value_[r]===void 0&&delete this._value_[r];if(this._proxies_.forEach((r,s)=>{const a=this._value_[s];s!="_parent_"&&a===void 0&&a!==null&&isNaN(Number(s))&&(r.set(null),this._publishDynamicFilling_(s,null))}),this._publishAssignement_(),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_),ni(this._value_))for(const r in this._value_){const s=e[r],o=ni(s)?s:{__value:s};if(!this._proxies_.has(r)){this._publishDynamicFilling_(r,s);continue}this._proxies_.get(r)?.set(o,!0),this._publishDynamicFilling_(r,s)}return!0}get(){if(jd(this),this._cachedGet_!==void 0)return this._cachedGet_;if(Object.prototype.hasOwnProperty.call(this._value_,"__value")){const e=this._value_.__value;return this._cachedGet_=e??null}return this._cachedGet_=this._value_!=null?this._value_:null}get $tag(){return this._instanceCounter_||(_i.instancesCounter++,this._instanceCounter_=_i.instancesCounter),_i.instances.set(this._instanceCounter_,this),"<"+Wi+'-publisher-proxy publisher="'+this._instanceCounter_+'"></'+Wi+"-publisher-proxy>"}};_i.instances=new Map,_i.instancesCounter=0;let Ss=_i;const Wc=[];function jd(i){Wc.length>0&&Wc[0].add(i)}const mt=class mt{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],mt.instance!=null)throw"Singleton / use getInstance";mt.instance=this,this.isLocalStrorageReady=this.cleanStorageData(),mt.initPageShowHandler()}static initPageShowHandler(){mt.pageShowHandlerInitialized||(mt.pageShowHandlerInitialized=!0,window.addEventListener("pageshow",e=>{e.persisted&&mt.getInstance().invalidateAll()}))}invalidateAll(){this.publishers.forEach(e=>{e._invalidate_on_page_show_&&e.invalidate()})}async cleanStorageData(){return new Promise(e=>{(async()=>{try{let n=localStorage.getItem(Ha),r=null;if(n&&(r=await this.decompress(n,"gzip")),r)try{this.localStorageData=JSON.parse(r)}catch{this.localStorageData={}}else n=await this.compress("{}","gzip"),localStorage.setItem(Ha,n),this.localStorageData={};const s=1e3*60*60*12;for(const a in this.localStorageData){const o=this.localStorageData[a],l=new Date().getTime()-(o.expirationDelayMs||s);o.lastModifiationMS<l&&delete this.localStorageData[a]}e(!0)}catch{window.requestAnimationFrame(()=>{e(!1)}),console.warn("no publisher cache in this browser")}})()})}static getInstance(e){if(e){const t=mt.instances.get(e);return t||(console.warn("No PublisherManager instance registered with id:",e,"creating new one"),new mt)}return mt.instance==null?new mt:mt.instance}static get(e,t){return mt.getInstance().get(e,t)}async setLocalData(e,t){await this.isLocalStrorageReady,e.set(this.localStorageData[t+"¤lang_"+zn.getLanguage()]?.data||e.get())}get(e,t){const n=t?.localStorageMode==="enabled",r=t?.invalidateOnPageShow===!0;if(!this.publishers.has(e)){const o=Va({});this.set(e,o)}const s=this.publishers.get(e);return n&&this.initialisedData.indexOf(e)===-1&&(t?.expirationDelayMs&&(s._expiration_delay_=t.expirationDelayMs),s._is_savable_=!0,this.initialisedData.push(e),this.setLocalData(s,e)),r&&(s._invalidate_on_page_show_=r),this.publishers.get(e)}set(e,t){this.publishers.set(e,t)}delete(e){return this.publishers.has(e)?(this.publishers.delete(e),!0):!1}async saveToLocalStorage(e=0){if(!(e!==mt.saveId&&e%10!=0))try{if(!mt.changed||mt.saving)return;mt.saving=!0,mt.changed=!1;const t=Array.from(this.publishers.keys());let n=!1;for(const r of t){const s=this.publishers.get(r);if(!s?._is_savable_)continue;const a=s?.get();a&&(this.localStorageData[r+"¤lang_"+zn.getLanguage()]={lastModifiationMS:new Date().getTime(),expirationDelayMs:s._expiration_delay_,data:a},n=!0)}if(n){const r=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem(Ha,r)}if(mt.saving=!1,mt.changed){mt.saveId++;const r=mt.saveId;setTimeout(()=>this.saveToLocalStorage(r),1e3)}}catch{mt.saving=!1}}async compress(e,t){const n=new TextEncoder().encode(e),r=window,s=new r.CompressionStream(t),a=s.writable.getWriter();a.write(n),a.close();const o=await new Response(s.readable).arrayBuffer(),l=new Uint8Array(o);let c="";for(let h=0;h<l.length;h++)c+=String.fromCharCode(l[h]);return btoa(c)}async decompress(e,t){const n=atob(e),s=Uint8Array.from(n,h=>h.charCodeAt(0)).buffer,a=window,o=new a.DecompressionStream(t),l=o.writable.getWriter();l.write(s),l.close();const c=await new Response(o.readable).arrayBuffer();return new TextDecoder().decode(c)}};mt.buildDate="Tue Sep 29 2026 21:11:50 GMT+0200 (Central European Summer Time)",mt.changed=!1,mt.saving=!1,mt.saveId=0,mt.instance=null,mt.instances=new Map,mt.pageShowHandlerInitialized=!1;let Gt=mt;if(typeof window<"u"){const i=window,e=Hd+"PublisherManager",t=i[e]||Gt;if(i[e]||(i[e]=Gt),t!==Gt){const n=["instance","instances","changed","saving","saveId","pageShowHandlerInitialized"];for(const r of n)Object.defineProperty(Gt,r,{configurable:!0,get(){return t[r]},set(s){t[r]=s}})}}const qd=new Set(["invalidate","onInvalidate","offInvalidate","invalidateForm","onFormInvalidate","offFormInvalidate","onAssign","offAssign","startDynamicFilling","stopDynamicFilling","startTemplateFilling","stopTemplateFilling","onInternalMutation","offInternalMutation","set","get","$tag","_cachedGet_","_templateFillListeners_","_fillListeners_","_assignListeners_","_invalidateListeners_","_formInvalidateListeners_","_publishInternalMutation_","hasListener","delete","_mutationListeners_","_publishDynamicFilling_","_publishInvalidation_","_publishFormInvalidation_","_publishTemplateFilling_","_publishAssignement_","_proxies_","parent","_parentKey_","_value_","_is_savable_","_expiration_delay_","_lockInternalMutationPublishing_","_instanceCounter_","_assignmentId_","_invalidate_on_page_show_"]);function Yd(i,e){return{get:function(t,n){if(typeof n=="string"&&qd.has(n))return i[n];if(n==Symbol.toPrimitive)return()=>e().get();if(!i._proxies_.has(n)){const r=i._value_[n],s=Va(ni(r)?r:{__value:r},i,n);s._proxies_.set("_parent_",e()),i._proxies_.set(n,s)}return i._proxies_.get(n)},set:function(t,n,r){if(n=="_value_")return i._value_=r,!0;if(n=="_cachedGet_")return i._cachedGet_=r,!0;if(n=="_assignmentId_")return i._assignmentId_=r,!0;if(n=="_is_savable_")return i._is_savable_=r,!0;if(n=="_expiration_delay_")return i._expiration_delay_=r,!0;if(n=="_invalidate_on_page_show_")return i._invalidate_on_page_show_=r,!0;if(n=="_instanceCounter_")return i._instanceCounter_=r,!0;if(!i._proxies_.has(n)){const a=Va({},i,n);a._proxies_.set("_parent_",e()),i._proxies_.set(n,a)}return i._value_[n]!==r&&(i._value_[n]=r,i._publishDynamicFilling_(n,r),i._proxies_.get(n)?.set(ni(r)?r:{__value:r})),!0},deleteProperty:function(t,n){return i._publishDynamicFilling_(n,null),i._proxies_.get(n)?.set(null),delete i._value_[n]},has:function(t,n){return n in i._value_&&n!="_lockInternalMutationPublishing_"},defineProperty:function(t,n,r){return r&&"value"in r&&(i._value_[n]=r.value),!0},getOwnPropertyDescriptor:function(t,n){return{enumerable:!0,configurable:!0}},ownKeys:function(t){return i._value_.__value?Object.keys(i._value_.__value):Object.keys(i._value_)}}}function Va(i,e=null,t){const n=new Ss(i,e,t);let r=null;const s=Yd(n,()=>r);return r=new Proxy(n,s),r}class Kd extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=e=>{this.innerHTML=e.toString()}}connectedCallback(){this.publisherId=this.getAttribute("publisher")||"",this.publisher=Ss.instances.get(parseInt(this.publisherId)),this.publisher?.onAssign(this.onAssign)}disconnectedCallback(){this.publisher?.offAssign(this.onAssign)}}try{customElements.define(Wi+"-publisher-proxy",Kd)}catch{}const Zd=(i,e)=>{{const t=i.split("."),n=t.shift()||"";let r=Gt.get(n,e);r=xs.traverse(r,t);const s=new Set;return s.add(r),s}};function Xc(i,e,t){const n=Xd(i);return Zd(n,t).values().next().value}function Jd(i,e){return $d()?Xc(i,void 0,e):Xc(i)}let Ga=(ut=class{static disable(){this.enabled&&(this.enabled=!1,Array.from(ut.observedElements.keys()).forEach(e=>ut.unObserve(e)))}static observe(e){if(!e||!ut.enabled||ut.observedElements.has(e))return;const t=new MutationObserver(ut.onMutation),n={};n.childList=!0,n.subtree=!0,n.attributes=!0,n.attributeFilter=["data-bind"],t.observe(e,n),e.querySelectorAll("[data-bind]").forEach(r=>ut.addPublisherListeners(r)),ut.observedElements.set(e,t)}static unObserve(e){if(!e)return;const t=this.observedElements.get(e);t&&(t.disconnect(),e.querySelectorAll("[data-bind]").forEach(n=>ut.removePublisherListeners(n)))}static onAdded(e){e.hasAttribute&&e.hasAttribute("data-bind")&&ut.addPublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(t=>ut.addPublisherListeners(t)):e.childNodes.forEach(t=>ut.onAdded(t))}static onRemoved(e){e.hasAttribute&&e.hasAttribute("data-bind")&&ut.removePublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(t=>ut.removePublisherListeners(t)):e.childNodes.forEach(t=>ut.onRemoved(t))}static onMutation(e){for(const t of e)switch(t.type){case"attributes":ut.addPublisherListeners(t.target);break;case"childList":t.addedNodes.forEach(n=>{ut.onAdded(n)}),t.removedNodes.forEach(n=>{ut.onRemoved(n)});break}}static removePublisherListeners(e){const t=ut.publisherListeners.get(e);t&&(ut.publisherListeners.delete(e),t.forEach(n=>{n.publisher?.offAssign(n.onAssign)}))}static getVariablesDescriptor(e){let t=e.match(/(\$(?:\w+\\?\.?)+)/g);return t?t=t.map(n=>n.replace("$","")):t=[e],t=t.filter(n=>n.length>0),{expression:e.replace("\\",""),variables:t.map(n=>n.split(/\b\.\b/).map(r=>r.replace("\\","")))}}static getDataBindItems(e){return"attributes"in e?Array.from(e.attributes).filter(t=>t.name.indexOf("::")==0).map(t=>({propertyToUpdate:t.name.substring(2).replace(/-((html)|\w)/g,r=>r.substring(1).toUpperCase()),bindedVariablesDescriptor:ut.getVariablesDescriptor(t.value)})):[]}static getSubPublisher(e,t){if(!t)return e;for(const n of t)if(n!="_self_"){if(!e)return null;e=e[n]}return e}static addPublisherListeners(e){ut.removePublisherListeners(e);const t=zn.getAncestorAttributeValue(e.parentNode||e.host||e,"dataProvider");if(!t)return;const n=Gt.getInstance().get(t),r=ut.getDataBindItems(e),s=[];r.forEach(a=>{const o=a.bindedVariablesDescriptor,l=a.propertyToUpdate;for(const c of o.variables){const h=c;let u=n;u=ut.getSubPublisher(n,h);const f=e,d={publisher:u,onAssign:()=>{const _=o.variables.map(m=>ut.getSubPublisher(n,m)?.get());let b=o.expression,g=!1;if(_.length==1&&o.variables[0].join(".")==b.substring(1)){let m=_[0];m===null&&(m=""),f[l]=m;return}for(let m=0;m<_.length;m++){let S=_[m];const y=o.variables[m];S===null&&(g=!0,S=void 0),b=b.replace("$"+y.join("."),S)}if(b.indexOf("|")!=-1){const m=b.indexOf("|");if(m==0)b=za.js(b.substring(1));else{const S=b.substring(0,m),y=b.substring(m+1),M=za[S];b=g?"":M?M(y):b}}else b=g?"":b;f[l]=b}};u?.onAssign(d.onAssign),s.push(d)}}),ut.publisherListeners.set(e,s)}},ut.observedElements=new Map,ut.enabled=!0,ut.publisherListeners=new Map,ut);Ga.observe(document.documentElement),window.SonicDataBindObserver||(window.SonicDataBindObserver=Ga);let Qd=(Pt=class{static listen(){if(!Pt.listening)return;const e=document.location?.href.replace(document.location.origin,"");Pt.prevURL&&Pt.prevURL!=e&&(Pt.prevURL=e,Pt.listeners.forEach(t=>{t.location=e})),window.requestAnimationFrame(Pt.listen)}static offChange(e){const t=Pt.listeners.indexOf(e);t!=-1&&(Pt.listeners.splice(t,1),Pt.listeners.length==0&&(Pt.listening=!1))}static onChange(e){Pt.listening||(Pt.listening=!0,Pt.listen()),Pt.listeners.push(e),e.location=this.prevURL}static changeFromComponent(e){const t=e.goBack,n=document.referrer;if(t!=null){const c=document.location.origin,h=(t||c).toString(),f=n.indexOf("http")==0?new URL(n).origin!=c:!1,d=n=="",_=history.length<3,b=d&&_,g=h!=document.location.href;if(f&&g||b){const S=history.state||{};S.concorde=S.concorde||{},S.concorde.hasDoneHistoryBack=!0,history.pushState(S,document.title),history.back(),document.location.replace(h)}else history.back();return}let r=e.getAttribute("to")||"";if(r||(r=e.href?.toString()||""),!r)return;if(r.indexOf("#")==0){document.location.hash=r.substring(1);return}const s=new URL(r,document.location.href),a=s.pathname.split("/"),o=[];let l="";for(const c of a)c!=l&&o.push(c),l=c;r="/"+o.join("/")+s.search+(s.hash?+s.hash:""),e.hasAttribute("pushState")?history.pushState(null,"",r):e.hasAttribute("replaceState")?history.replaceState(null,"",r):document.location.href=r}static updateComponentActiveState(e){if(e.autoActive=="disabled")return;const t=e.href?.toString()||"";if(e.href&&t.indexOf("http")!=0){const n=new URL(t,document.location.href),r=new URL(e.location||"",document.location.origin);let s=!1;e.autoActive=="strict"?s=n.pathname==r.pathname&&n.hash==r.hash&&n.search==r.search:e.autoActive=="strict-path-only"?s=n.pathname==r.pathname&&n.hash==r.hash:s=r.href.indexOf(n.href)==0,s?e.setAttribute("active","true"):e.removeAttribute("active")}}},Pt.listeners=[],Pt.listening=!1,Pt.prevURL=document.location?.href.replace(document.location.origin,""),Pt);function $c(i){if(i==null||typeof i!="object"||Array.isArray(i))return i;const e={...i};return delete e._sonic_http_response_,e}const _t=class _t{constructor(e){this.addHTTPResponse=!1,this.cache="default",this.isServiceSimulated=!1,this.blockUntilDone=!1,this.keepAlive=!1,this.serviceURL=e.serviceURL,this.blockUntilDone=e.blockUntilDone||!1,this.serviceURL=="publisher://"&&(this.isServiceSimulated=!0),this.serviceURL||(this.serviceURL=document.location.origin),this.userName=e.userName,this.password=e.password,e.token&&(this.token=e.token),this.tokenProvider=e.tokenProvider,this.authToken=e.authToken,this.addHTTPResponse=e.addHTTPResponse||!1,this.credentials=e.credentials,this.cache=e.cache||"default",this.keepAlive=e.keepAlive||!1}set token(e){if(this._token=e,!e){_t.tokens.delete(this.serviceURL);return}_t.invalidTokens.includes(e)||_t.tokens.set(this.serviceURL,e)}get token(){return _t.invalidTokens.includes(this._token)?_t.tokens.get(this.serviceURL):this._token}handleInvalidToken(e){e&&(_t.invalidTokens.includes(e)||(_t.invalidTokens.push(e),this.token=null))}async handleResult(e,t){_t.firstCallDoneFlags.set(this.serviceURL,"done"),this.lastResult=e;const n=e.headers.get("content-type")?.toLowerCase(),r=e.status;let s={};if(!n||n.indexOf("text/")==0)s={text:await e.text()};else try{s=await e.json()}catch{s={}}if(this.addHTTPResponse&&xs.isObject(s)&&(s._sonic_http_response_=e),r===498&&!_t.failledTokenUpdates.has(this.serviceURL))if(this.handleInvalidToken(this.token),t.apiMethod==="get"){const o=await this.get(t.path,t.additionalHeaders);if(o==null)throw new Error("GET retry failed after token refresh");s=o}else s=await this[t.apiMethod](t.path,t.data,t.method,t.additionalHeaders);return Jd("sonic-api").lastResponse.set({http:e,processed:s}),s}async auth(){if(this.token)return;if(_t.tokens.has(this.serviceURL)){this.token=_t.tokens.get(this.serviceURL);return}if(!this.tokenProvider)return;let e={};this.userName&&this.password?e={Authorization:"Basic "+window.btoa(unescape(encodeURIComponent(this.userName+":"+this.password)))}:this.authToken&&(e={Authorization:"Bearer "+this.authToken});const t=new URL(this.serviceURL),n=t.protocol+"//"+t.host,r=await fetch(this.computeURL(this.tokenProvider,{serviceHost:n}),{headers:e,credentials:this.credentials,keepalive:this.keepAlive});try{const s=await r.json();s.token?this.token=s.token:_t.failledTokenUpdates.set(this.serviceURL,!0)}catch{_t.failledTokenUpdates.set(this.serviceURL,!0)}}async localGet(e,t){const n=Gt.get(e),r=new URLSearchParams(t.split("?")[1]||""),s=n.get();let a=[];Array.isArray(s)?a=s:a=[s];const o=[];let l=Number.POSITIVE_INFINITY,c=0,h=0;if(r.has("limit")&&(l=parseInt(r.get("limit")||"0"),h++),r.has("offset")&&(c=parseInt(r.get("offset")||"0"),h++),h>0&&(r.delete("limit"),r.delete("offset")),r.size===0)return a.slice(c,c+l);for(const[u,f]of r.entries()){const d=f.split(",").map(_=>_.trim());for(const _ of d)for(const b of a)if(typeof b!="object")isNaN(+b)?b.toString().toLowerCase().includes(f.toLowerCase())&&o.push(b):b===f&&o.push(b);else{const g=b;if(!g[u])continue;isNaN(+g[u])?g[u]?.toString().toLowerCase().includes(_.toLowerCase())&&o.push(b):g[u]===_&&o.push(b)}}return o.slice(c,c+l)}firstCallDone(){return new Promise(e=>{if(!_t.firstCallDoneFlags.has(this.serviceURL))_t.firstCallDoneFlags.set(this.serviceURL,"loading"),e(!0);else{const t=()=>{[void 0,"loading"].includes(_t.firstCallDoneFlags.get(this.serviceURL))?window.requestAnimationFrame(t):e(!0)};t()}})}async get(e,t){const n=/dataProvider\((.*?)\)(.*?)$/;if(n.test(e)){this.blockUntilDone&&(await this.firstCallDone(),_t.firstCallDoneFlags.set(this.serviceURL,"loading"));const c=e.match(n);if(!c)throw new Error("dataProvider path is not valid");return await this.localGet(c[1],c[2])}const r={apiMethod:"get",path:e,additionalHeaders:t},s=await this.createHeaders(t),a=this.computeURL(e),o=JSON.stringify({url:a,headers:s,credentials:this.credentials,cache:this.cache,keepAlive:this.keepAlive});if(this.blockUntilDone&&(await this.firstCallDone(),_t.firstCallDoneFlags.set(this.serviceURL,"loading")),!_t.loadingGetPromises.has(o)){const c=new Promise(async h=>{try{const u=await fetch(a,{headers:s,credentials:this.credentials,cache:this.cache,keepalive:this.keepAlive}),f=await this.handleResult(u,r);h({processed:f,response:this.lastResult})}catch{_t.firstCallDoneFlags.set(this.serviceURL,"error"),h(null)}});_t.loadingGetPromises.set(o,c)}const l=await _t.loadingGetPromises.get(o);return _t.loadingGetPromises.delete(o),l?(this.lastResult=l.response,l.processed):null}async getDetailed(e,t){const n=/dataProvider\((.*?)\)(.*?)$/.test(e),r=await this.get(e,t);if(r==null)return;const s=$c(r),a=this.computeURL(e);if(n)return{request:new Request(a,{method:"GET"}),result:s};const o=await this.createHeaders(t);return{request:new Request(a,{method:"GET",headers:new Headers(o),credentials:this.credentials,cache:this.cache,keepalive:this.keepAlive}),response:this.lastResult,result:s}}async sendDetailed(e,t,n,r){const s=await this.send(e,t,n,r);if(s==null)return;const a=$c(s),o=this.computeURL(e),l=await this.createHeaders({Accept:"application/json","Content-Type":"application/json",...r});return{request:new Request(o,{method:n,headers:new Headers(l),credentials:this.credentials,body:JSON.stringify(t),keepalive:this.keepAlive}),response:this.lastResult,result:a}}async postDetailed(e,t,n){return this.sendDetailed(e,t,"POST",n)}async putDetailed(e,t,n){return this.sendDetailed(e,t,"PUT",n)}async patchDetailed(e,t,n){return this.sendDetailed(e,t,"PATCH",n)}async createHeaders(e){await this.auth();const t={};return this.token&&(t.Authorization="Bearer "+this.token),t["Accept-Language"]=zn.getLanguage(),e&&Object.assign(t,e),t}computeURL(e,t={}){let n="";e.startsWith("http")?n=e:n=this.serviceURL+"/"+e,n.startsWith("http")||(n=window.location.origin+n);const r=new URL(n);for(const s in t)r.searchParams.set(s,t[s]);return r.toString().replace(/([^(https?:)])\/{2,}/g,"$1/")}async send(e,t,n="POST",r){const s={apiMethod:"send",path:e,additionalHeaders:r,method:n,data:t},a=await this.createHeaders(r);a.Accept="application/json",a["Content-Type"]="application/json";const o=await fetch(this.computeURL(e),{headers:a,credentials:this.credentials,method:n,body:JSON.stringify(t),keepalive:this.keepAlive});return await this.handleResult(o,s)}async submitFormData(e,t,n="POST",r){const s={apiMethod:"submitFormData",path:e,additionalHeaders:r,method:n,data:t},a=await this.createHeaders(r);a.Accept="application/json";const o=new FormData,l=t;for(const h in l)o.set(h,l[h]);const c=await fetch(this.computeURL(e),{headers:a,credentials:this.credentials,method:n,body:o,keepalive:this.keepAlive});return await this.handleResult(c,s)}async put(e,t,n){return this.send(e,t,"PUT",n)}async post(e,t,n){return this.send(e,t,"POST",n)}async patch(e,t,n){return this.send(e,t,"PATCH",n)}async delete(e,t,n){return this.send(e,t,"delete",n)}};_t.loadingGetPromises=new Map,_t.tokens=new Map,_t.invalidTokens=[],_t.failledTokenUpdates=new Map,_t.firstCallDoneFlags=new Map;let Wa=_t;zn.getApiConfiguration(document.body||document.documentElement);var jc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ep(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var kr={exports:{}},tp=kr.exports,qc;function np(){return qc||(qc=1,(function(i,e){var t=[].slice;(function(n,r){return e!==null?i.exports=r():n.UrlPattern=r()})(tp,function(){var n,r,s,a,o,l,c,h,u,f,d,_,b,g,m;return u=function(S){return S.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},c=function(S,y){var M,T,R;for(R=[],M=-1,T=S.length;++M<T;)R=R.concat(y(S[M]));return R},g=function(S,y){var M,T,R;for(R="",M=-1,T=S.length;++M<T;)R+=y(S[M]);return R},b=function(S){return new RegExp(S.toString()+"|").exec("").length-1},d=function(S,y){var M,T,R,k,B;for(k={},M=-1,R=S.length;++M<R;)T=S[M],B=y[M],B!=null&&(k[T]!=null?(Array.isArray(k[T])||(k[T]=[k[T]]),k[T].push(B)):k[T]=B);return k},n={},n.Result=function(S,y){this.value=S,this.rest=y},n.Tagged=function(S,y){this.tag=S,this.value=y},n.tag=function(S,y){return function(M){var T,R;if(T=y(M),T!=null)return R=new n.Tagged(S,T.value),new n.Result(R,T.rest)}},n.regex=function(S){return function(y){var M,T;if(M=S.exec(y),M!=null)return T=M[0],new n.Result(T,y.slice(T.length))}},n.sequence=function(){var S;return S=1<=arguments.length?t.call(arguments,0):[],function(y){var M,T,R,k,B,C;for(M=-1,T=S.length,C=[],k=y;++M<T;){if(R=S[M],B=R(k),B==null)return;C.push(B.value),k=B.rest}return new n.Result(C,k)}},n.pick=function(){var S,y;return S=arguments[0],y=2<=arguments.length?t.call(arguments,1):[],function(M){var T,R;if(R=n.sequence.apply(n,y)(M),R!=null)return T=R.value,R.value=T[S],R}},n.string=function(S){var y;return y=S.length,function(M){if(M.slice(0,y)===S)return new n.Result(S,M.slice(y))}},n.lazy=function(S){var y;return y=null,function(M){return y==null&&(y=S()),y(M)}},n.baseMany=function(S,y,M,T,R){var k,B,C,D;for(C=R,D=M?"":[];!(y!=null&&(k=y(C),k!=null)||(B=S(C),B==null));)M?D+=B.value:D.push(B.value),C=B.rest;if(!(T&&D.length===0))return new n.Result(D,C)},n.many1=function(S){return function(y){return n.baseMany(S,null,!1,!0,y)}},n.concatMany1Till=function(S,y){return function(M){return n.baseMany(S,y,!0,!0,M)}},n.firstChoice=function(){var S;return S=1<=arguments.length?t.call(arguments,0):[],function(y){var M,T,R,k;for(M=-1,T=S.length;++M<T;)if(R=S[M],k=R(y),k!=null)return k}},_=function(S){var y;return y={},y.wildcard=n.tag("wildcard",n.string(S.wildcardChar)),y.optional=n.tag("optional",n.pick(1,n.string(S.optionalSegmentStartChar),n.lazy(function(){return y.pattern}),n.string(S.optionalSegmentEndChar))),y.name=n.regex(new RegExp("^["+S.segmentNameCharset+"]+")),y.named=n.tag("named",n.pick(1,n.string(S.segmentNameStartChar),n.lazy(function(){return y.name}))),y.escapedChar=n.pick(1,n.string(S.escapeChar),n.regex(/^./)),y.static=n.tag("static",n.concatMany1Till(n.firstChoice(n.lazy(function(){return y.escapedChar}),n.regex(/^./)),n.firstChoice(n.string(S.segmentNameStartChar),n.string(S.optionalSegmentStartChar),n.string(S.optionalSegmentEndChar),y.wildcard))),y.token=n.lazy(function(){return n.firstChoice(y.wildcard,y.optional,y.named,y.static)}),y.pattern=n.many1(n.lazy(function(){return y.token})),y},h={escapeChar:"\\",segmentNameStartChar:":",segmentValueCharset:"a-zA-Z0-9-_~ %",segmentNameCharset:"a-zA-Z0-9",optionalSegmentStartChar:"(",optionalSegmentEndChar:")",wildcardChar:"*"},l=function(S,y){if(Array.isArray(S))return g(S,function(M){return l(M,y)});switch(S.tag){case"wildcard":return"(.*?)";case"named":return"(["+y+"]+)";case"static":return u(S.value);case"optional":return"(?:"+l(S.value,y)+")?"}},o=function(S,y){return y==null&&(y=h.segmentValueCharset),"^"+l(S,y)+"$"},a=function(S){if(Array.isArray(S))return c(S,a);switch(S.tag){case"wildcard":return["_"];case"named":return[S.value];case"static":return[];case"optional":return a(S.value)}},f=function(S,y,M,T){var R,k,B,C;if(T==null&&(T=!1),C=S[y],C==null){if(T)throw new Error("no values provided for key `"+y+"`");return}if(R=M[y]||0,k=Array.isArray(C)?C.length-1:0,R>k){if(T)throw new Error("too few values provided for key `"+y+"`");return}return B=Array.isArray(C)?C[R]:C,T&&(M[y]=R+1),B},s=function(S,y,M){var T,R;if(Array.isArray(S)){for(T=-1,R=S.length;++T<R;)if(s(S[T],y,M))return!0;return!1}switch(S.tag){case"wildcard":return f(y,"_",M,!1)!=null;case"named":return f(y,S.value,M,!1)!=null;case"static":return!1;case"optional":return s(S.value,y,M)}},m=function(S,y,M){if(Array.isArray(S))return g(S,function(T){return m(T,y,M)});switch(S.tag){case"wildcard":return f(y,"_",M,!0);case"named":return f(y,S.value,M,!0);case"static":return S.value;case"optional":return s(S.value,y,M)?m(S.value,y,M):""}},r=function(S,y){var M,T,R,k,B;if(S instanceof r){this.isRegex=S.isRegex,this.regex=S.regex,this.ast=S.ast,this.names=S.names;return}if(this.isRegex=S instanceof RegExp,!(typeof S=="string"||this.isRegex))throw new TypeError("argument must be a regex or a string");if(this.isRegex){if(this.regex=S,y!=null){if(!Array.isArray(y))throw new Error("if first argument is a regex the second argument may be an array of group names but you provided something else");if(M=b(this.regex),y.length!==M)throw new Error("regex contains "+M+" groups but array of group names contains "+y.length);this.names=y}return}if(S==="")throw new Error("argument must not be the empty string");if(B=S.replace(/\s+/g,""),B!==S)throw new Error("argument must not contain whitespace");if(T={escapeChar:y?.escapeChar||h.escapeChar,segmentNameStartChar:y?.segmentNameStartChar||h.segmentNameStartChar,segmentNameCharset:y?.segmentNameCharset||h.segmentNameCharset,segmentValueCharset:y?.segmentValueCharset||h.segmentValueCharset,optionalSegmentStartChar:y?.optionalSegmentStartChar||h.optionalSegmentStartChar,optionalSegmentEndChar:y?.optionalSegmentEndChar||h.optionalSegmentEndChar,wildcardChar:y?.wildcardChar||h.wildcardChar},k=_(T),R=k.pattern(S),R==null)throw new Error("couldn't parse pattern");if(R.rest!=="")throw new Error("could only partially parse pattern");this.ast=R.value,this.regex=new RegExp(o(this.ast,T.segmentValueCharset)),this.names=a(this.ast)},r.prototype.match=function(S){var y,M;return M=this.regex.exec(S),M==null?null:(y=M.slice(1),this.names?d(this.names,y):y)},r.prototype.stringify=function(S){if(S==null&&(S={}),this.isRegex)throw new Error("can't stringify patterns generated from a regex");if(S!==Object(S))throw new Error("argument must be an object or undefined");return m(this.ast,S,{})},r.escapeForRegex=u,r.concatMap=c,r.stringConcatMap=g,r.regexGroupCount=b,r.keysAndValuesToObject=d,r.P=n,r.newParser=_,r.defaultOptions=h,r.astNodeToRegexString=o,r.astNodeToNames=a,r.getParam=f,r.astNodeContainsSegmentsForProvidedParams=s,r.stringify=m,r})})(kr,kr.exports)),kr.exports}var ip=np();const rp=ep(ip);class Xa{constructor(e){this.path=Xa.normalizePath(e)}getDataProviderKey(){return new ys(this.path)}static normalizePath(e){const t=String(e).trim();if(!t)throw new RangeError("Endpoint: path cannot be empty");if(/^https?:\/\//i.test(t)){let l;try{l=new URL(t)}catch{throw new RangeError("Endpoint: invalid absolute URL")}return l.pathname=l.pathname.replace(/\/+/g,"/"),l.href}const n=t.indexOf("?"),r=t.indexOf("#");let s=t.length;n>=0&&(s=Math.min(s,n)),r>=0&&(s=Math.min(s,r));let a=t.slice(0,s);const o=t.slice(s);if(a=a.replace(/^\/+/,""),a=a.replace(/\/+/g,"/"),!a&&o)throw new RangeError("Endpoint: path cannot be empty");return a+o}static isNonEmpty(e){return String(e).trim().length>0}static looksLikeDataProviderPath(e){return/^\s*dataProvider\s*\(/i.test(String(e))}toString(){return this.path}}function Ms(i){throw new Error('Could not dynamically require "'+i+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var $a={exports:{}},Yc;function sp(){return Yc||(Yc=1,(function(i,e){(function(t){i.exports=t()})(function(){return(function(){function t(n,r,s){function a(c,h){if(!r[c]){if(!n[c]){var u=typeof Ms=="function"&&Ms;if(!h&&u)return u(c,!0);if(o)return o(c,!0);var f=new Error("Cannot find module '"+c+"'");throw f.code="MODULE_NOT_FOUND",f}var d=r[c]={exports:{}};n[c][0].call(d.exports,function(_){var b=n[c][1][_];return a(b||_)},d,d.exports,t,n,r,s)}return r[c].exports}for(var o=typeof Ms=="function"&&Ms,l=0;l<s.length;l++)a(s[l]);return a}return t})()({1:[function(t,n,r){const s=t("./utils"),a=(function(){const o=s.stringToArray,l=["Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"],c=["Zeroth","First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Ninth","Tenth","Eleventh","Twelfth","Thirteenth","Fourteenth","Fifteenth","Sixteenth","Seventeenth","Eighteenth","Nineteenth"],h=["Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety","Hundred"],u=["Thousand","Million","Billion","Trillion"];function f(z,j){var W=function(be,U,ee){var fe="";if(be<=19)fe=(U?" and ":"")+(ee?c[be]:l[be]);else if(be<100){const Se=Math.floor(be/10),ze=be%10;fe=(U?" and ":"")+h[Se-2],ze>0?fe+="-"+W(ze,!1,ee):ee&&(fe=fe.substring(0,fe.length-1)+"ieth")}else if(be<1e3){const Se=Math.floor(be/100),ze=be%100;fe=(U?", ":"")+l[Se]+" Hundred",ze>0?fe+=W(ze,!0,ee):ee&&(fe+="th")}else{var ye=Math.floor(Math.log10(be)/3);ye>u.length&&(ye=u.length);const Se=Math.pow(10,ye*3),ze=Math.floor(be/Se),_e=be-ze*Se;fe=(U?", ":"")+W(ze,!1,!1)+" "+u[ye-1],_e>0?fe+=W(_e,!0,ee):ee&&(fe+="th")}return fe},le=W(z,!1,j);return le}const d=Object.create(null);l.forEach(function(z,j){d[z.toLowerCase()]=j}),c.forEach(function(z,j){d[z.toLowerCase()]=j}),h.forEach(function(z,j){const W=z.toLowerCase();d[W]=(j+2)*10,d[W.substring(0,z.length-1)+"ieth"]=d[W]}),d.hundredth=100,u.forEach(function(z,j){const W=z.toLowerCase(),le=Math.pow(10,(j+1)*3);d[W]=le,d[W+"th"]=le});function _(z){const W=z.split(/,\s|\sand\s|[\s\\-]/).map(U=>d[U]);let le=[0];return W.forEach(U=>{if(U<100){let ee=le.pop();ee>=1e3&&(le.push(ee),ee=0),le.push(ee+U)}else le.push(le.pop()*U)}),le.reduce((U,ee)=>U+ee,0)}const b=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],g={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};function m(z){for(var j=0;j<b.length;j++){const W=b[j];if(z>=W[0])return W[1]+m(z-W[0])}return""}function S(z){for(var j=0,W=1,le=z.length-1;le>=0;le--){const be=z[le],U=g[be];U<W?j-=U:(W=U,j+=U)}return j}function y(z,j){for(var W=[],le=j.charCodeAt(0);z>0;)W.unshift(String.fromCharCode((z-1)%26+le)),z=Math.floor((z-1)/26);return W.join("")}function M(z,j){for(var W=j.charCodeAt(0),le=0,be=0;be<z.length;be++)le+=(z.charCodeAt(z.length-be-1)-W+1)*Math.pow(26,be);return le}function T(z,j){if(typeof z>"u")return;z=Math.floor(z);const W=D(j);return B(z,W)}const R={DECIMAL:"decimal",LETTERS:"letters",ROMAN:"roman",WORDS:"words",SEQUENCE:"sequence"},k={UPPER:"upper",LOWER:"lower",TITLE:"title"};function B(z,j){let W;const le=z<0;switch(z=Math.abs(z),j.primary){case R.LETTERS:W=y(z,j.case===k.UPPER?"A":"a");break;case R.ROMAN:W=m(z),j.case===k.UPPER&&(W=W.toUpperCase());break;case R.WORDS:W=f(z,j.ordinal),j.case===k.UPPER?W=W.toUpperCase():j.case===k.LOWER&&(W=W.toLowerCase());break;case R.DECIMAL:W=""+z;var be=j.mandatoryDigits-W.length;if(be>0){var U=new Array(be+1).join("0");W=U+W}if(j.zeroCode!==48&&(W=o(W).map(Se=>String.fromCodePoint(Se.codePointAt(0)+j.zeroCode-48)).join("")),j.regular){const Se=Math.floor((W.length-1)/j.groupingSeparators.position);for(let ze=Se;ze>0;ze--){const _e=W.length-ze*j.groupingSeparators.position;W=W.substr(0,_e)+j.groupingSeparators.character+W.substr(_e)}}else j.groupingSeparators.reverse().forEach(Se=>{const ze=W.length-Se.position;W=W.substr(0,ze)+Se.character+W.substr(ze)});if(j.ordinal){var ee={1:"st",2:"nd",3:"rd"},fe=W[W.length-1],ye=ee[fe];(!ye||W.length>1&&W[W.length-2]==="1")&&(ye="th"),W=W+ye}break;case R.SEQUENCE:throw{code:"D3130",value:j.token}}return le&&(W="-"+W),W}const C=[48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296];function D(z){const j={type:"integer",primary:R.DECIMAL,case:k.LOWER,ordinal:!1};let W,le;const be=z.lastIndexOf(";");switch(be===-1?W=z:(W=z.substring(0,be),le=z.substring(be+1),le[0]==="o"&&(j.ordinal=!0)),W){case"A":j.case=k.UPPER;case"a":j.primary=R.LETTERS;break;case"I":j.case=k.UPPER;case"i":j.primary=R.ROMAN;break;case"W":j.case=k.UPPER,j.primary=R.WORDS;break;case"Ww":j.case=k.TITLE,j.primary=R.WORDS;break;case"w":j.primary=R.WORDS;break;default:{let U=null,ee=0,fe=0,ye=[],Se=0;if(o(W).map(_e=>_e.codePointAt(0)).reverse().forEach(_e=>{let xe=!1;for(let Xe=0;Xe<C.length;Xe++){const De=C[Xe];if(_e>=De&&_e<=De+9){if(xe=!0,ee++,Se++,U===null)U=De;else if(De!==U)throw{code:"D3131"};break}}xe||(_e===35?(Se++,fe++):ye.push({position:Se,character:String.fromCodePoint(_e)}))}),ee>0){j.primary=R.DECIMAL,j.zeroCode=U,j.mandatoryDigits=ee,j.optionalDigits=fe;const xe=function(Xe){if(Xe.length===0)return 0;const De=Xe[0].character;for(let re=1;re<Xe.length;re++)if(Xe[re].character!==De)return 0;const N=Xe.map(re=>re.position),w=function(re,pe){return pe===0?re:w(pe,re%pe)},q=N.reduce(w);for(let re=1;re<=N.length;re++)if(N.indexOf(re*q)===-1)return 0;return q}(ye);xe>0?(j.regular=!0,j.groupingSeparators={position:xe,character:ye[0].character}):(j.regular=!1,j.groupingSeparators=ye)}else j.primary=R.SEQUENCE,j.token=W}}return j}const V={Y:"1",M:"1",D:"1",d:"1",F:"n",W:"1",w:"1",X:"1",x:"1",H:"1",h:"1",P:"n",m:"01",s:"01",f:"1",Z:"01:01",z:"01:01",C:"n",E:"n"};function K(z){var j=[];const W={type:"datetime",parts:j},le=function(xe,Xe){if(Xe>xe){let De=z.substring(xe,Xe);De=De.split("]]").join("]"),j.push({type:"literal",value:De})}};for(var be=0,U=0;U<z.length;){if(z.charAt(U)==="["){if(z.charAt(U+1)==="["){le(be,U),j.push({type:"literal",value:"["}),U+=2,be=U;continue}if(le(be,U),be=U,U=z.indexOf("]",be),U===-1)throw{code:"D3135"};let xe=z.substring(be+1,U);xe=xe.split(/\s+/).join("");var ee={type:"marker",component:xe.charAt(0)},fe=xe.lastIndexOf(","),ye;if(fe!==-1){const Xe=xe.substring(fe+1),De=Xe.indexOf("-");let N,w;const q=function(pe){if(!(typeof pe>"u"||pe==="*"))return parseInt(pe)};De===-1?N=Xe:(N=Xe.substring(0,De),w=Xe.substring(De+1));const re={min:q(N),max:q(w)};ee.width=re,ye=xe.substring(1,fe)}else ye=xe.substring(1);if(ye.length===1)ee.presentation1=ye;else if(ye.length>1){var Se=ye.charAt(ye.length-1);"atco".indexOf(Se)!==-1?(ee.presentation2=Se,Se==="o"&&(ee.ordinal=!0),ee.presentation1=ye.substring(0,ye.length-1)):ee.presentation1=ye}else ee.presentation1=V[ee.component];if(typeof ee.presentation1>"u")throw{code:"D3132",value:ee.component};if(ee.presentation1[0]==="n")ee.names=k.LOWER;else if(ee.presentation1[0]==="N")ee.presentation1[1]==="n"?ee.names=k.TITLE:ee.names=k.UPPER;else if("YMDdFWwXxHhmsf".indexOf(ee.component)!==-1){var ze=ee.presentation1;if(ee.presentation2&&(ze+=";"+ee.presentation2),ee.integerFormat=D(ze),ee.width&&ee.width.min!==void 0&&ee.integerFormat.mandatoryDigits<ee.width.min&&(ee.integerFormat.mandatoryDigits=ee.width.min),ee.component==="Y")if(ee.n=-1,ee.width&&ee.width.max!==void 0)ee.n=ee.width.max,ee.integerFormat.mandatoryDigits=ee.n;else{var _e=ee.integerFormat.mandatoryDigits+ee.integerFormat.optionalDigits;_e>=2&&(ee.n=_e)}const Xe=j[j.length-1];Xe&&Xe.integerFormat&&(Xe.integerFormat.parseWidth=Xe.integerFormat.mandatoryDigits)}(ee.component==="Z"||ee.component==="z")&&(ee.integerFormat=D(ee.presentation1)),j.push(ee),be=U+1}U++}return le(be,U),W}const J=["","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],se=["January","February","March","April","May","June","July","August","September","October","November","December"],he=1e3*60*60*24,Q=function(z){const j=Date.UTC(z.year,z.month);var W=new Date(j).getUTCDay();return W===0&&(W=7),W>4?j+(8-W)*he:j-(W-1)*he},de=function(z,j){return{year:z,month:j,nextMonth:function(){return j===11?de(z+1,0):de(z,j+1)},previousMonth:function(){return j===0?de(z-1,11):de(z,j-1)},nextYear:function(){return de(z+1,j)},previousYear:function(){return de(z-1,j)}}},ne=function(z,j){return(j-z)/(he*7)+1},ue=(z,j)=>{let W;switch(j){case"Y":W=z.getUTCFullYear();break;case"M":W=z.getUTCMonth()+1;break;case"D":W=z.getUTCDate();break;case"d":{const le=Date.UTC(z.getUTCFullYear(),z.getUTCMonth(),z.getUTCDate()),be=Date.UTC(z.getUTCFullYear(),0);W=(le-be)/he+1;break}case"F":W=z.getUTCDay(),W===0&&(W=7);break;case"W":{const le=de(z.getUTCFullYear(),0),be=Q(le),U=Date.UTC(le.year,z.getUTCMonth(),z.getUTCDate());let ee=ne(be,U);if(ee>52){const fe=Q(le.nextYear());U>=fe&&(ee=1)}else if(ee<1){const fe=Q(le.previousYear());ee=ne(fe,U)}W=Math.floor(ee);break}case"w":{const le=de(z.getUTCFullYear(),z.getUTCMonth()),be=Q(le),U=Date.UTC(le.year,le.month,z.getUTCDate());let ee=ne(be,U);if(ee>4){const fe=Q(le.nextMonth());U>=fe&&(ee=1)}else if(ee<1){const fe=Q(le.previousMonth());ee=ne(fe,U)}W=Math.floor(ee);break}case"X":{const le=de(z.getUTCFullYear(),0),be=Q(le),U=Q(le.nextYear()),ee=z.getTime();ee<be?W=le.year-1:ee>=U?W=le.year+1:W=le.year;break}case"x":{const le=de(z.getUTCFullYear(),z.getUTCMonth()),be=Q(le),U=le.nextMonth(),ee=Q(U),fe=z.getTime();fe<be?W=le.previousMonth().month+1:fe>=ee?W=U.month+1:W=le.month+1;break}case"H":W=z.getUTCHours();break;case"h":W=z.getUTCHours(),W=W%12,W===0&&(W=12);break;case"P":W=z.getUTCHours()>=12?"pm":"am";break;case"m":W=z.getUTCMinutes();break;case"s":W=z.getUTCSeconds();break;case"f":W=z.getUTCMilliseconds();break;case"Z":case"z":break;case"C":W="ISO";break;case"E":W="ISO";break}return W};let Te=null;function ke(z,j,W){var le=0,be=0;if(typeof W<"u"){const ze=parseInt(W);le=Math.floor(ze/100),be=ze%100}var U=function(ze,_e){var xe=ue(ze,_e.component);if("YMDdFWwXxHhms".indexOf(_e.component)!==-1)if(_e.component==="Y"&&_e.n!==-1&&(xe=xe%Math.pow(10,_e.n)),_e.names){if(_e.component==="M"||_e.component==="x")xe=se[xe-1];else if(_e.component==="F")xe=J[xe];else throw{code:"D3133",value:_e.component};_e.names===k.UPPER?xe=xe.toUpperCase():_e.names===k.LOWER&&(xe=xe.toLowerCase()),_e.width&&xe.length>_e.width.max&&(xe=xe.substring(0,_e.width.max))}else xe=B(xe,_e.integerFormat);else if(_e.component==="f")xe=B(xe,_e.integerFormat);else if(_e.component==="Z"||_e.component==="z"){const Xe=le*100+be;if(_e.integerFormat.regular)xe=B(Xe,_e.integerFormat);else{const De=_e.integerFormat.mandatoryDigits;if(De===1||De===2)xe=B(le,_e.integerFormat),be!==0&&(xe+=":"+T(be,"00"));else if(De===3||De===4)xe=B(Xe,_e.integerFormat);else throw{code:"D3134",value:De}}Xe>=0&&(xe="+"+xe),_e.component==="z"&&(xe="GMT"+xe),Xe===0&&_e.presentation2==="t"&&(xe="Z")}else _e.component==="P"&&_e.names===k.UPPER&&(xe=xe.toUpperCase());return xe};let ee;typeof j>"u"?(Te===null&&(Te=K("[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]")),ee=Te):ee=K(j);const fe=(60*le+be)*60*1e3,ye=new Date(z+fe);let Se="";return ee.parts.forEach(function(ze){ze.type==="literal"?Se+=ze.value:Se+=U(ye,ze)}),Se}function O(z){var j=Object.create(null);if(z.type==="datetime")j.type="datetime",j.parts=z.parts.map(function(W){var le=Object.create(null);if(W.type==="literal")le.regex=W.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");else if(W.component==="Z"||W.component==="z"){let U;Array.isArray(W.integerFormat.groupingSeparators)||(U=W.integerFormat.groupingSeparators),le.regex="",W.component==="z"&&(le.regex="GMT"),le.regex+="[-+][0-9]+",U&&(le.regex+=U.character+"[0-9]+"),le.parse=function(ee){W.component==="z"&&(ee=ee.substring(3));let fe=0,ye=0;return U?(fe=Number.parseInt(ee.substring(0,ee.indexOf(U.character))),ye=Number.parseInt(ee.substring(ee.indexOf(U.character)+1))):ee.length-1<=2?fe=Number.parseInt(ee):(fe=Number.parseInt(ee.substring(0,3)),ye=Number.parseInt(ee.substring(3))),fe*60+ye}}else if(W.component==="f")le.regex="[0-9]+",le.parse=function(U){return parseFloat("0."+U.substring(0,3))*1e3};else if(W.integerFormat)le=O(W.integerFormat);else{le.regex="[a-zA-Z]+";var be=Object.create(null);if(W.component==="M"||W.component==="x")se.forEach(function(U,ee){W.width&&W.width.max?be[U.substring(0,W.width.max)]=ee+1:be[U]=ee+1});else if(W.component==="F")J.forEach(function(U,ee){ee>0&&(W.width&&W.width.max?be[U.substring(0,W.width.max)]=ee:be[U]=ee)});else if(W.component==="P")be={am:0,AM:0,pm:1,PM:1};else throw{code:"D3133",value:W.component};le.parse=function(U){return be[U]}}return le.component=W.component,le});else{j.type="integer";const W=z.case===k.UPPER;switch(z.primary){case R.LETTERS:j.regex=W?"[A-Z]+":"[a-z]+",j.parse=function(le){return M(le,W?"A":"a")};break;case R.ROMAN:j.regex=W?"[MDCLXVI]+":"[mdclxvi]+",j.parse=function(le){return S(W?le:le.toUpperCase())};break;case R.WORDS:j.regex="(?:"+s.keys(d).concat("and","[\\-, ]").join("|")+")+",j.parse=function(le){return _(le.toLowerCase())};break;case R.DECIMAL:j.regex="[0-9]",z.parseWidth?j.regex+=`{${z.parseWidth}}`:j.regex+="+",z.ordinal&&(j.regex+="(?:th|st|nd|rd)"),j.parse=function(le){let be=le;return z.ordinal&&(be=le.substring(0,le.length-2)),z.regular?be=be.split(",").join(""):z.groupingSeparators.forEach(U=>{be=be.split(U.character).join("")}),z.zeroCode!==48&&(be=be.split("").map(U=>String.fromCodePoint(U.codePointAt(0)-z.zeroCode+48)).join("")),parseInt(be)};break;case R.SEQUENCE:throw{code:"D3130",value:z.token}}}return j}function H(z,j){if(typeof z>"u")return;const W=D(j);return O(W).parse(z)}function we(z,j){const W=K(j),le=O(W),be="^"+le.parts.map(ye=>"("+ye.regex+")").join("")+"$";var ee=new RegExp(be,"i").exec(z);if(ee!==null){const De=Object.create(null);for(let A=1;A<ee.length;A++){const x=le.parts[A-1];x.parse&&(De[x.component]=x.parse(ee[A]))}if(Object.getOwnPropertyNames(De).length===0)return;let N=0;const w=A=>{N<<=1,N+=A?1:0},q=A=>!(~A&N)&&!!(A&N);"YXMxWwdD".split("").forEach(A=>w(De[A]));const pe=!q(161)&&q(130),ae=q(84),Ve=!ae&&q(72);N=0,"PHhmsf".split("").forEach(A=>w(De[A]));const oe=!q(23)&&q(47),Re=(pe?"YD":ae?"XxwF":Ve?"XWF":"YMD")+(oe?"Phmsf":"Hmsf"),je=this.environment.timestamp;let Oe=!1,Ce=!1;if(Re.split("").forEach(A=>{if(typeof De[A]>"u")Oe?(De[A]="MDd".indexOf(A)!==-1?1:0,Ce=!0):De[A]=ue(je,A);else if(Oe=!0,Ce)throw{code:"D3136"}}),De.M>0?De.M-=1:De.M=0,pe){const A=Date.UTC(De.Y,0),x=(De.d-1)*1e3*60*60*24,L=new Date(A+x);De.M=L.getUTCMonth(),De.D=L.getUTCDate()}if(ae)throw{code:"D3136"};if(Ve)throw{code:"D3136"};oe&&(De.H=De.h===12?0:De.h,De.P===1&&(De.H+=12));var fe=Date.UTC(De.Y,De.M,De.D,De.H,De.m,De.s,De.f);return(De.Z||De.z)&&(fe-=(De.Z||De.z)*60*1e3),fe}}var Be=new RegExp("^\\d{4}(-[01]\\d)?(-[0-3]\\d)?(T[0-2]\\d:[0-5]\\d:[0-5]\\d)?(\\.\\d+)?([+-][0-2]\\d:?[0-5]\\d|Z)?$");function ie(z,j){if(!(typeof z>"u"))if(typeof j>"u"){if(!Be.test(z))throw{stack:new Error().stack,code:"D3110",value:z};return Date.parse(z)}else return we.call(this,z,j)}function ce(z,j,W){if(!(typeof z>"u"))return ke.call(this,z,j,W)}return{formatInteger:T,parseInteger:H,fromMillis:ce,toMillis:ie}})();n.exports=a},{"./utils":6}],2:[function(t,n,r){(function(s){(function(){var a=t("./utils");const o=(()=>{var l=a.isNumeric,c=a.isArrayOfStrings,h=a.isArrayOfNumbers,u=a.isSequence,f=a.isFunction,d=a.isLambda,_=a.isPromise,b=a.getFunctionArity,g=a.isDeepEqual,m=a.stringToArray;function S(p){if(!(typeof p>"u")){var v=0;return p.forEach(function(E){v+=E}),v}}function y(p){return typeof p>"u"?0:p.length}function M(p){if(!(typeof p>"u"||p.length===0))return Math.max.apply(Math,p)}function T(p){if(!(typeof p>"u"||p.length===0))return Math.min.apply(Math,p)}function R(p){if(!(typeof p>"u"||p.length===0)){var v=0;return p.forEach(function(E){v+=E}),v/p.length}}function k(p,v=!1){if(!(typeof p>"u")){var E;if(typeof p=="string")E=p;else if(f(p))E="";else{if(typeof p=="number"&&!isFinite(p))throw{code:"D3001",value:p,stack:new Error().stack};var I=v?2:0;Array.isArray(p)&&p.outerWrapper&&(p=p[0]),E=JSON.stringify(p,function(F,X){return typeof X<"u"&&X!==null&&l(X)?X.toPrecision&&!Number.isInteger(X)?Number(X.toPrecision(15)):X:X&&f(X)?"":X},I)}return E}}function B(p,v,E){if(!(typeof p>"u")){var I=m(p),F=I.length;if(F+v<0&&(v=0),typeof E<"u"){if(E<=0)return"";var X=v>=0?v+E:F+v+E;return I.slice(v,X).join("")}return I.slice(v).join("")}}function C(p,v){if(!(typeof p>"u")){var E=p.indexOf(v);return E>-1?p.substr(0,E):p}}function D(p,v){if(!(typeof p>"u")){var E=p.indexOf(v);return E>-1?p.substr(E+v.length):p}}function V(p){if(!(typeof p>"u"))return p.toLowerCase()}function K(p){if(!(typeof p>"u"))return p.toUpperCase()}function J(p){if(!(typeof p>"u"))return m(p).length}function se(p){if(!(typeof p>"u")){var v=p.replace(/[ \t\n\r]+/gm," ");return v.charAt(0)===" "&&(v=v.substring(1)),v.charAt(v.length-1)===" "&&(v=v.substring(0,v.length-1)),v}}function he(p,v,E){if(!(typeof p>"u")){(typeof E>"u"||E.length===0)&&(E=" ");var I;v=Math.trunc(v);var F=Math.abs(v)-J(p);if(F>0){var X=new Array(F+1).join(E);E.length>1&&(X=B(X,0,F)),v>0?I=p+X:I=X+p}else I=p;return I}}async function Q(p,v){var E=p.apply(this,[v]);if(_(E)&&(E=await E),E&&!(typeof E.start=="number"||E.end==="number"||Array.isArray(E.groups)||f(E.next)))throw{code:"T1010",stack:new Error().stack};return E}async function de(p,v){if(!(typeof p>"u"||typeof v>"u")){var E;if(typeof v=="string")E=p.indexOf(v)!==-1;else{var I=await Q(v,p);E=typeof I<"u"}return E}}async function ne(p,v,E){if(!(typeof p>"u")){if(E<0)throw{stack:new Error().stack,value:E,code:"D3040",index:3};var I=this.createSequence();if(typeof E>"u"||E>0){var F=0,X=await Q(v,p);if(typeof X<"u")for(;typeof X<"u"&&(typeof E>"u"||F<E);)I.push({match:X.match,index:X.start,groups:X.groups}),X=await Q(X.next),F++}return I}}async function ue(p,v,E,I){if(!(typeof p>"u")){var F=this;if(v==="")throw{code:"D3010",stack:new Error().stack,value:v,index:2};if(I<0)throw{code:"D3011",stack:new Error().stack,value:I,index:4};var X;typeof E=="string"?X=function(gt){for(var Mt="",ct=0,St=E.indexOf("$",ct);St!==-1&&ct<E.length;){Mt+=E.substring(ct,St),ct=St+1;var nn=E.charAt(ct);if(nn==="$")Mt+="$",ct++;else if(nn==="0")Mt+=gt.match,ct++;else{var Dt;if(gt.groups.length===0?Dt=1:Dt=Math.floor(Math.log(gt.groups.length)*Math.LOG10E)+1,St=parseInt(E.substring(ct,ct+Dt),10),Dt>1&&St>gt.groups.length&&(St=parseInt(E.substring(ct,ct+Dt-1),10)),isNaN(St))Mt+="$";else{if(gt.groups.length>0){var hn=gt.groups[St-1];typeof hn<"u"&&(Mt+=hn)}ct+=St.toString().length}}St=E.indexOf("$",ct)}return Mt+=E.substring(ct),Mt}:X=E;var me="",ve=0;if(typeof I>"u"||I>0){var $e=0;if(typeof v=="string"){for(var Ne=p.indexOf(v,ve);Ne!==-1&&(typeof I>"u"||$e<I);)me+=p.substring(ve,Ne),me+=E,ve=Ne+v.length,$e++,Ne=p.indexOf(v,ve);me+=p.substring(ve)}else{var ht=await Q(v,p);if(typeof ht<"u"){for(;typeof ht<"u"&&(typeof I>"u"||$e<I);){me+=p.substring(ve,ht.start);var ot=X.apply(F,[ht]);if(_(ot)&&(ot=await ot),typeof ot=="string")me+=ot;else throw{code:"D3012",stack:new Error().stack,value:ot};ve=ht.start+ht.match.length,$e++,ht=await Q(ht.next)}me+=p.substring(ve)}else me=p}}else me=p;return me}}function Te(p){if(!(typeof p>"u")){var v=typeof window<"u"?window.btoa:function(E){return new s.Buffer.from(E,"binary").toString("base64")};return v(p)}}function ke(p){if(!(typeof p>"u")){var v=typeof window<"u"?window.atob:function(E){return new s.Buffer.from(E,"base64").toString("binary")};return v(p)}}function O(p){if(!(typeof p>"u")){var v;try{v=encodeURIComponent(p)}catch{throw{code:"D3140",stack:new Error().stack,value:p,functionName:"encodeUrlComponent"}}return v}}function H(p){if(!(typeof p>"u")){var v;try{v=encodeURI(p)}catch{throw{code:"D3140",stack:new Error().stack,value:p,functionName:"encodeUrl"}}return v}}function we(p){if(!(typeof p>"u")){var v;try{v=decodeURIComponent(p)}catch{throw{code:"D3140",stack:new Error().stack,value:p,functionName:"decodeUrlComponent"}}return v}}function Be(p){if(!(typeof p>"u")){var v;try{v=decodeURI(p)}catch{throw{code:"D3140",stack:new Error().stack,value:p,functionName:"decodeUrl"}}return v}}async function ie(p,v,E){if(!(typeof p>"u")){if(E<0)throw{code:"D3020",stack:new Error().stack,value:E,index:3};var I=[];if(typeof E>"u"||E>0)if(typeof v=="string")I=p.split(v,E);else{var F=0,X=await Q(v,p);if(typeof X<"u"){for(var me=0;typeof X<"u"&&(typeof E>"u"||F<E);)I.push(p.substring(me,X.start)),me=X.end,X=await Q(X.next),F++;(typeof E>"u"||F<E)&&I.push(p.substring(me))}else I.push(p)}return I}}function ce(p,v){if(!(typeof p>"u"))return typeof v>"u"&&(v=""),p.join(v)}function z(p,v,E){if(!(typeof p>"u")){var I={"decimal-separator":".","grouping-separator":",","exponent-separator":"e",infinity:"Infinity","minus-sign":"-",NaN:"NaN",percent:"%","per-mille":"‰","zero-digit":"0",digit:"#","pattern-separator":";"},F=I;typeof E<"u"&&a.keys(E).forEach(function(ge){F[ge]=E[ge]});for(var X=[],me=F["zero-digit"].charCodeAt(0),ve=me;ve<me+10;ve++)X.push(String.fromCharCode(ve));var $e=X.concat([F["decimal-separator"],F["exponent-separator"],F["grouping-separator"],F.digit,F["pattern-separator"]]),Ne=v.split(F["pattern-separator"]);if(Ne.length>2)throw{code:"D3080",stack:new Error().stack};var ht=function(ge){var Ue=(function(){for(var Je,Ke=0;Ke<ge.length;Ke++)if(Je=ge.charAt(Ke),$e.indexOf(Je)!==-1&&Je!==F["exponent-separator"])return ge.substring(0,Ke);return""})(),He=(function(){for(var Je,Ke=ge.length-1;Ke>=0;Ke--)if(Je=ge.charAt(Ke),$e.indexOf(Je)!==-1&&Je!==F["exponent-separator"])return ge.substring(Ke+1);return""})(),Pe=ge.substring(Ue.length,ge.length-He.length),qe,st,at,ft,tt=ge.indexOf(F["exponent-separator"],Ue.length);tt===-1||tt>ge.length-He.length?(qe=Pe,st=void 0):(qe=Pe.substring(0,tt),st=Pe.substring(tt+1));var Ge=qe.indexOf(F["decimal-separator"]);return Ge===-1?(at=qe,ft=He):(at=qe.substring(0,Ge),ft=qe.substring(Ge+1)),{prefix:Ue,suffix:He,activePart:Pe,mantissaPart:qe,exponentPart:st,integerPart:at,fractionalPart:ft,subpicture:ge}},ot=function(ge){var Ue,He,Pe=ge.subpicture,qe=Pe.indexOf(F["decimal-separator"]);qe!==Pe.lastIndexOf(F["decimal-separator"])&&(Ue="D3081"),Pe.indexOf(F.percent)!==Pe.lastIndexOf(F.percent)&&(Ue="D3082"),Pe.indexOf(F["per-mille"])!==Pe.lastIndexOf(F["per-mille"])&&(Ue="D3083"),Pe.indexOf(F.percent)!==-1&&Pe.indexOf(F["per-mille"])!==-1&&(Ue="D3084");var st=!1;for(He=0;He<ge.mantissaPart.length;He++){var at=ge.mantissaPart.charAt(He);if(X.indexOf(at)!==-1||at===F.digit){st=!0;break}}st||(Ue="D3085");var ft=ge.activePart.split("").map(function(Je){return $e.indexOf(Je)===-1?"p":"a"}).join("");ft.indexOf("p")!==-1&&(Ue="D3086"),qe!==-1?(Pe.charAt(qe-1)===F["grouping-separator"]||Pe.charAt(qe+1)===F["grouping-separator"])&&(Ue="D3087"):ge.integerPart.charAt(ge.integerPart.length-1)===F["grouping-separator"]&&(Ue="D3088"),Pe.indexOf(F["grouping-separator"]+F["grouping-separator"])!==-1&&(Ue="D3089");var tt=ge.integerPart.indexOf(F.digit);tt!==-1&&ge.integerPart.substring(0,tt).split("").filter(function(Je){return X.indexOf(Je)>-1}).length>0&&(Ue="D3090"),tt=ge.fractionalPart.lastIndexOf(F.digit),tt!==-1&&ge.fractionalPart.substring(tt).split("").filter(function(Je){return X.indexOf(Je)>-1}).length>0&&(Ue="D3091");var Ge=typeof ge.exponentPart=="string";if(Ge&&ge.exponentPart.length>0&&(Pe.indexOf(F.percent)!==-1||Pe.indexOf(F["per-mille"])!==-1)&&(Ue="D3092"),Ge&&(ge.exponentPart.length===0||ge.exponentPart.split("").filter(function(Je){return X.indexOf(Je)===-1}).length>0)&&(Ue="D3093"),Ue)throw{code:Ue,stack:new Error().stack}},gt=function(ge){var Ue=function(Tt,Vt){for(var wn=[],dt=Tt.indexOf(F["grouping-separator"]);dt!==-1;){var Wt=(Vt?Tt.substring(0,dt):Tt.substring(dt)).split("").filter(function(Ft){return X.indexOf(Ft)!==-1||Ft===F.digit}).length;wn.push(Wt),dt=ge.integerPart.indexOf(F["grouping-separator"],dt+1)}return wn},He=Ue(ge.integerPart),Pe=function(Tt){if(Tt.length===0)return 0;for(var Vt=function(Wt,Ft){return Ft===0?Wt:Vt(Ft,Wt%Ft)},wn=Tt.reduce(Vt),dt=1;dt<=Tt.length;dt++)if(Tt.indexOf(dt*wn)===-1)return 0;return wn},qe=Pe(He),st=Ue(ge.fractionalPart,!0),at=ge.integerPart.split("").filter(function(Tt){return X.indexOf(Tt)!==-1}).length,ft=at,tt=ge.fractionalPart.split(""),Ge=tt.filter(function(Tt){return X.indexOf(Tt)!==-1}).length,Je=tt.filter(function(Tt){return X.indexOf(Tt)!==-1||Tt===F.digit}).length,Ke=typeof ge.exponentPart=="string";at===0&&Je===0&&(Ke?(Ge=1,Je=1):at=1),Ke&&at===0&&ge.integerPart.indexOf(F.digit)!==-1&&(at=1),at===0&&Ge===0&&(Ge=1);var jt=0;return Ke&&(jt=ge.exponentPart.split("").filter(function(Tt){return X.indexOf(Tt)!==-1}).length),{integerPartGroupingPositions:He,regularGrouping:qe,minimumIntegerPartSize:at,scalingFactor:ft,prefix:ge.prefix,fractionalPartGroupingPositions:st,minimumFactionalPartSize:Ge,maximumFactionalPartSize:Je,minimumExponentSize:jt,suffix:ge.suffix,picture:ge.subpicture}},Mt=Ne.map(ht);Mt.forEach(ot);var ct=Mt.map(gt),St=F["minus-sign"],nn=F["zero-digit"],Dt=F["decimal-separator"],hn=F["grouping-separator"];ct.length===1&&(ct.push(JSON.parse(JSON.stringify(ct[0]))),ct[1].prefix=St+ct[1].prefix);var Et;p>=0?Et=ct[0]:Et=ct[1];var ki;Et.picture.indexOf(F.percent)!==-1?ki=p*100:Et.picture.indexOf(F["per-mille"])!==-1?ki=p*1e3:ki=p;var Bn,vi;if(Et.minimumExponentSize===0)Bn=ki;else{var ac=Math.pow(10,Et.scalingFactor),oc=Math.pow(10,Et.scalingFactor-1);if(Bn=ki,vi=0,Bn!==0){for(;Math.abs(Bn)<oc;)Bn*=10,vi-=1;for(;Math.abs(Bn)>ac;)Bn/=10,vi+=1}}var lc=ee(Bn,Et.maximumFactionalPartSize),P=function(ge,Ue){var He=Math.abs(ge).toFixed(Ue);return nn!=="0"&&(He=He.split("").map(function(Pe){return Pe>="0"&&Pe<="9"?X[Pe.charCodeAt(0)-48]:Pe}).join("")),He},G=P(lc,Et.maximumFactionalPartSize),Z=G.indexOf(".");for(Z===-1?G=G+Dt:G=G.replace(".",Dt);G.charAt(0)===nn;)G=G.substring(1);for(;G.charAt(G.length-1)===nn;)G=G.substring(0,G.length-1);Z=G.indexOf(Dt);var te=Et.minimumIntegerPartSize-Z,Y=Et.minimumFactionalPartSize-(G.length-Z-1);if(G=(te>0?new Array(te+1).join(nn):"")+G,G=G+(Y>0?new Array(Y+1).join(nn):""),Z=G.indexOf(Dt),Et.regularGrouping>0)for(var Ee=Math.floor((Z-1)/Et.regularGrouping),Le=1;Le<=Ee;Le++)G=[G.slice(0,Z-Le*Et.regularGrouping),hn,G.slice(Z-Le*Et.regularGrouping)].join("");else Et.integerPartGroupingPositions.forEach(function(ge){G=[G.slice(0,Z-ge),hn,G.slice(Z-ge)].join(""),Z++});if(Z=G.indexOf(Dt),Et.fractionalPartGroupingPositions.forEach(function(ge){G=[G.slice(0,ge+Z+1),hn,G.slice(ge+Z+1)].join("")}),Z=G.indexOf(Dt),(Et.picture.indexOf(Dt)===-1||Z===G.length-1)&&(G=G.substring(0,G.length-1)),typeof vi<"u"){var Fe=P(vi,0);te=Et.minimumExponentSize-Fe.length,te>0&&(Fe=new Array(te+1).join(nn)+Fe),G=G+F["exponent-separator"]+(vi<0?St:"")+Fe}return G=Et.prefix+G+Et.suffix,G}}function j(p,v){if(!(typeof p>"u")){if(p=ee(p),typeof v>"u"?v=10:v=ee(v),v<2||v>36)throw{code:"D3100",stack:new Error().stack,value:v};var E=p.toString(v);return E}}function W(p){var v;if(!(typeof p>"u")){if(typeof p=="number")v=p;else if(typeof p=="string"&&/^-?[0-9]+(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test(p)&&!isNaN(parseFloat(p))&&isFinite(p))v=parseFloat(p);else if(typeof p=="string"&&/^(0[xX][0-9A-Fa-f]+)|(0[oO][0-7]+)|(0[bB][0-1]+)$/.test(p))v=Number(p);else if(p===!0)v=1;else if(p===!1)v=0;else throw{code:"D3030",value:p,stack:new Error().stack,index:1};return v}}function le(p){var v;if(!(typeof p>"u"))return v=Math.abs(p),v}function be(p){var v;if(!(typeof p>"u"))return v=Math.floor(p),v}function U(p){var v;if(!(typeof p>"u"))return v=Math.ceil(p),v}function ee(p,v){var E;if(!(typeof p>"u")){if(v){var I=p.toString().split("e");p=+(I[0]+"e"+(I[1]?+I[1]+v:v))}E=Math.round(p);var F=E-p;return Math.abs(F)===.5&&Math.abs(E%2)===1&&(E=E-1),v&&(I=E.toString().split("e"),E=+(I[0]+"e"+(I[1]?+I[1]-v:-v))),Object.is(E,-0)&&(E=0),E}}function fe(p){var v;if(!(typeof p>"u")){if(p<0)throw{stack:new Error().stack,code:"D3060",index:1,value:p};return v=Math.sqrt(p),v}}function ye(p,v){var E;if(!(typeof p>"u")){if(E=Math.pow(p,v),!isFinite(E))throw{stack:new Error().stack,code:"D3061",index:1,value:p,exp:v};return E}}function Se(){return Math.random()}function ze(p){if(!(typeof p>"u")){var v=!1;if(Array.isArray(p)){if(p.length===1)v=ze(p[0]);else if(p.length>1){var E=p.filter(function(I){return ze(I)});v=E.length>0}}else typeof p=="string"?p.length>0&&(v=!0):l(p)?p!==0&&(v=!0):p!==null&&typeof p=="object"&&!f(p)?a.keys(p).length>0&&(v=!0):typeof p=="boolean"&&p===!0&&(v=!0);return v}}function _e(p){if(!(typeof p>"u"))return!ze(p)}function xe(p,v,E,I){var F=[v],X=b(p);return X>=2&&F.push(E),X>=3&&F.push(I),F}async function Xe(p,v){if(!(typeof p>"u")){for(var E=this.createSequence(),I=0;I<p.length;I++){var F=xe(v,p[I],I,p),X=await v.apply(this,F);typeof X<"u"&&E.push(X)}return E}}async function De(p,v){if(!(typeof p>"u")){for(var E=this.createSequence(),I=0;I<p.length;I++){var F=p[I],X=xe(v,F,I,p),me=await v.apply(this,X);ze(me)&&E.push(F)}return E}}async function N(p,v){if(!(typeof p>"u")){for(var E=!1,I,F=0;F<p.length;F++){var X=p[F],me=!0;if(typeof v<"u"){var ve=xe(v,X,F,p),$e=await v.apply(this,ve);me=ze($e)}if(me)if(!E)I=X,E=!0;else throw{stack:new Error().stack,code:"D3138",index:F}}if(!E)throw{stack:new Error().stack,code:"D3139"};return I}}function w(){for(var p=[],v=Array.prototype.slice.call(arguments),E=Math.min.apply(Math,v.map(function(X){return Array.isArray(X)?X.length:0})),I=0;I<E;I++){var F=v.map(X=>X[I]);p.push(F)}return p}async function q(p,v,E){if(!(typeof p>"u")){var I,F=b(v);if(F<2)throw{stack:new Error().stack,code:"D3050",index:1};var X;for(typeof E>"u"&&p.length>0?(I=p[0],X=1):(I=E,X=0);X<p.length;){var me=[I,p[X]];F>=3&&me.push(X),F>=4&&me.push(p),I=await v.apply(this,me),X++}return I}}function re(p){var v=this.createSequence();if(Array.isArray(p)){for(var E=Object.create(null),I=0;I<p.length;I++){var F=re.call(this,p[I]);F.forEach(function(X){E[X]=!0})}v=re.call(this,E)}else p!==null&&typeof p=="object"&&!f(p)&&a.keys(p).forEach(X=>v.push(X));return v}function pe(p,v){var E;if(Array.isArray(p)){E=this.createSequence();for(var I=0;I<p.length;I++){var F=pe.call(this,p[I],v);typeof F<"u"&&(Array.isArray(F)?F.forEach(X=>E.push(X)):E.push(F))}}else p!==null&&typeof p=="object"&&Object.prototype.hasOwnProperty.call(p,v)&&!f(p)&&(E=p[v]);return E}function ae(p,v){if(typeof p>"u")return v;if(typeof v>"u")return p;Array.isArray(p)||(p=this.createSequence(p)),Array.isArray(v)||(v=[v]);const E=p.length+v.length;if(this.options&&E>this.options.sequence)throw{code:"D2015",stack:new Error().stack,value:E};return p.concat(v)}function Ve(p){return!(typeof p>"u")}function Ae(p){var v=this.createSequence();if(Array.isArray(p))for(var E=0;E<p.length;E++)v=ae.call(this,v,Ae.call(this,p[E]));else if(p!==null&&typeof p=="object"&&!d(p))for(const F of a.keys(p)){var I=Object.create(null);I[F]=p[F],v.push(I)}else v=p;return v}function oe(p){if(!(typeof p>"u")){var v=Object.create(null);return p.forEach(function(E){for(const I of a.keys(E))v[I]=E[I]}),v}}function We(p){if(!(typeof p>"u")){if(p.length<=1)return p;for(var v=p.length,E=new Array(v),I=0;I<v;I++)E[v-I-1]=p[I];return E}}async function Me(p,v){var E=this.createSequence();for(const X of a.keys(p)){var I=xe(v,p[X],X,p),F=await v.apply(this,I);typeof F<"u"&&E.push(F)}return E}function Re(p){throw{code:"D3137",stack:new Error().stack,message:p||"$error() function evaluated"}}function je(p,v){if(!p)throw{code:"D3141",stack:new Error().stack,message:v||"$assert() statement failed"}}function Oe(p){if(p!==void 0)return p===null?"null":l(p)?"number":typeof p=="string"?"string":typeof p=="boolean"?"boolean":Array.isArray(p)?"array":f(p)?"function":"object"}async function Ce(p,v){if(!(typeof p>"u")){if(p.length<=1)return p;var E;if(typeof v>"u"){if(!h(p)&&!c(p))throw{stack:new Error().stack,code:"D3070",index:1};E=async function(me,ve){return me>ve}}else E=v;var I=async function(me,ve){var $e=async function(ht,ot,gt){ot.length===0?Array.prototype.push.apply(ht,gt):gt.length===0?Array.prototype.push.apply(ht,ot):await E(ot[0],gt[0])?(ht.push(gt[0]),await $e(ht,ot,gt.slice(1))):(ht.push(ot[0]),await $e(ht,ot.slice(1),gt))},Ne=[];return await $e(Ne,me,ve),Ne},F=async function(me){if(!Array.isArray(me)||me.length<=1)return me;var ve=Math.floor(me.length/2),$e=me.slice(0,ve),Ne=me.slice(ve);return $e=await F($e),Ne=await F(Ne),await I($e,Ne)},X=await F(p);return X}}function A(p){if(!(typeof p>"u")){if(p.length<=1)return p;for(var v=new Array(p.length),E=0;E<p.length;E++){var I=Math.floor(Math.random()*(E+1));E!==I&&(v[E]=v[I]),v[I]=p[E]}return v}}function x(p){if(!(typeof p>"u")){if(!Array.isArray(p)||p.length<=1)return p;for(var v=u(p)?this.createSequence():[],E=0;E<p.length;E++){for(var I=p[E],F=!1,X=0;X<v.length;X++)if(g(I,v[X])){F=!0;break}F||v.push(I)}return v}}async function L(p,v){var E=Object.create(null);for(const me of a.keys(p)){var I=p[me],F=xe(v,I,me,p),X=await v.apply(this,F);ze(X)&&(E[me]=I)}return a.keys(E).length===0&&(E=void 0),E}return{sum:S,count:y,max:M,min:T,average:R,string:k,substring:B,substringBefore:C,substringAfter:D,lowercase:V,uppercase:K,length:J,trim:se,pad:he,match:ne,contains:de,replace:ue,split:ie,join:ce,formatNumber:z,formatBase:j,number:W,floor:be,ceil:U,round:ee,abs:le,sqrt:fe,power:ye,random:Se,boolean:ze,not:_e,map:Xe,zip:w,filter:De,single:N,foldLeft:q,sift:L,keys:re,lookup:pe,append:ae,exists:Ve,spread:Ae,merge:oe,reverse:We,each:Me,error:Re,assert:je,type:Oe,sort:Ce,shuffle:A,distinct:x,base64encode:Te,base64decode:ke,encodeUrlComponent:O,encodeUrl:H,decodeUrlComponent:we,decodeUrl:Be}})();n.exports=o}).call(this)}).call(this,typeof jc<"u"?jc:typeof self<"u"?self:typeof window<"u"?window:{})},{"./utils":6}],3:[function(t,n,r){var s=t("./datetime"),a=t("./functions"),o=t("./utils"),l=t("./parser"),c=t("./signature"),h=(function(){var u=o.isNumeric,f=o.isArrayOfStrings,d=o.isArrayOfNumbers,_=o.isSequence,b=o.isFunction,g=o.isLambda,m=o.isIterable,S=o.isPromise,y=o.getFunctionArity,M=o.isDeepEqual,T=Re(null);async function R(A,x,L){var p;L.base.depth++,L.base.guardrails();var v=L.lookup(Symbol.for("jsonata.__evaluate_entry"));switch(v&&await v(A,x,L),A.type){case"path":p=await k(A,x,L);break;case"binary":p=await J(A,x,L);break;case"unary":p=await se(A,x,L);break;case"name":p=he(A,x,L);break;case"string":case"number":case"value":p=Q(A);break;case"wildcard":p=de(A,x,L);break;case"descendant":p=ue(A,x,L);break;case"parent":p=L.lookup(A.slot.label);break;case"condition":p=await be(A,x,L);break;case"block":p=await U(A,x,L);break;case"bind":p=await le(A,x,L);break;case"regex":p=ee(A,x,L);break;case"function":p=await xe(A,x,L);break;case"variable":p=fe(A,x,L);break;case"lambda":p=N(A,x,L);break;case"partial":p=await w(A,x,L);break;case"apply":p=await _e(A,x,L);break;case"transform":p=Se(A,x,L);break}if(Object.prototype.hasOwnProperty.call(A,"predicate"))for(var E=0;E<A.predicate.length;E++)p=await K(A.predicate[E].expr,p,L);A.type!=="path"&&Object.prototype.hasOwnProperty.call(A,"group")&&(p=await z(A.group,p,L));var I=L.lookup(Symbol.for("jsonata.__evaluate_exit"));return I&&await I(A,x,L,p),p&&_(p)&&!p.tupleStream&&(A.keepArray&&(p.keepSingleton=!0),p.length===0?p=void 0:p.length===1&&(p=p.keepSingleton?p:p[0])),L.base.depth--,p}async function k(A,x,L){var p;Array.isArray(x)&&A.steps[0].type!=="variable"?p=x:p=L.base.createSequence(x);for(var v,E=!1,I=void 0,F=0;F<A.steps.length;F++){var X=A.steps[F];if(X.tuple&&(E=!0),F===0&&X.consarray?v=await R(X,p,L):E?I=await V(X,p,I,L):v=await C(X,p,L,F===A.steps.length-1),!E&&(typeof v>"u"||v.length===0))break;typeof X.focus>"u"&&(p=v)}if(E)if(A.tuple)v=I;else for(v=L.base.createSequence(),F=0;F<I.length;F++)v.push(I[F]["@"]);return A.keepSingletonArray&&(Array.isArray(v)&&v.cons&&!v.sequence&&(v=L.base.createSequence(v)),v.keepSingleton=!0),Object.prototype.hasOwnProperty.call(A,"group")&&(v=await z(A.group,E?I:v,L)),v}function B(A,x){var L=Re(A);for(const p of o.keys(x))L.bind(p,x[p]);return L}async function C(A,x,L,p){var v;if(A.type==="sort")return v=await ye(A,x,L),A.stages&&(v=await D(A.stages,v,L)),v;v=L.base.createSequence();for(var E=0;E<x.length;E++){var I=await R(A,x[E],L);if(A.stages)for(var F=0;F<A.stages.length;F++)I=await K(A.stages[F].expr,I,L);typeof I<"u"&&v.push(I)}var X=L.base.createSequence();return p&&v.length===1&&Array.isArray(v[0])&&!_(v[0])?X=v[0]:Array.prototype.forEach.call(v,function(me){!Array.isArray(me)||me.cons?X.push(me):Array.prototype.forEach.call(me,ve=>X.push(ve))}),X}async function D(A,x,L){for(var p=x,v=0;v<A.length;v++){var E=A[v];switch(E.type){case"filter":p=await K(E.expr,p,L);break;case"index":for(var I=0;I<p.length;I++){var F=p[I];F[E.value]=I}break}}return p}async function V(A,x,L,p){var v;if(A.type==="sort"){if(L)v=await ye(A,L,p);else{var E=await ye(A,x,p);v=p.base.createSequence(),v.tupleStream=!0;for(var I=0;I<E.length;I++){var F={"@":E[I]};F[A.index]=I,v.push(F)}}return A.stages&&(v=await D(A.stages,v,p)),v}v=p.base.createSequence(),v.tupleStream=!0;var X=p;L===void 0&&(L=x.map(Ne=>({"@":Ne})));for(var me=0;me<L.length;me++){X=B(p,L[me]);var ve=await R(A,L[me]["@"],X);if(typeof ve<"u"){Array.isArray(ve)||(ve=[ve]);for(var $e=0;$e<ve.length;$e++)F=Object.create(null),Object.assign(F,L[me]),ve.tupleStream?Object.assign(F,ve[$e]):(A.focus?(F[A.focus]=ve[$e],F["@"]=L[me]["@"]):F["@"]=ve[$e],A.index&&(F[A.index]=$e),A.ancestor&&(F[A.ancestor.label]=L[me]["@"])),v.push(F)}}return A.stages&&(v=await D(A.stages,v,p)),v}async function K(A,x,L){var p=L.base.createSequence();if(x&&x.tupleStream&&(p.tupleStream=!0),Array.isArray(x)||(x=L.base.createSequence(x)),A.type==="number"){var v=Math.floor(A.value);v<0&&(v=x.length+v);var E=await x[v];typeof E<"u"&&(Array.isArray(E)?p=E:p.push(E))}else for(v=0;v<x.length;v++){var E=x[v],I=E,F=L;x.tupleStream&&(I=E["@"],F=B(L,E));var X=await R(A,I,F);u(X)&&(X=[X]),d(X)?Array.prototype.forEach.call(X,function(ve){var $e=Math.floor(ve);$e<0&&($e=x.length+$e),$e===v&&p.push(E)}):a.boolean(X)&&p.push(E)}return p}async function J(A,x,L){var p,v=await R(A.lhs,x,L),E=A.value,I=async()=>await R(A.rhs,x,L);if(E==="and"||E==="or")try{return await Be(v,I,E)}catch(X){throw X.position=A.position,X.token=E,X}var F=await I();try{switch(E){case"+":case"-":case"*":case"/":case"%":p=ke(v,F,E);break;case"=":case"!=":p=O(v,F,E);break;case"<":case"<=":case">":case">=":p=H(v,F,E);break;case"&":p=ce(v,F);break;case"..":p=W(v,F,L);break;case"in":p=we(v,F);break}}catch(X){throw X.position=A.position,X.token=E,X}return p}async function se(A,x,L){var p,v={options:L.base.options,createSequence:L.base.createSequence};switch(A.value){case"-":if(p=await R(A.expression,x,L),typeof p>"u")p=void 0;else if(u(p))p=-p;else throw{code:"D1002",stack:new Error().stack,position:A.position,token:A.value,value:p};break;case"[":p=[];let F=await Promise.all(A.expressions.map(async(X,me)=>(L.isParallelCall=me>0,[X,await R(X,x,L)])));for(let X of F){var[E,I]=X;typeof I<"u"&&(E.value==="["?p.push(I):p=a.append.call(v,p,I))}A.consarray&&Object.defineProperty(p,"cons",{enumerable:!1,configurable:!1,value:!0});break;case"{":p=await z(A,x,L);break}return p}function he(A,x,L){var p={createSequence:L.base.createSequence};return a.lookup.call(p,x,A.value)}function Q(A){return A.value}function de(A,x,L){var p={options:L.base.options,createSequence:L.base.createSequence},v=p.createSequence();return Array.isArray(x)&&x.outerWrapper&&x.length>0&&(x=x[0]),x!==null&&typeof x=="object"&&!b(x)&&o.keys(x).forEach(function(E){var I=x[E];Array.isArray(I)?(I=ne(I),v=a.append.call(p,v,I)):v.push(I)}),v}function ne(A,x){return typeof x>"u"&&(x=[]),Array.isArray(A)?Array.prototype.forEach.call(A,function(L){ne(L,x)}):x.push(A),x}function ue(A,x,L){var p,v=L.base.createSequence();return typeof x<"u"&&(Te(x,v),v.length===1?p=v[0]:p=v),p}function Te(A,x){Array.isArray(A)||x.push(A),Array.isArray(A)?Array.prototype.forEach.call(A,function(L){Te(L,x)}):A!==null&&typeof A=="object"&&!b(A)&&o.keys(A).forEach(function(L){Te(A[L],x)})}function ke(A,x,L){var p;if(typeof A<"u"&&!u(A))throw{code:"T2001",stack:new Error().stack,value:A};if(typeof x<"u"&&!u(x))throw{code:"T2002",stack:new Error().stack,value:x};if(typeof A>"u"||typeof x>"u")return p;switch(L){case"+":p=A+x;break;case"-":p=A-x;break;case"*":p=A*x;break;case"/":p=A/x;break;case"%":p=A%x;break}return p}function O(A,x,L){var p,v=typeof A,E=typeof x;if(v==="undefined"||E==="undefined")return!1;switch(L){case"=":p=M(A,x);break;case"!=":p=!M(A,x);break}return p}function H(A,x,L){var p,v=typeof A,E=typeof x,I=v==="undefined"||v==="string"||v==="number",F=E==="undefined"||E==="string"||E==="number";if(!I||!F)throw{code:"T2010",stack:new Error().stack,value:v==="string"||v==="number"?x:A};if(!(v==="undefined"||E==="undefined")){if(v!==E)throw{code:"T2009",stack:new Error().stack,value:A,value2:x};switch(L){case"<":p=A<x;break;case"<=":p=A<=x;break;case">":p=A>x;break;case">=":p=A>=x;break}return p}}function we(A,x){var L=!1;if(typeof A>"u"||typeof x>"u")return!1;Array.isArray(x)||(x=[x]);for(var p=0;p<x.length;p++)if(x[p]===A){L=!0;break}return L}async function Be(A,x,L){var p,v=ie(A);switch(L){case"and":p=v&&ie(await x());break;case"or":p=v||ie(await x());break}return p}function ie(A){var x=a.boolean(A);return typeof x>"u"?!1:x}function ce(A,x){var L,p="",v="";return typeof A<"u"&&(p=a.string(A)),typeof x<"u"&&(v=a.string(x)),L=p.concat(v),L}async function z(A,x,L){var p=Object.create(null),v=Object.create(null),E=!!(x&&x.tupleStream),I={options:L.base.options,createSequence:L.base.createSequence};Array.isArray(x)||(L.base.options,x=I.createSequence(x)),x.length===0&&!E&&x.push(void 0);for(var F=0;F<x.length;F++)for(var X=x[F],me=E?B(L,X):L,ve=0;ve<A.lhs.length;ve++){var $e=A.lhs[ve],Ne=await R($e[0],E?X["@"]:X,me);if(typeof Ne!="string"&&Ne!==void 0)throw{code:"T1003",stack:new Error().stack,position:A.position,value:Ne};if(Ne!==void 0){if(Ne==="_jsonata_lambda"||Ne==="_jsonata_function")throw{code:"D1013",stack:new Error().stack,position:A.position,value:Ne};var ht={data:X,exprIndex:ve};if(Object.prototype.hasOwnProperty.call(v,Ne)){if(v[Ne].exprIndex!==ve)throw{code:"D1009",stack:new Error().stack,position:A.position,value:Ne};v[Ne].data=a.append.call(I,v[Ne].data,X)}else v[Ne]=ht}}let ot=await Promise.all(o.keys(v).map(async(Mt,ct)=>{let St=v[Mt];var nn=St.data,Dt=L;if(E){var hn=j(St.data,L);nn=hn["@"],delete hn["@"],Dt=B(L,hn)}return L.isParallelCall=ct>0,[Mt,await R(A.lhs[St.exprIndex][1],nn,Dt)]}));for(let Mt of ot){var[Ne,gt]=await Mt;typeof gt<"u"&&(p[Ne]=gt)}return p}function j(A,x){if(!Array.isArray(A))return A;var L=Object.create(null),p={options:x.base.options,createSequence:x.base.createSequence};Object.assign(L,A[0]);for(var v=1;v<A.length;v++)for(const E of o.keys(A[v]))L[E]=a.append.call(p,L[E],A[v][E]);return L}function W(A,x,L){var p;if(typeof A<"u"&&!Number.isInteger(A))throw{code:"T2003",stack:new Error().stack,value:A};if(typeof x<"u"&&!Number.isInteger(x))throw{code:"T2004",stack:new Error().stack,value:x};if(typeof A>"u"||typeof x>"u"||A>x)return p;var v=x-A+1;if(v>1e7)throw{code:"D2014",stack:new Error().stack,value:v};if(L.base.options&&v>L.base.options.sequence)throw{code:"D2015",stack:new Error().stack,value:v};p=new Array(v);for(var E=A,I=0;E<=x;E++,I++)p[I]=E;return p.sequence=!0,p}async function le(A,x,L){var p=await R(A.rhs,x,L);return L.bind(A.lhs.value,p),p}async function be(A,x,L){var p,v=await R(A.condition,x,L);return a.boolean(v)?p=await R(A.then,x,L):typeof A.else<"u"&&(p=await R(A.else,x,L)),p}async function U(A,x,L){for(var p,v=Re(L),E=0;E<A.expressions.length;E++)p=await R(A.expressions[E],x,v);return p}function ee(A,x,L){var p=new L.base.RegexEngine(A.value),v=function(E,I){var F;p.lastIndex=I||0;var X=p.exec(E);if(X!==null){if(F={match:X[0],start:X.index,end:X.index+X[0].length,groups:[]},X.length>1)for(var me=1;me<X.length;me++)F.groups.push(X[me]);F.next=function(){if(!(p.lastIndex>=E.length)){var ve=v(E,p.lastIndex);if(ve&&ve.match==="")throw{code:"D1004",stack:new Error().stack,position:A.position,value:A.value.source};return ve}}}return F};return v}function fe(A,x,L){var p;return A.value===""?p=x&&x.outerWrapper?x[0]:x:p=L.lookup(A.value),p}async function ye(A,x,L){var p,v=x,E=!!x.tupleStream,I=async function(X,me){for(var ve=0,$e=0;ve===0&&$e<A.terms.length;$e++){var Ne=A.terms[$e],ht=X,ot=L;E&&(ht=X["@"],ot=B(L,X));var gt=await R(Ne.expression,ht,ot);ht=me,ot=L,E&&(ht=me["@"],ot=B(L,me));var Mt=await R(Ne.expression,ht,ot),ct=typeof gt,St=typeof Mt;if(ct==="undefined"){ve=St==="undefined"?0:1;continue}if(St==="undefined"){ve=-1;continue}if(!(ct==="string"||ct==="number")||!(St==="string"||St==="number"))throw{code:"T2008",stack:new Error().stack,position:A.position,value:ct==="string"||ct==="number"?Mt:gt};if(ct!==St)throw{code:"T2007",stack:new Error().stack,position:A.position,value:gt,value2:Mt};gt!==Mt&&(gt<Mt?ve=-1:ve=1,Ne.descending===!0&&(ve=-ve))}return ve===1},F={environment:L,input:x};return p=await a.sort.apply(F,[v,I]),p}function Se(A,x,L){var p=async function(v){if(!(typeof v>"u")){var E=L.lookup("clone");if(!b(E))throw{code:"T2013",stack:new Error().stack,position:A.position};var I=await Xe(E,[v],null,L),F=await R(A.pattern,I,L);if(typeof F<"u"){Array.isArray(F)||(F=[F]);for(var X=0;X<F.length;X++){var me=F[X],ve=await R(A.update,me,L),$e=typeof ve;if($e!=="undefined"){if($e!=="object"||ve===null||Array.isArray(ve))throw{code:"T2011",stack:new Error().stack,position:A.update.position,value:ve};for(const gt of o.keys(ve))me[gt]=ve[gt]}if(typeof A.delete<"u"){var Ne=await R(A.delete,me,L);if(typeof Ne<"u"){var ht=Ne;if(Array.isArray(Ne)||(Ne=[Ne]),!f(Ne))throw{code:"T2012",stack:new Error().stack,position:A.delete.position,value:ht};for(var ot=0;ot<Ne.length;ot++)typeof me=="object"&&me!==null&&delete me[Ne[ot]]}}}}return I}};return oe(p,"<(oa):o>")}var ze=l("function($f, $g) { function($x){ $g($f($x)) } }");async function _e(A,x,L){var p,v=await R(A.lhs,x,L);if(A.rhs.type==="function")p=await xe(A.rhs,x,L,{context:v});else{var E=await R(A.rhs,x,L);if(!b(E))throw{code:"T2006",stack:new Error().stack,position:A.position,value:E};if(b(v)){var I=await R(ze,null,L);p=await Xe(I,[v,E],null,L)}else p=await Xe(E,[v],null,L)}return p}async function xe(A,x,L,p){var v,E=await R(A.procedure,x,L);if(typeof E>"u"&&A.procedure.type==="path"&&L.lookup(A.procedure.steps[0].value))throw{code:"T1005",stack:new Error().stack,position:A.position,token:A.procedure.steps[0].value};var I=[];typeof p<"u"&&I.push(p.context);for(var F=0;F<A.arguments.length;F++){const me=await R(A.arguments[F],x,L);if(b(me)){const ve=async function(...$e){return await Xe(me,$e,null,L)};ve.arity=y(me),I.push(ve)}else I.push(me)}var X=A.procedure.type==="path"?A.procedure.steps[0].value:A.procedure.value;try{typeof E=="object"&&(E.token=X,E.position=A.position),v=await Xe(E,I,x,L)}catch(me){throw me.position||(me.position=A.position),me.token||(me.token=X),me}return v}async function Xe(A,x,L,p){var v;for(v=await De(A,x,L,p);g(v)&&v.thunk===!0;){var E=await R(v.body.procedure,v.input,v.environment);v.body.procedure.type==="variable"&&(E.token=v.body.procedure.value),E.position=v.body.procedure.position;for(var I=[],F=0;F<v.body.arguments.length;F++)I.push(await R(v.body.arguments[F],v.input,v.environment));v=await De(E,I,L,p)}return v}async function De(A,x,L,p){var v;try{var E=x;if(A&&(E=q(A.signature,x,L)),g(A))v=await re(A,E);else if(A&&A._jsonata_function===!0){var I={environment:p,input:L,options:p.base.options,createSequence:p.base.createSequence};v=A.implementation.apply(I,E),m(v)&&(v=v.next().value),S(v)&&(v=await v)}else if(typeof A=="function")v=A.apply(L,E),S(v)&&(v=await v);else throw{code:"T1006",stack:new Error().stack}}catch(F){throw A&&(typeof F.token>"u"&&typeof A.token<"u"&&(F.token=A.token),F.position=A.position||F.position),F}return v}function N(A,x,L){var p={_jsonata_lambda:!0,input:x,environment:L,arguments:A.arguments,signature:A.signature,body:A.body};return A.thunk===!0&&(p.thunk=!0),p.apply=async function(v,E){return await Xe(p,E,x,v?v.environment:L)},p}async function w(A,x,L){for(var p,v=[],E=0;E<A.arguments.length;E++){var I=A.arguments[E];I.type==="operator"&&I.value==="?"?v.push(I):v.push(await R(I,x,L))}var F=await R(A.procedure,x,L);if(typeof F>"u"&&A.procedure.type==="path"&&L.lookup(A.procedure.steps[0].value))throw{code:"T1007",stack:new Error().stack,position:A.position,token:A.procedure.steps[0].value};if(g(F))p=pe(F,v,L);else if(F&&F._jsonata_function===!0)p=ae(F.implementation,v,L);else if(typeof F=="function")p=ae(F,v,L);else throw{code:"T1008",stack:new Error().stack,position:A.position,token:A.procedure.type==="path"?A.procedure.steps[0].value:A.procedure.value};return p}function q(A,x,L){if(typeof A>"u")return x;var p=A.validate(x,L);return p}async function re(A,x){var L,p=Re(A.environment);return Array.prototype.forEach.call(A.arguments,function(v,E){p.bind(v.value,x[E])}),typeof A.body=="function"?L=await Ve(A.body,p):L=await R(A.body,A.input,p),L}function pe(A,x,L){var p=Re(A.environment||L),v=[];Array.prototype.forEach.call(A.arguments,function(I,F){var X=x[F];X&&X.type==="operator"&&X.value==="?"?v.push(I):p.bind(I.value,X)});var E={_jsonata_lambda:!0,input:A.input,environment:p,arguments:v,body:A.body};return E}function ae(A,x,L){var p=Ae(A);p=p.map(function(F){return"$"+F.trim()});var v="function("+p.join(", ")+"){ _ }",E=l(v);E.body=A;var I=pe(E,x,L);return I}async function Ve(A,x){var L=Ae(A),p=L.map(function(I){return x.lookup(I.trim())}),v={environment:x,createSequence:x.base.createSequence},E=A.apply(v,p);return S(E)&&(E=await E),E}function Ae(A){var x=A.toString(),L=/\(([^)]*)\)/.exec(x)[1],p=L.split(",");return p}function oe(A,x){var L={_jsonata_function:!0,implementation:A};return typeof x<"u"&&(L.signature=c(x)),L}async function We(A,x){if(!(typeof A>"u")){var L=this.input;typeof x<"u"&&(L=x,Array.isArray(L)&&!_(L)&&(L=this.createSequence(L),L.outerWrapper=!0));try{var p=l(A,!1)}catch(E){throw Oe(E),{stack:new Error().stack,code:"D3120",value:E.message,error:E}}try{var v=await R(p,L,this.environment)}catch(E){throw Oe(E),{stack:new Error().stack,code:"D3121",value:E.message,error:E}}return v}}function Me(A){if(!(typeof A>"u"))return JSON.parse(a.string(A))}function Re(A){var x=Object.create(null);const L={bind:function(v,E){x[v]=E},lookup:function(v){var E;return Object.prototype.hasOwnProperty.call(x,v)?E=x[v]:A&&(E=A.lookup(v)),E},timestamp:A?A.timestamp:null,async:A?A.async:!1,isParallelCall:A?A.isParallelCall:!1,global:A?A.global:{ancestry:[null]}};if(A){var p=A.lookup(Symbol.for("jsonata.__createFrame_push"));p&&p(A,L),L.base=A.base}return L}T.bind("sum",oe(a.sum,"<a<n>:n>")),T.bind("count",oe(a.count,"<a:n>")),T.bind("max",oe(a.max,"<a<n>:n>")),T.bind("min",oe(a.min,"<a<n>:n>")),T.bind("average",oe(a.average,"<a<n>:n>")),T.bind("string",oe(a.string,"<x-b?:s>")),T.bind("substring",oe(a.substring,"<s-nn?:s>")),T.bind("substringBefore",oe(a.substringBefore,"<s-s:s>")),T.bind("substringAfter",oe(a.substringAfter,"<s-s:s>")),T.bind("lowercase",oe(a.lowercase,"<s-:s>")),T.bind("uppercase",oe(a.uppercase,"<s-:s>")),T.bind("length",oe(a.length,"<s-:n>")),T.bind("trim",oe(a.trim,"<s-:s>")),T.bind("pad",oe(a.pad,"<s-ns?:s>")),T.bind("match",oe(a.match,"<s-f<s:o>n?:a<o>>")),T.bind("contains",oe(a.contains,"<s-(sf):b>")),T.bind("replace",oe(a.replace,"<s-(sf)(sf)n?:s>")),T.bind("split",oe(a.split,"<s-(sf)n?:a<s>>")),T.bind("join",oe(a.join,"<a<s>s?:s>")),T.bind("formatNumber",oe(a.formatNumber,"<n-so?:s>")),T.bind("formatBase",oe(a.formatBase,"<n-n?:s>")),T.bind("formatInteger",oe(s.formatInteger,"<n-s:s>")),T.bind("parseInteger",oe(s.parseInteger,"<s-s:n>")),T.bind("number",oe(a.number,"<(nsb)-:n>")),T.bind("floor",oe(a.floor,"<n-:n>")),T.bind("ceil",oe(a.ceil,"<n-:n>")),T.bind("round",oe(a.round,"<n-n?:n>")),T.bind("abs",oe(a.abs,"<n-:n>")),T.bind("sqrt",oe(a.sqrt,"<n-:n>")),T.bind("power",oe(a.power,"<n-n:n>")),T.bind("random",oe(a.random,"<:n>")),T.bind("boolean",oe(a.boolean,"<x-:b>")),T.bind("not",oe(a.not,"<x-:b>")),T.bind("map",oe(a.map,"<af>")),T.bind("zip",oe(a.zip,"<a+>")),T.bind("filter",oe(a.filter,"<af>")),T.bind("single",oe(a.single,"<af?>")),T.bind("reduce",oe(a.foldLeft,"<afj?:j>")),T.bind("sift",oe(a.sift,"<o-f?:o>")),T.bind("keys",oe(a.keys,"<x-:a<s>>")),T.bind("lookup",oe(a.lookup,"<x-s:x>")),T.bind("append",oe(a.append,"<xx:a>")),T.bind("exists",oe(a.exists,"<x:b>")),T.bind("spread",oe(a.spread,"<x-:a<o>>")),T.bind("merge",oe(a.merge,"<a<o>:o>")),T.bind("reverse",oe(a.reverse,"<a:a>")),T.bind("each",oe(a.each,"<o-f:a>")),T.bind("error",oe(a.error,"<s?:x>")),T.bind("assert",oe(a.assert,"<bs?:x>")),T.bind("type",oe(a.type,"<x:s>")),T.bind("sort",oe(a.sort,"<af?:a>")),T.bind("shuffle",oe(a.shuffle,"<a:a>")),T.bind("distinct",oe(a.distinct,"<x:x>")),T.bind("base64encode",oe(a.base64encode,"<s-:s>")),T.bind("base64decode",oe(a.base64decode,"<s-:s>")),T.bind("encodeUrlComponent",oe(a.encodeUrlComponent,"<s-:s>")),T.bind("encodeUrl",oe(a.encodeUrl,"<s-:s>")),T.bind("decodeUrlComponent",oe(a.decodeUrlComponent,"<s-:s>")),T.bind("decodeUrl",oe(a.decodeUrl,"<s-:s>")),T.bind("eval",oe(We,"<sx?:x>")),T.bind("toMillis",oe(s.toMillis,"<s-s?:n>")),T.bind("fromMillis",oe(s.fromMillis,"<n-s?s?:s>")),T.bind("clone",oe(Me,"<(oa)-:o>"));var je={S0101:"String literal must be terminated by a matching quote",S0102:"Number out of range: {{token}}",S0103:"Unsupported escape sequence: \\{{token}}",S0104:"The escape sequence \\u must be followed by 4 hex digits",S0105:"Quoted property name must be terminated with a backquote (`)",S0106:"Comment has no closing tag",S0201:"Syntax error: {{token}}",S0202:"Expected {{value}}, got {{token}}",S0203:"Expected {{value}} before end of expression",S0204:"Unknown operator: {{token}}",S0205:"Unexpected token: {{token}}",S0206:"Unknown expression type: {{token}}",S0207:"Unexpected end of expression",S0208:"Parameter {{value}} of function definition must be a variable name (start with $)",S0209:"A predicate cannot follow a grouping expression in a step",S0210:"Each step can only have one grouping expression",S0211:"The symbol {{token}} cannot be used as a unary operator",S0212:"The left side of := must be a variable name (start with $)",S0213:"The literal value {{value}} cannot be used as a step within a path expression",S0214:"The right side of {{token}} must be a variable name (start with $)",S0215:"A context variable binding must precede any predicates on a step",S0216:"A context variable binding must precede the 'order-by' clause on a step",S0217:"The object representing the 'parent' cannot be derived from this expression",S0301:"Empty regular expressions are not allowed",S0302:"No terminating / in regular expression",S0402:"Choice groups containing parameterized types are not supported",S0401:"Type parameters can only be applied to functions and arrays",S0500:"Attempted to evaluate an expression containing syntax error(s)",T0410:"Argument {{index}} of function {{token}} does not match function signature",T0411:"Context value is not a compatible type with argument {{index}} of function {{token}}",T0412:"Argument {{index}} of function {{token}} must be an array of {{type}}",D1001:"Number out of range: {{value}}",D1002:"Cannot negate a non-numeric value: {{value}}",T1003:"Key in object structure must evaluate to a string; got: {{value}}",D1004:"Regular expression matches zero length string",T1005:"Attempted to invoke a non-function. Did you mean ${{{token}}}?",T1006:"Attempted to invoke a non-function",T1007:"Attempted to partially apply a non-function. Did you mean ${{{token}}}?",T1008:"Attempted to partially apply a non-function",D1009:"Multiple key definitions evaluate to same key: {{value}}",T1010:"The matcher function argument passed to function {{token}} does not return the correct object structure",D1011:"Stack overflow. Check for non-terminating recursive function. Consider rewriting as tail-recursive",D1012:"Evaluation timeout after {{value}} milliseconds. Check for infinite loop",D1013:"Object property names starting with _jsonata_ are reserved for internal use: {{value}}",T2001:"The left side of the {{token}} operator must evaluate to a number",T2002:"The right side of the {{token}} operator must evaluate to a number",T2003:"The left side of the range operator (..) must evaluate to an integer",T2004:"The right side of the range operator (..) must evaluate to an integer",D2005:"The left side of := must be a variable name (start with $)",T2006:"The right side of the function application operator ~> must be a function",T2007:"Type mismatch when comparing values {{value}} and {{value2}} in order-by clause",T2008:"The expressions within an order-by clause must evaluate to numeric or string values",T2009:"The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type",T2010:"The expressions either side of operator {{token}} must evaluate to numeric or string values",T2011:"The insert/update clause of the transform expression must evaluate to an object: {{value}}",T2012:"The delete clause of the transform expression must evaluate to a string or array of strings: {{value}}",T2013:"The transform expression clones the input object using the $clone() function. This has been overridden in the current scope by a non-function.",D2014:"The size of the sequence allocated by the range operator (..) must not exceed 1e7. Attempted to allocate {{value}}.",D2015:"The maximum sequence length of {{value}} was exceeded.",D3001:"Attempting to invoke string function on Infinity or NaN",D3010:"Second argument of replace function cannot be an empty string",D3011:"Fourth argument of replace function must evaluate to a positive number",D3012:"Attempted to replace a matched string with a non-string value",D3020:"Third argument of split function must evaluate to a positive number",D3030:"Unable to cast value to a number: {{value}}",D3040:"Third argument of match function must evaluate to a positive number",D3050:"The second argument of reduce function must be a function with at least two arguments",D3060:"The sqrt function cannot be applied to a negative number: {{value}}",D3061:"The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}}",D3070:"The single argument form of the sort function can only be applied to an array of strings or an array of numbers. Use the second argument to specify a comparison function",D3080:"The picture string must only contain a maximum of two sub-pictures",D3081:"The sub-picture must not contain more than one instance of the 'decimal-separator' character",D3082:"The sub-picture must not contain more than one instance of the 'percent' character",D3083:"The sub-picture must not contain more than one instance of the 'per-mille' character",D3084:"The sub-picture must not contain both a 'percent' and a 'per-mille' character",D3085:"The mantissa part of a sub-picture must contain at least one character that is either an 'optional digit character' or a member of the 'decimal digit family'",D3086:"The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character",D3087:"The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character",D3088:"The sub-picture must not contain a 'grouping-separator' at the end of the integer part",D3089:"The sub-picture must not contain two adjacent instances of the 'grouping-separator' character",D3090:"The integer part of the sub-picture must not contain a member of the 'decimal digit family' that is followed by an instance of the 'optional digit character'",D3091:"The fractional part of the sub-picture must not contain an instance of the 'optional digit character' that is followed by a member of the 'decimal digit family'",D3092:"A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator'",D3093:"The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family'",D3100:"The radix of the formatBase function must be between 2 and 36. It was given {{value}}",D3110:"The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}",D3120:"Syntax error in expression passed to function eval: {{value}}",D3121:"Dynamic error evaluating the expression passed to function eval: {{value}}",D3130:"Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation",D3131:"In a decimal digit pattern, all digits must be from the same decimal group",D3132:"Unknown component specifier {{value}} in date/time picture string",D3133:"The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}",D3134:"The timezone integer format specifier cannot have more than four digits",D3135:"No matching closing bracket ']' in date/time picture string",D3136:"The date/time picture string is missing specifiers required to parse the timestamp",D3137:"{{{message}}}",D3138:"The $single() function expected exactly 1 matching result. Instead it matched more.",D3139:"The $single() function expected exactly 1 matching result. Instead it matched 0.",D3140:"Malformed URL passed to ${{{functionName}}}(): {{value}}",D3141:"{{{message}}}"};function Oe(A){var x=je[A.code];if(typeof x<"u"){var L=x.replace(/\{\{\{([^}]+)}}}/g,function(){return A[arguments[1]]});L=L.replace(/\{\{([^}]+)}}/g,function(){return JSON.stringify(A[arguments[1]])}),A.message=L}}function Ce(A,x){var L,p;try{L=l(A,x&&x.recover),p=L.errors,delete L.errors}catch(I){throw Oe(I),I}var v=Re(T),E=new Date;return v.bind("now",oe(function(I,F){return s.fromMillis(E.getTime(),I,F)},"<s?s?:s>")),v.bind("millis",oe(function(){return E.getTime()},"<:n>")),{evaluate:async function(I,F,X){if(typeof p<"u"){var me={code:"S0500",position:0};throw Oe(me),me}const ve=Re(v);for(const Ne of o.keys(F))ve.bind(Ne,F[Ne]);if(ve.bind("$",I),E=new Date,ve.timestamp=E,ve.options=x,ve.createSequence=function(){var Ne=[];return x&&x.sequence&&(Ne.push=function(...ht){if(Ne.length+ht.length>x.sequence)throw{code:"D2015",stack:new Error().stack,value:x.sequence};return Array.prototype.push.apply(Ne,ht)}),Ne.sequence=!0,arguments.length===1&&Ne.push(arguments[0]),Ne},Array.isArray(I)&&!_(I)&&(I=ve.createSequence(I),I.outerWrapper=!0),x&&(x.timeout||x.stack)){const Ne=Date.now();ve.guardrails=function(){if(x.stack>0&&ve.depth>x.stack)throw{code:"D1011",value:x.stack,stack:new Error().stack};if(x.timeout>0&&Date.now()-Ne>x.timeout)throw{code:"D1012",value:x.timeout,stack:new Error().stack}}}else ve.guardrails=function(){};ve.base=ve,ve.depth=0,x&&x.RegexEngine?ve.RegexEngine=x.RegexEngine:ve.RegexEngine=RegExp;var $e;try{return $e=await R(L,I,ve),typeof X=="function"&&X(null,$e),$e}catch(Ne){throw Oe(Ne),Ne}},assign:function(I,F){v.bind(I,F)},registerFunction:function(I,F,X){var me=oe(F,X);v.bind(I,me)},ast:function(){return L},errors:function(){return p}}}return Ce.parser=l,Ce})();n.exports=h},{"./datetime":1,"./functions":2,"./parser":4,"./signature":5,"./utils":6}],4:[function(t,n,r){var s=t("./signature");const a=(()=>{var o={".":75,"[":80,"]":0,"{":70,"}":0,"(":80,")":0,",":0,"@":80,"#":80,";":80,":":80,"?":20,"+":50,"-":50,"*":60,"/":60,"%":60,"|":20,"=":40,"<":40,">":40,"^":40,"**":60,"..":20,":=":10,"!=":40,"<=":40,">=":40,"~>":40,"?:":40,"??":40,and:30,or:25,in:40,"&":50,"!":0,"~":0},l={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
32
|
-
`,r:"\r",t:" "},c=function(u){var f=0,d=u.length,_=function(m,S){var y={type:m,value:S,position:f};return y},b=function(){for(var m=f,S=0,y,M,T=function(k){if(u.charAt(k)==="/"&&S===0){for(var B=0;u.charAt(k-(B+1))==="\\";)B++;if(B%2===0)return!0}return!1};f<d;){var R=u.charAt(f);if(T(f)){if(y=u.substring(m,f),y==="")throw{code:"S0301",stack:new Error().stack,position:f};for(f++,R=u.charAt(f),m=f;R==="i"||R==="m";)f++,R=u.charAt(f);return M=u.substring(m,f)+"g",new RegExp(y,M)}(R==="("||R==="["||R==="{")&&u.charAt(f-1)!=="\\"&&S++,(R===")"||R==="]"||R==="}")&&u.charAt(f-1)!=="\\"&&S--,f++}throw{code:"S0302",stack:new Error().stack,position:f}},g=function(m){if(f>=d)return null;for(var S=u.charAt(f);f<d&&`
|
|
33
|
-
\r\v`.indexOf(S)>-1;)f++,S=u.charAt(f);if(S==="/"&&u.charAt(f+1)==="*"){var y=f;for(f+=2,S=u.charAt(f);!(S==="*"&&u.charAt(f+1)==="/");)if(S=u.charAt(++f),f>=d)throw{code:"S0106",stack:new Error().stack,position:y};return f+=2,S=u.charAt(f),g(m)}if(m!==!0&&S==="/")return f++,_("regex",b());if(S==="."&&u.charAt(f+1)===".")return f+=2,_("operator","..");if(S===":"&&u.charAt(f+1)==="=")return f+=2,_("operator",":=");if(S==="!"&&u.charAt(f+1)==="=")return f+=2,_("operator","!=");if(S===">"&&u.charAt(f+1)==="=")return f+=2,_("operator",">=");if(S==="<"&&u.charAt(f+1)==="=")return f+=2,_("operator","<=");if(S==="*"&&u.charAt(f+1)==="*")return f+=2,_("operator","**");if(S==="~"&&u.charAt(f+1)===">")return f+=2,_("operator","~>");if(S==="?"&&u.charAt(f+1)===":")return f+=2,_("operator","?:");if(S==="?"&&u.charAt(f+1)==="?")return f+=2,_("operator","??");if(Object.prototype.hasOwnProperty.call(o,S))return f++,_("operator",S);if(S==='"'||S==="'"){var M=S;f++;for(var T="";f<d;){if(S=u.charAt(f),S==="\\")if(f++,S=u.charAt(f),Object.prototype.hasOwnProperty.call(l,S))T+=l[S];else if(S==="u"){var R=u.substr(f+1,4);if(/^[0-9a-fA-F]+$/.test(R)){var k=parseInt(R,16);T+=String.fromCharCode(k),f+=4}else throw{code:"S0104",stack:new Error().stack,position:f}}else throw{code:"S0103",stack:new Error().stack,position:f,token:S};else{if(S===M)return f++,_("string",T);T+=S}f++}throw{code:"S0101",stack:new Error().stack,position:f}}var B=/^-?(0|([1-9][0-9]*))(\.[0-9]+)?([Ee][-+]?[0-9]+)?/,C=B.exec(u.substring(f));if(C!==null){var D=parseFloat(C[0]);if(!isNaN(D)&&isFinite(D))return f+=C[0].length,_("number",D);throw{code:"S0102",stack:new Error().stack,position:f,token:C[0]}}var V;if(S==="`"){f++;var K=u.indexOf("`",f);if(K!==-1)return V=u.substring(f,K),f=K+1,_("name",V);throw f=d,{code:"S0105",stack:new Error().stack,position:f}}for(var J=f,se;;)if(se=u.charAt(J),J===d||`
|
|
34
|
-
\r\v`.indexOf(se)>-1||Object.prototype.hasOwnProperty.call(o,se)){if(u.charAt(f)==="$")return V=u.substring(f+1,J),f=J,_("variable",V);switch(V=u.substring(f,J),f=J,V){case"or":case"in":case"and":return _("operator",V);case"true":return _("value",!0);case"false":return _("value",!1);case"null":return _("value",null);default:return f===d&&V===""?null:_("name",V)}}else J++};return g},h=function(u,f){var d,_,b=Object.create(null),g=[],m=function(){var O=[];d.id!=="(end)"&&O.push({type:d.type,value:d.value,position:d.position});for(var H=_();H!==null;)O.push(H),H=_();return O},S={nud:function(){var O={code:"S0211",token:this.value,position:this.position};if(f)return O.remaining=m(),O.type="error",g.push(O),O;throw O.stack=new Error().stack,O}},y=function(O,H){var we=b[O];return H=H||0,we?H>=we.lbp&&(we.lbp=H):(we=Object.create(S),we.id=we.value=O,we.lbp=H,b[O]=we),we},M=function(O){if(f){O.remaining=m(),g.push(O);var H=b["(error)"];return d=Object.create(H),d.error=O,d.type="(error)",d}else throw O.stack=new Error().stack,O},T=function(O,H){if(O&&d.id!==O){var we;d.id==="(end)"?we="S0203":we="S0202";var Be={code:we,position:d.position,token:d.value,value:O};return M(Be)}var ie=_(H);if(ie===null)return d=b["(end)"],d.position=u.length,d;var ce=ie.value,z=ie.type,j;switch(z){case"name":case"variable":j=b["(name)"];break;case"operator":if(j=b[ce],!j)return M({code:"S0204",stack:new Error().stack,position:ie.position,token:ce});break;case"string":case"number":case"value":j=b["(literal)"];break;case"regex":z="regex",j=b["(regex)"];break;default:return M({code:"S0205",stack:new Error().stack,position:ie.position,token:ce})}return d=Object.create(j),d.value=ce,d.type=z,d.position=ie.position,d},R=function(O){var H,we=d;for(T(null,!0),H=we.nud();O<d.lbp;)we=d,T(),H=we.led(H);return H},k=function(O){var H=y(O,0);H.nud=function(){return this}},B=function(O,H,we){var Be=H||o[O],ie=y(O,Be);return ie.led=we||function(ce){return this.lhs=ce,this.rhs=R(Be),this.type="binary",this},ie},C=function(O,H,we){var Be=y(O,H);return Be.led=we,Be},D=function(O,H){var we=y(O);return we.nud=H||function(){return this.expression=R(70),this.type="unary",this},we};k("(end)"),k("(name)"),k("(literal)"),k("(regex)"),y(":"),y(";"),y(","),y(")"),y("]"),y("}"),y(".."),B("."),B("+"),B("-"),B("*"),B("/"),B("%"),B("="),B("<"),B(">"),B("!="),B("<="),B(">="),B("&"),B("and"),B("or"),B("in"),k("and"),k("or"),k("in"),D("-"),B("~>"),B("??",o["??"],function(O){return this.type="condition",this.condition={type:"function",value:"(",procedure:{type:"variable",value:"exists"},arguments:[JSON.parse(JSON.stringify(O))]},this.then=O,this.else=R(0),this}),C("(error)",10,function(O){return this.lhs=O,this.error=d.error,this.remaining=m(),this.type="error",this}),D("*",function(){return this.type="wildcard",this}),D("**",function(){return this.type="descendant",this}),D("%",function(){return this.type="parent",this}),B("(",o["("],function(O){if(this.procedure=O,this.type="function",this.arguments=[],d.id!==")")for(;d.type==="operator"&&d.id==="?"?(this.type="partial",this.arguments.push(d),T("?")):this.arguments.push(R(0)),d.id===",";)T(",");if(T(")",!0),O.type==="name"&&(O.value==="function"||O.value==="λ")){if(this.arguments.forEach(function(ce,z){if(ce.type!=="variable")return M({code:"S0208",stack:new Error().stack,position:ce.position,token:ce.value,value:z+1})}),this.type="lambda",d.id==="<"){for(var H=d.position,we=1,Be="<";we>0&&d.id!=="{"&&d.id!=="(end)";){var ie=T();ie.id===">"?we--:ie.id==="<"&&we++,Be+=ie.value}T(">");try{this.signature=s(Be)}catch(ce){return ce.position=H+ce.offset,M(ce)}}T("{"),this.body=R(0),T("}")}return this}),D("(",function(){for(var O=[];d.id!==")"&&(O.push(R(0)),d.id===";");)T(";");return T(")",!0),this.type="block",this.expressions=O,this}),D("[",function(){var O=[];if(d.id!=="]")for(;;){var H=R(0);if(d.id===".."){var we={type:"binary",value:"..",position:d.position,lhs:H};T(".."),we.rhs=R(0),H=we}if(O.push(H),d.id!==",")break;T(",")}return T("]",!0),this.expressions=O,this.type="unary",this}),B("[",o["["],function(O){if(d.id==="]"){for(var H=O;H&&H.type==="binary"&&H.value==="[";)H=H.lhs;return H.keepArray=!0,T("]"),O}else return this.lhs=O,this.rhs=R(o["]"]),this.type="binary",T("]",!0),this}),B("^",o["^"],function(O){T("(");for(var H=[];;){var we={descending:!1};if(d.id==="<"?T("<"):d.id===">"&&(we.descending=!0,T(">")),we.expression=R(0),H.push(we),d.id!==",")break;T(",")}return T(")"),this.lhs=O,this.rhs=H,this.type="binary",this});var V=function(O){var H=[];if(d.id!=="}")for(;;){var we=R(0);T(":");var Be=R(0);if(H.push([we,Be]),d.id!==",")break;T(",")}return T("}",!0),typeof O>"u"?(this.lhs=H,this.type="unary"):(this.lhs=O,this.rhs=H,this.type="binary"),this};D("{",V),B("{",o["{"],V),C(":=",o[":="],function(O){return O.type!=="variable"?M({code:"S0212",stack:new Error().stack,position:O.position,token:O.value}):(this.lhs=O,this.rhs=R(o[":="]-1),this.type="binary",this)}),B("@",o["@"],function(O){return this.lhs=O,this.rhs=R(o["@"]),this.rhs.type!=="variable"?M({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"@"}):(this.type="binary",this)}),B("#",o["#"],function(O){return this.lhs=O,this.rhs=R(o["#"]),this.rhs.type!=="variable"?M({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"#"}):(this.type="binary",this)}),B("?",o["?"],function(O){return this.type="condition",this.condition=O,this.then=R(0),d.id===":"&&(T(":"),this.else=R(0)),this}),B("?:",o["?:"],function(O){return this.type="condition",this.condition=JSON.parse(JSON.stringify(O)),this.then=O,this.else=R(0),this}),D("|",function(){return this.type="transform",this.pattern=R(0),T("|"),this.update=R(0),d.id===","&&(T(","),this.delete=R(0)),T("|"),this});var K=function(O){var H;if(O.type==="function"&&!O.predicate){var we={type:"lambda",thunk:!0,arguments:[],position:O.position};we.body=O,H=we}else if(O.type==="condition")O.then=K(O.then),typeof O.else<"u"&&(O.else=K(O.else)),H=O;else if(O.type==="block"){var Be=O.expressions.length;Be>0&&(O.expressions[Be-1]=K(O.expressions[Be-1])),H=O}else H=O;return H},J=0,se=0,he=[],Q=function(O,H){switch(O.type){case"name":case"wildcard":H.level--,H.level===0&&(typeof O.ancestor>"u"||(he[H.index].slot.label=O.ancestor.label),O.ancestor=H,O.tuple=!0);break;case"parent":H.level++;break;case"block":O.expressions.length>0&&(O.tuple=!0,H=Q(O.expressions[O.expressions.length-1],H));break;case"path":O.tuple=!0;var we=O.steps.length-1;for(H=Q(O.steps[we--],H);H.level>0&&we>=0;)H=Q(O.steps[we--],H);break;default:throw{code:"S0217",token:O.type,position:O.position}}return H},de=function(O,H){if(typeof H.seekingParent<"u"||H.type==="parent"){var we=typeof H.seekingParent<"u"?H.seekingParent:[];H.type==="parent"&&we.push(H.slot),typeof O.seekingParent>"u"?O.seekingParent=we:Array.prototype.push.apply(O.seekingParent,we)}},ne=function(O){var H=O.steps.length-1,we=O.steps[H],Be=typeof we.seekingParent<"u"?we.seekingParent:[];we.type==="parent"&&Be.push(we.slot);for(var ie=0;ie<Be.length;ie++){var ce=Be[ie];for(H=O.steps.length-2;ce.level>0;){if(H<0){typeof O.seekingParent>"u"?O.seekingParent=[ce]:O.seekingParent.push(ce);break}for(var z=O.steps[H--];H>=0&&z.focus&&O.steps[H].focus;)z=O.steps[H--];ce=Q(z,ce)}}},ue=function(O){var H;switch(O.type){case"binary":switch(O.value){case".":var we=ue(O.lhs);we.type==="path"?H=we:H={type:"path",steps:[we]},we.type==="parent"&&(H.seekingParent=[we.slot]);var Be=ue(O.rhs);Be.type==="path"?Array.prototype.push.apply(H.steps,Be.steps):(typeof Be.predicate<"u"&&(Be.stages=Be.predicate,delete Be.predicate),H.steps.push(Be)),H.steps.filter(function(fe){if(fe.type==="number"||fe.type==="value")throw{code:"S0213",stack:new Error().stack,position:fe.position,value:fe.value};return fe.type==="string"}).forEach(function(fe){fe.type="name"}),H.steps.filter(function(fe){return fe.keepArray===!0}).length>0&&(H.keepSingletonArray=!0);var ie=H.steps[0];ie.type==="unary"&&ie.value==="["&&(ie.consarray=!0);var ce=H.steps[H.steps.length-1];ce.type==="unary"&&ce.value==="["&&(ce.consarray=!0),ne(H);break;case"[":H=ue(O.lhs);var z=H,j="predicate";if(H.type==="path"&&(z=H.steps[H.steps.length-1],j="stages"),typeof z.group<"u")throw{code:"S0209",stack:new Error().stack,position:O.position};typeof z[j]>"u"&&(z[j]=[]);var W=ue(O.rhs);typeof W.seekingParent<"u"&&(W.seekingParent.forEach(fe=>{fe.level===1?Q(z,fe):fe.level--}),de(z,W)),z[j].push({type:"filter",expr:W,position:O.position});break;case"{":if(H=ue(O.lhs),typeof H.group<"u")throw{code:"S0210",stack:new Error().stack,position:O.position};H.group={lhs:O.rhs.map(function(fe){return[ue(fe[0]),ue(fe[1])]}),position:O.position};break;case"^":H=ue(O.lhs),H.type!=="path"&&(H={type:"path",steps:[H]});var le={type:"sort",position:O.position};le.terms=O.rhs.map(function(fe){var ye=ue(fe.expression);return de(le,ye),{descending:fe.descending,expression:ye}}),H.steps.push(le),ne(H);break;case":=":H={type:"bind",value:O.value,position:O.position},H.lhs=ue(O.lhs),H.rhs=ue(O.rhs),de(H,H.rhs);break;case"@":if(H=ue(O.lhs),z=H,H.type==="path"&&(z=H.steps[H.steps.length-1]),typeof z.stages<"u"||typeof z.predicate<"u")throw{code:"S0215",stack:new Error().stack,position:O.position};if(z.type==="sort")throw{code:"S0216",stack:new Error().stack,position:O.position};O.keepArray&&(z.keepArray=!0),z.focus=O.rhs.value,z.tuple=!0;break;case"#":H=ue(O.lhs),z=H,H.type==="path"?z=H.steps[H.steps.length-1]:(H={type:"path",steps:[H]},typeof z.predicate<"u"&&(z.stages=z.predicate,delete z.predicate)),typeof z.stages>"u"?z.index=O.rhs.value:z.stages.push({type:"index",value:O.rhs.value,position:O.position}),z.tuple=!0;break;case"~>":H={type:"apply",value:O.value,position:O.position},H.lhs=ue(O.lhs),H.rhs=ue(O.rhs),H.keepArray=H.lhs.keepArray||H.rhs.keepArray;break;default:H={type:O.type,value:O.value,position:O.position},H.lhs=ue(O.lhs),H.rhs=ue(O.rhs),de(H,H.lhs),de(H,H.rhs)}break;case"unary":H={type:O.type,value:O.value,position:O.position},O.value==="["?H.expressions=O.expressions.map(function(fe){var ye=ue(fe);return de(H,ye),ye}):O.value==="{"?H.lhs=O.lhs.map(function(fe){var ye=ue(fe[0]);de(H,ye);var Se=ue(fe[1]);return de(H,Se),[ye,Se]}):(H.expression=ue(O.expression),O.value==="-"&&H.expression.type==="number"?(H=H.expression,H.value=-H.value):de(H,H.expression));break;case"function":case"partial":H={type:O.type,name:O.name,value:O.value,position:O.position},H.arguments=O.arguments.map(function(fe){var ye=ue(fe);return de(H,ye),ye}),H.procedure=ue(O.procedure);break;case"lambda":H={type:O.type,arguments:O.arguments,signature:O.signature,position:O.position};var be=ue(O.body);H.body=K(be);break;case"condition":H={type:O.type,position:O.position},H.condition=ue(O.condition),de(H,H.condition),H.then=ue(O.then),de(H,H.then),typeof O.else<"u"&&(H.else=ue(O.else),de(H,H.else));break;case"transform":H={type:O.type,position:O.position},H.pattern=ue(O.pattern),H.update=ue(O.update),typeof O.delete<"u"&&(H.delete=ue(O.delete));break;case"block":H={type:O.type,position:O.position},H.expressions=O.expressions.map(function(fe){var ye=ue(fe);return de(H,ye),(ye.consarray||ye.type==="path"&&ye.steps[0].consarray)&&(H.consarray=!0),ye});break;case"name":H={type:"path",steps:[O]},O.keepArray&&(H.keepSingletonArray=!0);break;case"parent":H={type:"parent",slot:{label:"!"+J++,level:1,index:se++}},he.push(H);break;case"string":case"number":case"value":case"wildcard":case"descendant":case"variable":case"regex":H=O;break;case"operator":if(O.value==="and"||O.value==="or"||O.value==="in")O.type="name",H=ue(O);else if(O.value==="?")H=O;else throw{code:"S0201",stack:new Error().stack,position:O.position,token:O.value};break;case"error":H=O,O.lhs&&(H=ue(O.lhs));break;default:var U="S0206";O.id==="(end)"&&(U="S0207");var ee={code:U,position:O.position,token:O.value};if(f)return g.push(ee),{type:"error",error:ee};throw ee.stack=new Error().stack,ee}return O.keepArray&&(H.keepArray=!0),H};_=c(u),T();var Te=R(0);if(d.id!=="(end)"){var ke={code:"S0201",position:d.position,token:d.value};M(ke)}if(Te=ue(Te),Te.type==="parent"||typeof Te.seekingParent<"u")throw{code:"S0217",token:Te.type,position:Te.position};return g.length>0&&(Te.errors=g),Te};return h})();n.exports=a},{"./signature":5}],5:[function(t,n,r){var s=t("./utils");const a=(()=>{var o={a:"arrays",b:"booleans",f:"functions",n:"numbers",o:"objects",s:"strings"};function l(c){for(var h=1,u=[],f=Object.create(null),d=f;h<c.length;){var _=c.charAt(h);if(_===":")break;var b=function(){u.push(f),d=f,f=Object.create(null)},g=function(B,C,D,V){for(var K=1,J=C;J<B.length;)if(J++,_=B.charAt(J),_===V){if(K--,K===0)break}else _===D&&K++;return J};switch(_){case"s":case"n":case"b":case"l":case"o":f.regex="["+_+"m]",f.type=_,b();break;case"a":f.regex="[asnblfom]",f.type=_,f.array=!0,b();break;case"f":f.regex="f",f.type=_,b();break;case"j":f.regex="[asnblom]",f.type=_,b();break;case"x":f.regex="[asnblfom]",f.type=_,b();break;case"-":d.context=!0,d.contextRegex=new RegExp(d.regex),d.regex+="?";break;case"?":case"+":d.regex+=_;break;case"(":var m=g(c,h,"(",")"),S=c.substring(h+1,m);if(S.indexOf("<")===-1)f.regex="["+S+"m]";else throw{code:"S0402",stack:new Error().stack,value:S,offset:h};f.type="("+S+")",h=m,b();break;case"<":if(d.type==="a"||d.type==="f"){var y=g(c,h,"<",">");d.subtype=c.substring(h+1,y),h=y}else throw{code:"S0401",stack:new Error().stack,value:d.type,offset:h};break}h++}var M="^"+u.map(function(B){return"("+B.regex+")"}).join("")+"$",T=new RegExp(M),R=function(B){var C;if(s.isFunction(B))C="f";else{var D=typeof B;switch(D){case"string":C="s";break;case"number":C="n";break;case"boolean":C="b";break;case"object":B===null?C="l":Array.isArray(B)?C="a":C="o";break;case"undefined":default:C="m"}}return C},k=function(B,C){for(var D="^",V=0,K=0;K<u.length;K++){D+=u[K].regex;var J=C.match(D);if(J===null)throw{code:"T0410",stack:new Error().stack,value:B[V],index:V+1};V=J[0].length}throw{code:"T0410",stack:new Error().stack,value:B[V],index:V+1}};return{definition:c,validate:function(B,C){var D="";B.forEach(function(se){D+=R(se)});var V=T.exec(D);if(V){var K=[],J=0;return u.forEach(function(se,he){var Q=B[J],de=V[he+1];if(de==="")if(se.context&&se.contextRegex){var ne=R(C);if(se.contextRegex.test(ne))K.push(C);else throw{code:"T0411",stack:new Error().stack,value:C,index:J+1}}else K.push(Q),J++;else de.split("").forEach(function(ue){if(Q=B[J],se.type==="a"){if(ue==="m")Q=void 0;else{var Te=!0;if(typeof se.subtype<"u"){if(ue!=="a"&&de!==se.subtype)Te=!1;else if(ue==="a"&&Q.length>0){var ke=R(Q[0]);if(ke!==se.subtype.charAt(0))Te=!1;else{var O=Q.filter(function(H){return R(H)!==ke});Te=O.length===0}}}if(!Te)throw{code:"T0412",stack:new Error().stack,value:Q,index:J+1,type:o[se.subtype]};ue!=="a"&&(Q=[Q])}K.push(Q),J++}else K.push(Q),J++})}),K}k(B,D)}}}return l})();n.exports=a},{"./utils":6}],6:[function(t,n,r){const s=(()=>{function a(y){var M=!1;if(typeof y=="number"&&(M=!isNaN(y),M&&!isFinite(y)))throw{code:"D1001",value:y,stack:new Error().stack};return M}function o(y){var M=!1;return Array.isArray(y)&&(M=y.filter(function(T){return typeof T!="string"}).length===0),M}function l(y){var M=!1;return Array.isArray(y)&&(M=y.filter(function(T){return!a(T)}).length===0),M}function c(y){return y.sequence===!0&&Array.isArray(y)}function h(y){return y&&(y._jsonata_function===!0||y._jsonata_lambda===!0)||typeof y=="function"}function u(y){var M=typeof y.arity=="number"?y.arity:typeof y.implementation=="function"?y.implementation.length:typeof y.length=="number"?y.length:y.arguments.length;return M}function f(y){return y&&y._jsonata_lambda===!0}var d=(typeof Symbol=="function"?Symbol:{}).iterator||"@@iterator";function _(y){return typeof y=="object"&&y!==null&&d in y&&"next"in y&&typeof y.next=="function"}function b(y,M){if(y===M)return!0;if(typeof y=="object"&&typeof M=="object"&&y!==null&&M!==null){if(Array.isArray(y)&&Array.isArray(M)){if(y.length!==M.length)return!1;for(var T=0;T<y.length;T++)if(!b(y[T],M[T]))return!1;return!0}var R=Object.getOwnPropertyNames(y),k=Object.getOwnPropertyNames(M);if(R.length!==k.length)return!1;for(R=R.sort(),k=k.sort(),T=0;T<R.length;T++)if(R[T]!==k[T])return!1;for(T=0;T<R.length;T++){var B=R[T];if(!b(y[B],M[B]))return!1}return!0}return!1}function g(y){return typeof y=="object"&&y!==null&&"then"in y&&typeof y.then=="function"}function m(y){var M=[];for(let T of y)M.push(T);return M}function S(y){return typeof y=="object"&&y!==null?Object.keys(y):[]}return{isNumeric:a,isArrayOfStrings:o,isArrayOfNumbers:l,isSequence:c,isFunction:h,isLambda:f,isIterable:_,getFunctionArity:u,isDeepEqual:b,stringToArray:m,isPromise:g,keys:S}})();n.exports=s},{}]},{},[3])(3)})})($a)),$a.exports}sp();const ap=150,Kc=10,op=200,lp=16,Zc=new WeakMap;let Jc=!1;function Es(){return typeof navigator>"u"?!1:/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Br(i){if(i===window)return{x:window.scrollX,y:window.scrollY};const e=i;return{x:e.scrollLeft,y:e.scrollTop}}function cp(i,e,t){if(i===window){window.scrollTo(e,t);return}const n=i;typeof n.scrollTo=="function"?n.scrollTo(e,t):(n.scrollLeft=e,n.scrollTop=t)}function up(i){if(i===window){const t=document.documentElement;return Math.max(0,t.scrollHeight-window.innerHeight)}const e=i;return Math.max(0,e.scrollHeight-e.clientHeight)}function Xi(i){let e=Zc.get(i);if(!e){const t=Br(i);e={x:t.x,y:t.y,restoring:!1,watching:!1,userEngaged:!1,raf:0,stickyFrames:0},Zc.set(i,e)}return e}function Ts(i){Xi(i).userEngaged=!0}function ws(i){const e=Xi(i);clearTimeout(e.settleTimer),e.settleTimer=setTimeout(()=>{e.userEngaged=!1,e.settleTimer=void 0},ap)}function Qc(i,e){return e-i>=op}function $i(i){if(!Es())return;const e=Xi(i);if(e.restoring)return;const t=Br(i);if(Qc(t.y,e.y)){ja(i);return}e.x=t.x,e.y=t.y}function hp(i){if(!Es())return;const e=Xi(i),t=up(i),n=e.x,r=t>0?Math.min(e.y,t):e.y,{x:s,y:a}=Br(i);if(!(Math.abs(n-s)<=Kc&&Math.abs(r-a)<=Kc)){e.restoring=!0;try{cp(i,n,r)}finally{requestAnimationFrame(()=>{e.restoring=!1})}}}function ja(i){const e=Xi(i);if(e.stickyFrames=lp,e.raf)return;const t=()=>{e.raf=0,hp(i),e.stickyFrames>0&&(e.stickyFrames--,e.raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)}function qa(i){ja(i)}function zr(i){if(!Es())return;const e=Xi(i);if(e.watching)return;e.watching=!0;const t=i===window?window:i,n=()=>{if(e.restoring)return;const{y:_}=Br(i);if(Qc(_,e.y)){ja(i);return}if(e.userEngaged){$i(i),ws(i);return}$i(i)},r=_=>eu(_)===i,s=_=>{r(_)&&($i(i),Ts(i))},a=_=>{r(_)&&ws(i)},o=_=>{r(_)&&($i(i),Ts(i),ws(i))};t.addEventListener("scroll",n,{passive:!0}),t.addEventListener("touchstart",s,{passive:!0}),t.addEventListener("touchend",a,{passive:!0}),t.addEventListener("touchcancel",a,{passive:!0}),t.addEventListener("wheel",o,{passive:!0}),t.addEventListener("pointerdown",s,{passive:!0}),t.addEventListener("pointerup",a,{passive:!0}),t.addEventListener("pointercancel",a,{passive:!0});const l=Br(i);if(e.x=l.x,e.y=l.y,i===window){const _=new ResizeObserver(()=>qa(window));_.observe(document.documentElement),e.resizeObserver=_;return}const c=i,h=new ResizeObserver(()=>qa(c));h.observe(c);for(const _ of Array.from(c.children))h.observe(_);e.resizeObserver=h;const u=()=>qa(c),f=new MutationObserver(_=>{for(const b of _)if(b.type==="childList")for(const g of Array.from(b.addedNodes))g instanceof Element&&h.observe(g);u()});f.observe(c,{childList:!0,subtree:!0,characterData:!0});const d=c.getRootNode();d instanceof ShadowRoot&&d.host&&f.observe(d.host,{childList:!0,subtree:!0,characterData:!0}),e.mutationObserver=f}function eu(i){for(const e of i.composedPath())if(!(e===window||e===document)&&e instanceof HTMLElement&&tu(e))return e;return window}function tu(i){if(!(i instanceof HTMLElement)||i===document.documentElement||i===document.body)return!1;const e=getComputedStyle(i).overflowY;return e==="auto"||e==="scroll"||e==="overlay"}function Ya(i){for(const t of i.composedPath())t===window||t===document||t instanceof HTMLElement&&tu(t)&&zr(t);const e=eu(i);zr(e),i.type==="wheel"?($i(e),Ts(e),ws(e)):(i.type==="touchstart"||i.type==="pointerdown")&&($i(e),Ts(e))}function As(i){i instanceof Element&&i.classList?.contains("custom-scroll")&&zr(i),i.querySelectorAll?.(".custom-scroll").forEach(e=>{e instanceof HTMLElement&&zr(e)})}function Ka(i){As(i),new MutationObserver(t=>{for(const n of t)for(const r of Array.from(n.addedNodes))r instanceof Element&&As(r)}).observe(i,{childList:!0,subtree:!0})}function Za(i){i.querySelectorAll?.("*").forEach(e=>{e.shadowRoot&&(Ka(e.shadowRoot),Za(e.shadowRoot))})}function fp(){const i=Element.prototype;if(i.__safariScrollGuardPatched)return;i.__safariScrollGuardPatched=!0;const e=i.attachShadow;i.attachShadow=function(n){const r=e.call(this,n);return Ka(r),r}}function dp(){if(typeof window>"u"||Jc||(Jc=!0,!Es()))return;zr(window),fp();const i={capture:!0,passive:!0};window.addEventListener("wheel",Ya,i),window.addEventListener("touchstart",Ya,i),window.addEventListener("pointerdown",Ya,i);const e=()=>{As(document),Za(document)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e(),new MutationObserver(n=>{for(const r of n)for(const s of Array.from(r.addedNodes))s instanceof Element&&(As(s),s.shadowRoot&&Ka(s.shadowRoot),Za(s))}).observe(document.documentElement,{childList:!0,subtree:!0})}const pp=zd,mp=Vd,gp=Ga,_p=za,vp=zn,yp=Qd,xp=xs,bp=Wa,Sp=rp;dp(),window["concorde-utils"]=window["concorde-utils"]||{},window["concorde-utils"]={Utils:pp,Arrays:mp,DataBindObserver:gp,Format:_p,HTML:vp,LocationHandler:yp,Objects:xp,PublisherManager:Gt,api:bp,URLPattern:Sp,Endpoint:Xa,DataProviderKey:ys};/**
|
|
31
|
+
*/function Td(i){return Xe({...i,state:!0,attribute:!1})}const vn={Orbit:"orbit",Perspective:"perspective",Ortho:"ortho"},La=1e-4,Fc=80,wd=16,kc=250,Ad=80,Bc="image/jpeg",Rd=.85,Ms=45,Ia=1,zc=.5,Hc=50,Vc=8,Cd=172,Gc=Vc*Math.PI/180,Pd=["src","asset","camera","fov","exposure","autoRotate","minDistance","maxDistance","minPolar","maxPolar"],Dd=["time","frame","ready","loading","hovering","pointerX","pointerY","camX","camY","camZ","targetX","targetY","targetZ","zoom","hitX","hitY","hitZ","hitObjectId","frameUrl","snapshot","frameSource","moving"];function Ld(i){if(!i||typeof i!="object")return!1;const e=i;return typeof e.getFrameCanvas=="function"&&typeof e.frameSeq=="number"}const Id="#__sonic_frame_",Wc=new Map;function Ud(i){if(!i.startsWith(Id))return null;const e=Wc.get(i)??null;return e&&!e.isConnected?(Wc.delete(i),null):e}function Ua(i){return typeof i!="string"?null:i.trim()||null}function Nd(i){if(i==null||i==="")return null;if(typeof i=="string")return Ua(i);if(typeof i!="object")return null;const e=i;return Ua(e.url)??Ua(e.blobUrl)}function Na(i){for(const e of i)try{URL.revokeObjectURL(e)}catch{}}const Od=["gltf","glb","obj","ply","url"];function Oa(i){const e=i.split("?")[0].toLowerCase();return e.endsWith(".glb")?"glb":e.endsWith(".gltf")?"gltf":e.endsWith(".obj")?"obj":e.endsWith(".ply")?"ply":"url"}function Fd(i){const e=(i??"").trim().toLowerCase();return e===vn.Perspective||e===vn.Ortho||e===vn.Orbit?e:vn.Orbit}function kd(i){if(i==null||i==="")return null;if(typeof i=="string"){const c=i.trim();return c?{kind:Oa(c),url:c}:null}if(typeof i!="object")return null;const e=i,t=Nd(e),r=(typeof e.url=="string"?e.url.trim():"")||t||"",s=e.blob instanceof Blob?e.blob:void 0;if(!r&&!s)return null;const a=typeof e.kind=="string"?e.kind.trim().toLowerCase():"";let o;Od.includes(a)?o=a:r?o=Oa(r):o="url";const l={kind:o};return r&&(l.url=r),s&&(l.blob=s),e.morphTargets&&typeof e.morphTargets=="object"&&(l.morphTargets=e.morphTargets),l}function Bd(i,e){if(typeof i=="number"&&Number.isFinite(i))return i;if(typeof i=="string"&&i.trim()!==""){const t=Number(i);if(Number.isFinite(t))return t}return e}function zd(i){return i===!0||i===1||i==="1"||i==="true"||i==="on"}const Ut={cameraMode:Fd,asset:kd,guessKind:Oa,toNum:Bd,isFormFlagOn:zd};function Es(i){return!!i.playOffscreen||i.frameConsumerCount>0}function Fa(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function Xc(i){return!i.play||!i.ready||!i.inView&&!Es(i)||!i.runtime||Fa()?!1:i.playOnHover?i.hovering:!0}function $c(i){const e=i.autoRotate&&i.play&&!Fa()&&(!i.playOnHover||i.hovering);i.runtime?.setAutoRotate(!!e)}function qc(i){i.raf&&(cancelAnimationFrame(i.raf),i.raf=0)}function Hd(i,e){i.raf||(i.raf=requestAnimationFrame(e))}function Vd(i,e){$c(i),Xc(i)?Hd(i,e):(qc(i),i.ready&&i.runtime?.render())}const Gn={prefersReducedMotion:Fa,shouldAnimate:Xc,wantsOffscreenPlay:Es,syncAutoRotate:$c,syncPlayback:Vd,stopLoop:qc};function Gd(i,e){if(i.asset?.url||i.asset?.blob)return i.asset;const t=Ut.asset(i.src);if(t)return t;const n=e?.get()??{};if("asset"in n){const r=Ut.asset(n.asset);if(r)return r}return"src"in n?Ut.asset(n.src):null}const jc={resolve:Gd};function ka(i,e){return!!i?._proxies_?.get(e)?.hasListener?.()}function Wd(i){if(!i.ready)return;i.outPublisher||i.bindOutPublisher();const e=i.outPublisher;if(!(!e||!ka(e,"frameSource")))try{e.frameSource?.set({element:i})}catch{}}const Xd={maybePublish:Wd};function $d(i,e,t){const n=(i??"").trim()||(e??"").trim();if(!n)return t===0?{kind:"scene"}:{kind:"none"};if(n.startsWith("#"))return{kind:"element",key:n};const r=n.toLowerCase();return r==="scene"?{kind:"scene"}:r==="depth"?{kind:"depth"}:r==="self"?{kind:"self"}:r==="none"||r==="null"?{kind:"none"}:r==="buffer-a"||r==="buffera"||r==="a"?{kind:"buffer",buffer:"bufferA"}:r==="buffer-b"||r==="bufferb"||r==="b"?{kind:"buffer",buffer:"bufferB"}:r==="buffer-c"||r==="bufferc"||r==="c"?{kind:"buffer",buffer:"bufferC"}:r==="buffer-d"||r==="bufferd"||r==="d"?{kind:"buffer",buffer:"bufferD"}:{kind:"url",url:n}}function Ba(i){return Number.isFinite(i)?Math.min(1,Math.max(.25,i)):1}const za=["postImage","postBufferA","postBufferB","postBufferC","postBufferD","postCommon","postImageCh0","postImageCh1","postImageCh2","postImageCh3","postBufferACh0","postBufferACh1","postBufferACh2","postBufferACh3","postBufferBCh0","postBufferBCh1","postBufferBCh2","postBufferBCh3","postBufferCCh0","postBufferCCh1","postBufferCCh2","postBufferCCh3","postBufferDCh0","postBufferDCh1","postBufferDCh2","postBufferDCh3","postScale"];function qd(i,e){const t=["","","",""];let n=["","","",""];return e==="image"?n=[i.postImageCh0,i.postImageCh1,i.postImageCh2,i.postImageCh3]:e==="bufferA"?n=[i.postBufferACh0,i.postBufferACh1,i.postBufferACh2,i.postBufferACh3]:e==="bufferB"?n=[i.postBufferBCh0,i.postBufferBCh1,i.postBufferBCh2,i.postBufferBCh3]:e==="bufferC"?n=[i.postBufferCCh0,i.postBufferCCh1,i.postBufferCCh2,i.postBufferCCh3]:n=[i.postBufferDCh0,i.postBufferDCh1,i.postBufferDCh2,i.postBufferDCh3],[0,1,2,3].map(r=>$d(n[r],t[r],r))}function jd(i){if(!i.postImage.trim())return null;const e={common:i.postCommon,image:i.postImage,bufferA:i.postBufferA,bufferB:i.postBufferB,bufferC:i.postBufferC,bufferD:i.postBufferD},t=new Map;for(const n of["bufferA","bufferB","bufferC","bufferD","image"])t.set(n,qd(i,n));return{sources:e,channels:t,scale:Ba(i.postScale)}}function Yd(i,e){if(!e.startsWith("#"))return null;const t=Ud(e);if(t)return t;const n=e.slice(1);if(!n||n.startsWith("__sonic_frame_"))return null;const r=i.getRootNode();if(r instanceof Document||r instanceof ShadowRoot){const s=r.getElementById(n);if(s)return s}return typeof document<"u"?document.getElementById(n):null}function Yc(i){if(i.runtime){i.runtime.setPostElementResolver(e=>Yd(i,e));try{i.runtime.setPostConfig(jd(i)),i.errorMessage.startsWith("Post FX")&&(i.errorMessage="")}catch(e){const t=e instanceof Error?e.message:String(e);i.errorMessage=`Post FX: ${t}`;const n=e&&typeof e=="object"&&"pass"in e?String(e.pass):"image",r=e&&typeof e=="object"&&"infoLog"in e?String(e.infoLog):"";i.dispatchEvent(new CustomEvent("error",{detail:{message:t,pass:n,infoLog:r},bubbles:!0,composed:!0}));try{i.runtime.setPostConfig(null)}catch{}}}}function Kd(i,e,t,n,r=[0,0,0,0]){i.runtime?.setPostFrame({time:e,timeDelta:t,frame:n,mouse:r,params:[i.param0,i.param1,i.param2,i.param3]})}function Zd(i){return za.some(e=>i.has(e))}function Jd(i,e){let t=!1;for(const n of["param0","param1","param2","param3"])if(n in e&&typeof e[n]=="number")i[n]=e[n],t=!0;else if(n in e&&typeof e[n]=="string"){const r=Number(e[n]);Number.isFinite(r)&&(i[n]=r,t=!0)}for(const n of za){if(!(n in e))continue;const r=e[n];n==="postScale"&&(typeof r=="number"||typeof r=="string")?(i.postScale=Ba(Number(r)),t=!0):typeof r=="string"&&(i[n]=r,t=!0)}t&&Yc(i)}const Hr={applyConfig:Yc,syncFrame:Kd,propsChanged:Zd,applyFormPost:Jd,POST_PROP_KEYS:za};function Ha(i){return(Number.isFinite(i)?i:0)*Math.PI/180}async function Qd(i){if(!i.runtime)return;const e=++i.loadToken;i.errorMessage="";try{if(await i.runtime.load(jc.resolve(i,i.formPublisher)),e!==i.loadToken)return;i.ready=!0,i.startTime=performance.now(),i.frame=0,i.lastFormOrbit=null,i.onFormMutation(),Gn.syncAutoRotate(i),i.runtime.render(),i.frameSeq++,i.syncPlayback(),Hr.applyConfig(i),Xd.maybePublish(i),i.dispatchEvent(new CustomEvent("ready",{detail:{ready:!0},bubbles:!0,composed:!0}))}catch(t){if(e!==i.loadToken)return;i.ready=!!i.runtime?.ready,Kc(i,t),i.syncPlayback()}}function ep(i){i.runtime?.setOrbitLimits({minDistance:i.minDistance,maxDistance:i.maxDistance,minPolar:Ha(i.minPolar),maxPolar:Ha(i.maxPolar)})}function Kc(i,e){const t=e instanceof Error?e.message:String(e);i.errorMessage=t,i.dispatchEvent(new CustomEvent("error",{detail:{message:t},bubbles:!0,composed:!0}))}const Dn={run:Qd,applyOrbitLimits:ep,emitError:Kc,degToRad:Ha};/**
|
|
35
32
|
* @license
|
|
36
33
|
* Copyright 2010-2025 Three.js Authors
|
|
37
34
|
* SPDX-License-Identifier: MIT
|
|
38
|
-
*/const Ja="180",ji={ROTATE:0,DOLLY:1,PAN:2},qi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Mp=0,nu=1,Ep=2,iu=1,Tp=2,Vn=3,Gn=0,sn=1,Rn=2,ii=0,Yi=1,ru=2,su=3,au=4,wp=5,Si=100,Ap=101,Rp=102,Cp=103,Pp=104,Dp=200,Lp=201,Ip=202,Up=203,Qa=204,eo=205,Np=206,Op=207,Fp=208,kp=209,Bp=210,zp=211,Hp=212,Vp=213,Gp=214,to=0,no=1,io=2,Ki=3,ro=4,so=5,ao=6,oo=7,ou=0,Wp=1,Xp=2,ri=0,$p=1,jp=2,qp=3,lu=4,Yp=5,Kp=6,Zp=7,cu="attached",Jp="detached",uu=300,Zi=301,Ji=302,lo=303,co=304,Rs=306,Qi=1e3,si=1001,Cs=1002,Yt=1003,hu=1004,Hr=1005,ln=1006,Ps=1007,Wn=1008,Cn=1009,fu=1010,du=1011,Vr=1012,uo=1013,Mi=1014,_n=1015,Gr=1016,ho=1017,fo=1018,Wr=1020,pu=35902,mu=35899,gu=1021,_u=1022,fn=1023,Xr=1026,$r=1027,po=1028,mo=1029,vu=1030,go=1031,_o=1033,Ds=33776,Ls=33777,Is=33778,Us=33779,vo=35840,yo=35841,xo=35842,bo=35843,So=36196,Mo=37492,Eo=37496,To=37808,wo=37809,Ao=37810,Ro=37811,Co=37812,Po=37813,Do=37814,Lo=37815,Io=37816,Uo=37817,No=37818,Oo=37819,Fo=37820,ko=37821,Bo=36492,zo=36494,Ho=36495,Vo=36283,Go=36284,Wo=36285,Xo=36286,jr=2300,qr=2301,$o=2302,yu=2400,xu=2401,bu=2402,Qp=2500,em=0,Su=1,jo=2,tm=3200,nm=3201,Mu=0,im=1,ai="",Bt="srgb",Kt="srgb-linear",Ns="linear",xt="srgb",er=7680,Eu=519,rm=512,sm=513,am=514,Tu=515,om=516,lm=517,cm=518,um=519,qo=35044,wu="300 es",Pn=2e3,Os=2001;class Ei{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const r=n[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const Xt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Au=1234567;const Yr=Math.PI/180,tr=180/Math.PI;function vn(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Xt[i&255]+Xt[i>>8&255]+Xt[i>>16&255]+Xt[i>>24&255]+"-"+Xt[e&255]+Xt[e>>8&255]+"-"+Xt[e>>16&15|64]+Xt[e>>24&255]+"-"+Xt[t&63|128]+Xt[t>>8&255]+"-"+Xt[t>>16&255]+Xt[t>>24&255]+Xt[n&255]+Xt[n>>8&255]+Xt[n>>16&255]+Xt[n>>24&255]).toLowerCase()}function it(i,e,t){return Math.max(e,Math.min(t,i))}function Yo(i,e){return(i%e+e)%e}function hm(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function fm(i,e,t){return i!==e?(t-i)/(e-i):0}function Kr(i,e,t){return(1-t)*i+t*e}function dm(i,e,t,n){return Kr(i,e,1-Math.exp(-t*n))}function pm(i,e=1){return e-Math.abs(Yo(i,e*2)-e)}function mm(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function gm(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function _m(i,e){return i+Math.floor(Math.random()*(e-i+1))}function vm(i,e){return i+Math.random()*(e-i)}function ym(i){return i*(.5-Math.random())}function xm(i){i!==void 0&&(Au=i);let e=Au+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function bm(i){return i*Yr}function Sm(i){return i*tr}function Mm(i){return(i&i-1)===0&&i!==0}function Em(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Tm(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function wm(i,e,t,n,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),h=a((e+n)/2),u=s((e-n)/2),f=a((e-n)/2),d=s((n-e)/2),_=a((n-e)/2);switch(r){case"XYX":i.set(o*h,l*u,l*f,o*c);break;case"YZY":i.set(l*f,o*h,l*u,o*c);break;case"ZXZ":i.set(l*u,l*f,o*h,o*c);break;case"XZX":i.set(o*h,l*_,l*d,o*c);break;case"YXY":i.set(l*d,o*h,l*_,o*c);break;case"ZYZ":i.set(l*_,l*d,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function yn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function vt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const Ru={DEG2RAD:Yr,RAD2DEG:tr,generateUUID:vn,clamp:it,euclideanModulo:Yo,mapLinear:hm,inverseLerp:fm,lerp:Kr,damp:dm,pingpong:pm,smoothstep:mm,smootherstep:gm,randInt:_m,randFloat:vm,randFloatSpread:ym,seededRandom:xm,degToRad:bm,radToDeg:Sm,isPowerOfTwo:Mm,ceilPowerOfTwo:Em,floorPowerOfTwo:Tm,setQuaternionFromProperEuler:wm,normalize:vt,denormalize:yn};class Ye{constructor(e=0,t=0){Ye.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=it(this.x,e.x,t.x),this.y=it(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=it(this.x,e,t),this.y=it(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(it(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(it(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Dn{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let l=n[r+0],c=n[r+1],h=n[r+2],u=n[r+3];const f=s[a+0],d=s[a+1],_=s[a+2],b=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u;return}if(o===1){e[t+0]=f,e[t+1]=d,e[t+2]=_,e[t+3]=b;return}if(u!==b||l!==f||c!==d||h!==_){let g=1-o;const m=l*f+c*d+h*_+u*b,S=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){const T=Math.sqrt(y),R=Math.atan2(T,m*S);g=Math.sin(g*R)/T,o=Math.sin(o*R)/T}const M=o*S;if(l=l*g+f*M,c=c*g+d*M,h=h*g+_*M,u=u*g+b*M,g===1-o){const T=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=T,c*=T,h*=T,u*=T}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],h=n[r+3],u=s[a],f=s[a+1],d=s[a+2],_=s[a+3];return e[t]=o*_+h*u+l*d-c*f,e[t+1]=l*_+h*f+c*u-o*d,e[t+2]=c*_+h*d+o*f-l*u,e[t+3]=h*_-o*u-l*f-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(r/2),u=o(s/2),f=l(n/2),d=l(r/2),_=l(s/2);switch(a){case"XYZ":this._x=f*h*u+c*d*_,this._y=c*d*u-f*h*_,this._z=c*h*_+f*d*u,this._w=c*h*u-f*d*_;break;case"YXZ":this._x=f*h*u+c*d*_,this._y=c*d*u-f*h*_,this._z=c*h*_-f*d*u,this._w=c*h*u+f*d*_;break;case"ZXY":this._x=f*h*u-c*d*_,this._y=c*d*u+f*h*_,this._z=c*h*_+f*d*u,this._w=c*h*u-f*d*_;break;case"ZYX":this._x=f*h*u-c*d*_,this._y=c*d*u+f*h*_,this._z=c*h*_-f*d*u,this._w=c*h*u+f*d*_;break;case"YZX":this._x=f*h*u+c*d*_,this._y=c*d*u+f*h*_,this._z=c*h*_-f*d*u,this._w=c*h*u-f*d*_;break;case"XZY":this._x=f*h*u-c*d*_,this._y=c*d*u-f*h*_,this._z=c*h*_+f*d*u,this._w=c*h*u+f*d*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],u=t[10],f=n+o+u;if(f>0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(h-l)*d,this._y=(s-c)*d,this._z=(a-r)*d}else if(n>o&&n>u){const d=2*Math.sqrt(1+n-o-u);this._w=(h-l)/d,this._x=.25*d,this._y=(r+a)/d,this._z=(s+c)/d}else if(o>u){const d=2*Math.sqrt(1+o-n-u);this._w=(s-c)/d,this._x=(r+a)/d,this._y=.25*d,this._z=(l+h)/d}else{const d=2*Math.sqrt(1+u-n-o);this._w=(a-r)/d,this._x=(s+c)/d,this._y=(l+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(it(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=n*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-r*o,this._w=a*h-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const d=1-t;return this._w=d*a+t*this._w,this._x=d*n+t*this._x,this._y=d*r+t*this._y,this._z=d*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),u=Math.sin((1-t)*h)/c,f=Math.sin(t*h)/c;return this._w=a*u+this._w*f,this._x=n*u+this._x*f,this._y=r*u+this._y*f,this._z=s*u+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ${constructor(e=0,t=0,n=0){$.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Cu.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Cu.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*n),h=2*(o*t-s*r),u=2*(s*n-a*t);return this.x=t+l*c+a*u-o*h,this.y=n+l*h+o*c-s*u,this.z=r+l*u+s*h-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=it(this.x,e.x,t.x),this.y=it(this.y,e.y,t.y),this.z=it(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=it(this.x,e,t),this.y=it(this.y,e,t),this.z=it(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(it(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Ko.copy(this).projectOnVector(e),this.sub(Ko)}reflect(e){return this.sub(Ko.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(it(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Ko=new $,Cu=new Dn;class Qe{constructor(e,t,n,r,s,a,o,l,c){Qe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const h=this.elements;return h[0]=e,h[1]=r,h[2]=o,h[3]=t,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],u=n[7],f=n[2],d=n[5],_=n[8],b=r[0],g=r[3],m=r[6],S=r[1],y=r[4],M=r[7],T=r[2],R=r[5],k=r[8];return s[0]=a*b+o*S+l*T,s[3]=a*g+o*y+l*R,s[6]=a*m+o*M+l*k,s[1]=c*b+h*S+u*T,s[4]=c*g+h*y+u*R,s[7]=c*m+h*M+u*k,s[2]=f*b+d*S+_*T,s[5]=f*g+d*y+_*R,s[8]=f*m+d*M+_*k,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-n*s*h+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=h*a-o*c,f=o*l-h*s,d=c*s-a*l,_=t*u+n*f+r*d;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const b=1/_;return e[0]=u*b,e[1]=(r*c-h*n)*b,e[2]=(o*n-r*a)*b,e[3]=f*b,e[4]=(h*t-r*l)*b,e[5]=(r*s-o*t)*b,e[6]=d*b,e[7]=(n*l-c*t)*b,e[8]=(a*t-n*s)*b,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Zo.makeScale(e,t)),this}rotate(e){return this.premultiply(Zo.makeRotation(-e)),this}translate(e,t){return this.premultiply(Zo.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Zo=new Qe;function Pu(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Zr(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Am(){const i=Zr("canvas");return i.style.display="block",i}const Du={};function Jr(i){i in Du||(Du[i]=!0,console.warn(i))}function Rm(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}const Lu=new Qe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Iu=new Qe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Cm(){const i={enabled:!0,workingColorSpace:Kt,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===xt&&(r.r=Xn(r.r),r.g=Xn(r.g),r.b=Xn(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===xt&&(r.r=nr(r.r),r.g=nr(r.g),r.b=nr(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===ai?Ns:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Jr("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Jr("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Kt]:{primaries:e,whitePoint:n,transfer:Ns,toXYZ:Lu,fromXYZ:Iu,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Bt},outputColorSpaceConfig:{drawingBufferColorSpace:Bt}},[Bt]:{primaries:e,whitePoint:n,transfer:xt,toXYZ:Lu,fromXYZ:Iu,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Bt}}}),i}const lt=Cm();function Xn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function nr(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let ir;class Pm{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{ir===void 0&&(ir=Zr("canvas")),ir.width=e.width,ir.height=e.height;const r=ir.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=ir}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Zr("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=Xn(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Xn(t[n]/255)*255):t[n]=Xn(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Dm=0;class Jo{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Dm++}),this.uuid=vn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Qo(r[a].image)):s.push(Qo(r[a]))}else s=Qo(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function Qo(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Pm.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Lm=0;const el=new $;class zt extends Ei{constructor(e=zt.DEFAULT_IMAGE,t=zt.DEFAULT_MAPPING,n=si,r=si,s=ln,a=Wn,o=fn,l=Cn,c=zt.DEFAULT_ANISOTROPY,h=ai){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Lm++}),this.uuid=vn(),this.name="",this.source=new Jo(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Ye(0,0),this.repeat=new Ye(1,1),this.center=new Ye(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Qe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(el).x}get height(){return this.source.getSize(el).y}get depth(){return this.source.getSize(el).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==uu)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Qi:e.x=e.x-Math.floor(e.x);break;case si:e.x=e.x<0?0:1;break;case Cs:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Qi:e.y=e.y-Math.floor(e.y);break;case si:e.y=e.y<0?0:1;break;case Cs:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}zt.DEFAULT_IMAGE=null,zt.DEFAULT_MAPPING=uu,zt.DEFAULT_ANISOTROPY=1;class pt{constructor(e=0,t=0,n=0,r=1){pt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const l=e.elements,c=l[0],h=l[4],u=l[8],f=l[1],d=l[5],_=l[9],b=l[2],g=l[6],m=l[10];if(Math.abs(h-f)<.01&&Math.abs(u-b)<.01&&Math.abs(_-g)<.01){if(Math.abs(h+f)<.1&&Math.abs(u+b)<.1&&Math.abs(_+g)<.1&&Math.abs(c+d+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(c+1)/2,M=(d+1)/2,T=(m+1)/2,R=(h+f)/4,k=(u+b)/4,B=(_+g)/4;return y>M&&y>T?y<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(y),r=R/n,s=k/n):M>T?M<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(M),n=R/r,s=B/r):T<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(T),n=k/s,r=B/s),this.set(n,r,s,t),this}let S=Math.sqrt((g-_)*(g-_)+(u-b)*(u-b)+(f-h)*(f-h));return Math.abs(S)<.001&&(S=1),this.x=(g-_)/S,this.y=(u-b)/S,this.z=(f-h)/S,this.w=Math.acos((c+d+m-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=it(this.x,e.x,t.x),this.y=it(this.y,e.y,t.y),this.z=it(this.z,e.z,t.z),this.w=it(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=it(this.x,e,t),this.y=it(this.y,e,t),this.z=it(this.z,e,t),this.w=it(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(it(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Im extends Ei{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ln,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new pt(0,0,e,t),this.scissorTest=!1,this.viewport=new pt(0,0,e,t);const r={width:e,height:t,depth:n.depth},s=new zt(r);this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:ln,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isArrayTexture=this.textures[r].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new Jo(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ti extends Im{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Uu extends zt{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Yt,this.minFilter=Yt,this.wrapR=si,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Um extends zt{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Yt,this.minFilter=Yt,this.wrapR=si,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ln{constructor(e=new $(1/0,1/0,1/0),t=new $(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(xn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(xn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=xn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,xn):xn.fromBufferAttribute(s,a),xn.applyMatrix4(e.matrixWorld),this.expandByPoint(xn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Fs.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Fs.copy(n.boundingBox)),Fs.applyMatrix4(e.matrixWorld),this.union(Fs)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,xn),xn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Qr),ks.subVectors(this.max,Qr),rr.subVectors(e.a,Qr),sr.subVectors(e.b,Qr),ar.subVectors(e.c,Qr),oi.subVectors(sr,rr),li.subVectors(ar,sr),wi.subVectors(rr,ar);let t=[0,-oi.z,oi.y,0,-li.z,li.y,0,-wi.z,wi.y,oi.z,0,-oi.x,li.z,0,-li.x,wi.z,0,-wi.x,-oi.y,oi.x,0,-li.y,li.x,0,-wi.y,wi.x,0];return!tl(t,rr,sr,ar,ks)||(t=[1,0,0,0,1,0,0,0,1],!tl(t,rr,sr,ar,ks))?!1:(Bs.crossVectors(oi,li),t=[Bs.x,Bs.y,Bs.z],tl(t,rr,sr,ar,ks))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,xn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(xn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:($n[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),$n[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),$n[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),$n[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),$n[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),$n[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),$n[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),$n[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints($n),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const $n=[new $,new $,new $,new $,new $,new $,new $,new $],xn=new $,Fs=new Ln,rr=new $,sr=new $,ar=new $,oi=new $,li=new $,wi=new $,Qr=new $,ks=new $,Bs=new $,Ai=new $;function tl(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){Ai.fromArray(i,s);const o=r.x*Math.abs(Ai.x)+r.y*Math.abs(Ai.y)+r.z*Math.abs(Ai.z),l=e.dot(Ai),c=t.dot(Ai),h=n.dot(Ai);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const Nm=new Ln,es=new $,nl=new $;class In{constructor(e=new $,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Nm.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;es.subVectors(e,this.center);const t=es.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(es,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(nl.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(es.copy(e.center).add(nl)),this.expandByPoint(es.copy(e.center).sub(nl))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const jn=new $,il=new $,zs=new $,ci=new $,rl=new $,Hs=new $,sl=new $;class or{constructor(e=new $,t=new $(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,jn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=jn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(jn.copy(this.origin).addScaledVector(this.direction,t),jn.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){il.copy(e).add(t).multiplyScalar(.5),zs.copy(t).sub(e).normalize(),ci.copy(this.origin).sub(il);const s=e.distanceTo(t)*.5,a=-this.direction.dot(zs),o=ci.dot(this.direction),l=-ci.dot(zs),c=ci.lengthSq(),h=Math.abs(1-a*a);let u,f,d,_;if(h>0)if(u=a*l-o,f=a*o-l,_=s*h,u>=0)if(f>=-_)if(f<=_){const b=1/h;u*=b,f*=b,d=u*(u+a*f+2*o)+f*(a*u+f+2*l)+c}else f=s,u=Math.max(0,-(a*f+o)),d=-u*u+f*(f+2*l)+c;else f=-s,u=Math.max(0,-(a*f+o)),d=-u*u+f*(f+2*l)+c;else f<=-_?(u=Math.max(0,-(-a*s+o)),f=u>0?-s:Math.min(Math.max(-s,-l),s),d=-u*u+f*(f+2*l)+c):f<=_?(u=0,f=Math.min(Math.max(-s,-l),s),d=f*(f+2*l)+c):(u=Math.max(0,-(a*s+o)),f=u>0?s:Math.min(Math.max(-s,-l),s),d=-u*u+f*(f+2*l)+c);else f=a>0?-s:s,u=Math.max(0,-(a*f+o)),d=-u*u+f*(f+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(il).addScaledVector(zs,f),d}intersectSphere(e,t){jn.subVectors(e.center,this.origin);const n=jn.dot(this.direction),r=jn.dot(jn)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),h>=0?(s=(e.min.y-f.y)*h,a=(e.max.y-f.y)*h):(s=(e.max.y-f.y)*h,a=(e.min.y-f.y)*h),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-f.z)*u,l=(e.max.z-f.z)*u):(o=(e.max.z-f.z)*u,l=(e.min.z-f.z)*u),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,jn)!==null}intersectTriangle(e,t,n,r,s){rl.subVectors(t,e),Hs.subVectors(n,e),sl.crossVectors(rl,Hs);let a=this.direction.dot(sl),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;ci.subVectors(this.origin,e);const l=o*this.direction.dot(Hs.crossVectors(ci,Hs));if(l<0)return null;const c=o*this.direction.dot(rl.cross(ci));if(c<0||l+c>a)return null;const h=-o*ci.dot(sl);return h<0?null:this.at(h/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class et{constructor(e,t,n,r,s,a,o,l,c,h,u,f,d,_,b,g){et.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c,h,u,f,d,_,b,g)}set(e,t,n,r,s,a,o,l,c,h,u,f,d,_,b,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=r,m[1]=s,m[5]=a,m[9]=o,m[13]=l,m[2]=c,m[6]=h,m[10]=u,m[14]=f,m[3]=d,m[7]=_,m[11]=b,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new et().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/lr.setFromMatrixColumn(e,0).length(),s=1/lr.setFromMatrixColumn(e,1).length(),a=1/lr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const f=a*h,d=a*u,_=o*h,b=o*u;t[0]=l*h,t[4]=-l*u,t[8]=c,t[1]=d+_*c,t[5]=f-b*c,t[9]=-o*l,t[2]=b-f*c,t[6]=_+d*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*h,d=l*u,_=c*h,b=c*u;t[0]=f+b*o,t[4]=_*o-d,t[8]=a*c,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=d*o-_,t[6]=b+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*h,d=l*u,_=c*h,b=c*u;t[0]=f-b*o,t[4]=-a*u,t[8]=_+d*o,t[1]=d+_*o,t[5]=a*h,t[9]=b-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*h,d=a*u,_=o*h,b=o*u;t[0]=l*h,t[4]=_*c-d,t[8]=f*c+b,t[1]=l*u,t[5]=b*c+f,t[9]=d*c-_,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,d=a*c,_=o*l,b=o*c;t[0]=l*h,t[4]=b-f*u,t[8]=_*u+d,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=d*u+_,t[10]=f-b*u}else if(e.order==="XZY"){const f=a*l,d=a*c,_=o*l,b=o*c;t[0]=l*h,t[4]=-u,t[8]=c*h,t[1]=f*u+b,t[5]=a*h,t[9]=d*u-_,t[2]=_*u-d,t[6]=o*h,t[10]=b*u+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Om,e,Fm)}lookAt(e,t,n){const r=this.elements;return cn.subVectors(e,t),cn.lengthSq()===0&&(cn.z=1),cn.normalize(),ui.crossVectors(n,cn),ui.lengthSq()===0&&(Math.abs(n.z)===1?cn.x+=1e-4:cn.z+=1e-4,cn.normalize(),ui.crossVectors(n,cn)),ui.normalize(),Vs.crossVectors(cn,ui),r[0]=ui.x,r[4]=Vs.x,r[8]=cn.x,r[1]=ui.y,r[5]=Vs.y,r[9]=cn.y,r[2]=ui.z,r[6]=Vs.z,r[10]=cn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],u=n[5],f=n[9],d=n[13],_=n[2],b=n[6],g=n[10],m=n[14],S=n[3],y=n[7],M=n[11],T=n[15],R=r[0],k=r[4],B=r[8],C=r[12],D=r[1],V=r[5],K=r[9],J=r[13],se=r[2],he=r[6],Q=r[10],de=r[14],ne=r[3],ue=r[7],Te=r[11],ke=r[15];return s[0]=a*R+o*D+l*se+c*ne,s[4]=a*k+o*V+l*he+c*ue,s[8]=a*B+o*K+l*Q+c*Te,s[12]=a*C+o*J+l*de+c*ke,s[1]=h*R+u*D+f*se+d*ne,s[5]=h*k+u*V+f*he+d*ue,s[9]=h*B+u*K+f*Q+d*Te,s[13]=h*C+u*J+f*de+d*ke,s[2]=_*R+b*D+g*se+m*ne,s[6]=_*k+b*V+g*he+m*ue,s[10]=_*B+b*K+g*Q+m*Te,s[14]=_*C+b*J+g*de+m*ke,s[3]=S*R+y*D+M*se+T*ne,s[7]=S*k+y*V+M*he+T*ue,s[11]=S*B+y*K+M*Q+T*Te,s[15]=S*C+y*J+M*de+T*ke,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],u=e[6],f=e[10],d=e[14],_=e[3],b=e[7],g=e[11],m=e[15];return _*(+s*l*u-r*c*u-s*o*f+n*c*f+r*o*d-n*l*d)+b*(+t*l*d-t*c*f+s*a*f-r*a*d+r*c*h-s*l*h)+g*(+t*c*u-t*o*d-s*a*u+n*a*d+s*o*h-n*c*h)+m*(-r*o*h-t*l*u+t*o*f+r*a*u-n*a*f+n*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=e[9],f=e[10],d=e[11],_=e[12],b=e[13],g=e[14],m=e[15],S=u*g*c-b*f*c+b*l*d-o*g*d-u*l*m+o*f*m,y=_*f*c-h*g*c-_*l*d+a*g*d+h*l*m-a*f*m,M=h*b*c-_*u*c+_*o*d-a*b*d-h*o*m+a*u*m,T=_*u*l-h*b*l-_*o*f+a*b*f+h*o*g-a*u*g,R=t*S+n*y+r*M+s*T;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const k=1/R;return e[0]=S*k,e[1]=(b*f*s-u*g*s-b*r*d+n*g*d+u*r*m-n*f*m)*k,e[2]=(o*g*s-b*l*s+b*r*c-n*g*c-o*r*m+n*l*m)*k,e[3]=(u*l*s-o*f*s-u*r*c+n*f*c+o*r*d-n*l*d)*k,e[4]=y*k,e[5]=(h*g*s-_*f*s+_*r*d-t*g*d-h*r*m+t*f*m)*k,e[6]=(_*l*s-a*g*s-_*r*c+t*g*c+a*r*m-t*l*m)*k,e[7]=(a*f*s-h*l*s+h*r*c-t*f*c-a*r*d+t*l*d)*k,e[8]=M*k,e[9]=(_*u*s-h*b*s-_*n*d+t*b*d+h*n*m-t*u*m)*k,e[10]=(a*b*s-_*o*s+_*n*c-t*b*c-a*n*m+t*o*m)*k,e[11]=(h*o*s-a*u*s-h*n*c+t*u*c+a*n*d-t*o*d)*k,e[12]=T*k,e[13]=(h*b*r-_*u*r+_*n*f-t*b*f-h*n*g+t*u*g)*k,e[14]=(_*o*r-a*b*r-_*n*l+t*b*l+a*n*g-t*o*g)*k,e[15]=(a*u*r-h*o*r+h*n*l-t*u*l-a*n*f+t*o*f)*k,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+n,h*l-r*a,0,c*l-r*o,h*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,h=a+a,u=o+o,f=s*c,d=s*h,_=s*u,b=a*h,g=a*u,m=o*u,S=l*c,y=l*h,M=l*u,T=n.x,R=n.y,k=n.z;return r[0]=(1-(b+m))*T,r[1]=(d+M)*T,r[2]=(_-y)*T,r[3]=0,r[4]=(d-M)*R,r[5]=(1-(f+m))*R,r[6]=(g+S)*R,r[7]=0,r[8]=(_+y)*k,r[9]=(g-S)*k,r[10]=(1-(f+b))*k,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=lr.set(r[0],r[1],r[2]).length();const a=lr.set(r[4],r[5],r[6]).length(),o=lr.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],bn.copy(this);const c=1/s,h=1/a,u=1/o;return bn.elements[0]*=c,bn.elements[1]*=c,bn.elements[2]*=c,bn.elements[4]*=h,bn.elements[5]*=h,bn.elements[6]*=h,bn.elements[8]*=u,bn.elements[9]*=u,bn.elements[10]*=u,t.setFromRotationMatrix(bn),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=Pn,l=!1){const c=this.elements,h=2*s/(t-e),u=2*s/(n-r),f=(t+e)/(t-e),d=(n+r)/(n-r);let _,b;if(l)_=s/(a-s),b=a*s/(a-s);else if(o===Pn)_=-(a+s)/(a-s),b=-2*a*s/(a-s);else if(o===Os)_=-a/(a-s),b=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=f,c[12]=0,c[1]=0,c[5]=u,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=_,c[14]=b,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=Pn,l=!1){const c=this.elements,h=2/(t-e),u=2/(n-r),f=-(t+e)/(t-e),d=-(n+r)/(n-r);let _,b;if(l)_=1/(a-s),b=a/(a-s);else if(o===Pn)_=-2/(a-s),b=-(a+s)/(a-s);else if(o===Os)_=-1/(a-s),b=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=0,c[12]=f,c[1]=0,c[5]=u,c[9]=0,c[13]=d,c[2]=0,c[6]=0,c[10]=_,c[14]=b,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const lr=new $,bn=new et,Om=new $(0,0,0),Fm=new $(1,1,1),ui=new $,Vs=new $,cn=new $,Nu=new et,Ou=new Dn;class Un{constructor(e=0,t=0,n=0,r=Un.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],u=r[2],f=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(it(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-it(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(it(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-it(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(it(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-it(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Nu.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Nu,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Ou.setFromEuler(this),this.setFromQuaternion(Ou,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Un.DEFAULT_ORDER="XYZ";class al{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let km=0;const Fu=new $,cr=new Dn,qn=new et,Gs=new $,ts=new $,Bm=new $,zm=new Dn,ku=new $(1,0,0),Bu=new $(0,1,0),zu=new $(0,0,1),Hu={type:"added"},Hm={type:"removed"},ur={type:"childadded",child:null},ol={type:"childremoved",child:null};class At extends Ei{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:km++}),this.uuid=vn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=At.DEFAULT_UP.clone();const e=new $,t=new Un,n=new Dn,r=new $(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new et},normalMatrix:{value:new Qe}}),this.matrix=new et,this.matrixWorld=new et,this.matrixAutoUpdate=At.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=At.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new al,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return cr.setFromAxisAngle(e,t),this.quaternion.multiply(cr),this}rotateOnWorldAxis(e,t){return cr.setFromAxisAngle(e,t),this.quaternion.premultiply(cr),this}rotateX(e){return this.rotateOnAxis(ku,e)}rotateY(e){return this.rotateOnAxis(Bu,e)}rotateZ(e){return this.rotateOnAxis(zu,e)}translateOnAxis(e,t){return Fu.copy(e).applyQuaternion(this.quaternion),this.position.add(Fu.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ku,e)}translateY(e){return this.translateOnAxis(Bu,e)}translateZ(e){return this.translateOnAxis(zu,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(qn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Gs.copy(e):Gs.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),ts.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?qn.lookAt(ts,Gs,this.up):qn.lookAt(Gs,ts,this.up),this.quaternion.setFromRotationMatrix(qn),r&&(qn.extractRotation(r.matrixWorld),cr.setFromRotationMatrix(qn),this.quaternion.premultiply(cr.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Hu),ur.child=e,this.dispatchEvent(ur),ur.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Hm),ol.child=e,this.dispatchEvent(ol),ol.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),qn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),qn.multiply(e.parent.matrixWorld)),e.applyMatrix4(qn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Hu),ur.child=e,this.dispatchEvent(ur),ur.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ts,e,Bm),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ts,zm,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const u=l[c];s(e.shapes,u)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),h=a(e.images),u=a(e.shapes),f=a(e.skeletons),d=a(e.animations),_=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d),_.length>0&&(n.nodes=_)}return n.object=r,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}At.DEFAULT_UP=new $(0,1,0),At.DEFAULT_MATRIX_AUTO_UPDATE=!0,At.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Sn=new $,Yn=new $,ll=new $,Kn=new $,hr=new $,fr=new $,Vu=new $,cl=new $,ul=new $,hl=new $,fl=new pt,dl=new pt,pl=new pt;class Mn{constructor(e=new $,t=new $,n=new $){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Sn.subVectors(e,t),r.cross(Sn);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Sn.subVectors(r,t),Yn.subVectors(n,t),ll.subVectors(e,t);const a=Sn.dot(Sn),o=Sn.dot(Yn),l=Sn.dot(ll),c=Yn.dot(Yn),h=Yn.dot(ll),u=a*c-o*o;if(u===0)return s.set(0,0,0),null;const f=1/u,d=(c*l-o*h)*f,_=(a*h-o*l)*f;return s.set(1-d-_,_,d)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Kn)===null?!1:Kn.x>=0&&Kn.y>=0&&Kn.x+Kn.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,Kn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Kn.x),l.addScaledVector(a,Kn.y),l.addScaledVector(o,Kn.z),l)}static getInterpolatedAttribute(e,t,n,r,s,a){return fl.setScalar(0),dl.setScalar(0),pl.setScalar(0),fl.fromBufferAttribute(e,t),dl.fromBufferAttribute(e,n),pl.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(fl,s.x),a.addScaledVector(dl,s.y),a.addScaledVector(pl,s.z),a}static isFrontFacing(e,t,n,r){return Sn.subVectors(n,t),Yn.subVectors(e,t),Sn.cross(Yn).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Sn.subVectors(this.c,this.b),Yn.subVectors(this.a,this.b),Sn.cross(Yn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Mn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Mn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Mn.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Mn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Mn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;hr.subVectors(r,n),fr.subVectors(s,n),cl.subVectors(e,n);const l=hr.dot(cl),c=fr.dot(cl);if(l<=0&&c<=0)return t.copy(n);ul.subVectors(e,r);const h=hr.dot(ul),u=fr.dot(ul);if(h>=0&&u<=h)return t.copy(r);const f=l*u-h*c;if(f<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(n).addScaledVector(hr,a);hl.subVectors(e,s);const d=hr.dot(hl),_=fr.dot(hl);if(_>=0&&d<=_)return t.copy(s);const b=d*c-l*_;if(b<=0&&c>=0&&_<=0)return o=c/(c-_),t.copy(n).addScaledVector(fr,o);const g=h*_-d*u;if(g<=0&&u-h>=0&&d-_>=0)return Vu.subVectors(s,r),o=(u-h)/(u-h+(d-_)),t.copy(r).addScaledVector(Vu,o);const m=1/(g+b+f);return a=b*m,o=f*m,t.copy(n).addScaledVector(hr,a).addScaledVector(fr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Gu={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},hi={h:0,s:0,l:0},Ws={h:0,s:0,l:0};function ml(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class Ze{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Bt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,lt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=lt.workingColorSpace){return this.r=e,this.g=t,this.b=n,lt.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=lt.workingColorSpace){if(e=Yo(e,1),t=it(t,0,1),n=it(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=ml(a,s,e+1/3),this.g=ml(a,s,e),this.b=ml(a,s,e-1/3)}return lt.colorSpaceToWorking(this,r),this}setStyle(e,t=Bt){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Bt){const n=Gu[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Xn(e.r),this.g=Xn(e.g),this.b=Xn(e.b),this}copyLinearToSRGB(e){return this.r=nr(e.r),this.g=nr(e.g),this.b=nr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Bt){return lt.workingToColorSpace($t.copy(this),e),Math.round(it($t.r*255,0,255))*65536+Math.round(it($t.g*255,0,255))*256+Math.round(it($t.b*255,0,255))}getHexString(e=Bt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=lt.workingColorSpace){lt.workingToColorSpace($t.copy(this),t);const n=$t.r,r=$t.g,s=$t.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=h<=.5?u/(a+o):u/(2-a-o),a){case n:l=(r-s)/u+(r<s?6:0);break;case r:l=(s-n)/u+2;break;case s:l=(n-r)/u+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=lt.workingColorSpace){return lt.workingToColorSpace($t.copy(this),t),e.r=$t.r,e.g=$t.g,e.b=$t.b,e}getStyle(e=Bt){lt.workingToColorSpace($t.copy(this),e);const t=$t.r,n=$t.g,r=$t.b;return e!==Bt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(hi),this.setHSL(hi.h+e,hi.s+t,hi.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(hi),e.getHSL(Ws);const n=Kr(hi.h,Ws.h,t),r=Kr(hi.s,Ws.s,t),s=Kr(hi.l,Ws.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const $t=new Ze;Ze.NAMES=Gu;let Vm=0;class Nn extends Ei{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Vm++}),this.uuid=vn(),this.name="",this.type="Material",this.blending=Yi,this.side=Gn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Qa,this.blendDst=eo,this.blendEquation=Si,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ze(0,0,0),this.blendAlpha=0,this.depthFunc=Ki,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Eu,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=er,this.stencilZFail=er,this.stencilZPass=er,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Yi&&(n.blending=this.blending),this.side!==Gn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Qa&&(n.blendSrc=this.blendSrc),this.blendDst!==eo&&(n.blendDst=this.blendDst),this.blendEquation!==Si&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ki&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Eu&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==er&&(n.stencilFail=this.stencilFail),this.stencilZFail!==er&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==er&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Ri extends Nn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ze(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Un,this.combine=ou,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Lt=new $,Xs=new Ye;let Gm=0;class Zt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Gm++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=qo,this.updateRanges=[],this.gpuType=_n,this.version=0}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.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Xs.fromBufferAttribute(this,t),Xs.applyMatrix3(e),this.setXY(t,Xs.x,Xs.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Lt.fromBufferAttribute(this,t),Lt.applyMatrix3(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Lt.fromBufferAttribute(this,t),Lt.applyMatrix4(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Lt.fromBufferAttribute(this,t),Lt.applyNormalMatrix(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Lt.fromBufferAttribute(this,t),Lt.transformDirection(e),this.setXYZ(t,Lt.x,Lt.y,Lt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=yn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=vt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=yn(t,this.array)),t}setX(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=yn(t,this.array)),t}setY(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=yn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=yn(t,this.array)),t}setW(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),r=vt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),r=vt(r,this.array),s=vt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==qo&&(e.usage=this.usage),e}}class Wu extends Zt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Xu extends Zt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class dn extends Zt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let Wm=0;const pn=new et,gl=new At,dr=new $,un=new Ln,ns=new Ln,Ht=new $;class En extends Ei{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Wm++}),this.uuid=vn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Pu(e)?Xu:Wu)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Qe().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return pn.makeRotationFromQuaternion(e),this.applyMatrix4(pn),this}rotateX(e){return pn.makeRotationX(e),this.applyMatrix4(pn),this}rotateY(e){return pn.makeRotationY(e),this.applyMatrix4(pn),this}rotateZ(e){return pn.makeRotationZ(e),this.applyMatrix4(pn),this}translate(e,t,n){return pn.makeTranslation(e,t,n),this.applyMatrix4(pn),this}scale(e,t,n){return pn.makeScale(e,t,n),this.applyMatrix4(pn),this}lookAt(e){return gl.lookAt(e),gl.updateMatrix(),this.applyMatrix4(gl.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(dr).negate(),this.translate(dr.x,dr.y,dr.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new dn(n,3))}else{const n=Math.min(e.length,t.count);for(let r=0;r<n;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ln);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new $(-1/0,-1/0,-1/0),new $(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];un.setFromBufferAttribute(s),this.morphTargetsRelative?(Ht.addVectors(this.boundingBox.min,un.min),this.boundingBox.expandByPoint(Ht),Ht.addVectors(this.boundingBox.max,un.max),this.boundingBox.expandByPoint(Ht)):(this.boundingBox.expandByPoint(un.min),this.boundingBox.expandByPoint(un.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new In);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new $,1/0);return}if(e){const n=this.boundingSphere.center;if(un.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];ns.setFromBufferAttribute(o),this.morphTargetsRelative?(Ht.addVectors(un.min,ns.min),un.expandByPoint(Ht),Ht.addVectors(un.max,ns.max),un.expandByPoint(Ht)):(un.expandByPoint(ns.min),un.expandByPoint(ns.max))}un.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)Ht.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Ht));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)Ht.fromBufferAttribute(o,c),l&&(dr.fromBufferAttribute(e,c),Ht.add(dr)),r=Math.max(r,n.distanceToSquared(Ht))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Zt(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let B=0;B<n.count;B++)o[B]=new $,l[B]=new $;const c=new $,h=new $,u=new $,f=new Ye,d=new Ye,_=new Ye,b=new $,g=new $;function m(B,C,D){c.fromBufferAttribute(n,B),h.fromBufferAttribute(n,C),u.fromBufferAttribute(n,D),f.fromBufferAttribute(s,B),d.fromBufferAttribute(s,C),_.fromBufferAttribute(s,D),h.sub(c),u.sub(c),d.sub(f),_.sub(f);const V=1/(d.x*_.y-_.x*d.y);isFinite(V)&&(b.copy(h).multiplyScalar(_.y).addScaledVector(u,-d.y).multiplyScalar(V),g.copy(u).multiplyScalar(d.x).addScaledVector(h,-_.x).multiplyScalar(V),o[B].add(b),o[C].add(b),o[D].add(b),l[B].add(g),l[C].add(g),l[D].add(g))}let S=this.groups;S.length===0&&(S=[{start:0,count:e.count}]);for(let B=0,C=S.length;B<C;++B){const D=S[B],V=D.start,K=D.count;for(let J=V,se=V+K;J<se;J+=3)m(e.getX(J+0),e.getX(J+1),e.getX(J+2))}const y=new $,M=new $,T=new $,R=new $;function k(B){T.fromBufferAttribute(r,B),R.copy(T);const C=o[B];y.copy(C),y.sub(T.multiplyScalar(T.dot(C))).normalize(),M.crossVectors(R,C);const V=M.dot(l[B])<0?-1:1;a.setXYZW(B,y.x,y.y,y.z,V)}for(let B=0,C=S.length;B<C;++B){const D=S[B],V=D.start,K=D.count;for(let J=V,se=V+K;J<se;J+=3)k(e.getX(J+0)),k(e.getX(J+1)),k(e.getX(J+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Zt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,d=n.count;f<d;f++)n.setXYZ(f,0,0,0);const r=new $,s=new $,a=new $,o=new $,l=new $,c=new $,h=new $,u=new $;if(e)for(let f=0,d=e.count;f<d;f+=3){const _=e.getX(f+0),b=e.getX(f+1),g=e.getX(f+2);r.fromBufferAttribute(t,_),s.fromBufferAttribute(t,b),a.fromBufferAttribute(t,g),h.subVectors(a,s),u.subVectors(r,s),h.cross(u),o.fromBufferAttribute(n,_),l.fromBufferAttribute(n,b),c.fromBufferAttribute(n,g),o.add(h),l.add(h),c.add(h),n.setXYZ(_,o.x,o.y,o.z),n.setXYZ(b,l.x,l.y,l.z),n.setXYZ(g,c.x,c.y,c.z)}else for(let f=0,d=t.count;f<d;f+=3)r.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),a.fromBufferAttribute(t,f+2),h.subVectors(a,s),u.subVectors(r,s),h.cross(u),n.setXYZ(f+0,h.x,h.y,h.z),n.setXYZ(f+1,h.x,h.y,h.z),n.setXYZ(f+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Ht.fromBufferAttribute(e,t),Ht.normalize(),e.setXYZ(t,Ht.x,Ht.y,Ht.z)}toNonIndexed(){function e(o,l){const c=o.array,h=o.itemSize,u=o.normalized,f=new c.constructor(l.length*h);let d=0,_=0;for(let b=0,g=l.length;b<g;b++){o.isInterleavedBufferAttribute?d=l[b]*o.data.stride+o.offset:d=l[b]*h;for(let m=0;m<h;m++)f[_++]=c[d++]}return new Zt(f,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new En,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let h=0,u=c.length;h<u;h++){const f=c[h],d=e(f,n);l.push(d)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,f=c.length;u<f;u++){const d=c[u];h.push(d.toJSON(e.data))}h.length>0&&(r[l]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const r=e.attributes;for(const c in r){const h=r[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],u=s[c];for(let f=0,d=u.length;f<d;f++)h.push(u[f].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,h=a.length;c<h;c++){const u=a[c];this.addGroup(u.start,u.count,u.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const $u=new et,Ci=new or,$s=new In,ju=new $,js=new $,qs=new $,Ys=new $,_l=new $,Ks=new $,qu=new $,Zs=new $;class Jt extends At{constructor(e=new En,t=new Ri){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){Ks.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=o[l],u=s[l];h!==0&&(_l.fromBufferAttribute(u,e),a?Ks.addScaledVector(_l,h):Ks.addScaledVector(_l.sub(t),h))}t.add(Ks)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),$s.copy(n.boundingSphere),$s.applyMatrix4(s),Ci.copy(e.ray).recast(e.near),!($s.containsPoint(Ci.origin)===!1&&(Ci.intersectSphere($s,ju)===null||Ci.origin.distanceToSquared(ju)>(e.far-e.near)**2))&&($u.copy(s).invert(),Ci.copy(e.ray).applyMatrix4($u),!(n.boundingBox!==null&&Ci.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Ci)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,f=s.groups,d=s.drawRange;if(o!==null)if(Array.isArray(a))for(let _=0,b=f.length;_<b;_++){const g=f[_],m=a[g.materialIndex],S=Math.max(g.start,d.start),y=Math.min(o.count,Math.min(g.start+g.count,d.start+d.count));for(let M=S,T=y;M<T;M+=3){const R=o.getX(M),k=o.getX(M+1),B=o.getX(M+2);r=Js(this,m,e,n,c,h,u,R,k,B),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const _=Math.max(0,d.start),b=Math.min(o.count,d.start+d.count);for(let g=_,m=b;g<m;g+=3){const S=o.getX(g),y=o.getX(g+1),M=o.getX(g+2);r=Js(this,a,e,n,c,h,u,S,y,M),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let _=0,b=f.length;_<b;_++){const g=f[_],m=a[g.materialIndex],S=Math.max(g.start,d.start),y=Math.min(l.count,Math.min(g.start+g.count,d.start+d.count));for(let M=S,T=y;M<T;M+=3){const R=M,k=M+1,B=M+2;r=Js(this,m,e,n,c,h,u,R,k,B),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const _=Math.max(0,d.start),b=Math.min(l.count,d.start+d.count);for(let g=_,m=b;g<m;g+=3){const S=g,y=g+1,M=g+2;r=Js(this,a,e,n,c,h,u,S,y,M),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}}}function Xm(i,e,t,n,r,s,a,o){let l;if(e.side===sn?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===Gn,o),l===null)return null;Zs.copy(o),Zs.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(Zs);return c<t.near||c>t.far?null:{distance:c,point:Zs.clone(),object:i}}function Js(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,js),i.getVertexPosition(l,qs),i.getVertexPosition(c,Ys);const h=Xm(i,e,t,n,js,qs,Ys,qu);if(h){const u=new $;Mn.getBarycoord(qu,js,qs,Ys,u),r&&(h.uv=Mn.getInterpolatedAttribute(r,o,l,c,u,new Ye)),s&&(h.uv1=Mn.getInterpolatedAttribute(s,o,l,c,u,new Ye)),a&&(h.normal=Mn.getInterpolatedAttribute(a,o,l,c,u,new $),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const f={a:o,b:l,c,normal:new $,materialIndex:0};Mn.getNormal(js,qs,Ys,f.normal),h.face=f,h.barycoord=u}return h}class pr extends En{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],u=[];let f=0,d=0;_("z","y","x",-1,-1,n,t,e,a,s,0),_("z","y","x",1,-1,n,t,-e,a,s,1),_("x","z","y",1,1,e,n,t,r,a,2),_("x","z","y",1,-1,e,n,-t,r,a,3),_("x","y","z",1,-1,e,t,n,r,s,4),_("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new dn(c,3)),this.setAttribute("normal",new dn(h,3)),this.setAttribute("uv",new dn(u,2));function _(b,g,m,S,y,M,T,R,k,B,C){const D=M/k,V=T/B,K=M/2,J=T/2,se=R/2,he=k+1,Q=B+1;let de=0,ne=0;const ue=new $;for(let Te=0;Te<Q;Te++){const ke=Te*V-J;for(let O=0;O<he;O++){const H=O*D-K;ue[b]=H*S,ue[g]=ke*y,ue[m]=se,c.push(ue.x,ue.y,ue.z),ue[b]=0,ue[g]=0,ue[m]=R>0?1:-1,h.push(ue.x,ue.y,ue.z),u.push(O/k),u.push(1-Te/B),de+=1}}for(let Te=0;Te<B;Te++)for(let ke=0;ke<k;ke++){const O=f+ke+he*Te,H=f+ke+he*(Te+1),we=f+(ke+1)+he*(Te+1),Be=f+(ke+1)+he*Te;l.push(O,H,Be),l.push(H,we,Be),ne+=6}o.addGroup(d,ne,C),d+=ne,f+=de}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new pr(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function mr(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function Qt(i){const e={};for(let t=0;t<i.length;t++){const n=mr(i[t]);for(const r in n)e[r]=n[r]}return e}function $m(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Yu(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:lt.workingColorSpace}const jm={clone:mr,merge:Qt};var qm=`void main() {
|
|
35
|
+
*/const Va="180",$i={ROTATE:0,DOLLY:1,PAN:2},qi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},tp=0,Zc=1,np=2,Jc=1,ip=2,Wn=3,Xn=0,on=1,yn=2,oi=0,ji=1,Qc=2,eu=3,tu=4,rp=5,Ai=100,sp=101,ap=102,op=103,lp=104,cp=200,up=201,hp=202,fp=203,Ga=204,Wa=205,dp=206,pp=207,mp=208,gp=209,_p=210,vp=211,yp=212,xp=213,bp=214,Xa=0,$a=1,qa=2,Yi=3,ja=4,Ya=5,Ka=6,Za=7,nu=0,Sp=1,Mp=2,li=0,Ep=1,Tp=2,wp=3,iu=4,Ap=5,Rp=6,Cp=7,ru="attached",Pp="detached",su=300,Ki=301,Zi=302,Ja=303,Qa=304,Ts=306,Ji=1e3,ci=1001,ws=1002,Wt=1003,au=1004,Vr=1005,Nt=1006,As=1007,$n=1008,pn=1009,ou=1010,lu=1011,Gr=1012,eo=1013,ui=1014,xn=1015,Wr=1016,to=1017,no=1018,Xr=1020,cu=35902,uu=35899,hu=1021,fu=1022,ln=1023,Qi=1026,$r=1027,io=1028,ro=1029,du=1030,so=1031,ao=1033,Rs=33776,Cs=33777,Ps=33778,Ds=33779,oo=35840,lo=35841,co=35842,uo=35843,ho=36196,fo=37492,po=37496,mo=37808,go=37809,_o=37810,vo=37811,yo=37812,xo=37813,bo=37814,So=37815,Mo=37816,Eo=37817,To=37818,wo=37819,Ao=37820,Ro=37821,Co=36492,Po=36494,Do=36495,Lo=36283,Io=36284,Uo=36285,No=36286,qr=2300,jr=2301,Oo=2302,pu=2400,mu=2401,gu=2402,Dp=2500,Lp=0,_u=1,Fo=2,Ip=3200,Up=3201,vu=0,Np=1,Jt="",Ht="srgb",Qt="srgb-linear",Ls="linear",Mt="srgb",er=7680,yu=519,Op=512,Fp=513,kp=514,xu=515,Bp=516,zp=517,Hp=518,Vp=519,ko=35044,Bo="300 es",Ln=2e3,Is=2001;class Ri{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const r=n[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const qt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let bu=1234567;const Yr=Math.PI/180,tr=180/Math.PI;function bn(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(qt[i&255]+qt[i>>8&255]+qt[i>>16&255]+qt[i>>24&255]+"-"+qt[e&255]+qt[e>>8&255]+"-"+qt[e>>16&15|64]+qt[e>>24&255]+"-"+qt[t&63|128]+qt[t>>8&255]+"-"+qt[t>>16&255]+qt[t>>24&255]+qt[n&255]+qt[n>>8&255]+qt[n>>16&255]+qt[n>>24&255]).toLowerCase()}function at(i,e,t){return Math.max(e,Math.min(t,i))}function zo(i,e){return(i%e+e)%e}function Gp(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Wp(i,e,t){return i!==e?(t-i)/(e-i):0}function Kr(i,e,t){return(1-t)*i+t*e}function Xp(i,e,t,n){return Kr(i,e,1-Math.exp(-t*n))}function $p(i,e=1){return e-Math.abs(zo(i,e*2)-e)}function qp(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function jp(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Yp(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Kp(i,e){return i+Math.random()*(e-i)}function Zp(i){return i*(.5-Math.random())}function Jp(i){i!==void 0&&(bu=i);let e=bu+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Qp(i){return i*Yr}function em(i){return i*tr}function tm(i){return(i&i-1)===0&&i!==0}function nm(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function im(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function rm(i,e,t,n,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),h=a((e+n)/2),u=s((e-n)/2),f=a((e-n)/2),d=s((n-e)/2),_=a((n-e)/2);switch(r){case"XYX":i.set(o*h,l*u,l*f,o*c);break;case"YZY":i.set(l*f,o*h,l*u,o*c);break;case"ZXZ":i.set(l*u,l*f,o*h,o*c);break;case"XZX":i.set(o*h,l*_,l*d,o*c);break;case"YXY":i.set(l*d,o*h,l*_,o*c);break;case"ZYZ":i.set(l*_,l*d,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Sn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function bt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const Su={DEG2RAD:Yr,RAD2DEG:tr,generateUUID:bn,clamp:at,euclideanModulo:zo,mapLinear:Gp,inverseLerp:Wp,lerp:Kr,damp:Xp,pingpong:$p,smoothstep:qp,smootherstep:jp,randInt:Yp,randFloat:Kp,randFloatSpread:Zp,seededRandom:Jp,degToRad:Qp,radToDeg:em,isPowerOfTwo:tm,ceilPowerOfTwo:nm,floorPowerOfTwo:im,setQuaternionFromProperEuler:rm,normalize:bt,denormalize:Sn};class Je{constructor(e=0,t=0){Je.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=at(this.x,e.x,t.x),this.y=at(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=at(this.x,e,t),this.y=at(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(at(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(at(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class In{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let l=n[r+0],c=n[r+1],h=n[r+2],u=n[r+3];const f=s[a+0],d=s[a+1],_=s[a+2],b=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u;return}if(o===1){e[t+0]=f,e[t+1]=d,e[t+2]=_,e[t+3]=b;return}if(u!==b||l!==f||c!==d||h!==_){let g=1-o;const m=l*f+c*d+h*_+u*b,S=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){const T=Math.sqrt(y),R=Math.atan2(T,m*S);g=Math.sin(g*R)/T,o=Math.sin(o*R)/T}const M=o*S;if(l=l*g+f*M,c=c*g+d*M,h=h*g+_*M,u=u*g+b*M,g===1-o){const T=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=T,c*=T,h*=T,u*=T}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],h=n[r+3],u=s[a],f=s[a+1],d=s[a+2],_=s[a+3];return e[t]=o*_+h*u+l*d-c*f,e[t+1]=l*_+h*f+c*u-o*d,e[t+2]=c*_+h*d+o*f-l*u,e[t+3]=h*_-o*u-l*f-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(r/2),u=o(s/2),f=l(n/2),d=l(r/2),_=l(s/2);switch(a){case"XYZ":this._x=f*h*u+c*d*_,this._y=c*d*u-f*h*_,this._z=c*h*_+f*d*u,this._w=c*h*u-f*d*_;break;case"YXZ":this._x=f*h*u+c*d*_,this._y=c*d*u-f*h*_,this._z=c*h*_-f*d*u,this._w=c*h*u+f*d*_;break;case"ZXY":this._x=f*h*u-c*d*_,this._y=c*d*u+f*h*_,this._z=c*h*_+f*d*u,this._w=c*h*u-f*d*_;break;case"ZYX":this._x=f*h*u-c*d*_,this._y=c*d*u+f*h*_,this._z=c*h*_-f*d*u,this._w=c*h*u+f*d*_;break;case"YZX":this._x=f*h*u+c*d*_,this._y=c*d*u+f*h*_,this._z=c*h*_-f*d*u,this._w=c*h*u-f*d*_;break;case"XZY":this._x=f*h*u-c*d*_,this._y=c*d*u-f*h*_,this._z=c*h*_+f*d*u,this._w=c*h*u+f*d*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],u=t[10],f=n+o+u;if(f>0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(h-l)*d,this._y=(s-c)*d,this._z=(a-r)*d}else if(n>o&&n>u){const d=2*Math.sqrt(1+n-o-u);this._w=(h-l)/d,this._x=.25*d,this._y=(r+a)/d,this._z=(s+c)/d}else if(o>u){const d=2*Math.sqrt(1+o-n-u);this._w=(s-c)/d,this._x=(r+a)/d,this._y=.25*d,this._z=(l+h)/d}else{const d=2*Math.sqrt(1+u-n-o);this._w=(a-r)/d,this._x=(s+c)/d,this._y=(l+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(at(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=n*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-r*o,this._w=a*h-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const d=1-t;return this._w=d*a+t*this._w,this._x=d*n+t*this._x,this._y=d*r+t*this._y,this._z=d*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),u=Math.sin((1-t)*h)/c,f=Math.sin(t*h)/c;return this._w=a*u+this._w*f,this._x=n*u+this._x*f,this._y=r*u+this._y*f,this._z=s*u+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ${constructor(e=0,t=0,n=0){$.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Mu.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Mu.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*n),h=2*(o*t-s*r),u=2*(s*n-a*t);return this.x=t+l*c+a*u-o*h,this.y=n+l*h+o*c-s*u,this.z=r+l*u+s*h-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=at(this.x,e.x,t.x),this.y=at(this.y,e.y,t.y),this.z=at(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=at(this.x,e,t),this.y=at(this.y,e,t),this.z=at(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(at(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Ho.copy(this).projectOnVector(e),this.sub(Ho)}reflect(e){return this.sub(Ho.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(at(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Ho=new $,Mu=new In;class nt{constructor(e,t,n,r,s,a,o,l,c){nt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const h=this.elements;return h[0]=e,h[1]=r,h[2]=o,h[3]=t,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],u=n[7],f=n[2],d=n[5],_=n[8],b=r[0],g=r[3],m=r[6],S=r[1],y=r[4],M=r[7],T=r[2],R=r[5],k=r[8];return s[0]=a*b+o*S+l*T,s[3]=a*g+o*y+l*R,s[6]=a*m+o*M+l*k,s[1]=c*b+h*S+u*T,s[4]=c*g+h*y+u*R,s[7]=c*m+h*M+u*k,s[2]=f*b+d*S+_*T,s[5]=f*g+d*y+_*R,s[8]=f*m+d*M+_*k,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-n*s*h+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=h*a-o*c,f=o*l-h*s,d=c*s-a*l,_=t*u+n*f+r*d;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const b=1/_;return e[0]=u*b,e[1]=(r*c-h*n)*b,e[2]=(o*n-r*a)*b,e[3]=f*b,e[4]=(h*t-r*l)*b,e[5]=(r*s-o*t)*b,e[6]=d*b,e[7]=(n*l-c*t)*b,e[8]=(a*t-n*s)*b,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Vo.makeScale(e,t)),this}rotate(e){return this.premultiply(Vo.makeRotation(-e)),this}translate(e,t){return this.premultiply(Vo.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Vo=new nt;function Eu(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Zr(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function sm(){const i=Zr("canvas");return i.style.display="block",i}const Tu={};function Jr(i){i in Tu||(Tu[i]=!0,console.warn(i))}function am(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}const wu=new nt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Au=new nt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function om(){const i={enabled:!0,workingColorSpace:Qt,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Mt&&(r.r=qn(r.r),r.g=qn(r.g),r.b=qn(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Mt&&(r.r=nr(r.r),r.g=nr(r.g),r.b=nr(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Jt?Ls:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Jr("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Jr("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Qt]:{primaries:e,whitePoint:n,transfer:Ls,toXYZ:wu,fromXYZ:Au,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Ht},outputColorSpaceConfig:{drawingBufferColorSpace:Ht}},[Ht]:{primaries:e,whitePoint:n,transfer:Mt,toXYZ:wu,fromXYZ:Au,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Ht}}}),i}const ht=om();function qn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function nr(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let ir;class lm{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{ir===void 0&&(ir=Zr("canvas")),ir.width=e.width,ir.height=e.height;const r=ir.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=ir}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Zr("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=qn(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(qn(t[n]/255)*255):t[n]=qn(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let cm=0;class Go{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:cm++}),this.uuid=bn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Wo(r[a].image)):s.push(Wo(r[a]))}else s=Wo(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function Wo(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?lm.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let um=0;const Xo=new $;class Dt extends Ri{constructor(e=Dt.DEFAULT_IMAGE,t=Dt.DEFAULT_MAPPING,n=ci,r=ci,s=Nt,a=$n,o=ln,l=pn,c=Dt.DEFAULT_ANISOTROPY,h=Jt){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:um++}),this.uuid=bn(),this.name="",this.source=new Go(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Je(0,0),this.repeat=new Je(1,1),this.center=new Je(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new nt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Xo).x}get height(){return this.source.getSize(Xo).y}get depth(){return this.source.getSize(Xo).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==su)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ji:e.x=e.x-Math.floor(e.x);break;case ci:e.x=e.x<0?0:1;break;case ws:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Ji:e.y=e.y-Math.floor(e.y);break;case ci:e.y=e.y<0?0:1;break;case ws:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Dt.DEFAULT_IMAGE=null,Dt.DEFAULT_MAPPING=su,Dt.DEFAULT_ANISOTROPY=1;class dt{constructor(e=0,t=0,n=0,r=1){dt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const l=e.elements,c=l[0],h=l[4],u=l[8],f=l[1],d=l[5],_=l[9],b=l[2],g=l[6],m=l[10];if(Math.abs(h-f)<.01&&Math.abs(u-b)<.01&&Math.abs(_-g)<.01){if(Math.abs(h+f)<.1&&Math.abs(u+b)<.1&&Math.abs(_+g)<.1&&Math.abs(c+d+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(c+1)/2,M=(d+1)/2,T=(m+1)/2,R=(h+f)/4,k=(u+b)/4,B=(_+g)/4;return y>M&&y>T?y<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(y),r=R/n,s=k/n):M>T?M<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(M),n=R/r,s=B/r):T<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(T),n=k/s,r=B/s),this.set(n,r,s,t),this}let S=Math.sqrt((g-_)*(g-_)+(u-b)*(u-b)+(f-h)*(f-h));return Math.abs(S)<.001&&(S=1),this.x=(g-_)/S,this.y=(u-b)/S,this.z=(f-h)/S,this.w=Math.acos((c+d+m-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=at(this.x,e.x,t.x),this.y=at(this.y,e.y,t.y),this.z=at(this.z,e.z,t.z),this.w=at(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=at(this.x,e,t),this.y=at(this.y,e,t),this.z=at(this.z,e,t),this.w=at(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(at(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class hm extends Ri{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Nt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new dt(0,0,e,t),this.scissorTest=!1,this.viewport=new dt(0,0,e,t);const r={width:e,height:t,depth:n.depth},s=new Dt(r);this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:Nt,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isArrayTexture=this.textures[r].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new Go(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class jn extends hm{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Ru extends Dt{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Wt,this.minFilter=Wt,this.wrapR=ci,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class fm extends Dt{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Wt,this.minFilter=Wt,this.wrapR=ci,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Un{constructor(e=new $(1/0,1/0,1/0),t=new $(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Mn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Mn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Mn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Mn):Mn.fromBufferAttribute(s,a),Mn.applyMatrix4(e.matrixWorld),this.expandByPoint(Mn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Us.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Us.copy(n.boundingBox)),Us.applyMatrix4(e.matrixWorld),this.union(Us)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Mn),Mn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Qr),Ns.subVectors(this.max,Qr),rr.subVectors(e.a,Qr),sr.subVectors(e.b,Qr),ar.subVectors(e.c,Qr),hi.subVectors(sr,rr),fi.subVectors(ar,sr),Ci.subVectors(rr,ar);let t=[0,-hi.z,hi.y,0,-fi.z,fi.y,0,-Ci.z,Ci.y,hi.z,0,-hi.x,fi.z,0,-fi.x,Ci.z,0,-Ci.x,-hi.y,hi.x,0,-fi.y,fi.x,0,-Ci.y,Ci.x,0];return!$o(t,rr,sr,ar,Ns)||(t=[1,0,0,0,1,0,0,0,1],!$o(t,rr,sr,ar,Ns))?!1:(Os.crossVectors(hi,fi),t=[Os.x,Os.y,Os.z],$o(t,rr,sr,ar,Ns))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Mn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Mn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Yn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Yn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Yn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Yn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Yn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Yn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Yn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Yn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Yn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Yn=[new $,new $,new $,new $,new $,new $,new $,new $],Mn=new $,Us=new Un,rr=new $,sr=new $,ar=new $,hi=new $,fi=new $,Ci=new $,Qr=new $,Ns=new $,Os=new $,Pi=new $;function $o(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){Pi.fromArray(i,s);const o=r.x*Math.abs(Pi.x)+r.y*Math.abs(Pi.y)+r.z*Math.abs(Pi.z),l=e.dot(Pi),c=t.dot(Pi),h=n.dot(Pi);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const dm=new Un,es=new $,qo=new $;class Nn{constructor(e=new $,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):dm.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;es.subVectors(e,this.center);const t=es.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(es,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(qo.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(es.copy(e.center).add(qo)),this.expandByPoint(es.copy(e.center).sub(qo))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const Kn=new $,jo=new $,Fs=new $,di=new $,Yo=new $,ks=new $,Ko=new $;class or{constructor(e=new $,t=new $(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Kn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Kn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Kn.copy(this.origin).addScaledVector(this.direction,t),Kn.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){jo.copy(e).add(t).multiplyScalar(.5),Fs.copy(t).sub(e).normalize(),di.copy(this.origin).sub(jo);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Fs),o=di.dot(this.direction),l=-di.dot(Fs),c=di.lengthSq(),h=Math.abs(1-a*a);let u,f,d,_;if(h>0)if(u=a*l-o,f=a*o-l,_=s*h,u>=0)if(f>=-_)if(f<=_){const b=1/h;u*=b,f*=b,d=u*(u+a*f+2*o)+f*(a*u+f+2*l)+c}else f=s,u=Math.max(0,-(a*f+o)),d=-u*u+f*(f+2*l)+c;else f=-s,u=Math.max(0,-(a*f+o)),d=-u*u+f*(f+2*l)+c;else f<=-_?(u=Math.max(0,-(-a*s+o)),f=u>0?-s:Math.min(Math.max(-s,-l),s),d=-u*u+f*(f+2*l)+c):f<=_?(u=0,f=Math.min(Math.max(-s,-l),s),d=f*(f+2*l)+c):(u=Math.max(0,-(a*s+o)),f=u>0?s:Math.min(Math.max(-s,-l),s),d=-u*u+f*(f+2*l)+c);else f=a>0?-s:s,u=Math.max(0,-(a*f+o)),d=-u*u+f*(f+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(jo).addScaledVector(Fs,f),d}intersectSphere(e,t){Kn.subVectors(e.center,this.origin);const n=Kn.dot(this.direction),r=Kn.dot(Kn)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),h>=0?(s=(e.min.y-f.y)*h,a=(e.max.y-f.y)*h):(s=(e.max.y-f.y)*h,a=(e.min.y-f.y)*h),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-f.z)*u,l=(e.max.z-f.z)*u):(o=(e.max.z-f.z)*u,l=(e.min.z-f.z)*u),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Kn)!==null}intersectTriangle(e,t,n,r,s){Yo.subVectors(t,e),ks.subVectors(n,e),Ko.crossVectors(Yo,ks);let a=this.direction.dot(Ko),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;di.subVectors(this.origin,e);const l=o*this.direction.dot(ks.crossVectors(di,ks));if(l<0)return null;const c=o*this.direction.dot(Yo.cross(di));if(c<0||l+c>a)return null;const h=-o*di.dot(Ko);return h<0?null:this.at(h/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class it{constructor(e,t,n,r,s,a,o,l,c,h,u,f,d,_,b,g){it.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c,h,u,f,d,_,b,g)}set(e,t,n,r,s,a,o,l,c,h,u,f,d,_,b,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=r,m[1]=s,m[5]=a,m[9]=o,m[13]=l,m[2]=c,m[6]=h,m[10]=u,m[14]=f,m[3]=d,m[7]=_,m[11]=b,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new it().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/lr.setFromMatrixColumn(e,0).length(),s=1/lr.setFromMatrixColumn(e,1).length(),a=1/lr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const f=a*h,d=a*u,_=o*h,b=o*u;t[0]=l*h,t[4]=-l*u,t[8]=c,t[1]=d+_*c,t[5]=f-b*c,t[9]=-o*l,t[2]=b-f*c,t[6]=_+d*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*h,d=l*u,_=c*h,b=c*u;t[0]=f+b*o,t[4]=_*o-d,t[8]=a*c,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=d*o-_,t[6]=b+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*h,d=l*u,_=c*h,b=c*u;t[0]=f-b*o,t[4]=-a*u,t[8]=_+d*o,t[1]=d+_*o,t[5]=a*h,t[9]=b-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*h,d=a*u,_=o*h,b=o*u;t[0]=l*h,t[4]=_*c-d,t[8]=f*c+b,t[1]=l*u,t[5]=b*c+f,t[9]=d*c-_,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,d=a*c,_=o*l,b=o*c;t[0]=l*h,t[4]=b-f*u,t[8]=_*u+d,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=d*u+_,t[10]=f-b*u}else if(e.order==="XZY"){const f=a*l,d=a*c,_=o*l,b=o*c;t[0]=l*h,t[4]=-u,t[8]=c*h,t[1]=f*u+b,t[5]=a*h,t[9]=d*u-_,t[2]=_*u-d,t[6]=o*h,t[10]=b*u+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(pm,e,mm)}lookAt(e,t,n){const r=this.elements;return hn.subVectors(e,t),hn.lengthSq()===0&&(hn.z=1),hn.normalize(),pi.crossVectors(n,hn),pi.lengthSq()===0&&(Math.abs(n.z)===1?hn.x+=1e-4:hn.z+=1e-4,hn.normalize(),pi.crossVectors(n,hn)),pi.normalize(),Bs.crossVectors(hn,pi),r[0]=pi.x,r[4]=Bs.x,r[8]=hn.x,r[1]=pi.y,r[5]=Bs.y,r[9]=hn.y,r[2]=pi.z,r[6]=Bs.z,r[10]=hn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],u=n[5],f=n[9],d=n[13],_=n[2],b=n[6],g=n[10],m=n[14],S=n[3],y=n[7],M=n[11],T=n[15],R=r[0],k=r[4],B=r[8],C=r[12],D=r[1],V=r[5],K=r[9],J=r[13],se=r[2],he=r[6],Q=r[10],de=r[14],ne=r[3],ue=r[7],Te=r[11],ke=r[15];return s[0]=a*R+o*D+l*se+c*ne,s[4]=a*k+o*V+l*he+c*ue,s[8]=a*B+o*K+l*Q+c*Te,s[12]=a*C+o*J+l*de+c*ke,s[1]=h*R+u*D+f*se+d*ne,s[5]=h*k+u*V+f*he+d*ue,s[9]=h*B+u*K+f*Q+d*Te,s[13]=h*C+u*J+f*de+d*ke,s[2]=_*R+b*D+g*se+m*ne,s[6]=_*k+b*V+g*he+m*ue,s[10]=_*B+b*K+g*Q+m*Te,s[14]=_*C+b*J+g*de+m*ke,s[3]=S*R+y*D+M*se+T*ne,s[7]=S*k+y*V+M*he+T*ue,s[11]=S*B+y*K+M*Q+T*Te,s[15]=S*C+y*J+M*de+T*ke,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],u=e[6],f=e[10],d=e[14],_=e[3],b=e[7],g=e[11],m=e[15];return _*(+s*l*u-r*c*u-s*o*f+n*c*f+r*o*d-n*l*d)+b*(+t*l*d-t*c*f+s*a*f-r*a*d+r*c*h-s*l*h)+g*(+t*c*u-t*o*d-s*a*u+n*a*d+s*o*h-n*c*h)+m*(-r*o*h-t*l*u+t*o*f+r*a*u-n*a*f+n*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=e[9],f=e[10],d=e[11],_=e[12],b=e[13],g=e[14],m=e[15],S=u*g*c-b*f*c+b*l*d-o*g*d-u*l*m+o*f*m,y=_*f*c-h*g*c-_*l*d+a*g*d+h*l*m-a*f*m,M=h*b*c-_*u*c+_*o*d-a*b*d-h*o*m+a*u*m,T=_*u*l-h*b*l-_*o*f+a*b*f+h*o*g-a*u*g,R=t*S+n*y+r*M+s*T;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const k=1/R;return e[0]=S*k,e[1]=(b*f*s-u*g*s-b*r*d+n*g*d+u*r*m-n*f*m)*k,e[2]=(o*g*s-b*l*s+b*r*c-n*g*c-o*r*m+n*l*m)*k,e[3]=(u*l*s-o*f*s-u*r*c+n*f*c+o*r*d-n*l*d)*k,e[4]=y*k,e[5]=(h*g*s-_*f*s+_*r*d-t*g*d-h*r*m+t*f*m)*k,e[6]=(_*l*s-a*g*s-_*r*c+t*g*c+a*r*m-t*l*m)*k,e[7]=(a*f*s-h*l*s+h*r*c-t*f*c-a*r*d+t*l*d)*k,e[8]=M*k,e[9]=(_*u*s-h*b*s-_*n*d+t*b*d+h*n*m-t*u*m)*k,e[10]=(a*b*s-_*o*s+_*n*c-t*b*c-a*n*m+t*o*m)*k,e[11]=(h*o*s-a*u*s-h*n*c+t*u*c+a*n*d-t*o*d)*k,e[12]=T*k,e[13]=(h*b*r-_*u*r+_*n*f-t*b*f-h*n*g+t*u*g)*k,e[14]=(_*o*r-a*b*r-_*n*l+t*b*l+a*n*g-t*o*g)*k,e[15]=(a*u*r-h*o*r+h*n*l-t*u*l-a*n*f+t*o*f)*k,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+n,h*l-r*a,0,c*l-r*o,h*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,h=a+a,u=o+o,f=s*c,d=s*h,_=s*u,b=a*h,g=a*u,m=o*u,S=l*c,y=l*h,M=l*u,T=n.x,R=n.y,k=n.z;return r[0]=(1-(b+m))*T,r[1]=(d+M)*T,r[2]=(_-y)*T,r[3]=0,r[4]=(d-M)*R,r[5]=(1-(f+m))*R,r[6]=(g+S)*R,r[7]=0,r[8]=(_+y)*k,r[9]=(g-S)*k,r[10]=(1-(f+b))*k,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=lr.set(r[0],r[1],r[2]).length();const a=lr.set(r[4],r[5],r[6]).length(),o=lr.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],En.copy(this);const c=1/s,h=1/a,u=1/o;return En.elements[0]*=c,En.elements[1]*=c,En.elements[2]*=c,En.elements[4]*=h,En.elements[5]*=h,En.elements[6]*=h,En.elements[8]*=u,En.elements[9]*=u,En.elements[10]*=u,t.setFromRotationMatrix(En),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=Ln,l=!1){const c=this.elements,h=2*s/(t-e),u=2*s/(n-r),f=(t+e)/(t-e),d=(n+r)/(n-r);let _,b;if(l)_=s/(a-s),b=a*s/(a-s);else if(o===Ln)_=-(a+s)/(a-s),b=-2*a*s/(a-s);else if(o===Is)_=-a/(a-s),b=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=f,c[12]=0,c[1]=0,c[5]=u,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=_,c[14]=b,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=Ln,l=!1){const c=this.elements,h=2/(t-e),u=2/(n-r),f=-(t+e)/(t-e),d=-(n+r)/(n-r);let _,b;if(l)_=1/(a-s),b=a/(a-s);else if(o===Ln)_=-2/(a-s),b=-(a+s)/(a-s);else if(o===Is)_=-1/(a-s),b=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=0,c[12]=f,c[1]=0,c[5]=u,c[9]=0,c[13]=d,c[2]=0,c[6]=0,c[10]=_,c[14]=b,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const lr=new $,En=new it,pm=new $(0,0,0),mm=new $(1,1,1),pi=new $,Bs=new $,hn=new $,Cu=new it,Pu=new In;class On{constructor(e=0,t=0,n=0,r=On.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],u=r[2],f=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(at(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-at(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(at(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-at(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(at(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-at(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Cu.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Cu,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Pu.setFromEuler(this),this.setFromQuaternion(Pu,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}On.DEFAULT_ORDER="XYZ";class Zo{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let gm=0;const Du=new $,cr=new In,Zn=new it,zs=new $,ts=new $,_m=new $,vm=new In,Lu=new $(1,0,0),Iu=new $(0,1,0),Uu=new $(0,0,1),Nu={type:"added"},ym={type:"removed"},ur={type:"childadded",child:null},Jo={type:"childremoved",child:null};class Ct extends Ri{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:gm++}),this.uuid=bn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ct.DEFAULT_UP.clone();const e=new $,t=new On,n=new In,r=new $(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new it},normalMatrix:{value:new nt}}),this.matrix=new it,this.matrixWorld=new it,this.matrixAutoUpdate=Ct.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ct.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Zo,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return cr.setFromAxisAngle(e,t),this.quaternion.multiply(cr),this}rotateOnWorldAxis(e,t){return cr.setFromAxisAngle(e,t),this.quaternion.premultiply(cr),this}rotateX(e){return this.rotateOnAxis(Lu,e)}rotateY(e){return this.rotateOnAxis(Iu,e)}rotateZ(e){return this.rotateOnAxis(Uu,e)}translateOnAxis(e,t){return Du.copy(e).applyQuaternion(this.quaternion),this.position.add(Du.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Lu,e)}translateY(e){return this.translateOnAxis(Iu,e)}translateZ(e){return this.translateOnAxis(Uu,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Zn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?zs.copy(e):zs.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),ts.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Zn.lookAt(ts,zs,this.up):Zn.lookAt(zs,ts,this.up),this.quaternion.setFromRotationMatrix(Zn),r&&(Zn.extractRotation(r.matrixWorld),cr.setFromRotationMatrix(Zn),this.quaternion.premultiply(cr.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Nu),ur.child=e,this.dispatchEvent(ur),ur.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(ym),Jo.child=e,this.dispatchEvent(Jo),Jo.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Zn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Zn.multiply(e.parent.matrixWorld)),e.applyMatrix4(Zn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Nu),ur.child=e,this.dispatchEvent(ur),ur.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ts,e,_m),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ts,vm,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const u=l[c];s(e.shapes,u)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),h=a(e.images),u=a(e.shapes),f=a(e.skeletons),d=a(e.animations),_=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d),_.length>0&&(n.nodes=_)}return n.object=r,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}Ct.DEFAULT_UP=new $(0,1,0),Ct.DEFAULT_MATRIX_AUTO_UPDATE=!0,Ct.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Tn=new $,Jn=new $,Qo=new $,Qn=new $,hr=new $,fr=new $,Ou=new $,el=new $,tl=new $,nl=new $,il=new dt,rl=new dt,sl=new dt;class wn{constructor(e=new $,t=new $,n=new $){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Tn.subVectors(e,t),r.cross(Tn);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Tn.subVectors(r,t),Jn.subVectors(n,t),Qo.subVectors(e,t);const a=Tn.dot(Tn),o=Tn.dot(Jn),l=Tn.dot(Qo),c=Jn.dot(Jn),h=Jn.dot(Qo),u=a*c-o*o;if(u===0)return s.set(0,0,0),null;const f=1/u,d=(c*l-o*h)*f,_=(a*h-o*l)*f;return s.set(1-d-_,_,d)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Qn)===null?!1:Qn.x>=0&&Qn.y>=0&&Qn.x+Qn.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,Qn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Qn.x),l.addScaledVector(a,Qn.y),l.addScaledVector(o,Qn.z),l)}static getInterpolatedAttribute(e,t,n,r,s,a){return il.setScalar(0),rl.setScalar(0),sl.setScalar(0),il.fromBufferAttribute(e,t),rl.fromBufferAttribute(e,n),sl.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(il,s.x),a.addScaledVector(rl,s.y),a.addScaledVector(sl,s.z),a}static isFrontFacing(e,t,n,r){return Tn.subVectors(n,t),Jn.subVectors(e,t),Tn.cross(Jn).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Tn.subVectors(this.c,this.b),Jn.subVectors(this.a,this.b),Tn.cross(Jn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return wn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return wn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return wn.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return wn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return wn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;hr.subVectors(r,n),fr.subVectors(s,n),el.subVectors(e,n);const l=hr.dot(el),c=fr.dot(el);if(l<=0&&c<=0)return t.copy(n);tl.subVectors(e,r);const h=hr.dot(tl),u=fr.dot(tl);if(h>=0&&u<=h)return t.copy(r);const f=l*u-h*c;if(f<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(n).addScaledVector(hr,a);nl.subVectors(e,s);const d=hr.dot(nl),_=fr.dot(nl);if(_>=0&&d<=_)return t.copy(s);const b=d*c-l*_;if(b<=0&&c>=0&&_<=0)return o=c/(c-_),t.copy(n).addScaledVector(fr,o);const g=h*_-d*u;if(g<=0&&u-h>=0&&d-_>=0)return Ou.subVectors(s,r),o=(u-h)/(u-h+(d-_)),t.copy(r).addScaledVector(Ou,o);const m=1/(g+b+f);return a=b*m,o=f*m,t.copy(n).addScaledVector(hr,a).addScaledVector(fr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Fu={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},mi={h:0,s:0,l:0},Hs={h:0,s:0,l:0};function al(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class et{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ht){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ht.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=ht.workingColorSpace){return this.r=e,this.g=t,this.b=n,ht.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=ht.workingColorSpace){if(e=zo(e,1),t=at(t,0,1),n=at(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=al(a,s,e+1/3),this.g=al(a,s,e),this.b=al(a,s,e-1/3)}return ht.colorSpaceToWorking(this,r),this}setStyle(e,t=Ht){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ht){const n=Fu[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=qn(e.r),this.g=qn(e.g),this.b=qn(e.b),this}copyLinearToSRGB(e){return this.r=nr(e.r),this.g=nr(e.g),this.b=nr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ht){return ht.workingToColorSpace(jt.copy(this),e),Math.round(at(jt.r*255,0,255))*65536+Math.round(at(jt.g*255,0,255))*256+Math.round(at(jt.b*255,0,255))}getHexString(e=Ht){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ht.workingColorSpace){ht.workingToColorSpace(jt.copy(this),t);const n=jt.r,r=jt.g,s=jt.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=h<=.5?u/(a+o):u/(2-a-o),a){case n:l=(r-s)/u+(r<s?6:0);break;case r:l=(s-n)/u+2;break;case s:l=(n-r)/u+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=ht.workingColorSpace){return ht.workingToColorSpace(jt.copy(this),t),e.r=jt.r,e.g=jt.g,e.b=jt.b,e}getStyle(e=Ht){ht.workingToColorSpace(jt.copy(this),e);const t=jt.r,n=jt.g,r=jt.b;return e!==Ht?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(mi),this.setHSL(mi.h+e,mi.s+t,mi.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(mi),e.getHSL(Hs);const n=Kr(mi.h,Hs.h,t),r=Kr(mi.s,Hs.s,t),s=Kr(mi.l,Hs.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const jt=new et;et.NAMES=Fu;let xm=0;class Fn extends Ri{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:xm++}),this.uuid=bn(),this.name="",this.type="Material",this.blending=ji,this.side=Xn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ga,this.blendDst=Wa,this.blendEquation=Ai,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new et(0,0,0),this.blendAlpha=0,this.depthFunc=Yi,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=yu,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=er,this.stencilZFail=er,this.stencilZPass=er,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ji&&(n.blending=this.blending),this.side!==Xn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Ga&&(n.blendSrc=this.blendSrc),this.blendDst!==Wa&&(n.blendDst=this.blendDst),this.blendEquation!==Ai&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Yi&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==yu&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==er&&(n.stencilFail=this.stencilFail),this.stencilZFail!==er&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==er&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class gi extends Fn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new et(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new On,this.combine=nu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const It=new $,Vs=new Je;let bm=0;class en{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:bm++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ko,this.updateRanges=[],this.gpuType=xn,this.version=0}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.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.applyMatrix3(e),this.setXY(t,Vs.x,Vs.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)It.fromBufferAttribute(this,t),It.applyMatrix3(e),this.setXYZ(t,It.x,It.y,It.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)It.fromBufferAttribute(this,t),It.applyMatrix4(e),this.setXYZ(t,It.x,It.y,It.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)It.fromBufferAttribute(this,t),It.applyNormalMatrix(e),this.setXYZ(t,It.x,It.y,It.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)It.fromBufferAttribute(this,t),It.transformDirection(e),this.setXYZ(t,It.x,It.y,It.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Sn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=bt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Sn(t,this.array)),t}setX(e,t){return this.normalized&&(t=bt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Sn(t,this.array)),t}setY(e,t){return this.normalized&&(t=bt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Sn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=bt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Sn(t,this.array)),t}setW(e,t){return this.normalized&&(t=bt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=bt(t,this.array),n=bt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=bt(t,this.array),n=bt(n,this.array),r=bt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=bt(t,this.array),n=bt(n,this.array),r=bt(r,this.array),s=bt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==ko&&(e.usage=this.usage),e}}class ku extends en{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Bu extends en{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class mn extends en{constructor(e,t,n){super(new Float32Array(e),t,n)}}let Sm=0;const gn=new it,ol=new Ct,dr=new $,fn=new Un,ns=new Un,Vt=new $;class An extends Ri{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Sm++}),this.uuid=bn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Eu(e)?Bu:ku)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new nt().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return gn.makeRotationFromQuaternion(e),this.applyMatrix4(gn),this}rotateX(e){return gn.makeRotationX(e),this.applyMatrix4(gn),this}rotateY(e){return gn.makeRotationY(e),this.applyMatrix4(gn),this}rotateZ(e){return gn.makeRotationZ(e),this.applyMatrix4(gn),this}translate(e,t,n){return gn.makeTranslation(e,t,n),this.applyMatrix4(gn),this}scale(e,t,n){return gn.makeScale(e,t,n),this.applyMatrix4(gn),this}lookAt(e){return ol.lookAt(e),ol.updateMatrix(),this.applyMatrix4(ol.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(dr).negate(),this.translate(dr.x,dr.y,dr.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new mn(n,3))}else{const n=Math.min(e.length,t.count);for(let r=0;r<n;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Un);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new $(-1/0,-1/0,-1/0),new $(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];fn.setFromBufferAttribute(s),this.morphTargetsRelative?(Vt.addVectors(this.boundingBox.min,fn.min),this.boundingBox.expandByPoint(Vt),Vt.addVectors(this.boundingBox.max,fn.max),this.boundingBox.expandByPoint(Vt)):(this.boundingBox.expandByPoint(fn.min),this.boundingBox.expandByPoint(fn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Nn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new $,1/0);return}if(e){const n=this.boundingSphere.center;if(fn.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];ns.setFromBufferAttribute(o),this.morphTargetsRelative?(Vt.addVectors(fn.min,ns.min),fn.expandByPoint(Vt),Vt.addVectors(fn.max,ns.max),fn.expandByPoint(Vt)):(fn.expandByPoint(ns.min),fn.expandByPoint(ns.max))}fn.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)Vt.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Vt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)Vt.fromBufferAttribute(o,c),l&&(dr.fromBufferAttribute(e,c),Vt.add(dr)),r=Math.max(r,n.distanceToSquared(Vt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new en(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let B=0;B<n.count;B++)o[B]=new $,l[B]=new $;const c=new $,h=new $,u=new $,f=new Je,d=new Je,_=new Je,b=new $,g=new $;function m(B,C,D){c.fromBufferAttribute(n,B),h.fromBufferAttribute(n,C),u.fromBufferAttribute(n,D),f.fromBufferAttribute(s,B),d.fromBufferAttribute(s,C),_.fromBufferAttribute(s,D),h.sub(c),u.sub(c),d.sub(f),_.sub(f);const V=1/(d.x*_.y-_.x*d.y);isFinite(V)&&(b.copy(h).multiplyScalar(_.y).addScaledVector(u,-d.y).multiplyScalar(V),g.copy(u).multiplyScalar(d.x).addScaledVector(h,-_.x).multiplyScalar(V),o[B].add(b),o[C].add(b),o[D].add(b),l[B].add(g),l[C].add(g),l[D].add(g))}let S=this.groups;S.length===0&&(S=[{start:0,count:e.count}]);for(let B=0,C=S.length;B<C;++B){const D=S[B],V=D.start,K=D.count;for(let J=V,se=V+K;J<se;J+=3)m(e.getX(J+0),e.getX(J+1),e.getX(J+2))}const y=new $,M=new $,T=new $,R=new $;function k(B){T.fromBufferAttribute(r,B),R.copy(T);const C=o[B];y.copy(C),y.sub(T.multiplyScalar(T.dot(C))).normalize(),M.crossVectors(R,C);const V=M.dot(l[B])<0?-1:1;a.setXYZW(B,y.x,y.y,y.z,V)}for(let B=0,C=S.length;B<C;++B){const D=S[B],V=D.start,K=D.count;for(let J=V,se=V+K;J<se;J+=3)k(e.getX(J+0)),k(e.getX(J+1)),k(e.getX(J+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new en(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,d=n.count;f<d;f++)n.setXYZ(f,0,0,0);const r=new $,s=new $,a=new $,o=new $,l=new $,c=new $,h=new $,u=new $;if(e)for(let f=0,d=e.count;f<d;f+=3){const _=e.getX(f+0),b=e.getX(f+1),g=e.getX(f+2);r.fromBufferAttribute(t,_),s.fromBufferAttribute(t,b),a.fromBufferAttribute(t,g),h.subVectors(a,s),u.subVectors(r,s),h.cross(u),o.fromBufferAttribute(n,_),l.fromBufferAttribute(n,b),c.fromBufferAttribute(n,g),o.add(h),l.add(h),c.add(h),n.setXYZ(_,o.x,o.y,o.z),n.setXYZ(b,l.x,l.y,l.z),n.setXYZ(g,c.x,c.y,c.z)}else for(let f=0,d=t.count;f<d;f+=3)r.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),a.fromBufferAttribute(t,f+2),h.subVectors(a,s),u.subVectors(r,s),h.cross(u),n.setXYZ(f+0,h.x,h.y,h.z),n.setXYZ(f+1,h.x,h.y,h.z),n.setXYZ(f+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Vt.fromBufferAttribute(e,t),Vt.normalize(),e.setXYZ(t,Vt.x,Vt.y,Vt.z)}toNonIndexed(){function e(o,l){const c=o.array,h=o.itemSize,u=o.normalized,f=new c.constructor(l.length*h);let d=0,_=0;for(let b=0,g=l.length;b<g;b++){o.isInterleavedBufferAttribute?d=l[b]*o.data.stride+o.offset:d=l[b]*h;for(let m=0;m<h;m++)f[_++]=c[d++]}return new en(f,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new An,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let h=0,u=c.length;h<u;h++){const f=c[h],d=e(f,n);l.push(d)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,f=c.length;u<f;u++){const d=c[u];h.push(d.toJSON(e.data))}h.length>0&&(r[l]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const r=e.attributes;for(const c in r){const h=r[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],u=s[c];for(let f=0,d=u.length;f<d;f++)h.push(u[f].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,h=a.length;c<h;c++){const u=a[c];this.addGroup(u.start,u.count,u.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const zu=new it,Di=new or,Gs=new Nn,Hu=new $,Ws=new $,Xs=new $,$s=new $,ll=new $,qs=new $,Vu=new $,js=new $;class Yt extends Ct{constructor(e=new An,t=new gi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){qs.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=o[l],u=s[l];h!==0&&(ll.fromBufferAttribute(u,e),a?qs.addScaledVector(ll,h):qs.addScaledVector(ll.sub(t),h))}t.add(qs)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Gs.copy(n.boundingSphere),Gs.applyMatrix4(s),Di.copy(e.ray).recast(e.near),!(Gs.containsPoint(Di.origin)===!1&&(Di.intersectSphere(Gs,Hu)===null||Di.origin.distanceToSquared(Hu)>(e.far-e.near)**2))&&(zu.copy(s).invert(),Di.copy(e.ray).applyMatrix4(zu),!(n.boundingBox!==null&&Di.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Di)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,f=s.groups,d=s.drawRange;if(o!==null)if(Array.isArray(a))for(let _=0,b=f.length;_<b;_++){const g=f[_],m=a[g.materialIndex],S=Math.max(g.start,d.start),y=Math.min(o.count,Math.min(g.start+g.count,d.start+d.count));for(let M=S,T=y;M<T;M+=3){const R=o.getX(M),k=o.getX(M+1),B=o.getX(M+2);r=Ys(this,m,e,n,c,h,u,R,k,B),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const _=Math.max(0,d.start),b=Math.min(o.count,d.start+d.count);for(let g=_,m=b;g<m;g+=3){const S=o.getX(g),y=o.getX(g+1),M=o.getX(g+2);r=Ys(this,a,e,n,c,h,u,S,y,M),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let _=0,b=f.length;_<b;_++){const g=f[_],m=a[g.materialIndex],S=Math.max(g.start,d.start),y=Math.min(l.count,Math.min(g.start+g.count,d.start+d.count));for(let M=S,T=y;M<T;M+=3){const R=M,k=M+1,B=M+2;r=Ys(this,m,e,n,c,h,u,R,k,B),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const _=Math.max(0,d.start),b=Math.min(l.count,d.start+d.count);for(let g=_,m=b;g<m;g+=3){const S=g,y=g+1,M=g+2;r=Ys(this,a,e,n,c,h,u,S,y,M),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}}}function Mm(i,e,t,n,r,s,a,o){let l;if(e.side===on?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===Xn,o),l===null)return null;js.copy(o),js.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(js);return c<t.near||c>t.far?null:{distance:c,point:js.clone(),object:i}}function Ys(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,Ws),i.getVertexPosition(l,Xs),i.getVertexPosition(c,$s);const h=Mm(i,e,t,n,Ws,Xs,$s,Vu);if(h){const u=new $;wn.getBarycoord(Vu,Ws,Xs,$s,u),r&&(h.uv=wn.getInterpolatedAttribute(r,o,l,c,u,new Je)),s&&(h.uv1=wn.getInterpolatedAttribute(s,o,l,c,u,new Je)),a&&(h.normal=wn.getInterpolatedAttribute(a,o,l,c,u,new $),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const f={a:o,b:l,c,normal:new $,materialIndex:0};wn.getNormal(Ws,Xs,$s,f.normal),h.face=f,h.barycoord=u}return h}class pr extends An{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],u=[];let f=0,d=0;_("z","y","x",-1,-1,n,t,e,a,s,0),_("z","y","x",1,-1,n,t,-e,a,s,1),_("x","z","y",1,1,e,n,t,r,a,2),_("x","z","y",1,-1,e,n,-t,r,a,3),_("x","y","z",1,-1,e,t,n,r,s,4),_("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new mn(c,3)),this.setAttribute("normal",new mn(h,3)),this.setAttribute("uv",new mn(u,2));function _(b,g,m,S,y,M,T,R,k,B,C){const D=M/k,V=T/B,K=M/2,J=T/2,se=R/2,he=k+1,Q=B+1;let de=0,ne=0;const ue=new $;for(let Te=0;Te<Q;Te++){const ke=Te*V-J;for(let O=0;O<he;O++){const H=O*D-K;ue[b]=H*S,ue[g]=ke*y,ue[m]=se,c.push(ue.x,ue.y,ue.z),ue[b]=0,ue[g]=0,ue[m]=R>0?1:-1,h.push(ue.x,ue.y,ue.z),u.push(O/k),u.push(1-Te/B),de+=1}}for(let Te=0;Te<B;Te++)for(let ke=0;ke<k;ke++){const O=f+ke+he*Te,H=f+ke+he*(Te+1),we=f+(ke+1)+he*(Te+1),Be=f+(ke+1)+he*Te;l.push(O,H,Be),l.push(H,we,Be),ne+=6}o.addGroup(d,ne,C),d+=ne,f+=de}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new pr(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function mr(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function tn(i){const e={};for(let t=0;t<i.length;t++){const n=mr(i[t]);for(const r in n)e[r]=n[r]}return e}function Em(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Gu(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ht.workingColorSpace}const Tm={clone:mr,merge:tn};var wm=`void main() {
|
|
39
36
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
40
|
-
}`,
|
|
37
|
+
}`,Am=`void main() {
|
|
41
38
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
42
|
-
}`;class
|
|
39
|
+
}`;class ei extends Fn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=wm,this.fragmentShader=Am,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=mr(e.uniforms),this.uniformsGroups=Em(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Wu extends Ct{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new it,this.projectionMatrix=new it,this.projectionMatrixInverse=new it,this.coordinateSystem=Ln,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const _i=new $,Xu=new Je,$u=new Je;class nn extends Wu{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=tr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Yr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return tr*2*Math.atan(Math.tan(Yr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){_i.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(_i.x,_i.y).multiplyScalar(-e/_i.z),_i.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(_i.x,_i.y).multiplyScalar(-e/_i.z)}getViewSize(e,t){return this.getViewBounds(e,Xu,$u),t.subVectors($u,Xu)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Yr*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*n/c,r*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const gr=-90,_r=1;class Rm extends Ct{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new nn(gr,_r,e,t);r.layers=this.layers,this.add(r);const s=new nn(gr,_r,e,t);s.layers=this.layers,this.add(s);const a=new nn(gr,_r,e,t);a.layers=this.layers,this.add(a);const o=new nn(gr,_r,e,t);o.layers=this.layers,this.add(o);const l=new nn(gr,_r,e,t);l.layers=this.layers,this.add(l);const c=new nn(gr,_r,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===Ln)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Is)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,h]=this.children,u=e.getRenderTarget(),f=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const b=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,l),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=b,e.setRenderTarget(n,5,r),e.render(t,h),e.setRenderTarget(u,f,d),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class qu extends Dt{constructor(e=[],t=Ki,n,r,s,a,o,l,c,h){super(e,t,n,r,s,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Cm extends jn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new qu(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
43
40
|
|
|
44
41
|
varying vec3 vWorldDirection;
|
|
45
42
|
|
|
@@ -74,13 +71,13 @@
|
|
|
74
71
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
75
72
|
|
|
76
73
|
}
|
|
77
|
-
`},r=new pr(5,5,5),s=new fi({name:"CubemapFromEquirect",uniforms:mr(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:sn,blending:ii});s.uniforms.tEquirect.value=t;const a=new Jt(r,s),o=t.minFilter;return t.minFilter===Wn&&(t.minFilter=ln),new Km(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}class Zn extends At{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Jm={type:"move"};class vl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Zn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Zn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new $,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new $),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Zn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new $,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new $),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const b of e.hand.values()){const g=t.getJointPose(b,n),m=this._getHandJoint(c,b);g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=g.radius),m.visible=g!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],f=h.position.distanceTo(u.position),d=.02,_=.005;c.inputState.pinching&&f>d+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-_&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Jm)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Zn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Qm extends At{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 Un,this.environmentIntensity=1,this.environmentRotation=new Un,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 eg{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=qo,this.updateRanges=[],this.version=0,this.uuid=vn()}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 r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];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=vn()),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=vn()),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 tn=new $;class yl{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}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++)tn.fromBufferAttribute(this,t),tn.applyMatrix4(e),this.setXYZ(t,tn.x,tn.y,tn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)tn.fromBufferAttribute(this,t),tn.applyNormalMatrix(e),this.setXYZ(t,tn.x,tn.y,tn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)tn.fromBufferAttribute(this,t),tn.transformDirection(e),this.setXYZ(t,tn.x,tn.y,tn.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=vt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=vt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=vt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=vt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=vt(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=vt(t,this.array),n=vt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),r=vt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),r=vt(r,this.array),s=vt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,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 r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Zt(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 yl(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 r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}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}}}const eh=new $,th=new pt,nh=new pt,tg=new $,ih=new et,Qs=new $,xl=new In,rh=new et,bl=new or;class ng extends Jt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=cu,this.bindMatrix=new et,this.bindMatrixInverse=new et,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Ln),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Qs),this.boundingBox.expandByPoint(Qs)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new In),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Qs),this.boundingSphere.expandByPoint(Qs)}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,r=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),xl.copy(this.boundingSphere),xl.applyMatrix4(r),e.ray.intersectsSphere(xl)!==!1&&(rh.copy(r).invert(),bl.copy(e.ray).applyMatrix4(rh),!(this.boundingBox!==null&&bl.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,bl)))}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 pt,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===cu?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Jp?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,r=this.geometry;th.fromBufferAttribute(r.attributes.skinIndex,e),nh.fromBufferAttribute(r.attributes.skinWeight,e),eh.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=nh.getComponent(s);if(a!==0){const o=th.getComponent(s);ih.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(tg.copy(eh).applyMatrix4(ih),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class sh extends At{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ah extends zt{constructor(e=null,t=1,n=1,r,s,a,o,l,c=Yt,h=Yt,u,f){super(null,a,o,l,c,h,r,s,u,f),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const oh=new et,ig=new et;class Sl{constructor(e=[],t=[]){this.uuid=vn(),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,r=this.bones.length;n<r;n++)this.boneInverses.push(new et)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new et;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,r=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:ig;oh.multiplyMatrices(o,t[s]),oh.toArray(n,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new Sl(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 ah(t,e,e,fn,_n);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 r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){const s=e.bones[n];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new sh),this.bones.push(a),this.boneInverses.push(new et().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const a=t[r];e.bones.push(a.uuid);const o=n[r];e.boneInverses.push(o.toArray())}return e}}class Ml extends Zt{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}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 vr=new et,lh=new et,ea=[],ch=new Ln,rg=new et,is=new Jt,rs=new In;class sg extends Jt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Ml(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<n;r++)this.setMatrixAt(r,rg)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Ln),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,vr),ch.copy(e.boundingBox).applyMatrix4(vr),this.boundingBox.union(ch)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new In),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,vr),rs.copy(e.boundingSphere).applyMatrix4(vr),this.boundingSphere.union(rs)}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,r=this.morphTexture.source.data.data,s=n.length+1,a=e*s+1;for(let o=0;o<n.length;o++)n[o]=r[a+o]}raycast(e,t){const n=this.matrixWorld,r=this.count;if(is.geometry=this.geometry,is.material=this.material,is.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),rs.copy(this.boundingSphere),rs.applyMatrix4(n),e.ray.intersectsSphere(rs)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,vr),lh.multiplyMatrices(n,vr),is.matrixWorld=lh,is.raycast(e,ea);for(let a=0,o=ea.length;a<o;a++){const l=ea[a];l.instanceId=s,l.object=this,t.push(l)}ea.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Ml(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,r=n.length+1;this.morphTexture===null&&(this.morphTexture=new ah(new Float32Array(r*this.count),r,this.count,po,_n));const s=this.morphTexture.source.data.data;let a=0;for(let c=0;c<n.length;c++)a+=n[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=r*e;s[l]=o,s.set(n,l+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const El=new $,ag=new $,og=new Qe;class pi{constructor(e=new $(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=El.subVectors(n,t).cross(ag.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(El),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||og.getNormalMatrix(e),r=this.coplanarPoint(El).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Pi=new In,lg=new Ye(.5,.5),ta=new $;class Tl{constructor(e=new pi,t=new pi,n=new pi,r=new pi,s=new pi,a=new pi){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Pn,n=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],h=s[4],u=s[5],f=s[6],d=s[7],_=s[8],b=s[9],g=s[10],m=s[11],S=s[12],y=s[13],M=s[14],T=s[15];if(r[0].setComponents(c-a,d-h,m-_,T-S).normalize(),r[1].setComponents(c+a,d+h,m+_,T+S).normalize(),r[2].setComponents(c+o,d+u,m+b,T+y).normalize(),r[3].setComponents(c-o,d-u,m-b,T-y).normalize(),n)r[4].setComponents(l,f,g,M).normalize(),r[5].setComponents(c-l,d-f,m-g,T-M).normalize();else if(r[4].setComponents(c-l,d-f,m-g,T-M).normalize(),t===Pn)r[5].setComponents(c+l,d+f,m+g,T+M).normalize();else if(t===Os)r[5].setComponents(l,f,g,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Pi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Pi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Pi)}intersectsSprite(e){Pi.center.set(0,0,0);const t=lg.distanceTo(e.center);return Pi.radius=.7071067811865476+t,Pi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Pi)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(ta.x=r.normal.x>0?e.max.x:e.min.x,ta.y=r.normal.y>0?e.max.y:e.min.y,ta.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(ta)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class uh extends Nn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ze(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 na=new $,ia=new $,hh=new et,ss=new or,ra=new In,wl=new $,fh=new $;class Al extends At{constructor(e=new En,t=new uh){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)na.fromBufferAttribute(t,r-1),ia.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=na.distanceTo(ia);e.setAttribute("lineDistance",new dn(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ra.copy(n.boundingSphere),ra.applyMatrix4(r),ra.radius+=s,e.ray.intersectsSphere(ra)===!1)return;hh.copy(r).invert(),ss.copy(e.ray).applyMatrix4(hh);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,h=n.index,f=n.attributes.position;if(h!==null){const d=Math.max(0,a.start),_=Math.min(h.count,a.start+a.count);for(let b=d,g=_-1;b<g;b+=c){const m=h.getX(b),S=h.getX(b+1),y=sa(this,e,ss,l,m,S,b);y&&t.push(y)}if(this.isLineLoop){const b=h.getX(_-1),g=h.getX(d),m=sa(this,e,ss,l,b,g,_-1);m&&t.push(m)}}else{const d=Math.max(0,a.start),_=Math.min(f.count,a.start+a.count);for(let b=d,g=_-1;b<g;b+=c){const m=sa(this,e,ss,l,b,b+1,b);m&&t.push(m)}if(this.isLineLoop){const b=sa(this,e,ss,l,_-1,d,_-1);b&&t.push(b)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function sa(i,e,t,n,r,s,a){const o=i.geometry.attributes.position;if(na.fromBufferAttribute(o,r),ia.fromBufferAttribute(o,s),t.distanceSqToSegment(na,ia,wl,fh)>n)return;wl.applyMatrix4(i.matrixWorld);const c=e.ray.origin.distanceTo(wl);if(!(c<e.near||c>e.far))return{distance:c,point:fh.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const dh=new $,ph=new $;class cg extends Al{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 r=0,s=t.count;r<s;r+=2)dh.fromBufferAttribute(t,r),ph.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+dh.distanceTo(ph);e.setAttribute("lineDistance",new dn(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class ug extends Al{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class mh extends Nn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ze(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 gh=new et,Rl=new or,aa=new In,oa=new $;class hg extends At{constructor(e=new En,t=new mh){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),aa.copy(n.boundingSphere),aa.applyMatrix4(r),aa.radius+=s,e.ray.intersectsSphere(aa)===!1)return;gh.copy(r).invert(),Rl.copy(e.ray).applyMatrix4(gh);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,u=n.attributes.position;if(c!==null){const f=Math.max(0,a.start),d=Math.min(c.count,a.start+a.count);for(let _=f,b=d;_<b;_++){const g=c.getX(_);oa.fromBufferAttribute(u,g),_h(oa,g,l,r,e,t,this)}}else{const f=Math.max(0,a.start),d=Math.min(u.count,a.start+a.count);for(let _=f,b=d;_<b;_++)oa.fromBufferAttribute(u,_),_h(oa,_,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function _h(i,e,t,n,r,s,a){const o=Rl.distanceSqToPoint(i);if(o<t){const l=new $;Rl.closestPointToPoint(i,l),l.applyMatrix4(n);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class vh extends zt{constructor(e,t,n=Mi,r,s,a,o=Yt,l=Yt,c,h=Xr,u=1){if(h!==Xr&&h!==$r)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const f={width:e,height:t,depth:u};super(f,r,s,a,o,l,h,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Jo(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class yh extends zt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Cl extends En{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const s=[],a=[],o=[],l=[],c=new $,h=new Ye;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let u=0,f=3;u<=t;u++,f+=3){const d=n+u/t*r;c.x=e*Math.cos(d),c.y=e*Math.sin(d),a.push(c.x,c.y,c.z),o.push(0,0,1),h.x=(a[f]/e+1)/2,h.y=(a[f+1]/e+1)/2,l.push(h.x,h.y)}for(let u=1;u<=t;u++)s.push(u,u+1,0);this.setIndex(s),this.setAttribute("position",new dn(a,3)),this.setAttribute("normal",new dn(o,3)),this.setAttribute("uv",new dn(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Cl(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class la extends En{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(r),c=o+1,h=l+1,u=e/o,f=t/l,d=[],_=[],b=[],g=[];for(let m=0;m<h;m++){const S=m*f-a;for(let y=0;y<c;y++){const M=y*u-s;_.push(M,-S,0),b.push(0,0,1),g.push(y/o),g.push(1-m/l)}}for(let m=0;m<l;m++)for(let S=0;S<o;S++){const y=S+c*m,M=S+c*(m+1),T=S+1+c*(m+1),R=S+1+c*m;d.push(y,M,R),d.push(M,T,R)}this.setIndex(d),this.setAttribute("position",new dn(_,3)),this.setAttribute("normal",new dn(b,3)),this.setAttribute("uv",new dn(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new la(e.width,e.height,e.widthSegments,e.heightSegments)}}class as extends Nn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ze(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 Ze(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mu,this.normalScale=new Ye(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 Un,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 On extends as{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 Ye(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return it(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 Ze(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 Ze(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ze(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 fg extends Nn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=tm,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class dg extends Nn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function ca(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function pg(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function mg(i){function e(r,s){return i[r]-i[s]}const t=i.length,n=new Array(t);for(let r=0;r!==t;++r)n[r]=r;return n.sort(e),n}function xh(i,e,t){const n=i.length,r=new i.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let l=0;l!==e;++l)r[a++]=i[o+l]}return r}function bh(i,e,t,n){let r=1,s=i[0];for(;s!==void 0&&s[n]===void 0;)s=i[r++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push(...a)),s=i[r++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=i[r++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=i[r++];while(s!==void 0)}class os{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r: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,r=t[n],s=t[n-1];n:{e:{let a;t:{i:if(!(e<r)){for(let o=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=r,r=t[++n],e<r)break e}a=t.length;break t}if(!(e>=s)){const o=t[1];e<o&&(n=2,s=o);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break e}a=n,n=0;break t}break n}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let a=0;a!==r;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class gg extends os{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:yu,endingEnd:yu}}intervalChanged_(e,t,n){const r=this.parameterPositions;let s=e-2,a=e+1,o=r[s],l=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case xu:s=e,o=2*t-n;break;case bu:s=r.length-2,o=t+r[s]-r[s+1];break;default:s=e,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case xu:a=e,l=2*n-t;break;case bu:a=1,l=n+r[1]-r[0];break;default:a=e-1,l=t}const c=(n-t)*.5,h=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-n),this._offsetPrev=s*h,this._offsetNext=a*h}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=this._offsetPrev,u=this._offsetNext,f=this._weightPrev,d=this._weightNext,_=(n-t)/(r-t),b=_*_,g=b*_,m=-f*g+2*f*b-f*_,S=(1+f)*g+(-1.5-2*f)*b+(-.5+f)*_+1,y=(-1-d)*g+(1.5+d)*b+.5*_,M=d*g-d*b;for(let T=0;T!==o;++T)s[T]=m*a[h+T]+S*a[c+T]+y*a[l+T]+M*a[u+T];return s}}class _g extends os{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=(n-t)/(r-t),u=1-h;for(let f=0;f!==o;++f)s[f]=a[c+f]*u+a[l+f]*h;return s}}class vg extends os{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class Tn{constructor(e,t,n,r){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=ca(t,this.TimeBufferType),this.values=ca(n,this.ValueBufferType),this.setInterpolation(r||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:ca(e.times,Array),values:ca(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new vg(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new _g(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new gg(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case jr:t=this.InterpolantFactoryMethodDiscrete;break;case qr:t=this.InterpolantFactoryMethodLinear;break;case $o: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 jr;case this.InterpolantFactoryMethodLinear:return qr;case this.InterpolantFactoryMethodSmooth:return $o}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){const n=this.times,r=n.length;let s=0,a=r-1;for(;s!==r&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}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,r=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(r!==void 0&&pg(r))for(let o=0,l=r.length;o!==l;++o){const c=r[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===$o,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],h=e[o+1];if(c!==h&&(o!==1||c!==e[0]))if(r)l=!0;else{const u=o*n,f=u-n,d=u+n;for(let _=0;_!==n;++_){const b=t[u+_];if(b!==t[f+_]||b!==t[d+_]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const u=o*n,f=a*n;for(let d=0;d!==n;++d)t[f+d]=t[u+d]}++a}}if(s>0){e[a]=e[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}Tn.prototype.ValueTypeName="",Tn.prototype.TimeBufferType=Float32Array,Tn.prototype.ValueBufferType=Float32Array,Tn.prototype.DefaultInterpolation=qr;class yr extends Tn{constructor(e,t,n){super(e,t,n)}}yr.prototype.ValueTypeName="bool",yr.prototype.ValueBufferType=Array,yr.prototype.DefaultInterpolation=jr,yr.prototype.InterpolantFactoryMethodLinear=void 0,yr.prototype.InterpolantFactoryMethodSmooth=void 0;class Sh extends Tn{constructor(e,t,n,r){super(e,t,n,r)}}Sh.prototype.ValueTypeName="color";class xr extends Tn{constructor(e,t,n,r){super(e,t,n,r)}}xr.prototype.ValueTypeName="number";class yg extends os{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(r-t);let c=e*o;for(let h=c+o;c!==h;c+=4)Dn.slerpFlat(s,0,a,c-o,a,c,l);return s}}class br extends Tn{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new yg(this.times,this.values,this.getValueSize(),e)}}br.prototype.ValueTypeName="quaternion",br.prototype.InterpolantFactoryMethodSmooth=void 0;class Sr extends Tn{constructor(e,t,n){super(e,t,n)}}Sr.prototype.ValueTypeName="string",Sr.prototype.ValueBufferType=Array,Sr.prototype.DefaultInterpolation=jr,Sr.prototype.InterpolantFactoryMethodLinear=void 0,Sr.prototype.InterpolantFactoryMethodSmooth=void 0;class Mr extends Tn{constructor(e,t,n,r){super(e,t,n,r)}}Mr.prototype.ValueTypeName="vector";class xg{constructor(e="",t=-1,n=[],r=Qp){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=vn(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,r=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Sg(n[a]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){const t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,a=n.length;s!==a;++s)t.push(Tn.toJSON(n[s]));return r}static CreateFromMorphTargetSequence(e,t,n,r){const s=t.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const h=mg(l);l=xh(l,1,h),c=xh(c,1,h),!r&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new xr(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const r=e;n=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const r={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],h=c.name.match(s);if(h&&h.length>1){const u=h[1];let f=r[u];f||(r[u]=f=[]),f.push(c)}}const a=[];for(const o in r)a.push(this.CreateFromMorphTargetSequence(o,r[o],t,n));return a}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(u,f,d,_,b){if(d.length!==0){const g=[],m=[];bh(d,g,m,_),g.length!==0&&b.push(new u(f,g,m))}},r=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let u=0;u<c.length;u++){const f=c[u].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const d={};let _;for(_=0;_<f.length;_++)if(f[_].morphTargets)for(let b=0;b<f[_].morphTargets.length;b++)d[f[_].morphTargets[b]]=-1;for(const b in d){const g=[],m=[];for(let S=0;S!==f[_].morphTargets.length;++S){const y=f[_];g.push(y.time),m.push(y.morphTarget===b?1:0)}r.push(new xr(".morphTargetInfluence["+b+"]",g,m))}l=d.length*a}else{const d=".bones["+t[u].name+"]";n(Mr,d+".position",f,"pos",r),n(br,d+".quaternion",f,"rot",r),n(Mr,d+".scale",f,"scl",r)}}return r.length===0?null:new this(s,l,r,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,r=e.length;n!==r;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.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 n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function bg(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return xr;case"vector":case"vector2":case"vector3":case"vector4":return Mr;case"color":return Sh;case"quaternion":return br;case"bool":case"boolean":return yr;case"string":return Sr}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function Sg(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=bg(i.type);if(i.times===void 0){const t=[],n=[];bh(i.keys,t,n,"value"),i.times=t,i.values=n}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}const Jn={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class Mg{constructor(e,t,n){const r=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.abortController=new AbortController,this.itemStart=function(h){o++,s===!1&&r.onStart!==void 0&&r.onStart(h,a,o),s=!0},this.itemEnd=function(h){a++,r.onProgress!==void 0&&r.onProgress(h,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(h){r.onError!==void 0&&r.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){const u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,f=c.length;u<f;u+=2){const d=c[u],_=c[u+1];if(d.global&&(d.lastIndex=0),d.test(h))return _}return null},this.abort=function(){return this.abortController.abort(),this.abortController=new AbortController,this}}}const Eg=new Mg;class Er{constructor(e){this.manager=e!==void 0?e:Eg,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}Er.DEFAULT_MATERIAL_NAME="__DEFAULT";const Qn={};class Tg extends Error{constructor(e,t){super(e),this.response=t}}class Mh extends Er{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Jn.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Qn[e]!==void 0){Qn[e].push({onLoad:t,onProgress:n,onError:r});return}Qn[e]=[],Qn[e].push({onLoad:t,onProgress:n,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=Qn[e],u=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),d=f?parseInt(f):0,_=d!==0;let b=0;const g=new ReadableStream({start(m){S();function S(){u.read().then(({done:y,value:M})=>{if(y)m.close();else{b+=M.byteLength;const T=new ProgressEvent("progress",{lengthComputable:_,loaded:b,total:d});for(let R=0,k=h.length;R<k;R++){const B=h[R];B.onProgress&&B.onProgress(T)}m.enqueue(M),S()}},y=>{m.error(y)})}}});return new Response(g)}else throw new Tg(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return c.json();default:if(o==="")return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(o),f=u&&u[1]?u[1].toLowerCase():void 0,d=new TextDecoder(f);return c.arrayBuffer().then(_=>d.decode(_))}}}).then(c=>{Jn.add(`file:${e}`,c);const h=Qn[e];delete Qn[e];for(let u=0,f=h.length;u<f;u++){const d=h[u];d.onLoad&&d.onLoad(c)}}).catch(c=>{const h=Qn[e];if(h===void 0)throw this.manager.itemError(e),c;delete Qn[e];for(let u=0,f=h.length;u<f;u++){const d=h[u];d.onError&&d.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const Tr=new WeakMap;class wg extends Er{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Jn.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0);else{let u=Tr.get(a);u===void 0&&(u=[],Tr.set(a,u)),u.push({onLoad:t,onError:r})}return a}const o=Zr("img");function l(){h(),t&&t(this);const u=Tr.get(this)||[];for(let f=0;f<u.length;f++){const d=u[f];d.onLoad&&d.onLoad(this)}Tr.delete(this),s.manager.itemEnd(e)}function c(u){h(),r&&r(u),Jn.remove(`image:${e}`);const f=Tr.get(this)||[];for(let d=0;d<f.length;d++){const _=f[d];_.onError&&_.onError(u)}Tr.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),Jn.add(`image:${e}`,o),s.manager.itemStart(e),o.src=e,o}}class Ag extends Er{constructor(e){super(e)}load(e,t,n,r){const s=new zt,a=new wg(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}}class ua extends At{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ze(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}}const Pl=new et,Eh=new $,Th=new $;class Dl{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ye(512,512),this.mapType=Cn,this.map=null,this.mapPass=null,this.matrix=new et,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Tl,this._frameExtents=new Ye(1,1),this._viewportCount=1,this._viewports=[new pt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Eh.setFromMatrixPosition(e.matrixWorld),t.position.copy(Eh),Th.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Th),t.updateMatrixWorld(),Pl.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Pl,t.coordinateSystem,t.reversedDepth),t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Pl)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}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 Rg extends Dl{constructor(){super(new en(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=tr*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Cg extends ua{constructor(e,t,n=0,r=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(At.DEFAULT_UP),this.updateMatrix(),this.target=new At,this.distance=n,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new Rg}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 wh=new et,ls=new $,Ll=new $;class Pg extends Dl{constructor(){super(new en(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ye(4,2),this._viewportCount=6,this._viewports=[new pt(2,1,1,1),new pt(0,1,1,1),new pt(3,1,1,1),new pt(1,1,1,1),new pt(3,0,1,1),new pt(1,0,1,1)],this._cubeDirections=[new $(1,0,0),new $(-1,0,0),new $(0,0,1),new $(0,0,-1),new $(0,1,0),new $(0,-1,0)],this._cubeUps=[new $(0,1,0),new $(0,1,0),new $(0,1,0),new $(0,1,0),new $(0,0,1),new $(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,r=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),ls.setFromMatrixPosition(e.matrixWorld),n.position.copy(ls),Ll.copy(n.position),Ll.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Ll),n.updateMatrixWorld(),r.makeTranslation(-ls.x,-ls.y,-ls.z),wh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(wh,n.coordinateSystem,n.reversedDepth)}}class Dg extends ua{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new Pg}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 ha extends Ku{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class Lg extends Dl{constructor(){super(new ha(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Il extends ua{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(At.DEFAULT_UP),this.updateMatrix(),this.target=new At,this.shadow=new Lg}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Ig extends ua{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class cs{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)}}const Ul=new WeakMap;class Ug extends Er{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"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Jn.get(`image-bitmap:${e}`);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(c=>{if(Ul.has(a)===!0)r&&r(Ul.get(a)),s.manager.itemError(e),s.manager.itemEnd(e);else return t&&t(c),s.manager.itemEnd(e),c});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const l=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Jn.add(`image-bitmap:${e}`,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),Ul.set(l,c),Jn.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});Jn.add(`image-bitmap:${e}`,l),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class Ng extends en{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const Nl="\\[\\]\\.:\\/",Og=new RegExp("["+Nl+"]","g"),Ol="[^"+Nl+"]",Fg="[^"+Nl.replace("\\.","")+"]",kg=/((?:WC+[\/:])*)/.source.replace("WC",Ol),Bg=/(WCOD+)?/.source.replace("WCOD",Fg),zg=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ol),Hg=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ol),Vg=new RegExp("^"+kg+Bg+zg+Hg+"$"),Gg=["material","materials","bones","map"];class Wg{constructor(e,t,n){const r=n||yt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].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 yt{constructor(e,t,n){this.path=t,this.parsedPath=n||yt.parseTrackName(t),this.node=yt.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 yt.Composite(e,t,n):new yt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Og,"")}static parseTrackName(e){const t=Vg.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]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=n.nodeName.substring(r+1);Gg.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}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(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===t||o.uuid===t)return o;const l=n(o.children);if(l)return l}return null},r=n(e.children);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 r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_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 r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=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,r=t.propertyName;let s=t.propertyIndex;if(e||(e=yt.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 c=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 h=0;h<e.length;h++)if(e[h].name===c){c=h;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(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[r];if(a===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="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[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}yt.Composite=Wg,yt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},yt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},yt.prototype.GetterByBindingType=[yt.prototype._getValue_direct,yt.prototype._getValue_array,yt.prototype._getValue_arrayElement,yt.prototype._getValue_toArray],yt.prototype.SetterByBindingTypeAndVersioning=[[yt.prototype._setValue_direct,yt.prototype._setValue_direct_setNeedsUpdate,yt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[yt.prototype._setValue_array,yt.prototype._setValue_array_setNeedsUpdate,yt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[yt.prototype._setValue_arrayElement,yt.prototype._setValue_arrayElement_setNeedsUpdate,yt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[yt.prototype._setValue_fromArray,yt.prototype._setValue_fromArray_setNeedsUpdate,yt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];const Ah=new et;class Xg{constructor(e,t,n=0,r=1/0){this.ray=new or(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new al,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 Ah.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Ah),this}intersectObject(e,t=!0,n=[]){return Fl(e,this,n,t),n.sort(Rh),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)Fl(e[r],this,n,t);return n.sort(Rh),n}}function Rh(i,e){return i.distance-e.distance}function Fl(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){const s=i.children;for(let a=0,o=s.length;a<o;a++)Fl(s[a],e,t,!0)}}class Ch{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=it(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(it(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class $g extends Ei{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function Ph(i,e,t,n){const r=jg(n);switch(t){case gu:return i*e;case po:return i*e/r.components*r.byteLength;case mo:return i*e/r.components*r.byteLength;case vu:return i*e*2/r.components*r.byteLength;case go:return i*e*2/r.components*r.byteLength;case _u:return i*e*3/r.components*r.byteLength;case fn:return i*e*4/r.components*r.byteLength;case _o:return i*e*4/r.components*r.byteLength;case Ds:case Ls:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Is:case Us:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case yo:case bo:return Math.max(i,16)*Math.max(e,8)/4;case vo:case xo:return Math.max(i,8)*Math.max(e,8)/2;case So:case Mo:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Eo:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case To:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case wo:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case Ao:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case Ro:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case Co:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case Po:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case Do:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case Lo:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Io:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case Uo:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case No:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case Oo:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case Fo:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case ko:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Bo:case zo:case Ho:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Vo:case Go:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Wo:case Xo:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function jg(i){switch(i){case Cn:case fu:return{byteLength:1,components:1};case Vr:case du:case Gr:return{byteLength:2,components:1};case ho:case fo:return{byteLength:2,components:4};case Mi:case uo:case _n:return{byteLength:4,components:1};case pu:case mu:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ja}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ja);/**
|
|
74
|
+
`},r=new pr(5,5,5),s=new ei({name:"CubemapFromEquirect",uniforms:mr(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:on,blending:oi});s.uniforms.tEquirect.value=t;const a=new Yt(r,s),o=t.minFilter;return t.minFilter===$n&&(t.minFilter=Nt),new Rm(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}class ti extends Ct{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Pm={type:"move"};class cl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ti,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new ti,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new $,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new $),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ti,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new $,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new $),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const b of e.hand.values()){const g=t.getJointPose(b,n),m=this._getHandJoint(c,b);g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=g.radius),m.visible=g!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],f=h.position.distanceTo(u.position),d=.02,_=.005;c.inputState.pinching&&f>d+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-_&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Pm)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new ti;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class ju extends Ct{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 On,this.environmentIntensity=1,this.environmentRotation=new On,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 Dm{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ko,this.updateRanges=[],this.version=0,this.uuid=bn()}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 r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];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=bn()),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=bn()),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 rn=new $;class ul{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}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++)rn.fromBufferAttribute(this,t),rn.applyMatrix4(e),this.setXYZ(t,rn.x,rn.y,rn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)rn.fromBufferAttribute(this,t),rn.applyNormalMatrix(e),this.setXYZ(t,rn.x,rn.y,rn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)rn.fromBufferAttribute(this,t),rn.transformDirection(e),this.setXYZ(t,rn.x,rn.y,rn.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Sn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=bt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=bt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=bt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=bt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=bt(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=Sn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Sn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Sn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Sn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=bt(t,this.array),n=bt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=bt(t,this.array),n=bt(n,this.array),r=bt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=bt(t,this.array),n=bt(n,this.array),r=bt(r,this.array),s=bt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,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 r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new en(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 ul(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 r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}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}}}const Yu=new $,Ku=new dt,Zu=new dt,Lm=new $,Ju=new it,Ks=new $,hl=new Nn,Qu=new it,fl=new or;class Im extends Yt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=ru,this.bindMatrix=new it,this.bindMatrixInverse=new it,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Un),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Ks),this.boundingBox.expandByPoint(Ks)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Nn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Ks),this.boundingSphere.expandByPoint(Ks)}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,r=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),hl.copy(this.boundingSphere),hl.applyMatrix4(r),e.ray.intersectsSphere(hl)!==!1&&(Qu.copy(r).invert(),fl.copy(e.ray).applyMatrix4(Qu),!(this.boundingBox!==null&&fl.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,fl)))}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 dt,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===ru?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Pp?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,r=this.geometry;Ku.fromBufferAttribute(r.attributes.skinIndex,e),Zu.fromBufferAttribute(r.attributes.skinWeight,e),Yu.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=Zu.getComponent(s);if(a!==0){const o=Ku.getComponent(s);Ju.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(Lm.copy(Yu).applyMatrix4(Ju),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class eh extends Ct{constructor(){super(),this.isBone=!0,this.type="Bone"}}class dl extends Dt{constructor(e=null,t=1,n=1,r,s,a,o,l,c=Wt,h=Wt,u,f){super(null,a,o,l,c,h,r,s,u,f),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const th=new it,Um=new it;class pl{constructor(e=[],t=[]){this.uuid=bn(),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,r=this.bones.length;n<r;n++)this.boneInverses.push(new it)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new it;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,r=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:Um;th.multiplyMatrices(o,t[s]),th.toArray(n,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new pl(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 dl(t,e,e,ln,xn);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 r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){const s=e.bones[n];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new eh),this.bones.push(a),this.boneInverses.push(new it().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const a=t[r];e.bones.push(a.uuid);const o=n[r];e.boneInverses.push(o.toArray())}return e}}class ml extends en{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}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 vr=new it,nh=new it,Zs=[],ih=new Un,Nm=new it,is=new Yt,rs=new Nn;class Om extends Yt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new ml(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<n;r++)this.setMatrixAt(r,Nm)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Un),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,vr),ih.copy(e.boundingBox).applyMatrix4(vr),this.boundingBox.union(ih)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Nn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,vr),rs.copy(e.boundingSphere).applyMatrix4(vr),this.boundingSphere.union(rs)}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,r=this.morphTexture.source.data.data,s=n.length+1,a=e*s+1;for(let o=0;o<n.length;o++)n[o]=r[a+o]}raycast(e,t){const n=this.matrixWorld,r=this.count;if(is.geometry=this.geometry,is.material=this.material,is.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),rs.copy(this.boundingSphere),rs.applyMatrix4(n),e.ray.intersectsSphere(rs)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,vr),nh.multiplyMatrices(n,vr),is.matrixWorld=nh,is.raycast(e,Zs);for(let a=0,o=Zs.length;a<o;a++){const l=Zs[a];l.instanceId=s,l.object=this,t.push(l)}Zs.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new ml(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,r=n.length+1;this.morphTexture===null&&(this.morphTexture=new dl(new Float32Array(r*this.count),r,this.count,io,xn));const s=this.morphTexture.source.data.data;let a=0;for(let c=0;c<n.length;c++)a+=n[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=r*e;s[l]=o,s.set(n,l+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const gl=new $,Fm=new $,km=new nt;class vi{constructor(e=new $(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=gl.subVectors(n,t).cross(Fm.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(gl),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||km.getNormalMatrix(e),r=this.coplanarPoint(gl).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Li=new Nn,Bm=new Je(.5,.5),Js=new $;class _l{constructor(e=new vi,t=new vi,n=new vi,r=new vi,s=new vi,a=new vi){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ln,n=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],h=s[4],u=s[5],f=s[6],d=s[7],_=s[8],b=s[9],g=s[10],m=s[11],S=s[12],y=s[13],M=s[14],T=s[15];if(r[0].setComponents(c-a,d-h,m-_,T-S).normalize(),r[1].setComponents(c+a,d+h,m+_,T+S).normalize(),r[2].setComponents(c+o,d+u,m+b,T+y).normalize(),r[3].setComponents(c-o,d-u,m-b,T-y).normalize(),n)r[4].setComponents(l,f,g,M).normalize(),r[5].setComponents(c-l,d-f,m-g,T-M).normalize();else if(r[4].setComponents(c-l,d-f,m-g,T-M).normalize(),t===Ln)r[5].setComponents(c+l,d+f,m+g,T+M).normalize();else if(t===Is)r[5].setComponents(l,f,g,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Li.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Li.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Li)}intersectsSprite(e){Li.center.set(0,0,0);const t=Bm.distanceTo(e.center);return Li.radius=.7071067811865476+t,Li.applyMatrix4(e.matrixWorld),this.intersectsSphere(Li)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(Js.x=r.normal.x>0?e.max.x:e.min.x,Js.y=r.normal.y>0?e.max.y:e.min.y,Js.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Js)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class rh extends Fn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new et(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 Qs=new $,ea=new $,sh=new it,ss=new or,ta=new Nn,vl=new $,ah=new $;class yl extends Ct{constructor(e=new An,t=new rh){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)Qs.fromBufferAttribute(t,r-1),ea.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Qs.distanceTo(ea);e.setAttribute("lineDistance",new mn(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ta.copy(n.boundingSphere),ta.applyMatrix4(r),ta.radius+=s,e.ray.intersectsSphere(ta)===!1)return;sh.copy(r).invert(),ss.copy(e.ray).applyMatrix4(sh);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,h=n.index,f=n.attributes.position;if(h!==null){const d=Math.max(0,a.start),_=Math.min(h.count,a.start+a.count);for(let b=d,g=_-1;b<g;b+=c){const m=h.getX(b),S=h.getX(b+1),y=na(this,e,ss,l,m,S,b);y&&t.push(y)}if(this.isLineLoop){const b=h.getX(_-1),g=h.getX(d),m=na(this,e,ss,l,b,g,_-1);m&&t.push(m)}}else{const d=Math.max(0,a.start),_=Math.min(f.count,a.start+a.count);for(let b=d,g=_-1;b<g;b+=c){const m=na(this,e,ss,l,b,b+1,b);m&&t.push(m)}if(this.isLineLoop){const b=na(this,e,ss,l,_-1,d,_-1);b&&t.push(b)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function na(i,e,t,n,r,s,a){const o=i.geometry.attributes.position;if(Qs.fromBufferAttribute(o,r),ea.fromBufferAttribute(o,s),t.distanceSqToSegment(Qs,ea,vl,ah)>n)return;vl.applyMatrix4(i.matrixWorld);const c=e.ray.origin.distanceTo(vl);if(!(c<e.near||c>e.far))return{distance:c,point:ah.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const oh=new $,lh=new $;class zm extends yl{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 r=0,s=t.count;r<s;r+=2)oh.fromBufferAttribute(t,r),lh.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+oh.distanceTo(lh);e.setAttribute("lineDistance",new mn(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Hm extends yl{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class ch extends Fn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new et(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 uh=new it,xl=new or,ia=new Nn,ra=new $;class Vm extends Ct{constructor(e=new An,t=new ch){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ia.copy(n.boundingSphere),ia.applyMatrix4(r),ia.radius+=s,e.ray.intersectsSphere(ia)===!1)return;uh.copy(r).invert(),xl.copy(e.ray).applyMatrix4(uh);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,u=n.attributes.position;if(c!==null){const f=Math.max(0,a.start),d=Math.min(c.count,a.start+a.count);for(let _=f,b=d;_<b;_++){const g=c.getX(_);ra.fromBufferAttribute(u,g),hh(ra,g,l,r,e,t,this)}}else{const f=Math.max(0,a.start),d=Math.min(u.count,a.start+a.count);for(let _=f,b=d;_<b;_++)ra.fromBufferAttribute(u,_),hh(ra,_,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function hh(i,e,t,n,r,s,a){const o=xl.distanceSqToPoint(i);if(o<t){const l=new $;xl.closestPointToPoint(i,l),l.applyMatrix4(n);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class fh extends Dt{constructor(e,t,n,r,s=Nt,a=Nt,o,l,c){super(e,t,n,r,s,a,o,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const h=this;function u(){h.needsUpdate=!0,h._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u))}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)}dispose(){this._requestVideoFrameCallbackId!==0&&this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),super.dispose()}}class Gm extends Dt{constructor(e,t,n,r,s,a,o,l,c){super(e,t,n,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class bl extends Dt{constructor(e,t,n=ui,r,s,a,o=Wt,l=Wt,c,h=Qi,u=1){if(h!==Qi&&h!==$r)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const f={width:e,height:t,depth:u};super(f,r,s,a,o,l,h,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Go(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class dh extends Dt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Sl extends An{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const s=[],a=[],o=[],l=[],c=new $,h=new Je;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let u=0,f=3;u<=t;u++,f+=3){const d=n+u/t*r;c.x=e*Math.cos(d),c.y=e*Math.sin(d),a.push(c.x,c.y,c.z),o.push(0,0,1),h.x=(a[f]/e+1)/2,h.y=(a[f+1]/e+1)/2,l.push(h.x,h.y)}for(let u=1;u<=t;u++)s.push(u,u+1,0);this.setIndex(s),this.setAttribute("position",new mn(a,3)),this.setAttribute("normal",new mn(o,3)),this.setAttribute("uv",new mn(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Sl(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class as extends An{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(r),c=o+1,h=l+1,u=e/o,f=t/l,d=[],_=[],b=[],g=[];for(let m=0;m<h;m++){const S=m*f-a;for(let y=0;y<c;y++){const M=y*u-s;_.push(M,-S,0),b.push(0,0,1),g.push(y/o),g.push(1-m/l)}}for(let m=0;m<l;m++)for(let S=0;S<o;S++){const y=S+c*m,M=S+c*(m+1),T=S+1+c*(m+1),R=S+1+c*m;d.push(y,M,R),d.push(M,T,R)}this.setIndex(d),this.setAttribute("position",new mn(_,3)),this.setAttribute("normal",new mn(b,3)),this.setAttribute("uv",new mn(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new as(e.width,e.height,e.widthSegments,e.heightSegments)}}class Wm extends ei{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class os extends Fn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new et(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 et(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=vu,this.normalScale=new Je(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 On,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 kn extends os{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 Je(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return at(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 et(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 et(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new et(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 Xm extends Fn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Ip,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class $m extends Fn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function sa(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function qm(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function jm(i){function e(r,s){return i[r]-i[s]}const t=i.length,n=new Array(t);for(let r=0;r!==t;++r)n[r]=r;return n.sort(e),n}function ph(i,e,t){const n=i.length,r=new i.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let l=0;l!==e;++l)r[a++]=i[o+l]}return r}function mh(i,e,t,n){let r=1,s=i[0];for(;s!==void 0&&s[n]===void 0;)s=i[r++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push(...a)),s=i[r++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=i[r++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=i[r++];while(s!==void 0)}class ls{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r: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,r=t[n],s=t[n-1];n:{e:{let a;t:{i:if(!(e<r)){for(let o=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=r,r=t[++n],e<r)break e}a=t.length;break t}if(!(e>=s)){const o=t[1];e<o&&(n=2,s=o);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break e}a=n,n=0;break t}break n}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let a=0;a!==r;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Ym extends ls{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:pu,endingEnd:pu}}intervalChanged_(e,t,n){const r=this.parameterPositions;let s=e-2,a=e+1,o=r[s],l=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case mu:s=e,o=2*t-n;break;case gu:s=r.length-2,o=t+r[s]-r[s+1];break;default:s=e,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case mu:a=e,l=2*n-t;break;case gu:a=1,l=n+r[1]-r[0];break;default:a=e-1,l=t}const c=(n-t)*.5,h=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-n),this._offsetPrev=s*h,this._offsetNext=a*h}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=this._offsetPrev,u=this._offsetNext,f=this._weightPrev,d=this._weightNext,_=(n-t)/(r-t),b=_*_,g=b*_,m=-f*g+2*f*b-f*_,S=(1+f)*g+(-1.5-2*f)*b+(-.5+f)*_+1,y=(-1-d)*g+(1.5+d)*b+.5*_,M=d*g-d*b;for(let T=0;T!==o;++T)s[T]=m*a[h+T]+S*a[c+T]+y*a[l+T]+M*a[u+T];return s}}class Km extends ls{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=(n-t)/(r-t),u=1-h;for(let f=0;f!==o;++f)s[f]=a[c+f]*u+a[l+f]*h;return s}}class Zm extends ls{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class Rn{constructor(e,t,n,r){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=sa(t,this.TimeBufferType),this.values=sa(n,this.ValueBufferType),this.setInterpolation(r||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:sa(e.times,Array),values:sa(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Zm(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Km(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Ym(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case qr:t=this.InterpolantFactoryMethodDiscrete;break;case jr:t=this.InterpolantFactoryMethodLinear;break;case Oo: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 qr;case this.InterpolantFactoryMethodLinear:return jr;case this.InterpolantFactoryMethodSmooth:return Oo}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){const n=this.times,r=n.length;let s=0,a=r-1;for(;s!==r&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}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,r=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(r!==void 0&&qm(r))for(let o=0,l=r.length;o!==l;++o){const c=r[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===Oo,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],h=e[o+1];if(c!==h&&(o!==1||c!==e[0]))if(r)l=!0;else{const u=o*n,f=u-n,d=u+n;for(let _=0;_!==n;++_){const b=t[u+_];if(b!==t[f+_]||b!==t[d+_]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const u=o*n,f=a*n;for(let d=0;d!==n;++d)t[f+d]=t[u+d]}++a}}if(s>0){e[a]=e[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}Rn.prototype.ValueTypeName="",Rn.prototype.TimeBufferType=Float32Array,Rn.prototype.ValueBufferType=Float32Array,Rn.prototype.DefaultInterpolation=jr;class yr extends Rn{constructor(e,t,n){super(e,t,n)}}yr.prototype.ValueTypeName="bool",yr.prototype.ValueBufferType=Array,yr.prototype.DefaultInterpolation=qr,yr.prototype.InterpolantFactoryMethodLinear=void 0,yr.prototype.InterpolantFactoryMethodSmooth=void 0;class gh extends Rn{constructor(e,t,n,r){super(e,t,n,r)}}gh.prototype.ValueTypeName="color";class xr extends Rn{constructor(e,t,n,r){super(e,t,n,r)}}xr.prototype.ValueTypeName="number";class Jm extends ls{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(r-t);let c=e*o;for(let h=c+o;c!==h;c+=4)In.slerpFlat(s,0,a,c-o,a,c,l);return s}}class br extends Rn{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new Jm(this.times,this.values,this.getValueSize(),e)}}br.prototype.ValueTypeName="quaternion",br.prototype.InterpolantFactoryMethodSmooth=void 0;class Sr extends Rn{constructor(e,t,n){super(e,t,n)}}Sr.prototype.ValueTypeName="string",Sr.prototype.ValueBufferType=Array,Sr.prototype.DefaultInterpolation=qr,Sr.prototype.InterpolantFactoryMethodLinear=void 0,Sr.prototype.InterpolantFactoryMethodSmooth=void 0;class Mr extends Rn{constructor(e,t,n,r){super(e,t,n,r)}}Mr.prototype.ValueTypeName="vector";class Qm{constructor(e="",t=-1,n=[],r=Dp){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=bn(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,r=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(tg(n[a]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){const t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,a=n.length;s!==a;++s)t.push(Rn.toJSON(n[s]));return r}static CreateFromMorphTargetSequence(e,t,n,r){const s=t.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const h=jm(l);l=ph(l,1,h),c=ph(c,1,h),!r&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new xr(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const r=e;n=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const r={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],h=c.name.match(s);if(h&&h.length>1){const u=h[1];let f=r[u];f||(r[u]=f=[]),f.push(c)}}const a=[];for(const o in r)a.push(this.CreateFromMorphTargetSequence(o,r[o],t,n));return a}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(u,f,d,_,b){if(d.length!==0){const g=[],m=[];mh(d,g,m,_),g.length!==0&&b.push(new u(f,g,m))}},r=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let u=0;u<c.length;u++){const f=c[u].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const d={};let _;for(_=0;_<f.length;_++)if(f[_].morphTargets)for(let b=0;b<f[_].morphTargets.length;b++)d[f[_].morphTargets[b]]=-1;for(const b in d){const g=[],m=[];for(let S=0;S!==f[_].morphTargets.length;++S){const y=f[_];g.push(y.time),m.push(y.morphTarget===b?1:0)}r.push(new xr(".morphTargetInfluence["+b+"]",g,m))}l=d.length*a}else{const d=".bones["+t[u].name+"]";n(Mr,d+".position",f,"pos",r),n(br,d+".quaternion",f,"rot",r),n(Mr,d+".scale",f,"scl",r)}}return r.length===0?null:new this(s,l,r,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,r=e.length;n!==r;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.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 n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function eg(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return xr;case"vector":case"vector2":case"vector3":case"vector4":return Mr;case"color":return gh;case"quaternion":return br;case"bool":case"boolean":return yr;case"string":return Sr}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function tg(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=eg(i.type);if(i.times===void 0){const t=[],n=[];mh(i.keys,t,n,"value"),i.times=t,i.values=n}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}const ni={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class ng{constructor(e,t,n){const r=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.abortController=new AbortController,this.itemStart=function(h){o++,s===!1&&r.onStart!==void 0&&r.onStart(h,a,o),s=!0},this.itemEnd=function(h){a++,r.onProgress!==void 0&&r.onProgress(h,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(h){r.onError!==void 0&&r.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){const u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,f=c.length;u<f;u+=2){const d=c[u],_=c[u+1];if(d.global&&(d.lastIndex=0),d.test(h))return _}return null},this.abort=function(){return this.abortController.abort(),this.abortController=new AbortController,this}}}const ig=new ng;class Er{constructor(e){this.manager=e!==void 0?e:ig,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}Er.DEFAULT_MATERIAL_NAME="__DEFAULT";const ii={};class rg extends Error{constructor(e,t){super(e),this.response=t}}class _h extends Er{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=ni.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(ii[e]!==void 0){ii[e].push({onLoad:t,onProgress:n,onError:r});return}ii[e]=[],ii[e].push({onLoad:t,onProgress:n,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=ii[e],u=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),d=f?parseInt(f):0,_=d!==0;let b=0;const g=new ReadableStream({start(m){S();function S(){u.read().then(({done:y,value:M})=>{if(y)m.close();else{b+=M.byteLength;const T=new ProgressEvent("progress",{lengthComputable:_,loaded:b,total:d});for(let R=0,k=h.length;R<k;R++){const B=h[R];B.onProgress&&B.onProgress(T)}m.enqueue(M),S()}},y=>{m.error(y)})}}});return new Response(g)}else throw new rg(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return c.json();default:if(o==="")return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(o),f=u&&u[1]?u[1].toLowerCase():void 0,d=new TextDecoder(f);return c.arrayBuffer().then(_=>d.decode(_))}}}).then(c=>{ni.add(`file:${e}`,c);const h=ii[e];delete ii[e];for(let u=0,f=h.length;u<f;u++){const d=h[u];d.onLoad&&d.onLoad(c)}}).catch(c=>{const h=ii[e];if(h===void 0)throw this.manager.itemError(e),c;delete ii[e];for(let u=0,f=h.length;u<f;u++){const d=h[u];d.onError&&d.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const Tr=new WeakMap;class sg extends Er{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=ni.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0);else{let u=Tr.get(a);u===void 0&&(u=[],Tr.set(a,u)),u.push({onLoad:t,onError:r})}return a}const o=Zr("img");function l(){h(),t&&t(this);const u=Tr.get(this)||[];for(let f=0;f<u.length;f++){const d=u[f];d.onLoad&&d.onLoad(this)}Tr.delete(this),s.manager.itemEnd(e)}function c(u){h(),r&&r(u),ni.remove(`image:${e}`);const f=Tr.get(this)||[];for(let d=0;d<f.length;d++){const _=f[d];_.onError&&_.onError(u)}Tr.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),ni.add(`image:${e}`,o),s.manager.itemStart(e),o.src=e,o}}class vh extends Er{constructor(e){super(e)}load(e,t,n,r){const s=new Dt,a=new sg(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}}class aa extends Ct{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new et(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}}const Ml=new it,yh=new $,xh=new $;class El{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Je(512,512),this.mapType=pn,this.map=null,this.mapPass=null,this.matrix=new it,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new _l,this._frameExtents=new Je(1,1),this._viewportCount=1,this._viewports=[new dt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;yh.setFromMatrixPosition(e.matrixWorld),t.position.copy(yh),xh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(xh),t.updateMatrixWorld(),Ml.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ml,t.coordinateSystem,t.reversedDepth),t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Ml)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}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 ag extends El{constructor(){super(new nn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=tr*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class og extends aa{constructor(e,t,n=0,r=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ct.DEFAULT_UP),this.updateMatrix(),this.target=new Ct,this.distance=n,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new ag}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 bh=new it,cs=new $,Tl=new $;class lg extends El{constructor(){super(new nn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Je(4,2),this._viewportCount=6,this._viewports=[new dt(2,1,1,1),new dt(0,1,1,1),new dt(3,1,1,1),new dt(1,1,1,1),new dt(3,0,1,1),new dt(1,0,1,1)],this._cubeDirections=[new $(1,0,0),new $(-1,0,0),new $(0,0,1),new $(0,0,-1),new $(0,1,0),new $(0,-1,0)],this._cubeUps=[new $(0,1,0),new $(0,1,0),new $(0,1,0),new $(0,1,0),new $(0,0,1),new $(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,r=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),cs.setFromMatrixPosition(e.matrixWorld),n.position.copy(cs),Tl.copy(n.position),Tl.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Tl),n.updateMatrixWorld(),r.makeTranslation(-cs.x,-cs.y,-cs.z),bh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(bh,n.coordinateSystem,n.reversedDepth)}}class cg extends aa{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new lg}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 us extends Wu{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class ug extends El{constructor(){super(new us(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class wl extends aa{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ct.DEFAULT_UP),this.updateMatrix(),this.target=new Ct,this.shadow=new ug}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class hg extends aa{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class hs{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)}}const Al=new WeakMap;class fg extends Er{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"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=ni.get(`image-bitmap:${e}`);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(c=>{if(Al.has(a)===!0)r&&r(Al.get(a)),s.manager.itemError(e),s.manager.itemEnd(e);else return t&&t(c),s.manager.itemEnd(e),c});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const l=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return ni.add(`image-bitmap:${e}`,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),Al.set(l,c),ni.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});ni.add(`image-bitmap:${e}`,l),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class dg extends nn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const Rl="\\[\\]\\.:\\/",pg=new RegExp("["+Rl+"]","g"),Cl="[^"+Rl+"]",mg="[^"+Rl.replace("\\.","")+"]",gg=/((?:WC+[\/:])*)/.source.replace("WC",Cl),_g=/(WCOD+)?/.source.replace("WCOD",mg),vg=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Cl),yg=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Cl),xg=new RegExp("^"+gg+_g+vg+yg+"$"),bg=["material","materials","bones","map"];class Sg{constructor(e,t,n){const r=n||St.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].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(pg,"")}static parseTrackName(e){const t=xg.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]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=n.nodeName.substring(r+1);bg.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}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(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===t||o.uuid===t)return o;const l=n(o.children);if(l)return l}return null},r=n(e.children);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 r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_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 r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=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,r=t.propertyName;let s=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 c=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 h=0;h<e.length;h++)if(e[h].name===c){c=h;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(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[r];if(a===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="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[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}St.Composite=Sg,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]];const Sh=new it;class Mg{constructor(e,t,n=0,r=1/0){this.ray=new or(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Zo,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 Sh.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Sh),this}intersectObject(e,t=!0,n=[]){return Pl(e,this,n,t),n.sort(Mh),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)Pl(e[r],this,n,t);return n.sort(Mh),n}}function Mh(i,e){return i.distance-e.distance}function Pl(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){const s=i.children;for(let a=0,o=s.length;a<o;a++)Pl(s[a],e,t,!0)}}class Eh{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=at(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(at(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Eg extends Ri{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function Th(i,e,t,n){const r=Tg(n);switch(t){case hu:return i*e;case io:return i*e/r.components*r.byteLength;case ro:return i*e/r.components*r.byteLength;case du:return i*e*2/r.components*r.byteLength;case so:return i*e*2/r.components*r.byteLength;case fu:return i*e*3/r.components*r.byteLength;case ln:return i*e*4/r.components*r.byteLength;case ao:return i*e*4/r.components*r.byteLength;case Rs:case Cs:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Ps:case Ds:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case lo:case uo:return Math.max(i,16)*Math.max(e,8)/4;case oo:case co:return Math.max(i,8)*Math.max(e,8)/2;case ho:case fo:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case po:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case mo:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case go:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case _o:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case vo:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case yo:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case xo:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case bo:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case So:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Mo:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case Eo:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case To:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case wo:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case Ao:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case Ro:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Co:case Po:case Do:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Lo:case Io:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Uo:case No:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Tg(i){switch(i){case pn:case ou:return{byteLength:1,components:1};case Gr:case lu:case Wr:return{byteLength:2,components:1};case to:case no:return{byteLength:2,components:4};case ui:case eo:case xn:return{byteLength:4,components:1};case cu:case uu:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Va}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Va);/**
|
|
78
75
|
* @license
|
|
79
76
|
* Copyright 2010-2025 Three.js Authors
|
|
80
77
|
* SPDX-License-Identifier: MIT
|
|
81
|
-
*/function
|
|
78
|
+
*/function wh(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function wg(i){const e=new WeakMap;function t(o,l){const c=o.array,h=o.usage,u=c.byteLength,f=i.createBuffer();i.bindBuffer(l,f),i.bufferData(l,c,h),o.onUploadCallback();let d;if(c instanceof Float32Array)d=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)d=i.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?d=i.HALF_FLOAT:d=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)d=i.SHORT;else if(c instanceof Uint32Array)d=i.UNSIGNED_INT;else if(c instanceof Int32Array)d=i.INT;else if(c instanceof Int8Array)d=i.BYTE;else if(c instanceof Uint8Array)d=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)d=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:f,type:d,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,l,c){const h=l.array,u=l.updateRanges;if(i.bindBuffer(c,o),u.length===0)i.bufferSubData(c,0,h);else{u.sort((d,_)=>d.start-_.start);let f=0;for(let d=1;d<u.length;d++){const _=u[f],b=u[d];b.start<=_.start+_.count+1?_.count=Math.max(_.count,b.start+b.count-_.start):(++f,u[f]=b)}u.length=f+1;for(let d=0,_=u.length;d<_;d++){const b=u[d];i.bufferSubData(c,b.start*h.BYTES_PER_ELEMENT,h,b.start,b.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(i.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}var Ag=`#ifdef USE_ALPHAHASH
|
|
82
79
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
83
|
-
#endif`,
|
|
80
|
+
#endif`,Rg=`#ifdef USE_ALPHAHASH
|
|
84
81
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
85
82
|
float hash2D( vec2 value ) {
|
|
86
83
|
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
|
@@ -115,20 +112,20 @@
|
|
|
115
112
|
: cases.z;
|
|
116
113
|
return clamp( threshold , 1.0e-6, 1.0 );
|
|
117
114
|
}
|
|
118
|
-
#endif`,
|
|
115
|
+
#endif`,Cg=`#ifdef USE_ALPHAMAP
|
|
119
116
|
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|
120
|
-
#endif`,
|
|
117
|
+
#endif`,Pg=`#ifdef USE_ALPHAMAP
|
|
121
118
|
uniform sampler2D alphaMap;
|
|
122
|
-
#endif`,
|
|
119
|
+
#endif`,Dg=`#ifdef USE_ALPHATEST
|
|
123
120
|
#ifdef ALPHA_TO_COVERAGE
|
|
124
121
|
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
|
125
122
|
if ( diffuseColor.a == 0.0 ) discard;
|
|
126
123
|
#else
|
|
127
124
|
if ( diffuseColor.a < alphaTest ) discard;
|
|
128
125
|
#endif
|
|
129
|
-
#endif`,
|
|
126
|
+
#endif`,Lg=`#ifdef USE_ALPHATEST
|
|
130
127
|
uniform float alphaTest;
|
|
131
|
-
#endif`,
|
|
128
|
+
#endif`,Ig=`#ifdef USE_AOMAP
|
|
132
129
|
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
133
130
|
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
134
131
|
#if defined( USE_CLEARCOAT )
|
|
@@ -141,10 +138,10 @@
|
|
|
141
138
|
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
|
142
139
|
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|
143
140
|
#endif
|
|
144
|
-
#endif`,
|
|
141
|
+
#endif`,Ug=`#ifdef USE_AOMAP
|
|
145
142
|
uniform sampler2D aoMap;
|
|
146
143
|
uniform float aoMapIntensity;
|
|
147
|
-
#endif`,
|
|
144
|
+
#endif`,Ng=`#ifdef USE_BATCHING
|
|
148
145
|
#if ! defined( GL_ANGLE_multi_draw )
|
|
149
146
|
#define gl_DrawID _gl_DrawID
|
|
150
147
|
uniform int _gl_DrawID;
|
|
@@ -178,15 +175,15 @@
|
|
|
178
175
|
int y = j / size;
|
|
179
176
|
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
|
|
180
177
|
}
|
|
181
|
-
#endif`,
|
|
178
|
+
#endif`,Og=`#ifdef USE_BATCHING
|
|
182
179
|
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
|
|
183
|
-
#endif`,
|
|
180
|
+
#endif`,Fg=`vec3 transformed = vec3( position );
|
|
184
181
|
#ifdef USE_ALPHAHASH
|
|
185
182
|
vPosition = vec3( position );
|
|
186
|
-
#endif`,
|
|
183
|
+
#endif`,kg=`vec3 objectNormal = vec3( normal );
|
|
187
184
|
#ifdef USE_TANGENT
|
|
188
185
|
vec3 objectTangent = vec3( tangent.xyz );
|
|
189
|
-
#endif`,
|
|
186
|
+
#endif`,Bg=`float G_BlinnPhong_Implicit( ) {
|
|
190
187
|
return 0.25;
|
|
191
188
|
}
|
|
192
189
|
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
@@ -200,7 +197,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
200
197
|
float G = G_BlinnPhong_Implicit( );
|
|
201
198
|
float D = D_BlinnPhong( shininess, dotNH );
|
|
202
199
|
return F * ( G * D );
|
|
203
|
-
} // validated`,
|
|
200
|
+
} // validated`,zg=`#ifdef USE_IRIDESCENCE
|
|
204
201
|
const mat3 XYZ_TO_REC709 = mat3(
|
|
205
202
|
3.2404542, -0.9692660, 0.0556434,
|
|
206
203
|
-1.5371385, 1.8760108, -0.2040259,
|
|
@@ -263,7 +260,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
263
260
|
}
|
|
264
261
|
return max( I, vec3( 0.0 ) );
|
|
265
262
|
}
|
|
266
|
-
#endif`,
|
|
263
|
+
#endif`,Hg=`#ifdef USE_BUMPMAP
|
|
267
264
|
uniform sampler2D bumpMap;
|
|
268
265
|
uniform float bumpScale;
|
|
269
266
|
vec2 dHdxy_fwd() {
|
|
@@ -284,7 +281,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
284
281
|
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
285
282
|
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
286
283
|
}
|
|
287
|
-
#endif`,
|
|
284
|
+
#endif`,Vg=`#if NUM_CLIPPING_PLANES > 0
|
|
288
285
|
vec4 plane;
|
|
289
286
|
#ifdef ALPHA_TO_COVERAGE
|
|
290
287
|
float distanceToPlane, distanceGradient;
|
|
@@ -330,26 +327,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
330
327
|
if ( clipped ) discard;
|
|
331
328
|
#endif
|
|
332
329
|
#endif
|
|
333
|
-
#endif`,
|
|
330
|
+
#endif`,Gg=`#if NUM_CLIPPING_PLANES > 0
|
|
334
331
|
varying vec3 vClipPosition;
|
|
335
332
|
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
336
|
-
#endif`,
|
|
333
|
+
#endif`,Wg=`#if NUM_CLIPPING_PLANES > 0
|
|
337
334
|
varying vec3 vClipPosition;
|
|
338
|
-
#endif`,
|
|
335
|
+
#endif`,Xg=`#if NUM_CLIPPING_PLANES > 0
|
|
339
336
|
vClipPosition = - mvPosition.xyz;
|
|
340
|
-
#endif
|
|
337
|
+
#endif`,$g=`#if defined( USE_COLOR_ALPHA )
|
|
341
338
|
diffuseColor *= vColor;
|
|
342
339
|
#elif defined( USE_COLOR )
|
|
343
340
|
diffuseColor.rgb *= vColor;
|
|
344
|
-
#endif`,
|
|
341
|
+
#endif`,qg=`#if defined( USE_COLOR_ALPHA )
|
|
345
342
|
varying vec4 vColor;
|
|
346
343
|
#elif defined( USE_COLOR )
|
|
347
344
|
varying vec3 vColor;
|
|
348
|
-
#endif`,
|
|
345
|
+
#endif`,jg=`#if defined( USE_COLOR_ALPHA )
|
|
349
346
|
varying vec4 vColor;
|
|
350
347
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
351
348
|
varying vec3 vColor;
|
|
352
|
-
#endif`,
|
|
349
|
+
#endif`,Yg=`#if defined( USE_COLOR_ALPHA )
|
|
353
350
|
vColor = vec4( 1.0 );
|
|
354
351
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
355
352
|
vColor = vec3( 1.0 );
|
|
@@ -363,7 +360,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
363
360
|
#ifdef USE_BATCHING_COLOR
|
|
364
361
|
vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
|
|
365
362
|
vColor.xyz *= batchingColor.xyz;
|
|
366
|
-
#endif`,
|
|
363
|
+
#endif`,Kg=`#define PI 3.141592653589793
|
|
367
364
|
#define PI2 6.283185307179586
|
|
368
365
|
#define PI_HALF 1.5707963267948966
|
|
369
366
|
#define RECIPROCAL_PI 0.3183098861837907
|
|
@@ -437,7 +434,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
|
|
437
434
|
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
438
435
|
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
439
436
|
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
440
|
-
} // validated`,
|
|
437
|
+
} // validated`,Zg=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
441
438
|
#define cubeUV_minMipLevel 4.0
|
|
442
439
|
#define cubeUV_minTileSize 16.0
|
|
443
440
|
float getFace( vec3 direction ) {
|
|
@@ -530,7 +527,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
|
530
527
|
return vec4( mix( color0, color1, mipF ), 1.0 );
|
|
531
528
|
}
|
|
532
529
|
}
|
|
533
|
-
#endif`,
|
|
530
|
+
#endif`,Jg=`vec3 transformedNormal = objectNormal;
|
|
534
531
|
#ifdef USE_TANGENT
|
|
535
532
|
vec3 transformedTangent = objectTangent;
|
|
536
533
|
#endif
|
|
@@ -559,21 +556,21 @@ transformedNormal = normalMatrix * transformedNormal;
|
|
|
559
556
|
#ifdef FLIP_SIDED
|
|
560
557
|
transformedTangent = - transformedTangent;
|
|
561
558
|
#endif
|
|
562
|
-
#endif`,
|
|
559
|
+
#endif`,Qg=`#ifdef USE_DISPLACEMENTMAP
|
|
563
560
|
uniform sampler2D displacementMap;
|
|
564
561
|
uniform float displacementScale;
|
|
565
562
|
uniform float displacementBias;
|
|
566
|
-
#endif`,
|
|
563
|
+
#endif`,e_=`#ifdef USE_DISPLACEMENTMAP
|
|
567
564
|
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
|
568
|
-
#endif`,
|
|
565
|
+
#endif`,t_=`#ifdef USE_EMISSIVEMAP
|
|
569
566
|
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
|
570
567
|
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
|
|
571
568
|
emissiveColor = sRGBTransferEOTF( emissiveColor );
|
|
572
569
|
#endif
|
|
573
570
|
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
574
|
-
#endif`,
|
|
571
|
+
#endif`,n_=`#ifdef USE_EMISSIVEMAP
|
|
575
572
|
uniform sampler2D emissiveMap;
|
|
576
|
-
#endif`,
|
|
573
|
+
#endif`,i_="gl_FragColor = linearToOutputTexel( gl_FragColor );",r_=`vec4 LinearTransferOETF( in vec4 value ) {
|
|
577
574
|
return value;
|
|
578
575
|
}
|
|
579
576
|
vec4 sRGBTransferEOTF( in vec4 value ) {
|
|
@@ -581,7 +578,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
|
|
|
581
578
|
}
|
|
582
579
|
vec4 sRGBTransferOETF( in vec4 value ) {
|
|
583
580
|
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
|
|
584
|
-
}`,
|
|
581
|
+
}`,s_=`#ifdef USE_ENVMAP
|
|
585
582
|
#ifdef ENV_WORLDPOS
|
|
586
583
|
vec3 cameraToFrag;
|
|
587
584
|
if ( isOrthographic ) {
|
|
@@ -610,7 +607,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
610
607
|
#elif defined( ENVMAP_BLENDING_ADD )
|
|
611
608
|
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
612
609
|
#endif
|
|
613
|
-
#endif`,
|
|
610
|
+
#endif`,a_=`#ifdef USE_ENVMAP
|
|
614
611
|
uniform float envMapIntensity;
|
|
615
612
|
uniform float flipEnvMap;
|
|
616
613
|
uniform mat3 envMapRotation;
|
|
@@ -620,7 +617,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
620
617
|
uniform sampler2D envMap;
|
|
621
618
|
#endif
|
|
622
619
|
|
|
623
|
-
#endif`,
|
|
620
|
+
#endif`,o_=`#ifdef USE_ENVMAP
|
|
624
621
|
uniform float reflectivity;
|
|
625
622
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
626
623
|
#define ENV_WORLDPOS
|
|
@@ -631,7 +628,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
631
628
|
#else
|
|
632
629
|
varying vec3 vReflect;
|
|
633
630
|
#endif
|
|
634
|
-
#endif`,
|
|
631
|
+
#endif`,l_=`#ifdef USE_ENVMAP
|
|
635
632
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
636
633
|
#define ENV_WORLDPOS
|
|
637
634
|
#endif
|
|
@@ -642,7 +639,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
642
639
|
varying vec3 vReflect;
|
|
643
640
|
uniform float refractionRatio;
|
|
644
641
|
#endif
|
|
645
|
-
#endif`,
|
|
642
|
+
#endif`,c_=`#ifdef USE_ENVMAP
|
|
646
643
|
#ifdef ENV_WORLDPOS
|
|
647
644
|
vWorldPosition = worldPosition.xyz;
|
|
648
645
|
#else
|
|
@@ -659,18 +656,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
659
656
|
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
660
657
|
#endif
|
|
661
658
|
#endif
|
|
662
|
-
#endif`,
|
|
659
|
+
#endif`,u_=`#ifdef USE_FOG
|
|
663
660
|
vFogDepth = - mvPosition.z;
|
|
664
|
-
#endif`,
|
|
661
|
+
#endif`,h_=`#ifdef USE_FOG
|
|
665
662
|
varying float vFogDepth;
|
|
666
|
-
#endif`,
|
|
663
|
+
#endif`,f_=`#ifdef USE_FOG
|
|
667
664
|
#ifdef FOG_EXP2
|
|
668
665
|
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
|
669
666
|
#else
|
|
670
667
|
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
|
671
668
|
#endif
|
|
672
669
|
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|
673
|
-
#endif`,
|
|
670
|
+
#endif`,d_=`#ifdef USE_FOG
|
|
674
671
|
uniform vec3 fogColor;
|
|
675
672
|
varying float vFogDepth;
|
|
676
673
|
#ifdef FOG_EXP2
|
|
@@ -679,7 +676,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
679
676
|
uniform float fogNear;
|
|
680
677
|
uniform float fogFar;
|
|
681
678
|
#endif
|
|
682
|
-
#endif`,
|
|
679
|
+
#endif`,p_=`#ifdef USE_GRADIENTMAP
|
|
683
680
|
uniform sampler2D gradientMap;
|
|
684
681
|
#endif
|
|
685
682
|
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
@@ -691,12 +688,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
|
691
688
|
vec2 fw = fwidth( coord ) * 0.5;
|
|
692
689
|
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
|
|
693
690
|
#endif
|
|
694
|
-
}`,
|
|
691
|
+
}`,m_=`#ifdef USE_LIGHTMAP
|
|
695
692
|
uniform sampler2D lightMap;
|
|
696
693
|
uniform float lightMapIntensity;
|
|
697
|
-
#endif`,
|
|
694
|
+
#endif`,g_=`LambertMaterial material;
|
|
698
695
|
material.diffuseColor = diffuseColor.rgb;
|
|
699
|
-
material.specularStrength = specularStrength;`,
|
|
696
|
+
material.specularStrength = specularStrength;`,__=`varying vec3 vViewPosition;
|
|
700
697
|
struct LambertMaterial {
|
|
701
698
|
vec3 diffuseColor;
|
|
702
699
|
float specularStrength;
|
|
@@ -710,7 +707,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
|
|
|
710
707
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
711
708
|
}
|
|
712
709
|
#define RE_Direct RE_Direct_Lambert
|
|
713
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,
|
|
710
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,v_=`uniform bool receiveShadow;
|
|
714
711
|
uniform vec3 ambientLightColor;
|
|
715
712
|
#if defined( USE_LIGHT_PROBES )
|
|
716
713
|
uniform vec3 lightProbe[ 9 ];
|
|
@@ -826,7 +823,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
826
823
|
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
|
827
824
|
return irradiance;
|
|
828
825
|
}
|
|
829
|
-
#endif`,
|
|
826
|
+
#endif`,y_=`#ifdef USE_ENVMAP
|
|
830
827
|
vec3 getIBLIrradiance( const in vec3 normal ) {
|
|
831
828
|
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
832
829
|
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
@@ -859,8 +856,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
859
856
|
#endif
|
|
860
857
|
}
|
|
861
858
|
#endif
|
|
862
|
-
#endif`,
|
|
863
|
-
material.diffuseColor = diffuseColor.rgb;`,
|
|
859
|
+
#endif`,x_=`ToonMaterial material;
|
|
860
|
+
material.diffuseColor = diffuseColor.rgb;`,b_=`varying vec3 vViewPosition;
|
|
864
861
|
struct ToonMaterial {
|
|
865
862
|
vec3 diffuseColor;
|
|
866
863
|
};
|
|
@@ -872,11 +869,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
|
|
|
872
869
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
873
870
|
}
|
|
874
871
|
#define RE_Direct RE_Direct_Toon
|
|
875
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,
|
|
872
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,S_=`BlinnPhongMaterial material;
|
|
876
873
|
material.diffuseColor = diffuseColor.rgb;
|
|
877
874
|
material.specularColor = specular;
|
|
878
875
|
material.specularShininess = shininess;
|
|
879
|
-
material.specularStrength = specularStrength;`,
|
|
876
|
+
material.specularStrength = specularStrength;`,M_=`varying vec3 vViewPosition;
|
|
880
877
|
struct BlinnPhongMaterial {
|
|
881
878
|
vec3 diffuseColor;
|
|
882
879
|
vec3 specularColor;
|
|
@@ -893,7 +890,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
|
|
|
893
890
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
894
891
|
}
|
|
895
892
|
#define RE_Direct RE_Direct_BlinnPhong
|
|
896
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong
|
|
893
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,E_=`PhysicalMaterial material;
|
|
897
894
|
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
898
895
|
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
|
|
899
896
|
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
|
@@ -979,7 +976,7 @@ material.roughness = min( material.roughness, 1.0 );
|
|
|
979
976
|
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
|
|
980
977
|
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
|
|
981
978
|
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
|
|
982
|
-
#endif`,
|
|
979
|
+
#endif`,T_=`struct PhysicalMaterial {
|
|
983
980
|
vec3 diffuseColor;
|
|
984
981
|
float roughness;
|
|
985
982
|
vec3 specularColor;
|
|
@@ -1280,7 +1277,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
|
|
|
1280
1277
|
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
1281
1278
|
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
1282
1279
|
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
1283
|
-
}`,
|
|
1280
|
+
}`,w_=`
|
|
1284
1281
|
vec3 geometryPosition = - vViewPosition;
|
|
1285
1282
|
vec3 geometryNormal = normal;
|
|
1286
1283
|
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
@@ -1395,7 +1392,7 @@ IncidentLight directLight;
|
|
|
1395
1392
|
#if defined( RE_IndirectSpecular )
|
|
1396
1393
|
vec3 radiance = vec3( 0.0 );
|
|
1397
1394
|
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
1398
|
-
#endif`,
|
|
1395
|
+
#endif`,A_=`#if defined( RE_IndirectDiffuse )
|
|
1399
1396
|
#ifdef USE_LIGHTMAP
|
|
1400
1397
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
1401
1398
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
@@ -1414,32 +1411,32 @@ IncidentLight directLight;
|
|
|
1414
1411
|
#ifdef USE_CLEARCOAT
|
|
1415
1412
|
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
|
1416
1413
|
#endif
|
|
1417
|
-
#endif`,
|
|
1414
|
+
#endif`,R_=`#if defined( RE_IndirectDiffuse )
|
|
1418
1415
|
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1419
1416
|
#endif
|
|
1420
1417
|
#if defined( RE_IndirectSpecular )
|
|
1421
1418
|
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1422
|
-
#endif`,
|
|
1419
|
+
#endif`,C_=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
|
1423
1420
|
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1424
|
-
#endif`,
|
|
1421
|
+
#endif`,P_=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
|
1425
1422
|
uniform float logDepthBufFC;
|
|
1426
1423
|
varying float vFragDepth;
|
|
1427
1424
|
varying float vIsPerspective;
|
|
1428
|
-
#endif`,
|
|
1425
|
+
#endif`,D_=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
|
|
1429
1426
|
varying float vFragDepth;
|
|
1430
1427
|
varying float vIsPerspective;
|
|
1431
|
-
#endif`,
|
|
1428
|
+
#endif`,L_=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
|
|
1432
1429
|
vFragDepth = 1.0 + gl_Position.w;
|
|
1433
1430
|
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1434
|
-
#endif`,
|
|
1431
|
+
#endif`,I_=`#ifdef USE_MAP
|
|
1435
1432
|
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
|
1436
1433
|
#ifdef DECODE_VIDEO_TEXTURE
|
|
1437
1434
|
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
|
|
1438
1435
|
#endif
|
|
1439
1436
|
diffuseColor *= sampledDiffuseColor;
|
|
1440
|
-
#endif`,
|
|
1437
|
+
#endif`,U_=`#ifdef USE_MAP
|
|
1441
1438
|
uniform sampler2D map;
|
|
1442
|
-
#endif`,
|
|
1439
|
+
#endif`,N_=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1443
1440
|
#if defined( USE_POINTS_UV )
|
|
1444
1441
|
vec2 uv = vUv;
|
|
1445
1442
|
#else
|
|
@@ -1451,7 +1448,7 @@ IncidentLight directLight;
|
|
|
1451
1448
|
#endif
|
|
1452
1449
|
#ifdef USE_ALPHAMAP
|
|
1453
1450
|
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
1454
|
-
#endif`,
|
|
1451
|
+
#endif`,O_=`#if defined( USE_POINTS_UV )
|
|
1455
1452
|
varying vec2 vUv;
|
|
1456
1453
|
#else
|
|
1457
1454
|
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
@@ -1463,19 +1460,19 @@ IncidentLight directLight;
|
|
|
1463
1460
|
#endif
|
|
1464
1461
|
#ifdef USE_ALPHAMAP
|
|
1465
1462
|
uniform sampler2D alphaMap;
|
|
1466
|
-
#endif`,
|
|
1463
|
+
#endif`,F_=`float metalnessFactor = metalness;
|
|
1467
1464
|
#ifdef USE_METALNESSMAP
|
|
1468
1465
|
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
|
1469
1466
|
metalnessFactor *= texelMetalness.b;
|
|
1470
|
-
#endif`,
|
|
1467
|
+
#endif`,k_=`#ifdef USE_METALNESSMAP
|
|
1471
1468
|
uniform sampler2D metalnessMap;
|
|
1472
|
-
#endif`,
|
|
1469
|
+
#endif`,B_=`#ifdef USE_INSTANCING_MORPH
|
|
1473
1470
|
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
1474
1471
|
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
|
|
1475
1472
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1476
1473
|
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
|
|
1477
1474
|
}
|
|
1478
|
-
#endif`,
|
|
1475
|
+
#endif`,z_=`#if defined( USE_MORPHCOLORS )
|
|
1479
1476
|
vColor *= morphTargetBaseInfluence;
|
|
1480
1477
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1481
1478
|
#if defined( USE_COLOR_ALPHA )
|
|
@@ -1484,12 +1481,12 @@ IncidentLight directLight;
|
|
|
1484
1481
|
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
|
1485
1482
|
#endif
|
|
1486
1483
|
}
|
|
1487
|
-
#endif`,
|
|
1484
|
+
#endif`,H_=`#ifdef USE_MORPHNORMALS
|
|
1488
1485
|
objectNormal *= morphTargetBaseInfluence;
|
|
1489
1486
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1490
1487
|
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
|
|
1491
1488
|
}
|
|
1492
|
-
#endif`,
|
|
1489
|
+
#endif`,V_=`#ifdef USE_MORPHTARGETS
|
|
1493
1490
|
#ifndef USE_INSTANCING_MORPH
|
|
1494
1491
|
uniform float morphTargetBaseInfluence;
|
|
1495
1492
|
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
@@ -1503,12 +1500,12 @@ IncidentLight directLight;
|
|
|
1503
1500
|
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
|
|
1504
1501
|
return texelFetch( morphTargetsTexture, morphUV, 0 );
|
|
1505
1502
|
}
|
|
1506
|
-
#endif`,
|
|
1503
|
+
#endif`,G_=`#ifdef USE_MORPHTARGETS
|
|
1507
1504
|
transformed *= morphTargetBaseInfluence;
|
|
1508
1505
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1509
1506
|
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
|
|
1510
1507
|
}
|
|
1511
|
-
#endif`,
|
|
1508
|
+
#endif`,W_=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|
1512
1509
|
#ifdef FLAT_SHADED
|
|
1513
1510
|
vec3 fdx = dFdx( vViewPosition );
|
|
1514
1511
|
vec3 fdy = dFdy( vViewPosition );
|
|
@@ -1549,7 +1546,7 @@ IncidentLight directLight;
|
|
|
1549
1546
|
tbn2[1] *= faceDirection;
|
|
1550
1547
|
#endif
|
|
1551
1548
|
#endif
|
|
1552
|
-
vec3 nonPerturbedNormal = normal;`,
|
|
1549
|
+
vec3 nonPerturbedNormal = normal;`,X_=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
1553
1550
|
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1554
1551
|
#ifdef FLIP_SIDED
|
|
1555
1552
|
normal = - normal;
|
|
@@ -1564,25 +1561,25 @@ vec3 nonPerturbedNormal = normal;`,dv=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1564
1561
|
normal = normalize( tbn * mapN );
|
|
1565
1562
|
#elif defined( USE_BUMPMAP )
|
|
1566
1563
|
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|
1567
|
-
#endif
|
|
1564
|
+
#endif`,$_=`#ifndef FLAT_SHADED
|
|
1568
1565
|
varying vec3 vNormal;
|
|
1569
1566
|
#ifdef USE_TANGENT
|
|
1570
1567
|
varying vec3 vTangent;
|
|
1571
1568
|
varying vec3 vBitangent;
|
|
1572
1569
|
#endif
|
|
1573
|
-
#endif`,
|
|
1570
|
+
#endif`,q_=`#ifndef FLAT_SHADED
|
|
1574
1571
|
varying vec3 vNormal;
|
|
1575
1572
|
#ifdef USE_TANGENT
|
|
1576
1573
|
varying vec3 vTangent;
|
|
1577
1574
|
varying vec3 vBitangent;
|
|
1578
1575
|
#endif
|
|
1579
|
-
#endif`,
|
|
1576
|
+
#endif`,j_=`#ifndef FLAT_SHADED
|
|
1580
1577
|
vNormal = normalize( transformedNormal );
|
|
1581
1578
|
#ifdef USE_TANGENT
|
|
1582
1579
|
vTangent = normalize( transformedTangent );
|
|
1583
1580
|
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
1584
1581
|
#endif
|
|
1585
|
-
#endif`,
|
|
1582
|
+
#endif`,Y_=`#ifdef USE_NORMALMAP
|
|
1586
1583
|
uniform sampler2D normalMap;
|
|
1587
1584
|
uniform vec2 normalScale;
|
|
1588
1585
|
#endif
|
|
@@ -1604,13 +1601,13 @@ vec3 nonPerturbedNormal = normal;`,dv=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1604
1601
|
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
|
|
1605
1602
|
return mat3( T * scale, B * scale, N );
|
|
1606
1603
|
}
|
|
1607
|
-
#endif`,
|
|
1604
|
+
#endif`,K_=`#ifdef USE_CLEARCOAT
|
|
1608
1605
|
vec3 clearcoatNormal = nonPerturbedNormal;
|
|
1609
|
-
#endif`,
|
|
1606
|
+
#endif`,Z_=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1610
1607
|
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1611
1608
|
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
1612
1609
|
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
|
1613
|
-
#endif`,
|
|
1610
|
+
#endif`,J_=`#ifdef USE_CLEARCOATMAP
|
|
1614
1611
|
uniform sampler2D clearcoatMap;
|
|
1615
1612
|
#endif
|
|
1616
1613
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
@@ -1619,18 +1616,18 @@ vec3 nonPerturbedNormal = normal;`,dv=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1619
1616
|
#endif
|
|
1620
1617
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1621
1618
|
uniform sampler2D clearcoatRoughnessMap;
|
|
1622
|
-
#endif`,
|
|
1619
|
+
#endif`,Q_=`#ifdef USE_IRIDESCENCEMAP
|
|
1623
1620
|
uniform sampler2D iridescenceMap;
|
|
1624
1621
|
#endif
|
|
1625
1622
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
1626
1623
|
uniform sampler2D iridescenceThicknessMap;
|
|
1627
|
-
#endif`,
|
|
1624
|
+
#endif`,ev=`#ifdef OPAQUE
|
|
1628
1625
|
diffuseColor.a = 1.0;
|
|
1629
1626
|
#endif
|
|
1630
1627
|
#ifdef USE_TRANSMISSION
|
|
1631
1628
|
diffuseColor.a *= material.transmissionAlpha;
|
|
1632
1629
|
#endif
|
|
1633
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,
|
|
1630
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,tv=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
1634
1631
|
return normalize( normal ) * 0.5 + 0.5;
|
|
1635
1632
|
}
|
|
1636
1633
|
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
@@ -1699,9 +1696,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const
|
|
|
1699
1696
|
}
|
|
1700
1697
|
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
|
1701
1698
|
return ( near * far ) / ( ( far - near ) * depth - far );
|
|
1702
|
-
}`,
|
|
1699
|
+
}`,nv=`#ifdef PREMULTIPLIED_ALPHA
|
|
1703
1700
|
gl_FragColor.rgb *= gl_FragColor.a;
|
|
1704
|
-
#endif`,
|
|
1701
|
+
#endif`,iv=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
1705
1702
|
#ifdef USE_BATCHING
|
|
1706
1703
|
mvPosition = batchingMatrix * mvPosition;
|
|
1707
1704
|
#endif
|
|
@@ -1709,22 +1706,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
|
|
|
1709
1706
|
mvPosition = instanceMatrix * mvPosition;
|
|
1710
1707
|
#endif
|
|
1711
1708
|
mvPosition = modelViewMatrix * mvPosition;
|
|
1712
|
-
gl_Position = projectionMatrix * mvPosition;`,
|
|
1709
|
+
gl_Position = projectionMatrix * mvPosition;`,rv=`#ifdef DITHERING
|
|
1713
1710
|
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
1714
|
-
#endif`,
|
|
1711
|
+
#endif`,sv=`#ifdef DITHERING
|
|
1715
1712
|
vec3 dithering( vec3 color ) {
|
|
1716
1713
|
float grid_position = rand( gl_FragCoord.xy );
|
|
1717
1714
|
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
1718
1715
|
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
1719
1716
|
return color + dither_shift_RGB;
|
|
1720
1717
|
}
|
|
1721
|
-
#endif`,
|
|
1718
|
+
#endif`,av=`float roughnessFactor = roughness;
|
|
1722
1719
|
#ifdef USE_ROUGHNESSMAP
|
|
1723
1720
|
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
|
1724
1721
|
roughnessFactor *= texelRoughness.g;
|
|
1725
|
-
#endif`,
|
|
1722
|
+
#endif`,ov=`#ifdef USE_ROUGHNESSMAP
|
|
1726
1723
|
uniform sampler2D roughnessMap;
|
|
1727
|
-
#endif`,
|
|
1724
|
+
#endif`,lv=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1728
1725
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1729
1726
|
#endif
|
|
1730
1727
|
#if NUM_SPOT_LIGHT_MAPS > 0
|
|
@@ -1919,7 +1916,7 @@ gl_Position = projectionMatrix * mvPosition;`,wv=`#ifdef DITHERING
|
|
|
1919
1916
|
}
|
|
1920
1917
|
return mix( 1.0, shadow, shadowIntensity );
|
|
1921
1918
|
}
|
|
1922
|
-
#endif`,
|
|
1919
|
+
#endif`,cv=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1923
1920
|
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
|
|
1924
1921
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1925
1922
|
#endif
|
|
@@ -1960,7 +1957,7 @@ gl_Position = projectionMatrix * mvPosition;`,wv=`#ifdef DITHERING
|
|
|
1960
1957
|
};
|
|
1961
1958
|
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1962
1959
|
#endif
|
|
1963
|
-
#endif`,
|
|
1960
|
+
#endif`,uv=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
|
|
1964
1961
|
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
1965
1962
|
vec4 shadowWorldPosition;
|
|
1966
1963
|
#endif
|
|
@@ -1992,7 +1989,7 @@ gl_Position = projectionMatrix * mvPosition;`,wv=`#ifdef DITHERING
|
|
|
1992
1989
|
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
|
1993
1990
|
}
|
|
1994
1991
|
#pragma unroll_loop_end
|
|
1995
|
-
#endif`,
|
|
1992
|
+
#endif`,hv=`float getShadowMask() {
|
|
1996
1993
|
float shadow = 1.0;
|
|
1997
1994
|
#ifdef USE_SHADOWMAP
|
|
1998
1995
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
@@ -2024,12 +2021,12 @@ gl_Position = projectionMatrix * mvPosition;`,wv=`#ifdef DITHERING
|
|
|
2024
2021
|
#endif
|
|
2025
2022
|
#endif
|
|
2026
2023
|
return shadow;
|
|
2027
|
-
}`,
|
|
2024
|
+
}`,fv=`#ifdef USE_SKINNING
|
|
2028
2025
|
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
2029
2026
|
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
2030
2027
|
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
2031
2028
|
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
2032
|
-
#endif`,
|
|
2029
|
+
#endif`,dv=`#ifdef USE_SKINNING
|
|
2033
2030
|
uniform mat4 bindMatrix;
|
|
2034
2031
|
uniform mat4 bindMatrixInverse;
|
|
2035
2032
|
uniform highp sampler2D boneTexture;
|
|
@@ -2044,7 +2041,7 @@ gl_Position = projectionMatrix * mvPosition;`,wv=`#ifdef DITHERING
|
|
|
2044
2041
|
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
|
2045
2042
|
return mat4( v1, v2, v3, v4 );
|
|
2046
2043
|
}
|
|
2047
|
-
#endif`,
|
|
2044
|
+
#endif`,pv=`#ifdef USE_SKINNING
|
|
2048
2045
|
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
2049
2046
|
vec4 skinned = vec4( 0.0 );
|
|
2050
2047
|
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
@@ -2052,7 +2049,7 @@ gl_Position = projectionMatrix * mvPosition;`,wv=`#ifdef DITHERING
|
|
|
2052
2049
|
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
2053
2050
|
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
2054
2051
|
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
2055
|
-
#endif`,
|
|
2052
|
+
#endif`,mv=`#ifdef USE_SKINNING
|
|
2056
2053
|
mat4 skinMatrix = mat4( 0.0 );
|
|
2057
2054
|
skinMatrix += skinWeight.x * boneMatX;
|
|
2058
2055
|
skinMatrix += skinWeight.y * boneMatY;
|
|
@@ -2063,17 +2060,17 @@ gl_Position = projectionMatrix * mvPosition;`,wv=`#ifdef DITHERING
|
|
|
2063
2060
|
#ifdef USE_TANGENT
|
|
2064
2061
|
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
2065
2062
|
#endif
|
|
2066
|
-
#endif`,
|
|
2063
|
+
#endif`,gv=`float specularStrength;
|
|
2067
2064
|
#ifdef USE_SPECULARMAP
|
|
2068
2065
|
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
|
2069
2066
|
specularStrength = texelSpecular.r;
|
|
2070
2067
|
#else
|
|
2071
2068
|
specularStrength = 1.0;
|
|
2072
|
-
#endif`,
|
|
2069
|
+
#endif`,_v=`#ifdef USE_SPECULARMAP
|
|
2073
2070
|
uniform sampler2D specularMap;
|
|
2074
|
-
#endif`,
|
|
2071
|
+
#endif`,vv=`#if defined( TONE_MAPPING )
|
|
2075
2072
|
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
2076
|
-
#endif`,
|
|
2073
|
+
#endif`,yv=`#ifndef saturate
|
|
2077
2074
|
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
2078
2075
|
#endif
|
|
2079
2076
|
uniform float toneMappingExposure;
|
|
@@ -2170,7 +2167,7 @@ vec3 NeutralToneMapping( vec3 color ) {
|
|
|
2170
2167
|
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
|
|
2171
2168
|
return mix( color, vec3( newPeak ), g );
|
|
2172
2169
|
}
|
|
2173
|
-
vec3 CustomToneMapping( vec3 color ) { return color; }`,
|
|
2170
|
+
vec3 CustomToneMapping( vec3 color ) { return color; }`,xv=`#ifdef USE_TRANSMISSION
|
|
2174
2171
|
material.transmission = transmission;
|
|
2175
2172
|
material.transmissionAlpha = 1.0;
|
|
2176
2173
|
material.thickness = thickness;
|
|
@@ -2191,7 +2188,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Vv=`#ifdef USE_TRANSMISS
|
|
|
2191
2188
|
material.attenuationColor, material.attenuationDistance );
|
|
2192
2189
|
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
|
|
2193
2190
|
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
|
|
2194
|
-
#endif`,
|
|
2191
|
+
#endif`,bv=`#ifdef USE_TRANSMISSION
|
|
2195
2192
|
uniform float transmission;
|
|
2196
2193
|
uniform float thickness;
|
|
2197
2194
|
uniform float attenuationDistance;
|
|
@@ -2317,7 +2314,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Vv=`#ifdef USE_TRANSMISS
|
|
|
2317
2314
|
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
|
|
2318
2315
|
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
|
|
2319
2316
|
}
|
|
2320
|
-
#endif`,
|
|
2317
|
+
#endif`,Sv=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2321
2318
|
varying vec2 vUv;
|
|
2322
2319
|
#endif
|
|
2323
2320
|
#ifdef USE_MAP
|
|
@@ -2387,7 +2384,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Vv=`#ifdef USE_TRANSMISS
|
|
|
2387
2384
|
#ifdef USE_THICKNESSMAP
|
|
2388
2385
|
uniform mat3 thicknessMapTransform;
|
|
2389
2386
|
varying vec2 vThicknessMapUv;
|
|
2390
|
-
#endif`,
|
|
2387
|
+
#endif`,Mv=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2391
2388
|
varying vec2 vUv;
|
|
2392
2389
|
#endif
|
|
2393
2390
|
#ifdef USE_MAP
|
|
@@ -2481,7 +2478,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Vv=`#ifdef USE_TRANSMISS
|
|
|
2481
2478
|
#ifdef USE_THICKNESSMAP
|
|
2482
2479
|
uniform mat3 thicknessMapTransform;
|
|
2483
2480
|
varying vec2 vThicknessMapUv;
|
|
2484
|
-
#endif
|
|
2481
|
+
#endif`,Ev=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2485
2482
|
vUv = vec3( uv, 1 ).xy;
|
|
2486
2483
|
#endif
|
|
2487
2484
|
#ifdef USE_MAP
|
|
@@ -2552,7 +2549,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Vv=`#ifdef USE_TRANSMISS
|
|
|
2552
2549
|
#endif
|
|
2553
2550
|
#ifdef USE_THICKNESSMAP
|
|
2554
2551
|
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
|
2555
|
-
#endif`,
|
|
2552
|
+
#endif`,Tv=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
|
|
2556
2553
|
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
2557
2554
|
#ifdef USE_BATCHING
|
|
2558
2555
|
worldPosition = batchingMatrix * worldPosition;
|
|
@@ -2561,7 +2558,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Vv=`#ifdef USE_TRANSMISS
|
|
|
2561
2558
|
worldPosition = instanceMatrix * worldPosition;
|
|
2562
2559
|
#endif
|
|
2563
2560
|
worldPosition = modelMatrix * worldPosition;
|
|
2564
|
-
#endif`;const
|
|
2561
|
+
#endif`;const st={alphahash_fragment:Ag,alphahash_pars_fragment:Rg,alphamap_fragment:Cg,alphamap_pars_fragment:Pg,alphatest_fragment:Dg,alphatest_pars_fragment:Lg,aomap_fragment:Ig,aomap_pars_fragment:Ug,batching_pars_vertex:Ng,batching_vertex:Og,begin_vertex:Fg,beginnormal_vertex:kg,bsdfs:Bg,iridescence_fragment:zg,bumpmap_pars_fragment:Hg,clipping_planes_fragment:Vg,clipping_planes_pars_fragment:Gg,clipping_planes_pars_vertex:Wg,clipping_planes_vertex:Xg,color_fragment:$g,color_pars_fragment:qg,color_pars_vertex:jg,color_vertex:Yg,common:Kg,cube_uv_reflection_fragment:Zg,defaultnormal_vertex:Jg,displacementmap_pars_vertex:Qg,displacementmap_vertex:e_,emissivemap_fragment:t_,emissivemap_pars_fragment:n_,colorspace_fragment:i_,colorspace_pars_fragment:r_,envmap_fragment:s_,envmap_common_pars_fragment:a_,envmap_pars_fragment:o_,envmap_pars_vertex:l_,envmap_physical_pars_fragment:y_,envmap_vertex:c_,fog_vertex:u_,fog_pars_vertex:h_,fog_fragment:f_,fog_pars_fragment:d_,gradientmap_pars_fragment:p_,lightmap_pars_fragment:m_,lights_lambert_fragment:g_,lights_lambert_pars_fragment:__,lights_pars_begin:v_,lights_toon_fragment:x_,lights_toon_pars_fragment:b_,lights_phong_fragment:S_,lights_phong_pars_fragment:M_,lights_physical_fragment:E_,lights_physical_pars_fragment:T_,lights_fragment_begin:w_,lights_fragment_maps:A_,lights_fragment_end:R_,logdepthbuf_fragment:C_,logdepthbuf_pars_fragment:P_,logdepthbuf_pars_vertex:D_,logdepthbuf_vertex:L_,map_fragment:I_,map_pars_fragment:U_,map_particle_fragment:N_,map_particle_pars_fragment:O_,metalnessmap_fragment:F_,metalnessmap_pars_fragment:k_,morphinstance_vertex:B_,morphcolor_vertex:z_,morphnormal_vertex:H_,morphtarget_pars_vertex:V_,morphtarget_vertex:G_,normal_fragment_begin:W_,normal_fragment_maps:X_,normal_pars_fragment:$_,normal_pars_vertex:q_,normal_vertex:j_,normalmap_pars_fragment:Y_,clearcoat_normal_fragment_begin:K_,clearcoat_normal_fragment_maps:Z_,clearcoat_pars_fragment:J_,iridescence_pars_fragment:Q_,opaque_fragment:ev,packing:tv,premultiplied_alpha_fragment:nv,project_vertex:iv,dithering_fragment:rv,dithering_pars_fragment:sv,roughnessmap_fragment:av,roughnessmap_pars_fragment:ov,shadowmap_pars_fragment:lv,shadowmap_pars_vertex:cv,shadowmap_vertex:uv,shadowmask_pars_fragment:hv,skinbase_vertex:fv,skinning_pars_vertex:dv,skinning_vertex:pv,skinnormal_vertex:mv,specularmap_fragment:gv,specularmap_pars_fragment:_v,tonemapping_fragment:vv,tonemapping_pars_fragment:yv,transmission_fragment:xv,transmission_pars_fragment:bv,uv_pars_fragment:Sv,uv_pars_vertex:Mv,uv_vertex:Ev,worldpos_vertex:Tv,background_vert:`varying vec2 vUv;
|
|
2565
2562
|
uniform mat3 uvTransform;
|
|
2566
2563
|
void main() {
|
|
2567
2564
|
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
@@ -3617,7 +3614,7 @@ void main() {
|
|
|
3617
3614
|
#include <tonemapping_fragment>
|
|
3618
3615
|
#include <colorspace_fragment>
|
|
3619
3616
|
#include <fog_fragment>
|
|
3620
|
-
}`},Ie={common:{diffuse:{value:new Ze(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Qe},alphaMap:{value:null},alphaMapTransform:{value:new Qe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Qe}},envmap:{envMap:{value:null},envMapRotation:{value:new Qe},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Qe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Qe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Qe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Qe},normalScale:{value:new Ye(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Qe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Qe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Qe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Qe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ze(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ze(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Qe},alphaTest:{value:0},uvTransform:{value:new Qe}},sprite:{diffuse:{value:new Ze(16777215)},opacity:{value:1},center:{value:new Ye(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Qe},alphaMap:{value:null},alphaMapTransform:{value:new Qe},alphaTest:{value:0}}},Fn={basic:{uniforms:Qt([Ie.common,Ie.specularmap,Ie.envmap,Ie.aomap,Ie.lightmap,Ie.fog]),vertexShader:nt.meshbasic_vert,fragmentShader:nt.meshbasic_frag},lambert:{uniforms:Qt([Ie.common,Ie.specularmap,Ie.envmap,Ie.aomap,Ie.lightmap,Ie.emissivemap,Ie.bumpmap,Ie.normalmap,Ie.displacementmap,Ie.fog,Ie.lights,{emissive:{value:new Ze(0)}}]),vertexShader:nt.meshlambert_vert,fragmentShader:nt.meshlambert_frag},phong:{uniforms:Qt([Ie.common,Ie.specularmap,Ie.envmap,Ie.aomap,Ie.lightmap,Ie.emissivemap,Ie.bumpmap,Ie.normalmap,Ie.displacementmap,Ie.fog,Ie.lights,{emissive:{value:new Ze(0)},specular:{value:new Ze(1118481)},shininess:{value:30}}]),vertexShader:nt.meshphong_vert,fragmentShader:nt.meshphong_frag},standard:{uniforms:Qt([Ie.common,Ie.envmap,Ie.aomap,Ie.lightmap,Ie.emissivemap,Ie.bumpmap,Ie.normalmap,Ie.displacementmap,Ie.roughnessmap,Ie.metalnessmap,Ie.fog,Ie.lights,{emissive:{value:new Ze(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:nt.meshphysical_vert,fragmentShader:nt.meshphysical_frag},toon:{uniforms:Qt([Ie.common,Ie.aomap,Ie.lightmap,Ie.emissivemap,Ie.bumpmap,Ie.normalmap,Ie.displacementmap,Ie.gradientmap,Ie.fog,Ie.lights,{emissive:{value:new Ze(0)}}]),vertexShader:nt.meshtoon_vert,fragmentShader:nt.meshtoon_frag},matcap:{uniforms:Qt([Ie.common,Ie.bumpmap,Ie.normalmap,Ie.displacementmap,Ie.fog,{matcap:{value:null}}]),vertexShader:nt.meshmatcap_vert,fragmentShader:nt.meshmatcap_frag},points:{uniforms:Qt([Ie.points,Ie.fog]),vertexShader:nt.points_vert,fragmentShader:nt.points_frag},dashed:{uniforms:Qt([Ie.common,Ie.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:nt.linedashed_vert,fragmentShader:nt.linedashed_frag},depth:{uniforms:Qt([Ie.common,Ie.displacementmap]),vertexShader:nt.depth_vert,fragmentShader:nt.depth_frag},normal:{uniforms:Qt([Ie.common,Ie.bumpmap,Ie.normalmap,Ie.displacementmap,{opacity:{value:1}}]),vertexShader:nt.meshnormal_vert,fragmentShader:nt.meshnormal_frag},sprite:{uniforms:Qt([Ie.sprite,Ie.fog]),vertexShader:nt.sprite_vert,fragmentShader:nt.sprite_frag},background:{uniforms:{uvTransform:{value:new Qe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:nt.background_vert,fragmentShader:nt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Qe}},vertexShader:nt.backgroundCube_vert,fragmentShader:nt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:nt.cube_vert,fragmentShader:nt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:nt.equirect_vert,fragmentShader:nt.equirect_frag},distanceRGBA:{uniforms:Qt([Ie.common,Ie.displacementmap,{referencePosition:{value:new $},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:nt.distanceRGBA_vert,fragmentShader:nt.distanceRGBA_frag},shadow:{uniforms:Qt([Ie.lights,Ie.fog,{color:{value:new Ze(0)},opacity:{value:1}}]),vertexShader:nt.shadow_vert,fragmentShader:nt.shadow_frag}};Fn.physical={uniforms:Qt([Fn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Qe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Qe},clearcoatNormalScale:{value:new Ye(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Qe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Qe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Qe},sheen:{value:0},sheenColor:{value:new Ze(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Qe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Qe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Qe},transmissionSamplerSize:{value:new Ye},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Qe},attenuationDistance:{value:0},attenuationColor:{value:new Ze(0)},specularColor:{value:new Ze(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Qe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Qe},anisotropyVector:{value:new Ye},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Qe}}]),vertexShader:nt.meshphysical_vert,fragmentShader:nt.meshphysical_frag};const fa={r:0,b:0,g:0},Di=new Un,qv=new et;function Yv(i,e,t,n,r,s,a){const o=new Ze(0);let l=s===!0?0:1,c,h,u=null,f=0,d=null;function _(y){let M=y.isScene===!0?y.background:null;return M&&M.isTexture&&(M=(y.backgroundBlurriness>0?t:e).get(M)),M}function b(y){let M=!1;const T=_(y);T===null?m(o,l):T&&T.isColor&&(m(T,1),M=!0);const R=i.xr.getEnvironmentBlendMode();R==="additive"?n.buffers.color.setClear(0,0,0,1,a):R==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||M)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function g(y,M){const T=_(M);T&&(T.isCubeTexture||T.mapping===Rs)?(h===void 0&&(h=new Jt(new pr(1,1,1),new fi({name:"BackgroundCubeMaterial",uniforms:mr(Fn.backgroundCube.uniforms),vertexShader:Fn.backgroundCube.vertexShader,fragmentShader:Fn.backgroundCube.fragmentShader,side:sn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(R,k,B){this.matrixWorld.copyPosition(B.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),Di.copy(M.backgroundRotation),Di.x*=-1,Di.y*=-1,Di.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(Di.y*=-1,Di.z*=-1),h.material.uniforms.envMap.value=T,h.material.uniforms.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=M.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(qv.makeRotationFromEuler(Di)),h.material.toneMapped=lt.getTransfer(T.colorSpace)!==xt,(u!==T||f!==T.version||d!==i.toneMapping)&&(h.material.needsUpdate=!0,u=T,f=T.version,d=i.toneMapping),h.layers.enableAll(),y.unshift(h,h.geometry,h.material,0,0,null)):T&&T.isTexture&&(c===void 0&&(c=new Jt(new la(2,2),new fi({name:"BackgroundMaterial",uniforms:mr(Fn.background.uniforms),vertexShader:Fn.background.vertexShader,fragmentShader:Fn.background.fragmentShader,side:Gn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=T,c.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,c.material.toneMapped=lt.getTransfer(T.colorSpace)!==xt,T.matrixAutoUpdate===!0&&T.updateMatrix(),c.material.uniforms.uvTransform.value.copy(T.matrix),(u!==T||f!==T.version||d!==i.toneMapping)&&(c.material.needsUpdate=!0,u=T,f=T.version,d=i.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null))}function m(y,M){y.getRGB(fa,Yu(i)),n.buffers.color.setClear(fa.r,fa.g,fa.b,M,a)}function S(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(y,M=1){o.set(y),l=M,m(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(y){l=y,m(o,l)},render:b,addToRenderList:g,dispose:S}}function Kv(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=f(null);let s=r,a=!1;function o(D,V,K,J,se){let he=!1;const Q=u(J,K,V);s!==Q&&(s=Q,c(s.object)),he=d(D,J,K,se),he&&_(D,J,K,se),se!==null&&e.update(se,i.ELEMENT_ARRAY_BUFFER),(he||a)&&(a=!1,M(D,V,K,J),se!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(se).buffer))}function l(){return i.createVertexArray()}function c(D){return i.bindVertexArray(D)}function h(D){return i.deleteVertexArray(D)}function u(D,V,K){const J=K.wireframe===!0;let se=n[D.id];se===void 0&&(se={},n[D.id]=se);let he=se[V.id];he===void 0&&(he={},se[V.id]=he);let Q=he[J];return Q===void 0&&(Q=f(l()),he[J]=Q),Q}function f(D){const V=[],K=[],J=[];for(let se=0;se<t;se++)V[se]=0,K[se]=0,J[se]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:V,enabledAttributes:K,attributeDivisors:J,object:D,attributes:{},index:null}}function d(D,V,K,J){const se=s.attributes,he=V.attributes;let Q=0;const de=K.getAttributes();for(const ne in de)if(de[ne].location>=0){const Te=se[ne];let ke=he[ne];if(ke===void 0&&(ne==="instanceMatrix"&&D.instanceMatrix&&(ke=D.instanceMatrix),ne==="instanceColor"&&D.instanceColor&&(ke=D.instanceColor)),Te===void 0||Te.attribute!==ke||ke&&Te.data!==ke.data)return!0;Q++}return s.attributesNum!==Q||s.index!==J}function _(D,V,K,J){const se={},he=V.attributes;let Q=0;const de=K.getAttributes();for(const ne in de)if(de[ne].location>=0){let Te=he[ne];Te===void 0&&(ne==="instanceMatrix"&&D.instanceMatrix&&(Te=D.instanceMatrix),ne==="instanceColor"&&D.instanceColor&&(Te=D.instanceColor));const ke={};ke.attribute=Te,Te&&Te.data&&(ke.data=Te.data),se[ne]=ke,Q++}s.attributes=se,s.attributesNum=Q,s.index=J}function b(){const D=s.newAttributes;for(let V=0,K=D.length;V<K;V++)D[V]=0}function g(D){m(D,0)}function m(D,V){const K=s.newAttributes,J=s.enabledAttributes,se=s.attributeDivisors;K[D]=1,J[D]===0&&(i.enableVertexAttribArray(D),J[D]=1),se[D]!==V&&(i.vertexAttribDivisor(D,V),se[D]=V)}function S(){const D=s.newAttributes,V=s.enabledAttributes;for(let K=0,J=V.length;K<J;K++)V[K]!==D[K]&&(i.disableVertexAttribArray(K),V[K]=0)}function y(D,V,K,J,se,he,Q){Q===!0?i.vertexAttribIPointer(D,V,K,se,he):i.vertexAttribPointer(D,V,K,J,se,he)}function M(D,V,K,J){b();const se=J.attributes,he=K.getAttributes(),Q=V.defaultAttributeValues;for(const de in he){const ne=he[de];if(ne.location>=0){let ue=se[de];if(ue===void 0&&(de==="instanceMatrix"&&D.instanceMatrix&&(ue=D.instanceMatrix),de==="instanceColor"&&D.instanceColor&&(ue=D.instanceColor)),ue!==void 0){const Te=ue.normalized,ke=ue.itemSize,O=e.get(ue);if(O===void 0)continue;const H=O.buffer,we=O.type,Be=O.bytesPerElement,ie=we===i.INT||we===i.UNSIGNED_INT||ue.gpuType===uo;if(ue.isInterleavedBufferAttribute){const ce=ue.data,z=ce.stride,j=ue.offset;if(ce.isInstancedInterleavedBuffer){for(let W=0;W<ne.locationSize;W++)m(ne.location+W,ce.meshPerAttribute);D.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=ce.meshPerAttribute*ce.count)}else for(let W=0;W<ne.locationSize;W++)g(ne.location+W);i.bindBuffer(i.ARRAY_BUFFER,H);for(let W=0;W<ne.locationSize;W++)y(ne.location+W,ke/ne.locationSize,we,Te,z*Be,(j+ke/ne.locationSize*W)*Be,ie)}else{if(ue.isInstancedBufferAttribute){for(let ce=0;ce<ne.locationSize;ce++)m(ne.location+ce,ue.meshPerAttribute);D.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=ue.meshPerAttribute*ue.count)}else for(let ce=0;ce<ne.locationSize;ce++)g(ne.location+ce);i.bindBuffer(i.ARRAY_BUFFER,H);for(let ce=0;ce<ne.locationSize;ce++)y(ne.location+ce,ke/ne.locationSize,we,Te,ke*Be,ke/ne.locationSize*ce*Be,ie)}}else if(Q!==void 0){const Te=Q[de];if(Te!==void 0)switch(Te.length){case 2:i.vertexAttrib2fv(ne.location,Te);break;case 3:i.vertexAttrib3fv(ne.location,Te);break;case 4:i.vertexAttrib4fv(ne.location,Te);break;default:i.vertexAttrib1fv(ne.location,Te)}}}}S()}function T(){B();for(const D in n){const V=n[D];for(const K in V){const J=V[K];for(const se in J)h(J[se].object),delete J[se];delete V[K]}delete n[D]}}function R(D){if(n[D.id]===void 0)return;const V=n[D.id];for(const K in V){const J=V[K];for(const se in J)h(J[se].object),delete J[se];delete V[K]}delete n[D.id]}function k(D){for(const V in n){const K=n[V];if(K[D.id]===void 0)continue;const J=K[D.id];for(const se in J)h(J[se].object),delete J[se];delete K[D.id]}}function B(){C(),a=!0,s!==r&&(s=r,c(s.object))}function C(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:B,resetDefaultState:C,dispose:T,releaseStatesOfGeometry:R,releaseStatesOfProgram:k,initAttributes:b,enableAttribute:g,disableUnusedAttributes:S}}function Zv(i,e,t){let n;function r(c){n=c}function s(c,h){i.drawArrays(n,c,h),t.update(h,n,1)}function a(c,h,u){u!==0&&(i.drawArraysInstanced(n,c,h,u),t.update(h,n,u))}function o(c,h,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,h,0,u);let d=0;for(let _=0;_<u;_++)d+=h[_];t.update(d,n,1)}function l(c,h,u,f){if(u===0)return;const d=e.get("WEBGL_multi_draw");if(d===null)for(let _=0;_<c.length;_++)a(c[_],h[_],f[_]);else{d.multiDrawArraysInstancedWEBGL(n,c,0,h,0,f,0,u);let _=0;for(let b=0;b<u;b++)_+=h[b]*f[b];t.update(_,n,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function Jv(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const k=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(k.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(k){return!(k!==fn&&n.convert(k)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(k){const B=k===Gr&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(k!==Cn&&n.convert(k)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&k!==_n&&!B)}function l(k){if(k==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";k="mediump"}return k==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const u=t.logarithmicDepthBuffer===!0,f=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),d=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),b=i.getParameter(i.MAX_TEXTURE_SIZE),g=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),m=i.getParameter(i.MAX_VERTEX_ATTRIBS),S=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),y=i.getParameter(i.MAX_VARYING_VECTORS),M=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),T=_>0,R=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,reversedDepthBuffer:f,maxTextures:d,maxVertexTextures:_,maxTextureSize:b,maxCubemapSize:g,maxAttributes:m,maxVertexUniforms:S,maxVaryings:y,maxFragmentUniforms:M,vertexTextures:T,maxSamples:R}}function Qv(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new pi,o=new Qe,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,f){const d=u.length!==0||f||n!==0||r;return r=f,n=u.length,d},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,f){t=h(u,f,0)},this.setState=function(u,f,d){const _=u.clippingPlanes,b=u.clipIntersection,g=u.clipShadows,m=i.get(u);if(!r||_===null||_.length===0||s&&!g)s?h(null):c();else{const S=s?0:n,y=S*4;let M=m.clippingState||null;l.value=M,M=h(_,f,y,d);for(let T=0;T!==y;++T)M[T]=t[T];m.clippingState=M,this.numIntersection=b?this.numPlanes:0,this.numPlanes+=S}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,f,d,_){const b=u!==null?u.length:0;let g=null;if(b!==0){if(g=l.value,_!==!0||g===null){const m=d+b*4,S=f.matrixWorldInverse;o.getNormalMatrix(S),(g===null||g.length<m)&&(g=new Float32Array(m));for(let y=0,M=d;y!==b;++y,M+=4)a.copy(u[y]).applyMatrix4(S,o),a.normal.toArray(g,M),g[M+3]=a.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=b,e.numIntersection=0,g}}function e0(i){let e=new WeakMap;function t(a,o){return o===lo?a.mapping=Zi:o===co&&(a.mapping=Ji),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===lo||o===co)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new Zm(l.height);return c.fromEquirectangularTexture(i,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const wr=4,Lh=[.125,.215,.35,.446,.526,.582],Li=20,kl=new ha,Ih=new Ze;let Bl=null,zl=0,Hl=0,Vl=!1;const Ii=(1+Math.sqrt(5))/2,Ar=1/Ii,Uh=[new $(-Ii,Ar,0),new $(Ii,Ar,0),new $(-Ar,0,Ii),new $(Ar,0,Ii),new $(0,Ii,-Ar),new $(0,Ii,Ar),new $(-1,1,-1),new $(1,1,-1),new $(-1,1,1),new $(1,1,1)],t0=new $;class Nh{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100,s={}){const{size:a=256,position:o=t0}=s;Bl=this._renderer.getRenderTarget(),zl=this._renderer.getActiveCubeFace(),Hl=this._renderer.getActiveMipmapLevel(),Vl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=kh(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Fh(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.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(Bl,zl,Hl),this._renderer.xr.enabled=Vl,e.scissorTest=!1,da(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Zi||e.mapping===Ji?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Bl=this._renderer.getRenderTarget(),zl=this._renderer.getActiveCubeFace(),Hl=this._renderer.getActiveMipmapLevel(),Vl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;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:ln,minFilter:ln,generateMipmaps:!1,type:Gr,format:fn,colorSpace:Kt,depthBuffer:!1},r=Oh(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Oh(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=n0(s)),this._blurMaterial=i0(s,e,t)}return r}_compileMaterial(e){const t=new Jt(this._lodPlanes[0],e);this._renderer.compile(t,kl)}_sceneToCubeUV(e,t,n,r,s){const l=new en(90,1,t,n),c=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,f=u.autoClear,d=u.toneMapping;u.getClearColor(Ih),u.toneMapping=ri,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(r),u.clearDepth(),u.setRenderTarget(null));const b=new Ri({name:"PMREM.Background",side:sn,depthWrite:!1,depthTest:!1}),g=new Jt(new pr,b);let m=!1;const S=e.background;S?S.isColor&&(b.color.copy(S),e.background=null,m=!0):(b.color.copy(Ih),m=!0);for(let y=0;y<6;y++){const M=y%3;M===0?(l.up.set(0,c[y],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+h[y],s.y,s.z)):M===1?(l.up.set(0,0,c[y]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+h[y],s.z)):(l.up.set(0,c[y],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+h[y]));const T=this._cubeSize;da(r,M*T,y>2?T:0,T,T),u.setRenderTarget(r),m&&u.render(g,l),u.render(e,l)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=d,u.autoClear=f,e.background=S}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Zi||e.mapping===Ji;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=kh()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Fh());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new Jt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;da(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,kl)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=Uh[(r-s-1)%Uh.length];this._blur(e,s-1,s,a,o)}t.autoClear=n}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,u=new Jt(this._lodPlanes[r],c),f=c.uniforms,d=this._sizeLods[n]-1,_=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*Li-1),b=s/_,g=isFinite(s)?1+Math.floor(h*b):Li;g>Li&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${Li}`);const m=[];let S=0;for(let k=0;k<Li;++k){const B=k/b,C=Math.exp(-B*B/2);m.push(C),k===0?S+=C:k<g&&(S+=2*C)}for(let k=0;k<m.length;k++)m[k]=m[k]/S;f.envMap.value=e.texture,f.samples.value=g,f.weights.value=m,f.latitudinal.value=a==="latitudinal",o&&(f.poleAxis.value=o);const{_lodMax:y}=this;f.dTheta.value=_,f.mipInt.value=y-n;const M=this._sizeLods[r],T=3*M*(r>y-wr?r-y+wr:0),R=4*(this._cubeSize-M);da(t,T,R,3*M,2*M),l.setRenderTarget(t),l.render(u,kl)}}function n0(i){const e=[],t=[],n=[];let r=i;const s=i-wr+1+Lh.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>i-wr?l=Lh[a-i+wr-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,u=1+c,f=[h,h,u,h,u,u,h,h,u,u,h,u],d=6,_=6,b=3,g=2,m=1,S=new Float32Array(b*_*d),y=new Float32Array(g*_*d),M=new Float32Array(m*_*d);for(let R=0;R<d;R++){const k=R%3*2/3-1,B=R>2?0:-1,C=[k,B,0,k+2/3,B,0,k+2/3,B+1,0,k,B,0,k+2/3,B+1,0,k,B+1,0];S.set(C,b*_*R),y.set(f,g*_*R);const D=[R,R,R,R,R,R];M.set(D,m*_*R)}const T=new En;T.setAttribute("position",new Zt(S,b)),T.setAttribute("uv",new Zt(y,g)),T.setAttribute("faceIndex",new Zt(M,m)),e.push(T),r>wr&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Oh(i,e,t){const n=new Ti(i,e,t);return n.texture.mapping=Rs,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function da(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function i0(i,e,t){const n=new Float32Array(Li),r=new $(0,1,0);return new fi({name:"SphericalGaussianBlur",defines:{n:Li,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Gl(),fragmentShader:`
|
|
3617
|
+
}`},Ie={common:{diffuse:{value:new et(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new nt},alphaMap:{value:null},alphaMapTransform:{value:new nt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new nt}},envmap:{envMap:{value:null},envMapRotation:{value:new nt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new nt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new nt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new nt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new nt},normalScale:{value:new Je(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new nt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new nt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new nt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new nt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new et(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new et(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new nt},alphaTest:{value:0},uvTransform:{value:new nt}},sprite:{diffuse:{value:new et(16777215)},opacity:{value:1},center:{value:new Je(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new nt},alphaMap:{value:null},alphaMapTransform:{value:new nt},alphaTest:{value:0}}},Bn={basic:{uniforms:tn([Ie.common,Ie.specularmap,Ie.envmap,Ie.aomap,Ie.lightmap,Ie.fog]),vertexShader:st.meshbasic_vert,fragmentShader:st.meshbasic_frag},lambert:{uniforms:tn([Ie.common,Ie.specularmap,Ie.envmap,Ie.aomap,Ie.lightmap,Ie.emissivemap,Ie.bumpmap,Ie.normalmap,Ie.displacementmap,Ie.fog,Ie.lights,{emissive:{value:new et(0)}}]),vertexShader:st.meshlambert_vert,fragmentShader:st.meshlambert_frag},phong:{uniforms:tn([Ie.common,Ie.specularmap,Ie.envmap,Ie.aomap,Ie.lightmap,Ie.emissivemap,Ie.bumpmap,Ie.normalmap,Ie.displacementmap,Ie.fog,Ie.lights,{emissive:{value:new et(0)},specular:{value:new et(1118481)},shininess:{value:30}}]),vertexShader:st.meshphong_vert,fragmentShader:st.meshphong_frag},standard:{uniforms:tn([Ie.common,Ie.envmap,Ie.aomap,Ie.lightmap,Ie.emissivemap,Ie.bumpmap,Ie.normalmap,Ie.displacementmap,Ie.roughnessmap,Ie.metalnessmap,Ie.fog,Ie.lights,{emissive:{value:new et(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:st.meshphysical_vert,fragmentShader:st.meshphysical_frag},toon:{uniforms:tn([Ie.common,Ie.aomap,Ie.lightmap,Ie.emissivemap,Ie.bumpmap,Ie.normalmap,Ie.displacementmap,Ie.gradientmap,Ie.fog,Ie.lights,{emissive:{value:new et(0)}}]),vertexShader:st.meshtoon_vert,fragmentShader:st.meshtoon_frag},matcap:{uniforms:tn([Ie.common,Ie.bumpmap,Ie.normalmap,Ie.displacementmap,Ie.fog,{matcap:{value:null}}]),vertexShader:st.meshmatcap_vert,fragmentShader:st.meshmatcap_frag},points:{uniforms:tn([Ie.points,Ie.fog]),vertexShader:st.points_vert,fragmentShader:st.points_frag},dashed:{uniforms:tn([Ie.common,Ie.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:st.linedashed_vert,fragmentShader:st.linedashed_frag},depth:{uniforms:tn([Ie.common,Ie.displacementmap]),vertexShader:st.depth_vert,fragmentShader:st.depth_frag},normal:{uniforms:tn([Ie.common,Ie.bumpmap,Ie.normalmap,Ie.displacementmap,{opacity:{value:1}}]),vertexShader:st.meshnormal_vert,fragmentShader:st.meshnormal_frag},sprite:{uniforms:tn([Ie.sprite,Ie.fog]),vertexShader:st.sprite_vert,fragmentShader:st.sprite_frag},background:{uniforms:{uvTransform:{value:new nt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:st.background_vert,fragmentShader:st.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new nt}},vertexShader:st.backgroundCube_vert,fragmentShader:st.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:st.cube_vert,fragmentShader:st.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:st.equirect_vert,fragmentShader:st.equirect_frag},distanceRGBA:{uniforms:tn([Ie.common,Ie.displacementmap,{referencePosition:{value:new $},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:st.distanceRGBA_vert,fragmentShader:st.distanceRGBA_frag},shadow:{uniforms:tn([Ie.lights,Ie.fog,{color:{value:new et(0)},opacity:{value:1}}]),vertexShader:st.shadow_vert,fragmentShader:st.shadow_frag}};Bn.physical={uniforms:tn([Bn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new nt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new nt},clearcoatNormalScale:{value:new Je(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new nt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new nt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new nt},sheen:{value:0},sheenColor:{value:new et(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new nt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new nt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new nt},transmissionSamplerSize:{value:new Je},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new nt},attenuationDistance:{value:0},attenuationColor:{value:new et(0)},specularColor:{value:new et(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new nt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new nt},anisotropyVector:{value:new Je},anisotropyMap:{value:null},anisotropyMapTransform:{value:new nt}}]),vertexShader:st.meshphysical_vert,fragmentShader:st.meshphysical_frag};const oa={r:0,b:0,g:0},Ii=new On,wv=new it;function Av(i,e,t,n,r,s,a){const o=new et(0);let l=s===!0?0:1,c,h,u=null,f=0,d=null;function _(y){let M=y.isScene===!0?y.background:null;return M&&M.isTexture&&(M=(y.backgroundBlurriness>0?t:e).get(M)),M}function b(y){let M=!1;const T=_(y);T===null?m(o,l):T&&T.isColor&&(m(T,1),M=!0);const R=i.xr.getEnvironmentBlendMode();R==="additive"?n.buffers.color.setClear(0,0,0,1,a):R==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||M)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function g(y,M){const T=_(M);T&&(T.isCubeTexture||T.mapping===Ts)?(h===void 0&&(h=new Yt(new pr(1,1,1),new ei({name:"BackgroundCubeMaterial",uniforms:mr(Bn.backgroundCube.uniforms),vertexShader:Bn.backgroundCube.vertexShader,fragmentShader:Bn.backgroundCube.fragmentShader,side:on,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(R,k,B){this.matrixWorld.copyPosition(B.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),Ii.copy(M.backgroundRotation),Ii.x*=-1,Ii.y*=-1,Ii.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(Ii.y*=-1,Ii.z*=-1),h.material.uniforms.envMap.value=T,h.material.uniforms.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=M.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(wv.makeRotationFromEuler(Ii)),h.material.toneMapped=ht.getTransfer(T.colorSpace)!==Mt,(u!==T||f!==T.version||d!==i.toneMapping)&&(h.material.needsUpdate=!0,u=T,f=T.version,d=i.toneMapping),h.layers.enableAll(),y.unshift(h,h.geometry,h.material,0,0,null)):T&&T.isTexture&&(c===void 0&&(c=new Yt(new as(2,2),new ei({name:"BackgroundMaterial",uniforms:mr(Bn.background.uniforms),vertexShader:Bn.background.vertexShader,fragmentShader:Bn.background.fragmentShader,side:Xn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=T,c.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,c.material.toneMapped=ht.getTransfer(T.colorSpace)!==Mt,T.matrixAutoUpdate===!0&&T.updateMatrix(),c.material.uniforms.uvTransform.value.copy(T.matrix),(u!==T||f!==T.version||d!==i.toneMapping)&&(c.material.needsUpdate=!0,u=T,f=T.version,d=i.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null))}function m(y,M){y.getRGB(oa,Gu(i)),n.buffers.color.setClear(oa.r,oa.g,oa.b,M,a)}function S(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(y,M=1){o.set(y),l=M,m(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(y){l=y,m(o,l)},render:b,addToRenderList:g,dispose:S}}function Rv(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=f(null);let s=r,a=!1;function o(D,V,K,J,se){let he=!1;const Q=u(J,K,V);s!==Q&&(s=Q,c(s.object)),he=d(D,J,K,se),he&&_(D,J,K,se),se!==null&&e.update(se,i.ELEMENT_ARRAY_BUFFER),(he||a)&&(a=!1,M(D,V,K,J),se!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(se).buffer))}function l(){return i.createVertexArray()}function c(D){return i.bindVertexArray(D)}function h(D){return i.deleteVertexArray(D)}function u(D,V,K){const J=K.wireframe===!0;let se=n[D.id];se===void 0&&(se={},n[D.id]=se);let he=se[V.id];he===void 0&&(he={},se[V.id]=he);let Q=he[J];return Q===void 0&&(Q=f(l()),he[J]=Q),Q}function f(D){const V=[],K=[],J=[];for(let se=0;se<t;se++)V[se]=0,K[se]=0,J[se]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:V,enabledAttributes:K,attributeDivisors:J,object:D,attributes:{},index:null}}function d(D,V,K,J){const se=s.attributes,he=V.attributes;let Q=0;const de=K.getAttributes();for(const ne in de)if(de[ne].location>=0){const Te=se[ne];let ke=he[ne];if(ke===void 0&&(ne==="instanceMatrix"&&D.instanceMatrix&&(ke=D.instanceMatrix),ne==="instanceColor"&&D.instanceColor&&(ke=D.instanceColor)),Te===void 0||Te.attribute!==ke||ke&&Te.data!==ke.data)return!0;Q++}return s.attributesNum!==Q||s.index!==J}function _(D,V,K,J){const se={},he=V.attributes;let Q=0;const de=K.getAttributes();for(const ne in de)if(de[ne].location>=0){let Te=he[ne];Te===void 0&&(ne==="instanceMatrix"&&D.instanceMatrix&&(Te=D.instanceMatrix),ne==="instanceColor"&&D.instanceColor&&(Te=D.instanceColor));const ke={};ke.attribute=Te,Te&&Te.data&&(ke.data=Te.data),se[ne]=ke,Q++}s.attributes=se,s.attributesNum=Q,s.index=J}function b(){const D=s.newAttributes;for(let V=0,K=D.length;V<K;V++)D[V]=0}function g(D){m(D,0)}function m(D,V){const K=s.newAttributes,J=s.enabledAttributes,se=s.attributeDivisors;K[D]=1,J[D]===0&&(i.enableVertexAttribArray(D),J[D]=1),se[D]!==V&&(i.vertexAttribDivisor(D,V),se[D]=V)}function S(){const D=s.newAttributes,V=s.enabledAttributes;for(let K=0,J=V.length;K<J;K++)V[K]!==D[K]&&(i.disableVertexAttribArray(K),V[K]=0)}function y(D,V,K,J,se,he,Q){Q===!0?i.vertexAttribIPointer(D,V,K,se,he):i.vertexAttribPointer(D,V,K,J,se,he)}function M(D,V,K,J){b();const se=J.attributes,he=K.getAttributes(),Q=V.defaultAttributeValues;for(const de in he){const ne=he[de];if(ne.location>=0){let ue=se[de];if(ue===void 0&&(de==="instanceMatrix"&&D.instanceMatrix&&(ue=D.instanceMatrix),de==="instanceColor"&&D.instanceColor&&(ue=D.instanceColor)),ue!==void 0){const Te=ue.normalized,ke=ue.itemSize,O=e.get(ue);if(O===void 0)continue;const H=O.buffer,we=O.type,Be=O.bytesPerElement,ie=we===i.INT||we===i.UNSIGNED_INT||ue.gpuType===eo;if(ue.isInterleavedBufferAttribute){const ce=ue.data,z=ce.stride,q=ue.offset;if(ce.isInstancedInterleavedBuffer){for(let W=0;W<ne.locationSize;W++)m(ne.location+W,ce.meshPerAttribute);D.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=ce.meshPerAttribute*ce.count)}else for(let W=0;W<ne.locationSize;W++)g(ne.location+W);i.bindBuffer(i.ARRAY_BUFFER,H);for(let W=0;W<ne.locationSize;W++)y(ne.location+W,ke/ne.locationSize,we,Te,z*Be,(q+ke/ne.locationSize*W)*Be,ie)}else{if(ue.isInstancedBufferAttribute){for(let ce=0;ce<ne.locationSize;ce++)m(ne.location+ce,ue.meshPerAttribute);D.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=ue.meshPerAttribute*ue.count)}else for(let ce=0;ce<ne.locationSize;ce++)g(ne.location+ce);i.bindBuffer(i.ARRAY_BUFFER,H);for(let ce=0;ce<ne.locationSize;ce++)y(ne.location+ce,ke/ne.locationSize,we,Te,ke*Be,ke/ne.locationSize*ce*Be,ie)}}else if(Q!==void 0){const Te=Q[de];if(Te!==void 0)switch(Te.length){case 2:i.vertexAttrib2fv(ne.location,Te);break;case 3:i.vertexAttrib3fv(ne.location,Te);break;case 4:i.vertexAttrib4fv(ne.location,Te);break;default:i.vertexAttrib1fv(ne.location,Te)}}}}S()}function T(){B();for(const D in n){const V=n[D];for(const K in V){const J=V[K];for(const se in J)h(J[se].object),delete J[se];delete V[K]}delete n[D]}}function R(D){if(n[D.id]===void 0)return;const V=n[D.id];for(const K in V){const J=V[K];for(const se in J)h(J[se].object),delete J[se];delete V[K]}delete n[D.id]}function k(D){for(const V in n){const K=n[V];if(K[D.id]===void 0)continue;const J=K[D.id];for(const se in J)h(J[se].object),delete J[se];delete K[D.id]}}function B(){C(),a=!0,s!==r&&(s=r,c(s.object))}function C(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:B,resetDefaultState:C,dispose:T,releaseStatesOfGeometry:R,releaseStatesOfProgram:k,initAttributes:b,enableAttribute:g,disableUnusedAttributes:S}}function Cv(i,e,t){let n;function r(c){n=c}function s(c,h){i.drawArrays(n,c,h),t.update(h,n,1)}function a(c,h,u){u!==0&&(i.drawArraysInstanced(n,c,h,u),t.update(h,n,u))}function o(c,h,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,h,0,u);let d=0;for(let _=0;_<u;_++)d+=h[_];t.update(d,n,1)}function l(c,h,u,f){if(u===0)return;const d=e.get("WEBGL_multi_draw");if(d===null)for(let _=0;_<c.length;_++)a(c[_],h[_],f[_]);else{d.multiDrawArraysInstancedWEBGL(n,c,0,h,0,f,0,u);let _=0;for(let b=0;b<u;b++)_+=h[b]*f[b];t.update(_,n,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function Pv(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const k=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(k.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(k){return!(k!==ln&&n.convert(k)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(k){const B=k===Wr&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(k!==pn&&n.convert(k)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&k!==xn&&!B)}function l(k){if(k==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";k="mediump"}return k==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const u=t.logarithmicDepthBuffer===!0,f=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),d=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),b=i.getParameter(i.MAX_TEXTURE_SIZE),g=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),m=i.getParameter(i.MAX_VERTEX_ATTRIBS),S=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),y=i.getParameter(i.MAX_VARYING_VECTORS),M=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),T=_>0,R=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,reversedDepthBuffer:f,maxTextures:d,maxVertexTextures:_,maxTextureSize:b,maxCubemapSize:g,maxAttributes:m,maxVertexUniforms:S,maxVaryings:y,maxFragmentUniforms:M,vertexTextures:T,maxSamples:R}}function Dv(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new vi,o=new nt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,f){const d=u.length!==0||f||n!==0||r;return r=f,n=u.length,d},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,f){t=h(u,f,0)},this.setState=function(u,f,d){const _=u.clippingPlanes,b=u.clipIntersection,g=u.clipShadows,m=i.get(u);if(!r||_===null||_.length===0||s&&!g)s?h(null):c();else{const S=s?0:n,y=S*4;let M=m.clippingState||null;l.value=M,M=h(_,f,y,d);for(let T=0;T!==y;++T)M[T]=t[T];m.clippingState=M,this.numIntersection=b?this.numPlanes:0,this.numPlanes+=S}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,f,d,_){const b=u!==null?u.length:0;let g=null;if(b!==0){if(g=l.value,_!==!0||g===null){const m=d+b*4,S=f.matrixWorldInverse;o.getNormalMatrix(S),(g===null||g.length<m)&&(g=new Float32Array(m));for(let y=0,M=d;y!==b;++y,M+=4)a.copy(u[y]).applyMatrix4(S,o),a.normal.toArray(g,M),g[M+3]=a.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=b,e.numIntersection=0,g}}function Lv(i){let e=new WeakMap;function t(a,o){return o===Ja?a.mapping=Ki:o===Qa&&(a.mapping=Zi),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Ja||o===Qa)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new Cm(l.height);return c.fromEquirectangularTexture(i,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const wr=4,Ah=[.125,.215,.35,.446,.526,.582],Ui=20,Dl=new us,Rh=new et;let Ll=null,Il=0,Ul=0,Nl=!1;const Ni=(1+Math.sqrt(5))/2,Ar=1/Ni,Ch=[new $(-Ni,Ar,0),new $(Ni,Ar,0),new $(-Ar,0,Ni),new $(Ar,0,Ni),new $(0,Ni,-Ar),new $(0,Ni,Ar),new $(-1,1,-1),new $(1,1,-1),new $(-1,1,1),new $(1,1,1)],Iv=new $;class Ph{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100,s={}){const{size:a=256,position:o=Iv}=s;Ll=this._renderer.getRenderTarget(),Il=this._renderer.getActiveCubeFace(),Ul=this._renderer.getActiveMipmapLevel(),Nl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Ih(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Lh(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.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(Ll,Il,Ul),this._renderer.xr.enabled=Nl,e.scissorTest=!1,la(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Ki||e.mapping===Zi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Ll=this._renderer.getRenderTarget(),Il=this._renderer.getActiveCubeFace(),Ul=this._renderer.getActiveMipmapLevel(),Nl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;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:Nt,minFilter:Nt,generateMipmaps:!1,type:Wr,format:ln,colorSpace:Qt,depthBuffer:!1},r=Dh(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Dh(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Uv(s)),this._blurMaterial=Nv(s,e,t)}return r}_compileMaterial(e){const t=new Yt(this._lodPlanes[0],e);this._renderer.compile(t,Dl)}_sceneToCubeUV(e,t,n,r,s){const l=new nn(90,1,t,n),c=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,f=u.autoClear,d=u.toneMapping;u.getClearColor(Rh),u.toneMapping=li,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(r),u.clearDepth(),u.setRenderTarget(null));const b=new gi({name:"PMREM.Background",side:on,depthWrite:!1,depthTest:!1}),g=new Yt(new pr,b);let m=!1;const S=e.background;S?S.isColor&&(b.color.copy(S),e.background=null,m=!0):(b.color.copy(Rh),m=!0);for(let y=0;y<6;y++){const M=y%3;M===0?(l.up.set(0,c[y],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+h[y],s.y,s.z)):M===1?(l.up.set(0,0,c[y]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+h[y],s.z)):(l.up.set(0,c[y],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+h[y]));const T=this._cubeSize;la(r,M*T,y>2?T:0,T,T),u.setRenderTarget(r),m&&u.render(g,l),u.render(e,l)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=d,u.autoClear=f,e.background=S}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Ki||e.mapping===Zi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Ih()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Lh());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new Yt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;la(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,Dl)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=Ch[(r-s-1)%Ch.length];this._blur(e,s-1,s,a,o)}t.autoClear=n}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,u=new Yt(this._lodPlanes[r],c),f=c.uniforms,d=this._sizeLods[n]-1,_=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*Ui-1),b=s/_,g=isFinite(s)?1+Math.floor(h*b):Ui;g>Ui&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${Ui}`);const m=[];let S=0;for(let k=0;k<Ui;++k){const B=k/b,C=Math.exp(-B*B/2);m.push(C),k===0?S+=C:k<g&&(S+=2*C)}for(let k=0;k<m.length;k++)m[k]=m[k]/S;f.envMap.value=e.texture,f.samples.value=g,f.weights.value=m,f.latitudinal.value=a==="latitudinal",o&&(f.poleAxis.value=o);const{_lodMax:y}=this;f.dTheta.value=_,f.mipInt.value=y-n;const M=this._sizeLods[r],T=3*M*(r>y-wr?r-y+wr:0),R=4*(this._cubeSize-M);la(t,T,R,3*M,2*M),l.setRenderTarget(t),l.render(u,Dl)}}function Uv(i){const e=[],t=[],n=[];let r=i;const s=i-wr+1+Ah.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>i-wr?l=Ah[a-i+wr-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,u=1+c,f=[h,h,u,h,u,u,h,h,u,u,h,u],d=6,_=6,b=3,g=2,m=1,S=new Float32Array(b*_*d),y=new Float32Array(g*_*d),M=new Float32Array(m*_*d);for(let R=0;R<d;R++){const k=R%3*2/3-1,B=R>2?0:-1,C=[k,B,0,k+2/3,B,0,k+2/3,B+1,0,k,B,0,k+2/3,B+1,0,k,B+1,0];S.set(C,b*_*R),y.set(f,g*_*R);const D=[R,R,R,R,R,R];M.set(D,m*_*R)}const T=new An;T.setAttribute("position",new en(S,b)),T.setAttribute("uv",new en(y,g)),T.setAttribute("faceIndex",new en(M,m)),e.push(T),r>wr&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Dh(i,e,t){const n=new jn(i,e,t);return n.texture.mapping=Ts,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function la(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Nv(i,e,t){const n=new Float32Array(Ui),r=new $(0,1,0);return new ei({name:"SphericalGaussianBlur",defines:{n:Ui,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Ol(),fragmentShader:`
|
|
3621
3618
|
|
|
3622
3619
|
precision mediump float;
|
|
3623
3620
|
precision mediump int;
|
|
@@ -3677,7 +3674,7 @@ void main() {
|
|
|
3677
3674
|
}
|
|
3678
3675
|
|
|
3679
3676
|
}
|
|
3680
|
-
`,blending:
|
|
3677
|
+
`,blending:oi,depthTest:!1,depthWrite:!1})}function Lh(){return new ei({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ol(),fragmentShader:`
|
|
3681
3678
|
|
|
3682
3679
|
precision mediump float;
|
|
3683
3680
|
precision mediump int;
|
|
@@ -3696,7 +3693,7 @@ void main() {
|
|
|
3696
3693
|
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
3697
3694
|
|
|
3698
3695
|
}
|
|
3699
|
-
`,blending:
|
|
3696
|
+
`,blending:oi,depthTest:!1,depthWrite:!1})}function Ih(){return new ei({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ol(),fragmentShader:`
|
|
3700
3697
|
|
|
3701
3698
|
precision mediump float;
|
|
3702
3699
|
precision mediump int;
|
|
@@ -3712,7 +3709,7 @@ void main() {
|
|
|
3712
3709
|
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|
3713
3710
|
|
|
3714
3711
|
}
|
|
3715
|
-
`,blending:
|
|
3712
|
+
`,blending:oi,depthTest:!1,depthWrite:!1})}function Ol(){return`
|
|
3716
3713
|
|
|
3717
3714
|
precision mediump float;
|
|
3718
3715
|
precision mediump int;
|
|
@@ -3767,17 +3764,17 @@ void main() {
|
|
|
3767
3764
|
gl_Position = vec4( position, 1.0 );
|
|
3768
3765
|
|
|
3769
3766
|
}
|
|
3770
|
-
`}function r0(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===lo||l===co,h=l===Zi||l===Ji;if(c||h){let u=e.get(o);const f=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==f)return t===null&&(t=new Nh(i)),u=c?t.fromEquirectangular(o,u):t.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),u.texture;if(u!==void 0)return u.texture;{const d=o.image;return c&&d&&d.height>0||h&&d&&r(d)?(t===null&&(t=new Nh(i)),u=c?t.fromEquirectangular(o):t.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),o.addEventListener("dispose",s),u.texture):null}}}return o}function r(o){let l=0;const c=6;for(let h=0;h<c;h++)o[h]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function s0(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&Jr("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function a0(i,e,t,n){const r={},s=new WeakMap;function a(u){const f=u.target;f.index!==null&&e.remove(f.index);for(const _ in f.attributes)e.remove(f.attributes[_]);f.removeEventListener("dispose",a),delete r[f.id];const d=s.get(f);d&&(e.remove(d),s.delete(f)),n.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function o(u,f){return r[f.id]===!0||(f.addEventListener("dispose",a),r[f.id]=!0,t.memory.geometries++),f}function l(u){const f=u.attributes;for(const d in f)e.update(f[d],i.ARRAY_BUFFER)}function c(u){const f=[],d=u.index,_=u.attributes.position;let b=0;if(d!==null){const S=d.array;b=d.version;for(let y=0,M=S.length;y<M;y+=3){const T=S[y+0],R=S[y+1],k=S[y+2];f.push(T,R,R,k,k,T)}}else if(_!==void 0){const S=_.array;b=_.version;for(let y=0,M=S.length/3-1;y<M;y+=3){const T=y+0,R=y+1,k=y+2;f.push(T,R,R,k,k,T)}}else return;const g=new(Pu(f)?Xu:Wu)(f,1);g.version=b;const m=s.get(u);m&&e.remove(m),s.set(u,g)}function h(u){const f=s.get(u);if(f){const d=u.index;d!==null&&f.version<d.version&&c(u)}else c(u);return s.get(u)}return{get:o,update:l,getWireframeAttribute:h}}function o0(i,e,t){let n;function r(f){n=f}let s,a;function o(f){s=f.type,a=f.bytesPerElement}function l(f,d){i.drawElements(n,d,s,f*a),t.update(d,n,1)}function c(f,d,_){_!==0&&(i.drawElementsInstanced(n,d,s,f*a,_),t.update(d,n,_))}function h(f,d,_){if(_===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,d,0,s,f,0,_);let g=0;for(let m=0;m<_;m++)g+=d[m];t.update(g,n,1)}function u(f,d,_,b){if(_===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let m=0;m<f.length;m++)c(f[m]/a,d[m],b[m]);else{g.multiDrawElementsInstancedWEBGL(n,d,0,s,f,0,b,0,_);let m=0;for(let S=0;S<_;S++)m+=d[S]*b[S];t.update(m,n,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=u}function l0(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function c0(i,e,t){const n=new WeakMap,r=new pt;function s(a,o,l){const c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=h!==void 0?h.length:0;let f=n.get(o);if(f===void 0||f.count!==u){let C=function(){k.dispose(),n.delete(o),o.removeEventListener("dispose",C)};f!==void 0&&f.texture.dispose();const d=o.morphAttributes.position!==void 0,_=o.morphAttributes.normal!==void 0,b=o.morphAttributes.color!==void 0,g=o.morphAttributes.position||[],m=o.morphAttributes.normal||[],S=o.morphAttributes.color||[];let y=0;d===!0&&(y=1),_===!0&&(y=2),b===!0&&(y=3);let M=o.attributes.position.count*y,T=1;M>e.maxTextureSize&&(T=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const R=new Float32Array(M*T*4*u),k=new Uu(R,M,T,u);k.type=_n,k.needsUpdate=!0;const B=y*4;for(let D=0;D<u;D++){const V=g[D],K=m[D],J=S[D],se=M*T*4*D;for(let he=0;he<V.count;he++){const Q=he*B;d===!0&&(r.fromBufferAttribute(V,he),R[se+Q+0]=r.x,R[se+Q+1]=r.y,R[se+Q+2]=r.z,R[se+Q+3]=0),_===!0&&(r.fromBufferAttribute(K,he),R[se+Q+4]=r.x,R[se+Q+5]=r.y,R[se+Q+6]=r.z,R[se+Q+7]=0),b===!0&&(r.fromBufferAttribute(J,he),R[se+Q+8]=r.x,R[se+Q+9]=r.y,R[se+Q+10]=r.z,R[se+Q+11]=J.itemSize===4?r.w:1)}}f={count:u,texture:k,size:new Ye(M,T)},n.set(o,f),o.addEventListener("dispose",C)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let d=0;for(let b=0;b<c.length;b++)d+=c[b];const _=o.morphTargetsRelative?1:1-d;l.getUniforms().setValue(i,"morphTargetBaseInfluence",_),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",f.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",f.size)}return{update:s}}function u0(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,h=l.geometry,u=e.get(l,h);if(r.get(u)!==c&&(e.update(u),r.set(u,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),r.get(l)!==c&&(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,i.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const f=l.skeleton;r.get(f)!==c&&(f.update(),r.set(f,c))}return u}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}const Bh=new zt,zh=new vh(1,1),Hh=new Uu,Vh=new Um,Gh=new Qu,Wh=[],Xh=[],$h=new Float32Array(16),jh=new Float32Array(9),qh=new Float32Array(4);function Rr(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=Wh[r];if(s===void 0&&(s=new Float32Array(r),Wh[r]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(s,o)}return s}function Ut(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function Nt(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function pa(i,e){let t=Xh[e];t===void 0&&(t=new Int32Array(e),Xh[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function h0(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function f0(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ut(t,e))return;i.uniform2fv(this.addr,e),Nt(t,e)}}function d0(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Ut(t,e))return;i.uniform3fv(this.addr,e),Nt(t,e)}}function p0(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ut(t,e))return;i.uniform4fv(this.addr,e),Nt(t,e)}}function m0(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ut(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),Nt(t,e)}else{if(Ut(t,n))return;qh.set(n),i.uniformMatrix2fv(this.addr,!1,qh),Nt(t,n)}}function g0(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ut(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),Nt(t,e)}else{if(Ut(t,n))return;jh.set(n),i.uniformMatrix3fv(this.addr,!1,jh),Nt(t,n)}}function _0(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ut(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),Nt(t,e)}else{if(Ut(t,n))return;$h.set(n),i.uniformMatrix4fv(this.addr,!1,$h),Nt(t,n)}}function v0(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function y0(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ut(t,e))return;i.uniform2iv(this.addr,e),Nt(t,e)}}function x0(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Ut(t,e))return;i.uniform3iv(this.addr,e),Nt(t,e)}}function b0(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ut(t,e))return;i.uniform4iv(this.addr,e),Nt(t,e)}}function S0(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function M0(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ut(t,e))return;i.uniform2uiv(this.addr,e),Nt(t,e)}}function E0(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Ut(t,e))return;i.uniform3uiv(this.addr,e),Nt(t,e)}}function T0(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ut(t,e))return;i.uniform4uiv(this.addr,e),Nt(t,e)}}function w0(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(zh.compareFunction=Tu,s=zh):s=Bh,t.setTexture2D(e||s,r)}function A0(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||Vh,r)}function R0(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||Gh,r)}function C0(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||Hh,r)}function P0(i){switch(i){case 5126:return h0;case 35664:return f0;case 35665:return d0;case 35666:return p0;case 35674:return m0;case 35675:return g0;case 35676:return _0;case 5124:case 35670:return v0;case 35667:case 35671:return y0;case 35668:case 35672:return x0;case 35669:case 35673:return b0;case 5125:return S0;case 36294:return M0;case 36295:return E0;case 36296:return T0;case 35678:case 36198:case 36298:case 36306:case 35682:return w0;case 35679:case 36299:case 36307:return A0;case 35680:case 36300:case 36308:case 36293:return R0;case 36289:case 36303:case 36311:case 36292:return C0}}function D0(i,e){i.uniform1fv(this.addr,e)}function L0(i,e){const t=Rr(e,this.size,2);i.uniform2fv(this.addr,t)}function I0(i,e){const t=Rr(e,this.size,3);i.uniform3fv(this.addr,t)}function U0(i,e){const t=Rr(e,this.size,4);i.uniform4fv(this.addr,t)}function N0(i,e){const t=Rr(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function O0(i,e){const t=Rr(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function F0(i,e){const t=Rr(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function k0(i,e){i.uniform1iv(this.addr,e)}function B0(i,e){i.uniform2iv(this.addr,e)}function z0(i,e){i.uniform3iv(this.addr,e)}function H0(i,e){i.uniform4iv(this.addr,e)}function V0(i,e){i.uniform1uiv(this.addr,e)}function G0(i,e){i.uniform2uiv(this.addr,e)}function W0(i,e){i.uniform3uiv(this.addr,e)}function X0(i,e){i.uniform4uiv(this.addr,e)}function $0(i,e,t){const n=this.cache,r=e.length,s=pa(t,r);Ut(n,s)||(i.uniform1iv(this.addr,s),Nt(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||Bh,s[a])}function j0(i,e,t){const n=this.cache,r=e.length,s=pa(t,r);Ut(n,s)||(i.uniform1iv(this.addr,s),Nt(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Vh,s[a])}function q0(i,e,t){const n=this.cache,r=e.length,s=pa(t,r);Ut(n,s)||(i.uniform1iv(this.addr,s),Nt(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Gh,s[a])}function Y0(i,e,t){const n=this.cache,r=e.length,s=pa(t,r);Ut(n,s)||(i.uniform1iv(this.addr,s),Nt(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Hh,s[a])}function K0(i){switch(i){case 5126:return D0;case 35664:return L0;case 35665:return I0;case 35666:return U0;case 35674:return N0;case 35675:return O0;case 35676:return F0;case 5124:case 35670:return k0;case 35667:case 35671:return B0;case 35668:case 35672:return z0;case 35669:case 35673:return H0;case 5125:return V0;case 36294:return G0;case 36295:return W0;case 36296:return X0;case 35678:case 36198:case 36298:case 36306:case 35682:return $0;case 35679:case 36299:case 36307:return j0;case 35680:case 36300:case 36308:case 36293:return q0;case 36289:case 36303:case 36311:case 36292:return Y0}}class Z0{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=P0(t.type)}}class J0{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=K0(t.type)}}class Q0{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],n)}}}const Wl=/(\w+)(\])?(\[|\.)?/g;function Yh(i,e){i.seq.push(e),i.map[e.id]=e}function ey(i,e,t){const n=i.name,r=n.length;for(Wl.lastIndex=0;;){const s=Wl.exec(n),a=Wl.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){Yh(t,c===void 0?new Z0(o,i,e):new J0(o,i,e));break}else{let u=t.map[o];u===void 0&&(u=new Q0(o),Yh(t,u)),t=u}}}class ma{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);ey(s,a,this)}}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function Kh(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const ty=37297;let ny=0;function iy(i,e){const t=i.split(`
|
|
3767
|
+
`}function Ov(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Ja||l===Qa,h=l===Ki||l===Zi;if(c||h){let u=e.get(o);const f=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==f)return t===null&&(t=new Ph(i)),u=c?t.fromEquirectangular(o,u):t.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),u.texture;if(u!==void 0)return u.texture;{const d=o.image;return c&&d&&d.height>0||h&&d&&r(d)?(t===null&&(t=new Ph(i)),u=c?t.fromEquirectangular(o):t.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),o.addEventListener("dispose",s),u.texture):null}}}return o}function r(o){let l=0;const c=6;for(let h=0;h<c;h++)o[h]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function Fv(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&Jr("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function kv(i,e,t,n){const r={},s=new WeakMap;function a(u){const f=u.target;f.index!==null&&e.remove(f.index);for(const _ in f.attributes)e.remove(f.attributes[_]);f.removeEventListener("dispose",a),delete r[f.id];const d=s.get(f);d&&(e.remove(d),s.delete(f)),n.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function o(u,f){return r[f.id]===!0||(f.addEventListener("dispose",a),r[f.id]=!0,t.memory.geometries++),f}function l(u){const f=u.attributes;for(const d in f)e.update(f[d],i.ARRAY_BUFFER)}function c(u){const f=[],d=u.index,_=u.attributes.position;let b=0;if(d!==null){const S=d.array;b=d.version;for(let y=0,M=S.length;y<M;y+=3){const T=S[y+0],R=S[y+1],k=S[y+2];f.push(T,R,R,k,k,T)}}else if(_!==void 0){const S=_.array;b=_.version;for(let y=0,M=S.length/3-1;y<M;y+=3){const T=y+0,R=y+1,k=y+2;f.push(T,R,R,k,k,T)}}else return;const g=new(Eu(f)?Bu:ku)(f,1);g.version=b;const m=s.get(u);m&&e.remove(m),s.set(u,g)}function h(u){const f=s.get(u);if(f){const d=u.index;d!==null&&f.version<d.version&&c(u)}else c(u);return s.get(u)}return{get:o,update:l,getWireframeAttribute:h}}function Bv(i,e,t){let n;function r(f){n=f}let s,a;function o(f){s=f.type,a=f.bytesPerElement}function l(f,d){i.drawElements(n,d,s,f*a),t.update(d,n,1)}function c(f,d,_){_!==0&&(i.drawElementsInstanced(n,d,s,f*a,_),t.update(d,n,_))}function h(f,d,_){if(_===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,d,0,s,f,0,_);let g=0;for(let m=0;m<_;m++)g+=d[m];t.update(g,n,1)}function u(f,d,_,b){if(_===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let m=0;m<f.length;m++)c(f[m]/a,d[m],b[m]);else{g.multiDrawElementsInstancedWEBGL(n,d,0,s,f,0,b,0,_);let m=0;for(let S=0;S<_;S++)m+=d[S]*b[S];t.update(m,n,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=u}function zv(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function Hv(i,e,t){const n=new WeakMap,r=new dt;function s(a,o,l){const c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=h!==void 0?h.length:0;let f=n.get(o);if(f===void 0||f.count!==u){let C=function(){k.dispose(),n.delete(o),o.removeEventListener("dispose",C)};f!==void 0&&f.texture.dispose();const d=o.morphAttributes.position!==void 0,_=o.morphAttributes.normal!==void 0,b=o.morphAttributes.color!==void 0,g=o.morphAttributes.position||[],m=o.morphAttributes.normal||[],S=o.morphAttributes.color||[];let y=0;d===!0&&(y=1),_===!0&&(y=2),b===!0&&(y=3);let M=o.attributes.position.count*y,T=1;M>e.maxTextureSize&&(T=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const R=new Float32Array(M*T*4*u),k=new Ru(R,M,T,u);k.type=xn,k.needsUpdate=!0;const B=y*4;for(let D=0;D<u;D++){const V=g[D],K=m[D],J=S[D],se=M*T*4*D;for(let he=0;he<V.count;he++){const Q=he*B;d===!0&&(r.fromBufferAttribute(V,he),R[se+Q+0]=r.x,R[se+Q+1]=r.y,R[se+Q+2]=r.z,R[se+Q+3]=0),_===!0&&(r.fromBufferAttribute(K,he),R[se+Q+4]=r.x,R[se+Q+5]=r.y,R[se+Q+6]=r.z,R[se+Q+7]=0),b===!0&&(r.fromBufferAttribute(J,he),R[se+Q+8]=r.x,R[se+Q+9]=r.y,R[se+Q+10]=r.z,R[se+Q+11]=J.itemSize===4?r.w:1)}}f={count:u,texture:k,size:new Je(M,T)},n.set(o,f),o.addEventListener("dispose",C)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let d=0;for(let b=0;b<c.length;b++)d+=c[b];const _=o.morphTargetsRelative?1:1-d;l.getUniforms().setValue(i,"morphTargetBaseInfluence",_),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",f.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",f.size)}return{update:s}}function Vv(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,h=l.geometry,u=e.get(l,h);if(r.get(u)!==c&&(e.update(u),r.set(u,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),r.get(l)!==c&&(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,i.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const f=l.skeleton;r.get(f)!==c&&(f.update(),r.set(f,c))}return u}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}const Uh=new Dt,Nh=new bl(1,1),Oh=new Ru,Fh=new fm,kh=new qu,Bh=[],zh=[],Hh=new Float32Array(16),Vh=new Float32Array(9),Gh=new Float32Array(4);function Rr(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=Bh[r];if(s===void 0&&(s=new Float32Array(r),Bh[r]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(s,o)}return s}function Ot(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function Ft(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function ca(i,e){let t=zh[e];t===void 0&&(t=new Int32Array(e),zh[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Gv(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function Wv(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ot(t,e))return;i.uniform2fv(this.addr,e),Ft(t,e)}}function Xv(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Ot(t,e))return;i.uniform3fv(this.addr,e),Ft(t,e)}}function $v(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ot(t,e))return;i.uniform4fv(this.addr,e),Ft(t,e)}}function qv(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ot(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),Ft(t,e)}else{if(Ot(t,n))return;Gh.set(n),i.uniformMatrix2fv(this.addr,!1,Gh),Ft(t,n)}}function jv(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ot(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),Ft(t,e)}else{if(Ot(t,n))return;Vh.set(n),i.uniformMatrix3fv(this.addr,!1,Vh),Ft(t,n)}}function Yv(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Ot(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),Ft(t,e)}else{if(Ot(t,n))return;Hh.set(n),i.uniformMatrix4fv(this.addr,!1,Hh),Ft(t,n)}}function Kv(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function Zv(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ot(t,e))return;i.uniform2iv(this.addr,e),Ft(t,e)}}function Jv(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Ot(t,e))return;i.uniform3iv(this.addr,e),Ft(t,e)}}function Qv(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ot(t,e))return;i.uniform4iv(this.addr,e),Ft(t,e)}}function e0(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function t0(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ot(t,e))return;i.uniform2uiv(this.addr,e),Ft(t,e)}}function n0(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Ot(t,e))return;i.uniform3uiv(this.addr,e),Ft(t,e)}}function i0(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ot(t,e))return;i.uniform4uiv(this.addr,e),Ft(t,e)}}function r0(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(Nh.compareFunction=xu,s=Nh):s=Uh,t.setTexture2D(e||s,r)}function s0(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||Fh,r)}function a0(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||kh,r)}function o0(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||Oh,r)}function l0(i){switch(i){case 5126:return Gv;case 35664:return Wv;case 35665:return Xv;case 35666:return $v;case 35674:return qv;case 35675:return jv;case 35676:return Yv;case 5124:case 35670:return Kv;case 35667:case 35671:return Zv;case 35668:case 35672:return Jv;case 35669:case 35673:return Qv;case 5125:return e0;case 36294:return t0;case 36295:return n0;case 36296:return i0;case 35678:case 36198:case 36298:case 36306:case 35682:return r0;case 35679:case 36299:case 36307:return s0;case 35680:case 36300:case 36308:case 36293:return a0;case 36289:case 36303:case 36311:case 36292:return o0}}function c0(i,e){i.uniform1fv(this.addr,e)}function u0(i,e){const t=Rr(e,this.size,2);i.uniform2fv(this.addr,t)}function h0(i,e){const t=Rr(e,this.size,3);i.uniform3fv(this.addr,t)}function f0(i,e){const t=Rr(e,this.size,4);i.uniform4fv(this.addr,t)}function d0(i,e){const t=Rr(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function p0(i,e){const t=Rr(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function m0(i,e){const t=Rr(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function g0(i,e){i.uniform1iv(this.addr,e)}function _0(i,e){i.uniform2iv(this.addr,e)}function v0(i,e){i.uniform3iv(this.addr,e)}function y0(i,e){i.uniform4iv(this.addr,e)}function x0(i,e){i.uniform1uiv(this.addr,e)}function b0(i,e){i.uniform2uiv(this.addr,e)}function S0(i,e){i.uniform3uiv(this.addr,e)}function M0(i,e){i.uniform4uiv(this.addr,e)}function E0(i,e,t){const n=this.cache,r=e.length,s=ca(t,r);Ot(n,s)||(i.uniform1iv(this.addr,s),Ft(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||Uh,s[a])}function T0(i,e,t){const n=this.cache,r=e.length,s=ca(t,r);Ot(n,s)||(i.uniform1iv(this.addr,s),Ft(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Fh,s[a])}function w0(i,e,t){const n=this.cache,r=e.length,s=ca(t,r);Ot(n,s)||(i.uniform1iv(this.addr,s),Ft(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||kh,s[a])}function A0(i,e,t){const n=this.cache,r=e.length,s=ca(t,r);Ot(n,s)||(i.uniform1iv(this.addr,s),Ft(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Oh,s[a])}function R0(i){switch(i){case 5126:return c0;case 35664:return u0;case 35665:return h0;case 35666:return f0;case 35674:return d0;case 35675:return p0;case 35676:return m0;case 5124:case 35670:return g0;case 35667:case 35671:return _0;case 35668:case 35672:return v0;case 35669:case 35673:return y0;case 5125:return x0;case 36294:return b0;case 36295:return S0;case 36296:return M0;case 35678:case 36198:case 36298:case 36306:case 35682:return E0;case 35679:case 36299:case 36307:return T0;case 35680:case 36300:case 36308:case 36293:return w0;case 36289:case 36303:case 36311:case 36292:return A0}}class C0{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=l0(t.type)}}class P0{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=R0(t.type)}}class D0{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],n)}}}const Fl=/(\w+)(\])?(\[|\.)?/g;function Wh(i,e){i.seq.push(e),i.map[e.id]=e}function L0(i,e,t){const n=i.name,r=n.length;for(Fl.lastIndex=0;;){const s=Fl.exec(n),a=Fl.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){Wh(t,c===void 0?new C0(o,i,e):new P0(o,i,e));break}else{let u=t.map[o];u===void 0&&(u=new D0(o),Wh(t,u)),t=u}}}class ua{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);L0(s,a,this)}}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function Xh(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const I0=37297;let U0=0;function N0(i,e){const t=i.split(`
|
|
3771
3768
|
`),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`
|
|
3772
|
-
`)}const
|
|
3769
|
+
`)}const $h=new nt;function O0(i){ht._getMatrix($h,ht.workingColorSpace,i);const e=`mat3( ${$h.elements.map(t=>t.toFixed(4))} )`;switch(ht.getTransfer(i)){case Ls:return[e,"LinearTransferOETF"];case Mt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function qh(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+`
|
|
3773
3770
|
|
|
3774
3771
|
`+s+`
|
|
3775
3772
|
|
|
3776
|
-
`+
|
|
3777
|
-
`)}function
|
|
3778
|
-
`)}function
|
|
3779
|
-
`)}function
|
|
3780
|
-
`)}function
|
|
3773
|
+
`+N0(i.getShaderSource(e),o)}else return s}function F0(i,e){const t=O0(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
|
|
3774
|
+
`)}function k0(i,e){let t;switch(e){case Ep:t="Linear";break;case Tp:t="Reinhard";break;case wp:t="Cineon";break;case iu:t="ACESFilmic";break;case Rp:t="AgX";break;case Cp:t="Neutral";break;case Ap:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const ha=new $;function B0(){ht.getLuminanceCoefficients(ha);const i=ha.x.toFixed(4),e=ha.y.toFixed(4),t=ha.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
|
|
3775
|
+
`)}function z0(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(fs).join(`
|
|
3776
|
+
`)}function H0(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
|
|
3777
|
+
`)}function V0(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),a=s.name;let o=1;s.type===i.FLOAT_MAT2&&(o=2),s.type===i.FLOAT_MAT3&&(o=3),s.type===i.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:i.getAttribLocation(e,a),locationSize:o}}return t}function fs(i){return i!==""}function jh(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Yh(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const G0=/^[ \t]*#include +<([\w\d./]+)>/gm;function kl(i){return i.replace(G0,X0)}const W0=new Map;function X0(i,e){let t=st[e];if(t===void 0){const n=W0.get(e);if(n!==void 0)t=st[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return kl(t)}const $0=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Kh(i){return i.replace($0,q0)}function q0(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Zh(i){let e=`precision ${i.precision} float;
|
|
3781
3778
|
precision ${i.precision} int;
|
|
3782
3779
|
precision ${i.precision} sampler2D;
|
|
3783
3780
|
precision ${i.precision} samplerCube;
|
|
@@ -3797,30 +3794,30 @@ void main() {
|
|
|
3797
3794
|
`;return i.precision==="highp"?e+=`
|
|
3798
3795
|
#define HIGH_PRECISION`:i.precision==="mediump"?e+=`
|
|
3799
3796
|
#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`
|
|
3800
|
-
#define LOW_PRECISION`),e}function
|
|
3801
|
-
`:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(
|
|
3797
|
+
#define LOW_PRECISION`),e}function j0(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===Jc?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===ip?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===Wn&&(e="SHADOWMAP_TYPE_VSM"),e}function Y0(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case Ki:case Zi:e="ENVMAP_TYPE_CUBE";break;case Ts:e="ENVMAP_TYPE_CUBE_UV";break}return e}function K0(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case Zi:e="ENVMAP_MODE_REFRACTION";break}return e}function Z0(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case nu:e="ENVMAP_BLENDING_MULTIPLY";break;case Sp:e="ENVMAP_BLENDING_MIX";break;case Mp:e="ENVMAP_BLENDING_ADD";break}return e}function J0(i){const e=i.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),112)),texelHeight:n,maxMip:t}}function Q0(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=j0(t),c=Y0(t),h=K0(t),u=Z0(t),f=J0(t),d=z0(t),_=H0(s),b=r.createProgram();let g,m,S=t.glslVersion?"#version "+t.glslVersion+`
|
|
3798
|
+
`:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(fs).join(`
|
|
3802
3799
|
`),g.length>0&&(g+=`
|
|
3803
|
-
`),m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(
|
|
3800
|
+
`),m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(fs).join(`
|
|
3804
3801
|
`),m.length>0&&(m+=`
|
|
3805
|
-
`)):(g=[
|
|
3806
|
-
`].filter(
|
|
3807
|
-
`),m=[
|
|
3808
|
-
`].filter(
|
|
3809
|
-
`)),a=
|
|
3802
|
+
`)):(g=[Zh(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
|
|
3803
|
+
`].filter(fs).join(`
|
|
3804
|
+
`),m=[Zh(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+h:"",t.envMap?"#define "+u:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==li?"#define TONE_MAPPING":"",t.toneMapping!==li?st.tonemapping_pars_fragment:"",t.toneMapping!==li?k0("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",st.colorspace_pars_fragment,F0("linearToOutputTexel",t.outputColorSpace),B0(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|
3805
|
+
`].filter(fs).join(`
|
|
3806
|
+
`)),a=kl(a),a=jh(a,t),a=Yh(a,t),o=kl(o),o=jh(o,t),o=Yh(o,t),a=Kh(a),o=Kh(o),t.isRawShaderMaterial!==!0&&(S=`#version 300 es
|
|
3810
3807
|
`,g=[d,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
3811
3808
|
`)+`
|
|
3812
|
-
`+g,m=["#define varying in",t.glslVersion===
|
|
3809
|
+
`+g,m=["#define varying in",t.glslVersion===Bo?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Bo?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
|
|
3813
3810
|
`)+`
|
|
3814
|
-
`+m);const y=S+g+a,M=S+m+o,T=
|
|
3811
|
+
`+m);const y=S+g+a,M=S+m+o,T=Xh(r,r.VERTEX_SHADER,y),R=Xh(r,r.FRAGMENT_SHADER,M);r.attachShader(b,T),r.attachShader(b,R),t.index0AttributeName!==void 0?r.bindAttribLocation(b,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(b,0,"position"),r.linkProgram(b);function k(V){if(i.debug.checkShaderErrors){const K=r.getProgramInfoLog(b)||"",J=r.getShaderInfoLog(T)||"",se=r.getShaderInfoLog(R)||"",he=K.trim(),Q=J.trim(),de=se.trim();let ne=!0,ue=!0;if(r.getProgramParameter(b,r.LINK_STATUS)===!1)if(ne=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,b,T,R);else{const Te=qh(r,T,"vertex"),ke=qh(r,R,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(b,r.VALIDATE_STATUS)+`
|
|
3815
3812
|
|
|
3816
3813
|
Material Name: `+V.name+`
|
|
3817
3814
|
Material Type: `+V.type+`
|
|
3818
3815
|
|
|
3819
3816
|
Program Info Log: `+he+`
|
|
3820
3817
|
`+Te+`
|
|
3821
|
-
`+ke)}else he!==""?console.warn("THREE.WebGLProgram: Program Info Log:",he):(Q===""||de==="")&&(ue=!1);ue&&(V.diagnostics={runnable:ne,programLog:he,vertexShader:{log:Q,prefix:g},fragmentShader:{log:de,prefix:m}})}r.deleteShader(T),r.deleteShader(R),B=new ma(r,b),C=uy(r,b)}let B;this.getUniforms=function(){return B===void 0&&k(this),B};let C;this.getAttributes=function(){return C===void 0&&k(this),C};let D=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return D===!1&&(D=r.getProgramParameter(b,ty)),D},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(b),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=ny++,this.cacheKey=e,this.usedTimes=1,this.program=b,this.vertexShader=T,this.fragmentShader=R,this}let Sy=0;class My{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Ey(e),t.set(e,n)),n}}class Ey{constructor(e){this.id=Sy++,this.code=e,this.usedTimes=0}}function Ty(i,e,t,n,r,s,a){const o=new al,l=new My,c=new Set,h=[],u=r.logarithmicDepthBuffer,f=r.vertexTextures;let d=r.precision;const _={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function b(C){return c.add(C),C===0?"uv":`uv${C}`}function g(C,D,V,K,J){const se=K.fog,he=J.geometry,Q=C.isMeshStandardMaterial?K.environment:null,de=(C.isMeshStandardMaterial?t:e).get(C.envMap||Q),ne=de&&de.mapping===Rs?de.image.height:null,ue=_[C.type];C.precision!==null&&(d=r.getMaxPrecision(C.precision),d!==C.precision&&console.warn("THREE.WebGLProgram.getParameters:",C.precision,"not supported, using",d,"instead."));const Te=he.morphAttributes.position||he.morphAttributes.normal||he.morphAttributes.color,ke=Te!==void 0?Te.length:0;let O=0;he.morphAttributes.position!==void 0&&(O=1),he.morphAttributes.normal!==void 0&&(O=2),he.morphAttributes.color!==void 0&&(O=3);let H,we,Be,ie;if(ue){const ve=Fn[ue];H=ve.vertexShader,we=ve.fragmentShader}else H=C.vertexShader,we=C.fragmentShader,l.update(C),Be=l.getVertexShaderID(C),ie=l.getFragmentShaderID(C);const ce=i.getRenderTarget(),z=i.state.buffers.depth.getReversed(),j=J.isInstancedMesh===!0,W=J.isBatchedMesh===!0,le=!!C.map,be=!!C.matcap,U=!!de,ee=!!C.aoMap,fe=!!C.lightMap,ye=!!C.bumpMap,Se=!!C.normalMap,ze=!!C.displacementMap,_e=!!C.emissiveMap,xe=!!C.metalnessMap,Xe=!!C.roughnessMap,De=C.anisotropy>0,N=C.clearcoat>0,w=C.dispersion>0,q=C.iridescence>0,re=C.sheen>0,pe=C.transmission>0,ae=De&&!!C.anisotropyMap,Ve=N&&!!C.clearcoatMap,Ae=N&&!!C.clearcoatNormalMap,oe=N&&!!C.clearcoatRoughnessMap,We=q&&!!C.iridescenceMap,Me=q&&!!C.iridescenceThicknessMap,Re=re&&!!C.sheenColorMap,je=re&&!!C.sheenRoughnessMap,Oe=!!C.specularMap,Ce=!!C.specularColorMap,A=!!C.specularIntensityMap,x=pe&&!!C.transmissionMap,L=pe&&!!C.thicknessMap,p=!!C.gradientMap,v=!!C.alphaMap,E=C.alphaTest>0,I=!!C.alphaHash,F=!!C.extensions;let X=ri;C.toneMapped&&(ce===null||ce.isXRRenderTarget===!0)&&(X=i.toneMapping);const me={shaderID:ue,shaderType:C.type,shaderName:C.name,vertexShader:H,fragmentShader:we,defines:C.defines,customVertexShaderID:Be,customFragmentShaderID:ie,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:d,batching:W,batchingColor:W&&J._colorsTexture!==null,instancing:j,instancingColor:j&&J.instanceColor!==null,instancingMorph:j&&J.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:ce===null?i.outputColorSpace:ce.isXRRenderTarget===!0?ce.texture.colorSpace:Kt,alphaToCoverage:!!C.alphaToCoverage,map:le,matcap:be,envMap:U,envMapMode:U&&de.mapping,envMapCubeUVHeight:ne,aoMap:ee,lightMap:fe,bumpMap:ye,normalMap:Se,displacementMap:f&&ze,emissiveMap:_e,normalMapObjectSpace:Se&&C.normalMapType===im,normalMapTangentSpace:Se&&C.normalMapType===Mu,metalnessMap:xe,roughnessMap:Xe,anisotropy:De,anisotropyMap:ae,clearcoat:N,clearcoatMap:Ve,clearcoatNormalMap:Ae,clearcoatRoughnessMap:oe,dispersion:w,iridescence:q,iridescenceMap:We,iridescenceThicknessMap:Me,sheen:re,sheenColorMap:Re,sheenRoughnessMap:je,specularMap:Oe,specularColorMap:Ce,specularIntensityMap:A,transmission:pe,transmissionMap:x,thicknessMap:L,gradientMap:p,opaque:C.transparent===!1&&C.blending===Yi&&C.alphaToCoverage===!1,alphaMap:v,alphaTest:E,alphaHash:I,combine:C.combine,mapUv:le&&b(C.map.channel),aoMapUv:ee&&b(C.aoMap.channel),lightMapUv:fe&&b(C.lightMap.channel),bumpMapUv:ye&&b(C.bumpMap.channel),normalMapUv:Se&&b(C.normalMap.channel),displacementMapUv:ze&&b(C.displacementMap.channel),emissiveMapUv:_e&&b(C.emissiveMap.channel),metalnessMapUv:xe&&b(C.metalnessMap.channel),roughnessMapUv:Xe&&b(C.roughnessMap.channel),anisotropyMapUv:ae&&b(C.anisotropyMap.channel),clearcoatMapUv:Ve&&b(C.clearcoatMap.channel),clearcoatNormalMapUv:Ae&&b(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:oe&&b(C.clearcoatRoughnessMap.channel),iridescenceMapUv:We&&b(C.iridescenceMap.channel),iridescenceThicknessMapUv:Me&&b(C.iridescenceThicknessMap.channel),sheenColorMapUv:Re&&b(C.sheenColorMap.channel),sheenRoughnessMapUv:je&&b(C.sheenRoughnessMap.channel),specularMapUv:Oe&&b(C.specularMap.channel),specularColorMapUv:Ce&&b(C.specularColorMap.channel),specularIntensityMapUv:A&&b(C.specularIntensityMap.channel),transmissionMapUv:x&&b(C.transmissionMap.channel),thicknessMapUv:L&&b(C.thicknessMap.channel),alphaMapUv:v&&b(C.alphaMap.channel),vertexTangents:!!he.attributes.tangent&&(Se||De),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!he.attributes.color&&he.attributes.color.itemSize===4,pointsUvs:J.isPoints===!0&&!!he.attributes.uv&&(le||v),fog:!!se,useFog:C.fog===!0,fogExp2:!!se&&se.isFogExp2,flatShading:C.flatShading===!0&&C.wireframe===!1,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:u,reversedDepthBuffer:z,skinning:J.isSkinnedMesh===!0,morphTargets:he.morphAttributes.position!==void 0,morphNormals:he.morphAttributes.normal!==void 0,morphColors:he.morphAttributes.color!==void 0,morphTargetsCount:ke,morphTextureStride:O,numDirLights:D.directional.length,numPointLights:D.point.length,numSpotLights:D.spot.length,numSpotLightMaps:D.spotLightMap.length,numRectAreaLights:D.rectArea.length,numHemiLights:D.hemi.length,numDirLightShadows:D.directionalShadowMap.length,numPointLightShadows:D.pointShadowMap.length,numSpotLightShadows:D.spotShadowMap.length,numSpotLightShadowsWithMaps:D.numSpotLightShadowsWithMaps,numLightProbes:D.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:C.dithering,shadowMapEnabled:i.shadowMap.enabled&&V.length>0,shadowMapType:i.shadowMap.type,toneMapping:X,decodeVideoTexture:le&&C.map.isVideoTexture===!0&<.getTransfer(C.map.colorSpace)===xt,decodeVideoTextureEmissive:_e&&C.emissiveMap.isVideoTexture===!0&<.getTransfer(C.emissiveMap.colorSpace)===xt,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===Rn,flipSided:C.side===sn,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:F&&C.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(F&&C.extensions.multiDraw===!0||W)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return me.vertexUv1s=c.has(1),me.vertexUv2s=c.has(2),me.vertexUv3s=c.has(3),c.clear(),me}function m(C){const D=[];if(C.shaderID?D.push(C.shaderID):(D.push(C.customVertexShaderID),D.push(C.customFragmentShaderID)),C.defines!==void 0)for(const V in C.defines)D.push(V),D.push(C.defines[V]);return C.isRawShaderMaterial===!1&&(S(D,C),y(D,C),D.push(i.outputColorSpace)),D.push(C.customProgramCacheKey),D.join()}function S(C,D){C.push(D.precision),C.push(D.outputColorSpace),C.push(D.envMapMode),C.push(D.envMapCubeUVHeight),C.push(D.mapUv),C.push(D.alphaMapUv),C.push(D.lightMapUv),C.push(D.aoMapUv),C.push(D.bumpMapUv),C.push(D.normalMapUv),C.push(D.displacementMapUv),C.push(D.emissiveMapUv),C.push(D.metalnessMapUv),C.push(D.roughnessMapUv),C.push(D.anisotropyMapUv),C.push(D.clearcoatMapUv),C.push(D.clearcoatNormalMapUv),C.push(D.clearcoatRoughnessMapUv),C.push(D.iridescenceMapUv),C.push(D.iridescenceThicknessMapUv),C.push(D.sheenColorMapUv),C.push(D.sheenRoughnessMapUv),C.push(D.specularMapUv),C.push(D.specularColorMapUv),C.push(D.specularIntensityMapUv),C.push(D.transmissionMapUv),C.push(D.thicknessMapUv),C.push(D.combine),C.push(D.fogExp2),C.push(D.sizeAttenuation),C.push(D.morphTargetsCount),C.push(D.morphAttributeCount),C.push(D.numDirLights),C.push(D.numPointLights),C.push(D.numSpotLights),C.push(D.numSpotLightMaps),C.push(D.numHemiLights),C.push(D.numRectAreaLights),C.push(D.numDirLightShadows),C.push(D.numPointLightShadows),C.push(D.numSpotLightShadows),C.push(D.numSpotLightShadowsWithMaps),C.push(D.numLightProbes),C.push(D.shadowMapType),C.push(D.toneMapping),C.push(D.numClippingPlanes),C.push(D.numClipIntersection),C.push(D.depthPacking)}function y(C,D){o.disableAll(),D.supportsVertexTextures&&o.enable(0),D.instancing&&o.enable(1),D.instancingColor&&o.enable(2),D.instancingMorph&&o.enable(3),D.matcap&&o.enable(4),D.envMap&&o.enable(5),D.normalMapObjectSpace&&o.enable(6),D.normalMapTangentSpace&&o.enable(7),D.clearcoat&&o.enable(8),D.iridescence&&o.enable(9),D.alphaTest&&o.enable(10),D.vertexColors&&o.enable(11),D.vertexAlphas&&o.enable(12),D.vertexUv1s&&o.enable(13),D.vertexUv2s&&o.enable(14),D.vertexUv3s&&o.enable(15),D.vertexTangents&&o.enable(16),D.anisotropy&&o.enable(17),D.alphaHash&&o.enable(18),D.batching&&o.enable(19),D.dispersion&&o.enable(20),D.batchingColor&&o.enable(21),D.gradientMap&&o.enable(22),C.push(o.mask),o.disableAll(),D.fog&&o.enable(0),D.useFog&&o.enable(1),D.flatShading&&o.enable(2),D.logarithmicDepthBuffer&&o.enable(3),D.reversedDepthBuffer&&o.enable(4),D.skinning&&o.enable(5),D.morphTargets&&o.enable(6),D.morphNormals&&o.enable(7),D.morphColors&&o.enable(8),D.premultipliedAlpha&&o.enable(9),D.shadowMapEnabled&&o.enable(10),D.doubleSided&&o.enable(11),D.flipSided&&o.enable(12),D.useDepthPacking&&o.enable(13),D.dithering&&o.enable(14),D.transmission&&o.enable(15),D.sheen&&o.enable(16),D.opaque&&o.enable(17),D.pointsUvs&&o.enable(18),D.decodeVideoTexture&&o.enable(19),D.decodeVideoTextureEmissive&&o.enable(20),D.alphaToCoverage&&o.enable(21),C.push(o.mask)}function M(C){const D=_[C.type];let V;if(D){const K=Fn[D];V=jm.clone(K.uniforms)}else V=C.uniforms;return V}function T(C,D){let V;for(let K=0,J=h.length;K<J;K++){const se=h[K];if(se.cacheKey===D){V=se,++V.usedTimes;break}}return V===void 0&&(V=new by(i,D,C,s),h.push(V)),V}function R(C){if(--C.usedTimes===0){const D=h.indexOf(C);h[D]=h[h.length-1],h.pop(),C.destroy()}}function k(C){l.remove(C)}function B(){l.dispose()}return{getParameters:g,getProgramCacheKey:m,getUniforms:M,acquireProgram:T,releaseProgram:R,releaseShaderCache:k,programs:h,dispose:B}}function wy(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let o=i.get(a);return o===void 0&&(o={},i.set(a,o)),o}function n(a){i.delete(a)}function r(a,o,l){i.get(a)[o]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function Ay(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function rf(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function sf(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(u,f,d,_,b,g){let m=i[e];return m===void 0?(m={id:u.id,object:u,geometry:f,material:d,groupOrder:_,renderOrder:u.renderOrder,z:b,group:g},i[e]=m):(m.id=u.id,m.object=u,m.geometry=f,m.material=d,m.groupOrder=_,m.renderOrder=u.renderOrder,m.z=b,m.group=g),e++,m}function o(u,f,d,_,b,g){const m=a(u,f,d,_,b,g);d.transmission>0?n.push(m):d.transparent===!0?r.push(m):t.push(m)}function l(u,f,d,_,b,g){const m=a(u,f,d,_,b,g);d.transmission>0?n.unshift(m):d.transparent===!0?r.unshift(m):t.unshift(m)}function c(u,f){t.length>1&&t.sort(u||Ay),n.length>1&&n.sort(f||rf),r.length>1&&r.sort(f||rf)}function h(){for(let u=e,f=i.length;u<f;u++){const d=i[u];if(d.id===null)break;d.id=null,d.object=null,d.geometry=null,d.material=null,d.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:o,unshift:l,finish:h,sort:c}}function Ry(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new sf,i.set(n,[a])):r>=s.length?(a=new sf,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function Cy(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new $,color:new Ze};break;case"SpotLight":t={position:new $,direction:new $,color:new Ze,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new $,color:new Ze,distance:0,decay:0};break;case"HemisphereLight":t={direction:new $,skyColor:new Ze,groundColor:new Ze};break;case"RectAreaLight":t={color:new Ze,position:new $,halfWidth:new $,halfHeight:new $};break}return i[e.id]=t,t}}}function Py(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ye};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ye};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ye,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Dy=0;function Ly(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Iy(i){const e=new Cy,t=Py(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new $);const r=new $,s=new et,a=new et;function o(c){let h=0,u=0,f=0;for(let C=0;C<9;C++)n.probe[C].set(0,0,0);let d=0,_=0,b=0,g=0,m=0,S=0,y=0,M=0,T=0,R=0,k=0;c.sort(Ly);for(let C=0,D=c.length;C<D;C++){const V=c[C],K=V.color,J=V.intensity,se=V.distance,he=V.shadow&&V.shadow.map?V.shadow.map.texture:null;if(V.isAmbientLight)h+=K.r*J,u+=K.g*J,f+=K.b*J;else if(V.isLightProbe){for(let Q=0;Q<9;Q++)n.probe[Q].addScaledVector(V.sh.coefficients[Q],J);k++}else if(V.isDirectionalLight){const Q=e.get(V);if(Q.color.copy(V.color).multiplyScalar(V.intensity),V.castShadow){const de=V.shadow,ne=t.get(V);ne.shadowIntensity=de.intensity,ne.shadowBias=de.bias,ne.shadowNormalBias=de.normalBias,ne.shadowRadius=de.radius,ne.shadowMapSize=de.mapSize,n.directionalShadow[d]=ne,n.directionalShadowMap[d]=he,n.directionalShadowMatrix[d]=V.shadow.matrix,S++}n.directional[d]=Q,d++}else if(V.isSpotLight){const Q=e.get(V);Q.position.setFromMatrixPosition(V.matrixWorld),Q.color.copy(K).multiplyScalar(J),Q.distance=se,Q.coneCos=Math.cos(V.angle),Q.penumbraCos=Math.cos(V.angle*(1-V.penumbra)),Q.decay=V.decay,n.spot[b]=Q;const de=V.shadow;if(V.map&&(n.spotLightMap[T]=V.map,T++,de.updateMatrices(V),V.castShadow&&R++),n.spotLightMatrix[b]=de.matrix,V.castShadow){const ne=t.get(V);ne.shadowIntensity=de.intensity,ne.shadowBias=de.bias,ne.shadowNormalBias=de.normalBias,ne.shadowRadius=de.radius,ne.shadowMapSize=de.mapSize,n.spotShadow[b]=ne,n.spotShadowMap[b]=he,M++}b++}else if(V.isRectAreaLight){const Q=e.get(V);Q.color.copy(K).multiplyScalar(J),Q.halfWidth.set(V.width*.5,0,0),Q.halfHeight.set(0,V.height*.5,0),n.rectArea[g]=Q,g++}else if(V.isPointLight){const Q=e.get(V);if(Q.color.copy(V.color).multiplyScalar(V.intensity),Q.distance=V.distance,Q.decay=V.decay,V.castShadow){const de=V.shadow,ne=t.get(V);ne.shadowIntensity=de.intensity,ne.shadowBias=de.bias,ne.shadowNormalBias=de.normalBias,ne.shadowRadius=de.radius,ne.shadowMapSize=de.mapSize,ne.shadowCameraNear=de.camera.near,ne.shadowCameraFar=de.camera.far,n.pointShadow[_]=ne,n.pointShadowMap[_]=he,n.pointShadowMatrix[_]=V.shadow.matrix,y++}n.point[_]=Q,_++}else if(V.isHemisphereLight){const Q=e.get(V);Q.skyColor.copy(V.color).multiplyScalar(J),Q.groundColor.copy(V.groundColor).multiplyScalar(J),n.hemi[m]=Q,m++}}g>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ie.LTC_FLOAT_1,n.rectAreaLTC2=Ie.LTC_FLOAT_2):(n.rectAreaLTC1=Ie.LTC_HALF_1,n.rectAreaLTC2=Ie.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=f;const B=n.hash;(B.directionalLength!==d||B.pointLength!==_||B.spotLength!==b||B.rectAreaLength!==g||B.hemiLength!==m||B.numDirectionalShadows!==S||B.numPointShadows!==y||B.numSpotShadows!==M||B.numSpotMaps!==T||B.numLightProbes!==k)&&(n.directional.length=d,n.spot.length=b,n.rectArea.length=g,n.point.length=_,n.hemi.length=m,n.directionalShadow.length=S,n.directionalShadowMap.length=S,n.pointShadow.length=y,n.pointShadowMap.length=y,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=S,n.pointShadowMatrix.length=y,n.spotLightMatrix.length=M+T-R,n.spotLightMap.length=T,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=k,B.directionalLength=d,B.pointLength=_,B.spotLength=b,B.rectAreaLength=g,B.hemiLength=m,B.numDirectionalShadows=S,B.numPointShadows=y,B.numSpotShadows=M,B.numSpotMaps=T,B.numLightProbes=k,n.version=Dy++)}function l(c,h){let u=0,f=0,d=0,_=0,b=0;const g=h.matrixWorldInverse;for(let m=0,S=c.length;m<S;m++){const y=c[m];if(y.isDirectionalLight){const M=n.directional[u];M.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(g),u++}else if(y.isSpotLight){const M=n.spot[d];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(g),M.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(g),d++}else if(y.isRectAreaLight){const M=n.rectArea[_];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(g),a.identity(),s.copy(y.matrixWorld),s.premultiply(g),a.extractRotation(s),M.halfWidth.set(y.width*.5,0,0),M.halfHeight.set(0,y.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),_++}else if(y.isPointLight){const M=n.point[f];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(g),f++}else if(y.isHemisphereLight){const M=n.hemi[b];M.direction.setFromMatrixPosition(y.matrixWorld),M.direction.transformDirection(g),b++}}}return{setup:o,setupView:l,state:n}}function af(i){const e=new Iy(i),t=[],n=[];function r(h){c.camera=h,t.length=0,n.length=0}function s(h){t.push(h)}function a(h){n.push(h)}function o(){e.setup(t)}function l(h){e.setupView(t,h)}const c={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function Uy(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new af(i),e.set(r,[o])):s>=a.length?(o=new af(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const Ny=`void main() {
|
|
3818
|
+
`+ke)}else he!==""?console.warn("THREE.WebGLProgram: Program Info Log:",he):(Q===""||de==="")&&(ue=!1);ue&&(V.diagnostics={runnable:ne,programLog:he,vertexShader:{log:Q,prefix:g},fragmentShader:{log:de,prefix:m}})}r.deleteShader(T),r.deleteShader(R),B=new ua(r,b),C=V0(r,b)}let B;this.getUniforms=function(){return B===void 0&&k(this),B};let C;this.getAttributes=function(){return C===void 0&&k(this),C};let D=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return D===!1&&(D=r.getProgramParameter(b,I0)),D},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(b),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=U0++,this.cacheKey=e,this.usedTimes=1,this.program=b,this.vertexShader=T,this.fragmentShader=R,this}let ey=0;class ty{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new ny(e),t.set(e,n)),n}}class ny{constructor(e){this.id=ey++,this.code=e,this.usedTimes=0}}function iy(i,e,t,n,r,s,a){const o=new Zo,l=new ty,c=new Set,h=[],u=r.logarithmicDepthBuffer,f=r.vertexTextures;let d=r.precision;const _={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function b(C){return c.add(C),C===0?"uv":`uv${C}`}function g(C,D,V,K,J){const se=K.fog,he=J.geometry,Q=C.isMeshStandardMaterial?K.environment:null,de=(C.isMeshStandardMaterial?t:e).get(C.envMap||Q),ne=de&&de.mapping===Ts?de.image.height:null,ue=_[C.type];C.precision!==null&&(d=r.getMaxPrecision(C.precision),d!==C.precision&&console.warn("THREE.WebGLProgram.getParameters:",C.precision,"not supported, using",d,"instead."));const Te=he.morphAttributes.position||he.morphAttributes.normal||he.morphAttributes.color,ke=Te!==void 0?Te.length:0;let O=0;he.morphAttributes.position!==void 0&&(O=1),he.morphAttributes.normal!==void 0&&(O=2),he.morphAttributes.color!==void 0&&(O=3);let H,we,Be,ie;if(ue){const ve=Bn[ue];H=ve.vertexShader,we=ve.fragmentShader}else H=C.vertexShader,we=C.fragmentShader,l.update(C),Be=l.getVertexShaderID(C),ie=l.getFragmentShaderID(C);const ce=i.getRenderTarget(),z=i.state.buffers.depth.getReversed(),q=J.isInstancedMesh===!0,W=J.isBatchedMesh===!0,le=!!C.map,be=!!C.matcap,U=!!de,ee=!!C.aoMap,fe=!!C.lightMap,ye=!!C.bumpMap,Se=!!C.normalMap,ze=!!C.displacementMap,_e=!!C.emissiveMap,xe=!!C.metalnessMap,qe=!!C.roughnessMap,De=C.anisotropy>0,N=C.clearcoat>0,w=C.dispersion>0,j=C.iridescence>0,re=C.sheen>0,pe=C.transmission>0,ae=De&&!!C.anisotropyMap,Ve=N&&!!C.clearcoatMap,Ae=N&&!!C.clearcoatNormalMap,oe=N&&!!C.clearcoatRoughnessMap,We=j&&!!C.iridescenceMap,Me=j&&!!C.iridescenceThicknessMap,Re=re&&!!C.sheenColorMap,Ke=re&&!!C.sheenRoughnessMap,Oe=!!C.specularMap,Ce=!!C.specularColorMap,A=!!C.specularIntensityMap,x=pe&&!!C.transmissionMap,L=pe&&!!C.thicknessMap,p=!!C.gradientMap,v=!!C.alphaMap,E=C.alphaTest>0,I=!!C.alphaHash,F=!!C.extensions;let X=li;C.toneMapped&&(ce===null||ce.isXRRenderTarget===!0)&&(X=i.toneMapping);const me={shaderID:ue,shaderType:C.type,shaderName:C.name,vertexShader:H,fragmentShader:we,defines:C.defines,customVertexShaderID:Be,customFragmentShaderID:ie,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:d,batching:W,batchingColor:W&&J._colorsTexture!==null,instancing:q,instancingColor:q&&J.instanceColor!==null,instancingMorph:q&&J.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:ce===null?i.outputColorSpace:ce.isXRRenderTarget===!0?ce.texture.colorSpace:Qt,alphaToCoverage:!!C.alphaToCoverage,map:le,matcap:be,envMap:U,envMapMode:U&&de.mapping,envMapCubeUVHeight:ne,aoMap:ee,lightMap:fe,bumpMap:ye,normalMap:Se,displacementMap:f&&ze,emissiveMap:_e,normalMapObjectSpace:Se&&C.normalMapType===Np,normalMapTangentSpace:Se&&C.normalMapType===vu,metalnessMap:xe,roughnessMap:qe,anisotropy:De,anisotropyMap:ae,clearcoat:N,clearcoatMap:Ve,clearcoatNormalMap:Ae,clearcoatRoughnessMap:oe,dispersion:w,iridescence:j,iridescenceMap:We,iridescenceThicknessMap:Me,sheen:re,sheenColorMap:Re,sheenRoughnessMap:Ke,specularMap:Oe,specularColorMap:Ce,specularIntensityMap:A,transmission:pe,transmissionMap:x,thicknessMap:L,gradientMap:p,opaque:C.transparent===!1&&C.blending===ji&&C.alphaToCoverage===!1,alphaMap:v,alphaTest:E,alphaHash:I,combine:C.combine,mapUv:le&&b(C.map.channel),aoMapUv:ee&&b(C.aoMap.channel),lightMapUv:fe&&b(C.lightMap.channel),bumpMapUv:ye&&b(C.bumpMap.channel),normalMapUv:Se&&b(C.normalMap.channel),displacementMapUv:ze&&b(C.displacementMap.channel),emissiveMapUv:_e&&b(C.emissiveMap.channel),metalnessMapUv:xe&&b(C.metalnessMap.channel),roughnessMapUv:qe&&b(C.roughnessMap.channel),anisotropyMapUv:ae&&b(C.anisotropyMap.channel),clearcoatMapUv:Ve&&b(C.clearcoatMap.channel),clearcoatNormalMapUv:Ae&&b(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:oe&&b(C.clearcoatRoughnessMap.channel),iridescenceMapUv:We&&b(C.iridescenceMap.channel),iridescenceThicknessMapUv:Me&&b(C.iridescenceThicknessMap.channel),sheenColorMapUv:Re&&b(C.sheenColorMap.channel),sheenRoughnessMapUv:Ke&&b(C.sheenRoughnessMap.channel),specularMapUv:Oe&&b(C.specularMap.channel),specularColorMapUv:Ce&&b(C.specularColorMap.channel),specularIntensityMapUv:A&&b(C.specularIntensityMap.channel),transmissionMapUv:x&&b(C.transmissionMap.channel),thicknessMapUv:L&&b(C.thicknessMap.channel),alphaMapUv:v&&b(C.alphaMap.channel),vertexTangents:!!he.attributes.tangent&&(Se||De),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!he.attributes.color&&he.attributes.color.itemSize===4,pointsUvs:J.isPoints===!0&&!!he.attributes.uv&&(le||v),fog:!!se,useFog:C.fog===!0,fogExp2:!!se&&se.isFogExp2,flatShading:C.flatShading===!0&&C.wireframe===!1,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:u,reversedDepthBuffer:z,skinning:J.isSkinnedMesh===!0,morphTargets:he.morphAttributes.position!==void 0,morphNormals:he.morphAttributes.normal!==void 0,morphColors:he.morphAttributes.color!==void 0,morphTargetsCount:ke,morphTextureStride:O,numDirLights:D.directional.length,numPointLights:D.point.length,numSpotLights:D.spot.length,numSpotLightMaps:D.spotLightMap.length,numRectAreaLights:D.rectArea.length,numHemiLights:D.hemi.length,numDirLightShadows:D.directionalShadowMap.length,numPointLightShadows:D.pointShadowMap.length,numSpotLightShadows:D.spotShadowMap.length,numSpotLightShadowsWithMaps:D.numSpotLightShadowsWithMaps,numLightProbes:D.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:C.dithering,shadowMapEnabled:i.shadowMap.enabled&&V.length>0,shadowMapType:i.shadowMap.type,toneMapping:X,decodeVideoTexture:le&&C.map.isVideoTexture===!0&&ht.getTransfer(C.map.colorSpace)===Mt,decodeVideoTextureEmissive:_e&&C.emissiveMap.isVideoTexture===!0&&ht.getTransfer(C.emissiveMap.colorSpace)===Mt,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===yn,flipSided:C.side===on,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:F&&C.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(F&&C.extensions.multiDraw===!0||W)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return me.vertexUv1s=c.has(1),me.vertexUv2s=c.has(2),me.vertexUv3s=c.has(3),c.clear(),me}function m(C){const D=[];if(C.shaderID?D.push(C.shaderID):(D.push(C.customVertexShaderID),D.push(C.customFragmentShaderID)),C.defines!==void 0)for(const V in C.defines)D.push(V),D.push(C.defines[V]);return C.isRawShaderMaterial===!1&&(S(D,C),y(D,C),D.push(i.outputColorSpace)),D.push(C.customProgramCacheKey),D.join()}function S(C,D){C.push(D.precision),C.push(D.outputColorSpace),C.push(D.envMapMode),C.push(D.envMapCubeUVHeight),C.push(D.mapUv),C.push(D.alphaMapUv),C.push(D.lightMapUv),C.push(D.aoMapUv),C.push(D.bumpMapUv),C.push(D.normalMapUv),C.push(D.displacementMapUv),C.push(D.emissiveMapUv),C.push(D.metalnessMapUv),C.push(D.roughnessMapUv),C.push(D.anisotropyMapUv),C.push(D.clearcoatMapUv),C.push(D.clearcoatNormalMapUv),C.push(D.clearcoatRoughnessMapUv),C.push(D.iridescenceMapUv),C.push(D.iridescenceThicknessMapUv),C.push(D.sheenColorMapUv),C.push(D.sheenRoughnessMapUv),C.push(D.specularMapUv),C.push(D.specularColorMapUv),C.push(D.specularIntensityMapUv),C.push(D.transmissionMapUv),C.push(D.thicknessMapUv),C.push(D.combine),C.push(D.fogExp2),C.push(D.sizeAttenuation),C.push(D.morphTargetsCount),C.push(D.morphAttributeCount),C.push(D.numDirLights),C.push(D.numPointLights),C.push(D.numSpotLights),C.push(D.numSpotLightMaps),C.push(D.numHemiLights),C.push(D.numRectAreaLights),C.push(D.numDirLightShadows),C.push(D.numPointLightShadows),C.push(D.numSpotLightShadows),C.push(D.numSpotLightShadowsWithMaps),C.push(D.numLightProbes),C.push(D.shadowMapType),C.push(D.toneMapping),C.push(D.numClippingPlanes),C.push(D.numClipIntersection),C.push(D.depthPacking)}function y(C,D){o.disableAll(),D.supportsVertexTextures&&o.enable(0),D.instancing&&o.enable(1),D.instancingColor&&o.enable(2),D.instancingMorph&&o.enable(3),D.matcap&&o.enable(4),D.envMap&&o.enable(5),D.normalMapObjectSpace&&o.enable(6),D.normalMapTangentSpace&&o.enable(7),D.clearcoat&&o.enable(8),D.iridescence&&o.enable(9),D.alphaTest&&o.enable(10),D.vertexColors&&o.enable(11),D.vertexAlphas&&o.enable(12),D.vertexUv1s&&o.enable(13),D.vertexUv2s&&o.enable(14),D.vertexUv3s&&o.enable(15),D.vertexTangents&&o.enable(16),D.anisotropy&&o.enable(17),D.alphaHash&&o.enable(18),D.batching&&o.enable(19),D.dispersion&&o.enable(20),D.batchingColor&&o.enable(21),D.gradientMap&&o.enable(22),C.push(o.mask),o.disableAll(),D.fog&&o.enable(0),D.useFog&&o.enable(1),D.flatShading&&o.enable(2),D.logarithmicDepthBuffer&&o.enable(3),D.reversedDepthBuffer&&o.enable(4),D.skinning&&o.enable(5),D.morphTargets&&o.enable(6),D.morphNormals&&o.enable(7),D.morphColors&&o.enable(8),D.premultipliedAlpha&&o.enable(9),D.shadowMapEnabled&&o.enable(10),D.doubleSided&&o.enable(11),D.flipSided&&o.enable(12),D.useDepthPacking&&o.enable(13),D.dithering&&o.enable(14),D.transmission&&o.enable(15),D.sheen&&o.enable(16),D.opaque&&o.enable(17),D.pointsUvs&&o.enable(18),D.decodeVideoTexture&&o.enable(19),D.decodeVideoTextureEmissive&&o.enable(20),D.alphaToCoverage&&o.enable(21),C.push(o.mask)}function M(C){const D=_[C.type];let V;if(D){const K=Bn[D];V=Tm.clone(K.uniforms)}else V=C.uniforms;return V}function T(C,D){let V;for(let K=0,J=h.length;K<J;K++){const se=h[K];if(se.cacheKey===D){V=se,++V.usedTimes;break}}return V===void 0&&(V=new Q0(i,D,C,s),h.push(V)),V}function R(C){if(--C.usedTimes===0){const D=h.indexOf(C);h[D]=h[h.length-1],h.pop(),C.destroy()}}function k(C){l.remove(C)}function B(){l.dispose()}return{getParameters:g,getProgramCacheKey:m,getUniforms:M,acquireProgram:T,releaseProgram:R,releaseShaderCache:k,programs:h,dispose:B}}function ry(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let o=i.get(a);return o===void 0&&(o={},i.set(a,o)),o}function n(a){i.delete(a)}function r(a,o,l){i.get(a)[o]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function sy(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function Jh(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function Qh(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(u,f,d,_,b,g){let m=i[e];return m===void 0?(m={id:u.id,object:u,geometry:f,material:d,groupOrder:_,renderOrder:u.renderOrder,z:b,group:g},i[e]=m):(m.id=u.id,m.object=u,m.geometry=f,m.material=d,m.groupOrder=_,m.renderOrder=u.renderOrder,m.z=b,m.group=g),e++,m}function o(u,f,d,_,b,g){const m=a(u,f,d,_,b,g);d.transmission>0?n.push(m):d.transparent===!0?r.push(m):t.push(m)}function l(u,f,d,_,b,g){const m=a(u,f,d,_,b,g);d.transmission>0?n.unshift(m):d.transparent===!0?r.unshift(m):t.unshift(m)}function c(u,f){t.length>1&&t.sort(u||sy),n.length>1&&n.sort(f||Jh),r.length>1&&r.sort(f||Jh)}function h(){for(let u=e,f=i.length;u<f;u++){const d=i[u];if(d.id===null)break;d.id=null,d.object=null,d.geometry=null,d.material=null,d.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:o,unshift:l,finish:h,sort:c}}function ay(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new Qh,i.set(n,[a])):r>=s.length?(a=new Qh,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function oy(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new $,color:new et};break;case"SpotLight":t={position:new $,direction:new $,color:new et,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new $,color:new et,distance:0,decay:0};break;case"HemisphereLight":t={direction:new $,skyColor:new et,groundColor:new et};break;case"RectAreaLight":t={color:new et,position:new $,halfWidth:new $,halfHeight:new $};break}return i[e.id]=t,t}}}function ly(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Je};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Je};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Je,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let cy=0;function uy(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function hy(i){const e=new oy,t=ly(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new $);const r=new $,s=new it,a=new it;function o(c){let h=0,u=0,f=0;for(let C=0;C<9;C++)n.probe[C].set(0,0,0);let d=0,_=0,b=0,g=0,m=0,S=0,y=0,M=0,T=0,R=0,k=0;c.sort(uy);for(let C=0,D=c.length;C<D;C++){const V=c[C],K=V.color,J=V.intensity,se=V.distance,he=V.shadow&&V.shadow.map?V.shadow.map.texture:null;if(V.isAmbientLight)h+=K.r*J,u+=K.g*J,f+=K.b*J;else if(V.isLightProbe){for(let Q=0;Q<9;Q++)n.probe[Q].addScaledVector(V.sh.coefficients[Q],J);k++}else if(V.isDirectionalLight){const Q=e.get(V);if(Q.color.copy(V.color).multiplyScalar(V.intensity),V.castShadow){const de=V.shadow,ne=t.get(V);ne.shadowIntensity=de.intensity,ne.shadowBias=de.bias,ne.shadowNormalBias=de.normalBias,ne.shadowRadius=de.radius,ne.shadowMapSize=de.mapSize,n.directionalShadow[d]=ne,n.directionalShadowMap[d]=he,n.directionalShadowMatrix[d]=V.shadow.matrix,S++}n.directional[d]=Q,d++}else if(V.isSpotLight){const Q=e.get(V);Q.position.setFromMatrixPosition(V.matrixWorld),Q.color.copy(K).multiplyScalar(J),Q.distance=se,Q.coneCos=Math.cos(V.angle),Q.penumbraCos=Math.cos(V.angle*(1-V.penumbra)),Q.decay=V.decay,n.spot[b]=Q;const de=V.shadow;if(V.map&&(n.spotLightMap[T]=V.map,T++,de.updateMatrices(V),V.castShadow&&R++),n.spotLightMatrix[b]=de.matrix,V.castShadow){const ne=t.get(V);ne.shadowIntensity=de.intensity,ne.shadowBias=de.bias,ne.shadowNormalBias=de.normalBias,ne.shadowRadius=de.radius,ne.shadowMapSize=de.mapSize,n.spotShadow[b]=ne,n.spotShadowMap[b]=he,M++}b++}else if(V.isRectAreaLight){const Q=e.get(V);Q.color.copy(K).multiplyScalar(J),Q.halfWidth.set(V.width*.5,0,0),Q.halfHeight.set(0,V.height*.5,0),n.rectArea[g]=Q,g++}else if(V.isPointLight){const Q=e.get(V);if(Q.color.copy(V.color).multiplyScalar(V.intensity),Q.distance=V.distance,Q.decay=V.decay,V.castShadow){const de=V.shadow,ne=t.get(V);ne.shadowIntensity=de.intensity,ne.shadowBias=de.bias,ne.shadowNormalBias=de.normalBias,ne.shadowRadius=de.radius,ne.shadowMapSize=de.mapSize,ne.shadowCameraNear=de.camera.near,ne.shadowCameraFar=de.camera.far,n.pointShadow[_]=ne,n.pointShadowMap[_]=he,n.pointShadowMatrix[_]=V.shadow.matrix,y++}n.point[_]=Q,_++}else if(V.isHemisphereLight){const Q=e.get(V);Q.skyColor.copy(V.color).multiplyScalar(J),Q.groundColor.copy(V.groundColor).multiplyScalar(J),n.hemi[m]=Q,m++}}g>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ie.LTC_FLOAT_1,n.rectAreaLTC2=Ie.LTC_FLOAT_2):(n.rectAreaLTC1=Ie.LTC_HALF_1,n.rectAreaLTC2=Ie.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=f;const B=n.hash;(B.directionalLength!==d||B.pointLength!==_||B.spotLength!==b||B.rectAreaLength!==g||B.hemiLength!==m||B.numDirectionalShadows!==S||B.numPointShadows!==y||B.numSpotShadows!==M||B.numSpotMaps!==T||B.numLightProbes!==k)&&(n.directional.length=d,n.spot.length=b,n.rectArea.length=g,n.point.length=_,n.hemi.length=m,n.directionalShadow.length=S,n.directionalShadowMap.length=S,n.pointShadow.length=y,n.pointShadowMap.length=y,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=S,n.pointShadowMatrix.length=y,n.spotLightMatrix.length=M+T-R,n.spotLightMap.length=T,n.numSpotLightShadowsWithMaps=R,n.numLightProbes=k,B.directionalLength=d,B.pointLength=_,B.spotLength=b,B.rectAreaLength=g,B.hemiLength=m,B.numDirectionalShadows=S,B.numPointShadows=y,B.numSpotShadows=M,B.numSpotMaps=T,B.numLightProbes=k,n.version=cy++)}function l(c,h){let u=0,f=0,d=0,_=0,b=0;const g=h.matrixWorldInverse;for(let m=0,S=c.length;m<S;m++){const y=c[m];if(y.isDirectionalLight){const M=n.directional[u];M.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(g),u++}else if(y.isSpotLight){const M=n.spot[d];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(g),M.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(g),d++}else if(y.isRectAreaLight){const M=n.rectArea[_];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(g),a.identity(),s.copy(y.matrixWorld),s.premultiply(g),a.extractRotation(s),M.halfWidth.set(y.width*.5,0,0),M.halfHeight.set(0,y.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),_++}else if(y.isPointLight){const M=n.point[f];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(g),f++}else if(y.isHemisphereLight){const M=n.hemi[b];M.direction.setFromMatrixPosition(y.matrixWorld),M.direction.transformDirection(g),b++}}}return{setup:o,setupView:l,state:n}}function ef(i){const e=new hy(i),t=[],n=[];function r(h){c.camera=h,t.length=0,n.length=0}function s(h){t.push(h)}function a(h){n.push(h)}function o(){e.setup(t)}function l(h){e.setupView(t,h)}const c={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function fy(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new ef(i),e.set(r,[o])):s>=a.length?(o=new ef(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const dy=`void main() {
|
|
3822
3819
|
gl_Position = vec4( position, 1.0 );
|
|
3823
|
-
}`,
|
|
3820
|
+
}`,py=`uniform sampler2D shadow_pass;
|
|
3824
3821
|
uniform vec2 resolution;
|
|
3825
3822
|
uniform float radius;
|
|
3826
3823
|
#include <packing>
|
|
@@ -3846,12 +3843,12 @@ void main() {
|
|
|
3846
3843
|
squared_mean = squared_mean / samples;
|
|
3847
3844
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|
3848
3845
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
3849
|
-
}`;function Fy(i,e,t){let n=new Tl;const r=new Ye,s=new Ye,a=new pt,o=new fg({depthPacking:nm}),l=new dg,c={},h=t.maxTextureSize,u={[Gn]:sn,[sn]:Gn,[Rn]:Rn},f=new fi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ye},radius:{value:4}},vertexShader:Ny,fragmentShader:Oy}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const _=new En;_.setAttribute("position",new Zt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new Jt(_,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=iu;let m=this.type;this.render=function(R,k,B){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||R.length===0)return;const C=i.getRenderTarget(),D=i.getActiveCubeFace(),V=i.getActiveMipmapLevel(),K=i.state;K.setBlending(ii),K.buffers.depth.getReversed()===!0?K.buffers.color.setClear(0,0,0,0):K.buffers.color.setClear(1,1,1,1),K.buffers.depth.setTest(!0),K.setScissorTest(!1);const J=m!==Vn&&this.type===Vn,se=m===Vn&&this.type!==Vn;for(let he=0,Q=R.length;he<Q;he++){const de=R[he],ne=de.shadow;if(ne===void 0){console.warn("THREE.WebGLShadowMap:",de,"has no shadow.");continue}if(ne.autoUpdate===!1&&ne.needsUpdate===!1)continue;r.copy(ne.mapSize);const ue=ne.getFrameExtents();if(r.multiply(ue),s.copy(ne.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/ue.x),r.x=s.x*ue.x,ne.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/ue.y),r.y=s.y*ue.y,ne.mapSize.y=s.y)),ne.map===null||J===!0||se===!0){const ke=this.type!==Vn?{minFilter:Yt,magFilter:Yt}:{};ne.map!==null&&ne.map.dispose(),ne.map=new Ti(r.x,r.y,ke),ne.map.texture.name=de.name+".shadowMap",ne.camera.updateProjectionMatrix()}i.setRenderTarget(ne.map),i.clear();const Te=ne.getViewportCount();for(let ke=0;ke<Te;ke++){const O=ne.getViewport(ke);a.set(s.x*O.x,s.y*O.y,s.x*O.z,s.y*O.w),K.viewport(a),ne.updateMatrices(de,ke),n=ne.getFrustum(),M(k,B,ne.camera,de,this.type)}ne.isPointLightShadow!==!0&&this.type===Vn&&S(ne,B),ne.needsUpdate=!1}m=this.type,g.needsUpdate=!1,i.setRenderTarget(C,D,V)};function S(R,k){const B=e.update(b);f.defines.VSM_SAMPLES!==R.blurSamples&&(f.defines.VSM_SAMPLES=R.blurSamples,d.defines.VSM_SAMPLES=R.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new Ti(r.x,r.y)),f.uniforms.shadow_pass.value=R.map.texture,f.uniforms.resolution.value=R.mapSize,f.uniforms.radius.value=R.radius,i.setRenderTarget(R.mapPass),i.clear(),i.renderBufferDirect(k,null,B,f,b,null),d.uniforms.shadow_pass.value=R.mapPass.texture,d.uniforms.resolution.value=R.mapSize,d.uniforms.radius.value=R.radius,i.setRenderTarget(R.map),i.clear(),i.renderBufferDirect(k,null,B,d,b,null)}function y(R,k,B,C){let D=null;const V=B.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(V!==void 0)D=V;else if(D=B.isPointLight===!0?l:o,i.localClippingEnabled&&k.clipShadows===!0&&Array.isArray(k.clippingPlanes)&&k.clippingPlanes.length!==0||k.displacementMap&&k.displacementScale!==0||k.alphaMap&&k.alphaTest>0||k.map&&k.alphaTest>0||k.alphaToCoverage===!0){const K=D.uuid,J=k.uuid;let se=c[K];se===void 0&&(se={},c[K]=se);let he=se[J];he===void 0&&(he=D.clone(),se[J]=he,k.addEventListener("dispose",T)),D=he}if(D.visible=k.visible,D.wireframe=k.wireframe,C===Vn?D.side=k.shadowSide!==null?k.shadowSide:k.side:D.side=k.shadowSide!==null?k.shadowSide:u[k.side],D.alphaMap=k.alphaMap,D.alphaTest=k.alphaToCoverage===!0?.5:k.alphaTest,D.map=k.map,D.clipShadows=k.clipShadows,D.clippingPlanes=k.clippingPlanes,D.clipIntersection=k.clipIntersection,D.displacementMap=k.displacementMap,D.displacementScale=k.displacementScale,D.displacementBias=k.displacementBias,D.wireframeLinewidth=k.wireframeLinewidth,D.linewidth=k.linewidth,B.isPointLight===!0&&D.isMeshDistanceMaterial===!0){const K=i.properties.get(D);K.light=B}return D}function M(R,k,B,C,D){if(R.visible===!1)return;if(R.layers.test(k.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&D===Vn)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,R.matrixWorld);const J=e.update(R),se=R.material;if(Array.isArray(se)){const he=J.groups;for(let Q=0,de=he.length;Q<de;Q++){const ne=he[Q],ue=se[ne.materialIndex];if(ue&&ue.visible){const Te=y(R,ue,C,D);R.onBeforeShadow(i,R,k,B,J,Te,ne),i.renderBufferDirect(B,null,J,Te,R,ne),R.onAfterShadow(i,R,k,B,J,Te,ne)}}}else if(se.visible){const he=y(R,se,C,D);R.onBeforeShadow(i,R,k,B,J,he,null),i.renderBufferDirect(B,null,J,he,R,null),R.onAfterShadow(i,R,k,B,J,he,null)}}const K=R.children;for(let J=0,se=K.length;J<se;J++)M(K[J],k,B,C,D)}function T(R){R.target.removeEventListener("dispose",T);for(const B in c){const C=c[B],D=R.target.uuid;D in C&&(C[D].dispose(),delete C[D])}}}const ky={[to]:no,[io]:ao,[ro]:oo,[Ki]:so,[no]:to,[ao]:io,[oo]:ro,[so]:Ki};function By(i,e){function t(){let x=!1;const L=new pt;let p=null;const v=new pt(0,0,0,0);return{setMask:function(E){p!==E&&!x&&(i.colorMask(E,E,E,E),p=E)},setLocked:function(E){x=E},setClear:function(E,I,F,X,me){me===!0&&(E*=X,I*=X,F*=X),L.set(E,I,F,X),v.equals(L)===!1&&(i.clearColor(E,I,F,X),v.copy(L))},reset:function(){x=!1,p=null,v.set(-1,0,0,0)}}}function n(){let x=!1,L=!1,p=null,v=null,E=null;return{setReversed:function(I){if(L!==I){const F=e.get("EXT_clip_control");I?F.clipControlEXT(F.LOWER_LEFT_EXT,F.ZERO_TO_ONE_EXT):F.clipControlEXT(F.LOWER_LEFT_EXT,F.NEGATIVE_ONE_TO_ONE_EXT),L=I;const X=E;E=null,this.setClear(X)}},getReversed:function(){return L},setTest:function(I){I?ce(i.DEPTH_TEST):z(i.DEPTH_TEST)},setMask:function(I){p!==I&&!x&&(i.depthMask(I),p=I)},setFunc:function(I){if(L&&(I=ky[I]),v!==I){switch(I){case to:i.depthFunc(i.NEVER);break;case no:i.depthFunc(i.ALWAYS);break;case io:i.depthFunc(i.LESS);break;case Ki:i.depthFunc(i.LEQUAL);break;case ro:i.depthFunc(i.EQUAL);break;case so:i.depthFunc(i.GEQUAL);break;case ao:i.depthFunc(i.GREATER);break;case oo:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}v=I}},setLocked:function(I){x=I},setClear:function(I){E!==I&&(L&&(I=1-I),i.clearDepth(I),E=I)},reset:function(){x=!1,p=null,v=null,E=null,L=!1}}}function r(){let x=!1,L=null,p=null,v=null,E=null,I=null,F=null,X=null,me=null;return{setTest:function(ve){x||(ve?ce(i.STENCIL_TEST):z(i.STENCIL_TEST))},setMask:function(ve){L!==ve&&!x&&(i.stencilMask(ve),L=ve)},setFunc:function(ve,$e,Ne){(p!==ve||v!==$e||E!==Ne)&&(i.stencilFunc(ve,$e,Ne),p=ve,v=$e,E=Ne)},setOp:function(ve,$e,Ne){(I!==ve||F!==$e||X!==Ne)&&(i.stencilOp(ve,$e,Ne),I=ve,F=$e,X=Ne)},setLocked:function(ve){x=ve},setClear:function(ve){me!==ve&&(i.clearStencil(ve),me=ve)},reset:function(){x=!1,L=null,p=null,v=null,E=null,I=null,F=null,X=null,me=null}}}const s=new t,a=new n,o=new r,l=new WeakMap,c=new WeakMap;let h={},u={},f=new WeakMap,d=[],_=null,b=!1,g=null,m=null,S=null,y=null,M=null,T=null,R=null,k=new Ze(0,0,0),B=0,C=!1,D=null,V=null,K=null,J=null,se=null;const he=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Q=!1,de=0;const ne=i.getParameter(i.VERSION);ne.indexOf("WebGL")!==-1?(de=parseFloat(/^WebGL (\d)/.exec(ne)[1]),Q=de>=1):ne.indexOf("OpenGL ES")!==-1&&(de=parseFloat(/^OpenGL ES (\d)/.exec(ne)[1]),Q=de>=2);let ue=null,Te={};const ke=i.getParameter(i.SCISSOR_BOX),O=i.getParameter(i.VIEWPORT),H=new pt().fromArray(ke),we=new pt().fromArray(O);function Be(x,L,p,v){const E=new Uint8Array(4),I=i.createTexture();i.bindTexture(x,I),i.texParameteri(x,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(x,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let F=0;F<p;F++)x===i.TEXTURE_3D||x===i.TEXTURE_2D_ARRAY?i.texImage3D(L,0,i.RGBA,1,1,v,0,i.RGBA,i.UNSIGNED_BYTE,E):i.texImage2D(L+F,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,E);return I}const ie={};ie[i.TEXTURE_2D]=Be(i.TEXTURE_2D,i.TEXTURE_2D,1),ie[i.TEXTURE_CUBE_MAP]=Be(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),ie[i.TEXTURE_2D_ARRAY]=Be(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),ie[i.TEXTURE_3D]=Be(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ce(i.DEPTH_TEST),a.setFunc(Ki),ye(!1),Se(nu),ce(i.CULL_FACE),ee(ii);function ce(x){h[x]!==!0&&(i.enable(x),h[x]=!0)}function z(x){h[x]!==!1&&(i.disable(x),h[x]=!1)}function j(x,L){return u[x]!==L?(i.bindFramebuffer(x,L),u[x]=L,x===i.DRAW_FRAMEBUFFER&&(u[i.FRAMEBUFFER]=L),x===i.FRAMEBUFFER&&(u[i.DRAW_FRAMEBUFFER]=L),!0):!1}function W(x,L){let p=d,v=!1;if(x){p=f.get(L),p===void 0&&(p=[],f.set(L,p));const E=x.textures;if(p.length!==E.length||p[0]!==i.COLOR_ATTACHMENT0){for(let I=0,F=E.length;I<F;I++)p[I]=i.COLOR_ATTACHMENT0+I;p.length=E.length,v=!0}}else p[0]!==i.BACK&&(p[0]=i.BACK,v=!0);v&&i.drawBuffers(p)}function le(x){return _!==x?(i.useProgram(x),_=x,!0):!1}const be={[Si]:i.FUNC_ADD,[Ap]:i.FUNC_SUBTRACT,[Rp]:i.FUNC_REVERSE_SUBTRACT};be[Cp]=i.MIN,be[Pp]=i.MAX;const U={[Dp]:i.ZERO,[Lp]:i.ONE,[Ip]:i.SRC_COLOR,[Qa]:i.SRC_ALPHA,[Bp]:i.SRC_ALPHA_SATURATE,[Fp]:i.DST_COLOR,[Np]:i.DST_ALPHA,[Up]:i.ONE_MINUS_SRC_COLOR,[eo]:i.ONE_MINUS_SRC_ALPHA,[kp]:i.ONE_MINUS_DST_COLOR,[Op]:i.ONE_MINUS_DST_ALPHA,[zp]:i.CONSTANT_COLOR,[Hp]:i.ONE_MINUS_CONSTANT_COLOR,[Vp]:i.CONSTANT_ALPHA,[Gp]:i.ONE_MINUS_CONSTANT_ALPHA};function ee(x,L,p,v,E,I,F,X,me,ve){if(x===ii){b===!0&&(z(i.BLEND),b=!1);return}if(b===!1&&(ce(i.BLEND),b=!0),x!==wp){if(x!==g||ve!==C){if((m!==Si||M!==Si)&&(i.blendEquation(i.FUNC_ADD),m=Si,M=Si),ve)switch(x){case Yi:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ru:i.blendFunc(i.ONE,i.ONE);break;case su:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case au:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:console.error("THREE.WebGLState: Invalid blending: ",x);break}else switch(x){case Yi:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ru:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case su:console.error("THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case au:console.error("THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:console.error("THREE.WebGLState: Invalid blending: ",x);break}S=null,y=null,T=null,R=null,k.set(0,0,0),B=0,g=x,C=ve}return}E=E||L,I=I||p,F=F||v,(L!==m||E!==M)&&(i.blendEquationSeparate(be[L],be[E]),m=L,M=E),(p!==S||v!==y||I!==T||F!==R)&&(i.blendFuncSeparate(U[p],U[v],U[I],U[F]),S=p,y=v,T=I,R=F),(X.equals(k)===!1||me!==B)&&(i.blendColor(X.r,X.g,X.b,me),k.copy(X),B=me),g=x,C=!1}function fe(x,L){x.side===Rn?z(i.CULL_FACE):ce(i.CULL_FACE);let p=x.side===sn;L&&(p=!p),ye(p),x.blending===Yi&&x.transparent===!1?ee(ii):ee(x.blending,x.blendEquation,x.blendSrc,x.blendDst,x.blendEquationAlpha,x.blendSrcAlpha,x.blendDstAlpha,x.blendColor,x.blendAlpha,x.premultipliedAlpha),a.setFunc(x.depthFunc),a.setTest(x.depthTest),a.setMask(x.depthWrite),s.setMask(x.colorWrite);const v=x.stencilWrite;o.setTest(v),v&&(o.setMask(x.stencilWriteMask),o.setFunc(x.stencilFunc,x.stencilRef,x.stencilFuncMask),o.setOp(x.stencilFail,x.stencilZFail,x.stencilZPass)),_e(x.polygonOffset,x.polygonOffsetFactor,x.polygonOffsetUnits),x.alphaToCoverage===!0?ce(i.SAMPLE_ALPHA_TO_COVERAGE):z(i.SAMPLE_ALPHA_TO_COVERAGE)}function ye(x){D!==x&&(x?i.frontFace(i.CW):i.frontFace(i.CCW),D=x)}function Se(x){x!==Mp?(ce(i.CULL_FACE),x!==V&&(x===nu?i.cullFace(i.BACK):x===Ep?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):z(i.CULL_FACE),V=x}function ze(x){x!==K&&(Q&&i.lineWidth(x),K=x)}function _e(x,L,p){x?(ce(i.POLYGON_OFFSET_FILL),(J!==L||se!==p)&&(i.polygonOffset(L,p),J=L,se=p)):z(i.POLYGON_OFFSET_FILL)}function xe(x){x?ce(i.SCISSOR_TEST):z(i.SCISSOR_TEST)}function Xe(x){x===void 0&&(x=i.TEXTURE0+he-1),ue!==x&&(i.activeTexture(x),ue=x)}function De(x,L,p){p===void 0&&(ue===null?p=i.TEXTURE0+he-1:p=ue);let v=Te[p];v===void 0&&(v={type:void 0,texture:void 0},Te[p]=v),(v.type!==x||v.texture!==L)&&(ue!==p&&(i.activeTexture(p),ue=p),i.bindTexture(x,L||ie[x]),v.type=x,v.texture=L)}function N(){const x=Te[ue];x!==void 0&&x.type!==void 0&&(i.bindTexture(x.type,null),x.type=void 0,x.texture=void 0)}function w(){try{i.compressedTexImage2D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function q(){try{i.compressedTexImage3D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function re(){try{i.texSubImage2D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function pe(){try{i.texSubImage3D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function ae(){try{i.compressedTexSubImage2D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function Ve(){try{i.compressedTexSubImage3D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function Ae(){try{i.texStorage2D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function oe(){try{i.texStorage3D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function We(){try{i.texImage2D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function Me(){try{i.texImage3D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function Re(x){H.equals(x)===!1&&(i.scissor(x.x,x.y,x.z,x.w),H.copy(x))}function je(x){we.equals(x)===!1&&(i.viewport(x.x,x.y,x.z,x.w),we.copy(x))}function Oe(x,L){let p=c.get(L);p===void 0&&(p=new WeakMap,c.set(L,p));let v=p.get(x);v===void 0&&(v=i.getUniformBlockIndex(L,x.name),p.set(x,v))}function Ce(x,L){const v=c.get(L).get(x);l.get(L)!==v&&(i.uniformBlockBinding(L,v,x.__bindingPointIndex),l.set(L,v))}function A(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),a.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),h={},ue=null,Te={},u={},f=new WeakMap,d=[],_=null,b=!1,g=null,m=null,S=null,y=null,M=null,T=null,R=null,k=new Ze(0,0,0),B=0,C=!1,D=null,V=null,K=null,J=null,se=null,H.set(0,0,i.canvas.width,i.canvas.height),we.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ce,disable:z,bindFramebuffer:j,drawBuffers:W,useProgram:le,setBlending:ee,setMaterial:fe,setFlipSided:ye,setCullFace:Se,setLineWidth:ze,setPolygonOffset:_e,setScissorTest:xe,activeTexture:Xe,bindTexture:De,unbindTexture:N,compressedTexImage2D:w,compressedTexImage3D:q,texImage2D:We,texImage3D:Me,updateUBOMapping:Oe,uniformBlockBinding:Ce,texStorage2D:Ae,texStorage3D:oe,texSubImage2D:re,texSubImage3D:pe,compressedTexSubImage2D:ae,compressedTexSubImage3D:Ve,scissor:Re,viewport:je,reset:A}}function zy(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Ye,h=new WeakMap;let u;const f=new WeakMap;let d=!1;try{d=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(N,w){return d?new OffscreenCanvas(N,w):Zr("canvas")}function b(N,w,q){let re=1;const pe=De(N);if((pe.width>q||pe.height>q)&&(re=q/Math.max(pe.width,pe.height)),re<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const ae=Math.floor(re*pe.width),Ve=Math.floor(re*pe.height);u===void 0&&(u=_(ae,Ve));const Ae=w?_(ae,Ve):u;return Ae.width=ae,Ae.height=Ve,Ae.getContext("2d").drawImage(N,0,0,ae,Ve),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+pe.width+"x"+pe.height+") to ("+ae+"x"+Ve+")."),Ae}else return"data"in N&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+pe.width+"x"+pe.height+")."),N;return N}function g(N){return N.generateMipmaps}function m(N){i.generateMipmap(N)}function S(N){return N.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:N.isWebGL3DRenderTarget?i.TEXTURE_3D:N.isWebGLArrayRenderTarget||N.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function y(N,w,q,re,pe=!1){if(N!==null){if(i[N]!==void 0)return i[N];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let ae=w;if(w===i.RED&&(q===i.FLOAT&&(ae=i.R32F),q===i.HALF_FLOAT&&(ae=i.R16F),q===i.UNSIGNED_BYTE&&(ae=i.R8)),w===i.RED_INTEGER&&(q===i.UNSIGNED_BYTE&&(ae=i.R8UI),q===i.UNSIGNED_SHORT&&(ae=i.R16UI),q===i.UNSIGNED_INT&&(ae=i.R32UI),q===i.BYTE&&(ae=i.R8I),q===i.SHORT&&(ae=i.R16I),q===i.INT&&(ae=i.R32I)),w===i.RG&&(q===i.FLOAT&&(ae=i.RG32F),q===i.HALF_FLOAT&&(ae=i.RG16F),q===i.UNSIGNED_BYTE&&(ae=i.RG8)),w===i.RG_INTEGER&&(q===i.UNSIGNED_BYTE&&(ae=i.RG8UI),q===i.UNSIGNED_SHORT&&(ae=i.RG16UI),q===i.UNSIGNED_INT&&(ae=i.RG32UI),q===i.BYTE&&(ae=i.RG8I),q===i.SHORT&&(ae=i.RG16I),q===i.INT&&(ae=i.RG32I)),w===i.RGB_INTEGER&&(q===i.UNSIGNED_BYTE&&(ae=i.RGB8UI),q===i.UNSIGNED_SHORT&&(ae=i.RGB16UI),q===i.UNSIGNED_INT&&(ae=i.RGB32UI),q===i.BYTE&&(ae=i.RGB8I),q===i.SHORT&&(ae=i.RGB16I),q===i.INT&&(ae=i.RGB32I)),w===i.RGBA_INTEGER&&(q===i.UNSIGNED_BYTE&&(ae=i.RGBA8UI),q===i.UNSIGNED_SHORT&&(ae=i.RGBA16UI),q===i.UNSIGNED_INT&&(ae=i.RGBA32UI),q===i.BYTE&&(ae=i.RGBA8I),q===i.SHORT&&(ae=i.RGBA16I),q===i.INT&&(ae=i.RGBA32I)),w===i.RGB&&(q===i.UNSIGNED_INT_5_9_9_9_REV&&(ae=i.RGB9_E5),q===i.UNSIGNED_INT_10F_11F_11F_REV&&(ae=i.R11F_G11F_B10F)),w===i.RGBA){const Ve=pe?Ns:lt.getTransfer(re);q===i.FLOAT&&(ae=i.RGBA32F),q===i.HALF_FLOAT&&(ae=i.RGBA16F),q===i.UNSIGNED_BYTE&&(ae=Ve===xt?i.SRGB8_ALPHA8:i.RGBA8),q===i.UNSIGNED_SHORT_4_4_4_4&&(ae=i.RGBA4),q===i.UNSIGNED_SHORT_5_5_5_1&&(ae=i.RGB5_A1)}return(ae===i.R16F||ae===i.R32F||ae===i.RG16F||ae===i.RG32F||ae===i.RGBA16F||ae===i.RGBA32F)&&e.get("EXT_color_buffer_float"),ae}function M(N,w){let q;return N?w===null||w===Mi||w===Wr?q=i.DEPTH24_STENCIL8:w===_n?q=i.DEPTH32F_STENCIL8:w===Vr&&(q=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):w===null||w===Mi||w===Wr?q=i.DEPTH_COMPONENT24:w===_n?q=i.DEPTH_COMPONENT32F:w===Vr&&(q=i.DEPTH_COMPONENT16),q}function T(N,w){return g(N)===!0||N.isFramebufferTexture&&N.minFilter!==Yt&&N.minFilter!==ln?Math.log2(Math.max(w.width,w.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?w.mipmaps.length:1}function R(N){const w=N.target;w.removeEventListener("dispose",R),B(w),w.isVideoTexture&&h.delete(w)}function k(N){const w=N.target;w.removeEventListener("dispose",k),D(w)}function B(N){const w=n.get(N);if(w.__webglInit===void 0)return;const q=N.source,re=f.get(q);if(re){const pe=re[w.__cacheKey];pe.usedTimes--,pe.usedTimes===0&&C(N),Object.keys(re).length===0&&f.delete(q)}n.remove(N)}function C(N){const w=n.get(N);i.deleteTexture(w.__webglTexture);const q=N.source,re=f.get(q);delete re[w.__cacheKey],a.memory.textures--}function D(N){const w=n.get(N);if(N.depthTexture&&(N.depthTexture.dispose(),n.remove(N.depthTexture)),N.isWebGLCubeRenderTarget)for(let re=0;re<6;re++){if(Array.isArray(w.__webglFramebuffer[re]))for(let pe=0;pe<w.__webglFramebuffer[re].length;pe++)i.deleteFramebuffer(w.__webglFramebuffer[re][pe]);else i.deleteFramebuffer(w.__webglFramebuffer[re]);w.__webglDepthbuffer&&i.deleteRenderbuffer(w.__webglDepthbuffer[re])}else{if(Array.isArray(w.__webglFramebuffer))for(let re=0;re<w.__webglFramebuffer.length;re++)i.deleteFramebuffer(w.__webglFramebuffer[re]);else i.deleteFramebuffer(w.__webglFramebuffer);if(w.__webglDepthbuffer&&i.deleteRenderbuffer(w.__webglDepthbuffer),w.__webglMultisampledFramebuffer&&i.deleteFramebuffer(w.__webglMultisampledFramebuffer),w.__webglColorRenderbuffer)for(let re=0;re<w.__webglColorRenderbuffer.length;re++)w.__webglColorRenderbuffer[re]&&i.deleteRenderbuffer(w.__webglColorRenderbuffer[re]);w.__webglDepthRenderbuffer&&i.deleteRenderbuffer(w.__webglDepthRenderbuffer)}const q=N.textures;for(let re=0,pe=q.length;re<pe;re++){const ae=n.get(q[re]);ae.__webglTexture&&(i.deleteTexture(ae.__webglTexture),a.memory.textures--),n.remove(q[re])}n.remove(N)}let V=0;function K(){V=0}function J(){const N=V;return N>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+r.maxTextures),V+=1,N}function se(N){const w=[];return w.push(N.wrapS),w.push(N.wrapT),w.push(N.wrapR||0),w.push(N.magFilter),w.push(N.minFilter),w.push(N.anisotropy),w.push(N.internalFormat),w.push(N.format),w.push(N.type),w.push(N.generateMipmaps),w.push(N.premultiplyAlpha),w.push(N.flipY),w.push(N.unpackAlignment),w.push(N.colorSpace),w.join()}function he(N,w){const q=n.get(N);if(N.isVideoTexture&&xe(N),N.isRenderTargetTexture===!1&&N.isExternalTexture!==!0&&N.version>0&&q.__version!==N.version){const re=N.image;if(re===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(re.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ie(q,N,w);return}}else N.isExternalTexture&&(q.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,q.__webglTexture,i.TEXTURE0+w)}function Q(N,w){const q=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&q.__version!==N.version){ie(q,N,w);return}t.bindTexture(i.TEXTURE_2D_ARRAY,q.__webglTexture,i.TEXTURE0+w)}function de(N,w){const q=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&q.__version!==N.version){ie(q,N,w);return}t.bindTexture(i.TEXTURE_3D,q.__webglTexture,i.TEXTURE0+w)}function ne(N,w){const q=n.get(N);if(N.version>0&&q.__version!==N.version){ce(q,N,w);return}t.bindTexture(i.TEXTURE_CUBE_MAP,q.__webglTexture,i.TEXTURE0+w)}const ue={[Qi]:i.REPEAT,[si]:i.CLAMP_TO_EDGE,[Cs]:i.MIRRORED_REPEAT},Te={[Yt]:i.NEAREST,[hu]:i.NEAREST_MIPMAP_NEAREST,[Hr]:i.NEAREST_MIPMAP_LINEAR,[ln]:i.LINEAR,[Ps]:i.LINEAR_MIPMAP_NEAREST,[Wn]:i.LINEAR_MIPMAP_LINEAR},ke={[rm]:i.NEVER,[um]:i.ALWAYS,[sm]:i.LESS,[Tu]:i.LEQUAL,[am]:i.EQUAL,[cm]:i.GEQUAL,[om]:i.GREATER,[lm]:i.NOTEQUAL};function O(N,w){if(w.type===_n&&e.has("OES_texture_float_linear")===!1&&(w.magFilter===ln||w.magFilter===Ps||w.magFilter===Hr||w.magFilter===Wn||w.minFilter===ln||w.minFilter===Ps||w.minFilter===Hr||w.minFilter===Wn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(N,i.TEXTURE_WRAP_S,ue[w.wrapS]),i.texParameteri(N,i.TEXTURE_WRAP_T,ue[w.wrapT]),(N===i.TEXTURE_3D||N===i.TEXTURE_2D_ARRAY)&&i.texParameteri(N,i.TEXTURE_WRAP_R,ue[w.wrapR]),i.texParameteri(N,i.TEXTURE_MAG_FILTER,Te[w.magFilter]),i.texParameteri(N,i.TEXTURE_MIN_FILTER,Te[w.minFilter]),w.compareFunction&&(i.texParameteri(N,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(N,i.TEXTURE_COMPARE_FUNC,ke[w.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(w.magFilter===Yt||w.minFilter!==Hr&&w.minFilter!==Wn||w.type===_n&&e.has("OES_texture_float_linear")===!1)return;if(w.anisotropy>1||n.get(w).__currentAnisotropy){const q=e.get("EXT_texture_filter_anisotropic");i.texParameterf(N,q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(w.anisotropy,r.getMaxAnisotropy())),n.get(w).__currentAnisotropy=w.anisotropy}}}function H(N,w){let q=!1;N.__webglInit===void 0&&(N.__webglInit=!0,w.addEventListener("dispose",R));const re=w.source;let pe=f.get(re);pe===void 0&&(pe={},f.set(re,pe));const ae=se(w);if(ae!==N.__cacheKey){pe[ae]===void 0&&(pe[ae]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,q=!0),pe[ae].usedTimes++;const Ve=pe[N.__cacheKey];Ve!==void 0&&(pe[N.__cacheKey].usedTimes--,Ve.usedTimes===0&&C(w)),N.__cacheKey=ae,N.__webglTexture=pe[ae].texture}return q}function we(N,w,q){return Math.floor(Math.floor(N/q)/w)}function Be(N,w,q,re){const ae=N.updateRanges;if(ae.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,w.width,w.height,q,re,w.data);else{ae.sort((Me,Re)=>Me.start-Re.start);let Ve=0;for(let Me=1;Me<ae.length;Me++){const Re=ae[Ve],je=ae[Me],Oe=Re.start+Re.count,Ce=we(je.start,w.width,4),A=we(Re.start,w.width,4);je.start<=Oe+1&&Ce===A&&we(je.start+je.count-1,w.width,4)===Ce?Re.count=Math.max(Re.count,je.start+je.count-Re.start):(++Ve,ae[Ve]=je)}ae.length=Ve+1;const Ae=i.getParameter(i.UNPACK_ROW_LENGTH),oe=i.getParameter(i.UNPACK_SKIP_PIXELS),We=i.getParameter(i.UNPACK_SKIP_ROWS);i.pixelStorei(i.UNPACK_ROW_LENGTH,w.width);for(let Me=0,Re=ae.length;Me<Re;Me++){const je=ae[Me],Oe=Math.floor(je.start/4),Ce=Math.ceil(je.count/4),A=Oe%w.width,x=Math.floor(Oe/w.width),L=Ce,p=1;i.pixelStorei(i.UNPACK_SKIP_PIXELS,A),i.pixelStorei(i.UNPACK_SKIP_ROWS,x),t.texSubImage2D(i.TEXTURE_2D,0,A,x,L,p,q,re,w.data)}N.clearUpdateRanges(),i.pixelStorei(i.UNPACK_ROW_LENGTH,Ae),i.pixelStorei(i.UNPACK_SKIP_PIXELS,oe),i.pixelStorei(i.UNPACK_SKIP_ROWS,We)}}function ie(N,w,q){let re=i.TEXTURE_2D;(w.isDataArrayTexture||w.isCompressedArrayTexture)&&(re=i.TEXTURE_2D_ARRAY),w.isData3DTexture&&(re=i.TEXTURE_3D);const pe=H(N,w),ae=w.source;t.bindTexture(re,N.__webglTexture,i.TEXTURE0+q);const Ve=n.get(ae);if(ae.version!==Ve.__version||pe===!0){t.activeTexture(i.TEXTURE0+q);const Ae=lt.getPrimaries(lt.workingColorSpace),oe=w.colorSpace===ai?null:lt.getPrimaries(w.colorSpace),We=w.colorSpace===ai||Ae===oe?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,w.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,w.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,w.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,We);let Me=b(w.image,!1,r.maxTextureSize);Me=Xe(w,Me);const Re=s.convert(w.format,w.colorSpace),je=s.convert(w.type);let Oe=y(w.internalFormat,Re,je,w.colorSpace,w.isVideoTexture);O(re,w);let Ce;const A=w.mipmaps,x=w.isVideoTexture!==!0,L=Ve.__version===void 0||pe===!0,p=ae.dataReady,v=T(w,Me);if(w.isDepthTexture)Oe=M(w.format===$r,w.type),L&&(x?t.texStorage2D(i.TEXTURE_2D,1,Oe,Me.width,Me.height):t.texImage2D(i.TEXTURE_2D,0,Oe,Me.width,Me.height,0,Re,je,null));else if(w.isDataTexture)if(A.length>0){x&&L&&t.texStorage2D(i.TEXTURE_2D,v,Oe,A[0].width,A[0].height);for(let E=0,I=A.length;E<I;E++)Ce=A[E],x?p&&t.texSubImage2D(i.TEXTURE_2D,E,0,0,Ce.width,Ce.height,Re,je,Ce.data):t.texImage2D(i.TEXTURE_2D,E,Oe,Ce.width,Ce.height,0,Re,je,Ce.data);w.generateMipmaps=!1}else x?(L&&t.texStorage2D(i.TEXTURE_2D,v,Oe,Me.width,Me.height),p&&Be(w,Me,Re,je)):t.texImage2D(i.TEXTURE_2D,0,Oe,Me.width,Me.height,0,Re,je,Me.data);else if(w.isCompressedTexture)if(w.isCompressedArrayTexture){x&&L&&t.texStorage3D(i.TEXTURE_2D_ARRAY,v,Oe,A[0].width,A[0].height,Me.depth);for(let E=0,I=A.length;E<I;E++)if(Ce=A[E],w.format!==fn)if(Re!==null)if(x){if(p)if(w.layerUpdates.size>0){const F=Ph(Ce.width,Ce.height,w.format,w.type);for(const X of w.layerUpdates){const me=Ce.data.subarray(X*F/Ce.data.BYTES_PER_ELEMENT,(X+1)*F/Ce.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,E,0,0,X,Ce.width,Ce.height,1,Re,me)}w.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,E,0,0,0,Ce.width,Ce.height,Me.depth,Re,Ce.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,E,Oe,Ce.width,Ce.height,Me.depth,0,Ce.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else x?p&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,E,0,0,0,Ce.width,Ce.height,Me.depth,Re,je,Ce.data):t.texImage3D(i.TEXTURE_2D_ARRAY,E,Oe,Ce.width,Ce.height,Me.depth,0,Re,je,Ce.data)}else{x&&L&&t.texStorage2D(i.TEXTURE_2D,v,Oe,A[0].width,A[0].height);for(let E=0,I=A.length;E<I;E++)Ce=A[E],w.format!==fn?Re!==null?x?p&&t.compressedTexSubImage2D(i.TEXTURE_2D,E,0,0,Ce.width,Ce.height,Re,Ce.data):t.compressedTexImage2D(i.TEXTURE_2D,E,Oe,Ce.width,Ce.height,0,Ce.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):x?p&&t.texSubImage2D(i.TEXTURE_2D,E,0,0,Ce.width,Ce.height,Re,je,Ce.data):t.texImage2D(i.TEXTURE_2D,E,Oe,Ce.width,Ce.height,0,Re,je,Ce.data)}else if(w.isDataArrayTexture)if(x){if(L&&t.texStorage3D(i.TEXTURE_2D_ARRAY,v,Oe,Me.width,Me.height,Me.depth),p)if(w.layerUpdates.size>0){const E=Ph(Me.width,Me.height,w.format,w.type);for(const I of w.layerUpdates){const F=Me.data.subarray(I*E/Me.data.BYTES_PER_ELEMENT,(I+1)*E/Me.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,I,Me.width,Me.height,1,Re,je,F)}w.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Me.width,Me.height,Me.depth,Re,je,Me.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Oe,Me.width,Me.height,Me.depth,0,Re,je,Me.data);else if(w.isData3DTexture)x?(L&&t.texStorage3D(i.TEXTURE_3D,v,Oe,Me.width,Me.height,Me.depth),p&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Me.width,Me.height,Me.depth,Re,je,Me.data)):t.texImage3D(i.TEXTURE_3D,0,Oe,Me.width,Me.height,Me.depth,0,Re,je,Me.data);else if(w.isFramebufferTexture){if(L)if(x)t.texStorage2D(i.TEXTURE_2D,v,Oe,Me.width,Me.height);else{let E=Me.width,I=Me.height;for(let F=0;F<v;F++)t.texImage2D(i.TEXTURE_2D,F,Oe,E,I,0,Re,je,null),E>>=1,I>>=1}}else if(A.length>0){if(x&&L){const E=De(A[0]);t.texStorage2D(i.TEXTURE_2D,v,Oe,E.width,E.height)}for(let E=0,I=A.length;E<I;E++)Ce=A[E],x?p&&t.texSubImage2D(i.TEXTURE_2D,E,0,0,Re,je,Ce):t.texImage2D(i.TEXTURE_2D,E,Oe,Re,je,Ce);w.generateMipmaps=!1}else if(x){if(L){const E=De(Me);t.texStorage2D(i.TEXTURE_2D,v,Oe,E.width,E.height)}p&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Re,je,Me)}else t.texImage2D(i.TEXTURE_2D,0,Oe,Re,je,Me);g(w)&&m(re),Ve.__version=ae.version,w.onUpdate&&w.onUpdate(w)}N.__version=w.version}function ce(N,w,q){if(w.image.length!==6)return;const re=H(N,w),pe=w.source;t.bindTexture(i.TEXTURE_CUBE_MAP,N.__webglTexture,i.TEXTURE0+q);const ae=n.get(pe);if(pe.version!==ae.__version||re===!0){t.activeTexture(i.TEXTURE0+q);const Ve=lt.getPrimaries(lt.workingColorSpace),Ae=w.colorSpace===ai?null:lt.getPrimaries(w.colorSpace),oe=w.colorSpace===ai||Ve===Ae?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,w.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,w.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,w.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,oe);const We=w.isCompressedTexture||w.image[0].isCompressedTexture,Me=w.image[0]&&w.image[0].isDataTexture,Re=[];for(let I=0;I<6;I++)!We&&!Me?Re[I]=b(w.image[I],!0,r.maxCubemapSize):Re[I]=Me?w.image[I].image:w.image[I],Re[I]=Xe(w,Re[I]);const je=Re[0],Oe=s.convert(w.format,w.colorSpace),Ce=s.convert(w.type),A=y(w.internalFormat,Oe,Ce,w.colorSpace),x=w.isVideoTexture!==!0,L=ae.__version===void 0||re===!0,p=pe.dataReady;let v=T(w,je);O(i.TEXTURE_CUBE_MAP,w);let E;if(We){x&&L&&t.texStorage2D(i.TEXTURE_CUBE_MAP,v,A,je.width,je.height);for(let I=0;I<6;I++){E=Re[I].mipmaps;for(let F=0;F<E.length;F++){const X=E[F];w.format!==fn?Oe!==null?x?p&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,F,0,0,X.width,X.height,Oe,X.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,F,A,X.width,X.height,0,X.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):x?p&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,F,0,0,X.width,X.height,Oe,Ce,X.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,F,A,X.width,X.height,0,Oe,Ce,X.data)}}}else{if(E=w.mipmaps,x&&L){E.length>0&&v++;const I=De(Re[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,v,A,I.width,I.height)}for(let I=0;I<6;I++)if(Me){x?p&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,0,0,Re[I].width,Re[I].height,Oe,Ce,Re[I].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,A,Re[I].width,Re[I].height,0,Oe,Ce,Re[I].data);for(let F=0;F<E.length;F++){const me=E[F].image[I].image;x?p&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,F+1,0,0,me.width,me.height,Oe,Ce,me.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,F+1,A,me.width,me.height,0,Oe,Ce,me.data)}}else{x?p&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,0,0,Oe,Ce,Re[I]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,A,Oe,Ce,Re[I]);for(let F=0;F<E.length;F++){const X=E[F];x?p&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,F+1,0,0,Oe,Ce,X.image[I]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,F+1,A,Oe,Ce,X.image[I])}}}g(w)&&m(i.TEXTURE_CUBE_MAP),ae.__version=pe.version,w.onUpdate&&w.onUpdate(w)}N.__version=w.version}function z(N,w,q,re,pe,ae){const Ve=s.convert(q.format,q.colorSpace),Ae=s.convert(q.type),oe=y(q.internalFormat,Ve,Ae,q.colorSpace),We=n.get(w),Me=n.get(q);if(Me.__renderTarget=w,!We.__hasExternalTextures){const Re=Math.max(1,w.width>>ae),je=Math.max(1,w.height>>ae);pe===i.TEXTURE_3D||pe===i.TEXTURE_2D_ARRAY?t.texImage3D(pe,ae,oe,Re,je,w.depth,0,Ve,Ae,null):t.texImage2D(pe,ae,oe,Re,je,0,Ve,Ae,null)}t.bindFramebuffer(i.FRAMEBUFFER,N),_e(w)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,re,pe,Me.__webglTexture,0,ze(w)):(pe===i.TEXTURE_2D||pe>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&pe<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,re,pe,Me.__webglTexture,ae),t.bindFramebuffer(i.FRAMEBUFFER,null)}function j(N,w,q){if(i.bindRenderbuffer(i.RENDERBUFFER,N),w.depthBuffer){const re=w.depthTexture,pe=re&&re.isDepthTexture?re.type:null,ae=M(w.stencilBuffer,pe),Ve=w.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Ae=ze(w);_e(w)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Ae,ae,w.width,w.height):q?i.renderbufferStorageMultisample(i.RENDERBUFFER,Ae,ae,w.width,w.height):i.renderbufferStorage(i.RENDERBUFFER,ae,w.width,w.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ve,i.RENDERBUFFER,N)}else{const re=w.textures;for(let pe=0;pe<re.length;pe++){const ae=re[pe],Ve=s.convert(ae.format,ae.colorSpace),Ae=s.convert(ae.type),oe=y(ae.internalFormat,Ve,Ae,ae.colorSpace),We=ze(w);q&&_e(w)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,We,oe,w.width,w.height):_e(w)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,We,oe,w.width,w.height):i.renderbufferStorage(i.RENDERBUFFER,oe,w.width,w.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function W(N,w){if(w&&w.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,N),!(w.depthTexture&&w.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const re=n.get(w.depthTexture);re.__renderTarget=w,(!re.__webglTexture||w.depthTexture.image.width!==w.width||w.depthTexture.image.height!==w.height)&&(w.depthTexture.image.width=w.width,w.depthTexture.image.height=w.height,w.depthTexture.needsUpdate=!0),he(w.depthTexture,0);const pe=re.__webglTexture,ae=ze(w);if(w.depthTexture.format===Xr)_e(w)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,pe,0,ae):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,pe,0);else if(w.depthTexture.format===$r)_e(w)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,pe,0,ae):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,pe,0);else throw new Error("Unknown depthTexture format")}function le(N){const w=n.get(N),q=N.isWebGLCubeRenderTarget===!0;if(w.__boundDepthTexture!==N.depthTexture){const re=N.depthTexture;if(w.__depthDisposeCallback&&w.__depthDisposeCallback(),re){const pe=()=>{delete w.__boundDepthTexture,delete w.__depthDisposeCallback,re.removeEventListener("dispose",pe)};re.addEventListener("dispose",pe),w.__depthDisposeCallback=pe}w.__boundDepthTexture=re}if(N.depthTexture&&!w.__autoAllocateDepthBuffer){if(q)throw new Error("target.depthTexture not supported in Cube render targets");const re=N.texture.mipmaps;re&&re.length>0?W(w.__webglFramebuffer[0],N):W(w.__webglFramebuffer,N)}else if(q){w.__webglDepthbuffer=[];for(let re=0;re<6;re++)if(t.bindFramebuffer(i.FRAMEBUFFER,w.__webglFramebuffer[re]),w.__webglDepthbuffer[re]===void 0)w.__webglDepthbuffer[re]=i.createRenderbuffer(),j(w.__webglDepthbuffer[re],N,!1);else{const pe=N.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ae=w.__webglDepthbuffer[re];i.bindRenderbuffer(i.RENDERBUFFER,ae),i.framebufferRenderbuffer(i.FRAMEBUFFER,pe,i.RENDERBUFFER,ae)}}else{const re=N.texture.mipmaps;if(re&&re.length>0?t.bindFramebuffer(i.FRAMEBUFFER,w.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,w.__webglFramebuffer),w.__webglDepthbuffer===void 0)w.__webglDepthbuffer=i.createRenderbuffer(),j(w.__webglDepthbuffer,N,!1);else{const pe=N.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ae=w.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,ae),i.framebufferRenderbuffer(i.FRAMEBUFFER,pe,i.RENDERBUFFER,ae)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function be(N,w,q){const re=n.get(N);w!==void 0&&z(re.__webglFramebuffer,N,N.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),q!==void 0&&le(N)}function U(N){const w=N.texture,q=n.get(N),re=n.get(w);N.addEventListener("dispose",k);const pe=N.textures,ae=N.isWebGLCubeRenderTarget===!0,Ve=pe.length>1;if(Ve||(re.__webglTexture===void 0&&(re.__webglTexture=i.createTexture()),re.__version=w.version,a.memory.textures++),ae){q.__webglFramebuffer=[];for(let Ae=0;Ae<6;Ae++)if(w.mipmaps&&w.mipmaps.length>0){q.__webglFramebuffer[Ae]=[];for(let oe=0;oe<w.mipmaps.length;oe++)q.__webglFramebuffer[Ae][oe]=i.createFramebuffer()}else q.__webglFramebuffer[Ae]=i.createFramebuffer()}else{if(w.mipmaps&&w.mipmaps.length>0){q.__webglFramebuffer=[];for(let Ae=0;Ae<w.mipmaps.length;Ae++)q.__webglFramebuffer[Ae]=i.createFramebuffer()}else q.__webglFramebuffer=i.createFramebuffer();if(Ve)for(let Ae=0,oe=pe.length;Ae<oe;Ae++){const We=n.get(pe[Ae]);We.__webglTexture===void 0&&(We.__webglTexture=i.createTexture(),a.memory.textures++)}if(N.samples>0&&_e(N)===!1){q.__webglMultisampledFramebuffer=i.createFramebuffer(),q.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,q.__webglMultisampledFramebuffer);for(let Ae=0;Ae<pe.length;Ae++){const oe=pe[Ae];q.__webglColorRenderbuffer[Ae]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,q.__webglColorRenderbuffer[Ae]);const We=s.convert(oe.format,oe.colorSpace),Me=s.convert(oe.type),Re=y(oe.internalFormat,We,Me,oe.colorSpace,N.isXRRenderTarget===!0),je=ze(N);i.renderbufferStorageMultisample(i.RENDERBUFFER,je,Re,N.width,N.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.RENDERBUFFER,q.__webglColorRenderbuffer[Ae])}i.bindRenderbuffer(i.RENDERBUFFER,null),N.depthBuffer&&(q.__webglDepthRenderbuffer=i.createRenderbuffer(),j(q.__webglDepthRenderbuffer,N,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(ae){t.bindTexture(i.TEXTURE_CUBE_MAP,re.__webglTexture),O(i.TEXTURE_CUBE_MAP,w);for(let Ae=0;Ae<6;Ae++)if(w.mipmaps&&w.mipmaps.length>0)for(let oe=0;oe<w.mipmaps.length;oe++)z(q.__webglFramebuffer[Ae][oe],N,w,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,oe);else z(q.__webglFramebuffer[Ae],N,w,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,0);g(w)&&m(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Ve){for(let Ae=0,oe=pe.length;Ae<oe;Ae++){const We=pe[Ae],Me=n.get(We);let Re=i.TEXTURE_2D;(N.isWebGL3DRenderTarget||N.isWebGLArrayRenderTarget)&&(Re=N.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Re,Me.__webglTexture),O(Re,We),z(q.__webglFramebuffer,N,We,i.COLOR_ATTACHMENT0+Ae,Re,0),g(We)&&m(Re)}t.unbindTexture()}else{let Ae=i.TEXTURE_2D;if((N.isWebGL3DRenderTarget||N.isWebGLArrayRenderTarget)&&(Ae=N.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Ae,re.__webglTexture),O(Ae,w),w.mipmaps&&w.mipmaps.length>0)for(let oe=0;oe<w.mipmaps.length;oe++)z(q.__webglFramebuffer[oe],N,w,i.COLOR_ATTACHMENT0,Ae,oe);else z(q.__webglFramebuffer,N,w,i.COLOR_ATTACHMENT0,Ae,0);g(w)&&m(Ae),t.unbindTexture()}N.depthBuffer&&le(N)}function ee(N){const w=N.textures;for(let q=0,re=w.length;q<re;q++){const pe=w[q];if(g(pe)){const ae=S(N),Ve=n.get(pe).__webglTexture;t.bindTexture(ae,Ve),m(ae),t.unbindTexture()}}}const fe=[],ye=[];function Se(N){if(N.samples>0){if(_e(N)===!1){const w=N.textures,q=N.width,re=N.height;let pe=i.COLOR_BUFFER_BIT;const ae=N.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Ve=n.get(N),Ae=w.length>1;if(Ae)for(let We=0;We<w.length;We++)t.bindFramebuffer(i.FRAMEBUFFER,Ve.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+We,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,Ve.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+We,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,Ve.__webglMultisampledFramebuffer);const oe=N.texture.mipmaps;oe&&oe.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Ve.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Ve.__webglFramebuffer);for(let We=0;We<w.length;We++){if(N.resolveDepthBuffer&&(N.depthBuffer&&(pe|=i.DEPTH_BUFFER_BIT),N.stencilBuffer&&N.resolveStencilBuffer&&(pe|=i.STENCIL_BUFFER_BIT)),Ae){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,Ve.__webglColorRenderbuffer[We]);const Me=n.get(w[We]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,Me,0)}i.blitFramebuffer(0,0,q,re,0,0,q,re,pe,i.NEAREST),l===!0&&(fe.length=0,ye.length=0,fe.push(i.COLOR_ATTACHMENT0+We),N.depthBuffer&&N.resolveDepthBuffer===!1&&(fe.push(ae),ye.push(ae),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,ye)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,fe))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),Ae)for(let We=0;We<w.length;We++){t.bindFramebuffer(i.FRAMEBUFFER,Ve.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+We,i.RENDERBUFFER,Ve.__webglColorRenderbuffer[We]);const Me=n.get(w[We]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Ve.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+We,i.TEXTURE_2D,Me,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Ve.__webglMultisampledFramebuffer)}else if(N.depthBuffer&&N.resolveDepthBuffer===!1&&l){const w=N.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[w])}}}function ze(N){return Math.min(r.maxSamples,N.samples)}function _e(N){const w=n.get(N);return N.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&w.__useRenderToTexture!==!1}function xe(N){const w=a.render.frame;h.get(N)!==w&&(h.set(N,w),N.update())}function Xe(N,w){const q=N.colorSpace,re=N.format,pe=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||q!==Kt&&q!==ai&&(lt.getTransfer(q)===xt?(re!==fn||pe!==Cn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",q)),w}function De(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(c.width=N.naturalWidth||N.width,c.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(c.width=N.displayWidth,c.height=N.displayHeight):(c.width=N.width,c.height=N.height),c}this.allocateTextureUnit=J,this.resetTextureUnits=K,this.setTexture2D=he,this.setTexture2DArray=Q,this.setTexture3D=de,this.setTextureCube=ne,this.rebindTextures=be,this.setupRenderTarget=U,this.updateRenderTargetMipmap=ee,this.updateMultisampleRenderTarget=Se,this.setupDepthRenderbuffer=le,this.setupFrameBufferTexture=z,this.useMultisampledRTT=_e}function Hy(i,e){function t(n,r=ai){let s;const a=lt.getTransfer(r);if(n===Cn)return i.UNSIGNED_BYTE;if(n===ho)return i.UNSIGNED_SHORT_4_4_4_4;if(n===fo)return i.UNSIGNED_SHORT_5_5_5_1;if(n===pu)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===mu)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===fu)return i.BYTE;if(n===du)return i.SHORT;if(n===Vr)return i.UNSIGNED_SHORT;if(n===uo)return i.INT;if(n===Mi)return i.UNSIGNED_INT;if(n===_n)return i.FLOAT;if(n===Gr)return i.HALF_FLOAT;if(n===gu)return i.ALPHA;if(n===_u)return i.RGB;if(n===fn)return i.RGBA;if(n===Xr)return i.DEPTH_COMPONENT;if(n===$r)return i.DEPTH_STENCIL;if(n===po)return i.RED;if(n===mo)return i.RED_INTEGER;if(n===vu)return i.RG;if(n===go)return i.RG_INTEGER;if(n===_o)return i.RGBA_INTEGER;if(n===Ds||n===Ls||n===Is||n===Us)if(a===xt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Ds)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Ls)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Is)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Us)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Ds)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Ls)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Is)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Us)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===vo||n===yo||n===xo||n===bo)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===vo)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===yo)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===xo)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===bo)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===So||n===Mo||n===Eo)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===So||n===Mo)return a===xt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Eo)return a===xt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===To||n===wo||n===Ao||n===Ro||n===Co||n===Po||n===Do||n===Lo||n===Io||n===Uo||n===No||n===Oo||n===Fo||n===ko)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===To)return a===xt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===wo)return a===xt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ao)return a===xt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Ro)return a===xt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Co)return a===xt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Po)return a===xt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Do)return a===xt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Lo)return a===xt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Io)return a===xt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Uo)return a===xt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===No)return a===xt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Oo)return a===xt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Fo)return a===xt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ko)return a===xt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Bo||n===zo||n===Ho)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Bo)return a===xt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===zo)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Ho)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Vo||n===Go||n===Wo||n===Xo)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Vo)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Go)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Wo)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Xo)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Wr?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const Vy=`
|
|
3846
|
+
}`;function my(i,e,t){let n=new _l;const r=new Je,s=new Je,a=new dt,o=new Xm({depthPacking:Up}),l=new $m,c={},h=t.maxTextureSize,u={[Xn]:on,[on]:Xn,[yn]:yn},f=new ei({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Je},radius:{value:4}},vertexShader:dy,fragmentShader:py}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const _=new An;_.setAttribute("position",new en(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new Yt(_,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Jc;let m=this.type;this.render=function(R,k,B){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||R.length===0)return;const C=i.getRenderTarget(),D=i.getActiveCubeFace(),V=i.getActiveMipmapLevel(),K=i.state;K.setBlending(oi),K.buffers.depth.getReversed()===!0?K.buffers.color.setClear(0,0,0,0):K.buffers.color.setClear(1,1,1,1),K.buffers.depth.setTest(!0),K.setScissorTest(!1);const J=m!==Wn&&this.type===Wn,se=m===Wn&&this.type!==Wn;for(let he=0,Q=R.length;he<Q;he++){const de=R[he],ne=de.shadow;if(ne===void 0){console.warn("THREE.WebGLShadowMap:",de,"has no shadow.");continue}if(ne.autoUpdate===!1&&ne.needsUpdate===!1)continue;r.copy(ne.mapSize);const ue=ne.getFrameExtents();if(r.multiply(ue),s.copy(ne.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/ue.x),r.x=s.x*ue.x,ne.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/ue.y),r.y=s.y*ue.y,ne.mapSize.y=s.y)),ne.map===null||J===!0||se===!0){const ke=this.type!==Wn?{minFilter:Wt,magFilter:Wt}:{};ne.map!==null&&ne.map.dispose(),ne.map=new jn(r.x,r.y,ke),ne.map.texture.name=de.name+".shadowMap",ne.camera.updateProjectionMatrix()}i.setRenderTarget(ne.map),i.clear();const Te=ne.getViewportCount();for(let ke=0;ke<Te;ke++){const O=ne.getViewport(ke);a.set(s.x*O.x,s.y*O.y,s.x*O.z,s.y*O.w),K.viewport(a),ne.updateMatrices(de,ke),n=ne.getFrustum(),M(k,B,ne.camera,de,this.type)}ne.isPointLightShadow!==!0&&this.type===Wn&&S(ne,B),ne.needsUpdate=!1}m=this.type,g.needsUpdate=!1,i.setRenderTarget(C,D,V)};function S(R,k){const B=e.update(b);f.defines.VSM_SAMPLES!==R.blurSamples&&(f.defines.VSM_SAMPLES=R.blurSamples,d.defines.VSM_SAMPLES=R.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new jn(r.x,r.y)),f.uniforms.shadow_pass.value=R.map.texture,f.uniforms.resolution.value=R.mapSize,f.uniforms.radius.value=R.radius,i.setRenderTarget(R.mapPass),i.clear(),i.renderBufferDirect(k,null,B,f,b,null),d.uniforms.shadow_pass.value=R.mapPass.texture,d.uniforms.resolution.value=R.mapSize,d.uniforms.radius.value=R.radius,i.setRenderTarget(R.map),i.clear(),i.renderBufferDirect(k,null,B,d,b,null)}function y(R,k,B,C){let D=null;const V=B.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(V!==void 0)D=V;else if(D=B.isPointLight===!0?l:o,i.localClippingEnabled&&k.clipShadows===!0&&Array.isArray(k.clippingPlanes)&&k.clippingPlanes.length!==0||k.displacementMap&&k.displacementScale!==0||k.alphaMap&&k.alphaTest>0||k.map&&k.alphaTest>0||k.alphaToCoverage===!0){const K=D.uuid,J=k.uuid;let se=c[K];se===void 0&&(se={},c[K]=se);let he=se[J];he===void 0&&(he=D.clone(),se[J]=he,k.addEventListener("dispose",T)),D=he}if(D.visible=k.visible,D.wireframe=k.wireframe,C===Wn?D.side=k.shadowSide!==null?k.shadowSide:k.side:D.side=k.shadowSide!==null?k.shadowSide:u[k.side],D.alphaMap=k.alphaMap,D.alphaTest=k.alphaToCoverage===!0?.5:k.alphaTest,D.map=k.map,D.clipShadows=k.clipShadows,D.clippingPlanes=k.clippingPlanes,D.clipIntersection=k.clipIntersection,D.displacementMap=k.displacementMap,D.displacementScale=k.displacementScale,D.displacementBias=k.displacementBias,D.wireframeLinewidth=k.wireframeLinewidth,D.linewidth=k.linewidth,B.isPointLight===!0&&D.isMeshDistanceMaterial===!0){const K=i.properties.get(D);K.light=B}return D}function M(R,k,B,C,D){if(R.visible===!1)return;if(R.layers.test(k.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&D===Wn)&&(!R.frustumCulled||n.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,R.matrixWorld);const J=e.update(R),se=R.material;if(Array.isArray(se)){const he=J.groups;for(let Q=0,de=he.length;Q<de;Q++){const ne=he[Q],ue=se[ne.materialIndex];if(ue&&ue.visible){const Te=y(R,ue,C,D);R.onBeforeShadow(i,R,k,B,J,Te,ne),i.renderBufferDirect(B,null,J,Te,R,ne),R.onAfterShadow(i,R,k,B,J,Te,ne)}}}else if(se.visible){const he=y(R,se,C,D);R.onBeforeShadow(i,R,k,B,J,he,null),i.renderBufferDirect(B,null,J,he,R,null),R.onAfterShadow(i,R,k,B,J,he,null)}}const K=R.children;for(let J=0,se=K.length;J<se;J++)M(K[J],k,B,C,D)}function T(R){R.target.removeEventListener("dispose",T);for(const B in c){const C=c[B],D=R.target.uuid;D in C&&(C[D].dispose(),delete C[D])}}}const gy={[Xa]:$a,[qa]:Ka,[ja]:Za,[Yi]:Ya,[$a]:Xa,[Ka]:qa,[Za]:ja,[Ya]:Yi};function _y(i,e){function t(){let x=!1;const L=new dt;let p=null;const v=new dt(0,0,0,0);return{setMask:function(E){p!==E&&!x&&(i.colorMask(E,E,E,E),p=E)},setLocked:function(E){x=E},setClear:function(E,I,F,X,me){me===!0&&(E*=X,I*=X,F*=X),L.set(E,I,F,X),v.equals(L)===!1&&(i.clearColor(E,I,F,X),v.copy(L))},reset:function(){x=!1,p=null,v.set(-1,0,0,0)}}}function n(){let x=!1,L=!1,p=null,v=null,E=null;return{setReversed:function(I){if(L!==I){const F=e.get("EXT_clip_control");I?F.clipControlEXT(F.LOWER_LEFT_EXT,F.ZERO_TO_ONE_EXT):F.clipControlEXT(F.LOWER_LEFT_EXT,F.NEGATIVE_ONE_TO_ONE_EXT),L=I;const X=E;E=null,this.setClear(X)}},getReversed:function(){return L},setTest:function(I){I?ce(i.DEPTH_TEST):z(i.DEPTH_TEST)},setMask:function(I){p!==I&&!x&&(i.depthMask(I),p=I)},setFunc:function(I){if(L&&(I=gy[I]),v!==I){switch(I){case Xa:i.depthFunc(i.NEVER);break;case $a:i.depthFunc(i.ALWAYS);break;case qa:i.depthFunc(i.LESS);break;case Yi:i.depthFunc(i.LEQUAL);break;case ja:i.depthFunc(i.EQUAL);break;case Ya:i.depthFunc(i.GEQUAL);break;case Ka:i.depthFunc(i.GREATER);break;case Za:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}v=I}},setLocked:function(I){x=I},setClear:function(I){E!==I&&(L&&(I=1-I),i.clearDepth(I),E=I)},reset:function(){x=!1,p=null,v=null,E=null,L=!1}}}function r(){let x=!1,L=null,p=null,v=null,E=null,I=null,F=null,X=null,me=null;return{setTest:function(ve){x||(ve?ce(i.STENCIL_TEST):z(i.STENCIL_TEST))},setMask:function(ve){L!==ve&&!x&&(i.stencilMask(ve),L=ve)},setFunc:function(ve,Ye,Ne){(p!==ve||v!==Ye||E!==Ne)&&(i.stencilFunc(ve,Ye,Ne),p=ve,v=Ye,E=Ne)},setOp:function(ve,Ye,Ne){(I!==ve||F!==Ye||X!==Ne)&&(i.stencilOp(ve,Ye,Ne),I=ve,F=Ye,X=Ne)},setLocked:function(ve){x=ve},setClear:function(ve){me!==ve&&(i.clearStencil(ve),me=ve)},reset:function(){x=!1,L=null,p=null,v=null,E=null,I=null,F=null,X=null,me=null}}}const s=new t,a=new n,o=new r,l=new WeakMap,c=new WeakMap;let h={},u={},f=new WeakMap,d=[],_=null,b=!1,g=null,m=null,S=null,y=null,M=null,T=null,R=null,k=new et(0,0,0),B=0,C=!1,D=null,V=null,K=null,J=null,se=null;const he=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Q=!1,de=0;const ne=i.getParameter(i.VERSION);ne.indexOf("WebGL")!==-1?(de=parseFloat(/^WebGL (\d)/.exec(ne)[1]),Q=de>=1):ne.indexOf("OpenGL ES")!==-1&&(de=parseFloat(/^OpenGL ES (\d)/.exec(ne)[1]),Q=de>=2);let ue=null,Te={};const ke=i.getParameter(i.SCISSOR_BOX),O=i.getParameter(i.VIEWPORT),H=new dt().fromArray(ke),we=new dt().fromArray(O);function Be(x,L,p,v){const E=new Uint8Array(4),I=i.createTexture();i.bindTexture(x,I),i.texParameteri(x,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(x,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let F=0;F<p;F++)x===i.TEXTURE_3D||x===i.TEXTURE_2D_ARRAY?i.texImage3D(L,0,i.RGBA,1,1,v,0,i.RGBA,i.UNSIGNED_BYTE,E):i.texImage2D(L+F,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,E);return I}const ie={};ie[i.TEXTURE_2D]=Be(i.TEXTURE_2D,i.TEXTURE_2D,1),ie[i.TEXTURE_CUBE_MAP]=Be(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),ie[i.TEXTURE_2D_ARRAY]=Be(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),ie[i.TEXTURE_3D]=Be(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ce(i.DEPTH_TEST),a.setFunc(Yi),ye(!1),Se(Zc),ce(i.CULL_FACE),ee(oi);function ce(x){h[x]!==!0&&(i.enable(x),h[x]=!0)}function z(x){h[x]!==!1&&(i.disable(x),h[x]=!1)}function q(x,L){return u[x]!==L?(i.bindFramebuffer(x,L),u[x]=L,x===i.DRAW_FRAMEBUFFER&&(u[i.FRAMEBUFFER]=L),x===i.FRAMEBUFFER&&(u[i.DRAW_FRAMEBUFFER]=L),!0):!1}function W(x,L){let p=d,v=!1;if(x){p=f.get(L),p===void 0&&(p=[],f.set(L,p));const E=x.textures;if(p.length!==E.length||p[0]!==i.COLOR_ATTACHMENT0){for(let I=0,F=E.length;I<F;I++)p[I]=i.COLOR_ATTACHMENT0+I;p.length=E.length,v=!0}}else p[0]!==i.BACK&&(p[0]=i.BACK,v=!0);v&&i.drawBuffers(p)}function le(x){return _!==x?(i.useProgram(x),_=x,!0):!1}const be={[Ai]:i.FUNC_ADD,[sp]:i.FUNC_SUBTRACT,[ap]:i.FUNC_REVERSE_SUBTRACT};be[op]=i.MIN,be[lp]=i.MAX;const U={[cp]:i.ZERO,[up]:i.ONE,[hp]:i.SRC_COLOR,[Ga]:i.SRC_ALPHA,[_p]:i.SRC_ALPHA_SATURATE,[mp]:i.DST_COLOR,[dp]:i.DST_ALPHA,[fp]:i.ONE_MINUS_SRC_COLOR,[Wa]:i.ONE_MINUS_SRC_ALPHA,[gp]:i.ONE_MINUS_DST_COLOR,[pp]:i.ONE_MINUS_DST_ALPHA,[vp]:i.CONSTANT_COLOR,[yp]:i.ONE_MINUS_CONSTANT_COLOR,[xp]:i.CONSTANT_ALPHA,[bp]:i.ONE_MINUS_CONSTANT_ALPHA};function ee(x,L,p,v,E,I,F,X,me,ve){if(x===oi){b===!0&&(z(i.BLEND),b=!1);return}if(b===!1&&(ce(i.BLEND),b=!0),x!==rp){if(x!==g||ve!==C){if((m!==Ai||M!==Ai)&&(i.blendEquation(i.FUNC_ADD),m=Ai,M=Ai),ve)switch(x){case ji:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Qc:i.blendFunc(i.ONE,i.ONE);break;case eu:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case tu:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:console.error("THREE.WebGLState: Invalid blending: ",x);break}else switch(x){case ji:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Qc:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case eu:console.error("THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case tu:console.error("THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:console.error("THREE.WebGLState: Invalid blending: ",x);break}S=null,y=null,T=null,R=null,k.set(0,0,0),B=0,g=x,C=ve}return}E=E||L,I=I||p,F=F||v,(L!==m||E!==M)&&(i.blendEquationSeparate(be[L],be[E]),m=L,M=E),(p!==S||v!==y||I!==T||F!==R)&&(i.blendFuncSeparate(U[p],U[v],U[I],U[F]),S=p,y=v,T=I,R=F),(X.equals(k)===!1||me!==B)&&(i.blendColor(X.r,X.g,X.b,me),k.copy(X),B=me),g=x,C=!1}function fe(x,L){x.side===yn?z(i.CULL_FACE):ce(i.CULL_FACE);let p=x.side===on;L&&(p=!p),ye(p),x.blending===ji&&x.transparent===!1?ee(oi):ee(x.blending,x.blendEquation,x.blendSrc,x.blendDst,x.blendEquationAlpha,x.blendSrcAlpha,x.blendDstAlpha,x.blendColor,x.blendAlpha,x.premultipliedAlpha),a.setFunc(x.depthFunc),a.setTest(x.depthTest),a.setMask(x.depthWrite),s.setMask(x.colorWrite);const v=x.stencilWrite;o.setTest(v),v&&(o.setMask(x.stencilWriteMask),o.setFunc(x.stencilFunc,x.stencilRef,x.stencilFuncMask),o.setOp(x.stencilFail,x.stencilZFail,x.stencilZPass)),_e(x.polygonOffset,x.polygonOffsetFactor,x.polygonOffsetUnits),x.alphaToCoverage===!0?ce(i.SAMPLE_ALPHA_TO_COVERAGE):z(i.SAMPLE_ALPHA_TO_COVERAGE)}function ye(x){D!==x&&(x?i.frontFace(i.CW):i.frontFace(i.CCW),D=x)}function Se(x){x!==tp?(ce(i.CULL_FACE),x!==V&&(x===Zc?i.cullFace(i.BACK):x===np?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):z(i.CULL_FACE),V=x}function ze(x){x!==K&&(Q&&i.lineWidth(x),K=x)}function _e(x,L,p){x?(ce(i.POLYGON_OFFSET_FILL),(J!==L||se!==p)&&(i.polygonOffset(L,p),J=L,se=p)):z(i.POLYGON_OFFSET_FILL)}function xe(x){x?ce(i.SCISSOR_TEST):z(i.SCISSOR_TEST)}function qe(x){x===void 0&&(x=i.TEXTURE0+he-1),ue!==x&&(i.activeTexture(x),ue=x)}function De(x,L,p){p===void 0&&(ue===null?p=i.TEXTURE0+he-1:p=ue);let v=Te[p];v===void 0&&(v={type:void 0,texture:void 0},Te[p]=v),(v.type!==x||v.texture!==L)&&(ue!==p&&(i.activeTexture(p),ue=p),i.bindTexture(x,L||ie[x]),v.type=x,v.texture=L)}function N(){const x=Te[ue];x!==void 0&&x.type!==void 0&&(i.bindTexture(x.type,null),x.type=void 0,x.texture=void 0)}function w(){try{i.compressedTexImage2D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function j(){try{i.compressedTexImage3D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function re(){try{i.texSubImage2D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function pe(){try{i.texSubImage3D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function ae(){try{i.compressedTexSubImage2D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function Ve(){try{i.compressedTexSubImage3D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function Ae(){try{i.texStorage2D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function oe(){try{i.texStorage3D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function We(){try{i.texImage2D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function Me(){try{i.texImage3D(...arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function Re(x){H.equals(x)===!1&&(i.scissor(x.x,x.y,x.z,x.w),H.copy(x))}function Ke(x){we.equals(x)===!1&&(i.viewport(x.x,x.y,x.z,x.w),we.copy(x))}function Oe(x,L){let p=c.get(L);p===void 0&&(p=new WeakMap,c.set(L,p));let v=p.get(x);v===void 0&&(v=i.getUniformBlockIndex(L,x.name),p.set(x,v))}function Ce(x,L){const v=c.get(L).get(x);l.get(L)!==v&&(i.uniformBlockBinding(L,v,x.__bindingPointIndex),l.set(L,v))}function A(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),a.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),h={},ue=null,Te={},u={},f=new WeakMap,d=[],_=null,b=!1,g=null,m=null,S=null,y=null,M=null,T=null,R=null,k=new et(0,0,0),B=0,C=!1,D=null,V=null,K=null,J=null,se=null,H.set(0,0,i.canvas.width,i.canvas.height),we.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ce,disable:z,bindFramebuffer:q,drawBuffers:W,useProgram:le,setBlending:ee,setMaterial:fe,setFlipSided:ye,setCullFace:Se,setLineWidth:ze,setPolygonOffset:_e,setScissorTest:xe,activeTexture:qe,bindTexture:De,unbindTexture:N,compressedTexImage2D:w,compressedTexImage3D:j,texImage2D:We,texImage3D:Me,updateUBOMapping:Oe,uniformBlockBinding:Ce,texStorage2D:Ae,texStorage3D:oe,texSubImage2D:re,texSubImage3D:pe,compressedTexSubImage2D:ae,compressedTexSubImage3D:Ve,scissor:Re,viewport:Ke,reset:A}}function vy(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Je,h=new WeakMap;let u;const f=new WeakMap;let d=!1;try{d=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(N,w){return d?new OffscreenCanvas(N,w):Zr("canvas")}function b(N,w,j){let re=1;const pe=De(N);if((pe.width>j||pe.height>j)&&(re=j/Math.max(pe.width,pe.height)),re<1)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap||typeof VideoFrame<"u"&&N instanceof VideoFrame){const ae=Math.floor(re*pe.width),Ve=Math.floor(re*pe.height);u===void 0&&(u=_(ae,Ve));const Ae=w?_(ae,Ve):u;return Ae.width=ae,Ae.height=Ve,Ae.getContext("2d").drawImage(N,0,0,ae,Ve),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+pe.width+"x"+pe.height+") to ("+ae+"x"+Ve+")."),Ae}else return"data"in N&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+pe.width+"x"+pe.height+")."),N;return N}function g(N){return N.generateMipmaps}function m(N){i.generateMipmap(N)}function S(N){return N.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:N.isWebGL3DRenderTarget?i.TEXTURE_3D:N.isWebGLArrayRenderTarget||N.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function y(N,w,j,re,pe=!1){if(N!==null){if(i[N]!==void 0)return i[N];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let ae=w;if(w===i.RED&&(j===i.FLOAT&&(ae=i.R32F),j===i.HALF_FLOAT&&(ae=i.R16F),j===i.UNSIGNED_BYTE&&(ae=i.R8)),w===i.RED_INTEGER&&(j===i.UNSIGNED_BYTE&&(ae=i.R8UI),j===i.UNSIGNED_SHORT&&(ae=i.R16UI),j===i.UNSIGNED_INT&&(ae=i.R32UI),j===i.BYTE&&(ae=i.R8I),j===i.SHORT&&(ae=i.R16I),j===i.INT&&(ae=i.R32I)),w===i.RG&&(j===i.FLOAT&&(ae=i.RG32F),j===i.HALF_FLOAT&&(ae=i.RG16F),j===i.UNSIGNED_BYTE&&(ae=i.RG8)),w===i.RG_INTEGER&&(j===i.UNSIGNED_BYTE&&(ae=i.RG8UI),j===i.UNSIGNED_SHORT&&(ae=i.RG16UI),j===i.UNSIGNED_INT&&(ae=i.RG32UI),j===i.BYTE&&(ae=i.RG8I),j===i.SHORT&&(ae=i.RG16I),j===i.INT&&(ae=i.RG32I)),w===i.RGB_INTEGER&&(j===i.UNSIGNED_BYTE&&(ae=i.RGB8UI),j===i.UNSIGNED_SHORT&&(ae=i.RGB16UI),j===i.UNSIGNED_INT&&(ae=i.RGB32UI),j===i.BYTE&&(ae=i.RGB8I),j===i.SHORT&&(ae=i.RGB16I),j===i.INT&&(ae=i.RGB32I)),w===i.RGBA_INTEGER&&(j===i.UNSIGNED_BYTE&&(ae=i.RGBA8UI),j===i.UNSIGNED_SHORT&&(ae=i.RGBA16UI),j===i.UNSIGNED_INT&&(ae=i.RGBA32UI),j===i.BYTE&&(ae=i.RGBA8I),j===i.SHORT&&(ae=i.RGBA16I),j===i.INT&&(ae=i.RGBA32I)),w===i.RGB&&(j===i.UNSIGNED_INT_5_9_9_9_REV&&(ae=i.RGB9_E5),j===i.UNSIGNED_INT_10F_11F_11F_REV&&(ae=i.R11F_G11F_B10F)),w===i.RGBA){const Ve=pe?Ls:ht.getTransfer(re);j===i.FLOAT&&(ae=i.RGBA32F),j===i.HALF_FLOAT&&(ae=i.RGBA16F),j===i.UNSIGNED_BYTE&&(ae=Ve===Mt?i.SRGB8_ALPHA8:i.RGBA8),j===i.UNSIGNED_SHORT_4_4_4_4&&(ae=i.RGBA4),j===i.UNSIGNED_SHORT_5_5_5_1&&(ae=i.RGB5_A1)}return(ae===i.R16F||ae===i.R32F||ae===i.RG16F||ae===i.RG32F||ae===i.RGBA16F||ae===i.RGBA32F)&&e.get("EXT_color_buffer_float"),ae}function M(N,w){let j;return N?w===null||w===ui||w===Xr?j=i.DEPTH24_STENCIL8:w===xn?j=i.DEPTH32F_STENCIL8:w===Gr&&(j=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):w===null||w===ui||w===Xr?j=i.DEPTH_COMPONENT24:w===xn?j=i.DEPTH_COMPONENT32F:w===Gr&&(j=i.DEPTH_COMPONENT16),j}function T(N,w){return g(N)===!0||N.isFramebufferTexture&&N.minFilter!==Wt&&N.minFilter!==Nt?Math.log2(Math.max(w.width,w.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?w.mipmaps.length:1}function R(N){const w=N.target;w.removeEventListener("dispose",R),B(w),w.isVideoTexture&&h.delete(w)}function k(N){const w=N.target;w.removeEventListener("dispose",k),D(w)}function B(N){const w=n.get(N);if(w.__webglInit===void 0)return;const j=N.source,re=f.get(j);if(re){const pe=re[w.__cacheKey];pe.usedTimes--,pe.usedTimes===0&&C(N),Object.keys(re).length===0&&f.delete(j)}n.remove(N)}function C(N){const w=n.get(N);i.deleteTexture(w.__webglTexture);const j=N.source,re=f.get(j);delete re[w.__cacheKey],a.memory.textures--}function D(N){const w=n.get(N);if(N.depthTexture&&(N.depthTexture.dispose(),n.remove(N.depthTexture)),N.isWebGLCubeRenderTarget)for(let re=0;re<6;re++){if(Array.isArray(w.__webglFramebuffer[re]))for(let pe=0;pe<w.__webglFramebuffer[re].length;pe++)i.deleteFramebuffer(w.__webglFramebuffer[re][pe]);else i.deleteFramebuffer(w.__webglFramebuffer[re]);w.__webglDepthbuffer&&i.deleteRenderbuffer(w.__webglDepthbuffer[re])}else{if(Array.isArray(w.__webglFramebuffer))for(let re=0;re<w.__webglFramebuffer.length;re++)i.deleteFramebuffer(w.__webglFramebuffer[re]);else i.deleteFramebuffer(w.__webglFramebuffer);if(w.__webglDepthbuffer&&i.deleteRenderbuffer(w.__webglDepthbuffer),w.__webglMultisampledFramebuffer&&i.deleteFramebuffer(w.__webglMultisampledFramebuffer),w.__webglColorRenderbuffer)for(let re=0;re<w.__webglColorRenderbuffer.length;re++)w.__webglColorRenderbuffer[re]&&i.deleteRenderbuffer(w.__webglColorRenderbuffer[re]);w.__webglDepthRenderbuffer&&i.deleteRenderbuffer(w.__webglDepthRenderbuffer)}const j=N.textures;for(let re=0,pe=j.length;re<pe;re++){const ae=n.get(j[re]);ae.__webglTexture&&(i.deleteTexture(ae.__webglTexture),a.memory.textures--),n.remove(j[re])}n.remove(N)}let V=0;function K(){V=0}function J(){const N=V;return N>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+r.maxTextures),V+=1,N}function se(N){const w=[];return w.push(N.wrapS),w.push(N.wrapT),w.push(N.wrapR||0),w.push(N.magFilter),w.push(N.minFilter),w.push(N.anisotropy),w.push(N.internalFormat),w.push(N.format),w.push(N.type),w.push(N.generateMipmaps),w.push(N.premultiplyAlpha),w.push(N.flipY),w.push(N.unpackAlignment),w.push(N.colorSpace),w.join()}function he(N,w){const j=n.get(N);if(N.isVideoTexture&&xe(N),N.isRenderTargetTexture===!1&&N.isExternalTexture!==!0&&N.version>0&&j.__version!==N.version){const re=N.image;if(re===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(re.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ie(j,N,w);return}}else N.isExternalTexture&&(j.__webglTexture=N.sourceTexture?N.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,j.__webglTexture,i.TEXTURE0+w)}function Q(N,w){const j=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&j.__version!==N.version){ie(j,N,w);return}t.bindTexture(i.TEXTURE_2D_ARRAY,j.__webglTexture,i.TEXTURE0+w)}function de(N,w){const j=n.get(N);if(N.isRenderTargetTexture===!1&&N.version>0&&j.__version!==N.version){ie(j,N,w);return}t.bindTexture(i.TEXTURE_3D,j.__webglTexture,i.TEXTURE0+w)}function ne(N,w){const j=n.get(N);if(N.version>0&&j.__version!==N.version){ce(j,N,w);return}t.bindTexture(i.TEXTURE_CUBE_MAP,j.__webglTexture,i.TEXTURE0+w)}const ue={[Ji]:i.REPEAT,[ci]:i.CLAMP_TO_EDGE,[ws]:i.MIRRORED_REPEAT},Te={[Wt]:i.NEAREST,[au]:i.NEAREST_MIPMAP_NEAREST,[Vr]:i.NEAREST_MIPMAP_LINEAR,[Nt]:i.LINEAR,[As]:i.LINEAR_MIPMAP_NEAREST,[$n]:i.LINEAR_MIPMAP_LINEAR},ke={[Op]:i.NEVER,[Vp]:i.ALWAYS,[Fp]:i.LESS,[xu]:i.LEQUAL,[kp]:i.EQUAL,[Hp]:i.GEQUAL,[Bp]:i.GREATER,[zp]:i.NOTEQUAL};function O(N,w){if(w.type===xn&&e.has("OES_texture_float_linear")===!1&&(w.magFilter===Nt||w.magFilter===As||w.magFilter===Vr||w.magFilter===$n||w.minFilter===Nt||w.minFilter===As||w.minFilter===Vr||w.minFilter===$n)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(N,i.TEXTURE_WRAP_S,ue[w.wrapS]),i.texParameteri(N,i.TEXTURE_WRAP_T,ue[w.wrapT]),(N===i.TEXTURE_3D||N===i.TEXTURE_2D_ARRAY)&&i.texParameteri(N,i.TEXTURE_WRAP_R,ue[w.wrapR]),i.texParameteri(N,i.TEXTURE_MAG_FILTER,Te[w.magFilter]),i.texParameteri(N,i.TEXTURE_MIN_FILTER,Te[w.minFilter]),w.compareFunction&&(i.texParameteri(N,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(N,i.TEXTURE_COMPARE_FUNC,ke[w.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(w.magFilter===Wt||w.minFilter!==Vr&&w.minFilter!==$n||w.type===xn&&e.has("OES_texture_float_linear")===!1)return;if(w.anisotropy>1||n.get(w).__currentAnisotropy){const j=e.get("EXT_texture_filter_anisotropic");i.texParameterf(N,j.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(w.anisotropy,r.getMaxAnisotropy())),n.get(w).__currentAnisotropy=w.anisotropy}}}function H(N,w){let j=!1;N.__webglInit===void 0&&(N.__webglInit=!0,w.addEventListener("dispose",R));const re=w.source;let pe=f.get(re);pe===void 0&&(pe={},f.set(re,pe));const ae=se(w);if(ae!==N.__cacheKey){pe[ae]===void 0&&(pe[ae]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,j=!0),pe[ae].usedTimes++;const Ve=pe[N.__cacheKey];Ve!==void 0&&(pe[N.__cacheKey].usedTimes--,Ve.usedTimes===0&&C(w)),N.__cacheKey=ae,N.__webglTexture=pe[ae].texture}return j}function we(N,w,j){return Math.floor(Math.floor(N/j)/w)}function Be(N,w,j,re){const ae=N.updateRanges;if(ae.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,w.width,w.height,j,re,w.data);else{ae.sort((Me,Re)=>Me.start-Re.start);let Ve=0;for(let Me=1;Me<ae.length;Me++){const Re=ae[Ve],Ke=ae[Me],Oe=Re.start+Re.count,Ce=we(Ke.start,w.width,4),A=we(Re.start,w.width,4);Ke.start<=Oe+1&&Ce===A&&we(Ke.start+Ke.count-1,w.width,4)===Ce?Re.count=Math.max(Re.count,Ke.start+Ke.count-Re.start):(++Ve,ae[Ve]=Ke)}ae.length=Ve+1;const Ae=i.getParameter(i.UNPACK_ROW_LENGTH),oe=i.getParameter(i.UNPACK_SKIP_PIXELS),We=i.getParameter(i.UNPACK_SKIP_ROWS);i.pixelStorei(i.UNPACK_ROW_LENGTH,w.width);for(let Me=0,Re=ae.length;Me<Re;Me++){const Ke=ae[Me],Oe=Math.floor(Ke.start/4),Ce=Math.ceil(Ke.count/4),A=Oe%w.width,x=Math.floor(Oe/w.width),L=Ce,p=1;i.pixelStorei(i.UNPACK_SKIP_PIXELS,A),i.pixelStorei(i.UNPACK_SKIP_ROWS,x),t.texSubImage2D(i.TEXTURE_2D,0,A,x,L,p,j,re,w.data)}N.clearUpdateRanges(),i.pixelStorei(i.UNPACK_ROW_LENGTH,Ae),i.pixelStorei(i.UNPACK_SKIP_PIXELS,oe),i.pixelStorei(i.UNPACK_SKIP_ROWS,We)}}function ie(N,w,j){let re=i.TEXTURE_2D;(w.isDataArrayTexture||w.isCompressedArrayTexture)&&(re=i.TEXTURE_2D_ARRAY),w.isData3DTexture&&(re=i.TEXTURE_3D);const pe=H(N,w),ae=w.source;t.bindTexture(re,N.__webglTexture,i.TEXTURE0+j);const Ve=n.get(ae);if(ae.version!==Ve.__version||pe===!0){t.activeTexture(i.TEXTURE0+j);const Ae=ht.getPrimaries(ht.workingColorSpace),oe=w.colorSpace===Jt?null:ht.getPrimaries(w.colorSpace),We=w.colorSpace===Jt||Ae===oe?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,w.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,w.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,w.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,We);let Me=b(w.image,!1,r.maxTextureSize);Me=qe(w,Me);const Re=s.convert(w.format,w.colorSpace),Ke=s.convert(w.type);let Oe=y(w.internalFormat,Re,Ke,w.colorSpace,w.isVideoTexture);O(re,w);let Ce;const A=w.mipmaps,x=w.isVideoTexture!==!0,L=Ve.__version===void 0||pe===!0,p=ae.dataReady,v=T(w,Me);if(w.isDepthTexture)Oe=M(w.format===$r,w.type),L&&(x?t.texStorage2D(i.TEXTURE_2D,1,Oe,Me.width,Me.height):t.texImage2D(i.TEXTURE_2D,0,Oe,Me.width,Me.height,0,Re,Ke,null));else if(w.isDataTexture)if(A.length>0){x&&L&&t.texStorage2D(i.TEXTURE_2D,v,Oe,A[0].width,A[0].height);for(let E=0,I=A.length;E<I;E++)Ce=A[E],x?p&&t.texSubImage2D(i.TEXTURE_2D,E,0,0,Ce.width,Ce.height,Re,Ke,Ce.data):t.texImage2D(i.TEXTURE_2D,E,Oe,Ce.width,Ce.height,0,Re,Ke,Ce.data);w.generateMipmaps=!1}else x?(L&&t.texStorage2D(i.TEXTURE_2D,v,Oe,Me.width,Me.height),p&&Be(w,Me,Re,Ke)):t.texImage2D(i.TEXTURE_2D,0,Oe,Me.width,Me.height,0,Re,Ke,Me.data);else if(w.isCompressedTexture)if(w.isCompressedArrayTexture){x&&L&&t.texStorage3D(i.TEXTURE_2D_ARRAY,v,Oe,A[0].width,A[0].height,Me.depth);for(let E=0,I=A.length;E<I;E++)if(Ce=A[E],w.format!==ln)if(Re!==null)if(x){if(p)if(w.layerUpdates.size>0){const F=Th(Ce.width,Ce.height,w.format,w.type);for(const X of w.layerUpdates){const me=Ce.data.subarray(X*F/Ce.data.BYTES_PER_ELEMENT,(X+1)*F/Ce.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,E,0,0,X,Ce.width,Ce.height,1,Re,me)}w.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,E,0,0,0,Ce.width,Ce.height,Me.depth,Re,Ce.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,E,Oe,Ce.width,Ce.height,Me.depth,0,Ce.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else x?p&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,E,0,0,0,Ce.width,Ce.height,Me.depth,Re,Ke,Ce.data):t.texImage3D(i.TEXTURE_2D_ARRAY,E,Oe,Ce.width,Ce.height,Me.depth,0,Re,Ke,Ce.data)}else{x&&L&&t.texStorage2D(i.TEXTURE_2D,v,Oe,A[0].width,A[0].height);for(let E=0,I=A.length;E<I;E++)Ce=A[E],w.format!==ln?Re!==null?x?p&&t.compressedTexSubImage2D(i.TEXTURE_2D,E,0,0,Ce.width,Ce.height,Re,Ce.data):t.compressedTexImage2D(i.TEXTURE_2D,E,Oe,Ce.width,Ce.height,0,Ce.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):x?p&&t.texSubImage2D(i.TEXTURE_2D,E,0,0,Ce.width,Ce.height,Re,Ke,Ce.data):t.texImage2D(i.TEXTURE_2D,E,Oe,Ce.width,Ce.height,0,Re,Ke,Ce.data)}else if(w.isDataArrayTexture)if(x){if(L&&t.texStorage3D(i.TEXTURE_2D_ARRAY,v,Oe,Me.width,Me.height,Me.depth),p)if(w.layerUpdates.size>0){const E=Th(Me.width,Me.height,w.format,w.type);for(const I of w.layerUpdates){const F=Me.data.subarray(I*E/Me.data.BYTES_PER_ELEMENT,(I+1)*E/Me.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,I,Me.width,Me.height,1,Re,Ke,F)}w.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Me.width,Me.height,Me.depth,Re,Ke,Me.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Oe,Me.width,Me.height,Me.depth,0,Re,Ke,Me.data);else if(w.isData3DTexture)x?(L&&t.texStorage3D(i.TEXTURE_3D,v,Oe,Me.width,Me.height,Me.depth),p&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Me.width,Me.height,Me.depth,Re,Ke,Me.data)):t.texImage3D(i.TEXTURE_3D,0,Oe,Me.width,Me.height,Me.depth,0,Re,Ke,Me.data);else if(w.isFramebufferTexture){if(L)if(x)t.texStorage2D(i.TEXTURE_2D,v,Oe,Me.width,Me.height);else{let E=Me.width,I=Me.height;for(let F=0;F<v;F++)t.texImage2D(i.TEXTURE_2D,F,Oe,E,I,0,Re,Ke,null),E>>=1,I>>=1}}else if(A.length>0){if(x&&L){const E=De(A[0]);t.texStorage2D(i.TEXTURE_2D,v,Oe,E.width,E.height)}for(let E=0,I=A.length;E<I;E++)Ce=A[E],x?p&&t.texSubImage2D(i.TEXTURE_2D,E,0,0,Re,Ke,Ce):t.texImage2D(i.TEXTURE_2D,E,Oe,Re,Ke,Ce);w.generateMipmaps=!1}else if(x){if(L){const E=De(Me);t.texStorage2D(i.TEXTURE_2D,v,Oe,E.width,E.height)}p&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Re,Ke,Me)}else t.texImage2D(i.TEXTURE_2D,0,Oe,Re,Ke,Me);g(w)&&m(re),Ve.__version=ae.version,w.onUpdate&&w.onUpdate(w)}N.__version=w.version}function ce(N,w,j){if(w.image.length!==6)return;const re=H(N,w),pe=w.source;t.bindTexture(i.TEXTURE_CUBE_MAP,N.__webglTexture,i.TEXTURE0+j);const ae=n.get(pe);if(pe.version!==ae.__version||re===!0){t.activeTexture(i.TEXTURE0+j);const Ve=ht.getPrimaries(ht.workingColorSpace),Ae=w.colorSpace===Jt?null:ht.getPrimaries(w.colorSpace),oe=w.colorSpace===Jt||Ve===Ae?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,w.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,w.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,w.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,oe);const We=w.isCompressedTexture||w.image[0].isCompressedTexture,Me=w.image[0]&&w.image[0].isDataTexture,Re=[];for(let I=0;I<6;I++)!We&&!Me?Re[I]=b(w.image[I],!0,r.maxCubemapSize):Re[I]=Me?w.image[I].image:w.image[I],Re[I]=qe(w,Re[I]);const Ke=Re[0],Oe=s.convert(w.format,w.colorSpace),Ce=s.convert(w.type),A=y(w.internalFormat,Oe,Ce,w.colorSpace),x=w.isVideoTexture!==!0,L=ae.__version===void 0||re===!0,p=pe.dataReady;let v=T(w,Ke);O(i.TEXTURE_CUBE_MAP,w);let E;if(We){x&&L&&t.texStorage2D(i.TEXTURE_CUBE_MAP,v,A,Ke.width,Ke.height);for(let I=0;I<6;I++){E=Re[I].mipmaps;for(let F=0;F<E.length;F++){const X=E[F];w.format!==ln?Oe!==null?x?p&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,F,0,0,X.width,X.height,Oe,X.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,F,A,X.width,X.height,0,X.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):x?p&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,F,0,0,X.width,X.height,Oe,Ce,X.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,F,A,X.width,X.height,0,Oe,Ce,X.data)}}}else{if(E=w.mipmaps,x&&L){E.length>0&&v++;const I=De(Re[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,v,A,I.width,I.height)}for(let I=0;I<6;I++)if(Me){x?p&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,0,0,Re[I].width,Re[I].height,Oe,Ce,Re[I].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,A,Re[I].width,Re[I].height,0,Oe,Ce,Re[I].data);for(let F=0;F<E.length;F++){const me=E[F].image[I].image;x?p&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,F+1,0,0,me.width,me.height,Oe,Ce,me.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,F+1,A,me.width,me.height,0,Oe,Ce,me.data)}}else{x?p&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,0,0,Oe,Ce,Re[I]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,A,Oe,Ce,Re[I]);for(let F=0;F<E.length;F++){const X=E[F];x?p&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,F+1,0,0,Oe,Ce,X.image[I]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+I,F+1,A,Oe,Ce,X.image[I])}}}g(w)&&m(i.TEXTURE_CUBE_MAP),ae.__version=pe.version,w.onUpdate&&w.onUpdate(w)}N.__version=w.version}function z(N,w,j,re,pe,ae){const Ve=s.convert(j.format,j.colorSpace),Ae=s.convert(j.type),oe=y(j.internalFormat,Ve,Ae,j.colorSpace),We=n.get(w),Me=n.get(j);if(Me.__renderTarget=w,!We.__hasExternalTextures){const Re=Math.max(1,w.width>>ae),Ke=Math.max(1,w.height>>ae);pe===i.TEXTURE_3D||pe===i.TEXTURE_2D_ARRAY?t.texImage3D(pe,ae,oe,Re,Ke,w.depth,0,Ve,Ae,null):t.texImage2D(pe,ae,oe,Re,Ke,0,Ve,Ae,null)}t.bindFramebuffer(i.FRAMEBUFFER,N),_e(w)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,re,pe,Me.__webglTexture,0,ze(w)):(pe===i.TEXTURE_2D||pe>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&pe<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,re,pe,Me.__webglTexture,ae),t.bindFramebuffer(i.FRAMEBUFFER,null)}function q(N,w,j){if(i.bindRenderbuffer(i.RENDERBUFFER,N),w.depthBuffer){const re=w.depthTexture,pe=re&&re.isDepthTexture?re.type:null,ae=M(w.stencilBuffer,pe),Ve=w.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Ae=ze(w);_e(w)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Ae,ae,w.width,w.height):j?i.renderbufferStorageMultisample(i.RENDERBUFFER,Ae,ae,w.width,w.height):i.renderbufferStorage(i.RENDERBUFFER,ae,w.width,w.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ve,i.RENDERBUFFER,N)}else{const re=w.textures;for(let pe=0;pe<re.length;pe++){const ae=re[pe],Ve=s.convert(ae.format,ae.colorSpace),Ae=s.convert(ae.type),oe=y(ae.internalFormat,Ve,Ae,ae.colorSpace),We=ze(w);j&&_e(w)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,We,oe,w.width,w.height):_e(w)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,We,oe,w.width,w.height):i.renderbufferStorage(i.RENDERBUFFER,oe,w.width,w.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function W(N,w){if(w&&w.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,N),!(w.depthTexture&&w.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const re=n.get(w.depthTexture);re.__renderTarget=w,(!re.__webglTexture||w.depthTexture.image.width!==w.width||w.depthTexture.image.height!==w.height)&&(w.depthTexture.image.width=w.width,w.depthTexture.image.height=w.height,w.depthTexture.needsUpdate=!0),he(w.depthTexture,0);const pe=re.__webglTexture,ae=ze(w);if(w.depthTexture.format===Qi)_e(w)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,pe,0,ae):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,pe,0);else if(w.depthTexture.format===$r)_e(w)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,pe,0,ae):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,pe,0);else throw new Error("Unknown depthTexture format")}function le(N){const w=n.get(N),j=N.isWebGLCubeRenderTarget===!0;if(w.__boundDepthTexture!==N.depthTexture){const re=N.depthTexture;if(w.__depthDisposeCallback&&w.__depthDisposeCallback(),re){const pe=()=>{delete w.__boundDepthTexture,delete w.__depthDisposeCallback,re.removeEventListener("dispose",pe)};re.addEventListener("dispose",pe),w.__depthDisposeCallback=pe}w.__boundDepthTexture=re}if(N.depthTexture&&!w.__autoAllocateDepthBuffer){if(j)throw new Error("target.depthTexture not supported in Cube render targets");const re=N.texture.mipmaps;re&&re.length>0?W(w.__webglFramebuffer[0],N):W(w.__webglFramebuffer,N)}else if(j){w.__webglDepthbuffer=[];for(let re=0;re<6;re++)if(t.bindFramebuffer(i.FRAMEBUFFER,w.__webglFramebuffer[re]),w.__webglDepthbuffer[re]===void 0)w.__webglDepthbuffer[re]=i.createRenderbuffer(),q(w.__webglDepthbuffer[re],N,!1);else{const pe=N.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ae=w.__webglDepthbuffer[re];i.bindRenderbuffer(i.RENDERBUFFER,ae),i.framebufferRenderbuffer(i.FRAMEBUFFER,pe,i.RENDERBUFFER,ae)}}else{const re=N.texture.mipmaps;if(re&&re.length>0?t.bindFramebuffer(i.FRAMEBUFFER,w.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,w.__webglFramebuffer),w.__webglDepthbuffer===void 0)w.__webglDepthbuffer=i.createRenderbuffer(),q(w.__webglDepthbuffer,N,!1);else{const pe=N.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ae=w.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,ae),i.framebufferRenderbuffer(i.FRAMEBUFFER,pe,i.RENDERBUFFER,ae)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function be(N,w,j){const re=n.get(N);w!==void 0&&z(re.__webglFramebuffer,N,N.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),j!==void 0&&le(N)}function U(N){const w=N.texture,j=n.get(N),re=n.get(w);N.addEventListener("dispose",k);const pe=N.textures,ae=N.isWebGLCubeRenderTarget===!0,Ve=pe.length>1;if(Ve||(re.__webglTexture===void 0&&(re.__webglTexture=i.createTexture()),re.__version=w.version,a.memory.textures++),ae){j.__webglFramebuffer=[];for(let Ae=0;Ae<6;Ae++)if(w.mipmaps&&w.mipmaps.length>0){j.__webglFramebuffer[Ae]=[];for(let oe=0;oe<w.mipmaps.length;oe++)j.__webglFramebuffer[Ae][oe]=i.createFramebuffer()}else j.__webglFramebuffer[Ae]=i.createFramebuffer()}else{if(w.mipmaps&&w.mipmaps.length>0){j.__webglFramebuffer=[];for(let Ae=0;Ae<w.mipmaps.length;Ae++)j.__webglFramebuffer[Ae]=i.createFramebuffer()}else j.__webglFramebuffer=i.createFramebuffer();if(Ve)for(let Ae=0,oe=pe.length;Ae<oe;Ae++){const We=n.get(pe[Ae]);We.__webglTexture===void 0&&(We.__webglTexture=i.createTexture(),a.memory.textures++)}if(N.samples>0&&_e(N)===!1){j.__webglMultisampledFramebuffer=i.createFramebuffer(),j.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,j.__webglMultisampledFramebuffer);for(let Ae=0;Ae<pe.length;Ae++){const oe=pe[Ae];j.__webglColorRenderbuffer[Ae]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,j.__webglColorRenderbuffer[Ae]);const We=s.convert(oe.format,oe.colorSpace),Me=s.convert(oe.type),Re=y(oe.internalFormat,We,Me,oe.colorSpace,N.isXRRenderTarget===!0),Ke=ze(N);i.renderbufferStorageMultisample(i.RENDERBUFFER,Ke,Re,N.width,N.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.RENDERBUFFER,j.__webglColorRenderbuffer[Ae])}i.bindRenderbuffer(i.RENDERBUFFER,null),N.depthBuffer&&(j.__webglDepthRenderbuffer=i.createRenderbuffer(),q(j.__webglDepthRenderbuffer,N,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(ae){t.bindTexture(i.TEXTURE_CUBE_MAP,re.__webglTexture),O(i.TEXTURE_CUBE_MAP,w);for(let Ae=0;Ae<6;Ae++)if(w.mipmaps&&w.mipmaps.length>0)for(let oe=0;oe<w.mipmaps.length;oe++)z(j.__webglFramebuffer[Ae][oe],N,w,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,oe);else z(j.__webglFramebuffer[Ae],N,w,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,0);g(w)&&m(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Ve){for(let Ae=0,oe=pe.length;Ae<oe;Ae++){const We=pe[Ae],Me=n.get(We);let Re=i.TEXTURE_2D;(N.isWebGL3DRenderTarget||N.isWebGLArrayRenderTarget)&&(Re=N.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Re,Me.__webglTexture),O(Re,We),z(j.__webglFramebuffer,N,We,i.COLOR_ATTACHMENT0+Ae,Re,0),g(We)&&m(Re)}t.unbindTexture()}else{let Ae=i.TEXTURE_2D;if((N.isWebGL3DRenderTarget||N.isWebGLArrayRenderTarget)&&(Ae=N.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Ae,re.__webglTexture),O(Ae,w),w.mipmaps&&w.mipmaps.length>0)for(let oe=0;oe<w.mipmaps.length;oe++)z(j.__webglFramebuffer[oe],N,w,i.COLOR_ATTACHMENT0,Ae,oe);else z(j.__webglFramebuffer,N,w,i.COLOR_ATTACHMENT0,Ae,0);g(w)&&m(Ae),t.unbindTexture()}N.depthBuffer&&le(N)}function ee(N){const w=N.textures;for(let j=0,re=w.length;j<re;j++){const pe=w[j];if(g(pe)){const ae=S(N),Ve=n.get(pe).__webglTexture;t.bindTexture(ae,Ve),m(ae),t.unbindTexture()}}}const fe=[],ye=[];function Se(N){if(N.samples>0){if(_e(N)===!1){const w=N.textures,j=N.width,re=N.height;let pe=i.COLOR_BUFFER_BIT;const ae=N.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Ve=n.get(N),Ae=w.length>1;if(Ae)for(let We=0;We<w.length;We++)t.bindFramebuffer(i.FRAMEBUFFER,Ve.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+We,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,Ve.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+We,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,Ve.__webglMultisampledFramebuffer);const oe=N.texture.mipmaps;oe&&oe.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Ve.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Ve.__webglFramebuffer);for(let We=0;We<w.length;We++){if(N.resolveDepthBuffer&&(N.depthBuffer&&(pe|=i.DEPTH_BUFFER_BIT),N.stencilBuffer&&N.resolveStencilBuffer&&(pe|=i.STENCIL_BUFFER_BIT)),Ae){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,Ve.__webglColorRenderbuffer[We]);const Me=n.get(w[We]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,Me,0)}i.blitFramebuffer(0,0,j,re,0,0,j,re,pe,i.NEAREST),l===!0&&(fe.length=0,ye.length=0,fe.push(i.COLOR_ATTACHMENT0+We),N.depthBuffer&&N.resolveDepthBuffer===!1&&(fe.push(ae),ye.push(ae),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,ye)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,fe))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),Ae)for(let We=0;We<w.length;We++){t.bindFramebuffer(i.FRAMEBUFFER,Ve.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+We,i.RENDERBUFFER,Ve.__webglColorRenderbuffer[We]);const Me=n.get(w[We]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Ve.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+We,i.TEXTURE_2D,Me,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Ve.__webglMultisampledFramebuffer)}else if(N.depthBuffer&&N.resolveDepthBuffer===!1&&l){const w=N.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[w])}}}function ze(N){return Math.min(r.maxSamples,N.samples)}function _e(N){const w=n.get(N);return N.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&w.__useRenderToTexture!==!1}function xe(N){const w=a.render.frame;h.get(N)!==w&&(h.set(N,w),N.update())}function qe(N,w){const j=N.colorSpace,re=N.format,pe=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||j!==Qt&&j!==Jt&&(ht.getTransfer(j)===Mt?(re!==ln||pe!==pn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",j)),w}function De(N){return typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement?(c.width=N.naturalWidth||N.width,c.height=N.naturalHeight||N.height):typeof VideoFrame<"u"&&N instanceof VideoFrame?(c.width=N.displayWidth,c.height=N.displayHeight):(c.width=N.width,c.height=N.height),c}this.allocateTextureUnit=J,this.resetTextureUnits=K,this.setTexture2D=he,this.setTexture2DArray=Q,this.setTexture3D=de,this.setTextureCube=ne,this.rebindTextures=be,this.setupRenderTarget=U,this.updateRenderTargetMipmap=ee,this.updateMultisampleRenderTarget=Se,this.setupDepthRenderbuffer=le,this.setupFrameBufferTexture=z,this.useMultisampledRTT=_e}function yy(i,e){function t(n,r=Jt){let s;const a=ht.getTransfer(r);if(n===pn)return i.UNSIGNED_BYTE;if(n===to)return i.UNSIGNED_SHORT_4_4_4_4;if(n===no)return i.UNSIGNED_SHORT_5_5_5_1;if(n===cu)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===uu)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===ou)return i.BYTE;if(n===lu)return i.SHORT;if(n===Gr)return i.UNSIGNED_SHORT;if(n===eo)return i.INT;if(n===ui)return i.UNSIGNED_INT;if(n===xn)return i.FLOAT;if(n===Wr)return i.HALF_FLOAT;if(n===hu)return i.ALPHA;if(n===fu)return i.RGB;if(n===ln)return i.RGBA;if(n===Qi)return i.DEPTH_COMPONENT;if(n===$r)return i.DEPTH_STENCIL;if(n===io)return i.RED;if(n===ro)return i.RED_INTEGER;if(n===du)return i.RG;if(n===so)return i.RG_INTEGER;if(n===ao)return i.RGBA_INTEGER;if(n===Rs||n===Cs||n===Ps||n===Ds)if(a===Mt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Rs)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Cs)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ps)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ds)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Rs)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Cs)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ps)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ds)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===oo||n===lo||n===co||n===uo)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===oo)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===lo)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===co)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===uo)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===ho||n===fo||n===po)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===ho||n===fo)return a===Mt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===po)return a===Mt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===mo||n===go||n===_o||n===vo||n===yo||n===xo||n===bo||n===So||n===Mo||n===Eo||n===To||n===wo||n===Ao||n===Ro)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===mo)return a===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===go)return a===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===_o)return a===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===vo)return a===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===yo)return a===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===xo)return a===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===bo)return a===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===So)return a===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Mo)return a===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Eo)return a===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===To)return a===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===wo)return a===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ao)return a===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ro)return a===Mt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Co||n===Po||n===Do)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Co)return a===Mt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Po)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Do)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Lo||n===Io||n===Uo||n===No)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Lo)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Io)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Uo)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===No)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Xr?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const xy=`
|
|
3850
3847
|
void main() {
|
|
3851
3848
|
|
|
3852
3849
|
gl_Position = vec4( position, 1.0 );
|
|
3853
3850
|
|
|
3854
|
-
}`,
|
|
3851
|
+
}`,by=`
|
|
3855
3852
|
uniform sampler2DArray depthColor;
|
|
3856
3853
|
uniform float depthWidth;
|
|
3857
3854
|
uniform float depthHeight;
|
|
@@ -3870,7 +3867,59 @@ void main() {
|
|
|
3870
3867
|
|
|
3871
3868
|
}
|
|
3872
3869
|
|
|
3873
|
-
}`;class Wy{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new yh(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new fi({vertexShader:Vy,fragmentShader:Gy,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Jt(new la(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Xy extends Ei{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,u=null,f=null,d=null,_=null;const b=typeof XRWebGLBinding<"u",g=new Wy,m={},S=t.getContextAttributes();let y=null,M=null;const T=[],R=[],k=new Ye;let B=null;const C=new en;C.viewport=new pt;const D=new en;D.viewport=new pt;const V=[C,D],K=new Ng;let J=null,se=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ie){let ce=T[ie];return ce===void 0&&(ce=new vl,T[ie]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(ie){let ce=T[ie];return ce===void 0&&(ce=new vl,T[ie]=ce),ce.getGripSpace()},this.getHand=function(ie){let ce=T[ie];return ce===void 0&&(ce=new vl,T[ie]=ce),ce.getHandSpace()};function he(ie){const ce=R.indexOf(ie.inputSource);if(ce===-1)return;const z=T[ce];z!==void 0&&(z.update(ie.inputSource,ie.frame,c||a),z.dispatchEvent({type:ie.type,data:ie.inputSource}))}function Q(){r.removeEventListener("select",he),r.removeEventListener("selectstart",he),r.removeEventListener("selectend",he),r.removeEventListener("squeeze",he),r.removeEventListener("squeezestart",he),r.removeEventListener("squeezeend",he),r.removeEventListener("end",Q),r.removeEventListener("inputsourceschange",de);for(let ie=0;ie<T.length;ie++){const ce=R[ie];ce!==null&&(R[ie]=null,T[ie].disconnect(ce))}J=null,se=null,g.reset();for(const ie in m)delete m[ie];e.setRenderTarget(y),d=null,f=null,u=null,r=null,M=null,Be.stop(),n.isPresenting=!1,e.setPixelRatio(B),e.setSize(k.width,k.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ie){s=ie,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ie){o=ie,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(ie){c=ie},this.getBaseLayer=function(){return f!==null?f:d},this.getBinding=function(){return u===null&&b&&(u=new XRWebGLBinding(r,t)),u},this.getFrame=function(){return _},this.getSession=function(){return r},this.setSession=async function(ie){if(r=ie,r!==null){if(y=e.getRenderTarget(),r.addEventListener("select",he),r.addEventListener("selectstart",he),r.addEventListener("selectend",he),r.addEventListener("squeeze",he),r.addEventListener("squeezestart",he),r.addEventListener("squeezeend",he),r.addEventListener("end",Q),r.addEventListener("inputsourceschange",de),S.xrCompatible!==!0&&await t.makeXRCompatible(),B=e.getPixelRatio(),e.getSize(k),b&&"createProjectionLayer"in XRWebGLBinding.prototype){let z=null,j=null,W=null;S.depth&&(W=S.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,z=S.stencil?$r:Xr,j=S.stencil?Wr:Mi);const le={colorFormat:t.RGBA8,depthFormat:W,scaleFactor:s};u=this.getBinding(),f=u.createProjectionLayer(le),r.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),M=new Ti(f.textureWidth,f.textureHeight,{format:fn,type:Cn,depthTexture:new vh(f.textureWidth,f.textureHeight,j,void 0,void 0,void 0,void 0,void 0,void 0,z),stencilBuffer:S.stencil,colorSpace:e.outputColorSpace,samples:S.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}else{const z={antialias:S.antialias,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(r,t,z),r.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),M=new Ti(d.framebufferWidth,d.framebufferHeight,{format:fn,type:Cn,colorSpace:e.outputColorSpace,stencilBuffer:S.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),Be.setContext(r),Be.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function de(ie){for(let ce=0;ce<ie.removed.length;ce++){const z=ie.removed[ce],j=R.indexOf(z);j>=0&&(R[j]=null,T[j].disconnect(z))}for(let ce=0;ce<ie.added.length;ce++){const z=ie.added[ce];let j=R.indexOf(z);if(j===-1){for(let le=0;le<T.length;le++)if(le>=R.length){R.push(z),j=le;break}else if(R[le]===null){R[le]=z,j=le;break}if(j===-1)break}const W=T[j];W&&W.connect(z)}}const ne=new $,ue=new $;function Te(ie,ce,z){ne.setFromMatrixPosition(ce.matrixWorld),ue.setFromMatrixPosition(z.matrixWorld);const j=ne.distanceTo(ue),W=ce.projectionMatrix.elements,le=z.projectionMatrix.elements,be=W[14]/(W[10]-1),U=W[14]/(W[10]+1),ee=(W[9]+1)/W[5],fe=(W[9]-1)/W[5],ye=(W[8]-1)/W[0],Se=(le[8]+1)/le[0],ze=be*ye,_e=be*Se,xe=j/(-ye+Se),Xe=xe*-ye;if(ce.matrixWorld.decompose(ie.position,ie.quaternion,ie.scale),ie.translateX(Xe),ie.translateZ(xe),ie.matrixWorld.compose(ie.position,ie.quaternion,ie.scale),ie.matrixWorldInverse.copy(ie.matrixWorld).invert(),W[10]===-1)ie.projectionMatrix.copy(ce.projectionMatrix),ie.projectionMatrixInverse.copy(ce.projectionMatrixInverse);else{const De=be+xe,N=U+xe,w=ze-Xe,q=_e+(j-Xe),re=ee*U/N*De,pe=fe*U/N*De;ie.projectionMatrix.makePerspective(w,q,re,pe,De,N),ie.projectionMatrixInverse.copy(ie.projectionMatrix).invert()}}function ke(ie,ce){ce===null?ie.matrixWorld.copy(ie.matrix):ie.matrixWorld.multiplyMatrices(ce.matrixWorld,ie.matrix),ie.matrixWorldInverse.copy(ie.matrixWorld).invert()}this.updateCamera=function(ie){if(r===null)return;let ce=ie.near,z=ie.far;g.texture!==null&&(g.depthNear>0&&(ce=g.depthNear),g.depthFar>0&&(z=g.depthFar)),K.near=D.near=C.near=ce,K.far=D.far=C.far=z,(J!==K.near||se!==K.far)&&(r.updateRenderState({depthNear:K.near,depthFar:K.far}),J=K.near,se=K.far),K.layers.mask=ie.layers.mask|6,C.layers.mask=K.layers.mask&3,D.layers.mask=K.layers.mask&5;const j=ie.parent,W=K.cameras;ke(K,j);for(let le=0;le<W.length;le++)ke(W[le],j);W.length===2?Te(K,C,D):K.projectionMatrix.copy(C.projectionMatrix),O(ie,K,j)};function O(ie,ce,z){z===null?ie.matrix.copy(ce.matrixWorld):(ie.matrix.copy(z.matrixWorld),ie.matrix.invert(),ie.matrix.multiply(ce.matrixWorld)),ie.matrix.decompose(ie.position,ie.quaternion,ie.scale),ie.updateMatrixWorld(!0),ie.projectionMatrix.copy(ce.projectionMatrix),ie.projectionMatrixInverse.copy(ce.projectionMatrixInverse),ie.isPerspectiveCamera&&(ie.fov=tr*2*Math.atan(1/ie.projectionMatrix.elements[5]),ie.zoom=1)}this.getCamera=function(){return K},this.getFoveation=function(){if(!(f===null&&d===null))return l},this.setFoveation=function(ie){l=ie,f!==null&&(f.fixedFoveation=ie),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=ie)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(K)},this.getCameraTexture=function(ie){return m[ie]};let H=null;function we(ie,ce){if(h=ce.getViewerPose(c||a),_=ce,h!==null){const z=h.views;d!==null&&(e.setRenderTargetFramebuffer(M,d.framebuffer),e.setRenderTarget(M));let j=!1;z.length!==K.cameras.length&&(K.cameras.length=0,j=!0);for(let U=0;U<z.length;U++){const ee=z[U];let fe=null;if(d!==null)fe=d.getViewport(ee);else{const Se=u.getViewSubImage(f,ee);fe=Se.viewport,U===0&&(e.setRenderTargetTextures(M,Se.colorTexture,Se.depthStencilTexture),e.setRenderTarget(M))}let ye=V[U];ye===void 0&&(ye=new en,ye.layers.enable(U),ye.viewport=new pt,V[U]=ye),ye.matrix.fromArray(ee.transform.matrix),ye.matrix.decompose(ye.position,ye.quaternion,ye.scale),ye.projectionMatrix.fromArray(ee.projectionMatrix),ye.projectionMatrixInverse.copy(ye.projectionMatrix).invert(),ye.viewport.set(fe.x,fe.y,fe.width,fe.height),U===0&&(K.matrix.copy(ye.matrix),K.matrix.decompose(K.position,K.quaternion,K.scale)),j===!0&&K.cameras.push(ye)}const W=r.enabledFeatures;if(W&&W.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&b){u=n.getBinding();const U=u.getDepthInformation(z[0]);U&&U.isValid&&U.texture&&g.init(U,r.renderState)}if(W&&W.includes("camera-access")&&b){e.state.unbindTexture(),u=n.getBinding();for(let U=0;U<z.length;U++){const ee=z[U].camera;if(ee){let fe=m[ee];fe||(fe=new yh,m[ee]=fe);const ye=u.getCameraImage(ee);fe.sourceTexture=ye}}}}for(let z=0;z<T.length;z++){const j=R[z],W=T[z];j!==null&&W!==void 0&&W.update(j,ce,c||a)}H&&H(ie,ce),ce.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ce}),_=null}const Be=new Dh;Be.setAnimationLoop(we),this.setAnimationLoop=function(ie){H=ie},this.dispose=function(){}}}const Ui=new Un,$y=new et;function jy(i,e){function t(g,m){g.matrixAutoUpdate===!0&&g.updateMatrix(),m.value.copy(g.matrix)}function n(g,m){m.color.getRGB(g.fogColor.value,Yu(i)),m.isFog?(g.fogNear.value=m.near,g.fogFar.value=m.far):m.isFogExp2&&(g.fogDensity.value=m.density)}function r(g,m,S,y,M){m.isMeshBasicMaterial||m.isMeshLambertMaterial?s(g,m):m.isMeshToonMaterial?(s(g,m),u(g,m)):m.isMeshPhongMaterial?(s(g,m),h(g,m)):m.isMeshStandardMaterial?(s(g,m),f(g,m),m.isMeshPhysicalMaterial&&d(g,m,M)):m.isMeshMatcapMaterial?(s(g,m),_(g,m)):m.isMeshDepthMaterial?s(g,m):m.isMeshDistanceMaterial?(s(g,m),b(g,m)):m.isMeshNormalMaterial?s(g,m):m.isLineBasicMaterial?(a(g,m),m.isLineDashedMaterial&&o(g,m)):m.isPointsMaterial?l(g,m,S,y):m.isSpriteMaterial?c(g,m):m.isShadowMaterial?(g.color.value.copy(m.color),g.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function s(g,m){g.opacity.value=m.opacity,m.color&&g.diffuse.value.copy(m.color),m.emissive&&g.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.bumpMap&&(g.bumpMap.value=m.bumpMap,t(m.bumpMap,g.bumpMapTransform),g.bumpScale.value=m.bumpScale,m.side===sn&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,t(m.normalMap,g.normalMapTransform),g.normalScale.value.copy(m.normalScale),m.side===sn&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,t(m.displacementMap,g.displacementMapTransform),g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias),m.emissiveMap&&(g.emissiveMap.value=m.emissiveMap,t(m.emissiveMap,g.emissiveMapTransform)),m.specularMap&&(g.specularMap.value=m.specularMap,t(m.specularMap,g.specularMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest);const S=e.get(m),y=S.envMap,M=S.envMapRotation;y&&(g.envMap.value=y,Ui.copy(M),Ui.x*=-1,Ui.y*=-1,Ui.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Ui.y*=-1,Ui.z*=-1),g.envMapRotation.value.setFromMatrix4($y.makeRotationFromEuler(Ui)),g.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=m.reflectivity,g.ior.value=m.ior,g.refractionRatio.value=m.refractionRatio),m.lightMap&&(g.lightMap.value=m.lightMap,g.lightMapIntensity.value=m.lightMapIntensity,t(m.lightMap,g.lightMapTransform)),m.aoMap&&(g.aoMap.value=m.aoMap,g.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,g.aoMapTransform))}function a(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform))}function o(g,m){g.dashSize.value=m.dashSize,g.totalSize.value=m.dashSize+m.gapSize,g.scale.value=m.scale}function l(g,m,S,y){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.size.value=m.size*S,g.scale.value=y*.5,m.map&&(g.map.value=m.map,t(m.map,g.uvTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function c(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.rotation.value=m.rotation,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function h(g,m){g.specular.value.copy(m.specular),g.shininess.value=Math.max(m.shininess,1e-4)}function u(g,m){m.gradientMap&&(g.gradientMap.value=m.gradientMap)}function f(g,m){g.metalness.value=m.metalness,m.metalnessMap&&(g.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,g.metalnessMapTransform)),g.roughness.value=m.roughness,m.roughnessMap&&(g.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,g.roughnessMapTransform)),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)}function d(g,m,S){g.ior.value=m.ior,m.sheen>0&&(g.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),g.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(g.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,g.sheenColorMapTransform)),m.sheenRoughnessMap&&(g.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,g.sheenRoughnessMapTransform))),m.clearcoat>0&&(g.clearcoat.value=m.clearcoat,g.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(g.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,g.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(g.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===sn&&g.clearcoatNormalScale.value.negate())),m.dispersion>0&&(g.dispersion.value=m.dispersion),m.iridescence>0&&(g.iridescence.value=m.iridescence,g.iridescenceIOR.value=m.iridescenceIOR,g.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(g.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,g.iridescenceMapTransform)),m.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),m.transmission>0&&(g.transmission.value=m.transmission,g.transmissionSamplerMap.value=S.texture,g.transmissionSamplerSize.value.set(S.width,S.height),m.transmissionMap&&(g.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,g.transmissionMapTransform)),g.thickness.value=m.thickness,m.thicknessMap&&(g.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=m.attenuationDistance,g.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(g.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(g.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=m.specularIntensity,g.specularColor.value.copy(m.specularColor),m.specularColorMap&&(g.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,g.specularColorMapTransform)),m.specularIntensityMap&&(g.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,g.specularIntensityMapTransform))}function _(g,m){m.matcap&&(g.matcap.value=m.matcap)}function b(g,m){const S=e.get(m).light;g.referencePosition.value.setFromMatrixPosition(S.matrixWorld),g.nearDistance.value=S.shadow.camera.near,g.farDistance.value=S.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function qy(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(S,y){const M=y.program;n.uniformBlockBinding(S,M)}function c(S,y){let M=r[S.id];M===void 0&&(_(S),M=h(S),r[S.id]=M,S.addEventListener("dispose",g));const T=y.program;n.updateUBOMapping(S,T);const R=e.render.frame;s[S.id]!==R&&(f(S),s[S.id]=R)}function h(S){const y=u();S.__bindingPointIndex=y;const M=i.createBuffer(),T=S.__size,R=S.usage;return i.bindBuffer(i.UNIFORM_BUFFER,M),i.bufferData(i.UNIFORM_BUFFER,T,R),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,y,M),M}function u(){for(let S=0;S<o;S++)if(a.indexOf(S)===-1)return a.push(S),S;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(S){const y=r[S.id],M=S.uniforms,T=S.__cache;i.bindBuffer(i.UNIFORM_BUFFER,y);for(let R=0,k=M.length;R<k;R++){const B=Array.isArray(M[R])?M[R]:[M[R]];for(let C=0,D=B.length;C<D;C++){const V=B[C];if(d(V,R,C,T)===!0){const K=V.__offset,J=Array.isArray(V.value)?V.value:[V.value];let se=0;for(let he=0;he<J.length;he++){const Q=J[he],de=b(Q);typeof Q=="number"||typeof Q=="boolean"?(V.__data[0]=Q,i.bufferSubData(i.UNIFORM_BUFFER,K+se,V.__data)):Q.isMatrix3?(V.__data[0]=Q.elements[0],V.__data[1]=Q.elements[1],V.__data[2]=Q.elements[2],V.__data[3]=0,V.__data[4]=Q.elements[3],V.__data[5]=Q.elements[4],V.__data[6]=Q.elements[5],V.__data[7]=0,V.__data[8]=Q.elements[6],V.__data[9]=Q.elements[7],V.__data[10]=Q.elements[8],V.__data[11]=0):(Q.toArray(V.__data,se),se+=de.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,K,V.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function d(S,y,M,T){const R=S.value,k=y+"_"+M;if(T[k]===void 0)return typeof R=="number"||typeof R=="boolean"?T[k]=R:T[k]=R.clone(),!0;{const B=T[k];if(typeof R=="number"||typeof R=="boolean"){if(B!==R)return T[k]=R,!0}else if(B.equals(R)===!1)return B.copy(R),!0}return!1}function _(S){const y=S.uniforms;let M=0;const T=16;for(let k=0,B=y.length;k<B;k++){const C=Array.isArray(y[k])?y[k]:[y[k]];for(let D=0,V=C.length;D<V;D++){const K=C[D],J=Array.isArray(K.value)?K.value:[K.value];for(let se=0,he=J.length;se<he;se++){const Q=J[se],de=b(Q),ne=M%T,ue=ne%de.boundary,Te=ne+ue;M+=ue,Te!==0&&T-Te<de.storage&&(M+=T-Te),K.__data=new Float32Array(de.storage/Float32Array.BYTES_PER_ELEMENT),K.__offset=M,M+=de.storage}}}const R=M%T;return R>0&&(M+=T-R),S.__size=M,S.__cache={},this}function b(S){const y={boundary:0,storage:0};return typeof S=="number"||typeof S=="boolean"?(y.boundary=4,y.storage=4):S.isVector2?(y.boundary=8,y.storage=8):S.isVector3||S.isColor?(y.boundary=16,y.storage=12):S.isVector4?(y.boundary=16,y.storage=16):S.isMatrix3?(y.boundary=48,y.storage=48):S.isMatrix4?(y.boundary=64,y.storage=64):S.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",S),y}function g(S){const y=S.target;y.removeEventListener("dispose",g);const M=a.indexOf(y.__bindingPointIndex);a.splice(M,1),i.deleteBuffer(r[y.id]),delete r[y.id],delete s[y.id]}function m(){for(const S in r)i.deleteBuffer(r[S]);a=[],r={},s={}}return{bind:l,update:c,dispose:m}}class Yy{constructor(e={}){const{canvas:t=Am(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:f=!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=a;const _=new Uint32Array(4),b=new Int32Array(4);let g=null,m=null;const S=[],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.toneMapping=ri,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const M=this;let T=!1;this._outputColorSpace=Bt;let R=0,k=0,B=null,C=-1,D=null;const V=new pt,K=new pt;let J=null;const se=new Ze(0);let he=0,Q=t.width,de=t.height,ne=1,ue=null,Te=null;const ke=new pt(0,0,Q,de),O=new pt(0,0,Q,de);let H=!1;const we=new Tl;let Be=!1,ie=!1;const ce=new et,z=new $,j=new pt,W={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let le=!1;function be(){return B===null?ne:1}let U=n;function ee(P,G){return t.getContext(P,G)}try{const P={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ja}`),t.addEventListener("webglcontextlost",p,!1),t.addEventListener("webglcontextrestored",v,!1),t.addEventListener("webglcontextcreationerror",E,!1),U===null){const G="webgl2";if(U=ee(G,P),U===null)throw ee(G)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(P){throw console.error("THREE.WebGLRenderer: "+P.message),P}let fe,ye,Se,ze,_e,xe,Xe,De,N,w,q,re,pe,ae,Ve,Ae,oe,We,Me,Re,je,Oe,Ce,A;function x(){fe=new s0(U),fe.init(),Oe=new Hy(U,fe),ye=new Jv(U,fe,e,Oe),Se=new By(U,fe),ye.reversedDepthBuffer&&f&&Se.buffers.depth.setReversed(!0),ze=new l0(U),_e=new wy,xe=new zy(U,fe,Se,_e,ye,Oe,ze),Xe=new e0(M),De=new r0(M),N=new qg(U),Ce=new Kv(U,N),w=new a0(U,N,ze,Ce),q=new u0(U,w,N,ze),Me=new c0(U,ye,xe),Ae=new Qv(_e),re=new Ty(M,Xe,De,fe,ye,Ce,Ae),pe=new jy(M,_e),ae=new Ry,Ve=new Uy(fe),We=new Yv(M,Xe,De,Se,q,d,l),oe=new Fy(M,q,ye),A=new qy(U,ze,ye,Se),Re=new Zv(U,fe,ze),je=new o0(U,fe,ze),ze.programs=re.programs,M.capabilities=ye,M.extensions=fe,M.properties=_e,M.renderLists=ae,M.shadowMap=oe,M.state=Se,M.info=ze}x();const L=new Xy(M,U);this.xr=L,this.getContext=function(){return U},this.getContextAttributes=function(){return U.getContextAttributes()},this.forceContextLoss=function(){const P=fe.get("WEBGL_lose_context");P&&P.loseContext()},this.forceContextRestore=function(){const P=fe.get("WEBGL_lose_context");P&&P.restoreContext()},this.getPixelRatio=function(){return ne},this.setPixelRatio=function(P){P!==void 0&&(ne=P,this.setSize(Q,de,!1))},this.getSize=function(P){return P.set(Q,de)},this.setSize=function(P,G,Z=!0){if(L.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}Q=P,de=G,t.width=Math.floor(P*ne),t.height=Math.floor(G*ne),Z===!0&&(t.style.width=P+"px",t.style.height=G+"px"),this.setViewport(0,0,P,G)},this.getDrawingBufferSize=function(P){return P.set(Q*ne,de*ne).floor()},this.setDrawingBufferSize=function(P,G,Z){Q=P,de=G,ne=Z,t.width=Math.floor(P*Z),t.height=Math.floor(G*Z),this.setViewport(0,0,P,G)},this.getCurrentViewport=function(P){return P.copy(V)},this.getViewport=function(P){return P.copy(ke)},this.setViewport=function(P,G,Z,te){P.isVector4?ke.set(P.x,P.y,P.z,P.w):ke.set(P,G,Z,te),Se.viewport(V.copy(ke).multiplyScalar(ne).round())},this.getScissor=function(P){return P.copy(O)},this.setScissor=function(P,G,Z,te){P.isVector4?O.set(P.x,P.y,P.z,P.w):O.set(P,G,Z,te),Se.scissor(K.copy(O).multiplyScalar(ne).round())},this.getScissorTest=function(){return H},this.setScissorTest=function(P){Se.setScissorTest(H=P)},this.setOpaqueSort=function(P){ue=P},this.setTransparentSort=function(P){Te=P},this.getClearColor=function(P){return P.copy(We.getClearColor())},this.setClearColor=function(){We.setClearColor(...arguments)},this.getClearAlpha=function(){return We.getClearAlpha()},this.setClearAlpha=function(){We.setClearAlpha(...arguments)},this.clear=function(P=!0,G=!0,Z=!0){let te=0;if(P){let Y=!1;if(B!==null){const Ee=B.texture.format;Y=Ee===_o||Ee===go||Ee===mo}if(Y){const Ee=B.texture.type,Le=Ee===Cn||Ee===Mi||Ee===Vr||Ee===Wr||Ee===ho||Ee===fo,Fe=We.getClearColor(),ge=We.getClearAlpha(),Ue=Fe.r,He=Fe.g,Pe=Fe.b;Le?(_[0]=Ue,_[1]=He,_[2]=Pe,_[3]=ge,U.clearBufferuiv(U.COLOR,0,_)):(b[0]=Ue,b[1]=He,b[2]=Pe,b[3]=ge,U.clearBufferiv(U.COLOR,0,b))}else te|=U.COLOR_BUFFER_BIT}G&&(te|=U.DEPTH_BUFFER_BIT),Z&&(te|=U.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),U.clear(te)},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",p,!1),t.removeEventListener("webglcontextrestored",v,!1),t.removeEventListener("webglcontextcreationerror",E,!1),We.dispose(),ae.dispose(),Ve.dispose(),_e.dispose(),Xe.dispose(),De.dispose(),q.dispose(),Ce.dispose(),A.dispose(),re.dispose(),L.dispose(),L.removeEventListener("sessionstart",Ne),L.removeEventListener("sessionend",ht),ot.stop()};function p(P){P.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function v(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;const P=ze.autoReset,G=oe.enabled,Z=oe.autoUpdate,te=oe.needsUpdate,Y=oe.type;x(),ze.autoReset=P,oe.enabled=G,oe.autoUpdate=Z,oe.needsUpdate=te,oe.type=Y}function E(P){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",P.statusMessage)}function I(P){const G=P.target;G.removeEventListener("dispose",I),F(G)}function F(P){X(P),_e.remove(P)}function X(P){const G=_e.get(P).programs;G!==void 0&&(G.forEach(function(Z){re.releaseProgram(Z)}),P.isShaderMaterial&&re.releaseShaderCache(P))}this.renderBufferDirect=function(P,G,Z,te,Y,Ee){G===null&&(G=W);const Le=Y.isMesh&&Y.matrixWorld.determinant()<0,Fe=ki(P,G,Z,te,Y);Se.setMaterial(te,Le);let ge=Z.index,Ue=1;if(te.wireframe===!0){if(ge=w.getWireframeAttribute(Z),ge===void 0)return;Ue=2}const He=Z.drawRange,Pe=Z.attributes.position;let qe=He.start*Ue,st=(He.start+He.count)*Ue;Ee!==null&&(qe=Math.max(qe,Ee.start*Ue),st=Math.min(st,(Ee.start+Ee.count)*Ue)),ge!==null?(qe=Math.max(qe,0),st=Math.min(st,ge.count)):Pe!=null&&(qe=Math.max(qe,0),st=Math.min(st,Pe.count));const at=st-qe;if(at<0||at===1/0)return;Ce.setup(Y,te,Fe,Z,ge);let ft,tt=Re;if(ge!==null&&(ft=N.get(ge),tt=je,tt.setIndex(ft)),Y.isMesh)te.wireframe===!0?(Se.setLineWidth(te.wireframeLinewidth*be()),tt.setMode(U.LINES)):tt.setMode(U.TRIANGLES);else if(Y.isLine){let Ge=te.linewidth;Ge===void 0&&(Ge=1),Se.setLineWidth(Ge*be()),Y.isLineSegments?tt.setMode(U.LINES):Y.isLineLoop?tt.setMode(U.LINE_LOOP):tt.setMode(U.LINE_STRIP)}else Y.isPoints?tt.setMode(U.POINTS):Y.isSprite&&tt.setMode(U.TRIANGLES);if(Y.isBatchedMesh)if(Y._multiDrawInstances!==null)Jr("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),tt.renderMultiDrawInstances(Y._multiDrawStarts,Y._multiDrawCounts,Y._multiDrawCount,Y._multiDrawInstances);else if(fe.get("WEBGL_multi_draw"))tt.renderMultiDraw(Y._multiDrawStarts,Y._multiDrawCounts,Y._multiDrawCount);else{const Ge=Y._multiDrawStarts,Je=Y._multiDrawCounts,Ke=Y._multiDrawCount,jt=ge?N.get(ge).bytesPerElement:1,Tt=_e.get(te).currentProgram.getUniforms();for(let Vt=0;Vt<Ke;Vt++)Tt.setValue(U,"_gl_DrawID",Vt),tt.render(Ge[Vt]/jt,Je[Vt])}else if(Y.isInstancedMesh)tt.renderInstances(qe,at,Y.count);else if(Z.isInstancedBufferGeometry){const Ge=Z._maxInstanceCount!==void 0?Z._maxInstanceCount:1/0,Je=Math.min(Z.instanceCount,Ge);tt.renderInstances(qe,at,Je)}else tt.render(qe,at)};function me(P,G,Z){P.transparent===!0&&P.side===Rn&&P.forceSinglePass===!1?(P.side=sn,P.needsUpdate=!0,Dt(P,G,Z),P.side=Gn,P.needsUpdate=!0,Dt(P,G,Z),P.side=Rn):Dt(P,G,Z)}this.compile=function(P,G,Z=null){Z===null&&(Z=P),m=Ve.get(Z),m.init(G),y.push(m),Z.traverseVisible(function(Y){Y.isLight&&Y.layers.test(G.layers)&&(m.pushLight(Y),Y.castShadow&&m.pushShadow(Y))}),P!==Z&&P.traverseVisible(function(Y){Y.isLight&&Y.layers.test(G.layers)&&(m.pushLight(Y),Y.castShadow&&m.pushShadow(Y))}),m.setupLights();const te=new Set;return P.traverse(function(Y){if(!(Y.isMesh||Y.isPoints||Y.isLine||Y.isSprite))return;const Ee=Y.material;if(Ee)if(Array.isArray(Ee))for(let Le=0;Le<Ee.length;Le++){const Fe=Ee[Le];me(Fe,Z,Y),te.add(Fe)}else me(Ee,Z,Y),te.add(Ee)}),m=y.pop(),te},this.compileAsync=function(P,G,Z=null){const te=this.compile(P,G,Z);return new Promise(Y=>{function Ee(){if(te.forEach(function(Le){_e.get(Le).currentProgram.isReady()&&te.delete(Le)}),te.size===0){Y(P);return}setTimeout(Ee,10)}fe.get("KHR_parallel_shader_compile")!==null?Ee():setTimeout(Ee,10)})};let ve=null;function $e(P){ve&&ve(P)}function Ne(){ot.stop()}function ht(){ot.start()}const ot=new Dh;ot.setAnimationLoop($e),typeof self<"u"&&ot.setContext(self),this.setAnimationLoop=function(P){ve=P,L.setAnimationLoop(P),P===null?ot.stop():ot.start()},L.addEventListener("sessionstart",Ne),L.addEventListener("sessionend",ht),this.render=function(P,G){if(G!==void 0&&G.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;if(P.matrixWorldAutoUpdate===!0&&P.updateMatrixWorld(),G.parent===null&&G.matrixWorldAutoUpdate===!0&&G.updateMatrixWorld(),L.enabled===!0&&L.isPresenting===!0&&(L.cameraAutoUpdate===!0&&L.updateCamera(G),G=L.getCamera()),P.isScene===!0&&P.onBeforeRender(M,P,G,B),m=Ve.get(P,y.length),m.init(G),y.push(m),ce.multiplyMatrices(G.projectionMatrix,G.matrixWorldInverse),we.setFromProjectionMatrix(ce,Pn,G.reversedDepth),ie=this.localClippingEnabled,Be=Ae.init(this.clippingPlanes,ie),g=ae.get(P,S.length),g.init(),S.push(g),L.enabled===!0&&L.isPresenting===!0){const Ee=M.xr.getDepthSensingMesh();Ee!==null&>(Ee,G,-1/0,M.sortObjects)}gt(P,G,0,M.sortObjects),g.finish(),M.sortObjects===!0&&g.sort(ue,Te),le=L.enabled===!1||L.isPresenting===!1||L.hasDepthSensing()===!1,le&&We.addToRenderList(g,P),this.info.render.frame++,Be===!0&&Ae.beginShadows();const Z=m.state.shadowsArray;oe.render(Z,P,G),Be===!0&&Ae.endShadows(),this.info.autoReset===!0&&this.info.reset();const te=g.opaque,Y=g.transmissive;if(m.setupLights(),G.isArrayCamera){const Ee=G.cameras;if(Y.length>0)for(let Le=0,Fe=Ee.length;Le<Fe;Le++){const ge=Ee[Le];ct(te,Y,P,ge)}le&&We.render(P);for(let Le=0,Fe=Ee.length;Le<Fe;Le++){const ge=Ee[Le];Mt(g,P,ge,ge.viewport)}}else Y.length>0&&ct(te,Y,P,G),le&&We.render(P),Mt(g,P,G);B!==null&&k===0&&(xe.updateMultisampleRenderTarget(B),xe.updateRenderTargetMipmap(B)),P.isScene===!0&&P.onAfterRender(M,P,G),Ce.resetDefaultState(),C=-1,D=null,y.pop(),y.length>0?(m=y[y.length-1],Be===!0&&Ae.setGlobalState(M.clippingPlanes,m.state.camera)):m=null,S.pop(),S.length>0?g=S[S.length-1]:g=null};function gt(P,G,Z,te){if(P.visible===!1)return;if(P.layers.test(G.layers)){if(P.isGroup)Z=P.renderOrder;else if(P.isLOD)P.autoUpdate===!0&&P.update(G);else if(P.isLight)m.pushLight(P),P.castShadow&&m.pushShadow(P);else if(P.isSprite){if(!P.frustumCulled||we.intersectsSprite(P)){te&&j.setFromMatrixPosition(P.matrixWorld).applyMatrix4(ce);const Le=q.update(P),Fe=P.material;Fe.visible&&g.push(P,Le,Fe,Z,j.z,null)}}else if((P.isMesh||P.isLine||P.isPoints)&&(!P.frustumCulled||we.intersectsObject(P))){const Le=q.update(P),Fe=P.material;if(te&&(P.boundingSphere!==void 0?(P.boundingSphere===null&&P.computeBoundingSphere(),j.copy(P.boundingSphere.center)):(Le.boundingSphere===null&&Le.computeBoundingSphere(),j.copy(Le.boundingSphere.center)),j.applyMatrix4(P.matrixWorld).applyMatrix4(ce)),Array.isArray(Fe)){const ge=Le.groups;for(let Ue=0,He=ge.length;Ue<He;Ue++){const Pe=ge[Ue],qe=Fe[Pe.materialIndex];qe&&qe.visible&&g.push(P,Le,qe,Z,j.z,Pe)}}else Fe.visible&&g.push(P,Le,Fe,Z,j.z,null)}}const Ee=P.children;for(let Le=0,Fe=Ee.length;Le<Fe;Le++)gt(Ee[Le],G,Z,te)}function Mt(P,G,Z,te){const Y=P.opaque,Ee=P.transmissive,Le=P.transparent;m.setupLightsView(Z),Be===!0&&Ae.setGlobalState(M.clippingPlanes,Z),te&&Se.viewport(V.copy(te)),Y.length>0&&St(Y,G,Z),Ee.length>0&&St(Ee,G,Z),Le.length>0&&St(Le,G,Z),Se.buffers.depth.setTest(!0),Se.buffers.depth.setMask(!0),Se.buffers.color.setMask(!0),Se.setPolygonOffset(!1)}function ct(P,G,Z,te){if((Z.isScene===!0?Z.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[te.id]===void 0&&(m.state.transmissionRenderTarget[te.id]=new Ti(1,1,{generateMipmaps:!0,type:fe.has("EXT_color_buffer_half_float")||fe.has("EXT_color_buffer_float")?Gr:Cn,minFilter:Wn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:lt.workingColorSpace}));const Ee=m.state.transmissionRenderTarget[te.id],Le=te.viewport||V;Ee.setSize(Le.z*M.transmissionResolutionScale,Le.w*M.transmissionResolutionScale);const Fe=M.getRenderTarget(),ge=M.getActiveCubeFace(),Ue=M.getActiveMipmapLevel();M.setRenderTarget(Ee),M.getClearColor(se),he=M.getClearAlpha(),he<1&&M.setClearColor(16777215,.5),M.clear(),le&&We.render(Z);const He=M.toneMapping;M.toneMapping=ri;const Pe=te.viewport;if(te.viewport!==void 0&&(te.viewport=void 0),m.setupLightsView(te),Be===!0&&Ae.setGlobalState(M.clippingPlanes,te),St(P,Z,te),xe.updateMultisampleRenderTarget(Ee),xe.updateRenderTargetMipmap(Ee),fe.has("WEBGL_multisampled_render_to_texture")===!1){let qe=!1;for(let st=0,at=G.length;st<at;st++){const ft=G[st],tt=ft.object,Ge=ft.geometry,Je=ft.material,Ke=ft.group;if(Je.side===Rn&&tt.layers.test(te.layers)){const jt=Je.side;Je.side=sn,Je.needsUpdate=!0,nn(tt,Z,te,Ge,Je,Ke),Je.side=jt,Je.needsUpdate=!0,qe=!0}}qe===!0&&(xe.updateMultisampleRenderTarget(Ee),xe.updateRenderTargetMipmap(Ee))}M.setRenderTarget(Fe,ge,Ue),M.setClearColor(se,he),Pe!==void 0&&(te.viewport=Pe),M.toneMapping=He}function St(P,G,Z){const te=G.isScene===!0?G.overrideMaterial:null;for(let Y=0,Ee=P.length;Y<Ee;Y++){const Le=P[Y],Fe=Le.object,ge=Le.geometry,Ue=Le.group;let He=Le.material;He.allowOverride===!0&&te!==null&&(He=te),Fe.layers.test(Z.layers)&&nn(Fe,G,Z,ge,He,Ue)}}function nn(P,G,Z,te,Y,Ee){P.onBeforeRender(M,G,Z,te,Y,Ee),P.modelViewMatrix.multiplyMatrices(Z.matrixWorldInverse,P.matrixWorld),P.normalMatrix.getNormalMatrix(P.modelViewMatrix),Y.onBeforeRender(M,G,Z,te,P,Ee),Y.transparent===!0&&Y.side===Rn&&Y.forceSinglePass===!1?(Y.side=sn,Y.needsUpdate=!0,M.renderBufferDirect(Z,G,te,Y,P,Ee),Y.side=Gn,Y.needsUpdate=!0,M.renderBufferDirect(Z,G,te,Y,P,Ee),Y.side=Rn):M.renderBufferDirect(Z,G,te,Y,P,Ee),P.onAfterRender(M,G,Z,te,Y,Ee)}function Dt(P,G,Z){G.isScene!==!0&&(G=W);const te=_e.get(P),Y=m.state.lights,Ee=m.state.shadowsArray,Le=Y.state.version,Fe=re.getParameters(P,Y.state,Ee,G,Z),ge=re.getProgramCacheKey(Fe);let Ue=te.programs;te.environment=P.isMeshStandardMaterial?G.environment:null,te.fog=G.fog,te.envMap=(P.isMeshStandardMaterial?De:Xe).get(P.envMap||te.environment),te.envMapRotation=te.environment!==null&&P.envMap===null?G.environmentRotation:P.envMapRotation,Ue===void 0&&(P.addEventListener("dispose",I),Ue=new Map,te.programs=Ue);let He=Ue.get(ge);if(He!==void 0){if(te.currentProgram===He&&te.lightsStateVersion===Le)return Et(P,Fe),He}else Fe.uniforms=re.getUniforms(P),P.onBeforeCompile(Fe,M),He=re.acquireProgram(Fe,ge),Ue.set(ge,He),te.uniforms=Fe.uniforms;const Pe=te.uniforms;return(!P.isShaderMaterial&&!P.isRawShaderMaterial||P.clipping===!0)&&(Pe.clippingPlanes=Ae.uniform),Et(P,Fe),te.needsLights=vi(P),te.lightsStateVersion=Le,te.needsLights&&(Pe.ambientLightColor.value=Y.state.ambient,Pe.lightProbe.value=Y.state.probe,Pe.directionalLights.value=Y.state.directional,Pe.directionalLightShadows.value=Y.state.directionalShadow,Pe.spotLights.value=Y.state.spot,Pe.spotLightShadows.value=Y.state.spotShadow,Pe.rectAreaLights.value=Y.state.rectArea,Pe.ltc_1.value=Y.state.rectAreaLTC1,Pe.ltc_2.value=Y.state.rectAreaLTC2,Pe.pointLights.value=Y.state.point,Pe.pointLightShadows.value=Y.state.pointShadow,Pe.hemisphereLights.value=Y.state.hemi,Pe.directionalShadowMap.value=Y.state.directionalShadowMap,Pe.directionalShadowMatrix.value=Y.state.directionalShadowMatrix,Pe.spotShadowMap.value=Y.state.spotShadowMap,Pe.spotLightMatrix.value=Y.state.spotLightMatrix,Pe.spotLightMap.value=Y.state.spotLightMap,Pe.pointShadowMap.value=Y.state.pointShadowMap,Pe.pointShadowMatrix.value=Y.state.pointShadowMatrix),te.currentProgram=He,te.uniformsList=null,He}function hn(P){if(P.uniformsList===null){const G=P.currentProgram.getUniforms();P.uniformsList=ma.seqWithValue(G.seq,P.uniforms)}return P.uniformsList}function Et(P,G){const Z=_e.get(P);Z.outputColorSpace=G.outputColorSpace,Z.batching=G.batching,Z.batchingColor=G.batchingColor,Z.instancing=G.instancing,Z.instancingColor=G.instancingColor,Z.instancingMorph=G.instancingMorph,Z.skinning=G.skinning,Z.morphTargets=G.morphTargets,Z.morphNormals=G.morphNormals,Z.morphColors=G.morphColors,Z.morphTargetsCount=G.morphTargetsCount,Z.numClippingPlanes=G.numClippingPlanes,Z.numIntersection=G.numClipIntersection,Z.vertexAlphas=G.vertexAlphas,Z.vertexTangents=G.vertexTangents,Z.toneMapping=G.toneMapping}function ki(P,G,Z,te,Y){G.isScene!==!0&&(G=W),xe.resetTextureUnits();const Ee=G.fog,Le=te.isMeshStandardMaterial?G.environment:null,Fe=B===null?M.outputColorSpace:B.isXRRenderTarget===!0?B.texture.colorSpace:Kt,ge=(te.isMeshStandardMaterial?De:Xe).get(te.envMap||Le),Ue=te.vertexColors===!0&&!!Z.attributes.color&&Z.attributes.color.itemSize===4,He=!!Z.attributes.tangent&&(!!te.normalMap||te.anisotropy>0),Pe=!!Z.morphAttributes.position,qe=!!Z.morphAttributes.normal,st=!!Z.morphAttributes.color;let at=ri;te.toneMapped&&(B===null||B.isXRRenderTarget===!0)&&(at=M.toneMapping);const ft=Z.morphAttributes.position||Z.morphAttributes.normal||Z.morphAttributes.color,tt=ft!==void 0?ft.length:0,Ge=_e.get(te),Je=m.state.lights;if(Be===!0&&(ie===!0||P!==D)){const rn=P===D&&te.id===C;Ae.setState(te,P,rn)}let Ke=!1;te.version===Ge.__version?(Ge.needsLights&&Ge.lightsStateVersion!==Je.state.version||Ge.outputColorSpace!==Fe||Y.isBatchedMesh&&Ge.batching===!1||!Y.isBatchedMesh&&Ge.batching===!0||Y.isBatchedMesh&&Ge.batchingColor===!0&&Y.colorTexture===null||Y.isBatchedMesh&&Ge.batchingColor===!1&&Y.colorTexture!==null||Y.isInstancedMesh&&Ge.instancing===!1||!Y.isInstancedMesh&&Ge.instancing===!0||Y.isSkinnedMesh&&Ge.skinning===!1||!Y.isSkinnedMesh&&Ge.skinning===!0||Y.isInstancedMesh&&Ge.instancingColor===!0&&Y.instanceColor===null||Y.isInstancedMesh&&Ge.instancingColor===!1&&Y.instanceColor!==null||Y.isInstancedMesh&&Ge.instancingMorph===!0&&Y.morphTexture===null||Y.isInstancedMesh&&Ge.instancingMorph===!1&&Y.morphTexture!==null||Ge.envMap!==ge||te.fog===!0&&Ge.fog!==Ee||Ge.numClippingPlanes!==void 0&&(Ge.numClippingPlanes!==Ae.numPlanes||Ge.numIntersection!==Ae.numIntersection)||Ge.vertexAlphas!==Ue||Ge.vertexTangents!==He||Ge.morphTargets!==Pe||Ge.morphNormals!==qe||Ge.morphColors!==st||Ge.toneMapping!==at||Ge.morphTargetsCount!==tt)&&(Ke=!0):(Ke=!0,Ge.__version=te.version);let jt=Ge.currentProgram;Ke===!0&&(jt=Dt(te,G,Y));let Tt=!1,Vt=!1,wn=!1;const dt=jt.getUniforms(),Wt=Ge.uniforms;if(Se.useProgram(jt.program)&&(Tt=!0,Vt=!0,wn=!0),te.id!==C&&(C=te.id,Vt=!0),Tt||D!==P){Se.buffers.depth.getReversed()&&P.reversedDepth!==!0&&(P._reversedDepth=!0,P.updateProjectionMatrix()),dt.setValue(U,"projectionMatrix",P.projectionMatrix),dt.setValue(U,"viewMatrix",P.matrixWorldInverse);const on=dt.map.cameraPosition;on!==void 0&&on.setValue(U,z.setFromMatrixPosition(P.matrixWorld)),ye.logarithmicDepthBuffer&&dt.setValue(U,"logDepthBufFC",2/(Math.log(P.far+1)/Math.LN2)),(te.isMeshPhongMaterial||te.isMeshToonMaterial||te.isMeshLambertMaterial||te.isMeshBasicMaterial||te.isMeshStandardMaterial||te.isShaderMaterial)&&dt.setValue(U,"isOrthographic",P.isOrthographicCamera===!0),D!==P&&(D=P,Vt=!0,wn=!0)}if(Y.isSkinnedMesh){dt.setOptional(U,Y,"bindMatrix"),dt.setOptional(U,Y,"bindMatrixInverse");const rn=Y.skeleton;rn&&(rn.boneTexture===null&&rn.computeBoneTexture(),dt.setValue(U,"boneTexture",rn.boneTexture,xe))}Y.isBatchedMesh&&(dt.setOptional(U,Y,"batchingTexture"),dt.setValue(U,"batchingTexture",Y._matricesTexture,xe),dt.setOptional(U,Y,"batchingIdTexture"),dt.setValue(U,"batchingIdTexture",Y._indirectTexture,xe),dt.setOptional(U,Y,"batchingColorTexture"),Y._colorsTexture!==null&&dt.setValue(U,"batchingColorTexture",Y._colorsTexture,xe));const Ft=Z.morphAttributes;if((Ft.position!==void 0||Ft.normal!==void 0||Ft.color!==void 0)&&Me.update(Y,Z,jt),(Vt||Ge.receiveShadow!==Y.receiveShadow)&&(Ge.receiveShadow=Y.receiveShadow,dt.setValue(U,"receiveShadow",Y.receiveShadow)),te.isMeshGouraudMaterial&&te.envMap!==null&&(Wt.envMap.value=ge,Wt.flipEnvMap.value=ge.isCubeTexture&&ge.isRenderTargetTexture===!1?-1:1),te.isMeshStandardMaterial&&te.envMap===null&&G.environment!==null&&(Wt.envMapIntensity.value=G.environmentIntensity),Vt&&(dt.setValue(U,"toneMappingExposure",M.toneMappingExposure),Ge.needsLights&&Bn(Wt,wn),Ee&&te.fog===!0&&pe.refreshFogUniforms(Wt,Ee),pe.refreshMaterialUniforms(Wt,te,ne,de,m.state.transmissionRenderTarget[P.id]),ma.upload(U,hn(Ge),Wt,xe)),te.isShaderMaterial&&te.uniformsNeedUpdate===!0&&(ma.upload(U,hn(Ge),Wt,xe),te.uniformsNeedUpdate=!1),te.isSpriteMaterial&&dt.setValue(U,"center",Y.center),dt.setValue(U,"modelViewMatrix",Y.modelViewMatrix),dt.setValue(U,"normalMatrix",Y.normalMatrix),dt.setValue(U,"modelMatrix",Y.matrixWorld),te.isShaderMaterial||te.isRawShaderMaterial){const rn=te.uniformsGroups;for(let on=0,cc=rn.length;on<cc;on++){const Bi=rn[on];A.update(Bi,jt),A.bind(Bi,jt)}}return jt}function Bn(P,G){P.ambientLightColor.needsUpdate=G,P.lightProbe.needsUpdate=G,P.directionalLights.needsUpdate=G,P.directionalLightShadows.needsUpdate=G,P.pointLights.needsUpdate=G,P.pointLightShadows.needsUpdate=G,P.spotLights.needsUpdate=G,P.spotLightShadows.needsUpdate=G,P.rectAreaLights.needsUpdate=G,P.hemisphereLights.needsUpdate=G}function vi(P){return P.isMeshLambertMaterial||P.isMeshToonMaterial||P.isMeshPhongMaterial||P.isMeshStandardMaterial||P.isShadowMaterial||P.isShaderMaterial&&P.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return k},this.getRenderTarget=function(){return B},this.setRenderTargetTextures=function(P,G,Z){const te=_e.get(P);te.__autoAllocateDepthBuffer=P.resolveDepthBuffer===!1,te.__autoAllocateDepthBuffer===!1&&(te.__useRenderToTexture=!1),_e.get(P.texture).__webglTexture=G,_e.get(P.depthTexture).__webglTexture=te.__autoAllocateDepthBuffer?void 0:Z,te.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(P,G){const Z=_e.get(P);Z.__webglFramebuffer=G,Z.__useDefaultFramebuffer=G===void 0};const ac=U.createFramebuffer();this.setRenderTarget=function(P,G=0,Z=0){B=P,R=G,k=Z;let te=!0,Y=null,Ee=!1,Le=!1;if(P){const ge=_e.get(P);if(ge.__useDefaultFramebuffer!==void 0)Se.bindFramebuffer(U.FRAMEBUFFER,null),te=!1;else if(ge.__webglFramebuffer===void 0)xe.setupRenderTarget(P);else if(ge.__hasExternalTextures)xe.rebindTextures(P,_e.get(P.texture).__webglTexture,_e.get(P.depthTexture).__webglTexture);else if(P.depthBuffer){const Pe=P.depthTexture;if(ge.__boundDepthTexture!==Pe){if(Pe!==null&&_e.has(Pe)&&(P.width!==Pe.image.width||P.height!==Pe.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");xe.setupDepthRenderbuffer(P)}}const Ue=P.texture;(Ue.isData3DTexture||Ue.isDataArrayTexture||Ue.isCompressedArrayTexture)&&(Le=!0);const He=_e.get(P).__webglFramebuffer;P.isWebGLCubeRenderTarget?(Array.isArray(He[G])?Y=He[G][Z]:Y=He[G],Ee=!0):P.samples>0&&xe.useMultisampledRTT(P)===!1?Y=_e.get(P).__webglMultisampledFramebuffer:Array.isArray(He)?Y=He[Z]:Y=He,V.copy(P.viewport),K.copy(P.scissor),J=P.scissorTest}else V.copy(ke).multiplyScalar(ne).floor(),K.copy(O).multiplyScalar(ne).floor(),J=H;if(Z!==0&&(Y=ac),Se.bindFramebuffer(U.FRAMEBUFFER,Y)&&te&&Se.drawBuffers(P,Y),Se.viewport(V),Se.scissor(K),Se.setScissorTest(J),Ee){const ge=_e.get(P.texture);U.framebufferTexture2D(U.FRAMEBUFFER,U.COLOR_ATTACHMENT0,U.TEXTURE_CUBE_MAP_POSITIVE_X+G,ge.__webglTexture,Z)}else if(Le){const ge=G;for(let Ue=0;Ue<P.textures.length;Ue++){const He=_e.get(P.textures[Ue]);U.framebufferTextureLayer(U.FRAMEBUFFER,U.COLOR_ATTACHMENT0+Ue,He.__webglTexture,Z,ge)}}else if(P!==null&&Z!==0){const ge=_e.get(P.texture);U.framebufferTexture2D(U.FRAMEBUFFER,U.COLOR_ATTACHMENT0,U.TEXTURE_2D,ge.__webglTexture,Z)}C=-1},this.readRenderTargetPixels=function(P,G,Z,te,Y,Ee,Le,Fe=0){if(!(P&&P.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ge=_e.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&Le!==void 0&&(ge=ge[Le]),ge){Se.bindFramebuffer(U.FRAMEBUFFER,ge);try{const Ue=P.textures[Fe],He=Ue.format,Pe=Ue.type;if(!ye.textureFormatReadable(He)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ye.textureTypeReadable(Pe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}G>=0&&G<=P.width-te&&Z>=0&&Z<=P.height-Y&&(P.textures.length>1&&U.readBuffer(U.COLOR_ATTACHMENT0+Fe),U.readPixels(G,Z,te,Y,Oe.convert(He),Oe.convert(Pe),Ee))}finally{const Ue=B!==null?_e.get(B).__webglFramebuffer:null;Se.bindFramebuffer(U.FRAMEBUFFER,Ue)}}},this.readRenderTargetPixelsAsync=async function(P,G,Z,te,Y,Ee,Le,Fe=0){if(!(P&&P.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ge=_e.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&Le!==void 0&&(ge=ge[Le]),ge)if(G>=0&&G<=P.width-te&&Z>=0&&Z<=P.height-Y){Se.bindFramebuffer(U.FRAMEBUFFER,ge);const Ue=P.textures[Fe],He=Ue.format,Pe=Ue.type;if(!ye.textureFormatReadable(He))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ye.textureTypeReadable(Pe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const qe=U.createBuffer();U.bindBuffer(U.PIXEL_PACK_BUFFER,qe),U.bufferData(U.PIXEL_PACK_BUFFER,Ee.byteLength,U.STREAM_READ),P.textures.length>1&&U.readBuffer(U.COLOR_ATTACHMENT0+Fe),U.readPixels(G,Z,te,Y,Oe.convert(He),Oe.convert(Pe),0);const st=B!==null?_e.get(B).__webglFramebuffer:null;Se.bindFramebuffer(U.FRAMEBUFFER,st);const at=U.fenceSync(U.SYNC_GPU_COMMANDS_COMPLETE,0);return U.flush(),await Rm(U,at,4),U.bindBuffer(U.PIXEL_PACK_BUFFER,qe),U.getBufferSubData(U.PIXEL_PACK_BUFFER,0,Ee),U.deleteBuffer(qe),U.deleteSync(at),Ee}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(P,G=null,Z=0){const te=Math.pow(2,-Z),Y=Math.floor(P.image.width*te),Ee=Math.floor(P.image.height*te),Le=G!==null?G.x:0,Fe=G!==null?G.y:0;xe.setTexture2D(P,0),U.copyTexSubImage2D(U.TEXTURE_2D,Z,0,0,Le,Fe,Y,Ee),Se.unbindTexture()};const oc=U.createFramebuffer(),lc=U.createFramebuffer();this.copyTextureToTexture=function(P,G,Z=null,te=null,Y=0,Ee=null){Ee===null&&(Y!==0?(Jr("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Ee=Y,Y=0):Ee=0);let Le,Fe,ge,Ue,He,Pe,qe,st,at;const ft=P.isCompressedTexture?P.mipmaps[Ee]:P.image;if(Z!==null)Le=Z.max.x-Z.min.x,Fe=Z.max.y-Z.min.y,ge=Z.isBox3?Z.max.z-Z.min.z:1,Ue=Z.min.x,He=Z.min.y,Pe=Z.isBox3?Z.min.z:0;else{const Ft=Math.pow(2,-Y);Le=Math.floor(ft.width*Ft),Fe=Math.floor(ft.height*Ft),P.isDataArrayTexture?ge=ft.depth:P.isData3DTexture?ge=Math.floor(ft.depth*Ft):ge=1,Ue=0,He=0,Pe=0}te!==null?(qe=te.x,st=te.y,at=te.z):(qe=0,st=0,at=0);const tt=Oe.convert(G.format),Ge=Oe.convert(G.type);let Je;G.isData3DTexture?(xe.setTexture3D(G,0),Je=U.TEXTURE_3D):G.isDataArrayTexture||G.isCompressedArrayTexture?(xe.setTexture2DArray(G,0),Je=U.TEXTURE_2D_ARRAY):(xe.setTexture2D(G,0),Je=U.TEXTURE_2D),U.pixelStorei(U.UNPACK_FLIP_Y_WEBGL,G.flipY),U.pixelStorei(U.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),U.pixelStorei(U.UNPACK_ALIGNMENT,G.unpackAlignment);const Ke=U.getParameter(U.UNPACK_ROW_LENGTH),jt=U.getParameter(U.UNPACK_IMAGE_HEIGHT),Tt=U.getParameter(U.UNPACK_SKIP_PIXELS),Vt=U.getParameter(U.UNPACK_SKIP_ROWS),wn=U.getParameter(U.UNPACK_SKIP_IMAGES);U.pixelStorei(U.UNPACK_ROW_LENGTH,ft.width),U.pixelStorei(U.UNPACK_IMAGE_HEIGHT,ft.height),U.pixelStorei(U.UNPACK_SKIP_PIXELS,Ue),U.pixelStorei(U.UNPACK_SKIP_ROWS,He),U.pixelStorei(U.UNPACK_SKIP_IMAGES,Pe);const dt=P.isDataArrayTexture||P.isData3DTexture,Wt=G.isDataArrayTexture||G.isData3DTexture;if(P.isDepthTexture){const Ft=_e.get(P),rn=_e.get(G),on=_e.get(Ft.__renderTarget),cc=_e.get(rn.__renderTarget);Se.bindFramebuffer(U.READ_FRAMEBUFFER,on.__webglFramebuffer),Se.bindFramebuffer(U.DRAW_FRAMEBUFFER,cc.__webglFramebuffer);for(let Bi=0;Bi<ge;Bi++)dt&&(U.framebufferTextureLayer(U.READ_FRAMEBUFFER,U.COLOR_ATTACHMENT0,_e.get(P).__webglTexture,Y,Pe+Bi),U.framebufferTextureLayer(U.DRAW_FRAMEBUFFER,U.COLOR_ATTACHMENT0,_e.get(G).__webglTexture,Ee,at+Bi)),U.blitFramebuffer(Ue,He,Le,Fe,qe,st,Le,Fe,U.DEPTH_BUFFER_BIT,U.NEAREST);Se.bindFramebuffer(U.READ_FRAMEBUFFER,null),Se.bindFramebuffer(U.DRAW_FRAMEBUFFER,null)}else if(Y!==0||P.isRenderTargetTexture||_e.has(P)){const Ft=_e.get(P),rn=_e.get(G);Se.bindFramebuffer(U.READ_FRAMEBUFFER,oc),Se.bindFramebuffer(U.DRAW_FRAMEBUFFER,lc);for(let on=0;on<ge;on++)dt?U.framebufferTextureLayer(U.READ_FRAMEBUFFER,U.COLOR_ATTACHMENT0,Ft.__webglTexture,Y,Pe+on):U.framebufferTexture2D(U.READ_FRAMEBUFFER,U.COLOR_ATTACHMENT0,U.TEXTURE_2D,Ft.__webglTexture,Y),Wt?U.framebufferTextureLayer(U.DRAW_FRAMEBUFFER,U.COLOR_ATTACHMENT0,rn.__webglTexture,Ee,at+on):U.framebufferTexture2D(U.DRAW_FRAMEBUFFER,U.COLOR_ATTACHMENT0,U.TEXTURE_2D,rn.__webglTexture,Ee),Y!==0?U.blitFramebuffer(Ue,He,Le,Fe,qe,st,Le,Fe,U.COLOR_BUFFER_BIT,U.NEAREST):Wt?U.copyTexSubImage3D(Je,Ee,qe,st,at+on,Ue,He,Le,Fe):U.copyTexSubImage2D(Je,Ee,qe,st,Ue,He,Le,Fe);Se.bindFramebuffer(U.READ_FRAMEBUFFER,null),Se.bindFramebuffer(U.DRAW_FRAMEBUFFER,null)}else Wt?P.isDataTexture||P.isData3DTexture?U.texSubImage3D(Je,Ee,qe,st,at,Le,Fe,ge,tt,Ge,ft.data):G.isCompressedArrayTexture?U.compressedTexSubImage3D(Je,Ee,qe,st,at,Le,Fe,ge,tt,ft.data):U.texSubImage3D(Je,Ee,qe,st,at,Le,Fe,ge,tt,Ge,ft):P.isDataTexture?U.texSubImage2D(U.TEXTURE_2D,Ee,qe,st,Le,Fe,tt,Ge,ft.data):P.isCompressedTexture?U.compressedTexSubImage2D(U.TEXTURE_2D,Ee,qe,st,ft.width,ft.height,tt,ft.data):U.texSubImage2D(U.TEXTURE_2D,Ee,qe,st,Le,Fe,tt,Ge,ft);U.pixelStorei(U.UNPACK_ROW_LENGTH,Ke),U.pixelStorei(U.UNPACK_IMAGE_HEIGHT,jt),U.pixelStorei(U.UNPACK_SKIP_PIXELS,Tt),U.pixelStorei(U.UNPACK_SKIP_ROWS,Vt),U.pixelStorei(U.UNPACK_SKIP_IMAGES,wn),Ee===0&&G.generateMipmaps&&U.generateMipmap(Je),Se.unbindTexture()},this.initRenderTarget=function(P){_e.get(P).__webglFramebuffer===void 0&&xe.setupRenderTarget(P)},this.initTexture=function(P){P.isCubeTexture?xe.setTextureCube(P,0):P.isData3DTexture?xe.setTexture3D(P,0):P.isDataArrayTexture||P.isCompressedArrayTexture?xe.setTexture2DArray(P,0):xe.setTexture2D(P,0),Se.unbindTexture()},this.resetState=function(){R=0,k=0,B=null,Se.reset(),Ce.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Pn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=lt._getDrawingBufferColorSpace(e),t.unpackColorSpace=lt._getUnpackColorSpace()}}function of(i,e){if(e===em)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===jo||e===Su){let t=i.getIndex();if(t===null){const a=[],o=i.getAttribute("position");if(o!==void 0){for(let l=0;l<o.count;l++)a.push(l);i.setIndex(a),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}const n=t.count-2,r=[];if(e===jo)for(let a=1;a<=n;a++)r.push(t.getX(0)),r.push(t.getX(a)),r.push(t.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(r.push(t.getX(a)),r.push(t.getX(a+1)),r.push(t.getX(a+2))):(r.push(t.getX(a+2)),r.push(t.getX(a+1)),r.push(t.getX(a)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=i.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}class Ky extends Er{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new tx(t)}),this.register(function(t){return new nx(t)}),this.register(function(t){return new hx(t)}),this.register(function(t){return new fx(t)}),this.register(function(t){return new dx(t)}),this.register(function(t){return new rx(t)}),this.register(function(t){return new sx(t)}),this.register(function(t){return new ax(t)}),this.register(function(t){return new ox(t)}),this.register(function(t){return new ex(t)}),this.register(function(t){return new lx(t)}),this.register(function(t){return new ix(t)}),this.register(function(t){return new ux(t)}),this.register(function(t){return new cx(t)}),this.register(function(t){return new Jy(t)}),this.register(function(t){return new px(t)}),this.register(function(t){return new mx(t)})}load(e,t,n,r){const s=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const c=cs.extractUrlBase(e);a=cs.resolveURL(c,this.path)}else a=cs.extractUrlBase(e);this.manager.itemStart(e);const o=function(c){r?r(c):console.error(c),s.manager.itemError(e),s.manager.itemEnd(e)},l=new Mh(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{s.parse(c,a,function(h){t(h),s.manager.itemEnd(e)},o)}catch(h){o(h)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,r){let s;const a={},o={},l=new TextDecoder;if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===lf){try{a[rt.KHR_BINARY_GLTF]=new gx(e)}catch(u){r&&r(u);return}s=JSON.parse(a[rt.KHR_BINARY_GLTF].content)}else s=JSON.parse(l.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2){r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Cx(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const u=this.pluginCallbacks[h](c);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[u.name]=u,a[u.name]=!0}if(s.extensionsUsed)for(let h=0;h<s.extensionsUsed.length;++h){const u=s.extensionsUsed[h],f=s.extensionsRequired||[];switch(u){case rt.KHR_MATERIALS_UNLIT:a[u]=new Qy;break;case rt.KHR_DRACO_MESH_COMPRESSION:a[u]=new _x(s,this.dracoLoader);break;case rt.KHR_TEXTURE_TRANSFORM:a[u]=new vx;break;case rt.KHR_MESH_QUANTIZATION:a[u]=new yx;break;default:f.indexOf(u)>=0&&o[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(a),c.setPlugins(o),c.parse(n,r)}parseAsync(e,t){const n=this;return new Promise(function(r,s){n.parse(e,t,r,s)})}}function Zy(){let i={};return{get:function(e){return i[e]},add:function(e,t){i[e]=t},remove:function(e){delete i[e]},removeAll:function(){i={}}}}const rt={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Jy{constructor(e){this.parser=e,this.name=rt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n<r;n++){const s=t[n];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let r=t.cache.get(n);if(r)return r;const s=t.json,l=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let c;const h=new Ze(16777215);l.color!==void 0&&h.setRGB(l.color[0],l.color[1],l.color[2],Kt);const u=l.range!==void 0?l.range:0;switch(l.type){case"directional":c=new Il(h),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new Dg(h),c.distance=u;break;case"spot":c=new Cg(h),c.distance=u,l.spot=l.spot||{},l.spot.innerConeAngle=l.spot.innerConeAngle!==void 0?l.spot.innerConeAngle:0,l.spot.outerConeAngle=l.spot.outerConeAngle!==void 0?l.spot.outerConeAngle:Math.PI/4,c.angle=l.spot.outerConeAngle,c.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return c.position.set(0,0,0),kn(c,l),l.intensity!==void 0&&(c.intensity=l.intensity),c.name=t.createUniqueName(l.name||"light_"+e),r=Promise.resolve(c),t.cache.add(n,r),r}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,s=n.json.nodes[e],o=(s.extensions&&s.extensions[this.name]||{}).light;return o===void 0?null:this._loadLight(o).then(function(l){return n._getNodeRef(t.cache,o,l)})}}class Qy{constructor(){this.name=rt.KHR_MATERIALS_UNLIT}getMaterialType(){return Ri}extendParams(e,t,n){const r=[];e.color=new Ze(1,1,1),e.opacity=1;const s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const a=s.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],Kt),e.opacity=a[3]}s.baseColorTexture!==void 0&&r.push(n.assignTexture(e,"map",s.baseColorTexture,Bt))}return Promise.all(r)}}class ex{constructor(e){this.parser=e,this.name=rt.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name].emissiveStrength;return s!==void 0&&(t.emissiveIntensity=s),Promise.resolve()}}class tx{constructor(e){this.parser=e,this.name=rt.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:On}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];if(a.clearcoatFactor!==void 0&&(t.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(s.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){const o=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Ye(o,o)}return Promise.all(s)}}class nx{constructor(e){this.parser=e,this.name=rt.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:On}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class ix{constructor(e){this.parser=e,this.name=rt.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:On}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];return a.iridescenceFactor!==void 0&&(t.iridescence=a.iridescenceFactor),a.iridescenceTexture!==void 0&&s.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),a.iridescenceIor!==void 0&&(t.iridescenceIOR=a.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),a.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),a.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),a.iridescenceThicknessTexture!==void 0&&s.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(s)}}class rx{constructor(e){this.parser=e,this.name=rt.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:On}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[];t.sheenColor=new Ze(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=r.extensions[this.name];if(a.sheenColorFactor!==void 0){const o=a.sheenColorFactor;t.sheenColor.setRGB(o[0],o[1],o[2],Kt)}return a.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&s.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,Bt)),a.sheenRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(s)}}class sx{constructor(e){this.parser=e,this.name=rt.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:On}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];return a.transmissionFactor!==void 0&&(t.transmission=a.transmissionFactor),a.transmissionTexture!==void 0&&s.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(s)}}class ax{constructor(e){this.parser=e,this.name=rt.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:On}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];t.thickness=a.thicknessFactor!==void 0?a.thicknessFactor:0,a.thicknessTexture!==void 0&&s.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const o=a.attenuationColor||[1,1,1];return t.attenuationColor=new Ze().setRGB(o[0],o[1],o[2],Kt),Promise.all(s)}}class ox{constructor(e){this.parser=e,this.name=rt.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:On}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class lx{constructor(e){this.parser=e,this.name=rt.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:On}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];t.specularIntensity=a.specularFactor!==void 0?a.specularFactor:1,a.specularTexture!==void 0&&s.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));const o=a.specularColorFactor||[1,1,1];return t.specularColor=new Ze().setRGB(o[0],o[1],o[2],Kt),a.specularColorTexture!==void 0&&s.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,Bt)),Promise.all(s)}}class cx{constructor(e){this.parser=e,this.name=rt.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:On}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];return t.bumpScale=a.bumpFactor!==void 0?a.bumpFactor:1,a.bumpTexture!==void 0&&s.push(n.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(s)}}class ux{constructor(e){this.parser=e,this.name=rt.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:On}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];return a.anisotropyStrength!==void 0&&(t.anisotropy=a.anisotropyStrength),a.anisotropyRotation!==void 0&&(t.anisotropyRotation=a.anisotropyRotation),a.anisotropyTexture!==void 0&&s.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(s)}}class hx{constructor(e){this.parser=e,this.name=rt.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const s=r.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,a)}}class fx{constructor(e){this.parser=e,this.name=rt.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,n=this.parser,r=n.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],o=r.images[a.source];let l=n.textureLoader;if(o.uri){const c=n.options.manager.getHandler(o.uri);c!==null&&(l=c)}return n.loadTextureImage(e,a.source,l)}}class dx{constructor(e){this.parser=e,this.name=rt.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,n=this.parser,r=n.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],o=r.images[a.source];let l=n.textureLoader;if(o.uri){const c=n.options.manager.getHandler(o.uri);c!==null&&(l=c)}return n.loadTextureImage(e,a.source,l)}}class px{constructor(e){this.name=rt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const r=n.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(o){const l=r.byteOffset||0,c=r.byteLength||0,h=r.count,u=r.byteStride,f=new Uint8Array(o,l,c);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(h,u,f,r.mode,r.filter).then(function(d){return d.buffer}):a.ready.then(function(){const d=new ArrayBuffer(h*u);return a.decodeGltfBuffer(new Uint8Array(d),h,u,f,r.mode,r.filter),d})})}else return null}}class mx{constructor(e){this.name=rt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const r=t.meshes[n.mesh];for(const c of r.primitives)if(c.mode!==mn.TRIANGLES&&c.mode!==mn.TRIANGLE_STRIP&&c.mode!==mn.TRIANGLE_FAN&&c.mode!==void 0)return null;const a=n.extensions[this.name].attributes,o=[],l={};for(const c in a)o.push(this.parser.getDependency("accessor",a[c]).then(h=>(l[c]=h,l[c])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(c=>{const h=c.pop(),u=h.isGroup?h.children:[h],f=c[0].count,d=[];for(const _ of u){const b=new et,g=new $,m=new Dn,S=new $(1,1,1),y=new sg(_.geometry,_.material,f);for(let M=0;M<f;M++)l.TRANSLATION&&g.fromBufferAttribute(l.TRANSLATION,M),l.ROTATION&&m.fromBufferAttribute(l.ROTATION,M),l.SCALE&&S.fromBufferAttribute(l.SCALE,M),y.setMatrixAt(M,b.compose(g,m,S));for(const M in l)if(M==="_COLOR_0"){const T=l[M];y.instanceColor=new Ml(T.array,T.itemSize,T.normalized)}else M!=="TRANSLATION"&&M!=="ROTATION"&&M!=="SCALE"&&_.geometry.setAttribute(M,l[M]);At.prototype.copy.call(y,_),this.parser.assignFinalMaterial(y),d.push(y)}return h.isGroup?(h.clear(),h.add(...d),h):d[0]}))}}const lf="glTF",hs=12,cf={JSON:1313821514,BIN:5130562};class gx{constructor(e){this.name=rt.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,hs),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==lf)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-hs,s=new DataView(e,hs);let a=0;for(;a<r;){const o=s.getUint32(a,!0);a+=4;const l=s.getUint32(a,!0);if(a+=4,l===cf.JSON){const c=new Uint8Array(e,hs+a,o);this.content=n.decode(c)}else if(l===cf.BIN){const c=hs+a;this.body=e.slice(c,c+o)}a+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class _x{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=rt.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,r=this.dracoLoader,s=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},l={},c={};for(const h in a){const u=jl[h]||h.toLowerCase();o[u]=a[h]}for(const h in e.attributes){const u=jl[h]||h.toLowerCase();if(a[h]!==void 0){const f=n.accessors[e.attributes[h]],d=Cr[f.componentType];c[u]=d.name,l[u]=f.normalized===!0}}return t.getDependency("bufferView",s).then(function(h){return new Promise(function(u,f){r.decodeDracoFile(h,function(d){for(const _ in d.attributes){const b=d.attributes[_],g=l[_];g!==void 0&&(b.normalized=g)}u(d)},o,c,Kt,f)})})}}class vx{constructor(){this.name=rt.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class yx{constructor(){this.name=rt.KHR_MESH_QUANTIZATION}}class uf extends os{constructor(e,t,n,r){super(e,t,n,r)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r*3+r;for(let a=0;a!==r;a++)t[a]=n[s+a];return t}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=o*2,c=o*3,h=r-t,u=(n-t)/h,f=u*u,d=f*u,_=e*c,b=_-c,g=-2*d+3*f,m=d-f,S=1-g,y=m-f+u;for(let M=0;M!==o;M++){const T=a[b+M+o],R=a[b+M+l]*h,k=a[_+M+o],B=a[_+M]*h;s[M]=S*T+y*R+g*k+m*B}return s}}const xx=new Dn;class bx extends uf{interpolate_(e,t,n,r){const s=super.interpolate_(e,t,n,r);return xx.fromArray(s).normalize().toArray(s),s}}const mn={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Cr={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},hf={9728:Yt,9729:ln,9984:hu,9985:Ps,9986:Hr,9987:Wn},ff={33071:si,33648:Cs,10497:Qi},$l={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},jl={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},mi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Sx={CUBICSPLINE:void 0,LINEAR:qr,STEP:jr},ql={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Mx(i){return i.DefaultMaterial===void 0&&(i.DefaultMaterial=new as({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Gn})),i.DefaultMaterial}function Ni(i,e,t){for(const n in t.extensions)i[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function kn(i,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(i.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Ex(i,e,t){let n=!1,r=!1,s=!1;for(let c=0,h=e.length;c<h;c++){const u=e[c];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(r=!0),u.COLOR_0!==void 0&&(s=!0),n&&r&&s)break}if(!n&&!r&&!s)return Promise.resolve(i);const a=[],o=[],l=[];for(let c=0,h=e.length;c<h;c++){const u=e[c];if(n){const f=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):i.attributes.position;a.push(f)}if(r){const f=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):i.attributes.normal;o.push(f)}if(s){const f=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):i.attributes.color;l.push(f)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(l)]).then(function(c){const h=c[0],u=c[1],f=c[2];return n&&(i.morphAttributes.position=h),r&&(i.morphAttributes.normal=u),s&&(i.morphAttributes.color=f),i.morphTargetsRelative=!0,i})}function Tx(i,e){if(i.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)i.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(i.morphTargetInfluences.length===t.length){i.morphTargetDictionary={};for(let n=0,r=t.length;n<r;n++)i.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function wx(i){let e;const t=i.extensions&&i.extensions[rt.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Yl(t.attributes):e=i.indices+":"+Yl(i.attributes)+":"+i.mode,i.targets!==void 0)for(let n=0,r=i.targets.length;n<r;n++)e+=":"+Yl(i.targets[n]);return e}function Yl(i){let e="";const t=Object.keys(i).sort();for(let n=0,r=t.length;n<r;n++)e+=t[n]+":"+i[t[n]]+";";return e}function Kl(i){switch(i){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Ax(i){return i.search(/\.jpe?g($|\?)/i)>0||i.search(/^data\:image\/jpeg/)===0?"image/jpeg":i.search(/\.webp($|\?)/i)>0||i.search(/^data\:image\/webp/)===0?"image/webp":i.search(/\.ktx2($|\?)/i)>0||i.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const Rx=new et;class Cx{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Zy,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,s=!1,a=-1;if(typeof navigator<"u"){const o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;const l=o.match(/Version\/(\d+)/);r=n&&l?parseInt(l[1],10):-1,s=o.indexOf("Firefox")>-1,a=s?o.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&r<17||s&&a<98?this.textureLoader=new Ag(this.options.manager):this.textureLoader=new Ug(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Mh(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(a){const o={scene:a[0][r.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:r.asset,parser:n,userData:{}};return Ni(s,o,r),kn(o,r),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(o)})).then(function(){for(const l of o.scenes)l.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let r=0,s=t.length;r<s;r++){const a=t[r].joints;for(let o=0,l=a.length;o<l;o++)e[a[o]].isBone=!0}for(let r=0,s=e.length;r<s;r++){const a=e[r];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(n[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const r=n.clone(),s=(a,o)=>{const l=this.associations.get(a);l!=null&&this.associations.set(o,l);for(const[c,h]of a.children.entries())s(h,o.children[c])};return s(n,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const r=e(t[n]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let r=0;r<t.length;r++){const s=e(t[r]);s&&n.push(s)}return n}getDependency(e,t){const n=e+":"+t;let r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":r=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!r)throw new Error("Unknown type: "+e);break}this.cache.add(n,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,r=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(r.map(function(s,a){return n.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[rt.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(s,a){n.load(cs.resolveURL(t.uri,r.path),s,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const r=t.byteLength||0,s=t.byteOffset||0;return n.slice(s,s+r)})}loadAccessor(e){const t=this,n=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){const a=$l[r.type],o=Cr[r.componentType],l=r.normalized===!0,c=new o(r.count*a);return Promise.resolve(new Zt(c,a,l))}const s=[];return r.bufferView!==void 0?s.push(this.getDependency("bufferView",r.bufferView)):s.push(null),r.sparse!==void 0&&(s.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(s).then(function(a){const o=a[0],l=$l[r.type],c=Cr[r.componentType],h=c.BYTES_PER_ELEMENT,u=h*l,f=r.byteOffset||0,d=r.bufferView!==void 0?n.bufferViews[r.bufferView].byteStride:void 0,_=r.normalized===!0;let b,g;if(d&&d!==u){const m=Math.floor(f/d),S="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+m+":"+r.count;let y=t.cache.get(S);y||(b=new c(o,m*d,r.count*d/h),y=new eg(b,d/h),t.cache.add(S,y)),g=new yl(y,l,f%d/h,_)}else o===null?b=new c(r.count*l):b=new c(o,f,r.count*l),g=new Zt(b,l,_);if(r.sparse!==void 0){const m=$l.SCALAR,S=Cr[r.sparse.indices.componentType],y=r.sparse.indices.byteOffset||0,M=r.sparse.values.byteOffset||0,T=new S(a[1],y,r.sparse.count*m),R=new c(a[2],M,r.sparse.count*l);o!==null&&(g=new Zt(g.array.slice(),g.itemSize,g.normalized)),g.normalized=!1;for(let k=0,B=T.length;k<B;k++){const C=T[k];if(g.setX(C,R[k*l]),l>=2&&g.setY(C,R[k*l+1]),l>=3&&g.setZ(C,R[k*l+2]),l>=4&&g.setW(C,R[k*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}g.normalized=_}return g})}loadTexture(e){const t=this.json,n=this.options,s=t.textures[e].source,a=t.images[s];let o=this.textureLoader;if(a.uri){const l=n.manager.getHandler(a.uri);l!==null&&(o=l)}return this.loadTextureImage(e,s,o)}loadTextureImage(e,t,n){const r=this,s=this.json,a=s.textures[e],o=s.images[t],l=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,n).then(function(h){h.flipY=!1,h.name=a.name||o.name||"",h.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(h.name=o.uri);const f=(s.samplers||{})[a.sampler]||{};return h.magFilter=hf[f.magFilter]||ln,h.minFilter=hf[f.minFilter]||Wn,h.wrapS=ff[f.wrapS]||Qi,h.wrapT=ff[f.wrapT]||Qi,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==Yt&&h.minFilter!==ln,r.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const n=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const a=r.images[e],o=self.URL||self.webkitURL;let l=a.uri||"",c=!1;if(a.bufferView!==void 0)l=n.getDependency("bufferView",a.bufferView).then(function(u){c=!0;const f=new Blob([u],{type:a.mimeType});return l=o.createObjectURL(f),l});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(l).then(function(u){return new Promise(function(f,d){let _=f;t.isImageBitmapLoader===!0&&(_=function(b){const g=new zt(b);g.needsUpdate=!0,f(g)}),t.load(cs.resolveURL(u,s.path),_,void 0,d)})}).then(function(u){return c===!0&&o.revokeObjectURL(l),kn(u,a),u.userData.mimeType=a.mimeType||Ax(a.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),u});return this.sourceCache[e]=h,h}assignTexture(e,t,n,r){const s=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),s.extensions[rt.KHR_TEXTURE_TRANSFORM]){const o=n.extensions!==void 0?n.extensions[rt.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const l=s.associations.get(a);a=s.extensions[rt.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),s.associations.set(a,l)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+n.uuid;let l=this.cache.get(o);l||(l=new mh,Nn.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(o,l)),n=l}else if(e.isLine){const o="LineBasicMaterial:"+n.uuid;let l=this.cache.get(o);l||(l=new uh,Nn.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(o,l)),n=l}if(r||s||a){let o="ClonedMaterial:"+n.uuid+":";r&&(o+="derivative-tangents:"),s&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let l=this.cache.get(o);l||(l=n.clone(),s&&(l.vertexColors=!0),a&&(l.flatShading=!0),r&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(o,l),this.associations.set(l,this.associations.get(n))),n=l}e.material=n}getMaterialType(){return as}loadMaterial(e){const t=this,n=this.json,r=this.extensions,s=n.materials[e];let a;const o={},l=s.extensions||{},c=[];if(l[rt.KHR_MATERIALS_UNLIT]){const u=r[rt.KHR_MATERIALS_UNLIT];a=u.getMaterialType(),c.push(u.extendParams(o,s,t))}else{const u=s.pbrMetallicRoughness||{};if(o.color=new Ze(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;o.color.setRGB(f[0],f[1],f[2],Kt),o.opacity=f[3]}u.baseColorTexture!==void 0&&c.push(t.assignTexture(o,"map",u.baseColorTexture,Bt)),o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(o,"roughnessMap",u.metallicRoughnessTexture))),a=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,o)})))}s.doubleSided===!0&&(o.side=Rn);const h=s.alphaMode||ql.OPAQUE;if(h===ql.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===ql.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&a!==Ri&&(c.push(t.assignTexture(o,"normalMap",s.normalTexture)),o.normalScale=new Ye(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;o.normalScale.set(u,u)}if(s.occlusionTexture!==void 0&&a!==Ri&&(c.push(t.assignTexture(o,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&a!==Ri){const u=s.emissiveFactor;o.emissive=new Ze().setRGB(u[0],u[1],u[2],Kt)}return s.emissiveTexture!==void 0&&a!==Ri&&c.push(t.assignTexture(o,"emissiveMap",s.emissiveTexture,Bt)),Promise.all(c).then(function(){const u=new a(o);return s.name&&(u.name=s.name),kn(u,s),t.associations.set(u,{materials:e}),s.extensions&&Ni(r,u,s),u})}createUniqueName(e){const t=yt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,r=this.primitiveCache;function s(o){return n[rt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(l){return df(l,o,t)})}const a=[];for(let o=0,l=e.length;o<l;o++){const c=e[o],h=wx(c),u=r[h];if(u)a.push(u.promise);else{let f;c.extensions&&c.extensions[rt.KHR_DRACO_MESH_COMPRESSION]?f=s(c):f=df(new En,c,t),r[h]={primitive:c,promise:f},a.push(f)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,r=this.extensions,s=n.meshes[e],a=s.primitives,o=[];for(let l=0,c=a.length;l<c;l++){const h=a[l].material===void 0?Mx(this.cache):this.getDependency("material",a[l].material);o.push(h)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(l){const c=l.slice(0,l.length-1),h=l[l.length-1],u=[];for(let d=0,_=h.length;d<_;d++){const b=h[d],g=a[d];let m;const S=c[d];if(g.mode===mn.TRIANGLES||g.mode===mn.TRIANGLE_STRIP||g.mode===mn.TRIANGLE_FAN||g.mode===void 0)m=s.isSkinnedMesh===!0?new ng(b,S):new Jt(b,S),m.isSkinnedMesh===!0&&m.normalizeSkinWeights(),g.mode===mn.TRIANGLE_STRIP?m.geometry=of(m.geometry,Su):g.mode===mn.TRIANGLE_FAN&&(m.geometry=of(m.geometry,jo));else if(g.mode===mn.LINES)m=new cg(b,S);else if(g.mode===mn.LINE_STRIP)m=new Al(b,S);else if(g.mode===mn.LINE_LOOP)m=new ug(b,S);else if(g.mode===mn.POINTS)m=new hg(b,S);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+g.mode);Object.keys(m.geometry.morphAttributes).length>0&&Tx(m,s),m.name=t.createUniqueName(s.name||"mesh_"+e),kn(m,s),g.extensions&&Ni(r,m,g),t.assignFinalMaterial(m),u.push(m)}for(let d=0,_=u.length;d<_;d++)t.associations.set(u[d],{meshes:e,primitives:d});if(u.length===1)return s.extensions&&Ni(r,u[0],s),u[0];const f=new Zn;s.extensions&&Ni(r,f,s),t.associations.set(f,{meshes:e});for(let d=0,_=u.length;d<_;d++)f.add(u[d]);return f})}loadCamera(e){let t;const n=this.json.cameras[e],r=n[n.type];if(!r){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new en(Ru.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):n.type==="orthographic"&&(t=new ha(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),kn(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let r=0,s=t.joints.length;r<s;r++)n.push(this._loadNodeShallow(t.joints[r]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(r){const s=r.pop(),a=r,o=[],l=[];for(let c=0,h=a.length;c<h;c++){const u=a[c];if(u){o.push(u);const f=new et;s!==null&&f.fromArray(s.array,c*16),l.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new Sl(o,l)})}loadAnimation(e){const t=this.json,n=this,r=t.animations[e],s=r.name?r.name:"animation_"+e,a=[],o=[],l=[],c=[],h=[];for(let u=0,f=r.channels.length;u<f;u++){const d=r.channels[u],_=r.samplers[d.sampler],b=d.target,g=b.node,m=r.parameters!==void 0?r.parameters[_.input]:_.input,S=r.parameters!==void 0?r.parameters[_.output]:_.output;b.node!==void 0&&(a.push(this.getDependency("node",g)),o.push(this.getDependency("accessor",m)),l.push(this.getDependency("accessor",S)),c.push(_),h.push(b))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(l),Promise.all(c),Promise.all(h)]).then(function(u){const f=u[0],d=u[1],_=u[2],b=u[3],g=u[4],m=[];for(let y=0,M=f.length;y<M;y++){const T=f[y],R=d[y],k=_[y],B=b[y],C=g[y];if(T===void 0)continue;T.updateMatrix&&T.updateMatrix();const D=n._createAnimationTracks(T,R,k,B,C);if(D)for(let V=0;V<D.length;V++)m.push(D[V])}const S=new xg(s,void 0,m);return kn(S,r),S})}createNodeMesh(e){const t=this.json,n=this,r=t.nodes[e];return r.mesh===void 0?null:n.getDependency("mesh",r.mesh).then(function(s){const a=n._getNodeRef(n.meshCache,r.mesh,s);return r.weights!==void 0&&a.traverse(function(o){if(o.isMesh)for(let l=0,c=r.weights.length;l<c;l++)o.morphTargetInfluences[l]=r.weights[l]}),a})}loadNode(e){const t=this.json,n=this,r=t.nodes[e],s=n._loadNodeShallow(e),a=[],o=r.children||[];for(let c=0,h=o.length;c<h;c++)a.push(n.getDependency("node",o[c]));const l=r.skin===void 0?Promise.resolve(null):n.getDependency("skin",r.skin);return Promise.all([s,Promise.all(a),l]).then(function(c){const h=c[0],u=c[1],f=c[2];f!==null&&h.traverse(function(d){d.isSkinnedMesh&&d.bind(f,Rx)});for(let d=0,_=u.length;d<_;d++)h.add(u[d]);return h})}_loadNodeShallow(e){const t=this.json,n=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=t.nodes[e],a=s.name?r.createUniqueName(s.name):"",o=[],l=r._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&o.push(l),s.camera!==void 0&&o.push(r.getDependency("camera",s.camera).then(function(c){return r._getNodeRef(r.cameraCache,s.camera,c)})),r._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){o.push(c)}),this.nodeCache[e]=Promise.all(o).then(function(c){let h;if(s.isBone===!0?h=new sh:c.length>1?h=new Zn:c.length===1?h=c[0]:h=new At,h!==c[0])for(let u=0,f=c.length;u<f;u++)h.add(c[u]);if(s.name&&(h.userData.name=s.name,h.name=a),kn(h,s),s.extensions&&Ni(n,h,s),s.matrix!==void 0){const u=new et;u.fromArray(s.matrix),h.applyMatrix4(u)}else s.translation!==void 0&&h.position.fromArray(s.translation),s.rotation!==void 0&&h.quaternion.fromArray(s.rotation),s.scale!==void 0&&h.scale.fromArray(s.scale);if(!r.associations.has(h))r.associations.set(h,{});else if(s.mesh!==void 0&&r.meshCache.refs[s.mesh]>1){const u=r.associations.get(h);r.associations.set(h,{...u})}return r.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],r=this,s=new Zn;n.name&&(s.name=r.createUniqueName(n.name)),kn(s,n),n.extensions&&Ni(t,s,n);const a=n.nodes||[],o=[];for(let l=0,c=a.length;l<c;l++)o.push(r.getDependency("node",a[l]));return Promise.all(o).then(function(l){for(let h=0,u=l.length;h<u;h++)s.add(l[h]);const c=h=>{const u=new Map;for(const[f,d]of r.associations)(f instanceof Nn||f instanceof zt)&&u.set(f,d);return h.traverse(f=>{const d=r.associations.get(f);d!=null&&u.set(f,d)}),u};return r.associations=c(s),s})}_createAnimationTracks(e,t,n,r,s){const a=[],o=e.name?e.name:e.uuid,l=[];mi[s.path]===mi.weights?e.traverse(function(f){f.morphTargetInfluences&&l.push(f.name?f.name:f.uuid)}):l.push(o);let c;switch(mi[s.path]){case mi.weights:c=xr;break;case mi.rotation:c=br;break;case mi.translation:case mi.scale:c=Mr;break;default:switch(n.itemSize){case 1:c=xr;break;case 2:case 3:default:c=Mr;break}break}const h=r.interpolation!==void 0?Sx[r.interpolation]:qr,u=this._getArrayFromAccessor(n);for(let f=0,d=l.length;f<d;f++){const _=new c(l[f]+"."+mi[s.path],t.array,u,h);r.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(_),a.push(_)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=Kl(t.constructor),r=new Float32Array(t.length);for(let s=0,a=t.length;s<a;s++)r[s]=t[s]*n;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const r=this instanceof br?bx:uf;return new r(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Px(i,e,t){const n=e.attributes,r=new Ln;if(n.POSITION!==void 0){const o=t.json.accessors[n.POSITION],l=o.min,c=o.max;if(l!==void 0&&c!==void 0){if(r.set(new $(l[0],l[1],l[2]),new $(c[0],c[1],c[2])),o.normalized){const h=Kl(Cr[o.componentType]);r.min.multiplyScalar(h),r.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const o=new $,l=new $;for(let c=0,h=s.length;c<h;c++){const u=s[c];if(u.POSITION!==void 0){const f=t.json.accessors[u.POSITION],d=f.min,_=f.max;if(d!==void 0&&_!==void 0){if(l.setX(Math.max(Math.abs(d[0]),Math.abs(_[0]))),l.setY(Math.max(Math.abs(d[1]),Math.abs(_[1]))),l.setZ(Math.max(Math.abs(d[2]),Math.abs(_[2]))),f.normalized){const b=Kl(Cr[f.componentType]);l.multiplyScalar(b)}o.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(o)}i.boundingBox=r;const a=new In;r.getCenter(a.center),a.radius=r.min.distanceTo(r.max)/2,i.boundingSphere=a}function df(i,e,t){const n=e.attributes,r=[];function s(a,o){return t.getDependency("accessor",a).then(function(l){i.setAttribute(o,l)})}for(const a in n){const o=jl[a]||a.toLowerCase();o in i.attributes||r.push(s(n[a],o))}if(e.indices!==void 0&&!i.index){const a=t.getDependency("accessor",e.indices).then(function(o){i.setIndex(o)});r.push(a)}return lt.workingColorSpace!==Kt&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${lt.workingColorSpace}" not supported.`),kn(i,e),Px(i,e,t),Promise.all(r).then(function(){return e.targets!==void 0?Ex(i,e.targets,t):i})}function Dx(){const i=new Zn;i.name="sonic-3d-demo";const e=new pr(1,1,1),t=new as({color:3900150,metalness:.25,roughness:.4}),n=new Jt(e,t);n.name="demo-box",n.position.y=.5,i.add(n);const r=new Jt(new Cl(2.2,48),new as({color:1710618,metalness:0,roughness:.9}));return r.name="demo-ground",r.rotation.x=-Math.PI/2,i.add(r),i}function Lx(i){const e=new Ig(16777215,.55),t=new Il(16777215,1.1);t.position.set(4,6,3);const n=new Il(11584767,.35);n.position.set(-3,1,-2);const r=[e,t,n];for(const s of r)i.add(s);return r}const Zl={create:Dx,setupLights:Lx},Jl="WebGL indisponible — sonic-3d nécessite WebGL.";function Ix(i){const e=document.createElement("canvas"),t=e.getContext("webgl2")||e.getContext("webgl");if(!t||typeof t.getParameter!="function")throw new Error(Jl);const n={canvas:i,antialias:!0,alpha:!1,preserveDrawingBuffer:!0,powerPreference:"high-performance"};let r;try{r=new Yy(n)}catch(s){const a=s instanceof Error?s.message:String(s);throw new Error(`${Jl} (${a})`)}if(!r.getContext())throw r.dispose(),new Error(Jl);return r}function Ux(i){const e=i.dprMax??2,t=i.camera??gn.Orbit,n=i.fov??vs,r=i.fit!==!1,s={minDistance:i.minDistance??Cc,maxDistance:i.maxDistance??Pc,minPolar:i.minPolar??Lc,maxPolar:i.maxPolar??Math.PI-Lc},a=new Qm;a.background=new Ze(657930);const o=new Zn;a.add(o);const l=new en(n,1,.01,2e3);l.position.set(2.2,1.6,2.8);const c=new ha(-1,1,1,-1,.01,2e3);c.position.set(2.2,1.6,2.8);const h=Ix(i.canvas);return h.outputColorSpace=Bt,h.toneMapping=lu,h.toneMappingExposure=i.exposure??Da,h.setPixelRatio(1),{scene:a,renderer:h,canvas:i.canvas,perspCam:l,orthoCam:c,activeCam:l,root:o,lights:Zl.setupLights(a),dprMax:e,mode:t,fov:n,fitEnabled:r,limits:s,autoRotate:!!i.autoRotate}}function Ql(i,e,t){return i.content?(i.pointerNdc.set(e*2-1,-(t*2-1)),i.raycaster.setFromCamera(i.pointerNdc,i.activeCam),i.raycaster.intersectObject(i.content,!0)):[]}function ec(i){return{x:i.point.x,y:i.point.y,z:i.point.z,objectId:i.object.name||i.object.uuid}}function Nx(i,e,t){const n=Ql(i,e,t);return n.length?ec(n[0]):null}function pf(i){if(!i.highlighted)return;const e=i.highlighted.material,t=Array.isArray(e)?e[0]:e;t&&"emissive"in t&&(t.emissive.copy(i.prevEmissive),t.emissiveIntensity=i.prevEmissiveIntensity),i.highlighted=null}function Ox(i,e,t){const n=Ql(i,e,t),r=n[0]?.object,s=r?.isMesh?r:null;if(s===i.highlighted)return n.length?ec(n[0]):null;if(pf(i),!s)return null;const a=s.material,o=Array.isArray(a)?a[0]:a;return o&&"emissive"in o&&(i.highlighted=s,i.prevEmissive.copy(o.emissive),i.prevEmissiveIntensity=o.emissiveIntensity??1,o.emissive.set(3900150),o.emissiveIntensity=.45),ec(n[0])}const _a={hit:Nx,setHoverAt:Ox,clearHighlight:pf,raycastHits:Ql};function mf(i){if(i.blobUrl){try{URL.revokeObjectURL(i.blobUrl)}catch{}i.blobUrl=null}}function gf(i){_a.clearHighlight(i),i.content&&(i.root.remove(i.content),i.content.traverse(e=>{const t=e;if(t.isMesh){t.geometry?.dispose();const n=Array.isArray(t.material)?t.material:[t.material];for(const r of n)r?.dispose?.()}}),i.content=null,i.bbox.makeEmpty())}function tc(i){i.bbox.makeEmpty(),i.content&&i.bbox.setFromObject(i.content)}function _f(i,e){i.traverse(t=>{const n=t;if(!(!n.isMesh||!n.morphTargetDictionary||!n.morphTargetInfluences))for(const[r,s]of Object.entries(e)){const a=n.morphTargetDictionary[r];a!==void 0&&(n.morphTargetInfluences[a]=s)}})}async function Fx(i,e,t,n){gf(i);try{let r=e?.url?.trim()??"";if(!r&&e?.blob&&(mf(i),i.blobUrl=URL.createObjectURL(e.blob),r=i.blobUrl),!r)i.content=Zl.create(),i.root.add(i.content);else{const s=e?.kind??It.guessKind(r);if(s==="obj"||s==="ply")throw new Error(`Format "${s}" non supporté en V1 — utilisez glTF/GLB.`);const a=await i.loader.loadAsync(r);if(!n(t))return{ready:!1,error:null};i.content=a.scene,i.root.add(i.content),e?.morphTargets&&_f(i.content,e.morphTargets)}return n(t)?(tc(i),i.fitEnabled&&i.fitToContent(),{ready:!0,error:null}):{ready:!1,error:null}}catch(r){if(!n(t))return{ready:!1,error:null};const s=r instanceof Error?r.message:String(r);throw i.content=Zl.create(),i.root.add(i.content),tc(i),i.fitEnabled&&i.fitToContent(),r instanceof Error?r:new Error(s)}}const nc={asset:Fx,applyMorphTargets:_f,clearContent:gf,updateBBox:tc,revokeBlob:mf};function kx(i,e){i&&(i.minDistance=e.minDistance,i.maxDistance=e.maxDistance,i.minPolarAngle=e.minPolar,i.maxPolarAngle=e.maxPolar)}function Bx(i,e,t,n){const r=i.controls?.target??i.target;let s=Number.isFinite(n)?n:1;s=Math.max(i.limits.minDistance,s),Number.isFinite(i.limits.maxDistance)&&(s=Math.min(i.limits.maxDistance,s));const a=Math.max(-(Math.PI/2-.05),Math.min(Math.PI/2-.05,t)),o=s*Math.cos(a);i.activeCam.position.set(r.x+o*Math.sin(e),r.y+s*Math.sin(a),r.z+o*Math.cos(e)),i.controls?(i.controls.target.copy(r),i.controls.update()):i.activeCam.lookAt(r)}function zx(i){if(i.bbox.isEmpty())return;const e=new $,t=new $;i.bbox.getSize(e),i.bbox.getCenter(t),i.target.copy(t);const n=Math.max(e.x,e.y,e.z,.001),r=i.mode===gn.Ortho?n*1.8:n/(2*Math.tan((i.fov||vs)*Math.PI/360))*1.35,s=new $(1,.65,1).normalize();if(i.activeCam.position.copy(t).addScaledVector(s,r),i.controls?(i.controls.target.copy(t),i.controls.update()):i.activeCam.lookAt(t),i.mode===gn.Ortho){const a=i.perspCam.aspect||1,o=n*.75;i.orthoCam.left=-o*a,i.orthoCam.right=o*a,i.orthoCam.top=o,i.orthoCam.bottom=-o,i.orthoCam.updateProjectionMatrix()}}function Hx(i,e){const t={...i};return e.minDistance!=null&&Number.isFinite(e.minDistance)&&(t.minDistance=Math.max(0,e.minDistance)),e.maxDistance!=null&&Number.isFinite(e.maxDistance)&&(t.maxDistance=e.maxDistance<=0?1/0:Math.max(t.minDistance,e.maxDistance)),e.minPolar!=null&&Number.isFinite(e.minPolar)&&(t.minPolar=Math.max(0,e.minPolar)),e.maxPolar!=null&&Number.isFinite(e.maxPolar)&&(t.maxPolar=Math.min(Math.PI,Math.max(t.minPolar,e.maxPolar))),t}const va=1e-6;function vf(i,e){if(!Number.isFinite(e)||e===0)return!1;const t=e<0,n=i.object;if(n.isOrthographicCamera){const s=n.zoom;return t?s<i.maxZoom-va:s>i.minZoom+va}const r=i.getDistance();return t?r>i.minDistance+va:Number.isFinite(i.maxDistance)?r<i.maxDistance-va:!0}function Vx(i,e){const t=n=>{const r=e();!r?.enabled||!r.enableZoom||vf(r,n.deltaY)||n.stopImmediatePropagation()};return i.addEventListener("wheel",t,{capture:!0,passive:!0}),()=>{i.removeEventListener("wheel",t,{capture:!0})}}const Pr={applyLimitsToControls:kx,setSpherical:Bx,fitToContent:zx,mergeLimits:Hx,wheelAffectsZoom:vf,bindWheelPageScrollRelay:Vx};function Gx(i,e){const t=i.activeCam.position,n=i.controls?.target??i.target,r=new $().subVectors(t,n),s=r.length(),a=Math.atan2(r.x,r.z),o=Math.atan2(r.y,Math.hypot(r.x,r.z)),l={time:e.time,frame:e.frame,ready:i.ready?1:0,loading:i.loading?1:0,hovering:e.hovering,pointerX:e.pointerX,pointerY:e.pointerY,camX:t.x,camY:t.y,camZ:t.z,targetX:n.x,targetY:n.y,targetZ:n.z,fov:i.mode===gn.Ortho?0:i.perspCam.fov,zoom:i.mode===gn.Ortho?i.orthoCam.zoom:1,distance:s,yaw:a,pitch:o};return i.bbox.isEmpty()||(l.bboxMinX=i.bbox.min.x,l.bboxMinY=i.bbox.min.y,l.bboxMinZ=i.bbox.min.z,l.bboxMaxX=i.bbox.max.x,l.bboxMaxY=i.bbox.max.y,l.bboxMaxZ=i.bbox.max.z),e.hit&&(l.hitX=e.hit.x,l.hitY=e.hit.y,l.hitZ=e.hit.z,l.hitObjectId=e.hit.objectId),l}const Wx={build:Gx};async function Xx(i,e){const t=++i.loadToken;i._loading=!0,i._ready=!1,i.lastError=null;try{const n=await nc.asset(i,e,t,r=>r===i.loadToken);if(t!==i.loadToken)return;i._ready=n.ready,i._loading=!1}catch(n){if(t!==i.loadToken)return;throw i._loading=!1,i._ready=!1,i.lastError=n instanceof Error?n.message:String(n),n}}function $x(i){Pr.fitToContent({bbox:i.bbox,target:i.target,activeCam:i.activeCam,controls:i.controls,mode:i.mode,fov:i.fov,perspCam:i.perspCam,orthoCam:i.orthoCam})}function jx(i,e){return Wx.build({activeCam:i.activeCam,controls:i.controls,target:i.target,mode:i.mode,perspCam:i.perspCam,orthoCam:i.orthoCam,bbox:i.bbox,ready:i._ready,loading:i._loading},e)}function qx(i,e=!1){i.loadToken++,i.unbindWheelRelay?.(),i.unbindWheelRelay=null,i.controls?.dispose(),i.controls=null,nc.clearContent(i),nc.revokeBlob(i);for(const t of i.lights)i.scene.remove(t);i.lights=[],i.renderer.dispose(),e&&i.renderer.getContext()?.getExtension?.("WEBGL_lose_context")?.loseContext?.(),i._ready=!1}const Oi={runLoad:Xx,fitToContent:$x,buildSnapshot:jx,dispose:qx,pick:(i,e,t)=>_a.hit(i,e,t),setHoverAt:(i,e,t)=>_a.setHoverAt(i,e,t),clearHighlight:i=>_a.clearHighlight(i)};function Yx(i,e){i.dprMax=Math.max(1,e||2)}function Kx(i,e){i.renderer.toneMappingExposure=Number.isFinite(e)?e:Da}function Zx(i,e){i.fov=Number.isFinite(e)&&e>0?e:vs,i.perspCam.fov=i.fov,i.perspCam.updateProjectionMatrix()}function Jx(i,e){i.fitEnabled=e}function Qx(i,e){i.controls&&(i.controls.autoRotate=e)}function eb(i,e){i.limits=Pr.mergeLimits(i.limits,e),Pr.applyLimitsToControls(i.controls,i.limits)}function tb(i,e,t,n){Pr.setSpherical({activeCam:i.activeCam,controls:i.controls,target:i.target,limits:i.limits},e,t,n)}const Fi={setDprMax:Yx,setExposure:Kx,setFov:Zx,setFit:Jx,setAutoRotate:Qx,setOrbitLimits:eb,setOrbitSpherical:tb},yf={type:"change"},ic={type:"start"},xf={type:"end"},ya=new or,bf=new pi,nb=Math.cos(70*Ru.DEG2RAD),Ot=new $,an=2*Math.PI,bt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},rc=1e-6;class ib extends $g{constructor(e,t=null){super(e,t),this.state=bt.NONE,this.target=new $,this.cursor=new $,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:ji.ROTATE,MIDDLE:ji.DOLLY,RIGHT:ji.PAN},this.touches={ONE:qi.ROTATE,TWO:qi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new $,this._lastQuaternion=new Dn,this._lastTargetPosition=new $,this._quat=new Dn().setFromUnitVectors(e.up,new $(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new Ch,this._sphericalDelta=new Ch,this._scale=1,this._panOffset=new $,this._rotateStart=new Ye,this._rotateEnd=new Ye,this._rotateDelta=new Ye,this._panStart=new Ye,this._panEnd=new Ye,this._panDelta=new Ye,this._dollyStart=new Ye,this._dollyEnd=new Ye,this._dollyDelta=new Ye,this._dollyDirection=new $,this._mouse=new Ye,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=sb.bind(this),this._onPointerDown=rb.bind(this),this._onPointerUp=ab.bind(this),this._onContextMenu=db.bind(this),this._onMouseWheel=cb.bind(this),this._onKeyDown=ub.bind(this),this._onTouchStart=hb.bind(this),this._onTouchMove=fb.bind(this),this._onMouseDown=ob.bind(this),this._onMouseMove=lb.bind(this),this._interceptControlDown=pb.bind(this),this._interceptControlUp=mb.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(yf),this.update(),this.state=bt.NONE}update(e=null){const t=this.object.position;Ot.copy(t).sub(this.target),Ot.applyQuaternion(this._quat),this._spherical.setFromVector3(Ot),this.autoRotate&&this.state===bt.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=an:n>Math.PI&&(n-=an),r<-Math.PI?r+=an:r>Math.PI&&(r-=an),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(Ot.setFromSpherical(this._spherical),Ot.applyQuaternion(this._quatInverse),t.copy(this.target).add(Ot),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=Ot.length();a=this._clampDistance(o*this._scale);const l=o-a;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const o=new $(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new $(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),a=Ot.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(ya.origin.copy(this.object.position),ya.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(ya.direction))<nb?this.object.lookAt(this.target):(bf.setFromNormalAndCoplanarPoint(this.object.up,this.target),ya.intersectPlane(bf,this.target))))}else if(this.object.isOrthographicCamera){const a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>rc||8*(1-this._lastQuaternion.dot(this.object.quaternion))>rc||this._lastTargetPosition.distanceToSquared(this.target)>rc?(this.dispatchEvent(yf),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?an/60*this.autoRotateSpeed*e:an/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Ot.setFromMatrixColumn(t,0),Ot.multiplyScalar(-e),this._panOffset.add(Ot)}_panUp(e,t){this.screenSpacePanning===!0?Ot.setFromMatrixColumn(t,1):(Ot.setFromMatrixColumn(t,0),Ot.crossVectors(this.object.up,Ot)),Ot.multiplyScalar(e),this._panOffset.add(Ot)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;Ot.copy(r).sub(this.target);let s=Ot.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(s/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(an*this._rotateDelta.x/t.clientHeight),this._rotateUp(an*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(an*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-an*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(an*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-an*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(an*this._rotateDelta.x/t.clientHeight),this._rotateUp(an*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Ye,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function rb(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i)))}function sb(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function ab(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(xf),this.state=bt.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function ob(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case ji.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=bt.DOLLY;break;case ji.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=bt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=bt.ROTATE}break;case ji.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=bt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=bt.PAN}break;default:this.state=bt.NONE}this.state!==bt.NONE&&this.dispatchEvent(ic)}function lb(i){switch(this.state){case bt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case bt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case bt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function cb(i){this.enabled===!1||this.enableZoom===!1||this.state!==bt.NONE||(i.preventDefault(),this.dispatchEvent(ic),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(xf))}function ub(i){this.enabled!==!1&&this._handleKeyDown(i)}function hb(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case qi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=bt.TOUCH_ROTATE;break;case qi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=bt.TOUCH_PAN;break;default:this.state=bt.NONE}break;case 2:switch(this.touches.TWO){case qi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=bt.TOUCH_DOLLY_PAN;break;case qi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=bt.TOUCH_DOLLY_ROTATE;break;default:this.state=bt.NONE}break;default:this.state=bt.NONE}this.state!==bt.NONE&&this.dispatchEvent(ic)}function fb(i){switch(this._trackPointer(i),this.state){case bt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case bt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case bt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case bt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=bt.NONE}}function db(i){this.enabled!==!1&&i.preventDefault()}function pb(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function mb(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function gb(i,e){i.mode=e;const t=i.activeCam.position.clone(),n=i.target.clone();i.activeCam=e===gn.Ortho?i.orthoCam:i.perspCam,i.activeCam.position.copy(t),i.controls?.dispose(),i.controls=new ib(i.activeCam,i.canvas),i.controls.enableDamping=!0,i.controls.dampingFactor=.08,i.controls.target.copy(n),i.controls.enablePan=!0,Pr.applyLimitsToControls(i.controls,i.limits),i.controls.update(),i.unbindWheelRelay||(i.unbindWheelRelay=Pr.bindWheelPageScrollRelay(i.canvas,()=>i.controls))}function _b(i,e,t){const n=Math.max(1,e),r=Math.max(1,t),s=Math.min(typeof window<"u"&&window.devicePixelRatio||1,i.dprMax);i.renderer.setPixelRatio(s),i.renderer.setSize(n,r,!1);const a=n/r;i.perspCam.aspect=a,i.perspCam.updateProjectionMatrix();const o=1.2;i.orthoCam.left=-o*a,i.orthoCam.right=o*a,i.orthoCam.top=o,i.orthoCam.bottom=-o,i.orthoCam.updateProjectionMatrix()}const Sf={applyCameraMode:gb,resize:_b};class vb{constructor(e){this.controls=null,this.unbindWheelRelay=null,this.content=null,this.loader=new Ky,this.loadToken=0,this.blobUrl=null,this.bbox=new Ln,this.target=new $,this._ready=!1,this._loading=!1,this.lastError=null,this.raycaster=new Xg,this.pointerNdc=new Ye,this.highlighted=null,this.prevEmissive=new Ze,this.prevEmissiveIntensity=0,this.asTuneCtx=()=>this,this.asViewCtx=()=>this,this.asOpsCtx=()=>this;const t=Ux(e);this.scene=t.scene,this.renderer=t.renderer,this.canvas=t.canvas,this.perspCam=t.perspCam,this.orthoCam=t.orthoCam,this.activeCam=t.activeCam,this.root=t.root,this.lights=t.lights,this.dprMax=t.dprMax,this.mode=t.mode,this.fov=t.fov,this.fitEnabled=t.fitEnabled,this.limits=t.limits,this.applyCameraMode(this.mode),t.autoRotate&&this.setAutoRotate(!0),this.canvas,this.perspCam,this.orthoCam,this.root,this.content,this.lights,this.loader,this.loadToken,this.blobUrl,this.dprMax,this.fov,this.fitEnabled,this.limits,this.bbox,this.target,this.raycaster,this.pointerNdc,this.highlighted,this.prevEmissive,this.prevEmissiveIntensity,this.unbindWheelRelay}get ready(){return this._ready}get loading(){return this._loading}get error(){return this.lastError}get isLost(){return this.renderer.getContext()?.isContextLost?.()??!1}setDprMax(e){Fi.setDprMax(this.asTuneCtx(),e)}setExposure(e){Fi.setExposure(this.asTuneCtx(),e)}setFov(e){Fi.setFov(this.asTuneCtx(),e)}setFit(e){Fi.setFit(this.asTuneCtx(),e)}setAutoRotate(e){Fi.setAutoRotate(this.asTuneCtx(),e)}setOrbitLimits(e){Fi.setOrbitLimits(this.asTuneCtx(),e)}setOrbitSpherical(e,t,n){Fi.setOrbitSpherical(this.asTuneCtx(),e,t,n)}applyCameraMode(e){Sf.applyCameraMode(this.asViewCtx(),e)}resize(e,t){Sf.resize(this.asViewCtx(),e,t)}async load(e){return Oi.runLoad(this.asOpsCtx(),e)}fitToContent(){Oi.fitToContent(this.asOpsCtx())}render(){this.controls?.update(),this.renderer.render(this.scene,this.activeCam)}pick(e,t){return Oi.pick(this.asOpsCtx(),e,t)}setHoverAt(e,t){return Oi.setHoverAt(this.asOpsCtx(),e,t)}clearHighlight(){Oi.clearHighlight(this.asOpsCtx())}snapshot(e){return Oi.buildSnapshot(this.asOpsCtx(),e)}dispose(e=!1){Oi.dispose(this.asOpsCtx(),e)}}function yb(i){return i.renderRoot?.querySelector("canvas")??null}async function Mf(i){if(i.releasing||i.runtime)return;const e=yb(i);if(e)try{i.runtime=new vb({canvas:e,dprMax:i.dprMax,camera:It.cameraMode(i.camera),fov:i.fov,exposure:i.exposure,autoRotate:!1,fit:i.fit,minDistance:i.minDistance,maxDistance:i.maxDistance,minPolar:An.degToRad(i.minPolar),maxPolar:An.degToRad(i.maxPolar)}),An.applyOrbitLimits(i),Tf(i),await An.run(i)}catch(t){An.emitError(i,t)}}function Ef(i){i.loadToken++,Hn.stopLoop(i),i.ready=!1,i.releasing=!0,i.runtime?.dispose(!1),i.runtime=null,i.releasing=!1}function xb(i){if(!i.inView&&i.releaseOffscreen){Ef(i);return}if(i.inView&&(!i.runtime||i.runtime.isLost)){Mf(i);return}i.syncPlayback()}function Tf(i){if(!i.runtime)return;const e=i.getBoundingClientRect(),t=Math.max(e.width,i.clientWidth,1),n=Math.max(e.height,i.clientHeight,1);i.runtime.resize(t,n),i.ready&&i.runtime.render()}const xa={ensureRuntime:Mf,releaseRuntime:Ef,syncVisibility:xb,syncSize:Tf};function wf(i){const e=i.aspectRatio.trim();if(e){i.style.setProperty("--sonic-3d-ar",e.includes("/")?e:e.replace(":"," / "));return}i.style.removeProperty("--sonic-3d-ar")}function Af(i){i.formPublisher&&(i.formPublisher.offInternalMutation(i.onFormMutation),i.formPublisher=null)}function Rf(i){Af(i);const e=Ba.resolveFormProviderId(i,i.dataProvider);e&&(i.formPublisher=Gt.get(e),i.formPublisher.onInternalMutation(i.onFormMutation),i.onFormMutation())}function Cf(i){const e=Ba.resolveOutProviderId(i,i.outDataProvider,i.dataProvider);i.outPublisher=e?Gt.get(e):null}function bb(i){wf(i),i.resizeObserver=new ResizeObserver(()=>xa.syncSize(i)),i.resizeObserver.observe(i),i.intersectionObserver=new IntersectionObserver(e=>{i.inView=e.some(t=>t.isIntersecting),xa.syncVisibility(i)},{threshold:0}),i.intersectionObserver.observe(i),Rf(i),Cf(i),requestAnimationFrame(()=>{(i.inView||!i.releaseOffscreen)&&xa.ensureRuntime(i)})}const gi={applyAspectRatio:wf,unbindFormProvider:Af,bindFormProvider:Rf,bindOutPublisher:Cf,firstUpdated:bb},Pf=["frameUrl","snapshot"];function Df(i){if(!i.outPublisher)return!1;if(i.frameOut)return!0;for(const e of Pf)if(Oa(i.outPublisher,e))return!0;return!1}function Sb(i,e){return{url:URL.createObjectURL(e),blob:e,width:i.width,height:i.height,mime:e.type||Rc}}function Mb(i){return new Promise(e=>{if(typeof i.toBlob!="function"){e(null);return}const t=n=>{if(!n){e(null);return}e(Sb(i,n))};try{i.toBlob(t,Rc,pd)}catch{e(null)}})}function Eb(i,e){const t=i.outPublisher;if(t){try{t.frameUrl.set(e.url)}catch{}try{t.snapshot.set(e)}catch{}}}function Tb(i,e){if(i.snapshotBusy||!i.runtime||!Df(i))return;const t=Math.max(dd,Number.isFinite(i.snapshotInterval)&&i.snapshotInterval>0?i.snapshotInterval:Ac);if(e-i.lastSnapshotAt<t)return;i.lastSnapshotAt=e,i.snapshotBusy=!0;const n=++i.snapshotSeq,r=i.runtime.renderer.domElement;Mb(r).then(s=>{if(i.snapshotBusy=!1,!s||n!==i.snapshotSeq){s&&Ia([s.url]);return}Ia(i.frameUrls),i.frameUrls=[s.url],Eb(i,s)})}function wb(i){i.snapshotSeq++,i.snapshotBusy=!1,Ia(i.frameUrls),i.frameUrls=[]}const sc={wantsFrameCapture:Df,maybeCapture:Tb,revokeAll:wb,FRAME_KEYS:Pf};function Lf(i){if(i.outEventListeners>0||i.frameOut&&i.outPublisher)return!0;if(!i.outPublisher)return!1;for(const e of _d)if(Oa(i.outPublisher,e))return!0;return!1}function If(i,e){return!(!gd.includes(e)||!i.formPublisher||i.formPublisher!==i.outPublisher)}function Uf(i,e){return i.runtime?.snapshot({time:e,frame:i.frame,hovering:i.hovering?1:0,pointerX:i.pointerX,pointerY:i.pointerY,hit:i.lastHit})??{time:e,frame:i.frame,ready:0,loading:0,hovering:i.hovering?1:0,pointerX:i.pointerX,pointerY:i.pointerY,camX:0,camY:0,camZ:0,targetX:0,targetY:0,targetZ:0,fov:i.fov,zoom:1,distance:0,yaw:0,pitch:0}}function Ab(i,e){const t=i.outPublisher;if(t){for(const[n,r]of Object.entries(e))if(r!==void 0&&!If(i,n)&&!sc.FRAME_KEYS.includes(n))try{t[n].set(r)}catch{}}}function Rb(i,e,t){if(i.outPublisher||i.bindOutPublisher(),!Lf(i)||!i.runtime)return;const n=Math.max(fd,i.outInterval||wc);if(e-i.lastOutAt>=n){i.lastOutAt=e;const r=Uf(i,t);Ab(i,r);const s={detail:r,bubbles:!0,composed:!0};i.dispatchEvent(new CustomEvent("out",s))}sc.maybeCapture(i,e)}const Cb={hasOutConsumers:Lf,maybePublish:Rb,buildOutput:Uf,shouldSkipFormControlOutWrite:If};function Nf(i,e){const t=i.getBoundingClientRect(),n=Math.max(t.width,1),r=Math.max(t.height,1);return{x:(e.clientX-t.left)/n,y:(e.clientY-t.top)/r}}function Pb(i,e){const t=Nf(i,e);i.pointerX=t.x,i.pointerY=t.y,i.pick&&i.runtime?.ready&&i.runtime.setHoverAt(t.x,t.y)}function Db(i,e){const t=Nf(i,e);if(i.pointerX=t.x,i.pointerY=t.y,!i.pick||!i.runtime||e.button!==0)return;const n=i.runtime.pick(t.x,t.y);i.lastHit=n,n&&i.dispatchEvent(new CustomEvent("pick",{detail:n,bubbles:!0,composed:!0}))}function Lb(i){i.runtime?.ready&&(i.runtime.fitToContent(),i.runtime.render())}function Ib(i){i.hovering=!0,i.syncPlayback()}function Ub(i){i.hovering=!1,i.runtime?.clearHighlight(),i.syncPlayback()}const fs={onMove:Pb,onDown:Db,onDblClick:Lb,onEnter:Ib,onLeave:Ub};var Nb=Object.defineProperty,Ct=(i,e,t,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(e,t,r)||r);return r&&Nb(e,t,r),r};class Rt extends Fr{constructor(){super(...arguments),this.src="",this.asset=null,this.camera=gn.Orbit,this.fov=vs,this.exposure=Da,this.minDistance=Cc,this.maxDistance=Pc,this.minPolar=Dc,this.maxPolar=md,this.autoRotate=!1,this.fit=!0,this.pick=!1,this.play=!0,this.playOnHover=!1,this.releaseOffscreen=!0,this.dprMax=2,this.aspectRatio="",this.dataProvider="",this.outDataProvider="",this.outInterval=wc,this.snapshotInterval=Ac,this.frameOut=!1}}Ct([wt()],Rt.prototype,"src"),Ct([wt({attribute:!1})],Rt.prototype,"asset"),Ct([wt({reflect:!0})],Rt.prototype,"camera"),Ct([wt({type:Number})],Rt.prototype,"fov"),Ct([wt({type:Number})],Rt.prototype,"exposure"),Ct([wt({type:Number,attribute:"min-distance"})],Rt.prototype,"minDistance"),Ct([wt({type:Number,attribute:"max-distance"})],Rt.prototype,"maxDistance"),Ct([wt({type:Number,attribute:"min-polar"})],Rt.prototype,"minPolar"),Ct([wt({type:Number,attribute:"max-polar"})],Rt.prototype,"maxPolar"),Ct([wt({type:Boolean,attribute:"auto-rotate"})],Rt.prototype,"autoRotate"),Ct([wt({type:Boolean})],Rt.prototype,"fit"),Ct([wt({type:Boolean})],Rt.prototype,"pick"),Ct([wt({type:Boolean,reflect:!0})],Rt.prototype,"play"),Ct([wt({type:Boolean,attribute:"play-on-hover"})],Rt.prototype,"playOnHover"),Ct([wt({type:Boolean,attribute:"release-offscreen"})],Rt.prototype,"releaseOffscreen"),Ct([wt({type:Number,attribute:"dpr-max"})],Rt.prototype,"dprMax"),Ct([wt({type:String,attribute:"aspect-ratio"})],Rt.prototype,"aspectRatio"),Ct([wt({type:String})],Rt.prototype,"dataProvider"),Ct([wt({type:String,attribute:"out-data-provider"})],Rt.prototype,"outDataProvider"),Ct([wt({type:Number,attribute:"out-interval"})],Rt.prototype,"outInterval"),Ct([wt({type:Number,attribute:"snapshot-interval"})],Rt.prototype,"snapshotInterval"),Ct([wt({type:Boolean,attribute:"frame-out"})],Rt.prototype,"frameOut");const Ob=Bf`
|
|
3870
|
+
}`;class Sy{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new dh(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new ei({vertexShader:xy,fragmentShader:by,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Yt(new as(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class My extends Ri{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,u=null,f=null,d=null,_=null;const b=typeof XRWebGLBinding<"u",g=new Sy,m={},S=t.getContextAttributes();let y=null,M=null;const T=[],R=[],k=new Je;let B=null;const C=new nn;C.viewport=new dt;const D=new nn;D.viewport=new dt;const V=[C,D],K=new dg;let J=null,se=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ie){let ce=T[ie];return ce===void 0&&(ce=new cl,T[ie]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(ie){let ce=T[ie];return ce===void 0&&(ce=new cl,T[ie]=ce),ce.getGripSpace()},this.getHand=function(ie){let ce=T[ie];return ce===void 0&&(ce=new cl,T[ie]=ce),ce.getHandSpace()};function he(ie){const ce=R.indexOf(ie.inputSource);if(ce===-1)return;const z=T[ce];z!==void 0&&(z.update(ie.inputSource,ie.frame,c||a),z.dispatchEvent({type:ie.type,data:ie.inputSource}))}function Q(){r.removeEventListener("select",he),r.removeEventListener("selectstart",he),r.removeEventListener("selectend",he),r.removeEventListener("squeeze",he),r.removeEventListener("squeezestart",he),r.removeEventListener("squeezeend",he),r.removeEventListener("end",Q),r.removeEventListener("inputsourceschange",de);for(let ie=0;ie<T.length;ie++){const ce=R[ie];ce!==null&&(R[ie]=null,T[ie].disconnect(ce))}J=null,se=null,g.reset();for(const ie in m)delete m[ie];e.setRenderTarget(y),d=null,f=null,u=null,r=null,M=null,Be.stop(),n.isPresenting=!1,e.setPixelRatio(B),e.setSize(k.width,k.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ie){s=ie,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ie){o=ie,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(ie){c=ie},this.getBaseLayer=function(){return f!==null?f:d},this.getBinding=function(){return u===null&&b&&(u=new XRWebGLBinding(r,t)),u},this.getFrame=function(){return _},this.getSession=function(){return r},this.setSession=async function(ie){if(r=ie,r!==null){if(y=e.getRenderTarget(),r.addEventListener("select",he),r.addEventListener("selectstart",he),r.addEventListener("selectend",he),r.addEventListener("squeeze",he),r.addEventListener("squeezestart",he),r.addEventListener("squeezeend",he),r.addEventListener("end",Q),r.addEventListener("inputsourceschange",de),S.xrCompatible!==!0&&await t.makeXRCompatible(),B=e.getPixelRatio(),e.getSize(k),b&&"createProjectionLayer"in XRWebGLBinding.prototype){let z=null,q=null,W=null;S.depth&&(W=S.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,z=S.stencil?$r:Qi,q=S.stencil?Xr:ui);const le={colorFormat:t.RGBA8,depthFormat:W,scaleFactor:s};u=this.getBinding(),f=u.createProjectionLayer(le),r.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),M=new jn(f.textureWidth,f.textureHeight,{format:ln,type:pn,depthTexture:new bl(f.textureWidth,f.textureHeight,q,void 0,void 0,void 0,void 0,void 0,void 0,z),stencilBuffer:S.stencil,colorSpace:e.outputColorSpace,samples:S.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}else{const z={antialias:S.antialias,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(r,t,z),r.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),M=new jn(d.framebufferWidth,d.framebufferHeight,{format:ln,type:pn,colorSpace:e.outputColorSpace,stencilBuffer:S.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),Be.setContext(r),Be.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function de(ie){for(let ce=0;ce<ie.removed.length;ce++){const z=ie.removed[ce],q=R.indexOf(z);q>=0&&(R[q]=null,T[q].disconnect(z))}for(let ce=0;ce<ie.added.length;ce++){const z=ie.added[ce];let q=R.indexOf(z);if(q===-1){for(let le=0;le<T.length;le++)if(le>=R.length){R.push(z),q=le;break}else if(R[le]===null){R[le]=z,q=le;break}if(q===-1)break}const W=T[q];W&&W.connect(z)}}const ne=new $,ue=new $;function Te(ie,ce,z){ne.setFromMatrixPosition(ce.matrixWorld),ue.setFromMatrixPosition(z.matrixWorld);const q=ne.distanceTo(ue),W=ce.projectionMatrix.elements,le=z.projectionMatrix.elements,be=W[14]/(W[10]-1),U=W[14]/(W[10]+1),ee=(W[9]+1)/W[5],fe=(W[9]-1)/W[5],ye=(W[8]-1)/W[0],Se=(le[8]+1)/le[0],ze=be*ye,_e=be*Se,xe=q/(-ye+Se),qe=xe*-ye;if(ce.matrixWorld.decompose(ie.position,ie.quaternion,ie.scale),ie.translateX(qe),ie.translateZ(xe),ie.matrixWorld.compose(ie.position,ie.quaternion,ie.scale),ie.matrixWorldInverse.copy(ie.matrixWorld).invert(),W[10]===-1)ie.projectionMatrix.copy(ce.projectionMatrix),ie.projectionMatrixInverse.copy(ce.projectionMatrixInverse);else{const De=be+xe,N=U+xe,w=ze-qe,j=_e+(q-qe),re=ee*U/N*De,pe=fe*U/N*De;ie.projectionMatrix.makePerspective(w,j,re,pe,De,N),ie.projectionMatrixInverse.copy(ie.projectionMatrix).invert()}}function ke(ie,ce){ce===null?ie.matrixWorld.copy(ie.matrix):ie.matrixWorld.multiplyMatrices(ce.matrixWorld,ie.matrix),ie.matrixWorldInverse.copy(ie.matrixWorld).invert()}this.updateCamera=function(ie){if(r===null)return;let ce=ie.near,z=ie.far;g.texture!==null&&(g.depthNear>0&&(ce=g.depthNear),g.depthFar>0&&(z=g.depthFar)),K.near=D.near=C.near=ce,K.far=D.far=C.far=z,(J!==K.near||se!==K.far)&&(r.updateRenderState({depthNear:K.near,depthFar:K.far}),J=K.near,se=K.far),K.layers.mask=ie.layers.mask|6,C.layers.mask=K.layers.mask&3,D.layers.mask=K.layers.mask&5;const q=ie.parent,W=K.cameras;ke(K,q);for(let le=0;le<W.length;le++)ke(W[le],q);W.length===2?Te(K,C,D):K.projectionMatrix.copy(C.projectionMatrix),O(ie,K,q)};function O(ie,ce,z){z===null?ie.matrix.copy(ce.matrixWorld):(ie.matrix.copy(z.matrixWorld),ie.matrix.invert(),ie.matrix.multiply(ce.matrixWorld)),ie.matrix.decompose(ie.position,ie.quaternion,ie.scale),ie.updateMatrixWorld(!0),ie.projectionMatrix.copy(ce.projectionMatrix),ie.projectionMatrixInverse.copy(ce.projectionMatrixInverse),ie.isPerspectiveCamera&&(ie.fov=tr*2*Math.atan(1/ie.projectionMatrix.elements[5]),ie.zoom=1)}this.getCamera=function(){return K},this.getFoveation=function(){if(!(f===null&&d===null))return l},this.setFoveation=function(ie){l=ie,f!==null&&(f.fixedFoveation=ie),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=ie)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(K)},this.getCameraTexture=function(ie){return m[ie]};let H=null;function we(ie,ce){if(h=ce.getViewerPose(c||a),_=ce,h!==null){const z=h.views;d!==null&&(e.setRenderTargetFramebuffer(M,d.framebuffer),e.setRenderTarget(M));let q=!1;z.length!==K.cameras.length&&(K.cameras.length=0,q=!0);for(let U=0;U<z.length;U++){const ee=z[U];let fe=null;if(d!==null)fe=d.getViewport(ee);else{const Se=u.getViewSubImage(f,ee);fe=Se.viewport,U===0&&(e.setRenderTargetTextures(M,Se.colorTexture,Se.depthStencilTexture),e.setRenderTarget(M))}let ye=V[U];ye===void 0&&(ye=new nn,ye.layers.enable(U),ye.viewport=new dt,V[U]=ye),ye.matrix.fromArray(ee.transform.matrix),ye.matrix.decompose(ye.position,ye.quaternion,ye.scale),ye.projectionMatrix.fromArray(ee.projectionMatrix),ye.projectionMatrixInverse.copy(ye.projectionMatrix).invert(),ye.viewport.set(fe.x,fe.y,fe.width,fe.height),U===0&&(K.matrix.copy(ye.matrix),K.matrix.decompose(K.position,K.quaternion,K.scale)),q===!0&&K.cameras.push(ye)}const W=r.enabledFeatures;if(W&&W.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&b){u=n.getBinding();const U=u.getDepthInformation(z[0]);U&&U.isValid&&U.texture&&g.init(U,r.renderState)}if(W&&W.includes("camera-access")&&b){e.state.unbindTexture(),u=n.getBinding();for(let U=0;U<z.length;U++){const ee=z[U].camera;if(ee){let fe=m[ee];fe||(fe=new dh,m[ee]=fe);const ye=u.getCameraImage(ee);fe.sourceTexture=ye}}}}for(let z=0;z<T.length;z++){const q=R[z],W=T[z];q!==null&&W!==void 0&&W.update(q,ce,c||a)}H&&H(ie,ce),ce.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ce}),_=null}const Be=new wh;Be.setAnimationLoop(we),this.setAnimationLoop=function(ie){H=ie},this.dispose=function(){}}}const Oi=new On,Ey=new it;function Ty(i,e){function t(g,m){g.matrixAutoUpdate===!0&&g.updateMatrix(),m.value.copy(g.matrix)}function n(g,m){m.color.getRGB(g.fogColor.value,Gu(i)),m.isFog?(g.fogNear.value=m.near,g.fogFar.value=m.far):m.isFogExp2&&(g.fogDensity.value=m.density)}function r(g,m,S,y,M){m.isMeshBasicMaterial||m.isMeshLambertMaterial?s(g,m):m.isMeshToonMaterial?(s(g,m),u(g,m)):m.isMeshPhongMaterial?(s(g,m),h(g,m)):m.isMeshStandardMaterial?(s(g,m),f(g,m),m.isMeshPhysicalMaterial&&d(g,m,M)):m.isMeshMatcapMaterial?(s(g,m),_(g,m)):m.isMeshDepthMaterial?s(g,m):m.isMeshDistanceMaterial?(s(g,m),b(g,m)):m.isMeshNormalMaterial?s(g,m):m.isLineBasicMaterial?(a(g,m),m.isLineDashedMaterial&&o(g,m)):m.isPointsMaterial?l(g,m,S,y):m.isSpriteMaterial?c(g,m):m.isShadowMaterial?(g.color.value.copy(m.color),g.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function s(g,m){g.opacity.value=m.opacity,m.color&&g.diffuse.value.copy(m.color),m.emissive&&g.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.bumpMap&&(g.bumpMap.value=m.bumpMap,t(m.bumpMap,g.bumpMapTransform),g.bumpScale.value=m.bumpScale,m.side===on&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,t(m.normalMap,g.normalMapTransform),g.normalScale.value.copy(m.normalScale),m.side===on&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,t(m.displacementMap,g.displacementMapTransform),g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias),m.emissiveMap&&(g.emissiveMap.value=m.emissiveMap,t(m.emissiveMap,g.emissiveMapTransform)),m.specularMap&&(g.specularMap.value=m.specularMap,t(m.specularMap,g.specularMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest);const S=e.get(m),y=S.envMap,M=S.envMapRotation;y&&(g.envMap.value=y,Oi.copy(M),Oi.x*=-1,Oi.y*=-1,Oi.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Oi.y*=-1,Oi.z*=-1),g.envMapRotation.value.setFromMatrix4(Ey.makeRotationFromEuler(Oi)),g.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=m.reflectivity,g.ior.value=m.ior,g.refractionRatio.value=m.refractionRatio),m.lightMap&&(g.lightMap.value=m.lightMap,g.lightMapIntensity.value=m.lightMapIntensity,t(m.lightMap,g.lightMapTransform)),m.aoMap&&(g.aoMap.value=m.aoMap,g.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,g.aoMapTransform))}function a(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform))}function o(g,m){g.dashSize.value=m.dashSize,g.totalSize.value=m.dashSize+m.gapSize,g.scale.value=m.scale}function l(g,m,S,y){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.size.value=m.size*S,g.scale.value=y*.5,m.map&&(g.map.value=m.map,t(m.map,g.uvTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function c(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.rotation.value=m.rotation,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function h(g,m){g.specular.value.copy(m.specular),g.shininess.value=Math.max(m.shininess,1e-4)}function u(g,m){m.gradientMap&&(g.gradientMap.value=m.gradientMap)}function f(g,m){g.metalness.value=m.metalness,m.metalnessMap&&(g.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,g.metalnessMapTransform)),g.roughness.value=m.roughness,m.roughnessMap&&(g.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,g.roughnessMapTransform)),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)}function d(g,m,S){g.ior.value=m.ior,m.sheen>0&&(g.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),g.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(g.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,g.sheenColorMapTransform)),m.sheenRoughnessMap&&(g.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,g.sheenRoughnessMapTransform))),m.clearcoat>0&&(g.clearcoat.value=m.clearcoat,g.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(g.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,g.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(g.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===on&&g.clearcoatNormalScale.value.negate())),m.dispersion>0&&(g.dispersion.value=m.dispersion),m.iridescence>0&&(g.iridescence.value=m.iridescence,g.iridescenceIOR.value=m.iridescenceIOR,g.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(g.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,g.iridescenceMapTransform)),m.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),m.transmission>0&&(g.transmission.value=m.transmission,g.transmissionSamplerMap.value=S.texture,g.transmissionSamplerSize.value.set(S.width,S.height),m.transmissionMap&&(g.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,g.transmissionMapTransform)),g.thickness.value=m.thickness,m.thicknessMap&&(g.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=m.attenuationDistance,g.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(g.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(g.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=m.specularIntensity,g.specularColor.value.copy(m.specularColor),m.specularColorMap&&(g.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,g.specularColorMapTransform)),m.specularIntensityMap&&(g.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,g.specularIntensityMapTransform))}function _(g,m){m.matcap&&(g.matcap.value=m.matcap)}function b(g,m){const S=e.get(m).light;g.referencePosition.value.setFromMatrixPosition(S.matrixWorld),g.nearDistance.value=S.shadow.camera.near,g.farDistance.value=S.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function wy(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(S,y){const M=y.program;n.uniformBlockBinding(S,M)}function c(S,y){let M=r[S.id];M===void 0&&(_(S),M=h(S),r[S.id]=M,S.addEventListener("dispose",g));const T=y.program;n.updateUBOMapping(S,T);const R=e.render.frame;s[S.id]!==R&&(f(S),s[S.id]=R)}function h(S){const y=u();S.__bindingPointIndex=y;const M=i.createBuffer(),T=S.__size,R=S.usage;return i.bindBuffer(i.UNIFORM_BUFFER,M),i.bufferData(i.UNIFORM_BUFFER,T,R),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,y,M),M}function u(){for(let S=0;S<o;S++)if(a.indexOf(S)===-1)return a.push(S),S;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(S){const y=r[S.id],M=S.uniforms,T=S.__cache;i.bindBuffer(i.UNIFORM_BUFFER,y);for(let R=0,k=M.length;R<k;R++){const B=Array.isArray(M[R])?M[R]:[M[R]];for(let C=0,D=B.length;C<D;C++){const V=B[C];if(d(V,R,C,T)===!0){const K=V.__offset,J=Array.isArray(V.value)?V.value:[V.value];let se=0;for(let he=0;he<J.length;he++){const Q=J[he],de=b(Q);typeof Q=="number"||typeof Q=="boolean"?(V.__data[0]=Q,i.bufferSubData(i.UNIFORM_BUFFER,K+se,V.__data)):Q.isMatrix3?(V.__data[0]=Q.elements[0],V.__data[1]=Q.elements[1],V.__data[2]=Q.elements[2],V.__data[3]=0,V.__data[4]=Q.elements[3],V.__data[5]=Q.elements[4],V.__data[6]=Q.elements[5],V.__data[7]=0,V.__data[8]=Q.elements[6],V.__data[9]=Q.elements[7],V.__data[10]=Q.elements[8],V.__data[11]=0):(Q.toArray(V.__data,se),se+=de.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,K,V.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function d(S,y,M,T){const R=S.value,k=y+"_"+M;if(T[k]===void 0)return typeof R=="number"||typeof R=="boolean"?T[k]=R:T[k]=R.clone(),!0;{const B=T[k];if(typeof R=="number"||typeof R=="boolean"){if(B!==R)return T[k]=R,!0}else if(B.equals(R)===!1)return B.copy(R),!0}return!1}function _(S){const y=S.uniforms;let M=0;const T=16;for(let k=0,B=y.length;k<B;k++){const C=Array.isArray(y[k])?y[k]:[y[k]];for(let D=0,V=C.length;D<V;D++){const K=C[D],J=Array.isArray(K.value)?K.value:[K.value];for(let se=0,he=J.length;se<he;se++){const Q=J[se],de=b(Q),ne=M%T,ue=ne%de.boundary,Te=ne+ue;M+=ue,Te!==0&&T-Te<de.storage&&(M+=T-Te),K.__data=new Float32Array(de.storage/Float32Array.BYTES_PER_ELEMENT),K.__offset=M,M+=de.storage}}}const R=M%T;return R>0&&(M+=T-R),S.__size=M,S.__cache={},this}function b(S){const y={boundary:0,storage:0};return typeof S=="number"||typeof S=="boolean"?(y.boundary=4,y.storage=4):S.isVector2?(y.boundary=8,y.storage=8):S.isVector3||S.isColor?(y.boundary=16,y.storage=12):S.isVector4?(y.boundary=16,y.storage=16):S.isMatrix3?(y.boundary=48,y.storage=48):S.isMatrix4?(y.boundary=64,y.storage=64):S.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",S),y}function g(S){const y=S.target;y.removeEventListener("dispose",g);const M=a.indexOf(y.__bindingPointIndex);a.splice(M,1),i.deleteBuffer(r[y.id]),delete r[y.id],delete s[y.id]}function m(){for(const S in r)i.deleteBuffer(r[S]);a=[],r={},s={}}return{bind:l,update:c,dispose:m}}class Ay{constructor(e={}){const{canvas:t=sm(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:f=!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=a;const _=new Uint32Array(4),b=new Int32Array(4);let g=null,m=null;const S=[],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.toneMapping=li,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const M=this;let T=!1;this._outputColorSpace=Ht;let R=0,k=0,B=null,C=-1,D=null;const V=new dt,K=new dt;let J=null;const se=new et(0);let he=0,Q=t.width,de=t.height,ne=1,ue=null,Te=null;const ke=new dt(0,0,Q,de),O=new dt(0,0,Q,de);let H=!1;const we=new _l;let Be=!1,ie=!1;const ce=new it,z=new $,q=new dt,W={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let le=!1;function be(){return B===null?ne:1}let U=n;function ee(P,G){return t.getContext(P,G)}try{const P={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Va}`),t.addEventListener("webglcontextlost",p,!1),t.addEventListener("webglcontextrestored",v,!1),t.addEventListener("webglcontextcreationerror",E,!1),U===null){const G="webgl2";if(U=ee(G,P),U===null)throw ee(G)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(P){throw console.error("THREE.WebGLRenderer: "+P.message),P}let fe,ye,Se,ze,_e,xe,qe,De,N,w,j,re,pe,ae,Ve,Ae,oe,We,Me,Re,Ke,Oe,Ce,A;function x(){fe=new Fv(U),fe.init(),Oe=new yy(U,fe),ye=new Pv(U,fe,e,Oe),Se=new _y(U,fe),ye.reversedDepthBuffer&&f&&Se.buffers.depth.setReversed(!0),ze=new zv(U),_e=new ry,xe=new vy(U,fe,Se,_e,ye,Oe,ze),qe=new Lv(M),De=new Ov(M),N=new wg(U),Ce=new Rv(U,N),w=new kv(U,N,ze,Ce),j=new Vv(U,w,N,ze),Me=new Hv(U,ye,xe),Ae=new Dv(_e),re=new iy(M,qe,De,fe,ye,Ce,Ae),pe=new Ty(M,_e),ae=new ay,Ve=new fy(fe),We=new Av(M,qe,De,Se,j,d,l),oe=new my(M,j,ye),A=new wy(U,ze,ye,Se),Re=new Cv(U,fe,ze),Ke=new Bv(U,fe,ze),ze.programs=re.programs,M.capabilities=ye,M.extensions=fe,M.properties=_e,M.renderLists=ae,M.shadowMap=oe,M.state=Se,M.info=ze}x();const L=new My(M,U);this.xr=L,this.getContext=function(){return U},this.getContextAttributes=function(){return U.getContextAttributes()},this.forceContextLoss=function(){const P=fe.get("WEBGL_lose_context");P&&P.loseContext()},this.forceContextRestore=function(){const P=fe.get("WEBGL_lose_context");P&&P.restoreContext()},this.getPixelRatio=function(){return ne},this.setPixelRatio=function(P){P!==void 0&&(ne=P,this.setSize(Q,de,!1))},this.getSize=function(P){return P.set(Q,de)},this.setSize=function(P,G,Z=!0){if(L.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}Q=P,de=G,t.width=Math.floor(P*ne),t.height=Math.floor(G*ne),Z===!0&&(t.style.width=P+"px",t.style.height=G+"px"),this.setViewport(0,0,P,G)},this.getDrawingBufferSize=function(P){return P.set(Q*ne,de*ne).floor()},this.setDrawingBufferSize=function(P,G,Z){Q=P,de=G,ne=Z,t.width=Math.floor(P*Z),t.height=Math.floor(G*Z),this.setViewport(0,0,P,G)},this.getCurrentViewport=function(P){return P.copy(V)},this.getViewport=function(P){return P.copy(ke)},this.setViewport=function(P,G,Z,te){P.isVector4?ke.set(P.x,P.y,P.z,P.w):ke.set(P,G,Z,te),Se.viewport(V.copy(ke).multiplyScalar(ne).round())},this.getScissor=function(P){return P.copy(O)},this.setScissor=function(P,G,Z,te){P.isVector4?O.set(P.x,P.y,P.z,P.w):O.set(P,G,Z,te),Se.scissor(K.copy(O).multiplyScalar(ne).round())},this.getScissorTest=function(){return H},this.setScissorTest=function(P){Se.setScissorTest(H=P)},this.setOpaqueSort=function(P){ue=P},this.setTransparentSort=function(P){Te=P},this.getClearColor=function(P){return P.copy(We.getClearColor())},this.setClearColor=function(){We.setClearColor(...arguments)},this.getClearAlpha=function(){return We.getClearAlpha()},this.setClearAlpha=function(){We.setClearAlpha(...arguments)},this.clear=function(P=!0,G=!0,Z=!0){let te=0;if(P){let Y=!1;if(B!==null){const Ee=B.texture.format;Y=Ee===ao||Ee===so||Ee===ro}if(Y){const Ee=B.texture.type,Le=Ee===pn||Ee===ui||Ee===Gr||Ee===Xr||Ee===to||Ee===no,Fe=We.getClearColor(),ge=We.getClearAlpha(),Ue=Fe.r,He=Fe.g,Pe=Fe.b;Le?(_[0]=Ue,_[1]=He,_[2]=Pe,_[3]=ge,U.clearBufferuiv(U.COLOR,0,_)):(b[0]=Ue,b[1]=He,b[2]=Pe,b[3]=ge,U.clearBufferiv(U.COLOR,0,b))}else te|=U.COLOR_BUFFER_BIT}G&&(te|=U.DEPTH_BUFFER_BIT),Z&&(te|=U.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),U.clear(te)},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",p,!1),t.removeEventListener("webglcontextrestored",v,!1),t.removeEventListener("webglcontextcreationerror",E,!1),We.dispose(),ae.dispose(),Ve.dispose(),_e.dispose(),qe.dispose(),De.dispose(),j.dispose(),Ce.dispose(),A.dispose(),re.dispose(),L.dispose(),L.removeEventListener("sessionstart",Ne),L.removeEventListener("sessionend",mt),ut.stop()};function p(P){P.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function v(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;const P=ze.autoReset,G=oe.enabled,Z=oe.autoUpdate,te=oe.needsUpdate,Y=oe.type;x(),ze.autoReset=P,oe.enabled=G,oe.autoUpdate=Z,oe.needsUpdate=te,oe.type=Y}function E(P){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",P.statusMessage)}function I(P){const G=P.target;G.removeEventListener("dispose",I),F(G)}function F(P){X(P),_e.remove(P)}function X(P){const G=_e.get(P).programs;G!==void 0&&(G.forEach(function(Z){re.releaseProgram(Z)}),P.isShaderMaterial&&re.releaseShaderCache(P))}this.renderBufferDirect=function(P,G,Z,te,Y,Ee){G===null&&(G=W);const Le=Y.isMesh&&Y.matrixWorld.determinant()<0,Fe=zi(P,G,Z,te,Y);Se.setMaterial(te,Le);let ge=Z.index,Ue=1;if(te.wireframe===!0){if(ge=w.getWireframeAttribute(Z),ge===void 0)return;Ue=2}const He=Z.drawRange,Pe=Z.attributes.position;let Ze=He.start*Ue,lt=(He.start+He.count)*Ue;Ee!==null&&(Ze=Math.max(Ze,Ee.start*Ue),lt=Math.min(lt,(Ee.start+Ee.count)*Ue)),ge!==null?(Ze=Math.max(Ze,0),lt=Math.min(lt,ge.count)):Pe!=null&&(Ze=Math.max(Ze,0),lt=Math.min(lt,Pe.count));const ct=lt-Ze;if(ct<0||ct===1/0)return;Ce.setup(Y,te,Fe,Z,ge);let gt,rt=Re;if(ge!==null&&(gt=N.get(ge),rt=Ke,rt.setIndex(gt)),Y.isMesh)te.wireframe===!0?(Se.setLineWidth(te.wireframeLinewidth*be()),rt.setMode(U.LINES)):rt.setMode(U.TRIANGLES);else if(Y.isLine){let Ge=te.linewidth;Ge===void 0&&(Ge=1),Se.setLineWidth(Ge*be()),Y.isLineSegments?rt.setMode(U.LINES):Y.isLineLoop?rt.setMode(U.LINE_LOOP):rt.setMode(U.LINE_STRIP)}else Y.isPoints?rt.setMode(U.POINTS):Y.isSprite&&rt.setMode(U.TRIANGLES);if(Y.isBatchedMesh)if(Y._multiDrawInstances!==null)Jr("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),rt.renderMultiDrawInstances(Y._multiDrawStarts,Y._multiDrawCounts,Y._multiDrawCount,Y._multiDrawInstances);else if(fe.get("WEBGL_multi_draw"))rt.renderMultiDraw(Y._multiDrawStarts,Y._multiDrawCounts,Y._multiDrawCount);else{const Ge=Y._multiDrawStarts,tt=Y._multiDrawCounts,Qe=Y._multiDrawCount,Kt=ge?N.get(ge).bytesPerElement:1,Rt=_e.get(te).currentProgram.getUniforms();for(let Gt=0;Gt<Qe;Gt++)Rt.setValue(U,"_gl_DrawID",Gt),rt.render(Ge[Gt]/Kt,tt[Gt])}else if(Y.isInstancedMesh)rt.renderInstances(Ze,ct,Y.count);else if(Z.isInstancedBufferGeometry){const Ge=Z._maxInstanceCount!==void 0?Z._maxInstanceCount:1/0,tt=Math.min(Z.instanceCount,Ge);rt.renderInstances(Ze,ct,tt)}else rt.render(Ze,ct)};function me(P,G,Z){P.transparent===!0&&P.side===yn&&P.forceSinglePass===!1?(P.side=on,P.needsUpdate=!0,Lt(P,G,Z),P.side=Xn,P.needsUpdate=!0,Lt(P,G,Z),P.side=yn):Lt(P,G,Z)}this.compile=function(P,G,Z=null){Z===null&&(Z=P),m=Ve.get(Z),m.init(G),y.push(m),Z.traverseVisible(function(Y){Y.isLight&&Y.layers.test(G.layers)&&(m.pushLight(Y),Y.castShadow&&m.pushShadow(Y))}),P!==Z&&P.traverseVisible(function(Y){Y.isLight&&Y.layers.test(G.layers)&&(m.pushLight(Y),Y.castShadow&&m.pushShadow(Y))}),m.setupLights();const te=new Set;return P.traverse(function(Y){if(!(Y.isMesh||Y.isPoints||Y.isLine||Y.isSprite))return;const Ee=Y.material;if(Ee)if(Array.isArray(Ee))for(let Le=0;Le<Ee.length;Le++){const Fe=Ee[Le];me(Fe,Z,Y),te.add(Fe)}else me(Ee,Z,Y),te.add(Ee)}),m=y.pop(),te},this.compileAsync=function(P,G,Z=null){const te=this.compile(P,G,Z);return new Promise(Y=>{function Ee(){if(te.forEach(function(Le){_e.get(Le).currentProgram.isReady()&&te.delete(Le)}),te.size===0){Y(P);return}setTimeout(Ee,10)}fe.get("KHR_parallel_shader_compile")!==null?Ee():setTimeout(Ee,10)})};let ve=null;function Ye(P){ve&&ve(P)}function Ne(){ut.stop()}function mt(){ut.start()}const ut=new wh;ut.setAnimationLoop(Ye),typeof self<"u"&&ut.setContext(self),this.setAnimationLoop=function(P){ve=P,L.setAnimationLoop(P),P===null?ut.stop():ut.start()},L.addEventListener("sessionstart",Ne),L.addEventListener("sessionend",mt),this.render=function(P,G){if(G!==void 0&&G.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;if(P.matrixWorldAutoUpdate===!0&&P.updateMatrixWorld(),G.parent===null&&G.matrixWorldAutoUpdate===!0&&G.updateMatrixWorld(),L.enabled===!0&&L.isPresenting===!0&&(L.cameraAutoUpdate===!0&&L.updateCamera(G),G=L.getCamera()),P.isScene===!0&&P.onBeforeRender(M,P,G,B),m=Ve.get(P,y.length),m.init(G),y.push(m),ce.multiplyMatrices(G.projectionMatrix,G.matrixWorldInverse),we.setFromProjectionMatrix(ce,Ln,G.reversedDepth),ie=this.localClippingEnabled,Be=Ae.init(this.clippingPlanes,ie),g=ae.get(P,S.length),g.init(),S.push(g),L.enabled===!0&&L.isPresenting===!0){const Ee=M.xr.getDepthSensingMesh();Ee!==null&&yt(Ee,G,-1/0,M.sortObjects)}yt(P,G,0,M.sortObjects),g.finish(),M.sortObjects===!0&&g.sort(ue,Te),le=L.enabled===!1||L.isPresenting===!1||L.hasDepthSensing()===!1,le&&We.addToRenderList(g,P),this.info.render.frame++,Be===!0&&Ae.beginShadows();const Z=m.state.shadowsArray;oe.render(Z,P,G),Be===!0&&Ae.endShadows(),this.info.autoReset===!0&&this.info.reset();const te=g.opaque,Y=g.transmissive;if(m.setupLights(),G.isArrayCamera){const Ee=G.cameras;if(Y.length>0)for(let Le=0,Fe=Ee.length;Le<Fe;Le++){const ge=Ee[Le];ft(te,Y,P,ge)}le&&We.render(P);for(let Le=0,Fe=Ee.length;Le<Fe;Le++){const ge=Ee[Le];wt(g,P,ge,ge.viewport)}}else Y.length>0&&ft(te,Y,P,G),le&&We.render(P),wt(g,P,G);B!==null&&k===0&&(xe.updateMultisampleRenderTarget(B),xe.updateRenderTargetMipmap(B)),P.isScene===!0&&P.onAfterRender(M,P,G),Ce.resetDefaultState(),C=-1,D=null,y.pop(),y.length>0?(m=y[y.length-1],Be===!0&&Ae.setGlobalState(M.clippingPlanes,m.state.camera)):m=null,S.pop(),S.length>0?g=S[S.length-1]:g=null};function yt(P,G,Z,te){if(P.visible===!1)return;if(P.layers.test(G.layers)){if(P.isGroup)Z=P.renderOrder;else if(P.isLOD)P.autoUpdate===!0&&P.update(G);else if(P.isLight)m.pushLight(P),P.castShadow&&m.pushShadow(P);else if(P.isSprite){if(!P.frustumCulled||we.intersectsSprite(P)){te&&q.setFromMatrixPosition(P.matrixWorld).applyMatrix4(ce);const Le=j.update(P),Fe=P.material;Fe.visible&&g.push(P,Le,Fe,Z,q.z,null)}}else if((P.isMesh||P.isLine||P.isPoints)&&(!P.frustumCulled||we.intersectsObject(P))){const Le=j.update(P),Fe=P.material;if(te&&(P.boundingSphere!==void 0?(P.boundingSphere===null&&P.computeBoundingSphere(),q.copy(P.boundingSphere.center)):(Le.boundingSphere===null&&Le.computeBoundingSphere(),q.copy(Le.boundingSphere.center)),q.applyMatrix4(P.matrixWorld).applyMatrix4(ce)),Array.isArray(Fe)){const ge=Le.groups;for(let Ue=0,He=ge.length;Ue<He;Ue++){const Pe=ge[Ue],Ze=Fe[Pe.materialIndex];Ze&&Ze.visible&&g.push(P,Le,Ze,Z,q.z,Pe)}}else Fe.visible&&g.push(P,Le,Fe,Z,q.z,null)}}const Ee=P.children;for(let Le=0,Fe=Ee.length;Le<Fe;Le++)yt(Ee[Le],G,Z,te)}function wt(P,G,Z,te){const Y=P.opaque,Ee=P.transmissive,Le=P.transparent;m.setupLightsView(Z),Be===!0&&Ae.setGlobalState(M.clippingPlanes,Z),te&&Se.viewport(V.copy(te)),Y.length>0&&Tt(Y,G,Z),Ee.length>0&&Tt(Ee,G,Z),Le.length>0&&Tt(Le,G,Z),Se.buffers.depth.setTest(!0),Se.buffers.depth.setMask(!0),Se.buffers.color.setMask(!0),Se.setPolygonOffset(!1)}function ft(P,G,Z,te){if((Z.isScene===!0?Z.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[te.id]===void 0&&(m.state.transmissionRenderTarget[te.id]=new jn(1,1,{generateMipmaps:!0,type:fe.has("EXT_color_buffer_half_float")||fe.has("EXT_color_buffer_float")?Wr:pn,minFilter:$n,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ht.workingColorSpace}));const Ee=m.state.transmissionRenderTarget[te.id],Le=te.viewport||V;Ee.setSize(Le.z*M.transmissionResolutionScale,Le.w*M.transmissionResolutionScale);const Fe=M.getRenderTarget(),ge=M.getActiveCubeFace(),Ue=M.getActiveMipmapLevel();M.setRenderTarget(Ee),M.getClearColor(se),he=M.getClearAlpha(),he<1&&M.setClearColor(16777215,.5),M.clear(),le&&We.render(Z);const He=M.toneMapping;M.toneMapping=li;const Pe=te.viewport;if(te.viewport!==void 0&&(te.viewport=void 0),m.setupLightsView(te),Be===!0&&Ae.setGlobalState(M.clippingPlanes,te),Tt(P,Z,te),xe.updateMultisampleRenderTarget(Ee),xe.updateRenderTargetMipmap(Ee),fe.has("WEBGL_multisampled_render_to_texture")===!1){let Ze=!1;for(let lt=0,ct=G.length;lt<ct;lt++){const gt=G[lt],rt=gt.object,Ge=gt.geometry,tt=gt.material,Qe=gt.group;if(tt.side===yn&&rt.layers.test(te.layers)){const Kt=tt.side;tt.side=on,tt.needsUpdate=!0,sn(rt,Z,te,Ge,tt,Qe),tt.side=Kt,tt.needsUpdate=!0,Ze=!0}}Ze===!0&&(xe.updateMultisampleRenderTarget(Ee),xe.updateRenderTargetMipmap(Ee))}M.setRenderTarget(Fe,ge,Ue),M.setClearColor(se,he),Pe!==void 0&&(te.viewport=Pe),M.toneMapping=He}function Tt(P,G,Z){const te=G.isScene===!0?G.overrideMaterial:null;for(let Y=0,Ee=P.length;Y<Ee;Y++){const Le=P[Y],Fe=Le.object,ge=Le.geometry,Ue=Le.group;let He=Le.material;He.allowOverride===!0&&te!==null&&(He=te),Fe.layers.test(Z.layers)&&sn(Fe,G,Z,ge,He,Ue)}}function sn(P,G,Z,te,Y,Ee){P.onBeforeRender(M,G,Z,te,Y,Ee),P.modelViewMatrix.multiplyMatrices(Z.matrixWorldInverse,P.matrixWorld),P.normalMatrix.getNormalMatrix(P.modelViewMatrix),Y.onBeforeRender(M,G,Z,te,P,Ee),Y.transparent===!0&&Y.side===yn&&Y.forceSinglePass===!1?(Y.side=on,Y.needsUpdate=!0,M.renderBufferDirect(Z,G,te,Y,P,Ee),Y.side=Xn,Y.needsUpdate=!0,M.renderBufferDirect(Z,G,te,Y,P,Ee),Y.side=yn):M.renderBufferDirect(Z,G,te,Y,P,Ee),P.onAfterRender(M,G,Z,te,Y,Ee)}function Lt(P,G,Z){G.isScene!==!0&&(G=W);const te=_e.get(P),Y=m.state.lights,Ee=m.state.shadowsArray,Le=Y.state.version,Fe=re.getParameters(P,Y.state,Ee,G,Z),ge=re.getProgramCacheKey(Fe);let Ue=te.programs;te.environment=P.isMeshStandardMaterial?G.environment:null,te.fog=G.fog,te.envMap=(P.isMeshStandardMaterial?De:qe).get(P.envMap||te.environment),te.envMapRotation=te.environment!==null&&P.envMap===null?G.environmentRotation:P.envMapRotation,Ue===void 0&&(P.addEventListener("dispose",I),Ue=new Map,te.programs=Ue);let He=Ue.get(ge);if(He!==void 0){if(te.currentProgram===He&&te.lightsStateVersion===Le)return At(P,Fe),He}else Fe.uniforms=re.getUniforms(P),P.onBeforeCompile(Fe,M),He=re.acquireProgram(Fe,ge),Ue.set(ge,He),te.uniforms=Fe.uniforms;const Pe=te.uniforms;return(!P.isShaderMaterial&&!P.isRawShaderMaterial||P.clipping===!0)&&(Pe.clippingPlanes=Ae.uniform),At(P,Fe),te.needsLights=Mi(P),te.lightsStateVersion=Le,te.needsLights&&(Pe.ambientLightColor.value=Y.state.ambient,Pe.lightProbe.value=Y.state.probe,Pe.directionalLights.value=Y.state.directional,Pe.directionalLightShadows.value=Y.state.directionalShadow,Pe.spotLights.value=Y.state.spot,Pe.spotLightShadows.value=Y.state.spotShadow,Pe.rectAreaLights.value=Y.state.rectArea,Pe.ltc_1.value=Y.state.rectAreaLTC1,Pe.ltc_2.value=Y.state.rectAreaLTC2,Pe.pointLights.value=Y.state.point,Pe.pointLightShadows.value=Y.state.pointShadow,Pe.hemisphereLights.value=Y.state.hemi,Pe.directionalShadowMap.value=Y.state.directionalShadowMap,Pe.directionalShadowMatrix.value=Y.state.directionalShadowMatrix,Pe.spotShadowMap.value=Y.state.spotShadowMap,Pe.spotLightMatrix.value=Y.state.spotLightMatrix,Pe.spotLightMap.value=Y.state.spotLightMap,Pe.pointShadowMap.value=Y.state.pointShadowMap,Pe.pointShadowMatrix.value=Y.state.pointShadowMatrix),te.currentProgram=He,te.uniformsList=null,He}function dn(P){if(P.uniformsList===null){const G=P.currentProgram.getUniforms();P.uniformsList=ua.seqWithValue(G.seq,P.uniforms)}return P.uniformsList}function At(P,G){const Z=_e.get(P);Z.outputColorSpace=G.outputColorSpace,Z.batching=G.batching,Z.batchingColor=G.batchingColor,Z.instancing=G.instancing,Z.instancingColor=G.instancingColor,Z.instancingMorph=G.instancingMorph,Z.skinning=G.skinning,Z.morphTargets=G.morphTargets,Z.morphNormals=G.morphNormals,Z.morphColors=G.morphColors,Z.morphTargetsCount=G.morphTargetsCount,Z.numClippingPlanes=G.numClippingPlanes,Z.numIntersection=G.numClipIntersection,Z.vertexAlphas=G.vertexAlphas,Z.vertexTangents=G.vertexTangents,Z.toneMapping=G.toneMapping}function zi(P,G,Z,te,Y){G.isScene!==!0&&(G=W),xe.resetTextureUnits();const Ee=G.fog,Le=te.isMeshStandardMaterial?G.environment:null,Fe=B===null?M.outputColorSpace:B.isXRRenderTarget===!0?B.texture.colorSpace:Qt,ge=(te.isMeshStandardMaterial?De:qe).get(te.envMap||Le),Ue=te.vertexColors===!0&&!!Z.attributes.color&&Z.attributes.color.itemSize===4,He=!!Z.attributes.tangent&&(!!te.normalMap||te.anisotropy>0),Pe=!!Z.morphAttributes.position,Ze=!!Z.morphAttributes.normal,lt=!!Z.morphAttributes.color;let ct=li;te.toneMapped&&(B===null||B.isXRRenderTarget===!0)&&(ct=M.toneMapping);const gt=Z.morphAttributes.position||Z.morphAttributes.normal||Z.morphAttributes.color,rt=gt!==void 0?gt.length:0,Ge=_e.get(te),tt=m.state.lights;if(Be===!0&&(ie===!0||P!==D)){const an=P===D&&te.id===C;Ae.setState(te,P,an)}let Qe=!1;te.version===Ge.__version?(Ge.needsLights&&Ge.lightsStateVersion!==tt.state.version||Ge.outputColorSpace!==Fe||Y.isBatchedMesh&&Ge.batching===!1||!Y.isBatchedMesh&&Ge.batching===!0||Y.isBatchedMesh&&Ge.batchingColor===!0&&Y.colorTexture===null||Y.isBatchedMesh&&Ge.batchingColor===!1&&Y.colorTexture!==null||Y.isInstancedMesh&&Ge.instancing===!1||!Y.isInstancedMesh&&Ge.instancing===!0||Y.isSkinnedMesh&&Ge.skinning===!1||!Y.isSkinnedMesh&&Ge.skinning===!0||Y.isInstancedMesh&&Ge.instancingColor===!0&&Y.instanceColor===null||Y.isInstancedMesh&&Ge.instancingColor===!1&&Y.instanceColor!==null||Y.isInstancedMesh&&Ge.instancingMorph===!0&&Y.morphTexture===null||Y.isInstancedMesh&&Ge.instancingMorph===!1&&Y.morphTexture!==null||Ge.envMap!==ge||te.fog===!0&&Ge.fog!==Ee||Ge.numClippingPlanes!==void 0&&(Ge.numClippingPlanes!==Ae.numPlanes||Ge.numIntersection!==Ae.numIntersection)||Ge.vertexAlphas!==Ue||Ge.vertexTangents!==He||Ge.morphTargets!==Pe||Ge.morphNormals!==Ze||Ge.morphColors!==lt||Ge.toneMapping!==ct||Ge.morphTargetsCount!==rt)&&(Qe=!0):(Qe=!0,Ge.__version=te.version);let Kt=Ge.currentProgram;Qe===!0&&(Kt=Lt(te,G,Y));let Rt=!1,Gt=!1,Pn=!1;const _t=Kt.getUniforms(),$t=Ge.uniforms;if(Se.useProgram(Kt.program)&&(Rt=!0,Gt=!0,Pn=!0),te.id!==C&&(C=te.id,Gt=!0),Rt||D!==P){Se.buffers.depth.getReversed()&&P.reversedDepth!==!0&&(P._reversedDepth=!0,P.updateProjectionMatrix()),_t.setValue(U,"projectionMatrix",P.projectionMatrix),_t.setValue(U,"viewMatrix",P.matrixWorldInverse);const un=_t.map.cameraPosition;un!==void 0&&un.setValue(U,z.setFromMatrixPosition(P.matrixWorld)),ye.logarithmicDepthBuffer&&_t.setValue(U,"logDepthBufFC",2/(Math.log(P.far+1)/Math.LN2)),(te.isMeshPhongMaterial||te.isMeshToonMaterial||te.isMeshLambertMaterial||te.isMeshBasicMaterial||te.isMeshStandardMaterial||te.isShaderMaterial)&&_t.setValue(U,"isOrthographic",P.isOrthographicCamera===!0),D!==P&&(D=P,Gt=!0,Pn=!0)}if(Y.isSkinnedMesh){_t.setOptional(U,Y,"bindMatrix"),_t.setOptional(U,Y,"bindMatrixInverse");const an=Y.skeleton;an&&(an.boneTexture===null&&an.computeBoneTexture(),_t.setValue(U,"boneTexture",an.boneTexture,xe))}Y.isBatchedMesh&&(_t.setOptional(U,Y,"batchingTexture"),_t.setValue(U,"batchingTexture",Y._matricesTexture,xe),_t.setOptional(U,Y,"batchingIdTexture"),_t.setValue(U,"batchingIdTexture",Y._indirectTexture,xe),_t.setOptional(U,Y,"batchingColorTexture"),Y._colorsTexture!==null&&_t.setValue(U,"batchingColorTexture",Y._colorsTexture,xe));const Bt=Z.morphAttributes;if((Bt.position!==void 0||Bt.normal!==void 0||Bt.color!==void 0)&&Me.update(Y,Z,Kt),(Gt||Ge.receiveShadow!==Y.receiveShadow)&&(Ge.receiveShadow=Y.receiveShadow,_t.setValue(U,"receiveShadow",Y.receiveShadow)),te.isMeshGouraudMaterial&&te.envMap!==null&&($t.envMap.value=ge,$t.flipEnvMap.value=ge.isCubeTexture&&ge.isRenderTargetTexture===!1?-1:1),te.isMeshStandardMaterial&&te.envMap===null&&G.environment!==null&&($t.envMapIntensity.value=G.environmentIntensity),Gt&&(_t.setValue(U,"toneMappingExposure",M.toneMappingExposure),Ge.needsLights&&Vn($t,Pn),Ee&&te.fog===!0&&pe.refreshFogUniforms($t,Ee),pe.refreshMaterialUniforms($t,te,ne,de,m.state.transmissionRenderTarget[P.id]),ua.upload(U,dn(Ge),$t,xe)),te.isShaderMaterial&&te.uniformsNeedUpdate===!0&&(ua.upload(U,dn(Ge),$t,xe),te.uniformsNeedUpdate=!1),te.isSpriteMaterial&&_t.setValue(U,"center",Y.center),_t.setValue(U,"modelViewMatrix",Y.modelViewMatrix),_t.setValue(U,"normalMatrix",Y.normalMatrix),_t.setValue(U,"modelMatrix",Y.matrixWorld),te.isShaderMaterial||te.isRawShaderMaterial){const an=te.uniformsGroups;for(let un=0,xc=an.length;un<xc;un++){const Hi=an[un];A.update(Hi,Kt),A.bind(Hi,Kt)}}return Kt}function Vn(P,G){P.ambientLightColor.needsUpdate=G,P.lightProbe.needsUpdate=G,P.directionalLights.needsUpdate=G,P.directionalLightShadows.needsUpdate=G,P.pointLights.needsUpdate=G,P.pointLightShadows.needsUpdate=G,P.spotLights.needsUpdate=G,P.spotLightShadows.needsUpdate=G,P.rectAreaLights.needsUpdate=G,P.hemisphereLights.needsUpdate=G}function Mi(P){return P.isMeshLambertMaterial||P.isMeshToonMaterial||P.isMeshPhongMaterial||P.isMeshStandardMaterial||P.isShadowMaterial||P.isShaderMaterial&&P.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return k},this.getRenderTarget=function(){return B},this.setRenderTargetTextures=function(P,G,Z){const te=_e.get(P);te.__autoAllocateDepthBuffer=P.resolveDepthBuffer===!1,te.__autoAllocateDepthBuffer===!1&&(te.__useRenderToTexture=!1),_e.get(P.texture).__webglTexture=G,_e.get(P.depthTexture).__webglTexture=te.__autoAllocateDepthBuffer?void 0:Z,te.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(P,G){const Z=_e.get(P);Z.__webglFramebuffer=G,Z.__useDefaultFramebuffer=G===void 0};const _c=U.createFramebuffer();this.setRenderTarget=function(P,G=0,Z=0){B=P,R=G,k=Z;let te=!0,Y=null,Ee=!1,Le=!1;if(P){const ge=_e.get(P);if(ge.__useDefaultFramebuffer!==void 0)Se.bindFramebuffer(U.FRAMEBUFFER,null),te=!1;else if(ge.__webglFramebuffer===void 0)xe.setupRenderTarget(P);else if(ge.__hasExternalTextures)xe.rebindTextures(P,_e.get(P.texture).__webglTexture,_e.get(P.depthTexture).__webglTexture);else if(P.depthBuffer){const Pe=P.depthTexture;if(ge.__boundDepthTexture!==Pe){if(Pe!==null&&_e.has(Pe)&&(P.width!==Pe.image.width||P.height!==Pe.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");xe.setupDepthRenderbuffer(P)}}const Ue=P.texture;(Ue.isData3DTexture||Ue.isDataArrayTexture||Ue.isCompressedArrayTexture)&&(Le=!0);const He=_e.get(P).__webglFramebuffer;P.isWebGLCubeRenderTarget?(Array.isArray(He[G])?Y=He[G][Z]:Y=He[G],Ee=!0):P.samples>0&&xe.useMultisampledRTT(P)===!1?Y=_e.get(P).__webglMultisampledFramebuffer:Array.isArray(He)?Y=He[Z]:Y=He,V.copy(P.viewport),K.copy(P.scissor),J=P.scissorTest}else V.copy(ke).multiplyScalar(ne).floor(),K.copy(O).multiplyScalar(ne).floor(),J=H;if(Z!==0&&(Y=_c),Se.bindFramebuffer(U.FRAMEBUFFER,Y)&&te&&Se.drawBuffers(P,Y),Se.viewport(V),Se.scissor(K),Se.setScissorTest(J),Ee){const ge=_e.get(P.texture);U.framebufferTexture2D(U.FRAMEBUFFER,U.COLOR_ATTACHMENT0,U.TEXTURE_CUBE_MAP_POSITIVE_X+G,ge.__webglTexture,Z)}else if(Le){const ge=G;for(let Ue=0;Ue<P.textures.length;Ue++){const He=_e.get(P.textures[Ue]);U.framebufferTextureLayer(U.FRAMEBUFFER,U.COLOR_ATTACHMENT0+Ue,He.__webglTexture,Z,ge)}}else if(P!==null&&Z!==0){const ge=_e.get(P.texture);U.framebufferTexture2D(U.FRAMEBUFFER,U.COLOR_ATTACHMENT0,U.TEXTURE_2D,ge.__webglTexture,Z)}C=-1},this.readRenderTargetPixels=function(P,G,Z,te,Y,Ee,Le,Fe=0){if(!(P&&P.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ge=_e.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&Le!==void 0&&(ge=ge[Le]),ge){Se.bindFramebuffer(U.FRAMEBUFFER,ge);try{const Ue=P.textures[Fe],He=Ue.format,Pe=Ue.type;if(!ye.textureFormatReadable(He)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ye.textureTypeReadable(Pe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}G>=0&&G<=P.width-te&&Z>=0&&Z<=P.height-Y&&(P.textures.length>1&&U.readBuffer(U.COLOR_ATTACHMENT0+Fe),U.readPixels(G,Z,te,Y,Oe.convert(He),Oe.convert(Pe),Ee))}finally{const Ue=B!==null?_e.get(B).__webglFramebuffer:null;Se.bindFramebuffer(U.FRAMEBUFFER,Ue)}}},this.readRenderTargetPixelsAsync=async function(P,G,Z,te,Y,Ee,Le,Fe=0){if(!(P&&P.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ge=_e.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&Le!==void 0&&(ge=ge[Le]),ge)if(G>=0&&G<=P.width-te&&Z>=0&&Z<=P.height-Y){Se.bindFramebuffer(U.FRAMEBUFFER,ge);const Ue=P.textures[Fe],He=Ue.format,Pe=Ue.type;if(!ye.textureFormatReadable(He))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ye.textureTypeReadable(Pe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ze=U.createBuffer();U.bindBuffer(U.PIXEL_PACK_BUFFER,Ze),U.bufferData(U.PIXEL_PACK_BUFFER,Ee.byteLength,U.STREAM_READ),P.textures.length>1&&U.readBuffer(U.COLOR_ATTACHMENT0+Fe),U.readPixels(G,Z,te,Y,Oe.convert(He),Oe.convert(Pe),0);const lt=B!==null?_e.get(B).__webglFramebuffer:null;Se.bindFramebuffer(U.FRAMEBUFFER,lt);const ct=U.fenceSync(U.SYNC_GPU_COMMANDS_COMPLETE,0);return U.flush(),await am(U,ct,4),U.bindBuffer(U.PIXEL_PACK_BUFFER,Ze),U.getBufferSubData(U.PIXEL_PACK_BUFFER,0,Ee),U.deleteBuffer(Ze),U.deleteSync(ct),Ee}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(P,G=null,Z=0){const te=Math.pow(2,-Z),Y=Math.floor(P.image.width*te),Ee=Math.floor(P.image.height*te),Le=G!==null?G.x:0,Fe=G!==null?G.y:0;xe.setTexture2D(P,0),U.copyTexSubImage2D(U.TEXTURE_2D,Z,0,0,Le,Fe,Y,Ee),Se.unbindTexture()};const vc=U.createFramebuffer(),yc=U.createFramebuffer();this.copyTextureToTexture=function(P,G,Z=null,te=null,Y=0,Ee=null){Ee===null&&(Y!==0?(Jr("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Ee=Y,Y=0):Ee=0);let Le,Fe,ge,Ue,He,Pe,Ze,lt,ct;const gt=P.isCompressedTexture?P.mipmaps[Ee]:P.image;if(Z!==null)Le=Z.max.x-Z.min.x,Fe=Z.max.y-Z.min.y,ge=Z.isBox3?Z.max.z-Z.min.z:1,Ue=Z.min.x,He=Z.min.y,Pe=Z.isBox3?Z.min.z:0;else{const Bt=Math.pow(2,-Y);Le=Math.floor(gt.width*Bt),Fe=Math.floor(gt.height*Bt),P.isDataArrayTexture?ge=gt.depth:P.isData3DTexture?ge=Math.floor(gt.depth*Bt):ge=1,Ue=0,He=0,Pe=0}te!==null?(Ze=te.x,lt=te.y,ct=te.z):(Ze=0,lt=0,ct=0);const rt=Oe.convert(G.format),Ge=Oe.convert(G.type);let tt;G.isData3DTexture?(xe.setTexture3D(G,0),tt=U.TEXTURE_3D):G.isDataArrayTexture||G.isCompressedArrayTexture?(xe.setTexture2DArray(G,0),tt=U.TEXTURE_2D_ARRAY):(xe.setTexture2D(G,0),tt=U.TEXTURE_2D),U.pixelStorei(U.UNPACK_FLIP_Y_WEBGL,G.flipY),U.pixelStorei(U.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),U.pixelStorei(U.UNPACK_ALIGNMENT,G.unpackAlignment);const Qe=U.getParameter(U.UNPACK_ROW_LENGTH),Kt=U.getParameter(U.UNPACK_IMAGE_HEIGHT),Rt=U.getParameter(U.UNPACK_SKIP_PIXELS),Gt=U.getParameter(U.UNPACK_SKIP_ROWS),Pn=U.getParameter(U.UNPACK_SKIP_IMAGES);U.pixelStorei(U.UNPACK_ROW_LENGTH,gt.width),U.pixelStorei(U.UNPACK_IMAGE_HEIGHT,gt.height),U.pixelStorei(U.UNPACK_SKIP_PIXELS,Ue),U.pixelStorei(U.UNPACK_SKIP_ROWS,He),U.pixelStorei(U.UNPACK_SKIP_IMAGES,Pe);const _t=P.isDataArrayTexture||P.isData3DTexture,$t=G.isDataArrayTexture||G.isData3DTexture;if(P.isDepthTexture){const Bt=_e.get(P),an=_e.get(G),un=_e.get(Bt.__renderTarget),xc=_e.get(an.__renderTarget);Se.bindFramebuffer(U.READ_FRAMEBUFFER,un.__webglFramebuffer),Se.bindFramebuffer(U.DRAW_FRAMEBUFFER,xc.__webglFramebuffer);for(let Hi=0;Hi<ge;Hi++)_t&&(U.framebufferTextureLayer(U.READ_FRAMEBUFFER,U.COLOR_ATTACHMENT0,_e.get(P).__webglTexture,Y,Pe+Hi),U.framebufferTextureLayer(U.DRAW_FRAMEBUFFER,U.COLOR_ATTACHMENT0,_e.get(G).__webglTexture,Ee,ct+Hi)),U.blitFramebuffer(Ue,He,Le,Fe,Ze,lt,Le,Fe,U.DEPTH_BUFFER_BIT,U.NEAREST);Se.bindFramebuffer(U.READ_FRAMEBUFFER,null),Se.bindFramebuffer(U.DRAW_FRAMEBUFFER,null)}else if(Y!==0||P.isRenderTargetTexture||_e.has(P)){const Bt=_e.get(P),an=_e.get(G);Se.bindFramebuffer(U.READ_FRAMEBUFFER,vc),Se.bindFramebuffer(U.DRAW_FRAMEBUFFER,yc);for(let un=0;un<ge;un++)_t?U.framebufferTextureLayer(U.READ_FRAMEBUFFER,U.COLOR_ATTACHMENT0,Bt.__webglTexture,Y,Pe+un):U.framebufferTexture2D(U.READ_FRAMEBUFFER,U.COLOR_ATTACHMENT0,U.TEXTURE_2D,Bt.__webglTexture,Y),$t?U.framebufferTextureLayer(U.DRAW_FRAMEBUFFER,U.COLOR_ATTACHMENT0,an.__webglTexture,Ee,ct+un):U.framebufferTexture2D(U.DRAW_FRAMEBUFFER,U.COLOR_ATTACHMENT0,U.TEXTURE_2D,an.__webglTexture,Ee),Y!==0?U.blitFramebuffer(Ue,He,Le,Fe,Ze,lt,Le,Fe,U.COLOR_BUFFER_BIT,U.NEAREST):$t?U.copyTexSubImage3D(tt,Ee,Ze,lt,ct+un,Ue,He,Le,Fe):U.copyTexSubImage2D(tt,Ee,Ze,lt,Ue,He,Le,Fe);Se.bindFramebuffer(U.READ_FRAMEBUFFER,null),Se.bindFramebuffer(U.DRAW_FRAMEBUFFER,null)}else $t?P.isDataTexture||P.isData3DTexture?U.texSubImage3D(tt,Ee,Ze,lt,ct,Le,Fe,ge,rt,Ge,gt.data):G.isCompressedArrayTexture?U.compressedTexSubImage3D(tt,Ee,Ze,lt,ct,Le,Fe,ge,rt,gt.data):U.texSubImage3D(tt,Ee,Ze,lt,ct,Le,Fe,ge,rt,Ge,gt):P.isDataTexture?U.texSubImage2D(U.TEXTURE_2D,Ee,Ze,lt,Le,Fe,rt,Ge,gt.data):P.isCompressedTexture?U.compressedTexSubImage2D(U.TEXTURE_2D,Ee,Ze,lt,gt.width,gt.height,rt,gt.data):U.texSubImage2D(U.TEXTURE_2D,Ee,Ze,lt,Le,Fe,rt,Ge,gt);U.pixelStorei(U.UNPACK_ROW_LENGTH,Qe),U.pixelStorei(U.UNPACK_IMAGE_HEIGHT,Kt),U.pixelStorei(U.UNPACK_SKIP_PIXELS,Rt),U.pixelStorei(U.UNPACK_SKIP_ROWS,Gt),U.pixelStorei(U.UNPACK_SKIP_IMAGES,Pn),Ee===0&&G.generateMipmaps&&U.generateMipmap(tt),Se.unbindTexture()},this.initRenderTarget=function(P){_e.get(P).__webglFramebuffer===void 0&&xe.setupRenderTarget(P)},this.initTexture=function(P){P.isCubeTexture?xe.setTextureCube(P,0):P.isData3DTexture?xe.setTexture3D(P,0):P.isDataArrayTexture||P.isCompressedArrayTexture?xe.setTexture2DArray(P,0):xe.setTexture2D(P,0),Se.unbindTexture()},this.resetState=function(){R=0,k=0,B=null,Se.reset(),Ce.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ln}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=ht._getDrawingBufferColorSpace(e),t.unpackColorSpace=ht._getUnpackColorSpace()}}function tf(i,e){if(e===Lp)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===Fo||e===_u){let t=i.getIndex();if(t===null){const a=[],o=i.getAttribute("position");if(o!==void 0){for(let l=0;l<o.count;l++)a.push(l);i.setIndex(a),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}const n=t.count-2,r=[];if(e===Fo)for(let a=1;a<=n;a++)r.push(t.getX(0)),r.push(t.getX(a)),r.push(t.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(r.push(t.getX(a)),r.push(t.getX(a+1)),r.push(t.getX(a+2))):(r.push(t.getX(a+2)),r.push(t.getX(a+1)),r.push(t.getX(a)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=i.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}class Ry extends Er{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Iy(t)}),this.register(function(t){return new Uy(t)}),this.register(function(t){return new Gy(t)}),this.register(function(t){return new Wy(t)}),this.register(function(t){return new Xy(t)}),this.register(function(t){return new Oy(t)}),this.register(function(t){return new Fy(t)}),this.register(function(t){return new ky(t)}),this.register(function(t){return new By(t)}),this.register(function(t){return new Ly(t)}),this.register(function(t){return new zy(t)}),this.register(function(t){return new Ny(t)}),this.register(function(t){return new Vy(t)}),this.register(function(t){return new Hy(t)}),this.register(function(t){return new Py(t)}),this.register(function(t){return new $y(t)}),this.register(function(t){return new qy(t)})}load(e,t,n,r){const s=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const c=hs.extractUrlBase(e);a=hs.resolveURL(c,this.path)}else a=hs.extractUrlBase(e);this.manager.itemStart(e);const o=function(c){r?r(c):console.error(c),s.manager.itemError(e),s.manager.itemEnd(e)},l=new _h(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{s.parse(c,a,function(h){t(h),s.manager.itemEnd(e)},o)}catch(h){o(h)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,r){let s;const a={},o={},l=new TextDecoder;if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===nf){try{a[ot.KHR_BINARY_GLTF]=new jy(e)}catch(u){r&&r(u);return}s=JSON.parse(a[ot.KHR_BINARY_GLTF].content)}else s=JSON.parse(l.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2){r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new ox(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const u=this.pluginCallbacks[h](c);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[u.name]=u,a[u.name]=!0}if(s.extensionsUsed)for(let h=0;h<s.extensionsUsed.length;++h){const u=s.extensionsUsed[h],f=s.extensionsRequired||[];switch(u){case ot.KHR_MATERIALS_UNLIT:a[u]=new Dy;break;case ot.KHR_DRACO_MESH_COMPRESSION:a[u]=new Yy(s,this.dracoLoader);break;case ot.KHR_TEXTURE_TRANSFORM:a[u]=new Ky;break;case ot.KHR_MESH_QUANTIZATION:a[u]=new Zy;break;default:f.indexOf(u)>=0&&o[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(a),c.setPlugins(o),c.parse(n,r)}parseAsync(e,t){const n=this;return new Promise(function(r,s){n.parse(e,t,r,s)})}}function Cy(){let i={};return{get:function(e){return i[e]},add:function(e,t){i[e]=t},remove:function(e){delete i[e]},removeAll:function(){i={}}}}const ot={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Py{constructor(e){this.parser=e,this.name=ot.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n<r;n++){const s=t[n];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let r=t.cache.get(n);if(r)return r;const s=t.json,l=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let c;const h=new et(16777215);l.color!==void 0&&h.setRGB(l.color[0],l.color[1],l.color[2],Qt);const u=l.range!==void 0?l.range:0;switch(l.type){case"directional":c=new wl(h),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new cg(h),c.distance=u;break;case"spot":c=new og(h),c.distance=u,l.spot=l.spot||{},l.spot.innerConeAngle=l.spot.innerConeAngle!==void 0?l.spot.innerConeAngle:0,l.spot.outerConeAngle=l.spot.outerConeAngle!==void 0?l.spot.outerConeAngle:Math.PI/4,c.angle=l.spot.outerConeAngle,c.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return c.position.set(0,0,0),zn(c,l),l.intensity!==void 0&&(c.intensity=l.intensity),c.name=t.createUniqueName(l.name||"light_"+e),r=Promise.resolve(c),t.cache.add(n,r),r}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,s=n.json.nodes[e],o=(s.extensions&&s.extensions[this.name]||{}).light;return o===void 0?null:this._loadLight(o).then(function(l){return n._getNodeRef(t.cache,o,l)})}}class Dy{constructor(){this.name=ot.KHR_MATERIALS_UNLIT}getMaterialType(){return gi}extendParams(e,t,n){const r=[];e.color=new et(1,1,1),e.opacity=1;const s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const a=s.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],Qt),e.opacity=a[3]}s.baseColorTexture!==void 0&&r.push(n.assignTexture(e,"map",s.baseColorTexture,Ht))}return Promise.all(r)}}class Ly{constructor(e){this.parser=e,this.name=ot.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name].emissiveStrength;return s!==void 0&&(t.emissiveIntensity=s),Promise.resolve()}}class Iy{constructor(e){this.parser=e,this.name=ot.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:kn}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];if(a.clearcoatFactor!==void 0&&(t.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(s.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){const o=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Je(o,o)}return Promise.all(s)}}class Uy{constructor(e){this.parser=e,this.name=ot.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:kn}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class Ny{constructor(e){this.parser=e,this.name=ot.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:kn}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];return a.iridescenceFactor!==void 0&&(t.iridescence=a.iridescenceFactor),a.iridescenceTexture!==void 0&&s.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),a.iridescenceIor!==void 0&&(t.iridescenceIOR=a.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),a.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),a.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),a.iridescenceThicknessTexture!==void 0&&s.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(s)}}class Oy{constructor(e){this.parser=e,this.name=ot.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:kn}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[];t.sheenColor=new et(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=r.extensions[this.name];if(a.sheenColorFactor!==void 0){const o=a.sheenColorFactor;t.sheenColor.setRGB(o[0],o[1],o[2],Qt)}return a.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&s.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,Ht)),a.sheenRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(s)}}class Fy{constructor(e){this.parser=e,this.name=ot.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:kn}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];return a.transmissionFactor!==void 0&&(t.transmission=a.transmissionFactor),a.transmissionTexture!==void 0&&s.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(s)}}class ky{constructor(e){this.parser=e,this.name=ot.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:kn}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];t.thickness=a.thicknessFactor!==void 0?a.thicknessFactor:0,a.thicknessTexture!==void 0&&s.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const o=a.attenuationColor||[1,1,1];return t.attenuationColor=new et().setRGB(o[0],o[1],o[2],Qt),Promise.all(s)}}class By{constructor(e){this.parser=e,this.name=ot.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:kn}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class zy{constructor(e){this.parser=e,this.name=ot.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:kn}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];t.specularIntensity=a.specularFactor!==void 0?a.specularFactor:1,a.specularTexture!==void 0&&s.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));const o=a.specularColorFactor||[1,1,1];return t.specularColor=new et().setRGB(o[0],o[1],o[2],Qt),a.specularColorTexture!==void 0&&s.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,Ht)),Promise.all(s)}}class Hy{constructor(e){this.parser=e,this.name=ot.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:kn}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];return t.bumpScale=a.bumpFactor!==void 0?a.bumpFactor:1,a.bumpTexture!==void 0&&s.push(n.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(s)}}class Vy{constructor(e){this.parser=e,this.name=ot.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:kn}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],a=r.extensions[this.name];return a.anisotropyStrength!==void 0&&(t.anisotropy=a.anisotropyStrength),a.anisotropyRotation!==void 0&&(t.anisotropyRotation=a.anisotropyRotation),a.anisotropyTexture!==void 0&&s.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(s)}}class Gy{constructor(e){this.parser=e,this.name=ot.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const s=r.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,a)}}class Wy{constructor(e){this.parser=e,this.name=ot.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,n=this.parser,r=n.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],o=r.images[a.source];let l=n.textureLoader;if(o.uri){const c=n.options.manager.getHandler(o.uri);c!==null&&(l=c)}return n.loadTextureImage(e,a.source,l)}}class Xy{constructor(e){this.parser=e,this.name=ot.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,n=this.parser,r=n.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],o=r.images[a.source];let l=n.textureLoader;if(o.uri){const c=n.options.manager.getHandler(o.uri);c!==null&&(l=c)}return n.loadTextureImage(e,a.source,l)}}class $y{constructor(e){this.name=ot.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const r=n.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(o){const l=r.byteOffset||0,c=r.byteLength||0,h=r.count,u=r.byteStride,f=new Uint8Array(o,l,c);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(h,u,f,r.mode,r.filter).then(function(d){return d.buffer}):a.ready.then(function(){const d=new ArrayBuffer(h*u);return a.decodeGltfBuffer(new Uint8Array(d),h,u,f,r.mode,r.filter),d})})}else return null}}class qy{constructor(e){this.name=ot.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const r=t.meshes[n.mesh];for(const c of r.primitives)if(c.mode!==_n.TRIANGLES&&c.mode!==_n.TRIANGLE_STRIP&&c.mode!==_n.TRIANGLE_FAN&&c.mode!==void 0)return null;const a=n.extensions[this.name].attributes,o=[],l={};for(const c in a)o.push(this.parser.getDependency("accessor",a[c]).then(h=>(l[c]=h,l[c])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(c=>{const h=c.pop(),u=h.isGroup?h.children:[h],f=c[0].count,d=[];for(const _ of u){const b=new it,g=new $,m=new In,S=new $(1,1,1),y=new Om(_.geometry,_.material,f);for(let M=0;M<f;M++)l.TRANSLATION&&g.fromBufferAttribute(l.TRANSLATION,M),l.ROTATION&&m.fromBufferAttribute(l.ROTATION,M),l.SCALE&&S.fromBufferAttribute(l.SCALE,M),y.setMatrixAt(M,b.compose(g,m,S));for(const M in l)if(M==="_COLOR_0"){const T=l[M];y.instanceColor=new ml(T.array,T.itemSize,T.normalized)}else M!=="TRANSLATION"&&M!=="ROTATION"&&M!=="SCALE"&&_.geometry.setAttribute(M,l[M]);Ct.prototype.copy.call(y,_),this.parser.assignFinalMaterial(y),d.push(y)}return h.isGroup?(h.clear(),h.add(...d),h):d[0]}))}}const nf="glTF",ds=12,rf={JSON:1313821514,BIN:5130562};class jy{constructor(e){this.name=ot.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,ds),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==nf)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-ds,s=new DataView(e,ds);let a=0;for(;a<r;){const o=s.getUint32(a,!0);a+=4;const l=s.getUint32(a,!0);if(a+=4,l===rf.JSON){const c=new Uint8Array(e,ds+a,o);this.content=n.decode(c)}else if(l===rf.BIN){const c=ds+a;this.body=e.slice(c,c+o)}a+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Yy{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=ot.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,r=this.dracoLoader,s=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},l={},c={};for(const h in a){const u=zl[h]||h.toLowerCase();o[u]=a[h]}for(const h in e.attributes){const u=zl[h]||h.toLowerCase();if(a[h]!==void 0){const f=n.accessors[e.attributes[h]],d=Cr[f.componentType];c[u]=d.name,l[u]=f.normalized===!0}}return t.getDependency("bufferView",s).then(function(h){return new Promise(function(u,f){r.decodeDracoFile(h,function(d){for(const _ in d.attributes){const b=d.attributes[_],g=l[_];g!==void 0&&(b.normalized=g)}u(d)},o,c,Qt,f)})})}}class Ky{constructor(){this.name=ot.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Zy{constructor(){this.name=ot.KHR_MESH_QUANTIZATION}}class sf extends ls{constructor(e,t,n,r){super(e,t,n,r)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r*3+r;for(let a=0;a!==r;a++)t[a]=n[s+a];return t}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=o*2,c=o*3,h=r-t,u=(n-t)/h,f=u*u,d=f*u,_=e*c,b=_-c,g=-2*d+3*f,m=d-f,S=1-g,y=m-f+u;for(let M=0;M!==o;M++){const T=a[b+M+o],R=a[b+M+l]*h,k=a[_+M+o],B=a[_+M]*h;s[M]=S*T+y*R+g*k+m*B}return s}}const Jy=new In;class Qy extends sf{interpolate_(e,t,n,r){const s=super.interpolate_(e,t,n,r);return Jy.fromArray(s).normalize().toArray(s),s}}const _n={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Cr={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},af={9728:Wt,9729:Nt,9984:au,9985:As,9986:Vr,9987:$n},of={33071:ci,33648:ws,10497:Ji},Bl={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},zl={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},yi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},ex={CUBICSPLINE:void 0,LINEAR:jr,STEP:qr},Hl={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function tx(i){return i.DefaultMaterial===void 0&&(i.DefaultMaterial=new os({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Xn})),i.DefaultMaterial}function Fi(i,e,t){for(const n in t.extensions)i[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function zn(i,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(i.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function nx(i,e,t){let n=!1,r=!1,s=!1;for(let c=0,h=e.length;c<h;c++){const u=e[c];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(r=!0),u.COLOR_0!==void 0&&(s=!0),n&&r&&s)break}if(!n&&!r&&!s)return Promise.resolve(i);const a=[],o=[],l=[];for(let c=0,h=e.length;c<h;c++){const u=e[c];if(n){const f=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):i.attributes.position;a.push(f)}if(r){const f=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):i.attributes.normal;o.push(f)}if(s){const f=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):i.attributes.color;l.push(f)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(l)]).then(function(c){const h=c[0],u=c[1],f=c[2];return n&&(i.morphAttributes.position=h),r&&(i.morphAttributes.normal=u),s&&(i.morphAttributes.color=f),i.morphTargetsRelative=!0,i})}function ix(i,e){if(i.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)i.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(i.morphTargetInfluences.length===t.length){i.morphTargetDictionary={};for(let n=0,r=t.length;n<r;n++)i.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function rx(i){let e;const t=i.extensions&&i.extensions[ot.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Vl(t.attributes):e=i.indices+":"+Vl(i.attributes)+":"+i.mode,i.targets!==void 0)for(let n=0,r=i.targets.length;n<r;n++)e+=":"+Vl(i.targets[n]);return e}function Vl(i){let e="";const t=Object.keys(i).sort();for(let n=0,r=t.length;n<r;n++)e+=t[n]+":"+i[t[n]]+";";return e}function Gl(i){switch(i){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function sx(i){return i.search(/\.jpe?g($|\?)/i)>0||i.search(/^data\:image\/jpeg/)===0?"image/jpeg":i.search(/\.webp($|\?)/i)>0||i.search(/^data\:image\/webp/)===0?"image/webp":i.search(/\.ktx2($|\?)/i)>0||i.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const ax=new it;class ox{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Cy,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,s=!1,a=-1;if(typeof navigator<"u"){const o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;const l=o.match(/Version\/(\d+)/);r=n&&l?parseInt(l[1],10):-1,s=o.indexOf("Firefox")>-1,a=s?o.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&r<17||s&&a<98?this.textureLoader=new vh(this.options.manager):this.textureLoader=new fg(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new _h(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(a){const o={scene:a[0][r.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:r.asset,parser:n,userData:{}};return Fi(s,o,r),zn(o,r),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(o)})).then(function(){for(const l of o.scenes)l.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let r=0,s=t.length;r<s;r++){const a=t[r].joints;for(let o=0,l=a.length;o<l;o++)e[a[o]].isBone=!0}for(let r=0,s=e.length;r<s;r++){const a=e[r];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(n[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const r=n.clone(),s=(a,o)=>{const l=this.associations.get(a);l!=null&&this.associations.set(o,l);for(const[c,h]of a.children.entries())s(h,o.children[c])};return s(n,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const r=e(t[n]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let r=0;r<t.length;r++){const s=e(t[r]);s&&n.push(s)}return n}getDependency(e,t){const n=e+":"+t;let r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":r=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!r)throw new Error("Unknown type: "+e);break}this.cache.add(n,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,r=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(r.map(function(s,a){return n.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[ot.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(s,a){n.load(hs.resolveURL(t.uri,r.path),s,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const r=t.byteLength||0,s=t.byteOffset||0;return n.slice(s,s+r)})}loadAccessor(e){const t=this,n=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){const a=Bl[r.type],o=Cr[r.componentType],l=r.normalized===!0,c=new o(r.count*a);return Promise.resolve(new en(c,a,l))}const s=[];return r.bufferView!==void 0?s.push(this.getDependency("bufferView",r.bufferView)):s.push(null),r.sparse!==void 0&&(s.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(s).then(function(a){const o=a[0],l=Bl[r.type],c=Cr[r.componentType],h=c.BYTES_PER_ELEMENT,u=h*l,f=r.byteOffset||0,d=r.bufferView!==void 0?n.bufferViews[r.bufferView].byteStride:void 0,_=r.normalized===!0;let b,g;if(d&&d!==u){const m=Math.floor(f/d),S="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+m+":"+r.count;let y=t.cache.get(S);y||(b=new c(o,m*d,r.count*d/h),y=new Dm(b,d/h),t.cache.add(S,y)),g=new ul(y,l,f%d/h,_)}else o===null?b=new c(r.count*l):b=new c(o,f,r.count*l),g=new en(b,l,_);if(r.sparse!==void 0){const m=Bl.SCALAR,S=Cr[r.sparse.indices.componentType],y=r.sparse.indices.byteOffset||0,M=r.sparse.values.byteOffset||0,T=new S(a[1],y,r.sparse.count*m),R=new c(a[2],M,r.sparse.count*l);o!==null&&(g=new en(g.array.slice(),g.itemSize,g.normalized)),g.normalized=!1;for(let k=0,B=T.length;k<B;k++){const C=T[k];if(g.setX(C,R[k*l]),l>=2&&g.setY(C,R[k*l+1]),l>=3&&g.setZ(C,R[k*l+2]),l>=4&&g.setW(C,R[k*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}g.normalized=_}return g})}loadTexture(e){const t=this.json,n=this.options,s=t.textures[e].source,a=t.images[s];let o=this.textureLoader;if(a.uri){const l=n.manager.getHandler(a.uri);l!==null&&(o=l)}return this.loadTextureImage(e,s,o)}loadTextureImage(e,t,n){const r=this,s=this.json,a=s.textures[e],o=s.images[t],l=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,n).then(function(h){h.flipY=!1,h.name=a.name||o.name||"",h.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(h.name=o.uri);const f=(s.samplers||{})[a.sampler]||{};return h.magFilter=af[f.magFilter]||Nt,h.minFilter=af[f.minFilter]||$n,h.wrapS=of[f.wrapS]||Ji,h.wrapT=of[f.wrapT]||Ji,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==Wt&&h.minFilter!==Nt,r.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const n=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const a=r.images[e],o=self.URL||self.webkitURL;let l=a.uri||"",c=!1;if(a.bufferView!==void 0)l=n.getDependency("bufferView",a.bufferView).then(function(u){c=!0;const f=new Blob([u],{type:a.mimeType});return l=o.createObjectURL(f),l});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(l).then(function(u){return new Promise(function(f,d){let _=f;t.isImageBitmapLoader===!0&&(_=function(b){const g=new Dt(b);g.needsUpdate=!0,f(g)}),t.load(hs.resolveURL(u,s.path),_,void 0,d)})}).then(function(u){return c===!0&&o.revokeObjectURL(l),zn(u,a),u.userData.mimeType=a.mimeType||sx(a.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),u});return this.sourceCache[e]=h,h}assignTexture(e,t,n,r){const s=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),s.extensions[ot.KHR_TEXTURE_TRANSFORM]){const o=n.extensions!==void 0?n.extensions[ot.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const l=s.associations.get(a);a=s.extensions[ot.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),s.associations.set(a,l)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+n.uuid;let l=this.cache.get(o);l||(l=new ch,Fn.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(o,l)),n=l}else if(e.isLine){const o="LineBasicMaterial:"+n.uuid;let l=this.cache.get(o);l||(l=new rh,Fn.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(o,l)),n=l}if(r||s||a){let o="ClonedMaterial:"+n.uuid+":";r&&(o+="derivative-tangents:"),s&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let l=this.cache.get(o);l||(l=n.clone(),s&&(l.vertexColors=!0),a&&(l.flatShading=!0),r&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(o,l),this.associations.set(l,this.associations.get(n))),n=l}e.material=n}getMaterialType(){return os}loadMaterial(e){const t=this,n=this.json,r=this.extensions,s=n.materials[e];let a;const o={},l=s.extensions||{},c=[];if(l[ot.KHR_MATERIALS_UNLIT]){const u=r[ot.KHR_MATERIALS_UNLIT];a=u.getMaterialType(),c.push(u.extendParams(o,s,t))}else{const u=s.pbrMetallicRoughness||{};if(o.color=new et(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;o.color.setRGB(f[0],f[1],f[2],Qt),o.opacity=f[3]}u.baseColorTexture!==void 0&&c.push(t.assignTexture(o,"map",u.baseColorTexture,Ht)),o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(o,"roughnessMap",u.metallicRoughnessTexture))),a=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,o)})))}s.doubleSided===!0&&(o.side=yn);const h=s.alphaMode||Hl.OPAQUE;if(h===Hl.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===Hl.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&a!==gi&&(c.push(t.assignTexture(o,"normalMap",s.normalTexture)),o.normalScale=new Je(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;o.normalScale.set(u,u)}if(s.occlusionTexture!==void 0&&a!==gi&&(c.push(t.assignTexture(o,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&a!==gi){const u=s.emissiveFactor;o.emissive=new et().setRGB(u[0],u[1],u[2],Qt)}return s.emissiveTexture!==void 0&&a!==gi&&c.push(t.assignTexture(o,"emissiveMap",s.emissiveTexture,Ht)),Promise.all(c).then(function(){const u=new a(o);return s.name&&(u.name=s.name),zn(u,s),t.associations.set(u,{materials:e}),s.extensions&&Fi(r,u,s),u})}createUniqueName(e){const t=St.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,r=this.primitiveCache;function s(o){return n[ot.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(l){return lf(l,o,t)})}const a=[];for(let o=0,l=e.length;o<l;o++){const c=e[o],h=rx(c),u=r[h];if(u)a.push(u.promise);else{let f;c.extensions&&c.extensions[ot.KHR_DRACO_MESH_COMPRESSION]?f=s(c):f=lf(new An,c,t),r[h]={primitive:c,promise:f},a.push(f)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,r=this.extensions,s=n.meshes[e],a=s.primitives,o=[];for(let l=0,c=a.length;l<c;l++){const h=a[l].material===void 0?tx(this.cache):this.getDependency("material",a[l].material);o.push(h)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(l){const c=l.slice(0,l.length-1),h=l[l.length-1],u=[];for(let d=0,_=h.length;d<_;d++){const b=h[d],g=a[d];let m;const S=c[d];if(g.mode===_n.TRIANGLES||g.mode===_n.TRIANGLE_STRIP||g.mode===_n.TRIANGLE_FAN||g.mode===void 0)m=s.isSkinnedMesh===!0?new Im(b,S):new Yt(b,S),m.isSkinnedMesh===!0&&m.normalizeSkinWeights(),g.mode===_n.TRIANGLE_STRIP?m.geometry=tf(m.geometry,_u):g.mode===_n.TRIANGLE_FAN&&(m.geometry=tf(m.geometry,Fo));else if(g.mode===_n.LINES)m=new zm(b,S);else if(g.mode===_n.LINE_STRIP)m=new yl(b,S);else if(g.mode===_n.LINE_LOOP)m=new Hm(b,S);else if(g.mode===_n.POINTS)m=new Vm(b,S);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+g.mode);Object.keys(m.geometry.morphAttributes).length>0&&ix(m,s),m.name=t.createUniqueName(s.name||"mesh_"+e),zn(m,s),g.extensions&&Fi(r,m,g),t.assignFinalMaterial(m),u.push(m)}for(let d=0,_=u.length;d<_;d++)t.associations.set(u[d],{meshes:e,primitives:d});if(u.length===1)return s.extensions&&Fi(r,u[0],s),u[0];const f=new ti;s.extensions&&Fi(r,f,s),t.associations.set(f,{meshes:e});for(let d=0,_=u.length;d<_;d++)f.add(u[d]);return f})}loadCamera(e){let t;const n=this.json.cameras[e],r=n[n.type];if(!r){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new nn(Su.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):n.type==="orthographic"&&(t=new us(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),zn(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let r=0,s=t.joints.length;r<s;r++)n.push(this._loadNodeShallow(t.joints[r]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(r){const s=r.pop(),a=r,o=[],l=[];for(let c=0,h=a.length;c<h;c++){const u=a[c];if(u){o.push(u);const f=new it;s!==null&&f.fromArray(s.array,c*16),l.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new pl(o,l)})}loadAnimation(e){const t=this.json,n=this,r=t.animations[e],s=r.name?r.name:"animation_"+e,a=[],o=[],l=[],c=[],h=[];for(let u=0,f=r.channels.length;u<f;u++){const d=r.channels[u],_=r.samplers[d.sampler],b=d.target,g=b.node,m=r.parameters!==void 0?r.parameters[_.input]:_.input,S=r.parameters!==void 0?r.parameters[_.output]:_.output;b.node!==void 0&&(a.push(this.getDependency("node",g)),o.push(this.getDependency("accessor",m)),l.push(this.getDependency("accessor",S)),c.push(_),h.push(b))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(l),Promise.all(c),Promise.all(h)]).then(function(u){const f=u[0],d=u[1],_=u[2],b=u[3],g=u[4],m=[];for(let y=0,M=f.length;y<M;y++){const T=f[y],R=d[y],k=_[y],B=b[y],C=g[y];if(T===void 0)continue;T.updateMatrix&&T.updateMatrix();const D=n._createAnimationTracks(T,R,k,B,C);if(D)for(let V=0;V<D.length;V++)m.push(D[V])}const S=new Qm(s,void 0,m);return zn(S,r),S})}createNodeMesh(e){const t=this.json,n=this,r=t.nodes[e];return r.mesh===void 0?null:n.getDependency("mesh",r.mesh).then(function(s){const a=n._getNodeRef(n.meshCache,r.mesh,s);return r.weights!==void 0&&a.traverse(function(o){if(o.isMesh)for(let l=0,c=r.weights.length;l<c;l++)o.morphTargetInfluences[l]=r.weights[l]}),a})}loadNode(e){const t=this.json,n=this,r=t.nodes[e],s=n._loadNodeShallow(e),a=[],o=r.children||[];for(let c=0,h=o.length;c<h;c++)a.push(n.getDependency("node",o[c]));const l=r.skin===void 0?Promise.resolve(null):n.getDependency("skin",r.skin);return Promise.all([s,Promise.all(a),l]).then(function(c){const h=c[0],u=c[1],f=c[2];f!==null&&h.traverse(function(d){d.isSkinnedMesh&&d.bind(f,ax)});for(let d=0,_=u.length;d<_;d++)h.add(u[d]);return h})}_loadNodeShallow(e){const t=this.json,n=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=t.nodes[e],a=s.name?r.createUniqueName(s.name):"",o=[],l=r._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&o.push(l),s.camera!==void 0&&o.push(r.getDependency("camera",s.camera).then(function(c){return r._getNodeRef(r.cameraCache,s.camera,c)})),r._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){o.push(c)}),this.nodeCache[e]=Promise.all(o).then(function(c){let h;if(s.isBone===!0?h=new eh:c.length>1?h=new ti:c.length===1?h=c[0]:h=new Ct,h!==c[0])for(let u=0,f=c.length;u<f;u++)h.add(c[u]);if(s.name&&(h.userData.name=s.name,h.name=a),zn(h,s),s.extensions&&Fi(n,h,s),s.matrix!==void 0){const u=new it;u.fromArray(s.matrix),h.applyMatrix4(u)}else s.translation!==void 0&&h.position.fromArray(s.translation),s.rotation!==void 0&&h.quaternion.fromArray(s.rotation),s.scale!==void 0&&h.scale.fromArray(s.scale);if(!r.associations.has(h))r.associations.set(h,{});else if(s.mesh!==void 0&&r.meshCache.refs[s.mesh]>1){const u=r.associations.get(h);r.associations.set(h,{...u})}return r.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],r=this,s=new ti;n.name&&(s.name=r.createUniqueName(n.name)),zn(s,n),n.extensions&&Fi(t,s,n);const a=n.nodes||[],o=[];for(let l=0,c=a.length;l<c;l++)o.push(r.getDependency("node",a[l]));return Promise.all(o).then(function(l){for(let h=0,u=l.length;h<u;h++)s.add(l[h]);const c=h=>{const u=new Map;for(const[f,d]of r.associations)(f instanceof Fn||f instanceof Dt)&&u.set(f,d);return h.traverse(f=>{const d=r.associations.get(f);d!=null&&u.set(f,d)}),u};return r.associations=c(s),s})}_createAnimationTracks(e,t,n,r,s){const a=[],o=e.name?e.name:e.uuid,l=[];yi[s.path]===yi.weights?e.traverse(function(f){f.morphTargetInfluences&&l.push(f.name?f.name:f.uuid)}):l.push(o);let c;switch(yi[s.path]){case yi.weights:c=xr;break;case yi.rotation:c=br;break;case yi.translation:case yi.scale:c=Mr;break;default:switch(n.itemSize){case 1:c=xr;break;case 2:case 3:default:c=Mr;break}break}const h=r.interpolation!==void 0?ex[r.interpolation]:jr,u=this._getArrayFromAccessor(n);for(let f=0,d=l.length;f<d;f++){const _=new c(l[f]+"."+yi[s.path],t.array,u,h);r.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(_),a.push(_)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=Gl(t.constructor),r=new Float32Array(t.length);for(let s=0,a=t.length;s<a;s++)r[s]=t[s]*n;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const r=this instanceof br?Qy:sf;return new r(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function lx(i,e,t){const n=e.attributes,r=new Un;if(n.POSITION!==void 0){const o=t.json.accessors[n.POSITION],l=o.min,c=o.max;if(l!==void 0&&c!==void 0){if(r.set(new $(l[0],l[1],l[2]),new $(c[0],c[1],c[2])),o.normalized){const h=Gl(Cr[o.componentType]);r.min.multiplyScalar(h),r.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const o=new $,l=new $;for(let c=0,h=s.length;c<h;c++){const u=s[c];if(u.POSITION!==void 0){const f=t.json.accessors[u.POSITION],d=f.min,_=f.max;if(d!==void 0&&_!==void 0){if(l.setX(Math.max(Math.abs(d[0]),Math.abs(_[0]))),l.setY(Math.max(Math.abs(d[1]),Math.abs(_[1]))),l.setZ(Math.max(Math.abs(d[2]),Math.abs(_[2]))),f.normalized){const b=Gl(Cr[f.componentType]);l.multiplyScalar(b)}o.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(o)}i.boundingBox=r;const a=new Nn;r.getCenter(a.center),a.radius=r.min.distanceTo(r.max)/2,i.boundingSphere=a}function lf(i,e,t){const n=e.attributes,r=[];function s(a,o){return t.getDependency("accessor",a).then(function(l){i.setAttribute(o,l)})}for(const a in n){const o=zl[a]||a.toLowerCase();o in i.attributes||r.push(s(n[a],o))}if(e.indices!==void 0&&!i.index){const a=t.getDependency("accessor",e.indices).then(function(o){i.setIndex(o)});r.push(a)}return ht.workingColorSpace!==Qt&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ht.workingColorSpace}" not supported.`),zn(i,e),lx(i,e,t),Promise.all(r).then(function(){return e.targets!==void 0?nx(i,e.targets,t):i})}function cx(){const i=new ti;i.name="sonic-3d-demo";const e=new pr(1,1,1),t=new os({color:3900150,metalness:.25,roughness:.4}),n=new Yt(e,t);n.name="demo-box",n.position.y=.5,i.add(n);const r=new Yt(new Sl(2.2,48),new os({color:1710618,metalness:0,roughness:.9}));return r.name="demo-ground",r.rotation.x=-Math.PI/2,i.add(r),i}function ux(i){const e=new hg(16777215,.55),t=new wl(16777215,1.1);t.position.set(4,6,3);const n=new wl(11584767,.35);n.position.set(-3,1,-2);const r=[e,t,n];for(const s of r)i.add(s);return r}const Wl={create:cx,setupLights:ux},Xl="WebGL indisponible — sonic-3d nécessite WebGL.";function hx(i){const e=document.createElement("canvas"),t=e.getContext("webgl2")||e.getContext("webgl");if(!t||typeof t.getParameter!="function")throw new Error(Xl);const n={canvas:i,antialias:!0,alpha:!1,preserveDrawingBuffer:!0,powerPreference:"high-performance"};let r;try{r=new Ay(n)}catch(s){const a=s instanceof Error?s.message:String(s);throw new Error(`${Xl} (${a})`)}if(!r.getContext())throw r.dispose(),new Error(Xl);return r}function fx(i){const e=i.dprMax??2,t=i.camera??vn.Orbit,n=i.fov??Ms,r=i.fit!==!1,s={minDistance:i.minDistance??zc,maxDistance:i.maxDistance??Hc,minPolar:i.minPolar??Gc,maxPolar:i.maxPolar??Math.PI-Gc},a=new ju;a.background=new et(657930);const o=new ti;a.add(o);const l=new nn(n,1,.01,2e3);l.position.set(2.2,1.6,2.8);const c=new us(-1,1,1,-1,.01,2e3);c.position.set(2.2,1.6,2.8);const h=hx(i.canvas);return h.outputColorSpace=Ht,h.toneMapping=iu,h.toneMappingExposure=i.exposure??Ia,h.setPixelRatio(1),{scene:a,renderer:h,canvas:i.canvas,perspCam:l,orthoCam:c,activeCam:l,root:o,lights:Wl.setupLights(a),dprMax:e,mode:t,fov:n,fitEnabled:r,limits:s,autoRotate:!!i.autoRotate}}function $l(i,e,t){return i.content?(i.pointerNdc.set(e*2-1,-(t*2-1)),i.raycaster.setFromCamera(i.pointerNdc,i.activeCam),i.raycaster.intersectObject(i.content,!0)):[]}function ql(i){return{x:i.point.x,y:i.point.y,z:i.point.z,objectId:i.object.name||i.object.uuid}}function dx(i,e,t){const n=$l(i,e,t);return n.length?ql(n[0]):null}function cf(i){if(!i.highlighted)return;const e=i.highlighted.material,t=Array.isArray(e)?e[0]:e;t&&"emissive"in t&&(t.emissive.copy(i.prevEmissive),t.emissiveIntensity=i.prevEmissiveIntensity),i.highlighted=null}function px(i,e,t){const n=$l(i,e,t),r=n[0]?.object,s=r?.isMesh?r:null;if(s===i.highlighted)return n.length?ql(n[0]):null;if(cf(i),!s)return null;const a=s.material,o=Array.isArray(a)?a[0]:a;return o&&"emissive"in o&&(i.highlighted=s,i.prevEmissive.copy(o.emissive),i.prevEmissiveIntensity=o.emissiveIntensity??1,o.emissive.set(3900150),o.emissiveIntensity=.45),ql(n[0])}const fa={hit:dx,setHoverAt:px,clearHighlight:cf,raycastHits:$l};function uf(i){if(i.blobUrl){try{URL.revokeObjectURL(i.blobUrl)}catch{}i.blobUrl=null}}function hf(i){fa.clearHighlight(i),i.content&&(i.root.remove(i.content),i.content.traverse(e=>{const t=e;if(t.isMesh){t.geometry?.dispose();const n=Array.isArray(t.material)?t.material:[t.material];for(const r of n)r?.dispose?.()}}),i.content=null,i.bbox.makeEmpty())}function jl(i){i.bbox.makeEmpty(),i.content&&i.bbox.setFromObject(i.content)}function ff(i,e){i.traverse(t=>{const n=t;if(!(!n.isMesh||!n.morphTargetDictionary||!n.morphTargetInfluences))for(const[r,s]of Object.entries(e)){const a=n.morphTargetDictionary[r];a!==void 0&&(n.morphTargetInfluences[a]=s)}})}async function mx(i,e,t,n){hf(i);try{let r=e?.url?.trim()??"";if(!r&&e?.blob&&(uf(i),i.blobUrl=URL.createObjectURL(e.blob),r=i.blobUrl),!r)i.content=Wl.create(),i.root.add(i.content);else{const s=e?.kind??Ut.guessKind(r);if(s==="obj"||s==="ply")throw new Error(`Format "${s}" non supporté en V1 — utilisez glTF/GLB.`);const a=await i.loader.loadAsync(r);if(!n(t))return{ready:!1,error:null};i.content=a.scene,i.root.add(i.content),e?.morphTargets&&ff(i.content,e.morphTargets)}return n(t)?(jl(i),i.fitEnabled&&i.fitToContent(),{ready:!0,error:null}):{ready:!1,error:null}}catch(r){if(!n(t))return{ready:!1,error:null};const s=r instanceof Error?r.message:String(r);throw i.content=Wl.create(),i.root.add(i.content),jl(i),i.fitEnabled&&i.fitToContent(),r instanceof Error?r:new Error(s)}}const Yl={asset:mx,applyMorphTargets:ff,clearContent:hf,updateBBox:jl,revokeBlob:uf};function gx(i,e){i&&(i.minDistance=e.minDistance,i.maxDistance=e.maxDistance,i.minPolarAngle=e.minPolar,i.maxPolarAngle=e.maxPolar)}function _x(i,e,t,n){const r=i.controls?.target??i.target;let s=Number.isFinite(n)?n:1;s=Math.max(i.limits.minDistance,s),Number.isFinite(i.limits.maxDistance)&&(s=Math.min(i.limits.maxDistance,s));const a=Math.max(-(Math.PI/2-.05),Math.min(Math.PI/2-.05,t)),o=s*Math.cos(a);i.activeCam.position.set(r.x+o*Math.sin(e),r.y+s*Math.sin(a),r.z+o*Math.cos(e)),i.controls?(i.controls.target.copy(r),i.controls.update()):i.activeCam.lookAt(r)}function vx(i){if(i.bbox.isEmpty())return;const e=new $,t=new $;i.bbox.getSize(e),i.bbox.getCenter(t),i.target.copy(t);const n=Math.max(e.x,e.y,e.z,.001),r=i.mode===vn.Ortho?n*1.8:n/(2*Math.tan((i.fov||Ms)*Math.PI/360))*1.35,s=new $(1,.65,1).normalize();if(i.activeCam.position.copy(t).addScaledVector(s,r),i.controls?(i.controls.target.copy(t),i.controls.update()):i.activeCam.lookAt(t),i.mode===vn.Ortho){const a=i.perspCam.aspect||1,o=n*.75;i.orthoCam.left=-o*a,i.orthoCam.right=o*a,i.orthoCam.top=o,i.orthoCam.bottom=-o,i.orthoCam.updateProjectionMatrix()}}function yx(i,e){const t={...i};return e.minDistance!=null&&Number.isFinite(e.minDistance)&&(t.minDistance=Math.max(0,e.minDistance)),e.maxDistance!=null&&Number.isFinite(e.maxDistance)&&(t.maxDistance=e.maxDistance<=0?1/0:Math.max(t.minDistance,e.maxDistance)),e.minPolar!=null&&Number.isFinite(e.minPolar)&&(t.minPolar=Math.max(0,e.minPolar)),e.maxPolar!=null&&Number.isFinite(e.maxPolar)&&(t.maxPolar=Math.min(Math.PI,Math.max(t.minPolar,e.maxPolar))),t}const da=1e-6;function df(i,e){if(!Number.isFinite(e)||e===0)return!1;const t=e<0,n=i.object;if(n.isOrthographicCamera){const s=n.zoom;return t?s<i.maxZoom-da:s>i.minZoom+da}const r=i.getDistance();return t?r>i.minDistance+da:Number.isFinite(i.maxDistance)?r<i.maxDistance-da:!0}function xx(i,e){const t=n=>{const r=e();!r?.enabled||!r.enableZoom||df(r,n.deltaY)||n.stopImmediatePropagation()};return i.addEventListener("wheel",t,{capture:!0,passive:!0}),()=>{i.removeEventListener("wheel",t,{capture:!0})}}const Pr={applyLimitsToControls:gx,setSpherical:_x,fitToContent:vx,mergeLimits:yx,wheelAffectsZoom:df,bindWheelPageScrollRelay:xx};function bx(i,e){const t=i.activeCam.position,n=i.controls?.target??i.target,r=new $().subVectors(t,n),s=r.length(),a=Math.atan2(r.x,r.z),o=Math.atan2(r.y,Math.hypot(r.x,r.z)),l={time:e.time,frame:e.frame,ready:i.ready?1:0,loading:i.loading?1:0,hovering:e.hovering,pointerX:e.pointerX,pointerY:e.pointerY,camX:t.x,camY:t.y,camZ:t.z,targetX:n.x,targetY:n.y,targetZ:n.z,fov:i.mode===vn.Ortho?0:i.perspCam.fov,zoom:i.mode===vn.Ortho?i.orthoCam.zoom:1,distance:s,yaw:a,pitch:o};return i.bbox.isEmpty()||(l.bboxMinX=i.bbox.min.x,l.bboxMinY=i.bbox.min.y,l.bboxMinZ=i.bbox.min.z,l.bboxMaxX=i.bbox.max.x,l.bboxMaxY=i.bbox.max.y,l.bboxMaxZ=i.bbox.max.z),e.hit&&(l.hitX=e.hit.x,l.hitY=e.hit.y,l.hitZ=e.hit.z,l.hitObjectId=e.hit.objectId),l}const Sx={build:bx};async function Mx(i,e){const t=++i.loadToken;i._loading=!0,i._ready=!1,i.lastError=null;try{const n=await Yl.asset(i,e,t,r=>r===i.loadToken);if(t!==i.loadToken)return;i._ready=n.ready,i._loading=!1}catch(n){if(t!==i.loadToken)return;throw i._loading=!1,i._ready=!1,i.lastError=n instanceof Error?n.message:String(n),n}}function Ex(i){Pr.fitToContent({bbox:i.bbox,target:i.target,activeCam:i.activeCam,controls:i.controls,mode:i.mode,fov:i.fov,perspCam:i.perspCam,orthoCam:i.orthoCam})}function Tx(i,e){return Sx.build({activeCam:i.activeCam,controls:i.controls,target:i.target,mode:i.mode,perspCam:i.perspCam,orthoCam:i.orthoCam,bbox:i.bbox,ready:i._ready,loading:i._loading},e)}function wx(i,e=!1){i.loadToken++,i.unbindWheelRelay?.(),i.unbindWheelRelay=null,i.controls?.dispose(),i.controls=null,Yl.clearContent(i),Yl.revokeBlob(i);for(const t of i.lights)i.scene.remove(t);i.lights=[],i.renderer.dispose(),e&&i.renderer.getContext()?.getExtension?.("WEBGL_lose_context")?.loseContext?.(),i._ready=!1}const ki={runLoad:Mx,fitToContent:Ex,buildSnapshot:Tx,dispose:wx,pick:(i,e,t)=>fa.hit(i,e,t),setHoverAt:(i,e,t)=>fa.setHoverAt(i,e,t),clearHighlight:i=>fa.clearHighlight(i)},Ax=`precision highp float;
|
|
3871
|
+
precision highp int;
|
|
3872
|
+
precision mediump sampler2D;
|
|
3873
|
+
|
|
3874
|
+
uniform vec3 iResolution;
|
|
3875
|
+
uniform float iTime;
|
|
3876
|
+
uniform float iTimeDelta;
|
|
3877
|
+
uniform float iFrameRate;
|
|
3878
|
+
uniform int iFrame;
|
|
3879
|
+
uniform float iChannelTime[4];
|
|
3880
|
+
uniform vec3 iChannelResolution[4];
|
|
3881
|
+
uniform vec4 iMouse;
|
|
3882
|
+
uniform vec4 iDate;
|
|
3883
|
+
uniform float iSampleRate;
|
|
3884
|
+
uniform sampler2D iChannel0;
|
|
3885
|
+
uniform sampler2D iChannel1;
|
|
3886
|
+
uniform sampler2D iChannel2;
|
|
3887
|
+
uniform sampler2D iChannel3;
|
|
3888
|
+
uniform float uParam0;
|
|
3889
|
+
uniform float uParam1;
|
|
3890
|
+
uniform float uParam2;
|
|
3891
|
+
uniform float uParam3;
|
|
3892
|
+
/** Near / far caméra (0 dans sonic-shader standalone). */
|
|
3893
|
+
uniform float uNear;
|
|
3894
|
+
uniform float uFar;
|
|
3895
|
+
|
|
3896
|
+
out vec4 sonicFragColor;
|
|
3897
|
+
|
|
3898
|
+
/** Profondeur linéaire monde depuis une DepthTexture (0–1). */
|
|
3899
|
+
float sonicLinearDepth(float d) {
|
|
3900
|
+
float z = d * 2.0 - 1.0;
|
|
3901
|
+
float n = max(uNear, 1e-4);
|
|
3902
|
+
float f = max(uFar, n + 1e-4);
|
|
3903
|
+
return (2.0 * n * f) / (f + n - z * (f - n));
|
|
3904
|
+
}
|
|
3905
|
+
|
|
3906
|
+
`,Rx=`
|
|
3907
|
+
void main() {
|
|
3908
|
+
mainImage(sonicFragColor, gl_FragCoord.xy);
|
|
3909
|
+
}
|
|
3910
|
+
`,pf=`precision highp float;
|
|
3911
|
+
in vec3 position;
|
|
3912
|
+
void main() {
|
|
3913
|
+
gl_Position = vec4(position.xy, 0.0, 1.0);
|
|
3914
|
+
}
|
|
3915
|
+
`;function Cx(i,e){return Ax+(i?i+`
|
|
3916
|
+
`:"")+e+`
|
|
3917
|
+
`+Rx}function Px(i,e){return Cx(i,e)}class Kl extends Error{constructor(e,t,n=""){super(e),this.name="PostFxCompileError",this.pass=t,this.infoLog=n}}const Dx=["bufferA","bufferB","bufferC","bufferD","image"],Hn=(()=>{const i=new Uint8Array([0,0,0,255]),e=new dl(i,1,1);return e.needsUpdate=!0,e.colorSpace=Jt,e})();function Zl(i,e,t){if(t){const r=new bl(i,e);r.format=Qi,r.type=ui,r.minFilter=Wt,r.magFilter=Wt;const s=new jn(i,e,{minFilter:Nt,magFilter:Nt,format:ln,type:pn,depthTexture:r});return s.texture.colorSpace=Jt,s.texture.generateMipmaps=!1,s}const n=new jn(i,e,{minFilter:Nt,magFilter:Nt,format:ln,type:pn,depthBuffer:!1,stencilBuffer:!1});return n.texture.colorSpace=Jt,n.texture.generateMipmaps=!1,n}function Lx(i,e){return{targets:[Zl(i,e,!1),Zl(i,e,!1)],index:0}}function Jl(i){i.depthTexture?.dispose(),i.dispose()}class Ix{constructor(e){this.sceneRT=null,this.buffers=new Map,this.passes=new Map,this.channels=new Map,this.activePasses=[],this.quadScene=new ju,this.quadCam=new us(-1,1,1,-1,0,1),this.width=0,this.height=0,this.scale=1,this.urlTextures=new Map,this.loader=new vh,this.elementResolver=null,this.elementTextures=new Map,this.elementLastSeq=new Map,this.enabled=!1,this.renderer=e;const t=new as(2,2);this.quadMesh=new Yt(t,new gi),this.quadScene.add(this.quadMesh),this.quadCam.position.set(0,0,1),this.quadCam.lookAt(0,0,0)}get isEnabled(){return this.enabled}setElementResolver(e){this.elementResolver=e}setConfig(e){if(this.clearPasses(),!e?.sources.image.trim()){this.enabled=!1,this.disposeTargets();return}this.scale=Ba(e.scale),this.channels=e.channels;const t=e.sources;for(const n of Dx){const r=n==="image"?t.image:n==="bufferA"?t.bufferA:n==="bufferB"?t.bufferB:n==="bufferC"?t.bufferC:t.bufferD;if(r.trim())try{this.passes.set(n,this.compilePass(t.common,r,n)),this.activePasses.push(n)}catch(s){throw this.clearPasses(),this.enabled=!1,this.disposeTargets(),s instanceof Kl?s:new Kl(s instanceof Error?s.message:String(s),n)}}this.enabled=this.activePasses.includes("image"),this.enabled?this.width>0&&this.height>0&&this.ensureTargets(this.width,this.height):(this.clearPasses(),this.disposeTargets())}resize(e,t){const n=Math.max(1,Math.round(e*this.scale)),r=Math.max(1,Math.round(t*this.scale));n===this.width&&r===this.height&&this.sceneRT||(this.enabled?this.ensureTargets(n,r):(this.width=n,this.height=r))}render(e,t,n){if(this.enabled&&!this.sceneRT){const r=new Je;this.renderer.getDrawingBufferSize(r),r.x>=1&&r.y>=1&&this.ensureTargets(r.x,r.y)}if(!this.enabled||!this.sceneRT||this.width<1||this.height<1){this.renderer.setRenderTarget(null),this.renderer.render(e,t);return}this.renderer.setRenderTarget(this.sceneRT),this.renderer.clear(),this.renderer.render(e,t),this.updateElementTextures();for(const r of this.activePasses)r!=="image"&&this.drawPass(r,n,!1);this.drawPass("image",n,!0)}dispose(){this.clearPasses(),this.disposeTargets();for(const e of this.urlTextures.values())e.dispose();this.urlTextures.clear();for(const e of this.elementTextures.values())e.dispose();this.elementTextures.clear(),this.quadMesh.geometry.dispose(),this.quadMesh.material.dispose()}compilePass(e,t,n){const r=Px(e,t),s={iResolution:{value:new $(1,1,1)},iTime:{value:0},iTimeDelta:{value:0},iFrameRate:{value:60},iFrame:{value:0},iChannelTime:{value:new Float32Array(4)},iChannelResolution:{value:new Float32Array(12)},iMouse:{value:new dt},iDate:{value:new dt},iSampleRate:{value:44100},iChannel0:{value:Hn},iChannel1:{value:Hn},iChannel2:{value:Hn},iChannel3:{value:Hn},uParam0:{value:0},uParam1:{value:0},uParam2:{value:0},uParam3:{value:0},uNear:{value:0},uFar:{value:0}},a=new Wm({glslVersion:Bo,vertexShader:pf,fragmentShader:r,uniforms:s,depthTest:!1,depthWrite:!1,toneMapped:!1,side:yn}),o=this.validateGlsl(r,n);if(o)throw a.dispose(),new Kl(`Compile error (${n}): ${o}`,n,o);return{material:a,uniforms:s}}validateGlsl(e,t){const n=this.renderer.getContext();if(!n)return null;const r=n.createShader(n.VERTEX_SHADER),s=n.createShader(n.FRAGMENT_SHADER);if(!r||!s)return"Unable to create shader";n.shaderSource(r,`#version 300 es
|
|
3918
|
+
${pf}`),n.shaderSource(s,`#version 300 es
|
|
3919
|
+
${e}`),n.compileShader(r),n.compileShader(s);let a="";return n.getShaderParameter(r,n.COMPILE_STATUS)||(a+=n.getShaderInfoLog(r)||"vertex compile failed"),n.getShaderParameter(s,n.COMPILE_STATUS)||(a+=n.getShaderInfoLog(s)||"fragment compile failed"),n.deleteShader(r),n.deleteShader(s),a.trim()||null}ensureTargets(e,t){const n=Math.max(1,Math.round(e)),r=Math.max(1,Math.round(t));this.disposeTargets(),this.sceneRT=Zl(n,r,!0);for(const s of this.activePasses)s!=="image"&&this.buffers.set(s,Lx(n,r));this.width=n,this.height=r}disposeTargets(){this.sceneRT&&(Jl(this.sceneRT),this.sceneRT=null);for(const e of this.buffers.values())Jl(e.targets[0]),Jl(e.targets[1]);this.buffers.clear()}clearPasses(){for(const e of this.passes.values())e.material.dispose();this.passes.clear(),this.activePasses=[]}drawPass(e,t,n){const r=this.passes.get(e);if(!r)return;const s=this.channels.get(e)||[{kind:"scene"},{kind:"none"},{kind:"none"},{kind:"none"}],a=r.uniforms.iChannelResolution.value;for(let l=0;l<4;l++){const c=this.resolveChannel(e,s[l]),h=r.uniforms[`iChannel${l}`];h.value=c;const u=c.image,f=c.image?.width||u?.width||this.width||1,d=c.image?.height||u?.height||this.height||1;let _=f,b=d;if(c===this.sceneRT?.texture)_=this.width,b=this.height;else if(c===this.sceneRT?.depthTexture)_=this.width,b=this.height;else for(const[g,m]of this.buffers)if(c===m.targets[0].texture||c===m.targets[1].texture){_=this.width,b=this.height;break}a[l*3]=_,a[l*3+1]=b,a[l*3+2]=1}r.uniforms.iResolution.value.set(this.width,this.height,1),r.uniforms.iTime.value=t.time,r.uniforms.iTimeDelta.value=t.timeDelta,r.uniforms.iFrameRate.value=t.timeDelta>0?1/t.timeDelta:60,r.uniforms.iFrame.value=t.frame,r.uniforms.iMouse.value.set(t.mouse[0],t.mouse[1],t.mouse[2],t.mouse[3]);const o=new Date;if(r.uniforms.iDate.value.set(o.getFullYear(),o.getMonth(),o.getDate(),o.getHours()*3600+o.getMinutes()*60+o.getSeconds()+o.getMilliseconds()*.001),r.uniforms.uParam0.value=t.params[0],r.uniforms.uParam1.value=t.params[1],r.uniforms.uParam2.value=t.params[2],r.uniforms.uParam3.value=t.params[3],r.uniforms.uNear.value=t.near,r.uniforms.uFar.value=t.far,this.quadMesh.material=r.material,n)this.renderer.setRenderTarget(null);else{const l=this.buffers.get(e);if(!l)return;const c=1-l.index;this.renderer.setRenderTarget(l.targets[c]),this.renderer.clear()}if(this.renderer.render(this.quadScene,this.quadCam),!n){const l=this.buffers.get(e);l&&(l.index=1-l.index)}}resolveChannel(e,t){if(t.kind==="none")return Hn;if(t.kind==="scene")return this.sceneRT?.texture??Hn;if(t.kind==="depth")return this.sceneRT?.depthTexture??Hn;if(t.kind==="url")return this.getUrlTexture(t.url);if(t.kind==="element")return this.getElementTexture(t.key)??Hn;const n=t.kind==="self"?e==="image"?null:e:t.buffer;if(!n)return Hn;const r=this.buffers.get(n);return r?r.targets[r.index].texture:Hn}getUrlTexture(e){let t=this.urlTextures.get(e);return t||(t=this.loader.load(e),t.colorSpace=Jt,t.flipY=!0,this.urlTextures.set(e,t),t)}getElementTexture(e){const t=this.elementResolver?.(e)??null;if(!t)return null;let n=null,r=-1;if(Ld(t))n=t.getFrameCanvas(),r=t.frameSeq;else if(t instanceof HTMLCanvasElement)n=t,r=(this.elementLastSeq.get(e)??0)+1;else if(t instanceof HTMLVideoElement){if(t.readyState<2)return this.elementTextures.get(e)??null;let o=this.elementTextures.get(e);return o||(o=new fh(t),o.colorSpace=Jt,this.elementTextures.set(e,o)),o.needsUpdate=!0,o}else if(t instanceof HTMLImageElement){let o=this.urlTextures.get(e);return!o&&t.complete&&t.naturalWidth>0&&(o=new Dt(t),o.needsUpdate=!0,o.colorSpace=Jt,o.flipY=!0,this.urlTextures.set(e,o)),o??null}if(!n||n.width<1)return this.elementTextures.get(e)??null;let s=this.elementTextures.get(e);return s?s.image!==n&&(s.image=n):(s=new Gm(n),s.colorSpace=Jt,s.flipY=!1,this.elementTextures.set(e,s)),this.elementLastSeq.get(e)!==r&&(s.needsUpdate=!0,this.elementLastSeq.set(e,r)),s}updateElementTextures(){for(const[e,t]of this.elementTextures){if(t instanceof fh){t.needsUpdate=!0;continue}this.getElementTexture(e)}}}function Ux(i,e){i.dprMax=Math.max(1,e||2)}function Nx(i,e){i.renderer.toneMappingExposure=Number.isFinite(e)?e:Ia}function Ox(i,e){i.fov=Number.isFinite(e)&&e>0?e:Ms,i.perspCam.fov=i.fov,i.perspCam.updateProjectionMatrix()}function Fx(i,e){i.fitEnabled=e}function kx(i,e){i.controls&&(i.controls.autoRotate=e)}function Bx(i,e){if(!i.controls)return;const t=Number.isFinite(e)?Math.max(0,e):.08;i.controls.enableDamping=t>0,i.controls.dampingFactor=t>0?t:.08}function zx(i){if(!i.controls)return;i.controls.autoRotate=!1;const e=i.controls.enableDamping,t=i.controls.dampingFactor;i.controls.enableDamping=!1,i.controls.update(),i.controls.enableDamping=e,i.controls.dampingFactor=t}function Hx(i,e){i.limits=Pr.mergeLimits(i.limits,e),Pr.applyLimitsToControls(i.controls,i.limits)}function Vx(i,e,t,n){Pr.setSpherical({activeCam:i.activeCam,controls:i.controls,target:i.target,limits:i.limits},e,t,n)}const Cn={setDprMax:Ux,setExposure:Nx,setFov:Ox,setFit:Fx,setAutoRotate:kx,setDamping:Bx,stopMotion:zx,setOrbitLimits:Hx,setOrbitSpherical:Vx},mf={type:"change"},Ql={type:"start"},gf={type:"end"},pa=new or,_f=new vi,Gx=Math.cos(70*Su.DEG2RAD),kt=new $,cn=2*Math.PI,Et={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},ec=1e-6;class Wx extends Eg{constructor(e,t=null){super(e,t),this.state=Et.NONE,this.target=new $,this.cursor=new $,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:$i.ROTATE,MIDDLE:$i.DOLLY,RIGHT:$i.PAN},this.touches={ONE:qi.ROTATE,TWO:qi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new $,this._lastQuaternion=new In,this._lastTargetPosition=new $,this._quat=new In().setFromUnitVectors(e.up,new $(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new Eh,this._sphericalDelta=new Eh,this._scale=1,this._panOffset=new $,this._rotateStart=new Je,this._rotateEnd=new Je,this._rotateDelta=new Je,this._panStart=new Je,this._panEnd=new Je,this._panDelta=new Je,this._dollyStart=new Je,this._dollyEnd=new Je,this._dollyDelta=new Je,this._dollyDirection=new $,this._mouse=new Je,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=$x.bind(this),this._onPointerDown=Xx.bind(this),this._onPointerUp=qx.bind(this),this._onContextMenu=eb.bind(this),this._onMouseWheel=Kx.bind(this),this._onKeyDown=Zx.bind(this),this._onTouchStart=Jx.bind(this),this._onTouchMove=Qx.bind(this),this._onMouseDown=jx.bind(this),this._onMouseMove=Yx.bind(this),this._interceptControlDown=tb.bind(this),this._interceptControlUp=nb.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(mf),this.update(),this.state=Et.NONE}update(e=null){const t=this.object.position;kt.copy(t).sub(this.target),kt.applyQuaternion(this._quat),this._spherical.setFromVector3(kt),this.autoRotate&&this.state===Et.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=cn:n>Math.PI&&(n-=cn),r<-Math.PI?r+=cn:r>Math.PI&&(r-=cn),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(kt.setFromSpherical(this._spherical),kt.applyQuaternion(this._quatInverse),t.copy(this.target).add(kt),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=kt.length();a=this._clampDistance(o*this._scale);const l=o-a;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const o=new $(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new $(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),a=kt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(pa.origin.copy(this.object.position),pa.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(pa.direction))<Gx?this.object.lookAt(this.target):(_f.setFromNormalAndCoplanarPoint(this.object.up,this.target),pa.intersectPlane(_f,this.target))))}else if(this.object.isOrthographicCamera){const a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>ec||8*(1-this._lastQuaternion.dot(this.object.quaternion))>ec||this._lastTargetPosition.distanceToSquared(this.target)>ec?(this.dispatchEvent(mf),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?cn/60*this.autoRotateSpeed*e:cn/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){kt.setFromMatrixColumn(t,0),kt.multiplyScalar(-e),this._panOffset.add(kt)}_panUp(e,t){this.screenSpacePanning===!0?kt.setFromMatrixColumn(t,1):(kt.setFromMatrixColumn(t,0),kt.crossVectors(this.object.up,kt)),kt.multiplyScalar(e),this._panOffset.add(kt)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;kt.copy(r).sub(this.target);let s=kt.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(s/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(cn*this._rotateDelta.x/t.clientHeight),this._rotateUp(cn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(cn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-cn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(cn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-cn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(cn*this._rotateDelta.x/t.clientHeight),this._rotateUp(cn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Je,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function Xx(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i)))}function $x(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function qx(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(gf),this.state=Et.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function jx(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case $i.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=Et.DOLLY;break;case $i.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Et.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Et.ROTATE}break;case $i.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Et.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Et.PAN}break;default:this.state=Et.NONE}this.state!==Et.NONE&&this.dispatchEvent(Ql)}function Yx(i){switch(this.state){case Et.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case Et.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case Et.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function Kx(i){this.enabled===!1||this.enableZoom===!1||this.state!==Et.NONE||(i.preventDefault(),this.dispatchEvent(Ql),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(gf))}function Zx(i){this.enabled!==!1&&this._handleKeyDown(i)}function Jx(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case qi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=Et.TOUCH_ROTATE;break;case qi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=Et.TOUCH_PAN;break;default:this.state=Et.NONE}break;case 2:switch(this.touches.TWO){case qi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=Et.TOUCH_DOLLY_PAN;break;case qi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=Et.TOUCH_DOLLY_ROTATE;break;default:this.state=Et.NONE}break;default:this.state=Et.NONE}this.state!==Et.NONE&&this.dispatchEvent(Ql)}function Qx(i){switch(this._trackPointer(i),this.state){case Et.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case Et.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case Et.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case Et.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=Et.NONE}}function eb(i){this.enabled!==!1&&i.preventDefault()}function tb(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function nb(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function ib(i,e){i.mode=e;const t=i.activeCam.position.clone(),n=i.target.clone();i.activeCam=e===vn.Ortho?i.orthoCam:i.perspCam,i.activeCam.position.copy(t),i.controls?.dispose(),i.controls=new Wx(i.activeCam,i.canvas),i.controls.enableDamping=!0,i.controls.dampingFactor=.08,i.controls.target.copy(n),i.controls.enablePan=!0,Pr.applyLimitsToControls(i.controls,i.limits),i.controls.update(),i.unbindWheelRelay||(i.unbindWheelRelay=Pr.bindWheelPageScrollRelay(i.canvas,()=>i.controls))}function rb(i,e,t){const n=Math.max(1,e),r=Math.max(1,t),s=Math.min(typeof window<"u"&&window.devicePixelRatio||1,i.dprMax);i.renderer.setPixelRatio(s),i.renderer.setSize(n,r,!1);const a=n/r;i.perspCam.aspect=a,i.perspCam.updateProjectionMatrix();const o=1.2;i.orthoCam.left=-o*a,i.orthoCam.right=o*a,i.orthoCam.top=o,i.orthoCam.bottom=-o,i.orthoCam.updateProjectionMatrix()}const vf={applyCameraMode:ib,resize:rb};class sb{constructor(e){this.controls=null,this.unbindWheelRelay=null,this.content=null,this.loader=new Ry,this.loadToken=0,this.blobUrl=null,this.bbox=new Un,this.target=new $,this._ready=!1,this._loading=!1,this.lastError=null,this.raycaster=new Mg,this.pointerNdc=new Je,this.highlighted=null,this.prevEmissive=new et,this.prevEmissiveIntensity=0,this.lastCssW=1,this.lastCssH=1,this.damping=.08,this.postFrame={time:0,timeDelta:1/60,frame:0,mouse:[0,0,0,0],params:[0,0,0,0],near:.1,far:100},this.asTuneCtx=()=>this,this.asViewCtx=()=>this,this.asOpsCtx=()=>this;const t=fx(e);this.scene=t.scene,this.renderer=t.renderer,this.canvas=t.canvas,this.perspCam=t.perspCam,this.orthoCam=t.orthoCam,this.activeCam=t.activeCam,this.root=t.root,this.lights=t.lights,this.dprMax=t.dprMax,this.mode=t.mode,this.fov=t.fov,this.fitEnabled=t.fitEnabled,this.limits=t.limits,this.postFx=new Ix(this.renderer),this.applyCameraMode(this.mode),t.autoRotate&&this.setAutoRotate(!0),this.canvas,this.perspCam,this.orthoCam,this.root,this.content,this.lights,this.loader,this.loadToken,this.blobUrl,this.dprMax,this.fov,this.fitEnabled,this.limits,this.bbox,this.target,this.raycaster,this.pointerNdc,this.highlighted,this.prevEmissive,this.prevEmissiveIntensity,this.unbindWheelRelay}get ready(){return this._ready}get loading(){return this._loading}get error(){return this.lastError}get isLost(){return this.renderer.getContext()?.isContextLost?.()??!1}get hasPostFx(){return this.postFx.isEnabled}setDprMax(e){Cn.setDprMax(this.asTuneCtx(),e)}setExposure(e){Cn.setExposure(this.asTuneCtx(),e)}setFov(e){Cn.setFov(this.asTuneCtx(),e)}setFit(e){Cn.setFit(this.asTuneCtx(),e)}setAutoRotate(e){Cn.setAutoRotate(this.asTuneCtx(),e)}setDamping(e){this.damping=Number.isFinite(e)?Math.max(0,e):.08,Cn.setDamping(this.asTuneCtx(),this.damping)}stopMotion(){Cn.setAutoRotate(this.asTuneCtx(),!1),Cn.stopMotion(this.asTuneCtx())}setOrbitLimits(e){Cn.setOrbitLimits(this.asTuneCtx(),e)}setOrbitSpherical(e,t,n){Cn.setOrbitSpherical(this.asTuneCtx(),e,t,n)}applyCameraMode(e){vf.applyCameraMode(this.asViewCtx(),e),Cn.setDamping(this.asTuneCtx(),this.damping)}resize(e,t){this.lastCssW=e,this.lastCssH=t,vf.resize(this.asViewCtx(),e,t);const n=Math.min(typeof window<"u"&&window.devicePixelRatio||1,this.dprMax);this.postFx.resize(e*n,t*n)}async load(e){return ki.runLoad(this.asOpsCtx(),e)}fitToContent(){ki.fitToContent(this.asOpsCtx())}setPostConfig(e){this.postFx.setConfig(e),e&&this.lastCssW>0&&this.resize(this.lastCssW,this.lastCssH)}setPostElementResolver(e){this.postFx.setElementResolver(e)}setPostFrame(e){Object.assign(this.postFrame,e);const t=this.activeCam;"near"in t&&"far"in t&&(this.postFrame.near=t.near,this.postFrame.far=t.far)}render(){this.controls?.update(),this.postFx.isEnabled?this.postFx.render(this.scene,this.activeCam,this.postFrame):this.renderer.render(this.scene,this.activeCam)}pick(e,t){return ki.pick(this.asOpsCtx(),e,t)}setHoverAt(e,t){return ki.setHoverAt(this.asOpsCtx(),e,t)}clearHighlight(){ki.clearHighlight(this.asOpsCtx())}snapshot(e){return ki.buildSnapshot(this.asOpsCtx(),e)}dispose(e=!1){this.postFx.dispose(),ki.dispose(this.asOpsCtx(),e)}}function ab(i){return i.renderRoot?.querySelector("canvas")??null}async function yf(i){if(i.releasing||i.runtime)return;const e=ab(i);if(e)try{i.runtime=new sb({canvas:e,dprMax:i.dprMax,camera:Ut.cameraMode(i.camera),fov:i.fov,exposure:i.exposure,autoRotate:!1,fit:i.fit,minDistance:i.minDistance,maxDistance:i.maxDistance,minPolar:Dn.degToRad(i.minPolar),maxPolar:Dn.degToRad(i.maxPolar)}),i.runtime.setDamping(i.damping),Dn.applyOrbitLimits(i),bf(i),await Dn.run(i)}catch(t){Dn.emitError(i,t)}}function xf(i){i.loadToken++,Gn.stopLoop(i),i.ready=!1,i.releasing=!0,i.runtime?.dispose(!1),i.runtime=null,i.releasing=!1}function ob(i){const e=Es(i);if(!i.inView&&i.releaseOffscreen&&!e){xf(i);return}if((!i.runtime||i.runtime.isLost)&&(i.inView||e||!i.releaseOffscreen)){yf(i);return}i.syncPlayback()}function bf(i){if(!i.runtime)return;const e=i.getBoundingClientRect(),t=Math.max(e.width,i.clientWidth,1),n=Math.max(e.height,i.clientHeight,1);i.runtime.resize(t,n),i.ready&&i.runtime.render()}const Bi={ensureRuntime:yf,releaseRuntime:xf,syncVisibility:ob,syncSize:bf},tc="1";function lb(i){const e=i.trim();if(!e)return!1;try{const t=new URL(e,"https://example.invalid/");return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="blob:"}catch{return!1}}let ri=class Zt{static getLanguage(){const e=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||e}static getCookies(){return document.cookie.split(";").reduce((e,t)=>{const n=t.indexOf("=");return e[t.substring(0,n).trim()]=t.substring(n+1),e},{})}static nextComposedAncestor(e){return e instanceof Element&&e.assignedSlot?e.assignedSlot:e.parentNode||e.host||null}static everyAncestors(e,t){let n=e;for(;n;){if(!t(n))return;n=n.parentNode||n.host}}static overflowMatches(e,t){return t.includes(e.overflowY)||t.includes(e.overflowX)}static findAncestorByOverflow(e,t){let n=e;for(;n;){if(n instanceof Element&&n.nodeType===1){const r=window.getComputedStyle(n);if(Zt.overflowMatches(r,t))return n}n=Zt.nextComposedAncestor(n)}return null}static getScrollableAncestor(e){return Zt.findAncestorByOverflow(e,["auto","scroll","hidden","overlay"])}static getScrollingAncestor(e){return Zt.findAncestorByOverflow(e,["auto","scroll","overlay"])}static scopeAttributeNames(e){const t=e.toLowerCase();return t===e?[e]:[e,t]}static readScopeAttributeOnElement(e,t){for(const n of Zt.scopeAttributeNames(t))if(e.hasAttribute(n))return e.getAttribute(n)??"";return null}static getAncestorAttributeValue(e,t){if(!e)return null;let n=e;for(;n;){if(n instanceof HTMLElement){const s=Zt.readScopeAttributeOnElement(n,t);if(s!=null)return s}const r=n.parentNode||n.host;if(!r)break;n=r}return null}static getApiConfiguration(e){const t=Zt.getAncestorAttributeValue(e,"token"),n=Zt.getAncestorAttributeValue(e,"addHTTPResponse")!=null,r=Zt.getAncestorAttributeValue(e,"serviceURL");let s=null,a=null;const o=Zt.getAncestorAttributeValue(e,"tokenProvider"),l=Zt.getAncestorAttributeValue(e,"eventsApiToken");t||(s=Zt.getAncestorAttributeValue(e,"userName"),a=Zt.getAncestorAttributeValue(e,"password"));const c=Zt.getAncestorAttributeValue(e,"credentials")||void 0,h=e.getAttribute("cache"),u=e.hasAttribute("blockUntilDone"),f=e.hasAttribute("keepAlive");return{serviceURL:r,token:t,userName:s,password:a,authToken:l,tokenProvider:o,addHTTPResponse:n,credentials:c,cache:h,blockUntilDone:u,keepAlive:f}}static getClosestElement(e,t){let n=e;for(;n&&!(n.nodeName&&n.nodeName.toLowerCase()===t);){const r=n.parentNode||n.host;if(!r){n=null;break}n=r}return n?.nodeName?n:null}static getClosestForm(e){return Zt.getClosestElement(e,"form")}static getAncestorsByTagNames(e,t){const n=new Set(t.map(a=>a.toLowerCase())),r=[];let s=e.parentNode||e.host;for(;s;)s instanceof Element&&n.has(s.tagName.toLowerCase())&&r.push(s),s=s.parentNode||s.host;return r}static getAncestorsBySelectors(e,t){const n=[];let r=e.parentNode||e.host;for(;r;){if(r instanceof Element)for(const s of t)try{if(r.matches(s)){n.push(r);break}}catch{}r=r.parentNode||r.host}return n}static async loadJS(e){if(!lb(e))return!1;const t=typeof document<"u"?new URL(e,document.baseURI).href:e,n=Array.from(document.scripts).find(s=>s.src===t);if(n)return n.dataset.concordeLoaded===tc?!0:new Promise(s=>{let a=!1;const o=c=>{a||(a=!0,c&&(n.dataset.concordeLoaded=tc),s(c))};n.addEventListener("load",()=>o(!0),{once:!0}),n.addEventListener("error",()=>o(!1),{once:!0});const l=n.readyState;if(l==="complete"||l==="loaded"){o(!0);return}Promise.resolve().then(()=>{Promise.resolve().then(()=>{a||o(!0)})})});const r=/\.es\.js(\?|#|$)/.test(e)||/[?&]module(?:&|=|$)/.test(e);return new Promise(s=>{const a=document.createElement("script");a.src=e,r&&(a.type="module"),a.onload=()=>{a.dataset.concordeLoaded=tc,s(!0)},a.onerror=()=>s(!1),document.head.appendChild(a)})}static async loadCSS(e){return new Promise(t=>{const n=document.createElement("link");n.type="text/css",n.rel="stylesheet",n.href=e,n.onload=()=>t(!0),n.onerror=()=>t(!0),document.head.appendChild(n)})}};function cb(i,e){"fov"in e&&(i.fov=Ut.toNum(e.fov,i.fov)),"exposure"in e&&(i.exposure=Ut.toNum(e.exposure,i.exposure)),"minDistance"in e&&(i.minDistance=Ut.toNum(e.minDistance,i.minDistance)),"maxDistance"in e&&(i.maxDistance=Ut.toNum(e.maxDistance,i.maxDistance)),"minPolar"in e&&(i.minPolar=Ut.toNum(e.minPolar,i.minPolar)),"maxPolar"in e&&(i.maxPolar=Ut.toNum(e.maxPolar,i.maxPolar)),"autoRotate"in e&&(i.autoRotate=Ut.isFormFlagOn(e.autoRotate)),"camera"in e&&typeof e.camera=="string"&&(i.camera=Ut.cameraMode(e.camera))}function ub(i,e){let t=!1;if("asset"in e){const n=Ut.asset(e.asset);n&&(i.asset=n,t=!0)}return"src"in e&&typeof e.src=="string"&&!("asset"in e)&&i.src!==e.src&&(i.src=e.src,t=!0),t}function hb(i){return"minDistance"in i||"maxDistance"in i||"minPolar"in i||"maxPolar"in i||"camera"in i}function fb(i,e){i.runtime&&("exposure"in e&&i.runtime.setExposure(i.exposure),"fov"in e&&i.runtime.setFov(i.fov),"camera"in e&&i.runtime.applyCameraMode(Ut.cameraMode(i.camera)),hb(e)&&Dn.applyOrbitLimits(i),"autoRotate"in e&&Gn.syncAutoRotate(i))}const nc={applyScalars:cb,applyAsset:ub,pushToRuntime:fb};function db(i,e){return i?Math.abs(i.yaw-e.yaw)>La||Math.abs(i.pitch-e.pitch)>La||Math.abs(i.distance-e.distance)>La:!0}function pb(i,e){const t=i.runtime.snapshot({time:0,frame:i.frame,hovering:i.hovering?1:0,pointerX:i.pointerX,pointerY:i.pointerY});return{yaw:"yaw"in e?Ut.toNum(e.yaw,t.yaw):t.yaw,pitch:"pitch"in e?Ut.toNum(e.pitch,t.pitch):t.pitch,distance:"distance"in e?Ut.toNum(e.distance,t.distance):t.distance}}function Sf(i,e){if(!i.runtime||!("distance"in e||"yaw"in e||"pitch"in e))return;const t=pb(i,e),n=i.lastFormOrbit;db(n,t)&&(i.lastFormOrbit=t,i.autoRotate&&n&&(i.autoRotate=!1,Gn.syncAutoRotate(i)),i.runtime.setOrbitSpherical(t.yaw,t.pitch,t.distance),i.runtime.render())}function mb(i,e){nc.applyScalars(i,e);const t=nc.applyAsset(i,e);if(!i.runtime){t&&Dn.run(i);return}nc.pushToRuntime(i,e),Sf(i,e),Hr.applyFormPost(i,e),t&&Dn.run(i)}const gb={applyFormParams:mb,applyFormOrbit:Sf};function Mf(i,e){const t=e?.trim();return t||ri.getAncestorAttributeValue(i,"dataProvider")||ri.getAncestorAttributeValue(i,"formDataProvider")||""}function _b(i,e,t){const n=e?.trim();return n||Mf(i,t)}const ic={resolveFormProviderId:Mf,resolveOutProviderId:_b,asset:jc,formParams:gb};let vb=class{static async queueTaskPromise(){return new Promise(e=>{window.queueMicrotask(()=>e(null))})}static async delayPromise(e){return new Promise(t=>{setTimeout(t,e)})}},Ef="sonic";typeof __SONIC_PREFIX__<"u"&&(Ef=__SONIC_PREFIX__);let Tf=Ef.replace(/-([a-z])/g,i=>i[1].toUpperCase());const yb=Tf.charAt(0).toUpperCase()+Tf.slice(1);let xb=class Vi{static areEqual(e,t){return e.length===t.length?e.every((n,r)=>n===t[r]):!1}static from2d(e){return{to1D:()=>{let t=[];return e.forEach(n=>t=t.concat(n)),this.from(t)}}}static from(e){return{get:()=>e||[],everyItem:()=>({has:()=>({same:()=>({value:()=>({forKey:t=>{if(e.length<1)return!0;const n=(e[0]||{})[t];return e.every(r=>(r||{})[t]==n)}})})}),value:()=>({forKey:t=>Vi.from(e.map(n=>n[t]))}),copy:()=>({fromKey:t=>({toKey:n=>{e.forEach(r=>{r[n]=Array.isArray(r[t])?[...r[t]]:typeof r[t]=="object"&&r[t]!=null?{...r[t]}:r[t]})}})})}),map:t=>Vi.from(e.map(t)),filter:t=>Vi.from(e.filter(t)),find:t=>e.find(t),some:t=>e.some(t),every:t=>e.every(t),group:()=>({byKey:t=>{const n=[],r=new Map;for(const s of e){const a=s[t];if(!r.has(a)){const o=n.length;r.set(a,o);const l={items:[]};l[t]=a,n.push(l)}n[r.get(a)].items.push(s)}return Vi.from(n)}}),without:()=>({duplicates:()=>({forKey:t=>{const n=[...new Set(e.map(r=>r[t]))];return Vi.from(n.map(r=>e.find(s=>s[t]==r)))}}),itemsIn:t=>({havingSameValue:()=>({forKey:n=>{const r=(s,a)=>o=>s[a]!=o[a];return Vi.from(e.filter(s=>t.every(r(s,n))))}})})})}}},rc=class{static ucFirst(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.substring(1)}static minutesDuration(e,t="",n="long"){t||(t=ri.getLanguage());const r=(c,h)=>[Math.floor(c/h),c%h];function s(c,h,u){return new Intl.NumberFormat(c,{style:"unit",unit:h,unitDisplay:u}).format}const[a,o]=r(e,60),l=[];return a&&l.push(s(t,"hour",n)(a)),o&&l.push(s(t,"minute",n)(o)),new Intl.ListFormat(t,{style:"long",type:"conjunction"}).format(l)}static js(e){try{return Function("return "+e)()}catch{return""}}};class wf{constructor(e){this.path=e}toString(){return this.path}}function Af(i){return new Proxy(i,{get(e,t){if(t==="path")return e.path;if(t==="toString")return e.toString.bind(e);if(t===Symbol.toStringTag)return"DataProviderKey";if(typeof t=="symbol")return e[t];const n=e.path?`${e.path}.${String(t)}`:String(t);return Af(new wf(n))}})}const bb=/\$\{|\{\$/;function Sb(i){return bb.test(i)}function Mb(i){const e=i;if(Sb(e))throw new Error("Static publisher path required for get/set/dp. Use @subscribe, @publish, or @handle for dynamic DataProviderKey paths.");return e}const ma=function(i){return this instanceof ma?Af(new wf(i)):new ma(i)};let ga=class si{static shallowEqual(e,t,n=!0){const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length&&n)return!1;for(const a of r){const o=e[a],l=t[a];if(n?o!==l:o!=l)return!1}return!0}static deepEqual(e,t,n=!0){const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length&&n)return!1;for(const a of r){const o=e[a],l=t[a],c=si.isObject(o)&&si.isObject(l),h=n?o!==l:o!=l;if(c&&!si.deepEqual(o,l)||!c&&h)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}static isUndefindOrNull(e){return e==null}static isEmpty(e){return si.isUndefindOrNull(e)?!0:Object.keys(e).length===0}static traverse(e,t,n=!1){for(const r of t){const s=e[r];if(s===void 0)return;n&&si.isObject(s)?e=Object.assign(Array.isArray(s)?[]:{},e,s):e=e[r]}return e}static traverseDotNotation(e,t,n=!1){return si.traverse(e,t.split("."),n)}static getURLSearchArray(e,t=""){let n=[];for(let r in e){const s=e[r];t&&(r=t+"["+r+"]"),si.isObject(s)?n=[...n,...this.getURLSearchArray(s,r)]:n.push(`${r}=${s}`)}return n}static getURLSearchString(e){return si.getURLSearchArray(e,"").join("&")}};ga.traverseDotNotation;function Eb(i){return!1}function _a(i){return Object.prototype.hasOwnProperty.call(i,"__value")}function xi(i){return typeof i=="object"&&i!==null}let Dr="sonic";typeof __SONIC_PREFIX__>"u"&&(Dr="sonic");const sc=Dr=="sonic"?"publisher-proxies-data":Dr+"-publisher-proxies-data",Si=class Si{constructor(e,t,n){for(this._proxies_=new Map,this._is_savable_=!1,this._expiration_delay_=1e3*60*60*12,this._invalidate_on_page_show_=!1,this._invalidateListeners_=new Set,this._formInvalidateListeners_=new Set,this._assignListeners_=new Set,this._mutationListeners_=new Set,this._fillListeners_=new Set,this._templateFillListeners_=new Set,this._lockInternalMutationPublishing_=!1,this._instanceCounter_=0,this._assignmentId_=0,this._value_=e,this.parent=t||null,this._parentKey_=n,this.root=this,this._instanceCounter_=0;this.root.parent;)this.root=this.root.parent}delete(){for(const e in this._proxies_.keys())e!="_parent_"&&this._proxies_.get(e)?.delete();this._invalidateListeners_.clear(),this._formInvalidateListeners_.clear(),this._assignListeners_.clear(),this._mutationListeners_.clear(),this._fillListeners_.clear(),this._templateFillListeners_.clear(),this._proxies_.clear(),Si.instances.delete(this._instanceCounter_)}hasListener(){return this._templateFillListeners_.size>0||this._assignListeners_.size>0||this._invalidateListeners_.size>0||this._formInvalidateListeners_.size>0||this._mutationListeners_.size>0||this._fillListeners_.size>0}_publishInternalMutation_(e=!1){if(this._mutationListeners_.forEach(t=>t()),this._is_savable_&&!Xt.changed){Xt.changed=!0,Xt.saveId++;const t=Xt.saveId;setTimeout(()=>Xt.getInstance().saveToLocalStorage(t),1e3)}e||this.parent&&this.parent._publishInternalMutation_()}async _publishAssignement_(e=!1){if(this._assignmentId_++,this._assignmentId_!==this._assignmentId_)return;const n=this.get();this._assignListeners_.forEach(r=>{r(n)}),this._publishInternalMutation_(e)}_publishInvalidation_(){this._invalidateListeners_.forEach(e=>e())}_publishFormInvalidation_(){this._formInvalidateListeners_.forEach(e=>e())}_publishDynamicFilling_(e,t){this._fillListeners_.forEach(n=>{n[e]!==t&&(n[e]=t)}),this._publishTemplateFilling_(e,t)}_publishTemplateFilling_(e,t){this._templateFillListeners_.forEach(n=>{const r=Object.getOwnPropertyDescriptor(n,e);r&&!r.set&&!r.writable||(n.propertyMap&&n.propertyMap[e]&&(e=n.propertyMap[e]),typeof n[e]<"u"&&n[e]!==t&&(n[e]=t))})}onAssign(e,t=!0){typeof e=="function"&&(this._assignListeners_.has(e)||(this._assignListeners_.add(e),t&&e(this.get())))}offAssign(e){this._assignListeners_.delete(e)}onInvalidate(e){typeof e=="function"&&this._invalidateListeners_.add(e)}offInvalidate(e){typeof e=="function"&&this._invalidateListeners_.delete(e)}invalidate(){this._publishInvalidation_()}onFormInvalidate(e){typeof e=="function"&&this._formInvalidateListeners_.add(e)}offFormInvalidate(e){typeof e=="function"&&this._formInvalidateListeners_.delete(e)}invalidateForm(){this._publishFormInvalidation_()}onInternalMutation(e){typeof e=="function"&&(this._mutationListeners_.add(e),e())}offInternalMutation(e){typeof e=="function"&&this._mutationListeners_.delete(e)}startTemplateFilling(e){if(this._templateFillListeners_.add(e),typeof this._value_=="object")for(const t in this._value_){let n=t;const r=this._value_[t];e.propertyMap&&e.propertyMap[t]&&(n=e.propertyMap[t]),typeof e[t]<"u"&&e[t]!==r&&(e[n]=r)}}stopTemplateFilling(e){this._templateFillListeners_.delete(e)}startDynamicFilling(e){this._fillListeners_.add(e);for(const t in this._value_){const n=this._value_[t];e[t]!==n&&(e[t]=n)}}stopDynamicFilling(e){this._fillListeners_.delete(e)}set(e,t=!1){if(this._value_===e||xi(this._value_)&&xi(e)&&e&&_a(this._value_)&&_a(e)&&this._value_.__value===e.__value||!xi(e)&&e===this._value_.__value)return!0;this._value_=xi(e)?e:{__value:e},this._cachedGet_=void 0;const n=_a(this._value_);if(this._parentKey_&&this.parent){const r=_a(this._value_)?this._value_.__value:this._value_;if(this.parent?.get()==null&&this.parent?.get()==null)if(isNaN(Number(this._parentKey_)))this.parent.set({[this._parentKey_]:r});else{const s=[];s[Number(this._parentKey_)]=r,this.parent.set(s)}else this.parent._value_[this._parentKey_]=r}if(n)return this._proxies_.forEach((r,s)=>{s!="_parent_"&&(r.set(null),this._publishDynamicFilling_(s,null))}),this._publishAssignement_(t),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_.__value),!0;for(const r in this._value_)this._value_[r]===void 0&&delete this._value_[r];if(this._proxies_.forEach((r,s)=>{const a=this._value_[s];s!="_parent_"&&a===void 0&&a!==null&&isNaN(Number(s))&&(r.set(null),this._publishDynamicFilling_(s,null))}),this._publishAssignement_(),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_),xi(this._value_))for(const r in this._value_){const s=e[r],o=xi(s)?s:{__value:s};if(!this._proxies_.has(r)){this._publishDynamicFilling_(r,s);continue}this._proxies_.get(r)?.set(o,!0),this._publishDynamicFilling_(r,s)}return!0}get(){if(Tb(this),this._cachedGet_!==void 0)return this._cachedGet_;if(Object.prototype.hasOwnProperty.call(this._value_,"__value")){const e=this._value_.__value;return this._cachedGet_=e??null}return this._cachedGet_=this._value_!=null?this._value_:null}get $tag(){return this._instanceCounter_||(Si.instancesCounter++,this._instanceCounter_=Si.instancesCounter),Si.instances.set(this._instanceCounter_,this),"<"+Dr+'-publisher-proxy publisher="'+this._instanceCounter_+'"></'+Dr+"-publisher-proxy>"}};Si.instances=new Map,Si.instancesCounter=0;let va=Si;const Rf=[];function Tb(i){Rf.length>0&&Rf[0].add(i)}const vt=class vt{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],vt.instance!=null)throw"Singleton / use getInstance";vt.instance=this,this.isLocalStrorageReady=this.cleanStorageData(),vt.initPageShowHandler()}static initPageShowHandler(){vt.pageShowHandlerInitialized||(vt.pageShowHandlerInitialized=!0,window.addEventListener("pageshow",e=>{e.persisted&&vt.getInstance().invalidateAll()}))}invalidateAll(){this.publishers.forEach(e=>{e._invalidate_on_page_show_&&e.invalidate()})}async cleanStorageData(){return new Promise(e=>{(async()=>{try{let n=localStorage.getItem(sc),r=null;if(n&&(r=await this.decompress(n,"gzip")),r)try{this.localStorageData=JSON.parse(r)}catch{this.localStorageData={}}else n=await this.compress("{}","gzip"),localStorage.setItem(sc,n),this.localStorageData={};const s=1e3*60*60*12;for(const a in this.localStorageData){const o=this.localStorageData[a],l=new Date().getTime()-(o.expirationDelayMs||s);o.lastModifiationMS<l&&delete this.localStorageData[a]}e(!0)}catch{window.requestAnimationFrame(()=>{e(!1)}),console.warn("no publisher cache in this browser")}})()})}static getInstance(e){if(e){const t=vt.instances.get(e);return t||(console.warn("No PublisherManager instance registered with id:",e,"creating new one"),new vt)}return vt.instance==null?new vt:vt.instance}static get(e,t){return vt.getInstance().get(e,t)}async setLocalData(e,t){await this.isLocalStrorageReady,e.set(this.localStorageData[t+"¤lang_"+ri.getLanguage()]?.data||e.get())}get(e,t){const n=t?.localStorageMode==="enabled",r=t?.invalidateOnPageShow===!0;if(!this.publishers.has(e)){const o=ac({});this.set(e,o)}const s=this.publishers.get(e);return n&&this.initialisedData.indexOf(e)===-1&&(t?.expirationDelayMs&&(s._expiration_delay_=t.expirationDelayMs),s._is_savable_=!0,this.initialisedData.push(e),this.setLocalData(s,e)),r&&(s._invalidate_on_page_show_=r),this.publishers.get(e)}set(e,t){this.publishers.set(e,t)}delete(e){return this.publishers.has(e)?(this.publishers.delete(e),!0):!1}async saveToLocalStorage(e=0){if(!(e!==vt.saveId&&e%10!=0))try{if(!vt.changed||vt.saving)return;vt.saving=!0,vt.changed=!1;const t=Array.from(this.publishers.keys());let n=!1;for(const r of t){const s=this.publishers.get(r);if(!s?._is_savable_)continue;const a=s?.get();a&&(this.localStorageData[r+"¤lang_"+ri.getLanguage()]={lastModifiationMS:new Date().getTime(),expirationDelayMs:s._expiration_delay_,data:a},n=!0)}if(n){const r=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem(sc,r)}if(vt.saving=!1,vt.changed){vt.saveId++;const r=vt.saveId;setTimeout(()=>this.saveToLocalStorage(r),1e3)}}catch{vt.saving=!1}}async compress(e,t){const n=new TextEncoder().encode(e),r=window,s=new r.CompressionStream(t),a=s.writable.getWriter();a.write(n),a.close();const o=await new Response(s.readable).arrayBuffer(),l=new Uint8Array(o);let c="";for(let h=0;h<l.length;h++)c+=String.fromCharCode(l[h]);return btoa(c)}async decompress(e,t){const n=atob(e),s=Uint8Array.from(n,h=>h.charCodeAt(0)).buffer,a=window,o=new a.DecompressionStream(t),l=o.writable.getWriter();l.write(s),l.close();const c=await new Response(o.readable).arrayBuffer();return new TextDecoder().decode(c)}};vt.buildDate="Thu Oct 01 2026 19:01:49 GMT+0200 (Central European Summer Time)",vt.changed=!1,vt.saving=!1,vt.saveId=0,vt.instance=null,vt.instances=new Map,vt.pageShowHandlerInitialized=!1;let Xt=vt;if(typeof window<"u"){const i=window,e=yb+"PublisherManager",t=i[e]||Xt;if(i[e]||(i[e]=Xt),t!==Xt){const n=["instance","instances","changed","saving","saveId","pageShowHandlerInitialized"];for(const r of n)Object.defineProperty(Xt,r,{configurable:!0,get(){return t[r]},set(s){t[r]=s}})}}const wb=new Set(["invalidate","onInvalidate","offInvalidate","invalidateForm","onFormInvalidate","offFormInvalidate","onAssign","offAssign","startDynamicFilling","stopDynamicFilling","startTemplateFilling","stopTemplateFilling","onInternalMutation","offInternalMutation","set","get","$tag","_cachedGet_","_templateFillListeners_","_fillListeners_","_assignListeners_","_invalidateListeners_","_formInvalidateListeners_","_publishInternalMutation_","hasListener","delete","_mutationListeners_","_publishDynamicFilling_","_publishInvalidation_","_publishFormInvalidation_","_publishTemplateFilling_","_publishAssignement_","_proxies_","parent","_parentKey_","_value_","_is_savable_","_expiration_delay_","_lockInternalMutationPublishing_","_instanceCounter_","_assignmentId_","_invalidate_on_page_show_"]);function Ab(i,e){return{get:function(t,n){if(typeof n=="string"&&wb.has(n))return i[n];if(n==Symbol.toPrimitive)return()=>e().get();if(!i._proxies_.has(n)){const r=i._value_[n],s=ac(xi(r)?r:{__value:r},i,n);s._proxies_.set("_parent_",e()),i._proxies_.set(n,s)}return i._proxies_.get(n)},set:function(t,n,r){if(n=="_value_")return i._value_=r,!0;if(n=="_cachedGet_")return i._cachedGet_=r,!0;if(n=="_assignmentId_")return i._assignmentId_=r,!0;if(n=="_is_savable_")return i._is_savable_=r,!0;if(n=="_expiration_delay_")return i._expiration_delay_=r,!0;if(n=="_invalidate_on_page_show_")return i._invalidate_on_page_show_=r,!0;if(n=="_instanceCounter_")return i._instanceCounter_=r,!0;if(!i._proxies_.has(n)){const a=ac({},i,n);a._proxies_.set("_parent_",e()),i._proxies_.set(n,a)}return i._value_[n]!==r&&(i._value_[n]=r,i._publishDynamicFilling_(n,r),i._proxies_.get(n)?.set(xi(r)?r:{__value:r})),!0},deleteProperty:function(t,n){return i._publishDynamicFilling_(n,null),i._proxies_.get(n)?.set(null),delete i._value_[n]},has:function(t,n){return n in i._value_&&n!="_lockInternalMutationPublishing_"},defineProperty:function(t,n,r){return r&&"value"in r&&(i._value_[n]=r.value),!0},getOwnPropertyDescriptor:function(t,n){return{enumerable:!0,configurable:!0}},ownKeys:function(t){return i._value_.__value?Object.keys(i._value_.__value):Object.keys(i._value_)}}}function ac(i,e=null,t){const n=new va(i,e,t);let r=null;const s=Ab(n,()=>r);return r=new Proxy(n,s),r}class Rb extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=e=>{this.innerHTML=e.toString()}}connectedCallback(){this.publisherId=this.getAttribute("publisher")||"",this.publisher=va.instances.get(parseInt(this.publisherId)),this.publisher?.onAssign(this.onAssign)}disconnectedCallback(){this.publisher?.offAssign(this.onAssign)}}try{customElements.define(Dr+"-publisher-proxy",Rb)}catch{}const Cb=(i,e)=>{{const t=i.split("."),n=t.shift()||"";let r=Xt.get(n,e);r=ga.traverse(r,t);const s=new Set;return s.add(r),s}};function Cf(i,e,t){const n=Mb(i);return Cb(n,t).values().next().value}function Pb(i,e){return Eb()?Cf(i,void 0,e):Cf(i)}let oc=(pt=class{static disable(){this.enabled&&(this.enabled=!1,Array.from(pt.observedElements.keys()).forEach(e=>pt.unObserve(e)))}static observe(e){if(!e||!pt.enabled||pt.observedElements.has(e))return;const t=new MutationObserver(pt.onMutation),n={};n.childList=!0,n.subtree=!0,n.attributes=!0,n.attributeFilter=["data-bind"],t.observe(e,n),e.querySelectorAll("[data-bind]").forEach(r=>pt.addPublisherListeners(r)),pt.observedElements.set(e,t)}static unObserve(e){if(!e)return;const t=this.observedElements.get(e);t&&(t.disconnect(),e.querySelectorAll("[data-bind]").forEach(n=>pt.removePublisherListeners(n)))}static onAdded(e){e.hasAttribute&&e.hasAttribute("data-bind")&&pt.addPublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(t=>pt.addPublisherListeners(t)):e.childNodes.forEach(t=>pt.onAdded(t))}static onRemoved(e){e.hasAttribute&&e.hasAttribute("data-bind")&&pt.removePublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(t=>pt.removePublisherListeners(t)):e.childNodes.forEach(t=>pt.onRemoved(t))}static onMutation(e){for(const t of e)switch(t.type){case"attributes":pt.addPublisherListeners(t.target);break;case"childList":t.addedNodes.forEach(n=>{pt.onAdded(n)}),t.removedNodes.forEach(n=>{pt.onRemoved(n)});break}}static removePublisherListeners(e){const t=pt.publisherListeners.get(e);t&&(pt.publisherListeners.delete(e),t.forEach(n=>{n.publisher?.offAssign(n.onAssign)}))}static getVariablesDescriptor(e){let t=e.match(/(\$(?:\w+\\?\.?)+)/g);return t?t=t.map(n=>n.replace("$","")):t=[e],t=t.filter(n=>n.length>0),{expression:e.replace("\\",""),variables:t.map(n=>n.split(/\b\.\b/).map(r=>r.replace("\\","")))}}static getDataBindItems(e){return"attributes"in e?Array.from(e.attributes).filter(t=>t.name.indexOf("::")==0).map(t=>({propertyToUpdate:t.name.substring(2).replace(/-((html)|\w)/g,r=>r.substring(1).toUpperCase()),bindedVariablesDescriptor:pt.getVariablesDescriptor(t.value)})):[]}static getSubPublisher(e,t){if(!t)return e;for(const n of t)if(n!="_self_"){if(!e)return null;e=e[n]}return e}static addPublisherListeners(e){pt.removePublisherListeners(e);const t=ri.getAncestorAttributeValue(e.parentNode||e.host||e,"dataProvider");if(!t)return;const n=Xt.getInstance().get(t),r=pt.getDataBindItems(e),s=[];r.forEach(a=>{const o=a.bindedVariablesDescriptor,l=a.propertyToUpdate;for(const c of o.variables){const h=c;let u=n;u=pt.getSubPublisher(n,h);const f=e,d={publisher:u,onAssign:()=>{const _=o.variables.map(m=>pt.getSubPublisher(n,m)?.get());let b=o.expression,g=!1;if(_.length==1&&o.variables[0].join(".")==b.substring(1)){let m=_[0];m===null&&(m=""),f[l]=m;return}for(let m=0;m<_.length;m++){let S=_[m];const y=o.variables[m];S===null&&(g=!0,S=void 0),b=b.replace("$"+y.join("."),S)}if(b.indexOf("|")!=-1){const m=b.indexOf("|");if(m==0)b=rc.js(b.substring(1));else{const S=b.substring(0,m),y=b.substring(m+1),M=rc[S];b=g?"":M?M(y):b}}else b=g?"":b;f[l]=b}};u?.onAssign(d.onAssign),s.push(d)}}),pt.publisherListeners.set(e,s)}},pt.observedElements=new Map,pt.enabled=!0,pt.publisherListeners=new Map,pt);oc.observe(document.documentElement),window.SonicDataBindObserver||(window.SonicDataBindObserver=oc);let Db=(Pt=class{static listen(){if(!Pt.listening)return;const e=document.location?.href.replace(document.location.origin,"");Pt.prevURL&&Pt.prevURL!=e&&(Pt.prevURL=e,Pt.listeners.forEach(t=>{t.location=e})),window.requestAnimationFrame(Pt.listen)}static offChange(e){const t=Pt.listeners.indexOf(e);t!=-1&&(Pt.listeners.splice(t,1),Pt.listeners.length==0&&(Pt.listening=!1))}static onChange(e){Pt.listening||(Pt.listening=!0,Pt.listen()),Pt.listeners.push(e),e.location=this.prevURL}static changeFromComponent(e){const t=e.goBack,n=document.referrer;if(t!=null){const c=document.location.origin,h=(t||c).toString(),f=n.indexOf("http")==0?new URL(n).origin!=c:!1,d=n=="",_=history.length<3,b=d&&_,g=h!=document.location.href;if(f&&g||b){const S=history.state||{};S.concorde=S.concorde||{},S.concorde.hasDoneHistoryBack=!0,history.pushState(S,document.title),history.back(),document.location.replace(h)}else history.back();return}let r=e.getAttribute("to")||"";if(r||(r=e.href?.toString()||""),!r)return;if(r.indexOf("#")==0){document.location.hash=r.substring(1);return}const s=new URL(r,document.location.href),a=s.pathname.split("/"),o=[];let l="";for(const c of a)c!=l&&o.push(c),l=c;r="/"+o.join("/")+s.search+(s.hash?s.hash:""),e.hasAttribute("pushState")?history.pushState(null,"",r):e.hasAttribute("replaceState")?history.replaceState(null,"",r):document.location.href=r}static updateComponentActiveState(e){if(e.autoActive=="disabled")return;const t=e.href?.toString()||"";if(e.href&&t.indexOf("http")!=0){const n=new URL(t,document.location.href),r=new URL(e.location||"",document.location.origin);let s=!1;e.autoActive=="strict"?s=n.pathname==r.pathname&&n.hash==r.hash&&n.search==r.search:e.autoActive=="strict-path-only"?s=n.pathname==r.pathname&&n.hash==r.hash:s=r.href.indexOf(n.href)==0,s?e.setAttribute("active","true"):e.removeAttribute("active")}}},Pt.listeners=[],Pt.listening=!1,Pt.prevURL=document.location?.href.replace(document.location.origin,""),Pt);function Pf(i){if(i==null||typeof i!="object"||Array.isArray(i))return i;const e={...i};return delete e._sonic_http_response_,e}const xt=class xt{constructor(e){this.addHTTPResponse=!1,this.cache="default",this.isServiceSimulated=!1,this.blockUntilDone=!1,this.keepAlive=!1,this.serviceURL=e.serviceURL,this.blockUntilDone=e.blockUntilDone||!1,this.serviceURL=="publisher://"&&(this.isServiceSimulated=!0),this.serviceURL||(this.serviceURL=document.location.origin),this.userName=e.userName,this.password=e.password,e.token&&(this.token=e.token),this.tokenProvider=e.tokenProvider,this.authToken=e.authToken,this.addHTTPResponse=e.addHTTPResponse||!1,this.credentials=e.credentials,this.cache=e.cache||"default",this.keepAlive=e.keepAlive||!1}set token(e){if(this._token=e,!e){xt.tokens.delete(this.serviceURL);return}xt.invalidTokens.includes(e)||xt.tokens.set(this.serviceURL,e)}get token(){return xt.invalidTokens.includes(this._token)?xt.tokens.get(this.serviceURL):this._token}handleInvalidToken(e){e&&(xt.invalidTokens.includes(e)||(xt.invalidTokens.push(e),this.token=null))}async handleResult(e,t){xt.firstCallDoneFlags.set(this.serviceURL,"done"),this.lastResult=e;const n=e.headers.get("content-type")?.toLowerCase(),r=e.status;let s={};if(!n||n.indexOf("text/")==0)s={text:await e.text()};else try{s=await e.json()}catch{s={}}if(this.addHTTPResponse&&ga.isObject(s)&&(s._sonic_http_response_=e),r===498&&!xt.failledTokenUpdates.has(this.serviceURL))if(this.handleInvalidToken(this.token),t.apiMethod==="get"){const o=await this.get(t.path,t.additionalHeaders);if(o==null)throw new Error("GET retry failed after token refresh");s=o}else s=await this[t.apiMethod](t.path,t.data,t.method,t.additionalHeaders);return Pb("sonic-api").lastResponse.set({http:e,processed:s}),s}async auth(){if(this.token)return;if(xt.tokens.has(this.serviceURL)){this.token=xt.tokens.get(this.serviceURL);return}if(!this.tokenProvider)return;let e={};this.userName&&this.password?e={Authorization:"Basic "+window.btoa(unescape(encodeURIComponent(this.userName+":"+this.password)))}:this.authToken&&(e={Authorization:"Bearer "+this.authToken});const t=new URL(this.serviceURL),n=t.protocol+"//"+t.host,r=await fetch(this.computeURL(this.tokenProvider,{serviceHost:n}),{headers:e,credentials:this.credentials,keepalive:this.keepAlive});try{const s=await r.json();s.token?this.token=s.token:xt.failledTokenUpdates.set(this.serviceURL,!0)}catch{xt.failledTokenUpdates.set(this.serviceURL,!0)}}async localGet(e,t){const n=Xt.get(e),r=new URLSearchParams(t.split("?")[1]||""),s=n.get();let a=[];Array.isArray(s)?a=s:a=[s];const o=[];let l=Number.POSITIVE_INFINITY,c=0,h=0;if(r.has("limit")&&(l=parseInt(r.get("limit")||"0"),h++),r.has("offset")&&(c=parseInt(r.get("offset")||"0"),h++),h>0&&(r.delete("limit"),r.delete("offset")),r.size===0)return a.slice(c,c+l);for(const[u,f]of r.entries()){const d=f.split(",").map(_=>_.trim());for(const _ of d)for(const b of a)if(typeof b!="object")isNaN(+b)?b.toString().toLowerCase().includes(f.toLowerCase())&&o.push(b):b===f&&o.push(b);else{const g=b;if(!g[u])continue;isNaN(+g[u])?g[u]?.toString().toLowerCase().includes(_.toLowerCase())&&o.push(b):g[u]===_&&o.push(b)}}return o.slice(c,c+l)}firstCallDone(){return new Promise(e=>{if(!xt.firstCallDoneFlags.has(this.serviceURL))xt.firstCallDoneFlags.set(this.serviceURL,"loading"),e(!0);else{const t=()=>{[void 0,"loading"].includes(xt.firstCallDoneFlags.get(this.serviceURL))?window.requestAnimationFrame(t):e(!0)};t()}})}async get(e,t){const n=/dataProvider\((.*?)\)(.*?)$/;if(n.test(e)){this.blockUntilDone&&(await this.firstCallDone(),xt.firstCallDoneFlags.set(this.serviceURL,"loading"));const c=e.match(n);if(!c)throw new Error("dataProvider path is not valid");return await this.localGet(c[1],c[2])}const r={apiMethod:"get",path:e,additionalHeaders:t},s=await this.createHeaders(t),a=this.computeURL(e),o=JSON.stringify({url:a,headers:s,credentials:this.credentials,cache:this.cache,keepAlive:this.keepAlive});if(this.blockUntilDone&&(await this.firstCallDone(),xt.firstCallDoneFlags.set(this.serviceURL,"loading")),!xt.loadingGetPromises.has(o)){const c=new Promise(async h=>{try{const u=await fetch(a,{headers:s,credentials:this.credentials,cache:this.cache,keepalive:this.keepAlive}),f=await this.handleResult(u,r);h({processed:f,response:this.lastResult})}catch{xt.firstCallDoneFlags.set(this.serviceURL,"error"),h(null)}});xt.loadingGetPromises.set(o,c)}const l=await xt.loadingGetPromises.get(o);return xt.loadingGetPromises.delete(o),l?(this.lastResult=l.response,l.processed):null}async getDetailed(e,t){const n=/dataProvider\((.*?)\)(.*?)$/.test(e),r=await this.get(e,t);if(r==null)return;const s=Pf(r),a=this.computeURL(e);if(n)return{request:new Request(a,{method:"GET"}),result:s};const o=await this.createHeaders(t);return{request:new Request(a,{method:"GET",headers:new Headers(o),credentials:this.credentials,cache:this.cache,keepalive:this.keepAlive}),response:this.lastResult,result:s}}async sendDetailed(e,t,n,r){const s=await this.send(e,t,n,r);if(s==null)return;const a=Pf(s),o=this.computeURL(e),l=await this.createHeaders({Accept:"application/json","Content-Type":"application/json",...r});return{request:new Request(o,{method:n,headers:new Headers(l),credentials:this.credentials,body:JSON.stringify(t),keepalive:this.keepAlive}),response:this.lastResult,result:a}}async postDetailed(e,t,n){return this.sendDetailed(e,t,"POST",n)}async putDetailed(e,t,n){return this.sendDetailed(e,t,"PUT",n)}async patchDetailed(e,t,n){return this.sendDetailed(e,t,"PATCH",n)}async createHeaders(e){await this.auth();const t={};return this.token&&(t.Authorization="Bearer "+this.token),t["Accept-Language"]=ri.getLanguage(),e&&Object.assign(t,e),t}computeURL(e,t={}){let n="";e.startsWith("http")?n=e:n=this.serviceURL+"/"+e,n.startsWith("http")||(n=window.location.origin+n);const r=new URL(n);for(const s in t)r.searchParams.set(s,t[s]);return r.toString().replace(/([^(https?:)])\/{2,}/g,"$1/")}async send(e,t,n="POST",r){const s={apiMethod:"send",path:e,additionalHeaders:r,method:n,data:t},a=await this.createHeaders(r);a.Accept="application/json",a["Content-Type"]="application/json";const o=await fetch(this.computeURL(e),{headers:a,credentials:this.credentials,method:n,body:JSON.stringify(t),keepalive:this.keepAlive});return await this.handleResult(o,s)}async submitFormData(e,t,n="POST",r){const s={apiMethod:"submitFormData",path:e,additionalHeaders:r,method:n,data:t},a=await this.createHeaders(r);a.Accept="application/json";const o=new FormData,l=t;for(const h in l)o.set(h,l[h]);const c=await fetch(this.computeURL(e),{headers:a,credentials:this.credentials,method:n,body:o,keepalive:this.keepAlive});return await this.handleResult(c,s)}async put(e,t,n){return this.send(e,t,"PUT",n)}async post(e,t,n){return this.send(e,t,"POST",n)}async patch(e,t,n){return this.send(e,t,"PATCH",n)}async delete(e,t,n){return this.send(e,t,"delete",n)}};xt.loadingGetPromises=new Map,xt.tokens=new Map,xt.invalidTokens=[],xt.failledTokenUpdates=new Map,xt.firstCallDoneFlags=new Map;let lc=xt;ri.getApiConfiguration(document.body||document.documentElement);var Df=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lb(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var ps={exports:{}},Ib=ps.exports,Lf;function Ub(){return Lf||(Lf=1,(function(i,e){var t=[].slice;(function(n,r){return e!==null?i.exports=r():n.UrlPattern=r()})(Ib,function(){var n,r,s,a,o,l,c,h,u,f,d,_,b,g,m;return u=function(S){return S.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},c=function(S,y){var M,T,R;for(R=[],M=-1,T=S.length;++M<T;)R=R.concat(y(S[M]));return R},g=function(S,y){var M,T,R;for(R="",M=-1,T=S.length;++M<T;)R+=y(S[M]);return R},b=function(S){return new RegExp(S.toString()+"|").exec("").length-1},d=function(S,y){var M,T,R,k,B;for(k={},M=-1,R=S.length;++M<R;)T=S[M],B=y[M],B!=null&&(k[T]!=null?(Array.isArray(k[T])||(k[T]=[k[T]]),k[T].push(B)):k[T]=B);return k},n={},n.Result=function(S,y){this.value=S,this.rest=y},n.Tagged=function(S,y){this.tag=S,this.value=y},n.tag=function(S,y){return function(M){var T,R;if(T=y(M),T!=null)return R=new n.Tagged(S,T.value),new n.Result(R,T.rest)}},n.regex=function(S){return function(y){var M,T;if(M=S.exec(y),M!=null)return T=M[0],new n.Result(T,y.slice(T.length))}},n.sequence=function(){var S;return S=1<=arguments.length?t.call(arguments,0):[],function(y){var M,T,R,k,B,C;for(M=-1,T=S.length,C=[],k=y;++M<T;){if(R=S[M],B=R(k),B==null)return;C.push(B.value),k=B.rest}return new n.Result(C,k)}},n.pick=function(){var S,y;return S=arguments[0],y=2<=arguments.length?t.call(arguments,1):[],function(M){var T,R;if(R=n.sequence.apply(n,y)(M),R!=null)return T=R.value,R.value=T[S],R}},n.string=function(S){var y;return y=S.length,function(M){if(M.slice(0,y)===S)return new n.Result(S,M.slice(y))}},n.lazy=function(S){var y;return y=null,function(M){return y==null&&(y=S()),y(M)}},n.baseMany=function(S,y,M,T,R){var k,B,C,D;for(C=R,D=M?"":[];!(y!=null&&(k=y(C),k!=null)||(B=S(C),B==null));)M?D+=B.value:D.push(B.value),C=B.rest;if(!(T&&D.length===0))return new n.Result(D,C)},n.many1=function(S){return function(y){return n.baseMany(S,null,!1,!0,y)}},n.concatMany1Till=function(S,y){return function(M){return n.baseMany(S,y,!0,!0,M)}},n.firstChoice=function(){var S;return S=1<=arguments.length?t.call(arguments,0):[],function(y){var M,T,R,k;for(M=-1,T=S.length;++M<T;)if(R=S[M],k=R(y),k!=null)return k}},_=function(S){var y;return y={},y.wildcard=n.tag("wildcard",n.string(S.wildcardChar)),y.optional=n.tag("optional",n.pick(1,n.string(S.optionalSegmentStartChar),n.lazy(function(){return y.pattern}),n.string(S.optionalSegmentEndChar))),y.name=n.regex(new RegExp("^["+S.segmentNameCharset+"]+")),y.named=n.tag("named",n.pick(1,n.string(S.segmentNameStartChar),n.lazy(function(){return y.name}))),y.escapedChar=n.pick(1,n.string(S.escapeChar),n.regex(/^./)),y.static=n.tag("static",n.concatMany1Till(n.firstChoice(n.lazy(function(){return y.escapedChar}),n.regex(/^./)),n.firstChoice(n.string(S.segmentNameStartChar),n.string(S.optionalSegmentStartChar),n.string(S.optionalSegmentEndChar),y.wildcard))),y.token=n.lazy(function(){return n.firstChoice(y.wildcard,y.optional,y.named,y.static)}),y.pattern=n.many1(n.lazy(function(){return y.token})),y},h={escapeChar:"\\",segmentNameStartChar:":",segmentValueCharset:"a-zA-Z0-9-_~ %",segmentNameCharset:"a-zA-Z0-9",optionalSegmentStartChar:"(",optionalSegmentEndChar:")",wildcardChar:"*"},l=function(S,y){if(Array.isArray(S))return g(S,function(M){return l(M,y)});switch(S.tag){case"wildcard":return"(.*?)";case"named":return"(["+y+"]+)";case"static":return u(S.value);case"optional":return"(?:"+l(S.value,y)+")?"}},o=function(S,y){return y==null&&(y=h.segmentValueCharset),"^"+l(S,y)+"$"},a=function(S){if(Array.isArray(S))return c(S,a);switch(S.tag){case"wildcard":return["_"];case"named":return[S.value];case"static":return[];case"optional":return a(S.value)}},f=function(S,y,M,T){var R,k,B,C;if(T==null&&(T=!1),C=S[y],C==null){if(T)throw new Error("no values provided for key `"+y+"`");return}if(R=M[y]||0,k=Array.isArray(C)?C.length-1:0,R>k){if(T)throw new Error("too few values provided for key `"+y+"`");return}return B=Array.isArray(C)?C[R]:C,T&&(M[y]=R+1),B},s=function(S,y,M){var T,R;if(Array.isArray(S)){for(T=-1,R=S.length;++T<R;)if(s(S[T],y,M))return!0;return!1}switch(S.tag){case"wildcard":return f(y,"_",M,!1)!=null;case"named":return f(y,S.value,M,!1)!=null;case"static":return!1;case"optional":return s(S.value,y,M)}},m=function(S,y,M){if(Array.isArray(S))return g(S,function(T){return m(T,y,M)});switch(S.tag){case"wildcard":return f(y,"_",M,!0);case"named":return f(y,S.value,M,!0);case"static":return S.value;case"optional":return s(S.value,y,M)?m(S.value,y,M):""}},r=function(S,y){var M,T,R,k,B;if(S instanceof r){this.isRegex=S.isRegex,this.regex=S.regex,this.ast=S.ast,this.names=S.names;return}if(this.isRegex=S instanceof RegExp,!(typeof S=="string"||this.isRegex))throw new TypeError("argument must be a regex or a string");if(this.isRegex){if(this.regex=S,y!=null){if(!Array.isArray(y))throw new Error("if first argument is a regex the second argument may be an array of group names but you provided something else");if(M=b(this.regex),y.length!==M)throw new Error("regex contains "+M+" groups but array of group names contains "+y.length);this.names=y}return}if(S==="")throw new Error("argument must not be the empty string");if(B=S.replace(/\s+/g,""),B!==S)throw new Error("argument must not contain whitespace");if(T={escapeChar:y?.escapeChar||h.escapeChar,segmentNameStartChar:y?.segmentNameStartChar||h.segmentNameStartChar,segmentNameCharset:y?.segmentNameCharset||h.segmentNameCharset,segmentValueCharset:y?.segmentValueCharset||h.segmentValueCharset,optionalSegmentStartChar:y?.optionalSegmentStartChar||h.optionalSegmentStartChar,optionalSegmentEndChar:y?.optionalSegmentEndChar||h.optionalSegmentEndChar,wildcardChar:y?.wildcardChar||h.wildcardChar},k=_(T),R=k.pattern(S),R==null)throw new Error("couldn't parse pattern");if(R.rest!=="")throw new Error("could only partially parse pattern");this.ast=R.value,this.regex=new RegExp(o(this.ast,T.segmentValueCharset)),this.names=a(this.ast)},r.prototype.match=function(S){var y,M;return M=this.regex.exec(S),M==null?null:(y=M.slice(1),this.names?d(this.names,y):y)},r.prototype.stringify=function(S){if(S==null&&(S={}),this.isRegex)throw new Error("can't stringify patterns generated from a regex");if(S!==Object(S))throw new Error("argument must be an object or undefined");return m(this.ast,S,{})},r.escapeForRegex=u,r.concatMap=c,r.stringConcatMap=g,r.regexGroupCount=b,r.keysAndValuesToObject=d,r.P=n,r.newParser=_,r.defaultOptions=h,r.astNodeToRegexString=o,r.astNodeToNames=a,r.getParam=f,r.astNodeContainsSegmentsForProvidedParams=s,r.stringify=m,r})})(ps,ps.exports)),ps.exports}var Nb=Ub();const Ob=Lb(Nb);class cc{constructor(e){this.path=cc.normalizePath(e)}getDataProviderKey(){return new ma(this.path)}static normalizePath(e){const t=String(e).trim();if(!t)throw new RangeError("Endpoint: path cannot be empty");if(/^https?:\/\//i.test(t)){let l;try{l=new URL(t)}catch{throw new RangeError("Endpoint: invalid absolute URL")}return l.pathname=l.pathname.replace(/\/+/g,"/"),l.href}const n=t.indexOf("?"),r=t.indexOf("#");let s=t.length;n>=0&&(s=Math.min(s,n)),r>=0&&(s=Math.min(s,r));let a=t.slice(0,s);const o=t.slice(s);if(a=a.replace(/^\/+/,""),a=a.replace(/\/+/g,"/"),!a&&o)throw new RangeError("Endpoint: path cannot be empty");return a+o}static isNonEmpty(e){return String(e).trim().length>0}static looksLikeDataProviderPath(e){return/^\s*dataProvider\s*\(/i.test(String(e))}toString(){return this.path}}function ya(i){throw new Error('Could not dynamically require "'+i+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var uc={exports:{}},If;function Fb(){return If||(If=1,(function(i,e){(function(t){i.exports=t()})(function(){return(function(){function t(n,r,s){function a(c,h){if(!r[c]){if(!n[c]){var u=typeof ya=="function"&&ya;if(!h&&u)return u(c,!0);if(o)return o(c,!0);var f=new Error("Cannot find module '"+c+"'");throw f.code="MODULE_NOT_FOUND",f}var d=r[c]={exports:{}};n[c][0].call(d.exports,function(_){var b=n[c][1][_];return a(b||_)},d,d.exports,t,n,r,s)}return r[c].exports}for(var o=typeof ya=="function"&&ya,l=0;l<s.length;l++)a(s[l]);return a}return t})()({1:[function(t,n,r){const s=t("./utils"),a=(function(){const o=s.stringToArray,l=["Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"],c=["Zeroth","First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Ninth","Tenth","Eleventh","Twelfth","Thirteenth","Fourteenth","Fifteenth","Sixteenth","Seventeenth","Eighteenth","Nineteenth"],h=["Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety","Hundred"],u=["Thousand","Million","Billion","Trillion"];function f(z,q){var W=function(be,U,ee){var fe="";if(be<=19)fe=(U?" and ":"")+(ee?c[be]:l[be]);else if(be<100){const Se=Math.floor(be/10),ze=be%10;fe=(U?" and ":"")+h[Se-2],ze>0?fe+="-"+W(ze,!1,ee):ee&&(fe=fe.substring(0,fe.length-1)+"ieth")}else if(be<1e3){const Se=Math.floor(be/100),ze=be%100;fe=(U?", ":"")+l[Se]+" Hundred",ze>0?fe+=W(ze,!0,ee):ee&&(fe+="th")}else{var ye=Math.floor(Math.log10(be)/3);ye>u.length&&(ye=u.length);const Se=Math.pow(10,ye*3),ze=Math.floor(be/Se),_e=be-ze*Se;fe=(U?", ":"")+W(ze,!1,!1)+" "+u[ye-1],_e>0?fe+=W(_e,!0,ee):ee&&(fe+="th")}return fe},le=W(z,!1,q);return le}const d=Object.create(null);l.forEach(function(z,q){d[z.toLowerCase()]=q}),c.forEach(function(z,q){d[z.toLowerCase()]=q}),h.forEach(function(z,q){const W=z.toLowerCase();d[W]=(q+2)*10,d[W.substring(0,z.length-1)+"ieth"]=d[W]}),d.hundredth=100,u.forEach(function(z,q){const W=z.toLowerCase(),le=Math.pow(10,(q+1)*3);d[W]=le,d[W+"th"]=le});function _(z){const W=z.split(/,\s|\sand\s|[\s\\-]/).map(U=>d[U]);let le=[0];return W.forEach(U=>{if(U<100){let ee=le.pop();ee>=1e3&&(le.push(ee),ee=0),le.push(ee+U)}else le.push(le.pop()*U)}),le.reduce((U,ee)=>U+ee,0)}const b=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],g={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};function m(z){for(var q=0;q<b.length;q++){const W=b[q];if(z>=W[0])return W[1]+m(z-W[0])}return""}function S(z){for(var q=0,W=1,le=z.length-1;le>=0;le--){const be=z[le],U=g[be];U<W?q-=U:(W=U,q+=U)}return q}function y(z,q){for(var W=[],le=q.charCodeAt(0);z>0;)W.unshift(String.fromCharCode((z-1)%26+le)),z=Math.floor((z-1)/26);return W.join("")}function M(z,q){for(var W=q.charCodeAt(0),le=0,be=0;be<z.length;be++)le+=(z.charCodeAt(z.length-be-1)-W+1)*Math.pow(26,be);return le}function T(z,q){if(typeof z>"u")return;z=Math.floor(z);const W=D(q);return B(z,W)}const R={DECIMAL:"decimal",LETTERS:"letters",ROMAN:"roman",WORDS:"words",SEQUENCE:"sequence"},k={UPPER:"upper",LOWER:"lower",TITLE:"title"};function B(z,q){let W;const le=z<0;switch(z=Math.abs(z),q.primary){case R.LETTERS:W=y(z,q.case===k.UPPER?"A":"a");break;case R.ROMAN:W=m(z),q.case===k.UPPER&&(W=W.toUpperCase());break;case R.WORDS:W=f(z,q.ordinal),q.case===k.UPPER?W=W.toUpperCase():q.case===k.LOWER&&(W=W.toLowerCase());break;case R.DECIMAL:W=""+z;var be=q.mandatoryDigits-W.length;if(be>0){var U=new Array(be+1).join("0");W=U+W}if(q.zeroCode!==48&&(W=o(W).map(Se=>String.fromCodePoint(Se.codePointAt(0)+q.zeroCode-48)).join("")),q.regular){const Se=Math.floor((W.length-1)/q.groupingSeparators.position);for(let ze=Se;ze>0;ze--){const _e=W.length-ze*q.groupingSeparators.position;W=W.substr(0,_e)+q.groupingSeparators.character+W.substr(_e)}}else q.groupingSeparators.reverse().forEach(Se=>{const ze=W.length-Se.position;W=W.substr(0,ze)+Se.character+W.substr(ze)});if(q.ordinal){var ee={1:"st",2:"nd",3:"rd"},fe=W[W.length-1],ye=ee[fe];(!ye||W.length>1&&W[W.length-2]==="1")&&(ye="th"),W=W+ye}break;case R.SEQUENCE:throw{code:"D3130",value:q.token}}return le&&(W="-"+W),W}const C=[48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296];function D(z){const q={type:"integer",primary:R.DECIMAL,case:k.LOWER,ordinal:!1};let W,le;const be=z.lastIndexOf(";");switch(be===-1?W=z:(W=z.substring(0,be),le=z.substring(be+1),le[0]==="o"&&(q.ordinal=!0)),W){case"A":q.case=k.UPPER;case"a":q.primary=R.LETTERS;break;case"I":q.case=k.UPPER;case"i":q.primary=R.ROMAN;break;case"W":q.case=k.UPPER,q.primary=R.WORDS;break;case"Ww":q.case=k.TITLE,q.primary=R.WORDS;break;case"w":q.primary=R.WORDS;break;default:{let U=null,ee=0,fe=0,ye=[],Se=0;if(o(W).map(_e=>_e.codePointAt(0)).reverse().forEach(_e=>{let xe=!1;for(let qe=0;qe<C.length;qe++){const De=C[qe];if(_e>=De&&_e<=De+9){if(xe=!0,ee++,Se++,U===null)U=De;else if(De!==U)throw{code:"D3131"};break}}xe||(_e===35?(Se++,fe++):ye.push({position:Se,character:String.fromCodePoint(_e)}))}),ee>0){q.primary=R.DECIMAL,q.zeroCode=U,q.mandatoryDigits=ee,q.optionalDigits=fe;const xe=function(qe){if(qe.length===0)return 0;const De=qe[0].character;for(let re=1;re<qe.length;re++)if(qe[re].character!==De)return 0;const N=qe.map(re=>re.position),w=function(re,pe){return pe===0?re:w(pe,re%pe)},j=N.reduce(w);for(let re=1;re<=N.length;re++)if(N.indexOf(re*j)===-1)return 0;return j}(ye);xe>0?(q.regular=!0,q.groupingSeparators={position:xe,character:ye[0].character}):(q.regular=!1,q.groupingSeparators=ye)}else q.primary=R.SEQUENCE,q.token=W}}return q}const V={Y:"1",M:"1",D:"1",d:"1",F:"n",W:"1",w:"1",X:"1",x:"1",H:"1",h:"1",P:"n",m:"01",s:"01",f:"1",Z:"01:01",z:"01:01",C:"n",E:"n"};function K(z){var q=[];const W={type:"datetime",parts:q},le=function(xe,qe){if(qe>xe){let De=z.substring(xe,qe);De=De.split("]]").join("]"),q.push({type:"literal",value:De})}};for(var be=0,U=0;U<z.length;){if(z.charAt(U)==="["){if(z.charAt(U+1)==="["){le(be,U),q.push({type:"literal",value:"["}),U+=2,be=U;continue}if(le(be,U),be=U,U=z.indexOf("]",be),U===-1)throw{code:"D3135"};let xe=z.substring(be+1,U);xe=xe.split(/\s+/).join("");var ee={type:"marker",component:xe.charAt(0)},fe=xe.lastIndexOf(","),ye;if(fe!==-1){const qe=xe.substring(fe+1),De=qe.indexOf("-");let N,w;const j=function(pe){if(!(typeof pe>"u"||pe==="*"))return parseInt(pe)};De===-1?N=qe:(N=qe.substring(0,De),w=qe.substring(De+1));const re={min:j(N),max:j(w)};ee.width=re,ye=xe.substring(1,fe)}else ye=xe.substring(1);if(ye.length===1)ee.presentation1=ye;else if(ye.length>1){var Se=ye.charAt(ye.length-1);"atco".indexOf(Se)!==-1?(ee.presentation2=Se,Se==="o"&&(ee.ordinal=!0),ee.presentation1=ye.substring(0,ye.length-1)):ee.presentation1=ye}else ee.presentation1=V[ee.component];if(typeof ee.presentation1>"u")throw{code:"D3132",value:ee.component};if(ee.presentation1[0]==="n")ee.names=k.LOWER;else if(ee.presentation1[0]==="N")ee.presentation1[1]==="n"?ee.names=k.TITLE:ee.names=k.UPPER;else if("YMDdFWwXxHhmsf".indexOf(ee.component)!==-1){var ze=ee.presentation1;if(ee.presentation2&&(ze+=";"+ee.presentation2),ee.integerFormat=D(ze),ee.width&&ee.width.min!==void 0&&ee.integerFormat.mandatoryDigits<ee.width.min&&(ee.integerFormat.mandatoryDigits=ee.width.min),ee.component==="Y")if(ee.n=-1,ee.width&&ee.width.max!==void 0)ee.n=ee.width.max,ee.integerFormat.mandatoryDigits=ee.n;else{var _e=ee.integerFormat.mandatoryDigits+ee.integerFormat.optionalDigits;_e>=2&&(ee.n=_e)}const qe=q[q.length-1];qe&&qe.integerFormat&&(qe.integerFormat.parseWidth=qe.integerFormat.mandatoryDigits)}(ee.component==="Z"||ee.component==="z")&&(ee.integerFormat=D(ee.presentation1)),q.push(ee),be=U+1}U++}return le(be,U),W}const J=["","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],se=["January","February","March","April","May","June","July","August","September","October","November","December"],he=1e3*60*60*24,Q=function(z){const q=Date.UTC(z.year,z.month);var W=new Date(q).getUTCDay();return W===0&&(W=7),W>4?q+(8-W)*he:q-(W-1)*he},de=function(z,q){return{year:z,month:q,nextMonth:function(){return q===11?de(z+1,0):de(z,q+1)},previousMonth:function(){return q===0?de(z-1,11):de(z,q-1)},nextYear:function(){return de(z+1,q)},previousYear:function(){return de(z-1,q)}}},ne=function(z,q){return(q-z)/(he*7)+1},ue=(z,q)=>{let W;switch(q){case"Y":W=z.getUTCFullYear();break;case"M":W=z.getUTCMonth()+1;break;case"D":W=z.getUTCDate();break;case"d":{const le=Date.UTC(z.getUTCFullYear(),z.getUTCMonth(),z.getUTCDate()),be=Date.UTC(z.getUTCFullYear(),0);W=(le-be)/he+1;break}case"F":W=z.getUTCDay(),W===0&&(W=7);break;case"W":{const le=de(z.getUTCFullYear(),0),be=Q(le),U=Date.UTC(le.year,z.getUTCMonth(),z.getUTCDate());let ee=ne(be,U);if(ee>52){const fe=Q(le.nextYear());U>=fe&&(ee=1)}else if(ee<1){const fe=Q(le.previousYear());ee=ne(fe,U)}W=Math.floor(ee);break}case"w":{const le=de(z.getUTCFullYear(),z.getUTCMonth()),be=Q(le),U=Date.UTC(le.year,le.month,z.getUTCDate());let ee=ne(be,U);if(ee>4){const fe=Q(le.nextMonth());U>=fe&&(ee=1)}else if(ee<1){const fe=Q(le.previousMonth());ee=ne(fe,U)}W=Math.floor(ee);break}case"X":{const le=de(z.getUTCFullYear(),0),be=Q(le),U=Q(le.nextYear()),ee=z.getTime();ee<be?W=le.year-1:ee>=U?W=le.year+1:W=le.year;break}case"x":{const le=de(z.getUTCFullYear(),z.getUTCMonth()),be=Q(le),U=le.nextMonth(),ee=Q(U),fe=z.getTime();fe<be?W=le.previousMonth().month+1:fe>=ee?W=U.month+1:W=le.month+1;break}case"H":W=z.getUTCHours();break;case"h":W=z.getUTCHours(),W=W%12,W===0&&(W=12);break;case"P":W=z.getUTCHours()>=12?"pm":"am";break;case"m":W=z.getUTCMinutes();break;case"s":W=z.getUTCSeconds();break;case"f":W=z.getUTCMilliseconds();break;case"Z":case"z":break;case"C":W="ISO";break;case"E":W="ISO";break}return W};let Te=null;function ke(z,q,W){var le=0,be=0;if(typeof W<"u"){const ze=parseInt(W);le=Math.floor(ze/100),be=ze%100}var U=function(ze,_e){var xe=ue(ze,_e.component);if("YMDdFWwXxHhms".indexOf(_e.component)!==-1)if(_e.component==="Y"&&_e.n!==-1&&(xe=xe%Math.pow(10,_e.n)),_e.names){if(_e.component==="M"||_e.component==="x")xe=se[xe-1];else if(_e.component==="F")xe=J[xe];else throw{code:"D3133",value:_e.component};_e.names===k.UPPER?xe=xe.toUpperCase():_e.names===k.LOWER&&(xe=xe.toLowerCase()),_e.width&&xe.length>_e.width.max&&(xe=xe.substring(0,_e.width.max))}else xe=B(xe,_e.integerFormat);else if(_e.component==="f")xe=B(xe,_e.integerFormat);else if(_e.component==="Z"||_e.component==="z"){const qe=le*100+be;if(_e.integerFormat.regular)xe=B(qe,_e.integerFormat);else{const De=_e.integerFormat.mandatoryDigits;if(De===1||De===2)xe=B(le,_e.integerFormat),be!==0&&(xe+=":"+T(be,"00"));else if(De===3||De===4)xe=B(qe,_e.integerFormat);else throw{code:"D3134",value:De}}qe>=0&&(xe="+"+xe),_e.component==="z"&&(xe="GMT"+xe),qe===0&&_e.presentation2==="t"&&(xe="Z")}else _e.component==="P"&&_e.names===k.UPPER&&(xe=xe.toUpperCase());return xe};let ee;typeof q>"u"?(Te===null&&(Te=K("[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]")),ee=Te):ee=K(q);const fe=(60*le+be)*60*1e3,ye=new Date(z+fe);let Se="";return ee.parts.forEach(function(ze){ze.type==="literal"?Se+=ze.value:Se+=U(ye,ze)}),Se}function O(z){var q=Object.create(null);if(z.type==="datetime")q.type="datetime",q.parts=z.parts.map(function(W){var le=Object.create(null);if(W.type==="literal")le.regex=W.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");else if(W.component==="Z"||W.component==="z"){let U;Array.isArray(W.integerFormat.groupingSeparators)||(U=W.integerFormat.groupingSeparators),le.regex="",W.component==="z"&&(le.regex="GMT"),le.regex+="[-+][0-9]+",U&&(le.regex+=U.character+"[0-9]+"),le.parse=function(ee){W.component==="z"&&(ee=ee.substring(3));let fe=0,ye=0;return U?(fe=Number.parseInt(ee.substring(0,ee.indexOf(U.character))),ye=Number.parseInt(ee.substring(ee.indexOf(U.character)+1))):ee.length-1<=2?fe=Number.parseInt(ee):(fe=Number.parseInt(ee.substring(0,3)),ye=Number.parseInt(ee.substring(3))),fe*60+ye}}else if(W.component==="f")le.regex="[0-9]+",le.parse=function(U){return parseFloat("0."+U.substring(0,3))*1e3};else if(W.integerFormat)le=O(W.integerFormat);else{le.regex="[a-zA-Z]+";var be=Object.create(null);if(W.component==="M"||W.component==="x")se.forEach(function(U,ee){W.width&&W.width.max?be[U.substring(0,W.width.max)]=ee+1:be[U]=ee+1});else if(W.component==="F")J.forEach(function(U,ee){ee>0&&(W.width&&W.width.max?be[U.substring(0,W.width.max)]=ee:be[U]=ee)});else if(W.component==="P")be={am:0,AM:0,pm:1,PM:1};else throw{code:"D3133",value:W.component};le.parse=function(U){return be[U]}}return le.component=W.component,le});else{q.type="integer";const W=z.case===k.UPPER;switch(z.primary){case R.LETTERS:q.regex=W?"[A-Z]+":"[a-z]+",q.parse=function(le){return M(le,W?"A":"a")};break;case R.ROMAN:q.regex=W?"[MDCLXVI]+":"[mdclxvi]+",q.parse=function(le){return S(W?le:le.toUpperCase())};break;case R.WORDS:q.regex="(?:"+s.keys(d).concat("and","[\\-, ]").join("|")+")+",q.parse=function(le){return _(le.toLowerCase())};break;case R.DECIMAL:q.regex="[0-9]",z.parseWidth?q.regex+=`{${z.parseWidth}}`:q.regex+="+",z.ordinal&&(q.regex+="(?:th|st|nd|rd)"),q.parse=function(le){let be=le;return z.ordinal&&(be=le.substring(0,le.length-2)),z.regular?be=be.split(",").join(""):z.groupingSeparators.forEach(U=>{be=be.split(U.character).join("")}),z.zeroCode!==48&&(be=be.split("").map(U=>String.fromCodePoint(U.codePointAt(0)-z.zeroCode+48)).join("")),parseInt(be)};break;case R.SEQUENCE:throw{code:"D3130",value:z.token}}}return q}function H(z,q){if(typeof z>"u")return;const W=D(q);return O(W).parse(z)}function we(z,q){const W=K(q),le=O(W),be="^"+le.parts.map(ye=>"("+ye.regex+")").join("")+"$";var ee=new RegExp(be,"i").exec(z);if(ee!==null){const De=Object.create(null);for(let A=1;A<ee.length;A++){const x=le.parts[A-1];x.parse&&(De[x.component]=x.parse(ee[A]))}if(Object.getOwnPropertyNames(De).length===0)return;let N=0;const w=A=>{N<<=1,N+=A?1:0},j=A=>!(~A&N)&&!!(A&N);"YXMxWwdD".split("").forEach(A=>w(De[A]));const pe=!j(161)&&j(130),ae=j(84),Ve=!ae&&j(72);N=0,"PHhmsf".split("").forEach(A=>w(De[A]));const oe=!j(23)&&j(47),Re=(pe?"YD":ae?"XxwF":Ve?"XWF":"YMD")+(oe?"Phmsf":"Hmsf"),Ke=this.environment.timestamp;let Oe=!1,Ce=!1;if(Re.split("").forEach(A=>{if(typeof De[A]>"u")Oe?(De[A]="MDd".indexOf(A)!==-1?1:0,Ce=!0):De[A]=ue(Ke,A);else if(Oe=!0,Ce)throw{code:"D3136"}}),De.M>0?De.M-=1:De.M=0,pe){const A=Date.UTC(De.Y,0),x=(De.d-1)*1e3*60*60*24,L=new Date(A+x);De.M=L.getUTCMonth(),De.D=L.getUTCDate()}if(ae)throw{code:"D3136"};if(Ve)throw{code:"D3136"};oe&&(De.H=De.h===12?0:De.h,De.P===1&&(De.H+=12));var fe=Date.UTC(De.Y,De.M,De.D,De.H,De.m,De.s,De.f);return(De.Z||De.z)&&(fe-=(De.Z||De.z)*60*1e3),fe}}var Be=new RegExp("^\\d{4}(-[01]\\d)?(-[0-3]\\d)?(T[0-2]\\d:[0-5]\\d:[0-5]\\d)?(\\.\\d+)?([+-][0-2]\\d:?[0-5]\\d|Z)?$");function ie(z,q){if(!(typeof z>"u"))if(typeof q>"u"){if(!Be.test(z))throw{stack:new Error().stack,code:"D3110",value:z};return Date.parse(z)}else return we.call(this,z,q)}function ce(z,q,W){if(!(typeof z>"u"))return ke.call(this,z,q,W)}return{formatInteger:T,parseInteger:H,fromMillis:ce,toMillis:ie}})();n.exports=a},{"./utils":6}],2:[function(t,n,r){(function(s){(function(){var a=t("./utils");const o=(()=>{var l=a.isNumeric,c=a.isArrayOfStrings,h=a.isArrayOfNumbers,u=a.isSequence,f=a.isFunction,d=a.isLambda,_=a.isPromise,b=a.getFunctionArity,g=a.isDeepEqual,m=a.stringToArray;function S(p){if(!(typeof p>"u")){var v=0;return p.forEach(function(E){v+=E}),v}}function y(p){return typeof p>"u"?0:p.length}function M(p){if(!(typeof p>"u"||p.length===0))return Math.max.apply(Math,p)}function T(p){if(!(typeof p>"u"||p.length===0))return Math.min.apply(Math,p)}function R(p){if(!(typeof p>"u"||p.length===0)){var v=0;return p.forEach(function(E){v+=E}),v/p.length}}function k(p,v=!1){if(!(typeof p>"u")){var E;if(typeof p=="string")E=p;else if(f(p))E="";else{if(typeof p=="number"&&!isFinite(p))throw{code:"D3001",value:p,stack:new Error().stack};var I=v?2:0;Array.isArray(p)&&p.outerWrapper&&(p=p[0]),E=JSON.stringify(p,function(F,X){return typeof X<"u"&&X!==null&&l(X)?X.toPrecision&&!Number.isInteger(X)?Number(X.toPrecision(15)):X:X&&f(X)?"":X},I)}return E}}function B(p,v,E){if(!(typeof p>"u")){var I=m(p),F=I.length;if(F+v<0&&(v=0),typeof E<"u"){if(E<=0)return"";var X=v>=0?v+E:F+v+E;return I.slice(v,X).join("")}return I.slice(v).join("")}}function C(p,v){if(!(typeof p>"u")){var E=p.indexOf(v);return E>-1?p.substr(0,E):p}}function D(p,v){if(!(typeof p>"u")){var E=p.indexOf(v);return E>-1?p.substr(E+v.length):p}}function V(p){if(!(typeof p>"u"))return p.toLowerCase()}function K(p){if(!(typeof p>"u"))return p.toUpperCase()}function J(p){if(!(typeof p>"u"))return m(p).length}function se(p){if(!(typeof p>"u")){var v=p.replace(/[ \t\n\r]+/gm," ");return v.charAt(0)===" "&&(v=v.substring(1)),v.charAt(v.length-1)===" "&&(v=v.substring(0,v.length-1)),v}}function he(p,v,E){if(!(typeof p>"u")){(typeof E>"u"||E.length===0)&&(E=" ");var I;v=Math.trunc(v);var F=Math.abs(v)-J(p);if(F>0){var X=new Array(F+1).join(E);E.length>1&&(X=B(X,0,F)),v>0?I=p+X:I=X+p}else I=p;return I}}async function Q(p,v){var E=p.apply(this,[v]);if(_(E)&&(E=await E),E&&!(typeof E.start=="number"||E.end==="number"||Array.isArray(E.groups)||f(E.next)))throw{code:"T1010",stack:new Error().stack};return E}async function de(p,v){if(!(typeof p>"u"||typeof v>"u")){var E;if(typeof v=="string")E=p.indexOf(v)!==-1;else{var I=await Q(v,p);E=typeof I<"u"}return E}}async function ne(p,v,E){if(!(typeof p>"u")){if(E<0)throw{stack:new Error().stack,value:E,code:"D3040",index:3};var I=this.createSequence();if(typeof E>"u"||E>0){var F=0,X=await Q(v,p);if(typeof X<"u")for(;typeof X<"u"&&(typeof E>"u"||F<E);)I.push({match:X.match,index:X.start,groups:X.groups}),X=await Q(X.next),F++}return I}}async function ue(p,v,E,I){if(!(typeof p>"u")){var F=this;if(v==="")throw{code:"D3010",stack:new Error().stack,value:v,index:2};if(I<0)throw{code:"D3011",stack:new Error().stack,value:I,index:4};var X;typeof E=="string"?X=function(yt){for(var wt="",ft=0,Tt=E.indexOf("$",ft);Tt!==-1&&ft<E.length;){wt+=E.substring(ft,Tt),ft=Tt+1;var sn=E.charAt(ft);if(sn==="$")wt+="$",ft++;else if(sn==="0")wt+=yt.match,ft++;else{var Lt;if(yt.groups.length===0?Lt=1:Lt=Math.floor(Math.log(yt.groups.length)*Math.LOG10E)+1,Tt=parseInt(E.substring(ft,ft+Lt),10),Lt>1&&Tt>yt.groups.length&&(Tt=parseInt(E.substring(ft,ft+Lt-1),10)),isNaN(Tt))wt+="$";else{if(yt.groups.length>0){var dn=yt.groups[Tt-1];typeof dn<"u"&&(wt+=dn)}ft+=Tt.toString().length}}Tt=E.indexOf("$",ft)}return wt+=E.substring(ft),wt}:X=E;var me="",ve=0;if(typeof I>"u"||I>0){var Ye=0;if(typeof v=="string"){for(var Ne=p.indexOf(v,ve);Ne!==-1&&(typeof I>"u"||Ye<I);)me+=p.substring(ve,Ne),me+=E,ve=Ne+v.length,Ye++,Ne=p.indexOf(v,ve);me+=p.substring(ve)}else{var mt=await Q(v,p);if(typeof mt<"u"){for(;typeof mt<"u"&&(typeof I>"u"||Ye<I);){me+=p.substring(ve,mt.start);var ut=X.apply(F,[mt]);if(_(ut)&&(ut=await ut),typeof ut=="string")me+=ut;else throw{code:"D3012",stack:new Error().stack,value:ut};ve=mt.start+mt.match.length,Ye++,mt=await Q(mt.next)}me+=p.substring(ve)}else me=p}}else me=p;return me}}function Te(p){if(!(typeof p>"u")){var v=typeof window<"u"?window.btoa:function(E){return new s.Buffer.from(E,"binary").toString("base64")};return v(p)}}function ke(p){if(!(typeof p>"u")){var v=typeof window<"u"?window.atob:function(E){return new s.Buffer.from(E,"base64").toString("binary")};return v(p)}}function O(p){if(!(typeof p>"u")){var v;try{v=encodeURIComponent(p)}catch{throw{code:"D3140",stack:new Error().stack,value:p,functionName:"encodeUrlComponent"}}return v}}function H(p){if(!(typeof p>"u")){var v;try{v=encodeURI(p)}catch{throw{code:"D3140",stack:new Error().stack,value:p,functionName:"encodeUrl"}}return v}}function we(p){if(!(typeof p>"u")){var v;try{v=decodeURIComponent(p)}catch{throw{code:"D3140",stack:new Error().stack,value:p,functionName:"decodeUrlComponent"}}return v}}function Be(p){if(!(typeof p>"u")){var v;try{v=decodeURI(p)}catch{throw{code:"D3140",stack:new Error().stack,value:p,functionName:"decodeUrl"}}return v}}async function ie(p,v,E){if(!(typeof p>"u")){if(E<0)throw{code:"D3020",stack:new Error().stack,value:E,index:3};var I=[];if(typeof E>"u"||E>0)if(typeof v=="string")I=p.split(v,E);else{var F=0,X=await Q(v,p);if(typeof X<"u"){for(var me=0;typeof X<"u"&&(typeof E>"u"||F<E);)I.push(p.substring(me,X.start)),me=X.end,X=await Q(X.next),F++;(typeof E>"u"||F<E)&&I.push(p.substring(me))}else I.push(p)}return I}}function ce(p,v){if(!(typeof p>"u"))return typeof v>"u"&&(v=""),p.join(v)}function z(p,v,E){if(!(typeof p>"u")){var I={"decimal-separator":".","grouping-separator":",","exponent-separator":"e",infinity:"Infinity","minus-sign":"-",NaN:"NaN",percent:"%","per-mille":"‰","zero-digit":"0",digit:"#","pattern-separator":";"},F=I;typeof E<"u"&&a.keys(E).forEach(function(ge){F[ge]=E[ge]});for(var X=[],me=F["zero-digit"].charCodeAt(0),ve=me;ve<me+10;ve++)X.push(String.fromCharCode(ve));var Ye=X.concat([F["decimal-separator"],F["exponent-separator"],F["grouping-separator"],F.digit,F["pattern-separator"]]),Ne=v.split(F["pattern-separator"]);if(Ne.length>2)throw{code:"D3080",stack:new Error().stack};var mt=function(ge){var Ue=(function(){for(var tt,Qe=0;Qe<ge.length;Qe++)if(tt=ge.charAt(Qe),Ye.indexOf(tt)!==-1&&tt!==F["exponent-separator"])return ge.substring(0,Qe);return""})(),He=(function(){for(var tt,Qe=ge.length-1;Qe>=0;Qe--)if(tt=ge.charAt(Qe),Ye.indexOf(tt)!==-1&&tt!==F["exponent-separator"])return ge.substring(Qe+1);return""})(),Pe=ge.substring(Ue.length,ge.length-He.length),Ze,lt,ct,gt,rt=ge.indexOf(F["exponent-separator"],Ue.length);rt===-1||rt>ge.length-He.length?(Ze=Pe,lt=void 0):(Ze=Pe.substring(0,rt),lt=Pe.substring(rt+1));var Ge=Ze.indexOf(F["decimal-separator"]);return Ge===-1?(ct=Ze,gt=He):(ct=Ze.substring(0,Ge),gt=Ze.substring(Ge+1)),{prefix:Ue,suffix:He,activePart:Pe,mantissaPart:Ze,exponentPart:lt,integerPart:ct,fractionalPart:gt,subpicture:ge}},ut=function(ge){var Ue,He,Pe=ge.subpicture,Ze=Pe.indexOf(F["decimal-separator"]);Ze!==Pe.lastIndexOf(F["decimal-separator"])&&(Ue="D3081"),Pe.indexOf(F.percent)!==Pe.lastIndexOf(F.percent)&&(Ue="D3082"),Pe.indexOf(F["per-mille"])!==Pe.lastIndexOf(F["per-mille"])&&(Ue="D3083"),Pe.indexOf(F.percent)!==-1&&Pe.indexOf(F["per-mille"])!==-1&&(Ue="D3084");var lt=!1;for(He=0;He<ge.mantissaPart.length;He++){var ct=ge.mantissaPart.charAt(He);if(X.indexOf(ct)!==-1||ct===F.digit){lt=!0;break}}lt||(Ue="D3085");var gt=ge.activePart.split("").map(function(tt){return Ye.indexOf(tt)===-1?"p":"a"}).join("");gt.indexOf("p")!==-1&&(Ue="D3086"),Ze!==-1?(Pe.charAt(Ze-1)===F["grouping-separator"]||Pe.charAt(Ze+1)===F["grouping-separator"])&&(Ue="D3087"):ge.integerPart.charAt(ge.integerPart.length-1)===F["grouping-separator"]&&(Ue="D3088"),Pe.indexOf(F["grouping-separator"]+F["grouping-separator"])!==-1&&(Ue="D3089");var rt=ge.integerPart.indexOf(F.digit);rt!==-1&&ge.integerPart.substring(0,rt).split("").filter(function(tt){return X.indexOf(tt)>-1}).length>0&&(Ue="D3090"),rt=ge.fractionalPart.lastIndexOf(F.digit),rt!==-1&&ge.fractionalPart.substring(rt).split("").filter(function(tt){return X.indexOf(tt)>-1}).length>0&&(Ue="D3091");var Ge=typeof ge.exponentPart=="string";if(Ge&&ge.exponentPart.length>0&&(Pe.indexOf(F.percent)!==-1||Pe.indexOf(F["per-mille"])!==-1)&&(Ue="D3092"),Ge&&(ge.exponentPart.length===0||ge.exponentPart.split("").filter(function(tt){return X.indexOf(tt)===-1}).length>0)&&(Ue="D3093"),Ue)throw{code:Ue,stack:new Error().stack}},yt=function(ge){var Ue=function(Rt,Gt){for(var Pn=[],_t=Rt.indexOf(F["grouping-separator"]);_t!==-1;){var $t=(Gt?Rt.substring(0,_t):Rt.substring(_t)).split("").filter(function(Bt){return X.indexOf(Bt)!==-1||Bt===F.digit}).length;Pn.push($t),_t=ge.integerPart.indexOf(F["grouping-separator"],_t+1)}return Pn},He=Ue(ge.integerPart),Pe=function(Rt){if(Rt.length===0)return 0;for(var Gt=function($t,Bt){return Bt===0?$t:Gt(Bt,$t%Bt)},Pn=Rt.reduce(Gt),_t=1;_t<=Rt.length;_t++)if(Rt.indexOf(_t*Pn)===-1)return 0;return Pn},Ze=Pe(He),lt=Ue(ge.fractionalPart,!0),ct=ge.integerPart.split("").filter(function(Rt){return X.indexOf(Rt)!==-1}).length,gt=ct,rt=ge.fractionalPart.split(""),Ge=rt.filter(function(Rt){return X.indexOf(Rt)!==-1}).length,tt=rt.filter(function(Rt){return X.indexOf(Rt)!==-1||Rt===F.digit}).length,Qe=typeof ge.exponentPart=="string";ct===0&&tt===0&&(Qe?(Ge=1,tt=1):ct=1),Qe&&ct===0&&ge.integerPart.indexOf(F.digit)!==-1&&(ct=1),ct===0&&Ge===0&&(Ge=1);var Kt=0;return Qe&&(Kt=ge.exponentPart.split("").filter(function(Rt){return X.indexOf(Rt)!==-1}).length),{integerPartGroupingPositions:He,regularGrouping:Ze,minimumIntegerPartSize:ct,scalingFactor:gt,prefix:ge.prefix,fractionalPartGroupingPositions:lt,minimumFactionalPartSize:Ge,maximumFactionalPartSize:tt,minimumExponentSize:Kt,suffix:ge.suffix,picture:ge.subpicture}},wt=Ne.map(mt);wt.forEach(ut);var ft=wt.map(yt),Tt=F["minus-sign"],sn=F["zero-digit"],Lt=F["decimal-separator"],dn=F["grouping-separator"];ft.length===1&&(ft.push(JSON.parse(JSON.stringify(ft[0]))),ft[1].prefix=Tt+ft[1].prefix);var At;p>=0?At=ft[0]:At=ft[1];var zi;At.picture.indexOf(F.percent)!==-1?zi=p*100:At.picture.indexOf(F["per-mille"])!==-1?zi=p*1e3:zi=p;var Vn,Mi;if(At.minimumExponentSize===0)Vn=zi;else{var _c=Math.pow(10,At.scalingFactor),vc=Math.pow(10,At.scalingFactor-1);if(Vn=zi,Mi=0,Vn!==0){for(;Math.abs(Vn)<vc;)Vn*=10,Mi-=1;for(;Math.abs(Vn)>_c;)Vn/=10,Mi+=1}}var yc=ee(Vn,At.maximumFactionalPartSize),P=function(ge,Ue){var He=Math.abs(ge).toFixed(Ue);return sn!=="0"&&(He=He.split("").map(function(Pe){return Pe>="0"&&Pe<="9"?X[Pe.charCodeAt(0)-48]:Pe}).join("")),He},G=P(yc,At.maximumFactionalPartSize),Z=G.indexOf(".");for(Z===-1?G=G+Lt:G=G.replace(".",Lt);G.charAt(0)===sn;)G=G.substring(1);for(;G.charAt(G.length-1)===sn;)G=G.substring(0,G.length-1);Z=G.indexOf(Lt);var te=At.minimumIntegerPartSize-Z,Y=At.minimumFactionalPartSize-(G.length-Z-1);if(G=(te>0?new Array(te+1).join(sn):"")+G,G=G+(Y>0?new Array(Y+1).join(sn):""),Z=G.indexOf(Lt),At.regularGrouping>0)for(var Ee=Math.floor((Z-1)/At.regularGrouping),Le=1;Le<=Ee;Le++)G=[G.slice(0,Z-Le*At.regularGrouping),dn,G.slice(Z-Le*At.regularGrouping)].join("");else At.integerPartGroupingPositions.forEach(function(ge){G=[G.slice(0,Z-ge),dn,G.slice(Z-ge)].join(""),Z++});if(Z=G.indexOf(Lt),At.fractionalPartGroupingPositions.forEach(function(ge){G=[G.slice(0,ge+Z+1),dn,G.slice(ge+Z+1)].join("")}),Z=G.indexOf(Lt),(At.picture.indexOf(Lt)===-1||Z===G.length-1)&&(G=G.substring(0,G.length-1)),typeof Mi<"u"){var Fe=P(Mi,0);te=At.minimumExponentSize-Fe.length,te>0&&(Fe=new Array(te+1).join(sn)+Fe),G=G+F["exponent-separator"]+(Mi<0?Tt:"")+Fe}return G=At.prefix+G+At.suffix,G}}function q(p,v){if(!(typeof p>"u")){if(p=ee(p),typeof v>"u"?v=10:v=ee(v),v<2||v>36)throw{code:"D3100",stack:new Error().stack,value:v};var E=p.toString(v);return E}}function W(p){var v;if(!(typeof p>"u")){if(typeof p=="number")v=p;else if(typeof p=="string"&&/^-?[0-9]+(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test(p)&&!isNaN(parseFloat(p))&&isFinite(p))v=parseFloat(p);else if(typeof p=="string"&&/^(0[xX][0-9A-Fa-f]+)|(0[oO][0-7]+)|(0[bB][0-1]+)$/.test(p))v=Number(p);else if(p===!0)v=1;else if(p===!1)v=0;else throw{code:"D3030",value:p,stack:new Error().stack,index:1};return v}}function le(p){var v;if(!(typeof p>"u"))return v=Math.abs(p),v}function be(p){var v;if(!(typeof p>"u"))return v=Math.floor(p),v}function U(p){var v;if(!(typeof p>"u"))return v=Math.ceil(p),v}function ee(p,v){var E;if(!(typeof p>"u")){if(v){var I=p.toString().split("e");p=+(I[0]+"e"+(I[1]?+I[1]+v:v))}E=Math.round(p);var F=E-p;return Math.abs(F)===.5&&Math.abs(E%2)===1&&(E=E-1),v&&(I=E.toString().split("e"),E=+(I[0]+"e"+(I[1]?+I[1]-v:-v))),Object.is(E,-0)&&(E=0),E}}function fe(p){var v;if(!(typeof p>"u")){if(p<0)throw{stack:new Error().stack,code:"D3060",index:1,value:p};return v=Math.sqrt(p),v}}function ye(p,v){var E;if(!(typeof p>"u")){if(E=Math.pow(p,v),!isFinite(E))throw{stack:new Error().stack,code:"D3061",index:1,value:p,exp:v};return E}}function Se(){return Math.random()}function ze(p){if(!(typeof p>"u")){var v=!1;if(Array.isArray(p)){if(p.length===1)v=ze(p[0]);else if(p.length>1){var E=p.filter(function(I){return ze(I)});v=E.length>0}}else typeof p=="string"?p.length>0&&(v=!0):l(p)?p!==0&&(v=!0):p!==null&&typeof p=="object"&&!f(p)?a.keys(p).length>0&&(v=!0):typeof p=="boolean"&&p===!0&&(v=!0);return v}}function _e(p){if(!(typeof p>"u"))return!ze(p)}function xe(p,v,E,I){var F=[v],X=b(p);return X>=2&&F.push(E),X>=3&&F.push(I),F}async function qe(p,v){if(!(typeof p>"u")){for(var E=this.createSequence(),I=0;I<p.length;I++){var F=xe(v,p[I],I,p),X=await v.apply(this,F);typeof X<"u"&&E.push(X)}return E}}async function De(p,v){if(!(typeof p>"u")){for(var E=this.createSequence(),I=0;I<p.length;I++){var F=p[I],X=xe(v,F,I,p),me=await v.apply(this,X);ze(me)&&E.push(F)}return E}}async function N(p,v){if(!(typeof p>"u")){for(var E=!1,I,F=0;F<p.length;F++){var X=p[F],me=!0;if(typeof v<"u"){var ve=xe(v,X,F,p),Ye=await v.apply(this,ve);me=ze(Ye)}if(me)if(!E)I=X,E=!0;else throw{stack:new Error().stack,code:"D3138",index:F}}if(!E)throw{stack:new Error().stack,code:"D3139"};return I}}function w(){for(var p=[],v=Array.prototype.slice.call(arguments),E=Math.min.apply(Math,v.map(function(X){return Array.isArray(X)?X.length:0})),I=0;I<E;I++){var F=v.map(X=>X[I]);p.push(F)}return p}async function j(p,v,E){if(!(typeof p>"u")){var I,F=b(v);if(F<2)throw{stack:new Error().stack,code:"D3050",index:1};var X;for(typeof E>"u"&&p.length>0?(I=p[0],X=1):(I=E,X=0);X<p.length;){var me=[I,p[X]];F>=3&&me.push(X),F>=4&&me.push(p),I=await v.apply(this,me),X++}return I}}function re(p){var v=this.createSequence();if(Array.isArray(p)){for(var E=Object.create(null),I=0;I<p.length;I++){var F=re.call(this,p[I]);F.forEach(function(X){E[X]=!0})}v=re.call(this,E)}else p!==null&&typeof p=="object"&&!f(p)&&a.keys(p).forEach(X=>v.push(X));return v}function pe(p,v){var E;if(Array.isArray(p)){E=this.createSequence();for(var I=0;I<p.length;I++){var F=pe.call(this,p[I],v);typeof F<"u"&&(Array.isArray(F)?F.forEach(X=>E.push(X)):E.push(F))}}else p!==null&&typeof p=="object"&&Object.prototype.hasOwnProperty.call(p,v)&&!f(p)&&(E=p[v]);return E}function ae(p,v){if(typeof p>"u")return v;if(typeof v>"u")return p;Array.isArray(p)||(p=this.createSequence(p)),Array.isArray(v)||(v=[v]);const E=p.length+v.length;if(this.options&&E>this.options.sequence)throw{code:"D2015",stack:new Error().stack,value:E};return p.concat(v)}function Ve(p){return!(typeof p>"u")}function Ae(p){var v=this.createSequence();if(Array.isArray(p))for(var E=0;E<p.length;E++)v=ae.call(this,v,Ae.call(this,p[E]));else if(p!==null&&typeof p=="object"&&!d(p))for(const F of a.keys(p)){var I=Object.create(null);I[F]=p[F],v.push(I)}else v=p;return v}function oe(p){if(!(typeof p>"u")){var v=Object.create(null);return p.forEach(function(E){for(const I of a.keys(E))v[I]=E[I]}),v}}function We(p){if(!(typeof p>"u")){if(p.length<=1)return p;for(var v=p.length,E=new Array(v),I=0;I<v;I++)E[v-I-1]=p[I];return E}}async function Me(p,v){var E=this.createSequence();for(const X of a.keys(p)){var I=xe(v,p[X],X,p),F=await v.apply(this,I);typeof F<"u"&&E.push(F)}return E}function Re(p){throw{code:"D3137",stack:new Error().stack,message:p||"$error() function evaluated"}}function Ke(p,v){if(!p)throw{code:"D3141",stack:new Error().stack,message:v||"$assert() statement failed"}}function Oe(p){if(p!==void 0)return p===null?"null":l(p)?"number":typeof p=="string"?"string":typeof p=="boolean"?"boolean":Array.isArray(p)?"array":f(p)?"function":"object"}async function Ce(p,v){if(!(typeof p>"u")){if(p.length<=1)return p;var E;if(typeof v>"u"){if(!h(p)&&!c(p))throw{stack:new Error().stack,code:"D3070",index:1};E=async function(me,ve){return me>ve}}else E=v;var I=async function(me,ve){var Ye=async function(mt,ut,yt){ut.length===0?Array.prototype.push.apply(mt,yt):yt.length===0?Array.prototype.push.apply(mt,ut):await E(ut[0],yt[0])?(mt.push(yt[0]),await Ye(mt,ut,yt.slice(1))):(mt.push(ut[0]),await Ye(mt,ut.slice(1),yt))},Ne=[];return await Ye(Ne,me,ve),Ne},F=async function(me){if(!Array.isArray(me)||me.length<=1)return me;var ve=Math.floor(me.length/2),Ye=me.slice(0,ve),Ne=me.slice(ve);return Ye=await F(Ye),Ne=await F(Ne),await I(Ye,Ne)},X=await F(p);return X}}function A(p){if(!(typeof p>"u")){if(p.length<=1)return p;for(var v=new Array(p.length),E=0;E<p.length;E++){var I=Math.floor(Math.random()*(E+1));E!==I&&(v[E]=v[I]),v[I]=p[E]}return v}}function x(p){if(!(typeof p>"u")){if(!Array.isArray(p)||p.length<=1)return p;for(var v=u(p)?this.createSequence():[],E=0;E<p.length;E++){for(var I=p[E],F=!1,X=0;X<v.length;X++)if(g(I,v[X])){F=!0;break}F||v.push(I)}return v}}async function L(p,v){var E=Object.create(null);for(const me of a.keys(p)){var I=p[me],F=xe(v,I,me,p),X=await v.apply(this,F);ze(X)&&(E[me]=I)}return a.keys(E).length===0&&(E=void 0),E}return{sum:S,count:y,max:M,min:T,average:R,string:k,substring:B,substringBefore:C,substringAfter:D,lowercase:V,uppercase:K,length:J,trim:se,pad:he,match:ne,contains:de,replace:ue,split:ie,join:ce,formatNumber:z,formatBase:q,number:W,floor:be,ceil:U,round:ee,abs:le,sqrt:fe,power:ye,random:Se,boolean:ze,not:_e,map:qe,zip:w,filter:De,single:N,foldLeft:j,sift:L,keys:re,lookup:pe,append:ae,exists:Ve,spread:Ae,merge:oe,reverse:We,each:Me,error:Re,assert:Ke,type:Oe,sort:Ce,shuffle:A,distinct:x,base64encode:Te,base64decode:ke,encodeUrlComponent:O,encodeUrl:H,decodeUrlComponent:we,decodeUrl:Be}})();n.exports=o}).call(this)}).call(this,typeof Df<"u"?Df:typeof self<"u"?self:typeof window<"u"?window:{})},{"./utils":6}],3:[function(t,n,r){var s=t("./datetime"),a=t("./functions"),o=t("./utils"),l=t("./parser"),c=t("./signature"),h=(function(){var u=o.isNumeric,f=o.isArrayOfStrings,d=o.isArrayOfNumbers,_=o.isSequence,b=o.isFunction,g=o.isLambda,m=o.isIterable,S=o.isPromise,y=o.getFunctionArity,M=o.isDeepEqual,T=Re(null);async function R(A,x,L){var p;L.base.depth++,L.base.guardrails();var v=L.lookup(Symbol.for("jsonata.__evaluate_entry"));switch(v&&await v(A,x,L),A.type){case"path":p=await k(A,x,L);break;case"binary":p=await J(A,x,L);break;case"unary":p=await se(A,x,L);break;case"name":p=he(A,x,L);break;case"string":case"number":case"value":p=Q(A);break;case"wildcard":p=de(A,x,L);break;case"descendant":p=ue(A,x,L);break;case"parent":p=L.lookup(A.slot.label);break;case"condition":p=await be(A,x,L);break;case"block":p=await U(A,x,L);break;case"bind":p=await le(A,x,L);break;case"regex":p=ee(A,x,L);break;case"function":p=await xe(A,x,L);break;case"variable":p=fe(A,x,L);break;case"lambda":p=N(A,x,L);break;case"partial":p=await w(A,x,L);break;case"apply":p=await _e(A,x,L);break;case"transform":p=Se(A,x,L);break}if(Object.prototype.hasOwnProperty.call(A,"predicate"))for(var E=0;E<A.predicate.length;E++)p=await K(A.predicate[E].expr,p,L);A.type!=="path"&&Object.prototype.hasOwnProperty.call(A,"group")&&(p=await z(A.group,p,L));var I=L.lookup(Symbol.for("jsonata.__evaluate_exit"));return I&&await I(A,x,L,p),p&&_(p)&&!p.tupleStream&&(A.keepArray&&(p.keepSingleton=!0),p.length===0?p=void 0:p.length===1&&(p=p.keepSingleton?p:p[0])),L.base.depth--,p}async function k(A,x,L){var p;Array.isArray(x)&&A.steps[0].type!=="variable"?p=x:p=L.base.createSequence(x);for(var v,E=!1,I=void 0,F=0;F<A.steps.length;F++){var X=A.steps[F];if(X.tuple&&(E=!0),F===0&&X.consarray?v=await R(X,p,L):E?I=await V(X,p,I,L):v=await C(X,p,L,F===A.steps.length-1),!E&&(typeof v>"u"||v.length===0))break;typeof X.focus>"u"&&(p=v)}if(E)if(A.tuple)v=I;else for(v=L.base.createSequence(),F=0;F<I.length;F++)v.push(I[F]["@"]);return A.keepSingletonArray&&(Array.isArray(v)&&v.cons&&!v.sequence&&(v=L.base.createSequence(v)),v.keepSingleton=!0),Object.prototype.hasOwnProperty.call(A,"group")&&(v=await z(A.group,E?I:v,L)),v}function B(A,x){var L=Re(A);for(const p of o.keys(x))L.bind(p,x[p]);return L}async function C(A,x,L,p){var v;if(A.type==="sort")return v=await ye(A,x,L),A.stages&&(v=await D(A.stages,v,L)),v;v=L.base.createSequence();for(var E=0;E<x.length;E++){var I=await R(A,x[E],L);if(A.stages)for(var F=0;F<A.stages.length;F++)I=await K(A.stages[F].expr,I,L);typeof I<"u"&&v.push(I)}var X=L.base.createSequence();return p&&v.length===1&&Array.isArray(v[0])&&!_(v[0])?X=v[0]:Array.prototype.forEach.call(v,function(me){!Array.isArray(me)||me.cons?X.push(me):Array.prototype.forEach.call(me,ve=>X.push(ve))}),X}async function D(A,x,L){for(var p=x,v=0;v<A.length;v++){var E=A[v];switch(E.type){case"filter":p=await K(E.expr,p,L);break;case"index":for(var I=0;I<p.length;I++){var F=p[I];F[E.value]=I}break}}return p}async function V(A,x,L,p){var v;if(A.type==="sort"){if(L)v=await ye(A,L,p);else{var E=await ye(A,x,p);v=p.base.createSequence(),v.tupleStream=!0;for(var I=0;I<E.length;I++){var F={"@":E[I]};F[A.index]=I,v.push(F)}}return A.stages&&(v=await D(A.stages,v,p)),v}v=p.base.createSequence(),v.tupleStream=!0;var X=p;L===void 0&&(L=x.map(Ne=>({"@":Ne})));for(var me=0;me<L.length;me++){X=B(p,L[me]);var ve=await R(A,L[me]["@"],X);if(typeof ve<"u"){Array.isArray(ve)||(ve=[ve]);for(var Ye=0;Ye<ve.length;Ye++)F=Object.create(null),Object.assign(F,L[me]),ve.tupleStream?Object.assign(F,ve[Ye]):(A.focus?(F[A.focus]=ve[Ye],F["@"]=L[me]["@"]):F["@"]=ve[Ye],A.index&&(F[A.index]=Ye),A.ancestor&&(F[A.ancestor.label]=L[me]["@"])),v.push(F)}}return A.stages&&(v=await D(A.stages,v,p)),v}async function K(A,x,L){var p=L.base.createSequence();if(x&&x.tupleStream&&(p.tupleStream=!0),Array.isArray(x)||(x=L.base.createSequence(x)),A.type==="number"){var v=Math.floor(A.value);v<0&&(v=x.length+v);var E=await x[v];typeof E<"u"&&(Array.isArray(E)?p=E:p.push(E))}else for(v=0;v<x.length;v++){var E=x[v],I=E,F=L;x.tupleStream&&(I=E["@"],F=B(L,E));var X=await R(A,I,F);u(X)&&(X=[X]),d(X)?Array.prototype.forEach.call(X,function(ve){var Ye=Math.floor(ve);Ye<0&&(Ye=x.length+Ye),Ye===v&&p.push(E)}):a.boolean(X)&&p.push(E)}return p}async function J(A,x,L){var p,v=await R(A.lhs,x,L),E=A.value,I=async()=>await R(A.rhs,x,L);if(E==="and"||E==="or")try{return await Be(v,I,E)}catch(X){throw X.position=A.position,X.token=E,X}var F=await I();try{switch(E){case"+":case"-":case"*":case"/":case"%":p=ke(v,F,E);break;case"=":case"!=":p=O(v,F,E);break;case"<":case"<=":case">":case">=":p=H(v,F,E);break;case"&":p=ce(v,F);break;case"..":p=W(v,F,L);break;case"in":p=we(v,F);break}}catch(X){throw X.position=A.position,X.token=E,X}return p}async function se(A,x,L){var p,v={options:L.base.options,createSequence:L.base.createSequence};switch(A.value){case"-":if(p=await R(A.expression,x,L),typeof p>"u")p=void 0;else if(u(p))p=-p;else throw{code:"D1002",stack:new Error().stack,position:A.position,token:A.value,value:p};break;case"[":p=[];let F=await Promise.all(A.expressions.map(async(X,me)=>(L.isParallelCall=me>0,[X,await R(X,x,L)])));for(let X of F){var[E,I]=X;typeof I<"u"&&(E.value==="["?p.push(I):p=a.append.call(v,p,I))}A.consarray&&Object.defineProperty(p,"cons",{enumerable:!1,configurable:!1,value:!0});break;case"{":p=await z(A,x,L);break}return p}function he(A,x,L){var p={createSequence:L.base.createSequence};return a.lookup.call(p,x,A.value)}function Q(A){return A.value}function de(A,x,L){var p={options:L.base.options,createSequence:L.base.createSequence},v=p.createSequence();return Array.isArray(x)&&x.outerWrapper&&x.length>0&&(x=x[0]),x!==null&&typeof x=="object"&&!b(x)&&o.keys(x).forEach(function(E){var I=x[E];Array.isArray(I)?(I=ne(I),v=a.append.call(p,v,I)):v.push(I)}),v}function ne(A,x){return typeof x>"u"&&(x=[]),Array.isArray(A)?Array.prototype.forEach.call(A,function(L){ne(L,x)}):x.push(A),x}function ue(A,x,L){var p,v=L.base.createSequence();return typeof x<"u"&&(Te(x,v),v.length===1?p=v[0]:p=v),p}function Te(A,x){Array.isArray(A)||x.push(A),Array.isArray(A)?Array.prototype.forEach.call(A,function(L){Te(L,x)}):A!==null&&typeof A=="object"&&!b(A)&&o.keys(A).forEach(function(L){Te(A[L],x)})}function ke(A,x,L){var p;if(typeof A<"u"&&!u(A))throw{code:"T2001",stack:new Error().stack,value:A};if(typeof x<"u"&&!u(x))throw{code:"T2002",stack:new Error().stack,value:x};if(typeof A>"u"||typeof x>"u")return p;switch(L){case"+":p=A+x;break;case"-":p=A-x;break;case"*":p=A*x;break;case"/":p=A/x;break;case"%":p=A%x;break}return p}function O(A,x,L){var p,v=typeof A,E=typeof x;if(v==="undefined"||E==="undefined")return!1;switch(L){case"=":p=M(A,x);break;case"!=":p=!M(A,x);break}return p}function H(A,x,L){var p,v=typeof A,E=typeof x,I=v==="undefined"||v==="string"||v==="number",F=E==="undefined"||E==="string"||E==="number";if(!I||!F)throw{code:"T2010",stack:new Error().stack,value:v==="string"||v==="number"?x:A};if(!(v==="undefined"||E==="undefined")){if(v!==E)throw{code:"T2009",stack:new Error().stack,value:A,value2:x};switch(L){case"<":p=A<x;break;case"<=":p=A<=x;break;case">":p=A>x;break;case">=":p=A>=x;break}return p}}function we(A,x){var L=!1;if(typeof A>"u"||typeof x>"u")return!1;Array.isArray(x)||(x=[x]);for(var p=0;p<x.length;p++)if(x[p]===A){L=!0;break}return L}async function Be(A,x,L){var p,v=ie(A);switch(L){case"and":p=v&&ie(await x());break;case"or":p=v||ie(await x());break}return p}function ie(A){var x=a.boolean(A);return typeof x>"u"?!1:x}function ce(A,x){var L,p="",v="";return typeof A<"u"&&(p=a.string(A)),typeof x<"u"&&(v=a.string(x)),L=p.concat(v),L}async function z(A,x,L){var p=Object.create(null),v=Object.create(null),E=!!(x&&x.tupleStream),I={options:L.base.options,createSequence:L.base.createSequence};Array.isArray(x)||(L.base.options,x=I.createSequence(x)),x.length===0&&!E&&x.push(void 0);for(var F=0;F<x.length;F++)for(var X=x[F],me=E?B(L,X):L,ve=0;ve<A.lhs.length;ve++){var Ye=A.lhs[ve],Ne=await R(Ye[0],E?X["@"]:X,me);if(typeof Ne!="string"&&Ne!==void 0)throw{code:"T1003",stack:new Error().stack,position:A.position,value:Ne};if(Ne!==void 0){if(Ne==="_jsonata_lambda"||Ne==="_jsonata_function")throw{code:"D1013",stack:new Error().stack,position:A.position,value:Ne};var mt={data:X,exprIndex:ve};if(Object.prototype.hasOwnProperty.call(v,Ne)){if(v[Ne].exprIndex!==ve)throw{code:"D1009",stack:new Error().stack,position:A.position,value:Ne};v[Ne].data=a.append.call(I,v[Ne].data,X)}else v[Ne]=mt}}let ut=await Promise.all(o.keys(v).map(async(wt,ft)=>{let Tt=v[wt];var sn=Tt.data,Lt=L;if(E){var dn=q(Tt.data,L);sn=dn["@"],delete dn["@"],Lt=B(L,dn)}return L.isParallelCall=ft>0,[wt,await R(A.lhs[Tt.exprIndex][1],sn,Lt)]}));for(let wt of ut){var[Ne,yt]=await wt;typeof yt<"u"&&(p[Ne]=yt)}return p}function q(A,x){if(!Array.isArray(A))return A;var L=Object.create(null),p={options:x.base.options,createSequence:x.base.createSequence};Object.assign(L,A[0]);for(var v=1;v<A.length;v++)for(const E of o.keys(A[v]))L[E]=a.append.call(p,L[E],A[v][E]);return L}function W(A,x,L){var p;if(typeof A<"u"&&!Number.isInteger(A))throw{code:"T2003",stack:new Error().stack,value:A};if(typeof x<"u"&&!Number.isInteger(x))throw{code:"T2004",stack:new Error().stack,value:x};if(typeof A>"u"||typeof x>"u"||A>x)return p;var v=x-A+1;if(v>1e7)throw{code:"D2014",stack:new Error().stack,value:v};if(L.base.options&&v>L.base.options.sequence)throw{code:"D2015",stack:new Error().stack,value:v};p=new Array(v);for(var E=A,I=0;E<=x;E++,I++)p[I]=E;return p.sequence=!0,p}async function le(A,x,L){var p=await R(A.rhs,x,L);return L.bind(A.lhs.value,p),p}async function be(A,x,L){var p,v=await R(A.condition,x,L);return a.boolean(v)?p=await R(A.then,x,L):typeof A.else<"u"&&(p=await R(A.else,x,L)),p}async function U(A,x,L){for(var p,v=Re(L),E=0;E<A.expressions.length;E++)p=await R(A.expressions[E],x,v);return p}function ee(A,x,L){var p=new L.base.RegexEngine(A.value),v=function(E,I){var F;p.lastIndex=I||0;var X=p.exec(E);if(X!==null){if(F={match:X[0],start:X.index,end:X.index+X[0].length,groups:[]},X.length>1)for(var me=1;me<X.length;me++)F.groups.push(X[me]);F.next=function(){if(!(p.lastIndex>=E.length)){var ve=v(E,p.lastIndex);if(ve&&ve.match==="")throw{code:"D1004",stack:new Error().stack,position:A.position,value:A.value.source};return ve}}}return F};return v}function fe(A,x,L){var p;return A.value===""?p=x&&x.outerWrapper?x[0]:x:p=L.lookup(A.value),p}async function ye(A,x,L){var p,v=x,E=!!x.tupleStream,I=async function(X,me){for(var ve=0,Ye=0;ve===0&&Ye<A.terms.length;Ye++){var Ne=A.terms[Ye],mt=X,ut=L;E&&(mt=X["@"],ut=B(L,X));var yt=await R(Ne.expression,mt,ut);mt=me,ut=L,E&&(mt=me["@"],ut=B(L,me));var wt=await R(Ne.expression,mt,ut),ft=typeof yt,Tt=typeof wt;if(ft==="undefined"){ve=Tt==="undefined"?0:1;continue}if(Tt==="undefined"){ve=-1;continue}if(!(ft==="string"||ft==="number")||!(Tt==="string"||Tt==="number"))throw{code:"T2008",stack:new Error().stack,position:A.position,value:ft==="string"||ft==="number"?wt:yt};if(ft!==Tt)throw{code:"T2007",stack:new Error().stack,position:A.position,value:yt,value2:wt};yt!==wt&&(yt<wt?ve=-1:ve=1,Ne.descending===!0&&(ve=-ve))}return ve===1},F={environment:L,input:x};return p=await a.sort.apply(F,[v,I]),p}function Se(A,x,L){var p=async function(v){if(!(typeof v>"u")){var E=L.lookup("clone");if(!b(E))throw{code:"T2013",stack:new Error().stack,position:A.position};var I=await qe(E,[v],null,L),F=await R(A.pattern,I,L);if(typeof F<"u"){Array.isArray(F)||(F=[F]);for(var X=0;X<F.length;X++){var me=F[X],ve=await R(A.update,me,L),Ye=typeof ve;if(Ye!=="undefined"){if(Ye!=="object"||ve===null||Array.isArray(ve))throw{code:"T2011",stack:new Error().stack,position:A.update.position,value:ve};for(const yt of o.keys(ve))me[yt]=ve[yt]}if(typeof A.delete<"u"){var Ne=await R(A.delete,me,L);if(typeof Ne<"u"){var mt=Ne;if(Array.isArray(Ne)||(Ne=[Ne]),!f(Ne))throw{code:"T2012",stack:new Error().stack,position:A.delete.position,value:mt};for(var ut=0;ut<Ne.length;ut++)typeof me=="object"&&me!==null&&delete me[Ne[ut]]}}}}return I}};return oe(p,"<(oa):o>")}var ze=l("function($f, $g) { function($x){ $g($f($x)) } }");async function _e(A,x,L){var p,v=await R(A.lhs,x,L);if(A.rhs.type==="function")p=await xe(A.rhs,x,L,{context:v});else{var E=await R(A.rhs,x,L);if(!b(E))throw{code:"T2006",stack:new Error().stack,position:A.position,value:E};if(b(v)){var I=await R(ze,null,L);p=await qe(I,[v,E],null,L)}else p=await qe(E,[v],null,L)}return p}async function xe(A,x,L,p){var v,E=await R(A.procedure,x,L);if(typeof E>"u"&&A.procedure.type==="path"&&L.lookup(A.procedure.steps[0].value))throw{code:"T1005",stack:new Error().stack,position:A.position,token:A.procedure.steps[0].value};var I=[];typeof p<"u"&&I.push(p.context);for(var F=0;F<A.arguments.length;F++){const me=await R(A.arguments[F],x,L);if(b(me)){const ve=async function(...Ye){return await qe(me,Ye,null,L)};ve.arity=y(me),I.push(ve)}else I.push(me)}var X=A.procedure.type==="path"?A.procedure.steps[0].value:A.procedure.value;try{typeof E=="object"&&(E.token=X,E.position=A.position),v=await qe(E,I,x,L)}catch(me){throw me.position||(me.position=A.position),me.token||(me.token=X),me}return v}async function qe(A,x,L,p){var v;for(v=await De(A,x,L,p);g(v)&&v.thunk===!0;){var E=await R(v.body.procedure,v.input,v.environment);v.body.procedure.type==="variable"&&(E.token=v.body.procedure.value),E.position=v.body.procedure.position;for(var I=[],F=0;F<v.body.arguments.length;F++)I.push(await R(v.body.arguments[F],v.input,v.environment));v=await De(E,I,L,p)}return v}async function De(A,x,L,p){var v;try{var E=x;if(A&&(E=j(A.signature,x,L)),g(A))v=await re(A,E);else if(A&&A._jsonata_function===!0){var I={environment:p,input:L,options:p.base.options,createSequence:p.base.createSequence};v=A.implementation.apply(I,E),m(v)&&(v=v.next().value),S(v)&&(v=await v)}else if(typeof A=="function")v=A.apply(L,E),S(v)&&(v=await v);else throw{code:"T1006",stack:new Error().stack}}catch(F){throw A&&(typeof F.token>"u"&&typeof A.token<"u"&&(F.token=A.token),F.position=A.position||F.position),F}return v}function N(A,x,L){var p={_jsonata_lambda:!0,input:x,environment:L,arguments:A.arguments,signature:A.signature,body:A.body};return A.thunk===!0&&(p.thunk=!0),p.apply=async function(v,E){return await qe(p,E,x,v?v.environment:L)},p}async function w(A,x,L){for(var p,v=[],E=0;E<A.arguments.length;E++){var I=A.arguments[E];I.type==="operator"&&I.value==="?"?v.push(I):v.push(await R(I,x,L))}var F=await R(A.procedure,x,L);if(typeof F>"u"&&A.procedure.type==="path"&&L.lookup(A.procedure.steps[0].value))throw{code:"T1007",stack:new Error().stack,position:A.position,token:A.procedure.steps[0].value};if(g(F))p=pe(F,v,L);else if(F&&F._jsonata_function===!0)p=ae(F.implementation,v,L);else if(typeof F=="function")p=ae(F,v,L);else throw{code:"T1008",stack:new Error().stack,position:A.position,token:A.procedure.type==="path"?A.procedure.steps[0].value:A.procedure.value};return p}function j(A,x,L){if(typeof A>"u")return x;var p=A.validate(x,L);return p}async function re(A,x){var L,p=Re(A.environment);return Array.prototype.forEach.call(A.arguments,function(v,E){p.bind(v.value,x[E])}),typeof A.body=="function"?L=await Ve(A.body,p):L=await R(A.body,A.input,p),L}function pe(A,x,L){var p=Re(A.environment||L),v=[];Array.prototype.forEach.call(A.arguments,function(I,F){var X=x[F];X&&X.type==="operator"&&X.value==="?"?v.push(I):p.bind(I.value,X)});var E={_jsonata_lambda:!0,input:A.input,environment:p,arguments:v,body:A.body};return E}function ae(A,x,L){var p=Ae(A);p=p.map(function(F){return"$"+F.trim()});var v="function("+p.join(", ")+"){ _ }",E=l(v);E.body=A;var I=pe(E,x,L);return I}async function Ve(A,x){var L=Ae(A),p=L.map(function(I){return x.lookup(I.trim())}),v={environment:x,createSequence:x.base.createSequence},E=A.apply(v,p);return S(E)&&(E=await E),E}function Ae(A){var x=A.toString(),L=/\(([^)]*)\)/.exec(x)[1],p=L.split(",");return p}function oe(A,x){var L={_jsonata_function:!0,implementation:A};return typeof x<"u"&&(L.signature=c(x)),L}async function We(A,x){if(!(typeof A>"u")){var L=this.input;typeof x<"u"&&(L=x,Array.isArray(L)&&!_(L)&&(L=this.createSequence(L),L.outerWrapper=!0));try{var p=l(A,!1)}catch(E){throw Oe(E),{stack:new Error().stack,code:"D3120",value:E.message,error:E}}try{var v=await R(p,L,this.environment)}catch(E){throw Oe(E),{stack:new Error().stack,code:"D3121",value:E.message,error:E}}return v}}function Me(A){if(!(typeof A>"u"))return JSON.parse(a.string(A))}function Re(A){var x=Object.create(null);const L={bind:function(v,E){x[v]=E},lookup:function(v){var E;return Object.prototype.hasOwnProperty.call(x,v)?E=x[v]:A&&(E=A.lookup(v)),E},timestamp:A?A.timestamp:null,async:A?A.async:!1,isParallelCall:A?A.isParallelCall:!1,global:A?A.global:{ancestry:[null]}};if(A){var p=A.lookup(Symbol.for("jsonata.__createFrame_push"));p&&p(A,L),L.base=A.base}return L}T.bind("sum",oe(a.sum,"<a<n>:n>")),T.bind("count",oe(a.count,"<a:n>")),T.bind("max",oe(a.max,"<a<n>:n>")),T.bind("min",oe(a.min,"<a<n>:n>")),T.bind("average",oe(a.average,"<a<n>:n>")),T.bind("string",oe(a.string,"<x-b?:s>")),T.bind("substring",oe(a.substring,"<s-nn?:s>")),T.bind("substringBefore",oe(a.substringBefore,"<s-s:s>")),T.bind("substringAfter",oe(a.substringAfter,"<s-s:s>")),T.bind("lowercase",oe(a.lowercase,"<s-:s>")),T.bind("uppercase",oe(a.uppercase,"<s-:s>")),T.bind("length",oe(a.length,"<s-:n>")),T.bind("trim",oe(a.trim,"<s-:s>")),T.bind("pad",oe(a.pad,"<s-ns?:s>")),T.bind("match",oe(a.match,"<s-f<s:o>n?:a<o>>")),T.bind("contains",oe(a.contains,"<s-(sf):b>")),T.bind("replace",oe(a.replace,"<s-(sf)(sf)n?:s>")),T.bind("split",oe(a.split,"<s-(sf)n?:a<s>>")),T.bind("join",oe(a.join,"<a<s>s?:s>")),T.bind("formatNumber",oe(a.formatNumber,"<n-so?:s>")),T.bind("formatBase",oe(a.formatBase,"<n-n?:s>")),T.bind("formatInteger",oe(s.formatInteger,"<n-s:s>")),T.bind("parseInteger",oe(s.parseInteger,"<s-s:n>")),T.bind("number",oe(a.number,"<(nsb)-:n>")),T.bind("floor",oe(a.floor,"<n-:n>")),T.bind("ceil",oe(a.ceil,"<n-:n>")),T.bind("round",oe(a.round,"<n-n?:n>")),T.bind("abs",oe(a.abs,"<n-:n>")),T.bind("sqrt",oe(a.sqrt,"<n-:n>")),T.bind("power",oe(a.power,"<n-n:n>")),T.bind("random",oe(a.random,"<:n>")),T.bind("boolean",oe(a.boolean,"<x-:b>")),T.bind("not",oe(a.not,"<x-:b>")),T.bind("map",oe(a.map,"<af>")),T.bind("zip",oe(a.zip,"<a+>")),T.bind("filter",oe(a.filter,"<af>")),T.bind("single",oe(a.single,"<af?>")),T.bind("reduce",oe(a.foldLeft,"<afj?:j>")),T.bind("sift",oe(a.sift,"<o-f?:o>")),T.bind("keys",oe(a.keys,"<x-:a<s>>")),T.bind("lookup",oe(a.lookup,"<x-s:x>")),T.bind("append",oe(a.append,"<xx:a>")),T.bind("exists",oe(a.exists,"<x:b>")),T.bind("spread",oe(a.spread,"<x-:a<o>>")),T.bind("merge",oe(a.merge,"<a<o>:o>")),T.bind("reverse",oe(a.reverse,"<a:a>")),T.bind("each",oe(a.each,"<o-f:a>")),T.bind("error",oe(a.error,"<s?:x>")),T.bind("assert",oe(a.assert,"<bs?:x>")),T.bind("type",oe(a.type,"<x:s>")),T.bind("sort",oe(a.sort,"<af?:a>")),T.bind("shuffle",oe(a.shuffle,"<a:a>")),T.bind("distinct",oe(a.distinct,"<x:x>")),T.bind("base64encode",oe(a.base64encode,"<s-:s>")),T.bind("base64decode",oe(a.base64decode,"<s-:s>")),T.bind("encodeUrlComponent",oe(a.encodeUrlComponent,"<s-:s>")),T.bind("encodeUrl",oe(a.encodeUrl,"<s-:s>")),T.bind("decodeUrlComponent",oe(a.decodeUrlComponent,"<s-:s>")),T.bind("decodeUrl",oe(a.decodeUrl,"<s-:s>")),T.bind("eval",oe(We,"<sx?:x>")),T.bind("toMillis",oe(s.toMillis,"<s-s?:n>")),T.bind("fromMillis",oe(s.fromMillis,"<n-s?s?:s>")),T.bind("clone",oe(Me,"<(oa)-:o>"));var Ke={S0101:"String literal must be terminated by a matching quote",S0102:"Number out of range: {{token}}",S0103:"Unsupported escape sequence: \\{{token}}",S0104:"The escape sequence \\u must be followed by 4 hex digits",S0105:"Quoted property name must be terminated with a backquote (`)",S0106:"Comment has no closing tag",S0201:"Syntax error: {{token}}",S0202:"Expected {{value}}, got {{token}}",S0203:"Expected {{value}} before end of expression",S0204:"Unknown operator: {{token}}",S0205:"Unexpected token: {{token}}",S0206:"Unknown expression type: {{token}}",S0207:"Unexpected end of expression",S0208:"Parameter {{value}} of function definition must be a variable name (start with $)",S0209:"A predicate cannot follow a grouping expression in a step",S0210:"Each step can only have one grouping expression",S0211:"The symbol {{token}} cannot be used as a unary operator",S0212:"The left side of := must be a variable name (start with $)",S0213:"The literal value {{value}} cannot be used as a step within a path expression",S0214:"The right side of {{token}} must be a variable name (start with $)",S0215:"A context variable binding must precede any predicates on a step",S0216:"A context variable binding must precede the 'order-by' clause on a step",S0217:"The object representing the 'parent' cannot be derived from this expression",S0301:"Empty regular expressions are not allowed",S0302:"No terminating / in regular expression",S0402:"Choice groups containing parameterized types are not supported",S0401:"Type parameters can only be applied to functions and arrays",S0500:"Attempted to evaluate an expression containing syntax error(s)",T0410:"Argument {{index}} of function {{token}} does not match function signature",T0411:"Context value is not a compatible type with argument {{index}} of function {{token}}",T0412:"Argument {{index}} of function {{token}} must be an array of {{type}}",D1001:"Number out of range: {{value}}",D1002:"Cannot negate a non-numeric value: {{value}}",T1003:"Key in object structure must evaluate to a string; got: {{value}}",D1004:"Regular expression matches zero length string",T1005:"Attempted to invoke a non-function. Did you mean ${{{token}}}?",T1006:"Attempted to invoke a non-function",T1007:"Attempted to partially apply a non-function. Did you mean ${{{token}}}?",T1008:"Attempted to partially apply a non-function",D1009:"Multiple key definitions evaluate to same key: {{value}}",T1010:"The matcher function argument passed to function {{token}} does not return the correct object structure",D1011:"Stack overflow. Check for non-terminating recursive function. Consider rewriting as tail-recursive",D1012:"Evaluation timeout after {{value}} milliseconds. Check for infinite loop",D1013:"Object property names starting with _jsonata_ are reserved for internal use: {{value}}",T2001:"The left side of the {{token}} operator must evaluate to a number",T2002:"The right side of the {{token}} operator must evaluate to a number",T2003:"The left side of the range operator (..) must evaluate to an integer",T2004:"The right side of the range operator (..) must evaluate to an integer",D2005:"The left side of := must be a variable name (start with $)",T2006:"The right side of the function application operator ~> must be a function",T2007:"Type mismatch when comparing values {{value}} and {{value2}} in order-by clause",T2008:"The expressions within an order-by clause must evaluate to numeric or string values",T2009:"The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type",T2010:"The expressions either side of operator {{token}} must evaluate to numeric or string values",T2011:"The insert/update clause of the transform expression must evaluate to an object: {{value}}",T2012:"The delete clause of the transform expression must evaluate to a string or array of strings: {{value}}",T2013:"The transform expression clones the input object using the $clone() function. This has been overridden in the current scope by a non-function.",D2014:"The size of the sequence allocated by the range operator (..) must not exceed 1e7. Attempted to allocate {{value}}.",D2015:"The maximum sequence length of {{value}} was exceeded.",D3001:"Attempting to invoke string function on Infinity or NaN",D3010:"Second argument of replace function cannot be an empty string",D3011:"Fourth argument of replace function must evaluate to a positive number",D3012:"Attempted to replace a matched string with a non-string value",D3020:"Third argument of split function must evaluate to a positive number",D3030:"Unable to cast value to a number: {{value}}",D3040:"Third argument of match function must evaluate to a positive number",D3050:"The second argument of reduce function must be a function with at least two arguments",D3060:"The sqrt function cannot be applied to a negative number: {{value}}",D3061:"The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}}",D3070:"The single argument form of the sort function can only be applied to an array of strings or an array of numbers. Use the second argument to specify a comparison function",D3080:"The picture string must only contain a maximum of two sub-pictures",D3081:"The sub-picture must not contain more than one instance of the 'decimal-separator' character",D3082:"The sub-picture must not contain more than one instance of the 'percent' character",D3083:"The sub-picture must not contain more than one instance of the 'per-mille' character",D3084:"The sub-picture must not contain both a 'percent' and a 'per-mille' character",D3085:"The mantissa part of a sub-picture must contain at least one character that is either an 'optional digit character' or a member of the 'decimal digit family'",D3086:"The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character",D3087:"The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character",D3088:"The sub-picture must not contain a 'grouping-separator' at the end of the integer part",D3089:"The sub-picture must not contain two adjacent instances of the 'grouping-separator' character",D3090:"The integer part of the sub-picture must not contain a member of the 'decimal digit family' that is followed by an instance of the 'optional digit character'",D3091:"The fractional part of the sub-picture must not contain an instance of the 'optional digit character' that is followed by a member of the 'decimal digit family'",D3092:"A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator'",D3093:"The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family'",D3100:"The radix of the formatBase function must be between 2 and 36. It was given {{value}}",D3110:"The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}",D3120:"Syntax error in expression passed to function eval: {{value}}",D3121:"Dynamic error evaluating the expression passed to function eval: {{value}}",D3130:"Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation",D3131:"In a decimal digit pattern, all digits must be from the same decimal group",D3132:"Unknown component specifier {{value}} in date/time picture string",D3133:"The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}",D3134:"The timezone integer format specifier cannot have more than four digits",D3135:"No matching closing bracket ']' in date/time picture string",D3136:"The date/time picture string is missing specifiers required to parse the timestamp",D3137:"{{{message}}}",D3138:"The $single() function expected exactly 1 matching result. Instead it matched more.",D3139:"The $single() function expected exactly 1 matching result. Instead it matched 0.",D3140:"Malformed URL passed to ${{{functionName}}}(): {{value}}",D3141:"{{{message}}}"};function Oe(A){var x=Ke[A.code];if(typeof x<"u"){var L=x.replace(/\{\{\{([^}]+)}}}/g,function(){return A[arguments[1]]});L=L.replace(/\{\{([^}]+)}}/g,function(){return JSON.stringify(A[arguments[1]])}),A.message=L}}function Ce(A,x){var L,p;try{L=l(A,x&&x.recover),p=L.errors,delete L.errors}catch(I){throw Oe(I),I}var v=Re(T),E=new Date;return v.bind("now",oe(function(I,F){return s.fromMillis(E.getTime(),I,F)},"<s?s?:s>")),v.bind("millis",oe(function(){return E.getTime()},"<:n>")),{evaluate:async function(I,F,X){if(typeof p<"u"){var me={code:"S0500",position:0};throw Oe(me),me}const ve=Re(v);for(const Ne of o.keys(F))ve.bind(Ne,F[Ne]);if(ve.bind("$",I),E=new Date,ve.timestamp=E,ve.options=x,ve.createSequence=function(){var Ne=[];return x&&x.sequence&&(Ne.push=function(...mt){if(Ne.length+mt.length>x.sequence)throw{code:"D2015",stack:new Error().stack,value:x.sequence};return Array.prototype.push.apply(Ne,mt)}),Ne.sequence=!0,arguments.length===1&&Ne.push(arguments[0]),Ne},Array.isArray(I)&&!_(I)&&(I=ve.createSequence(I),I.outerWrapper=!0),x&&(x.timeout||x.stack)){const Ne=Date.now();ve.guardrails=function(){if(x.stack>0&&ve.depth>x.stack)throw{code:"D1011",value:x.stack,stack:new Error().stack};if(x.timeout>0&&Date.now()-Ne>x.timeout)throw{code:"D1012",value:x.timeout,stack:new Error().stack}}}else ve.guardrails=function(){};ve.base=ve,ve.depth=0,x&&x.RegexEngine?ve.RegexEngine=x.RegexEngine:ve.RegexEngine=RegExp;var Ye;try{return Ye=await R(L,I,ve),typeof X=="function"&&X(null,Ye),Ye}catch(Ne){throw Oe(Ne),Ne}},assign:function(I,F){v.bind(I,F)},registerFunction:function(I,F,X){var me=oe(F,X);v.bind(I,me)},ast:function(){return L},errors:function(){return p}}}return Ce.parser=l,Ce})();n.exports=h},{"./datetime":1,"./functions":2,"./parser":4,"./signature":5,"./utils":6}],4:[function(t,n,r){var s=t("./signature");const a=(()=>{var o={".":75,"[":80,"]":0,"{":70,"}":0,"(":80,")":0,",":0,"@":80,"#":80,";":80,":":80,"?":20,"+":50,"-":50,"*":60,"/":60,"%":60,"|":20,"=":40,"<":40,">":40,"^":40,"**":60,"..":20,":=":10,"!=":40,"<=":40,">=":40,"~>":40,"?:":40,"??":40,and:30,or:25,in:40,"&":50,"!":0,"~":0},l={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
3920
|
+
`,r:"\r",t:" "},c=function(u){var f=0,d=u.length,_=function(m,S){var y={type:m,value:S,position:f};return y},b=function(){for(var m=f,S=0,y,M,T=function(k){if(u.charAt(k)==="/"&&S===0){for(var B=0;u.charAt(k-(B+1))==="\\";)B++;if(B%2===0)return!0}return!1};f<d;){var R=u.charAt(f);if(T(f)){if(y=u.substring(m,f),y==="")throw{code:"S0301",stack:new Error().stack,position:f};for(f++,R=u.charAt(f),m=f;R==="i"||R==="m";)f++,R=u.charAt(f);return M=u.substring(m,f)+"g",new RegExp(y,M)}(R==="("||R==="["||R==="{")&&u.charAt(f-1)!=="\\"&&S++,(R===")"||R==="]"||R==="}")&&u.charAt(f-1)!=="\\"&&S--,f++}throw{code:"S0302",stack:new Error().stack,position:f}},g=function(m){if(f>=d)return null;for(var S=u.charAt(f);f<d&&`
|
|
3921
|
+
\r\v`.indexOf(S)>-1;)f++,S=u.charAt(f);if(S==="/"&&u.charAt(f+1)==="*"){var y=f;for(f+=2,S=u.charAt(f);!(S==="*"&&u.charAt(f+1)==="/");)if(S=u.charAt(++f),f>=d)throw{code:"S0106",stack:new Error().stack,position:y};return f+=2,S=u.charAt(f),g(m)}if(m!==!0&&S==="/")return f++,_("regex",b());if(S==="."&&u.charAt(f+1)===".")return f+=2,_("operator","..");if(S===":"&&u.charAt(f+1)==="=")return f+=2,_("operator",":=");if(S==="!"&&u.charAt(f+1)==="=")return f+=2,_("operator","!=");if(S===">"&&u.charAt(f+1)==="=")return f+=2,_("operator",">=");if(S==="<"&&u.charAt(f+1)==="=")return f+=2,_("operator","<=");if(S==="*"&&u.charAt(f+1)==="*")return f+=2,_("operator","**");if(S==="~"&&u.charAt(f+1)===">")return f+=2,_("operator","~>");if(S==="?"&&u.charAt(f+1)===":")return f+=2,_("operator","?:");if(S==="?"&&u.charAt(f+1)==="?")return f+=2,_("operator","??");if(Object.prototype.hasOwnProperty.call(o,S))return f++,_("operator",S);if(S==='"'||S==="'"){var M=S;f++;for(var T="";f<d;){if(S=u.charAt(f),S==="\\")if(f++,S=u.charAt(f),Object.prototype.hasOwnProperty.call(l,S))T+=l[S];else if(S==="u"){var R=u.substr(f+1,4);if(/^[0-9a-fA-F]+$/.test(R)){var k=parseInt(R,16);T+=String.fromCharCode(k),f+=4}else throw{code:"S0104",stack:new Error().stack,position:f}}else throw{code:"S0103",stack:new Error().stack,position:f,token:S};else{if(S===M)return f++,_("string",T);T+=S}f++}throw{code:"S0101",stack:new Error().stack,position:f}}var B=/^-?(0|([1-9][0-9]*))(\.[0-9]+)?([Ee][-+]?[0-9]+)?/,C=B.exec(u.substring(f));if(C!==null){var D=parseFloat(C[0]);if(!isNaN(D)&&isFinite(D))return f+=C[0].length,_("number",D);throw{code:"S0102",stack:new Error().stack,position:f,token:C[0]}}var V;if(S==="`"){f++;var K=u.indexOf("`",f);if(K!==-1)return V=u.substring(f,K),f=K+1,_("name",V);throw f=d,{code:"S0105",stack:new Error().stack,position:f}}for(var J=f,se;;)if(se=u.charAt(J),J===d||`
|
|
3922
|
+
\r\v`.indexOf(se)>-1||Object.prototype.hasOwnProperty.call(o,se)){if(u.charAt(f)==="$")return V=u.substring(f+1,J),f=J,_("variable",V);switch(V=u.substring(f,J),f=J,V){case"or":case"in":case"and":return _("operator",V);case"true":return _("value",!0);case"false":return _("value",!1);case"null":return _("value",null);default:return f===d&&V===""?null:_("name",V)}}else J++};return g},h=function(u,f){var d,_,b=Object.create(null),g=[],m=function(){var O=[];d.id!=="(end)"&&O.push({type:d.type,value:d.value,position:d.position});for(var H=_();H!==null;)O.push(H),H=_();return O},S={nud:function(){var O={code:"S0211",token:this.value,position:this.position};if(f)return O.remaining=m(),O.type="error",g.push(O),O;throw O.stack=new Error().stack,O}},y=function(O,H){var we=b[O];return H=H||0,we?H>=we.lbp&&(we.lbp=H):(we=Object.create(S),we.id=we.value=O,we.lbp=H,b[O]=we),we},M=function(O){if(f){O.remaining=m(),g.push(O);var H=b["(error)"];return d=Object.create(H),d.error=O,d.type="(error)",d}else throw O.stack=new Error().stack,O},T=function(O,H){if(O&&d.id!==O){var we;d.id==="(end)"?we="S0203":we="S0202";var Be={code:we,position:d.position,token:d.value,value:O};return M(Be)}var ie=_(H);if(ie===null)return d=b["(end)"],d.position=u.length,d;var ce=ie.value,z=ie.type,q;switch(z){case"name":case"variable":q=b["(name)"];break;case"operator":if(q=b[ce],!q)return M({code:"S0204",stack:new Error().stack,position:ie.position,token:ce});break;case"string":case"number":case"value":q=b["(literal)"];break;case"regex":z="regex",q=b["(regex)"];break;default:return M({code:"S0205",stack:new Error().stack,position:ie.position,token:ce})}return d=Object.create(q),d.value=ce,d.type=z,d.position=ie.position,d},R=function(O){var H,we=d;for(T(null,!0),H=we.nud();O<d.lbp;)we=d,T(),H=we.led(H);return H},k=function(O){var H=y(O,0);H.nud=function(){return this}},B=function(O,H,we){var Be=H||o[O],ie=y(O,Be);return ie.led=we||function(ce){return this.lhs=ce,this.rhs=R(Be),this.type="binary",this},ie},C=function(O,H,we){var Be=y(O,H);return Be.led=we,Be},D=function(O,H){var we=y(O);return we.nud=H||function(){return this.expression=R(70),this.type="unary",this},we};k("(end)"),k("(name)"),k("(literal)"),k("(regex)"),y(":"),y(";"),y(","),y(")"),y("]"),y("}"),y(".."),B("."),B("+"),B("-"),B("*"),B("/"),B("%"),B("="),B("<"),B(">"),B("!="),B("<="),B(">="),B("&"),B("and"),B("or"),B("in"),k("and"),k("or"),k("in"),D("-"),B("~>"),B("??",o["??"],function(O){return this.type="condition",this.condition={type:"function",value:"(",procedure:{type:"variable",value:"exists"},arguments:[JSON.parse(JSON.stringify(O))]},this.then=O,this.else=R(0),this}),C("(error)",10,function(O){return this.lhs=O,this.error=d.error,this.remaining=m(),this.type="error",this}),D("*",function(){return this.type="wildcard",this}),D("**",function(){return this.type="descendant",this}),D("%",function(){return this.type="parent",this}),B("(",o["("],function(O){if(this.procedure=O,this.type="function",this.arguments=[],d.id!==")")for(;d.type==="operator"&&d.id==="?"?(this.type="partial",this.arguments.push(d),T("?")):this.arguments.push(R(0)),d.id===",";)T(",");if(T(")",!0),O.type==="name"&&(O.value==="function"||O.value==="λ")){if(this.arguments.forEach(function(ce,z){if(ce.type!=="variable")return M({code:"S0208",stack:new Error().stack,position:ce.position,token:ce.value,value:z+1})}),this.type="lambda",d.id==="<"){for(var H=d.position,we=1,Be="<";we>0&&d.id!=="{"&&d.id!=="(end)";){var ie=T();ie.id===">"?we--:ie.id==="<"&&we++,Be+=ie.value}T(">");try{this.signature=s(Be)}catch(ce){return ce.position=H+ce.offset,M(ce)}}T("{"),this.body=R(0),T("}")}return this}),D("(",function(){for(var O=[];d.id!==")"&&(O.push(R(0)),d.id===";");)T(";");return T(")",!0),this.type="block",this.expressions=O,this}),D("[",function(){var O=[];if(d.id!=="]")for(;;){var H=R(0);if(d.id===".."){var we={type:"binary",value:"..",position:d.position,lhs:H};T(".."),we.rhs=R(0),H=we}if(O.push(H),d.id!==",")break;T(",")}return T("]",!0),this.expressions=O,this.type="unary",this}),B("[",o["["],function(O){if(d.id==="]"){for(var H=O;H&&H.type==="binary"&&H.value==="[";)H=H.lhs;return H.keepArray=!0,T("]"),O}else return this.lhs=O,this.rhs=R(o["]"]),this.type="binary",T("]",!0),this}),B("^",o["^"],function(O){T("(");for(var H=[];;){var we={descending:!1};if(d.id==="<"?T("<"):d.id===">"&&(we.descending=!0,T(">")),we.expression=R(0),H.push(we),d.id!==",")break;T(",")}return T(")"),this.lhs=O,this.rhs=H,this.type="binary",this});var V=function(O){var H=[];if(d.id!=="}")for(;;){var we=R(0);T(":");var Be=R(0);if(H.push([we,Be]),d.id!==",")break;T(",")}return T("}",!0),typeof O>"u"?(this.lhs=H,this.type="unary"):(this.lhs=O,this.rhs=H,this.type="binary"),this};D("{",V),B("{",o["{"],V),C(":=",o[":="],function(O){return O.type!=="variable"?M({code:"S0212",stack:new Error().stack,position:O.position,token:O.value}):(this.lhs=O,this.rhs=R(o[":="]-1),this.type="binary",this)}),B("@",o["@"],function(O){return this.lhs=O,this.rhs=R(o["@"]),this.rhs.type!=="variable"?M({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"@"}):(this.type="binary",this)}),B("#",o["#"],function(O){return this.lhs=O,this.rhs=R(o["#"]),this.rhs.type!=="variable"?M({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"#"}):(this.type="binary",this)}),B("?",o["?"],function(O){return this.type="condition",this.condition=O,this.then=R(0),d.id===":"&&(T(":"),this.else=R(0)),this}),B("?:",o["?:"],function(O){return this.type="condition",this.condition=JSON.parse(JSON.stringify(O)),this.then=O,this.else=R(0),this}),D("|",function(){return this.type="transform",this.pattern=R(0),T("|"),this.update=R(0),d.id===","&&(T(","),this.delete=R(0)),T("|"),this});var K=function(O){var H;if(O.type==="function"&&!O.predicate){var we={type:"lambda",thunk:!0,arguments:[],position:O.position};we.body=O,H=we}else if(O.type==="condition")O.then=K(O.then),typeof O.else<"u"&&(O.else=K(O.else)),H=O;else if(O.type==="block"){var Be=O.expressions.length;Be>0&&(O.expressions[Be-1]=K(O.expressions[Be-1])),H=O}else H=O;return H},J=0,se=0,he=[],Q=function(O,H){switch(O.type){case"name":case"wildcard":H.level--,H.level===0&&(typeof O.ancestor>"u"||(he[H.index].slot.label=O.ancestor.label),O.ancestor=H,O.tuple=!0);break;case"parent":H.level++;break;case"block":O.expressions.length>0&&(O.tuple=!0,H=Q(O.expressions[O.expressions.length-1],H));break;case"path":O.tuple=!0;var we=O.steps.length-1;for(H=Q(O.steps[we--],H);H.level>0&&we>=0;)H=Q(O.steps[we--],H);break;default:throw{code:"S0217",token:O.type,position:O.position}}return H},de=function(O,H){if(typeof H.seekingParent<"u"||H.type==="parent"){var we=typeof H.seekingParent<"u"?H.seekingParent:[];H.type==="parent"&&we.push(H.slot),typeof O.seekingParent>"u"?O.seekingParent=we:Array.prototype.push.apply(O.seekingParent,we)}},ne=function(O){var H=O.steps.length-1,we=O.steps[H],Be=typeof we.seekingParent<"u"?we.seekingParent:[];we.type==="parent"&&Be.push(we.slot);for(var ie=0;ie<Be.length;ie++){var ce=Be[ie];for(H=O.steps.length-2;ce.level>0;){if(H<0){typeof O.seekingParent>"u"?O.seekingParent=[ce]:O.seekingParent.push(ce);break}for(var z=O.steps[H--];H>=0&&z.focus&&O.steps[H].focus;)z=O.steps[H--];ce=Q(z,ce)}}},ue=function(O){var H;switch(O.type){case"binary":switch(O.value){case".":var we=ue(O.lhs);we.type==="path"?H=we:H={type:"path",steps:[we]},we.type==="parent"&&(H.seekingParent=[we.slot]);var Be=ue(O.rhs);Be.type==="path"?Array.prototype.push.apply(H.steps,Be.steps):(typeof Be.predicate<"u"&&(Be.stages=Be.predicate,delete Be.predicate),H.steps.push(Be)),H.steps.filter(function(fe){if(fe.type==="number"||fe.type==="value")throw{code:"S0213",stack:new Error().stack,position:fe.position,value:fe.value};return fe.type==="string"}).forEach(function(fe){fe.type="name"}),H.steps.filter(function(fe){return fe.keepArray===!0}).length>0&&(H.keepSingletonArray=!0);var ie=H.steps[0];ie.type==="unary"&&ie.value==="["&&(ie.consarray=!0);var ce=H.steps[H.steps.length-1];ce.type==="unary"&&ce.value==="["&&(ce.consarray=!0),ne(H);break;case"[":H=ue(O.lhs);var z=H,q="predicate";if(H.type==="path"&&(z=H.steps[H.steps.length-1],q="stages"),typeof z.group<"u")throw{code:"S0209",stack:new Error().stack,position:O.position};typeof z[q]>"u"&&(z[q]=[]);var W=ue(O.rhs);typeof W.seekingParent<"u"&&(W.seekingParent.forEach(fe=>{fe.level===1?Q(z,fe):fe.level--}),de(z,W)),z[q].push({type:"filter",expr:W,position:O.position});break;case"{":if(H=ue(O.lhs),typeof H.group<"u")throw{code:"S0210",stack:new Error().stack,position:O.position};H.group={lhs:O.rhs.map(function(fe){return[ue(fe[0]),ue(fe[1])]}),position:O.position};break;case"^":H=ue(O.lhs),H.type!=="path"&&(H={type:"path",steps:[H]});var le={type:"sort",position:O.position};le.terms=O.rhs.map(function(fe){var ye=ue(fe.expression);return de(le,ye),{descending:fe.descending,expression:ye}}),H.steps.push(le),ne(H);break;case":=":H={type:"bind",value:O.value,position:O.position},H.lhs=ue(O.lhs),H.rhs=ue(O.rhs),de(H,H.rhs);break;case"@":if(H=ue(O.lhs),z=H,H.type==="path"&&(z=H.steps[H.steps.length-1]),typeof z.stages<"u"||typeof z.predicate<"u")throw{code:"S0215",stack:new Error().stack,position:O.position};if(z.type==="sort")throw{code:"S0216",stack:new Error().stack,position:O.position};O.keepArray&&(z.keepArray=!0),z.focus=O.rhs.value,z.tuple=!0;break;case"#":H=ue(O.lhs),z=H,H.type==="path"?z=H.steps[H.steps.length-1]:(H={type:"path",steps:[H]},typeof z.predicate<"u"&&(z.stages=z.predicate,delete z.predicate)),typeof z.stages>"u"?z.index=O.rhs.value:z.stages.push({type:"index",value:O.rhs.value,position:O.position}),z.tuple=!0;break;case"~>":H={type:"apply",value:O.value,position:O.position},H.lhs=ue(O.lhs),H.rhs=ue(O.rhs),H.keepArray=H.lhs.keepArray||H.rhs.keepArray;break;default:H={type:O.type,value:O.value,position:O.position},H.lhs=ue(O.lhs),H.rhs=ue(O.rhs),de(H,H.lhs),de(H,H.rhs)}break;case"unary":H={type:O.type,value:O.value,position:O.position},O.value==="["?H.expressions=O.expressions.map(function(fe){var ye=ue(fe);return de(H,ye),ye}):O.value==="{"?H.lhs=O.lhs.map(function(fe){var ye=ue(fe[0]);de(H,ye);var Se=ue(fe[1]);return de(H,Se),[ye,Se]}):(H.expression=ue(O.expression),O.value==="-"&&H.expression.type==="number"?(H=H.expression,H.value=-H.value):de(H,H.expression));break;case"function":case"partial":H={type:O.type,name:O.name,value:O.value,position:O.position},H.arguments=O.arguments.map(function(fe){var ye=ue(fe);return de(H,ye),ye}),H.procedure=ue(O.procedure);break;case"lambda":H={type:O.type,arguments:O.arguments,signature:O.signature,position:O.position};var be=ue(O.body);H.body=K(be);break;case"condition":H={type:O.type,position:O.position},H.condition=ue(O.condition),de(H,H.condition),H.then=ue(O.then),de(H,H.then),typeof O.else<"u"&&(H.else=ue(O.else),de(H,H.else));break;case"transform":H={type:O.type,position:O.position},H.pattern=ue(O.pattern),H.update=ue(O.update),typeof O.delete<"u"&&(H.delete=ue(O.delete));break;case"block":H={type:O.type,position:O.position},H.expressions=O.expressions.map(function(fe){var ye=ue(fe);return de(H,ye),(ye.consarray||ye.type==="path"&&ye.steps[0].consarray)&&(H.consarray=!0),ye});break;case"name":H={type:"path",steps:[O]},O.keepArray&&(H.keepSingletonArray=!0);break;case"parent":H={type:"parent",slot:{label:"!"+J++,level:1,index:se++}},he.push(H);break;case"string":case"number":case"value":case"wildcard":case"descendant":case"variable":case"regex":H=O;break;case"operator":if(O.value==="and"||O.value==="or"||O.value==="in")O.type="name",H=ue(O);else if(O.value==="?")H=O;else throw{code:"S0201",stack:new Error().stack,position:O.position,token:O.value};break;case"error":H=O,O.lhs&&(H=ue(O.lhs));break;default:var U="S0206";O.id==="(end)"&&(U="S0207");var ee={code:U,position:O.position,token:O.value};if(f)return g.push(ee),{type:"error",error:ee};throw ee.stack=new Error().stack,ee}return O.keepArray&&(H.keepArray=!0),H};_=c(u),T();var Te=R(0);if(d.id!=="(end)"){var ke={code:"S0201",position:d.position,token:d.value};M(ke)}if(Te=ue(Te),Te.type==="parent"||typeof Te.seekingParent<"u")throw{code:"S0217",token:Te.type,position:Te.position};return g.length>0&&(Te.errors=g),Te};return h})();n.exports=a},{"./signature":5}],5:[function(t,n,r){var s=t("./utils");const a=(()=>{var o={a:"arrays",b:"booleans",f:"functions",n:"numbers",o:"objects",s:"strings"};function l(c){for(var h=1,u=[],f=Object.create(null),d=f;h<c.length;){var _=c.charAt(h);if(_===":")break;var b=function(){u.push(f),d=f,f=Object.create(null)},g=function(B,C,D,V){for(var K=1,J=C;J<B.length;)if(J++,_=B.charAt(J),_===V){if(K--,K===0)break}else _===D&&K++;return J};switch(_){case"s":case"n":case"b":case"l":case"o":f.regex="["+_+"m]",f.type=_,b();break;case"a":f.regex="[asnblfom]",f.type=_,f.array=!0,b();break;case"f":f.regex="f",f.type=_,b();break;case"j":f.regex="[asnblom]",f.type=_,b();break;case"x":f.regex="[asnblfom]",f.type=_,b();break;case"-":d.context=!0,d.contextRegex=new RegExp(d.regex),d.regex+="?";break;case"?":case"+":d.regex+=_;break;case"(":var m=g(c,h,"(",")"),S=c.substring(h+1,m);if(S.indexOf("<")===-1)f.regex="["+S+"m]";else throw{code:"S0402",stack:new Error().stack,value:S,offset:h};f.type="("+S+")",h=m,b();break;case"<":if(d.type==="a"||d.type==="f"){var y=g(c,h,"<",">");d.subtype=c.substring(h+1,y),h=y}else throw{code:"S0401",stack:new Error().stack,value:d.type,offset:h};break}h++}var M="^"+u.map(function(B){return"("+B.regex+")"}).join("")+"$",T=new RegExp(M),R=function(B){var C;if(s.isFunction(B))C="f";else{var D=typeof B;switch(D){case"string":C="s";break;case"number":C="n";break;case"boolean":C="b";break;case"object":B===null?C="l":Array.isArray(B)?C="a":C="o";break;case"undefined":default:C="m"}}return C},k=function(B,C){for(var D="^",V=0,K=0;K<u.length;K++){D+=u[K].regex;var J=C.match(D);if(J===null)throw{code:"T0410",stack:new Error().stack,value:B[V],index:V+1};V=J[0].length}throw{code:"T0410",stack:new Error().stack,value:B[V],index:V+1}};return{definition:c,validate:function(B,C){var D="";B.forEach(function(se){D+=R(se)});var V=T.exec(D);if(V){var K=[],J=0;return u.forEach(function(se,he){var Q=B[J],de=V[he+1];if(de==="")if(se.context&&se.contextRegex){var ne=R(C);if(se.contextRegex.test(ne))K.push(C);else throw{code:"T0411",stack:new Error().stack,value:C,index:J+1}}else K.push(Q),J++;else de.split("").forEach(function(ue){if(Q=B[J],se.type==="a"){if(ue==="m")Q=void 0;else{var Te=!0;if(typeof se.subtype<"u"){if(ue!=="a"&&de!==se.subtype)Te=!1;else if(ue==="a"&&Q.length>0){var ke=R(Q[0]);if(ke!==se.subtype.charAt(0))Te=!1;else{var O=Q.filter(function(H){return R(H)!==ke});Te=O.length===0}}}if(!Te)throw{code:"T0412",stack:new Error().stack,value:Q,index:J+1,type:o[se.subtype]};ue!=="a"&&(Q=[Q])}K.push(Q),J++}else K.push(Q),J++})}),K}k(B,D)}}}return l})();n.exports=a},{"./utils":6}],6:[function(t,n,r){const s=(()=>{function a(y){var M=!1;if(typeof y=="number"&&(M=!isNaN(y),M&&!isFinite(y)))throw{code:"D1001",value:y,stack:new Error().stack};return M}function o(y){var M=!1;return Array.isArray(y)&&(M=y.filter(function(T){return typeof T!="string"}).length===0),M}function l(y){var M=!1;return Array.isArray(y)&&(M=y.filter(function(T){return!a(T)}).length===0),M}function c(y){return y.sequence===!0&&Array.isArray(y)}function h(y){return y&&(y._jsonata_function===!0||y._jsonata_lambda===!0)||typeof y=="function"}function u(y){var M=typeof y.arity=="number"?y.arity:typeof y.implementation=="function"?y.implementation.length:typeof y.length=="number"?y.length:y.arguments.length;return M}function f(y){return y&&y._jsonata_lambda===!0}var d=(typeof Symbol=="function"?Symbol:{}).iterator||"@@iterator";function _(y){return typeof y=="object"&&y!==null&&d in y&&"next"in y&&typeof y.next=="function"}function b(y,M){if(y===M)return!0;if(typeof y=="object"&&typeof M=="object"&&y!==null&&M!==null){if(Array.isArray(y)&&Array.isArray(M)){if(y.length!==M.length)return!1;for(var T=0;T<y.length;T++)if(!b(y[T],M[T]))return!1;return!0}var R=Object.getOwnPropertyNames(y),k=Object.getOwnPropertyNames(M);if(R.length!==k.length)return!1;for(R=R.sort(),k=k.sort(),T=0;T<R.length;T++)if(R[T]!==k[T])return!1;for(T=0;T<R.length;T++){var B=R[T];if(!b(y[B],M[B]))return!1}return!0}return!1}function g(y){return typeof y=="object"&&y!==null&&"then"in y&&typeof y.then=="function"}function m(y){var M=[];for(let T of y)M.push(T);return M}function S(y){return typeof y=="object"&&y!==null?Object.keys(y):[]}return{isNumeric:a,isArrayOfStrings:o,isArrayOfNumbers:l,isSequence:c,isFunction:h,isLambda:f,isIterable:_,getFunctionArity:u,isDeepEqual:b,stringToArray:m,isPromise:g,keys:S}})();n.exports=s},{}]},{},[3])(3)})})(uc)),uc.exports}Fb();const kb=150,Uf=10,Bb=200,zb=16,Nf=new WeakMap;let Of=!1;function xa(){return typeof navigator>"u"?!1:/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function ms(i){if(i===window)return{x:window.scrollX,y:window.scrollY};const e=i;return{x:e.scrollLeft,y:e.scrollTop}}function Hb(i,e,t){if(i===window){window.scrollTo(e,t);return}const n=i;typeof n.scrollTo=="function"?n.scrollTo(e,t):(n.scrollLeft=e,n.scrollTop=t)}function Vb(i){if(i===window){const t=document.documentElement;return Math.max(0,t.scrollHeight-window.innerHeight)}const e=i;return Math.max(0,e.scrollHeight-e.clientHeight)}function Lr(i){let e=Nf.get(i);if(!e){const t=ms(i);e={x:t.x,y:t.y,restoring:!1,watching:!1,userEngaged:!1,raf:0,stickyFrames:0},Nf.set(i,e)}return e}function ba(i){Lr(i).userEngaged=!0}function Sa(i){const e=Lr(i);clearTimeout(e.settleTimer),e.settleTimer=setTimeout(()=>{e.userEngaged=!1,e.settleTimer=void 0},kb)}function Ff(i,e){return e-i>=Bb}function Ir(i){if(!xa())return;const e=Lr(i);if(e.restoring)return;const t=ms(i);if(Ff(t.y,e.y)){hc(i);return}e.x=t.x,e.y=t.y}function Gb(i){if(!xa())return;const e=Lr(i),t=Vb(i),n=e.x,r=t>0?Math.min(e.y,t):e.y,{x:s,y:a}=ms(i);if(!(Math.abs(n-s)<=Uf&&Math.abs(r-a)<=Uf)){e.restoring=!0;try{Hb(i,n,r)}finally{requestAnimationFrame(()=>{e.restoring=!1})}}}function hc(i){const e=Lr(i);if(e.stickyFrames=zb,e.raf)return;const t=()=>{e.raf=0,Gb(i),e.stickyFrames>0&&(e.stickyFrames--,e.raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)}function fc(i){hc(i)}function gs(i){if(!xa())return;const e=Lr(i);if(e.watching)return;e.watching=!0;const t=i===window?window:i,n=()=>{if(e.restoring)return;const{y:_}=ms(i);if(Ff(_,e.y)){hc(i);return}if(e.userEngaged){Ir(i),Sa(i);return}Ir(i)},r=_=>kf(_)===i,s=_=>{r(_)&&(Ir(i),ba(i))},a=_=>{r(_)&&Sa(i)},o=_=>{r(_)&&(Ir(i),ba(i),Sa(i))};t.addEventListener("scroll",n,{passive:!0}),t.addEventListener("touchstart",s,{passive:!0}),t.addEventListener("touchend",a,{passive:!0}),t.addEventListener("touchcancel",a,{passive:!0}),t.addEventListener("wheel",o,{passive:!0}),t.addEventListener("pointerdown",s,{passive:!0}),t.addEventListener("pointerup",a,{passive:!0}),t.addEventListener("pointercancel",a,{passive:!0});const l=ms(i);if(e.x=l.x,e.y=l.y,i===window){const _=new ResizeObserver(()=>fc(window));_.observe(document.documentElement),e.resizeObserver=_;return}const c=i,h=new ResizeObserver(()=>fc(c));h.observe(c);for(const _ of Array.from(c.children))h.observe(_);e.resizeObserver=h;const u=()=>fc(c),f=new MutationObserver(_=>{for(const b of _)if(b.type==="childList")for(const g of Array.from(b.addedNodes))g instanceof Element&&h.observe(g);u()});f.observe(c,{childList:!0,subtree:!0,characterData:!0});const d=c.getRootNode();d instanceof ShadowRoot&&d.host&&f.observe(d.host,{childList:!0,subtree:!0,characterData:!0}),e.mutationObserver=f}function kf(i){for(const e of i.composedPath())if(!(e===window||e===document)&&e instanceof HTMLElement&&Bf(e))return e;return window}function Bf(i){if(!(i instanceof HTMLElement)||i===document.documentElement||i===document.body)return!1;const e=getComputedStyle(i).overflowY;return e==="auto"||e==="scroll"||e==="overlay"}function dc(i){for(const t of i.composedPath())t===window||t===document||t instanceof HTMLElement&&Bf(t)&&gs(t);const e=kf(i);gs(e),i.type==="wheel"?(Ir(e),ba(e),Sa(e)):(i.type==="touchstart"||i.type==="pointerdown")&&(Ir(e),ba(e))}function Ma(i){i instanceof Element&&i.classList?.contains("custom-scroll")&&gs(i),i.querySelectorAll?.(".custom-scroll").forEach(e=>{e instanceof HTMLElement&&gs(e)})}function pc(i){Ma(i),new MutationObserver(t=>{for(const n of t)for(const r of Array.from(n.addedNodes))r instanceof Element&&Ma(r)}).observe(i,{childList:!0,subtree:!0})}function mc(i){i.querySelectorAll?.("*").forEach(e=>{e.shadowRoot&&(pc(e.shadowRoot),mc(e.shadowRoot))})}function Wb(){const i=Element.prototype;if(i.__safariScrollGuardPatched)return;i.__safariScrollGuardPatched=!0;const e=i.attachShadow;i.attachShadow=function(n){const r=e.call(this,n);return pc(r),r}}function Xb(){if(typeof window>"u"||Of||(Of=!0,!xa()))return;gs(window),Wb();const i={capture:!0,passive:!0};window.addEventListener("wheel",dc,i),window.addEventListener("touchstart",dc,i),window.addEventListener("pointerdown",dc,i);const e=()=>{Ma(document),mc(document)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e(),new MutationObserver(n=>{for(const r of n)for(const s of Array.from(r.addedNodes))s instanceof Element&&(Ma(s),s.shadowRoot&&pc(s.shadowRoot),mc(s))}).observe(document.documentElement,{childList:!0,subtree:!0})}const $b=vb,qb=xb,jb=oc,Yb=rc,Kb=ri,Zb=Db,Jb=ga,Qb=lc,eS=Ob;Xb(),window["concorde-utils"]=window["concorde-utils"]||{},window["concorde-utils"]={Utils:$b,Arrays:qb,DataBindObserver:jb,Format:Yb,HTML:Kb,LocationHandler:Zb,Objects:Jb,PublisherManager:Xt,api:Qb,URLPattern:eS,Endpoint:cc,DataProviderKey:ma};function zf(i){const e=i.aspectRatio.trim();if(e){i.style.setProperty("--sonic-3d-ar",e.includes("/")?e:e.replace(":"," / "));return}i.style.removeProperty("--sonic-3d-ar")}function Hf(i){i.formPublisher&&(i.formPublisher.offInternalMutation(i.onFormMutation),i.formPublisher=null)}function Vf(i){Hf(i);const e=ic.resolveFormProviderId(i,i.dataProvider);e&&(i.formPublisher=Xt.get(e),i.formPublisher.onInternalMutation(i.onFormMutation),i.onFormMutation())}function Gf(i){const e=ic.resolveOutProviderId(i,i.outDataProvider,i.dataProvider);i.outPublisher=e?Xt.get(e):null}function tS(i){zf(i),i.resizeObserver=new ResizeObserver(()=>Bi.syncSize(i)),i.resizeObserver.observe(i),i.intersectionObserver=new IntersectionObserver(e=>{i.inView=e.some(t=>t.isIntersecting),Bi.syncVisibility(i)},{threshold:0}),i.intersectionObserver.observe(i),Vf(i),Gf(i),requestAnimationFrame(()=>{(i.inView||!i.releaseOffscreen||Es(i))&&Bi.ensureRuntime(i)})}const bi={applyAspectRatio:zf,unbindFormProvider:Hf,bindFormProvider:Vf,bindOutPublisher:Gf,firstUpdated:tS},Wf=["frameUrl","snapshot"];function Xf(i){if(!i.outPublisher)return!1;if(i.frameOut)return!0;for(const e of Wf)if(ka(i.outPublisher,e))return!0;return!1}function nS(i,e){return{url:URL.createObjectURL(e),blob:e,width:i.width,height:i.height,mime:e.type||Bc}}function iS(i){return new Promise(e=>{if(typeof i.toBlob!="function"){e(null);return}const t=n=>{if(!n){e(null);return}e(nS(i,n))};try{i.toBlob(t,Bc,Rd)}catch{e(null)}})}function rS(i,e){const t=i.outPublisher;if(t){try{t.frameUrl.set(e.url)}catch{}try{t.snapshot.set(e)}catch{}}}function sS(i,e){if(i.snapshotBusy||!i.runtime||!Xf(i))return;const t=Math.max(Ad,Number.isFinite(i.snapshotInterval)&&i.snapshotInterval>0?i.snapshotInterval:kc);if(e-i.lastSnapshotAt<t)return;i.lastSnapshotAt=e,i.snapshotBusy=!0;const n=++i.snapshotSeq,r=i.runtime.renderer.domElement;iS(r).then(s=>{if(i.snapshotBusy=!1,!s||n!==i.snapshotSeq){s&&Na([s.url]);return}Na(i.frameUrls),i.frameUrls=[s.url],rS(i,s)})}function aS(i){i.snapshotSeq++,i.snapshotBusy=!1,Na(i.frameUrls),i.frameUrls=[]}const gc={wantsFrameCapture:Xf,maybeCapture:sS,revokeAll:aS,FRAME_KEYS:Wf};function $f(i){if(i.outEventListeners>0||i.frameOut&&i.outPublisher)return!0;if(!i.outPublisher)return!1;for(const e of Dd)if(ka(i.outPublisher,e))return!0;return!1}function qf(i,e){return!(!Pd.includes(e)||!i.formPublisher||i.formPublisher!==i.outPublisher)}function jf(i,e){return{...i.runtime?.snapshot({time:e,frame:i.frame,hovering:i.hovering?1:0,pointerX:i.pointerX,pointerY:i.pointerY,hit:i.lastHit})??{time:e,frame:i.frame,ready:0,loading:0,hovering:i.hovering?1:0,pointerX:i.pointerX,pointerY:i.pointerY,camX:0,camY:0,camZ:0,targetX:0,targetY:0,targetZ:0,fov:i.fov,zoom:1,distance:0,yaw:0,pitch:0},moving:i.moving}}function oS(i,e){const t=i.outPublisher;if(t){for(const[n,r]of Object.entries(e))if(r!==void 0&&!qf(i,n)&&!gc.FRAME_KEYS.includes(n))try{t[n].set(r)}catch{}}}function lS(i,e,t){if(i.outPublisher||i.bindOutPublisher(),!$f(i)||!i.runtime)return;const n=Math.max(wd,i.outInterval||Fc);if(e-i.lastOutAt>=n){i.lastOutAt=e;const r=jf(i,t);oS(i,r);const s={detail:r,bubbles:!0,composed:!0};i.dispatchEvent(new CustomEvent("out",s))}gc.maybeCapture(i,e)}const cS={hasOutConsumers:$f,maybePublish:lS,buildOutput:jf,shouldSkipFormControlOutWrite:qf};function Yf(i,e){const t=i.getBoundingClientRect(),n=Math.max(t.width,1),r=Math.max(t.height,1);return{x:(e.clientX-t.left)/n,y:(e.clientY-t.top)/r}}function uS(i,e){const t=Yf(i,e);i.pointerX=t.x,i.pointerY=t.y,i.pick&&i.runtime?.ready&&i.runtime.setHoverAt(t.x,t.y)}function hS(i,e){const t=Yf(i,e);if(i.pointerX=t.x,i.pointerY=t.y,!i.pick||!i.runtime||e.button!==0)return;const n=i.runtime.pick(t.x,t.y);i.lastHit=n,n&&i.dispatchEvent(new CustomEvent("pick",{detail:n,bubbles:!0,composed:!0}))}function fS(i){i.runtime?.ready&&(i.runtime.fitToContent(),i.runtime.render())}function dS(i){i.hovering=!0,i.syncPlayback()}function pS(i){i.hovering=!1,i.runtime?.clearHighlight(),i.syncPlayback()}const _s={onMove:uS,onDown:hS,onDblClick:fS,onEnter:dS,onLeave:pS};var mS=Object.defineProperty,je=(i,e,t,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(e,t,r)||r);return r&&mS(e,t,r),r};class $e extends zr{constructor(){super(...arguments),this.src="",this.asset=null,this.camera=vn.Orbit,this.fov=Ms,this.exposure=Ia,this.minDistance=zc,this.maxDistance=Hc,this.minPolar=Vc,this.maxPolar=Cd,this.autoRotate=!1,this.fit=!0,this.pick=!1,this.play=!0,this.playOnHover=!1,this.playOffscreen=!1,this.releaseOffscreen=!0,this.damping=.08,this.dprMax=2,this.aspectRatio="",this.dataProvider="",this.outDataProvider="",this.outInterval=Fc,this.snapshotInterval=kc,this.frameOut=!1,this.postImage="",this.postBufferA="",this.postBufferB="",this.postBufferC="",this.postBufferD="",this.postCommon="",this.postImageCh0="",this.postImageCh1="",this.postImageCh2="",this.postImageCh3="",this.postBufferACh0="",this.postBufferACh1="",this.postBufferACh2="",this.postBufferACh3="",this.postBufferBCh0="",this.postBufferBCh1="",this.postBufferBCh2="",this.postBufferBCh3="",this.postBufferCCh0="",this.postBufferCCh1="",this.postBufferCCh2="",this.postBufferCCh3="",this.postBufferDCh0="",this.postBufferDCh1="",this.postBufferDCh2="",this.postBufferDCh3="",this.param0=0,this.param1=0,this.param2=0,this.param3=0,this.postScale=1}}je([Xe()],$e.prototype,"src"),je([Xe({attribute:!1})],$e.prototype,"asset"),je([Xe({reflect:!0})],$e.prototype,"camera"),je([Xe({type:Number})],$e.prototype,"fov"),je([Xe({type:Number})],$e.prototype,"exposure"),je([Xe({type:Number,attribute:"min-distance"})],$e.prototype,"minDistance"),je([Xe({type:Number,attribute:"max-distance"})],$e.prototype,"maxDistance"),je([Xe({type:Number,attribute:"min-polar"})],$e.prototype,"minPolar"),je([Xe({type:Number,attribute:"max-polar"})],$e.prototype,"maxPolar"),je([Xe({type:Boolean,attribute:"auto-rotate"})],$e.prototype,"autoRotate"),je([Xe({type:Boolean})],$e.prototype,"fit"),je([Xe({type:Boolean})],$e.prototype,"pick"),je([Xe({type:Boolean,reflect:!0})],$e.prototype,"play"),je([Xe({type:Boolean,attribute:"play-on-hover"})],$e.prototype,"playOnHover"),je([Xe({type:Boolean,attribute:"play-offscreen"})],$e.prototype,"playOffscreen"),je([Xe({type:Boolean,attribute:"release-offscreen"})],$e.prototype,"releaseOffscreen"),je([Xe({type:Number})],$e.prototype,"damping"),je([Xe({type:Number,attribute:"dpr-max"})],$e.prototype,"dprMax"),je([Xe({type:String,attribute:"aspect-ratio"})],$e.prototype,"aspectRatio"),je([Xe({type:String})],$e.prototype,"dataProvider"),je([Xe({type:String,attribute:"out-data-provider"})],$e.prototype,"outDataProvider"),je([Xe({type:Number,attribute:"out-interval"})],$e.prototype,"outInterval"),je([Xe({type:Number,attribute:"snapshot-interval"})],$e.prototype,"snapshotInterval"),je([Xe({type:Boolean,attribute:"frame-out"})],$e.prototype,"frameOut"),je([Xe({attribute:"post-image"})],$e.prototype,"postImage"),je([Xe({attribute:"post-buffer-a"})],$e.prototype,"postBufferA"),je([Xe({attribute:"post-buffer-b"})],$e.prototype,"postBufferB"),je([Xe({attribute:"post-buffer-c"})],$e.prototype,"postBufferC"),je([Xe({attribute:"post-buffer-d"})],$e.prototype,"postBufferD"),je([Xe({attribute:"post-common"})],$e.prototype,"postCommon"),je([Xe({attribute:"post-image-ch0"})],$e.prototype,"postImageCh0"),je([Xe({attribute:"post-image-ch1"})],$e.prototype,"postImageCh1"),je([Xe({attribute:"post-image-ch2"})],$e.prototype,"postImageCh2"),je([Xe({attribute:"post-image-ch3"})],$e.prototype,"postImageCh3"),je([Xe({attribute:"post-buffer-a-ch0"})],$e.prototype,"postBufferACh0"),je([Xe({attribute:"post-buffer-a-ch1"})],$e.prototype,"postBufferACh1"),je([Xe({attribute:"post-buffer-a-ch2"})],$e.prototype,"postBufferACh2"),je([Xe({attribute:"post-buffer-a-ch3"})],$e.prototype,"postBufferACh3"),je([Xe({attribute:"post-buffer-b-ch0"})],$e.prototype,"postBufferBCh0"),je([Xe({attribute:"post-buffer-b-ch1"})],$e.prototype,"postBufferBCh1"),je([Xe({attribute:"post-buffer-b-ch2"})],$e.prototype,"postBufferBCh2"),je([Xe({attribute:"post-buffer-b-ch3"})],$e.prototype,"postBufferBCh3"),je([Xe({attribute:"post-buffer-c-ch0"})],$e.prototype,"postBufferCCh0"),je([Xe({attribute:"post-buffer-c-ch1"})],$e.prototype,"postBufferCCh1"),je([Xe({attribute:"post-buffer-c-ch2"})],$e.prototype,"postBufferCCh2"),je([Xe({attribute:"post-buffer-c-ch3"})],$e.prototype,"postBufferCCh3"),je([Xe({attribute:"post-buffer-d-ch0"})],$e.prototype,"postBufferDCh0"),je([Xe({attribute:"post-buffer-d-ch1"})],$e.prototype,"postBufferDCh1"),je([Xe({attribute:"post-buffer-d-ch2"})],$e.prototype,"postBufferDCh2"),je([Xe({attribute:"post-buffer-d-ch3"})],$e.prototype,"postBufferDCh3"),je([Xe({type:Number})],$e.prototype,"param0"),je([Xe({type:Number})],$e.prototype,"param1"),je([Xe({type:Number})],$e.prototype,"param2"),je([Xe({type:Number})],$e.prototype,"param3"),je([Xe({type:Number,attribute:"post-scale"})],$e.prototype,"postScale");const gS=ed`
|
|
3874
3923
|
:host {
|
|
3875
3924
|
display: block;
|
|
3876
3925
|
position: relative;
|
|
@@ -3905,7 +3954,7 @@ void main() {
|
|
|
3905
3954
|
overflow: auto;
|
|
3906
3955
|
pointer-events: none;
|
|
3907
3956
|
}
|
|
3908
|
-
`;function
|
|
3957
|
+
`;function _S(i,e){return e.some(t=>i.has(t))}function vS(i,e){i.runtime&&(e.has("camera")&&i.runtime.applyCameraMode(Ut.cameraMode(i.camera)),e.has("fov")&&i.runtime.setFov(i.fov),e.has("exposure")&&i.runtime.setExposure(i.exposure),e.has("dprMax")&&(i.runtime.setDprMax(i.dprMax),Bi.syncSize(i)),e.has("fit")&&i.runtime.setFit(i.fit),_S(e,["minDistance","maxDistance","minPolar","maxPolar","camera"])&&Dn.applyOrbitLimits(i))}function yS(i,e){e.has("aspectRatio")&&bi.applyAspectRatio(i),(e.has("dataProvider")||e.has("outDataProvider"))&&(bi.bindFormProvider(i),bi.bindOutPublisher(i))}function xS(i,e){yS(i,e),i.runtime&&(vS(i,e),(e.has("autoRotate")||e.has("play"))&&Gn.syncAutoRotate(i),(e.has("play")||e.has("playOnHover")||e.has("playOffscreen"))&&i.syncPlayback(),(e.has("playOffscreen")||e.has("releaseOffscreen"))&&Bi.syncVisibility(i),e.has("damping")&&i.runtime&&i.runtime.setDamping(i.damping),(e.has("src")||e.has("asset"))&&Dn.run(i),Hr.propsChanged(e)&&Hr.applyConfig(i))}const bS={updated:xS};function SS(i){i.addEventListener("pointermove",i.onPointerMove),i.addEventListener("pointerdown",i.onPointerDown),i.addEventListener("dblclick",i.onDblClick),i.addEventListener("pointerleave",i.onPointerLeave),i.addEventListener("pointerenter",i.onPointerEnter),bi.bindFormProvider(i),bi.bindOutPublisher(i)}function MS(i){i.removeEventListener("pointermove",i.onPointerMove),i.removeEventListener("pointerdown",i.onPointerDown),i.removeEventListener("dblclick",i.onDblClick),i.removeEventListener("pointerleave",i.onPointerLeave),i.removeEventListener("pointerenter",i.onPointerEnter),bi.unbindFormProvider(i),Gn.stopLoop(i),i.resizeObserver?.disconnect(),i.intersectionObserver?.disconnect(),i.loadToken++,i.ready=!1,i.releasing=!0,gc.revokeAll(i),i.runtime?.dispose(!0),i.runtime=null,i.outPublisher=null,i.releasing=!1}const Kf={connect:SS,disconnect:MS};var ES=Object.defineProperty,TS=Object.getOwnPropertyDescriptor,Zf=(i,e,t,n)=>{for(var r=n>1?void 0:n?TS(e,t):e,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(e,t,r):a(r))||r);return n&&r&&ES(e,t,r),r};const Jf=8;let Ea=class extends $e{constructor(){super(...arguments),this.errorMessage="",this.runtime=null,this.raf=0,this.startTime=0,this.frame=0,this.hovering=!1,this.pointerX=.5,this.pointerY=.5,this.lastHit=null,this.outEventListeners=0,this.inView=!0,this.ready=!1,this.releasing=!1,this.loadToken=0,this.resizeObserver=null,this.intersectionObserver=null,this.formPublisher=null,this.outPublisher=null,this.lastOutAt=0,this.lastSnapshotAt=0,this.snapshotBusy=!1,this.frameUrls=[],this.snapshotSeq=0,this.frameSeq=0,this.lastDrawAt=0,this.lastFormOrbit=null,this.frameConsumers=new Set,this.moving=0,this.stillFrames=0,this.lastMotionYaw=NaN,this.lastMotionPitch=NaN,this.lastMotionDist=NaN,this.onFormMutation=()=>{const i=this.formPublisher?.get()??{};ic.formParams.applyFormParams(this,i)},this.syncAutoRotate=()=>Gn.syncAutoRotate(this),this.syncPlayback=()=>Gn.syncPlayback(this,this.loop),this.bindOutPublisher=()=>bi.bindOutPublisher(this),this.loop=()=>{this.raf=requestAnimationFrame(this.loop),this.drawFrame(performance.now()),this.playOnHover&&!this.hovering&&!this.autoRotate&&Gn.stopLoop(this)},this.onPointerMove=i=>_s.onMove(this,i),this.onPointerDown=i=>_s.onDown(this,i),this.onDblClick=()=>_s.onDblClick(this),this.onPointerEnter=()=>_s.onEnter(this),this.onPointerLeave=()=>_s.onLeave(this)}get frameConsumerCount(){return this.frameConsumers.size}connectedCallback(){super.connectedCallback(),this.pointerX,this.pointerY,this.lastHit,this.inView,this.releasing,this.loadToken,this.resizeObserver,this.intersectionObserver,this.formPublisher,this.outPublisher,this.lastOutAt,this.lastSnapshotAt,this.snapshotBusy,this.frameUrls,this.snapshotSeq,this.lastFormOrbit,this.syncAutoRotate,this.syncPlayback,this.bindOutPublisher,this.onPointerMove,this.onPointerDown,this.onDblClick,this.onPointerEnter,this.onPointerLeave,this.onFormMutation,this.errorMessage,Kf.connect(this)}addEventListener(i,e,t){i==="out"&&e&&this.outEventListeners++,super.addEventListener(i,e,t)}removeEventListener(i,e,t){i==="out"&&e&&(this.outEventListeners=Math.max(0,this.outEventListeners-1)),super.removeEventListener(i,e,t)}disconnectedCallback(){super.disconnectedCallback(),Kf.disconnect(this)}firstUpdated(){bi.firstUpdated(this)}updated(i){bS.updated(this,i)}drawFrame(i){if(!this.runtime||!this.ready)return;this.frame++;const e=(i-this.startTime)/1e3,t=Math.max(0,(i-this.lastDrawAt)/1e3);this.lastDrawAt=i,Hr.syncFrame(this,e,t,this.frame),this.runtime.render(),this.frameSeq++,this.trackMotion(e),cS.maybePublish(this,i,e)}registerFrameConsumer(i={}){this.frameConsumers.add(i),Bi.syncVisibility(this)}unregisterFrameConsumer(i={}){this.frameConsumers.delete(i),Bi.syncVisibility(this)}stopMotion(){this.autoRotate=!1,this.runtime?.stopMotion(),this.stillFrames=Jf,this.moving!==0&&(this.moving=0,this.dispatchEvent(new CustomEvent("rest",{detail:{moving:0},bubbles:!0,composed:!0}))),this.syncPlayback()}trackMotion(i){if(!this.runtime)return;const e=this.runtime.snapshot({time:i,frame:this.frame,hovering:this.hovering?1:0,pointerX:this.pointerX,pointerY:this.pointerY,hit:this.lastHit}),t=1e-5,n=Number.isFinite(this.lastMotionYaw)&&Math.abs(e.yaw-this.lastMotionYaw)<t&&Math.abs(e.pitch-this.lastMotionPitch)<t&&Math.abs(e.distance-this.lastMotionDist)<t&&!this.autoRotate;this.lastMotionYaw=e.yaw,this.lastMotionPitch=e.pitch,this.lastMotionDist=e.distance,n?(this.stillFrames++,this.stillFrames>=Jf&&this.moving!==0&&(this.moving=0,this.dispatchEvent(new CustomEvent("rest",{detail:{moving:0,yaw:e.yaw,pitch:e.pitch},bubbles:!0,composed:!0})))):(this.stillFrames=0,this.moving=1)}getFrameCanvas(){return!this.runtime||!this.ready?null:this.runtime.renderer.domElement}render(){return Uc`
|
|
3909
3958
|
<canvas part="canvas"></canvas>
|
|
3910
|
-
${this.errorMessage?
|
|
3911
|
-
`}};
|
|
3959
|
+
${this.errorMessage?Uc`<div class="err" part="error">${this.errorMessage}</div>`:null}
|
|
3960
|
+
`}};Ea.styles=gS,Zf([Td()],Ea.prototype,"errorMessage",2),Ea=Zf([Sd("sonic-3d")],Ea)})();
|