diff --git a/.next/BUILD_ID b/.next/BUILD_ID
index 05ed909..c66584c 100644
--- a/.next/BUILD_ID
+++ b/.next/BUILD_ID
@@ -1 +1 @@
-xSz9x0FW88Rb7utFdR6Fp
\ No newline at end of file
+_irQtJdFK0j8SeLn5FtRS
\ No newline at end of file
diff --git a/.next/app-build-manifest.json b/.next/app-build-manifest.json
index 054c82f..7cb89f1 100644
--- a/.next/app-build-manifest.json
+++ b/.next/app-build-manifest.json
@@ -15,28 +15,12 @@
"static/css/1d2d59615145af7d.css",
"static/chunks/app/layout-2a5e75b3a17431fd.js"
],
- "/everyone-votes/terms/page": [
- "static/chunks/webpack-d8e064491704869d.js",
- "static/chunks/fd9d1056-519edff8920177a7.js",
- "static/chunks/938-d733aaafb07bca99.js",
- "static/chunks/main-app-76ef2d05c58d6354.js",
- "static/chunks/app/everyone-votes/terms/page-2d2b3d1433737a22.js"
- ],
"/everyone-votes/privacy/page": [
"static/chunks/webpack-d8e064491704869d.js",
"static/chunks/fd9d1056-519edff8920177a7.js",
"static/chunks/938-d733aaafb07bca99.js",
"static/chunks/main-app-76ef2d05c58d6354.js",
- "static/chunks/app/everyone-votes/privacy/page-7a71bbf2f721c35f.js"
- ],
- "/page": [
- "static/chunks/webpack-d8e064491704869d.js",
- "static/chunks/fd9d1056-519edff8920177a7.js",
- "static/chunks/938-d733aaafb07bca99.js",
- "static/chunks/main-app-76ef2d05c58d6354.js",
- "static/chunks/986-72006aa1051e30d3.js",
- "static/css/60c69e914bf8dd4b.css",
- "static/chunks/app/page-8af0c2c4af65d19c.js"
+ "static/chunks/app/everyone-votes/privacy/page-202d4d11d0c48193.js"
],
"/space/page": [
"static/chunks/webpack-d8e064491704869d.js",
@@ -56,14 +40,30 @@
"static/chunks/fd9d1056-519edff8920177a7.js",
"static/chunks/938-d733aaafb07bca99.js",
"static/chunks/main-app-76ef2d05c58d6354.js",
- "static/chunks/app/space/loading-b8903409900b99fa.js"
+ "static/chunks/app/space/loading-e753a6f0bb842c86.js"
+ ],
+ "/everyone-votes/terms/page": [
+ "static/chunks/webpack-d8e064491704869d.js",
+ "static/chunks/fd9d1056-519edff8920177a7.js",
+ "static/chunks/938-d733aaafb07bca99.js",
+ "static/chunks/main-app-76ef2d05c58d6354.js",
+ "static/chunks/app/everyone-votes/terms/page-2d2b3d1433737a22.js"
+ ],
+ "/page": [
+ "static/chunks/webpack-d8e064491704869d.js",
+ "static/chunks/fd9d1056-519edff8920177a7.js",
+ "static/chunks/938-d733aaafb07bca99.js",
+ "static/chunks/main-app-76ef2d05c58d6354.js",
+ "static/chunks/986-72006aa1051e30d3.js",
+ "static/css/60c69e914bf8dd4b.css",
+ "static/chunks/app/page-8af0c2c4af65d19c.js"
],
"/wiston/page": [
"static/chunks/webpack-d8e064491704869d.js",
"static/chunks/fd9d1056-519edff8920177a7.js",
"static/chunks/938-d733aaafb07bca99.js",
"static/chunks/main-app-76ef2d05c58d6354.js",
- "static/chunks/app/wiston/page-3411783e09c6cfc5.js"
+ "static/chunks/app/wiston/page-d6a2614d06eda357.js"
]
}
}
\ No newline at end of file
diff --git a/.next/app-path-routes-manifest.json b/.next/app-path-routes-manifest.json
index e5fc0ac..384ca7d 100644
--- a/.next/app-path-routes-manifest.json
+++ b/.next/app-path-routes-manifest.json
@@ -1 +1 @@
-{"/_not-found":"/_not-found","/everyone-votes/terms/page":"/everyone-votes/terms","/everyone-votes/privacy/page":"/everyone-votes/privacy","/favicon.ico/route":"/favicon.ico","/page":"/","/space/page":"/space","/wiston/page":"/wiston"}
\ No newline at end of file
+{"/_not-found":"/_not-found","/everyone-votes/privacy/page":"/everyone-votes/privacy","/favicon.ico/route":"/favicon.ico","/space/page":"/space","/everyone-votes/terms/page":"/everyone-votes/terms","/page":"/","/wiston/page":"/wiston"}
\ No newline at end of file
diff --git a/.next/build-manifest.json b/.next/build-manifest.json
index 2b2759a..67430e2 100644
--- a/.next/build-manifest.json
+++ b/.next/build-manifest.json
@@ -5,8 +5,8 @@
"devFiles": [],
"ampDevFiles": [],
"lowPriorityFiles": [
- "static/xSz9x0FW88Rb7utFdR6Fp/_buildManifest.js",
- "static/xSz9x0FW88Rb7utFdR6Fp/_ssgManifest.js"
+ "static/_irQtJdFK0j8SeLn5FtRS/_buildManifest.js",
+ "static/_irQtJdFK0j8SeLn5FtRS/_ssgManifest.js"
],
"rootMainFiles": [
"static/chunks/webpack-d8e064491704869d.js",
diff --git a/.next/next-minimal-server.js.nft.json b/.next/next-minimal-server.js.nft.json
index 9e8eb3a..74b6493 100644
--- a/.next/next-minimal-server.js.nft.json
+++ b/.next/next-minimal-server.js.nft.json
@@ -1 +1 @@
-{"version":1,"files":["../node_modules/styled-jsx/index.js","../node_modules/styled-jsx/package.json","../node_modules/styled-jsx/dist/index/index.js","../node_modules/react/package.json","../node_modules/react/index.js","../node_modules/client-only/package.json","../node_modules/react/cjs/react.production.min.js","../node_modules/client-only/index.js","../node_modules/styled-jsx/style.js","../node_modules/next/dist/compiled/next-server/server.runtime.prod.js","../node_modules/next/package.json","../node_modules/next/dist/server/body-streams.js","../node_modules/next/dist/shared/lib/constants.js","../node_modules/next/dist/server/web/utils.js","../node_modules/next/dist/client/components/app-router-headers.js","../node_modules/next/dist/server/lib/trace/tracer.js","../node_modules/next/dist/server/lib/trace/constants.js","../node_modules/next/dist/shared/lib/modern-browserslist-target.js","../node_modules/next/dist/shared/lib/runtime-config.external.js","../node_modules/next/dist/compiled/ws/package.json","../node_modules/@swc/helpers/_/_interop_require_default/package.json","../node_modules/next/dist/compiled/ws/index.js","../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../node_modules/@swc/helpers/package.json","../node_modules/next/dist/compiled/jsonwebtoken/package.json","../node_modules/@swc/helpers/cjs/_interop_require_default.cjs","../node_modules/next/dist/compiled/jsonwebtoken/index.js","../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../node_modules/next/dist/lib/semver-noop.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/amp-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/app-router-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/entrypoints.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/head-manager-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/hooks-client-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/html-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/image-config-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/loadable-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/loadable.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/router-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/server-inserted-html.js","../node_modules/next/dist/server/future/route-modules/app-page/module.compiled.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/amp-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/app-router-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/entrypoints.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/head-manager-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/hooks-client-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/html-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/image-config-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/loadable-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/loadable.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/router-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/server-inserted-html.js","../node_modules/next/dist/server/future/route-modules/pages/module.compiled.js"]}
\ No newline at end of file
+{"version":1,"files":["../node_modules/styled-jsx/index.js","../node_modules/styled-jsx/package.json","../node_modules/styled-jsx/dist/index/index.js","../node_modules/react/package.json","../node_modules/react/index.js","../node_modules/client-only/package.json","../node_modules/react/cjs/react.production.min.js","../node_modules/client-only/index.js","../node_modules/styled-jsx/style.js","../node_modules/next/dist/compiled/next-server/server.runtime.prod.js","../node_modules/next/package.json","../node_modules/next/dist/server/body-streams.js","../node_modules/next/dist/shared/lib/constants.js","../node_modules/next/dist/server/web/utils.js","../node_modules/next/dist/client/components/app-router-headers.js","../node_modules/next/dist/server/lib/trace/constants.js","../node_modules/next/dist/server/lib/trace/tracer.js","../node_modules/next/dist/shared/lib/modern-browserslist-target.js","../node_modules/next/dist/shared/lib/runtime-config.external.js","../node_modules/next/dist/compiled/ws/package.json","../node_modules/@swc/helpers/_/_interop_require_default/package.json","../node_modules/next/dist/compiled/ws/index.js","../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../node_modules/@swc/helpers/package.json","../node_modules/next/dist/compiled/jsonwebtoken/package.json","../node_modules/@swc/helpers/cjs/_interop_require_default.cjs","../node_modules/next/dist/compiled/jsonwebtoken/index.js","../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../node_modules/next/dist/lib/semver-noop.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/amp-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/app-router-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/entrypoints.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/head-manager-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/hooks-client-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/html-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/image-config-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/loadable-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/loadable.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/router-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/server-inserted-html.js","../node_modules/next/dist/server/future/route-modules/app-page/module.compiled.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/amp-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/app-router-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/entrypoints.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/head-manager-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/hooks-client-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/html-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/image-config-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/loadable-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/loadable.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/router-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/server-inserted-html.js","../node_modules/next/dist/server/future/route-modules/pages/module.compiled.js"]}
\ No newline at end of file
diff --git a/.next/next-server.js.nft.json b/.next/next-server.js.nft.json
index fad7542..2a835d3 100644
--- a/.next/next-server.js.nft.json
+++ b/.next/next-server.js.nft.json
@@ -1 +1 @@
-{"version":1,"files":["../node_modules/styled-jsx/index.js","../node_modules/styled-jsx/package.json","../node_modules/styled-jsx/dist/index/index.js","../node_modules/react/package.json","../node_modules/react/index.js","../node_modules/client-only/package.json","../node_modules/react/cjs/react.production.min.js","../node_modules/client-only/index.js","../node_modules/styled-jsx/style.js","../node_modules/next/dist/server/next-server.js","../node_modules/next/package.json","../node_modules/next/dist/server/request-meta.js","../node_modules/next/dist/server/node-environment.js","../node_modules/next/dist/server/require-hook.js","../node_modules/next/dist/server/node-polyfill-crypto.js","../node_modules/next/dist/server/base-server.js","../node_modules/next/dist/lib/find-pages-dir.js","../node_modules/next/dist/server/send-payload.js","../node_modules/next/dist/server/require.js","../node_modules/next/dist/server/load-components.js","../node_modules/next/dist/lib/is-error.js","../node_modules/next/dist/server/body-streams.js","../node_modules/next/dist/server/setup-http-agent-env.js","../node_modules/next/dist/lib/constants.js","../node_modules/next/dist/server/pipe-readable.js","../node_modules/next/dist/server/load-manifest.js","../node_modules/next/dist/server/serve-static.js","../node_modules/next/dist/lib/format-server-error.js","../node_modules/next/dist/lib/picocolors.js","../node_modules/next/dist/server/image-optimizer.js","../node_modules/next/dist/shared/lib/utils.js","../node_modules/next/dist/shared/lib/constants.js","../node_modules/next/dist/server/base-http/node.js","../node_modules/next/dist/build/output/log.js","../node_modules/next/dist/server/web/utils.js","../node_modules/next/dist/server/lib/node-fs-methods.js","../node_modules/next/dist/server/lib/mock-request.js","../node_modules/next/dist/client/components/app-router-headers.js","../node_modules/next/dist/shared/lib/page-path/denormalize-page-path.js","../node_modules/next/dist/shared/lib/page-path/normalize-page-path.js","../node_modules/next/dist/server/future/route-matches/pages-api-route-match.js","../node_modules/next/dist/server/lib/trace/tracer.js","../node_modules/next/dist/server/lib/trace/constants.js","../node_modules/next/dist/server/lib/server-ipc/utils.js","../node_modules/next/dist/server/lib/server-ipc/invoke-request.js","../node_modules/next/dist/shared/lib/router/utils/route-matcher.js","../node_modules/next/dist/shared/lib/router/utils/parse-url.js","../node_modules/next/dist/shared/lib/router/utils/remove-trailing-slash.js","../node_modules/next/dist/shared/lib/router/utils/middleware-route-matcher.js","../node_modules/next/dist/shared/lib/router/utils/get-next-pathname-info.js","../node_modules/next/dist/shared/lib/router/utils/querystring.js","../node_modules/next/dist/shared/lib/router/utils/app-paths.js","../node_modules/next/dist/shared/lib/router/utils/route-regex.js","../node_modules/next/dist/server/web/spec-extension/adapters/next-request.js","../node_modules/next/dist/server/future/helpers/module-loader/route-module-loader.js","../node_modules/next/dist/server/future/route-modules/app-page/module.render.js","../node_modules/next/dist/server/future/route-modules/pages/module.render.js","../node_modules/next/dist/client/components/action-async-storage.external.js","../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../node_modules/next/dist/client/components/request-async-storage.external.js","../node_modules/next/dist/client/components/static-generation-async-storage.external.js","../node_modules/next/dist/compiled/next-server/pages.runtime.prod.js","../node_modules/next/dist/server/api-utils/index.js","../node_modules/next/dist/server/response-cache/index.js","../node_modules/next/dist/server/lib/incremental-cache/index.js","../node_modules/next/dist/server/web/sandbox/index.js","../node_modules/next/dist/lib/interop-default.js","../node_modules/next/dist/lib/wait.js","../node_modules/next/dist/lib/detached-promise.js","../node_modules/@next/env/package.json","../node_modules/next/dist/server/lib/revalidate.js","../node_modules/next/dist/server/lib/etag.js","../node_modules/next/dist/shared/lib/is-plain-object.js","../node_modules/next/dist/experimental/testmode/server.js","../node_modules/next/dist/shared/lib/image-blur-svg.js","../node_modules/next/dist/shared/lib/match-remote-pattern.js","../node_modules/next/dist/shared/lib/i18n/normalize-locale-path.js","../node_modules/next/dist/server/lib/squoosh/main.js","../node_modules/next/dist/lib/redirect-status.js","../node_modules/next/dist/lib/is-edge-runtime.js","../node_modules/next/dist/server/utils.js","../node_modules/next/dist/server/render-result.js","../node_modules/next/dist/server/server-utils.js","../node_modules/next/dist/server/send-response.js","../node_modules/next/dist/server/internal-utils.js","../node_modules/next/dist/shared/lib/modern-browserslist-target.js","../node_modules/next/dist/server/base-http/index.js","../node_modules/next/dist/client/components/redirect-status-code.js","../node_modules/next/dist/server/lib/format-hostname.js","../node_modules/next/dist/shared/lib/runtime-config.external.js","../node_modules/next/dist/shared/lib/get-hostname.js","../node_modules/next/dist/server/lib/match-next-data-pathname.js","../node_modules/next/dist/server/app-render/strip-flight-headers.js","../node_modules/next/dist/server/lib/server-action-request-meta.js","../node_modules/next/dist/server/future/route-kind.js","../node_modules/next/dist/server/future/normalizers/locale-route-normalizer.js","../node_modules/next/dist/server/future/route-matcher-managers/default-route-matcher-manager.js","../node_modules/next/dist/server/future/route-matcher-providers/app-page-route-matcher-provider.js","../node_modules/next/dist/server/future/route-matcher-providers/pages-route-matcher-provider.js","../node_modules/next/dist/server/future/route-matcher-providers/app-route-route-matcher-provider.js","../node_modules/next/dist/server/future/route-matcher-providers/pages-api-route-matcher-provider.js","../node_modules/next/dist/server/future/route-modules/checks.js","../node_modules/next/dist/server/future/helpers/i18n-provider.js","../node_modules/next/dist/server/api-utils/node/try-get-preview-data.js","../node_modules/next/dist/shared/lib/i18n/get-locale-redirect.js","../node_modules/next/dist/shared/lib/page-path/ensure-leading-slash.js","../node_modules/next/dist/shared/lib/page-path/normalize-path-sep.js","../node_modules/@next/env/dist/index.js","../node_modules/next/dist/client/components/async-local-storage.js","../node_modules/next/dist/shared/lib/segment.js","../node_modules/next/dist/shared/lib/escape-regexp.js","../node_modules/next/dist/shared/lib/router/utils/is-bot.js","../node_modules/next/dist/shared/lib/router/utils/escape-path-delimiters.js","../node_modules/next/dist/shared/lib/router/utils/remove-path-prefix.js","../node_modules/next/dist/server/future/route-modules/helpers/response-handlers.js","../node_modules/next/dist/shared/lib/router/utils/get-route-from-asset-path.js","../node_modules/next/dist/server/future/normalizers/request/rsc.js","../node_modules/next/dist/server/future/normalizers/request/postponed.js","../node_modules/next/dist/server/future/normalizers/request/prefetch-rsc.js","../node_modules/next/dist/server/future/normalizers/request/next-data.js","../node_modules/next/dist/lib/scheduler.js","../node_modules/next/dist/lib/batcher.js","../node_modules/next/dist/server/future/helpers/interception-routes.js","../node_modules/next/dist/server/web/spec-extension/request.js","../node_modules/next/dist/server/future/route-matcher-providers/helpers/manifest-loaders/server-manifest-loader.js","../node_modules/next/dist/server/response-cache/types.js","../node_modules/next/dist/server/response-cache/utils.js","../node_modules/next/dist/shared/lib/router/utils/parse-relative-url.js","../node_modules/next/dist/shared/lib/router/utils/prepare-destination.js","../node_modules/next/dist/shared/lib/router/utils/path-has-prefix.js","../node_modules/next/dist/server/future/helpers/module-loader/node-module-loader.js","../node_modules/next/dist/server/future/route-modules/app-page/module.compiled.js","../node_modules/next/dist/server/future/route-modules/pages/module.compiled.js","../node_modules/next/dist/server/web/spec-extension/adapters/headers.js","../node_modules/next/dist/shared/lib/isomorphic/path.js","../node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js","../node_modules/next/dist/server/lib/incremental-cache/fetch-cache.js","../node_modules/next/dist/server/lib/server-ipc/request-utils.js","../node_modules/next/dist/server/web/sandbox/context.js","../node_modules/next/dist/server/web/sandbox/sandbox.js","../node_modules/next/dist/shared/lib/router/utils/index.js","../node_modules/next/dist/experimental/testmode/context.js","../node_modules/next/dist/experimental/testmode/fetch.js","../node_modules/next/dist/experimental/testmode/httpget.js","../node_modules/next/dist/compiled/ws/package.json","../node_modules/next/dist/compiled/fresh/package.json","../node_modules/next/dist/compiled/lru-cache/package.json","../node_modules/next/dist/compiled/send/package.json","../node_modules/next/dist/compiled/get-orientation/package.json","../node_modules/next/dist/compiled/image-size/package.json","../node_modules/next/dist/compiled/is-animated/package.json","../node_modules/next/dist/compiled/content-disposition/package.json","../node_modules/react-dom/package.json","../node_modules/next/dist/server/stream-utils/node-web-streams-helper.js","../node_modules/next/dist/server/api-utils/get-cookie-parser.js","../node_modules/next/dist/compiled/@hapi/accept/package.json","../node_modules/next/dist/server/lib/is-ipv6.js","../node_modules/@swc/helpers/_/_interop_require_default/package.json","../node_modules/next/dist/lib/is-app-page-route.js","../node_modules/next/dist/lib/is-api-route.js","../node_modules/next/dist/lib/is-app-route-route.js","../node_modules/next/dist/server/crypto-utils.js","../node_modules/next/dist/server/accept-header.js","../node_modules/next/dist/shared/lib/router/utils/path-match.js","../node_modules/react-dom/server.browser.js","../node_modules/next/dist/server/future/route-matchers/locale-route-matcher.js","../node_modules/next/dist/server/future/route-matchers/app-page-route-matcher.js","../node_modules/next/dist/server/future/route-matcher-providers/manifest-route-matcher-provider.js","../node_modules/next/dist/server/future/route-matchers/pages-route-matcher.js","../node_modules/next/dist/server/future/route-matchers/app-route-route-matcher.js","../node_modules/next/dist/server/web/spec-extension/cookies.js","../node_modules/next/dist/server/future/route-matchers/pages-api-route-matcher.js","../node_modules/next/dist/shared/lib/i18n/detect-domain-locale.js","../node_modules/next/dist/compiled/ws/index.js","../node_modules/next/dist/compiled/fresh/index.js","../node_modules/next/dist/compiled/lru-cache/index.js","../node_modules/next/dist/compiled/send/index.js","../node_modules/next/dist/server/web/error.js","../node_modules/next/dist/server/web/next-url.js","../node_modules/next/dist/compiled/image-size/index.js","../node_modules/next/dist/compiled/get-orientation/index.js","../node_modules/next/dist/compiled/is-animated/index.js","../node_modules/next/dist/compiled/content-disposition/index.js","../node_modules/next/dist/shared/lib/router/utils/format-url.js","../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../node_modules/@swc/helpers/package.json","../node_modules/next/dist/compiled/node-html-parser/package.json","../node_modules/next/dist/compiled/jsonwebtoken/package.json","../node_modules/next/dist/compiled/cookie/package.json","../node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.js","../node_modules/next/dist/shared/lib/router/utils/is-dynamic.js","../node_modules/next/dist/server/future/normalizers/request/suffix.js","../node_modules/next/dist/server/future/normalizers/request/prefix.js","../node_modules/next/dist/compiled/@hapi/accept/index.js","../node_modules/next/dist/lib/pick.js","../node_modules/next/dist/shared/lib/router/utils/parse-path.js","../node_modules/next/dist/server/web/sandbox/resource-managers.js","../node_modules/next/dist/server/web/sandbox/fetch-inline-assets.js","../node_modules/next/dist/server/web/spec-extension/adapters/reflect.js","../node_modules/@swc/helpers/cjs/_interop_require_default.cjs","../node_modules/next/dist/compiled/node-html-parser/index.js","../node_modules/next/dist/compiled/jsonwebtoken/index.js","../node_modules/next/dist/compiled/cookie/index.js","../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../node_modules/next/dist/shared/lib/router/utils/sorted-routes.js","../node_modules/next/dist/server/future/normalizers/built/app/index.js","../node_modules/next/dist/server/future/normalizers/built/pages/index.js","../node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js","../node_modules/react-dom/cjs/react-dom-server.browser.production.min.js","../node_modules/next/dist/server/stream-utils/encode-decode.js","../node_modules/next/dist/compiled/micromatch/package.json","../node_modules/next/dist/server/future/route-matchers/route-matcher.js","../node_modules/next/dist/compiled/micromatch/index.js","../node_modules/next/dist/server/future/route-matcher-providers/helpers/cached-route-matcher-provider.js","../node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js","../node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js","../node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js","../node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js","../node_modules/next/dist/shared/lib/router/utils/format-next-pathname-info.js","../node_modules/next/dist/server/future/route-modules/app-page/module.js","../node_modules/next/dist/server/future/route-modules/pages/module.js","../node_modules/next/dist/compiled/path-browserify/package.json","../node_modules/next/dist/compiled/edge-runtime/package.json","../node_modules/next/dist/compiled/path-to-regexp/index.js","../node_modules/next/dist/compiled/path-browserify/index.js","../node_modules/next/dist/compiled/edge-runtime/index.js","../node_modules/next/dist/server/future/normalizers/built/app/app-filename-normalizer.js","../node_modules/next/dist/server/future/normalizers/built/app/app-page-normalizer.js","../node_modules/next/dist/server/future/normalizers/built/app/app-bundle-path-normalizer.js","../node_modules/next/dist/server/future/normalizers/built/app/app-pathname-normalizer.js","../node_modules/next/dist/server/future/normalizers/built/pages/pages-pathname-normalizer.js","../node_modules/next/dist/server/future/normalizers/built/pages/pages-bundle-path-normalizer.js","../node_modules/next/dist/server/future/normalizers/built/pages/pages-filename-normalizer.js","../node_modules/next/dist/server/future/normalizers/built/pages/pages-page-normalizer.js","../node_modules/next/dist/compiled/@mswjs/interceptors/ClientRequest/package.json","../node_modules/next/dist/compiled/debug/package.json","../node_modules/next/dist/compiled/@edge-runtime/cookies/package.json","../node_modules/@swc/helpers/_/_interop_require_wildcard/package.json","../node_modules/next/dist/lib/semver-noop.js","../node_modules/next/dist/server/render.js","../node_modules/next/dist/compiled/@mswjs/interceptors/ClientRequest/index.js","../node_modules/next/dist/shared/lib/router/utils/add-locale.js","../node_modules/next/dist/shared/lib/router/utils/add-path-suffix.js","../node_modules/next/dist/shared/lib/router/utils/add-path-prefix.js","../node_modules/next/dist/server/app-render/app-render.js","../node_modules/next/dist/compiled/debug/index.js","../node_modules/next/dist/server/future/route-modules/route-module.js","../node_modules/next/dist/compiled/@edge-runtime/cookies/index.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/entrypoints.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/ssr/entrypoints.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/rsc/entrypoints.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/entrypoints.js","../node_modules/@swc/helpers/cjs/_interop_require_wildcard.cjs","../node_modules/next/dist/server/future/normalizers/prefixing-normalizer.js","../node_modules/next/dist/server/future/normalizers/normalizers.js","../node_modules/next/dist/server/future/normalizers/wrap-normalizer-fn.js","../node_modules/next/dist/server/future/normalizers/underscore-normalizer.js","../node_modules/next/dist/server/future/normalizers/absolute-filename-normalizer.js","../node_modules/next/dist/lib/is-serializable-props.js","../node_modules/next/dist/server/post-process.js","../node_modules/next/dist/shared/lib/head.js","../node_modules/next/dist/shared/lib/amp-context.shared-runtime.js","../node_modules/next/dist/shared/lib/amp-mode.js","../node_modules/next/dist/shared/lib/head-manager-context.shared-runtime.js","../node_modules/next/dist/shared/lib/loadable.shared-runtime.js","../node_modules/next/dist/shared/lib/router-context.shared-runtime.js","../node_modules/next/dist/shared/lib/loadable-context.shared-runtime.js","../node_modules/next/dist/shared/lib/html-context.shared-runtime.js","../node_modules/next/dist/shared/lib/image-config-context.shared-runtime.js","../node_modules/next/dist/shared/lib/hooks-client-context.shared-runtime.js","../node_modules/next/dist/shared/lib/app-router-context.shared-runtime.js","../node_modules/next/dist/shared/lib/router/adapters.js","../node_modules/next/dist/server/app-render/create-server-components-renderer.js","../node_modules/next/dist/client/components/match-segments.js","../node_modules/next/dist/lib/metadata/metadata.js","../node_modules/next/dist/server/async-storage/request-async-storage-wrapper.js","../node_modules/next/dist/server/async-storage/static-generation-async-storage-wrapper.js","../node_modules/next/dist/server/lib/patch-fetch.js","../node_modules/next/dist/client/components/not-found.js","../node_modules/next/dist/client/components/redirect.js","../node_modules/next/dist/server/app-render/create-error-handler.js","../node_modules/next/dist/server/app-render/flight-render-result.js","../node_modules/next/dist/server/app-render/get-short-dynamic-param-type.js","../node_modules/next/dist/server/app-render/get-segment-param.js","../node_modules/next/dist/server/app-render/get-script-nonce-from-header.js","../node_modules/next/dist/server/app-render/parse-and-validate-flight-router-state.js","../node_modules/next/dist/server/app-render/validate-url.js","../node_modules/next/dist/client/components/hooks-server-context.js","../node_modules/next/dist/server/app-render/create-flight-router-state-from-loader-tree.js","../node_modules/next/dist/server/app-render/action-handler.js","../node_modules/next/dist/server/app-render/server-inserted-html.js","../node_modules/next/dist/server/app-render/required-scripts.js","../node_modules/next/dist/server/app-render/walk-tree-with-flight-router-state.js","../node_modules/next/dist/server/app-render/create-component-tree.js","../node_modules/next/dist/server/app-render/make-get-server-inserted-html.js","../node_modules/next/dist/server/app-render/get-asset-query-string.js","../node_modules/next/dist/server/app-render/is-missing-postpone-error.js","../node_modules/next/dist/server/app-render/action-encryption-utils.js","../node_modules/next/dist/client/components/dev-root-not-found-boundary.js","../node_modules/next/dist/shared/lib/lazy-dynamic/no-ssr-error.js","../node_modules/next/dist/server/app-render/static/static-renderer.js","../node_modules/next/dist/shared/lib/server-inserted-html.shared-runtime.js","../node_modules/next/dist/lib/non-nullable.js","../node_modules/next/dist/server/optimize-amp.js","../node_modules/next/dist/shared/lib/page-path/absolute-path-to-page.js","../node_modules/next/dist/shared/lib/side-effect.js","../node_modules/next/dist/shared/lib/image-config.js","../node_modules/next/dist/server/htmlescape.js","../node_modules/next/dist/lib/client-reference.js","../node_modules/next/dist/compiled/strip-ansi/package.json","../node_modules/next/dist/compiled/react-is/package.json","../node_modules/next/dist/shared/lib/utils/warn-once.js","../node_modules/next/dist/server/app-render/use-flight-response.js","../node_modules/next/dist/lib/metadata/resolve-metadata.js","../node_modules/next/dist/lib/metadata/default-metadata.js","../node_modules/next/dist/server/async-storage/draft-mode-provider.js","../node_modules/next/dist/server/dev/log-app-dir-error.js","../node_modules/next/dist/export/helpers/is-dynamic-usage-error.js","../node_modules/next/dist/server/app-render/types.js","../node_modules/next/dist/server/app-render/react-server.node.js","../node_modules/next/dist/server/app-render/get-css-inlined-link-tags.js","../node_modules/next/dist/server/app-render/get-preloadable-fonts.js","../node_modules/next/dist/server/app-render/get-layer-assets.js","../node_modules/next/dist/server/app-render/parse-loader-tree.js","../node_modules/next/dist/server/lib/app-dir-module.js","../node_modules/next/dist/server/app-render/has-loading-component-in-tree.js","../node_modules/next/dist/server/app-render/interop-default.js","../node_modules/next/dist/server/app-render/create-component-styles-and-scripts.js","../node_modules/next/dist/client/components/not-found-boundary.js","../node_modules/next/dist/lib/metadata/generate/basic.js","../node_modules/next/dist/lib/metadata/generate/alternate.js","../node_modules/next/dist/lib/metadata/generate/opengraph.js","../node_modules/next/dist/lib/metadata/generate/meta.js","../node_modules/next/dist/lib/metadata/generate/icons.js","../node_modules/next/dist/compiled/nanoid/package.json","../node_modules/next/dist/shared/lib/router/utils/as-path-to-search-params.js","../node_modules/next/dist/compiled/strip-ansi/index.js","../node_modules/next/dist/compiled/react-is/index.js","../node_modules/next/dist/compiled/nanoid/index.cjs","../node_modules/react/jsx-runtime.js","../node_modules/react/jsx-dev-runtime.js","../node_modules/next/dist/lib/metadata/get-metadata-route.js","../node_modules/busboy/package.json","../node_modules/next/dist/shared/lib/page-path/remove-page-path-tail.js","../node_modules/next/dist/lib/metadata/clone-metadata.js","../node_modules/next/dist/client/components/navigation.js","../node_modules/next/dist/lib/metadata/generate/utils.js","../node_modules/next/dist/lib/metadata/resolvers/resolve-opengraph.js","../node_modules/next/dist/lib/metadata/resolvers/resolve-title.js","../node_modules/next/dist/lib/metadata/resolvers/resolve-basics.js","../node_modules/next/dist/lib/metadata/resolvers/resolve-icons.js","../node_modules/busboy/lib/index.js","../node_modules/next/dist/lib/metadata/constants.js","../node_modules/next/dist/compiled/string-hash/package.json","../node_modules/next/dist/compiled/superstruct/package.json","../node_modules/next/dist/compiled/bytes/package.json","../node_modules/react-dom/index.js","../node_modules/react/cjs/react-jsx-runtime.production.min.js","../node_modules/react/cjs/react-jsx-dev-runtime.production.min.js","../node_modules/next/dist/compiled/react-is/cjs/react-is.development.js","../node_modules/next/dist/compiled/react-is/cjs/react-is.production.min.js","../node_modules/next/dist/compiled/string-hash/index.js","../node_modules/next/dist/compiled/superstruct/index.cjs","../node_modules/next/dist/compiled/bytes/index.js","../node_modules/next/dist/lib/metadata/is-metadata-route.js","../node_modules/next/dist/shared/lib/hash.js","../node_modules/busboy/lib/utils.js","../node_modules/busboy/lib/types/urlencoded.js","../node_modules/busboy/lib/types/multipart.js","../node_modules/react-dom/cjs/react-dom.production.min.js","../node_modules/next/dist/client/components/client-hook-in-server-component-error.js","../node_modules/next/dist/client/components/bailout-to-client-rendering.js","../node_modules/next/dist/client/components/router-reducer/reducers/get-segment-value.js","../node_modules/next/dist/lib/metadata/resolvers/resolve-url.js","../node_modules/scheduler/package.json","../node_modules/streamsearch/package.json","../node_modules/scheduler/index.js","../node_modules/streamsearch/lib/sbmh.js","../node_modules/scheduler/cjs/scheduler.production.min.js","../node_modules/scheduler/cjs/scheduler.development.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/amp-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/app-router-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/head-manager-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/hooks-client-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/html-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/image-config-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/loadable-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/loadable.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/router-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/server-inserted-html.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/amp-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/app-router-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/head-manager-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/hooks-client-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/html-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/image-config-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/loadable-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/loadable.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/router-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/server-inserted-html.js"]}
\ No newline at end of file
+{"version":1,"files":["../node_modules/styled-jsx/index.js","../node_modules/styled-jsx/package.json","../node_modules/styled-jsx/dist/index/index.js","../node_modules/react/package.json","../node_modules/react/index.js","../node_modules/client-only/package.json","../node_modules/react/cjs/react.production.min.js","../node_modules/client-only/index.js","../node_modules/styled-jsx/style.js","../node_modules/next/dist/server/next-server.js","../node_modules/next/package.json","../node_modules/next/dist/server/base-server.js","../node_modules/next/dist/server/node-environment.js","../node_modules/next/dist/server/node-polyfill-crypto.js","../node_modules/next/dist/server/require-hook.js","../node_modules/next/dist/server/request-meta.js","../node_modules/next/dist/lib/find-pages-dir.js","../node_modules/next/dist/server/send-payload.js","../node_modules/next/dist/server/require.js","../node_modules/next/dist/server/load-components.js","../node_modules/next/dist/lib/is-error.js","../node_modules/next/dist/server/body-streams.js","../node_modules/next/dist/server/setup-http-agent-env.js","../node_modules/next/dist/lib/constants.js","../node_modules/next/dist/server/pipe-readable.js","../node_modules/next/dist/server/load-manifest.js","../node_modules/next/dist/server/image-optimizer.js","../node_modules/next/dist/server/serve-static.js","../node_modules/next/dist/lib/format-server-error.js","../node_modules/next/dist/lib/picocolors.js","../node_modules/next/dist/shared/lib/utils.js","../node_modules/next/dist/shared/lib/constants.js","../node_modules/next/dist/server/base-http/node.js","../node_modules/next/dist/build/output/log.js","../node_modules/next/dist/server/web/utils.js","../node_modules/next/dist/server/lib/node-fs-methods.js","../node_modules/next/dist/server/lib/mock-request.js","../node_modules/next/dist/client/components/app-router-headers.js","../node_modules/next/dist/shared/lib/page-path/denormalize-page-path.js","../node_modules/next/dist/shared/lib/page-path/normalize-page-path.js","../node_modules/next/dist/server/lib/trace/constants.js","../node_modules/next/dist/server/future/route-matches/pages-api-route-match.js","../node_modules/next/dist/server/lib/trace/tracer.js","../node_modules/next/dist/server/lib/server-ipc/invoke-request.js","../node_modules/next/dist/server/lib/server-ipc/utils.js","../node_modules/next/dist/shared/lib/router/utils/route-matcher.js","../node_modules/next/dist/shared/lib/router/utils/parse-url.js","../node_modules/next/dist/shared/lib/router/utils/querystring.js","../node_modules/next/dist/shared/lib/router/utils/middleware-route-matcher.js","../node_modules/next/dist/shared/lib/router/utils/get-next-pathname-info.js","../node_modules/next/dist/shared/lib/router/utils/app-paths.js","../node_modules/next/dist/shared/lib/router/utils/remove-trailing-slash.js","../node_modules/next/dist/shared/lib/router/utils/route-regex.js","../node_modules/next/dist/server/web/spec-extension/adapters/next-request.js","../node_modules/next/dist/server/future/helpers/module-loader/route-module-loader.js","../node_modules/next/dist/server/future/route-modules/app-page/module.render.js","../node_modules/next/dist/server/future/route-modules/pages/module.render.js","../node_modules/next/dist/client/components/action-async-storage.external.js","../node_modules/next/dist/client/components/request-async-storage.external.js","../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../node_modules/next/dist/client/components/static-generation-async-storage.external.js","../node_modules/next/dist/compiled/next-server/pages.runtime.prod.js","../node_modules/next/dist/server/api-utils/index.js","../node_modules/next/dist/server/response-cache/index.js","../node_modules/next/dist/server/lib/incremental-cache/index.js","../node_modules/next/dist/server/web/sandbox/index.js","../node_modules/next/dist/lib/interop-default.js","../node_modules/next/dist/lib/wait.js","../node_modules/next/dist/lib/detached-promise.js","../node_modules/@next/env/package.json","../node_modules/next/dist/server/lib/etag.js","../node_modules/next/dist/server/lib/revalidate.js","../node_modules/next/dist/shared/lib/is-plain-object.js","../node_modules/next/dist/shared/lib/image-blur-svg.js","../node_modules/next/dist/shared/lib/match-remote-pattern.js","../node_modules/next/dist/experimental/testmode/server.js","../node_modules/next/dist/shared/lib/i18n/normalize-locale-path.js","../node_modules/next/dist/server/lib/squoosh/main.js","../node_modules/next/dist/lib/redirect-status.js","../node_modules/next/dist/lib/is-edge-runtime.js","../node_modules/next/dist/server/utils.js","../node_modules/next/dist/server/render-result.js","../node_modules/next/dist/server/server-utils.js","../node_modules/next/dist/server/send-response.js","../node_modules/next/dist/server/internal-utils.js","../node_modules/next/dist/server/base-http/index.js","../node_modules/next/dist/shared/lib/modern-browserslist-target.js","../node_modules/next/dist/server/lib/format-hostname.js","../node_modules/next/dist/client/components/redirect-status-code.js","../node_modules/next/dist/shared/lib/runtime-config.external.js","../node_modules/next/dist/shared/lib/get-hostname.js","../node_modules/next/dist/server/lib/match-next-data-pathname.js","../node_modules/next/dist/server/app-render/strip-flight-headers.js","../node_modules/next/dist/server/lib/server-action-request-meta.js","../node_modules/next/dist/server/future/route-kind.js","../node_modules/next/dist/server/future/route-matcher-managers/default-route-matcher-manager.js","../node_modules/next/dist/server/future/normalizers/locale-route-normalizer.js","../node_modules/next/dist/server/future/route-matcher-providers/app-route-route-matcher-provider.js","../node_modules/next/dist/server/future/route-matcher-providers/pages-api-route-matcher-provider.js","../node_modules/next/dist/server/future/route-matcher-providers/app-page-route-matcher-provider.js","../node_modules/next/dist/server/future/route-matcher-providers/pages-route-matcher-provider.js","../node_modules/next/dist/server/future/helpers/i18n-provider.js","../node_modules/next/dist/server/future/route-modules/checks.js","../node_modules/next/dist/server/api-utils/node/try-get-preview-data.js","../node_modules/next/dist/shared/lib/i18n/get-locale-redirect.js","../node_modules/next/dist/shared/lib/page-path/ensure-leading-slash.js","../node_modules/@next/env/dist/index.js","../node_modules/next/dist/shared/lib/page-path/normalize-path-sep.js","../node_modules/next/dist/client/components/async-local-storage.js","../node_modules/next/dist/shared/lib/segment.js","../node_modules/next/dist/shared/lib/escape-regexp.js","../node_modules/next/dist/shared/lib/router/utils/is-bot.js","../node_modules/next/dist/shared/lib/router/utils/escape-path-delimiters.js","../node_modules/next/dist/server/future/route-modules/helpers/response-handlers.js","../node_modules/next/dist/shared/lib/router/utils/remove-path-prefix.js","../node_modules/next/dist/server/future/normalizers/request/postponed.js","../node_modules/next/dist/shared/lib/router/utils/get-route-from-asset-path.js","../node_modules/next/dist/server/future/normalizers/request/rsc.js","../node_modules/next/dist/server/future/normalizers/request/prefetch-rsc.js","../node_modules/next/dist/server/future/normalizers/request/next-data.js","../node_modules/next/dist/lib/batcher.js","../node_modules/next/dist/lib/scheduler.js","../node_modules/next/dist/server/future/helpers/interception-routes.js","../node_modules/next/dist/server/web/spec-extension/request.js","../node_modules/next/dist/server/future/route-matcher-providers/helpers/manifest-loaders/server-manifest-loader.js","../node_modules/next/dist/server/response-cache/types.js","../node_modules/next/dist/server/response-cache/utils.js","../node_modules/next/dist/shared/lib/router/utils/parse-relative-url.js","../node_modules/next/dist/shared/lib/router/utils/path-has-prefix.js","../node_modules/next/dist/shared/lib/router/utils/prepare-destination.js","../node_modules/next/dist/server/future/helpers/module-loader/node-module-loader.js","../node_modules/next/dist/server/future/route-modules/app-page/module.compiled.js","../node_modules/next/dist/server/future/route-modules/pages/module.compiled.js","../node_modules/next/dist/server/web/spec-extension/adapters/headers.js","../node_modules/next/dist/server/lib/incremental-cache/fetch-cache.js","../node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js","../node_modules/next/dist/shared/lib/isomorphic/path.js","../node_modules/next/dist/server/lib/server-ipc/request-utils.js","../node_modules/next/dist/server/web/sandbox/sandbox.js","../node_modules/next/dist/server/web/sandbox/context.js","../node_modules/next/dist/shared/lib/router/utils/index.js","../node_modules/next/dist/experimental/testmode/context.js","../node_modules/next/dist/experimental/testmode/httpget.js","../node_modules/next/dist/experimental/testmode/fetch.js","../node_modules/next/dist/compiled/ws/package.json","../node_modules/next/dist/compiled/fresh/package.json","../node_modules/next/dist/compiled/lru-cache/package.json","../node_modules/next/dist/compiled/image-size/package.json","../node_modules/next/dist/compiled/is-animated/package.json","../node_modules/next/dist/compiled/content-disposition/package.json","../node_modules/next/dist/compiled/get-orientation/package.json","../node_modules/next/dist/compiled/send/package.json","../node_modules/react-dom/package.json","../node_modules/next/dist/server/stream-utils/node-web-streams-helper.js","../node_modules/next/dist/server/api-utils/get-cookie-parser.js","../node_modules/next/dist/compiled/@hapi/accept/package.json","../node_modules/next/dist/server/lib/is-ipv6.js","../node_modules/@swc/helpers/_/_interop_require_default/package.json","../node_modules/next/dist/lib/is-app-route-route.js","../node_modules/next/dist/lib/is-api-route.js","../node_modules/next/dist/lib/is-app-page-route.js","../node_modules/next/dist/server/crypto-utils.js","../node_modules/next/dist/server/accept-header.js","../node_modules/next/dist/shared/lib/router/utils/path-match.js","../node_modules/react-dom/server.browser.js","../node_modules/next/dist/server/future/route-matchers/locale-route-matcher.js","../node_modules/next/dist/server/future/route-matcher-providers/manifest-route-matcher-provider.js","../node_modules/next/dist/server/future/route-matchers/app-route-route-matcher.js","../node_modules/next/dist/server/future/route-matchers/pages-api-route-matcher.js","../node_modules/next/dist/server/future/route-matchers/app-page-route-matcher.js","../node_modules/next/dist/server/future/route-matchers/pages-route-matcher.js","../node_modules/next/dist/server/web/spec-extension/cookies.js","../node_modules/next/dist/shared/lib/i18n/detect-domain-locale.js","../node_modules/next/dist/compiled/ws/index.js","../node_modules/next/dist/compiled/fresh/index.js","../node_modules/next/dist/compiled/lru-cache/index.js","../node_modules/next/dist/compiled/image-size/index.js","../node_modules/next/dist/server/web/next-url.js","../node_modules/next/dist/server/web/error.js","../node_modules/next/dist/compiled/is-animated/index.js","../node_modules/next/dist/compiled/content-disposition/index.js","../node_modules/next/dist/compiled/get-orientation/index.js","../node_modules/next/dist/compiled/send/index.js","../node_modules/next/dist/shared/lib/router/utils/format-url.js","../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../node_modules/@swc/helpers/package.json","../node_modules/next/dist/compiled/node-html-parser/package.json","../node_modules/next/dist/compiled/jsonwebtoken/package.json","../node_modules/next/dist/compiled/cookie/package.json","../node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.js","../node_modules/next/dist/shared/lib/router/utils/is-dynamic.js","../node_modules/next/dist/server/future/normalizers/request/suffix.js","../node_modules/next/dist/server/future/normalizers/request/prefix.js","../node_modules/next/dist/compiled/@hapi/accept/index.js","../node_modules/next/dist/lib/pick.js","../node_modules/next/dist/shared/lib/router/utils/parse-path.js","../node_modules/next/dist/server/web/sandbox/resource-managers.js","../node_modules/next/dist/server/web/sandbox/fetch-inline-assets.js","../node_modules/next/dist/server/web/spec-extension/adapters/reflect.js","../node_modules/@swc/helpers/cjs/_interop_require_default.cjs","../node_modules/next/dist/compiled/node-html-parser/index.js","../node_modules/next/dist/compiled/jsonwebtoken/index.js","../node_modules/next/dist/compiled/cookie/index.js","../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../node_modules/next/dist/shared/lib/router/utils/sorted-routes.js","../node_modules/next/dist/server/future/normalizers/built/pages/index.js","../node_modules/next/dist/server/future/normalizers/built/app/index.js","../node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js","../node_modules/react-dom/cjs/react-dom-server.browser.production.min.js","../node_modules/next/dist/server/stream-utils/encode-decode.js","../node_modules/next/dist/compiled/micromatch/package.json","../node_modules/next/dist/server/future/route-matchers/route-matcher.js","../node_modules/next/dist/compiled/micromatch/index.js","../node_modules/next/dist/server/future/route-matcher-providers/helpers/cached-route-matcher-provider.js","../node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js","../node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js","../node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js","../node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js","../node_modules/next/dist/shared/lib/router/utils/format-next-pathname-info.js","../node_modules/next/dist/server/future/route-modules/app-page/module.js","../node_modules/next/dist/server/future/route-modules/pages/module.js","../node_modules/next/dist/compiled/path-browserify/package.json","../node_modules/next/dist/compiled/edge-runtime/package.json","../node_modules/next/dist/compiled/path-to-regexp/index.js","../node_modules/next/dist/compiled/path-browserify/index.js","../node_modules/next/dist/compiled/edge-runtime/index.js","../node_modules/next/dist/server/future/normalizers/built/pages/pages-bundle-path-normalizer.js","../node_modules/next/dist/server/future/normalizers/built/pages/pages-pathname-normalizer.js","../node_modules/next/dist/server/future/normalizers/built/pages/pages-filename-normalizer.js","../node_modules/next/dist/server/future/normalizers/built/pages/pages-page-normalizer.js","../node_modules/next/dist/server/future/normalizers/built/app/app-bundle-path-normalizer.js","../node_modules/next/dist/server/future/normalizers/built/app/app-pathname-normalizer.js","../node_modules/next/dist/server/future/normalizers/built/app/app-filename-normalizer.js","../node_modules/next/dist/server/future/normalizers/built/app/app-page-normalizer.js","../node_modules/next/dist/compiled/@mswjs/interceptors/ClientRequest/package.json","../node_modules/next/dist/compiled/debug/package.json","../node_modules/next/dist/compiled/@edge-runtime/cookies/package.json","../node_modules/@swc/helpers/_/_interop_require_wildcard/package.json","../node_modules/next/dist/lib/semver-noop.js","../node_modules/next/dist/server/render.js","../node_modules/next/dist/shared/lib/router/utils/add-locale.js","../node_modules/next/dist/shared/lib/router/utils/add-path-prefix.js","../node_modules/next/dist/shared/lib/router/utils/add-path-suffix.js","../node_modules/next/dist/compiled/@mswjs/interceptors/ClientRequest/index.js","../node_modules/next/dist/server/app-render/app-render.js","../node_modules/next/dist/compiled/debug/index.js","../node_modules/next/dist/server/future/route-modules/route-module.js","../node_modules/next/dist/compiled/@edge-runtime/cookies/index.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/entrypoints.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/rsc/entrypoints.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/ssr/entrypoints.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/entrypoints.js","../node_modules/@swc/helpers/cjs/_interop_require_wildcard.cjs","../node_modules/next/dist/server/future/normalizers/prefixing-normalizer.js","../node_modules/next/dist/server/future/normalizers/normalizers.js","../node_modules/next/dist/server/future/normalizers/wrap-normalizer-fn.js","../node_modules/next/dist/server/future/normalizers/absolute-filename-normalizer.js","../node_modules/next/dist/server/future/normalizers/underscore-normalizer.js","../node_modules/next/dist/lib/is-serializable-props.js","../node_modules/next/dist/server/post-process.js","../node_modules/next/dist/shared/lib/amp-mode.js","../node_modules/next/dist/shared/lib/amp-context.shared-runtime.js","../node_modules/next/dist/shared/lib/head-manager-context.shared-runtime.js","../node_modules/next/dist/shared/lib/loadable-context.shared-runtime.js","../node_modules/next/dist/shared/lib/head.js","../node_modules/next/dist/shared/lib/loadable.shared-runtime.js","../node_modules/next/dist/shared/lib/router-context.shared-runtime.js","../node_modules/next/dist/shared/lib/html-context.shared-runtime.js","../node_modules/next/dist/shared/lib/image-config-context.shared-runtime.js","../node_modules/next/dist/shared/lib/app-router-context.shared-runtime.js","../node_modules/next/dist/shared/lib/hooks-client-context.shared-runtime.js","../node_modules/next/dist/shared/lib/router/adapters.js","../node_modules/next/dist/client/components/match-segments.js","../node_modules/next/dist/server/app-render/create-server-components-renderer.js","../node_modules/next/dist/server/async-storage/static-generation-async-storage-wrapper.js","../node_modules/next/dist/client/components/redirect.js","../node_modules/next/dist/server/async-storage/request-async-storage-wrapper.js","../node_modules/next/dist/lib/metadata/metadata.js","../node_modules/next/dist/server/lib/patch-fetch.js","../node_modules/next/dist/server/app-render/flight-render-result.js","../node_modules/next/dist/client/components/not-found.js","../node_modules/next/dist/server/app-render/create-error-handler.js","../node_modules/next/dist/server/app-render/get-script-nonce-from-header.js","../node_modules/next/dist/server/app-render/get-short-dynamic-param-type.js","../node_modules/next/dist/server/app-render/get-segment-param.js","../node_modules/next/dist/server/app-render/action-handler.js","../node_modules/next/dist/server/app-render/parse-and-validate-flight-router-state.js","../node_modules/next/dist/server/app-render/create-flight-router-state-from-loader-tree.js","../node_modules/next/dist/server/app-render/validate-url.js","../node_modules/next/dist/server/app-render/make-get-server-inserted-html.js","../node_modules/next/dist/server/app-render/server-inserted-html.js","../node_modules/next/dist/client/components/hooks-server-context.js","../node_modules/next/dist/server/app-render/required-scripts.js","../node_modules/next/dist/server/app-render/walk-tree-with-flight-router-state.js","../node_modules/next/dist/server/app-render/create-component-tree.js","../node_modules/next/dist/server/app-render/get-asset-query-string.js","../node_modules/next/dist/server/app-render/action-encryption-utils.js","../node_modules/next/dist/server/app-render/is-missing-postpone-error.js","../node_modules/next/dist/client/components/dev-root-not-found-boundary.js","../node_modules/next/dist/shared/lib/lazy-dynamic/no-ssr-error.js","../node_modules/next/dist/server/app-render/static/static-renderer.js","../node_modules/next/dist/shared/lib/server-inserted-html.shared-runtime.js","../node_modules/next/dist/lib/non-nullable.js","../node_modules/next/dist/server/optimize-amp.js","../node_modules/next/dist/shared/lib/page-path/absolute-path-to-page.js","../node_modules/next/dist/shared/lib/image-config.js","../node_modules/next/dist/shared/lib/side-effect.js","../node_modules/next/dist/server/htmlescape.js","../node_modules/next/dist/lib/client-reference.js","../node_modules/next/dist/compiled/react-is/package.json","../node_modules/next/dist/compiled/strip-ansi/package.json","../node_modules/next/dist/shared/lib/utils/warn-once.js","../node_modules/next/dist/server/app-render/use-flight-response.js","../node_modules/next/dist/server/async-storage/draft-mode-provider.js","../node_modules/next/dist/lib/metadata/resolve-metadata.js","../node_modules/next/dist/lib/metadata/default-metadata.js","../node_modules/next/dist/server/dev/log-app-dir-error.js","../node_modules/next/dist/export/helpers/is-dynamic-usage-error.js","../node_modules/next/dist/server/app-render/types.js","../node_modules/next/dist/server/app-render/react-server.node.js","../node_modules/next/dist/server/app-render/get-css-inlined-link-tags.js","../node_modules/next/dist/server/app-render/get-preloadable-fonts.js","../node_modules/next/dist/server/lib/app-dir-module.js","../node_modules/next/dist/server/app-render/get-layer-assets.js","../node_modules/next/dist/server/app-render/parse-loader-tree.js","../node_modules/next/dist/server/app-render/has-loading-component-in-tree.js","../node_modules/next/dist/server/app-render/interop-default.js","../node_modules/next/dist/server/app-render/create-component-styles-and-scripts.js","../node_modules/next/dist/client/components/not-found-boundary.js","../node_modules/next/dist/lib/metadata/generate/basic.js","../node_modules/next/dist/lib/metadata/generate/alternate.js","../node_modules/next/dist/lib/metadata/generate/opengraph.js","../node_modules/next/dist/lib/metadata/generate/icons.js","../node_modules/next/dist/lib/metadata/generate/meta.js","../node_modules/next/dist/compiled/nanoid/package.json","../node_modules/next/dist/shared/lib/router/utils/as-path-to-search-params.js","../node_modules/next/dist/compiled/react-is/index.js","../node_modules/next/dist/compiled/strip-ansi/index.js","../node_modules/next/dist/compiled/nanoid/index.cjs","../node_modules/react/jsx-runtime.js","../node_modules/react/jsx-dev-runtime.js","../node_modules/next/dist/lib/metadata/get-metadata-route.js","../node_modules/busboy/package.json","../node_modules/next/dist/shared/lib/page-path/remove-page-path-tail.js","../node_modules/next/dist/lib/metadata/clone-metadata.js","../node_modules/next/dist/client/components/navigation.js","../node_modules/next/dist/lib/metadata/resolvers/resolve-title.js","../node_modules/next/dist/lib/metadata/generate/utils.js","../node_modules/next/dist/lib/metadata/resolvers/resolve-icons.js","../node_modules/next/dist/lib/metadata/resolvers/resolve-basics.js","../node_modules/next/dist/lib/metadata/resolvers/resolve-opengraph.js","../node_modules/busboy/lib/index.js","../node_modules/next/dist/compiled/string-hash/package.json","../node_modules/next/dist/lib/metadata/constants.js","../node_modules/next/dist/compiled/superstruct/package.json","../node_modules/next/dist/compiled/bytes/package.json","../node_modules/react/cjs/react-jsx-runtime.production.min.js","../node_modules/react/cjs/react-jsx-dev-runtime.production.min.js","../node_modules/react-dom/index.js","../node_modules/next/dist/compiled/react-is/cjs/react-is.production.min.js","../node_modules/next/dist/compiled/react-is/cjs/react-is.development.js","../node_modules/next/dist/compiled/string-hash/index.js","../node_modules/next/dist/compiled/superstruct/index.cjs","../node_modules/next/dist/compiled/bytes/index.js","../node_modules/next/dist/lib/metadata/is-metadata-route.js","../node_modules/next/dist/shared/lib/hash.js","../node_modules/busboy/lib/utils.js","../node_modules/busboy/lib/types/urlencoded.js","../node_modules/busboy/lib/types/multipart.js","../node_modules/react-dom/cjs/react-dom.production.min.js","../node_modules/next/dist/client/components/client-hook-in-server-component-error.js","../node_modules/next/dist/client/components/bailout-to-client-rendering.js","../node_modules/next/dist/client/components/router-reducer/reducers/get-segment-value.js","../node_modules/next/dist/lib/metadata/resolvers/resolve-url.js","../node_modules/scheduler/package.json","../node_modules/streamsearch/package.json","../node_modules/scheduler/index.js","../node_modules/streamsearch/lib/sbmh.js","../node_modules/scheduler/cjs/scheduler.production.min.js","../node_modules/scheduler/cjs/scheduler.development.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/amp-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/app-router-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/head-manager-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/hooks-client-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/html-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/image-config-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/loadable-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/loadable.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/router-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/server-inserted-html.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/amp-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/app-router-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/head-manager-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/hooks-client-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/html-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/image-config-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/loadable-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/loadable.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/router-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/server-inserted-html.js"]}
\ No newline at end of file
diff --git a/.next/prerender-manifest.js b/.next/prerender-manifest.js
index 7d0ddb1..833fcef 100644
--- a/.next/prerender-manifest.js
+++ b/.next/prerender-manifest.js
@@ -1 +1 @@
-self.__PRERENDER_MANIFEST="{\"version\":4,\"routes\":{\"/favicon.ico\":{\"initialHeaders\":{\"cache-control\":\"public, max-age=0, must-revalidate\",\"content-type\":\"image/x-icon\",\"x-next-cache-tags\":\"_N_T_/layout,_N_T_/favicon.ico/layout,_N_T_/favicon.ico/route,_N_T_/favicon.ico\"},\"experimentalBypassFor\":[{\"type\":\"header\",\"key\":\"Next-Action\"},{\"type\":\"header\",\"key\":\"content-type\",\"value\":\"multipart/form-data\"}],\"initialRevalidateSeconds\":false,\"srcRoute\":\"/favicon.ico\",\"dataRoute\":null},\"/everyone-votes/terms\":{\"experimentalBypassFor\":[{\"type\":\"header\",\"key\":\"Next-Action\"},{\"type\":\"header\",\"key\":\"content-type\",\"value\":\"multipart/form-data\"}],\"initialRevalidateSeconds\":false,\"srcRoute\":\"/everyone-votes/terms\",\"dataRoute\":\"/everyone-votes/terms.rsc\"},\"/everyone-votes/privacy\":{\"experimentalBypassFor\":[{\"type\":\"header\",\"key\":\"Next-Action\"},{\"type\":\"header\",\"key\":\"content-type\",\"value\":\"multipart/form-data\"}],\"initialRevalidateSeconds\":false,\"srcRoute\":\"/everyone-votes/privacy\",\"dataRoute\":\"/everyone-votes/privacy.rsc\"},\"/\":{\"experimentalBypassFor\":[{\"type\":\"header\",\"key\":\"Next-Action\"},{\"type\":\"header\",\"key\":\"content-type\",\"value\":\"multipart/form-data\"}],\"initialRevalidateSeconds\":false,\"srcRoute\":\"/\",\"dataRoute\":\"/index.rsc\"},\"/wiston\":{\"experimentalBypassFor\":[{\"type\":\"header\",\"key\":\"Next-Action\"},{\"type\":\"header\",\"key\":\"content-type\",\"value\":\"multipart/form-data\"}],\"initialRevalidateSeconds\":false,\"srcRoute\":\"/wiston\",\"dataRoute\":\"/wiston.rsc\"},\"/space\":{\"experimentalBypassFor\":[{\"type\":\"header\",\"key\":\"Next-Action\"},{\"type\":\"header\",\"key\":\"content-type\",\"value\":\"multipart/form-data\"}],\"initialRevalidateSeconds\":false,\"srcRoute\":\"/space\",\"dataRoute\":\"/space.rsc\"}},\"dynamicRoutes\":{},\"notFoundRoutes\":[],\"preview\":{\"previewModeId\":\"ef8045dd883b24c46f5e1dcb17f6a42f\",\"previewModeSigningKey\":\"e3c0026f0a2f05041186a8da9f09ebf1526584f3b0b71d4d87445128b115dea0\",\"previewModeEncryptionKey\":\"351af1c9275cb83cd1aec2a8e439d55c46e618c1f41a594d0c81feda4bd9eb35\"}}"
\ No newline at end of file
+self.__PRERENDER_MANIFEST="{\"version\":4,\"routes\":{\"/favicon.ico\":{\"initialHeaders\":{\"cache-control\":\"public, max-age=0, must-revalidate\",\"content-type\":\"image/x-icon\",\"x-next-cache-tags\":\"_N_T_/layout,_N_T_/favicon.ico/layout,_N_T_/favicon.ico/route,_N_T_/favicon.ico\"},\"experimentalBypassFor\":[{\"type\":\"header\",\"key\":\"Next-Action\"},{\"type\":\"header\",\"key\":\"content-type\",\"value\":\"multipart/form-data\"}],\"initialRevalidateSeconds\":false,\"srcRoute\":\"/favicon.ico\",\"dataRoute\":null},\"/everyone-votes/terms\":{\"experimentalBypassFor\":[{\"type\":\"header\",\"key\":\"Next-Action\"},{\"type\":\"header\",\"key\":\"content-type\",\"value\":\"multipart/form-data\"}],\"initialRevalidateSeconds\":false,\"srcRoute\":\"/everyone-votes/terms\",\"dataRoute\":\"/everyone-votes/terms.rsc\"},\"/everyone-votes/privacy\":{\"experimentalBypassFor\":[{\"type\":\"header\",\"key\":\"Next-Action\"},{\"type\":\"header\",\"key\":\"content-type\",\"value\":\"multipart/form-data\"}],\"initialRevalidateSeconds\":false,\"srcRoute\":\"/everyone-votes/privacy\",\"dataRoute\":\"/everyone-votes/privacy.rsc\"},\"/\":{\"experimentalBypassFor\":[{\"type\":\"header\",\"key\":\"Next-Action\"},{\"type\":\"header\",\"key\":\"content-type\",\"value\":\"multipart/form-data\"}],\"initialRevalidateSeconds\":false,\"srcRoute\":\"/\",\"dataRoute\":\"/index.rsc\"},\"/wiston\":{\"experimentalBypassFor\":[{\"type\":\"header\",\"key\":\"Next-Action\"},{\"type\":\"header\",\"key\":\"content-type\",\"value\":\"multipart/form-data\"}],\"initialRevalidateSeconds\":false,\"srcRoute\":\"/wiston\",\"dataRoute\":\"/wiston.rsc\"},\"/space\":{\"experimentalBypassFor\":[{\"type\":\"header\",\"key\":\"Next-Action\"},{\"type\":\"header\",\"key\":\"content-type\",\"value\":\"multipart/form-data\"}],\"initialRevalidateSeconds\":false,\"srcRoute\":\"/space\",\"dataRoute\":\"/space.rsc\"}},\"dynamicRoutes\":{},\"notFoundRoutes\":[],\"preview\":{\"previewModeId\":\"fa6fb29c4e154ed9a1e2df3dc276f21d\",\"previewModeSigningKey\":\"bd1462756e636dd5f9fc47cab1931d5d49ddce79b8bc3a56802b3872024f8aaf\",\"previewModeEncryptionKey\":\"73b517d28042554b72d6de967e719a89eb0902d6843715e5e60d9e146baf50c9\"}}"
\ No newline at end of file
diff --git a/.next/prerender-manifest.json b/.next/prerender-manifest.json
index 932636f..c220030 100644
--- a/.next/prerender-manifest.json
+++ b/.next/prerender-manifest.json
@@ -1 +1 @@
-{"version":4,"routes":{"/favicon.ico":{"initialHeaders":{"cache-control":"public, max-age=0, must-revalidate","content-type":"image/x-icon","x-next-cache-tags":"_N_T_/layout,_N_T_/favicon.ico/layout,_N_T_/favicon.ico/route,_N_T_/favicon.ico"},"experimentalBypassFor":[{"type":"header","key":"Next-Action"},{"type":"header","key":"content-type","value":"multipart/form-data"}],"initialRevalidateSeconds":false,"srcRoute":"/favicon.ico","dataRoute":null},"/everyone-votes/terms":{"experimentalBypassFor":[{"type":"header","key":"Next-Action"},{"type":"header","key":"content-type","value":"multipart/form-data"}],"initialRevalidateSeconds":false,"srcRoute":"/everyone-votes/terms","dataRoute":"/everyone-votes/terms.rsc"},"/everyone-votes/privacy":{"experimentalBypassFor":[{"type":"header","key":"Next-Action"},{"type":"header","key":"content-type","value":"multipart/form-data"}],"initialRevalidateSeconds":false,"srcRoute":"/everyone-votes/privacy","dataRoute":"/everyone-votes/privacy.rsc"},"/":{"experimentalBypassFor":[{"type":"header","key":"Next-Action"},{"type":"header","key":"content-type","value":"multipart/form-data"}],"initialRevalidateSeconds":false,"srcRoute":"/","dataRoute":"/index.rsc"},"/wiston":{"experimentalBypassFor":[{"type":"header","key":"Next-Action"},{"type":"header","key":"content-type","value":"multipart/form-data"}],"initialRevalidateSeconds":false,"srcRoute":"/wiston","dataRoute":"/wiston.rsc"},"/space":{"experimentalBypassFor":[{"type":"header","key":"Next-Action"},{"type":"header","key":"content-type","value":"multipart/form-data"}],"initialRevalidateSeconds":false,"srcRoute":"/space","dataRoute":"/space.rsc"}},"dynamicRoutes":{},"notFoundRoutes":[],"preview":{"previewModeId":"ef8045dd883b24c46f5e1dcb17f6a42f","previewModeSigningKey":"e3c0026f0a2f05041186a8da9f09ebf1526584f3b0b71d4d87445128b115dea0","previewModeEncryptionKey":"351af1c9275cb83cd1aec2a8e439d55c46e618c1f41a594d0c81feda4bd9eb35"}}
\ No newline at end of file
+{"version":4,"routes":{"/favicon.ico":{"initialHeaders":{"cache-control":"public, max-age=0, must-revalidate","content-type":"image/x-icon","x-next-cache-tags":"_N_T_/layout,_N_T_/favicon.ico/layout,_N_T_/favicon.ico/route,_N_T_/favicon.ico"},"experimentalBypassFor":[{"type":"header","key":"Next-Action"},{"type":"header","key":"content-type","value":"multipart/form-data"}],"initialRevalidateSeconds":false,"srcRoute":"/favicon.ico","dataRoute":null},"/everyone-votes/terms":{"experimentalBypassFor":[{"type":"header","key":"Next-Action"},{"type":"header","key":"content-type","value":"multipart/form-data"}],"initialRevalidateSeconds":false,"srcRoute":"/everyone-votes/terms","dataRoute":"/everyone-votes/terms.rsc"},"/everyone-votes/privacy":{"experimentalBypassFor":[{"type":"header","key":"Next-Action"},{"type":"header","key":"content-type","value":"multipart/form-data"}],"initialRevalidateSeconds":false,"srcRoute":"/everyone-votes/privacy","dataRoute":"/everyone-votes/privacy.rsc"},"/":{"experimentalBypassFor":[{"type":"header","key":"Next-Action"},{"type":"header","key":"content-type","value":"multipart/form-data"}],"initialRevalidateSeconds":false,"srcRoute":"/","dataRoute":"/index.rsc"},"/wiston":{"experimentalBypassFor":[{"type":"header","key":"Next-Action"},{"type":"header","key":"content-type","value":"multipart/form-data"}],"initialRevalidateSeconds":false,"srcRoute":"/wiston","dataRoute":"/wiston.rsc"},"/space":{"experimentalBypassFor":[{"type":"header","key":"Next-Action"},{"type":"header","key":"content-type","value":"multipart/form-data"}],"initialRevalidateSeconds":false,"srcRoute":"/space","dataRoute":"/space.rsc"}},"dynamicRoutes":{},"notFoundRoutes":[],"preview":{"previewModeId":"fa6fb29c4e154ed9a1e2df3dc276f21d","previewModeSigningKey":"bd1462756e636dd5f9fc47cab1931d5d49ddce79b8bc3a56802b3872024f8aaf","previewModeEncryptionKey":"73b517d28042554b72d6de967e719a89eb0902d6843715e5e60d9e146baf50c9"}}
\ No newline at end of file
diff --git a/.next/server/app-paths-manifest.json b/.next/server/app-paths-manifest.json
index e1286d6..f4a9c73 100644
--- a/.next/server/app-paths-manifest.json
+++ b/.next/server/app-paths-manifest.json
@@ -1,9 +1,9 @@
{
"/_not-found": "app/_not-found.js",
- "/everyone-votes/terms/page": "app/everyone-votes/terms/page.js",
"/everyone-votes/privacy/page": "app/everyone-votes/privacy/page.js",
"/favicon.ico/route": "app/favicon.ico/route.js",
- "/page": "app/page.js",
"/space/page": "app/space/page.js",
+ "/everyone-votes/terms/page": "app/everyone-votes/terms/page.js",
+ "/page": "app/page.js",
"/wiston/page": "app/wiston/page.js"
}
\ No newline at end of file
diff --git a/.next/server/app/_not-found.html b/.next/server/app/_not-found.html
index f051e9e..7470fca 100644
--- a/.next/server/app/_not-found.html
+++ b/.next/server/app/_not-found.html
@@ -1 +1 @@
-
404: This page could not be found. sukadia.dev 404
This page could not be found.
\ No newline at end of file
+404: This page could not be found. sukadia.dev 404
This page could not be found.
\ No newline at end of file
diff --git a/.next/server/app/_not-found.js b/.next/server/app/_not-found.js
index ac45a1d..6340c5e 100644
--- a/.next/server/app/_not-found.js
+++ b/.next/server/app/_not-found.js
@@ -1 +1 @@
-(()=>{var e={};e.id=165,e.ids=[165],e.modules={7849:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external")},5403:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external")},4749:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external")},399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},5528:e=>{"use strict";e.exports=require("next/dist\\client\\components\\action-async-storage.external.js")},1877:e=>{"use strict";e.exports=require("next/dist\\client\\components\\request-async-storage.external.js")},5319:e=>{"use strict";e.exports=require("next/dist\\client\\components\\static-generation-async-storage.external.js")},6813:(e,t,n)=>{"use strict";n.r(t),n.d(t,{GlobalError:()=>i.a,__next_app__:()=>p,originalPathname:()=>c,pages:()=>u,routeModule:()=>m,tree:()=>l});var r=n(482),s=n(9108),o=n(2563),i=n.n(o),a=n(8300),d={};for(let e in a)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(d[e]=()=>a[e]);n.d(t,d);let l=["",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(n.t.bind(n,9361,23)),"next/dist/client/components/not-found-error"]}]},{layout:[()=>Promise.resolve().then(n.bind(n,2917)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\layout.tsx"],"not-found":[()=>Promise.resolve().then(n.t.bind(n,9361,23)),"next/dist/client/components/not-found-error"]}],u=[],c="/_not-found",p={require:n,loadChunk:()=>Promise.resolve()},m=new r.AppPageRouteModule({definition:{kind:s.x.APP_PAGE,page:"/_not-found",pathname:"/_not-found",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:l}})},6254:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,2583,23)),Promise.resolve().then(n.t.bind(n,6840,23)),Promise.resolve().then(n.t.bind(n,8771,23)),Promise.resolve().then(n.t.bind(n,3225,23)),Promise.resolve().then(n.t.bind(n,9295,23)),Promise.resolve().then(n.t.bind(n,3982,23))},2731:()=>{},2917:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>a,metadata:()=>i});var r=n(5036),s=n(265),o=n.n(s);n(3440);let i={title:"sukadia.dev",description:"I code, stream, and create videos."};function a({children:e}){return r.jsx("html",{lang:"en",children:r.jsx("body",{className:o().className,children:e})})}},3440:()=>{}};var t=require("../webpack-runtime.js");t.C(e);var n=e=>t(t.s=e),r=t.X(0,[638,969],()=>n(6813));module.exports=r})();
\ No newline at end of file
+(()=>{var e={};e.id=165,e.ids=[165],e.modules={7849:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external")},2934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},5403:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external")},4580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},4749:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external")},5869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},6813:(e,t,n)=>{"use strict";n.r(t),n.d(t,{GlobalError:()=>i.a,__next_app__:()=>p,originalPathname:()=>c,pages:()=>u,routeModule:()=>m,tree:()=>l});var r=n(482),s=n(9108),o=n(2563),i=n.n(o),a=n(8300),d={};for(let e in a)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(d[e]=()=>a[e]);n.d(t,d);let l=["",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(n.t.bind(n,9361,23)),"next/dist/client/components/not-found-error"]}]},{layout:[()=>Promise.resolve().then(n.bind(n,2917)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\layout.tsx"],"not-found":[()=>Promise.resolve().then(n.t.bind(n,9361,23)),"next/dist/client/components/not-found-error"]}],u=[],c="/_not-found",p={require:n,loadChunk:()=>Promise.resolve()},m=new r.AppPageRouteModule({definition:{kind:s.x.APP_PAGE,page:"/_not-found",pathname:"/_not-found",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:l}})},6254:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,2583,23)),Promise.resolve().then(n.t.bind(n,6840,23)),Promise.resolve().then(n.t.bind(n,8771,23)),Promise.resolve().then(n.t.bind(n,3225,23)),Promise.resolve().then(n.t.bind(n,9295,23)),Promise.resolve().then(n.t.bind(n,3982,23))},2731:()=>{},2917:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>a,metadata:()=>i});var r=n(5036),s=n(265),o=n.n(s);n(3440);let i={title:"sukadia.dev",description:"I code, stream, and create videos."};function a({children:e}){return r.jsx("html",{lang:"en",children:r.jsx("body",{className:o().className,children:e})})}},3440:()=>{}};var t=require("../webpack-runtime.js");t.C(e);var n=e=>t(t.s=e),r=t.X(0,[638,969],()=>n(6813));module.exports=r})();
\ No newline at end of file
diff --git a/.next/server/app/_not-found.rsc b/.next/server/app/_not-found.rsc
index 6eea5e2..71b96a9 100644
--- a/.next/server/app/_not-found.rsc
+++ b/.next/server/app/_not-found.rsc
@@ -4,6 +4,6 @@
5:{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"}
6:{"display":"inline-block"}
7:{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0}
-0:["xSz9x0FW88Rb7utFdR6Fp",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},["$L1",[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],null]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_e66fe9","children":["$","$L2",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":"$4","children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":"$5","children":"404"}],["$","div",null,{"style":"$6","children":["$","h2",null,{"style":"$7","children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/1d2d59615145af7d.css","precedence":"next","crossOrigin":""}]],"$L8"]]]]
+0:["_irQtJdFK0j8SeLn5FtRS",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},["$L1",[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],null]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_e66fe9","children":["$","$L2",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":"$4","children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":"$5","children":"404"}],["$","div",null,{"style":"$6","children":["$","h2",null,{"style":"$7","children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/1d2d59615145af7d.css","precedence":"next","crossOrigin":""}]],"$L8"]]]]
8:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"sukadia.dev"}],["$","meta","3",{"name":"description","content":"I code, stream, and create videos."}]]
1:null
diff --git a/.next/server/app/everyone-votes/privacy.html b/.next/server/app/everyone-votes/privacy.html
index 5438086..aca04a4 100644
--- a/.next/server/app/everyone-votes/privacy.html
+++ b/.next/server/app/everyone-votes/privacy.html
@@ -1 +1 @@
-sukadia.dev Everyone Votes Privacy Policy Everyone Votes is an application on Discord that delivers and tallies daily polls to Discord servers. By being a user, you agree to the following use of your data:
What We Store By voting on a poll with Everyone Votes, we store: This data is stored for up to 24 hours, and is wiped every day at UTC midnight.
A cumulative count of the number of votes for each poll option is saved indefinitely.
By setting up Everyone Votes, we store: - The server id, poll channel ids, and current poll messages
- Config settings
This data is stored for as long as Everyone Votes is setup within the server.
By adding server-wide polls on Everyone Votes, we store: This data is stored up until the results are tallied for it. Moderators can also manually remove the poll by using the corresponding command.
In summary, I don't use your data for anything malicious, just for getting poll result counts.
Removal of Data Server data is erased once Everyone Votes is kicked from the server. Any server moderator can kick the bot to trigger this erasure.
User vote data is erased at UTC midnight every day. Since user vote data lasts such a small window of time, erasure requests cannot be fulfilled for this data.
Contact If you have questions or concerns about these terms, please join the support server on Discord, or email contact@sukadia.dev .
\ No newline at end of file
+sukadia.dev Everyone Votes Privacy Policy Everyone Votes is an application on Discord that delivers and tallies daily polls to Discord servers. By being a user, you agree to the following use of your data:
What We Store By voting on a poll with Everyone Votes, we store: This data is stored for up to 24 hours, and is wiped every day at UTC midnight.
A cumulative count of the number of votes for each poll option is saved indefinitely.
By setting up Everyone Votes, we store: - The server id, poll channel ids, and current poll messages
- Config settings
This data is stored for as long as Everyone Votes is setup within the server.
By adding server-wide polls on Everyone Votes, we store: This data is stored up until the results are tallied for it. Moderators can also manually remove the poll by using the corresponding command.
In summary, I don't use your data for anything malicious, just for getting poll result counts.
Removal of Data Server data is erased once Everyone Votes is kicked from the server. Any server moderator can kick the bot to trigger this erasure.
User vote data is erased at UTC midnight every day. Since user vote data lasts such a small window of time, erasure requests cannot be fulfilled for this data.
Contact If you have questions or concerns about these terms, please join the support server on Discord, or email contact@sukadia.dev .
\ No newline at end of file
diff --git a/.next/server/app/everyone-votes/privacy.rsc b/.next/server/app/everyone-votes/privacy.rsc
index 72f0214..5460ec0 100644
--- a/.next/server/app/everyone-votes/privacy.rsc
+++ b/.next/server/app/everyone-votes/privacy.rsc
@@ -1,5 +1,5 @@
2:I[5613,[],""]
3:I[1778,[],""]
-0:["xSz9x0FW88Rb7utFdR6Fp",[[["",{"children":["everyone-votes",{"children":["privacy",{"children":["__PAGE__",{}]}]}]},"$undefined","$undefined",true],["",{"children":["everyone-votes",{"children":["privacy",{"children":["__PAGE__",{},["$L1",["$","main",null,{"className":"ml-[10%] mt-[5%] mr-[10%]","children":[["$","h1",null,{"className":"text-3xl","children":"Everyone Votes Privacy Policy"}],["$","p",null,{"children":"Everyone Votes is an application on Discord that delivers and tallies daily polls to Discord servers. By being a user, you agree to the following use of your data:"}],["$","br",null,{}],["$","h2",null,{"className":"text-2xl","children":"What We Store"}],["$","h3",null,{"className":"text-xl","children":"By voting on a poll with Everyone Votes, we store:"}],["$","ul",null,{"children":[["$","p",null,{"children":"- The poll option(s) you voted on"}],["$","p",null,{"children":"- Your Discord user id"}]]}],["$","p",null,{"children":"This data is stored for up to 24 hours, and is wiped every day at UTC midnight."}],["$","p",null,{"children":"A cumulative count of the number of votes for each poll option is saved indefinitely."}],["$","br",null,{}],["$","h3",null,{"className":"text-xl","children":"By setting up Everyone Votes, we store:"}],["$","ul",null,{"children":[["$","p",null,{"children":"- The server id, poll channel ids, and current poll messages"}],["$","p",null,{"children":"- Config settings"}]]}],["$","p",null,{"children":"This data is stored for as long as Everyone Votes is setup within the server."}],["$","br",null,{}],["$","h3",null,{"className":"text-xl","children":"By adding server-wide polls on Everyone Votes, we store:"}],["$","ul",null,{"children":["$","p",null,{"children":"- All of those polls' data"}]}],["$","p",null,{"children":"This data is stored up until the results are tallied for it. Moderators can also manually remove the poll by using the corresponding command."}],["$","br",null,{}],["$","p",null,{"children":"In summary, I don't use your data for anything malicious, just for getting poll result counts."}],["$","br",null,{}],["$","h2",null,{"className":"text-2xl","children":"Removal of Data"}],["$","p",null,{"children":"Server data is erased once Everyone Votes is kicked from the server. Any server moderator can kick the bot to trigger this erasure."}],["$","p",null,{"children":"User vote data is erased at UTC midnight every day. Since user vote data lasts such a small window of time, erasure requests cannot be fulfilled for this data."}],["$","br",null,{}],["$","h2",null,{"className":"text-2xl","children":"Contact"}],["$","p",null,{"children":["If you have questions or concerns about these terms, please join the ",["$","a",null,{"href":"https://discord.gg/pc6EcNjuZU","className":"text-blue-500","children":"support server"}]," on Discord, or email ",["$","span",null,{"className":"font-mono","children":"contact@sukadia.dev"}],"."]}]]}],null]]},["$","$L2",null,{"parallelRouterKey":"children","segmentPath":["children","everyone-votes","children","privacy","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},["$","$L2",null,{"parallelRouterKey":"children","segmentPath":["children","everyone-votes","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_e66fe9","children":["$","$L2",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/1d2d59615145af7d.css","precedence":"next","crossOrigin":""}]],"$L4"]]]]
+0:["_irQtJdFK0j8SeLn5FtRS",[[["",{"children":["everyone-votes",{"children":["privacy",{"children":["__PAGE__",{}]}]}]},"$undefined","$undefined",true],["",{"children":["everyone-votes",{"children":["privacy",{"children":["__PAGE__",{},["$L1",["$","main",null,{"className":"ml-[10%] mt-[5%] mr-[10%]","children":[["$","h1",null,{"className":"text-3xl","children":"Everyone Votes Privacy Policy"}],["$","p",null,{"children":"Everyone Votes is an application on Discord that delivers and tallies daily polls to Discord servers. By being a user, you agree to the following use of your data:"}],["$","br",null,{}],["$","h2",null,{"className":"text-2xl","children":"What We Store"}],["$","h3",null,{"className":"text-xl","children":"By voting on a poll with Everyone Votes, we store:"}],["$","ul",null,{"children":[["$","p",null,{"children":"- The poll option(s) you voted on"}],["$","p",null,{"children":"- Your Discord user id"}]]}],["$","p",null,{"children":"This data is stored for up to 24 hours, and is wiped every day at UTC midnight."}],["$","p",null,{"children":"A cumulative count of the number of votes for each poll option is saved indefinitely."}],["$","br",null,{}],["$","h3",null,{"className":"text-xl","children":"By setting up Everyone Votes, we store:"}],["$","ul",null,{"children":[["$","p",null,{"children":"- The server id, poll channel ids, and current poll messages"}],["$","p",null,{"children":"- Config settings"}]]}],["$","p",null,{"children":"This data is stored for as long as Everyone Votes is setup within the server."}],["$","br",null,{}],["$","h3",null,{"className":"text-xl","children":"By adding server-wide polls on Everyone Votes, we store:"}],["$","ul",null,{"children":["$","p",null,{"children":"- All of those polls' data"}]}],["$","p",null,{"children":"This data is stored up until the results are tallied for it. Moderators can also manually remove the poll by using the corresponding command."}],["$","br",null,{}],["$","p",null,{"children":"In summary, I don't use your data for anything malicious, just for getting poll result counts."}],["$","br",null,{}],["$","h2",null,{"className":"text-2xl","children":"Removal of Data"}],["$","p",null,{"children":"Server data is erased once Everyone Votes is kicked from the server. Any server moderator can kick the bot to trigger this erasure."}],["$","p",null,{"children":"User vote data is erased at UTC midnight every day. Since user vote data lasts such a small window of time, erasure requests cannot be fulfilled for this data."}],["$","br",null,{}],["$","h2",null,{"className":"text-2xl","children":"Contact"}],["$","p",null,{"children":["If you have questions or concerns about these terms, please join the ",["$","a",null,{"href":"https://discord.gg/pc6EcNjuZU","className":"text-blue-500","children":"support server"}]," on Discord, or email ",["$","span",null,{"className":"font-mono","children":"contact@sukadia.dev"}],"."]}]]}],null]]},["$","$L2",null,{"parallelRouterKey":"children","segmentPath":["children","everyone-votes","children","privacy","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},["$","$L2",null,{"parallelRouterKey":"children","segmentPath":["children","everyone-votes","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_e66fe9","children":["$","$L2",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/1d2d59615145af7d.css","precedence":"next","crossOrigin":""}]],"$L4"]]]]
4:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"sukadia.dev"}],["$","meta","3",{"name":"description","content":"I code, stream, and create videos."}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]]
1:null
diff --git a/.next/server/app/everyone-votes/privacy/page.js b/.next/server/app/everyone-votes/privacy/page.js
index 4e4fe34..a0c5db6 100644
--- a/.next/server/app/everyone-votes/privacy/page.js
+++ b/.next/server/app/everyone-votes/privacy/page.js
@@ -1 +1 @@
-(()=>{var e={};e.id=369,e.ids=[369],e.modules={7849:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external")},5403:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external")},4749:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external")},399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},5528:e=>{"use strict";e.exports=require("next/dist\\client\\components\\action-async-storage.external.js")},1877:e=>{"use strict";e.exports=require("next/dist\\client\\components\\request-async-storage.external.js")},5319:e=>{"use strict";e.exports=require("next/dist\\client\\components\\static-generation-async-storage.external.js")},1017:e=>{"use strict";e.exports=require("path")},7310:e=>{"use strict";e.exports=require("url")},2668:(e,t,s)=>{"use strict";s.r(t),s.d(t,{GlobalError:()=>i.a,__next_app__:()=>u,originalPathname:()=>p,pages:()=>c,routeModule:()=>h,tree:()=>d});var r=s(482),o=s(9108),a=s(2563),i=s.n(a),n=s(8300),l={};for(let e in n)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(l[e]=()=>n[e]);s.d(t,l);let d=["",{children:["everyone-votes",{children:["privacy",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(s.bind(s,8898)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\everyone-votes\\privacy\\page.tsx"]}]},{}]},{metadata:{icon:[async e=>(await Promise.resolve().then(s.bind(s,7481))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(s.bind(s,2917)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\layout.tsx"],"not-found":[()=>Promise.resolve().then(s.t.bind(s,9361,23)),"next/dist/client/components/not-found-error"],metadata:{icon:[async e=>(await Promise.resolve().then(s.bind(s,7481))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}],c=["X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\everyone-votes\\privacy\\page.tsx"],p="/everyone-votes/privacy/page",u={require:s,loadChunk:()=>Promise.resolve()},h=new r.AppPageRouteModule({definition:{kind:o.x.APP_PAGE,page:"/everyone-votes/privacy/page",pathname:"/everyone-votes/privacy",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:d}})},6254:(e,t,s)=>{Promise.resolve().then(s.t.bind(s,2583,23)),Promise.resolve().then(s.t.bind(s,6840,23)),Promise.resolve().then(s.t.bind(s,8771,23)),Promise.resolve().then(s.t.bind(s,3225,23)),Promise.resolve().then(s.t.bind(s,9295,23)),Promise.resolve().then(s.t.bind(s,3982,23))},2731:()=>{},5303:()=>{},8898:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>o});var r=s(5036);function o(){return(0,r.jsxs)("main",{className:"ml-[10%] mt-[5%] mr-[10%]",children:[r.jsx("h1",{className:"text-3xl",children:"Everyone Votes Privacy Policy"}),r.jsx("p",{children:"Everyone Votes is an application on Discord that delivers and tallies daily polls to Discord servers. By being a user, you agree to the following use of your data:"}),r.jsx("br",{}),r.jsx("h2",{className:"text-2xl",children:"What We Store"}),r.jsx("h3",{className:"text-xl",children:"By voting on a poll with Everyone Votes, we store:"}),(0,r.jsxs)("ul",{children:[r.jsx("p",{children:"- The poll option(s) you voted on"}),r.jsx("p",{children:"- Your Discord user id"})]}),r.jsx("p",{children:"This data is stored for up to 24 hours, and is wiped every day at UTC midnight."}),r.jsx("p",{children:"A cumulative count of the number of votes for each poll option is saved indefinitely."}),r.jsx("br",{}),r.jsx("h3",{className:"text-xl",children:"By setting up Everyone Votes, we store:"}),(0,r.jsxs)("ul",{children:[r.jsx("p",{children:"- The server id, poll channel ids, and current poll messages"}),r.jsx("p",{children:"- Config settings"})]}),r.jsx("p",{children:"This data is stored for as long as Everyone Votes is setup within the server."}),r.jsx("br",{}),r.jsx("h3",{className:"text-xl",children:"By adding server-wide polls on Everyone Votes, we store:"}),r.jsx("ul",{children:r.jsx("p",{children:"- All of those polls' data"})}),r.jsx("p",{children:"This data is stored up until the results are tallied for it. Moderators can also manually remove the poll by using the corresponding command."}),r.jsx("br",{}),r.jsx("p",{children:"In summary, I don't use your data for anything malicious, just for getting poll result counts."}),r.jsx("br",{}),r.jsx("h2",{className:"text-2xl",children:"Removal of Data"}),r.jsx("p",{children:"Server data is erased once Everyone Votes is kicked from the server. Any server moderator can kick the bot to trigger this erasure."}),r.jsx("p",{children:"User vote data is erased at UTC midnight every day. Since user vote data lasts such a small window of time, erasure requests cannot be fulfilled for this data."}),r.jsx("br",{}),r.jsx("h2",{className:"text-2xl",children:"Contact"}),(0,r.jsxs)("p",{children:["If you have questions or concerns about these terms, please join the ",r.jsx("a",{href:"https://discord.gg/pc6EcNjuZU",className:"text-blue-500",children:"support server"})," on Discord, or email ",r.jsx("span",{className:"font-mono",children:"contact@sukadia.dev"}),"."]})]})}},2917:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>n,metadata:()=>i});var r=s(5036),o=s(265),a=s.n(o);s(3440);let i={title:"sukadia.dev",description:"I code, stream, and create videos."};function n({children:e}){return r.jsx("html",{lang:"en",children:r.jsx("body",{className:a().className,children:e})})}},7481:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>o});var r=s(337);let o=e=>[{type:"image/x-icon",sizes:"16x16",url:(0,r.fillMetadataSegment)(".",e.params,"favicon.ico")+""}]},3440:()=>{}};var t=require("../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[638,969,337],()=>s(2668));module.exports=r})();
\ No newline at end of file
+(()=>{var e={};e.id=369,e.ids=[369],e.modules={7849:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external")},2934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},5403:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external")},4580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},4749:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external")},5869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},1017:e=>{"use strict";e.exports=require("path")},7310:e=>{"use strict";e.exports=require("url")},2668:(e,t,s)=>{"use strict";s.r(t),s.d(t,{GlobalError:()=>i.a,__next_app__:()=>u,originalPathname:()=>p,pages:()=>c,routeModule:()=>h,tree:()=>d});var r=s(482),o=s(9108),a=s(2563),i=s.n(a),n=s(8300),l={};for(let e in n)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(l[e]=()=>n[e]);s.d(t,l);let d=["",{children:["everyone-votes",{children:["privacy",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(s.bind(s,8898)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\everyone-votes\\privacy\\page.tsx"]}]},{}]},{metadata:{icon:[async e=>(await Promise.resolve().then(s.bind(s,7481))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(s.bind(s,2917)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\layout.tsx"],"not-found":[()=>Promise.resolve().then(s.t.bind(s,9361,23)),"next/dist/client/components/not-found-error"],metadata:{icon:[async e=>(await Promise.resolve().then(s.bind(s,7481))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}],c=["X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\everyone-votes\\privacy\\page.tsx"],p="/everyone-votes/privacy/page",u={require:s,loadChunk:()=>Promise.resolve()},h=new r.AppPageRouteModule({definition:{kind:o.x.APP_PAGE,page:"/everyone-votes/privacy/page",pathname:"/everyone-votes/privacy",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:d}})},6254:(e,t,s)=>{Promise.resolve().then(s.t.bind(s,2583,23)),Promise.resolve().then(s.t.bind(s,6840,23)),Promise.resolve().then(s.t.bind(s,8771,23)),Promise.resolve().then(s.t.bind(s,3225,23)),Promise.resolve().then(s.t.bind(s,9295,23)),Promise.resolve().then(s.t.bind(s,3982,23))},2731:()=>{},5303:()=>{},8898:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>o});var r=s(5036);function o(){return(0,r.jsxs)("main",{className:"ml-[10%] mt-[5%] mr-[10%]",children:[r.jsx("h1",{className:"text-3xl",children:"Everyone Votes Privacy Policy"}),r.jsx("p",{children:"Everyone Votes is an application on Discord that delivers and tallies daily polls to Discord servers. By being a user, you agree to the following use of your data:"}),r.jsx("br",{}),r.jsx("h2",{className:"text-2xl",children:"What We Store"}),r.jsx("h3",{className:"text-xl",children:"By voting on a poll with Everyone Votes, we store:"}),(0,r.jsxs)("ul",{children:[r.jsx("p",{children:"- The poll option(s) you voted on"}),r.jsx("p",{children:"- Your Discord user id"})]}),r.jsx("p",{children:"This data is stored for up to 24 hours, and is wiped every day at UTC midnight."}),r.jsx("p",{children:"A cumulative count of the number of votes for each poll option is saved indefinitely."}),r.jsx("br",{}),r.jsx("h3",{className:"text-xl",children:"By setting up Everyone Votes, we store:"}),(0,r.jsxs)("ul",{children:[r.jsx("p",{children:"- The server id, poll channel ids, and current poll messages"}),r.jsx("p",{children:"- Config settings"})]}),r.jsx("p",{children:"This data is stored for as long as Everyone Votes is setup within the server."}),r.jsx("br",{}),r.jsx("h3",{className:"text-xl",children:"By adding server-wide polls on Everyone Votes, we store:"}),r.jsx("ul",{children:r.jsx("p",{children:"- All of those polls' data"})}),r.jsx("p",{children:"This data is stored up until the results are tallied for it. Moderators can also manually remove the poll by using the corresponding command."}),r.jsx("br",{}),r.jsx("p",{children:"In summary, I don't use your data for anything malicious, just for getting poll result counts."}),r.jsx("br",{}),r.jsx("h2",{className:"text-2xl",children:"Removal of Data"}),r.jsx("p",{children:"Server data is erased once Everyone Votes is kicked from the server. Any server moderator can kick the bot to trigger this erasure."}),r.jsx("p",{children:"User vote data is erased at UTC midnight every day. Since user vote data lasts such a small window of time, erasure requests cannot be fulfilled for this data."}),r.jsx("br",{}),r.jsx("h2",{className:"text-2xl",children:"Contact"}),(0,r.jsxs)("p",{children:["If you have questions or concerns about these terms, please join the ",r.jsx("a",{href:"https://discord.gg/pc6EcNjuZU",className:"text-blue-500",children:"support server"})," on Discord, or email ",r.jsx("span",{className:"font-mono",children:"contact@sukadia.dev"}),"."]})]})}},2917:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>n,metadata:()=>i});var r=s(5036),o=s(265),a=s.n(o);s(3440);let i={title:"sukadia.dev",description:"I code, stream, and create videos."};function n({children:e}){return r.jsx("html",{lang:"en",children:r.jsx("body",{className:a().className,children:e})})}},7481:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>o});var r=s(337);let o=e=>[{type:"image/x-icon",sizes:"16x16",url:(0,r.fillMetadataSegment)(".",e.params,"favicon.ico")+""}]},3440:()=>{}};var t=require("../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[638,969,337],()=>s(2668));module.exports=r})();
\ No newline at end of file
diff --git a/.next/server/app/everyone-votes/terms.html b/.next/server/app/everyone-votes/terms.html
index b78e026..195a3e7 100644
--- a/.next/server/app/everyone-votes/terms.html
+++ b/.next/server/app/everyone-votes/terms.html
@@ -1 +1 @@
-sukadia.dev Everyone Votes Terms of Service Everyone Votes is an application on Discord that delivers and tallies daily polls to Discord servers. By being a user, you agree to the following terms:
User Conduct "Users" include any Discord user interacting with Everyone Votes through Discord's slash commands or buttons. Users must adhere to the following guidelines:
Failure to follow these terms may result in the user being blacklisted from using Everyone Vote's features, either automatically or at the discretion of the developer.
Paid Content Everyone Votes offers certain features that require supporting the bot monthly on Ko-fi . In order to gain access to these features, the supporter must be in the Discord support server to properly track subscription status.
Benefits may not immediately appear for the supporter, and may not work fully as expected. Please follow the contact information below to report any issues so they may be resolved in a timely fashion.
Refunds are not guaranteed and will be given at the discretion of the developer. (I'm a pretty reasonable person though!)
Contact If you have questions or concerns about these terms, please join the support server on Discord, or email contact@sukadia.dev .
I appreciate you for reading these terms, not many do that!
\ No newline at end of file
+sukadia.dev Everyone Votes Terms of Service Everyone Votes is an application on Discord that delivers and tallies daily polls to Discord servers. By being a user, you agree to the following terms:
User Conduct "Users" include any Discord user interacting with Everyone Votes through Discord's slash commands or buttons. Users must adhere to the following guidelines:
Failure to follow these terms may result in the user being blacklisted from using Everyone Vote's features, either automatically or at the discretion of the developer.
Paid Content Everyone Votes offers certain features that require supporting the bot monthly on Ko-fi . In order to gain access to these features, the supporter must be in the Discord support server to properly track subscription status.
Benefits may not immediately appear for the supporter, and may not work fully as expected. Please follow the contact information below to report any issues so they may be resolved in a timely fashion.
Refunds are not guaranteed and will be given at the discretion of the developer. (I'm a pretty reasonable person though!)
Contact If you have questions or concerns about these terms, please join the support server on Discord, or email contact@sukadia.dev .
I appreciate you for reading these terms, not many do that!
\ No newline at end of file
diff --git a/.next/server/app/everyone-votes/terms.rsc b/.next/server/app/everyone-votes/terms.rsc
index 2dc7fd6..ee801db 100644
--- a/.next/server/app/everyone-votes/terms.rsc
+++ b/.next/server/app/everyone-votes/terms.rsc
@@ -1,5 +1,5 @@
2:I[5613,[],""]
3:I[1778,[],""]
-0:["xSz9x0FW88Rb7utFdR6Fp",[[["",{"children":["everyone-votes",{"children":["terms",{"children":["__PAGE__",{}]}]}]},"$undefined","$undefined",true],["",{"children":["everyone-votes",{"children":["terms",{"children":["__PAGE__",{},["$L1",["$","main",null,{"className":"ml-[10%] mt-[5%] mr-[10%]","children":[["$","h1",null,{"className":"text-3xl","children":"Everyone Votes Terms of Service"}],["$","p",null,{"children":"Everyone Votes is an application on Discord that delivers and tallies daily polls to Discord servers. By being a user, you agree to the following terms:"}],["$","br",null,{}],["$","h2",null,{"className":"text-2xl","children":"User Conduct"}],["$","p",null,{"children":"\"Users\" include any Discord user interacting with Everyone Votes through Discord's slash commands or buttons. Users must adhere to the following guidelines:"}],["$","ul",null,{"children":[["$","p",null,{"children":"- Spamming bot interactions is not allowed."}],["$","p",null,{"children":"- Only one account per person may vote on polls."}],["$","p",null,{"children":["- Follow ",["$","a",null,{"href":"https://discord.com/terms","className":"text-blue-500","children":"Discord's Terms of Service"}],"."]}]]}],["$","p",null,{"children":"Failure to follow these terms may result in the user being blacklisted from using Everyone Vote's features, either automatically or at the discretion of the developer."}],["$","br",null,{}],["$","h2",null,{"className":"text-2xl","children":"Paid Content"}],["$","p",null,{"children":["Everyone Votes offers certain features that require supporting the bot monthly on ",["$","a",null,{"href":"https://ko-fi.com/everyonevotes/tiers","className":"text-blue-500","children":"Ko-fi"}],". In order to gain access to these features, the supporter must be in the Discord ",["$","a",null,{"href":"https://discord.gg/pc6EcNjuZU","className":"text-blue-500","children":"support server"}]," to properly track subscription status."]}],["$","p",null,{"children":"Benefits may not immediately appear for the supporter, and may not work fully as expected. Please follow the contact information below to report any issues so they may be resolved in a timely fashion."}],["$","p",null,{"children":"Refunds are not guaranteed and will be given at the discretion of the developer. (I'm a pretty reasonable person though!)"}],["$","br",null,{}],["$","h2",null,{"className":"text-2xl","children":"Contact"}],["$","p",null,{"children":["If you have questions or concerns about these terms, please join the ",["$","a",null,{"href":"https://discord.gg/pc6EcNjuZU","className":"text-blue-500","children":"support server"}]," on Discord, or email ",["$","span",null,{"className":"font-mono","children":"contact@sukadia.dev"}],"."]}],["$","p",null,{"children":"I appreciate you for reading these terms, not many do that!"}]]}],null]]},["$","$L2",null,{"parallelRouterKey":"children","segmentPath":["children","everyone-votes","children","terms","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},["$","$L2",null,{"parallelRouterKey":"children","segmentPath":["children","everyone-votes","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_e66fe9","children":["$","$L2",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/1d2d59615145af7d.css","precedence":"next","crossOrigin":""}]],"$L4"]]]]
+0:["_irQtJdFK0j8SeLn5FtRS",[[["",{"children":["everyone-votes",{"children":["terms",{"children":["__PAGE__",{}]}]}]},"$undefined","$undefined",true],["",{"children":["everyone-votes",{"children":["terms",{"children":["__PAGE__",{},["$L1",["$","main",null,{"className":"ml-[10%] mt-[5%] mr-[10%]","children":[["$","h1",null,{"className":"text-3xl","children":"Everyone Votes Terms of Service"}],["$","p",null,{"children":"Everyone Votes is an application on Discord that delivers and tallies daily polls to Discord servers. By being a user, you agree to the following terms:"}],["$","br",null,{}],["$","h2",null,{"className":"text-2xl","children":"User Conduct"}],["$","p",null,{"children":"\"Users\" include any Discord user interacting with Everyone Votes through Discord's slash commands or buttons. Users must adhere to the following guidelines:"}],["$","ul",null,{"children":[["$","p",null,{"children":"- Spamming bot interactions is not allowed."}],["$","p",null,{"children":"- Only one account per person may vote on polls."}],["$","p",null,{"children":["- Follow ",["$","a",null,{"href":"https://discord.com/terms","className":"text-blue-500","children":"Discord's Terms of Service"}],"."]}]]}],["$","p",null,{"children":"Failure to follow these terms may result in the user being blacklisted from using Everyone Vote's features, either automatically or at the discretion of the developer."}],["$","br",null,{}],["$","h2",null,{"className":"text-2xl","children":"Paid Content"}],["$","p",null,{"children":["Everyone Votes offers certain features that require supporting the bot monthly on ",["$","a",null,{"href":"https://ko-fi.com/everyonevotes/tiers","className":"text-blue-500","children":"Ko-fi"}],". In order to gain access to these features, the supporter must be in the Discord ",["$","a",null,{"href":"https://discord.gg/pc6EcNjuZU","className":"text-blue-500","children":"support server"}]," to properly track subscription status."]}],["$","p",null,{"children":"Benefits may not immediately appear for the supporter, and may not work fully as expected. Please follow the contact information below to report any issues so they may be resolved in a timely fashion."}],["$","p",null,{"children":"Refunds are not guaranteed and will be given at the discretion of the developer. (I'm a pretty reasonable person though!)"}],["$","br",null,{}],["$","h2",null,{"className":"text-2xl","children":"Contact"}],["$","p",null,{"children":["If you have questions or concerns about these terms, please join the ",["$","a",null,{"href":"https://discord.gg/pc6EcNjuZU","className":"text-blue-500","children":"support server"}]," on Discord, or email ",["$","span",null,{"className":"font-mono","children":"contact@sukadia.dev"}],"."]}],["$","p",null,{"children":"I appreciate you for reading these terms, not many do that!"}]]}],null]]},["$","$L2",null,{"parallelRouterKey":"children","segmentPath":["children","everyone-votes","children","terms","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},["$","$L2",null,{"parallelRouterKey":"children","segmentPath":["children","everyone-votes","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_e66fe9","children":["$","$L2",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/1d2d59615145af7d.css","precedence":"next","crossOrigin":""}]],"$L4"]]]]
4:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"sukadia.dev"}],["$","meta","3",{"name":"description","content":"I code, stream, and create videos."}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]]
1:null
diff --git a/.next/server/app/everyone-votes/terms/page.js b/.next/server/app/everyone-votes/terms/page.js
index cede584..c078c5e 100644
--- a/.next/server/app/everyone-votes/terms/page.js
+++ b/.next/server/app/everyone-votes/terms/page.js
@@ -1 +1 @@
-(()=>{var e={};e.id=181,e.ids=[181],e.modules={7849:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external")},5403:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external")},4749:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external")},399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},5528:e=>{"use strict";e.exports=require("next/dist\\client\\components\\action-async-storage.external.js")},1877:e=>{"use strict";e.exports=require("next/dist\\client\\components\\request-async-storage.external.js")},5319:e=>{"use strict";e.exports=require("next/dist\\client\\components\\static-generation-async-storage.external.js")},1017:e=>{"use strict";e.exports=require("path")},7310:e=>{"use strict";e.exports=require("url")},9167:(e,t,s)=>{"use strict";s.r(t),s.d(t,{GlobalError:()=>a.a,__next_app__:()=>u,originalPathname:()=>p,pages:()=>d,routeModule:()=>m,tree:()=>c});var r=s(482),o=s(9108),n=s(2563),a=s.n(n),i=s(8300),l={};for(let e in i)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(l[e]=()=>i[e]);s.d(t,l);let c=["",{children:["everyone-votes",{children:["terms",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(s.bind(s,5447)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\everyone-votes\\terms\\page.tsx"]}]},{}]},{metadata:{icon:[async e=>(await Promise.resolve().then(s.bind(s,7481))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(s.bind(s,2917)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\layout.tsx"],"not-found":[()=>Promise.resolve().then(s.t.bind(s,9361,23)),"next/dist/client/components/not-found-error"],metadata:{icon:[async e=>(await Promise.resolve().then(s.bind(s,7481))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}],d=["X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\everyone-votes\\terms\\page.tsx"],p="/everyone-votes/terms/page",u={require:s,loadChunk:()=>Promise.resolve()},m=new r.AppPageRouteModule({definition:{kind:o.x.APP_PAGE,page:"/everyone-votes/terms/page",pathname:"/everyone-votes/terms",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:c}})},6254:(e,t,s)=>{Promise.resolve().then(s.t.bind(s,2583,23)),Promise.resolve().then(s.t.bind(s,6840,23)),Promise.resolve().then(s.t.bind(s,8771,23)),Promise.resolve().then(s.t.bind(s,3225,23)),Promise.resolve().then(s.t.bind(s,9295,23)),Promise.resolve().then(s.t.bind(s,3982,23))},2731:()=>{},5303:()=>{},5447:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>o});var r=s(5036);function o(){return(0,r.jsxs)("main",{className:"ml-[10%] mt-[5%] mr-[10%]",children:[r.jsx("h1",{className:"text-3xl",children:"Everyone Votes Terms of Service"}),r.jsx("p",{children:"Everyone Votes is an application on Discord that delivers and tallies daily polls to Discord servers. By being a user, you agree to the following terms:"}),r.jsx("br",{}),r.jsx("h2",{className:"text-2xl",children:"User Conduct"}),r.jsx("p",{children:'"Users" include any Discord user interacting with Everyone Votes through Discord\'s slash commands or buttons. Users must adhere to the following guidelines:'}),(0,r.jsxs)("ul",{children:[r.jsx("p",{children:"- Spamming bot interactions is not allowed."}),r.jsx("p",{children:"- Only one account per person may vote on polls."}),(0,r.jsxs)("p",{children:["- Follow ",r.jsx("a",{href:"https://discord.com/terms",className:"text-blue-500",children:"Discord's Terms of Service"}),"."]})]}),r.jsx("p",{children:"Failure to follow these terms may result in the user being blacklisted from using Everyone Vote's features, either automatically or at the discretion of the developer."}),r.jsx("br",{}),r.jsx("h2",{className:"text-2xl",children:"Paid Content"}),(0,r.jsxs)("p",{children:["Everyone Votes offers certain features that require supporting the bot monthly on ",r.jsx("a",{href:"https://ko-fi.com/everyonevotes/tiers",className:"text-blue-500",children:"Ko-fi"}),". In order to gain access to these features, the supporter must be in the Discord ",r.jsx("a",{href:"https://discord.gg/pc6EcNjuZU",className:"text-blue-500",children:"support server"})," to properly track subscription status."]}),r.jsx("p",{children:"Benefits may not immediately appear for the supporter, and may not work fully as expected. Please follow the contact information below to report any issues so they may be resolved in a timely fashion."}),r.jsx("p",{children:"Refunds are not guaranteed and will be given at the discretion of the developer. (I'm a pretty reasonable person though!)"}),r.jsx("br",{}),r.jsx("h2",{className:"text-2xl",children:"Contact"}),(0,r.jsxs)("p",{children:["If you have questions or concerns about these terms, please join the ",r.jsx("a",{href:"https://discord.gg/pc6EcNjuZU",className:"text-blue-500",children:"support server"})," on Discord, or email ",r.jsx("span",{className:"font-mono",children:"contact@sukadia.dev"}),"."]}),r.jsx("p",{children:"I appreciate you for reading these terms, not many do that!"})]})}},2917:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>i,metadata:()=>a});var r=s(5036),o=s(265),n=s.n(o);s(3440);let a={title:"sukadia.dev",description:"I code, stream, and create videos."};function i({children:e}){return r.jsx("html",{lang:"en",children:r.jsx("body",{className:n().className,children:e})})}},7481:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>o});var r=s(337);let o=e=>[{type:"image/x-icon",sizes:"16x16",url:(0,r.fillMetadataSegment)(".",e.params,"favicon.ico")+""}]},3440:()=>{}};var t=require("../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[638,969,337],()=>s(9167));module.exports=r})();
\ No newline at end of file
+(()=>{var e={};e.id=181,e.ids=[181],e.modules={7849:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external")},2934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},5403:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external")},4580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},4749:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external")},5869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},1017:e=>{"use strict";e.exports=require("path")},7310:e=>{"use strict";e.exports=require("url")},9167:(e,t,s)=>{"use strict";s.r(t),s.d(t,{GlobalError:()=>a.a,__next_app__:()=>u,originalPathname:()=>p,pages:()=>d,routeModule:()=>m,tree:()=>c});var r=s(482),o=s(9108),n=s(2563),a=s.n(n),i=s(8300),l={};for(let e in i)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(l[e]=()=>i[e]);s.d(t,l);let c=["",{children:["everyone-votes",{children:["terms",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(s.bind(s,5447)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\everyone-votes\\terms\\page.tsx"]}]},{}]},{metadata:{icon:[async e=>(await Promise.resolve().then(s.bind(s,7481))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(s.bind(s,2917)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\layout.tsx"],"not-found":[()=>Promise.resolve().then(s.t.bind(s,9361,23)),"next/dist/client/components/not-found-error"],metadata:{icon:[async e=>(await Promise.resolve().then(s.bind(s,7481))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}],d=["X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\everyone-votes\\terms\\page.tsx"],p="/everyone-votes/terms/page",u={require:s,loadChunk:()=>Promise.resolve()},m=new r.AppPageRouteModule({definition:{kind:o.x.APP_PAGE,page:"/everyone-votes/terms/page",pathname:"/everyone-votes/terms",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:c}})},6254:(e,t,s)=>{Promise.resolve().then(s.t.bind(s,2583,23)),Promise.resolve().then(s.t.bind(s,6840,23)),Promise.resolve().then(s.t.bind(s,8771,23)),Promise.resolve().then(s.t.bind(s,3225,23)),Promise.resolve().then(s.t.bind(s,9295,23)),Promise.resolve().then(s.t.bind(s,3982,23))},2731:()=>{},5303:()=>{},5447:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>o});var r=s(5036);function o(){return(0,r.jsxs)("main",{className:"ml-[10%] mt-[5%] mr-[10%]",children:[r.jsx("h1",{className:"text-3xl",children:"Everyone Votes Terms of Service"}),r.jsx("p",{children:"Everyone Votes is an application on Discord that delivers and tallies daily polls to Discord servers. By being a user, you agree to the following terms:"}),r.jsx("br",{}),r.jsx("h2",{className:"text-2xl",children:"User Conduct"}),r.jsx("p",{children:'"Users" include any Discord user interacting with Everyone Votes through Discord\'s slash commands or buttons. Users must adhere to the following guidelines:'}),(0,r.jsxs)("ul",{children:[r.jsx("p",{children:"- Spamming bot interactions is not allowed."}),r.jsx("p",{children:"- Only one account per person may vote on polls."}),(0,r.jsxs)("p",{children:["- Follow ",r.jsx("a",{href:"https://discord.com/terms",className:"text-blue-500",children:"Discord's Terms of Service"}),"."]})]}),r.jsx("p",{children:"Failure to follow these terms may result in the user being blacklisted from using Everyone Vote's features, either automatically or at the discretion of the developer."}),r.jsx("br",{}),r.jsx("h2",{className:"text-2xl",children:"Paid Content"}),(0,r.jsxs)("p",{children:["Everyone Votes offers certain features that require supporting the bot monthly on ",r.jsx("a",{href:"https://ko-fi.com/everyonevotes/tiers",className:"text-blue-500",children:"Ko-fi"}),". In order to gain access to these features, the supporter must be in the Discord ",r.jsx("a",{href:"https://discord.gg/pc6EcNjuZU",className:"text-blue-500",children:"support server"})," to properly track subscription status."]}),r.jsx("p",{children:"Benefits may not immediately appear for the supporter, and may not work fully as expected. Please follow the contact information below to report any issues so they may be resolved in a timely fashion."}),r.jsx("p",{children:"Refunds are not guaranteed and will be given at the discretion of the developer. (I'm a pretty reasonable person though!)"}),r.jsx("br",{}),r.jsx("h2",{className:"text-2xl",children:"Contact"}),(0,r.jsxs)("p",{children:["If you have questions or concerns about these terms, please join the ",r.jsx("a",{href:"https://discord.gg/pc6EcNjuZU",className:"text-blue-500",children:"support server"})," on Discord, or email ",r.jsx("span",{className:"font-mono",children:"contact@sukadia.dev"}),"."]}),r.jsx("p",{children:"I appreciate you for reading these terms, not many do that!"})]})}},2917:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>i,metadata:()=>a});var r=s(5036),o=s(265),n=s.n(o);s(3440);let a={title:"sukadia.dev",description:"I code, stream, and create videos."};function i({children:e}){return r.jsx("html",{lang:"en",children:r.jsx("body",{className:n().className,children:e})})}},7481:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>o});var r=s(337);let o=e=>[{type:"image/x-icon",sizes:"16x16",url:(0,r.fillMetadataSegment)(".",e.params,"favicon.ico")+""}]},3440:()=>{}};var t=require("../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[638,969,337],()=>s(9167));module.exports=r})();
\ No newline at end of file
diff --git a/.next/server/app/index.html b/.next/server/app/index.html
index 37401ef..cc689ff 100644
--- a/.next/server/app/index.html
+++ b/.next/server/app/index.html
@@ -1 +1 @@
-sukadia.dev
\ No newline at end of file
+sukadia.dev
\ No newline at end of file
diff --git a/.next/server/app/index.rsc b/.next/server/app/index.rsc
index ca14b43..f7c1578 100644
--- a/.next/server/app/index.rsc
+++ b/.next/server/app/index.rsc
@@ -2,6 +2,6 @@
3:I[326,["986","static/chunks/986-72006aa1051e30d3.js","931","static/chunks/app/page-8af0c2c4af65d19c.js"],""]
4:I[5613,[],""]
5:I[1778,[],""]
-0:["xSz9x0FW88Rb7utFdR6Fp",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_e66fe9","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/60c69e914bf8dd4b.css","precedence":"next","crossOrigin":""}]]}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/1d2d59615145af7d.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
+0:["_irQtJdFK0j8SeLn5FtRS",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_e66fe9","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/60c69e914bf8dd4b.css","precedence":"next","crossOrigin":""}]]}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/1d2d59615145af7d.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"sukadia.dev"}],["$","meta","3",{"name":"description","content":"I code, stream, and create videos."}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]]
1:null
diff --git a/.next/server/app/page.js b/.next/server/app/page.js
index 8216544..870c96c 100644
--- a/.next/server/app/page.js
+++ b/.next/server/app/page.js
@@ -1 +1 @@
-(()=>{var e={};e.id=931,e.ids=[931],e.modules={7849:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external")},5403:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external")},4749:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external")},399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},5528:e=>{"use strict";e.exports=require("next/dist\\client\\components\\action-async-storage.external.js")},1877:e=>{"use strict";e.exports=require("next/dist\\client\\components\\request-async-storage.external.js")},5319:e=>{"use strict";e.exports=require("next/dist\\client\\components\\static-generation-async-storage.external.js")},1017:e=>{"use strict";e.exports=require("path")},7310:e=>{"use strict";e.exports=require("url")},4345:(e,t,r)=>{"use strict";r.r(t),r.d(t,{GlobalError:()=>s.a,__next_app__:()=>f,originalPathname:()=>c,pages:()=>u,routeModule:()=>p,tree:()=>d});var n=r(482),i=r(9108),o=r(2563),s=r.n(o),a=r(8300),l={};for(let e in a)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(l[e]=()=>a[e]);r.d(t,l);let d=["",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(r.bind(r,751)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\page.tsx"],metadata:{icon:[async e=>(await Promise.resolve().then(r.bind(r,7481))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(r.bind(r,2917)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\layout.tsx"],"not-found":[()=>Promise.resolve().then(r.t.bind(r,9361,23)),"next/dist/client/components/not-found-error"],metadata:{icon:[async e=>(await Promise.resolve().then(r.bind(r,7481))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}],u=["X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\page.tsx"],c="/page",f={require:r,loadChunk:()=>Promise.resolve()},p=new n.AppPageRouteModule({definition:{kind:i.x.APP_PAGE,page:"/page",pathname:"/",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:d}})},8530:(e,t,r)=>{Promise.resolve().then(r.bind(r,2079))},6254:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,2583,23)),Promise.resolve().then(r.t.bind(r,6840,23)),Promise.resolve().then(r.t.bind(r,8771,23)),Promise.resolve().then(r.t.bind(r,3225,23)),Promise.resolve().then(r.t.bind(r,9295,23)),Promise.resolve().then(r.t.bind(r,3982,23))},2731:()=>{},2079:(e,t,r)=>{"use strict";let n;r.r(t),r.d(t,{default:()=>d});var i=r(2295),o=r(3729);r(8294);var s=r(1223),a=r.n(s);function l(e){return(0,i.jsxs)("a",{className:`w-[20rem] h-[8rem] p-2 rounded-2xl bg-slate-800 shadow-lg ${e.shadow} flex flex-col flex-shrink-0 ease-out duration-300 hover:scale-105 hover:-translate-y-1 transition-all`,href:e.link,target:"_blank",children:[(0,i.jsxs)("div",{className:"flex flex-row items-center gap-1 ml-2 h-[2rem] w-full rounded-2xl",children:[i.jsx("span",{className:"text-l font-bold text-cyan-500",children:"sukadia.dev"}),(0,i.jsxs)("span",{className:"text-xl font-bold dark:text-white",children:["/ ",e.title]})]}),(0,i.jsxs)("div",{className:"flex flex-row w-full overflow-clip h-[84px]",children:[i.jsx("div",{className:"h-full aspect-square rounded-2xl relative",children:i.jsx("div",{className:"h-full w-full aspect-square relative rounded-2xl overflow-hidden",children:i.jsx(a(),{fill:!0,src:e.icon,sizes:"128px",alt:"thumbnail",className:""})})}),i.jsx("div",{className:"h-full w-full m-2 ml-4 rounded-2xl",children:i.jsx("p",{children:e.description})})]})]})}function d(){let[e,t]=(0,o.useState)(""),r=(0,o.useRef)("undefined"!=typeof Audio?new Audio("audio/the-fabled-period-button.mp3"):void 0).current,s=0;return(0,i.jsxs)("main",{className:"select-none",children:[i.jsx("div",{className:"flex flex-col items-center h-screen overflow-hidden",children:(0,i.jsxs)("div",{className:("sukadia"==e||"dev"==e?"-translate-y-24":"")+" flex flex-row w-screen items-center justify-center overflow-hidden text-6xl min-[437px]:text-7xl min-[577px]:text-8xl md:text-9xl m-auto transition-all duration-500 z-20",children:[i.jsx("div",{className:"overflow-hidden flex-shrink",onMouseDown:r=>{t("sukadia"==e?"":"sukadia")},children:i.jsx("div",{id:"sukadia",className:("sukadia"==e?"maintitle-pressed top-2":"maintitle hover:-translate-y-0.5")+" transition-all hover:m-2",children:"sukadia"})}),i.jsx("div",{className:"overflow-hidden flex-shrink",onMouseDown:i=>{t("."==e?"":".");let o=++s;n=setTimeout(()=>{s==o&&r?.cloneNode().play()},100)},onMouseUp:e=>{t(""),clearTimeout(n)},children:i.jsx("div",{id:".",className:("."==e?"maintitle-pressed top-2":"maintitle hover:-translate-y-0.5")+" transition-all hover:m-2",children:"."})}),i.jsx("div",{className:"overflow-hidden flex-shrink",onMouseDown:r=>{t("dev"==e?"":"dev")},children:i.jsx("div",{id:"dev",className:("dev"==e?"maintitle-pressed top-2":"maintitle hover:-translate-y-0.5")+" transition-all hover:m-2",children:"dev"})})]})}),i.jsx("div",{className:("sukadia"==e?"":"pointer-events-none")+" flex flex-col items-center absolute h-1/2 p-4 mt-4 -translate-y-4 inset-x-0 top-1/2 overflow-y-auto overflow-x-hidden",children:(0,i.jsxs)("li",{className:("sukadia"==e?"opacity-100 z-10":"opacity-0 pointer-events-none -translate-y-12 z-1")+" flex flex-wrap flex-row items-center justify-center w-3/5 max-w-[1200px] gap-8 transition-all duration-500",children:[i.jsx(l,{title:"Youtube",description:"Lots of VRChat videos focusing on roleplay.",icon:"/images/YoutubeIcon.png",link:"/youtube",shadow:"shadow-red-950"}),i.jsx(l,{title:"Twitch",description:"Occasional streams for whatever seems fun at the moment.",icon:"/images/TwitchIcon.png",link:"/twitch",shadow:"shadow-violet-950"}),i.jsx(l,{title:"Discord",description:"The hub for all my socials & projects. Join to stay updated!",icon:"/images/DiscordIcon.png",link:"/discord",shadow:"shadow-blue-900"}),i.jsx(l,{title:"Ko-fi",description:"Support me monthly to help me make more content.",icon:"/images/KofiIcon.png",link:"/ko-fi",shadow:"shadow-sky-900"})]})}),i.jsx("div",{className:("dev"==e?"":"pointer-events-none")+" flex flex-col items-center absolute h-1/2 p-4 mt-4 -translate-y-4 inset-x-0 top-1/2 overflow-y-auto overflow-x-hidden",children:(0,i.jsxs)("li",{className:("dev"==e?"opacity-100 z-10":"opacity-0 -translate-y-12 z-0")+" flex flex-wrap flex-row items-center justify-center w-3/5 max-w-[1200px] gap-8 transition-all duration-500",children:[i.jsx(l,{title:"Everyone-Votes",description:"A Discord bot that sends and tallies daily polls from thousands of servers.",icon:"/images/EveryoneVotesIcon.png",link:"/everyone-votes",shadow:"shadow-blue-900"}),i.jsx(l,{title:"Space",description:"A WebGPU space/nebula image generator with lots of parameters to modify.",icon:"/images/SpaceIcon.png",link:"/space",shadow:"shadow-violet-950"}),i.jsx(l,{title:"Dark",description:"A VSCode color theme based off of Brackets Dark.",icon:"/images/DarkIcon.png",link:"/dark",shadow:"shadow-yellow-950"})]})})]})}},1900:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return x}});let n=r(9694),i=r(7824)._(r(3729)),o=n._(r(1202)),s=n._(r(1758)),a=r(3855),l=r(3053),d=r(4187);r(837);let u=r(6150),c=n._(r(4931)),f={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function p(e,t,r,n,i,o){let s=null==e?void 0:e.src;e&&e["data-loaded-src"]!==s&&(e["data-loaded-src"]=s,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&i(!0),null==r?void 0:r.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let n=!1,i=!1;r.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>n,isPropagationStopped:()=>i,persist:()=>{},preventDefault:()=>{n=!0,t.preventDefault()},stopPropagation:()=>{i=!0,t.stopPropagation()}})}(null==n?void 0:n.current)&&n.current(e)}}))}function m(e){let[t,r]=i.version.split(".",2),n=parseInt(t,10),o=parseInt(r,10);return n>18||18===n&&o>=3?{fetchPriority:e}:{fetchpriority:e}}globalThis.__NEXT_IMAGE_IMPORTED=!0;let h=(0,i.forwardRef)((e,t)=>{let{src:r,srcSet:n,sizes:o,height:s,width:a,decoding:l,className:d,style:u,fetchPriority:c,placeholder:f,loading:h,unoptimized:g,fill:x,onLoadRef:v,onLoadingCompleteRef:y,setBlurComplete:w,setShowAltText:b,onLoad:_,onError:j,...P}=e;return i.default.createElement("img",{...P,...m(c),loading:h,width:a,height:s,decoding:l,"data-nimg":x?"fill":"1",className:d,style:u,sizes:o,srcSet:n,src:r,ref:(0,i.useCallback)(e=>{t&&("function"==typeof t?t(e):"object"==typeof t&&(t.current=e)),e&&(j&&(e.src=e.src),e.complete&&p(e,f,v,y,w,g))},[r,f,v,y,w,j,g,t]),onLoad:e=>{p(e.currentTarget,f,v,y,w,g)},onError:e=>{b(!0),"empty"!==f&&w(!0),j&&j(e)}})});function g(e){let{isAppRouter:t,imgAttributes:r}=e,n={as:"image",imageSrcSet:r.srcSet,imageSizes:r.sizes,crossOrigin:r.crossOrigin,referrerPolicy:r.referrerPolicy,...m(r.fetchPriority)};return t&&o.default.preload?(o.default.preload(r.src,n),null):i.default.createElement(s.default,null,i.default.createElement("link",{key:"__nimg-"+r.src+r.srcSet+r.sizes,rel:"preload",href:r.srcSet?void 0:r.src,...n}))}let x=(0,i.forwardRef)((e,t)=>{let r=(0,i.useContext)(u.RouterContext),n=(0,i.useContext)(d.ImageConfigContext),o=(0,i.useMemo)(()=>{let e=f||n||l.imageConfigDefault,t=[...e.deviceSizes,...e.imageSizes].sort((e,t)=>e-t),r=e.deviceSizes.sort((e,t)=>e-t);return{...e,allSizes:t,deviceSizes:r}},[n]),{onLoad:s,onLoadingComplete:p}=e,m=(0,i.useRef)(s);(0,i.useEffect)(()=>{m.current=s},[s]);let x=(0,i.useRef)(p);(0,i.useEffect)(()=>{x.current=p},[p]);let[v,y]=(0,i.useState)(!1),[w,b]=(0,i.useState)(!1),{props:_,meta:j}=(0,a.getImgProps)(e,{defaultLoader:c.default,imgConf:o,blurComplete:v,showAltText:w});return i.default.createElement(i.default.Fragment,null,i.default.createElement(h,{..._,unoptimized:j.unoptimized,placeholder:j.placeholder,fill:j.fill,onLoadRef:m,onLoadingCompleteRef:x,setBlurComplete:y,setShowAltText:b,ref:t}),j.priority?i.default.createElement(g,{isAppRouter:!r,imgAttributes:_}):null)});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},7637:(e,t,r)=>{"use strict";e.exports=r(6372).vendored.contexts.AmpContext},2158:(e,t,r)=>{"use strict";e.exports=r(6372).vendored.contexts.HeadManagerContext},4187:(e,t,r)=>{"use strict";e.exports=r(6372).vendored.contexts.ImageConfigContext},6150:(e,t,r)=>{"use strict";e.exports=r(6372).vendored.contexts.RouterContext},2295:(e,t,r)=>{"use strict";e.exports=r(6372).vendored["react-ssr"].ReactJsxRuntime},3126:(e,t)=>{"use strict";function r(e){let{ampFirst:t=!1,hybrid:r=!1,hasQuery:n=!1}=void 0===e?{}:e;return t||r&&n}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isInAmpMode",{enumerable:!0,get:function(){return r}})},3855:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImgProps",{enumerable:!0,get:function(){return a}}),r(837);let n=r(3990),i=r(3053);function o(e){return void 0!==e.default}function s(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function a(e,t){var r;let a,l,d,{src:u,sizes:c,unoptimized:f=!1,priority:p=!1,loading:m,className:h,quality:g,width:x,height:v,fill:y=!1,style:w,onLoad:b,onLoadingComplete:_,placeholder:j="empty",blurDataURL:P,fetchPriority:S,layout:k,objectFit:C,objectPosition:E,lazyBoundary:M,lazyRoot:O,...z}=e,{imgConf:I,showAltText:A,blurComplete:N,defaultLoader:R}=t,D=I||i.imageConfigDefault;if("allSizes"in D)a=D;else{let e=[...D.deviceSizes,...D.imageSizes].sort((e,t)=>e-t),t=D.deviceSizes.sort((e,t)=>e-t);a={...D,allSizes:e,deviceSizes:t}}let q=z.loader||R;delete z.loader,delete z.srcSet;let U="__next_img_default"in q;if(U){if("custom"===a.loader)throw Error('Image with src "'+u+'" is missing "loader" prop.\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader')}else{let e=q;q=t=>{let{config:r,...n}=t;return e(n)}}if(k){"fill"===k&&(y=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[k];e&&(w={...w,...e});let t={responsive:"100vw",fill:"100vw"}[k];t&&!c&&(c=t)}let G="",T=s(x),W=s(v);if("object"==typeof(r=u)&&(o(r)||void 0!==r.src)){let e=o(u)?u.default:u;if(!e.src)throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received "+JSON.stringify(e));if(!e.height||!e.width)throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received "+JSON.stringify(e));if(l=e.blurWidth,d=e.blurHeight,P=P||e.blurDataURL,G=e.src,!y){if(T||W){if(T&&!W){let t=T/e.width;W=Math.round(e.height*t)}else if(!T&&W){let t=W/e.height;T=Math.round(e.width*t)}}else T=e.width,W=e.height}}let L=!p&&("lazy"===m||void 0===m);(!(u="string"==typeof u?u:G)||u.startsWith("data:")||u.startsWith("blob:"))&&(f=!0,L=!1),a.unoptimized&&(f=!0),U&&u.endsWith(".svg")&&!a.dangerouslyAllowSVG&&(f=!0),p&&(S="high");let B=s(g),V=Object.assign(y?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:C,objectPosition:E}:{},A?{}:{color:"transparent"},w),F=N||"empty"===j?null:"blur"===j?'url("data:image/svg+xml;charset=utf-8,'+(0,n.getImageBlurSvg)({widthInt:T,heightInt:W,blurWidth:l,blurHeight:d,blurDataURL:P||"",objectFit:V.objectFit})+'")':'url("'+j+'")',X=F?{backgroundSize:V.objectFit||"cover",backgroundPosition:V.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:F}:{},$=function(e){let{config:t,src:r,unoptimized:n,width:i,quality:o,sizes:s,loader:a}=e;if(n)return{src:r,srcSet:void 0,sizes:void 0};let{widths:l,kind:d}=function(e,t,r){let{deviceSizes:n,allSizes:i}=e;if(r){let e=/(^|\s)(1?\d?\d)vw/g,t=[];for(let n;n=e.exec(r);n)t.push(parseInt(n[2]));if(t.length){let e=.01*Math.min(...t);return{widths:i.filter(t=>t>=n[0]*e),kind:"w"}}return{widths:i,kind:"w"}}return"number"!=typeof t?{widths:n,kind:"w"}:{widths:[...new Set([t,2*t].map(e=>i.find(t=>t>=e)||i[i.length-1]))],kind:"x"}}(t,i,s),u=l.length-1;return{sizes:s||"w"!==d?s:"100vw",srcSet:l.map((e,n)=>a({config:t,src:r,quality:o,width:e})+" "+("w"===d?e:n+1)+d).join(", "),src:a({config:t,src:r,quality:o,width:l[u]})}}({config:a,src:u,unoptimized:f,width:T,quality:B,sizes:c,loader:q});return{props:{...z,loading:L?"lazy":m,fetchPriority:S,width:T,height:W,decoding:"async",className:h,style:{...V,...X},sizes:$.sizes,srcSet:$.srcSet,src:$.src},meta:{unoptimized:f,priority:p,placeholder:j,fill:y}}}},1758:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{defaultHead:function(){return d},default:function(){return p}});let n=r(9694),i=r(7824)._(r(3729)),o=n._(r(7984)),s=r(7637),a=r(2158),l=r(3126);function d(e){void 0===e&&(e=!1);let t=[i.default.createElement("meta",{charSet:"utf-8"})];return e||t.push(i.default.createElement("meta",{name:"viewport",content:"width=device-width"})),t}function u(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===i.default.Fragment?e.concat(i.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}r(837);let c=["name","httpEquiv","charSet","itemProp"];function f(e,t){let{inAmpMode:r}=t;return e.reduce(u,[]).reverse().concat(d(r).reverse()).filter(function(){let e=new Set,t=new Set,r=new Set,n={};return i=>{let o=!0,s=!1;if(i.key&&"number"!=typeof i.key&&i.key.indexOf("$")>0){s=!0;let t=i.key.slice(i.key.indexOf("$")+1);e.has(t)?o=!1:e.add(t)}switch(i.type){case"title":case"base":t.has(i.type)?o=!1:t.add(i.type);break;case"meta":for(let e=0,t=c.length;e{let n=e.key||t;if(!r&&"link"===e.type&&e.props.href&&["https://fonts.googleapis.com/css","https://use.typekit.net/"].some(t=>e.props.href.startsWith(t))){let t={...e.props||{}};return t["data-href"]=t.href,t.href=void 0,t["data-optimized-fonts"]=!0,i.default.cloneElement(e,t)}return i.default.cloneElement(e,{key:n})})}let p=function(e){let{children:t}=e,r=(0,i.useContext)(s.AmpStateContext),n=(0,i.useContext)(a.HeadManagerContext);return i.default.createElement(o.default,{reduceComponentsToState:f,headManager:n,inAmpMode:(0,l.isInAmpMode)(r)},t)};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3990:(e,t)=>{"use strict";function r(e){let{widthInt:t,heightInt:r,blurWidth:n,blurHeight:i,blurDataURL:o,objectFit:s}=e,a=n?40*n:t,l=i?40*i:r,d=a&&l?"viewBox='0 0 "+a+" "+l+"'":"";return"%3Csvg xmlns='http://www.w3.org/2000/svg' "+d+"%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='"+(d?"none":"contain"===s?"xMidYMid":"cover"===s?"xMidYMid slice":"none")+"' style='filter: url(%23b);' href='"+o+"'/%3E%3C/svg%3E"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImageBlurSvg",{enumerable:!0,get:function(){return r}})},3053:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{VALID_LOADERS:function(){return r},imageConfigDefault:function(){return n}});let r=["default","imgix","cloudinary","akamai","custom"],n={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:60,formats:["image/webp"],dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"inline",remotePatterns:[],unoptimized:!1}},7412:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{unstable_getImgProps:function(){return l},default:function(){return d}});let n=r(9694),i=r(3855),o=r(837),s=r(1900),a=n._(r(4931)),l=e=>{(0,o.warnOnce)("Warning: unstable_getImgProps() is experimental and may change or be removed at any time. Use at your own risk.");let{props:t}=(0,i.getImgProps)(e,{defaultLoader:a.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,r]of Object.entries(t))void 0===r&&delete t[e];return{props:t}},d=s.Image},4931:(e,t)=>{"use strict";function r(e){let{config:t,src:r,width:n,quality:i}=e;return t.path+"?url="+encodeURIComponent(r)+"&w="+n+"&q="+(i||75)}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n}}),r.__next_img_default=!0;let n=r},7984:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return s}});let n=r(3729),i=()=>{},o=()=>{};function s(e){var t;let{headManager:r,reduceComponentsToState:s}=e;function a(){if(r&&r.mountedInstances){let t=n.Children.toArray(Array.from(r.mountedInstances).filter(Boolean));r.updateHead(s(t,e))}}return null==r||null==(t=r.mountedInstances)||t.add(e.children),a(),i(()=>{var t;return null==r||null==(t=r.mountedInstances)||t.add(e.children),()=>{var t;null==r||null==(t=r.mountedInstances)||t.delete(e.children)}}),i(()=>(r&&(r._pendingUpdate=a),()=>{r&&(r._pendingUpdate=a)})),o(()=>(r&&r._pendingUpdate&&(r._pendingUpdate(),r._pendingUpdate=null),()=>{r&&r._pendingUpdate&&(r._pendingUpdate(),r._pendingUpdate=null)})),null}},837:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"warnOnce",{enumerable:!0,get:function(){return r}});let r=e=>{}},1223:(e,t,r)=>{e.exports=r(7412)},2917:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a,metadata:()=>s});var n=r(5036),i=r(265),o=r.n(i);r(3440);let s={title:"sukadia.dev",description:"I code, stream, and create videos."};function a({children:e}){return n.jsx("html",{lang:"en",children:n.jsx("body",{className:o().className,children:e})})}},751:(e,t,r)=>{"use strict";r.r(t),r.d(t,{$$typeof:()=>o,__esModule:()=>i,default:()=>s});let n=(0,r(6843).createProxy)(String.raw`X:\Some Useful Stuff\Applications\Web\next-sukadia.dev\app\page.tsx`),{__esModule:i,$$typeof:o}=n,s=n.default},7481:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>i});var n=r(337);let i=e=>[{type:"image/x-icon",sizes:"16x16",url:(0,n.fillMetadataSegment)(".",e.params,"favicon.ico")+""}]},3440:()=>{},8294:()=>{}};var t=require("../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[638,969,337],()=>r(4345));module.exports=n})();
\ No newline at end of file
+(()=>{var e={};e.id=931,e.ids=[931],e.modules={7849:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external")},2934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},5403:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external")},4580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},4749:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external")},5869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},1017:e=>{"use strict";e.exports=require("path")},7310:e=>{"use strict";e.exports=require("url")},4345:(e,t,r)=>{"use strict";r.r(t),r.d(t,{GlobalError:()=>s.a,__next_app__:()=>f,originalPathname:()=>c,pages:()=>u,routeModule:()=>p,tree:()=>d});var n=r(482),i=r(9108),o=r(2563),s=r.n(o),a=r(8300),l={};for(let e in a)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(l[e]=()=>a[e]);r.d(t,l);let d=["",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(r.bind(r,751)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\page.tsx"],metadata:{icon:[async e=>(await Promise.resolve().then(r.bind(r,7481))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(r.bind(r,2917)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\layout.tsx"],"not-found":[()=>Promise.resolve().then(r.t.bind(r,9361,23)),"next/dist/client/components/not-found-error"],metadata:{icon:[async e=>(await Promise.resolve().then(r.bind(r,7481))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}],u=["X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\page.tsx"],c="/page",f={require:r,loadChunk:()=>Promise.resolve()},p=new n.AppPageRouteModule({definition:{kind:i.x.APP_PAGE,page:"/page",pathname:"/",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:d}})},8530:(e,t,r)=>{Promise.resolve().then(r.bind(r,2079))},6254:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,2583,23)),Promise.resolve().then(r.t.bind(r,6840,23)),Promise.resolve().then(r.t.bind(r,8771,23)),Promise.resolve().then(r.t.bind(r,3225,23)),Promise.resolve().then(r.t.bind(r,9295,23)),Promise.resolve().then(r.t.bind(r,3982,23))},2731:()=>{},2079:(e,t,r)=>{"use strict";let n;r.r(t),r.d(t,{default:()=>d});var i=r(2295),o=r(3729);r(8294);var s=r(1223),a=r.n(s);function l(e){return(0,i.jsxs)("a",{className:`w-[20rem] h-[8rem] p-2 rounded-2xl bg-slate-800 shadow-lg ${e.shadow} flex flex-col flex-shrink-0 ease-out duration-300 hover:scale-105 hover:-translate-y-1 transition-all`,href:e.link,target:"_blank",children:[(0,i.jsxs)("div",{className:"flex flex-row items-center gap-1 ml-2 h-[2rem] w-full rounded-2xl",children:[i.jsx("span",{className:"text-l font-bold text-cyan-500",children:"sukadia.dev"}),(0,i.jsxs)("span",{className:"text-xl font-bold dark:text-white",children:["/ ",e.title]})]}),(0,i.jsxs)("div",{className:"flex flex-row w-full overflow-clip h-[84px]",children:[i.jsx("div",{className:"h-full aspect-square rounded-2xl relative",children:i.jsx("div",{className:"h-full w-full aspect-square relative rounded-2xl overflow-hidden",children:i.jsx(a(),{fill:!0,src:e.icon,sizes:"128px",alt:"thumbnail",className:""})})}),i.jsx("div",{className:"h-full w-full m-2 ml-4 rounded-2xl",children:i.jsx("p",{children:e.description})})]})]})}function d(){let[e,t]=(0,o.useState)(""),r=(0,o.useRef)("undefined"!=typeof Audio?new Audio("audio/the-fabled-period-button.mp3"):void 0).current,s=0;return(0,i.jsxs)("main",{className:"select-none",children:[i.jsx("div",{className:"flex flex-col items-center h-screen overflow-hidden",children:(0,i.jsxs)("div",{className:("sukadia"==e||"dev"==e?"-translate-y-24":"")+" flex flex-row w-screen items-center justify-center overflow-hidden text-6xl min-[437px]:text-7xl min-[577px]:text-8xl md:text-9xl m-auto transition-all duration-500 z-20",children:[i.jsx("div",{className:"overflow-hidden flex-shrink",onMouseDown:r=>{t("sukadia"==e?"":"sukadia")},children:i.jsx("div",{id:"sukadia",className:("sukadia"==e?"maintitle-pressed top-2":"maintitle hover:-translate-y-0.5")+" transition-all hover:m-2",children:"sukadia"})}),i.jsx("div",{className:"overflow-hidden flex-shrink",onMouseDown:i=>{t("."==e?"":".");let o=++s;n=setTimeout(()=>{s==o&&r?.cloneNode().play()},100)},onMouseUp:e=>{t(""),clearTimeout(n)},children:i.jsx("div",{id:".",className:("."==e?"maintitle-pressed top-2":"maintitle hover:-translate-y-0.5")+" transition-all hover:m-2",children:"."})}),i.jsx("div",{className:"overflow-hidden flex-shrink",onMouseDown:r=>{t("dev"==e?"":"dev")},children:i.jsx("div",{id:"dev",className:("dev"==e?"maintitle-pressed top-2":"maintitle hover:-translate-y-0.5")+" transition-all hover:m-2",children:"dev"})})]})}),i.jsx("div",{className:("sukadia"==e?"":"pointer-events-none")+" flex flex-col items-center absolute h-1/2 p-4 mt-4 -translate-y-4 inset-x-0 top-1/2 overflow-y-auto overflow-x-hidden",children:(0,i.jsxs)("li",{className:("sukadia"==e?"opacity-100 z-10":"opacity-0 pointer-events-none -translate-y-12 z-1")+" flex flex-wrap flex-row items-center justify-center w-3/5 max-w-[1200px] gap-8 transition-all duration-500",children:[i.jsx(l,{title:"Youtube",description:"Lots of VRChat videos focusing on roleplay.",icon:"/images/YoutubeIcon.png",link:"/youtube",shadow:"shadow-red-950"}),i.jsx(l,{title:"Twitch",description:"Occasional streams for whatever seems fun at the moment.",icon:"/images/TwitchIcon.png",link:"/twitch",shadow:"shadow-violet-950"}),i.jsx(l,{title:"Discord",description:"The hub for all my socials & projects. Join to stay updated!",icon:"/images/DiscordIcon.png",link:"/discord",shadow:"shadow-blue-900"}),i.jsx(l,{title:"Ko-fi",description:"Support me monthly to help me make more content.",icon:"/images/KofiIcon.png",link:"/ko-fi",shadow:"shadow-sky-900"})]})}),i.jsx("div",{className:("dev"==e?"":"pointer-events-none")+" flex flex-col items-center absolute h-1/2 p-4 mt-4 -translate-y-4 inset-x-0 top-1/2 overflow-y-auto overflow-x-hidden",children:(0,i.jsxs)("li",{className:("dev"==e?"opacity-100 z-10":"opacity-0 -translate-y-12 z-0")+" flex flex-wrap flex-row items-center justify-center w-3/5 max-w-[1200px] gap-8 transition-all duration-500",children:[i.jsx(l,{title:"Everyone-Votes",description:"A Discord bot that sends and tallies daily polls from thousands of servers.",icon:"/images/EveryoneVotesIcon.png",link:"/everyone-votes",shadow:"shadow-blue-900"}),i.jsx(l,{title:"Space",description:"A WebGPU space/nebula image generator with lots of parameters to modify.",icon:"/images/SpaceIcon.png",link:"/space",shadow:"shadow-violet-950"}),i.jsx(l,{title:"Dark",description:"A VSCode color theme based off of Brackets Dark.",icon:"/images/DarkIcon.png",link:"/dark",shadow:"shadow-yellow-950"})]})})]})}},1900:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return x}});let n=r(9694),i=r(7824)._(r(3729)),o=n._(r(1202)),s=n._(r(1758)),a=r(3855),l=r(3053),d=r(4187);r(837);let u=r(6150),c=n._(r(4931)),f={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function p(e,t,r,n,i,o){let s=null==e?void 0:e.src;e&&e["data-loaded-src"]!==s&&(e["data-loaded-src"]=s,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&i(!0),null==r?void 0:r.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let n=!1,i=!1;r.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>n,isPropagationStopped:()=>i,persist:()=>{},preventDefault:()=>{n=!0,t.preventDefault()},stopPropagation:()=>{i=!0,t.stopPropagation()}})}(null==n?void 0:n.current)&&n.current(e)}}))}function m(e){let[t,r]=i.version.split(".",2),n=parseInt(t,10),o=parseInt(r,10);return n>18||18===n&&o>=3?{fetchPriority:e}:{fetchpriority:e}}globalThis.__NEXT_IMAGE_IMPORTED=!0;let h=(0,i.forwardRef)((e,t)=>{let{src:r,srcSet:n,sizes:o,height:s,width:a,decoding:l,className:d,style:u,fetchPriority:c,placeholder:f,loading:h,unoptimized:g,fill:x,onLoadRef:v,onLoadingCompleteRef:y,setBlurComplete:w,setShowAltText:b,onLoad:_,onError:j,...P}=e;return i.default.createElement("img",{...P,...m(c),loading:h,width:a,height:s,decoding:l,"data-nimg":x?"fill":"1",className:d,style:u,sizes:o,srcSet:n,src:r,ref:(0,i.useCallback)(e=>{t&&("function"==typeof t?t(e):"object"==typeof t&&(t.current=e)),e&&(j&&(e.src=e.src),e.complete&&p(e,f,v,y,w,g))},[r,f,v,y,w,j,g,t]),onLoad:e=>{p(e.currentTarget,f,v,y,w,g)},onError:e=>{b(!0),"empty"!==f&&w(!0),j&&j(e)}})});function g(e){let{isAppRouter:t,imgAttributes:r}=e,n={as:"image",imageSrcSet:r.srcSet,imageSizes:r.sizes,crossOrigin:r.crossOrigin,referrerPolicy:r.referrerPolicy,...m(r.fetchPriority)};return t&&o.default.preload?(o.default.preload(r.src,n),null):i.default.createElement(s.default,null,i.default.createElement("link",{key:"__nimg-"+r.src+r.srcSet+r.sizes,rel:"preload",href:r.srcSet?void 0:r.src,...n}))}let x=(0,i.forwardRef)((e,t)=>{let r=(0,i.useContext)(u.RouterContext),n=(0,i.useContext)(d.ImageConfigContext),o=(0,i.useMemo)(()=>{let e=f||n||l.imageConfigDefault,t=[...e.deviceSizes,...e.imageSizes].sort((e,t)=>e-t),r=e.deviceSizes.sort((e,t)=>e-t);return{...e,allSizes:t,deviceSizes:r}},[n]),{onLoad:s,onLoadingComplete:p}=e,m=(0,i.useRef)(s);(0,i.useEffect)(()=>{m.current=s},[s]);let x=(0,i.useRef)(p);(0,i.useEffect)(()=>{x.current=p},[p]);let[v,y]=(0,i.useState)(!1),[w,b]=(0,i.useState)(!1),{props:_,meta:j}=(0,a.getImgProps)(e,{defaultLoader:c.default,imgConf:o,blurComplete:v,showAltText:w});return i.default.createElement(i.default.Fragment,null,i.default.createElement(h,{..._,unoptimized:j.unoptimized,placeholder:j.placeholder,fill:j.fill,onLoadRef:m,onLoadingCompleteRef:x,setBlurComplete:y,setShowAltText:b,ref:t}),j.priority?i.default.createElement(g,{isAppRouter:!r,imgAttributes:_}):null)});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},7637:(e,t,r)=>{"use strict";e.exports=r(6372).vendored.contexts.AmpContext},2158:(e,t,r)=>{"use strict";e.exports=r(6372).vendored.contexts.HeadManagerContext},4187:(e,t,r)=>{"use strict";e.exports=r(6372).vendored.contexts.ImageConfigContext},6150:(e,t,r)=>{"use strict";e.exports=r(6372).vendored.contexts.RouterContext},2295:(e,t,r)=>{"use strict";e.exports=r(6372).vendored["react-ssr"].ReactJsxRuntime},3126:(e,t)=>{"use strict";function r(e){let{ampFirst:t=!1,hybrid:r=!1,hasQuery:n=!1}=void 0===e?{}:e;return t||r&&n}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isInAmpMode",{enumerable:!0,get:function(){return r}})},3855:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImgProps",{enumerable:!0,get:function(){return a}}),r(837);let n=r(3990),i=r(3053);function o(e){return void 0!==e.default}function s(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function a(e,t){var r;let a,l,d,{src:u,sizes:c,unoptimized:f=!1,priority:p=!1,loading:m,className:h,quality:g,width:x,height:v,fill:y=!1,style:w,onLoad:b,onLoadingComplete:_,placeholder:j="empty",blurDataURL:P,fetchPriority:S,layout:k,objectFit:C,objectPosition:E,lazyBoundary:M,lazyRoot:O,...z}=e,{imgConf:I,showAltText:A,blurComplete:N,defaultLoader:R}=t,D=I||i.imageConfigDefault;if("allSizes"in D)a=D;else{let e=[...D.deviceSizes,...D.imageSizes].sort((e,t)=>e-t),t=D.deviceSizes.sort((e,t)=>e-t);a={...D,allSizes:e,deviceSizes:t}}let q=z.loader||R;delete z.loader,delete z.srcSet;let U="__next_img_default"in q;if(U){if("custom"===a.loader)throw Error('Image with src "'+u+'" is missing "loader" prop.\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader')}else{let e=q;q=t=>{let{config:r,...n}=t;return e(n)}}if(k){"fill"===k&&(y=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[k];e&&(w={...w,...e});let t={responsive:"100vw",fill:"100vw"}[k];t&&!c&&(c=t)}let G="",T=s(x),W=s(v);if("object"==typeof(r=u)&&(o(r)||void 0!==r.src)){let e=o(u)?u.default:u;if(!e.src)throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received "+JSON.stringify(e));if(!e.height||!e.width)throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received "+JSON.stringify(e));if(l=e.blurWidth,d=e.blurHeight,P=P||e.blurDataURL,G=e.src,!y){if(T||W){if(T&&!W){let t=T/e.width;W=Math.round(e.height*t)}else if(!T&&W){let t=W/e.height;T=Math.round(e.width*t)}}else T=e.width,W=e.height}}let L=!p&&("lazy"===m||void 0===m);(!(u="string"==typeof u?u:G)||u.startsWith("data:")||u.startsWith("blob:"))&&(f=!0,L=!1),a.unoptimized&&(f=!0),U&&u.endsWith(".svg")&&!a.dangerouslyAllowSVG&&(f=!0),p&&(S="high");let B=s(g),V=Object.assign(y?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:C,objectPosition:E}:{},A?{}:{color:"transparent"},w),F=N||"empty"===j?null:"blur"===j?'url("data:image/svg+xml;charset=utf-8,'+(0,n.getImageBlurSvg)({widthInt:T,heightInt:W,blurWidth:l,blurHeight:d,blurDataURL:P||"",objectFit:V.objectFit})+'")':'url("'+j+'")',X=F?{backgroundSize:V.objectFit||"cover",backgroundPosition:V.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:F}:{},$=function(e){let{config:t,src:r,unoptimized:n,width:i,quality:o,sizes:s,loader:a}=e;if(n)return{src:r,srcSet:void 0,sizes:void 0};let{widths:l,kind:d}=function(e,t,r){let{deviceSizes:n,allSizes:i}=e;if(r){let e=/(^|\s)(1?\d?\d)vw/g,t=[];for(let n;n=e.exec(r);n)t.push(parseInt(n[2]));if(t.length){let e=.01*Math.min(...t);return{widths:i.filter(t=>t>=n[0]*e),kind:"w"}}return{widths:i,kind:"w"}}return"number"!=typeof t?{widths:n,kind:"w"}:{widths:[...new Set([t,2*t].map(e=>i.find(t=>t>=e)||i[i.length-1]))],kind:"x"}}(t,i,s),u=l.length-1;return{sizes:s||"w"!==d?s:"100vw",srcSet:l.map((e,n)=>a({config:t,src:r,quality:o,width:e})+" "+("w"===d?e:n+1)+d).join(", "),src:a({config:t,src:r,quality:o,width:l[u]})}}({config:a,src:u,unoptimized:f,width:T,quality:B,sizes:c,loader:q});return{props:{...z,loading:L?"lazy":m,fetchPriority:S,width:T,height:W,decoding:"async",className:h,style:{...V,...X},sizes:$.sizes,srcSet:$.srcSet,src:$.src},meta:{unoptimized:f,priority:p,placeholder:j,fill:y}}}},1758:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{defaultHead:function(){return d},default:function(){return p}});let n=r(9694),i=r(7824)._(r(3729)),o=n._(r(7984)),s=r(7637),a=r(2158),l=r(3126);function d(e){void 0===e&&(e=!1);let t=[i.default.createElement("meta",{charSet:"utf-8"})];return e||t.push(i.default.createElement("meta",{name:"viewport",content:"width=device-width"})),t}function u(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===i.default.Fragment?e.concat(i.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}r(837);let c=["name","httpEquiv","charSet","itemProp"];function f(e,t){let{inAmpMode:r}=t;return e.reduce(u,[]).reverse().concat(d(r).reverse()).filter(function(){let e=new Set,t=new Set,r=new Set,n={};return i=>{let o=!0,s=!1;if(i.key&&"number"!=typeof i.key&&i.key.indexOf("$")>0){s=!0;let t=i.key.slice(i.key.indexOf("$")+1);e.has(t)?o=!1:e.add(t)}switch(i.type){case"title":case"base":t.has(i.type)?o=!1:t.add(i.type);break;case"meta":for(let e=0,t=c.length;e{let n=e.key||t;if(!r&&"link"===e.type&&e.props.href&&["https://fonts.googleapis.com/css","https://use.typekit.net/"].some(t=>e.props.href.startsWith(t))){let t={...e.props||{}};return t["data-href"]=t.href,t.href=void 0,t["data-optimized-fonts"]=!0,i.default.cloneElement(e,t)}return i.default.cloneElement(e,{key:n})})}let p=function(e){let{children:t}=e,r=(0,i.useContext)(s.AmpStateContext),n=(0,i.useContext)(a.HeadManagerContext);return i.default.createElement(o.default,{reduceComponentsToState:f,headManager:n,inAmpMode:(0,l.isInAmpMode)(r)},t)};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3990:(e,t)=>{"use strict";function r(e){let{widthInt:t,heightInt:r,blurWidth:n,blurHeight:i,blurDataURL:o,objectFit:s}=e,a=n?40*n:t,l=i?40*i:r,d=a&&l?"viewBox='0 0 "+a+" "+l+"'":"";return"%3Csvg xmlns='http://www.w3.org/2000/svg' "+d+"%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='"+(d?"none":"contain"===s?"xMidYMid":"cover"===s?"xMidYMid slice":"none")+"' style='filter: url(%23b);' href='"+o+"'/%3E%3C/svg%3E"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImageBlurSvg",{enumerable:!0,get:function(){return r}})},3053:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{VALID_LOADERS:function(){return r},imageConfigDefault:function(){return n}});let r=["default","imgix","cloudinary","akamai","custom"],n={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:60,formats:["image/webp"],dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"inline",remotePatterns:[],unoptimized:!1}},7412:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{unstable_getImgProps:function(){return l},default:function(){return d}});let n=r(9694),i=r(3855),o=r(837),s=r(1900),a=n._(r(4931)),l=e=>{(0,o.warnOnce)("Warning: unstable_getImgProps() is experimental and may change or be removed at any time. Use at your own risk.");let{props:t}=(0,i.getImgProps)(e,{defaultLoader:a.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,r]of Object.entries(t))void 0===r&&delete t[e];return{props:t}},d=s.Image},4931:(e,t)=>{"use strict";function r(e){let{config:t,src:r,width:n,quality:i}=e;return t.path+"?url="+encodeURIComponent(r)+"&w="+n+"&q="+(i||75)}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n}}),r.__next_img_default=!0;let n=r},7984:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return s}});let n=r(3729),i=()=>{},o=()=>{};function s(e){var t;let{headManager:r,reduceComponentsToState:s}=e;function a(){if(r&&r.mountedInstances){let t=n.Children.toArray(Array.from(r.mountedInstances).filter(Boolean));r.updateHead(s(t,e))}}return null==r||null==(t=r.mountedInstances)||t.add(e.children),a(),i(()=>{var t;return null==r||null==(t=r.mountedInstances)||t.add(e.children),()=>{var t;null==r||null==(t=r.mountedInstances)||t.delete(e.children)}}),i(()=>(r&&(r._pendingUpdate=a),()=>{r&&(r._pendingUpdate=a)})),o(()=>(r&&r._pendingUpdate&&(r._pendingUpdate(),r._pendingUpdate=null),()=>{r&&r._pendingUpdate&&(r._pendingUpdate(),r._pendingUpdate=null)})),null}},837:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"warnOnce",{enumerable:!0,get:function(){return r}});let r=e=>{}},1223:(e,t,r)=>{e.exports=r(7412)},2917:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a,metadata:()=>s});var n=r(5036),i=r(265),o=r.n(i);r(3440);let s={title:"sukadia.dev",description:"I code, stream, and create videos."};function a({children:e}){return n.jsx("html",{lang:"en",children:n.jsx("body",{className:o().className,children:e})})}},751:(e,t,r)=>{"use strict";r.r(t),r.d(t,{$$typeof:()=>o,__esModule:()=>i,default:()=>s});let n=(0,r(6843).createProxy)(String.raw`X:\Some Useful Stuff\Applications\Web\next-sukadia.dev\app\page.tsx`),{__esModule:i,$$typeof:o}=n,s=n.default},7481:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>i});var n=r(337);let i=e=>[{type:"image/x-icon",sizes:"16x16",url:(0,n.fillMetadataSegment)(".",e.params,"favicon.ico")+""}]},3440:()=>{},8294:()=>{}};var t=require("../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[638,969,337],()=>r(4345));module.exports=n})();
\ No newline at end of file
diff --git a/.next/server/app/space.html b/.next/server/app/space.html
index 87a40a8..aaf3ce2 100644
--- a/.next/server/app/space.html
+++ b/.next/server/app/space.html
@@ -1 +1 @@
-sukadia.dev
\ No newline at end of file
+sukadia.dev
\ No newline at end of file
diff --git a/.next/server/app/space.rsc b/.next/server/app/space.rsc
index 5769bcc..cdb5562 100644
--- a/.next/server/app/space.rsc
+++ b/.next/server/app/space.rsc
@@ -2,6 +2,6 @@
3:I[7846,["732","static/chunks/e1206f8c-1ba69cf5e736c266.js","105","static/chunks/1f3d3139-8a75094e9a213384.js","735","static/chunks/604a08ec-edbc4bb5c67ea975.js","790","static/chunks/d67c510a-4a8f7a6a0c1c3e2a.js","116","static/chunks/537cd76e-7aba1cf7a4752418.js","973","static/chunks/973-5f61489a82d0bbab.js","514","static/chunks/app/space/page-185302d4e0f787e8.js"],""]
4:I[5613,[],""]
5:I[1778,[],""]
-0:["xSz9x0FW88Rb7utFdR6Fp",[[["",{"children":["space",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["space",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","space","children"],"loading":["$","div",null,{"className":"flex h-screen justify-center items-center","children":["$","div",null,{"className":"flex items-center justify-center rounded-full w-14 h-14 bg-gradient-to-tr from-cyan-400 to-blue-900 animate-spin","children":["$","div",null,{"className":"h-10 w-10 rounded-full bg-black"}]}]}],"loadingStyles":[],"loadingScripts":[],"hasLoading":true,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_e66fe9","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/1d2d59615145af7d.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
+0:["_irQtJdFK0j8SeLn5FtRS",[[["",{"children":["space",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["space",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","space","children"],"loading":["$","div",null,{"className":"flex h-screen justify-center items-center","children":["$","div",null,{"className":"flex items-center justify-center rounded-full w-14 h-14 bg-gradient-to-tr from-cyan-400 to-blue-900 animate-spin","children":["$","div",null,{"className":"h-10 w-10 rounded-full bg-black"}]}]}],"loadingStyles":[],"loadingScripts":[],"hasLoading":true,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_e66fe9","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/1d2d59615145af7d.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"sukadia.dev"}],["$","meta","3",{"name":"description","content":"I code, stream, and create videos."}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]]
1:null
diff --git a/.next/server/app/space/page.js b/.next/server/app/space/page.js
index 445f77e..523e54c 100644
--- a/.next/server/app/space/page.js
+++ b/.next/server/app/space/page.js
@@ -1,4 +1,4 @@
-(()=>{var e={};e.id=514,e.ids=[514],e.modules={7849:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external")},5403:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external")},4749:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external")},399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},5528:e=>{"use strict";e.exports=require("next/dist\\client\\components\\action-async-storage.external.js")},1877:e=>{"use strict";e.exports=require("next/dist\\client\\components\\request-async-storage.external.js")},5319:e=>{"use strict";e.exports=require("next/dist\\client\\components\\static-generation-async-storage.external.js")},1017:e=>{"use strict";e.exports=require("path")},7310:e=>{"use strict";e.exports=require("url")},8899:(e,t,i)=>{"use strict";i.r(t),i.d(t,{GlobalError:()=>a.a,__next_app__:()=>d,originalPathname:()=>c,pages:()=>u,routeModule:()=>p,tree:()=>h});var r=i(482),s=i(9108),n=i(2563),a=i.n(n),o=i(8300),l={};for(let e in o)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(l[e]=()=>o[e]);i.d(t,l);let h=["",{children:["space",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(i.bind(i,926)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\space\\page.tsx"]}]},{loading:[()=>Promise.resolve().then(i.bind(i,8187)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\space\\loading.tsx"],metadata:{icon:[async e=>(await Promise.resolve().then(i.bind(i,7481))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(i.bind(i,2917)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\layout.tsx"],"not-found":[()=>Promise.resolve().then(i.t.bind(i,9361,23)),"next/dist/client/components/not-found-error"],metadata:{icon:[async e=>(await Promise.resolve().then(i.bind(i,7481))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}],u=["X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\space\\page.tsx"],c="/space/page",d={require:i,loadChunk:()=>Promise.resolve()},p=new r.AppPageRouteModule({definition:{kind:s.x.APP_PAGE,page:"/space/page",pathname:"/space",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:h}})},4038:(e,t,i)=>{Promise.resolve().then(i.bind(i,2018))},6254:(e,t,i)=>{Promise.resolve().then(i.t.bind(i,2583,23)),Promise.resolve().then(i.t.bind(i,6840,23)),Promise.resolve().then(i.t.bind(i,8771,23)),Promise.resolve().then(i.t.bind(i,3225,23)),Promise.resolve().then(i.t.bind(i,9295,23)),Promise.resolve().then(i.t.bind(i,3982,23))},2731:()=>{},5303:()=>{},2018:(e,t,i)=>{"use strict";let r,s,n,a,o,l,h,u,c,d,p;i.r(t),i.d(t,{default:()=>yM});var _,f,m,g,v,x,T,b,E,S,C,y,A,R,I,P,M,D,O,N,F,w,L,B,U,V,k,G,z,W,H,X,Y,j,K,$,q,Q,Z,J,ee,et,ei,er,es,en,ea,eo,el,eh,eu,ec,ed,ep,e_,ef,em,eg,ev,ex,eT,eb,eE,eS,eC,ey,eA,eR,eI,eP,eM,eD,eO,eN,eF,ew,eL,eB,eU,eV,ek,eG,ez,eW,eH,eX,eY,ej,eK,e$,eq,eQ,eZ,eJ,e0,e1,e2,e3,e4,e5,e6,e8,e7,e9,te,tt,ti,tr,ts,tn,ta,to,tl,th,tu,tc,td,tp,t_,tf,tm,tg,tv,tx,tT,tb,tE,tS,tC,ty,tA,tR,tI,tP,tM,tD,tO,tN,tF,tw,tL,tB=i(2295),tU=i(3729),tV=i(3267),tk=i.n(tV);function tG(){return tB.jsx("div",{className:"flex h-screen justify-center items-center",children:tB.jsx("div",{className:"flex items-center justify-center rounded-full w-14 h-14 bg-gradient-to-tr from-cyan-400 to-blue-900 animate-spin",children:tB.jsx("div",{className:"h-10 w-10 rounded-full bg-black"})})})}var tz=i(9652);class tW{constructor(){this.rootNodes=[],this.cameras=[],this.lights=[],this.meshes=[],this.skeletons=[],this.particleSystems=[],this.animations=[],this.animationGroups=[],this.multiMaterials=[],this.materials=[],this.morphTargetManagers=[],this.geometries=[],this.transformNodes=[],this.actionManagers=[],this.textures=[],this._environmentTexture=null,this.postProcesses=[]}static AddParser(e,t){this._BabylonFileParsers[e]=t}static GetParser(e){return this._BabylonFileParsers[e]?this._BabylonFileParsers[e]:null}static AddIndividualParser(e,t){this._IndividualBabylonFileParsers[e]=t}static GetIndividualParser(e){return this._IndividualBabylonFileParsers[e]?this._IndividualBabylonFileParsers[e]:null}static Parse(e,t,i,r){for(let s in this._BabylonFileParsers)Object.prototype.hasOwnProperty.call(this._BabylonFileParsers,s)&&this._BabylonFileParsers[s](e,t,i,r)}get environmentTexture(){return this._environmentTexture}set environmentTexture(e){this._environmentTexture=e}getNodes(){let e=[];return e=(e=(e=(e=e.concat(this.meshes)).concat(this.lights)).concat(this.cameras)).concat(this.transformNodes),this.skeletons.forEach(t=>e=e.concat(t.bones)),e}}tW._BabylonFileParsers={},tW._IndividualBabylonFileParsers={};class tH{constructor(){this.hoverCursor="",this.actions=[],this.isRecursive=!1}static get HasTriggers(){for(let e in tH.Triggers)if(Object.prototype.hasOwnProperty.call(tH.Triggers,e))return!0;return!1}static get HasPickTriggers(){for(let e in tH.Triggers)if(Object.prototype.hasOwnProperty.call(tH.Triggers,e)){let t=parseInt(e);if(t>=1&&t<=7)return!0}return!1}static HasSpecificTrigger(e){for(let t in tH.Triggers)if(Object.prototype.hasOwnProperty.call(tH.Triggers,t)&&parseInt(t)===e)return!0;return!1}}tH.Triggers={};class tX{constructor(e,t=!1,i,r){this.initialize(e,t,i,r)}initialize(e,t=!1,i,r){return this.mask=e,this.skipNextObservers=t,this.target=i,this.currentTarget=r,this}}class tY{constructor(e,t,i=null){this.callback=e,this.mask=t,this.scope=i,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1,this._remove=null}remove(){this._remove&&this._remove()}}class tj{static FromPromise(e,t){let i=new tj;return e.then(e=>{i.notifyObservers(e)}).catch(e=>{if(t)t.notifyObservers(e);else throw e}),i}get observers(){return this._observers}constructor(e,t=!1){this.notifyIfTriggered=t,this._observers=[],this._numObserversMarkedAsDeleted=0,this._hasNotified=!1,this._eventState=new tX(0),e&&(this._onObserverAdded=e)}add(e,t=-1,i=!1,r=null,s=!1){if(!e)return null;let n=new tY(e,t,r);return n.unregisterOnNextCall=s,i?this._observers.unshift(n):this._observers.push(n),this._onObserverAdded&&this._onObserverAdded(n),this._hasNotified&&this.notifyIfTriggered&&void 0!==this._lastNotifiedValue&&this.notifyObserver(n,this._lastNotifiedValue),n._remove=()=>{this.remove(n)},n}addOnce(e){return this.add(e,void 0,void 0,void 0,!0)}remove(e){return!!e&&(e._remove=null,-1!==this._observers.indexOf(e)&&(this._deferUnregister(e),!0))}removeCallback(e,t){for(let i=0;i{this._remove(e)},0))}_remove(e,t=!0){if(!e)return!1;let i=this._observers.indexOf(e);return -1!==i&&(t&&this._numObserversMarkedAsDeleted--,this._observers.splice(i,1),!0)}makeObserverTopPriority(e){this._remove(e,!1),this._observers.unshift(e)}makeObserverBottomPriority(e){this._remove(e,!1),this._observers.push(e)}notifyObservers(e,t=-1,i,r,s){if(this.notifyIfTriggered&&(this._hasNotified=!0,this._lastNotifiedValue=e),!this._observers.length)return!0;let n=this._eventState;for(let a of(n.mask=t,n.target=i,n.currentTarget=r,n.skipNextObservers=!1,n.lastReturnValue=e,n.userInfo=s,this._observers))if(!a._willBeUnregistered&&(a.mask&t&&(a.unregisterOnNextCall&&this._deferUnregister(a),a.scope?n.lastReturnValue=a.callback.apply(a.scope,[e,n]):n.lastReturnValue=a.callback(e,n)),n.skipNextObservers))return!1;return!0}notifyObserver(e,t,i=-1){if(this.notifyIfTriggered&&(this._hasNotified=!0,this._lastNotifiedValue=t),e._willBeUnregistered)return;let r=this._eventState;r.mask=i,r.skipNextObservers=!1,e.unregisterOnNextCall&&this._deferUnregister(e),e.callback(t,r)}hasObservers(){return this._observers.length-this._numObserversMarkedAsDeleted>0}clear(){for(;this._observers.length;){let e=this._observers.pop();e&&(e._remove=null)}this._onObserverAdded=null,this._numObserversMarkedAsDeleted=0,this.cleanLastNotifiedState()}cleanLastNotifiedState(){this._hasNotified=!1,this._lastNotifiedValue=void 0}clone(){let e=new tj;return e._observers=this._observers.slice(0),e}hasSpecificMask(e=-1){for(let t of this._observers)if(t.mask&e||t.mask===e)return!0;return!1}}class tK{static WithinEpsilon(e,t,i=1401298e-51){return Math.abs(e-t)<=i}static ToHex(e){let t=e.toString(16);return e<=15?("0"+t).toUpperCase():t.toUpperCase()}static Sign(e){return 0==(e=+e)||isNaN(e)?e:e>0?1:-1}static Clamp(e,t=0,i=1){return Math.min(i,Math.max(t,e))}static Log2(e){return Math.log(e)*Math.LOG2E}static ILog2(e){if(Math.log2)return Math.floor(Math.log2(e));if(e<0)return NaN;if(0===e)return-1/0;let t=0;if(e<1){for(;e<1;)t++,e*=2;t=-t}else if(e>1)for(;e>1;)t++,e=Math.floor(e/2);return t}static Repeat(e,t){return e-Math.floor(e/t)*t}static Normalize(e,t,i){return(e-t)/(i-t)}static Denormalize(e,t,i){return e*(i-t)+t}static DeltaAngle(e,t){let i=tK.Repeat(t-e,360);return i>180&&(i-=360),i}static PingPong(e,t){let i=tK.Repeat(e,2*t);return t-Math.abs(i-t)}static SmoothStep(e,t,i){let r=tK.Clamp(i);return t*(r=-2*r*r*r+3*r*r)+e*(1-r)}static MoveTowards(e,t,i){return Math.abs(t-e)<=i?t:e+tK.Sign(t-e)*i}static MoveTowardsAngle(e,t,i){let r=tK.DeltaAngle(e,t),s=0;return-i180&&(r-=360),e+r*tK.Clamp(i)}static InverseLerp(e,t,i){return e!=t?tK.Clamp((i-e)/(t-e)):0}static Hermite(e,t,i,r,s){let n=s*s,a=s*n;return e*(2*a-3*n+1)+i*(-2*a+3*n)+t*(a-2*n+s)+r*(a-n)}static Hermite1stDerivative(e,t,i,r,s){let n=s*s;return(n-s)*6*e+(3*n-4*s+1)*t+(-n+s)*6*i+(3*n-2*s)*r}static RandomRange(e,t){return e===t?e:Math.random()*(t-e)+e}static RangeToPercent(e,t,i){return(e-t)/(i-t)}static PercentToRange(e,t,i){return(i-t)*e+t}static NormalizeRadians(e){return e-=tK.TwoPi*Math.floor((e+Math.PI)/tK.TwoPi)}static HCF(e,t){let i=e%t;return 0===i?t:tK.HCF(t,i)}}tK.TwoPi=2*Math.PI;let t$=1/2.2,tq=(1+Math.sqrt(5))/2;class tQ{static BuildArray(e,t){let i=[];for(let r=0;r(function(e,t,i){let r=e[t];if("function"!=typeof r)return null;let s=function(){let r=e.length,n=s.previous.apply(e,arguments);return i(t,r),n};return r.next=s,s.previous=r,e[t]=s,()=>{let i=s.previous;if(!i)return;let r=s.next;r?(i.next=r,r.previous=i):(i.next=void 0,e[t]=i),s.next=void 0,s.previous=void 0}})(e,i,t));return()=>{i.forEach(e=>{null==e||e()})}}let t0={};class t1{static SetMatrixPrecision(e){if(t1.MatrixTrackPrecisionChange=!1,e&&!t1.MatrixUse64Bits&&t1.MatrixTrackedMatrices)for(let e=0;eparseInt(e.toString().replace(/\W/g,""));class t4{constructor(e=0,t=0){this.x=e,this.y=t}toString(){return`{X: ${this.x} Y: ${this.y}}`}getClassName(){return"Vector2"}getHashCode(){let e=t3(this.x),t=t3(this.y);return 397*e^t}toArray(e,t=0){return e[t]=this.x,e[t+1]=this.y,this}fromArray(e,t=0){return t4.FromArrayToRef(e,t,this),this}asArray(){let e=[];return this.toArray(e,0),e}copyFrom(e){return this.x=e.x,this.y=e.y,this}copyFromFloats(e,t){return this.x=e,this.y=t,this}set(e,t){return this.copyFromFloats(e,t)}add(e){return new this.constructor(this.x+e.x,this.y+e.y)}addToRef(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,t}addInPlace(e){return this.x+=e.x,this.y+=e.y,this}addVector3(e){return new this.constructor(this.x+e.x,this.y+e.y)}subtract(e){return new this.constructor(this.x-e.x,this.y-e.y)}subtractToRef(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,t}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this}multiplyInPlace(e){return this.x*=e.x,this.y*=e.y,this}multiply(e){return new this.constructor(this.x*e.x,this.y*e.y)}multiplyToRef(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,t}multiplyByFloats(e,t){return new this.constructor(this.x*e,this.y*t)}divide(e){return new this.constructor(this.x/e.x,this.y/e.y)}divideToRef(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,t}divideInPlace(e){return this.divideToRef(e,this)}negate(){return new this.constructor(-this.x,-this.y)}negateInPlace(){return this.x*=-1,this.y*=-1,this}negateToRef(e){return e.copyFromFloats(-1*this.x,-1*this.y)}scaleInPlace(e){return this.x*=e,this.y*=e,this}scale(e){let t=new this.constructor(0,0);return this.scaleToRef(e,t),t}scaleToRef(e,t){return t.x=this.x*e,t.y=this.y*e,t}scaleAndAddToRef(e,t){return t.x+=this.x*e,t.y+=this.y*e,t}equals(e){return e&&this.x===e.x&&this.y===e.y}equalsWithEpsilon(e,t=.001){return e&&tK.WithinEpsilon(this.x,e.x,t)&&tK.WithinEpsilon(this.y,e.y,t)}floor(){return new this.constructor(Math.floor(this.x),Math.floor(this.y))}fract(){return new this.constructor(this.x-Math.floor(this.x),this.y-Math.floor(this.y))}rotateToRef(e,t){let i=Math.cos(e),r=Math.sin(e),s=i*this.x-r*this.y,n=r*this.x+i*this.y;return t.x=s,t.y=n,t}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.normalizeFromLength(this.length())}normalizeFromLength(e){return 0===e||1===e?this:this.scaleInPlace(1/e)}normalizeToNew(){let e=new this.constructor(0,0);return this.normalizeToRef(e),e}normalizeToRef(e){let t=this.length();return 0===t||1===t?e.copyFromFloats(this.x,this.y):this.scaleToRef(1/t,e)}clone(){return new this.constructor(this.x,this.y)}dot(e){return this.x*e.x+this.y*e.y}static Zero(){return new t4(0,0)}static One(){return new t4(1,1)}static Random(e=0,t=1){return new t4(tK.RandomRange(e,t),tK.RandomRange(e,t))}static get ZeroReadOnly(){return t4._ZeroReadOnly}static FromArray(e,t=0){return new t4(e[t],e[t+1])}static FromArrayToRef(e,t,i){return i.x=e[t],i.y=e[t+1],i}static CatmullRom(e,t,i,r,s){let n=s*s,a=s*n,o=.5*(2*t.x+(-e.x+i.x)*s+(2*e.x-5*t.x+4*i.x-r.x)*n+(-e.x+3*t.x-3*i.x+r.x)*a),l=.5*(2*t.y+(-e.y+i.y)*s+(2*e.y-5*t.y+4*i.y-r.y)*n+(-e.y+3*t.y-3*i.y+r.y)*a);return new e.constructor(o,l)}static Clamp(e,t,i){let r=e.x;r=(r=r>i.x?i.x:r)i.y?i.y:s)t.x?e.x:t.x,r=e.y>t.y?e.y:t.y;return new e.constructor(i,r)}static Transform(e,t){let i=new e.constructor;return t4.TransformToRef(e,t,i),i}static TransformToRef(e,t,i){let r=t.m,s=e.x*r[0]+e.y*r[4]+r[12],n=e.x*r[1]+e.y*r[5]+r[13];return i.x=s,i.y=n,i}static PointInTriangle(e,t,i,r){let s=.5*(-i.y*r.x+t.y*(-i.x+r.x)+t.x*(i.y-r.y)+i.x*r.y),n=s<0?-1:1,a=(t.y*r.x-t.x*r.y+(r.y-t.y)*e.x+(t.x-r.x)*e.y)*n,o=(t.x*i.y-t.y*i.x+(t.y-i.y)*e.x+(i.x-t.x)*e.y)*n;return a>0&&o>0&&a+o<2*s*n}static Distance(e,t){return Math.sqrt(t4.DistanceSquared(e,t))}static DistanceSquared(e,t){let i=e.x-t.x,r=e.y-t.y;return i*i+r*r}static Center(e,t){let i=new e.constructor;return t4.CenterToRef(e,t,i)}static CenterToRef(e,t,i){return i.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2)}static DistanceOfPointFromSegment(e,t,i){let r=t4.DistanceSquared(t,i);if(0===r)return t4.Distance(e,t);let s=i.subtract(t),n=Math.max(0,Math.min(1,t4.Dot(e.subtract(t),s)/r)),a=t.add(s.multiplyByFloats(n,n));return t4.Distance(e,a)}}t4._ZeroReadOnly=t4.Zero();class t5{get x(){return this._x}set x(e){this._x=e,this._isDirty=!0}get y(){return this._y}set y(e){this._y=e,this._isDirty=!0}get z(){return this._z}set z(e){this._z=e,this._isDirty=!0}constructor(e=0,t=0,i=0){this._isDirty=!0,this._x=e,this._y=t,this._z=i}toString(){return`{X: ${this._x} Y: ${this._y} Z: ${this._z}}`}getClassName(){return"Vector3"}getHashCode(){let e=t3(this._x),t=t3(this._y),i=t3(this._z),r=e;return 397*(r=397*r^t)^i}asArray(){let e=[];return this.toArray(e,0),e}toArray(e,t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,this}fromArray(e,t=0){return t5.FromArrayToRef(e,t,this),this}toQuaternion(){return t8.RotationYawPitchRoll(this._y,this._x,this._z)}addInPlace(e){return this.addInPlaceFromFloats(e._x,e._y,e._z)}addInPlaceFromFloats(e,t,i){return this._x+=e,this._y+=t,this._z+=i,this._isDirty=!0,this}add(e){return new this.constructor(this._x+e._x,this._y+e._y,this._z+e._z)}addToRef(e,t){return t.copyFromFloats(this._x+e._x,this._y+e._y,this._z+e._z)}subtractInPlace(e){return this._x-=e._x,this._y-=e._y,this._z-=e._z,this._isDirty=!0,this}subtract(e){return new this.constructor(this._x-e._x,this._y-e._y,this._z-e._z)}subtractToRef(e,t){return this.subtractFromFloatsToRef(e._x,e._y,e._z,t)}subtractFromFloats(e,t,i){return new this.constructor(this._x-e,this._y-t,this._z-i)}subtractFromFloatsToRef(e,t,i,r){return r.copyFromFloats(this._x-e,this._y-t,this._z-i)}negate(){return new this.constructor(-this._x,-this._y,-this._z)}negateInPlace(){return this._x*=-1,this._y*=-1,this._z*=-1,this._isDirty=!0,this}negateToRef(e){return e.copyFromFloats(-1*this._x,-1*this._y,-1*this._z)}scaleInPlace(e){return this._x*=e,this._y*=e,this._z*=e,this._isDirty=!0,this}scale(e){return new this.constructor(this._x*e,this._y*e,this._z*e)}scaleToRef(e,t){return t.copyFromFloats(this._x*e,this._y*e,this._z*e)}getNormalToRef(e){let t=this.length(),i=Math.acos(this.y/t),r=Math.atan2(this.z,this.x);i>Math.PI/2?i-=Math.PI/2:i+=Math.PI/2;let s=t*Math.sin(i)*Math.cos(r),n=t*Math.cos(i),a=t*Math.sin(i)*Math.sin(r);return e.set(s,n,a),e}applyRotationQuaternionToRef(e,t){let i=this._x,r=this._y,s=this._z,n=e._x,a=e._y,o=e._z,l=e._w,h=2*(a*s-o*r),u=2*(o*i-n*s),c=2*(n*r-a*i);return t._x=i+l*h+a*c-o*u,t._y=r+l*u+o*h-n*c,t._z=s+l*c+n*u-a*h,t._isDirty=!0,t}applyRotationQuaternionInPlace(e){return this.applyRotationQuaternionToRef(e,this)}applyRotationQuaternion(e){return this.applyRotationQuaternionToRef(e,new this.constructor)}scaleAndAddToRef(e,t){return t.addInPlaceFromFloats(this._x*e,this._y*e,this._z*e)}projectOnPlane(e,t){let i=new this.constructor;return this.projectOnPlaneToRef(e,t,i),i}projectOnPlaneToRef(e,t,i){let r=e.normal,s=e.d,n=t9.Vector3[0];this.subtractToRef(t,n),n.normalize();let a=t5.Dot(n,r);if(1e-10>Math.abs(a))i.setAll(1/0);else{let e=-(t5.Dot(t,r)+s)/a,o=n.scaleInPlace(e);t.addToRef(o,i)}return i}equals(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z}equalsWithEpsilon(e,t=.001){return e&&tK.WithinEpsilon(this._x,e._x,t)&&tK.WithinEpsilon(this._y,e._y,t)&&tK.WithinEpsilon(this._z,e._z,t)}equalsToFloats(e,t,i){return this._x===e&&this._y===t&&this._z===i}multiplyInPlace(e){return this._x*=e._x,this._y*=e._y,this._z*=e._z,this._isDirty=!0,this}multiply(e){return this.multiplyByFloats(e._x,e._y,e._z)}multiplyToRef(e,t){return t.copyFromFloats(this._x*e._x,this._y*e._y,this._z*e._z)}multiplyByFloats(e,t,i){return new this.constructor(this._x*e,this._y*t,this._z*i)}divide(e){return new this.constructor(this._x/e._x,this._y/e._y,this._z/e._z)}divideToRef(e,t){return t.copyFromFloats(this._x/e._x,this._y/e._y,this._z/e._z)}divideInPlace(e){return this.divideToRef(e,this)}minimizeInPlace(e){return this.minimizeInPlaceFromFloats(e._x,e._y,e._z)}maximizeInPlace(e){return this.maximizeInPlaceFromFloats(e._x,e._y,e._z)}minimizeInPlaceFromFloats(e,t,i){return ethis._x&&(this.x=e),t>this._y&&(this.y=t),i>this._z&&(this.z=i),this}isNonUniformWithinEpsilon(e){let t=Math.abs(this._x),i=Math.abs(this._y);if(!tK.WithinEpsilon(t,i,e))return!0;let r=Math.abs(this._z);return!(tK.WithinEpsilon(t,r,e)&&tK.WithinEpsilon(i,r,e))}get isNonUniform(){let e=Math.abs(this._x);return e!==Math.abs(this._y)||e!==Math.abs(this._z)}floor(){return new this.constructor(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))}fract(){return new this.constructor(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z))}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z)}lengthSquared(){return this._x*this._x+this._y*this._y+this._z*this._z}get hasAZeroComponent(){return this._x*this._y*this._z==0}normalize(){return this.normalizeFromLength(this.length())}reorderInPlace(e){if("xyz"===(e=e.toLowerCase()))return this;let t=t9.Vector3[0].copyFrom(this);return this.x=t[e[0]],this.y=t[e[1]],this.z=t[e[2]],this}rotateByQuaternionToRef(e,t){return e.toRotationMatrix(t9.Matrix[0]),t5.TransformCoordinatesToRef(this,t9.Matrix[0],t),t}rotateByQuaternionAroundPointToRef(e,t,i){return this.subtractToRef(t,t9.Vector3[0]),t9.Vector3[0].rotateByQuaternionToRef(e,t9.Vector3[0]),t.addToRef(t9.Vector3[0],i),i}cross(e){let t=new this.constructor;return t5.CrossToRef(this,e,t)}normalizeFromLength(e){return 0===e||1===e?this:this.scaleInPlace(1/e)}normalizeToNew(){let e=new this.constructor(0,0,0);return this.normalizeToRef(e),e}normalizeToRef(e){let t=this.length();return 0===t||1===t?e.copyFromFloats(this._x,this._y,this._z):this.scaleToRef(1/t,e)}clone(){return new this.constructor(this._x,this._y,this._z)}copyFrom(e){return this.copyFromFloats(e._x,e._y,e._z)}copyFromFloats(e,t,i){return this._x=e,this._y=t,this._z=i,this._isDirty=!0,this}set(e,t,i){return this.copyFromFloats(e,t,i)}setAll(e){return this._x=this._y=this._z=e,this._isDirty=!0,this}static GetClipFactor(e,t,i,r){let s=t5.Dot(e,i);return(s-r)/(s-t5.Dot(t,i))}static GetAngleBetweenVectors(e,t,i){let r=e.normalizeToRef(t9.Vector3[1]),s=t.normalizeToRef(t9.Vector3[2]),n=t5.Dot(r,s),a=Math.acos(n=tK.Clamp(n,-1,1)),o=t9.Vector3[3];return(t5.CrossToRef(r,s,o),t5.Dot(o,i)>0)?isNaN(a)?0:a:isNaN(a)?-Math.PI:-Math.acos(n)}static GetAngleBetweenVectorsOnPlane(e,t,i){t9.Vector3[0].copyFrom(e);let r=t9.Vector3[0];t9.Vector3[1].copyFrom(t);let s=t9.Vector3[1];t9.Vector3[2].copyFrom(i);let n=t9.Vector3[2],a=t9.Vector3[3],o=t9.Vector3[4];r.normalize(),s.normalize(),n.normalize(),t5.CrossToRef(n,r,a),t5.CrossToRef(a,n,o);let l=Math.atan2(t5.Dot(s,a),t5.Dot(s,o));return tK.NormalizeRadians(l)}static PitchYawRollToMoveBetweenPointsToRef(e,t,i){let r=ie.Vector3[0];return t.subtractToRef(e,r),i._y=Math.atan2(r.x,r.z)||0,i._x=Math.atan2(Math.sqrt(r.x**2+r.z**2),r.y)||0,i._z=0,i._isDirty=!0,i}static PitchYawRollToMoveBetweenPoints(e,t){let i=t5.Zero();return t5.PitchYawRollToMoveBetweenPointsToRef(e,t,i)}static SlerpToRef(e,t,i,r){let s,n;i=tK.Clamp(i,0,1);let a=t9.Vector3[0],o=t9.Vector3[1];a.copyFrom(e);let l=a.length();a.normalizeFromLength(l),o.copyFrom(t);let h=o.length();o.normalizeFromLength(h);let u=t5.Dot(a,o);if(u<.999){let e=Math.acos(u),t=1/Math.sin(e);s=Math.sin((1-i)*e)*t,n=Math.sin(i*e)*t}else s=1-i,n=i;return a.scaleInPlace(s),o.scaleInPlace(n),r.copyFrom(a).addInPlace(o),r.scaleInPlace(tK.Lerp(l,h,i)),r}static SmoothToRef(e,t,i,r,s){return t5.SlerpToRef(e,t,0===r?1:i/r,s),s}static FromArray(e,t=0){return new t5(e[t],e[t+1],e[t+2])}static FromFloatArray(e,t){return t5.FromArray(e,t)}static FromArrayToRef(e,t,i){return i._x=e[t],i._y=e[t+1],i._z=e[t+2],i._isDirty=!0,i}static FromFloatArrayToRef(e,t,i){return t5.FromArrayToRef(e,t,i)}static FromFloatsToRef(e,t,i,r){return r.copyFromFloats(e,t,i),r}static Zero(){return new t5(0,0,0)}static One(){return new t5(1,1,1)}static Up(){return new t5(0,1,0)}static get UpReadOnly(){return t5._UpReadOnly}static get DownReadOnly(){return t5._DownReadOnly}static get RightReadOnly(){return t5._RightReadOnly}static get LeftReadOnly(){return t5._LeftReadOnly}static get LeftHandedForwardReadOnly(){return t5._LeftHandedForwardReadOnly}static get RightHandedForwardReadOnly(){return t5._RightHandedForwardReadOnly}static get LeftHandedBackwardReadOnly(){return t5._LeftHandedBackwardReadOnly}static get RightHandedBackwardReadOnly(){return t5._RightHandedBackwardReadOnly}static get ZeroReadOnly(){return t5._ZeroReadOnly}static get OneReadOnly(){return t5._OneReadOnly}static Down(){return new t5(0,-1,0)}static Forward(e=!1){return new t5(0,0,e?-1:1)}static Backward(e=!1){return new t5(0,0,e?1:-1)}static Right(){return new t5(1,0,0)}static Left(){return new t5(-1,0,0)}static Random(e=0,t=1){return new t5(tK.RandomRange(e,t),tK.RandomRange(e,t),tK.RandomRange(e,t))}static TransformCoordinates(e,t){let i=t5.Zero();return t5.TransformCoordinatesToRef(e,t,i),i}static TransformCoordinatesToRef(e,t,i){return t5.TransformCoordinatesFromFloatsToRef(e._x,e._y,e._z,t,i),i}static TransformCoordinatesFromFloatsToRef(e,t,i,r,s){let n=r.m,a=e*n[0]+t*n[4]+i*n[8]+n[12],o=e*n[1]+t*n[5]+i*n[9]+n[13],l=e*n[2]+t*n[6]+i*n[10]+n[14],h=1/(e*n[3]+t*n[7]+i*n[11]+n[15]);return s._x=a*h,s._y=o*h,s._z=l*h,s._isDirty=!0,s}static TransformNormal(e,t){let i=t5.Zero();return t5.TransformNormalToRef(e,t,i),i}static TransformNormalToRef(e,t,i){return this.TransformNormalFromFloatsToRef(e._x,e._y,e._z,t,i),i}static TransformNormalFromFloatsToRef(e,t,i,r,s){let n=r.m;return s._x=e*n[0]+t*n[4]+i*n[8],s._y=e*n[1]+t*n[5]+i*n[9],s._z=e*n[2]+t*n[6]+i*n[10],s._isDirty=!0,s}static CatmullRom(e,t,i,r,s){let n=s*s,a=s*n,o=.5*(2*t._x+(-e._x+i._x)*s+(2*e._x-5*t._x+4*i._x-r._x)*n+(-e._x+3*t._x-3*i._x+r._x)*a),l=.5*(2*t._y+(-e._y+i._y)*s+(2*e._y-5*t._y+4*i._y-r._y)*n+(-e._y+3*t._y-3*i._y+r._y)*a),h=.5*(2*t._z+(-e._z+i._z)*s+(2*e._z-5*t._z+4*i._z-r._z)*n+(-e._z+3*t._z-3*i._z+r._z)*a);return new e.constructor(o,l,h)}static Clamp(e,t,i){let r=new e.constructor;return t5.ClampToRef(e,t,i,r),r}static ClampToRef(e,t,i,r){let s=e._x;s=(s=s>i._x?i._x:s)i._y?i._y:n)i._z?i._z:a)0&&A<0?(I.copyFrom(o),n=t,a=i):A>0&&R<0?(I.copyFrom(h),n=i,a=r):(I.copyFrom(l).scaleInPlace(-1),n=r,a=t);let P=t9.Vector3[9],M=t9.Vector3[4];if(n.subtractToRef(x,S),a.subtractToRef(x,P),t5.CrossToRef(S,P,M),!(0>t5.Dot(M,u)))return s.copyFrom(x),Math.abs(m*g);let D=t9.Vector3[5];t5.CrossToRef(I,M,D),D.normalize();let O=t9.Vector3[9];O.copyFrom(n).subtractInPlace(x);let N=O.length();if(N<.001)return s.copyFrom(n),t5.Distance(e,n);O.normalizeFromLength(N);let F=t5.Dot(D,O),w=t9.Vector3[7];w.copyFrom(x).addInPlace(D.scaleInPlace(N*F)),S.copyFrom(w).subtractInPlace(n),m=I.length(),I.normalizeFromLength(m);let L=t5.Dot(S,I)/Math.max(m,.001);return L=tK.Clamp(L,0,1),w.copyFrom(n).addInPlace(I.scaleInPlace(L*m)),s.copyFrom(w),t5.Distance(e,w)}static Center(e,t){return t5.CenterToRef(e,t,t5.Zero())}static CenterToRef(e,t,i){return i.copyFromFloats((e._x+t._x)/2,(e._y+t._y)/2,(e._z+t._z)/2)}static RotationFromAxis(e,t,i){let r=new e.constructor;return t5.RotationFromAxisToRef(e,t,i,r),r}static RotationFromAxisToRef(e,t,i,r){let s=t9.Quaternion[0];return t8.RotationQuaternionFromAxisToRef(e,t,i,s),s.toEulerAnglesToRef(r),r}}t5._UpReadOnly=t5.Up(),t5._DownReadOnly=t5.Down(),t5._LeftHandedForwardReadOnly=t5.Forward(!1),t5._RightHandedForwardReadOnly=t5.Forward(!0),t5._LeftHandedBackwardReadOnly=t5.Backward(!1),t5._RightHandedBackwardReadOnly=t5.Backward(!0),t5._RightReadOnly=t5.Right(),t5._LeftReadOnly=t5.Left(),t5._ZeroReadOnly=t5.Zero(),t5._OneReadOnly=t5.One();class t6{constructor(e=0,t=0,i=0,r=0){this.x=e,this.y=t,this.z=i,this.w=r}toString(){return`{X: ${this.x} Y: ${this.y} Z: ${this.z} W: ${this.w}}`}getClassName(){return"Vector4"}getHashCode(){let e=t3(this.x),t=t3(this.y),i=t3(this.z),r=t3(this.w),s=e;return 397*(s=397*(s=397*s^t)^i)^r}asArray(){let e=[];return this.toArray(e,0),e}toArray(e,t){return void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,this}fromArray(e,t=0){return t6.FromArrayToRef(e,t,this),this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}add(e){return new this.constructor(this.x+e.x,this.y+e.y,this.z+e.z,this.w+e.w)}addToRef(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,t.z=this.z+e.z,t.w=this.w+e.w,t}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subtract(e){return new this.constructor(this.x-e.x,this.y-e.y,this.z-e.z,this.w-e.w)}subtractToRef(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,t.z=this.z-e.z,t.w=this.w-e.w,t}subtractFromFloats(e,t,i,r){return new this.constructor(this.x-e,this.y-t,this.z-i,this.w-r)}subtractFromFloatsToRef(e,t,i,r,s){return s.x=this.x-e,s.y=this.y-t,s.z=this.z-i,s.w=this.w-r,s}negate(){return new this.constructor(-this.x,-this.y,-this.z,-this.w)}negateInPlace(){return this.x*=-1,this.y*=-1,this.z*=-1,this.w*=-1,this}negateToRef(e){return e.copyFromFloats(-1*this.x,-1*this.y,-1*this.z,-1*this.w)}scaleInPlace(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}scale(e){return new this.constructor(this.x*e,this.y*e,this.z*e,this.w*e)}scaleToRef(e,t){return t.x=this.x*e,t.y=this.y*e,t.z=this.z*e,t.w=this.w*e,t}scaleAndAddToRef(e,t){return t.x+=this.x*e,t.y+=this.y*e,t.z+=this.z*e,t.w+=this.w*e,t}equals(e){return e&&this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w}equalsWithEpsilon(e,t=.001){return e&&tK.WithinEpsilon(this.x,e.x,t)&&tK.WithinEpsilon(this.y,e.y,t)&&tK.WithinEpsilon(this.z,e.z,t)&&tK.WithinEpsilon(this.w,e.w,t)}equalsToFloats(e,t,i,r){return this.x===e&&this.y===t&&this.z===i&&this.w===r}multiplyInPlace(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiply(e){return new this.constructor(this.x*e.x,this.y*e.y,this.z*e.z,this.w*e.w)}multiplyToRef(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,t.z=this.z*e.z,t.w=this.w*e.w,t}multiplyByFloats(e,t,i,r){return new this.constructor(this.x*e,this.y*t,this.z*i,this.w*r)}divide(e){return new this.constructor(this.x/e.x,this.y/e.y,this.z/e.z,this.w/e.w)}divideToRef(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,t.z=this.z/e.z,t.w=this.w/e.w,t}divideInPlace(e){return this.divideToRef(e,this)}minimizeInPlace(e){return e.xthis.x&&(this.x=e.x),e.y>this.y&&(this.y=e.y),e.z>this.z&&(this.z=e.z),e.w>this.w&&(this.w=e.w),this}floor(){return new this.constructor(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z),Math.floor(this.w))}fract(){return new this.constructor(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z),this.w-Math.floor(this.w))}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}normalize(){return this.normalizeFromLength(this.length())}normalizeFromLength(e){return 0===e||1===e?this:this.scaleInPlace(1/e)}normalizeToNew(){let e=new this.constructor(0,0,0,0);return this.normalizeToRef(e),e}normalizeToRef(e){let t=this.length();return 0===t||1===t?e.copyFromFloats(this.x,this.y,this.z,this.w):this.scaleToRef(1/t,e)}toVector3(){return new t5(this.x,this.y,this.z)}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copyFrom(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}copyFromFloats(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}set(e,t,i,r){return this.copyFromFloats(e,t,i,r)}setAll(e){return this.x=this.y=this.z=this.w=e,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}static FromArray(e,t){return t||(t=0),new t6(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t,i){return i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3],i}static FromFloatArrayToRef(e,t,i){return t6.FromArrayToRef(e,t,i),i}static FromFloatsToRef(e,t,i,r,s){return s.x=e,s.y=t,s.z=i,s.w=r,s}static Zero(){return new t6(0,0,0,0)}static One(){return new t6(1,1,1,1)}static Random(e=0,t=1){return new t6(tK.RandomRange(e,t),tK.RandomRange(e,t),tK.RandomRange(e,t),tK.RandomRange(e,t))}static get ZeroReadOnly(){return t6._ZeroReadOnly}static Normalize(e){let t=t6.Zero();return t6.NormalizeToRef(e,t),t}static NormalizeToRef(e,t){return e.normalizeToRef(t),t}static Minimize(e,t){let i=new e.constructor;return i.copyFrom(e),i.minimizeInPlace(t),i}static Maximize(e,t){let i=new e.constructor;return i.copyFrom(e),i.maximizeInPlace(t),i}static Distance(e,t){return Math.sqrt(t6.DistanceSquared(e,t))}static DistanceSquared(e,t){let i=e.x-t.x,r=e.y-t.y,s=e.z-t.z,n=e.w-t.w;return i*i+r*r+s*s+n*n}static Center(e,t){return t6.CenterToRef(e,t,t6.Zero())}static CenterToRef(e,t,i){return i.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2,(e.w+t.w)/2)}static TransformCoordinates(e,t){let i=t6.Zero();return t6.TransformCoordinatesToRef(e,t,i),i}static TransformCoordinatesToRef(e,t,i){return t6.TransformCoordinatesFromFloatsToRef(e._x,e._y,e._z,t,i),i}static TransformCoordinatesFromFloatsToRef(e,t,i,r,s){let n=r.m,a=e*n[0]+t*n[4]+i*n[8]+n[12],o=e*n[1]+t*n[5]+i*n[9]+n[13],l=e*n[2]+t*n[6]+i*n[10]+n[14],h=e*n[3]+t*n[7]+i*n[11]+n[15];return s.x=a,s.y=o,s.z=l,s.w=h,s}static TransformNormal(e,t){let i=new e.constructor;return t6.TransformNormalToRef(e,t,i),i}static TransformNormalToRef(e,t,i){let r=t.m,s=e.x*r[0]+e.y*r[4]+e.z*r[8],n=e.x*r[1]+e.y*r[5]+e.z*r[9],a=e.x*r[2]+e.y*r[6]+e.z*r[10];return i.x=s,i.y=n,i.z=a,i.w=e.w,i}static TransformNormalFromFloatsToRef(e,t,i,r,s,n){let a=s.m;return n.x=e*a[0]+t*a[4]+i*a[8],n.y=e*a[1]+t*a[5]+i*a[9],n.z=e*a[2]+t*a[6]+i*a[10],n.w=r,n}static FromVector3(e,t=0){return new t6(e._x,e._y,e._z,t)}static Dot(e,t){return e.dot(t)}}t6._ZeroReadOnly=t6.Zero();class t8{get x(){return this._x}set x(e){this._x=e,this._isDirty=!0}get y(){return this._y}set y(e){this._y=e,this._isDirty=!0}get z(){return this._z}set z(e){this._z=e,this._isDirty=!0}get w(){return this._w}set w(e){this._w=e,this._isDirty=!0}constructor(e=0,t=0,i=0,r=1){this._isDirty=!0,this._x=e,this._y=t,this._z=i,this._w=r}toString(){return`{X: ${this._x} Y: ${this._y} Z: ${this._z} W: ${this._w}}`}getClassName(){return"Quaternion"}getHashCode(){let e=t3(this._x),t=t3(this._y),i=t3(this._z),r=t3(this._w),s=e;return 397*(s=397*(s=397*s^t)^i)^r}asArray(){return[this._x,this._y,this._z,this._w]}toArray(e,t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,this}equals(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z&&this._w===e._w}equalsWithEpsilon(e,t=.001){return e&&tK.WithinEpsilon(this._x,e._x,t)&&tK.WithinEpsilon(this._y,e._y,t)&&tK.WithinEpsilon(this._z,e._z,t)&&tK.WithinEpsilon(this._w,e._w,t)}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copyFrom(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._w=e._w,this._isDirty=!0,this}copyFromFloats(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._isDirty=!0,this}set(e,t,i,r){return this.copyFromFloats(e,t,i,r)}add(e){return new this.constructor(this._x+e._x,this._y+e._y,this._z+e._z,this._w+e._w)}addInPlace(e){return this._x+=e._x,this._y+=e._y,this._z+=e._z,this._w+=e._w,this._isDirty=!0,this}subtract(e){return new this.constructor(this._x-e._x,this._y-e._y,this._z-e._z,this._w-e._w)}subtractInPlace(e){return this._x-=e._x,this._y-=e._y,this._z-=e._z,this._w-=e._w,this._isDirty=!0,this}scale(e){return new this.constructor(this._x*e,this._y*e,this._z*e,this._w*e)}scaleToRef(e,t){return t._x=this._x*e,t._y=this._y*e,t._z=this._z*e,t._w=this._w*e,t._isDirty=!0,t}scaleInPlace(e){return this._x*=e,this._y*=e,this._z*=e,this._w*=e,this._isDirty=!0,this}scaleAndAddToRef(e,t){return t._x+=this._x*e,t._y+=this._y*e,t._z+=this._z*e,t._w+=this._w*e,t._isDirty=!0,t}multiply(e){let t=new this.constructor(0,0,0,1);return this.multiplyToRef(e,t),t}multiplyToRef(e,t){let i=this._x*e._w+this._y*e._z-this._z*e._y+this._w*e._x,r=-this._x*e._z+this._y*e._w+this._z*e._x+this._w*e._y,s=this._x*e._y-this._y*e._x+this._z*e._w+this._w*e._z,n=-this._x*e._x-this._y*e._y-this._z*e._z+this._w*e._w;return t.copyFromFloats(i,r,s,n),t}multiplyInPlace(e){return this.multiplyToRef(e,this),this}conjugateToRef(e){return e.copyFromFloats(-this._x,-this._y,-this._z,this._w),e}conjugateInPlace(){return this._x*=-1,this._y*=-1,this._z*=-1,this._isDirty=!0,this}conjugate(){return new this.constructor(-this._x,-this._y,-this._z,this._w)}invert(){let e=this.conjugate(),t=this.lengthSquared();return 0==t||1==t||e.scaleInPlace(1/t),e}invertInPlace(){this.conjugateInPlace();let e=this.lengthSquared();return 0==e||1==e||this.scaleInPlace(1/e),this}lengthSquared(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this.lengthSquared())}normalize(){return this.normalizeFromLength(this.length())}normalizeFromLength(e){return 0===e||1===e?this:this.scaleInPlace(1/e)}normalizeToNew(){let e=new this.constructor(0,0,0,1);return this.normalizeToRef(e),e}normalizeToRef(e){let t=this.length();return 0===t||1===t?e.copyFromFloats(this._x,this._y,this._z,this._w):this.scaleToRef(1/t,e)}toEulerAngles(){let e=t5.Zero();return this.toEulerAnglesToRef(e),e}toEulerAnglesToRef(e){let t=this._z,i=this._x,r=this._y,s=this._w,n=r*t-i*s;if(n<-.4999999)e._y=2*Math.atan2(r,s),e._x=Math.PI/2,e._z=0,e._isDirty=!0;else if(n>.4999999)e._y=2*Math.atan2(r,s),e._x=-Math.PI/2,e._z=0,e._isDirty=!0;else{let a=s*s,o=t*t,l=i*i,h=r*r;e._z=Math.atan2(2*(i*r+t*s),-o-l+h+a),e._x=Math.asin(-2*n),e._y=Math.atan2(2*(t*i+r*s),o-l-h+a),e._isDirty=!0}return e}toRotationMatrix(e){return t7.FromQuaternionToRef(this,e),e}fromRotationMatrix(e){return t8.FromRotationMatrixToRef(e,this),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}static FromRotationMatrix(e){let t=new t8;return t8.FromRotationMatrixToRef(e,t),t}static FromRotationMatrixToRef(e,t){let i;let r=e.m,s=r[0],n=r[4],a=r[8],o=r[1],l=r[5],h=r[9],u=r[2],c=r[6],d=r[10],p=s+l+d;return p>0?(i=.5/Math.sqrt(p+1),t._w=.25/i,t._x=(c-h)*i,t._y=(a-u)*i,t._z=(o-n)*i):s>l&&s>d?(i=2*Math.sqrt(1+s-l-d),t._w=(c-h)/i,t._x=.25*i,t._y=(n+o)/i,t._z=(a+u)/i):l>d?(i=2*Math.sqrt(1+l-s-d),t._w=(a-u)/i,t._x=(n+o)/i,t._y=.25*i,t._z=(h+c)/i):(i=2*Math.sqrt(1+d-s-l),t._w=(o-n)/i,t._x=(a+u)/i,t._y=(h+c)/i,t._z=.25*i),t._isDirty=!0,t}static Dot(e,t){return e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w}static AreClose(e,t,i=.1){let r=t8.Dot(e,t);return 1-r*r<=i}static SmoothToRef(e,t,i,r,s){let n=0===r?1:i/r;return n=tK.Clamp(n,0,1),t8.SlerpToRef(e,t,n,s),s}static Zero(){return new t8(0,0,0,0)}static Inverse(e){return new e.constructor(-e._x,-e._y,-e._z,e._w)}static InverseToRef(e,t){return t.set(-e._x,-e._y,-e._z,e._w),t}static Identity(){return new t8(0,0,0,1)}static IsIdentity(e){return e&&0===e._x&&0===e._y&&0===e._z&&1===e._w}static RotationAxis(e,t){return t8.RotationAxisToRef(e,t,new t8)}static RotationAxisToRef(e,t,i){let r=Math.sin(t/2);return e.normalize(),i._w=Math.cos(t/2),i._x=e._x*r,i._y=e._y*r,i._z=e._z*r,i._isDirty=!0,i}static FromArray(e,t){return t||(t=0),new t8(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t,i){return i._x=e[t],i._y=e[t+1],i._z=e[t+2],i._w=e[t+3],i._isDirty=!0,i}static FromEulerAngles(e,t,i){let r=new t8;return t8.RotationYawPitchRollToRef(t,e,i,r),r}static FromEulerAnglesToRef(e,t,i,r){return t8.RotationYawPitchRollToRef(t,e,i,r),r}static FromEulerVector(e){let t=new t8;return t8.RotationYawPitchRollToRef(e._y,e._x,e._z,t),t}static FromEulerVectorToRef(e,t){return t8.RotationYawPitchRollToRef(e._y,e._x,e._z,t),t}static FromUnitVectorsToRef(e,t,i,r=.001){let s=t5.Dot(e,t)+1;return sMath.abs(e.z)?i.set(-e.y,e.x,0,0):i.set(0,-e.z,e.y,0):(t5.CrossToRef(e,t,ie.Vector3[0]),i.set(ie.Vector3[0].x,ie.Vector3[0].y,ie.Vector3[0].z,s)),i.normalize()}static RotationYawPitchRoll(e,t,i){let r=new t8;return t8.RotationYawPitchRollToRef(e,t,i,r),r}static RotationYawPitchRollToRef(e,t,i,r){let s=.5*i,n=.5*t,a=.5*e,o=Math.sin(s),l=Math.cos(s),h=Math.sin(n),u=Math.cos(n),c=Math.sin(a),d=Math.cos(a);return r._x=d*h*l+c*u*o,r._y=c*u*l-d*h*o,r._z=d*u*o-c*h*l,r._w=d*u*l+c*h*o,r._isDirty=!0,r}static RotationAlphaBetaGamma(e,t,i){let r=new t8;return t8.RotationAlphaBetaGammaToRef(e,t,i,r),r}static RotationAlphaBetaGammaToRef(e,t,i,r){let s=(i+e)*.5,n=(i-e)*.5,a=.5*t;return r._x=Math.cos(n)*Math.sin(a),r._y=Math.sin(n)*Math.sin(a),r._z=Math.sin(s)*Math.cos(a),r._w=Math.cos(s)*Math.cos(a),r._isDirty=!0,r}static RotationQuaternionFromAxis(e,t,i){let r=new t8(0,0,0,0);return t8.RotationQuaternionFromAxisToRef(e,t,i,r),r}static RotationQuaternionFromAxisToRef(e,t,i,r){let s=t9.Matrix[0];return t7.FromXYZAxesToRef(e.normalize(),t.normalize(),i.normalize(),s),t8.FromRotationMatrixToRef(s,r),r}static FromLookDirectionLH(e,t){let i=new t8;return t8.FromLookDirectionLHToRef(e,t,i),i}static FromLookDirectionLHToRef(e,t,i){let r=t9.Matrix[0];return t7.LookDirectionLHToRef(e,t,r),t8.FromRotationMatrixToRef(r,i),i}static FromLookDirectionRH(e,t){let i=new t8;return t8.FromLookDirectionRHToRef(e,t,i),i}static FromLookDirectionRHToRef(e,t,i){let r=t9.Matrix[0];return t7.LookDirectionRHToRef(e,t,r),t8.FromRotationMatrixToRef(r,i)}static Slerp(e,t,i){let r=t8.Identity();return t8.SlerpToRef(e,t,i,r),r}static SlerpToRef(e,t,i,r){let s,n;let a=e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w,o=!1;if(a<0&&(o=!0,a=-a),a>.999999)n=1-i,s=o?-i:i;else{let e=Math.acos(a),t=1/Math.sin(e);n=Math.sin((1-i)*e)*t,s=o?-Math.sin(i*e)*t:Math.sin(i*e)*t}return r._x=n*e._x+s*t._x,r._y=n*e._y+s*t._y,r._z=n*e._z+s*t._z,r._w=n*e._w+s*t._w,r._isDirty=!0,r}static Hermite(e,t,i,r,s){let n=s*s,a=s*n,o=2*a-3*n+1,l=-2*a+3*n,h=a-2*n+s,u=a-n,c=e._x*o+i._x*l+t._x*h+r._x*u,d=e._y*o+i._y*l+t._y*h+r._y*u,p=e._z*o+i._z*l+t._z*h+r._z*u,_=e._w*o+i._w*l+t._w*h+r._w*u;return new e.constructor(c,d,p,_)}static Hermite1stDerivative(e,t,i,r,s){let n=new e.constructor;return this.Hermite1stDerivativeToRef(e,t,i,r,s,n),n}static Hermite1stDerivativeToRef(e,t,i,r,s,n){let a=s*s;return n._x=(a-s)*6*e._x+(3*a-4*s+1)*t._x+(-a+s)*6*i._x+(3*a-2*s)*r._x,n._y=(a-s)*6*e._y+(3*a-4*s+1)*t._y+(-a+s)*6*i._y+(3*a-2*s)*r._y,n._z=(a-s)*6*e._z+(3*a-4*s+1)*t._z+(-a+s)*6*i._z+(3*a-2*s)*r._z,n._w=(a-s)*6*e._w+(3*a-4*s+1)*t._w+(-a+s)*6*i._w+(3*a-2*s)*r._w,n._isDirty=!0,n}static Normalize(e){let t=t8.Zero();return t8.NormalizeToRef(e,t),t}static NormalizeToRef(e,t){return e.normalizeToRef(t),t}}class t7{static get Use64Bits(){return t1.MatrixUse64Bits}get m(){return this._m}markAsUpdated(){this.updateFlag=t7._UpdateFlagSeed++,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0}_updateIdentityStatus(e,t=!1,i=!1,r=!0){this._isIdentity=e,this._isIdentity3x2=e||i,this._isIdentityDirty=!this._isIdentity&&t,this._isIdentity3x2Dirty=!this._isIdentity3x2&&r}constructor(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this.updateFlag=-1,t1.MatrixTrackPrecisionChange&&t1.MatrixTrackedMatrices.push(this),this._m=new t1.MatrixCurrentType(16),this.markAsUpdated()}isIdentity(){if(this._isIdentityDirty){this._isIdentityDirty=!1;let e=this._m;this._isIdentity=1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]}return this._isIdentity}isIdentityAs3x2(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,1!==this._m[0]||1!==this._m[5]||1!==this._m[15]?this._isIdentity3x2=!1:0!==this._m[1]||0!==this._m[2]||0!==this._m[3]||0!==this._m[4]||0!==this._m[6]||0!==this._m[7]||0!==this._m[8]||0!==this._m[9]||0!==this._m[10]||0!==this._m[11]||0!==this._m[12]||0!==this._m[13]||0!==this._m[14]?this._isIdentity3x2=!1:this._isIdentity3x2=!0),this._isIdentity3x2}determinant(){if(!0===this._isIdentity)return 1;let e=this._m,t=e[0],i=e[1],r=e[2],s=e[3],n=e[4],a=e[5],o=e[6],l=e[7],h=e[8],u=e[9],c=e[10],d=e[11],p=e[12],_=e[13],f=e[14],m=e[15],g=c*m-f*d,v=u*m-_*d,x=u*f-_*c,T=h*m-p*d,b=h*f-c*p,E=h*_-p*u;return t*+(a*g-o*v+l*x)+-(i*(n*g-o*T+l*b))+r*+(n*v-a*T+l*E)+-(s*(n*x-a*b+o*E))}toString(){return`{${this.m[0]}, ${this.m[1]}, ${this.m[2]}, ${this.m[3]}
+(()=>{var e={};e.id=514,e.ids=[514],e.modules={7849:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external")},2934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},5403:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external")},4580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},4749:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external")},5869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},1017:e=>{"use strict";e.exports=require("path")},7310:e=>{"use strict";e.exports=require("url")},8899:(e,t,i)=>{"use strict";i.r(t),i.d(t,{GlobalError:()=>a.a,__next_app__:()=>d,originalPathname:()=>c,pages:()=>u,routeModule:()=>p,tree:()=>h});var r=i(482),s=i(9108),n=i(2563),a=i.n(n),o=i(8300),l={};for(let e in o)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(l[e]=()=>o[e]);i.d(t,l);let h=["",{children:["space",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(i.bind(i,926)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\space\\page.tsx"]}]},{loading:[()=>Promise.resolve().then(i.bind(i,8187)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\space\\loading.tsx"],metadata:{icon:[async e=>(await Promise.resolve().then(i.bind(i,7481))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(i.bind(i,2917)),"X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\layout.tsx"],"not-found":[()=>Promise.resolve().then(i.t.bind(i,9361,23)),"next/dist/client/components/not-found-error"],metadata:{icon:[async e=>(await Promise.resolve().then(i.bind(i,7481))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}],u=["X:\\Some Useful Stuff\\Applications\\Web\\next-sukadia.dev\\app\\space\\page.tsx"],c="/space/page",d={require:i,loadChunk:()=>Promise.resolve()},p=new r.AppPageRouteModule({definition:{kind:s.x.APP_PAGE,page:"/space/page",pathname:"/space",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:h}})},4038:(e,t,i)=>{Promise.resolve().then(i.bind(i,2018))},6254:(e,t,i)=>{Promise.resolve().then(i.t.bind(i,2583,23)),Promise.resolve().then(i.t.bind(i,6840,23)),Promise.resolve().then(i.t.bind(i,8771,23)),Promise.resolve().then(i.t.bind(i,3225,23)),Promise.resolve().then(i.t.bind(i,9295,23)),Promise.resolve().then(i.t.bind(i,3982,23))},2731:()=>{},5303:()=>{},2018:(e,t,i)=>{"use strict";let r,s,n,a,o,l,h,u,c,d,p;i.r(t),i.d(t,{default:()=>yM});var _,f,m,g,v,x,T,b,E,S,C,y,A,R,I,P,M,D,O,N,F,w,L,B,U,V,k,G,z,W,H,X,Y,j,K,$,q,Q,Z,J,ee,et,ei,er,es,en,ea,eo,el,eh,eu,ec,ed,ep,e_,ef,em,eg,ev,ex,eT,eb,eE,eS,eC,ey,eA,eR,eI,eP,eM,eD,eO,eN,eF,ew,eL,eB,eU,eV,ek,eG,ez,eW,eH,eX,eY,ej,eK,e$,eq,eQ,eZ,eJ,e0,e1,e2,e3,e4,e5,e6,e8,e7,e9,te,tt,ti,tr,ts,tn,ta,to,tl,th,tu,tc,td,tp,t_,tf,tm,tg,tv,tx,tT,tb,tE,tS,tC,ty,tA,tR,tI,tP,tM,tD,tO,tN,tF,tw,tL,tB=i(2295),tU=i(3729),tV=i(3267),tk=i.n(tV);function tG(){return tB.jsx("div",{className:"flex h-screen justify-center items-center",children:tB.jsx("div",{className:"flex items-center justify-center rounded-full w-14 h-14 bg-gradient-to-tr from-cyan-400 to-blue-900 animate-spin",children:tB.jsx("div",{className:"h-10 w-10 rounded-full bg-black"})})})}var tz=i(9652);class tW{constructor(){this.rootNodes=[],this.cameras=[],this.lights=[],this.meshes=[],this.skeletons=[],this.particleSystems=[],this.animations=[],this.animationGroups=[],this.multiMaterials=[],this.materials=[],this.morphTargetManagers=[],this.geometries=[],this.transformNodes=[],this.actionManagers=[],this.textures=[],this._environmentTexture=null,this.postProcesses=[]}static AddParser(e,t){this._BabylonFileParsers[e]=t}static GetParser(e){return this._BabylonFileParsers[e]?this._BabylonFileParsers[e]:null}static AddIndividualParser(e,t){this._IndividualBabylonFileParsers[e]=t}static GetIndividualParser(e){return this._IndividualBabylonFileParsers[e]?this._IndividualBabylonFileParsers[e]:null}static Parse(e,t,i,r){for(let s in this._BabylonFileParsers)Object.prototype.hasOwnProperty.call(this._BabylonFileParsers,s)&&this._BabylonFileParsers[s](e,t,i,r)}get environmentTexture(){return this._environmentTexture}set environmentTexture(e){this._environmentTexture=e}getNodes(){let e=[];return e=(e=(e=(e=e.concat(this.meshes)).concat(this.lights)).concat(this.cameras)).concat(this.transformNodes),this.skeletons.forEach(t=>e=e.concat(t.bones)),e}}tW._BabylonFileParsers={},tW._IndividualBabylonFileParsers={};class tH{constructor(){this.hoverCursor="",this.actions=[],this.isRecursive=!1}static get HasTriggers(){for(let e in tH.Triggers)if(Object.prototype.hasOwnProperty.call(tH.Triggers,e))return!0;return!1}static get HasPickTriggers(){for(let e in tH.Triggers)if(Object.prototype.hasOwnProperty.call(tH.Triggers,e)){let t=parseInt(e);if(t>=1&&t<=7)return!0}return!1}static HasSpecificTrigger(e){for(let t in tH.Triggers)if(Object.prototype.hasOwnProperty.call(tH.Triggers,t)&&parseInt(t)===e)return!0;return!1}}tH.Triggers={};class tX{constructor(e,t=!1,i,r){this.initialize(e,t,i,r)}initialize(e,t=!1,i,r){return this.mask=e,this.skipNextObservers=t,this.target=i,this.currentTarget=r,this}}class tY{constructor(e,t,i=null){this.callback=e,this.mask=t,this.scope=i,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1,this._remove=null}remove(){this._remove&&this._remove()}}class tj{static FromPromise(e,t){let i=new tj;return e.then(e=>{i.notifyObservers(e)}).catch(e=>{if(t)t.notifyObservers(e);else throw e}),i}get observers(){return this._observers}constructor(e,t=!1){this.notifyIfTriggered=t,this._observers=[],this._numObserversMarkedAsDeleted=0,this._hasNotified=!1,this._eventState=new tX(0),e&&(this._onObserverAdded=e)}add(e,t=-1,i=!1,r=null,s=!1){if(!e)return null;let n=new tY(e,t,r);return n.unregisterOnNextCall=s,i?this._observers.unshift(n):this._observers.push(n),this._onObserverAdded&&this._onObserverAdded(n),this._hasNotified&&this.notifyIfTriggered&&void 0!==this._lastNotifiedValue&&this.notifyObserver(n,this._lastNotifiedValue),n._remove=()=>{this.remove(n)},n}addOnce(e){return this.add(e,void 0,void 0,void 0,!0)}remove(e){return!!e&&(e._remove=null,-1!==this._observers.indexOf(e)&&(this._deferUnregister(e),!0))}removeCallback(e,t){for(let i=0;i{this._remove(e)},0))}_remove(e,t=!0){if(!e)return!1;let i=this._observers.indexOf(e);return -1!==i&&(t&&this._numObserversMarkedAsDeleted--,this._observers.splice(i,1),!0)}makeObserverTopPriority(e){this._remove(e,!1),this._observers.unshift(e)}makeObserverBottomPriority(e){this._remove(e,!1),this._observers.push(e)}notifyObservers(e,t=-1,i,r,s){if(this.notifyIfTriggered&&(this._hasNotified=!0,this._lastNotifiedValue=e),!this._observers.length)return!0;let n=this._eventState;for(let a of(n.mask=t,n.target=i,n.currentTarget=r,n.skipNextObservers=!1,n.lastReturnValue=e,n.userInfo=s,this._observers))if(!a._willBeUnregistered&&(a.mask&t&&(a.unregisterOnNextCall&&this._deferUnregister(a),a.scope?n.lastReturnValue=a.callback.apply(a.scope,[e,n]):n.lastReturnValue=a.callback(e,n)),n.skipNextObservers))return!1;return!0}notifyObserver(e,t,i=-1){if(this.notifyIfTriggered&&(this._hasNotified=!0,this._lastNotifiedValue=t),e._willBeUnregistered)return;let r=this._eventState;r.mask=i,r.skipNextObservers=!1,e.unregisterOnNextCall&&this._deferUnregister(e),e.callback(t,r)}hasObservers(){return this._observers.length-this._numObserversMarkedAsDeleted>0}clear(){for(;this._observers.length;){let e=this._observers.pop();e&&(e._remove=null)}this._onObserverAdded=null,this._numObserversMarkedAsDeleted=0,this.cleanLastNotifiedState()}cleanLastNotifiedState(){this._hasNotified=!1,this._lastNotifiedValue=void 0}clone(){let e=new tj;return e._observers=this._observers.slice(0),e}hasSpecificMask(e=-1){for(let t of this._observers)if(t.mask&e||t.mask===e)return!0;return!1}}class tK{static WithinEpsilon(e,t,i=1401298e-51){return Math.abs(e-t)<=i}static ToHex(e){let t=e.toString(16);return e<=15?("0"+t).toUpperCase():t.toUpperCase()}static Sign(e){return 0==(e=+e)||isNaN(e)?e:e>0?1:-1}static Clamp(e,t=0,i=1){return Math.min(i,Math.max(t,e))}static Log2(e){return Math.log(e)*Math.LOG2E}static ILog2(e){if(Math.log2)return Math.floor(Math.log2(e));if(e<0)return NaN;if(0===e)return-1/0;let t=0;if(e<1){for(;e<1;)t++,e*=2;t=-t}else if(e>1)for(;e>1;)t++,e=Math.floor(e/2);return t}static Repeat(e,t){return e-Math.floor(e/t)*t}static Normalize(e,t,i){return(e-t)/(i-t)}static Denormalize(e,t,i){return e*(i-t)+t}static DeltaAngle(e,t){let i=tK.Repeat(t-e,360);return i>180&&(i-=360),i}static PingPong(e,t){let i=tK.Repeat(e,2*t);return t-Math.abs(i-t)}static SmoothStep(e,t,i){let r=tK.Clamp(i);return t*(r=-2*r*r*r+3*r*r)+e*(1-r)}static MoveTowards(e,t,i){return Math.abs(t-e)<=i?t:e+tK.Sign(t-e)*i}static MoveTowardsAngle(e,t,i){let r=tK.DeltaAngle(e,t),s=0;return-i180&&(r-=360),e+r*tK.Clamp(i)}static InverseLerp(e,t,i){return e!=t?tK.Clamp((i-e)/(t-e)):0}static Hermite(e,t,i,r,s){let n=s*s,a=s*n;return e*(2*a-3*n+1)+i*(-2*a+3*n)+t*(a-2*n+s)+r*(a-n)}static Hermite1stDerivative(e,t,i,r,s){let n=s*s;return(n-s)*6*e+(3*n-4*s+1)*t+(-n+s)*6*i+(3*n-2*s)*r}static RandomRange(e,t){return e===t?e:Math.random()*(t-e)+e}static RangeToPercent(e,t,i){return(e-t)/(i-t)}static PercentToRange(e,t,i){return(i-t)*e+t}static NormalizeRadians(e){return e-=tK.TwoPi*Math.floor((e+Math.PI)/tK.TwoPi)}static HCF(e,t){let i=e%t;return 0===i?t:tK.HCF(t,i)}}tK.TwoPi=2*Math.PI;let t$=1/2.2,tq=(1+Math.sqrt(5))/2;class tQ{static BuildArray(e,t){let i=[];for(let r=0;r(function(e,t,i){let r=e[t];if("function"!=typeof r)return null;let s=function(){let r=e.length,n=s.previous.apply(e,arguments);return i(t,r),n};return r.next=s,s.previous=r,e[t]=s,()=>{let i=s.previous;if(!i)return;let r=s.next;r?(i.next=r,r.previous=i):(i.next=void 0,e[t]=i),s.next=void 0,s.previous=void 0}})(e,i,t));return()=>{i.forEach(e=>{null==e||e()})}}let t0={};class t1{static SetMatrixPrecision(e){if(t1.MatrixTrackPrecisionChange=!1,e&&!t1.MatrixUse64Bits&&t1.MatrixTrackedMatrices)for(let e=0;eparseInt(e.toString().replace(/\W/g,""));class t4{constructor(e=0,t=0){this.x=e,this.y=t}toString(){return`{X: ${this.x} Y: ${this.y}}`}getClassName(){return"Vector2"}getHashCode(){let e=t3(this.x),t=t3(this.y);return 397*e^t}toArray(e,t=0){return e[t]=this.x,e[t+1]=this.y,this}fromArray(e,t=0){return t4.FromArrayToRef(e,t,this),this}asArray(){let e=[];return this.toArray(e,0),e}copyFrom(e){return this.x=e.x,this.y=e.y,this}copyFromFloats(e,t){return this.x=e,this.y=t,this}set(e,t){return this.copyFromFloats(e,t)}add(e){return new this.constructor(this.x+e.x,this.y+e.y)}addToRef(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,t}addInPlace(e){return this.x+=e.x,this.y+=e.y,this}addVector3(e){return new this.constructor(this.x+e.x,this.y+e.y)}subtract(e){return new this.constructor(this.x-e.x,this.y-e.y)}subtractToRef(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,t}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this}multiplyInPlace(e){return this.x*=e.x,this.y*=e.y,this}multiply(e){return new this.constructor(this.x*e.x,this.y*e.y)}multiplyToRef(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,t}multiplyByFloats(e,t){return new this.constructor(this.x*e,this.y*t)}divide(e){return new this.constructor(this.x/e.x,this.y/e.y)}divideToRef(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,t}divideInPlace(e){return this.divideToRef(e,this)}negate(){return new this.constructor(-this.x,-this.y)}negateInPlace(){return this.x*=-1,this.y*=-1,this}negateToRef(e){return e.copyFromFloats(-1*this.x,-1*this.y)}scaleInPlace(e){return this.x*=e,this.y*=e,this}scale(e){let t=new this.constructor(0,0);return this.scaleToRef(e,t),t}scaleToRef(e,t){return t.x=this.x*e,t.y=this.y*e,t}scaleAndAddToRef(e,t){return t.x+=this.x*e,t.y+=this.y*e,t}equals(e){return e&&this.x===e.x&&this.y===e.y}equalsWithEpsilon(e,t=.001){return e&&tK.WithinEpsilon(this.x,e.x,t)&&tK.WithinEpsilon(this.y,e.y,t)}floor(){return new this.constructor(Math.floor(this.x),Math.floor(this.y))}fract(){return new this.constructor(this.x-Math.floor(this.x),this.y-Math.floor(this.y))}rotateToRef(e,t){let i=Math.cos(e),r=Math.sin(e),s=i*this.x-r*this.y,n=r*this.x+i*this.y;return t.x=s,t.y=n,t}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.normalizeFromLength(this.length())}normalizeFromLength(e){return 0===e||1===e?this:this.scaleInPlace(1/e)}normalizeToNew(){let e=new this.constructor(0,0);return this.normalizeToRef(e),e}normalizeToRef(e){let t=this.length();return 0===t||1===t?e.copyFromFloats(this.x,this.y):this.scaleToRef(1/t,e)}clone(){return new this.constructor(this.x,this.y)}dot(e){return this.x*e.x+this.y*e.y}static Zero(){return new t4(0,0)}static One(){return new t4(1,1)}static Random(e=0,t=1){return new t4(tK.RandomRange(e,t),tK.RandomRange(e,t))}static get ZeroReadOnly(){return t4._ZeroReadOnly}static FromArray(e,t=0){return new t4(e[t],e[t+1])}static FromArrayToRef(e,t,i){return i.x=e[t],i.y=e[t+1],i}static CatmullRom(e,t,i,r,s){let n=s*s,a=s*n,o=.5*(2*t.x+(-e.x+i.x)*s+(2*e.x-5*t.x+4*i.x-r.x)*n+(-e.x+3*t.x-3*i.x+r.x)*a),l=.5*(2*t.y+(-e.y+i.y)*s+(2*e.y-5*t.y+4*i.y-r.y)*n+(-e.y+3*t.y-3*i.y+r.y)*a);return new e.constructor(o,l)}static Clamp(e,t,i){let r=e.x;r=(r=r>i.x?i.x:r)i.y?i.y:s)t.x?e.x:t.x,r=e.y>t.y?e.y:t.y;return new e.constructor(i,r)}static Transform(e,t){let i=new e.constructor;return t4.TransformToRef(e,t,i),i}static TransformToRef(e,t,i){let r=t.m,s=e.x*r[0]+e.y*r[4]+r[12],n=e.x*r[1]+e.y*r[5]+r[13];return i.x=s,i.y=n,i}static PointInTriangle(e,t,i,r){let s=.5*(-i.y*r.x+t.y*(-i.x+r.x)+t.x*(i.y-r.y)+i.x*r.y),n=s<0?-1:1,a=(t.y*r.x-t.x*r.y+(r.y-t.y)*e.x+(t.x-r.x)*e.y)*n,o=(t.x*i.y-t.y*i.x+(t.y-i.y)*e.x+(i.x-t.x)*e.y)*n;return a>0&&o>0&&a+o<2*s*n}static Distance(e,t){return Math.sqrt(t4.DistanceSquared(e,t))}static DistanceSquared(e,t){let i=e.x-t.x,r=e.y-t.y;return i*i+r*r}static Center(e,t){let i=new e.constructor;return t4.CenterToRef(e,t,i)}static CenterToRef(e,t,i){return i.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2)}static DistanceOfPointFromSegment(e,t,i){let r=t4.DistanceSquared(t,i);if(0===r)return t4.Distance(e,t);let s=i.subtract(t),n=Math.max(0,Math.min(1,t4.Dot(e.subtract(t),s)/r)),a=t.add(s.multiplyByFloats(n,n));return t4.Distance(e,a)}}t4._ZeroReadOnly=t4.Zero();class t5{get x(){return this._x}set x(e){this._x=e,this._isDirty=!0}get y(){return this._y}set y(e){this._y=e,this._isDirty=!0}get z(){return this._z}set z(e){this._z=e,this._isDirty=!0}constructor(e=0,t=0,i=0){this._isDirty=!0,this._x=e,this._y=t,this._z=i}toString(){return`{X: ${this._x} Y: ${this._y} Z: ${this._z}}`}getClassName(){return"Vector3"}getHashCode(){let e=t3(this._x),t=t3(this._y),i=t3(this._z),r=e;return 397*(r=397*r^t)^i}asArray(){let e=[];return this.toArray(e,0),e}toArray(e,t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,this}fromArray(e,t=0){return t5.FromArrayToRef(e,t,this),this}toQuaternion(){return t8.RotationYawPitchRoll(this._y,this._x,this._z)}addInPlace(e){return this.addInPlaceFromFloats(e._x,e._y,e._z)}addInPlaceFromFloats(e,t,i){return this._x+=e,this._y+=t,this._z+=i,this._isDirty=!0,this}add(e){return new this.constructor(this._x+e._x,this._y+e._y,this._z+e._z)}addToRef(e,t){return t.copyFromFloats(this._x+e._x,this._y+e._y,this._z+e._z)}subtractInPlace(e){return this._x-=e._x,this._y-=e._y,this._z-=e._z,this._isDirty=!0,this}subtract(e){return new this.constructor(this._x-e._x,this._y-e._y,this._z-e._z)}subtractToRef(e,t){return this.subtractFromFloatsToRef(e._x,e._y,e._z,t)}subtractFromFloats(e,t,i){return new this.constructor(this._x-e,this._y-t,this._z-i)}subtractFromFloatsToRef(e,t,i,r){return r.copyFromFloats(this._x-e,this._y-t,this._z-i)}negate(){return new this.constructor(-this._x,-this._y,-this._z)}negateInPlace(){return this._x*=-1,this._y*=-1,this._z*=-1,this._isDirty=!0,this}negateToRef(e){return e.copyFromFloats(-1*this._x,-1*this._y,-1*this._z)}scaleInPlace(e){return this._x*=e,this._y*=e,this._z*=e,this._isDirty=!0,this}scale(e){return new this.constructor(this._x*e,this._y*e,this._z*e)}scaleToRef(e,t){return t.copyFromFloats(this._x*e,this._y*e,this._z*e)}getNormalToRef(e){let t=this.length(),i=Math.acos(this.y/t),r=Math.atan2(this.z,this.x);i>Math.PI/2?i-=Math.PI/2:i+=Math.PI/2;let s=t*Math.sin(i)*Math.cos(r),n=t*Math.cos(i),a=t*Math.sin(i)*Math.sin(r);return e.set(s,n,a),e}applyRotationQuaternionToRef(e,t){let i=this._x,r=this._y,s=this._z,n=e._x,a=e._y,o=e._z,l=e._w,h=2*(a*s-o*r),u=2*(o*i-n*s),c=2*(n*r-a*i);return t._x=i+l*h+a*c-o*u,t._y=r+l*u+o*h-n*c,t._z=s+l*c+n*u-a*h,t._isDirty=!0,t}applyRotationQuaternionInPlace(e){return this.applyRotationQuaternionToRef(e,this)}applyRotationQuaternion(e){return this.applyRotationQuaternionToRef(e,new this.constructor)}scaleAndAddToRef(e,t){return t.addInPlaceFromFloats(this._x*e,this._y*e,this._z*e)}projectOnPlane(e,t){let i=new this.constructor;return this.projectOnPlaneToRef(e,t,i),i}projectOnPlaneToRef(e,t,i){let r=e.normal,s=e.d,n=t9.Vector3[0];this.subtractToRef(t,n),n.normalize();let a=t5.Dot(n,r);if(1e-10>Math.abs(a))i.setAll(1/0);else{let e=-(t5.Dot(t,r)+s)/a,o=n.scaleInPlace(e);t.addToRef(o,i)}return i}equals(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z}equalsWithEpsilon(e,t=.001){return e&&tK.WithinEpsilon(this._x,e._x,t)&&tK.WithinEpsilon(this._y,e._y,t)&&tK.WithinEpsilon(this._z,e._z,t)}equalsToFloats(e,t,i){return this._x===e&&this._y===t&&this._z===i}multiplyInPlace(e){return this._x*=e._x,this._y*=e._y,this._z*=e._z,this._isDirty=!0,this}multiply(e){return this.multiplyByFloats(e._x,e._y,e._z)}multiplyToRef(e,t){return t.copyFromFloats(this._x*e._x,this._y*e._y,this._z*e._z)}multiplyByFloats(e,t,i){return new this.constructor(this._x*e,this._y*t,this._z*i)}divide(e){return new this.constructor(this._x/e._x,this._y/e._y,this._z/e._z)}divideToRef(e,t){return t.copyFromFloats(this._x/e._x,this._y/e._y,this._z/e._z)}divideInPlace(e){return this.divideToRef(e,this)}minimizeInPlace(e){return this.minimizeInPlaceFromFloats(e._x,e._y,e._z)}maximizeInPlace(e){return this.maximizeInPlaceFromFloats(e._x,e._y,e._z)}minimizeInPlaceFromFloats(e,t,i){return ethis._x&&(this.x=e),t>this._y&&(this.y=t),i>this._z&&(this.z=i),this}isNonUniformWithinEpsilon(e){let t=Math.abs(this._x),i=Math.abs(this._y);if(!tK.WithinEpsilon(t,i,e))return!0;let r=Math.abs(this._z);return!(tK.WithinEpsilon(t,r,e)&&tK.WithinEpsilon(i,r,e))}get isNonUniform(){let e=Math.abs(this._x);return e!==Math.abs(this._y)||e!==Math.abs(this._z)}floor(){return new this.constructor(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))}fract(){return new this.constructor(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z))}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z)}lengthSquared(){return this._x*this._x+this._y*this._y+this._z*this._z}get hasAZeroComponent(){return this._x*this._y*this._z==0}normalize(){return this.normalizeFromLength(this.length())}reorderInPlace(e){if("xyz"===(e=e.toLowerCase()))return this;let t=t9.Vector3[0].copyFrom(this);return this.x=t[e[0]],this.y=t[e[1]],this.z=t[e[2]],this}rotateByQuaternionToRef(e,t){return e.toRotationMatrix(t9.Matrix[0]),t5.TransformCoordinatesToRef(this,t9.Matrix[0],t),t}rotateByQuaternionAroundPointToRef(e,t,i){return this.subtractToRef(t,t9.Vector3[0]),t9.Vector3[0].rotateByQuaternionToRef(e,t9.Vector3[0]),t.addToRef(t9.Vector3[0],i),i}cross(e){let t=new this.constructor;return t5.CrossToRef(this,e,t)}normalizeFromLength(e){return 0===e||1===e?this:this.scaleInPlace(1/e)}normalizeToNew(){let e=new this.constructor(0,0,0);return this.normalizeToRef(e),e}normalizeToRef(e){let t=this.length();return 0===t||1===t?e.copyFromFloats(this._x,this._y,this._z):this.scaleToRef(1/t,e)}clone(){return new this.constructor(this._x,this._y,this._z)}copyFrom(e){return this.copyFromFloats(e._x,e._y,e._z)}copyFromFloats(e,t,i){return this._x=e,this._y=t,this._z=i,this._isDirty=!0,this}set(e,t,i){return this.copyFromFloats(e,t,i)}setAll(e){return this._x=this._y=this._z=e,this._isDirty=!0,this}static GetClipFactor(e,t,i,r){let s=t5.Dot(e,i);return(s-r)/(s-t5.Dot(t,i))}static GetAngleBetweenVectors(e,t,i){let r=e.normalizeToRef(t9.Vector3[1]),s=t.normalizeToRef(t9.Vector3[2]),n=t5.Dot(r,s),a=Math.acos(n=tK.Clamp(n,-1,1)),o=t9.Vector3[3];return(t5.CrossToRef(r,s,o),t5.Dot(o,i)>0)?isNaN(a)?0:a:isNaN(a)?-Math.PI:-Math.acos(n)}static GetAngleBetweenVectorsOnPlane(e,t,i){t9.Vector3[0].copyFrom(e);let r=t9.Vector3[0];t9.Vector3[1].copyFrom(t);let s=t9.Vector3[1];t9.Vector3[2].copyFrom(i);let n=t9.Vector3[2],a=t9.Vector3[3],o=t9.Vector3[4];r.normalize(),s.normalize(),n.normalize(),t5.CrossToRef(n,r,a),t5.CrossToRef(a,n,o);let l=Math.atan2(t5.Dot(s,a),t5.Dot(s,o));return tK.NormalizeRadians(l)}static PitchYawRollToMoveBetweenPointsToRef(e,t,i){let r=ie.Vector3[0];return t.subtractToRef(e,r),i._y=Math.atan2(r.x,r.z)||0,i._x=Math.atan2(Math.sqrt(r.x**2+r.z**2),r.y)||0,i._z=0,i._isDirty=!0,i}static PitchYawRollToMoveBetweenPoints(e,t){let i=t5.Zero();return t5.PitchYawRollToMoveBetweenPointsToRef(e,t,i)}static SlerpToRef(e,t,i,r){let s,n;i=tK.Clamp(i,0,1);let a=t9.Vector3[0],o=t9.Vector3[1];a.copyFrom(e);let l=a.length();a.normalizeFromLength(l),o.copyFrom(t);let h=o.length();o.normalizeFromLength(h);let u=t5.Dot(a,o);if(u<.999){let e=Math.acos(u),t=1/Math.sin(e);s=Math.sin((1-i)*e)*t,n=Math.sin(i*e)*t}else s=1-i,n=i;return a.scaleInPlace(s),o.scaleInPlace(n),r.copyFrom(a).addInPlace(o),r.scaleInPlace(tK.Lerp(l,h,i)),r}static SmoothToRef(e,t,i,r,s){return t5.SlerpToRef(e,t,0===r?1:i/r,s),s}static FromArray(e,t=0){return new t5(e[t],e[t+1],e[t+2])}static FromFloatArray(e,t){return t5.FromArray(e,t)}static FromArrayToRef(e,t,i){return i._x=e[t],i._y=e[t+1],i._z=e[t+2],i._isDirty=!0,i}static FromFloatArrayToRef(e,t,i){return t5.FromArrayToRef(e,t,i)}static FromFloatsToRef(e,t,i,r){return r.copyFromFloats(e,t,i),r}static Zero(){return new t5(0,0,0)}static One(){return new t5(1,1,1)}static Up(){return new t5(0,1,0)}static get UpReadOnly(){return t5._UpReadOnly}static get DownReadOnly(){return t5._DownReadOnly}static get RightReadOnly(){return t5._RightReadOnly}static get LeftReadOnly(){return t5._LeftReadOnly}static get LeftHandedForwardReadOnly(){return t5._LeftHandedForwardReadOnly}static get RightHandedForwardReadOnly(){return t5._RightHandedForwardReadOnly}static get LeftHandedBackwardReadOnly(){return t5._LeftHandedBackwardReadOnly}static get RightHandedBackwardReadOnly(){return t5._RightHandedBackwardReadOnly}static get ZeroReadOnly(){return t5._ZeroReadOnly}static get OneReadOnly(){return t5._OneReadOnly}static Down(){return new t5(0,-1,0)}static Forward(e=!1){return new t5(0,0,e?-1:1)}static Backward(e=!1){return new t5(0,0,e?1:-1)}static Right(){return new t5(1,0,0)}static Left(){return new t5(-1,0,0)}static Random(e=0,t=1){return new t5(tK.RandomRange(e,t),tK.RandomRange(e,t),tK.RandomRange(e,t))}static TransformCoordinates(e,t){let i=t5.Zero();return t5.TransformCoordinatesToRef(e,t,i),i}static TransformCoordinatesToRef(e,t,i){return t5.TransformCoordinatesFromFloatsToRef(e._x,e._y,e._z,t,i),i}static TransformCoordinatesFromFloatsToRef(e,t,i,r,s){let n=r.m,a=e*n[0]+t*n[4]+i*n[8]+n[12],o=e*n[1]+t*n[5]+i*n[9]+n[13],l=e*n[2]+t*n[6]+i*n[10]+n[14],h=1/(e*n[3]+t*n[7]+i*n[11]+n[15]);return s._x=a*h,s._y=o*h,s._z=l*h,s._isDirty=!0,s}static TransformNormal(e,t){let i=t5.Zero();return t5.TransformNormalToRef(e,t,i),i}static TransformNormalToRef(e,t,i){return this.TransformNormalFromFloatsToRef(e._x,e._y,e._z,t,i),i}static TransformNormalFromFloatsToRef(e,t,i,r,s){let n=r.m;return s._x=e*n[0]+t*n[4]+i*n[8],s._y=e*n[1]+t*n[5]+i*n[9],s._z=e*n[2]+t*n[6]+i*n[10],s._isDirty=!0,s}static CatmullRom(e,t,i,r,s){let n=s*s,a=s*n,o=.5*(2*t._x+(-e._x+i._x)*s+(2*e._x-5*t._x+4*i._x-r._x)*n+(-e._x+3*t._x-3*i._x+r._x)*a),l=.5*(2*t._y+(-e._y+i._y)*s+(2*e._y-5*t._y+4*i._y-r._y)*n+(-e._y+3*t._y-3*i._y+r._y)*a),h=.5*(2*t._z+(-e._z+i._z)*s+(2*e._z-5*t._z+4*i._z-r._z)*n+(-e._z+3*t._z-3*i._z+r._z)*a);return new e.constructor(o,l,h)}static Clamp(e,t,i){let r=new e.constructor;return t5.ClampToRef(e,t,i,r),r}static ClampToRef(e,t,i,r){let s=e._x;s=(s=s>i._x?i._x:s)i._y?i._y:n)i._z?i._z:a)0&&A<0?(I.copyFrom(o),n=t,a=i):A>0&&R<0?(I.copyFrom(h),n=i,a=r):(I.copyFrom(l).scaleInPlace(-1),n=r,a=t);let P=t9.Vector3[9],M=t9.Vector3[4];if(n.subtractToRef(x,S),a.subtractToRef(x,P),t5.CrossToRef(S,P,M),!(0>t5.Dot(M,u)))return s.copyFrom(x),Math.abs(m*g);let D=t9.Vector3[5];t5.CrossToRef(I,M,D),D.normalize();let O=t9.Vector3[9];O.copyFrom(n).subtractInPlace(x);let N=O.length();if(N<.001)return s.copyFrom(n),t5.Distance(e,n);O.normalizeFromLength(N);let F=t5.Dot(D,O),w=t9.Vector3[7];w.copyFrom(x).addInPlace(D.scaleInPlace(N*F)),S.copyFrom(w).subtractInPlace(n),m=I.length(),I.normalizeFromLength(m);let L=t5.Dot(S,I)/Math.max(m,.001);return L=tK.Clamp(L,0,1),w.copyFrom(n).addInPlace(I.scaleInPlace(L*m)),s.copyFrom(w),t5.Distance(e,w)}static Center(e,t){return t5.CenterToRef(e,t,t5.Zero())}static CenterToRef(e,t,i){return i.copyFromFloats((e._x+t._x)/2,(e._y+t._y)/2,(e._z+t._z)/2)}static RotationFromAxis(e,t,i){let r=new e.constructor;return t5.RotationFromAxisToRef(e,t,i,r),r}static RotationFromAxisToRef(e,t,i,r){let s=t9.Quaternion[0];return t8.RotationQuaternionFromAxisToRef(e,t,i,s),s.toEulerAnglesToRef(r),r}}t5._UpReadOnly=t5.Up(),t5._DownReadOnly=t5.Down(),t5._LeftHandedForwardReadOnly=t5.Forward(!1),t5._RightHandedForwardReadOnly=t5.Forward(!0),t5._LeftHandedBackwardReadOnly=t5.Backward(!1),t5._RightHandedBackwardReadOnly=t5.Backward(!0),t5._RightReadOnly=t5.Right(),t5._LeftReadOnly=t5.Left(),t5._ZeroReadOnly=t5.Zero(),t5._OneReadOnly=t5.One();class t6{constructor(e=0,t=0,i=0,r=0){this.x=e,this.y=t,this.z=i,this.w=r}toString(){return`{X: ${this.x} Y: ${this.y} Z: ${this.z} W: ${this.w}}`}getClassName(){return"Vector4"}getHashCode(){let e=t3(this.x),t=t3(this.y),i=t3(this.z),r=t3(this.w),s=e;return 397*(s=397*(s=397*s^t)^i)^r}asArray(){let e=[];return this.toArray(e,0),e}toArray(e,t){return void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,this}fromArray(e,t=0){return t6.FromArrayToRef(e,t,this),this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}add(e){return new this.constructor(this.x+e.x,this.y+e.y,this.z+e.z,this.w+e.w)}addToRef(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,t.z=this.z+e.z,t.w=this.w+e.w,t}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subtract(e){return new this.constructor(this.x-e.x,this.y-e.y,this.z-e.z,this.w-e.w)}subtractToRef(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,t.z=this.z-e.z,t.w=this.w-e.w,t}subtractFromFloats(e,t,i,r){return new this.constructor(this.x-e,this.y-t,this.z-i,this.w-r)}subtractFromFloatsToRef(e,t,i,r,s){return s.x=this.x-e,s.y=this.y-t,s.z=this.z-i,s.w=this.w-r,s}negate(){return new this.constructor(-this.x,-this.y,-this.z,-this.w)}negateInPlace(){return this.x*=-1,this.y*=-1,this.z*=-1,this.w*=-1,this}negateToRef(e){return e.copyFromFloats(-1*this.x,-1*this.y,-1*this.z,-1*this.w)}scaleInPlace(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}scale(e){return new this.constructor(this.x*e,this.y*e,this.z*e,this.w*e)}scaleToRef(e,t){return t.x=this.x*e,t.y=this.y*e,t.z=this.z*e,t.w=this.w*e,t}scaleAndAddToRef(e,t){return t.x+=this.x*e,t.y+=this.y*e,t.z+=this.z*e,t.w+=this.w*e,t}equals(e){return e&&this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w}equalsWithEpsilon(e,t=.001){return e&&tK.WithinEpsilon(this.x,e.x,t)&&tK.WithinEpsilon(this.y,e.y,t)&&tK.WithinEpsilon(this.z,e.z,t)&&tK.WithinEpsilon(this.w,e.w,t)}equalsToFloats(e,t,i,r){return this.x===e&&this.y===t&&this.z===i&&this.w===r}multiplyInPlace(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiply(e){return new this.constructor(this.x*e.x,this.y*e.y,this.z*e.z,this.w*e.w)}multiplyToRef(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,t.z=this.z*e.z,t.w=this.w*e.w,t}multiplyByFloats(e,t,i,r){return new this.constructor(this.x*e,this.y*t,this.z*i,this.w*r)}divide(e){return new this.constructor(this.x/e.x,this.y/e.y,this.z/e.z,this.w/e.w)}divideToRef(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,t.z=this.z/e.z,t.w=this.w/e.w,t}divideInPlace(e){return this.divideToRef(e,this)}minimizeInPlace(e){return e.xthis.x&&(this.x=e.x),e.y>this.y&&(this.y=e.y),e.z>this.z&&(this.z=e.z),e.w>this.w&&(this.w=e.w),this}floor(){return new this.constructor(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z),Math.floor(this.w))}fract(){return new this.constructor(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z),this.w-Math.floor(this.w))}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}normalize(){return this.normalizeFromLength(this.length())}normalizeFromLength(e){return 0===e||1===e?this:this.scaleInPlace(1/e)}normalizeToNew(){let e=new this.constructor(0,0,0,0);return this.normalizeToRef(e),e}normalizeToRef(e){let t=this.length();return 0===t||1===t?e.copyFromFloats(this.x,this.y,this.z,this.w):this.scaleToRef(1/t,e)}toVector3(){return new t5(this.x,this.y,this.z)}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copyFrom(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}copyFromFloats(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}set(e,t,i,r){return this.copyFromFloats(e,t,i,r)}setAll(e){return this.x=this.y=this.z=this.w=e,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}static FromArray(e,t){return t||(t=0),new t6(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t,i){return i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3],i}static FromFloatArrayToRef(e,t,i){return t6.FromArrayToRef(e,t,i),i}static FromFloatsToRef(e,t,i,r,s){return s.x=e,s.y=t,s.z=i,s.w=r,s}static Zero(){return new t6(0,0,0,0)}static One(){return new t6(1,1,1,1)}static Random(e=0,t=1){return new t6(tK.RandomRange(e,t),tK.RandomRange(e,t),tK.RandomRange(e,t),tK.RandomRange(e,t))}static get ZeroReadOnly(){return t6._ZeroReadOnly}static Normalize(e){let t=t6.Zero();return t6.NormalizeToRef(e,t),t}static NormalizeToRef(e,t){return e.normalizeToRef(t),t}static Minimize(e,t){let i=new e.constructor;return i.copyFrom(e),i.minimizeInPlace(t),i}static Maximize(e,t){let i=new e.constructor;return i.copyFrom(e),i.maximizeInPlace(t),i}static Distance(e,t){return Math.sqrt(t6.DistanceSquared(e,t))}static DistanceSquared(e,t){let i=e.x-t.x,r=e.y-t.y,s=e.z-t.z,n=e.w-t.w;return i*i+r*r+s*s+n*n}static Center(e,t){return t6.CenterToRef(e,t,t6.Zero())}static CenterToRef(e,t,i){return i.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2,(e.w+t.w)/2)}static TransformCoordinates(e,t){let i=t6.Zero();return t6.TransformCoordinatesToRef(e,t,i),i}static TransformCoordinatesToRef(e,t,i){return t6.TransformCoordinatesFromFloatsToRef(e._x,e._y,e._z,t,i),i}static TransformCoordinatesFromFloatsToRef(e,t,i,r,s){let n=r.m,a=e*n[0]+t*n[4]+i*n[8]+n[12],o=e*n[1]+t*n[5]+i*n[9]+n[13],l=e*n[2]+t*n[6]+i*n[10]+n[14],h=e*n[3]+t*n[7]+i*n[11]+n[15];return s.x=a,s.y=o,s.z=l,s.w=h,s}static TransformNormal(e,t){let i=new e.constructor;return t6.TransformNormalToRef(e,t,i),i}static TransformNormalToRef(e,t,i){let r=t.m,s=e.x*r[0]+e.y*r[4]+e.z*r[8],n=e.x*r[1]+e.y*r[5]+e.z*r[9],a=e.x*r[2]+e.y*r[6]+e.z*r[10];return i.x=s,i.y=n,i.z=a,i.w=e.w,i}static TransformNormalFromFloatsToRef(e,t,i,r,s,n){let a=s.m;return n.x=e*a[0]+t*a[4]+i*a[8],n.y=e*a[1]+t*a[5]+i*a[9],n.z=e*a[2]+t*a[6]+i*a[10],n.w=r,n}static FromVector3(e,t=0){return new t6(e._x,e._y,e._z,t)}static Dot(e,t){return e.dot(t)}}t6._ZeroReadOnly=t6.Zero();class t8{get x(){return this._x}set x(e){this._x=e,this._isDirty=!0}get y(){return this._y}set y(e){this._y=e,this._isDirty=!0}get z(){return this._z}set z(e){this._z=e,this._isDirty=!0}get w(){return this._w}set w(e){this._w=e,this._isDirty=!0}constructor(e=0,t=0,i=0,r=1){this._isDirty=!0,this._x=e,this._y=t,this._z=i,this._w=r}toString(){return`{X: ${this._x} Y: ${this._y} Z: ${this._z} W: ${this._w}}`}getClassName(){return"Quaternion"}getHashCode(){let e=t3(this._x),t=t3(this._y),i=t3(this._z),r=t3(this._w),s=e;return 397*(s=397*(s=397*s^t)^i)^r}asArray(){return[this._x,this._y,this._z,this._w]}toArray(e,t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,this}equals(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z&&this._w===e._w}equalsWithEpsilon(e,t=.001){return e&&tK.WithinEpsilon(this._x,e._x,t)&&tK.WithinEpsilon(this._y,e._y,t)&&tK.WithinEpsilon(this._z,e._z,t)&&tK.WithinEpsilon(this._w,e._w,t)}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copyFrom(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._w=e._w,this._isDirty=!0,this}copyFromFloats(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._isDirty=!0,this}set(e,t,i,r){return this.copyFromFloats(e,t,i,r)}add(e){return new this.constructor(this._x+e._x,this._y+e._y,this._z+e._z,this._w+e._w)}addInPlace(e){return this._x+=e._x,this._y+=e._y,this._z+=e._z,this._w+=e._w,this._isDirty=!0,this}subtract(e){return new this.constructor(this._x-e._x,this._y-e._y,this._z-e._z,this._w-e._w)}subtractInPlace(e){return this._x-=e._x,this._y-=e._y,this._z-=e._z,this._w-=e._w,this._isDirty=!0,this}scale(e){return new this.constructor(this._x*e,this._y*e,this._z*e,this._w*e)}scaleToRef(e,t){return t._x=this._x*e,t._y=this._y*e,t._z=this._z*e,t._w=this._w*e,t._isDirty=!0,t}scaleInPlace(e){return this._x*=e,this._y*=e,this._z*=e,this._w*=e,this._isDirty=!0,this}scaleAndAddToRef(e,t){return t._x+=this._x*e,t._y+=this._y*e,t._z+=this._z*e,t._w+=this._w*e,t._isDirty=!0,t}multiply(e){let t=new this.constructor(0,0,0,1);return this.multiplyToRef(e,t),t}multiplyToRef(e,t){let i=this._x*e._w+this._y*e._z-this._z*e._y+this._w*e._x,r=-this._x*e._z+this._y*e._w+this._z*e._x+this._w*e._y,s=this._x*e._y-this._y*e._x+this._z*e._w+this._w*e._z,n=-this._x*e._x-this._y*e._y-this._z*e._z+this._w*e._w;return t.copyFromFloats(i,r,s,n),t}multiplyInPlace(e){return this.multiplyToRef(e,this),this}conjugateToRef(e){return e.copyFromFloats(-this._x,-this._y,-this._z,this._w),e}conjugateInPlace(){return this._x*=-1,this._y*=-1,this._z*=-1,this._isDirty=!0,this}conjugate(){return new this.constructor(-this._x,-this._y,-this._z,this._w)}invert(){let e=this.conjugate(),t=this.lengthSquared();return 0==t||1==t||e.scaleInPlace(1/t),e}invertInPlace(){this.conjugateInPlace();let e=this.lengthSquared();return 0==e||1==e||this.scaleInPlace(1/e),this}lengthSquared(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this.lengthSquared())}normalize(){return this.normalizeFromLength(this.length())}normalizeFromLength(e){return 0===e||1===e?this:this.scaleInPlace(1/e)}normalizeToNew(){let e=new this.constructor(0,0,0,1);return this.normalizeToRef(e),e}normalizeToRef(e){let t=this.length();return 0===t||1===t?e.copyFromFloats(this._x,this._y,this._z,this._w):this.scaleToRef(1/t,e)}toEulerAngles(){let e=t5.Zero();return this.toEulerAnglesToRef(e),e}toEulerAnglesToRef(e){let t=this._z,i=this._x,r=this._y,s=this._w,n=r*t-i*s;if(n<-.4999999)e._y=2*Math.atan2(r,s),e._x=Math.PI/2,e._z=0,e._isDirty=!0;else if(n>.4999999)e._y=2*Math.atan2(r,s),e._x=-Math.PI/2,e._z=0,e._isDirty=!0;else{let a=s*s,o=t*t,l=i*i,h=r*r;e._z=Math.atan2(2*(i*r+t*s),-o-l+h+a),e._x=Math.asin(-2*n),e._y=Math.atan2(2*(t*i+r*s),o-l-h+a),e._isDirty=!0}return e}toRotationMatrix(e){return t7.FromQuaternionToRef(this,e),e}fromRotationMatrix(e){return t8.FromRotationMatrixToRef(e,this),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}static FromRotationMatrix(e){let t=new t8;return t8.FromRotationMatrixToRef(e,t),t}static FromRotationMatrixToRef(e,t){let i;let r=e.m,s=r[0],n=r[4],a=r[8],o=r[1],l=r[5],h=r[9],u=r[2],c=r[6],d=r[10],p=s+l+d;return p>0?(i=.5/Math.sqrt(p+1),t._w=.25/i,t._x=(c-h)*i,t._y=(a-u)*i,t._z=(o-n)*i):s>l&&s>d?(i=2*Math.sqrt(1+s-l-d),t._w=(c-h)/i,t._x=.25*i,t._y=(n+o)/i,t._z=(a+u)/i):l>d?(i=2*Math.sqrt(1+l-s-d),t._w=(a-u)/i,t._x=(n+o)/i,t._y=.25*i,t._z=(h+c)/i):(i=2*Math.sqrt(1+d-s-l),t._w=(o-n)/i,t._x=(a+u)/i,t._y=(h+c)/i,t._z=.25*i),t._isDirty=!0,t}static Dot(e,t){return e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w}static AreClose(e,t,i=.1){let r=t8.Dot(e,t);return 1-r*r<=i}static SmoothToRef(e,t,i,r,s){let n=0===r?1:i/r;return n=tK.Clamp(n,0,1),t8.SlerpToRef(e,t,n,s),s}static Zero(){return new t8(0,0,0,0)}static Inverse(e){return new e.constructor(-e._x,-e._y,-e._z,e._w)}static InverseToRef(e,t){return t.set(-e._x,-e._y,-e._z,e._w),t}static Identity(){return new t8(0,0,0,1)}static IsIdentity(e){return e&&0===e._x&&0===e._y&&0===e._z&&1===e._w}static RotationAxis(e,t){return t8.RotationAxisToRef(e,t,new t8)}static RotationAxisToRef(e,t,i){let r=Math.sin(t/2);return e.normalize(),i._w=Math.cos(t/2),i._x=e._x*r,i._y=e._y*r,i._z=e._z*r,i._isDirty=!0,i}static FromArray(e,t){return t||(t=0),new t8(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t,i){return i._x=e[t],i._y=e[t+1],i._z=e[t+2],i._w=e[t+3],i._isDirty=!0,i}static FromEulerAngles(e,t,i){let r=new t8;return t8.RotationYawPitchRollToRef(t,e,i,r),r}static FromEulerAnglesToRef(e,t,i,r){return t8.RotationYawPitchRollToRef(t,e,i,r),r}static FromEulerVector(e){let t=new t8;return t8.RotationYawPitchRollToRef(e._y,e._x,e._z,t),t}static FromEulerVectorToRef(e,t){return t8.RotationYawPitchRollToRef(e._y,e._x,e._z,t),t}static FromUnitVectorsToRef(e,t,i,r=.001){let s=t5.Dot(e,t)+1;return sMath.abs(e.z)?i.set(-e.y,e.x,0,0):i.set(0,-e.z,e.y,0):(t5.CrossToRef(e,t,ie.Vector3[0]),i.set(ie.Vector3[0].x,ie.Vector3[0].y,ie.Vector3[0].z,s)),i.normalize()}static RotationYawPitchRoll(e,t,i){let r=new t8;return t8.RotationYawPitchRollToRef(e,t,i,r),r}static RotationYawPitchRollToRef(e,t,i,r){let s=.5*i,n=.5*t,a=.5*e,o=Math.sin(s),l=Math.cos(s),h=Math.sin(n),u=Math.cos(n),c=Math.sin(a),d=Math.cos(a);return r._x=d*h*l+c*u*o,r._y=c*u*l-d*h*o,r._z=d*u*o-c*h*l,r._w=d*u*l+c*h*o,r._isDirty=!0,r}static RotationAlphaBetaGamma(e,t,i){let r=new t8;return t8.RotationAlphaBetaGammaToRef(e,t,i,r),r}static RotationAlphaBetaGammaToRef(e,t,i,r){let s=(i+e)*.5,n=(i-e)*.5,a=.5*t;return r._x=Math.cos(n)*Math.sin(a),r._y=Math.sin(n)*Math.sin(a),r._z=Math.sin(s)*Math.cos(a),r._w=Math.cos(s)*Math.cos(a),r._isDirty=!0,r}static RotationQuaternionFromAxis(e,t,i){let r=new t8(0,0,0,0);return t8.RotationQuaternionFromAxisToRef(e,t,i,r),r}static RotationQuaternionFromAxisToRef(e,t,i,r){let s=t9.Matrix[0];return t7.FromXYZAxesToRef(e.normalize(),t.normalize(),i.normalize(),s),t8.FromRotationMatrixToRef(s,r),r}static FromLookDirectionLH(e,t){let i=new t8;return t8.FromLookDirectionLHToRef(e,t,i),i}static FromLookDirectionLHToRef(e,t,i){let r=t9.Matrix[0];return t7.LookDirectionLHToRef(e,t,r),t8.FromRotationMatrixToRef(r,i),i}static FromLookDirectionRH(e,t){let i=new t8;return t8.FromLookDirectionRHToRef(e,t,i),i}static FromLookDirectionRHToRef(e,t,i){let r=t9.Matrix[0];return t7.LookDirectionRHToRef(e,t,r),t8.FromRotationMatrixToRef(r,i)}static Slerp(e,t,i){let r=t8.Identity();return t8.SlerpToRef(e,t,i,r),r}static SlerpToRef(e,t,i,r){let s,n;let a=e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w,o=!1;if(a<0&&(o=!0,a=-a),a>.999999)n=1-i,s=o?-i:i;else{let e=Math.acos(a),t=1/Math.sin(e);n=Math.sin((1-i)*e)*t,s=o?-Math.sin(i*e)*t:Math.sin(i*e)*t}return r._x=n*e._x+s*t._x,r._y=n*e._y+s*t._y,r._z=n*e._z+s*t._z,r._w=n*e._w+s*t._w,r._isDirty=!0,r}static Hermite(e,t,i,r,s){let n=s*s,a=s*n,o=2*a-3*n+1,l=-2*a+3*n,h=a-2*n+s,u=a-n,c=e._x*o+i._x*l+t._x*h+r._x*u,d=e._y*o+i._y*l+t._y*h+r._y*u,p=e._z*o+i._z*l+t._z*h+r._z*u,_=e._w*o+i._w*l+t._w*h+r._w*u;return new e.constructor(c,d,p,_)}static Hermite1stDerivative(e,t,i,r,s){let n=new e.constructor;return this.Hermite1stDerivativeToRef(e,t,i,r,s,n),n}static Hermite1stDerivativeToRef(e,t,i,r,s,n){let a=s*s;return n._x=(a-s)*6*e._x+(3*a-4*s+1)*t._x+(-a+s)*6*i._x+(3*a-2*s)*r._x,n._y=(a-s)*6*e._y+(3*a-4*s+1)*t._y+(-a+s)*6*i._y+(3*a-2*s)*r._y,n._z=(a-s)*6*e._z+(3*a-4*s+1)*t._z+(-a+s)*6*i._z+(3*a-2*s)*r._z,n._w=(a-s)*6*e._w+(3*a-4*s+1)*t._w+(-a+s)*6*i._w+(3*a-2*s)*r._w,n._isDirty=!0,n}static Normalize(e){let t=t8.Zero();return t8.NormalizeToRef(e,t),t}static NormalizeToRef(e,t){return e.normalizeToRef(t),t}}class t7{static get Use64Bits(){return t1.MatrixUse64Bits}get m(){return this._m}markAsUpdated(){this.updateFlag=t7._UpdateFlagSeed++,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0}_updateIdentityStatus(e,t=!1,i=!1,r=!0){this._isIdentity=e,this._isIdentity3x2=e||i,this._isIdentityDirty=!this._isIdentity&&t,this._isIdentity3x2Dirty=!this._isIdentity3x2&&r}constructor(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this.updateFlag=-1,t1.MatrixTrackPrecisionChange&&t1.MatrixTrackedMatrices.push(this),this._m=new t1.MatrixCurrentType(16),this.markAsUpdated()}isIdentity(){if(this._isIdentityDirty){this._isIdentityDirty=!1;let e=this._m;this._isIdentity=1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]}return this._isIdentity}isIdentityAs3x2(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,1!==this._m[0]||1!==this._m[5]||1!==this._m[15]?this._isIdentity3x2=!1:0!==this._m[1]||0!==this._m[2]||0!==this._m[3]||0!==this._m[4]||0!==this._m[6]||0!==this._m[7]||0!==this._m[8]||0!==this._m[9]||0!==this._m[10]||0!==this._m[11]||0!==this._m[12]||0!==this._m[13]||0!==this._m[14]?this._isIdentity3x2=!1:this._isIdentity3x2=!0),this._isIdentity3x2}determinant(){if(!0===this._isIdentity)return 1;let e=this._m,t=e[0],i=e[1],r=e[2],s=e[3],n=e[4],a=e[5],o=e[6],l=e[7],h=e[8],u=e[9],c=e[10],d=e[11],p=e[12],_=e[13],f=e[14],m=e[15],g=c*m-f*d,v=u*m-_*d,x=u*f-_*c,T=h*m-p*d,b=h*f-c*p,E=h*_-p*u;return t*+(a*g-o*v+l*x)+-(i*(n*g-o*T+l*b))+r*+(n*v-a*T+l*E)+-(s*(n*x-a*b+o*E))}toString(){return`{${this.m[0]}, ${this.m[1]}, ${this.m[2]}, ${this.m[3]}
${this.m[4]}, ${this.m[5]}, ${this.m[6]}, ${this.m[7]}
${this.m[8]}, ${this.m[9]}, ${this.m[10]}, ${this.m[11]}
${this.m[12]}, ${this.m[13]}, ${this.m[14]}, ${this.m[15]}}`}toArray(){return this._m}asArray(){return this._m}invert(){return this.invertToRef(this),this}reset(){return t7.FromValuesToRef(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this),this._updateIdentityStatus(!1),this}add(e){let t=new this.constructor;return this.addToRef(e,t),t}addToRef(e,t){let i=this._m,r=t._m,s=e.m;for(let e=0;e<16;e++)r[e]=i[e]+s[e];return t.markAsUpdated(),t}addToSelf(e){let t=this._m,i=e.m;for(let e=0;e<16;e++)t[e]+=i[e];return this.markAsUpdated(),this}invertToRef(e){if(!0===this._isIdentity)return t7.IdentityToRef(e),e;let t=this._m,i=t[0],r=t[1],s=t[2],n=t[3],a=t[4],o=t[5],l=t[6],h=t[7],u=t[8],c=t[9],d=t[10],p=t[11],_=t[12],f=t[13],m=t[14],g=t[15],v=d*g-m*p,x=c*g-f*p,T=c*m-f*d,b=u*g-_*p,E=u*m-d*_,S=u*f-_*c,C=+(o*v-l*x+h*T),y=-(a*v-l*b+h*E),A=+(a*x-o*b+h*S),R=-(a*T-o*E+l*S),I=i*C+r*y+s*A+n*R;if(0===I)return e.copyFrom(this),e;let P=1/I,M=l*g-m*h,D=o*g-f*h,O=o*m-f*l,N=a*g-_*h,F=a*m-_*l,w=a*f-_*o,L=l*p-d*h,B=o*p-c*h,U=o*d-c*l,V=a*p-u*h,k=a*d-u*l,G=a*c-u*o;return t7.FromValuesToRef(C*P,-(r*v-s*x+n*T)*P,+(r*M-s*D+n*O)*P,-(r*L-s*B+n*U)*P,y*P,+(i*v-s*b+n*E)*P,-(i*M-s*N+n*F)*P,+(i*L-s*V+n*k)*P,A*P,-(i*x-r*b+n*S)*P,+(i*D-r*N+n*w)*P,-(i*B-r*V+n*G)*P,R*P,+(i*T-r*E+s*S)*P,-(i*O-r*F+s*w)*P,+(i*U-r*k+s*G)*P,e),e}addAtIndex(e,t){return this._m[e]+=t,this.markAsUpdated(),this}multiplyAtIndex(e,t){return this._m[e]*=t,this.markAsUpdated(),this}setTranslationFromFloats(e,t,i){return this._m[12]=e,this._m[13]=t,this._m[14]=i,this.markAsUpdated(),this}addTranslationFromFloats(e,t,i){return this._m[12]+=e,this._m[13]+=t,this._m[14]+=i,this.markAsUpdated(),this}setTranslation(e){return this.setTranslationFromFloats(e._x,e._y,e._z)}getTranslation(){return new t5(this._m[12],this._m[13],this._m[14])}getTranslationToRef(e){return e.x=this._m[12],e.y=this._m[13],e.z=this._m[14],e}removeRotationAndScaling(){let e=this.m;return t7.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,e[12],e[13],e[14],e[15],this),this._updateIdentityStatus(0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]),this}multiply(e){let t=new this.constructor;return this.multiplyToRef(e,t),t}copyFrom(e){return e.copyToArray(this._m),this.updateFlag=e.updateFlag,this._updateIdentityStatus(e._isIdentity,e._isIdentityDirty,e._isIdentity3x2,e._isIdentity3x2Dirty),this}copyToArray(e,t=0){let i=this._m;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],this}multiplyToRef(e,t){return this._isIdentity?t.copyFrom(e):e._isIdentity?t.copyFrom(this):(this.multiplyToArray(e,t._m,0),t.markAsUpdated()),t}multiplyToArray(e,t,i){let r=this._m,s=e.m,n=r[0],a=r[1],o=r[2],l=r[3],h=r[4],u=r[5],c=r[6],d=r[7],p=r[8],_=r[9],f=r[10],m=r[11],g=r[12],v=r[13],x=r[14],T=r[15],b=s[0],E=s[1],S=s[2],C=s[3],y=s[4],A=s[5],R=s[6],I=s[7],P=s[8],M=s[9],D=s[10],O=s[11],N=s[12],F=s[13],w=s[14],L=s[15];return t[i]=n*b+a*y+o*P+l*N,t[i+1]=n*E+a*A+o*M+l*F,t[i+2]=n*S+a*R+o*D+l*w,t[i+3]=n*C+a*I+o*O+l*L,t[i+4]=h*b+u*y+c*P+d*N,t[i+5]=h*E+u*A+c*M+d*F,t[i+6]=h*S+u*R+c*D+d*w,t[i+7]=h*C+u*I+c*O+d*L,t[i+8]=p*b+_*y+f*P+m*N,t[i+9]=p*E+_*A+f*M+m*F,t[i+10]=p*S+_*R+f*D+m*w,t[i+11]=p*C+_*I+f*O+m*L,t[i+12]=g*b+v*y+x*P+T*N,t[i+13]=g*E+v*A+x*M+T*F,t[i+14]=g*S+v*R+x*D+T*w,t[i+15]=g*C+v*I+x*O+T*L,this}equals(e){if(!e)return!1;if((this._isIdentity||e._isIdentity)&&!this._isIdentityDirty&&!e._isIdentityDirty)return this._isIdentity&&e._isIdentity;let t=this.m,i=e.m;return t[0]===i[0]&&t[1]===i[1]&&t[2]===i[2]&&t[3]===i[3]&&t[4]===i[4]&&t[5]===i[5]&&t[6]===i[6]&&t[7]===i[7]&&t[8]===i[8]&&t[9]===i[9]&&t[10]===i[10]&&t[11]===i[11]&&t[12]===i[12]&&t[13]===i[13]&&t[14]===i[14]&&t[15]===i[15]}clone(){let e=new this.constructor;return e.copyFrom(this),e}getClassName(){return"Matrix"}getHashCode(){let e=t3(this._m[0]);for(let t=1;t<16;t++)e=397*e^t3(this._m[t]);return e}decomposeToTransformNode(e){return e.rotationQuaternion=e.rotationQuaternion||new t8,this.decompose(e.scaling,e.rotationQuaternion,e.position)}decompose(e,t,i,r,s=!0){if(this._isIdentity)return i&&i.setAll(0),e&&e.setAll(1),t&&t.copyFromFloats(0,0,0,1),!0;let n=this._m;if(i&&i.copyFromFloats(n[12],n[13],n[14]),(e=e||t9.Vector3[0]).x=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]),e.y=Math.sqrt(n[4]*n[4]+n[5]*n[5]+n[6]*n[6]),e.z=Math.sqrt(n[8]*n[8]+n[9]*n[9]+n[10]*n[10]),r){let t=(s?r.absoluteScaling.x:r.scaling.x)<0?-1:1,i=(s?r.absoluteScaling.y:r.scaling.y)<0?-1:1,n=(s?r.absoluteScaling.z:r.scaling.z)<0?-1:1;e.x*=t,e.y*=i,e.z*=n}else 0>=this.determinant()&&(e.y*=-1);if(0===e._x||0===e._y||0===e._z)return t&&t.copyFromFloats(0,0,0,1),!1;if(t){let i=1/e._x,r=1/e._y,s=1/e._z;t7.FromValuesToRef(n[0]*i,n[1]*i,n[2]*i,0,n[4]*r,n[5]*r,n[6]*r,0,n[8]*s,n[9]*s,n[10]*s,0,0,0,0,1,t9.Matrix[0]),t8.FromRotationMatrixToRef(t9.Matrix[0],t)}return!0}getRow(e){if(e<0||e>3)return null;let t=4*e;return new t6(this._m[t+0],this._m[t+1],this._m[t+2],this._m[t+3])}getRowToRef(e,t){if(e>=0&&e<=3){let i=4*e;t.x=this._m[i+0],t.y=this._m[i+1],t.z=this._m[i+2],t.w=this._m[i+3]}return t}setRow(e,t){return this.setRowFromFloats(e,t.x,t.y,t.z,t.w)}transpose(){let e=new this.constructor;return t7.TransposeToRef(this,e),e}transposeToRef(e){return t7.TransposeToRef(this,e),e}setRowFromFloats(e,t,i,r,s){if(e<0||e>3)return this;let n=4*e;return this._m[n+0]=t,this._m[n+1]=i,this._m[n+2]=r,this._m[n+3]=s,this.markAsUpdated(),this}scale(e){let t=new this.constructor;return this.scaleToRef(e,t),t}scaleToRef(e,t){for(let i=0;i<16;i++)t._m[i]=this._m[i]*e;return t.markAsUpdated(),t}scaleAndAddToRef(e,t){for(let i=0;i<16;i++)t._m[i]+=this._m[i]*e;return t.markAsUpdated(),t}toNormalMatrix(e){let t=t9.Matrix[0];this.invertToRef(t),t.transposeToRef(e);let i=e._m;return t7.FromValuesToRef(i[0],i[1],i[2],0,i[4],i[5],i[6],0,i[8],i[9],i[10],0,0,0,0,1,e),e}getRotationMatrix(){let e=new this.constructor;return this.getRotationMatrixToRef(e),e}getRotationMatrixToRef(e){let t=t9.Vector3[0];if(!this.decompose(t))return t7.IdentityToRef(e),e;let i=this._m,r=1/t._x,s=1/t._y,n=1/t._z;return t7.FromValuesToRef(i[0]*r,i[1]*r,i[2]*r,0,i[4]*s,i[5]*s,i[6]*s,0,i[8]*n,i[9]*n,i[10]*n,0,0,0,0,1,e),e}toggleModelMatrixHandInPlace(){let e=this._m;return e[2]*=-1,e[6]*=-1,e[8]*=-1,e[9]*=-1,e[14]*=-1,this.markAsUpdated(),this}toggleProjectionMatrixHandInPlace(){let e=this._m;return e[8]*=-1,e[9]*=-1,e[10]*=-1,e[11]*=-1,this.markAsUpdated(),this}static FromArray(e,t=0){let i=new t7;return t7.FromArrayToRef(e,t,i),i}static FromArrayToRef(e,t,i){for(let r=0;r<16;r++)i._m[r]=e[r+t];return i.markAsUpdated(),i}static FromFloat32ArrayToRefScaled(e,t,i,r){for(let s=0;s<16;s++)r._m[s]=e[s+t]*i;return r.markAsUpdated(),r}static get IdentityReadOnly(){return t7._IdentityReadOnly}static FromValuesToRef(e,t,i,r,s,n,a,o,l,h,u,c,d,p,_,f,m){let g=m._m;g[0]=e,g[1]=t,g[2]=i,g[3]=r,g[4]=s,g[5]=n,g[6]=a,g[7]=o,g[8]=l,g[9]=h,g[10]=u,g[11]=c,g[12]=d,g[13]=p,g[14]=_,g[15]=f,m.markAsUpdated()}static FromValues(e,t,i,r,s,n,a,o,l,h,u,c,d,p,_,f){let m=new t7,g=m._m;return g[0]=e,g[1]=t,g[2]=i,g[3]=r,g[4]=s,g[5]=n,g[6]=a,g[7]=o,g[8]=l,g[9]=h,g[10]=u,g[11]=c,g[12]=d,g[13]=p,g[14]=_,g[15]=f,m.markAsUpdated(),m}static Compose(e,t,i){let r=new t7;return t7.ComposeToRef(e,t,i,r),r}static ComposeToRef(e,t,i,r){let s=r._m,n=t._x,a=t._y,o=t._z,l=t._w,h=n+n,u=a+a,c=o+o,d=n*h,p=n*u,_=n*c,f=a*u,m=a*c,g=o*c,v=l*h,x=l*u,T=l*c,b=e._x,E=e._y,S=e._z;return s[0]=(1-(f+g))*b,s[1]=(p+T)*b,s[2]=(_-x)*b,s[3]=0,s[4]=(p-T)*E,s[5]=(1-(d+g))*E,s[6]=(m+v)*E,s[7]=0,s[8]=(_+x)*S,s[9]=(m-v)*S,s[10]=(1-(d+f))*S,s[11]=0,s[12]=i._x,s[13]=i._y,s[14]=i._z,s[15]=1,r.markAsUpdated(),r}static Identity(){let e=t7.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return e._updateIdentityStatus(!0),e}static IdentityToRef(e){return t7.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,e),e._updateIdentityStatus(!0),e}static Zero(){let e=t7.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return e._updateIdentityStatus(!1),e}static RotationX(e){let t=new t7;return t7.RotationXToRef(e,t),t}static Invert(e){let t=new e.constructor;return e.invertToRef(t),t}static RotationXToRef(e,t){let i=Math.sin(e),r=Math.cos(e);return t7.FromValuesToRef(1,0,0,0,0,r,i,0,0,-i,r,0,0,0,0,1,t),t._updateIdentityStatus(1===r&&0===i),t}static RotationY(e){let t=new t7;return t7.RotationYToRef(e,t),t}static RotationYToRef(e,t){let i=Math.sin(e),r=Math.cos(e);return t7.FromValuesToRef(r,0,-i,0,0,1,0,0,i,0,r,0,0,0,0,1,t),t._updateIdentityStatus(1===r&&0===i),t}static RotationZ(e){let t=new t7;return t7.RotationZToRef(e,t),t}static RotationZToRef(e,t){let i=Math.sin(e),r=Math.cos(e);return t7.FromValuesToRef(r,i,0,0,-i,r,0,0,0,0,1,0,0,0,0,1,t),t._updateIdentityStatus(1===r&&0===i),t}static RotationAxis(e,t){let i=new t7;return t7.RotationAxisToRef(e,t,i),i}static RotationAxisToRef(e,t,i){let r=Math.sin(-t),s=Math.cos(-t),n=1-s;e.normalize();let a=i._m;return a[0]=e._x*e._x*n+s,a[1]=e._x*e._y*n-e._z*r,a[2]=e._x*e._z*n+e._y*r,a[3]=0,a[4]=e._y*e._x*n+e._z*r,a[5]=e._y*e._y*n+s,a[6]=e._y*e._z*n-e._x*r,a[7]=0,a[8]=e._z*e._x*n-e._y*r,a[9]=e._z*e._y*n+e._x*r,a[10]=e._z*e._z*n+s,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,i.markAsUpdated(),i}static RotationAlignToRef(e,t,i,r=!1){let s=t5.Dot(t,e),n=i._m;if(s<-.999)n[0]=-1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=r?1:-1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=r?-1:1,n[11]=0;else{let i=t5.Cross(t,e),r=1/(1+s);n[0]=i._x*i._x*r+s,n[1]=i._y*i._x*r-i._z,n[2]=i._z*i._x*r+i._y,n[3]=0,n[4]=i._x*i._y*r+i._z,n[5]=i._y*i._y*r+s,n[6]=i._z*i._y*r-i._x,n[7]=0,n[8]=i._x*i._z*r-i._y,n[9]=i._y*i._z*r+i._x,n[10]=i._z*i._z*r+s,n[11]=0}return n[12]=0,n[13]=0,n[14]=0,n[15]=1,i.markAsUpdated(),i}static RotationYawPitchRoll(e,t,i){let r=new t7;return t7.RotationYawPitchRollToRef(e,t,i,r),r}static RotationYawPitchRollToRef(e,t,i,r){return t8.RotationYawPitchRollToRef(e,t,i,t9.Quaternion[0]),t9.Quaternion[0].toRotationMatrix(r),r}static Scaling(e,t,i){let r=new t7;return t7.ScalingToRef(e,t,i,r),r}static ScalingToRef(e,t,i,r){return t7.FromValuesToRef(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1,r),r._updateIdentityStatus(1===e&&1===t&&1===i),r}static Translation(e,t,i){let r=new t7;return t7.TranslationToRef(e,t,i,r),r}static TranslationToRef(e,t,i,r){return t7.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,e,t,i,1,r),r._updateIdentityStatus(0===e&&0===t&&0===i),r}static Lerp(e,t,i){let r=new e.constructor;return t7.LerpToRef(e,t,i,r),r}static LerpToRef(e,t,i,r){let s=r._m,n=e.m,a=t.m;for(let e=0;e<16;e++)s[e]=n[e]*(1-i)+a[e]*i;return r.markAsUpdated(),r}static DecomposeLerp(e,t,i){let r=new e.constructor;return t7.DecomposeLerpToRef(e,t,i,r),r}static DecomposeLerpToRef(e,t,i,r){let s=t9.Vector3[0],n=t9.Quaternion[0],a=t9.Vector3[1];e.decompose(s,n,a);let o=t9.Vector3[2],l=t9.Quaternion[1],h=t9.Vector3[3];t.decompose(o,l,h);let u=t9.Vector3[4];t5.LerpToRef(s,o,i,u);let c=t9.Quaternion[2];t8.SlerpToRef(n,l,i,c);let d=t9.Vector3[5];return t5.LerpToRef(a,h,i,d),t7.ComposeToRef(u,c,d,r),r}static LookAtLH(e,t,i){let r=new t7;return t7.LookAtLHToRef(e,t,i,r),r}static LookAtLHToRef(e,t,i,r){let s=t9.Vector3[0],n=t9.Vector3[1],a=t9.Vector3[2];t.subtractToRef(e,a),a.normalize(),t5.CrossToRef(i,a,s);let o=s.lengthSquared();0===o?s.x=1:s.normalizeFromLength(Math.sqrt(o)),t5.CrossToRef(a,s,n),n.normalize();let l=-t5.Dot(s,e),h=-t5.Dot(n,e),u=-t5.Dot(a,e);return t7.FromValuesToRef(s._x,n._x,a._x,0,s._y,n._y,a._y,0,s._z,n._z,a._z,0,l,h,u,1,r),r}static LookAtRH(e,t,i){let r=new t7;return t7.LookAtRHToRef(e,t,i,r),r}static LookAtRHToRef(e,t,i,r){let s=t9.Vector3[0],n=t9.Vector3[1],a=t9.Vector3[2];e.subtractToRef(t,a),a.normalize(),t5.CrossToRef(i,a,s);let o=s.lengthSquared();0===o?s.x=1:s.normalizeFromLength(Math.sqrt(o)),t5.CrossToRef(a,s,n),n.normalize();let l=-t5.Dot(s,e),h=-t5.Dot(n,e),u=-t5.Dot(a,e);return t7.FromValuesToRef(s._x,n._x,a._x,0,s._y,n._y,a._y,0,s._z,n._z,a._z,0,l,h,u,1,r),r}static LookDirectionLH(e,t){let i=new t7;return t7.LookDirectionLHToRef(e,t,i),i}static LookDirectionLHToRef(e,t,i){let r=t9.Vector3[0];r.copyFrom(e),r.scaleInPlace(-1);let s=t9.Vector3[1];return t5.CrossToRef(t,r,s),t7.FromValuesToRef(s._x,s._y,s._z,0,t._x,t._y,t._z,0,r._x,r._y,r._z,0,0,0,0,1,i),i}static LookDirectionRH(e,t){let i=new t7;return t7.LookDirectionRHToRef(e,t,i),i}static LookDirectionRHToRef(e,t,i){let r=t9.Vector3[2];return t5.CrossToRef(t,e,r),t7.FromValuesToRef(r._x,r._y,r._z,0,t._x,t._y,t._z,0,e._x,e._y,e._z,0,0,0,0,1,i),i}static OrthoLH(e,t,i,r,s){let n=new t7;return t7.OrthoLHToRef(e,t,i,r,n,s),n}static OrthoLHToRef(e,t,i,r,s,n){let a=2/e,o=2/t,l=2/(r-i),h=-(r+i)/(r-i);return t7.FromValuesToRef(a,0,0,0,0,o,0,0,0,0,l,0,0,0,h,1,s),n&&s.multiplyToRef(it,s),s._updateIdentityStatus(1===a&&1===o&&1===l&&0===h),s}static OrthoOffCenterLH(e,t,i,r,s,n,a){let o=new t7;return t7.OrthoOffCenterLHToRef(e,t,i,r,s,n,o,a),o}static OrthoOffCenterLHToRef(e,t,i,r,s,n,a,o){return t7.FromValuesToRef(2/(t-e),0,0,0,0,2/(r-i),0,0,0,0,2/(n-s),0,(e+t)/(e-t),(r+i)/(i-r),-(n+s)/(n-s),1,a),o&&a.multiplyToRef(it,a),a.markAsUpdated(),a}static ObliqueOffCenterLHToRef(e,t,i,r,s,n,a,o,l,h,u){let c=-a*Math.cos(o),d=-a*Math.sin(o);return t7.TranslationToRef(0,0,-l,t9.Matrix[1]),t7.FromValuesToRef(1,0,0,0,0,1,0,0,c,d,1,0,0,0,0,1,t9.Matrix[0]),t9.Matrix[1].multiplyToRef(t9.Matrix[0],t9.Matrix[0]),t7.TranslationToRef(0,0,l,t9.Matrix[1]),t9.Matrix[0].multiplyToRef(t9.Matrix[1],t9.Matrix[0]),t7.OrthoOffCenterLHToRef(e,t,i,r,s,n,h,u),t9.Matrix[0].multiplyToRef(h,h),h}static OrthoOffCenterRH(e,t,i,r,s,n,a){let o=new t7;return t7.OrthoOffCenterRHToRef(e,t,i,r,s,n,o,a),o}static OrthoOffCenterRHToRef(e,t,i,r,s,n,a,o){return t7.OrthoOffCenterLHToRef(e,t,i,r,s,n,a,o),a._m[10]*=-1,a}static ObliqueOffCenterRHToRef(e,t,i,r,s,n,a,o,l,h,u){let c=a*Math.cos(o),d=a*Math.sin(o);return t7.TranslationToRef(0,0,l,t9.Matrix[1]),t7.FromValuesToRef(1,0,0,0,0,1,0,0,c,d,1,0,0,0,0,1,t9.Matrix[0]),t9.Matrix[1].multiplyToRef(t9.Matrix[0],t9.Matrix[0]),t7.TranslationToRef(0,0,-l,t9.Matrix[1]),t9.Matrix[0].multiplyToRef(t9.Matrix[1],t9.Matrix[0]),t7.OrthoOffCenterRHToRef(e,t,i,r,s,n,h,u),t9.Matrix[0].multiplyToRef(h,h),h}static PerspectiveLH(e,t,i,r,s,n=0){let a=new t7;return t7.FromValuesToRef(2*i/e,0,0,0,0,2*i/t,0,Math.tan(n),0,0,(r+i)/(r-i),1,0,0,-2*r*i/(r-i),0,a),s&&a.multiplyToRef(it,a),a._updateIdentityStatus(!1),a}static PerspectiveFovLH(e,t,i,r,s,n=0,a=!1){let o=new t7;return t7.PerspectiveFovLHToRef(e,t,i,r,o,!0,s,n,a),o}static PerspectiveFovLHToRef(e,t,i,r,s,n=!0,a,o=0,l=!1){let h=1/Math.tan(.5*e),u=n?h/t:h,c=n?h:h*t,d=l&&0===i?-1:0!==r?(r+i)/(r-i):1,p=l&&0===i?2*r:0!==r?-2*r*i/(r-i):-2*i;return t7.FromValuesToRef(u,0,0,0,0,c,0,Math.tan(o),0,0,d,1,0,0,p,0,s),a&&s.multiplyToRef(it,s),s._updateIdentityStatus(!1),s}static PerspectiveFovReverseLHToRef(e,t,i,r,s,n=!0,a,o=0){let l=1/Math.tan(.5*e),h=n?l/t:l,u=n?l:l*t;return t7.FromValuesToRef(h,0,0,0,0,u,0,Math.tan(o),0,0,-i,1,0,0,1,0,s),a&&s.multiplyToRef(it,s),s._updateIdentityStatus(!1),s}static PerspectiveFovRH(e,t,i,r,s,n=0,a=!1){let o=new t7;return t7.PerspectiveFovRHToRef(e,t,i,r,o,!0,s,n,a),o}static PerspectiveFovRHToRef(e,t,i,r,s,n=!0,a,o=0,l=!1){let h=1/Math.tan(.5*e),u=n?h/t:h,c=n?h:h*t,d=l&&0===i?1:0!==r?-(r+i)/(r-i):-1,p=l&&0===i?2*r:0!==r?-2*r*i/(r-i):-2*i;return t7.FromValuesToRef(u,0,0,0,0,c,0,Math.tan(o),0,0,d,-1,0,0,p,0,s),a&&s.multiplyToRef(it,s),s._updateIdentityStatus(!1),s}static PerspectiveFovReverseRHToRef(e,t,i,r,s,n=!0,a,o=0){let l=1/Math.tan(.5*e),h=n?l/t:l,u=n?l:l*t;return t7.FromValuesToRef(h,0,0,0,0,u,0,Math.tan(o),0,0,-i,-1,0,0,-1,0,s),a&&s.multiplyToRef(it,s),s._updateIdentityStatus(!1),s}static GetFinalMatrix(e,t,i,r,s,n){let a=e.width,o=e.height,l=e.x,h=e.y,u=t7.FromValues(a/2,0,0,0,0,-o/2,0,0,0,0,n-s,0,l+a/2,o/2+h,s,1),c=new t.constructor;return t.multiplyToRef(i,c),c.multiplyToRef(r,c),c.multiplyToRef(u,c)}static GetAsMatrix2x2(e){let t=e.m,i=[t[0],t[1],t[4],t[5]];return t1.MatrixUse64Bits?i:new Float32Array(i)}static GetAsMatrix3x3(e){let t=e.m,i=[t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10]];return t1.MatrixUse64Bits?i:new Float32Array(i)}static Transpose(e){let t=new e.constructor;return t7.TransposeToRef(e,t),t}static TransposeToRef(e,t){let i=e.m,r=i[0],s=i[4],n=i[8],a=i[12],o=i[1],l=i[5],h=i[9],u=i[13],c=i[2],d=i[6],p=i[10],_=i[14],f=i[3],m=i[7],g=i[11],v=i[15],x=t._m;return x[0]=r,x[1]=s,x[2]=n,x[3]=a,x[4]=o,x[5]=l,x[6]=h,x[7]=u,x[8]=c,x[9]=d,x[10]=p,x[11]=_,x[12]=f,x[13]=m,x[14]=g,x[15]=v,t.markAsUpdated(),t._updateIdentityStatus(e._isIdentity,e._isIdentityDirty),t}static Reflection(e){let t=new t7;return t7.ReflectionToRef(e,t),t}static ReflectionToRef(e,t){e.normalize();let i=e.normal.x,r=e.normal.y,s=e.normal.z,n=-2*i,a=-2*r,o=-2*s;return t7.FromValuesToRef(n*i+1,a*i,o*i,0,n*r,a*r+1,o*r,0,n*s,a*s,o*s+1,0,n*e.d,a*e.d,o*e.d,1,t),t}static FromXYZAxesToRef(e,t,i,r){return t7.FromValuesToRef(e._x,e._y,e._z,0,t._x,t._y,t._z,0,i._x,i._y,i._z,0,0,0,0,1,r),r}static FromQuaternionToRef(e,t){let i=e._x*e._x,r=e._y*e._y,s=e._z*e._z,n=e._x*e._y,a=e._z*e._w,o=e._z*e._x,l=e._y*e._w,h=e._y*e._z,u=e._x*e._w;return t._m[0]=1-2*(r+s),t._m[1]=2*(n+a),t._m[2]=2*(o-l),t._m[3]=0,t._m[4]=2*(n-a),t._m[5]=1-2*(s+i),t._m[6]=2*(h+u),t._m[7]=0,t._m[8]=2*(o+l),t._m[9]=2*(h-u),t._m[10]=1-2*(r+i),t._m[11]=0,t._m[12]=0,t._m[13]=0,t._m[14]=0,t._m[15]=1,t.markAsUpdated(),t}}t7._UpdateFlagSeed=0,t7._IdentityReadOnly=t7.Identity();class t9{}t9.Vector3=tQ.BuildTuple(11,t5.Zero),t9.Matrix=tQ.BuildTuple(2,t7.Identity),t9.Quaternion=tQ.BuildTuple(3,t8.Zero);class ie{}ie.Vector2=tQ.BuildTuple(3,t4.Zero),ie.Vector3=tQ.BuildTuple(13,t5.Zero),ie.Vector4=tQ.BuildTuple(3,t6.Zero),ie.Quaternion=tQ.BuildTuple(2,t8.Zero),ie.Matrix=tQ.BuildTuple(8,t7.Identity),t0["BABYLON.Vector2"]=t4,t0["BABYLON.Vector3"]=t5,t0["BABYLON.Vector4"]=t6,t0["BABYLON.Matrix"]=t7;let it=t7.FromValues(1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1);function ii(e){return Math.pow(e,2.2)}function ir(e){return e<=.04045?.0773993808*e:Math.pow(.947867299*(e+.055),2.4)}function is(e){return Math.pow(e,t$)}function ia(e){return e<=.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class io{constructor(e=0,t=0,i=0){this.r=e,this.g=t,this.b=i}toString(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+"}"}getClassName(){return"Color3"}getHashCode(){let e=255*this.r|0;return 397*(e=397*e^(255*this.g|0))^(255*this.b|0)}toArray(e,t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,this}fromArray(e,t=0){return io.FromArrayToRef(e,t,this),this}toColor4(e=1){return new il(this.r,this.g,this.b,e)}asArray(){return[this.r,this.g,this.b]}toLuminance(){return .3*this.r+.59*this.g+.11*this.b}multiply(e){return new io(this.r*e.r,this.g*e.g,this.b*e.b)}multiplyToRef(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,this}equals(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b}equalsFloats(e,t,i){return this.r===e&&this.g===t&&this.b===i}scale(e){return new io(this.r*e,this.g*e,this.b*e)}scaleInPlace(e){return this.r*=e,this.g*=e,this.b*=e,this}scaleToRef(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,this}scaleAndAddToRef(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,this}clampToRef(e=0,t=1,i){return i.r=tK.Clamp(this.r,e,t),i.g=tK.Clamp(this.g,e,t),i.b=tK.Clamp(this.b,e,t),this}add(e){return new io(this.r+e.r,this.g+e.g,this.b+e.b)}addToRef(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,this}subtract(e){return new io(this.r-e.r,this.g-e.g,this.b-e.b)}subtractToRef(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,this}clone(){return new io(this.r,this.g,this.b)}copyFrom(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copyFromFloats(e,t,i){return this.r=e,this.g=t,this.b=i,this}set(e,t,i){return this.copyFromFloats(e,t,i)}toHexString(){let e=Math.round(255*this.r),t=Math.round(255*this.g),i=Math.round(255*this.b);return"#"+tK.ToHex(e)+tK.ToHex(t)+tK.ToHex(i)}toHSV(){let e=new io;return this.toHSVToRef(e),e}toHSVToRef(e){let t=this.r,i=this.g,r=this.b,s=Math.max(t,i,r),n=Math.min(t,i,r),a=0,o=0,l=s-n;0!==s&&(o=l/s),s!=n&&(s==t?(a=(i-r)/l,i=0&&n<=1?(o=s,l=a):n>=1&&n<=2?(o=a,l=s):n>=2&&n<=3?(l=s,h=a):n>=3&&n<=4?(l=a,h=s):n>=4&&n<=5?(o=a,h=s):n>=5&&n<=6&&(o=s,h=a);let u=i-s;r.set(o+u,l+u,h+u)}static FromHSV(e,t,i){let r=new io(0,0,0);return io.HSVtoRGBToRef(e,t,i,r),r}static FromHexString(e){if("#"!==e.substring(0,1)||7!==e.length)return new io(0,0,0);let t=parseInt(e.substring(1,3),16),i=parseInt(e.substring(3,5),16),r=parseInt(e.substring(5,7),16);return io.FromInts(t,i,r)}static FromArray(e,t=0){return new io(e[t],e[t+1],e[t+2])}static FromArrayToRef(e,t=0,i){i.r=e[t],i.g=e[t+1],i.b=e[t+2]}static FromInts(e,t,i){return new io(e/255,t/255,i/255)}static Lerp(e,t,i){let r=new io(0,0,0);return io.LerpToRef(e,t,i,r),r}static LerpToRef(e,t,i,r){r.r=e.r+(t.r-e.r)*i,r.g=e.g+(t.g-e.g)*i,r.b=e.b+(t.b-e.b)*i}static Hermite(e,t,i,r,s){let n=s*s,a=s*n,o=2*a-3*n+1,l=-2*a+3*n,h=a-2*n+s,u=a-n;return new io(e.r*o+i.r*l+t.r*h+r.r*u,e.g*o+i.g*l+t.g*h+r.g*u,e.b*o+i.b*l+t.b*h+r.b*u)}static Hermite1stDerivative(e,t,i,r,s){let n=io.Black();return this.Hermite1stDerivativeToRef(e,t,i,r,s,n),n}static Hermite1stDerivativeToRef(e,t,i,r,s,n){let a=s*s;n.r=(a-s)*6*e.r+(3*a-4*s+1)*t.r+(-a+s)*6*i.r+(3*a-2*s)*r.r,n.g=(a-s)*6*e.g+(3*a-4*s+1)*t.g+(-a+s)*6*i.g+(3*a-2*s)*r.g,n.b=(a-s)*6*e.b+(3*a-4*s+1)*t.b+(-a+s)*6*i.b+(3*a-2*s)*r.b}static Red(){return new io(1,0,0)}static Green(){return new io(0,1,0)}static Blue(){return new io(0,0,1)}static Black(){return new io(0,0,0)}static get BlackReadOnly(){return io._BlackReadOnly}static White(){return new io(1,1,1)}static Purple(){return new io(.5,0,.5)}static Magenta(){return new io(1,0,1)}static Yellow(){return new io(1,1,0)}static Gray(){return new io(.5,.5,.5)}static Teal(){return new io(0,1,1)}static Random(){return new io(Math.random(),Math.random(),Math.random())}}io._BlackReadOnly=io.Black();class il{constructor(e=0,t=0,i=0,r=1){this.r=e,this.g=t,this.b=i,this.a=r}addInPlace(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this.a+=e.a,this}asArray(){return[this.r,this.g,this.b,this.a]}toArray(e,t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e[t+3]=this.a,this}fromArray(e,t=0){return il.FromArrayToRef(e,t,this),this}equals(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}add(e){return new il(this.r+e.r,this.g+e.g,this.b+e.b,this.a+e.a)}subtract(e){return new il(this.r-e.r,this.g-e.g,this.b-e.b,this.a-e.a)}subtractToRef(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,t.a=this.a-e.a,this}scale(e){return new il(this.r*e,this.g*e,this.b*e,this.a*e)}scaleInPlace(e){return this.r*=e,this.g*=e,this.b*=e,this.a*=e,this}scaleToRef(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,t.a=this.a*e,this}scaleAndAddToRef(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,t.a+=this.a*e,this}clampToRef(e=0,t=1,i){return i.r=tK.Clamp(this.r,e,t),i.g=tK.Clamp(this.g,e,t),i.b=tK.Clamp(this.b,e,t),i.a=tK.Clamp(this.a,e,t),this}multiply(e){return new il(this.r*e.r,this.g*e.g,this.b*e.b,this.a*e.a)}multiplyToRef(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,t.a=this.a*e.a,t}toString(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"}getClassName(){return"Color4"}getHashCode(){let e=255*this.r|0;return 397*(e=397*(e=397*e^(255*this.g|0))^(255*this.b|0))^(255*this.a|0)}clone(){return new il(this.r,this.g,this.b,this.a)}copyFrom(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}copyFromFloats(e,t,i,r){return this.r=e,this.g=t,this.b=i,this.a=r,this}set(e,t,i,r){return this.copyFromFloats(e,t,i,r)}toHexString(e=!1){let t=Math.round(255*this.r),i=Math.round(255*this.g),r=Math.round(255*this.b);if(e)return"#"+tK.ToHex(t)+tK.ToHex(i)+tK.ToHex(r);let s=Math.round(255*this.a);return"#"+tK.ToHex(t)+tK.ToHex(i)+tK.ToHex(r)+tK.ToHex(s)}toLinearSpace(e=!1){let t=new il;return this.toLinearSpaceToRef(t,e),t}toLinearSpaceToRef(e,t=!1){return t?(e.r=ir(this.r),e.g=ir(this.g),e.b=ir(this.b)):(e.r=ii(this.r),e.g=ii(this.g),e.b=ii(this.b)),e.a=this.a,this}toGammaSpace(e=!1){let t=new il;return this.toGammaSpaceToRef(t,e),t}toGammaSpaceToRef(e,t=!1){return t?(e.r=ia(this.r),e.g=ia(this.g),e.b=ia(this.b)):(e.r=is(this.r),e.g=is(this.g),e.b=is(this.b)),e.a=this.a,this}static FromHexString(e){if("#"!==e.substring(0,1)||9!==e.length&&7!==e.length)return new il(0,0,0,0);let t=parseInt(e.substring(1,3),16),i=parseInt(e.substring(3,5),16),r=parseInt(e.substring(5,7),16),s=9===e.length?parseInt(e.substring(7,9),16):255;return il.FromInts(t,i,r,s)}static Lerp(e,t,i){let r=new il(0,0,0,0);return il.LerpToRef(e,t,i,r),r}static LerpToRef(e,t,i,r){r.r=e.r+(t.r-e.r)*i,r.g=e.g+(t.g-e.g)*i,r.b=e.b+(t.b-e.b)*i,r.a=e.a+(t.a-e.a)*i}static Hermite(e,t,i,r,s){let n=s*s,a=s*n,o=2*a-3*n+1,l=-2*a+3*n,h=a-2*n+s,u=a-n,c=e.r*o+i.r*l+t.r*h+r.r*u;return new il(c,e.g*o+i.g*l+t.g*h+r.g*u,e.b*o+i.b*l+t.b*h+r.b*u,e.a*o+i.a*l+t.a*h+r.a*u)}static Hermite1stDerivative(e,t,i,r,s){let n=new il;return this.Hermite1stDerivativeToRef(e,t,i,r,s,n),n}static Hermite1stDerivativeToRef(e,t,i,r,s,n){let a=s*s;n.r=(a-s)*6*e.r+(3*a-4*s+1)*t.r+(-a+s)*6*i.r+(3*a-2*s)*r.r,n.g=(a-s)*6*e.g+(3*a-4*s+1)*t.g+(-a+s)*6*i.g+(3*a-2*s)*r.g,n.b=(a-s)*6*e.b+(3*a-4*s+1)*t.b+(-a+s)*6*i.b+(3*a-2*s)*r.b,n.a=(a-s)*6*e.a+(3*a-4*s+1)*t.a+(-a+s)*6*i.a+(3*a-2*s)*r.a}static FromColor3(e,t=1){return new il(e.r,e.g,e.b,t)}static FromArray(e,t=0){return new il(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t=0,i){i.r=e[t],i.g=e[t+1],i.b=e[t+2],i.a=e[t+3]}static FromInts(e,t,i,r){return new il(e/255,t/255,i/255,r/255)}static CheckColors4(e,t){if(e.length===3*t){let t=[];for(let i=0;inew il(0,0,0,0)),t0["BABYLON.Color3"]=io,t0["BABYLON.Color4"]=il;class iu{constructor(e,t){this.triggerOptions=e,this.onBeforeExecuteObservable=new tj,e.parameter?(this.trigger=e.trigger,this._triggerParameter=e.parameter):e.trigger?this.trigger=e.trigger:this.trigger=e,this._nextActiveAction=this,this._condition=t}_prepare(){}getTriggerParameter(){return this._triggerParameter}setTriggerParameter(e){this._triggerParameter=e}_evaluateConditionForCurrentFrame(){let e=this._condition;if(!e)return!0;let t=this._actionManager.getScene().getRenderId();return e._evaluationId!==t&&(e._evaluationId=t,e._currentResult=e.isValid()),e._currentResult}_executeCurrent(e){this._evaluateConditionForCurrentFrame()&&(this.onBeforeExecuteObservable.notifyObservers(this),this._nextActiveAction.execute(e),this.skipToNextActiveAction())}execute(e){}skipToNextActiveAction(){this._nextActiveAction._child?(this._nextActiveAction._child._actionManager||(this._nextActiveAction._child._actionManager=this._actionManager),this._nextActiveAction=this._nextActiveAction._child):this._nextActiveAction=this}then(e){return this._child=e,e._actionManager=this._actionManager,e._prepare(),e}_getProperty(e){return this._actionManager._getProperty(e)}_getEffectiveTarget(e,t){return this._actionManager._getEffectiveTarget(e,t)}serialize(e){}_serialize(e,t){let i={type:1,children:[],name:e.name,properties:e.properties||[]};if(this._child&&this._child.serialize(i),this._condition){let e=this._condition.serialize();return e.children.push(i),t&&t.children.push(e),e}return t&&t.children.push(i),i}}iu._SerializeValueAsString=e=>"number"==typeof e?e.toString():"boolean"==typeof e?e?"true":"false":e instanceof t4?e.x+", "+e.y:e instanceof t5?e.x+", "+e.y+", "+e.z:e instanceof io?e.r+", "+e.g+", "+e.b:e instanceof il?e.r+", "+e.g+", "+e.b+", "+e.a:e,iu._GetTargetProperty=e=>({name:"target",targetType:e._isMesh?"MeshProperties":e._isLight?"LightProperties":e._isCamera?"CameraProperties":e._isMaterial?"MaterialProperties":"SceneProperties",value:e._isScene?"Scene":e.name}),t0["BABYLON.Action"]=iu;class ic{constructor(e,t,i,r,s,n){this.source=e,this.pointerX=t,this.pointerY=i,this.meshUnderPointer=r,this.sourceEvent=s,this.additionalData=n}static CreateNew(e,t,i){let r=e.getScene();return new ic(e,r.pointerX,r.pointerY,r.meshUnderPointer||e,t,i)}static CreateNewFromSprite(e,t,i,r){return new ic(e,t.pointerX,t.pointerY,t.meshUnderPointer,i,r)}static CreateNewFromScene(e,t){return new ic(null,e.pointerX,e.pointerY,e.meshUnderPointer,t)}static CreateNewFromPrimitive(e,t,i,r){return new ic(e,t.x,t.y,null,i,r)}}class id{constructor(e){this._actionManager=e}isValid(){return!0}_getProperty(e){return this._actionManager._getProperty(e)}_getEffectiveTarget(e,t){return this._actionManager._getEffectiveTarget(e,t)}serialize(){}_serialize(e){return{type:2,children:[],name:e.name,properties:e.properties}}}class ip extends id{static get IsEqual(){return ip._IsEqual}static get IsDifferent(){return ip._IsDifferent}static get IsGreater(){return ip._IsGreater}static get IsLesser(){return ip._IsLesser}constructor(e,t,i,r,s=ip.IsEqual){super(e),this.propertyPath=i,this.value=r,this.operator=s,this._target=t,this._effectiveTarget=this._getEffectiveTarget(t,this.propertyPath),this._property=this._getProperty(this.propertyPath)}isValid(){switch(this.operator){case ip.IsGreater:return this._effectiveTarget[this._property]>this.value;case ip.IsLesser:return this._effectiveTarget[this._property]e<10?"0"+e:""+e,i=new Date;return"["+t(i.getHours())+":"+t(i.getMinutes())+":"+t(i.getSeconds())+"]: "+e}static _LogDisabled(e,t){}static _LogEnabled(e=1,t,i){let r=Array.isArray(t)?t[0]:t;if(void 0!==i&&!ig._CheckLimit(r,i))return;let s=ig._FormatMessage(r),n=this._Levels[e],a=Array.isArray(t)?t.slice(1):[];n.logFunc&&n.logFunc("BJS - "+s,...a);let o=`${s}
`;ig._AddLogEntry(o),ig._GenerateLimitMessage(r,e)}static get LogCache(){return ig._LogCache}static ClearLogCache(){ig._LogCache="",ig._LogLimitOutputs={},ig.errorsCount=0}static set LogLevels(e){ig.Log=ig._LogDisabled,ig.Warn=ig._LogDisabled,ig.Error=ig._LogDisabled,[ig.MessageLogLevel,ig.WarningLogLevel,ig.ErrorLogLevel].forEach(t=>{(e&t)===t&&(ig[this._Levels[t].name]=ig._LogEnabled.bind(ig,t))})}}ig.NoneLogLevel=0,ig.MessageLogLevel=1,ig.WarningLogLevel=2,ig.ErrorLogLevel=4,ig.AllLogLevel=7,ig.MessageLimitReached="Too many %TYPE%s (%LIMIT%), no more %TYPE%s will be reported for this message.",ig._LogCache="",ig._LogLimitOutputs={},ig._Levels=[{},{color:"white",logFunc:console.log,name:"Log"},{color:"orange",logFunc:console.warn,name:"Warn"},{},{color:"red",logFunc:console.error,name:"Error"}],ig.errorsCount=0,ig.Log=ig._LogEnabled.bind(ig,ig.MessageLogLevel),ig.Warn=ig._LogEnabled.bind(ig,ig.WarningLogLevel),ig.Error=ig._LogEnabled.bind(ig,ig.ErrorLogLevel);class iv extends iu{constructor(e,t,i,r){super(e,r),this.propertyPath=i,this._target=this._effectiveTarget=t}_prepare(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)}execute(){this._effectiveTarget[this._property]=!this._effectiveTarget[this._property]}serialize(e){return super._serialize({name:"SwitchBooleanAction",properties:[iu._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath}]},e)}}class ix extends iu{constructor(e,t,i,r){super(e,r),this.value=i,this._target=t}execute(){this._target.state=this.value}serialize(e){return super._serialize({name:"SetStateAction",properties:[iu._GetTargetProperty(this._target),{name:"value",value:this.value}]},e)}}class iT extends iu{constructor(e,t,i,r,s){super(e,s),this.propertyPath=i,this.value=r,this._target=this._effectiveTarget=t}_prepare(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)}execute(){this._effectiveTarget[this._property]=this.value,this._target.markAsDirty&&this._target.markAsDirty(this._property)}serialize(e){return super._serialize({name:"SetValueAction",properties:[iu._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:iu._SerializeValueAsString(this.value)}]},e)}}class ib extends iu{constructor(e,t,i,r,s){super(e,s),this.propertyPath=i,this.value=r,this._target=this._effectiveTarget=t}_prepare(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath),"number"!=typeof this._effectiveTarget[this._property]&&ig.Warn("Warning: IncrementValueAction can only be used with number values")}execute(){this._effectiveTarget[this._property]+=this.value,this._target.markAsDirty&&this._target.markAsDirty(this._property)}serialize(e){return super._serialize({name:"IncrementValueAction",properties:[iu._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:iu._SerializeValueAsString(this.value)}]},e)}}class iE extends iu{constructor(e,t,i,r,s,n){super(e,n),this.from=i,this.to=r,this.loop=s,this._target=t}_prepare(){}execute(){this._actionManager.getScene().beginAnimation(this._target,this.from,this.to,this.loop)}serialize(e){return super._serialize({name:"PlayAnimationAction",properties:[iu._GetTargetProperty(this._target),{name:"from",value:String(this.from)},{name:"to",value:String(this.to)},{name:"loop",value:iu._SerializeValueAsString(this.loop)||!1}]},e)}}class iS extends iu{constructor(e,t,i){super(e,i),this._target=t}_prepare(){}execute(){this._actionManager.getScene().stopAnimation(this._target)}serialize(e){return super._serialize({name:"StopAnimationAction",properties:[iu._GetTargetProperty(this._target)]},e)}}class iC extends iu{constructor(e=0,t){super(e,t)}execute(){}serialize(e){return super._serialize({name:"DoNothingAction",properties:[]},e)}}class iy extends iu{constructor(e,t,i,r=!0){super(e,i),this.children=t,this.enableChildrenConditions=r}_prepare(){for(let e=0;e!e||e.getClassName&&"Mesh"===e.getClassName()?null:e.getClassName&&("SubMesh"===e.getClassName()||"PhysicsBody"===e.getClassName())?e.clone(t):e.clone?e.clone():Array.isArray(e)?e.slice():i&&"object"==typeof e?Object.assign({},e):null;class iP{static DeepCopy(e,t,i,r,s=!1){for(let n of function(e){let t=[];do Object.getOwnPropertyNames(e).forEach(function(e){-1===t.indexOf(e)&&t.push(e)});while(e=Object.getPrototypeOf(e));return t}(e)){if("_"===n[0]&&(!r||-1===r.indexOf(n))||n.endsWith("Observable")||i&&-1!==i.indexOf(n))continue;let a=e[n],o=typeof a;if("function"!==o)try{if("object"===o){if(a instanceof Uint8Array)t[n]=Uint8Array.from(a);else if(a instanceof Array){if(t[n]=[],a.length>0){if("object"==typeof a[0])for(let e=0;e-1&&this._scene.actionManagers.splice(e,1),this._scene.meshes.filter(e=>e.actionManager===this)))t.actionManager=null}getScene(){return this._scene}hasSpecificTriggers(e){for(let t=0;t-1)return!0}return!1}hasSpecificTriggers2(e,t){for(let i=0;i=iM.OnPickTrigger&&t.trigger<=iM.OnPointerOutTrigger)return!0}return!1}get hasPickTriggers(){for(let e=0;e=iM.OnPickTrigger&&t.trigger<=iM.OnPickUpTrigger)return!0}return!1}registerAction(e){return e.trigger===iM.OnEveryFrameTrigger&&this.getScene().actionManager!==this?(ig.Warn("OnEveryFrameTrigger can only be used with scene.actionManager"),null):(this.actions.push(e),this.getScene()._registeredActions++,iM.Triggers[e.trigger]?iM.Triggers[e.trigger]++:iM.Triggers[e.trigger]=1,e._actionManager=this,e._prepare(),e)}unregisterAction(e){let t=this.actions.indexOf(e);return -1!==t&&(this.actions.splice(t,1),iM.Triggers[e.trigger]-=1,0===iM.Triggers[e.trigger]&&delete iM.Triggers[e.trigger],e._actionManager=null,this.getScene()._registeredActions--,!0)}processTrigger(e,t){for(let i=0;i{let i=t0["BABYLON."+e];return i&&new i(...t)},n=(e,t,i,r)=>{if(null===r){let e=parseFloat(t);return"true"===t||"false"===t?"true"===t:isNaN(e)?t:e}let s=r.split("."),n=t.split(",");for(let e=0;e{if(e.detached)return;let u=[],c=null,d=null,p=e.combine&&e.combine.length>0;if(2===e.type?u.push(r):u.push(t),p){let t=[];for(let i=0;i0){let e=s.properties[0].value,t=null===s.properties[0].targetType?e:i.getMeshByName(e);t._meshId&&(t.mesh=i.getMeshById(t._meshId)),r={trigger:iM[s.name],parameter:t}}else r=iM[s.name];for(let e=0;e(e=e.slice(1,e.length-1),iN._HandleParenthesisContent(e,t))):iN._HandleParenthesisContent(e,t))||"false"!==e&&iN.Eval(e,t)}static _HandleParenthesisContent(e,t){let i;t=t||(e=>"true"===e);let r=e.split("||");for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e)){let s=iN._SimplifyNegation(r[e].trim()),n=s.split("&&");if(n.length>1)for(let e=0;e(e=e.replace(/[\s]/g,()=>"")).length%2?"!":"")).trim())?e="false":"!false"===e&&(e="true"),e}}class iF{static EnableFor(e){e._tags=e._tags||{},e.hasTags=()=>iF.HasTags(e),e.addTags=t=>iF.AddTagsTo(e,t),e.removeTags=t=>iF.RemoveTagsFrom(e,t),e.matchesTagsQuery=t=>iF.MatchesQuery(e,t)}static DisableFor(e){delete e._tags,delete e.hasTags,delete e.addTags,delete e.removeTags,delete e.matchesTagsQuery}static HasTags(e){if(!e._tags)return!1;let t=e._tags;for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1}static GetTags(e,t=!0){if(!e._tags)return null;if(!t)return e._tags;{let t=[];for(let i in e._tags)Object.prototype.hasOwnProperty.call(e._tags,i)&&!0===e._tags[i]&&t.push(i);return t.join(" ")}}static AddTagsTo(e,t){t&&"string"==typeof t&&t.split(" ").forEach(function(t){iF._AddTagTo(e,t)})}static _AddTagTo(e,t){""===(t=t.trim())||"true"===t||"false"===t||t.match(/[\s]/)||t.match(/^([!]|([|]|[&]){2})/)||(iF.EnableFor(e),e._tags[t]=!0)}static RemoveTagsFrom(e,t){if(!iF.HasTags(e))return;let i=t.split(" ");for(let t in i)iF._RemoveTagFrom(e,i[t])}static _RemoveTagFrom(e,t){delete e._tags[t]}static MatchesQuery(e,t){return void 0===t||(""===t?iF.HasTags(e):iN.Eval(t,t=>iF.HasTags(e)&&e._tags[t]))}}let iw={};function iL(e,t=!1){if(!t||!iw[e])return iw[e]=!0,`${e} needs to be imported before as it contains a side-effect required by your code.`}let iB={},iU={},iV=function(e,t,i,r={}){let s=e();iF&&iF.HasTags(t)&&iF.AddTagsTo(s,iF.GetTags(t,!0));let n=ik(s),a={};for(let e in n){let o=n[e],l=t[e],h=o.type;if(null!=l&&("uniqueId"!==e||i$.AllowLoadingUniqueId))switch(h){case 0:case 6:case 11:s[e]=l;break;case 1:r.cloneTexturesOnlyOnce&&a[l.uniqueId]?s[e]=a[l.uniqueId]:(s[e]=i||l.isRenderTarget?l:l.clone(),a[l.uniqueId]=s[e]);break;case 2:case 3:case 4:case 5:case 7:case 10:case 12:s[e]=i?l:l.clone()}}return s};function ik(e){let t=e.getClassName();if(iU[t])return iU[t];iU[t]={};let i=iU[t],r=e,s=t;for(;s;){let e;let t=iB[s];for(let e in t)i[e]=t[e];let n=!1;do{if(!(e=Object.getPrototypeOf(r)).getClassName){n=!0;break}if(e.getClassName()!==s)break;r=e}while(e);if(n)break;s=e.getClassName(),r=e}return i}function iG(e,t){return(i,r)=>{let s=function(e){let t=e.getClassName();return iB[t]||(iB[t]={}),iB[t]}(i);s[r]||(s[r]={type:e,sourceName:t})}}function iz(e,t=null){return function(e,t=null){return(i,r)=>{let s=t||"_"+r;Object.defineProperty(i,r,{get:function(){return this[s]},set:function(t){"function"==typeof this.equals&&this.equals(t)||this[s]===t||(this[s]=t,i[e].apply(this))},enumerable:!0,configurable:!0})}}(e,t)}function iW(e){return iG(0,e)}function iH(e){return iG(1,e)}function iX(e){return iG(2,e)}function iY(e){return iG(3,e)}function ij(e){return iG(5,e)}function iK(e){return iG(6,e)}class i${static AppendSerializedAnimations(e,t){if(e.animations){t.animations=[];for(let i=0;i{let n=s;if("undefined"!=typeof _native&&_native[t]){let e=_native[t];n=r?(...t)=>r(...t)?e(...t):s(...t):e}return e[t]=n,n(...i)}}i$.AllowLoadingUniqueId=!1,i$._ImageProcessingConfigurationParser=e=>{throw iL("ImageProcessingConfiguration")},i$._FresnelParametersParser=e=>{throw iL("FresnelParameters")},i$._ColorCurvesParser=e=>{throw iL("ColorCurves")},i$._TextureParser=(e,t,i)=>{throw iL("Texture")},iq.filter=function(e){return(t,i,r)=>iq(t,i,r,e)},function(e){e[e.NONE=0]="NONE",e[e.STEP=1]="STEP"}(_||(_={}));class iQ{constructor(e,t,i){this.name=e,this.from=t,this.to=i}clone(){return new iQ(this.name,this.from,this.to)}}function iZ(e,t,i,r){var s,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(n<3?s(a):n>3?s(t,i,a):s(t,i))||a);return n>3&&a&&Object.defineProperty(t,i,a),a}Object.create,Object.create;class iJ{constructor(){this._doNotSerialize=!1,this._isDisposed=!1,this._sceneRootNodesIndex=-1,this._isEnabled=!0,this._isParentEnabled=!0,this._isReady=!0,this._onEnabledStateChangedObservable=new tj,this._onClonedObservable=new tj}}class i0{static AddNodeConstructor(e,t){this._NodeConstructors[e]=t}static Construct(e,t,i,r){let s=this._NodeConstructors[e];return s?s(t,i,r):null}set accessibilityTag(e){this._accessibilityTag=e,this.onAccessibilityTagChangedObservable.notifyObservers(e)}get accessibilityTag(){return this._accessibilityTag}get doNotSerialize(){return!!this._nodeDataStorage._doNotSerialize||!!this._parentNode&&this._parentNode.doNotSerialize}set doNotSerialize(e){this._nodeDataStorage._doNotSerialize=e}isDisposed(){return this._nodeDataStorage._isDisposed}set parent(e){if(this._parentNode===e)return;let t=this._parentNode;if(this._parentNode&&void 0!==this._parentNode._children&&null!==this._parentNode._children){let t=this._parentNode._children.indexOf(this);-1!==t&&this._parentNode._children.splice(t,1),e||this._nodeDataStorage._isDisposed||this._addToSceneRootNodes()}this._parentNode=e,this._parentNode&&((void 0===this._parentNode._children||null===this._parentNode._children)&&(this._parentNode._children=[]),this._parentNode._children.push(this),t||this._removeFromSceneRootNodes()),this._syncParentEnabledState()}get parent(){return this._parentNode}_serializeAsParent(e){e.parentId=this.uniqueId}_addToSceneRootNodes(){-1===this._nodeDataStorage._sceneRootNodesIndex&&(this._nodeDataStorage._sceneRootNodesIndex=this._scene.rootNodes.length,this._scene.rootNodes.push(this))}_removeFromSceneRootNodes(){if(-1!==this._nodeDataStorage._sceneRootNodesIndex){let e=this._scene.rootNodes,t=e.length-1;e[this._nodeDataStorage._sceneRootNodesIndex]=e[t],e[this._nodeDataStorage._sceneRootNodesIndex]._nodeDataStorage._sceneRootNodesIndex=this._nodeDataStorage._sceneRootNodesIndex,this._scene.rootNodes.pop(),this._nodeDataStorage._sceneRootNodesIndex=-1}}get animationPropertiesOverride(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride}set animationPropertiesOverride(e){this._animationPropertiesOverride=e}getClassName(){return"Node"}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}get onEnabledStateChangedObservable(){return this._nodeDataStorage._onEnabledStateChangedObservable}get onClonedObservable(){return this._nodeDataStorage._onClonedObservable}constructor(e,t=null){this._isDirty=!1,this._nodeDataStorage=new iJ,this.state="",this.metadata=null,this.reservedDataStore=null,this._accessibilityTag=null,this.onAccessibilityTagChangedObservable=new tj,this._parentContainer=null,this.animations=[],this._ranges={},this.onReady=null,this._currentRenderId=-1,this._parentUpdateId=-1,this._childUpdateId=-1,this._waitingParentId=null,this._waitingParentInstanceIndex=null,this._waitingParsedUniqueId=null,this._cache={},this._parentNode=null,this._children=null,this._worldMatrix=t7.Identity(),this._worldMatrixDeterminant=0,this._worldMatrixDeterminantIsDirty=!0,this._animationPropertiesOverride=null,this._isNode=!0,this.onDisposeObservable=new tj,this._onDisposeObserver=null,this._behaviors=[],this.name=e,this.id=e,this._scene=t||t2.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._initCache()}getScene(){return this._scene}getEngine(){return this._scene.getEngine()}addBehavior(e,t=!1){return -1!==this._behaviors.indexOf(e)||(e.init(),this._scene.isLoading&&!t?this._scene.onDataLoadedObservable.addOnce(()=>{e.attach(this)}):e.attach(this),this._behaviors.push(e)),this}removeBehavior(e){let t=this._behaviors.indexOf(e);return -1===t||(this._behaviors[t].detach(),this._behaviors.splice(t,1)),this}get behaviors(){return this._behaviors}getBehaviorByName(e){for(let t of this._behaviors)if(t.name===e)return t;return null}getWorldMatrix(){return this._currentRenderId!==this._scene.getRenderId()&&this.computeWorldMatrix(),this._worldMatrix}_getWorldMatrixDeterminant(){return this._worldMatrixDeterminantIsDirty&&(this._worldMatrixDeterminantIsDirty=!1,this._worldMatrixDeterminant=this._worldMatrix.determinant()),this._worldMatrixDeterminant}get worldMatrixFromCache(){return this._worldMatrix}_initCache(){this._cache={},this._cache.parent=void 0}updateCache(e){!e&&this.isSynchronized()||(this._cache.parent=this.parent,this._updateCache())}_getActionManagerForTrigger(e,t=!0){return this.parent?this.parent._getActionManagerForTrigger(e,!1):null}_updateCache(e){}_isSynchronized(){return!0}_markSyncedWithParent(){this._parentNode&&(this._parentUpdateId=this._parentNode._childUpdateId)}isSynchronizedWithParent(){return!this._parentNode||!this._parentNode._isDirty&&this._parentUpdateId===this._parentNode._childUpdateId&&this._parentNode.isSynchronized()}isSynchronized(){return this._cache.parent!==this._parentNode?(this._cache.parent=this._parentNode,!1):(!this._parentNode||!!this.isSynchronizedWithParent())&&this._isSynchronized()}isReady(e=!1){return this._nodeDataStorage._isReady}markAsDirty(e){return this._currentRenderId=Number.MAX_VALUE,this._isDirty=!0,this}isEnabled(e=!0){return!1===e?this._nodeDataStorage._isEnabled:!!this._nodeDataStorage._isEnabled&&this._nodeDataStorage._isParentEnabled}_syncParentEnabledState(){this._nodeDataStorage._isParentEnabled=!this._parentNode||this._parentNode.isEnabled(),this._children&&this._children.forEach(e=>{e._syncParentEnabledState()})}setEnabled(e){this._nodeDataStorage._isEnabled!==e&&(this._nodeDataStorage._isEnabled=e,this._syncParentEnabledState(),this._nodeDataStorage._onEnabledStateChangedObservable.notifyObservers(e))}isDescendantOf(e){return!!this.parent&&(this.parent===e||this.parent.isDescendantOf(e))}_getDescendants(e,t=!1,i){if(this._children)for(let r=0;r(!t||t(e))&&void 0!==e.cullingStrategy),i}getChildren(e,t=!0){return this.getDescendants(t,e)}_setReady(e){if(e!==this._nodeDataStorage._isReady){if(!e){this._nodeDataStorage._isReady=!1;return}this.onReady&&this.onReady(this),this._nodeDataStorage._isReady=!0}}getAnimationByName(e){for(let t=0;tnew i0(e,this.getScene()),this);if(t&&(r.parent=t),!i){let t=this.getDescendants(!0);for(let i=0;i{throw iL("AnimationRange")},i0._NodeConstructors={},iZ([iW()],i0.prototype,"name",void 0),iZ([iW()],i0.prototype,"id",void 0),iZ([iW()],i0.prototype,"uniqueId",void 0),iZ([iW()],i0.prototype,"state",void 0),iZ([iW()],i0.prototype,"metadata",void 0);class i1{constructor(e,t){this.width=e,this.height=t}toString(){return`{W: ${this.width}, H: ${this.height}}`}getClassName(){return"Size"}getHashCode(){return 397*(0|this.width)^(0|this.height)}copyFrom(e){this.width=e.width,this.height=e.height}copyFromFloats(e,t){return this.width=e,this.height=t,this}set(e,t){return this.copyFromFloats(e,t)}multiplyByFloats(e,t){return new i1(this.width*e,this.height*t)}clone(){return new i1(this.width,this.height)}equals(e){return!!e&&this.width===e.width&&this.height===e.height}get surface(){return this.width*this.height}static Zero(){return new i1(0,0)}add(e){return new i1(this.width+e.width,this.height+e.height)}subtract(e){return new i1(this.width-e.width,this.height-e.height)}scale(e){return new i1(this.width*e,this.height*e)}static Lerp(e,t,i){return new i1(e.width+(t.width-e.width)*i,e.height+(t.height-e.height)*i)}}class i2{constructor(){this._xhr="undefined"!=typeof _native&&_native.XMLHttpRequest?new _native.XMLHttpRequest:new XMLHttpRequest,this._requestURL=""}static get IsCustomRequestAvailable(){return Object.keys(i2.CustomRequestHeaders).length>0||i2.CustomRequestModifiers.length>0}_injectCustomRequestHeaders(){if(!this._shouldSkipRequestModifications(this._requestURL))for(let e in i2.CustomRequestHeaders){let t=i2.CustomRequestHeaders[e];t&&this._xhr.setRequestHeader(e,t)}}_shouldSkipRequestModifications(e){return i2.SkipRequestModificationForBabylonCDN&&(e.includes("preview.babylonjs.com")||e.includes("cdn.babylonjs.com"))}get onprogress(){return this._xhr.onprogress}set onprogress(e){this._xhr.onprogress=e}get readyState(){return this._xhr.readyState}get status(){return this._xhr.status}get statusText(){return this._xhr.statusText}get response(){return this._xhr.response}get responseURL(){return this._xhr.responseURL}get responseText(){return this._xhr.responseText}get responseType(){return this._xhr.responseType}set responseType(e){this._xhr.responseType=e}get timeout(){return this._xhr.timeout}set timeout(e){this._xhr.timeout=e}addEventListener(e,t,i){this._xhr.addEventListener(e,t,i)}removeEventListener(e,t,i){this._xhr.removeEventListener(e,t,i)}abort(){this._xhr.abort()}send(e){i2.CustomRequestHeaders&&this._injectCustomRequestHeaders(),this._xhr.send(e)}open(e,t){for(let e of i2.CustomRequestModifiers){if(this._shouldSkipRequestModifications(t))return;e(this._xhr,t)}return t=(t=t.replace("file:http:","http:")).replace("file:https:","https:"),this._requestURL=t,this._xhr.open(e,t,!0)}setRequestHeader(e,t){this._xhr.setRequestHeader(e,t)}getResponseHeader(e){return this._xhr.getResponseHeader(e)}}i2.CustomRequestHeaders={},i2.CustomRequestModifiers=[],i2.SkipRequestModificationForBabylonCDN=!0;let i3=Object.freeze(new t8(0,0,0,0)),i4=Object.freeze(t5.Zero()),i5=Object.freeze(t4.Zero()),i6=Object.freeze(i1.Zero()),i8=Object.freeze(io.Black()),i7=Object.freeze(new il(0,0,0,0)),i9={key:0,repeatCount:0,loopMode:2};class re{static _PrepareAnimation(e,t,i,r,s,n,a,o){let l;if(!isNaN(parseFloat(s))&&isFinite(s)?l=re.ANIMATIONTYPE_FLOAT:s instanceof t8?l=re.ANIMATIONTYPE_QUATERNION:s instanceof t5?l=re.ANIMATIONTYPE_VECTOR3:s instanceof t4?l=re.ANIMATIONTYPE_VECTOR2:s instanceof io?l=re.ANIMATIONTYPE_COLOR3:s instanceof il?l=re.ANIMATIONTYPE_COLOR4:s instanceof i1&&(l=re.ANIMATIONTYPE_SIZE),void 0==l)return null;let h=new re(e,t,i,l,a);return h.setKeys([{frame:0,value:s},{frame:r,value:n}]),void 0!==o&&h.setEasingFunction(o),h}static CreateAnimation(e,t,i,r){let s=new re(e+"Animation",e,i,t,re.ANIMATIONLOOPMODE_CONSTANT);return s.setEasingFunction(r),s}static CreateAndStartAnimation(e,t,i,r,s,n,a,o,l,h,u){let c=re._PrepareAnimation(e,i,r,s,n,a,o,l);return c&&(t.getScene&&(u=t.getScene()),u)?u.beginDirectAnimation(t,[c],0,s,1===c.loopMode,1,h):null}static CreateAndStartHierarchyAnimation(e,t,i,r,s,n,a,o,l,h,u){let c=re._PrepareAnimation(e,r,s,n,a,o,l,h);return c?t.getScene().beginDirectHierarchyAnimation(t,i,[c],0,n,1===c.loopMode,1,u):null}static CreateMergeAndStartAnimation(e,t,i,r,s,n,a,o,l,h){let u=re._PrepareAnimation(e,i,r,s,n,a,o,l);return u?(t.animations.push(u),t.getScene().beginAnimation(t,0,s,1===u.loopMode,1,h)):null}static MakeAnimationAdditive(e,t,i,r=!1,s){var n,a;let o;let l=e;if((o="object"==typeof t?t:{referenceFrame:null!=t?t:0,range:i,cloneOriginalAnimation:r,clonedAnimationName:s}).cloneOriginalAnimation&&((l=e.clone()).name=o.clonedAnimationName||l.name),!l._keys.length)return l;let h=o.referenceFrame&&o.referenceFrame>=0?o.referenceFrame:0,u=0,c=l._keys[0],d=l._keys.length-1,p=l._keys[d],_={referenceValue:c.value,referencePosition:ie.Vector3[0],referenceQuaternion:ie.Quaternion[0],referenceScaling:ie.Vector3[1],keyPosition:ie.Vector3[2],keyQuaternion:ie.Quaternion[1],keyScaling:ie.Vector3[3]},f=c.frame,m=p.frame;if(o.range){let e=l.getRange(o.range);e&&(f=e.from,m=e.to)}else f=null!==(n=o.fromFrame)&&void 0!==n?n:f,m=null!==(a=o.toFrame)&&void 0!==a?a:m;if(f!==c.frame&&(u=l.createKeyForFrame(f)),m!==p.frame&&(d=l.createKeyForFrame(m)),1===l._keys.length){let e=l._getKeyValue(l._keys[0]);_.referenceValue=e.clone?e.clone():e}else if(h<=c.frame){let e=l._getKeyValue(c.value);_.referenceValue=e.clone?e.clone():e}else if(h>=p.frame){let e=l._getKeyValue(p.value);_.referenceValue=e.clone?e.clone():e}else{i9.key=0;let e=l._interpolate(h,i9);_.referenceValue=e.clone?e.clone():e}l.dataType===re.ANIMATIONTYPE_QUATERNION?_.referenceValue.normalize().conjugateInPlace():l.dataType===re.ANIMATIONTYPE_MATRIX&&(_.referenceValue.decompose(_.referenceScaling,_.referenceQuaternion,_.referencePosition),_.referenceQuaternion.normalize().conjugateInPlace());let g=Number.MAX_VALUE,v=o.clipKeys?[]:null;for(let e=u;e<=d;e++){let t=l._keys[e];if(v&&(t={frame:t.frame,value:t.value.clone?t.value.clone():t.value,inTangent:t.inTangent,outTangent:t.outTangent,interpolation:t.interpolation,lockedTangent:t.lockedTangent},g===Number.MAX_VALUE&&(g=t.frame),t.frame-=g,v.push(t)),!e||l.dataType===re.ANIMATIONTYPE_FLOAT||t.value!==c.value)switch(l.dataType){case re.ANIMATIONTYPE_MATRIX:t.value.decompose(_.keyScaling,_.keyQuaternion,_.keyPosition),_.keyPosition.subtractInPlace(_.referencePosition),_.keyScaling.divideInPlace(_.referenceScaling),_.referenceQuaternion.multiplyToRef(_.keyQuaternion,_.keyQuaternion),t7.ComposeToRef(_.keyScaling,_.keyQuaternion,_.keyPosition,t.value);break;case re.ANIMATIONTYPE_QUATERNION:_.referenceValue.multiplyToRef(t.value,t.value);break;case re.ANIMATIONTYPE_VECTOR2:case re.ANIMATIONTYPE_VECTOR3:case re.ANIMATIONTYPE_COLOR3:case re.ANIMATIONTYPE_COLOR4:t.value.subtractToRef(_.referenceValue,t.value);break;case re.ANIMATIONTYPE_SIZE:t.value.width-=_.referenceValue.width,t.value.height-=_.referenceValue.height;break;default:t.value-=_.referenceValue}}return v&&l.setKeys(v,!0),l}static TransitionTo(e,t,i,r,s,n,a,o=null){if(a<=0)return i[e]=t,o&&o(),null;let l=a/1e3*s;n.setKeys([{frame:0,value:i[e].clone?i[e].clone():i[e]},{frame:l,value:t}]),i.animations||(i.animations=[]),i.animations.push(n);let h=r.beginAnimation(i,0,l,!1);return h.onAnimationEnd=o,h}get runtimeAnimations(){return this._runtimeAnimations}get hasRunningRuntimeAnimations(){for(let e of this._runtimeAnimations)if(!e.isStopped())return!0;return!1}constructor(e,t,i,r,s,n){this.name=e,this.targetProperty=t,this.framePerSecond=i,this.dataType=r,this.loopMode=s,this.enableBlending=n,this._easingFunction=null,this._runtimeAnimations=[],this._events=[],this.blendingSpeed=.01,this._ranges={},this.targetPropertyPath=t.split("."),this.dataType=r,this.loopMode=void 0===s?re.ANIMATIONLOOPMODE_CYCLE:s,this.uniqueId=re._UniqueIdGenerator++}toString(e){let t="Name: "+this.name+", property: "+this.targetProperty;if(t+=", datatype: "+["Float","Vector3","Quaternion","Matrix","Color3","Vector2"][this.dataType]+", nKeys: "+(this._keys?this._keys.length:"none")+", nRanges: "+(this._ranges?Object.keys(this._ranges).length:"none"),e){t+=", Ranges: {";let e=!0;for(let i in this._ranges)e&&(t+=", ",e=!1),t+=i;t+="}"}return t}addEvent(e){this._events.push(e),this._events.sort((e,t)=>e.frame-t.frame)}removeEvents(e){for(let t=0;t=0;i--)this._keys[i].frame>=e&&this._keys[i].frame<=t&&this._keys.splice(i,1)}this._ranges[e]=null}}getRange(e){return this._ranges[e]}getKeys(){return this._keys}getHighestFrame(){let e=0;for(let t=0,i=this._keys.length;t0)return t.highLimitValue.clone?t.highLimitValue.clone():t.highLimitValue;let s=this._keys,n=s.length,a=t.key;for(;a>=0&&e=s[a+1].frame;)++a;if(t.key=a,a<0)return i?void 0:this._getKeyValue(s[0].value);if(a+1>n-1)return i?void 0:this._getKeyValue(s[n-1].value);let o=s[a],l=s[a+1];if(i&&(e===o.frame||e===l.frame))return;let h=this._getKeyValue(o.value),u=this._getKeyValue(l.value);if(o.interpolation===_.STEP)return l.frame>e?h:u;let c=void 0!==o.outTangent&&void 0!==l.inTangent,d=l.frame-o.frame,p=(e-o.frame)/d,f=o.easingFunction||this.getEasingFunction();switch(null!==f&&(p=f.ease(p)),this.dataType){case re.ANIMATIONTYPE_FLOAT:{let e=c?this.floatInterpolateFunctionWithTangents(h,o.outTangent*d,u,l.inTangent*d,p):this.floatInterpolateFunction(h,u,p);switch(t.loopMode){case re.ANIMATIONLOOPMODE_CYCLE:case re.ANIMATIONLOOPMODE_CONSTANT:case re.ANIMATIONLOOPMODE_YOYO:return e;case re.ANIMATIONLOOPMODE_RELATIVE:case re.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return(null!==(r=t.offsetValue)&&void 0!==r?r:0)*t.repeatCount+e}break}case re.ANIMATIONTYPE_QUATERNION:{let e=c?this.quaternionInterpolateFunctionWithTangents(h,o.outTangent.scale(d),u,l.inTangent.scale(d),p):this.quaternionInterpolateFunction(h,u,p);switch(t.loopMode){case re.ANIMATIONLOOPMODE_CYCLE:case re.ANIMATIONLOOPMODE_CONSTANT:case re.ANIMATIONLOOPMODE_YOYO:break;case re.ANIMATIONLOOPMODE_RELATIVE:case re.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return e.addInPlace((t.offsetValue||i3).scale(t.repeatCount))}return e}case re.ANIMATIONTYPE_VECTOR3:{let e=c?this.vector3InterpolateFunctionWithTangents(h,o.outTangent.scale(d),u,l.inTangent.scale(d),p):this.vector3InterpolateFunction(h,u,p);switch(t.loopMode){case re.ANIMATIONLOOPMODE_CYCLE:case re.ANIMATIONLOOPMODE_CONSTANT:case re.ANIMATIONLOOPMODE_YOYO:return e;case re.ANIMATIONLOOPMODE_RELATIVE:case re.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return e.add((t.offsetValue||i4).scale(t.repeatCount))}break}case re.ANIMATIONTYPE_VECTOR2:{let e=c?this.vector2InterpolateFunctionWithTangents(h,o.outTangent.scale(d),u,l.inTangent.scale(d),p):this.vector2InterpolateFunction(h,u,p);switch(t.loopMode){case re.ANIMATIONLOOPMODE_CYCLE:case re.ANIMATIONLOOPMODE_CONSTANT:case re.ANIMATIONLOOPMODE_YOYO:return e;case re.ANIMATIONLOOPMODE_RELATIVE:case re.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return e.add((t.offsetValue||i5).scale(t.repeatCount))}break}case re.ANIMATIONTYPE_SIZE:switch(t.loopMode){case re.ANIMATIONLOOPMODE_CYCLE:case re.ANIMATIONLOOPMODE_CONSTANT:case re.ANIMATIONLOOPMODE_YOYO:return this.sizeInterpolateFunction(h,u,p);case re.ANIMATIONLOOPMODE_RELATIVE:case re.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return this.sizeInterpolateFunction(h,u,p).add((t.offsetValue||i6).scale(t.repeatCount))}break;case re.ANIMATIONTYPE_COLOR3:{let e=c?this.color3InterpolateFunctionWithTangents(h,o.outTangent.scale(d),u,l.inTangent.scale(d),p):this.color3InterpolateFunction(h,u,p);switch(t.loopMode){case re.ANIMATIONLOOPMODE_CYCLE:case re.ANIMATIONLOOPMODE_CONSTANT:case re.ANIMATIONLOOPMODE_YOYO:return e;case re.ANIMATIONLOOPMODE_RELATIVE:case re.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return e.add((t.offsetValue||i8).scale(t.repeatCount))}break}case re.ANIMATIONTYPE_COLOR4:{let e=c?this.color4InterpolateFunctionWithTangents(h,o.outTangent.scale(d),u,l.inTangent.scale(d),p):this.color4InterpolateFunction(h,u,p);switch(t.loopMode){case re.ANIMATIONLOOPMODE_CYCLE:case re.ANIMATIONLOOPMODE_CONSTANT:case re.ANIMATIONLOOPMODE_YOYO:return e;case re.ANIMATIONLOOPMODE_RELATIVE:case re.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return e.add((t.offsetValue||i7).scale(t.repeatCount))}break}case re.ANIMATIONTYPE_MATRIX:switch(t.loopMode){case re.ANIMATIONLOOPMODE_CYCLE:case re.ANIMATIONLOOPMODE_CONSTANT:case re.ANIMATIONLOOPMODE_YOYO:if(re.AllowMatricesInterpolation)return this.matrixInterpolateFunction(h,u,p,t.workValue);return h;case re.ANIMATIONLOOPMODE_RELATIVE:case re.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return h}}return 0}matrixInterpolateFunction(e,t,i,r){return re.AllowMatrixDecomposeForInterpolation?r?(t7.DecomposeLerpToRef(e,t,i,r),r):t7.DecomposeLerp(e,t,i):r?(t7.LerpToRef(e,t,i,r),r):t7.Lerp(e,t,i)}clone(){let e=new re(this.name,this.targetPropertyPath.join("."),this.framePerSecond,this.dataType,this.loopMode);if(e.enableBlending=this.enableBlending,e.blendingSpeed=this.blendingSpeed,this._keys&&e.setKeys(this._keys),this._ranges)for(let t in e._ranges={},this._ranges){let i=this._ranges[t];i&&(e._ranges[t]=i.clone())}return e}setKeys(e,t=!1){this._keys=t?e:e.slice(0)}createKeyForFrame(e){i9.key=0;let t=this._interpolate(e,i9,!0);if(!t)return this._keys[i9.key].frame===e?i9.key:i9.key+1;let i={frame:e,value:t.clone?t.clone():t};return this._keys.splice(i9.key+1,0,i),i9.key+1}serialize(){let e={};e.name=this.name,e.property=this.targetProperty,e.framePerSecond=this.framePerSecond,e.dataType=this.dataType,e.loopBehavior=this.loopMode,e.enableBlending=this.enableBlending,e.blendingSpeed=this.blendingSpeed;let t=this.dataType;e.keys=[];let i=this.getKeys();for(let r=0;r=2&&(r=l.values[1]),l.values.length>=3&&(a=l.values[2]),l.values.length>=4&&(o=l.values[3]);break;case re.ANIMATIONTYPE_QUATERNION:if(t=t8.FromArray(l.values),l.values.length>=8){let e=t8.FromArray(l.values.slice(4,8));e.equals(t8.Zero())||(r=e)}if(l.values.length>=12){let e=t8.FromArray(l.values.slice(8,12));e.equals(t8.Zero())||(a=e)}l.values.length>=13&&(o=l.values[12]);break;case re.ANIMATIONTYPE_MATRIX:t=t7.FromArray(l.values),l.values.length>=17&&(o=l.values[16]);break;case re.ANIMATIONTYPE_COLOR3:t=io.FromArray(l.values),l.values[3]&&(r=io.FromArray(l.values[3])),l.values[4]&&(a=io.FromArray(l.values[4])),l.values[5]&&(o=l.values[5]);break;case re.ANIMATIONTYPE_COLOR4:t=il.FromArray(l.values),l.values[4]&&(r=il.FromArray(l.values[4])),l.values[5]&&(a=il.FromArray(l.values[5])),l.values[6]&&(o=il.FromArray(l.values[6]));break;case re.ANIMATIONTYPE_VECTOR3:default:t=t5.FromArray(l.values),l.values[3]&&(r=t5.FromArray(l.values[3])),l.values[4]&&(a=t5.FromArray(l.values[4])),l.values[5]&&(o=l.values[5])}let h={};h.frame=l.frame,h.value=t,void 0!=r&&(h.inTangent=r),void 0!=a&&(h.outTangent=a),void 0!=o&&(h.interpolation=o),n.push(h)}if(r.setKeys(n),e.ranges)for(i=0;i{let s=new i2;s.addEventListener("readystatechange",()=>{if(4==s.readyState){if(200==s.status){let t=JSON.parse(s.responseText);if(t.animations&&(t=t.animations),t.length){let e=[];for(let i of t)e.push(this.Parse(i));i(e)}else{let r=this.Parse(t);e&&(r.name=e),i(r)}}else r("Unable to load the animation")}}),s.open("GET",t),s.send()})}static ParseFromSnippetAsync(e){return new Promise((t,i)=>{let r=new i2;r.addEventListener("readystatechange",()=>{if(4==r.readyState){if(200==r.status){let i=JSON.parse(JSON.parse(r.responseText).jsonPayload);if(i.animations){let r=JSON.parse(i.animations),s=[];for(let t of r.animations){let i=this.Parse(t);i.snippetId=e,s.push(i)}t(s)}else{let r=JSON.parse(i.animation),s=this.Parse(r);s.snippetId=e,t(s)}}else i("Unable to load the snippet "+e)}}),r.open("GET",this.SnippetUrl+"/"+e.replace(/#/g,"/")),r.send()})}}re._UniqueIdGenerator=0,re.AllowMatricesInterpolation=!1,re.AllowMatrixDecomposeForInterpolation=!0,re.SnippetUrl="https://snippet.babylonjs.com",re.ANIMATIONTYPE_FLOAT=0,re.ANIMATIONTYPE_VECTOR3=1,re.ANIMATIONTYPE_QUATERNION=2,re.ANIMATIONTYPE_MATRIX=3,re.ANIMATIONTYPE_COLOR3=4,re.ANIMATIONTYPE_COLOR4=7,re.ANIMATIONTYPE_VECTOR2=5,re.ANIMATIONTYPE_SIZE=6,re.ANIMATIONLOOPMODE_RELATIVE=0,re.ANIMATIONLOOPMODE_CYCLE=1,re.ANIMATIONLOOPMODE_CONSTANT=2,re.ANIMATIONLOOPMODE_YOYO=4,re.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT=5,re.CreateFromSnippetAsync=re.ParseFromSnippetAsync,t0["BABYLON.Animation"]=re,i0._AnimationRangeFactory=(e,t,i)=>new iQ(e,t,i);class rt extends iu{constructor(e,t,i,r,s=1e3,n,a,o){super(e,n),this.duration=1e3,this.onInterpolationDoneObservable=new tj,this.propertyPath=i,this.value=r,this.duration=s,this.stopOtherAnimations=a,this.onInterpolationDone=o,this._target=this._effectiveTarget=t}_prepare(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)}execute(){let e;let t=this._actionManager.getScene(),i=[{frame:0,value:this._effectiveTarget[this._property]},{frame:100,value:this.value}];if("number"==typeof this.value)e=re.ANIMATIONTYPE_FLOAT;else if(this.value instanceof io)e=re.ANIMATIONTYPE_COLOR3;else if(this.value instanceof t5)e=re.ANIMATIONTYPE_VECTOR3;else if(this.value instanceof t7)e=re.ANIMATIONTYPE_MATRIX;else if(this.value instanceof t8)e=re.ANIMATIONTYPE_QUATERNION;else{ig.Warn("InterpolateValueAction: Unsupported type ("+typeof this.value+")");return}let r=new re("InterpolateValueAction",this._property,1e3/this.duration*100,e,re.ANIMATIONLOOPMODE_CONSTANT);r.setKeys(i),this.stopOtherAnimations&&t.stopAnimation(this._effectiveTarget),t.beginDirectAnimation(this._effectiveTarget,[r],0,100,!1,1,()=>{this.onInterpolationDoneObservable.notifyObservers(this),this.onInterpolationDone&&this.onInterpolationDone()})}serialize(e){return super._serialize({name:"InterpolateValueAction",properties:[iu._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:iu._SerializeValueAsString(this.value)},{name:"duration",value:iu._SerializeValueAsString(this.duration)},{name:"stopOtherAnimations",value:iu._SerializeValueAsString(this.stopOtherAnimations)||!1}]},e)}}t0["BABYLON.InterpolateValueAction"]=rt;class ri{get currentFrame(){return this._currentFrame}get weight(){return this._weight}get currentValue(){return this._currentValue}get targetPath(){return this._targetPath}get target(){return this._currentActiveTarget}get isAdditive(){return this._host&&this._host.isAdditive}constructor(e,t,i,r){if(this._events=[],this._currentFrame=0,this._originalValue=[],this._originalBlendValue=null,this._offsetsCache={},this._highLimitsCache={},this._stopped=!1,this._blendingFactor=0,this._currentValue=null,this._currentActiveTarget=null,this._directTarget=null,this._targetPath="",this._weight=1,this._absoluteFrameOffset=0,this._previousElapsedTime=0,this._previousAbsoluteFrame=0,this._targetIsArray=!1,this._animation=t,this._target=e,this._scene=i,this._host=r,this._activeTargets=[],t._runtimeAnimations.push(this),this._animationState={key:0,repeatCount:0,loopMode:this._getCorrectLoopMode()},this._animation.dataType===re.ANIMATIONTYPE_MATRIX&&(this._animationState.workValue=t7.Zero()),this._keys=this._animation.getKeys(),this._minFrame=this._keys[0].frame,this._maxFrame=this._keys[this._keys.length-1].frame,this._minValue=this._keys[0].value,this._maxValue=this._keys[this._keys.length-1].value,0!==this._minFrame){let e={frame:0,value:this._minValue};this._keys.splice(0,0,e)}if(this._target instanceof Array){let e=0;for(let t of this._target)this._preparePath(t,e),this._getOriginalValues(e),e++;this._targetIsArray=!0}else this._preparePath(this._target),this._getOriginalValues(),this._targetIsArray=!1,this._directTarget=this._activeTargets[0];let s=t.getEvents();s&&s.length>0&&s.forEach(e=>{this._events.push(e._clone())}),this._enableBlending=e&&e.animationPropertiesOverride?e.animationPropertiesOverride.enableBlending:this._animation.enableBlending}_preparePath(e,t=0){let i=this._animation.targetPropertyPath;if(i.length>1){let r=e[i[0]];for(let e=1;e-1&&this._animation.runtimeAnimations.splice(e,1)}setValue(e,t){if(this._targetIsArray){for(let i=0;it[t.length-1].frame&&(e=t[t.length-1].frame);let i=this._events;if(i.length)for(let t=0;tthis._maxFrame)&&(t=this._minFrame),(ithis._maxFrame)&&(i=this._maxFrame);let c=i-t,d=l.framePerSecond*s*e/1e3+this._absoluteFrameOffset,p=0;if(r&&this._animationState.loopMode===re.ANIMATIONLOOPMODE_YOYO&&(d=Math.abs(Math.sin((d-t)/c*Math.PI))*c+t),this._previousElapsedTime=e,this._previousAbsoluteFrame=d,!r&&i>=t&&d>=c)u=!1,p=l._getKeyValue(this._maxValue);else if(!r&&t>=i&&d<=c)u=!1,p=l._getKeyValue(this._minValue);else if(this._animationState.loopMode!==re.ANIMATIONLOOPMODE_CYCLE){let e=i.toString()+t.toString();if(!this._offsetsCache[e]){this._animationState.repeatCount=0,this._animationState.loopMode=re.ANIMATIONLOOPMODE_CYCLE;let r=l._interpolate(t,this._animationState),s=l._interpolate(i,this._animationState);switch(this._animationState.loopMode=this._getCorrectLoopMode(),l.dataType){case re.ANIMATIONTYPE_FLOAT:this._offsetsCache[e]=s-r;break;case re.ANIMATIONTYPE_QUATERNION:case re.ANIMATIONTYPE_VECTOR3:case re.ANIMATIONTYPE_VECTOR2:case re.ANIMATIONTYPE_SIZE:case re.ANIMATIONTYPE_COLOR3:this._offsetsCache[e]=s.subtract(r)}this._highLimitsCache[e]=s}p=this._highLimitsCache[e],a=this._offsetsCache[e]}if(void 0===a)switch(l.dataType){case re.ANIMATIONTYPE_FLOAT:a=0;break;case re.ANIMATIONTYPE_QUATERNION:a=i3;break;case re.ANIMATIONTYPE_VECTOR3:a=i4;break;case re.ANIMATIONTYPE_VECTOR2:a=i5;break;case re.ANIMATIONTYPE_SIZE:a=i6;break;case re.ANIMATIONTYPE_COLOR3:a=i8;break;case re.ANIMATIONTYPE_COLOR4:a=i7}if(this._host&&this._host.syncRoot){let e=this._host.syncRoot,i=(e.masterFrame-e.fromFrame)/(e.toFrame-e.fromFrame);o=t+c*i}else o=d>0&&t>i||d<0&&t0&&this.currentFrame>o||s<0&&this.currentFrame0?0:l.getKeys().length-1}this._currentFrame=o,this._animationState.repeatCount=0===c?0:d/c>>0,this._animationState.highLimitValue=p,this._animationState.offsetValue=a;let f=l._interpolate(o,this._animationState);if(this.setValue(f,n),_.length){for(let e=0;e<_.length;e++)if(c>0&&o>=_[e].frame&&_[e].frame>=t||c<0&&o<=_[e].frame&&_[e].frame<=t){let t=_[e];t.isDone||(t.onlyOnce&&(_.splice(e,1),e--),t.isDone=!0,t.action(o))}}return u||(this._stopped=!0),u}}function rr(){return"undefined"!=typeof navigator}function rs(){return"undefined"!=typeof document}function rn(e){let t="",i=e.firstChild;for(;i;)3===i.nodeType&&(t+=i.textContent),i=i.nextSibling;return t}class ra{static get Now(){return Date.now()}}class ro{}ro.FilesToLoad={};class rl{static ExponentialBackoff(e=3,t=500){return(i,r,s)=>0!==r.status||s>=e||-1!==i.indexOf("file:")?-1:Math.pow(2,s)*t}}class rh extends Error{}rh._setPrototypeOf=Object.setPrototypeOf||((e,t)=>(e.__proto__=t,e));let ru={MeshInvalidPositionsError:0,UnsupportedTextureError:1e3,SceneLoaderError:3e3,LoadFileError:4e3,RequestFileError:4001,ReadFileError:4002};class rc extends rh{constructor(e,t,i){super(e),this.errorCode=t,this.innerError=i,this.name="RuntimeError",rh._setPrototypeOf(this,rc.prototype)}}let rd=e=>{let t,i,r,s,n,a,o;let l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h="",u=0,c=ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e);for(;u>2,n=(3&t)<<4|i>>4,a=(15&i)<<2|r>>6,o=63&r,isNaN(i)?a=o=64:isNaN(r)&&(o=64),h+=l.charAt(s)+l.charAt(n)+l.charAt(a)+l.charAt(o);return h},rp=e=>atob(e),r_=e=>{let t=rp(e),i=t.length,r=new Uint8Array(new ArrayBuffer(i));for(let e=0;e{h+=i.process(e,t)}),this.additionalDefineKey&&(e[this.additionalDefineKey]=this.additionalDefineValue||"true"),h}}class rm{constructor(){this._lines=[]}get currentLine(){return this._lines[this.lineIndex]}get canRead(){return this.lineIndex1&&this._lines.push(e);else{let e=t.split(";");for(let t=0;t{""!==(h=h.trim())&&(i.push(h),h="")},n=e=>{rrx._Stack[r],o=()=>-1===r?"!!INVALID EXPRESSION!!":rx._Stack[r--],l=0,h="";for(;l1){for(s();-1!==r&&rx._OperatorPriority[a()]>=rx._OperatorPriority[u];)i.push(o());n(u),l++}else h+=t;l++}for(s();-1!==r;)"("===a()?o():i.push(o());return rx._InfixToPostfixCache.size>=rx.InfixToPostfixCacheLimitSize&&rx.ClearCache(),rx._InfixToPostfixCache.set(e,{result:i,accessTime:Date.now()}),i}static ClearCache(){let e=Array.from(rx._InfixToPostfixCache.entries()).sort((e,t)=>e[1].accessTime-t[1].accessTime);for(let t=0;t":i=r>s;break;case"<":i=r=":i=r>=s;break;case"==":i=r===s;break;case"!=":i=r!==s}return i}}!function(e){e[e.GLSL=0]="GLSL",e[e.WGSL=1]="WGSL"}(f||(f={}));let rC=/defined\s*?\((.+?)\)/g,ry=/defined\s*?\[(.+?)\]/g,rA=/#include\s?<(.+)>(\((.*)\))*(\[(.*)\])*/g,rR=/__decl__/,rI=/light\{X\}.(\w*)/g,rP=/\{X\}/g,rM=[];class rD{static Initialize(e){e.processor&&e.processor.initializeShaders&&e.processor.initializeShaders(e.processingContext)}static Process(e,t,i,r){var s;(null===(s=t.processor)||void 0===s?void 0:s.preProcessShaderCode)&&(e=t.processor.preProcessShaderCode(e,t.isFragment)),this._ProcessIncludes(e,t,e=>{t.processCodeAfterIncludes&&(e=t.processCodeAfterIncludes(t.isFragment?"fragment":"vertex",e)),i(this._ProcessShaderConversion(e,t,r),e)})}static PreProcess(e,t,i,r){var s;(null===(s=t.processor)||void 0===s?void 0:s.preProcessShaderCode)&&(e=t.processor.preProcessShaderCode(e,t.isFragment)),this._ProcessIncludes(e,t,e=>{t.processCodeAfterIncludes&&(e=t.processCodeAfterIncludes(t.isFragment?"fragment":"vertex",e)),i(this._ApplyPreProcessing(e,t,r),e)})}static Finalize(e,t,i){return i.processor&&i.processor.finalizeShaders?i.processor.finalizeShaders(e,t,i.processingContext):{vertexCode:e,fragmentCode:t}}static _ProcessPrecision(e,t){var i;if(null===(i=t.processor)||void 0===i?void 0:i.noPrecision)return e;let r=t.shouldUseHighPrecisionShader;return -1===e.indexOf("precision highp float")?e=r?"precision highp float;\n"+e:"precision mediump float;\n"+e:r||(e=e.replace("precision highp float","precision mediump float")),e}static _ExtractOperation(e){let t=/defined\((.+)\)/.exec(e);if(t&&t.length)return new rT(t[1].trim(),"!"===e[0]);let i="",r=0;for(i of["==","!=",">=","<=","<",">"])if((r=e.indexOf(i))>-1)break;if(-1===r)return new rT(e);let s=e.substring(0,r).trim(),n=e.substring(r+i.length).trim();return new rS(s,i,n)}static _BuildSubExpression(e){e=e.replace(rC,"defined[$1]");let t=rx.infixToPostfix(e),i=[];for(let e of t)if("||"!==e&&"&&"!==e)i.push(e);else if(i.length>=2){let t=i[i.length-1],r=i[i.length-2];i.length-=2;let s="&&"==e?new rE:new rb;"string"==typeof t&&(t=t.replace(ry,"defined($1)")),"string"==typeof r&&(r=r.replace(ry,"defined($1)")),s.leftOperand="string"==typeof r?this._ExtractOperation(r):r,s.rightOperand="string"==typeof t?this._ExtractOperation(t):t,i.push(s)}let r=i[i.length-1];return"string"==typeof r&&(r=r.replace(ry,"defined($1)")),"string"==typeof r?this._ExtractOperation(r):r}static _BuildExpression(e,t){let i=new rv,r=e.substring(0,t),s=e.substring(t);return s=s.substring(0,(s.indexOf("//")+1||s.length+1)-1).trim(),"#ifdef"===r?i.testExpression=new rT(s):"#ifndef"===r?i.testExpression=new rT(s,!0):i.testExpression=this._BuildSubExpression(s),i}static _MoveCursorWithinIf(e,t,i){let r=e.currentLine;for(;this._MoveCursor(e,i);){let s=(r=e.currentLine).substring(0,5).toLowerCase();if("#else"===s){let i=new rf;t.children.push(i),this._MoveCursor(e,i);return}if("#elif"===s){let e=this._BuildExpression(r,5);t.children.push(e),i=e}}}static _MoveCursor(e,t){for(;e.canRead;){e.lineIndex++;let i=e.currentLine;if(i.indexOf("#")>=0){let r=rD._MoveCursorRegex.exec(i);if(r&&r.length){switch(r[0]){case"#ifdef":{let r=new rg;t.children.push(r);let s=this._BuildExpression(i,6);r.children.push(s),this._MoveCursorWithinIf(e,r,s);break}case"#else":case"#elif":return!0;case"#endif":return!1;case"#ifndef":{let r=new rg;t.children.push(r);let s=this._BuildExpression(i,7);r.children.push(s),this._MoveCursorWithinIf(e,r,s);break}case"#if":{let r=new rg,s=this._BuildExpression(i,3);t.children.push(r),r.children.push(s),this._MoveCursorWithinIf(e,r,s)}}continue}}let r=new rf;if(r.line=i,t.children.push(r),"#"===i[0]&&"d"===i[1]){let e=i.replace(";","").split(" ");r.additionalDefineKey=e[1],3===e.length&&(r.additionalDefineValue=e[2])}}return!1}static _EvaluatePreProcessors(e,t,i){let r=new rf,s=new rm;return s.lineIndex=-1,s.lines=e.split("\n"),this._MoveCursor(s,r),r.process(t,i)}static _PreparePreProcessors(e,t){var i;let r=e.defines,s={};for(let e of r){let t=e.replace("#define","").replace(";","").trim().split(" ");s[t[0]]=t.length>1?t[1]:""}return(null===(i=e.processor)||void 0===i?void 0:i.shaderLanguage)===f.GLSL&&(s.GL_ES="true"),s.__VERSION__=e.version,s[e.platformName]="true",t._getGlobalDefines(s),s}static _ProcessShaderConversion(e,t,i){let r=this._ProcessPrecision(e,t);if(!t.processor||t.processor.shaderLanguage===f.GLSL&&-1!==r.indexOf("#version 3")&&(r=r.replace("#version 300 es",""),!t.processor.parseGLES3))return r;let s=t.defines,n=this._PreparePreProcessors(t,i);return t.processor.preProcessor&&(r=t.processor.preProcessor(r,s,t.isFragment,t.processingContext)),r=this._EvaluatePreProcessors(r,n,t),t.processor.postProcessor&&(r=t.processor.postProcessor(r,s,t.isFragment,t.processingContext,i)),i._features.needShaderCodeInlining&&(r=i.inlineShaderCode(r)),r}static _ApplyPreProcessing(e,t,i){var r,s;let n=e,a=t.defines,o=this._PreparePreProcessors(t,i);return(null===(r=t.processor)||void 0===r?void 0:r.preProcessor)&&(n=t.processor.preProcessor(n,a,t.isFragment,t.processingContext)),n=this._EvaluatePreProcessors(n,o,t),(null===(s=t.processor)||void 0===s?void 0:s.postProcessor)&&(n=t.processor.postProcessor(n,a,t.isFragment,t.processingContext,i)),i._features.needShaderCodeInlining&&(n=i.inlineShaderCode(n)),n}static _ProcessIncludes(e,t,i){let r;for(rM.length=0;null!==(r=rA.exec(e));)rM.push(r);let s=String(e),n=[e],a=!1;for(let e of rM){let r=e[1];if(-1!==r.indexOf("__decl__")&&(r=r.replace(rR,""),t.supportsUniformBuffers&&(r=r.replace("Vertex","Ubo").replace("Fragment","Ubo")),r+="Declaration"),t.includesShadersStore[r]){let i=t.includesShadersStore[r];if(e[2]){let t=e[3].split(",");for(let e=0;et+"{X}")),i+=a.replace(rP,e.toString())+"\n"}else t.supportsUniformBuffers||(i=i.replace(rI,(e,t)=>t+"{X}")),i=i.replace(rP,r)}let s=[];for(let t of n){let r=t.split(e[0]);for(let e=0;e=0||i.indexOf("#include <")>=0}else{let e=t.shadersRepository+"ShadersInclude/"+r+".fx";rD._FileToolsLoadFile(e,e=>{t.includesShadersStore[r]=e,this._ProcessIncludes(n.join(""),t,i)});return}}rM.length=0,s=n.join(""),a?this._ProcessIncludes(s.toString(),t,i):i(s)}static _FileToolsLoadFile(e,t,i,r,s,n){throw iL("FileTools")}}rD._MoveCursorRegex=/(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/;class rO{static GetShadersRepository(e=f.GLSL){return e===f.GLSL?rO.ShadersRepository:rO.ShadersRepositoryWGSL}static GetShadersStore(e=f.GLSL){return e===f.GLSL?rO.ShadersStore:rO.ShadersStoreWGSL}static GetIncludesShadersStore(e=f.GLSL){return e===f.GLSL?rO.IncludesShadersStore:rO.IncludesShadersStoreWGSL}}rO.ShadersRepository="src/Shaders/",rO.ShadersStore={},rO.IncludesShadersStore={},rO.ShadersRepositoryWGSL="src/ShadersWGSL/",rO.ShadersStoreWGSL={},rO.IncludesShadersStoreWGSL={};class rN{static get ShadersRepository(){return rO.ShadersRepository}static set ShadersRepository(e){rO.ShadersRepository=e}get onBindObservable(){return this._onBindObservable||(this._onBindObservable=new tj),this._onBindObservable}constructor(e,t,i,r=null,s,n=null,a=null,o=null,l=null,h,u="",c=f.GLSL){var d,p,_;if(this.name=null,this.defines="",this.onCompiled=null,this.onError=null,this.onBind=null,this.uniqueId=0,this.onCompileObservable=new tj,this.onErrorObservable=new tj,this._onBindObservable=null,this._wasPreviouslyReady=!1,this._forceRebindOnNextCall=!1,this._wasPreviouslyUsingInstances=null,this._isDisposed=!1,this._bonesComputationForcedToCPU=!1,this._uniformBuffersNames={},this._multiTarget=!1,this._samplers={},this._isReady=!1,this._compilationError="",this._allFallbacksProcessed=!1,this._uniforms={},this._key="",this._fallbacks=null,this._vertexSourceCodeOverride="",this._fragmentSourceCodeOverride="",this._transformFeedbackVaryings=null,this._pipelineContext=null,this._vertexSourceCode="",this._fragmentSourceCode="",this._vertexSourceCodeBeforeMigration="",this._fragmentSourceCodeBeforeMigration="",this._rawVertexSourceCode="",this._rawFragmentSourceCode="",this._processCodeAfterIncludes=void 0,this._processFinalCode=null,this.name=e,this._key=u,t.attributes){if(this._engine=i,this._attributesNames=t.attributes,this._uniformsNames=t.uniformsNames.concat(t.samplers),this._samplerList=t.samplers.slice(),this.defines=t.defines,this.onError=t.onError,this.onCompiled=t.onCompiled,this._fallbacks=t.fallbacks,this._indexParameters=t.indexParameters,this._transformFeedbackVaryings=t.transformFeedbackVaryings||null,this._multiTarget=!!t.multiTarget,this._shaderLanguage=null!==(d=t.shaderLanguage)&&void 0!==d?d:f.GLSL,t.uniformBuffersNames){this._uniformBuffersNamesList=t.uniformBuffersNames.slice();for(let e=0;e{if(a[0]&&a[1]){n.isFragment=!0;let[e,i]=a;rD.Process(i,n,(i,r)=>{this._fragmentSourceCodeBeforeMigration=r,this._processFinalCode&&(i=this._processFinalCode("fragment",i));let a=rD.Finalize(e,i,n);n=null,this._useFinalCode(a.vertexCode,a.fragmentCode,s,t)},this._engine)}};this._loadShader(i,"Vertex","",e=>{rD.Initialize(n),rD.Process(e,n,(t,i)=>{this._rawVertexSourceCode=e,this._vertexSourceCodeBeforeMigration=i,this._processFinalCode&&(t=this._processFinalCode("vertex",t)),a[0]=t,o()},this._engine)}),this._loadShader(r,"Fragment","Pixel",e=>{this._rawFragmentSourceCode=e,a[1]=e,o()})}_useFinalCode(e,t,i,r=!1){if(i){let r=i.vertexElement||i.vertex||i.spectorName||i,s=i.fragmentElement||i.fragment||i.spectorName||i;this._vertexSourceCode=(this._shaderLanguage===f.WGSL?"//":"")+"#define SHADER_NAME vertex:"+r+"\n"+e,this._fragmentSourceCode=(this._shaderLanguage===f.WGSL?"//":"")+"#define SHADER_NAME fragment:"+s+"\n"+t}else this._vertexSourceCode=e,this._fragmentSourceCode=t;this._prepareEffect(r)}get key(){return this._key}isReady(){try{return this._isReadyInternal()}catch(e){return!1}}_isReadyInternal(){return!!this._isReady||!!this._pipelineContext&&this._pipelineContext.isReady}getEngine(){return this._engine}getPipelineContext(){return this._pipelineContext}getAttributesNames(){return this._attributesNames}getAttributeLocation(e){return this._attributes[e]}getAttributeLocationByName(e){return this._attributeLocationByName[e]}getAttributesCount(){return this._attributes.length}getUniformIndex(e){return this._uniformsNames.indexOf(e)}getUniform(e){return this._uniforms[e]}getSamplers(){return this._samplerList}getUniformNames(){return this._uniformsNames}getUniformBuffersNames(){return this._uniformBuffersNamesList}getIndexParameters(){return this._indexParameters}getCompilationError(){return this._compilationError}allFallbacksProcessed(){return this._allFallbacksProcessed}executeWhenCompiled(e){if(this.isReady()){e(this);return}this.onCompileObservable.add(t=>{e(t)}),(!this._pipelineContext||this._pipelineContext.isAsync)&&setTimeout(()=>{this._checkIsReady(null)},16)}_checkIsReady(e){try{if(this._isReadyInternal())return}catch(t){this._processCompilationErrors(t,e);return}this._isDisposed||setTimeout(()=>{this._checkIsReady(e)},16)}_loadShader(e,t,i,r){let s;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement){r(rn(e));return}if("source:"===e.substr(0,7)){r(e.substr(7));return}if("base64:"===e.substr(0,7)){r(window.atob(e.substr(7)));return}let n=rO.GetShadersStore(this._shaderLanguage);if(n[e+t+"Shader"]){r(n[e+t+"Shader"]);return}if(i&&n[e+i+"Shader"]){r(n[e+i+"Shader"]);return}s="."===e[0]||"/"===e[0]||e.indexOf("http")>-1?e:rO.GetShadersRepository(this._shaderLanguage)+e,this._engine._loadFile(s+"."+t.toLowerCase()+".fx",r)}get vertexSourceCode(){var e,t;return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._vertexSourceCodeOverride:null!==(t=null===(e=this._pipelineContext)||void 0===e?void 0:e._getVertexShaderCode())&&void 0!==t?t:this._vertexSourceCode}get fragmentSourceCode(){var e,t;return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._fragmentSourceCodeOverride:null!==(t=null===(e=this._pipelineContext)||void 0===e?void 0:e._getFragmentShaderCode())&&void 0!==t?t:this._fragmentSourceCode}get vertexSourceCodeBeforeMigration(){return this._vertexSourceCodeBeforeMigration}get fragmentSourceCodeBeforeMigration(){return this._fragmentSourceCodeBeforeMigration}get rawVertexSourceCode(){return this._rawVertexSourceCode}get rawFragmentSourceCode(){return this._rawFragmentSourceCode}_rebuildProgram(e,t,i,r){this._isReady=!1,this._vertexSourceCodeOverride=e,this._fragmentSourceCodeOverride=t,this.onError=(e,t)=>{r&&r(t)},this.onCompiled=()=>{let e=this.getEngine().scenes;if(e)for(let t=0;tthis._rebuildProgram(e,t,i,r);this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?n._preparePipelineContext(this._pipelineContext,this._vertexSourceCodeOverride,this._fragmentSourceCodeOverride,!0,this._rawVertexSourceCode,this._rawFragmentSourceCode,a,null,this._transformFeedbackVaryings,this._key):n._preparePipelineContext(this._pipelineContext,this._vertexSourceCode,this._fragmentSourceCode,!1,this._rawVertexSourceCode,this._rawFragmentSourceCode,a,r,this._transformFeedbackVaryings,this._key),n._executeWhenRenderingStateIsCompiled(this._pipelineContext,()=>{if(this._attributes=[],this._pipelineContext._fillEffectInformation(this,this._uniformBuffersNames,this._uniformsNames,this._uniforms,this._samplerList,this._samplers,i,this._attributes),i)for(let e=0;e=t&&(r=`Offending line [${t}] in ${i?"fragment":"vertex"} code: ${n[t-1]}`)}}return[e,r]}_processCompilationErrors(e,t=null){var i,r,s;this._compilationError=e.message;let n=this._attributesNames,a=this._fallbacks;if(ig.Error("Unable to compile effect:"),ig.Error("Uniforms: "+this._uniformsNames.map(function(e){return" "+e})),ig.Error("Attributes: "+n.map(function(e){return" "+e})),ig.Error("Defines:\n"+this.defines),rN.LogShaderCodeOnCompilationError){let e=null,t=null,n=null;(null===(i=this._pipelineContext)||void 0===i?void 0:i._getVertexShaderCode())&&([n,e]=this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(),this._compilationError,!1),n&&(ig.Error("Vertex code:"),ig.Error(n))),(null===(r=this._pipelineContext)||void 0===r?void 0:r._getFragmentShaderCode())&&([n,t]=this._getShaderCodeAndErrorLine(null===(s=this._pipelineContext)||void 0===s?void 0:s._getFragmentShaderCode(),this._compilationError,!0),n&&(ig.Error("Fragment code:"),ig.Error(n))),e&&ig.Error(e),t&&ig.Error(t)}ig.Error("Error: "+this._compilationError);let o=()=>{this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this)};t&&(this._pipelineContext=t,this._isReady=!0,o()),a?(this._pipelineContext=null,a.hasMoreFallbacks?(this._allFallbacksProcessed=!1,ig.Error("Trying next fallback."),this.defines=a.reduce(this.defines,this),this._prepareEffect()):(this._allFallbacksProcessed=!0,o(),this.onErrorObservable.clear(),this._fallbacks&&this._fallbacks.unBindMesh())):(this._allFallbacksProcessed=!0,t||o())}get isSupported(){return""===this._compilationError}_bindTexture(e,t){this._engine._bindTexture(this._samplers[e],t,e)}setTexture(e,t){this._engine.setTexture(this._samplers[e],this._uniforms[e],t,e)}setDepthStencilTexture(e,t){this._engine.setDepthStencilTexture(this._samplers[e],this._uniforms[e],t,e)}setTextureArray(e,t){let i=e+"Ex";if(-1===this._samplerList.indexOf(i+"0")){let r=this._samplerList.indexOf(e);for(let e=1;e{t._swapAndDie(this,!1),this.isReady=e.isReady};e.isAsync?e.proxy.then(t):t(e.proxy);return}switch(this.source){case m.Temp:break;case m.Url:i=this._engine.createTexture(null!==(e=this._originalUrl)&&void 0!==e?e:this.url,!this.generateMipMaps,this.invertY,null,this.samplingMode,e=>{e._swapAndDie(this,!1),this.isReady=!0},null,this._buffer,void 0,this.format,this._extension,void 0,void 0,void 0,this._useSRGBBuffer);return;case m.Raw:(i=this._engine.createRawTexture(this._bufferView,this.baseWidth,this.baseHeight,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type,this._creationFlags,this._useSRGBBuffer))._swapAndDie(this,!1),this.isReady=!0;break;case m.Raw3D:(i=this._engine.createRawTexture3D(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type))._swapAndDie(this,!1),this.isReady=!0;break;case m.Raw2DArray:(i=this._engine.createRawTexture2DArray(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type))._swapAndDie(this,!1),this.isReady=!0;break;case m.Dynamic:(i=this._engine.createDynamicTexture(this.baseWidth,this.baseHeight,this.generateMipMaps,this.samplingMode))._swapAndDie(this,!1),this._dynamicTextureSource&&this._engine.updateDynamicTexture(this,this._dynamicTextureSource,this.invertY,this._premulAlpha,this.format,!0);break;case m.Cube:i=this._engine.createCubeTexture(this.url,null,this._files,!this.generateMipMaps,()=>{i._swapAndDie(this,!1),this.isReady=!0},null,this.format,this._extension,!1,0,0,null,void 0,this._useSRGBBuffer);return;case m.CubeRaw:(i=this._engine.createRawCubeTexture(this._bufferViewArray,this.width,null!==(t=this._originalFormat)&&void 0!==t?t:this.format,this.type,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this,!1),this.isReady=!0;break;case m.CubeRawRGBD:return;case m.CubePrefiltered:(i=this._engine.createPrefilteredCubeTexture(this.url,null,this._lodGenerationScale,this._lodGenerationOffset,e=>{e&&e._swapAndDie(this,!1),this.isReady=!0},null,this.format,this._extension))._sphericalPolynomial=this._sphericalPolynomial;return}}_swapAndDie(e,t=!0){var i;null===(i=this._hardwareTexture)||void 0===i||i.setUsage(e._source,this.generateMipMaps,this.is2DArray,this.isCube,this.is3D,this.width,this.height,this.depth),e._hardwareTexture=this._hardwareTexture,t&&(e._isRGBD=this._isRGBD),this._lodTextureHigh&&(e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureHigh=this._lodTextureHigh),this._lodTextureMid&&(e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureMid=this._lodTextureMid),this._lodTextureLow&&(e._lodTextureLow&&e._lodTextureLow.dispose(),e._lodTextureLow=this._lodTextureLow),this._irradianceTexture&&(e._irradianceTexture&&e._irradianceTexture.dispose(),e._irradianceTexture=this._irradianceTexture);let r=this._engine.getLoadedTexturesCache(),s=r.indexOf(this);-1!==s&&r.splice(s,1),-1===(s=r.indexOf(e))&&r.push(e)}dispose(){this._references--,this.onLoadedObservable.clear(),this.onErrorObservable.clear(),0===this._references&&(this._engine._releaseTexture(this),this._hardwareTexture=null,this._dynamicTextureSource=null)}}rU._Counter=0;class rV{constructor(){this.shaderLanguage=f.GLSL}postProcessor(e,t,i,r,s){return s.getCaps().drawBuffersExtension||(e=e.replace(/#extension.+GL_EXT_draw_buffers.+(enable|require)/g,"")),e}}let rk=/(flat\s)?\s*varying\s*.*/;class rG{constructor(){this.shaderLanguage=f.GLSL}attributeProcessor(e){return e.replace("attribute","in")}varyingCheck(e,t){return rk.test(e)}varyingProcessor(e,t){return e.replace("varying",t?"in":"out")}postProcessor(e,t,i){let r=-1!==e.search(/#extension.+GL_EXT_draw_buffers.+require/);if(e=(e=e.replace(/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,"")).replace(/texture2D\s*\(/g,"texture("),i){let t=-1!==e.search(/layout *\(location *= *0\) *out/g);e=(e=(e=(e=(e=(e=(e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/void\s+?main\s*\(/g,(r||t?"":"layout(location = 0) out vec4 glFragColor;\n")+"void main(")}else if(-1!==t.indexOf("#define MULTIVIEW"))return"#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+e;return e}}class rz{get underlyingResource(){return null}constructor(){this.references=0,this.capacity=0,this.is32Bits=!1,this.uniqueId=rz._Counter++}}rz._Counter=0;class rW extends rz{constructor(e){super(),this._buffer=e}get underlyingResource(){return this._buffer}}class rH{constructor(){this._valueCache={},this.vertexCompilationError=null,this.fragmentCompilationError=null,this.programLinkError=null,this.programValidationError=null,this._isDisposed=!1}get isAsync(){return this.isParallelCompiled}get isReady(){return!!this.program&&(!this.isParallelCompiled||this.engine._isRenderingStateCompiled(this))}_handlesSpectorRebuildCallback(e){e&&this.program&&e(this.program)}_fillEffectInformation(e,t,i,r,s,n,a,o){let l;let h=this.engine;if(h.supportsUniformBuffers)for(let i in t)e.bindUniformBlock(i,t[i]);for(this.engine.getUniforms(this,i).forEach((e,t)=>{r[i[t]]=e}),this._uniforms=r,l=0;l{n[e]=t}),h.getAttributes(this,a)))o.push(e)}dispose(){this._uniforms={},this._isDisposed=!0}_cacheMatrix(e,t){let i=this._valueCache[e],r=t.updateFlag;return(void 0===i||i!==r)&&(this._valueCache[e]=r,!0)}_cacheFloat2(e,t,i){let r=this._valueCache[e];if(!r||2!==r.length)return r=[t,i],this._valueCache[e]=r,!0;let s=!1;return r[0]!==t&&(r[0]=t,s=!0),r[1]!==i&&(r[1]=i,s=!0),s}_cacheFloat3(e,t,i,r){let s=this._valueCache[e];if(!s||3!==s.length)return s=[t,i,r],this._valueCache[e]=s,!0;let n=!1;return s[0]!==t&&(s[0]=t,n=!0),s[1]!==i&&(s[1]=i,n=!0),s[2]!==r&&(s[2]=r,n=!0),n}_cacheFloat4(e,t,i,r,s){let n=this._valueCache[e];if(!n||4!==n.length)return n=[t,i,r,s],this._valueCache[e]=n,!0;let a=!1;return n[0]!==t&&(n[0]=t,a=!0),n[1]!==i&&(n[1]=i,a=!0),n[2]!==r&&(n[2]=r,a=!0),n[3]!==s&&(n[3]=s,a=!0),a}setInt(e,t){let i=this._valueCache[e];(void 0===i||i!==t)&&this.engine.setInt(this._uniforms[e],t)&&(this._valueCache[e]=t)}setInt2(e,t,i){this._cacheFloat2(e,t,i)&&!this.engine.setInt2(this._uniforms[e],t,i)&&(this._valueCache[e]=null)}setInt3(e,t,i,r){this._cacheFloat3(e,t,i,r)&&!this.engine.setInt3(this._uniforms[e],t,i,r)&&(this._valueCache[e]=null)}setInt4(e,t,i,r,s){this._cacheFloat4(e,t,i,r,s)&&!this.engine.setInt4(this._uniforms[e],t,i,r,s)&&(this._valueCache[e]=null)}setIntArray(e,t){this._valueCache[e]=null,this.engine.setIntArray(this._uniforms[e],t)}setIntArray2(e,t){this._valueCache[e]=null,this.engine.setIntArray2(this._uniforms[e],t)}setIntArray3(e,t){this._valueCache[e]=null,this.engine.setIntArray3(this._uniforms[e],t)}setIntArray4(e,t){this._valueCache[e]=null,this.engine.setIntArray4(this._uniforms[e],t)}setUInt(e,t){let i=this._valueCache[e];(void 0===i||i!==t)&&this.engine.setUInt(this._uniforms[e],t)&&(this._valueCache[e]=t)}setUInt2(e,t,i){this._cacheFloat2(e,t,i)&&!this.engine.setUInt2(this._uniforms[e],t,i)&&(this._valueCache[e]=null)}setUInt3(e,t,i,r){this._cacheFloat3(e,t,i,r)&&!this.engine.setUInt3(this._uniforms[e],t,i,r)&&(this._valueCache[e]=null)}setUInt4(e,t,i,r,s){this._cacheFloat4(e,t,i,r,s)&&!this.engine.setUInt4(this._uniforms[e],t,i,r,s)&&(this._valueCache[e]=null)}setUIntArray(e,t){this._valueCache[e]=null,this.engine.setUIntArray(this._uniforms[e],t)}setUIntArray2(e,t){this._valueCache[e]=null,this.engine.setUIntArray2(this._uniforms[e],t)}setUIntArray3(e,t){this._valueCache[e]=null,this.engine.setUIntArray3(this._uniforms[e],t)}setUIntArray4(e,t){this._valueCache[e]=null,this.engine.setUIntArray4(this._uniforms[e],t)}setArray(e,t){this._valueCache[e]=null,this.engine.setArray(this._uniforms[e],t)}setArray2(e,t){this._valueCache[e]=null,this.engine.setArray2(this._uniforms[e],t)}setArray3(e,t){this._valueCache[e]=null,this.engine.setArray3(this._uniforms[e],t)}setArray4(e,t){this._valueCache[e]=null,this.engine.setArray4(this._uniforms[e],t)}setMatrices(e,t){t&&(this._valueCache[e]=null,this.engine.setMatrices(this._uniforms[e],t))}setMatrix(e,t){this._cacheMatrix(e,t)&&!this.engine.setMatrices(this._uniforms[e],t.toArray())&&(this._valueCache[e]=null)}setMatrix3x3(e,t){this._valueCache[e]=null,this.engine.setMatrix3x3(this._uniforms[e],t)}setMatrix2x2(e,t){this._valueCache[e]=null,this.engine.setMatrix2x2(this._uniforms[e],t)}setFloat(e,t){let i=this._valueCache[e];(void 0===i||i!==t)&&this.engine.setFloat(this._uniforms[e],t)&&(this._valueCache[e]=t)}setVector2(e,t){this._cacheFloat2(e,t.x,t.y)&&!this.engine.setFloat2(this._uniforms[e],t.x,t.y)&&(this._valueCache[e]=null)}setFloat2(e,t,i){this._cacheFloat2(e,t,i)&&!this.engine.setFloat2(this._uniforms[e],t,i)&&(this._valueCache[e]=null)}setVector3(e,t){this._cacheFloat3(e,t.x,t.y,t.z)&&!this.engine.setFloat3(this._uniforms[e],t.x,t.y,t.z)&&(this._valueCache[e]=null)}setFloat3(e,t,i,r){this._cacheFloat3(e,t,i,r)&&!this.engine.setFloat3(this._uniforms[e],t,i,r)&&(this._valueCache[e]=null)}setVector4(e,t){this._cacheFloat4(e,t.x,t.y,t.z,t.w)&&!this.engine.setFloat4(this._uniforms[e],t.x,t.y,t.z,t.w)&&(this._valueCache[e]=null)}setQuaternion(e,t){this._cacheFloat4(e,t.x,t.y,t.z,t.w)&&!this.engine.setFloat4(this._uniforms[e],t.x,t.y,t.z,t.w)&&(this._valueCache[e]=null)}setFloat4(e,t,i,r,s){this._cacheFloat4(e,t,i,r,s)&&!this.engine.setFloat4(this._uniforms[e],t,i,r,s)&&(this._valueCache[e]=null)}setColor3(e,t){this._cacheFloat3(e,t.r,t.g,t.b)&&!this.engine.setFloat3(this._uniforms[e],t.r,t.g,t.b)&&(this._valueCache[e]=null)}setColor4(e,t,i){this._cacheFloat4(e,t.r,t.g,t.b,i)&&!this.engine.setFloat4(this._uniforms[e],t.r,t.g,t.b,i)&&(this._valueCache[e]=null)}setDirectColor4(e,t){this._cacheFloat4(e,t.r,t.g,t.b,t.a)&&!this.engine.setFloat4(this._uniforms[e],t.r,t.g,t.b,t.a)&&(this._valueCache[e]=null)}_getVertexShaderCode(){return this.vertexShader?this.engine._getShaderSource(this.vertexShader):null}_getFragmentShaderCode(){return this.fragmentShader?this.engine._getShaderSource(this.fragmentShader):null}}class rX{get underlyingResource(){return this._webGLTexture}constructor(e=null,t){if(this._MSAARenderBuffers=null,this._context=t,!e&&!(e=t.createTexture()))throw Error("Unable to create webGL texture");this.set(e)}setUsage(){}set(e){this._webGLTexture=e}reset(){this._webGLTexture=null,this._MSAARenderBuffers=null}addMSAARenderBuffer(e){this._MSAARenderBuffers||(this._MSAARenderBuffers=[]),this._MSAARenderBuffers.push(e)}releaseMSAARenderBuffers(){if(this._MSAARenderBuffers){for(let e of this._MSAARenderBuffers)this._context.deleteRenderbuffer(e);this._MSAARenderBuffers=null}}getMSAARenderBuffer(e=0){var t,i;return null!==(i=null===(t=this._MSAARenderBuffers)||void 0===t?void 0:t[e])&&void 0!==i?i:null}release(){this.releaseMSAARenderBuffers(),this._webGLTexture&&this._context.deleteTexture(this._webGLTexture),this.reset()}}class rY{static IsWrapper(e){return void 0===e.getPipelineContext}static GetEffect(e){return void 0===e.getPipelineContext?e.effect:e}constructor(e,t=!0){this.effect=null,this.defines=null,this.drawContext=e.createDrawContext(),t&&(this.materialContext=e.createMaterialContext())}setEffect(e,t,i=!0){var r;this.effect=e,void 0!==t&&(this.defines=t),i&&(null===(r=this.drawContext)||void 0===r||r.reset())}dispose(){var e;null===(e=this.drawContext)||void 0===e||e.dispose()}}class rj{get isDirty(){return this._isStencilTestDirty||this._isStencilMaskDirty||this._isStencilFuncDirty||this._isStencilOpDirty}get func(){return this._func}set func(e){this._func!==e&&(this._func=e,this._isStencilFuncDirty=!0)}get funcRef(){return this._funcRef}set funcRef(e){this._funcRef!==e&&(this._funcRef=e,this._isStencilFuncDirty=!0)}get funcMask(){return this._funcMask}set funcMask(e){this._funcMask!==e&&(this._funcMask=e,this._isStencilFuncDirty=!0)}get opStencilFail(){return this._opStencilFail}set opStencilFail(e){this._opStencilFail!==e&&(this._opStencilFail=e,this._isStencilOpDirty=!0)}get opDepthFail(){return this._opDepthFail}set opDepthFail(e){this._opDepthFail!==e&&(this._opDepthFail=e,this._isStencilOpDirty=!0)}get opStencilDepthPass(){return this._opStencilDepthPass}set opStencilDepthPass(e){this._opStencilDepthPass!==e&&(this._opStencilDepthPass=e,this._isStencilOpDirty=!0)}get mask(){return this._mask}set mask(e){this._mask!==e&&(this._mask=e,this._isStencilMaskDirty=!0)}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this._isStencilTestDirty=!0)}constructor(e=!0){this._isStencilTestDirty=!1,this._isStencilMaskDirty=!1,this._isStencilFuncDirty=!1,this._isStencilOpDirty=!1,this.useStencilGlobalOnly=!1,e&&this.reset()}reset(){var e;this.stencilMaterial=void 0,null===(e=this.stencilGlobal)||void 0===e||e.reset(),this._isStencilTestDirty=!0,this._isStencilMaskDirty=!0,this._isStencilFuncDirty=!0,this._isStencilOpDirty=!0}apply(e){var t;if(!e)return;let i=!this.useStencilGlobalOnly&&!!(null===(t=this.stencilMaterial)||void 0===t?void 0:t.enabled);this.enabled=i?this.stencilMaterial.enabled:this.stencilGlobal.enabled,this.func=i?this.stencilMaterial.func:this.stencilGlobal.func,this.funcRef=i?this.stencilMaterial.funcRef:this.stencilGlobal.funcRef,this.funcMask=i?this.stencilMaterial.funcMask:this.stencilGlobal.funcMask,this.opStencilFail=i?this.stencilMaterial.opStencilFail:this.stencilGlobal.opStencilFail,this.opDepthFail=i?this.stencilMaterial.opDepthFail:this.stencilGlobal.opDepthFail,this.opStencilDepthPass=i?this.stencilMaterial.opStencilDepthPass:this.stencilGlobal.opStencilDepthPass,this.mask=i?this.stencilMaterial.mask:this.stencilGlobal.mask,this.isDirty&&(this._isStencilTestDirty&&(this.enabled?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this._isStencilTestDirty=!1),this._isStencilMaskDirty&&(e.stencilMask(this.mask),this._isStencilMaskDirty=!1),this._isStencilFuncDirty&&(e.stencilFunc(this.func,this.funcRef,this.funcMask),this._isStencilFuncDirty=!1),this._isStencilOpDirty&&(e.stencilOp(this.opStencilFail,this.opDepthFail,this.opStencilDepthPass),this._isStencilOpDirty=!1))}}class rK{}class r${static get NpmPackage(){return"babylonjs@6.37.1"}static get Version(){return"6.37.1"}get description(){let e=this.name+this.webGLVersion;return this._caps.parallelShaderCompile&&(e+=" - Parallel shader compilation"),e}get name(){return this._name}set name(e){this._name=e}get version(){return this._webGLVersion}get isDisposed(){return this._isDisposed}static get ShadersRepository(){return rN.ShadersRepository}static set ShadersRepository(e){rN.ShadersRepository=e}_getShaderProcessor(e){return this._shaderProcessor}get useReverseDepthBuffer(){return this._useReverseDepthBuffer}set useReverseDepthBuffer(e){e!==this._useReverseDepthBuffer&&(this._useReverseDepthBuffer=e,e?this._depthCullingState.depthFunc=518:this._depthCullingState.depthFunc=515)}get frameId(){return this._frameId}get supportsUniformBuffers(){return this.webGLVersion>1&&!this.disableUniformBuffers}getCreationOptions(){return this._creationOptions}get _shouldUseHighPrecisionShader(){return!!(this._caps.highPrecisionShaderSupported&&this._highPrecisionShadersAllowed)}get needPOTTextures(){return this._webGLVersion<2||this.forcePOTTextures}get activeRenderLoops(){return this._activeRenderLoops}get doNotHandleContextLost(){return this._doNotHandleContextLost}set doNotHandleContextLost(e){this._doNotHandleContextLost=e}get _supportsHardwareTextureRescaling(){return!1}set framebufferDimensionsObject(e){this._framebufferDimensionsObject=e}get currentViewport(){return this._cachedViewport}get emptyTexture(){return this._emptyTexture||(this._emptyTexture=this.createRawTexture(new Uint8Array(4),1,1,5,!1,!1,1)),this._emptyTexture}get emptyTexture3D(){return this._emptyTexture3D||(this._emptyTexture3D=this.createRawTexture3D(new Uint8Array(4),1,1,1,5,!1,!1,1)),this._emptyTexture3D}get emptyTexture2DArray(){return this._emptyTexture2DArray||(this._emptyTexture2DArray=this.createRawTexture2DArray(new Uint8Array(4),1,1,1,5,!1,!1,1)),this._emptyTexture2DArray}get emptyCubeTexture(){if(!this._emptyCubeTexture){let e=new Uint8Array(4);this._emptyCubeTexture=this.createRawCubeTexture([e,e,e,e,e,e],1,5,0,!1,!1,1)}return this._emptyCubeTexture}get isWebGPU(){return this._isWebGPU}get shaderPlatformName(){return this._shaderPlatformName}get snapshotRendering(){return!1}set snapshotRendering(e){}get snapshotRenderingMode(){return this._snapshotRenderingMode}set snapshotRenderingMode(e){this._snapshotRenderingMode=e}snapshotRenderingReset(){this.snapshotRendering=!1}static _CreateCanvas(e,t){if("undefined"==typeof document)return new OffscreenCanvas(e,t);let i=document.createElement("canvas");return i.width=e,i.height=t,i}createCanvas(e,t){return r$._CreateCanvas(e,t)}createCanvasImage(){return document.createElement("img")}constructor(e,t,i,r){var s,n,a,o,l,h,u,c,d,p,_;this._name="WebGL",this._isDisposed=!1,this.forcePOTTextures=!1,this.isFullscreen=!1,this.cullBackFaces=null,this.renderEvenInBackground=!0,this.preventCacheWipeBetweenFrames=!1,this.validateShaderPrograms=!1,this._useReverseDepthBuffer=!1,this.isNDCHalfZRange=!1,this.hasOriginBottomLeft=!0,this.disableUniformBuffers=!1,this.onDisposeObservable=new tj,this._frameId=0,this._uniformBuffers=[],this._storageBuffers=[],this._webGLVersion=1,this._windowIsBackground=!1,this._highPrecisionShadersAllowed=!0,this._badOS=!1,this._badDesktopOS=!1,this._renderingQueueLaunched=!1,this._activeRenderLoops=[],this.onContextLostObservable=new tj,this.onContextRestoredObservable=new tj,this._contextWasLost=!1,this._doNotHandleContextLost=!1,this.disableVertexArrayObjects=!1,this._colorWrite=!0,this._colorWriteChanged=!0,this._depthCullingState=new rF,this._stencilStateComposer=new rj,this._stencilState=new rw,this._alphaState=new rL,this._alphaMode=1,this._alphaEquation=0,this._internalTexturesCache=[],this._renderTargetWrapperCache=[],this._activeChannel=0,this._currentTextureChannel=-1,this._boundTexturesCache={},this._compiledEffects={},this._vertexAttribArraysEnabled=[],this._currentRenderTarget=null,this._uintIndicesCurrentlySet=!1,this._currentBoundBuffer=[],this._currentFramebuffer=null,this._dummyFramebuffer=null,this._currentBufferPointers=[],this._currentInstanceLocations=[],this._currentInstanceBuffers=[],this._vaoRecordInProgress=!1,this._mustWipeVertexAttributes=!1,this._nextFreeTextureSlots=[],this._maxSimultaneousTextures=0,this._maxMSAASamplesOverride=null,this._activeRequests=[],this.adaptToDeviceRatio=!1,this._lastDevicePixelRatio=1,this._transformTextureUrl=null,this.hostInformation={isMobile:!1},this.premultipliedAlpha=!0,this.onBeforeTextureInitObservable=new tj,this._isWebGPU=!1,this._snapshotRenderingMode=0,this._viewportCached={x:0,y:0,z:0,w:0},this._unpackFlipYCached=null,this.enableUnpackFlipYCached=!0,this._boundUniforms={},this.startTime=ra.Now;let f=null;i=i||{},this._creationOptions=i,this.adaptToDeviceRatio=null!=r&&r,this._stencilStateComposer.stencilGlobal=this._stencilState,t1.SetMatrixPrecision(!!i.useHighPrecisionMatrix),i.antialias=null!=t?t:i.antialias,i.deterministicLockstep=null!==(s=i.deterministicLockstep)&&void 0!==s&&s,i.lockstepMaxSteps=null!==(n=i.lockstepMaxSteps)&&void 0!==n?n:4,i.timeStep=null!==(a=i.timeStep)&&void 0!==a?a:1/60,i.audioEngine=null===(o=i.audioEngine)||void 0===o||o,i.stencil=null===(l=i.stencil)||void 0===l||l,this._audioContext=null!==(u=null===(h=i.audioEngineOptions)||void 0===h?void 0:h.audioContext)&&void 0!==u?u:null,this._audioDestination=null!==(d=null===(c=i.audioEngineOptions)||void 0===c?void 0:c.audioDestination)&&void 0!==d?d:null,this.premultipliedAlpha=null===(p=i.premultipliedAlpha)||void 0===p||p,this.useExactSrgbConversions=null!==(_=i.useExactSrgbConversions)&&void 0!==_&&_,this._doNotHandleContextLost=!!i.doNotHandleContextLost,this._isStencilEnable=!!i.stencil,r=r||i.adaptToDeviceRatio||!1;let m=i.limitDeviceRatio||1;if(this._hardwareScalingLevel=r?1/Math.min(m,1):1,this._lastDevicePixelRatio=1,!e)return;if(e.getContext){if(f=e,this._renderingCanvas=f,void 0===i.preserveDrawingBuffer&&(i.preserveDrawingBuffer=!1),void 0===i.xrCompatible&&(i.xrCompatible=!0),navigator&&navigator.userAgent){this._setupMobileChecks();let e=navigator.userAgent;for(let t of r$.ExceptionList){let r=t.key,s=t.targets;if(new RegExp(r).test(e)){if(t.capture&&t.captureConstraint){let i=t.capture,r=t.captureConstraint,s=new RegExp(i).exec(e);if(s&&s.length>0&&parseInt(s[s.length-1])>=r)continue}for(let e of s)switch(e){case"uniformBuffer":this.disableUniformBuffers=!0;break;case"vao":this.disableVertexArrayObjects=!0;break;case"antialias":i.antialias=!1;break;case"maxMSAASamples":this._maxMSAASamplesOverride=1}}}}if(this._doNotHandleContextLost||(this._onContextLost=e=>{e.preventDefault(),this._contextWasLost=!0,ig.Warn("WebGL context lost."),this.onContextLostObservable.notifyObservers(this)},this._onContextRestored=()=>{this._restoreEngineAfterContextLost(()=>this._initGLContext())},f.addEventListener("webglcontextlost",this._onContextLost,!1),f.addEventListener("webglcontextrestored",this._onContextRestored,!1),i.powerPreference=i.powerPreference||"high-performance"),this._badDesktopOS=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),this._badDesktopOS&&(i.xrCompatible=!1),!i.disableWebGL2Support)try{this._gl=f.getContext("webgl2",i)||f.getContext("experimental-webgl2",i),this._gl&&(this._webGLVersion=2,this._shaderPlatformName="WEBGL2",this._gl.deleteQuery||(this._webGLVersion=1,this._shaderPlatformName="WEBGL1"))}catch(e){}if(!this._gl){if(!f)throw Error("The provided canvas is null or undefined.");try{this._gl=f.getContext("webgl",i)||f.getContext("experimental-webgl",i)}catch(e){throw Error("WebGL not supported")}}if(!this._gl)throw Error("WebGL not supported")}else{this._gl=e,this._renderingCanvas=this._gl.canvas,this._gl.renderbufferStorageMultisample?(this._webGLVersion=2,this._shaderPlatformName="WEBGL2"):this._shaderPlatformName="WEBGL1";let t=this._gl.getContextAttributes();t&&(i.stencil=t.stencil)}this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,this._gl.NONE),void 0!==i.useHighPrecisionFloats&&(this._highPrecisionShadersAllowed=i.useHighPrecisionFloats),this.resize(),this._initGLContext(),this._initFeatures();for(let e=0;e1?new rG:new rV,this._badOS=/iPad/i.test(navigator.userAgent)||/iPhone/i.test(navigator.userAgent);let g=`Babylon.js v${r$.Version}`;ig.Log(g+` - ${this.description}`),this._renderingCanvas&&this._renderingCanvas.setAttribute&&this._renderingCanvas.setAttribute("data-engine",g)}_setupMobileChecks(){navigator&&navigator.userAgent&&(this._checkForMobile=()=>{let e=navigator.userAgent;this.hostInformation.isMobile=-1!==e.indexOf("Mobile")||-1!==e.indexOf("Mac")&&rs()&&"ontouchend"in document},this._checkForMobile())}_restoreEngineAfterContextLost(e){setTimeout(async()=>{var t;this._dummyFramebuffer=null,this._emptyTexture=null,this._emptyCubeTexture=null,this._emptyTexture3D=null,this._emptyTexture2DArray=null;let i=this._depthCullingState.depthTest,r=this._depthCullingState.depthFunc,s=this._depthCullingState.depthMask,n=this._stencilState.stencilTest;await e(),this.wipeCaches(!0),this._rebuildEffects(),null===(t=this._rebuildComputeEffects)||void 0===t||t.call(this),this._rebuildBuffers(),this._rebuildInternalTextures(),this._rebuildTextures(),this._rebuildRenderTargetWrappers(),this.wipeCaches(!0),this._depthCullingState.depthTest=i,this._depthCullingState.depthFunc=r,this._depthCullingState.depthMask=s,this._stencilState.stencilTest=n,ig.Warn(this.name+" context successfully restored."),this.onContextRestoredObservable.notifyObservers(this),this._contextWasLost=!1},0)}_sharedInit(e){this._renderingCanvas=e}_getShaderProcessingContext(e){return null}_rebuildInternalTextures(){for(let e of this._internalTexturesCache.slice())e._rebuild()}_rebuildRenderTargetWrappers(){for(let e of this._renderTargetWrapperCache.slice())e._rebuild()}_rebuildEffects(){for(let e in this._compiledEffects){let t=this._compiledEffects[e];t._pipelineContext=null,t._wasPreviouslyReady=!1,t._prepareEffect()}rN.ResetCache()}areAllEffectsReady(){for(let e in this._compiledEffects)if(!this._compiledEffects[e].isReady())return!1;return!0}_rebuildBuffers(){for(let e of this._uniformBuffers)e._rebuildAfterContextLost()}_rebuildTextures(){}_initGLContext(){var e;this._caps={maxTexturesImageUnits:this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),maxCombinedTexturesImageUnits:this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),maxVertexTextureImageUnits:this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),maxSamples:this._webGLVersion>1?this._gl.getParameter(this._gl.MAX_SAMPLES):1,maxCubemapTextureSize:this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),maxRenderTextureSize:this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),maxVertexAttribs:this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),maxVaryingVectors:this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),maxFragmentUniformVectors:this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),maxVertexUniformVectors:this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),parallelShaderCompile:this._gl.getExtension("KHR_parallel_shader_compile")||void 0,standardDerivatives:this._webGLVersion>1||null!==this._gl.getExtension("OES_standard_derivatives"),maxAnisotropy:1,astc:this._gl.getExtension("WEBGL_compressed_texture_astc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc"),bptc:this._gl.getExtension("EXT_texture_compression_bptc")||this._gl.getExtension("WEBKIT_EXT_texture_compression_bptc"),s3tc:this._gl.getExtension("WEBGL_compressed_texture_s3tc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),s3tc_srgb:this._gl.getExtension("WEBGL_compressed_texture_s3tc_srgb")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc_srgb"),pvrtc:this._gl.getExtension("WEBGL_compressed_texture_pvrtc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:this._gl.getExtension("WEBGL_compressed_texture_etc1")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"),etc2:this._gl.getExtension("WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBGL_compressed_texture_es3_0"),textureAnisotropicFilterExtension:this._gl.getExtension("EXT_texture_filter_anisotropic")||this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"),uintIndices:this._webGLVersion>1||null!==this._gl.getExtension("OES_element_index_uint"),fragmentDepthSupported:this._webGLVersion>1||null!==this._gl.getExtension("EXT_frag_depth"),highPrecisionShaderSupported:!1,timerQuery:this._gl.getExtension("EXT_disjoint_timer_query_webgl2")||this._gl.getExtension("EXT_disjoint_timer_query"),supportOcclusionQuery:this._webGLVersion>1,canUseTimestampForTimerQuery:!1,drawBuffersExtension:!1,maxMSAASamples:1,colorBufferFloat:!!(this._webGLVersion>1&&this._gl.getExtension("EXT_color_buffer_float")),supportFloatTexturesResolve:!1,rg11b10ufColorRenderable:!1,colorBufferHalfFloat:!!(this._webGLVersion>1&&this._gl.getExtension("EXT_color_buffer_half_float")),textureFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_float")),textureHalfFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_half_float")),textureHalfFloatRender:!1,textureFloatLinearFiltering:!1,textureFloatRender:!1,textureHalfFloatLinearFiltering:!1,vertexArrayObject:!1,instancedArrays:!1,textureLOD:!!(this._webGLVersion>1||this._gl.getExtension("EXT_shader_texture_lod")),texelFetch:1!==this._webGLVersion,blendMinMax:!1,multiview:this._gl.getExtension("OVR_multiview2"),oculusMultiview:this._gl.getExtension("OCULUS_multiview"),depthTextureExtension:!1,canUseGLInstanceID:this._webGLVersion>1,canUseGLVertexID:this._webGLVersion>1,supportComputeShaders:!1,supportSRGBBuffers:!1,supportTransformFeedbacks:this._webGLVersion>1,textureMaxLevel:this._webGLVersion>1,texture2DArrayMaxLayerCount:this._webGLVersion>1?this._gl.getParameter(this._gl.MAX_ARRAY_TEXTURE_LAYERS):128,disableMorphTargetTexture:!1},this._caps.supportFloatTexturesResolve=this._caps.colorBufferFloat,this._caps.rg11b10ufColorRenderable=this._caps.colorBufferFloat,this._glVersion=this._gl.getParameter(this._gl.VERSION);let t=this._gl.getExtension("WEBGL_debug_renderer_info");if(null!=t&&(this._glRenderer=this._gl.getParameter(t.UNMASKED_RENDERER_WEBGL),this._glVendor=this._gl.getParameter(t.UNMASKED_VENDOR_WEBGL)),this._glVendor||(this._glVendor=this._gl.getParameter(this._gl.VENDOR)||"Unknown vendor"),this._glRenderer||(this._glRenderer=this._gl.getParameter(this._gl.RENDERER)||"Unknown renderer"),36193!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=36193),34842!==this._gl.RGBA16F&&(this._gl.RGBA16F=34842),34836!==this._gl.RGBA32F&&(this._gl.RGBA32F=34836),35056!==this._gl.DEPTH24_STENCIL8&&(this._gl.DEPTH24_STENCIL8=35056),this._caps.timerQuery&&(1===this._webGLVersion&&(this._gl.getQuery=this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)),this._caps.canUseTimestampForTimerQuery=(null!==(e=this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT,this._caps.timerQuery.QUERY_COUNTER_BITS_EXT))&&void 0!==e?e:0)>0),this._caps.maxAnisotropy=this._caps.textureAnisotropicFilterExtension?this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,this._caps.textureFloatLinearFiltering=!!(this._caps.textureFloat&&this._gl.getExtension("OES_texture_float_linear")),this._caps.textureFloatRender=!!(this._caps.textureFloat&&this._canRenderToFloatFramebuffer()),this._caps.textureHalfFloatLinearFiltering=!!(this._webGLVersion>1||this._caps.textureHalfFloat&&this._gl.getExtension("OES_texture_half_float_linear")),this._caps.astc&&(this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR),this._caps.bptc&&(this._gl.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=this._caps.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT),this._caps.s3tc_srgb&&(this._gl.COMPRESSED_SRGB_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT),this._caps.etc2&&(this._gl.COMPRESSED_SRGB8_ETC2=this._caps.etc2.COMPRESSED_SRGB8_ETC2,this._gl.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=this._caps.etc2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC),this._webGLVersion>1&&5131!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=5131),this._caps.textureHalfFloatRender=this._caps.textureHalfFloat&&this._canRenderToHalfFloatFramebuffer(),this._webGLVersion>1)this._caps.drawBuffersExtension=!0,this._caps.maxMSAASamples=null!==this._maxMSAASamplesOverride?this._maxMSAASamplesOverride:this._gl.getParameter(this._gl.MAX_SAMPLES);else{let e=this._gl.getExtension("WEBGL_draw_buffers");if(null!==e){this._caps.drawBuffersExtension=!0,this._gl.drawBuffers=e.drawBuffersWEBGL.bind(e),this._gl.DRAW_FRAMEBUFFER=this._gl.FRAMEBUFFER;for(let t=0;t<16;t++)this._gl["COLOR_ATTACHMENT"+t+"_WEBGL"]=e["COLOR_ATTACHMENT"+t+"_WEBGL"]}}if(this._webGLVersion>1)this._caps.depthTextureExtension=!0;else{let e=this._gl.getExtension("WEBGL_depth_texture");null!=e&&(this._caps.depthTextureExtension=!0,this._gl.UNSIGNED_INT_24_8=e.UNSIGNED_INT_24_8_WEBGL)}if(this.disableVertexArrayObjects)this._caps.vertexArrayObject=!1;else if(this._webGLVersion>1)this._caps.vertexArrayObject=!0;else{let e=this._gl.getExtension("OES_vertex_array_object");null!=e&&(this._caps.vertexArrayObject=!0,this._gl.createVertexArray=e.createVertexArrayOES.bind(e),this._gl.bindVertexArray=e.bindVertexArrayOES.bind(e),this._gl.deleteVertexArray=e.deleteVertexArrayOES.bind(e))}if(this._webGLVersion>1)this._caps.instancedArrays=!0;else{let e=this._gl.getExtension("ANGLE_instanced_arrays");null!=e?(this._caps.instancedArrays=!0,this._gl.drawArraysInstanced=e.drawArraysInstancedANGLE.bind(e),this._gl.drawElementsInstanced=e.drawElementsInstancedANGLE.bind(e),this._gl.vertexAttribDivisor=e.vertexAttribDivisorANGLE.bind(e)):this._caps.instancedArrays=!1}if(this._gl.getShaderPrecisionFormat){let e=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT),t=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT);e&&t&&(this._caps.highPrecisionShaderSupported=0!==e.precision&&0!==t.precision)}if(this._webGLVersion>1)this._caps.blendMinMax=!0;else{let e=this._gl.getExtension("EXT_blend_minmax");null!=e&&(this._caps.blendMinMax=!0,this._gl.MAX=e.MAX_EXT,this._gl.MIN=e.MIN_EXT)}if(!this._caps.supportSRGBBuffers){if(this._webGLVersion>1)this._caps.supportSRGBBuffers=!0,this._glSRGBExtensionValues={SRGB:WebGL2RenderingContext.SRGB,SRGB8:WebGL2RenderingContext.SRGB8,SRGB8_ALPHA8:WebGL2RenderingContext.SRGB8_ALPHA8};else{let e=this._gl.getExtension("EXT_sRGB");null!=e&&(this._caps.supportSRGBBuffers=!0,this._glSRGBExtensionValues={SRGB:e.SRGB_EXT,SRGB8:e.SRGB_ALPHA_EXT,SRGB8_ALPHA8:e.SRGB_ALPHA_EXT})}this._caps.supportSRGBBuffers=this._caps.supportSRGBBuffers&&!!(this._creationOptions&&this._creationOptions.forceSRGBBufferSupportState)}this._depthCullingState.depthTest=!0,this._depthCullingState.depthFunc=this._gl.LEQUAL,this._depthCullingState.depthMask=!0,this._maxSimultaneousTextures=this._caps.maxCombinedTexturesImageUnits;for(let e=0;e=0&&(this._activeRenderLoops.splice(t,1),0==this._activeRenderLoops.length&&this._cancelFrame())}_cancelFrame(){if(this._renderingQueueLaunched&&this._frameHandler)return(this._renderingQueueLaunched=!1,"function"==typeof cancelAnimationFrame)?cancelAnimationFrame(this._frameHandler):clearTimeout(this._frameHandler)}_renderLoop(){if(!this._contextWasLost){let e=!0;if((this._isDisposed||!this.renderEvenInBackground&&this._windowIsBackground)&&(e=!1),e){this.beginFrame();for(let e=0;e0?this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1}getRenderingCanvas(){return this._renderingCanvas}getAudioContext(){return this._audioContext}getAudioDestination(){return this._audioDestination}getHostWindow(){return null}getRenderWidth(e=!1){return!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferWidth:this._gl.drawingBufferWidth}getRenderHeight(e=!1){return!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferHeight:this._gl.drawingBufferHeight}_queueNewFrame(e,t){return r$.QueueNewFrame(e,t)}runRenderLoop(e){-1===this._activeRenderLoops.indexOf(e)&&(this._activeRenderLoops.push(e),this._renderingQueueLaunched||(this._renderingQueueLaunched=!0,this._boundRenderFunction=()=>this._renderLoop(),this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow())))}clear(e,t,i,r=!1){var s,n;let a=this.stencilStateComposer.useStencilGlobalOnly;this.stencilStateComposer.useStencilGlobalOnly=!0,this.applyStates(),this.stencilStateComposer.useStencilGlobalOnly=a;let o=0;if(t&&e){let t=!0;if(this._currentRenderTarget){let i=null===(s=this._currentRenderTarget.texture)||void 0===s?void 0:s.format;if(8===i||9===i||10===i||11===i){let i=null===(n=this._currentRenderTarget.texture)||void 0===n?void 0:n.type;7===i||5===i?(r$._TempClearColorUint32[0]=255*e.r,r$._TempClearColorUint32[1]=255*e.g,r$._TempClearColorUint32[2]=255*e.b,r$._TempClearColorUint32[3]=255*e.a,this._gl.clearBufferuiv(this._gl.COLOR,0,r$._TempClearColorUint32)):(r$._TempClearColorInt32[0]=255*e.r,r$._TempClearColorInt32[1]=255*e.g,r$._TempClearColorInt32[2]=255*e.b,r$._TempClearColorInt32[3]=255*e.a,this._gl.clearBufferiv(this._gl.COLOR,0,r$._TempClearColorInt32)),t=!1}}t&&(this._gl.clearColor(e.r,e.g,e.b,void 0!==e.a?e.a:1),o|=this._gl.COLOR_BUFFER_BIT)}i&&(this.useReverseDepthBuffer?(this._depthCullingState.depthFunc=this._gl.GEQUAL,this._gl.clearDepth(0)):this._gl.clearDepth(1),o|=this._gl.DEPTH_BUFFER_BIT),r&&(this._gl.clearStencil(0),o|=this._gl.STENCIL_BUFFER_BIT),this._gl.clear(o)}_viewport(e,t,i,r){(e!==this._viewportCached.x||t!==this._viewportCached.y||i!==this._viewportCached.z||r!==this._viewportCached.w)&&(this._viewportCached.x=e,this._viewportCached.y=t,this._viewportCached.z=i,this._viewportCached.w=r,this._gl.viewport(e,t,i,r))}setViewport(e,t,i){let r=t||this.getRenderWidth(),s=i||this.getRenderHeight(),n=e.x||0,a=e.y||0;this._cachedViewport=e,this._viewport(n*r,a*s,r*e.width,s*e.height)}beginFrame(){}endFrame(){this._badOS&&this.flushFramebuffer(),this._frameId++}resize(e=!1){let t,i;if(this.adaptToDeviceRatio){let e=this._lastDevicePixelRatio/1;this._lastDevicePixelRatio=1,this._hardwareScalingLevel*=e}t=this._renderingCanvas?this._renderingCanvas.width:100,i=this._renderingCanvas?this._renderingCanvas.height:100,this.setSize(t/this._hardwareScalingLevel,i/this._hardwareScalingLevel,e)}setSize(e,t,i=!1){return!!this._renderingCanvas&&(e|=0,t|=0,(!!i||this._renderingCanvas.width!==e||this._renderingCanvas.height!==t)&&(this._renderingCanvas.width=e,this._renderingCanvas.height=t,!0))}bindFramebuffer(e,t=0,i,r,s,n=0,a=0){var o,l,h,u,c,d;this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._bindUnboundFramebuffer(e._MSAAFramebuffer?e._MSAAFramebuffer:e._framebuffer);let p=this._gl;e.isMulti||(e.is2DArray?p.framebufferTextureLayer(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,null===(o=e.texture._hardwareTexture)||void 0===o?void 0:o.underlyingResource,n,a):e.isCube?p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_CUBE_MAP_POSITIVE_X+t,null===(l=e.texture._hardwareTexture)||void 0===l?void 0:l.underlyingResource,n):e._currentLOD===n||(p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_2D,null===(h=e.texture._hardwareTexture)||void 0===h?void 0:h.underlyingResource,n),e._currentLOD=n));let _=e._depthStencilTexture;if(_){let i=e._depthStencilTextureWithStencil?p.DEPTH_STENCIL_ATTACHMENT:p.DEPTH_ATTACHMENT;e.is2DArray?p.framebufferTextureLayer(p.FRAMEBUFFER,i,null===(u=_._hardwareTexture)||void 0===u?void 0:u.underlyingResource,n,a):e.isCube?p.framebufferTexture2D(p.FRAMEBUFFER,i,p.TEXTURE_CUBE_MAP_POSITIVE_X+t,null===(c=_._hardwareTexture)||void 0===c?void 0:c.underlyingResource,n):p.framebufferTexture2D(p.FRAMEBUFFER,i,p.TEXTURE_2D,null===(d=_._hardwareTexture)||void 0===d?void 0:d.underlyingResource,n)}this._cachedViewport&&!s?this.setViewport(this._cachedViewport,i,r):(!i&&(i=e.width,n&&(i/=Math.pow(2,n))),!r&&(r=e.height,n&&(r/=Math.pow(2,n))),this._viewport(0,0,i,r)),this.wipeCaches()}setState(e,t=0,i,r=!1,s,n,a=0){var o,l;(this._depthCullingState.cull!==e||i)&&(this._depthCullingState.cull=e);let h=null===(l=null!==(o=this.cullBackFaces)&&void 0!==o?o:s)||void 0===l||l?this._gl.BACK:this._gl.FRONT;(this._depthCullingState.cullFace!==h||i)&&(this._depthCullingState.cullFace=h),this.setZOffset(t),this.setZOffsetUnits(a);let u=r?this._gl.CW:this._gl.CCW;(this._depthCullingState.frontFace!==u||i)&&(this._depthCullingState.frontFace=u),this._stencilStateComposer.stencilMaterial=n}getDepthBuffer(){return this._depthCullingState.depthTest}setDepthBuffer(e){this._depthCullingState.depthTest=e}setZOffset(e){this._depthCullingState.zOffset=this.useReverseDepthBuffer?-e:e}getZOffset(){let e=this._depthCullingState.zOffset;return this.useReverseDepthBuffer?-e:e}setZOffsetUnits(e){this._depthCullingState.zOffsetUnits=this.useReverseDepthBuffer?-e:e}getZOffsetUnits(){let e=this._depthCullingState.zOffsetUnits;return this.useReverseDepthBuffer?-e:e}_bindUnboundFramebuffer(e){this._currentFramebuffer!==e&&(this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,e),this._currentFramebuffer=e)}_currentFrameBufferIsDefaultFrameBuffer(){return null===this._currentFramebuffer}generateMipmaps(e){this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)}unBindFramebuffer(e,t=!1,i){var r;this._currentRenderTarget=null;let s=this._gl;if(e._MSAAFramebuffer){if(e.isMulti){this.unBindMultiColorAttachmentFramebuffer(e,t,i);return}s.bindFramebuffer(s.READ_FRAMEBUFFER,e._MSAAFramebuffer),s.bindFramebuffer(s.DRAW_FRAMEBUFFER,e._framebuffer),s.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,s.COLOR_BUFFER_BIT,s.NEAREST)}(null===(r=e.texture)||void 0===r?void 0:r.generateMipMaps)&&!t&&!e.isCube&&this.generateMipmaps(e.texture),i&&(e._MSAAFramebuffer&&this._bindUnboundFramebuffer(e._framebuffer),i()),this._bindUnboundFramebuffer(null)}flushFramebuffer(){this._gl.flush()}restoreDefaultFramebuffer(){this._currentRenderTarget?this.unBindFramebuffer(this._currentRenderTarget):this._bindUnboundFramebuffer(null),this._cachedViewport&&this.setViewport(this._cachedViewport),this.wipeCaches()}_resetVertexBufferBinding(){this.bindArrayBuffer(null),this._cachedVertexBuffers=null}createVertexBuffer(e,t,i){return this._createVertexBuffer(e,this._gl.STATIC_DRAW)}_createVertexBuffer(e,t){let i=this._gl.createBuffer();if(!i)throw Error("Unable to create vertex buffer");let r=new rW(i);return this.bindArrayBuffer(r),e instanceof Array?this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(e),t):this._gl.bufferData(this._gl.ARRAY_BUFFER,e,t),this._resetVertexBufferBinding(),r.references=1,r}createDynamicVertexBuffer(e,t){return this._createVertexBuffer(e,this._gl.DYNAMIC_DRAW)}_resetIndexBufferBinding(){this.bindIndexBuffer(null),this._cachedIndexBuffer=null}createIndexBuffer(e,t,i){let r=this._gl.createBuffer(),s=new rW(r);if(!r)throw Error("Unable to create index buffer");this.bindIndexBuffer(s);let n=this._normalizeIndexData(e);return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,n,t?this._gl.DYNAMIC_DRAW:this._gl.STATIC_DRAW),this._resetIndexBufferBinding(),s.references=1,s.is32Bits=4===n.BYTES_PER_ELEMENT,s}_normalizeIndexData(e){if(2===e.BYTES_PER_ELEMENT)return e;if(this._caps.uintIndices){if(e instanceof Uint32Array)return e;for(let t=0;t=65535)return new Uint32Array(e)}return new Uint16Array(e)}bindArrayBuffer(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ARRAY_BUFFER)}bindUniformBlock(e,t,i){let r=e.program,s=this._gl.getUniformBlockIndex(r,t);this._gl.uniformBlockBinding(r,s,i)}bindIndexBuffer(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)}_bindBuffer(e,t){(this._vaoRecordInProgress||this._currentBoundBuffer[t]!==e)&&(this._gl.bindBuffer(t,e?e.underlyingResource:null),this._currentBoundBuffer[t]=e)}updateArrayBuffer(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)}_vertexAttribPointer(e,t,i,r,s,n,a){let o=this._currentBufferPointers[t];if(!o)return;let l=!1;o.active?(o.buffer!==e&&(o.buffer=e,l=!0),o.size!==i&&(o.size=i,l=!0),o.type!==r&&(o.type=r,l=!0),o.normalized!==s&&(o.normalized=s,l=!0),o.stride!==n&&(o.stride=n,l=!0),o.offset!==a&&(o.offset=a,l=!0)):(l=!0,o.active=!0,o.index=t,o.size=i,o.type=r,o.normalized=s,o.stride=n,o.offset=a,o.buffer=e),(l||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),r===this._gl.UNSIGNED_INT||r===this._gl.INT?this._gl.vertexAttribIPointer(t,i,r,n,a):this._gl.vertexAttribPointer(t,i,r,s,n,a))}_bindIndexBufferWithCache(e){null!=e&&this._cachedIndexBuffer!==e&&(this._cachedIndexBuffer=e,this.bindIndexBuffer(e),this._uintIndicesCurrentlySet=e.is32Bits)}_bindVertexBuffersAttributes(e,t,i){let r=t.getAttributesNames();this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.unbindAllAttributes();for(let s=0;s=0){let t=r[s],a=null;if(i&&(a=i[t]),a||(a=e[t]),!a)continue;this._gl.enableVertexAttribArray(n),this._vaoRecordInProgress||(this._vertexAttribArraysEnabled[n]=!0);let o=a.getBuffer();o&&(this._vertexAttribPointer(o,n,a.getSize(),a.type,a.normalized,a.byteStride,a.byteOffset),a.getIsInstanced()&&(this._gl.vertexAttribDivisor(n,a.getInstanceDivisor()),this._vaoRecordInProgress||(this._currentInstanceLocations.push(n),this._currentInstanceBuffers.push(o))))}}}recordVertexArrayObject(e,t,i,r){let s=this._gl.createVertexArray();if(!s)throw Error("Unable to create VAO");return this._vaoRecordInProgress=!0,this._gl.bindVertexArray(s),this._mustWipeVertexAttributes=!0,this._bindVertexBuffersAttributes(e,i,r),this.bindIndexBuffer(t),this._vaoRecordInProgress=!1,this._gl.bindVertexArray(null),s}bindVertexArrayObject(e,t){this._cachedVertexArrayObject!==e&&(this._cachedVertexArrayObject=e,this._gl.bindVertexArray(e),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._uintIndicesCurrentlySet=null!=t&&t.is32Bits,this._mustWipeVertexAttributes=!0)}bindBuffersDirectly(e,t,i,r,s){if(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==s){this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=s;let t=s.getAttributesCount();this._unbindVertexArrayObject(),this.unbindAllAttributes();let n=0;for(let a=0;a=0&&(this._gl.enableVertexAttribArray(t),this._vertexAttribArraysEnabled[t]=!0,this._vertexAttribPointer(e,t,i[a],this._gl.FLOAT,!1,r,n)),n+=4*i[a]}}this._bindIndexBufferWithCache(t)}_unbindVertexArrayObject(){this._cachedVertexArrayObject&&(this._cachedVertexArrayObject=null,this._gl.bindVertexArray(null))}bindBuffers(e,t,i,r){(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==i)&&(this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=i,this._bindVertexBuffersAttributes(e,i,r)),this._bindIndexBufferWithCache(t)}unbindInstanceAttributes(){let e;for(let t=0,i=this._currentInstanceLocations.length;t1?"#version 300 es\n#define WEBGL2 \n":"",o=this._compileShader(t,"vertex",r,a),l=this._compileShader(i,"fragment",r,a);return this._createShaderProgram(e,o,l,s,n)}inlineShaderCode(e){return e}createPipelineContext(e){let t=new rH;return t.engine=this,this._caps.parallelShaderCompile&&(t.isParallelCompiled=!0),t}createMaterialContext(){}createDrawContext(){}_createShaderProgram(e,t,i,r,s=null){let n=r.createProgram();if(e.program=n,!n)throw Error("Unable to create program");return r.attachShader(n,t),r.attachShader(n,i),r.linkProgram(n),e.context=r,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),n}_finalizePipelineContext(e){let t=e.context,i=e.vertexShader,r=e.fragmentShader,s=e.program;if(!t.getProgramParameter(s,t.LINK_STATUS)){if(!this._gl.getShaderParameter(i,this._gl.COMPILE_STATUS)){let t=this._gl.getShaderInfoLog(i);if(t)throw e.vertexCompilationError=t,Error("VERTEX SHADER "+t)}if(!this._gl.getShaderParameter(r,this._gl.COMPILE_STATUS)){let t=this._gl.getShaderInfoLog(r);if(t)throw e.fragmentCompilationError=t,Error("FRAGMENT SHADER "+t)}let n=t.getProgramInfoLog(s);if(n)throw e.programLinkError=n,Error(n)}if(this.validateShaderPrograms&&(t.validateProgram(s),!t.getProgramParameter(s,t.VALIDATE_STATUS))){let i=t.getProgramInfoLog(s);if(i)throw e.programValidationError=i,Error(i)}t.deleteShader(i),t.deleteShader(r),e.vertexShader=void 0,e.fragmentShader=void 0,e.onCompiled&&(e.onCompiled(),e.onCompiled=void 0)}_preparePipelineContext(e,t,i,r,s,n,a,o,l,h){r?e.program=this.createRawShaderProgram(e,t,i,void 0,l):e.program=this.createShaderProgram(e,t,i,o,void 0,l),e.program.__SPECTOR_rebuildProgram=a}_isRenderingStateCompiled(e){return!this._isDisposed&&!e._isDisposed&&!!this._gl.getProgramParameter(e.program,this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR)&&(this._finalizePipelineContext(e),!0)}_executeWhenRenderingStateIsCompiled(e,t){if(!e.isParallelCompiled){t();return}let i=e.onCompiled;i?e.onCompiled=()=>{i(),t()}:e.onCompiled=t}getUniforms(e,t){let i=[];for(let r=0;r1||this.isWebGPU)),(1!==o||this._caps.textureFloatLinearFiltering)&&(2!==o||this._caps.textureHalfFloatLinearFiltering)||(l=1),1!==o||this._caps.textureFloat||(o=0,ig.Warn("Float textures are not supported. Type forced to TEXTURETYPE_UNSIGNED_BYTE"));let d=this._gl,p=new rU(this,r),_=e.width||e,f=e.height||e,g=e.layers||0,v=this._getSamplingParameters(l,a),x=0!==g?d.TEXTURE_2D_ARRAY:d.TEXTURE_2D,T=this._getRGBABufferInternalSizedFormat(o,h,u),b=this._getInternalFormat(h),E=this._getWebGLTextureType(o);return this._bindTextureDirectly(x,p),0!==g?(p.is2DArray=!0,d.texImage3D(x,0,T,_,f,g,0,b,E,null)):d.texImage2D(x,0,T,_,f,0,b,E,null),d.texParameteri(x,d.TEXTURE_MAG_FILTER,v.mag),d.texParameteri(x,d.TEXTURE_MIN_FILTER,v.min),d.texParameteri(x,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(x,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),a&&this._gl.generateMipmap(x),this._bindTextureDirectly(x,null),p._useSRGBBuffer=u,p.baseWidth=_,p.baseHeight=f,p.width=_,p.height=f,p.depth=g,p.isReady=!0,p.samples=c,p.generateMipMaps=a,p.samplingMode=l,p.type=o,p.format=h,p.label=n,this._internalTexturesCache.push(p),p}_getUseSRGBBuffer(e,t){return e&&this._caps.supportSRGBBuffers&&(this.webGLVersion>1||this.isWebGPU||t)}_createTextureBase(e,t,i,r,s=3,n=null,a=null,o,l,h=null,u=null,c=null,d=null,p,_,f){let g="data:"===(e=e||"").substr(0,5),v="blob:"===e.substr(0,5),x=g&&-1!==e.indexOf(";base64,"),T=u||new rU(this,m.Url);T!==u&&(T.label=e.substring(0,60));let b=e;!this._transformTextureUrl||x||u||h||(e=this._transformTextureUrl(e)),b!==e&&(T._originalUrl=b);let E=e.lastIndexOf("."),S=d||(E>-1?e.substring(E).toLowerCase():""),C=null;for(let e of(S.indexOf("?")>-1&&(S=S.split("?")[0]),r$._TextureLoaders))if(e.canLoad(S,p)){C=e;break}r&&r.addPendingData(T),T.url=e,T.generateMipMaps=!t,T.samplingMode=s,T.invertY=i,T._useSRGBBuffer=this._getUseSRGBBuffer(!!f,t),this._doNotHandleContextLost||(T._buffer=h);let y=null;n&&!u&&(y=T.onLoadedObservable.add(n)),u||this._internalTexturesCache.push(T);let A=(i,u)=>{r&&r.removePendingData(T),e===b?(y&&T.onLoadedObservable.remove(y),t2.UseFallbackTexture&&this._createTextureBase(t2.FallbackTexture,t,T.invertY,r,s,null,a,o,l,h,T),i=(i||"Unknown error")+(t2.UseFallbackTexture?" - Fallback texture was used":""),T.onErrorObservable.notifyObservers({message:i,exception:u}),a&&a(i,u)):(ig.Warn(`Failed to load ${e}, falling back to ${b}`),this._createTextureBase(b,t,T.invertY,r,s,n,a,o,l,h,T,c,d,p,_,f))};if(C){let t=e=>{C.loadData(e,T,(e,t,i,n,a,l)=>{l?A("TextureLoader failed to load data"):o(T,S,r,{width:e,height:t},T.invertY,!i,n,()=>(a(),!1),s)},_)};h?h instanceof ArrayBuffer?t(new Uint8Array(h)):ArrayBuffer.isView(h)?t(h):a&&a("Unable to load: only ArrayBuffer or ArrayBufferView is supported",null):this._loadFile(e,e=>t(new Uint8Array(e)),void 0,r?r.offlineProvider:void 0,!0,(e,t)=>{A("Unable to load "+(e&&e.responseURL,t))})}else{let i=e=>{v&&!this._doNotHandleContextLost&&(T._buffer=e),o(T,S,r,e,T.invertY,t,!1,l,s)};!g||x?h&&("string"==typeof h.decoding||h.close)?i(h):r$._FileToolsLoadImage(e,i,A,r?r.offlineProvider:null,p,T.invertY&&this._features.needsInvertingBitmap?{imageOrientation:"flipY"}:void 0):"string"==typeof h||h instanceof ArrayBuffer||ArrayBuffer.isView(h)||h instanceof Blob?r$._FileToolsLoadImage(h,i,A,r?r.offlineProvider:null,p,T.invertY&&this._features.needsInvertingBitmap?{imageOrientation:"flipY"}:void 0):h&&i(h)}return T}createTexture(e,t,i,r,s=3,n=null,a=null,o=null,l=null,h=null,u=null,c,d,p,_){return this._createTextureBase(e,t,i,r,s,n,a,this._prepareWebGLTexture.bind(this),(e,t,i,s,n,a)=>{let o=this._gl,l=i.width===e&&i.height===t;n._creationFlags=null!=p?p:0;let u=this._getTexImageParametersForCreateTexture(h,s,n._useSRGBBuffer);if(l)return o.texImage2D(o.TEXTURE_2D,0,u.internalFormat,u.format,u.type,i),!1;let c=this._caps.maxTextureSize;if(i.width>c||i.height>c||!this._supportsHardwareTextureRescaling)return this._prepareWorkingCanvas(),!!this._workingCanvas&&!!this._workingContext&&(this._workingCanvas.width=e,this._workingCanvas.height=t,this._workingContext.drawImage(i,0,0,i.width,i.height,0,0,e,t),o.texImage2D(o.TEXTURE_2D,0,u.internalFormat,u.format,u.type,this._workingCanvas),n.width=e,n.height=t,!1);{let e=new rU(this,m.Temp);this._bindTextureDirectly(o.TEXTURE_2D,e,!0),o.texImage2D(o.TEXTURE_2D,0,u.internalFormat,u.format,u.type,i),this._rescaleTexture(e,n,r,u.format,()=>{this._releaseTexture(e),this._bindTextureDirectly(o.TEXTURE_2D,n,!0),a()})}return!0},o,l,h,u,c,d,_)}_getTexImageParametersForCreateTexture(e,t,i){let r,s;return null==e&&(e=".jpg"!==t||i?5:4),1===this.webGLVersion?s=r=this._getInternalFormat(e,i):(r=this._getInternalFormat(e,!1),s=this._getRGBABufferInternalSizedFormat(0,e,i)),{internalFormat:s,format:r,type:this._gl.UNSIGNED_BYTE}}static _FileToolsLoadImage(e,t,i,r,s,n){throw iL("FileTools")}_rescaleTexture(e,t,i,r,s){}createRawTexture(e,t,i,r,s,n,a,o=null,l=0,h=0,u=!1){throw iL("Engine.RawTexture")}createRawCubeTexture(e,t,i,r,s,n,a,o=null){throw iL("Engine.RawTexture")}createRawTexture3D(e,t,i,r,s,n,a,o,l=null,h=0){throw iL("Engine.RawTexture")}createRawTexture2DArray(e,t,i,r,s,n,a,o,l=null,h=0){throw iL("Engine.RawTexture")}_unpackFlipY(e){this._unpackFlipYCached!==e&&(this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,e?1:0),this.enableUnpackFlipYCached&&(this._unpackFlipYCached=e))}_getUnpackAlignement(){return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT)}_getTextureTarget(e){return e.isCube?this._gl.TEXTURE_CUBE_MAP:e.is3D?this._gl.TEXTURE_3D:e.is2DArray||e.isMultiview?this._gl.TEXTURE_2D_ARRAY:this._gl.TEXTURE_2D}updateTextureSamplingMode(e,t,i=!1){let r=this._getTextureTarget(t),s=this._getSamplingParameters(e,t.useMipMaps||i);this._setTextureParameterInteger(r,this._gl.TEXTURE_MAG_FILTER,s.mag,t),this._setTextureParameterInteger(r,this._gl.TEXTURE_MIN_FILTER,s.min),i&&(t.generateMipMaps=!0,this._gl.generateMipmap(r)),this._bindTextureDirectly(r,null),t.samplingMode=e}updateTextureDimensions(e,t,i,r=1){}updateTextureWrappingMode(e,t,i=null,r=null){let s=this._getTextureTarget(e);null!==t&&(this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t),e),e._cachedWrapU=t),null!==i&&(this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(i),e),e._cachedWrapV=i),(e.is2DArray||e.is3D)&&null!==r&&(this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(r),e),e._cachedWrapR=r),this._bindTextureDirectly(s,null)}_setupDepthStencilTexture(e,t,i,r,s,n=1){let a=t.width||t,o=t.height||t,l=t.layers||0;e.baseWidth=a,e.baseHeight=o,e.width=a,e.height=o,e.is2DArray=l>0,e.depth=l,e.isReady=!0,e.samples=n,e.generateMipMaps=!1,e.samplingMode=r?2:1,e.type=0,e._comparisonFunction=s;let h=this._gl,u=this._getTextureTarget(e),c=this._getSamplingParameters(e.samplingMode,!1);h.texParameteri(u,h.TEXTURE_MAG_FILTER,c.mag),h.texParameteri(u,h.TEXTURE_MIN_FILTER,c.min),h.texParameteri(u,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(u,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),this.webGLVersion>1&&(0===s?(h.texParameteri(u,h.TEXTURE_COMPARE_FUNC,515),h.texParameteri(u,h.TEXTURE_COMPARE_MODE,h.NONE)):(h.texParameteri(u,h.TEXTURE_COMPARE_FUNC,s),h.texParameteri(u,h.TEXTURE_COMPARE_MODE,h.COMPARE_REF_TO_TEXTURE)))}_uploadCompressedDataToTextureDirectly(e,t,i,r,s,n=0,a=0){let o=this._gl,l=o.TEXTURE_2D;if(e.isCube&&(l=o.TEXTURE_CUBE_MAP_POSITIVE_X+n),e._useSRGBBuffer)switch(t){case 37492:case 36196:this._caps.etc2?t=o.COMPRESSED_SRGB8_ETC2:e._useSRGBBuffer=!1;break;case 37496:this._caps.etc2?t=o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:e._useSRGBBuffer=!1;break;case 36492:t=o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;break;case 37808:t=o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;break;case 33776:this._caps.s3tc_srgb?t=o.COMPRESSED_SRGB_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case 33777:this._caps.s3tc_srgb?t=o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case 33779:this._caps.s3tc_srgb?t=o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:e._useSRGBBuffer=!1;break;default:e._useSRGBBuffer=!1}this._gl.compressedTexImage2D(l,a,t,i,r,0,s)}_uploadDataToTextureDirectly(e,t,i=0,r=0,s,n=!1){let a=this._gl,o=this._getWebGLTextureType(e.type),l=this._getInternalFormat(e.format),h=void 0===s?this._getRGBABufferInternalSizedFormat(e.type,e.format,e._useSRGBBuffer):this._getInternalFormat(s,e._useSRGBBuffer);this._unpackFlipY(e.invertY);let u=a.TEXTURE_2D;e.isCube&&(u=a.TEXTURE_CUBE_MAP_POSITIVE_X+i);let c=Math.round(Math.log(e.width)*Math.LOG2E),d=Math.round(Math.log(e.height)*Math.LOG2E),p=n?e.width:Math.pow(2,Math.max(c-r,0)),_=n?e.height:Math.pow(2,Math.max(d-r,0));a.texImage2D(u,r,h,p,_,0,l,o,t)}updateTextureData(e,t,i,r,s,n,a=0,o=0,l=!1){let h=this._gl,u=this._getWebGLTextureType(e.type),c=this._getInternalFormat(e.format);this._unpackFlipY(e.invertY);let d=h.TEXTURE_2D,p=h.TEXTURE_2D;e.isCube&&(p=h.TEXTURE_CUBE_MAP_POSITIVE_X+a,d=h.TEXTURE_CUBE_MAP),this._bindTextureDirectly(d,e,!0),h.texSubImage2D(p,o,i,r,s,n,c,u,t),l&&this._gl.generateMipmap(p),this._bindTextureDirectly(d,null)}_uploadArrayBufferViewToTexture(e,t,i=0,r=0){let s=this._gl,n=e.isCube?s.TEXTURE_CUBE_MAP:s.TEXTURE_2D;this._bindTextureDirectly(n,e,!0),this._uploadDataToTextureDirectly(e,t,i,r),this._bindTextureDirectly(n,null,!0)}_prepareWebGLTextureContinuation(e,t,i,r,s){let n=this._gl;if(!n)return;let a=this._getSamplingParameters(s,!i);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,a.mag),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,a.min),i||r||n.generateMipmap(n.TEXTURE_2D),this._bindTextureDirectly(n.TEXTURE_2D,null),t&&t.removePendingData(e),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}_prepareWebGLTexture(e,t,i,r,s,n,a,o,l=3){let h=this.getCaps().maxTextureSize,u=Math.min(h,this.needPOTTextures?r$.GetExponentOfTwo(r.width,h):r.width),c=Math.min(h,this.needPOTTextures?r$.GetExponentOfTwo(r.height,h):r.height),d=this._gl;if(d){if(!e._hardwareTexture){i&&i.removePendingData(e);return}this._bindTextureDirectly(d.TEXTURE_2D,e,!0),this._unpackFlipY(void 0===s||!!s),e.baseWidth=r.width,e.baseHeight=r.height,e.width=u,e.height=c,e.isReady=!0,e.type=-1!==e.type?e.type:0,e.format=-1!==e.format?e.format:".jpg"!==t||e._useSRGBBuffer?5:4,o(u,c,r,t,e,()=>{this._prepareWebGLTextureContinuation(e,i,n,a,l)})||this._prepareWebGLTextureContinuation(e,i,n,a,l)}}_setupFramebufferDepthAttachments(e,t,i,r,s=1){let n=this._gl;if(e&&t)return this._createRenderBuffer(i,r,s,n.DEPTH_STENCIL,n.DEPTH24_STENCIL8,n.DEPTH_STENCIL_ATTACHMENT);if(t){let e=n.DEPTH_COMPONENT16;return this._webGLVersion>1&&(e=n.DEPTH_COMPONENT32F),this._createRenderBuffer(i,r,s,e,e,n.DEPTH_ATTACHMENT)}return e?this._createRenderBuffer(i,r,s,n.STENCIL_INDEX8,n.STENCIL_INDEX8,n.STENCIL_ATTACHMENT):null}_createRenderBuffer(e,t,i,r,s,n,a=!0){let o=this._gl.createRenderbuffer();return this._updateRenderBuffer(o,e,t,i,r,s,n,a)}_updateRenderBuffer(e,t,i,r,s,n,a,o=!0){let l=this._gl;return l.bindRenderbuffer(l.RENDERBUFFER,e),r>1&&l.renderbufferStorageMultisample?l.renderbufferStorageMultisample(l.RENDERBUFFER,r,n,t,i):l.renderbufferStorage(l.RENDERBUFFER,s,t,i),l.framebufferRenderbuffer(l.FRAMEBUFFER,a,l.RENDERBUFFER,e),o&&l.bindRenderbuffer(l.RENDERBUFFER,null),e}_releaseTexture(e){var t;this._deleteTexture(null===(t=e._hardwareTexture)||void 0===t?void 0:t.underlyingResource),this.unbindAllTextures();let i=this._internalTexturesCache.indexOf(e);-1!==i&&this._internalTexturesCache.splice(i,1),e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureLow&&e._lodTextureLow.dispose(),e._irradianceTexture&&e._irradianceTexture.dispose()}_releaseRenderTargetWrapper(e){let t=this._renderTargetWrapperCache.indexOf(e);-1!==t&&this._renderTargetWrapperCache.splice(t,1)}_deleteTexture(e){e&&this._gl.deleteTexture(e)}_setProgram(e){this._currentProgram!==e&&(this._gl.useProgram(e),this._currentProgram=e)}bindSamplers(e){let t=e.getPipelineContext();this._setProgram(t.program);let i=e.getSamplers();for(let t=0;t-1;if(i&&o&&(this._activeChannel=t._associatedChannel),this._boundTexturesCache[this._activeChannel]!==t||r){if(this._activateCurrentTexture(),t&&t.isMultiview)throw ig.Error(["_bindTextureDirectly called with a multiview texture!",e,t]),"_bindTextureDirectly called with a multiview texture!";this._gl.bindTexture(e,null!==(n=null===(s=null==t?void 0:t._hardwareTexture)||void 0===s?void 0:s.underlyingResource)&&void 0!==n?n:null),this._boundTexturesCache[this._activeChannel]=t,t&&(t._associatedChannel=this._activeChannel)}else i&&(a=!0,this._activateCurrentTexture());return o&&!i&&this._bindSamplerUniformToChannel(t._associatedChannel,this._activeChannel),a}_bindTexture(e,t,i){if(void 0===e)return;t&&(t._associatedChannel=e),this._activeChannel=e;let r=t?this._getTextureTarget(t):this._gl.TEXTURE_2D;this._bindTextureDirectly(r,t)}unbindAllTextures(){for(let e=0;e1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))}setTexture(e,t,i,r){void 0!==e&&(t&&(this._boundUniforms[e]=t),this._setTexture(e,i))}_bindSamplerUniformToChannel(e,t){let i=this._boundUniforms[e];i&&i._currentState!==t&&(this._gl.uniform1i(i,t),i._currentState=t)}_getTextureWrapMode(e){switch(e){case 1:break;case 0:return this._gl.CLAMP_TO_EDGE;case 2:return this._gl.MIRRORED_REPEAT}return this._gl.REPEAT}_setTexture(e,t,i=!1,r=!1,s=""){let n;if(!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),this.webGLVersion>1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))),!1;if(t.video){this._activeChannel=e;let i=t.getInternalTexture();i&&(i._associatedChannel=e),t.update()}else if(4===t.delayLoadState)return t.delayLoad(),!1;n=r?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture,!i&&n&&(n._associatedChannel=e);let a=!0;this._boundTexturesCache[e]===n&&(i||this._bindSamplerUniformToChannel(n._associatedChannel,e),a=!1),this._activeChannel=e;let o=this._getTextureTarget(n);if(a&&this._bindTextureDirectly(o,n,i),n&&!n.isMultiview){if(n.isCube&&n._cachedCoordinatesMode!==t.coordinatesMode){n._cachedCoordinatesMode=t.coordinatesMode;let e=3!==t.coordinatesMode&&5!==t.coordinatesMode?1:0;t.wrapU=e,t.wrapV=e}n._cachedWrapU!==t.wrapU&&(n._cachedWrapU=t.wrapU,this._setTextureParameterInteger(o,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t.wrapU),n)),n._cachedWrapV!==t.wrapV&&(n._cachedWrapV=t.wrapV,this._setTextureParameterInteger(o,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(t.wrapV),n)),n.is3D&&n._cachedWrapR!==t.wrapR&&(n._cachedWrapR=t.wrapR,this._setTextureParameterInteger(o,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(t.wrapR),n)),this._setAnisotropicLevel(o,n,t.anisotropicFilteringLevel)}return!0}setTextureArray(e,t,i,r){if(void 0!==e&&t){this._textureUnits&&this._textureUnits.length===i.length||(this._textureUnits=new Int32Array(i.length));for(let t=0;t=this._caps.maxVertexAttribs)&&this._vertexAttribArraysEnabled[e]&&this.disableAttributeByIndex(e)}releaseEffects(){for(let e in this._compiledEffects){let t=this._compiledEffects[e].getPipelineContext();this._deletePipelineContext(t)}this._compiledEffects={}}dispose(){var e,t;for(let t of(this._isDisposed=!0,this.stopRenderLoop(),this.onBeforeTextureInitObservable&&this.onBeforeTextureInitObservable.clear(),this._emptyTexture&&(this._releaseTexture(this._emptyTexture),this._emptyTexture=null),this._emptyCubeTexture&&(this._releaseTexture(this._emptyCubeTexture),this._emptyCubeTexture=null),this._dummyFramebuffer&&this._gl.deleteFramebuffer(this._dummyFramebuffer),this.releaseEffects(),null===(e=this.releaseComputeEffects)||void 0===e||e.call(this),this.unbindAllAttributes(),this._boundUniforms={},this._workingCanvas=null,this._workingContext=null,this._currentBufferPointers.length=0,this._renderingCanvas=null,this._currentProgram=null,this._boundRenderFunction=null,rN.ResetCache(),this._activeRequests))t.abort();this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this._creationOptions.loseContextOnDispose&&(null===(t=this._gl.getExtension("WEBGL_lose_context"))||void 0===t||t.loseContext())}attachContextLostEvent(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextlost",e,!1)}attachContextRestoredEvent(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextrestored",e,!1)}getError(){return this._gl.getError()}_canRenderToFloatFramebuffer(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(1)}_canRenderToHalfFloatFramebuffer(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(2)}_canRenderToFramebuffer(e){let t=this._gl;for(;t.getError()!==t.NO_ERROR;);let i=!0,r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(e),1,1,0,t.RGBA,this._getWebGLTextureType(e),null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0);let n=t.checkFramebufferStatus(t.FRAMEBUFFER);if((i=(i=i&&n===t.FRAMEBUFFER_COMPLETE)&&t.getError()===t.NO_ERROR)&&(t.clear(t.COLOR_BUFFER_BIT),i=i&&t.getError()===t.NO_ERROR),i){t.bindFramebuffer(t.FRAMEBUFFER,null);let e=t.RGBA,r=t.UNSIGNED_BYTE,s=new Uint8Array(4);t.readPixels(0,0,1,1,e,r,s),i=i&&t.getError()===t.NO_ERROR}for(t.deleteTexture(r),t.deleteFramebuffer(s),t.bindFramebuffer(t.FRAMEBUFFER,null);!i&&t.getError()!==t.NO_ERROR;);return i}_getWebGLTextureType(e){if(1===this._webGLVersion){switch(e){case 1:return this._gl.FLOAT;case 2:return this._gl.HALF_FLOAT_OES;case 0:break;case 8:return this._gl.UNSIGNED_SHORT_4_4_4_4;case 9:return this._gl.UNSIGNED_SHORT_5_5_5_1;case 10:return this._gl.UNSIGNED_SHORT_5_6_5}return this._gl.UNSIGNED_BYTE}switch(e){case 3:return this._gl.BYTE;case 0:break;case 4:return this._gl.SHORT;case 5:return this._gl.UNSIGNED_SHORT;case 6:return this._gl.INT;case 7:return this._gl.UNSIGNED_INT;case 1:return this._gl.FLOAT;case 2:return this._gl.HALF_FLOAT;case 8:return this._gl.UNSIGNED_SHORT_4_4_4_4;case 9:return this._gl.UNSIGNED_SHORT_5_5_5_1;case 10:return this._gl.UNSIGNED_SHORT_5_6_5;case 11:return this._gl.UNSIGNED_INT_2_10_10_10_REV;case 12:return this._gl.UNSIGNED_INT_24_8;case 13:return this._gl.UNSIGNED_INT_10F_11F_11F_REV;case 14:return this._gl.UNSIGNED_INT_5_9_9_9_REV;case 15:return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV}return this._gl.UNSIGNED_BYTE}_getInternalFormat(e,t=!1){let i=t?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA;switch(e){case 0:i=this._gl.ALPHA;break;case 1:i=this._gl.LUMINANCE;break;case 2:i=this._gl.LUMINANCE_ALPHA;break;case 6:i=this._gl.RED;break;case 7:i=this._gl.RG;break;case 4:i=t?this._glSRGBExtensionValues.SRGB:this._gl.RGB;break;case 5:i=t?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA}if(this._webGLVersion>1)switch(e){case 8:i=this._gl.RED_INTEGER;break;case 9:i=this._gl.RG_INTEGER;break;case 10:i=this._gl.RGB_INTEGER;break;case 11:i=this._gl.RGBA_INTEGER}return i}_getRGBABufferInternalSizedFormat(e,t,i=!1){if(1===this._webGLVersion){if(void 0!==t)switch(t){case 0:return this._gl.ALPHA;case 1:return this._gl.LUMINANCE;case 2:return this._gl.LUMINANCE_ALPHA;case 4:return i?this._glSRGBExtensionValues.SRGB:this._gl.RGB}return this._gl.RGBA}switch(e){case 3:switch(t){case 6:return this._gl.R8_SNORM;case 7:return this._gl.RG8_SNORM;case 4:return this._gl.RGB8_SNORM;case 8:return this._gl.R8I;case 9:return this._gl.RG8I;case 10:return this._gl.RGB8I;case 11:return this._gl.RGBA8I;default:return this._gl.RGBA8_SNORM}case 0:switch(t){case 6:return this._gl.R8;case 7:return this._gl.RG8;case 4:return i?this._glSRGBExtensionValues.SRGB8:this._gl.RGB8;case 5:return i?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA8;case 8:return this._gl.R8UI;case 9:return this._gl.RG8UI;case 10:return this._gl.RGB8UI;case 11:return this._gl.RGBA8UI;case 0:return this._gl.ALPHA;case 1:return this._gl.LUMINANCE;case 2:return this._gl.LUMINANCE_ALPHA;default:return this._gl.RGBA8}case 4:switch(t){case 8:return this._gl.R16I;case 9:return this._gl.RG16I;case 10:return this._gl.RGB16I;default:return this._gl.RGBA16I}case 5:switch(t){case 8:return this._gl.R16UI;case 9:return this._gl.RG16UI;case 10:return this._gl.RGB16UI;default:return this._gl.RGBA16UI}case 6:switch(t){case 8:return this._gl.R32I;case 9:return this._gl.RG32I;case 10:return this._gl.RGB32I;default:return this._gl.RGBA32I}case 7:switch(t){case 8:return this._gl.R32UI;case 9:return this._gl.RG32UI;case 10:return this._gl.RGB32UI;default:return this._gl.RGBA32UI}case 1:switch(t){case 6:return this._gl.R32F;case 7:return this._gl.RG32F;case 4:return this._gl.RGB32F;default:return this._gl.RGBA32F}case 2:switch(t){case 6:return this._gl.R16F;case 7:return this._gl.RG16F;case 4:return this._gl.RGB16F;default:return this._gl.RGBA16F}case 10:return this._gl.RGB565;case 13:return this._gl.R11F_G11F_B10F;case 14:return this._gl.RGB9_E5;case 8:return this._gl.RGBA4;case 9:return this._gl.RGB5_A1;case 11:switch(t){case 5:default:return this._gl.RGB10_A2;case 11:return this._gl.RGB10_A2UI}}return i?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA8}_loadFile(e,t,i,r,s,n){let a=r$._FileToolsLoadFile(e,t,i,r,s,n);return this._activeRequests.push(a),a.onCompleteObservable.add(e=>{this._activeRequests.splice(this._activeRequests.indexOf(e),1)}),a}static _FileToolsLoadFile(e,t,i,r,s,n){throw iL("FileTools")}readPixels(e,t,i,r,s=!0,n=!0){let a=s?this._gl.RGBA:this._gl.RGB,o=new Uint8Array(r*i*(s?4:3));return n&&this.flushFramebuffer(),this._gl.readPixels(e,t,i,r,a,this._gl.UNSIGNED_BYTE,o),Promise.resolve(o)}static get IsSupportedAsync(){return Promise.resolve(this.isSupported())}static get IsSupported(){return this.isSupported()}static isSupported(){if(null!==this._HasMajorPerformanceCaveat)return!this._HasMajorPerformanceCaveat;if(null===this._IsSupported)try{let e=this._CreateCanvas(1,1),t=e.getContext("webgl")||e.getContext("experimental-webgl");this._IsSupported=null!=t&&!!window.WebGLRenderingContext}catch(e){this._IsSupported=!1}return this._IsSupported}static get HasMajorPerformanceCaveat(){if(null===this._HasMajorPerformanceCaveat)try{let e=this._CreateCanvas(1,1),t=e.getContext("webgl",{failIfMajorPerformanceCaveat:!0})||e.getContext("experimental-webgl",{failIfMajorPerformanceCaveat:!0});this._HasMajorPerformanceCaveat=!t}catch(e){this._HasMajorPerformanceCaveat=!1}return this._HasMajorPerformanceCaveat}static CeilingPOT(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e}static FloorPOT(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,(e|=e>>16)-(e>>1)}static NearestPOT(e){let t=r$.CeilingPOT(e),i=r$.FloorPOT(e);return t-e>e-i?i:t}static GetExponentOfTwo(e,t,i=2){let r;switch(i){case 1:r=r$.FloorPOT(e);break;case 2:r=r$.NearestPOT(e);break;default:r=r$.CeilingPOT(e)}return Math.min(r,t)}static QueueNewFrame(e,t){return"function"==typeof requestAnimationFrame?requestAnimationFrame(e):setTimeout(e,16)}getHostDocument(){return this._renderingCanvas&&this._renderingCanvas.ownerDocument?this._renderingCanvas.ownerDocument:rs()?document:null}}r$._TempClearColorUint32=new Uint32Array(4),r$._TempClearColorInt32=new Int32Array(4),r$.ExceptionList=[{key:"Chrome/63.0",capture:"63\\.0\\.3239\\.(\\d+)",captureConstraint:108,targets:["uniformBuffer"]},{key:"Firefox/58",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Firefox/59",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Chrome/72.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/73.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/74.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/71",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/72",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Chrome/12\\d\\..+?Mobile",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:".*AppleWebKit.*(15.4).*Safari",capture:null,captureConstraint:null,targets:["antialias","maxMSAASamples"]},{key:".*(15.4).*AppleWebKit.*Safari",capture:null,captureConstraint:null,targets:["antialias","maxMSAASamples"]}],r$._TextureLoaders=[],r$.CollisionsEpsilon=.001,r$._IsSupported=null,r$._HasMajorPerformanceCaveat=null;class rq{static SetImmediate(e){setTimeout(e,1)}}let rQ=new RegExp(/^data:([^,]+\/[^,]+)?;base64,/i);class rZ extends rc{constructor(e,t){super(e,ru.LoadFileError),this.name="LoadFileError",rh._setPrototypeOf(this,rZ.prototype),t instanceof i2?this.request=t:this.file=t}}class rJ extends rc{constructor(e,t){super(e,ru.RequestFileError),this.request=t,this.name="RequestFileError",rh._setPrototypeOf(this,rJ.prototype)}}class r0 extends rc{constructor(e,t){super(e,ru.ReadFileError),this.file=t,this.name="ReadFileError",rh._setPrototypeOf(this,r0.prototype)}}let r1={DefaultRetryStrategy:rl.ExponentialBackoff(),BaseUrl:"",CorsBehavior:"anonymous",PreprocessUrl:e=>e,ScriptBaseUrl:"",ScriptPreprocessUrl:e=>e},r2=e=>e=e.replace(/#/gm,"%23"),r3=(e,t)=>{if((!e||0!==e.indexOf("data:"))&&r1.CorsBehavior){if("string"==typeof r1.CorsBehavior||r1.CorsBehavior instanceof String)t.crossOrigin=r1.CorsBehavior;else{let i=r1.CorsBehavior(e);i&&(t.crossOrigin=i)}}},r4=(e,t,i,r,s="",n)=>{let a;let o=t2.LastCreatedEngine;if("undefined"==typeof HTMLImageElement&&!(null==o?void 0:o._features.forceBitmapOverHTMLImageElement))return i("LoadImage is only supported in web or BabylonNative environments."),null;let l=!1;e instanceof ArrayBuffer||ArrayBuffer.isView(e)?"undefined"!=typeof Blob&&"undefined"!=typeof URL?(a=URL.createObjectURL(new Blob([e],{type:s})),l=!0):a=`data:${s};base64,`+rd(e):e instanceof Blob?(a=URL.createObjectURL(e),l=!0):(a=r2(e),a=r1.PreprocessUrl(e));let h=t=>{if(i){let r=a||e.toString();i(`Error while trying to load image: ${0===r.indexOf("http")||r.length<=128?r:r.slice(0,128)+"..."}`,t)}};if(null==o?void 0:o._features.forceBitmapOverHTMLImageElement)return r6(a,r=>{o.createImageBitmap(new Blob([r],{type:s}),Object.assign({premultiplyAlpha:"none"},n)).then(e=>{t(e),l&&URL.revokeObjectURL(a)}).catch(t=>{i&&i("Error while trying to load image: "+e,t)})},void 0,r||void 0,!0,(e,t)=>{h(t)}),null;let u=new Image;r3(a,u);let c=[],d=()=>{c.forEach(e=>{e.target.removeEventListener(e.name,e.handler)}),c.length=0};c.push({target:u,name:"load",handler:()=>{d(),t(u),l&&u.src&&URL.revokeObjectURL(u.src)}}),c.push({target:u,name:"error",handler:e=>{d(),h(e),l&&u.src&&URL.revokeObjectURL(u.src)}}),c.push({target:document,name:"securitypolicyviolation",handler:e=>{if(e.blockedURI!==u.src)return;d();let t=Error(`CSP violation of policy ${e.effectiveDirective} ${e.blockedURI}. Current policy is ${e.originalPolicy}`);t2.UseFallbackTexture=!1,h(t),l&&u.src&&URL.revokeObjectURL(u.src),u.src=""}}),c.forEach(e=>{e.target.addEventListener(e.name,e.handler)});let p="blob:"===a.substring(0,5),_="data:"===a.substring(0,5),f=()=>{p||_||!i2.IsCustomRequestAvailable?u.src=a:r6(a,(e,t,i)=>{let r=!s&&i?i:s,n=new Blob([e],{type:r}),a=URL.createObjectURL(n);l=!0,u.src=a},void 0,r||void 0,!0,(e,t)=>{h(t)})};if(!p&&!_&&r&&r.enableTexturesOffline)r.open(()=>{r&&r.loadImage(a,u)},f);else{if(-1!==a.indexOf("file:")){let e=decodeURIComponent(a.substring(5).toLowerCase());if(ro.FilesToLoad[e]&&"undefined"!=typeof URL){try{let t;try{t=URL.createObjectURL(ro.FilesToLoad[e])}catch(i){t=URL.createObjectURL(ro.FilesToLoad[e])}u.src=t,l=!0}catch(e){u.src=""}return u}}f()}return u},r5=(e,t,i,r,s)=>{let n=new FileReader,a={onCompleteObservable:new tj,abort:()=>n.abort()};return n.onloadend=()=>a.onCompleteObservable.notifyObservers(a),s&&(n.onerror=()=>{s(new r0(`Unable to read ${e.name}`,e))}),n.onload=e=>{t(e.target.result)},i&&(n.onprogress=i),r?n.readAsArrayBuffer(e):n.readAsText(e),a},r6=(e,t,i,r,s,n,a)=>{if(e.name)return r5(e,t,i,s,n?e=>{n(void 0,e)}:void 0);if(-1!==e.indexOf("file:")){let r=decodeURIComponent(e.substring(5).toLowerCase());0===r.indexOf("./")&&(r=r.substring(2));let a=ro.FilesToLoad[r];if(a)return r5(a,t,i,s,n?e=>n(void 0,new rZ(e.message,e.file)):void 0)}let{match:o,type:l}=r9(e);if(o){let i={onCompleteObservable:new tj,abort:()=>()=>{}};try{let i=s?se(e):st(e);t(i,void 0,l)}catch(e){n?n(void 0,e):ig.Error(e.message||"Failed to parse the Data URL")}return rq.SetImmediate(()=>{i.onCompleteObservable.notifyObservers(i)}),i}return r8(e,(e,i)=>{t(e,null==i?void 0:i.responseURL,null==i?void 0:i.getResponseHeader("content-type"))},i,r,s,n?e=>{n(e.request,new rZ(e.message,e.request))}:void 0,a)},r8=(e,t,i,r,s,n,a)=>{e=r2(e),e=r1.PreprocessUrl(e);let o=r1.BaseUrl+e,l=!1,h={onCompleteObservable:new tj,abort:()=>l=!0},u=()=>{let e,r=new i2,u=null,c=()=>{r&&(i&&r.removeEventListener("progress",i),e&&r.removeEventListener("readystatechange",e),r.removeEventListener("loadend",d))},d=()=>{c(),h.onCompleteObservable.notifyObservers(h),h.onCompleteObservable.clear(),i=void 0,e=null,d=null,n=void 0,a=void 0,t=void 0};h.abort=()=>{l=!0,d&&d(),r&&r.readyState!==(XMLHttpRequest.DONE||4)&&r.abort(),null!==u&&(clearTimeout(u),u=null),r=null};let p=e=>{let t=e.message||"Unknown error";n&&r?n(new rJ(t,r)):ig.Error(t)},_=h=>{if(r){if(r.open("GET",o),a)try{a(r)}catch(e){p(e);return}s&&(r.responseType="arraybuffer"),i&&r.addEventListener("progress",i),d&&r.addEventListener("loadend",d),e=()=>{if(!l&&r&&r.readyState===(XMLHttpRequest.DONE||4)){if(e&&r.removeEventListener("readystatechange",e),r.status>=200&&r.status<300||0===r.status){try{t&&t(s?r.response:r.responseText,r)}catch(e){p(e)}return}let i=r1.DefaultRetryStrategy;if(i){let e=i(o,r,h);if(-1!==e){c(),r=new i2,u=setTimeout(()=>_(h+1),e);return}}let a=new rJ("Error status: "+r.status+" "+r.statusText+" - Unable to load "+o,r);n&&n(a)}},r.addEventListener("readystatechange",e),r.send()}};_(0)};if(r&&r.enableSceneOffline){let a=e=>{e&&e.status>400?n&&n(e):u()};r.open(()=>{r&&r.loadFile(r1.BaseUrl+e,e=>{!l&&t&&t(e),h.onCompleteObservable.notifyObservers(h)},i?e=>{!l&&i&&i(e)}:void 0,a,s)},a)}else u();return h},r7=e=>rQ.test(e),r9=e=>{let t=rQ.exec(e);return null===t||0===t.length?{match:!1,type:""}:{match:!0,type:t[0].replace("data:","").replace("base64,","")}};function se(e){return r_(e.split(",")[1])}let st=e=>rp(e.split(",")[1]);r$._FileToolsLoadImage=r4,r$._FileToolsLoadFile=r6,rD._FileToolsLoadFile=r6,((e,t,i,s,n,a,o,l,h,u)=>{Object.defineProperty(r={DecodeBase64UrlToBinary:e,DecodeBase64UrlToString:t,DefaultRetryStrategy:i.DefaultRetryStrategy,BaseUrl:i.BaseUrl,CorsBehavior:i.CorsBehavior,PreprocessUrl:i.PreprocessUrl,IsBase64DataUrl:s,IsFileURL:n,LoadFile:a,LoadImage:o,ReadFile:l,RequestFile:h,SetCorsBehavior:u},"DefaultRetryStrategy",{get:function(){return i.DefaultRetryStrategy},set:function(e){i.DefaultRetryStrategy=e}}),Object.defineProperty(r,"BaseUrl",{get:function(){return i.BaseUrl},set:function(e){i.BaseUrl=e}}),Object.defineProperty(r,"PreprocessUrl",{get:function(){return i.PreprocessUrl},set:function(e){i.PreprocessUrl=e}}),Object.defineProperty(r,"CorsBehavior",{get:function(){return i.CorsBehavior},set:function(e){i.CorsBehavior=e}})})(se,st,r1,r7,()=>"undefined"!=typeof location&&"file:"===location.protocol,r6,r4,r5,r8,r3);class si{static Instantiate(e){if(this.RegisteredExternalClasses&&this.RegisteredExternalClasses[e])return this.RegisteredExternalClasses[e];let t=t0[e];if(t)return t;ig.Warn(e+" not found, you may have missed an import.");let i=e.split("."),r=window||this;for(let e=0,t=i.length;e{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}si.RegisteredExternalClasses={};class ss{static get BaseUrl(){return r1.BaseUrl}static set BaseUrl(e){r1.BaseUrl=e}static IsAbsoluteUrl(e){return 0===e.indexOf("//")||!(-1===e.indexOf("://")||-1===e.indexOf(".")||-1===e.indexOf("/")||e.indexOf(":")>e.indexOf("/"))&&(e.indexOf("://"){r6(e,e=>{i(e)},void 0,void 0,t,(e,t)=>{r(t)})})}static GetBabylonScriptURL(e,t){if(!e)return"";if(ss.ScriptBaseUrl&&e.startsWith(ss._DefaultCdnUrl)){let t="/"===ss.ScriptBaseUrl[ss.ScriptBaseUrl.length-1]?ss.ScriptBaseUrl.substring(0,ss.ScriptBaseUrl.length-1):ss.ScriptBaseUrl;e=e.replace(ss._DefaultCdnUrl,t)}return e=ss.ScriptPreprocessUrl(e),t&&(e=ss.GetAbsoluteUrl(e)),e}static LoadBabylonScript(e,t,i,r){e=ss.GetBabylonScriptURL(e),ss.LoadScript(e,t,i)}static LoadBabylonScriptAsync(e){return e=ss.GetBabylonScriptURL(e),ss.LoadScriptAsync(e)}static LoadScript(e,t,i,r){if("function"==typeof importScripts){try{importScripts(e),t()}catch(t){null==i||i(`Unable to load script '${e}' in worker`,t)}return}null==i||i(`Cannot load script '${e}' outside of a window or a worker`)}static LoadScriptAsync(e){return new Promise((t,i)=>{this.LoadScript(e,()=>{t()},(e,t)=>{i(t||Error(e))})})}static ReadFileAsDataURL(e,t,i){let r=new FileReader,s={onCompleteObservable:new tj,abort:()=>r.abort()};return r.onloadend=()=>{s.onCompleteObservable.notifyObservers(s)},r.onload=e=>{t(e.target.result)},r.onprogress=i,r.readAsDataURL(e),s}static ReadFile(e,t,i,r,s){return r5(e,t,i,r,s)}static FileAsURL(e){let t=new Blob([e]);return window.URL.createObjectURL(t)}static Format(e,t=2){return e.toFixed(t)}static DeepCopy(e,t,i,r){iP.DeepCopy(e,t,i,r)}static IsEmpty(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}static RegisterTopRootEvents(e,t){for(let i=0;i{let r=atob(this.toDataURL(t,i).split(",")[1]),s=r.length,n=new Uint8Array(s);for(let e=0;et(e)):e.toBlob(function(e){t(e)},i,r)}static DownloadBlob(e,t){if("download"in document.createElement("a")){if(!t){let e=new Date;t="screenshot_"+((e.getFullYear()+"-"+(e.getMonth()+1)).slice(2)+"-"+e.getDate()+"_"+e.getHours())+"-"+("0"+e.getMinutes()).slice(-2)+".png"}ss.Download(e,t)}else if(e&&"undefined"!=typeof URL){let t=URL.createObjectURL(e),i=window.open("");if(!i)return;let r=i.document.createElement("img");r.onload=function(){URL.revokeObjectURL(t)},r.src=t,i.document.body.appendChild(r)}}static EncodeScreenshotCanvasData(e,t,i="image/png",r,s){if("string"!=typeof r&&t){if(t){if(ss._IsOffScreenCanvas(e)){e.convertToBlob({type:i,quality:s}).then(e=>{let i=new FileReader;i.readAsDataURL(e),i.onloadend=()=>{t(i.result)}});return}t(e.toDataURL(i,s))}}else this.ToBlob(e,function(e){e&&ss.DownloadBlob(e,r),t&&t("")},i,s)}static Download(e,t){if("undefined"==typeof URL)return;let i=window.URL.createObjectURL(e),r=document.createElement("a");document.body.appendChild(r),r.style.display="none",r.href=i,r.download=t,r.addEventListener("click",()=>{r.parentElement&&r.parentElement.removeChild(r)}),r.click(),window.URL.revokeObjectURL(i)}static BackCompatCameraNoPreventDefault(e){return"boolean"==typeof e[0]?e[0]:"boolean"==typeof e[1]&&e[1]}static CreateScreenshot(e,t,i,r,s="image/png",n=!1,a){throw iL("ScreenshotTools")}static CreateScreenshotAsync(e,t,i,r="image/png",s){throw iL("ScreenshotTools")}static CreateScreenshotUsingRenderTarget(e,t,i,r,s="image/png",n=1,a=!1,o,l=!1,h=!1,u=!0,c){throw iL("ScreenshotTools")}static CreateScreenshotUsingRenderTargetAsync(e,t,i,r="image/png",s=1,n=!1,a,o=!1,l=!1,h=!0,u){throw iL("ScreenshotTools")}static RandomId(){return sr()}static IsBase64(e){return r7(e)}static DecodeBase64(e){return se(e)}static get errorsCount(){return ig.errorsCount}static Log(e){ig.Log(e)}static Warn(e){ig.Warn(e)}static Error(e){ig.Error(e)}static get LogCache(){return ig.LogCache}static ClearLogCache(){ig.ClearLogCache()}static set LogLevels(e){ig.LogLevels=e}static set PerformanceLogLevel(e){if((e&ss.PerformanceUserMarkLogLevel)===ss.PerformanceUserMarkLogLevel){ss.StartPerformanceCounter=ss._StartUserMark,ss.EndPerformanceCounter=ss._EndUserMark;return}if((e&ss.PerformanceConsoleLogLevel)===ss.PerformanceConsoleLogLevel){ss.StartPerformanceCounter=ss._StartPerformanceConsole,ss.EndPerformanceCounter=ss._EndPerformanceConsole;return}ss.StartPerformanceCounter=ss._StartPerformanceCounterDisabled,ss.EndPerformanceCounter=ss._EndPerformanceCounterDisabled}static _StartPerformanceCounterDisabled(e,t){}static _EndPerformanceCounterDisabled(e,t){}static _StartUserMark(e,t=!0){ss._Performance&&t&&ss._Performance.mark&&ss._Performance.mark(e+"-Begin")}static _EndUserMark(e,t=!0){t&&ss._Performance.mark&&(ss._Performance.mark(e+"-End"),ss._Performance.measure(e,e+"-Begin",e+"-End"))}static _StartPerformanceConsole(e,t=!0){t&&(ss._StartUserMark(e,t),console.time&&console.time(e))}static _EndPerformanceConsole(e,t=!0){t&&(ss._EndUserMark(e,t),console.timeEnd(e))}static get Now(){return ra.Now}static GetClassName(e,t=!1){let i=null;return!t&&e.getClassName?i=e.getClassName():(e instanceof Object&&(i=(t?e:Object.getPrototypeOf(e)).constructor.__bjsclassName__),i||(i=typeof e)),i}static First(e,t){for(let i of e)if(t(i))return i;return null}static getFullClassName(e,t=!1){let i=null,r=null;if(!t&&e.getClassName)i=e.getClassName();else{if(e instanceof Object){let s=t?e:Object.getPrototypeOf(e);i=s.constructor.__bjsclassName__,r=s.constructor.__bjsmoduleName__}i||(i=typeof e)}return i?(null!=r?r+".":"")+i:null}static DelayAsync(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}static IsSafari(){return!!rr()&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}}ss.UseCustomRequestHeaders=!1,ss.CustomRequestHeaders=i2.CustomRequestHeaders,ss.GetDOMTextContent=rn,ss._DefaultCdnUrl="https://cdn.babylonjs.com",ss.GetAbsoluteUrl="object"==typeof document?e=>{let t=document.createElement("a");return t.href=e,t.href}:"function"==typeof URL&&"object"==typeof location?e=>new URL(e,location.origin).href:()=>{throw Error("Unable to get absolute URL. Override BABYLON.Tools.GetAbsoluteUrl to a custom implementation for the current context.")},ss.NoneLogLevel=ig.NoneLogLevel,ss.MessageLogLevel=ig.MessageLogLevel,ss.WarningLogLevel=ig.WarningLogLevel,ss.ErrorLogLevel=ig.ErrorLogLevel,ss.AllLogLevel=ig.AllLogLevel,ss.IsWindowObjectExist=function(){return!1},ss.PerformanceNoneLogLevel=0,ss.PerformanceUserMarkLogLevel=1,ss.PerformanceConsoleLogLevel=2,ss.StartPerformanceCounter=ss._StartPerformanceCounterDisabled,ss.EndPerformanceCounter=ss._EndPerformanceCounterDisabled;class sn{constructor(e,t,i,r=0){this.iterations=e,this.index=r-1,this._done=!1,this._fn=t,this._successCallback=i}executeNext(){this._done||(this.index+1{s&&s()?r.breakLoop():setTimeout(()=>{for(let n=0;n=e)break;if(i(a),s&&s()){r.breakLoop();break}}r.executeNext()},n)},r)}}t2.FallbackTexture="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z";class sa{constructor(e){this.length=0,this.data=Array(e),this._id=sa._GlobalId++}push(e){this.data[this.length++]=e,this.length>this.data.length&&(this.data.length*=2)}forEach(e){for(let t=0;tthis.data.length&&(this.data.length=(this.length+e.length)*2);for(let t=0;t=this.length?-1:t}contains(e){return -1!==this.indexOf(e)}}sa._GlobalId=0;class so extends sa{constructor(){super(...arguments),this._duplicateId=0}push(e){super.push(e),e.__smartArrayFlags||(e.__smartArrayFlags={}),e.__smartArrayFlags[this._id]=this._duplicateId}pushNoDuplicate(e){return(!e.__smartArrayFlags||e.__smartArrayFlags[this._id]!==this._duplicateId)&&(this.push(e),!0)}reset(){super.reset(),this._duplicateId++}concatWithNoDuplicate(e){if(0!==e.length){this.length+e.length>this.data.length&&(this.data.length=(this.length+e.length)*2);for(let t=0;tthis.add(e,t))}get(e){let t=this._data[e];if(void 0!==t)return t}getOrAddWithFactory(e,t){let i=this.get(e);return void 0!==i||(i=t(e))&&this.add(e,i),i}getOrAdd(e,t){let i=this.get(e);return void 0!==i?i:(this.add(e,t),t)}contains(e){return void 0!==this._data[e]}add(e,t){return void 0===this._data[e]&&(this._data[e]=t,++this._count,!0)}set(e,t){return void 0!==this._data[e]&&(this._data[e]=t,!0)}getAndRemove(e){let t=this.get(e);return void 0!==t?(delete this._data[e],--this._count,t):null}remove(e){return!!this.contains(e)&&(delete this._data[e],--this._count,!0)}clear(){this._data={},this._count=0}get count(){return this._count}forEach(e){for(let t in this._data){let i=this._data[t];e(t,i)}}first(e){for(let t in this._data){let i=this._data[t],r=e(t,i);if(r)return r}return null}}class sh{constructor(e){if(this._keys=[],this._isDirty=!0,this._areLightsDirty=!0,this._areLightsDisposed=!1,this._areAttributesDirty=!0,this._areTexturesDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._arePrePassDirty=!0,this._areImageProcessingDirty=!0,this._normals=!1,this._uvs=!1,this._needNormals=!1,this._needUVs=!1,this._externalProperties=e,e)for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this._setDefaultValue(t)}get isDirty(){return this._isDirty}markAsProcessed(){this._isDirty=!1,this._areAttributesDirty=!1,this._areTexturesDirty=!1,this._areFresnelDirty=!1,this._areLightsDirty=!1,this._areLightsDisposed=!1,this._areMiscDirty=!1,this._arePrePassDirty=!1,this._areImageProcessingDirty=!1}markAsUnprocessed(){this._isDirty=!0}markAllAsDirty(){this._areTexturesDirty=!0,this._areAttributesDirty=!0,this._areLightsDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._arePrePassDirty=!1,this._areImageProcessingDirty=!0,this._isDirty=!0}markAsImageProcessingDirty(){this._areImageProcessingDirty=!0,this._isDirty=!0}markAsLightDirty(e=!1){this._areLightsDirty=!0,this._areLightsDisposed=this._areLightsDisposed||e,this._isDirty=!0}markAsAttributesDirty(){this._areAttributesDirty=!0,this._isDirty=!0}markAsTexturesDirty(){this._areTexturesDirty=!0,this._isDirty=!0}markAsFresnelDirty(){this._areFresnelDirty=!0,this._isDirty=!0}markAsMiscDirty(){this._areMiscDirty=!0,this._isDirty=!0}markAsPrePassDirty(){this._arePrePassDirty=!0,this._isDirty=!0}rebuild(){for(let e of(this._keys.length=0,Object.keys(this)))"_"!==e[0]&&this._keys.push(e);if(this._externalProperties)for(let e in this._externalProperties)-1===this._keys.indexOf(e)&&this._keys.push(e)}isEqual(e){if(this._keys.length!==e._keys.length)return!1;for(let t=0;tthis._setDefaultValue(e))}_setDefaultValue(e){var t,i,r,s,n;let a=null!==(r=null===(i=null===(t=this._externalProperties)||void 0===t?void 0:t[e])||void 0===i?void 0:i.type)&&void 0!==r?r:typeof this[e],o=null===(n=null===(s=this._externalProperties)||void 0===s?void 0:s[e])||void 0===n?void 0:n.default;switch(a){case"number":this[e]=null!=o?o:0;break;case"string":this[e]=null!=o?o:"";break;default:this[e]=null!=o&&o}}toString(){let e="";for(let t=0;tnew su,this)}serialize(){return i$.Serialize(this)}static Parse(e){return i$.Parse(()=>new su,e,null,null)}}iZ([iW()],su.prototype,"_globalHue",void 0),iZ([iW()],su.prototype,"_globalDensity",void 0),iZ([iW()],su.prototype,"_globalSaturation",void 0),iZ([iW()],su.prototype,"_globalExposure",void 0),iZ([iW()],su.prototype,"_highlightsHue",void 0),iZ([iW()],su.prototype,"_highlightsDensity",void 0),iZ([iW()],su.prototype,"_highlightsSaturation",void 0),iZ([iW()],su.prototype,"_highlightsExposure",void 0),iZ([iW()],su.prototype,"_midtonesHue",void 0),iZ([iW()],su.prototype,"_midtonesDensity",void 0),iZ([iW()],su.prototype,"_midtonesSaturation",void 0),iZ([iW()],su.prototype,"_midtonesExposure",void 0),i$._ColorCurvesParser=su.Parse;class sc extends sh{constructor(){super(),this.IMAGEPROCESSING=!1,this.VIGNETTE=!1,this.VIGNETTEBLENDMODEMULTIPLY=!1,this.VIGNETTEBLENDMODEOPAQUE=!1,this.TONEMAPPING=!1,this.TONEMAPPING_ACES=!1,this.CONTRAST=!1,this.COLORCURVES=!1,this.COLORGRADING=!1,this.COLORGRADING3D=!1,this.SAMPLER3DGREENDEPTH=!1,this.SAMPLER3DBGRMAP=!1,this.DITHER=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.EXPOSURE=!1,this.SKIPFINALCOLORCLAMP=!1,this.rebuild()}}class sd{constructor(){this.colorCurves=new su,this._colorCurvesEnabled=!1,this._colorGradingEnabled=!1,this._colorGradingWithGreenDepth=!0,this._colorGradingBGR=!0,this._exposure=1,this._toneMappingEnabled=!1,this._toneMappingType=sd.TONEMAPPING_STANDARD,this._contrast=1,this.vignetteStretch=0,this.vignetteCenterX=0,this.vignetteCenterY=0,this.vignetteWeight=1.5,this.vignetteColor=new il(0,0,0,0),this.vignetteCameraFov=.5,this._vignetteBlendMode=sd.VIGNETTEMODE_MULTIPLY,this._vignetteEnabled=!1,this._ditheringEnabled=!1,this._ditheringIntensity=1/255,this._skipFinalColorClamp=!1,this._applyByPostProcess=!1,this._isEnabled=!0,this.onUpdateParameters=new tj}get colorCurvesEnabled(){return this._colorCurvesEnabled}set colorCurvesEnabled(e){this._colorCurvesEnabled!==e&&(this._colorCurvesEnabled=e,this._updateParameters())}get colorGradingTexture(){return this._colorGradingTexture}set colorGradingTexture(e){this._colorGradingTexture!==e&&(this._colorGradingTexture=e,this._updateParameters())}get colorGradingEnabled(){return this._colorGradingEnabled}set colorGradingEnabled(e){this._colorGradingEnabled!==e&&(this._colorGradingEnabled=e,this._updateParameters())}get colorGradingWithGreenDepth(){return this._colorGradingWithGreenDepth}set colorGradingWithGreenDepth(e){this._colorGradingWithGreenDepth!==e&&(this._colorGradingWithGreenDepth=e,this._updateParameters())}get colorGradingBGR(){return this._colorGradingBGR}set colorGradingBGR(e){this._colorGradingBGR!==e&&(this._colorGradingBGR=e,this._updateParameters())}get exposure(){return this._exposure}set exposure(e){this._exposure!==e&&(this._exposure=e,this._updateParameters())}get toneMappingEnabled(){return this._toneMappingEnabled}set toneMappingEnabled(e){this._toneMappingEnabled!==e&&(this._toneMappingEnabled=e,this._updateParameters())}get toneMappingType(){return this._toneMappingType}set toneMappingType(e){this._toneMappingType!==e&&(this._toneMappingType=e,this._updateParameters())}get contrast(){return this._contrast}set contrast(e){this._contrast!==e&&(this._contrast=e,this._updateParameters())}get vignetteCentreY(){return this.vignetteCenterY}set vignetteCentreY(e){this.vignetteCenterY=e}get vignetteCentreX(){return this.vignetteCenterX}set vignetteCentreX(e){this.vignetteCenterX=e}get vignetteBlendMode(){return this._vignetteBlendMode}set vignetteBlendMode(e){this._vignetteBlendMode!==e&&(this._vignetteBlendMode=e,this._updateParameters())}get vignetteEnabled(){return this._vignetteEnabled}set vignetteEnabled(e){this._vignetteEnabled!==e&&(this._vignetteEnabled=e,this._updateParameters())}get ditheringEnabled(){return this._ditheringEnabled}set ditheringEnabled(e){this._ditheringEnabled!==e&&(this._ditheringEnabled=e,this._updateParameters())}get ditheringIntensity(){return this._ditheringIntensity}set ditheringIntensity(e){this._ditheringIntensity!==e&&(this._ditheringIntensity=e,this._updateParameters())}get skipFinalColorClamp(){return this._skipFinalColorClamp}set skipFinalColorClamp(e){this._skipFinalColorClamp!==e&&(this._skipFinalColorClamp=e,this._updateParameters())}get applyByPostProcess(){return this._applyByPostProcess}set applyByPostProcess(e){this._applyByPostProcess!==e&&(this._applyByPostProcess=e,this._updateParameters())}get isEnabled(){return this._isEnabled}set isEnabled(e){this._isEnabled!==e&&(this._isEnabled=e,this._updateParameters())}_updateParameters(){this.onUpdateParameters.notifyObservers(this)}getClassName(){return"ImageProcessingConfiguration"}static PrepareUniforms(e,t){t.EXPOSURE&&e.push("exposureLinear"),t.CONTRAST&&e.push("contrast"),t.COLORGRADING&&e.push("colorTransformSettings"),(t.VIGNETTE||t.DITHER)&&e.push("vInverseScreenSize"),t.VIGNETTE&&(e.push("vignetteSettings1"),e.push("vignetteSettings2")),t.COLORCURVES&&su.PrepareUniforms(e),t.DITHER&&e.push("ditherIntensity")}static PrepareSamplers(e,t){t.COLORGRADING&&e.push("txColorTransform")}prepareDefines(e,t=!1){if(t!==this.applyByPostProcess||!this._isEnabled){e.VIGNETTE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.DITHER=!1,e.IMAGEPROCESSING=!1,e.SKIPFINALCOLORCLAMP=this.skipFinalColorClamp,e.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess&&this._isEnabled;return}(e.VIGNETTE=this.vignetteEnabled,e.VIGNETTEBLENDMODEMULTIPLY=this.vignetteBlendMode===sd._VIGNETTEMODE_MULTIPLY,e.VIGNETTEBLENDMODEOPAQUE=!e.VIGNETTEBLENDMODEMULTIPLY,e.TONEMAPPING=this.toneMappingEnabled,this._toneMappingType===sd.TONEMAPPING_ACES)?e.TONEMAPPING_ACES=!0:e.TONEMAPPING_ACES=!1,e.CONTRAST=1!==this.contrast,e.EXPOSURE=1!==this.exposure,e.COLORCURVES=this.colorCurvesEnabled&&!!this.colorCurves,e.COLORGRADING=this.colorGradingEnabled&&!!this.colorGradingTexture,e.COLORGRADING?e.COLORGRADING3D=this.colorGradingTexture.is3D:e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=this.colorGradingWithGreenDepth,e.SAMPLER3DBGRMAP=this.colorGradingBGR,e.DITHER=this._ditheringEnabled,e.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess,e.SKIPFINALCOLORCLAMP=this.skipFinalColorClamp,e.IMAGEPROCESSING=e.VIGNETTE||e.TONEMAPPING||e.CONTRAST||e.EXPOSURE||e.COLORCURVES||e.COLORGRADING||e.DITHER}isReady(){return!this.colorGradingEnabled||!this.colorGradingTexture||this.colorGradingTexture.isReady()}bind(e,t){if(this._colorCurvesEnabled&&this.colorCurves&&su.Bind(this.colorCurves,e),this._vignetteEnabled||this._ditheringEnabled){let i=1/e.getEngine().getRenderWidth(),r=1/e.getEngine().getRenderHeight();if(e.setFloat2("vInverseScreenSize",i,r),this._ditheringEnabled&&e.setFloat("ditherIntensity",.5*this._ditheringIntensity),this._vignetteEnabled){let s=null!=t?t:r/i,n=Math.tan(.5*this.vignetteCameraFov),a=n*s,o=Math.sqrt(a*n);a=ss.Mix(a,o,this.vignetteStretch),n=ss.Mix(n,o,this.vignetteStretch),e.setFloat4("vignetteSettings1",a,n,-a*this.vignetteCenterX,-n*this.vignetteCenterY);let l=-2*this.vignetteWeight;e.setFloat4("vignetteSettings2",this.vignetteColor.r,this.vignetteColor.g,this.vignetteColor.b,l)}}if(e.setFloat("exposureLinear",this.exposure),e.setFloat("contrast",this.contrast),this.colorGradingTexture){e.setTexture("txColorTransform",this.colorGradingTexture);let t=this.colorGradingTexture.getSize().height;e.setFloat4("colorTransformSettings",(t-1)/t,.5/t,t,this.colorGradingTexture.level)}}clone(){return i$.Clone(()=>new sd,this)}serialize(){return i$.Serialize(this)}static Parse(e){let t=i$.Parse(()=>new sd,e,null,null);return void 0!==e.vignetteCentreX&&(t.vignetteCenterX=e.vignetteCentreX),void 0!==e.vignetteCentreY&&(t.vignetteCenterY=e.vignetteCentreY),t}static get VIGNETTEMODE_MULTIPLY(){return this._VIGNETTEMODE_MULTIPLY}static get VIGNETTEMODE_OPAQUE(){return this._VIGNETTEMODE_OPAQUE}}sd.TONEMAPPING_STANDARD=0,sd.TONEMAPPING_ACES=1,sd._VIGNETTEMODE_MULTIPLY=0,sd._VIGNETTEMODE_OPAQUE=1,iZ([iG(7,void 0)],sd.prototype,"colorCurves",void 0),iZ([iW()],sd.prototype,"_colorCurvesEnabled",void 0),iZ([iH("colorGradingTexture")],sd.prototype,"_colorGradingTexture",void 0),iZ([iW()],sd.prototype,"_colorGradingEnabled",void 0),iZ([iW()],sd.prototype,"_colorGradingWithGreenDepth",void 0),iZ([iW()],sd.prototype,"_colorGradingBGR",void 0),iZ([iW()],sd.prototype,"_exposure",void 0),iZ([iW()],sd.prototype,"_toneMappingEnabled",void 0),iZ([iW()],sd.prototype,"_toneMappingType",void 0),iZ([iW()],sd.prototype,"_contrast",void 0),iZ([iW()],sd.prototype,"vignetteStretch",void 0),iZ([iW()],sd.prototype,"vignetteCenterX",void 0),iZ([iW()],sd.prototype,"vignetteCenterY",void 0),iZ([iW()],sd.prototype,"vignetteWeight",void 0),iZ([iG(8,void 0)],sd.prototype,"vignetteColor",void 0),iZ([iW()],sd.prototype,"vignetteCameraFov",void 0),iZ([iW()],sd.prototype,"_vignetteBlendMode",void 0),iZ([iW()],sd.prototype,"_vignetteEnabled",void 0),iZ([iW()],sd.prototype,"_ditheringEnabled",void 0),iZ([iW()],sd.prototype,"_ditheringIntensity",void 0),iZ([iW()],sd.prototype,"_skipFinalColorClamp",void 0),iZ([iW()],sd.prototype,"_applyByPostProcess",void 0),iZ([iW()],sd.prototype,"_isEnabled",void 0),i$._ImageProcessingConfigurationParser=sd.Parse,r$.prototype.createUniformBuffer=function(e,t){let i=this._gl.createBuffer();if(!i)throw Error("Unable to create uniform buffer");let r=new rW(i);return this.bindUniformBuffer(r),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.STATIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.STATIC_DRAW),this.bindUniformBuffer(null),r.references=1,r},r$.prototype.createDynamicUniformBuffer=function(e,t){let i=this._gl.createBuffer();if(!i)throw Error("Unable to create dynamic uniform buffer");let r=new rW(i);return this.bindUniformBuffer(r),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.DYNAMIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.DYNAMIC_DRAW),this.bindUniformBuffer(null),r.references=1,r},r$.prototype.updateUniformBuffer=function(e,t,i,r){this.bindUniformBuffer(e),void 0===i&&(i=0),void 0===r?t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,i,t):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,i,new Float32Array(t)):t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,t.subarray(i,i+r)):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,new Float32Array(t).subarray(i,i+r)),this.bindUniformBuffer(null)},r$.prototype.bindUniformBuffer=function(e){this._gl.bindBuffer(this._gl.UNIFORM_BUFFER,e?e.underlyingResource:null)},r$.prototype.bindUniformBufferBase=function(e,t,i){this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER,t,e?e.underlyingResource:null)},r$.prototype.bindUniformBlock=function(e,t,i){let r=e.program,s=this._gl.getUniformBlockIndex(r,t);4294967295!==s&&this._gl.uniformBlockBinding(r,s,i)};class sp{constructor(e,t,i,r,s=!1){this._valueCache={},this._engine=e,this._noUBO=!e.supportsUniformBuffers||s,this._dynamic=i,this._name=null!=r?r:"no-name",this._data=t||[],this._uniformLocations={},this._uniformSizes={},this._uniformArraySizes={},this._uniformLocationPointer=0,this._needSync=!1,this._engine._features.trackUbosInFrame&&(this._buffers=[],this._bufferIndex=-1,this._createBufferOnWrite=!1,this._currentFrameId=0),this._noUBO?(this.updateMatrix3x3=this._updateMatrix3x3ForEffect,this.updateMatrix2x2=this._updateMatrix2x2ForEffect,this.updateFloat=this._updateFloatForEffect,this.updateFloat2=this._updateFloat2ForEffect,this.updateFloat3=this._updateFloat3ForEffect,this.updateFloat4=this._updateFloat4ForEffect,this.updateFloatArray=this._updateFloatArrayForEffect,this.updateArray=this._updateArrayForEffect,this.updateIntArray=this._updateIntArrayForEffect,this.updateUIntArray=this._updateUIntArrayForEffect,this.updateMatrix=this._updateMatrixForEffect,this.updateMatrices=this._updateMatricesForEffect,this.updateVector3=this._updateVector3ForEffect,this.updateVector4=this._updateVector4ForEffect,this.updateColor3=this._updateColor3ForEffect,this.updateColor4=this._updateColor4ForEffect,this.updateDirectColor4=this._updateDirectColor4ForEffect,this.updateInt=this._updateIntForEffect,this.updateInt2=this._updateInt2ForEffect,this.updateInt3=this._updateInt3ForEffect,this.updateInt4=this._updateInt4ForEffect,this.updateUInt=this._updateUIntForEffect,this.updateUInt2=this._updateUInt2ForEffect,this.updateUInt3=this._updateUInt3ForEffect,this.updateUInt4=this._updateUInt4ForEffect):(this._engine._uniformBuffers.push(this),this.updateMatrix3x3=this._updateMatrix3x3ForUniform,this.updateMatrix2x2=this._updateMatrix2x2ForUniform,this.updateFloat=this._updateFloatForUniform,this.updateFloat2=this._updateFloat2ForUniform,this.updateFloat3=this._updateFloat3ForUniform,this.updateFloat4=this._updateFloat4ForUniform,this.updateFloatArray=this._updateFloatArrayForUniform,this.updateArray=this._updateArrayForUniform,this.updateIntArray=this._updateIntArrayForUniform,this.updateUIntArray=this._updateUIntArrayForUniform,this.updateMatrix=this._updateMatrixForUniform,this.updateMatrices=this._updateMatricesForUniform,this.updateVector3=this._updateVector3ForUniform,this.updateVector4=this._updateVector4ForUniform,this.updateColor3=this._updateColor3ForUniform,this.updateColor4=this._updateColor4ForUniform,this.updateDirectColor4=this._updateDirectColor4ForUniform,this.updateInt=this._updateIntForUniform,this.updateInt2=this._updateInt2ForUniform,this.updateInt3=this._updateInt3ForUniform,this.updateInt4=this._updateInt4ForUniform,this.updateUInt=this._updateUIntForUniform,this.updateUInt2=this._updateUInt2ForUniform,this.updateUInt3=this._updateUInt3ForUniform,this.updateUInt4=this._updateUInt4ForUniform)}get useUbo(){return!this._noUBO}get isSync(){return!this._needSync}isDynamic(){return void 0!==this._dynamic}getData(){return this._bufferData}getBuffer(){return this._buffer}_fillAlignment(e){let t;if(t=e<=2?e:4,this._uniformLocationPointer%t!=0){let e=this._uniformLocationPointer;this._uniformLocationPointer+=t-this._uniformLocationPointer%t;let i=this._uniformLocationPointer-e;for(let e=0;e0){if(t instanceof Array)throw"addUniform should not be use with Array in UBO: "+e;if(this._fillAlignment(4),this._uniformArraySizes[e]={strideSize:t,arraySize:i},16==t)t*=i;else{let e=4-t;t=t*i+e*i}r=[];for(let e=0;e1&&this._buffers[this._bufferIndex][1]){if(this._buffersEqual(this._bufferData,this._buffers[this._bufferIndex][1])){this._needSync=!1,this._createBufferOnWrite=this._engine._features.trackUbosInFrame;return}this._copyBuffer(this._bufferData,this._buffers[this._bufferIndex][1])}this._engine.updateUniformBuffer(this._buffer,this._bufferData),this._engine._features._collectUbosUpdatedInFrame&&(sp._UpdatedUbosInFrame[this._name]||(sp._UpdatedUbosInFrame[this._name]=0),sp._UpdatedUbosInFrame[this._name]++),this._needSync=!1,this._createBufferOnWrite=this._engine._features.trackUbosInFrame}}_createNewBuffer(){this._bufferIndex+10?(this._needSync=0!==this._bufferIndex,this._bufferIndex=0,this._buffer=this._buffers[this._bufferIndex][0]):this._bufferIndex=-1)}updateUniform(e,t,i){this._checkNewFrame();let r=this._uniformLocations[e];if(void 0===r){if(this._buffer){ig.Error("Cannot add an uniform after UBO has been created.");return}this.addUniform(e,i),r=this._uniformLocations[e]}if(this._buffer||this.create(),this._dynamic)for(let e=0;ea[t]=e),a}if(!(e instanceof Array||e instanceof Float32Array)||0!==r||e.length!==h){if(e instanceof Array){let t=r/4;return e.slice(t,t+h)}if(e instanceof ArrayBuffer)return new Float32Array(e,r,h);{let t=e.byteOffset+r;if(o){let i=new Float32Array(h),r=new Float32Array(e.buffer,t,h);return i.set(r),i}let i=t%4;return i&&(t=Math.max(0,t-i)),new Float32Array(e.buffer,t,h)}}return o?e.slice():e}}sf._Counter=0,sf.BYTE=5120,sf.UNSIGNED_BYTE=5121,sf.SHORT=5122,sf.UNSIGNED_SHORT=5123,sf.INT=5124,sf.UNSIGNED_INT=5125,sf.FLOAT=5126,sf.PositionKind="position",sf.NormalKind="normal",sf.TangentKind="tangent",sf.UVKind="uv",sf.UV2Kind="uv2",sf.UV3Kind="uv3",sf.UV4Kind="uv4",sf.UV5Kind="uv5",sf.UV6Kind="uv6",sf.ColorKind="color",sf.ColorInstanceKind="instanceColor",sf.MatricesIndicesKind="matricesIndices",sf.MatricesWeightsKind="matricesWeights",sf.MatricesIndicesExtraKind="matricesIndicesExtra",sf.MatricesWeightsExtraKind="matricesWeightsExtra";class sm{constructor(){this.hit=!1,this.distance=0,this.pickedPoint=null,this.pickedMesh=null,this.bu=0,this.bv=0,this.faceId=-1,this.subMeshFaceId=-1,this.subMeshId=0,this.pickedSprite=null,this.thinInstanceIndex=-1,this.ray=null,this.originMesh=null,this.aimTransform=null,this.gripTransform=null}getNormal(e=!1,t=!0){let i;if(!this.pickedMesh||t&&!this.pickedMesh.isVerticesDataPresent(sf.NormalKind))return null;let r=this.pickedMesh.getIndices();(null==r?void 0:r.length)===0&&(r=null);let s=ie.Vector3[0],n=ie.Vector3[1],a=ie.Vector3[2];if(t){let e=this.pickedMesh.getVerticesData(sf.NormalKind),t=r?t5.FromArrayToRef(e,3*r[3*this.faceId],s):s.copyFromFloats(e[9*this.faceId],e[9*this.faceId+1],e[9*this.faceId+2]),o=r?t5.FromArrayToRef(e,3*r[3*this.faceId+1],n):n.copyFromFloats(e[(3*this.faceId+1)*3],e[(3*this.faceId+1)*3+1],e[(3*this.faceId+1)*3+2]),l=r?t5.FromArrayToRef(e,3*r[3*this.faceId+2],a):a.copyFromFloats(e[(3*this.faceId+2)*3],e[(3*this.faceId+2)*3+1],e[(3*this.faceId+2)*3+2]);t=t.scale(this.bu),o=o.scale(this.bv),l=l.scale(1-this.bu-this.bv),i=new t5(t.x+o.x+l.x,t.y+o.y+l.y,t.z+o.z+l.z)}else{let e=this.pickedMesh.getVerticesData(sf.PositionKind),t=r?t5.FromArrayToRef(e,3*r[3*this.faceId],s):s.copyFromFloats(e[9*this.faceId],e[9*this.faceId+1],e[9*this.faceId+2]),o=r?t5.FromArrayToRef(e,3*r[3*this.faceId+1],n):n.copyFromFloats(e[(3*this.faceId+1)*3],e[(3*this.faceId+1)*3+1],e[(3*this.faceId+1)*3+2]),l=r?t5.FromArrayToRef(e,3*r[3*this.faceId+2],a):a.copyFromFloats(e[(3*this.faceId+2)*3],e[(3*this.faceId+2)*3+1],e[(3*this.faceId+2)*3+2]),h=t.subtract(o),u=l.subtract(o);i=t5.Cross(h,u)}let o=(e,t)=>{let i=e.getWorldMatrix();e.nonUniformScaling&&(ie.Matrix[0].copyFrom(i),(i=ie.Matrix[0]).setTranslationFromFloats(0,0,0),i.invert(),i.transposeToRef(ie.Matrix[1]),i=ie.Matrix[1]),t5.TransformNormalToRef(t,i,t)};if(e&&o(this.pickedMesh,i),this.ray){let t=ie.Vector3[0].copyFrom(i);e||o(this.pickedMesh,t),t5.Dot(t,this.ray.direction)>0&&i.negateInPlace()}return i.normalize(),i}getTextureCoordinates(e=sf.UVKind){if(!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(e))return null;let t=this.pickedMesh.getIndices();if(!t)return null;let i=this.pickedMesh.getVerticesData(e);if(!i)return null;let r=t4.FromArray(i,2*t[3*this.faceId]),s=t4.FromArray(i,2*t[3*this.faceId+1]),n=t4.FromArray(i,2*t[3*this.faceId+2]);return r=r.scale(this.bu),s=s.scale(this.bv),n=n.scale(1-this.bu-this.bv),new t4(r.x+s.x+n.x,r.y+s.y+n.y)}}class sg{constructor(e){this._vertexBuffers={},this._scene=e}_prepareBuffers(){if(this._vertexBuffers[sf.PositionKind])return;let e=[];e.push(1,1),e.push(-1,1),e.push(-1,-1),e.push(1,-1),this._vertexBuffers[sf.PositionKind]=new sf(this._scene.getEngine(),e,sf.PositionKind,!1,!1,2),this._buildIndexBuffer()}_buildIndexBuffer(){let e=[];e.push(0),e.push(1),e.push(2),e.push(0),e.push(2),e.push(3),this._indexBuffer=this._scene.getEngine().createIndexBuffer(e)}_rebuild(){let e=this._vertexBuffers[sf.PositionKind];e&&(e._rebuild(),this._buildIndexBuffer())}_prepareFrame(e=null,t=null){let i=this._scene.activeCamera;return!!(i&&(t=t||i._postProcesses.filter(e=>null!=e))&&0!==t.length&&this._scene.postProcessesEnabled)&&(t[0].activate(i,e,null!=t),!0)}directRender(e,t=null,i=!1,r=0,s=0,n=!1){var a;let o=this._scene.getEngine();for(let l=0;lnull!=e)).length||!this._scene.postProcessesEnabled)return;let o=this._scene.getEngine();for(let l=0,h=r.length;lt._alphaIndex?1:e._alphaIndext._distanceToCamera?-1:0}static frontToBackSortCompare(e,t){return e._distanceToCamerat._distanceToCamera?1:0}static PainterSortCompare(e,t){let i=e.getMesh(),r=t.getMesh();return i.material&&r.material?i.material.uniqueId-r.material.uniqueId:i.uniqueId-r.uniqueId}prepare(){this._opaqueSubMeshes.reset(),this._transparentSubMeshes.reset(),this._alphaTestSubMeshes.reset(),this._depthOnlySubMeshes.reset(),this._particleSystems.reset(),this.prepareSprites(),this._edgesRenderers.reset(),this._empty=!0}prepareSprites(){this._spriteManagers.reset()}dispose(){this._opaqueSubMeshes.dispose(),this._transparentSubMeshes.dispose(),this._alphaTestSubMeshes.dispose(),this._depthOnlySubMeshes.dispose(),this._particleSystems.dispose(),this._spriteManagers.dispose(),this._edgesRenderers.dispose()}dispatch(e,t,i){void 0===t&&(t=e.getMesh()),void 0===i&&(i=e.getMaterial()),null!=i&&(i.needAlphaBlendingForMesh(t)?this._transparentSubMeshes.push(e):i.needAlphaTesting()?(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._alphaTestSubMeshes.push(e)):(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._opaqueSubMeshes.push(e)),t._renderingGroup=this,t._edgesRenderer&&t._edgesRenderer.isEnabled&&this._edgesRenderers.pushNoDuplicate(t._edgesRenderer),this._empty=!1)}dispatchSprites(e){this._spriteManagers.push(e),this._empty=!1}dispatchParticles(e){this._particleSystems.push(e),this._empty=!1}_renderParticles(e){if(0===this._particleSystems.length)return;let t=this._scene.activeCamera;this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);for(let i=0;i=v.LeftClick&&i<=v.RightClick&&(l.type=1===r?"pointerdown":"pointerup",l.button=i-2),l}static _CreateWheelEvent(e,t,i,r,s,n){let a=this._CreateMouseEvent(e,t,i,r,s,n);switch(a.pointerId=1,a.type="wheel",a.deltaMode=sM.DOM_DELTA_PIXEL,a.deltaX=0,a.deltaY=0,a.deltaZ=0,i){case v.MouseWheelX:a.deltaX=r;break;case v.MouseWheelY:a.deltaY=r;break;case v.MouseWheelZ:a.deltaZ=r}return a}static _CreateMouseEvent(e,t,i,r,s,n){let a=this._CreateEvent(n),o=s.pollInput(e,t,v.Horizontal),l=s.pollInput(e,t,v.Vertical);return n?(a.movementX=0,a.movementY=0,a.offsetX=a.movementX-n.getBoundingClientRect().x,a.offsetY=a.movementY-n.getBoundingClientRect().y):(a.movementX=s.pollInput(e,t,x.DeltaHorizontal),a.movementY=s.pollInput(e,t,x.DeltaVertical),a.offsetX=0,a.offsetY=0),this._CheckNonCharacterKeys(a,s),a.clientX=o,a.clientY=l,a.x=o,a.y=l,a.deviceType=e,a.deviceSlot=t,a.inputIndex=i,a}static _CreateKeyboardEvent(e,t,i,r){let s=this._CreateEvent(r);return this._CheckNonCharacterKeys(s,i),s.deviceType=g.Keyboard,s.deviceSlot=0,s.inputIndex=e,s.type=1===t?"keydown":"keyup",s.key=String.fromCharCode(e),s.keyCode=e,s}static _CheckNonCharacterKeys(e,t){let i=t.isDeviceAvailable(g.Keyboard),r=i&&1===t.pollInput(g.Keyboard,0,18),s=i&&1===t.pollInput(g.Keyboard,0,17),n=i&&(1===t.pollInput(g.Keyboard,0,91)||1===t.pollInput(g.Keyboard,0,92)||1===t.pollInput(g.Keyboard,0,93)),a=i&&1===t.pollInput(g.Keyboard,0,16);e.altKey=r,e.ctrlKey=s,e.metaKey=n,e.shiftKey=a}static _CreateEvent(e){let t={};return t.preventDefault=()=>{},t.target=e,t}}class sO{constructor(e,t,i){this._nativeInput=_native.DeviceInputSystem?new _native.DeviceInputSystem(e,t,(e,t,r,s)=>{let n=sD.CreateDeviceEvent(e,t,r,s,this);i(e,t,n)}):this._createDummyNativeInput()}pollInput(e,t,i){return this._nativeInput.pollInput(e,t,i)}isDeviceAvailable(e){return e===g.Mouse||e===g.Touch}dispose(){this._nativeInput.dispose()}_createDummyNativeInput(){return{pollInput:()=>0,isDeviceAvailable:()=>!1,dispose:()=>{}}}}let sN=Object.keys(v).length/2;class sF{constructor(e,t,i,r){this._inputs=[],this._keyboardActive=!1,this._pointerActive=!1,this._usingSafari=ss.IsSafari(),this._usingMacOS=rr()&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),this._keyboardDownEvent=e=>{},this._keyboardUpEvent=e=>{},this._keyboardBlurEvent=e=>{},this._pointerMoveEvent=e=>{},this._pointerDownEvent=e=>{},this._pointerUpEvent=e=>{},this._pointerCancelEvent=e=>{},this._pointerWheelEvent=e=>{},this._pointerBlurEvent=e=>{},this._pointerMacOSChromeOutEvent=e=>{},this._eventsAttached=!1,this._mouseId=-1,this._isUsingFirefox=rr()&&navigator.userAgent&&-1!==navigator.userAgent.indexOf("Firefox"),this._isUsingChromium=rr()&&navigator.userAgent&&-1!==navigator.userAgent.indexOf("Chrome"),this._maxTouchPoints=0,this._pointerInputClearObserver=null,this._gamepadConnectedEvent=e=>{},this._gamepadDisconnectedEvent=e=>{},this._eventPrefix=ss.GetPointerPrefix(e),this._engine=e,this._onDeviceConnected=t,this._onDeviceDisconnected=i,this._onInputChanged=r,this._mouseId=this._isUsingFirefox?0:1,this._enableEvents(),this._usingMacOS&&(this._metaKeys=[]),this._engine._onEngineViewChanged||(this._engine._onEngineViewChanged=()=>{this._enableEvents()})}pollInput(e,t,i){let r=this._inputs[e][t];if(!r)throw`Unable to find device ${g[e]}`;e>=g.DualShock&&e<=g.DualSense&&this._updateDevice(e,t,i);let s=r[i];if(void 0===s)throw`Unable to find input ${i} for device ${g[e]} in slot ${t}`;return i===v.Move&&ss.Warn("Unable to provide information for PointerInput.Move. Try using PointerInput.Horizontal or PointerInput.Vertical for move data."),s}isDeviceAvailable(e){return void 0!==this._inputs[e]}dispose(){this._onDeviceConnected=()=>{},this._onDeviceDisconnected=()=>{},this._onInputChanged=()=>{},delete this._engine._onEngineViewChanged,this._elementToAttachTo&&this._disableEvents()}_enableEvents(){let e=this===null||void 0===this?void 0:this._engine.getInputElement();if(e&&(!this._eventsAttached||this._elementToAttachTo!==e)){if(this._disableEvents(),this._inputs){for(let e of this._inputs)if(e)for(let t in e){let i=e[+t];if(i)for(let e=0;e{this._keyboardActive||(this._keyboardActive=!0,this._registerDevice(g.Keyboard,0,255));let t=this._inputs[g.Keyboard][0];t&&(t[e.keyCode]=1,e.inputIndex=e.keyCode,this._usingMacOS&&e.metaKey&&"Meta"!==e.key&&!this._metaKeys.includes(e.keyCode)&&this._metaKeys.push(e.keyCode),this._onInputChanged(g.Keyboard,0,e))},this._keyboardUpEvent=e=>{this._keyboardActive||(this._keyboardActive=!0,this._registerDevice(g.Keyboard,0,255));let t=this._inputs[g.Keyboard][0];if(t){if(t[e.keyCode]=0,e.inputIndex=e.keyCode,this._usingMacOS&&"Meta"===e.key&&this._metaKeys.length>0){for(let e of this._metaKeys){let i=sD.CreateDeviceEvent(g.Keyboard,0,e,0,this,this._elementToAttachTo);t[e]=0,this._onInputChanged(g.Keyboard,0,i)}this._metaKeys.splice(0,this._metaKeys.length)}this._onInputChanged(g.Keyboard,0,e)}},this._keyboardBlurEvent=()=>{if(this._keyboardActive){let e=this._inputs[g.Keyboard][0];for(let t=0;t{let t=this._getPointerType(e),i=t===g.Mouse?0:this._activeTouchIds.indexOf(e.pointerId);if(t===g.Touch&&-1===i){let r=this._activeTouchIds.indexOf(-1);if(r>=0)i=r,this._activeTouchIds[r]=e.pointerId,this._onDeviceConnected(t,i);else{ss.Warn(`Max number of touches exceeded. Ignoring touches in excess of ${this._maxTouchPoints}`);return}}this._inputs[t]||(this._inputs[t]={}),this._inputs[t][i]||this._addPointerDevice(t,i,e.clientX,e.clientY);let r=this._inputs[t][i];r&&(e.inputIndex=v.Move,r[v.Horizontal]=e.clientX,r[v.Vertical]=e.clientY,t===g.Touch&&0===r[v.LeftClick]&&(r[v.LeftClick]=1),void 0===e.pointerId&&(e.pointerId=this._mouseId),this._onInputChanged(t,i,e),this._usingSafari||-1===e.button||(e.inputIndex=e.button+2,r[e.button+2]=r[e.button+2]?0:1,this._onInputChanged(t,i,e)))},this._pointerDownEvent=e=>{let t=this._getPointerType(e),i=t===g.Mouse?0:e.pointerId;if(t===g.Touch){let t=this._activeTouchIds.indexOf(-1);if(t>=0)i=t,this._activeTouchIds[t]=e.pointerId;else{ss.Warn(`Max number of touches exceeded. Ignoring touches in excess of ${this._maxTouchPoints}`);return}}this._inputs[t]||(this._inputs[t]={}),this._inputs[t][i]?t===g.Touch&&this._onDeviceConnected(t,i):this._addPointerDevice(t,i,e.clientX,e.clientY);let r=this._inputs[t][i];if(r){let s=r[v.Horizontal],n=r[v.Vertical];if(t===g.Mouse){if(void 0===e.pointerId&&(e.pointerId=this._mouseId),!document.pointerLockElement)try{this._elementToAttachTo.setPointerCapture(this._mouseId)}catch(e){}}else if(e.pointerId&&!document.pointerLockElement)try{this._elementToAttachTo.setPointerCapture(e.pointerId)}catch(e){}r[v.Horizontal]=e.clientX,r[v.Vertical]=e.clientY,r[e.button+2]=1,e.inputIndex=e.button+2,this._onInputChanged(t,i,e),(s!==e.clientX||n!==e.clientY)&&(e.inputIndex=v.Move,this._onInputChanged(t,i,e))}},this._pointerUpEvent=e=>{var t,i,r,s,n;let a=this._getPointerType(e),o=a===g.Mouse?0:this._activeTouchIds.indexOf(e.pointerId);if(a===g.Touch){if(-1===o)return;this._activeTouchIds[o]=-1}let l=null===(t=this._inputs[a])||void 0===t?void 0:t[o];if(l&&0!==l[e.button+2]){let t=l[v.Horizontal],h=l[v.Vertical];l[v.Horizontal]=e.clientX,l[v.Vertical]=e.clientY,l[e.button+2]=0,void 0===e.pointerId&&(e.pointerId=this._mouseId),(t!==e.clientX||h!==e.clientY)&&(e.inputIndex=v.Move,this._onInputChanged(a,o,e)),e.inputIndex=e.button+2,a===g.Mouse&&this._mouseId>=0&&(null===(r=(i=this._elementToAttachTo).hasPointerCapture)||void 0===r?void 0:r.call(i,this._mouseId))?this._elementToAttachTo.releasePointerCapture(this._mouseId):e.pointerId&&(null===(n=(s=this._elementToAttachTo).hasPointerCapture)||void 0===n?void 0:n.call(s,e.pointerId))&&this._elementToAttachTo.releasePointerCapture(e.pointerId),this._onInputChanged(a,o,e),a===g.Touch&&this._onDeviceDisconnected(a,o)}},this._pointerCancelEvent=e=>{var t,i,r,s;if("mouse"===e.pointerType){let e=this._inputs[g.Mouse][0];this._mouseId>=0&&(null===(i=(t=this._elementToAttachTo).hasPointerCapture)||void 0===i?void 0:i.call(t,this._mouseId))&&this._elementToAttachTo.releasePointerCapture(this._mouseId);for(let t=v.LeftClick;t<=v.BrowserForward;t++)if(1===e[t]){e[t]=0;let i=sD.CreateDeviceEvent(g.Mouse,0,t,0,this,this._elementToAttachTo);this._onInputChanged(g.Mouse,0,i)}}else{let t=this._activeTouchIds.indexOf(e.pointerId);if(-1===t)return;(null===(s=(r=this._elementToAttachTo).hasPointerCapture)||void 0===s?void 0:s.call(r,e.pointerId))&&this._elementToAttachTo.releasePointerCapture(e.pointerId),this._inputs[g.Touch][t][v.LeftClick]=0;let i=sD.CreateDeviceEvent(g.Touch,t,v.LeftClick,0,this,this._elementToAttachTo,e.pointerId);this._onInputChanged(g.Touch,t,i),this._activeTouchIds[t]=-1,this._onDeviceDisconnected(g.Touch,t)}},this._wheelEventName="onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll";let e=!1,t=function(){};try{let i=Object.defineProperty({},"passive",{get:function(){e=!0}});this._elementToAttachTo.addEventListener("test",t,i),this._elementToAttachTo.removeEventListener("test",t,i)}catch(e){}this._pointerBlurEvent=()=>{var e,t,i,r,s;if(this.isDeviceAvailable(g.Mouse)){let i=this._inputs[g.Mouse][0];this._mouseId>=0&&(null===(t=(e=this._elementToAttachTo).hasPointerCapture)||void 0===t?void 0:t.call(e,this._mouseId))&&this._elementToAttachTo.releasePointerCapture(this._mouseId);for(let e=v.LeftClick;e<=v.BrowserForward;e++)if(1===i[e]){i[e]=0;let t=sD.CreateDeviceEvent(g.Mouse,0,e,0,this,this._elementToAttachTo);this._onInputChanged(g.Mouse,0,t)}}if(this.isDeviceAvailable(g.Touch)){let e=this._inputs[g.Touch];for(let t=0;t{let t=g.Mouse;this._inputs[t]||(this._inputs[t]=[]),this._inputs[t][0]||(this._pointerActive=!0,this._registerDevice(t,0,sN));let i=this._inputs[t][0];i&&(i[v.MouseWheelX]=e.deltaX||0,i[v.MouseWheelY]=e.deltaY||e.wheelDelta||0,i[v.MouseWheelZ]=e.deltaZ||0,void 0===e.pointerId&&(e.pointerId=this._mouseId),0!==i[v.MouseWheelX]&&(e.inputIndex=v.MouseWheelX,this._onInputChanged(t,0,e)),0!==i[v.MouseWheelY]&&(e.inputIndex=v.MouseWheelY,this._onInputChanged(t,0,e)),0!==i[v.MouseWheelZ]&&(e.inputIndex=v.MouseWheelZ,this._onInputChanged(t,0,e)))},this._usingMacOS&&this._isUsingChromium&&(this._pointerMacOSChromeOutEvent=e=>{e.buttons>1&&this._pointerCancelEvent(e)},this._elementToAttachTo.addEventListener("lostpointercapture",this._pointerMacOSChromeOutEvent)),this._elementToAttachTo.addEventListener(this._eventPrefix+"move",this._pointerMoveEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"down",this._pointerDownEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"up",this._pointerUpEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"cancel",this._pointerCancelEvent),this._elementToAttachTo.addEventListener("blur",this._pointerBlurEvent),this._elementToAttachTo.addEventListener(this._wheelEventName,this._pointerWheelEvent,!!e&&{passive:!1}),this._pointerInputClearObserver=this._engine.onEndFrameObservable.add(()=>{if(this.isDeviceAvailable(g.Mouse)){let e=this._inputs[g.Mouse][0];e[v.MouseWheelX]=0,e[v.MouseWheelY]=0,e[v.MouseWheelZ]=0}})}_handleGamepadActions(){this._gamepadConnectedEvent=e=>{this._addGamePad(e.gamepad)},this._gamepadDisconnectedEvent=e=>{if(this._gamepads){let t=this._getGamepadDeviceType(e.gamepad.id),i=e.gamepad.index;this._unregisterDevice(t,i),delete this._gamepads[i]}},window.addEventListener("gamepadconnected",this._gamepadConnectedEvent),window.addEventListener("gamepaddisconnected",this._gamepadDisconnectedEvent)}_updateDevice(e,t,i){let r=navigator.getGamepads()[t];if(r&&e===this._gamepads[t]){let s=this._inputs[e][t];i>=r.buttons.length?s[i]=r.axes[i-r.buttons.length].valueOf():s[i]=r.buttons[i].value}}_getGamepadDeviceType(e){return -1!==e.indexOf("054c")?-1!==e.indexOf("0ce6")?g.DualSense:g.DualShock:-1!==e.indexOf("Xbox One")||-1!==e.search("Xbox 360")||-1!==e.search("xinput")?g.Xbox:-1!==e.indexOf("057e")?g.Switch:g.Generic}_getPointerType(e){let t=g.Mouse;return("touch"===e.pointerType||"pen"===e.pointerType||e.touches)&&(t=g.Touch),t}}class sw{constructor(e,t,i=0){this.deviceType=t,this.deviceSlot=i,this.onInputChangedObservable=new tj,this._deviceInputSystem=e}getInput(e){return this._deviceInputSystem.pollInput(this.deviceType,this.deviceSlot,e)}}class sL{constructor(e){this._registeredManagers=[],this._refCount=0,this.registerManager=e=>{for(let t=0;t{let t=this._registeredManagers.indexOf(e);t>-1&&this._registeredManagers.splice(t,1)};let t=Object.keys(g).length/2;this._devices=Array(t);let i=(e,t)=>{for(let i of(this._devices[e]||(this._devices[e]=[]),this._devices[e][t]||(this._devices[e][t]=t),this._registeredManagers)){let r=new sw(this._deviceInputSystem,e,t);i._addDevice(r)}},r=(e,t)=>{var i;for(let r of((null===(i=this._devices[e])||void 0===i?void 0:i[t])&&delete this._devices[e][t],this._registeredManagers))r._removeDevice(e,t)},s=(e,t,i)=>{if(i)for(let r of this._registeredManagers)r._onInputChanged(e,t,i)};"undefined"!=typeof _native?this._deviceInputSystem=new sO(i,r,s):this._deviceInputSystem=new sF(e,i,r,s)}dispose(){this._deviceInputSystem.dispose()}}class sB{getDeviceSource(e,t){if(void 0===t){if(void 0===this._firstDevice[e])return null;t=this._firstDevice[e]}return this._devices[e]&&void 0!==this._devices[e][t]?this._devices[e][t]:null}getDeviceSources(e){return this._devices[e]?this._devices[e].filter(e=>!!e):[]}constructor(e){let t=Object.keys(g).length/2;this._devices=Array(t),this._firstDevice=Array(t),this._engine=e,this._engine._deviceSourceManager||(this._engine._deviceSourceManager=new sL(e)),this._engine._deviceSourceManager._refCount++,this.onDeviceConnectedObservable=new tj(e=>{for(let t of this._devices)if(t)for(let i of t)i&&this.onDeviceConnectedObservable.notifyObserver(e,i)}),this.onDeviceDisconnectedObservable=new tj,this._engine._deviceSourceManager.registerManager(this),this._onDisposeObserver=e.onDisposeObservable.add(()=>{this.dispose()})}dispose(){this.onDeviceConnectedObservable.clear(),this.onDeviceDisconnectedObservable.clear(),this._engine._deviceSourceManager&&(this._engine._deviceSourceManager.unregisterManager(this),--this._engine._deviceSourceManager._refCount<1&&(this._engine._deviceSourceManager.dispose(),delete this._engine._deviceSourceManager)),this._engine.onDisposeObservable.remove(this._onDisposeObserver)}_addDevice(e){this._devices[e.deviceType]||(this._devices[e.deviceType]=[]),this._devices[e.deviceType][e.deviceSlot]||(this._devices[e.deviceType][e.deviceSlot]=e,this._updateFirstDevices(e.deviceType)),this.onDeviceConnectedObservable.notifyObservers(e)}_removeDevice(e,t){var i,r;let s=null===(i=this._devices[e])||void 0===i?void 0:i[t];this.onDeviceDisconnectedObservable.notifyObservers(s),(null===(r=this._devices[e])||void 0===r?void 0:r[t])&&delete this._devices[e][t],this._updateFirstDevices(e)}_onInputChanged(e,t,i){var r,s;null===(s=null===(r=this._devices[e])||void 0===r?void 0:r[t])||void 0===s||s.onInputChangedObservable.notifyObservers(i)}_updateFirstDevices(e){switch(e){case g.Keyboard:case g.Mouse:this._firstDevice[e]=0;break;case g.Touch:case g.DualSense:case g.DualShock:case g.Xbox:case g.Switch:case g.Generic:{delete this._firstDevice[e];let t=this._devices[e];if(t){for(let i=0;i=v.MouseWheelX&&t.inputIndex<=v.MouseWheelZ?sS.POINTERWHEEL:sS.POINTERMOVE;r.onPointerMove&&(e=e||this._pickMove(t),r.onPointerMove(t,e,a)),e?(i=new sA(a,t,e),this._setRayOnPointerInfo(e,t)):(i=new sA(a,t,null,this),this._movePointerInfo=i),r.onPointerObservable.hasObservers()&&r.onPointerObservable.notifyObservers(i,a)}_setRayOnPointerInfo(e,t){let i=this._scene;e&&i._pickingAvailable&&!e.ray&&(e.ray=i.createPickingRay(t.offsetX,t.offsetY,t7.Identity(),i.activeCamera))}_addCameraPointerObserver(e,t){return this._cameraObserverCount++,this._scene.onPointerObservable.add(e,t)}_removeCameraPointerObserver(e){return this._cameraObserverCount--,this._scene.onPointerObservable.remove(e)}_checkForPicking(){return!!(this._scene.onPointerObservable.observers.length>this._cameraObserverCount||this._scene.onPointerPick)}_checkPrePointerObservable(e,t,i){let r=this._scene,s=new sy(i,t,this._unTranslatedPointerX,this._unTranslatedPointerY);return e&&(s.originalPickingInfo=e,s.ray=e.ray,e.originMesh&&(s.nearInteractionPickingInfo=e)),r.onPrePointerObservable.notifyObservers(s,i),!!s.skipOnPointerObservable}_pickMove(e){let t=this._scene,i=t.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,t.pointerMovePredicate,t.pointerMoveFastCheck,t.cameraToUseForPointers,t.pointerMoveTrianglePredicate);return this._setCursorAndPointerOverMesh(i,e,t),i}_setCursorAndPointerOverMesh(e,t,i){let r=i.getEngine().getInputElement();if(null==e?void 0:e.pickedMesh){if(this.setPointerOverMesh(e.pickedMesh,t.pointerId,e,t),!i.doNotHandleCursors&&r&&this._pointerOverMesh){let e=this._pointerOverMesh._getActionManagerForTrigger();e&&e.hasPointerTriggers&&(r.style.cursor=e.hoverCursor||i.hoverCursor)}}else this.setPointerOverMesh(null,t.pointerId,e,t)}simulatePointerMove(e,t){let i=new PointerEvent("pointermove",t);i.inputIndex=v.Move,this._checkPrePointerObservable(e,i,sS.POINTERMOVE)||this._processPointerMove(e,i)}simulatePointerDown(e,t){let i=new PointerEvent("pointerdown",t);i.inputIndex=i.button+2,this._checkPrePointerObservable(e,i,sS.POINTERDOWN)||this._processPointerDown(e,i)}_processPointerDown(e,t){let i;let r=this._scene;if(null==e?void 0:e.pickedMesh){this._pickedDownMesh=e.pickedMesh;let i=e.pickedMesh._getActionManagerForTrigger();if(i){if(i.hasPickTriggers)switch(i.processTrigger(5,ic.CreateNew(e.pickedMesh,t,e)),t.button){case 0:i.processTrigger(2,ic.CreateNew(e.pickedMesh,t,e));break;case 1:i.processTrigger(4,ic.CreateNew(e.pickedMesh,t,e));break;case 2:i.processTrigger(3,ic.CreateNew(e.pickedMesh,t,e))}i.hasSpecificTrigger(8)&&window.setTimeout(()=>{let e=r.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,e=>e.isPickable&&e.isVisible&&e.isReady()&&e.actionManager&&e.actionManager.hasSpecificTrigger(8)&&e===this._pickedDownMesh,!1,r.cameraToUseForPointers);(null==e?void 0:e.pickedMesh)&&i&&0!==this._totalPointersPressed&&Date.now()-this._startingPointerTime>sV.LongPressDelay&&!this._isPointerSwiping()&&(this._startingPointerTime=0,i.processTrigger(8,ic.CreateNew(e.pickedMesh,t)))},sV.LongPressDelay)}}else for(let i of r._pointerDownStage)e=i.action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,t,!1);let s=sS.POINTERDOWN;e?(r.onPointerDown&&r.onPointerDown(t,e,s),i=new sA(s,t,e),this._setRayOnPointerInfo(e,t)):i=new sA(s,t,null,this),r.onPointerObservable.hasObservers()&&r.onPointerObservable.notifyObservers(i,s)}_isPointerSwiping(){return this._isSwiping}simulatePointerUp(e,t,i){let r=new PointerEvent("pointerup",t);r.inputIndex=v.Move;let s=new sU;i?s.doubleClick=!0:s.singleClick=!0,this._checkPrePointerObservable(e,r,sS.POINTERUP)||this._processPointerUp(e,r,s)}_processPointerUp(e,t,i){let r=this._scene;if(null==e?void 0:e.pickedMesh){if(this._pickedUpMesh=e.pickedMesh,this._pickedDownMesh===this._pickedUpMesh&&(r.onPointerPick&&r.onPointerPick(t,e),i.singleClick&&!i.ignore&&r.onPointerObservable.observers.length>this._cameraObserverCount)){let i=sS.POINTERPICK,s=new sA(i,t,e);this._setRayOnPointerInfo(e,t),r.onPointerObservable.notifyObservers(s,i)}let s=e.pickedMesh._getActionManagerForTrigger();if(s&&!i.ignore){s.processTrigger(7,ic.CreateNew(e.pickedMesh,t,e)),!i.hasSwiped&&i.singleClick&&s.processTrigger(1,ic.CreateNew(e.pickedMesh,t,e));let r=e.pickedMesh._getActionManagerForTrigger(6);i.doubleClick&&r&&r.processTrigger(6,ic.CreateNew(e.pickedMesh,t,e))}}else if(!i.ignore)for(let s of r._pointerUpStage)e=s.action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,t,i.doubleClick);if(this._pickedDownMesh&&this._pickedDownMesh!==this._pickedUpMesh){let e=this._pickedDownMesh._getActionManagerForTrigger(16);e&&e.processTrigger(16,ic.CreateNew(this._pickedDownMesh,t))}if(!i.ignore){let s=new sA(sS.POINTERUP,t,e);if(this._setRayOnPointerInfo(e,t),r.onPointerObservable.notifyObservers(s,sS.POINTERUP),r.onPointerUp&&r.onPointerUp(t,e,sS.POINTERUP),!i.hasSwiped&&!this._skipPointerTap&&!this._isMultiTouchGesture){let s=0;if(i.singleClick?s=sS.POINTERTAP:i.doubleClick&&(s=sS.POINTERDOUBLETAP),s){let i=new sA(s,t,e);r.onPointerObservable.hasObservers()&&r.onPointerObservable.hasSpecificMask(s)&&r.onPointerObservable.notifyObservers(i,s)}}}}isPointerCaptured(e=0){return this._pointerCaptures[e]}attachControl(e=!0,t=!0,i=!0,r=null){let s=this._scene,n=s.getEngine();r||(r=n.getInputElement()),this._alreadyAttached&&this.detachControl(),r&&(this._alreadyAttachedTo=r),this._deviceSourceManager=new sB(n),this._initActionManager=e=>{if(!this._meshPickProceed){let t=!s.skipPointerUpPicking&&(0!==s._registeredActions||this._checkForPicking()||s.onPointerUp)?s.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,s.pointerUpPredicate,s.pointerUpFastCheck,s.cameraToUseForPointers):null;this._currentPickResult=t,t&&(e=t.hit&&t.pickedMesh?t.pickedMesh._getActionManagerForTrigger():null),this._meshPickProceed=!0}return e},this._delayedSimpleClick=(e,t,i)=>{if((Date.now()-this._previousStartingPointerTime>sV.DoubleClickDelay&&!this._doubleClickOccured||e!==this._previousButtonPressed)&&(this._doubleClickOccured=!1,t.singleClick=!0,t.ignore=!1,this._delayedClicks[e])){let t=this._delayedClicks[e].evt,i=sS.POINTERTAP,r=new sA(i,t,this._currentPickResult);s.onPointerObservable.hasObservers()&&s.onPointerObservable.hasSpecificMask(i)&&s.onPointerObservable.notifyObservers(r,i),this._delayedClicks[e]=null}},this._initClickEvent=(e,t,i,r)=>{var s,n;let a=new sU;this._currentPickResult=null;let o=null,l=e.hasSpecificMask(sS.POINTERPICK)||t.hasSpecificMask(sS.POINTERPICK)||e.hasSpecificMask(sS.POINTERTAP)||t.hasSpecificMask(sS.POINTERTAP)||e.hasSpecificMask(sS.POINTERDOUBLETAP)||t.hasSpecificMask(sS.POINTERDOUBLETAP);!l&&tH&&(o=this._initActionManager(o,a))&&(l=o.hasPickTriggers);let h=!1;if(l){let l=i.button;if(a.hasSwiped=this._isPointerSwiping(),!a.hasSwiped){let u=!sV.ExclusiveDoubleClickMode;if(!u&&(u=!e.hasSpecificMask(sS.POINTERDOUBLETAP)&&!t.hasSpecificMask(sS.POINTERDOUBLETAP))&&!tH.HasSpecificTrigger(6)&&(o=this._initActionManager(o,a))&&(u=!o.hasSpecificTrigger(6)),u)(Date.now()-this._previousStartingPointerTime>sV.DoubleClickDelay||l!==this._previousButtonPressed)&&(a.singleClick=!0,r(a,this._currentPickResult),h=!0);else{let e={evt:i,clickInfo:a,timeoutId:window.setTimeout(this._delayedSimpleClick.bind(this,l,a,r),sV.DoubleClickDelay)};this._delayedClicks[l]=e}let c=e.hasSpecificMask(sS.POINTERDOUBLETAP)||t.hasSpecificMask(sS.POINTERDOUBLETAP);!c&&tH.HasSpecificTrigger(6)&&(o=this._initActionManager(o,a))&&(c=o.hasSpecificTrigger(6)),c&&(l===this._previousButtonPressed&&Date.now()-this._previousStartingPointerTime{if(this._updatePointerPosition(e),this._isSwiping||-1===this._swipeButtonPressed||(this._isSwiping=Math.abs(this._startingPointerPosition.x-this._pointerX)>sV.DragMovementThreshold||Math.abs(this._startingPointerPosition.y-this._pointerY)>sV.DragMovementThreshold),n.isPointerLock&&n._verifyPointerLock(),this._checkPrePointerObservable(null,e,e.inputIndex>=v.MouseWheelX&&e.inputIndex<=v.MouseWheelZ?sS.POINTERWHEEL:sS.POINTERMOVE)||!s.cameraToUseForPointers&&!s.activeCamera)return;if(s.skipPointerMovePicking){this._processPointerMove(new sm,e);return}s.pointerMovePredicate||(s.pointerMovePredicate=e=>e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(e.enablePointerMoveEvents||s.constantlyUpdateMeshUnderPointer||null!==e._getActionManagerForTrigger())&&(!s.cameraToUseForPointers||(s.cameraToUseForPointers.layerMask&e.layerMask)!=0));let t=s._registeredActions>0||s.constantlyUpdateMeshUnderPointer?this._pickMove(e):null;this._processPointerMove(t,e)},this._onPointerDown=e=>{var t;let i;if(this._totalPointersPressed++,this._pickedDownMesh=null,this._meshPickProceed=!1,sV.ExclusiveDoubleClickMode){for(let i=0;ie.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(!s.cameraToUseForPointers||(s.cameraToUseForPointers.layerMask&e.layerMask)!=0)),this._pickedDownMesh=null,i=!s.skipPointerDownPicking&&(0!==s._registeredActions||this._checkForPicking()||s.onPointerDown)?s.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,s.pointerDownPredicate,s.pointerDownFastCheck,s.cameraToUseForPointers):new sm,this._processPointerDown(i,e))},this._onPointerUp=e=>{0!==this._totalPointersPressed&&(this._totalPointersPressed--,this._pickedUpMesh=null,this._meshPickProceed=!1,this._updatePointerPosition(e),s.preventDefaultOnPointerUp&&r&&(e.preventDefault(),r.focus()),this._initClickEvent(s.onPrePointerObservable,s.onPointerObservable,e,(t,i)=>{if(s.onPrePointerObservable.hasObservers()&&(this._skipPointerTap=!1,!t.ignore)){if(this._checkPrePointerObservable(null,e,sS.POINTERUP)){this._swipeButtonPressed===e.button&&(this._isSwiping=!1,this._swipeButtonPressed=-1),0===e.buttons&&(this._pointerCaptures[e.pointerId]=!1);return}!t.hasSwiped&&(t.singleClick&&s.onPrePointerObservable.hasSpecificMask(sS.POINTERTAP)&&this._checkPrePointerObservable(null,e,sS.POINTERTAP)&&(this._skipPointerTap=!0),t.doubleClick&&s.onPrePointerObservable.hasSpecificMask(sS.POINTERDOUBLETAP)&&this._checkPrePointerObservable(null,e,sS.POINTERDOUBLETAP)&&(this._skipPointerTap=!0))}if(!this._pointerCaptures[e.pointerId]){this._swipeButtonPressed===e.button&&(this._isSwiping=!1,this._swipeButtonPressed=-1);return}0===e.buttons&&(this._pointerCaptures[e.pointerId]=!1),(s.cameraToUseForPointers||s.activeCamera)&&(s.pointerUpPredicate||(s.pointerUpPredicate=e=>e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(!s.cameraToUseForPointers||(s.cameraToUseForPointers.layerMask&e.layerMask)!=0)),!this._meshPickProceed&&(tH&&tH.HasTriggers||this._checkForPicking()||s.onPointerUp)&&this._initActionManager(null,t),i||(i=this._currentPickResult),this._processPointerUp(i,e,t),this._previousPickResult=this._currentPickResult,this._swipeButtonPressed===e.button&&(this._isSwiping=!1,this._swipeButtonPressed=-1))}))},this._onKeyDown=e=>{let t=sR.KEYDOWN;if(s.onPreKeyboardObservable.hasObservers()){let i=new sP(t,e);if(s.onPreKeyboardObservable.notifyObservers(i,t),i.skipOnKeyboardObservable)return}if(s.onKeyboardObservable.hasObservers()){let i=new sI(t,e);s.onKeyboardObservable.notifyObservers(i,t)}s.actionManager&&s.actionManager.processTrigger(14,ic.CreateNewFromScene(s,e))},this._onKeyUp=e=>{let t=sR.KEYUP;if(s.onPreKeyboardObservable.hasObservers()){let i=new sP(t,e);if(s.onPreKeyboardObservable.notifyObservers(i,t),i.skipOnKeyboardObservable)return}if(s.onKeyboardObservable.hasObservers()){let i=new sI(t,e);s.onKeyboardObservable.notifyObservers(i,t)}s.actionManager&&s.actionManager.processTrigger(15,ic.CreateNewFromScene(s,e))},this._deviceSourceManager.onDeviceConnectedObservable.add(r=>{r.deviceType===g.Mouse?r.onInputChangedObservable.add(s=>{s.inputIndex===v.LeftClick||s.inputIndex===v.MiddleClick||s.inputIndex===v.RightClick||s.inputIndex===v.BrowserBack||s.inputIndex===v.BrowserForward?t&&1===r.getInput(s.inputIndex)?this._onPointerDown(s):e&&0===r.getInput(s.inputIndex)&&this._onPointerUp(s):i&&(s.inputIndex===v.Move?this._onPointerMove(s):(s.inputIndex===v.MouseWheelX||s.inputIndex===v.MouseWheelY||s.inputIndex===v.MouseWheelZ)&&this._onPointerMove(s))}):r.deviceType===g.Touch?r.onInputChangedObservable.add(s=>{s.inputIndex===v.LeftClick&&(t&&1===r.getInput(s.inputIndex)?(this._onPointerDown(s),this._totalPointersPressed>1&&(this._isMultiTouchGesture=!0)):e&&0===r.getInput(s.inputIndex)&&(this._onPointerUp(s),0===this._totalPointersPressed&&(this._isMultiTouchGesture=!1))),i&&s.inputIndex===v.Move&&this._onPointerMove(s)}):r.deviceType===g.Keyboard&&r.onInputChangedObservable.add(e=>{"keydown"===e.type?this._onKeyDown(e):"keyup"===e.type&&this._onKeyUp(e)})}),this._alreadyAttached=!0}detachControl(){this._alreadyAttached&&(this._deviceSourceManager.dispose(),this._deviceSourceManager=null,this._alreadyAttachedTo&&!this._scene.doNotHandleCursors&&(this._alreadyAttachedTo.style.cursor=this._scene.defaultCursor),this._alreadyAttached=!1,this._alreadyAttachedTo=null)}setPointerOverMesh(e,t=0,i,r){let s;if(this._meshUnderPointerId[t]===e&&(!e||!e._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting))return;let n=this._meshUnderPointerId[t];n&&(s=n._getActionManagerForTrigger(10))&&s.processTrigger(10,ic.CreateNew(n,r,{pointerId:t})),e?(this._meshUnderPointerId[t]=e,this._pointerOverMesh=e,(s=e._getActionManagerForTrigger(9))&&s.processTrigger(9,ic.CreateNew(e,r,{pointerId:t,pickResult:i}))):(delete this._meshUnderPointerId[t],this._pointerOverMesh=null)}getPointerOverMesh(){return this.meshUnderPointer}_invalidateMesh(e){for(let t in this._pointerOverMesh===e&&(this._pointerOverMesh=null),this._pickedDownMesh===e&&(this._pickedDownMesh=null),this._pickedUpMesh===e&&(this._pickedUpMesh=null),this._meshUnderPointerId)this._meshUnderPointerId[t]===e&&delete this._meshUnderPointerId[t]}}sV.DragMovementThreshold=10,sV.LongPressDelay=500,sV.DoubleClickDelay=300,sV.ExclusiveDoubleClickMode=!1;class sk{get min(){return this._min}get max(){return this._max}get average(){return this._average}get lastSecAverage(){return this._lastSecAverage}get current(){return this._current}get total(){return this._totalAccumulated}get count(){return this._totalValueCount}constructor(){this._startMonitoringTime=0,this._min=0,this._max=0,this._average=0,this._lastSecAverage=0,this._current=0,this._totalValueCount=0,this._totalAccumulated=0,this._lastSecAccumulated=0,this._lastSecTime=0,this._lastSecValueCount=0}fetchNewFrame(){this._totalValueCount++,this._current=0,this._lastSecValueCount++}addCount(e,t){sk.Enabled&&(this._current+=e,t&&this._fetchResult())}beginMonitoring(){sk.Enabled&&(this._startMonitoringTime=ra.Now)}endMonitoring(e=!0){if(!sk.Enabled)return;e&&this.fetchNewFrame();let t=ra.Now;this._current=t-this._startMonitoringTime,e&&this._fetchResult()}endFrame(){this._fetchResult()}_fetchResult(){this._totalAccumulated+=this._current,this._lastSecAccumulated+=this._current,this._min=Math.min(this._min,this._current),this._max=Math.max(this._max,this._current),this._average=this._totalAccumulated/this._totalValueCount;let e=ra.Now;e-this._lastSecTime>1e3&&(this._lastSecAverage=this._lastSecAccumulated/this._lastSecValueCount,this._lastSecTime=e,this._lastSecAccumulated=0,this._lastSecValueCount=0)}}sk.Enabled=!0;class sG{constructor(e,t,i,r){this.normal=new t5(e,t,i),this.d=r}asArray(){return[this.normal.x,this.normal.y,this.normal.z,this.d]}clone(){return new sG(this.normal.x,this.normal.y,this.normal.z,this.d)}getClassName(){return"Plane"}getHashCode(){return 397*this.normal.getHashCode()^(0|this.d)}normalize(){let e=Math.sqrt(this.normal.x*this.normal.x+this.normal.y*this.normal.y+this.normal.z*this.normal.z),t=0;return 0!==e&&(t=1/e),this.normal.x*=t,this.normal.y*=t,this.normal.z*=t,this.d*=t,this}transform(e){let t=sG._TmpMatrix;e.invertToRef(t);let i=t.m,r=this.normal.x,s=this.normal.y,n=this.normal.z,a=this.d,o=r*i[0]+s*i[1]+n*i[2]+a*i[3];return new sG(o,r*i[4]+s*i[5]+n*i[6]+a*i[7],r*i[8]+s*i[9]+n*i[10]+a*i[11],r*i[12]+s*i[13]+n*i[14]+a*i[15])}dotCoordinate(e){return this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z+this.d}copyFromPoints(e,t,i){let r;let s=t.x-e.x,n=t.y-e.y,a=t.z-e.z,o=i.x-e.x,l=i.y-e.y,h=i.z-e.z,u=n*h-a*l,c=a*o-s*h,d=s*l-n*o,p=Math.sqrt(u*u+c*c+d*d);return r=0!==p?1/p:0,this.normal.x=u*r,this.normal.y=c*r,this.normal.z=d*r,this.d=-(this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z),this}isFrontFacingTo(e,t){return t5.Dot(this.normal,e)<=t}signedDistanceTo(e){return t5.Dot(e,this.normal)+this.d}static FromArray(e){return new sG(e[0],e[1],e[2],e[3])}static FromPoints(e,t,i){let r=new sG(0,0,0,0);return r.copyFromPoints(e,t,i),r}static FromPositionAndNormal(e,t){let i=new sG(0,0,0,0);return this.FromPositionAndNormalToRef(e,t,i)}static FromPositionAndNormalToRef(e,t,i){return i.normal.copyFrom(t),i.normal.normalize(),i.d=-e.dot(i.normal),i}static SignedDistanceToPlaneFromPositionAndNormal(e,t,i){let r=-(t.x*e.x+t.y*e.y+t.z*e.z);return t5.Dot(i,t)+r}}sG._TmpMatrix=t7.Identity();class sz{static GetPlanes(e){let t=[];for(let e=0;e<6;e++)t.push(new sG(0,0,0,0));return sz.GetPlanesToRef(e,t),t}static GetNearPlaneToRef(e,t){let i=e.m;t.normal.x=i[3]+i[2],t.normal.y=i[7]+i[6],t.normal.z=i[11]+i[10],t.d=i[15]+i[14],t.normalize()}static GetFarPlaneToRef(e,t){let i=e.m;t.normal.x=i[3]-i[2],t.normal.y=i[7]-i[6],t.normal.z=i[11]-i[10],t.d=i[15]-i[14],t.normalize()}static GetLeftPlaneToRef(e,t){let i=e.m;t.normal.x=i[3]+i[0],t.normal.y=i[7]+i[4],t.normal.z=i[11]+i[8],t.d=i[15]+i[12],t.normalize()}static GetRightPlaneToRef(e,t){let i=e.m;t.normal.x=i[3]-i[0],t.normal.y=i[7]-i[4],t.normal.z=i[11]-i[8],t.d=i[15]-i[12],t.normalize()}static GetTopPlaneToRef(e,t){let i=e.m;t.normal.x=i[3]-i[1],t.normal.y=i[7]-i[5],t.normal.z=i[11]-i[9],t.d=i[15]-i[13],t.normalize()}static GetBottomPlaneToRef(e,t){let i=e.m;t.normal.x=i[3]+i[1],t.normal.y=i[7]+i[5],t.normal.z=i[11]+i[9],t.d=i[15]+i[13],t.normalize()}static GetPlanesToRef(e,t){sz.GetNearPlaneToRef(e,t[0]),sz.GetFarPlaneToRef(e,t[1]),sz.GetLeftPlaneToRef(e,t[2]),sz.GetRightPlaneToRef(e,t[3]),sz.GetTopPlaneToRef(e,t[4]),sz.GetBottomPlaneToRef(e,t[5])}static IsPointInFrustum(e,t){for(let i=0;i<6;i++)if(0>t[i].dotCoordinate(e))return!1;return!0}}class sW{static get UniqueId(){let e=this._UniqueIdCounter;return this._UniqueIdCounter++,e}}sW._UniqueIdCounter=1;class sH{static CompareLightsPriority(e,t){return e.shadowEnabled!==t.shadowEnabled?(t.shadowEnabled?1:0)-(e.shadowEnabled?1:0):t.renderPriority-e.renderPriority}}sH.FALLOFF_DEFAULT=0,sH.FALLOFF_PHYSICAL=1,sH.FALLOFF_GLTF=2,sH.FALLOFF_STANDARD=3,sH.LIGHTMAP_DEFAULT=0,sH.LIGHTMAP_SPECULAR=1,sH.LIGHTMAP_SHADOWSONLY=2,sH.INTENSITYMODE_AUTOMATIC=0,sH.INTENSITYMODE_LUMINOUSPOWER=1,sH.INTENSITYMODE_LUMINOUSINTENSITY=2,sH.INTENSITYMODE_ILLUMINANCE=3,sH.INTENSITYMODE_LUMINANCE=4,sH.LIGHTTYPEID_POINTLIGHT=0,sH.LIGHTTYPEID_DIRECTIONALLIGHT=1,sH.LIGHTTYPEID_SPOTLIGHT=2,sH.LIGHTTYPEID_HEMISPHERICLIGHT=3;class sX{constructor(){this.pointerDownFastCheck=!1,this.pointerUpFastCheck=!1,this.pointerMoveFastCheck=!1,this.skipPointerMovePicking=!1,this.skipPointerDownPicking=!1,this.skipPointerUpPicking=!1}}!function(e){e[e.BackwardCompatible=0]="BackwardCompatible",e[e.Intermediate=1]="Intermediate",e[e.Aggressive=2]="Aggressive"}(y||(y={}));class sY extends tW{static DefaultMaterialFactory(e){throw iL("StandardMaterial")}static CollisionCoordinatorFactory(){throw iL("DefaultCollisionCoordinator")}get environmentTexture(){return this._environmentTexture}set environmentTexture(e){this._environmentTexture!==e&&(this._environmentTexture=e,this.markAllMaterialsAsDirty(1))}get imageProcessingConfiguration(){return this._imageProcessingConfiguration}get performancePriority(){return this._performancePriority}set performancePriority(e){if(e!==this._performancePriority){switch(this._performancePriority=e,e){case y.BackwardCompatible:this.skipFrustumClipping=!1,this._renderingManager.maintainStateBetweenFrames=!1,this.skipPointerMovePicking=!1,this.autoClear=!0;break;case y.Intermediate:this.skipFrustumClipping=!1,this._renderingManager.maintainStateBetweenFrames=!1,this.skipPointerMovePicking=!0,this.autoClear=!1;break;case y.Aggressive:this.skipFrustumClipping=!0,this._renderingManager.maintainStateBetweenFrames=!0,this.skipPointerMovePicking=!0,this.autoClear=!1}this.onScenePerformancePriorityChangedObservable.notifyObservers(e)}}set forceWireframe(e){this._forceWireframe!==e&&(this._forceWireframe=e,this.markAllMaterialsAsDirty(16))}get forceWireframe(){return this._forceWireframe}set skipFrustumClipping(e){this._skipFrustumClipping!==e&&(this._skipFrustumClipping=e)}get skipFrustumClipping(){return this._skipFrustumClipping}set forcePointsCloud(e){this._forcePointsCloud!==e&&(this._forcePointsCloud=e,this.markAllMaterialsAsDirty(16))}get forcePointsCloud(){return this._forcePointsCloud}get animationPropertiesOverride(){return this._animationPropertiesOverride}set animationPropertiesOverride(e){this._animationPropertiesOverride=e}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}set beforeRender(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),e&&(this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e))}set afterRender(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),e&&(this._onAfterRenderObserver=this.onAfterRenderObservable.add(e))}set beforeCameraRender(e){this._onBeforeCameraRenderObserver&&this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=this.onBeforeCameraRenderObservable.add(e)}set afterCameraRender(e){this._onAfterCameraRenderObserver&&this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=this.onAfterCameraRenderObservable.add(e)}get pointerDownPredicate(){return this._pointerPickingConfiguration.pointerDownPredicate}set pointerDownPredicate(e){this._pointerPickingConfiguration.pointerDownPredicate=e}get pointerUpPredicate(){return this._pointerPickingConfiguration.pointerUpPredicate}set pointerUpPredicate(e){this._pointerPickingConfiguration.pointerUpPredicate=e}get pointerMovePredicate(){return this._pointerPickingConfiguration.pointerMovePredicate}set pointerMovePredicate(e){this._pointerPickingConfiguration.pointerMovePredicate=e}get pointerDownFastCheck(){return this._pointerPickingConfiguration.pointerDownFastCheck}set pointerDownFastCheck(e){this._pointerPickingConfiguration.pointerDownFastCheck=e}get pointerUpFastCheck(){return this._pointerPickingConfiguration.pointerUpFastCheck}set pointerUpFastCheck(e){this._pointerPickingConfiguration.pointerUpFastCheck=e}get pointerMoveFastCheck(){return this._pointerPickingConfiguration.pointerMoveFastCheck}set pointerMoveFastCheck(e){this._pointerPickingConfiguration.pointerMoveFastCheck=e}get skipPointerMovePicking(){return this._pointerPickingConfiguration.skipPointerMovePicking}set skipPointerMovePicking(e){this._pointerPickingConfiguration.skipPointerMovePicking=e}get skipPointerDownPicking(){return this._pointerPickingConfiguration.skipPointerDownPicking}set skipPointerDownPicking(e){this._pointerPickingConfiguration.skipPointerDownPicking=e}get skipPointerUpPicking(){return this._pointerPickingConfiguration.skipPointerUpPicking}set skipPointerUpPicking(e){this._pointerPickingConfiguration.skipPointerUpPicking=e}get unTranslatedPointer(){return this._inputManager.unTranslatedPointer}static get DragMovementThreshold(){return sV.DragMovementThreshold}static set DragMovementThreshold(e){sV.DragMovementThreshold=e}static get LongPressDelay(){return sV.LongPressDelay}static set LongPressDelay(e){sV.LongPressDelay=e}static get DoubleClickDelay(){return sV.DoubleClickDelay}static set DoubleClickDelay(e){sV.DoubleClickDelay=e}static get ExclusiveDoubleClickMode(){return sV.ExclusiveDoubleClickMode}static set ExclusiveDoubleClickMode(e){sV.ExclusiveDoubleClickMode=e}bindEyePosition(e,t="vEyePosition",i=!1){let r=this._forcedViewPosition?this._forcedViewPosition:this._mirroredCameraPosition?this._mirroredCameraPosition:this.activeCamera.globalPosition,s=this.useRightHandedSystem===(null!=this._mirroredCameraPosition);return ie.Vector4[0].set(r.x,r.y,r.z,s?-1:1),e&&(i?e.setFloat3(t,ie.Vector4[0].x,ie.Vector4[0].y,ie.Vector4[0].z):e.setVector4(t,ie.Vector4[0])),ie.Vector4[0]}finalizeSceneUbo(){let e=this.getSceneUniformBuffer(),t=this.bindEyePosition(null);return e.updateFloat4("vEyePosition",t.x,t.y,t.z,t.w),e.update(),e}set useRightHandedSystem(e){this._useRightHandedSystem!==e&&(this._useRightHandedSystem=e,this.markAllMaterialsAsDirty(16))}get useRightHandedSystem(){return this._useRightHandedSystem}setStepId(e){this._currentStepId=e}getStepId(){return this._currentStepId}getInternalStep(){return this._currentInternalStep}set fogEnabled(e){this._fogEnabled!==e&&(this._fogEnabled=e,this.markAllMaterialsAsDirty(16))}get fogEnabled(){return this._fogEnabled}set fogMode(e){this._fogMode!==e&&(this._fogMode=e,this.markAllMaterialsAsDirty(16))}get fogMode(){return this._fogMode}get prePass(){return!!this.prePassRenderer&&this.prePassRenderer.defaultRT.enabled}set shadowsEnabled(e){this._shadowsEnabled!==e&&(this._shadowsEnabled=e,this.markAllMaterialsAsDirty(2))}get shadowsEnabled(){return this._shadowsEnabled}set lightsEnabled(e){this._lightsEnabled!==e&&(this._lightsEnabled=e,this.markAllMaterialsAsDirty(2))}get lightsEnabled(){return this._lightsEnabled}get activeCameras(){return this._activeCameras}set activeCameras(e){this._unObserveActiveCameras&&(this._unObserveActiveCameras(),this._unObserveActiveCameras=null),e&&(this._unObserveActiveCameras=tJ(e,()=>{this.onActiveCamerasChanged.notifyObservers(this)})),this._activeCameras=e}get activeCamera(){return this._activeCamera}set activeCamera(e){e!==this._activeCamera&&(this._activeCamera=e,this.onActiveCameraChanged.notifyObservers(this))}get defaultMaterial(){return this._defaultMaterial||(this._defaultMaterial=sY.DefaultMaterialFactory(this)),this._defaultMaterial}set defaultMaterial(e){this._defaultMaterial=e}set texturesEnabled(e){this._texturesEnabled!==e&&(this._texturesEnabled=e,this.markAllMaterialsAsDirty(1))}get texturesEnabled(){return this._texturesEnabled}set skeletonsEnabled(e){this._skeletonsEnabled!==e&&(this._skeletonsEnabled=e,this.markAllMaterialsAsDirty(8))}get skeletonsEnabled(){return this._skeletonsEnabled}get collisionCoordinator(){return this._collisionCoordinator||(this._collisionCoordinator=sY.CollisionCoordinatorFactory(),this._collisionCoordinator.init(this)),this._collisionCoordinator}get renderingManager(){return this._renderingManager}get frustumPlanes(){return this._frustumPlanes}_registerTransientComponents(){if(this._transientComponents.length>0){for(let e of this._transientComponents)e.register();this._transientComponents.length=0}}_addComponent(e){this._components.push(e),this._transientComponents.push(e),e.addFromContainer&&e.serialize&&this._serializableComponents.push(e)}_getComponent(e){for(let t of this._components)if(t.name===e)return t;return null}constructor(e,t){super(),this._inputManager=new sV(this),this.cameraToUseForPointers=null,this._isScene=!0,this._blockEntityCollection=!1,this.autoClear=!0,this.autoClearDepthAndStencil=!0,this.clearColor=new il(.2,.2,.3,1),this.ambientColor=new io(0,0,0),this.environmentIntensity=1,this._performancePriority=y.BackwardCompatible,this.onScenePerformancePriorityChangedObservable=new tj,this._forceWireframe=!1,this._skipFrustumClipping=!1,this._forcePointsCloud=!1,this.animationsEnabled=!0,this._animationPropertiesOverride=null,this.useConstantAnimationDeltaTime=!1,this.constantlyUpdateMeshUnderPointer=!1,this.hoverCursor="pointer",this.defaultCursor="",this.doNotHandleCursors=!1,this.preventDefaultOnPointerDown=!0,this.preventDefaultOnPointerUp=!0,this.metadata=null,this.reservedDataStore=null,this.disableOfflineSupportExceptionRules=[],this.onDisposeObservable=new tj,this._onDisposeObserver=null,this.onBeforeRenderObservable=new tj,this._onBeforeRenderObserver=null,this.onAfterRenderObservable=new tj,this.onAfterRenderCameraObservable=new tj,this._onAfterRenderObserver=null,this.onBeforeAnimationsObservable=new tj,this.onAfterAnimationsObservable=new tj,this.onBeforeDrawPhaseObservable=new tj,this.onAfterDrawPhaseObservable=new tj,this.onReadyObservable=new tj,this.onBeforeCameraRenderObservable=new tj,this._onBeforeCameraRenderObserver=null,this.onAfterCameraRenderObservable=new tj,this._onAfterCameraRenderObserver=null,this.onBeforeActiveMeshesEvaluationObservable=new tj,this.onAfterActiveMeshesEvaluationObservable=new tj,this.onBeforeParticlesRenderingObservable=new tj,this.onAfterParticlesRenderingObservable=new tj,this.onDataLoadedObservable=new tj,this.onNewCameraAddedObservable=new tj,this.onCameraRemovedObservable=new tj,this.onNewLightAddedObservable=new tj,this.onLightRemovedObservable=new tj,this.onNewGeometryAddedObservable=new tj,this.onGeometryRemovedObservable=new tj,this.onNewTransformNodeAddedObservable=new tj,this.onTransformNodeRemovedObservable=new tj,this.onNewMeshAddedObservable=new tj,this.onMeshRemovedObservable=new tj,this.onNewSkeletonAddedObservable=new tj,this.onSkeletonRemovedObservable=new tj,this.onNewMaterialAddedObservable=new tj,this.onNewMultiMaterialAddedObservable=new tj,this.onMaterialRemovedObservable=new tj,this.onMultiMaterialRemovedObservable=new tj,this.onNewTextureAddedObservable=new tj,this.onTextureRemovedObservable=new tj,this.onBeforeRenderTargetsRenderObservable=new tj,this.onAfterRenderTargetsRenderObservable=new tj,this.onBeforeStepObservable=new tj,this.onAfterStepObservable=new tj,this.onActiveCameraChanged=new tj,this.onActiveCamerasChanged=new tj,this.onBeforeRenderingGroupObservable=new tj,this.onAfterRenderingGroupObservable=new tj,this.onMeshImportedObservable=new tj,this.onAnimationFileImportedObservable=new tj,this._registeredForLateAnimationBindings=new so(256),this._pointerPickingConfiguration=new sX,this.onPrePointerObservable=new tj,this.onPointerObservable=new tj,this.onPreKeyboardObservable=new tj,this.onKeyboardObservable=new tj,this._useRightHandedSystem=!1,this._timeAccumulator=0,this._currentStepId=0,this._currentInternalStep=0,this._fogEnabled=!0,this._fogMode=sY.FOGMODE_NONE,this.fogColor=new io(.2,.2,.3),this.fogDensity=.1,this.fogStart=0,this.fogEnd=1e3,this.needsPreviousWorldMatrices=!1,this._shadowsEnabled=!0,this._lightsEnabled=!0,this._unObserveActiveCameras=null,this._texturesEnabled=!0,this.physicsEnabled=!0,this.particlesEnabled=!0,this.spritesEnabled=!0,this._skeletonsEnabled=!0,this.lensFlaresEnabled=!0,this.collisionsEnabled=!0,this.gravity=new t5(0,-9.807,0),this.postProcessesEnabled=!0,this.renderTargetsEnabled=!0,this.dumpNextRenderTargets=!1,this.customRenderTargets=[],this.importedMeshesFiles=[],this.probesEnabled=!0,this._meshesForIntersections=new so(256),this.proceduralTexturesEnabled=!0,this._totalVertices=new sk,this._activeIndices=new sk,this._activeParticles=new sk,this._activeBones=new sk,this._animationTime=0,this.animationTimeScale=1,this._renderId=0,this._frameId=0,this._executeWhenReadyTimeoutId=null,this._intermediateRendering=!1,this._defaultFrameBufferCleared=!1,this._viewUpdateFlag=-1,this._projectionUpdateFlag=-1,this._toBeDisposed=Array(256),this._activeRequests=[],this._pendingData=[],this._isDisposed=!1,this.dispatchAllSubMeshesOfActiveMeshes=!1,this._activeMeshes=new sa(256),this._processedMaterials=new sa(256),this._renderTargets=new so(256),this._materialsRenderTargets=new so(256),this._activeParticleSystems=new sa(256),this._activeSkeletons=new so(32),this._softwareSkinnedMeshes=new so(32),this._activeAnimatables=[],this._transformMatrix=t7.Zero(),this.requireLightSorting=!1,this._components=[],this._serializableComponents=[],this._transientComponents=[],this._beforeCameraUpdateStage=sE.Create(),this._beforeClearStage=sE.Create(),this._beforeRenderTargetClearStage=sE.Create(),this._gatherRenderTargetsStage=sE.Create(),this._gatherActiveCameraRenderTargetsStage=sE.Create(),this._isReadyForMeshStage=sE.Create(),this._beforeEvaluateActiveMeshStage=sE.Create(),this._evaluateSubMeshStage=sE.Create(),this._preActiveMeshStage=sE.Create(),this._cameraDrawRenderTargetStage=sE.Create(),this._beforeCameraDrawStage=sE.Create(),this._beforeRenderTargetDrawStage=sE.Create(),this._beforeRenderingGroupDrawStage=sE.Create(),this._beforeRenderingMeshStage=sE.Create(),this._afterRenderingMeshStage=sE.Create(),this._afterRenderingGroupDrawStage=sE.Create(),this._afterCameraDrawStage=sE.Create(),this._afterCameraPostProcessStage=sE.Create(),this._afterRenderTargetDrawStage=sE.Create(),this._afterRenderTargetPostProcessStage=sE.Create(),this._afterRenderStage=sE.Create(),this._pointerMoveStage=sE.Create(),this._pointerDownStage=sE.Create(),this._pointerUpStage=sE.Create(),this._geometriesByUniqueId=null,this._defaultMeshCandidates={data:[],length:0},this._defaultSubMeshCandidates={data:[],length:0},this._preventFreeActiveMeshesAndRenderingGroups=!1,this._activeMeshesFrozen=!1,this._activeMeshesFrozenButKeepClipping=!1,this._skipEvaluateActiveMeshesCompletely=!1,this._allowPostProcessClearColor=!0,this.getDeterministicFrameTime=()=>this._engine.getTimeStep(),this._registeredActions=0,this._blockMaterialDirtyMechanism=!1,this._perfCollector=null,this.activeCameras=[];let i=Object.assign({useGeometryUniqueIdsMap:!0,useMaterialMeshMap:!0,useClonedMeshMap:!0,virtual:!1},t);e=this._engine=e||t2.LastCreatedEngine,i.virtual?e._virtualScenes.push(this):(t2._LastCreatedScene=this,e.scenes.push(this)),this._uid=null,this._renderingManager=new sT(this),sg&&(this.postProcessManager=new sg(this)),this._createUbo(),sd&&(this._imageProcessingConfiguration=new sd),this.setDefaultCandidateProviders(),i.useGeometryUniqueIdsMap&&(this._geometriesByUniqueId={}),this.useMaterialMeshMap=i.useMaterialMeshMap,this.useClonedMeshMap=i.useClonedMeshMap,t&&t.virtual||e.onNewSceneAddedObservable.notifyObservers(this)}getClassName(){return"Scene"}_getDefaultMeshCandidates(){return this._defaultMeshCandidates.data=this.meshes,this._defaultMeshCandidates.length=this.meshes.length,this._defaultMeshCandidates}_getDefaultSubMeshCandidates(e){return this._defaultSubMeshCandidates.data=e.subMeshes,this._defaultSubMeshCandidates.length=e.subMeshes.length,this._defaultSubMeshCandidates}setDefaultCandidateProviders(){this.getActiveMeshCandidates=()=>this._getDefaultMeshCandidates(),this.getActiveSubMeshCandidates=e=>this._getDefaultSubMeshCandidates(e),this.getIntersectingSubMeshCandidates=(e,t)=>this._getDefaultSubMeshCandidates(e),this.getCollidingSubMeshCandidates=(e,t)=>this._getDefaultSubMeshCandidates(e)}get meshUnderPointer(){return this._inputManager.meshUnderPointer}get pointerX(){return this._inputManager.pointerX}set pointerX(e){this._inputManager.pointerX=e}get pointerY(){return this._inputManager.pointerY}set pointerY(e){this._inputManager.pointerY=e}getCachedMaterial(){return this._cachedMaterial}getCachedEffect(){return this._cachedEffect}getCachedVisibility(){return this._cachedVisibility}isCachedMaterialInvalid(e,t,i=1){return this._cachedEffect!==t||this._cachedMaterial!==e||this._cachedVisibility!==i}getEngine(){return this._engine}getTotalVertices(){return this._totalVertices.current}get totalVerticesPerfCounter(){return this._totalVertices}getActiveIndices(){return this._activeIndices.current}get totalActiveIndicesPerfCounter(){return this._activeIndices}getActiveParticles(){return this._activeParticles.current}get activeParticlesPerfCounter(){return this._activeParticles}getActiveBones(){return this._activeBones.current}get activeBonesPerfCounter(){return this._activeBones}getActiveMeshes(){return this._activeMeshes}getAnimationRatio(){return void 0!==this._animationRatio?this._animationRatio:1}getRenderId(){return this._renderId}getFrameId(){return this._frameId}incrementRenderId(){this._renderId++}_createUbo(){this.setSceneUniformBuffer(this.createSceneUniformBuffer())}simulatePointerMove(e,t){return this._inputManager.simulatePointerMove(e,t),this}simulatePointerDown(e,t){return this._inputManager.simulatePointerDown(e,t),this}simulatePointerUp(e,t,i){return this._inputManager.simulatePointerUp(e,t,i),this}isPointerCaptured(e=0){return this._inputManager.isPointerCaptured(e)}attachControl(e=!0,t=!0,i=!0){this._inputManager.attachControl(e,t,i)}detachControl(){this._inputManager.detachControl()}isReady(e=!0){var t,i,r;let s;if(this._isDisposed)return!1;let n=this.getEngine(),a=n.currentRenderPassId;n.currentRenderPassId=null!==(i=null===(t=this.activeCamera)||void 0===t?void 0:t.renderPassId)&&void 0!==i?i:a;let o=!0;for(this._pendingData.length>0&&(o=!1),null===(r=this.prePassRenderer)||void 0===r||r.update(),this.useOrderIndependentTransparency&&this.depthPeelingRenderer&&o&&(o=this.depthPeelingRenderer.isReady()),e&&(this._processedMaterials.reset(),this._materialsRenderTargets.reset()),s=0;s0;for(let e of this._isReadyForMeshStage)e.action(t,i)||(o=!1);if(!e)continue;let r=t.material||this.defaultMaterial;if(r){if(r._storeEffectOnSubMeshes)for(let e of t.subMeshes){let t=e.getMaterial();t&&t.hasRenderTargetTextures&&null!=t.getRenderTargetTextures&&-1===this._processedMaterials.indexOf(t)&&(this._processedMaterials.push(t),this._materialsRenderTargets.concatWithNoDuplicate(t.getRenderTargetTextures()))}else r.hasRenderTargetTextures&&null!=r.getRenderTargetTextures&&-1===this._processedMaterials.indexOf(r)&&(this._processedMaterials.push(r),this._materialsRenderTargets.concatWithNoDuplicate(r.getRenderTargetTextures()))}}if(e)for(s=0;s0)for(let e of this.activeCameras)e.isReady(!0)||(o=!1);else this.activeCamera&&!this.activeCamera.isReady(!0)&&(o=!1);for(let e of this.particleSystems)e.isReady()||(o=!1);if(this.layers)for(let e of this.layers)e.isReady()||(o=!1);return n.areAllEffectsReady()||(o=!1),n.currentRenderPassId=a,o}resetCachedMaterial(){this._cachedMaterial=null,this._cachedEffect=null,this._cachedVisibility=null}registerBeforeRender(e){this.onBeforeRenderObservable.add(e)}unregisterBeforeRender(e){this.onBeforeRenderObservable.removeCallback(e)}registerAfterRender(e){this.onAfterRenderObservable.add(e)}unregisterAfterRender(e){this.onAfterRenderObservable.removeCallback(e)}_executeOnceBeforeRender(e){let t=()=>{e(),setTimeout(()=>{this.unregisterBeforeRender(t)})};this.registerBeforeRender(t)}executeOnceBeforeRender(e,t){void 0!==t?setTimeout(()=>{this._executeOnceBeforeRender(e)},t):this._executeOnceBeforeRender(e)}addPendingData(e){this._pendingData.push(e)}removePendingData(e){let t=this.isLoading,i=this._pendingData.indexOf(e);-1!==i&&this._pendingData.splice(i,1),t&&!this.isLoading&&this.onDataLoadedObservable.notifyObservers(this)}getWaitingItemsCount(){return this._pendingData.length}get isLoading(){return this._pendingData.length>0}executeWhenReady(e,t=!1){this.onReadyObservable.addOnce(e),null===this._executeWhenReadyTimeoutId&&this._checkIsReady(t)}whenReadyAsync(e=!1){return new Promise(t=>{this.executeWhenReady(()=>{t()},e)})}_checkIsReady(e=!1){if(this._registerTransientComponents(),this.isReady(e)){this.onReadyObservable.notifyObservers(this),this.onReadyObservable.clear(),this._executeWhenReadyTimeoutId=null;return}if(this._isDisposed){this.onReadyObservable.clear(),this._executeWhenReadyTimeoutId=null;return}this._executeWhenReadyTimeoutId=setTimeout(()=>{this.incrementRenderId(),this._checkIsReady(e)},100)}get animatables(){return this._activeAnimatables}resetLastAnimationTimeFrame(){this._animationTimeLast=ra.Now}getViewMatrix(){return this._viewMatrix}getProjectionMatrix(){return this._projectionMatrix}getTransformMatrix(){return this._transformMatrix}setTransformMatrix(e,t,i,r){i||r||!this._multiviewSceneUbo||(this._multiviewSceneUbo.dispose(),this._multiviewSceneUbo=null),(this._viewUpdateFlag!==e.updateFlag||this._projectionUpdateFlag!==t.updateFlag)&&(this._viewUpdateFlag=e.updateFlag,this._projectionUpdateFlag=t.updateFlag,this._viewMatrix=e,this._projectionMatrix=t,this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._frustumPlanes?sz.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=sz.GetPlanes(this._transformMatrix),this._multiviewSceneUbo&&this._multiviewSceneUbo.useUbo?this._updateMultiviewUbo(i,r):this._sceneUbo.useUbo&&(this._sceneUbo.updateMatrix("viewProjection",this._transformMatrix),this._sceneUbo.updateMatrix("view",this._viewMatrix),this._sceneUbo.updateMatrix("projection",this._projectionMatrix)))}getSceneUniformBuffer(){return this._multiviewSceneUbo?this._multiviewSceneUbo:this._sceneUbo}createSceneUniformBuffer(e){let t=new sp(this._engine,void 0,!1,null!=e?e:"scene");return t.addUniform("viewProjection",16),t.addUniform("view",16),t.addUniform("projection",16),t.addUniform("vEyePosition",4),t}setSceneUniformBuffer(e){this._sceneUbo=e,this._viewUpdateFlag=-1,this._projectionUpdateFlag=-1}getUniqueId(){return sW.UniqueId}addMesh(e,t=!1){!this._blockEntityCollection&&(this.meshes.push(e),e._resyncLightSources(),e.parent||e._addToSceneRootNodes(),this.onNewMeshAddedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach(e=>{this.addMesh(e)}))}removeMesh(e,t=!1){let i=this.meshes.indexOf(e);return -1===i||(this.meshes[i]=this.meshes[this.meshes.length-1],this.meshes.pop(),e.parent||e._removeFromSceneRootNodes()),this._inputManager._invalidateMesh(e),this.onMeshRemovedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach(e=>{this.removeMesh(e)}),i}addTransformNode(e){this._blockEntityCollection||e.getScene()===this&&-1!==e._indexInSceneTransformNodesArray||(e._indexInSceneTransformNodesArray=this.transformNodes.length,this.transformNodes.push(e),e.parent||e._addToSceneRootNodes(),this.onNewTransformNodeAddedObservable.notifyObservers(e))}removeTransformNode(e){let t=e._indexInSceneTransformNodesArray;if(-1!==t){if(t!==this.transformNodes.length-1){let e=this.transformNodes[this.transformNodes.length-1];this.transformNodes[t]=e,e._indexInSceneTransformNodesArray=t}e._indexInSceneTransformNodesArray=-1,this.transformNodes.pop(),e.parent||e._removeFromSceneRootNodes()}return this.onTransformNodeRemovedObservable.notifyObservers(e),t}removeSkeleton(e){let t=this.skeletons.indexOf(e);return -1!==t&&(this.skeletons.splice(t,1),this.onSkeletonRemovedObservable.notifyObservers(e),this._executeActiveContainerCleanup(this._activeSkeletons)),t}removeMorphTargetManager(e){let t=this.morphTargetManagers.indexOf(e);return -1!==t&&this.morphTargetManagers.splice(t,1),t}removeLight(e){let t=this.lights.indexOf(e);if(-1!==t){for(let t of this.meshes)t._removeLightSource(e,!1);this.lights.splice(t,1),this.sortLightsByPriority(),e.parent||e._removeFromSceneRootNodes()}return this.onLightRemovedObservable.notifyObservers(e),t}removeCamera(e){let t=this.cameras.indexOf(e);if(-1===t||(this.cameras.splice(t,1),e.parent||e._removeFromSceneRootNodes()),this.activeCameras){let t=this.activeCameras.indexOf(e);-1!==t&&this.activeCameras.splice(t,1)}return this.activeCamera===e&&(this.cameras.length>0?this.activeCamera=this.cameras[0]:this.activeCamera=null),this.onCameraRemovedObservable.notifyObservers(e),t}removeParticleSystem(e){let t=this.particleSystems.indexOf(e);return -1!==t&&(this.particleSystems.splice(t,1),this._executeActiveContainerCleanup(this._activeParticleSystems)),t}removeAnimation(e){let t=this.animations.indexOf(e);return -1!==t&&this.animations.splice(t,1),t}stopAnimation(e,t,i){}removeAnimationGroup(e){let t=this.animationGroups.indexOf(e);return -1!==t&&this.animationGroups.splice(t,1),t}removeMultiMaterial(e){let t=this.multiMaterials.indexOf(e);return -1!==t&&this.multiMaterials.splice(t,1),this.onMultiMaterialRemovedObservable.notifyObservers(e),t}removeMaterial(e){let t=e._indexInSceneMaterialArray;if(-1!==t&&tt.uniqueId===e)}getMaterialById(e,t=!1){return this._getMaterial(t,t=>t.id===e)}getMaterialByName(e,t=!1){return this._getMaterial(t,t=>t.name===e)}getLastMaterialById(e,t=!1){for(let t=this.materials.length-1;t>=0;t--)if(this.materials[t].id===e)return this.materials[t];if(t){for(let t=this.multiMaterials.length-1;t>=0;t--)if(this.multiMaterials[t].id===e)return this.multiMaterials[t]}return null}getTextureByUniqueId(e){for(let t=0;t=0;t--)if(this.meshes[t].id===e)return this.meshes[t];return null}getLastTransformNodeById(e){for(let t=this.transformNodes.length-1;t>=0;t--)if(this.transformNodes[t].id===e)return this.transformNodes[t];return null}getLastEntryById(e){let t;for(t=this.meshes.length-1;t>=0;t--)if(this.meshes[t].id===e)return this.meshes[t];for(t=this.transformNodes.length-1;t>=0;t--)if(this.transformNodes[t].id===e)return this.transformNodes[t];for(t=this.cameras.length-1;t>=0;t--)if(this.cameras[t].id===e)return this.cameras[t];for(t=this.lights.length-1;t>=0;t--)if(this.lights[t].id===e)return this.lights[t];return null}getNodeById(e){let t=this.getMeshById(e);if(t)return t;let i=this.getTransformNodeById(e);if(i)return i;let r=this.getLightById(e);if(r)return r;let s=this.getCameraById(e);return s?s:this.getBoneById(e)||null}getNodeByName(e){let t=this.getMeshByName(e);if(t)return t;let i=this.getTransformNodeByName(e);if(i)return i;let r=this.getLightByName(e);if(r)return r;let s=this.getCameraByName(e);return s?s:this.getBoneByName(e)||null}getMeshByName(e){for(let t=0;t=0;t--)if(this.skeletons[t].id===e)return this.skeletons[t];return null}getSkeletonByUniqueId(e){for(let t=0;t{if(!this.activeCamera){i&&i("No active camera found");return}if(this._frustumPlanes||this.updateTransformMatrix(),this._evaluateActiveMeshes(),this._activeMeshesFrozen=!0,this._activeMeshesFrozenButKeepClipping=s,this._skipEvaluateActiveMeshesCompletely=e,r)for(let e=0;ee.dispose())}_evaluateActiveMeshes(){var e;if(this._engine.snapshotRendering&&1===this._engine.snapshotRenderingMode){this._activeMeshes.length>0&&(null===(e=this.activeCamera)||void 0===e||e._activeMeshes.reset(),this._activeMeshes.reset(),this._renderingManager.reset(),this._processedMaterials.reset(),this._activeParticleSystems.reset(),this._activeSkeletons.reset(),this._softwareSkinnedMeshes.reset());return}if(this._activeMeshesFrozen&&this._activeMeshes.length){if(!this._skipEvaluateActiveMeshesCompletely){let e=this._activeMeshes.length;for(let t=0;t0&&(i.layerMask&this.activeCamera.layerMask)!=0&&(this._skipFrustumClipping||i.alwaysSelectAsActiveMesh||i.isInFrustum(this._frustumPlanes)))){for(let e of(this._activeMeshes.push(i),this.activeCamera._activeMeshes.push(i),r!==i&&r._activate(this._renderId,!1),this._preActiveMeshStage))e.action(i);i._activate(this._renderId,!1)&&(i.isAnInstance?i._internalAbstractMeshDataInfo._actAsRegularMesh&&(r=i):r._internalAbstractMeshDataInfo._onlyForInstances=!1,r._internalAbstractMeshDataInfo._isActive=!0,this._activeMesh(i,r)),i._postActivate()}}if(this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this),this.particlesEnabled){this.onBeforeParticlesRenderingObservable.notifyObservers(this);for(let e=0;e0){let r=this.getActiveSubMeshCandidates(t),s=r.length;i=i||1===s;for(let n=0;n0&&this._renderTargets.concatWithNoDuplicate(e.customRenderTargets),t&&t.customRenderTargets&&t.customRenderTargets.length>0&&this._renderTargets.concatWithNoDuplicate(t.customRenderTargets),this.environmentTexture&&this.environmentTexture.isRenderTarget&&this._renderTargets.pushNoDuplicate(this.environmentTexture),this._gatherActiveCameraRenderTargetsStage))i.action(this._renderTargets);let o=!1;if(this.renderTargetsEnabled){if(this._intermediateRendering=!0,this._renderTargets.length>0){ss.StartPerformanceCounter("Render targets",this._renderTargets.length>0);for(let e=0;e0),this._renderId++}for(let e of this._cameraDrawRenderTargetStage)o=e.action(this.activeCamera)||o;this._intermediateRendering=!1}for(let t of(this._engine.currentRenderPassId=null!==(n=null!==(s=null===(r=e.outputRenderTarget)||void 0===r?void 0:r.renderPassId)&&void 0!==s?s:e.renderPassId)&&void 0!==n?n:0,o&&!this.prePass&&(this._bindFrameBuffer(this._activeCamera,!1),this.updateTransformMatrix()),this.onAfterRenderTargetsRenderObservable.notifyObservers(this),!this.postProcessManager||e._multiviewTexture||this.prePass||this.postProcessManager._prepareFrame(),this._beforeCameraDrawStage))t.action(this.activeCamera);for(let e of(this.onBeforeDrawPhaseObservable.notifyObservers(this),a.snapshotRendering&&1===a.snapshotRenderingMode&&this.finalizeSceneUbo(),this._renderingManager.render(null,null,!0,!0),this.onAfterDrawPhaseObservable.notifyObservers(this),this._afterCameraDrawStage))e.action(this.activeCamera);if(this.postProcessManager&&!e._multiviewTexture){let t=e.outputRenderTarget?e.outputRenderTarget.renderTarget:void 0;this.postProcessManager._finalizeFrame(e.isIntermediate,t)}for(let e of this._afterCameraPostProcessStage)e.action(this.activeCamera);this._renderTargets.reset(),this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera)}_processSubCameras(e,t=!0){if(0===e.cameraRigMode||e._renderingMultiview){e._renderingMultiview&&!this._multiviewSceneUbo&&this._createMultiviewUbo(),this._renderForCamera(e,void 0,t),this.onAfterRenderCameraObservable.notifyObservers(e);return}if(e._useMultiviewToSingleView)this._renderMultiviewToSingleView(e);else{this.onBeforeCameraRenderObservable.notifyObservers(e);for(let t=0;t-1)||(13===i.trigger&&i._executeCurrent(ic.CreateNew(t,void 0,r)),t.actionManager.hasSpecificTrigger(13,e=>r===(e.mesh?e.mesh:e))&&13!==i.trigger||t._intersectionsInProgress.splice(n,1))}}}}_advancePhysicsEngineStep(e){}_animate(){}animate(){if(this._engine.isDeterministicLockStep()){let e=Math.max(sY.MinDeltaTime,Math.min(this._engine.getDeltaTime(),sY.MaxDeltaTime))+this._timeAccumulator,t=this._engine.getTimeStep(),i=1e3/t/1e3,r=0,s=this._engine.getLockstepMaxSteps(),n=Math.floor(e/t);for(n=Math.min(n,s);e>0&&r0)for(let e=0;e0),this._intermediateRendering=!0;for(let e=0;e0),this._intermediateRendering=!1,this._renderId++}for(let e of(this._engine.currentRenderPassId=null!==(s=null==a?void 0:a.renderPassId)&&void 0!==s?s:0,this.activeCamera=a,this._activeCamera&&22!==this._activeCamera.cameraRigMode&&!this.prePass&&this._bindFrameBuffer(this._activeCamera,!1),this.onAfterRenderTargetsRenderObservable.notifyObservers(this),this._beforeClearStage))e.action();for(let e of(this._clearFrameBuffer(this.activeCamera),this._gatherRenderTargetsStage))e.action(this._renderTargets);if(this.activeCameras&&this.activeCameras.length>0)for(let e=0;e0);else{if(!this.activeCamera)throw Error("No camera defined");this._processSubCameras(this.activeCamera,!!this.activeCamera.outputRenderTarget)}for(let e of(this._checkIntersections(),this._afterRenderStage))e.action();if(this.afterRender&&this.afterRender(),this.onAfterRenderObservable.notifyObservers(this),this._toBeDisposed.length){for(let e=0;e{e.onAnimationEndObservable.clear(),e.onAnimationEnd=null}),this.stopAllAnimations()),this.resetCachedMaterial(),this.activeCamera&&(this.activeCamera._activeMeshes.dispose(),this.activeCamera=null),this.activeCameras=null,this._activeMeshes.dispose(),this._renderingManager.dispose(),this._processedMaterials.dispose(),this._activeParticleSystems.dispose(),this._activeSkeletons.dispose(),this._softwareSkinnedMeshes.dispose(),this._renderTargets.dispose(),this._materialsRenderTargets.dispose(),this._registeredForLateAnimationBindings.dispose(),this._meshesForIntersections.dispose(),this._toBeDisposed.length=0,this._activeRequests.slice()))e.abort();this._activeRequests.length=0;try{this.onDisposeObservable.notifyObservers(this)}catch(e){ig.Error("An error occurred while calling onDisposeObservable!",e)}if(this.detachControl(),this._engine.getInputElement())for(let e=0;ee.dispose(!0)),this._disposeList(this.transformNodes,e=>e.dispose(!0));let e=this.cameras;this._disposeList(e),this._defaultMaterial&&this._defaultMaterial.dispose(),this._disposeList(this.multiMaterials),this._disposeList(this.materials),this._disposeList(this.particleSystems),this._disposeList(this.postProcesses),this._disposeList(this.textures),this._disposeList(this.morphTargetManagers),this._sceneUbo.dispose(),this._multiviewSceneUbo&&this._multiviewSceneUbo.dispose(),this.postProcessManager.dispose(),this._disposeList(this._components);let t=this._engine.scenes.indexOf(this);t>-1&&this._engine.scenes.splice(t,1),t2._LastCreatedScene===this&&(this._engine.scenes.length>0?t2._LastCreatedScene=this._engine.scenes[this._engine.scenes.length-1]:t2._LastCreatedScene=null),(t=this._engine._virtualScenes.indexOf(this))>-1&&this._engine._virtualScenes.splice(t,1),this._engine.wipeCaches(!0),this.onDisposeObservable.clear(),this.onBeforeRenderObservable.clear(),this.onAfterRenderObservable.clear(),this.onBeforeRenderTargetsRenderObservable.clear(),this.onAfterRenderTargetsRenderObservable.clear(),this.onAfterStepObservable.clear(),this.onBeforeStepObservable.clear(),this.onBeforeActiveMeshesEvaluationObservable.clear(),this.onAfterActiveMeshesEvaluationObservable.clear(),this.onBeforeParticlesRenderingObservable.clear(),this.onAfterParticlesRenderingObservable.clear(),this.onBeforeDrawPhaseObservable.clear(),this.onAfterDrawPhaseObservable.clear(),this.onBeforeAnimationsObservable.clear(),this.onAfterAnimationsObservable.clear(),this.onDataLoadedObservable.clear(),this.onBeforeRenderingGroupObservable.clear(),this.onAfterRenderingGroupObservable.clear(),this.onMeshImportedObservable.clear(),this.onBeforeCameraRenderObservable.clear(),this.onAfterCameraRenderObservable.clear(),this.onAfterRenderCameraObservable.clear(),this.onReadyObservable.clear(),this.onNewCameraAddedObservable.clear(),this.onCameraRemovedObservable.clear(),this.onNewLightAddedObservable.clear(),this.onLightRemovedObservable.clear(),this.onNewGeometryAddedObservable.clear(),this.onGeometryRemovedObservable.clear(),this.onNewTransformNodeAddedObservable.clear(),this.onTransformNodeRemovedObservable.clear(),this.onNewMeshAddedObservable.clear(),this.onMeshRemovedObservable.clear(),this.onNewSkeletonAddedObservable.clear(),this.onSkeletonRemovedObservable.clear(),this.onNewMaterialAddedObservable.clear(),this.onNewMultiMaterialAddedObservable.clear(),this.onMaterialRemovedObservable.clear(),this.onMultiMaterialRemovedObservable.clear(),this.onNewTextureAddedObservable.clear(),this.onTextureRemovedObservable.clear(),this.onPrePointerObservable.clear(),this.onPointerObservable.clear(),this.onPreKeyboardObservable.clear(),this.onKeyboardObservable.clear(),this.onActiveCameraChanged.clear(),this.onScenePerformancePriorityChangedObservable.clear(),this._isDisposed=!0}_disposeList(e,t){let i=e.slice(0);for(let e of(t=null!=t?t:e=>e.dispose(),i))t(e);e.length=0}get isDisposed(){return this._isDisposed}clearCachedVertexData(){for(let e=0;e!0),this.meshes.filter(e).forEach(e=>{if(e.computeWorldMatrix(!0),!e.subMeshes||0===e.subMeshes.length||e.infiniteDistance)return;let r=e.getBoundingInfo(),s=r.boundingBox.minimumWorld,n=r.boundingBox.maximumWorld;t5.CheckExtends(s,t,i),t5.CheckExtends(n,t,i)}),{min:t,max:i}}createPickingRay(e,t,i,r,s=!1){throw iL("Ray")}createPickingRayToRef(e,t,i,r,s,n=!1,a=!1){throw iL("Ray")}createPickingRayInCameraSpace(e,t,i){throw iL("Ray")}createPickingRayInCameraSpaceToRef(e,t,i,r){throw iL("Ray")}get _pickingAvailable(){return!1}pick(e,t,i,r,s,n){let a=iL("Ray",!0);return a&&ig.Warn(a),new sm}pickWithBoundingInfo(e,t,i,r,s){let n=iL("Ray",!0);return n&&ig.Warn(n),new sm}pickWithRay(e,t,i,r){throw iL("Ray")}multiPick(e,t,i,r,s){throw iL("Ray")}multiPickWithRay(e,t,i){throw iL("Ray")}setPointerOverMesh(e,t,i){this._inputManager.setPointerOverMesh(e,t,i)}getPointerOverMesh(){return this._inputManager.getPointerOverMesh()}_rebuildGeometries(){for(let e of this.geometries)e._rebuild();for(let e of this.meshes)e._rebuild();for(let e of(this.postProcessManager&&this.postProcessManager._rebuild(),this._components))e.rebuild();for(let e of this.particleSystems)e.rebuild();if(this.spriteManagers)for(let e of this.spriteManagers)e.rebuild()}_rebuildTextures(){for(let e of this.textures)e._rebuild();this.markAllMaterialsAsDirty(1)}_getByTags(e,t,i){if(void 0===t)return e;let r=[];for(let s in e){let n=e[s];iF&&iF.MatchesQuery(n,t)&&(!i||i(n))&&r.push(n)}return r}getMeshesByTags(e,t){return this._getByTags(this.meshes,e,t)}getCamerasByTags(e,t){return this._getByTags(this.cameras,e,t)}getLightsByTags(e,t){return this._getByTags(this.lights,e,t)}getMaterialByTags(e,t){return this._getByTags(this.materials,e,t).concat(this._getByTags(this.multiMaterials,e,t))}getTransformNodesByTags(e,t){return this._getByTags(this.transformNodes,e,t)}setRenderingOrder(e,t=null,i=null,r=null){this._renderingManager.setRenderingOrder(e,t,i,r)}setRenderingAutoClearDepthStencil(e,t,i=!0,r=!0){this._renderingManager.setRenderingAutoClearDepthStencil(e,t,i,r)}getAutoClearDepthStencilSetup(e){return this._renderingManager.getAutoClearDepthStencilSetup(e)}_forceBlockMaterialDirtyMechanism(e){this._blockMaterialDirtyMechanism=e}get blockMaterialDirtyMechanism(){return this._blockMaterialDirtyMechanism}set blockMaterialDirtyMechanism(e){this._blockMaterialDirtyMechanism!==e&&(this._blockMaterialDirtyMechanism=e,e||this.markAllMaterialsAsDirty(63))}markAllMaterialsAsDirty(e,t){if(!this._blockMaterialDirtyMechanism)for(let i of this.materials)(!t||t(i))&&i.markAsDirty(e)}_loadFile(e,t,i,r,s,n,a){let o=r6(e,t,i,r?this.offlineProvider:void 0,s,n,a);return this._activeRequests.push(o),o.onCompleteObservable.add(e=>{this._activeRequests.splice(this._activeRequests.indexOf(e),1)}),o}_loadFileAsync(e,t,i,r,s){return new Promise((n,a)=>{this._loadFile(e,e=>{n(e)},t,i,r,(e,t)=>{a(t)},s)})}_requestFile(e,t,i,r,s,n,a){let o=r8(e,t,i,r?this.offlineProvider:void 0,s,n,a);return this._activeRequests.push(o),o.onCompleteObservable.add(e=>{this._activeRequests.splice(this._activeRequests.indexOf(e),1)}),o}_requestFileAsync(e,t,i,r,s){return new Promise((n,a)=>{this._requestFile(e,e=>{n(e)},t,i,r,e=>{a(e)},s)})}_readFile(e,t,i,r,s){let n=r5(e,t,i,r,s);return this._activeRequests.push(n),n.onCompleteObservable.add(e=>{this._activeRequests.splice(this._activeRequests.indexOf(e),1)}),n}_readFileAsync(e,t,i){return new Promise((r,s)=>{this._readFile(e,e=>{r(e)},t,i,e=>{s(e)})})}getPerfCollector(){throw iL("performanceViewerSceneExtension")}setActiveCameraByID(e){return this.setActiveCameraById(e)}getMaterialByID(e){return this.getMaterialById(e)}getLastMaterialByID(e){return this.getLastMaterialById(e)}getTextureByUniqueID(e){return this.getTextureByUniqueId(e)}getCameraByID(e){return this.getCameraById(e)}getCameraByUniqueID(e){return this.getCameraByUniqueId(e)}getBoneByID(e){return this.getBoneById(e)}getLightByID(e){return this.getLightById(e)}getLightByUniqueID(e){return this.getLightByUniqueId(e)}getParticleSystemByID(e){return this.getParticleSystemById(e)}getGeometryByID(e){return this.getGeometryById(e)}getMeshByID(e){return this.getMeshById(e)}getMeshByUniqueID(e){return this.getMeshByUniqueId(e)}getLastMeshByID(e){return this.getLastMeshById(e)}getMeshesByID(e){return this.getMeshesById(e)}getTransformNodeByID(e){return this.getTransformNodeById(e)}getTransformNodeByUniqueID(e){return this.getTransformNodeByUniqueId(e)}getTransformNodesByID(e){return this.getTransformNodesById(e)}getNodeByID(e){return this.getNodeById(e)}getLastEntryByID(e){return this.getLastEntryById(e)}getLastSkeletonByID(e){return this.getLastSkeletonById(e)}}sY.FOGMODE_NONE=0,sY.FOGMODE_EXP=1,sY.FOGMODE_EXP2=2,sY.FOGMODE_LINEAR=3,sY.MinDeltaTime=1,sY.MaxDeltaTime=1e3,function(e){e[e.LOCAL=0]="LOCAL",e[e.WORLD=1]="WORLD",e[e.BONE=2]="BONE"}(A||(A={}));class sj{}sj.X=new t5(1,0,0),sj.Y=new t5(0,1,0),sj.Z=new t5(0,0,1),function(e){e[e.X=0]="X",e[e.Y=1]="Y",e[e.Z=2]="Z"}(R||(R={}));class sK extends i0{get _matrix(){return this._compose(),this._localMatrix}set _matrix(e){(e.updateFlag!==this._localMatrix.updateFlag||this._needToCompose)&&(this._needToCompose=!1,this._localMatrix.copyFrom(e),this._markAsDirtyAndDecompose())}constructor(e,t,i=null,r=null,s=null,n=null,a=null){var o;super(e,t.getScene()),this.name=e,this.children=[],this.animations=[],this._index=null,this._scalingDeterminant=1,this._needToDecompose=!0,this._needToCompose=!1,this._linkedTransformNode=null,this._waitingTransformNodeId=null,this._skeleton=t,this._localMatrix=null!==(o=null==r?void 0:r.clone())&&void 0!==o?o:t7.Identity(),this._restMatrix=null!=s?s:this._localMatrix.clone(),this._bindMatrix=null!=n?n:this._localMatrix.clone(),this._index=a,this._absoluteMatrix=new t7,this._absoluteBindMatrix=new t7,this._absoluteInverseBindMatrix=new t7,this._finalMatrix=new t7,t.bones.push(this),this.setParent(i,!1),this._updateAbsoluteBindMatrices()}getClassName(){return"Bone"}getSkeleton(){return this._skeleton}get parent(){return this._parentNode}getParent(){return this.parent}getChildren(){return this.children}getIndex(){return null===this._index?this.getSkeleton().bones.indexOf(this):this._index}set parent(e){this.setParent(e)}setParent(e,t=!0){if(this.parent!==e){if(this.parent){let e=this.parent.children.indexOf(this);-1!==e&&this.parent.children.splice(e,1)}this._parentNode=e,this.parent&&this.parent.children.push(this),t&&this._updateAbsoluteBindMatrices(),this.markAsDirty()}}getLocalMatrix(){return this._compose(),this._localMatrix}getBindMatrix(){return this._bindMatrix}getBaseMatrix(){return this.getBindMatrix()}getRestMatrix(){return this._restMatrix}getRestPose(){return this.getRestMatrix()}setRestMatrix(e){this._restMatrix.copyFrom(e)}setRestPose(e){this.setRestMatrix(e)}getBindPose(){return this.getBindMatrix()}setBindMatrix(e){this.updateMatrix(e)}setBindPose(e){this.setBindMatrix(e)}getFinalMatrix(){return this._finalMatrix}getWorldMatrix(){return this.getFinalMatrix()}returnToRest(){var e;if(this._linkedTransformNode){let t=ie.Vector3[0],i=ie.Quaternion[0],r=ie.Vector3[1];this.getRestMatrix().decompose(t,i,r),this._linkedTransformNode.position.copyFrom(r),this._linkedTransformNode.rotationQuaternion=null!==(e=this._linkedTransformNode.rotationQuaternion)&&void 0!==e?e:t8.Identity(),this._linkedTransformNode.rotationQuaternion.copyFrom(i),this._linkedTransformNode.scaling.copyFrom(t)}else this._matrix=this._restMatrix}getAbsoluteInverseBindMatrix(){return this._absoluteInverseBindMatrix}getInvertedAbsoluteTransform(){return this.getAbsoluteInverseBindMatrix()}getAbsoluteMatrix(){return this._absoluteMatrix}getAbsoluteTransform(){return this._absoluteMatrix}linkTransformNode(e){this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode--,this._linkedTransformNode=e,this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode++}getTransformNode(){return this._linkedTransformNode}get position(){return this._decompose(),this._localPosition}set position(e){this._decompose(),this._localPosition.copyFrom(e),this._markAsDirtyAndCompose()}get rotation(){return this.getRotation()}set rotation(e){this.setRotation(e)}get rotationQuaternion(){return this._decompose(),this._localRotation}set rotationQuaternion(e){this.setRotationQuaternion(e)}get scaling(){return this.getScale()}set scaling(e){this.setScale(e)}get animationPropertiesOverride(){return this._skeleton.animationPropertiesOverride}_decompose(){this._needToDecompose&&(this._needToDecompose=!1,this._localScaling||(this._localScaling=t5.Zero(),this._localRotation=t8.Zero(),this._localPosition=t5.Zero()),this._localMatrix.decompose(this._localScaling,this._localRotation,this._localPosition))}_compose(){if(this._needToCompose){if(!this._localScaling){this._needToCompose=!1;return}this._needToCompose=!1,t7.ComposeToRef(this._localScaling,this._localRotation,this._localPosition,this._localMatrix)}}updateMatrix(e,t=!0,i=!0){this._bindMatrix.copyFrom(e),t&&this._updateAbsoluteBindMatrices(),i?this._matrix=e:this.markAsDirty()}_updateAbsoluteBindMatrices(e,t=!0){if(e||(e=this._bindMatrix),this.parent?e.multiplyToRef(this.parent._absoluteBindMatrix,this._absoluteBindMatrix):this._absoluteBindMatrix.copyFrom(e),this._absoluteBindMatrix.invertToRef(this._absoluteInverseBindMatrix),t)for(let e=0;ethis._absoluteBindMatrix.determinant()?-1:1}markAsDirty(){return this._currentRenderId++,this._childUpdateId++,this._skeleton._markAsDirty(),this}_markAsDirtyAndCompose(){this.markAsDirty(),this._needToCompose=!0}_markAsDirtyAndDecompose(){this.markAsDirty(),this._needToDecompose=!0}_updatePosition(e,t=A.LOCAL,i,r=!0){let s=this.getLocalMatrix();if(t==A.LOCAL)r?(s.addAtIndex(12,e.x),s.addAtIndex(13,e.y),s.addAtIndex(14,e.z)):s.setTranslationFromFloats(e.x,e.y,e.z);else{let t=null;i&&(t=i.getWorldMatrix()),this._skeleton.computeAbsoluteMatrices();let n=sK._TmpMats[0],a=sK._TmpVecs[0];this.parent?i&&t?(n.copyFrom(this.parent.getAbsoluteMatrix()),n.multiplyToRef(t,n)):n.copyFrom(this.parent.getAbsoluteMatrix()):t7.IdentityToRef(n),r&&n.setTranslationFromFloats(0,0,0),n.invert(),t5.TransformCoordinatesToRef(e,n,a),r?(s.addAtIndex(12,a.x),s.addAtIndex(13,a.y),s.addAtIndex(14,a.z)):s.setTranslationFromFloats(a.x,a.y,a.z)}this._markAsDirtyAndDecompose()}translate(e,t=A.LOCAL,i){this._updatePosition(e,t,i,!0)}setPosition(e,t=A.LOCAL,i){this._updatePosition(e,t,i,!1)}setAbsolutePosition(e,t){this.setPosition(e,A.WORLD,t)}scale(e,t,i,r=!1){let s=this.getLocalMatrix(),n=sK._TmpMats[0];for(let r of(t7.ScalingToRef(e,t,i,n),n.multiplyToRef(s,s),n.invert(),this.children)){let s=r.getLocalMatrix();s.multiplyToRef(n,s),s.multiplyAtIndex(12,e),s.multiplyAtIndex(13,t),s.multiplyAtIndex(14,i),r._markAsDirtyAndDecompose()}if(this._markAsDirtyAndDecompose(),r)for(let s of this.children)s.scale(e,t,i,r)}setScale(e){this._decompose(),this._localScaling.copyFrom(e),this._markAsDirtyAndCompose()}getScale(){return this._decompose(),this._localScaling}getScaleToRef(e){this._decompose(),e.copyFrom(this._localScaling)}setYawPitchRoll(e,t,i,r=A.LOCAL,s){if(r===A.LOCAL){let n=sK._TmpQuat;t8.RotationYawPitchRollToRef(e,t,i,n),this.setRotationQuaternion(n,r,s);return}let n=sK._TmpMats[0];if(!this._getAbsoluteInverseMatrixUnscaledToRef(n,s))return;let a=sK._TmpMats[1];t7.RotationYawPitchRollToRef(e,t,i,a),n.multiplyToRef(a,a),this._rotateWithMatrix(a,r,s)}rotate(e,t,i=A.LOCAL,r){let s=sK._TmpMats[0];s.setTranslationFromFloats(0,0,0),t7.RotationAxisToRef(e,t,s),this._rotateWithMatrix(s,i,r)}setAxisAngle(e,t,i=A.LOCAL,r){if(i===A.LOCAL){let s=sK._TmpQuat;t8.RotationAxisToRef(e,t,s),this.setRotationQuaternion(s,i,r);return}let s=sK._TmpMats[0];if(!this._getAbsoluteInverseMatrixUnscaledToRef(s,r))return;let n=sK._TmpMats[1];t7.RotationAxisToRef(e,t,n),s.multiplyToRef(n,n),this._rotateWithMatrix(n,i,r)}setRotation(e,t=A.LOCAL,i){this.setYawPitchRoll(e.y,e.x,e.z,t,i)}setRotationQuaternion(e,t=A.LOCAL,i){if(t===A.LOCAL){this._decompose(),this._localRotation.copyFrom(e),this._markAsDirtyAndCompose();return}let r=sK._TmpMats[0];if(!this._getAbsoluteInverseMatrixUnscaledToRef(r,i))return;let s=sK._TmpMats[1];t7.FromQuaternionToRef(e,s),r.multiplyToRef(s,s),this._rotateWithMatrix(s,t,i)}setRotationMatrix(e,t=A.LOCAL,i){if(t===A.LOCAL){let r=sK._TmpQuat;t8.FromRotationMatrixToRef(e,r),this.setRotationQuaternion(r,t,i);return}let r=sK._TmpMats[0];if(!this._getAbsoluteInverseMatrixUnscaledToRef(r,i))return;let s=sK._TmpMats[1];s.copyFrom(e),r.multiplyToRef(e,s),this._rotateWithMatrix(s,t,i)}_rotateWithMatrix(e,t=A.LOCAL,i){let r=this.getLocalMatrix(),s=r.m[12],n=r.m[13],a=r.m[14],o=this.getParent(),l=sK._TmpMats[3],h=sK._TmpMats[4];o&&t==A.WORLD?(i?(l.copyFrom(i.getWorldMatrix()),o.getAbsoluteMatrix().multiplyToRef(l,l)):l.copyFrom(o.getAbsoluteMatrix()),h.copyFrom(l),h.invert(),r.multiplyToRef(l,r),r.multiplyToRef(e,r),r.multiplyToRef(h,r)):t==A.WORLD&&i?(l.copyFrom(i.getWorldMatrix()),h.copyFrom(l),h.invert(),r.multiplyToRef(l,r),r.multiplyToRef(e,r),r.multiplyToRef(h,r)):r.multiplyToRef(e,r),r.setTranslationFromFloats(s,n,a),this.computeAbsoluteMatrices(),this._markAsDirtyAndDecompose()}_getAbsoluteInverseMatrixUnscaledToRef(e,t){let i=sK._TmpMats[2];return e.copyFrom(this.getAbsoluteMatrix()),t?(e.multiplyToRef(t.getWorldMatrix(),e),t7.ScalingToRef(t.scaling.x,t.scaling.y,t.scaling.z,i)):t7.IdentityToRef(i),e.invert(),!isNaN(e.m[0])&&(i.multiplyAtIndex(0,this._scalingDeterminant),e.multiplyToRef(i,e),!0)}getPosition(e=A.LOCAL,t=null){let i=t5.Zero();return this.getPositionToRef(e,t,i),i}getPositionToRef(e=A.LOCAL,t,i){if(e==A.LOCAL){let e=this.getLocalMatrix();i.x=e.m[12],i.y=e.m[13],i.z=e.m[14]}else{let e=null;t&&(e=t.getWorldMatrix()),this._skeleton.computeAbsoluteMatrices();let r=sK._TmpMats[0];t&&e?(r.copyFrom(this.getAbsoluteMatrix()),r.multiplyToRef(e,r)):r=this.getAbsoluteMatrix(),i.x=r.m[12],i.y=r.m[13],i.z=r.m[14]}}getAbsolutePosition(e=null){let t=t5.Zero();return this.getPositionToRef(A.WORLD,e,t),t}getAbsolutePositionToRef(e,t){this.getPositionToRef(A.WORLD,e,t)}computeAbsoluteMatrices(){if(this._compose(),this.parent)this._localMatrix.multiplyToRef(this.parent._absoluteMatrix,this._absoluteMatrix);else{this._absoluteMatrix.copyFrom(this._localMatrix);let e=this._skeleton.getPoseMatrix();e&&this._absoluteMatrix.multiplyToRef(e,this._absoluteMatrix)}let e=this.children,t=e.length;for(let i=0;i-1&&(this._scene._activeAnimatables.splice(e,1),this._scene._activeAnimatables.push(this))}return this}getAnimations(){return this._runtimeAnimations}appendAnimations(e,t){for(let i=0;i{this.onAnimationLoopObservable.notifyObservers(this),this.onAnimationLoop&&this.onAnimationLoop()},this._runtimeAnimations.push(r)}}getAnimationByTargetProperty(e){let t=this._runtimeAnimations;for(let i=0;i-1){let s=this._runtimeAnimations;for(let i=s.length-1;i>=0;i--){let r=s[i];(!e||r.animation.name==e)&&(!t||t(r.target))&&(r.dispose(),s.splice(i,1))}0==s.length&&(i||this._scene._activeAnimatables.splice(r,1),this._raiseOnAnimationEnd())}}else{let e=this._scene._activeAnimatables.indexOf(this);if(e>-1){i||this._scene._activeAnimatables.splice(e,1);let t=this._runtimeAnimations;for(let e=0;e{this.onAnimationEndObservable.add(()=>{e(this)},void 0,void 0,this,!0)})}_animate(e){let t;if(this._paused)return this.animationStarted=!1,null===this._pausedDelay&&(this._pausedDelay=e),!0;if(null===this._localDelayOffset?(this._localDelayOffset=e,this._pausedDelay=null):null!==this._pausedDelay&&(this._localDelayOffset+=e-this._pausedDelay,this._pausedDelay=null),null!==this._manualJumpDelay&&(this._localDelayOffset+=this._manualJumpDelay,this._manualJumpDelay=null,this._frameToSyncFromJump=null),this._goToFrame=null,0===this._weight)return!0;let i=!1,r=this._runtimeAnimations;for(t=0;t0)return;this._animationTimeLast=e}this.deltaTime=this.useConstantAnimationDeltaTime?16:(e-this._animationTimeLast)*this.animationTimeScale,this._animationTimeLast=e;let t=this._activeAnimatables;if(0===t.length)return;this._animationTime+=this.deltaTime;let i=this._animationTime;for(let e=0;ee.playOrder-t.playOrder)},sY.prototype.beginWeightedAnimation=function(e,t,i,r=1,s,n=1,a,o,l,h,u=!1){let c=this.beginAnimation(e,t,i,s,n,a,o,!1,l,h,u);return c.weight=r,c},sY.prototype.beginAnimation=function(e,t,i,r,s=1,n,a,o=!0,l,h,u=!1){t>i&&s>0&&(s*=-1),o&&this.stopAnimation(e,void 0,l),a||(a=new s$(this,e,t,i,r,s,n,void 0,h,u));let c=!l||l(e);if(e.animations&&c&&a.appendAnimations(e,e.animations),e.getAnimatables){let u=e.getAnimatables();for(let e=0;er&&n>0)n*=-1;else if(r>i&&n<0){let e=r;r=i,i=e}return new s$(this,e,i,r,s,n,a,t,o,l)},sY.prototype.beginDirectHierarchyAnimation=function(e,t,i,r,s,n,a,o,l,h=!1){let u=e.getDescendants(t),c=[];for(let t of(c.push(this.beginDirectAnimation(e,i,r,s,n,a,o,l,h)),u))c.push(this.beginDirectAnimation(t,i,r,s,n,a,o,l,h));return c},sY.prototype.getAnimatableByTarget=function(e){for(let t=0;t0?l:-l,s),o.scaleAndAddToRef(l,i)}s.normalize()}for(let t=0;t0)s.copyFrom(r);else if(1===e.animations.length){if(t8.SlerpToRef(r,i.currentValue,Math.min(1,e.totalWeight),s),0===e.totalAdditiveWeight)return s}else if(e.animations.length>1){let i,n,a=1;if(e.totalWeight<1){let t=1-e.totalWeight;n=[],(i=[]).push(r),n.push(t)}else{if(2===e.animations.length&&(t8.SlerpToRef(e.animations[0].currentValue,e.animations[1].currentValue,e.animations[1].weight/e.totalWeight,t),0===e.totalAdditiveWeight))return t;i=[],n=[],a=e.totalWeight}for(let t=0;t=h&&n.frame<=u&&(r?(o=n.value.clone(),f?(a=o.getTranslation(),o.setTranslation(a.scaleInPlace(m))):g&&s?(a=o.getTranslation(),o.setTranslation(a.multiplyInPlace(s))):o=n.value):o=n.value,v.push({frame:n.frame+i,value:o}));return this.animations[0].createRange(t,h+i,u+i),!0},function(e){e[e.CW=0]="CW",e[e.CCW=1]="CCW"}(I||(I={}));class sq{constructor(e){this._radians=e,this._radians<0&&(this._radians+=2*Math.PI)}degrees(){return 180*this._radians/Math.PI}radians(){return this._radians}static BetweenTwoPoints(e,t){let i=t.subtract(e);return new sq(Math.atan2(i.y,i.x))}static BetweenTwoVectors(e,t){let i=e.lengthSquared()*t.lengthSquared();if(0===i)return new sq(Math.PI/2);i=Math.sqrt(i);let r=e.dot(t)/i;return new sq(Math.acos(r=tK.Clamp(r,-1,1)))}static FromRadians(e){return new sq(e)}static FromDegrees(e){return new sq(e*Math.PI/180)}}class sQ{constructor(e,t,i){this.startPoint=e,this.midPoint=t,this.endPoint=i;let r=Math.pow(t.x,2)+Math.pow(t.y,2),s=(Math.pow(e.x,2)+Math.pow(e.y,2)-r)/2,n=(r-Math.pow(i.x,2)-Math.pow(i.y,2))/2,a=(e.x-t.x)*(t.y-i.y)-(t.x-i.x)*(e.y-t.y);this.centerPoint=new t4((s*(t.y-i.y)-n*(e.y-t.y))/a,((e.x-t.x)*n-(t.x-i.x)*s)/a),this.radius=this.centerPoint.subtract(this.startPoint).length(),this.startAngle=sq.BetweenTwoPoints(this.centerPoint,this.startPoint);let o=this.startAngle.degrees(),l=sq.BetweenTwoPoints(this.centerPoint,this.midPoint).degrees(),h=sq.BetweenTwoPoints(this.centerPoint,this.endPoint).degrees();l-o>180&&(l-=360),l-o<-180&&(l+=360),h-l>180&&(h-=360),h-l<-180&&(h+=360),this.orientation=l-o<0?I.CW:I.CCW,this.angle=sq.FromDegrees(this.orientation===I.CW?o-h:h-o)}}class sZ{constructor(e,t){this._points=[],this._length=0,this.closed=!1,this._points.push(new t4(e,t))}addLineTo(e,t){if(this.closed)return this;let i=new t4(e,t),r=this._points[this._points.length-1];return this._points.push(i),this._length+=i.subtract(r).length(),this}addArcTo(e,t,i,r,s=36){if(this.closed)return this;let n=new sQ(this._points[this._points.length-1],new t4(e,t),new t4(i,r)),a=n.angle.radians()/s;n.orientation===I.CW&&(a*=-1);let o=n.startAngle.radians()+a;for(let e=0;e(1-e)*(1-e)*t+2*e*(1-e)*i+e*e*r,a=this._points[this._points.length-1];for(let o=0;o<=s;o++){let l=o/s,h=n(l,a.x,e,i),u=n(l,a.y,t,r);this.addLineTo(h,u)}return this}addBezierCurveTo(e,t,i,r,s,n,a=36){if(this.closed)return this;let o=(e,t,i,r,s)=>(1-e)*(1-e)*(1-e)*t+3*e*(1-e)*(1-e)*i+3*e*e*(1-e)*r+e*e*e*s,l=this._points[this._points.length-1];for(let h=0;h<=a;h++){let u=h/a,c=o(u,l.x,e,i,s),d=o(u,l.y,t,r,n);this.addLineTo(c,d)}return this}isPointInside(e){let t=!1,i=this._points.length;for(let r=i-1,s=0;sNumber.EPSILON){if(o<0&&(i=this._points[s],a=-a,n=this._points[r],o=-o),e.yn.y)continue;if(e.y===i.y&&e.x===i.x)return!0;{let r=o*(e.x-i.x)-a*(e.y-i.y);if(0===r)return!0;if(r<0)continue;t=!t}}else{if(e.y!==i.y)continue;if(n.x<=e.x&&e.x<=i.x||i.x<=e.x&&e.x<=n.x)return!0}}return t}close(){return this.closed=!0,this}length(){let e=this._length;if(this.closed){let t=this._points[this._points.length-1];e+=this._points[0].subtract(t).length()}return e}area(){let e=this._points.length,t=0;for(let i=e-1,r=0;r1)return t4.Zero();let t=e*this.length(),i=0;for(let e=0;e=i&&t<=a){let e=n.normalize(),r=t-i;return new t4(s.x+e.x*r,s.y+e.y*r)}i=a}return t4.Zero()}static StartingAt(e,t){return new sZ(e,t)}}class sJ{constructor(e,t=null,i,r=!1){this.path=e,this._curve=[],this._distances=[],this._tangents=[],this._normals=[],this._binormals=[],this._pointAtData={id:0,point:t5.Zero(),previousPointArrayIndex:0,position:0,subPosition:0,interpolateReady:!1,interpolationMatrix:t7.Identity()};for(let t=0;tt){let i=e;e=t,t=i}let i=this.getCurve(),r=this.getPointAt(e),s=this.getPreviousPointIndexAt(e),n=this.getPointAt(t),a=this.getPreviousPointIndexAt(t)+1,o=[];return 0!==e&&(s++,o.push(r)),o.push(...i.slice(s,a)),(1!==t||1===e)&&o.push(n),new sJ(o,this.getNormalAt(e),this._raw,this._alignTangentsWithPath)}update(e,t=null,i=!1){for(let t=0;tt+1;)t++,i=this._curve[e].subtract(this._curve[e-t]);return i}_normalVector(e,t){let i;let r=e.length();if(0===r&&(r=1),null==t){let t;t=tK.WithinEpsilon(Math.abs(e.y)/r,1,.001)?tK.WithinEpsilon(Math.abs(e.x)/r,1,.001)?tK.WithinEpsilon(Math.abs(e.z)/r,1,.001)?t5.Zero():new t5(0,0,1):new t5(1,0,0):new t5(0,-1,0),i=t5.Cross(e,t)}else i=t5.Cross(e,t),t5.CrossToRef(i,e,i);return i.normalize(),i}_updatePointAtData(e,t=!1){let i;if(this._pointAtData.id===e)return this._pointAtData.interpolateReady||this._updateInterpolationMatrix(),this._pointAtData;this._pointAtData.id=e;let r=this.getPoints();if(e<=0)return this._setPointAtData(0,0,r[0],0,t);if(e>=1)return this._setPointAtData(1,1,r[r.length-1],r.length-1,t);let s=r[0],n=0,a=e*this.length();for(let o=1;oa){let r=(n-a)/l,h=s.subtract(i),u=i.add(h.scaleInPlace(r));return this._setPointAtData(e,1-r,u,o-1,t)}s=i}return this._pointAtData}_setPointAtData(e,t,i,r,s){return this._pointAtData.point=i,this._pointAtData.position=e,this._pointAtData.subPosition=t,this._pointAtData.previousPointArrayIndex=r,this._pointAtData.interpolateReady=s,s&&this._updateInterpolationMatrix(),this._pointAtData}_updateInterpolationMatrix(){this._pointAtData.interpolationMatrix=t7.Identity();let e=this._pointAtData.previousPointArrayIndex;if(e!==this._tangents.length-1){let t=e+1,i=this._tangents[e].clone(),r=this._normals[e].clone(),s=this._binormals[e].clone(),n=this._tangents[t].clone(),a=this._normals[t].clone(),o=this._binormals[t].clone(),l=t8.RotationQuaternionFromAxis(r,s,i),h=t8.RotationQuaternionFromAxis(a,o,n);t8.Slerp(l,h,this._pointAtData.subPosition).toRotationMatrix(this._pointAtData.interpolationMatrix)}}}class s0{static CreateQuadraticBezier(e,t,i,r){r=r>2?r:3;let s=[],n=(e,t,i,r)=>(1-e)*(1-e)*t+2*e*(1-e)*i+e*e*r;for(let a=0;a<=r;a++)s.push(new t5(n(a/r,e.x,t.x,i.x),n(a/r,e.y,t.y,i.y),n(a/r,e.z,t.z,i.z)));return new s0(s)}static CreateCubicBezier(e,t,i,r,s){s=s>3?s:4;let n=[],a=(e,t,i,r,s)=>(1-e)*(1-e)*(1-e)*t+3*e*(1-e)*(1-e)*i+3*e*e*(1-e)*r+e*e*e*s;for(let o=0;o<=s;o++)n.push(new t5(a(o/s,e.x,t.x,i.x,r.x),a(o/s,e.y,t.y,i.y,r.y),a(o/s,e.z,t.z,i.z,r.z)));return new s0(n)}static CreateHermiteSpline(e,t,i,r,s){let n=[],a=1/s;for(let o=0;o<=s;o++)n.push(t5.Hermite(e,t,i,r,o*a));return new s0(n)}static CreateCatmullRomSpline(e,t,i){let r=[],s=1/t,n=0;if(i){let i=e.length;for(let a=0;a=.5?(1-this.easeInCore((1-e)*2))*.5+.5:.5*this.easeInCore(2*e)}}s1.EASINGMODE_EASEIN=0,s1.EASINGMODE_EASEOUT=1,s1.EASINGMODE_EASEINOUT=2;class s2 extends s1{easeInCore(e){return 1-Math.sqrt(1-(e=Math.max(0,Math.min(1,e)))*e)}}class s3 extends s1{constructor(e=1){super(),this.amplitude=e}easeInCore(e){return Math.pow(e,3)-e*Math.max(0,this.amplitude)*Math.sin(3.141592653589793*e)}}class s4 extends s1{constructor(e=2){super(),this.exponent=e}easeInCore(e){return this.exponent<=0?e:(Math.exp(this.exponent*e)-1)/(Math.exp(this.exponent)-1)}}class s5 extends s1{easeInCore(e){return e*e}}class s6 extends s1{easeInCore(e){return 1-Math.sin(1.5707963267948966*(1-e))}}class s8{getClassName(){return"TargetedAnimation"}serialize(){let e={};return e.animation=this.animation.serialize(),e.targetId=this.target.id,e}}class s7{syncWithMask(){if(!this.mask){this._numActiveAnimatables=this._targetedAnimations.length;return}this._numActiveAnimatables=0;for(let e=0;e0)){for(let e=0;en&&(n=t.to);let a=new s7(e[0].name+"_merged",e[0]._scene,r);for(let r of e){for(let e of(i&&r.normalize(s,n),r.targetedAnimations))a.addTargetedAnimation(e.animation,e.target);t&&r.dispose()}return a}constructor(e,t=null,i=-1,r=0){this.name=e,this._targetedAnimations=[],this._animatables=[],this._from=Number.MAX_VALUE,this._to=-Number.MAX_VALUE,this._speedRatio=1,this._loopAnimation=!1,this._isAdditive=!1,this._weight=-1,this._playOrder=0,this._enableBlending=null,this._blendingSpeed=null,this._numActiveAnimatables=0,this._parentContainer=null,this.onAnimationEndObservable=new tj,this.onAnimationLoopObservable=new tj,this.onAnimationGroupLoopObservable=new tj,this.onAnimationGroupEndObservable=new tj,this.onAnimationGroupPauseObservable=new tj,this.onAnimationGroupPlayObservable=new tj,this.metadata=null,this._animationLoopFlags=[],this._scene=t||t2.LastCreatedScene,this._weight=i,this._playOrder=r,this.uniqueId=this._scene.getUniqueId(),this._scene.addAnimationGroup(this)}addTargetedAnimation(e,t){let i=new s8;i.animation=e,i.target=t;let r=e.getKeys();return this._from>r[0].frame&&(this._from=r[0].frame),this._to-1;t--)this._targetedAnimations[t].animation===e&&this._targetedAnimations.splice(t,1)}normalize(e=null,t=null){null==e&&(e=this._from),null==t&&(t=this._to);for(let i=0;ie){let t={frame:e,value:s.value,inTangent:s.inTangent,outTangent:s.outTangent,interpolation:s.interpolation};r.splice(0,0,t)}if(n.frame{this.onAnimationLoopObservable.notifyObservers(t),this._animationLoopFlags[i]||(this._animationLoopFlags[i]=!0,this._animationLoopCount++,this._animationLoopCount!==this._numActiveAnimatables||(this.onAnimationGroupLoopObservable.notifyObservers(this),this._animationLoopCount=0,this._animationLoopFlags.length=0))}}start(e=!1,t=1,i,r,s){if(this._isStarted||0===this._targetedAnimations.length)return this;this._loopAnimation=e,this._animationLoopCount=0,this._animationLoopFlags.length=0;for(let n=0;n{this.onAnimationEndObservable.notifyObservers(a),this._checkAnimationGroupEnded(o)},this._processLoop(o,a,n),this._animatables.push(o)}return this.syncWithMask(),this._scene.sortActiveAnimatables(),this._speedRatio=t,this._isStarted=!0,this._isPaused=!1,this.onAnimationGroupPlayObservable.notifyObservers(this),this}pause(){if(!this._isStarted)return this;this._isPaused=!0;for(let e=0;e0&&(this._scene._activeAnimatables[t++]=i)}return this._scene._activeAnimatables.length=t,this._isStarted=!1,this}setWeightForAllAnimatables(e){for(let t=0;t-1&&this._scene.animationGroups.splice(e,1),this._parentContainer){let e=this._parentContainer.animationGroups.indexOf(this);e>-1&&this._parentContainer.animationGroups.splice(e,1),this._parentContainer=null}this.onAnimationEndObservable.clear(),this.onAnimationGroupEndObservable.clear(),this.onAnimationGroupPauseObservable.clear(),this.onAnimationGroupPlayObservable.clear(),this.onAnimationLoopObservable.clear(),this.onAnimationGroupLoopObservable.clear()}_checkAnimationGroupEnded(e){let t=this._animatables.indexOf(e);t>-1&&this._animatables.splice(t,1),0===this._animatables.length&&(this._isStarted=!1,this.onAnimationGroupEndObservable.notifyObservers(this))}clone(e,t,i=!1){let r=new s7(e||this.name,this._scene,this._weight,this._playOrder);for(let e of(r._from=this.from,r._to=this.to,r._speedRatio=this.speedRatio,r._loopAnimation=this.loopAnimation,r._isAdditive=this.isAdditive,r._enableBlending=this.enableBlending,r._blendingSpeed=this.blendingSpeed,r.metadata=this.metadata,r.mask=this.mask,this._targetedAnimations))r.addTargetedAnimation(i?e.animation.clone():e.animation,t?t(e.target):e.target);return r}serialize(){let e={};e.name=this.name,e.from=this.from,e.to=this.to,e.speedRatio=this.speedRatio,e.loopAnimation=this.loopAnimation,e.isAdditive=this.isAdditive,e.weight=this.weight,e.playOrder=this.playOrder,e.enableBlending=this.enableBlending,e.blendingSpeed=this.blendingSpeed,e.targetedAnimations=[];for(let t=0;ts[0].frame&&(e=s[0].frame),t=t&&e<=i||s&&r.frame>=t&&r.frame<=i){let e={frame:r.frame,value:r.value.clone?r.value.clone():r.value,inTangent:r.inTangent,outTangent:r.outTangent,interpolation:r.interpolation,lockedTangent:r.lockedTangent};d===Number.MAX_VALUE&&(d=e.frame),e.frame-=d,c.push(e)}}if(0===c.length){o.splice(e,1),e--;continue}n>c[0].frame&&(n=c[0].frame),a{r.value=void 0,t(r)},i):t(r)}catch(e){i(e)}}function ne(e,t,i,r,s){let n=()=>{let a;let o=e=>{e.done?i(e.value):void 0===a?a=!0:n()};do a=void 0,s&&s.aborted?r(Error("Aborted")):t(e,o,r),void 0===a&&(a=!1);while(a)};n()}function nt(e,t){let i;return ne(e,s9,e=>i=e,e=>{throw e},t),i}function ni(e,t,i){return new Promise((r,s)=>{ne(e,t,r,s,i)})}!function(e){e[e.Include=0]="Include",e[e.Exclude=1]="Exclude"}(P||(P={}));class nr{constructor(e,t,i,r){this.x=e,this.y=t,this.width=i,this.height=r}toGlobal(e,t){return new nr(this.x*e,this.y*t,this.width*e,this.height*t)}toGlobalToRef(e,t,i){return i.x=this.x*e,i.y=this.y*t,i.width=this.width*e,i.height=this.height*t,this}clone(){return new nr(this.x,this.y,this.width,this.height)}}class ns extends i0{get position(){return this._position}set position(e){this._position=e}set upVector(e){this._upVector=e}get upVector(){return this._upVector}get screenArea(){var e,t,i,r;let s=0,n=0;if(this.mode===ns.PERSPECTIVE_CAMERA)this.fovMode===ns.FOVMODE_VERTICAL_FIXED?(n=2*this.minZ*Math.tan(this.fov/2),s=this.getEngine().getAspectRatio(this)*n):n=(s=2*this.minZ*Math.tan(this.fov/2))/this.getEngine().getAspectRatio(this);else{let a=this.getEngine().getRenderWidth()/2,o=this.getEngine().getRenderHeight()/2;s=(null!==(e=this.orthoRight)&&void 0!==e?e:a)-(null!==(t=this.orthoLeft)&&void 0!==t?t:-a),n=(null!==(i=this.orthoTop)&&void 0!==i?i:o)-(null!==(r=this.orthoBottom)&&void 0!==r?r:-o)}return s*n}set orthoLeft(e){for(let t of(this._orthoLeft=e,this._rigCameras))t.orthoLeft=e}get orthoLeft(){return this._orthoLeft}set orthoRight(e){for(let t of(this._orthoRight=e,this._rigCameras))t.orthoRight=e}get orthoRight(){return this._orthoRight}set orthoBottom(e){for(let t of(this._orthoBottom=e,this._rigCameras))t.orthoBottom=e}get orthoBottom(){return this._orthoBottom}set orthoTop(e){for(let t of(this._orthoTop=e,this._rigCameras))t.orthoTop=e}get orthoTop(){return this._orthoTop}set mode(e){for(let t of(this._mode=e,this._rigCameras))t.mode=e}get mode(){return this._mode}constructor(e,t,i,r=!0){super(e,i),this._position=t5.Zero(),this._upVector=t5.Up(),this.oblique=null,this._orthoLeft=null,this._orthoRight=null,this._orthoBottom=null,this._orthoTop=null,this.fov=.8,this.projectionPlaneTilt=0,this.minZ=1,this.maxZ=1e4,this.inertia=.9,this._mode=ns.PERSPECTIVE_CAMERA,this.isIntermediate=!1,this.viewport=new nr(0,0,1,1),this.layerMask=268435455,this.fovMode=ns.FOVMODE_VERTICAL_FIXED,this.cameraRigMode=ns.RIG_MODE_NONE,this.customRenderTargets=[],this.outputRenderTarget=null,this.onViewMatrixChangedObservable=new tj,this.onProjectionMatrixChangedObservable=new tj,this.onAfterCheckInputsObservable=new tj,this.onRestoreStateObservable=new tj,this.isRigCamera=!1,this._rigCameras=[],this._skipRendering=!1,this._projectionMatrix=new t7,this._postProcesses=[],this._activeMeshes=new sa(256),this._globalPosition=t5.Zero(),this._computedViewMatrix=t7.Identity(),this._doNotComputeProjectionMatrix=!1,this._transformMatrix=t7.Zero(),this._refreshFrustumPlanes=!0,this._absoluteRotation=t8.Identity(),this._isCamera=!0,this._isLeftCamera=!1,this._isRightCamera=!1,this.getScene().addCamera(this),r&&!this.getScene().activeCamera&&(this.getScene().activeCamera=this),this.position=t,this.renderPassId=this.getScene().getEngine().createRenderPassId(`Camera ${e}`)}storeState(){return this._stateStored=!0,this._storedFov=this.fov,this}_restoreStateValues(){return!!this._stateStored&&(this.fov=this._storedFov,!0)}restoreState(){return!!this._restoreStateValues()&&(this.onRestoreStateObservable.notifyObservers(this),!0)}getClassName(){return"Camera"}toString(e){let t="Name: "+this.name;if(t+=", type: "+this.getClassName(),this.animations)for(let i=0;i-1?(ig.Error("You're trying to reuse a post process not defined as reusable."),0):(null==t||t<0?this._postProcesses.push(e):null===this._postProcesses[t]?this._postProcesses[t]=e:this._postProcesses.splice(t,0,e),this._cascadePostProcessesToRigCams(),this._scene.prePassRenderer&&this._scene.prePassRenderer.markAsDirty(),this._postProcesses.indexOf(e))}detachPostProcess(e){let t=this._postProcesses.indexOf(e);-1!==t&&(this._postProcesses[t]=null),this._scene.prePassRenderer&&this._scene.prePassRenderer.markAsDirty(),this._cascadePostProcessesToRigCams()}getWorldMatrix(){return this._isSynchronizedViewMatrix()||this.getViewMatrix(),this._worldMatrix}_getViewMatrix(){return t7.Identity()}getViewMatrix(e){return!e&&this._isSynchronizedViewMatrix()||(this.updateCache(),this._computedViewMatrix=this._getViewMatrix(),this._currentRenderId=this.getScene().getRenderId(),this._childUpdateId++,this._refreshFrustumPlanes=!0,this._cameraRigParams&&this._cameraRigParams.vrPreViewMatrix&&this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix,this._computedViewMatrix),this.parent&&this.parent.onViewMatrixChangedObservable&&this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent),this.onViewMatrixChangedObservable.notifyObservers(this),this._computedViewMatrix.invertToRef(this._worldMatrix)),this._computedViewMatrix}freezeProjectionMatrix(e){this._doNotComputeProjectionMatrix=!0,void 0!==e&&(this._projectionMatrix=e)}unfreezeProjectionMatrix(){this._doNotComputeProjectionMatrix=!1}getProjectionMatrix(e){var t,i,r,s,n,a,o,l,h,u,c,d,p,_,f,m,g,v,x;if(this._doNotComputeProjectionMatrix||!e&&this._isSynchronizedProjectionMatrix())return this._projectionMatrix;this._cache.mode=this.mode,this._cache.minZ=this.minZ,this._cache.maxZ=this.maxZ,this._refreshFrustumPlanes=!0;let T=this.getEngine(),b=this.getScene(),E=T.useReverseDepthBuffer;if(this.mode===ns.PERSPECTIVE_CAMERA)this._cache.fov=this.fov,this._cache.fovMode=this.fovMode,this._cache.aspectRatio=T.getAspectRatio(this),this._cache.projectionPlaneTilt=this.projectionPlaneTilt,this.minZ<=0&&(this.minZ=.1),(b.useRightHandedSystem?t7.PerspectiveFovRHToRef:t7.PerspectiveFovLHToRef)(this.fov,T.getAspectRatio(this),E?this.maxZ:this.minZ,E?this.minZ:this.maxZ,this._projectionMatrix,this.fovMode===ns.FOVMODE_VERTICAL_FIXED,T.isNDCHalfZRange,this.projectionPlaneTilt,E);else{let e=T.getRenderWidth()/2,S=T.getRenderHeight()/2;b.useRightHandedSystem?this.oblique?t7.ObliqueOffCenterRHToRef(null!==(t=this.orthoLeft)&&void 0!==t?t:-e,null!==(i=this.orthoRight)&&void 0!==i?i:e,null!==(r=this.orthoBottom)&&void 0!==r?r:-S,null!==(s=this.orthoTop)&&void 0!==s?s:S,E?this.maxZ:this.minZ,E?this.minZ:this.maxZ,this.oblique.length,this.oblique.angle,this._computeObliqueDistance(this.oblique.offset),this._projectionMatrix,T.isNDCHalfZRange):t7.OrthoOffCenterRHToRef(null!==(n=this.orthoLeft)&&void 0!==n?n:-e,null!==(a=this.orthoRight)&&void 0!==a?a:e,null!==(o=this.orthoBottom)&&void 0!==o?o:-S,null!==(l=this.orthoTop)&&void 0!==l?l:S,E?this.maxZ:this.minZ,E?this.minZ:this.maxZ,this._projectionMatrix,T.isNDCHalfZRange):this.oblique?t7.ObliqueOffCenterLHToRef(null!==(h=this.orthoLeft)&&void 0!==h?h:-e,null!==(u=this.orthoRight)&&void 0!==u?u:e,null!==(c=this.orthoBottom)&&void 0!==c?c:-S,null!==(d=this.orthoTop)&&void 0!==d?d:S,E?this.maxZ:this.minZ,E?this.minZ:this.maxZ,this.oblique.length,this.oblique.angle,this._computeObliqueDistance(this.oblique.offset),this._projectionMatrix,T.isNDCHalfZRange):t7.OrthoOffCenterLHToRef(null!==(p=this.orthoLeft)&&void 0!==p?p:-e,null!==(_=this.orthoRight)&&void 0!==_?_:e,null!==(f=this.orthoBottom)&&void 0!==f?f:-S,null!==(m=this.orthoTop)&&void 0!==m?m:S,E?this.maxZ:this.minZ,E?this.minZ:this.maxZ,this._projectionMatrix,T.isNDCHalfZRange),this._cache.orthoLeft=this.orthoLeft,this._cache.orthoRight=this.orthoRight,this._cache.orthoBottom=this.orthoBottom,this._cache.orthoTop=this.orthoTop,this._cache.obliqueAngle=null===(g=this.oblique)||void 0===g?void 0:g.angle,this._cache.obliqueLength=null===(v=this.oblique)||void 0===v?void 0:v.length,this._cache.obliqueOffset=null===(x=this.oblique)||void 0===x?void 0:x.offset,this._cache.renderWidth=T.getRenderWidth(),this._cache.renderHeight=T.getRenderHeight()}return this.onProjectionMatrixChangedObservable.notifyObservers(this),this._projectionMatrix}getTransformationMatrix(){return this._computedViewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._transformMatrix}_computeObliqueDistance(e){return(this.radius||(this.target?t5.Distance(this.position,this.target):this.position.length()))+e}_updateFrustumPlanes(){this._refreshFrustumPlanes&&(this.getTransformationMatrix(),this._frustumPlanes?sz.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=sz.GetPlanes(this._transformMatrix),this._refreshFrustumPlanes=!1)}isInFrustum(e,t=!1){if(this._updateFrustumPlanes(),!t||!(this.rigCameras.length>0))return e.isInFrustum(this._frustumPlanes);{let t=!1;return this.rigCameras.forEach(i=>{i._updateFrustumPlanes(),t=t||e.isInFrustum(i._frustumPlanes)}),t}}isCompletelyInFrustum(e){return this._updateFrustumPlanes(),e.isCompletelyInFrustum(this._frustumPlanes)}getForwardRay(e=100,t,i){throw iL("Ray")}getForwardRayToRef(e,t=100,i,r){throw iL("Ray")}dispose(e,t=!1){for(this.onViewMatrixChangedObservable.clear(),this.onProjectionMatrixChangedObservable.clear(),this.onAfterCheckInputsObservable.clear(),this.onRestoreStateObservable.clear(),this.inputs&&this.inputs.clear(),this.getScene().stopAnimation(this),this.getScene().removeCamera(this);this._rigCameras.length>0;){let e=this._rigCameras.pop();e&&e.dispose()}if(this._parentContainer){let e=this._parentContainer.cameras.indexOf(this);e>-1&&this._parentContainer.cameras.splice(e,1),this._parentContainer=null}if(this._rigPostProcess)this._rigPostProcess.dispose(this),this._rigPostProcess=null,this._postProcesses.length=0;else if(this.cameraRigMode!==ns.RIG_MODE_NONE)this._rigPostProcess=null,this._postProcesses.length=0;else{let e=this._postProcesses.length;for(;--e>=0;){let t=this._postProcesses[e];t&&t.dispose(this)}}let i=this.customRenderTargets.length;for(;--i>=0;)this.customRenderTargets[i].dispose();this.customRenderTargets.length=0,this._activeMeshes.dispose(),this.getScene().getEngine().releaseRenderPassId(this.renderPassId),super.dispose(e,t)}get isLeftCamera(){return this._isLeftCamera}get isRightCamera(){return this._isRightCamera}get leftCamera(){return this._rigCameras.length<1?null:this._rigCameras[0]}get rightCamera(){return this._rigCameras.length<2?null:this._rigCameras[1]}getLeftTarget(){return this._rigCameras.length<1?null:this._rigCameras[0].getTarget()}getRightTarget(){return this._rigCameras.length<2?null:this._rigCameras[1].getTarget()}setCameraRigMode(e,t){if(this.cameraRigMode!==e){for(;this._rigCameras.length>0;){let e=this._rigCameras.pop();e&&e.dispose()}if(this.cameraRigMode=e,this._cameraRigParams={},this._cameraRigParams.interaxialDistance=t.interaxialDistance||.0637,this._cameraRigParams.stereoHalfAngle=ss.ToRadians(this._cameraRigParams.interaxialDistance/.0637),this.cameraRigMode!==ns.RIG_MODE_NONE){let e=this.createRigCamera(this.name+"_L",0);e&&(e._isLeftCamera=!0);let t=this.createRigCamera(this.name+"_R",1);t&&(t._isRightCamera=!0),e&&t&&(this._rigCameras.push(e),this._rigCameras.push(t))}this._setRigMode(t),this._cascadePostProcessesToRigCams(),this.update()}}_setRigMode(e){}_getVRProjectionMatrix(){return t7.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov,this._cameraRigParams.vrMetrics.aspectRatio,this.minZ,this.maxZ,this._cameraRigParams.vrWorkMatrix,!0,this.getEngine().isNDCHalfZRange),this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix,this._projectionMatrix),this._projectionMatrix}setCameraRigParameter(e,t){this._cameraRigParams||(this._cameraRigParams={}),this._cameraRigParams[e]=t,"interaxialDistance"===e&&(this._cameraRigParams.stereoHalfAngle=ss.ToRadians(t/.0637))}createRigCamera(e,t){return null}_updateRigCameras(){for(let e=0;ens._CreateDefaultParsedCamera(t,i))}computeWorldMatrix(){return this.getWorldMatrix()}static Parse(e,t){let i=e.type,r=ns.GetConstructorFromName(i,e.name,t,e.interaxial_distance,e.isStereoscopicSideBySide),s=i$.Parse(r,e,t);if(void 0!==e.parentId&&(s._waitingParentId=e.parentId),void 0!==e.parentInstanceIndex&&(s._waitingParentInstanceIndex=e.parentInstanceIndex),s.inputs&&(s.inputs.parse(e),s._setupInputs()),e.upVector&&(s.upVector=t5.FromArray(e.upVector)),s.setPosition&&(s.position.copyFromFloats(0,0,0),s.setPosition(t5.FromArray(e.position))),e.target&&s.setTarget&&s.setTarget(t5.FromArray(e.target)),e.cameraRigMode){let t=e.interaxial_distance?{interaxialDistance:e.interaxial_distance}:{};s.setCameraRigMode(e.cameraRigMode,t)}if(e.animations){for(let t=0;tthis.parent._getWorldMatrixDeterminant()&&(e*=-1),e}}ns._CreateDefaultParsedCamera=(e,t)=>{throw iL("UniversalCamera")},ns.PERSPECTIVE_CAMERA=0,ns.ORTHOGRAPHIC_CAMERA=1,ns.FOVMODE_VERTICAL_FIXED=0,ns.FOVMODE_HORIZONTAL_FIXED=1,ns.RIG_MODE_NONE=0,ns.RIG_MODE_STEREOSCOPIC_ANAGLYPH=10,ns.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL=11,ns.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED=12,ns.RIG_MODE_STEREOSCOPIC_OVERUNDER=13,ns.RIG_MODE_STEREOSCOPIC_INTERLACED=14,ns.RIG_MODE_VR=20,ns.RIG_MODE_CUSTOM=22,ns.ForceAttachControlToAlwaysPreventDefault=!1,iZ([ij("position")],ns.prototype,"_position",void 0),iZ([ij("upVector")],ns.prototype,"_upVector",void 0),iZ([iW()],ns.prototype,"orthoLeft",null),iZ([iW()],ns.prototype,"orthoRight",null),iZ([iW()],ns.prototype,"orthoBottom",null),iZ([iW()],ns.prototype,"orthoTop",null),iZ([iW()],ns.prototype,"fov",void 0),iZ([iW()],ns.prototype,"projectionPlaneTilt",void 0),iZ([iW()],ns.prototype,"minZ",void 0),iZ([iW()],ns.prototype,"maxZ",void 0),iZ([iW()],ns.prototype,"inertia",void 0),iZ([iW()],ns.prototype,"mode",null),iZ([iW()],ns.prototype,"layerMask",void 0),iZ([iW()],ns.prototype,"fovMode",void 0),iZ([iW()],ns.prototype,"cameraRigMode",void 0),iZ([iW()],ns.prototype,"interaxialDistance",void 0),iZ([iW()],ns.prototype,"isStereoscopicSideBySide",void 0);class nn{constructor(e,t,i){this.bu=e,this.bv=t,this.distance=i,this.faceId=0,this.subMeshId=0}}class na{constructor(e,t,i){this.vectors=tQ.BuildArray(8,t5.Zero),this.center=t5.Zero(),this.centerWorld=t5.Zero(),this.extendSize=t5.Zero(),this.extendSizeWorld=t5.Zero(),this.directions=tQ.BuildArray(3,t5.Zero),this.vectorsWorld=tQ.BuildArray(8,t5.Zero),this.minimumWorld=t5.Zero(),this.maximumWorld=t5.Zero(),this.minimum=t5.Zero(),this.maximum=t5.Zero(),this._drawWrapperFront=null,this._drawWrapperBack=null,this.reConstruct(e,t,i)}reConstruct(e,t,i){let r=e.x,s=e.y,n=e.z,a=t.x,o=t.y,l=t.z,h=this.vectors;this.minimum.copyFromFloats(r,s,n),this.maximum.copyFromFloats(a,o,l),h[0].copyFromFloats(r,s,n),h[1].copyFromFloats(a,o,l),h[2].copyFromFloats(a,s,n),h[3].copyFromFloats(r,o,n),h[4].copyFromFloats(r,s,l),h[5].copyFromFloats(a,o,n),h[6].copyFromFloats(r,o,l),h[7].copyFromFloats(a,s,l),t.addToRef(e,this.center).scaleInPlace(.5),t.subtractToRef(e,this.extendSize).scaleInPlace(.5),this._worldMatrix=i||t7.IdentityReadOnly,this._update(this._worldMatrix)}scale(e){let t=na._TmpVector3,i=this.maximum.subtractToRef(this.minimum,t[0]),r=i.length();i.normalizeFromLength(r);let s=r*e,n=i.scaleInPlace(.5*s),a=this.center.subtractToRef(n,t[1]),o=this.center.addToRef(n,t[2]);return this.reConstruct(a,o,this._worldMatrix),this}getWorldMatrix(){return this._worldMatrix}_update(e){let t=this.minimumWorld,i=this.maximumWorld,r=this.directions,s=this.vectorsWorld,n=this.vectors;if(e.isIdentity()){t.copyFrom(this.minimum),i.copyFrom(this.maximum);for(let e=0;e<8;++e)s[e].copyFrom(n[e]);this.extendSizeWorld.copyFrom(this.extendSize),this.centerWorld.copyFrom(this.center)}else{t.setAll(Number.MAX_VALUE),i.setAll(-Number.MAX_VALUE);for(let r=0;r<8;++r){let a=s[r];t5.TransformCoordinatesToRef(n[r],e,a),t.minimizeInPlace(a),i.maximizeInPlace(a)}i.subtractToRef(t,this.extendSizeWorld).scaleInPlace(.5),i.addToRef(t,this.centerWorld).scaleInPlace(.5)}t5.FromArrayToRef(e.m,0,r[0]),t5.FromArrayToRef(e.m,4,r[1]),t5.FromArrayToRef(e.m,8,r[2]),this._worldMatrix=e}isInFrustum(e){return na.IsInFrustum(this.vectorsWorld,e)}isCompletelyInFrustum(e){return na.IsCompletelyInFrustum(this.vectorsWorld,e)}intersectsPoint(e){let t=this.minimumWorld,i=this.maximumWorld,r=t.x,s=t.y,n=t.z,a=i.x,o=i.y,l=i.z,h=e.x,u=e.y,c=e.z;return!(a-h<-.001)&&!(-.001>h-r)&&!(o-u<-.001)&&!(-.001>u-s)&&!(l-c<-.001)&&!(-.001>c-n)}intersectsSphere(e){return na.IntersectsSphere(this.minimumWorld,this.maximumWorld,e.centerWorld,e.radiusWorld)}intersectsMinMax(e,t){let i=this.minimumWorld,r=this.maximumWorld,s=i.x,n=i.y,a=i.z,o=r.x,l=r.y,h=r.z,u=e.x,c=e.y,d=e.z,p=t.x,_=t.y,f=t.z;return!(op)&&!(l_)&&!(hf)}dispose(){var e,t;null===(e=this._drawWrapperFront)||void 0===e||e.dispose(),null===(t=this._drawWrapperBack)||void 0===t||t.dispose()}static Intersects(e,t){return e.intersectsMinMax(t.minimumWorld,t.maximumWorld)}static IntersectsSphere(e,t,i,r){let s=na._TmpVector3[0];return t5.ClampToRef(i,e,t,s),t5.DistanceSquared(i,s)<=r*r}static IsCompletelyInFrustum(e,t){for(let i=0;i<6;++i){let r=t[i];for(let t=0;t<8;++t)if(0>r.dotCoordinate(e[t]))return!1}return!0}static IsInFrustum(e,t){for(let i=0;i<6;++i){let r=!0,s=t[i];for(let t=0;t<8;++t)if(s.dotCoordinate(e[t])>=0){r=!1;break}if(r)return!1}return!0}}na._TmpVector3=tQ.BuildArray(3,t5.Zero);class no{constructor(e,t,i){this.center=t5.Zero(),this.centerWorld=t5.Zero(),this.minimum=t5.Zero(),this.maximum=t5.Zero(),this.reConstruct(e,t,i)}reConstruct(e,t,i){this.minimum.copyFrom(e),this.maximum.copyFrom(t);let r=t5.Distance(e,t);t.addToRef(e,this.center).scaleInPlace(.5),this.radius=.5*r,this._update(i||t7.IdentityReadOnly)}scale(e){let t=this.radius*e,i=no._TmpVector3,r=i[0].setAll(t),s=this.center.subtractToRef(r,i[1]),n=this.center.addToRef(r,i[2]);return this.reConstruct(s,n,this._worldMatrix),this}getWorldMatrix(){return this._worldMatrix}_update(e){if(e.isIdentity())this.centerWorld.copyFrom(this.center),this.radiusWorld=this.radius;else{t5.TransformCoordinatesToRef(this.center,e,this.centerWorld);let t=no._TmpVector3[0];t5.TransformNormalFromFloatsToRef(1,1,1,e,t),this.radiusWorld=Math.max(Math.abs(t.x),Math.abs(t.y),Math.abs(t.z))*this.radius}}isInFrustum(e){let t=this.centerWorld,i=this.radiusWorld;for(let r=0;r<6;r++)if(e[r].dotCoordinate(t)<=-i)return!1;return!0}isCenterInFrustum(e){let t=this.centerWorld;for(let i=0;i<6;i++)if(0>e[i].dotCoordinate(t))return!1;return!0}intersectsPoint(e){let t=t5.DistanceSquared(this.centerWorld,e);return!(this.radiusWorld*this.radiusWorld{let r=t5.Dot(t.centerWorld,e),s=Math.abs(t5.Dot(t.directions[0],e))*t.extendSize.x+Math.abs(t5.Dot(t.directions[1],e))*t.extendSize.y+Math.abs(t5.Dot(t.directions[2],e))*t.extendSize.z;i.min=r-s,i.max=r+s},nc=(e,t,i)=>(nu(e,t,nl),nu(e,i,nh),!(nl.min>nh.max||nh.min>nl.max));class nd{constructor(e,t,i){this._isLocked=!1,this.boundingBox=new na(e,t,i),this.boundingSphere=new no(e,t,i)}reConstruct(e,t,i){this.boundingBox.reConstruct(e,t,i),this.boundingSphere.reConstruct(e,t,i)}get minimum(){return this.boundingBox.minimum}get maximum(){return this.boundingBox.maximum}get isLocked(){return this._isLocked}set isLocked(e){this._isLocked=e}update(e){this._isLocked||(this.boundingBox._update(e),this.boundingSphere._update(e))}centerOn(e,t){let i=nd._TmpVector3[0].copyFrom(e).subtractInPlace(t),r=nd._TmpVector3[1].copyFrom(e).addInPlace(t);return this.boundingBox.reConstruct(i,r,this.boundingBox.getWorldMatrix()),this.boundingSphere.reConstruct(i,r,this.boundingBox.getWorldMatrix()),this}encapsulate(e){let t=t5.Minimize(this.minimum,e),i=t5.Maximize(this.maximum,e);return this.reConstruct(t,i,this.boundingBox.getWorldMatrix()),this}encapsulateBoundingInfo(e){let t=ie.Matrix[0];this.boundingBox.getWorldMatrix().invertToRef(t);let i=ie.Vector3[0];return t5.TransformCoordinatesToRef(e.boundingBox.minimumWorld,t,i),this.encapsulate(i),t5.TransformCoordinatesToRef(e.boundingBox.maximumWorld,t,i),this.encapsulate(i),this}scale(e){return this.boundingBox.scale(e),this.boundingSphere.scale(e),this}isInFrustum(e,t=0){return!!((2===t||3===t)&&this.boundingSphere.isCenterInFrustum(e))||!!this.boundingSphere.isInFrustum(e)&&(1===t||3===t||this.boundingBox.isInFrustum(e))}get diagonalLength(){let e=this.boundingBox;return e.maximumWorld.subtractToRef(e.minimumWorld,nd._TmpVector3[0]).length()}isCompletelyInFrustum(e){return this.boundingBox.isCompletelyInFrustum(e)}_checkCollision(e){return e._canDoCollision(this.boundingSphere.centerWorld,this.boundingSphere.radiusWorld,this.boundingBox.minimumWorld,this.boundingBox.maximumWorld)}intersectsPoint(e){return!!(this.boundingSphere.centerWorld&&this.boundingSphere.intersectsPoint(e)&&this.boundingBox.intersectsPoint(e))}intersects(e,t){if(!no.Intersects(this.boundingSphere,e.boundingSphere)||!na.Intersects(this.boundingBox,e.boundingBox))return!1;if(!t)return!0;let i=this.boundingBox,r=e.boundingBox;return!!(nc(i.directions[0],i,r)&&nc(i.directions[1],i,r)&&nc(i.directions[2],i,r)&&nc(r.directions[0],i,r)&&nc(r.directions[1],i,r)&&nc(r.directions[2],i,r)&&nc(t5.Cross(i.directions[0],r.directions[0]),i,r)&&nc(t5.Cross(i.directions[0],r.directions[1]),i,r)&&nc(t5.Cross(i.directions[0],r.directions[2]),i,r)&&nc(t5.Cross(i.directions[1],r.directions[0]),i,r)&&nc(t5.Cross(i.directions[1],r.directions[1]),i,r)&&nc(t5.Cross(i.directions[1],r.directions[2]),i,r)&&nc(t5.Cross(i.directions[2],r.directions[0]),i,r)&&nc(t5.Cross(i.directions[2],r.directions[1]),i,r)&&nc(t5.Cross(i.directions[2],r.directions[2]),i,r))}}nd._TmpVector3=tQ.BuildArray(2,t5.Zero);class np{static extractMinAndMaxIndexed(e,t,i,r,s,n){for(let a=i;a!Array.isArray(e)&&!Array.isArray(t))],np,"extractMinAndMaxIndexed",null),iZ([iq.filter((...[e])=>!Array.isArray(e))],np,"extractMinAndMax",null);class nf{get materialDefines(){var e;return this._mainDrawWrapperOverride?this._mainDrawWrapperOverride.defines:null===(e=this._getDrawWrapper())||void 0===e?void 0:e.defines}set materialDefines(e){var t;(null!==(t=this._mainDrawWrapperOverride)&&void 0!==t?t:this._getDrawWrapper(void 0,!0)).defines=e}_getDrawWrapper(e,t=!1){e=null!=e?e:this._engine.currentRenderPassId;let i=this._drawWrappers[e];return!i&&t&&(this._drawWrappers[e]=i=new rY(this._mesh.getScene().getEngine())),i}_removeDrawWrapper(e,t=!0){var i;t&&(null===(i=this._drawWrappers[e])||void 0===i||i.dispose()),this._drawWrappers[e]=void 0}get effect(){var e,t;return this._mainDrawWrapperOverride?this._mainDrawWrapperOverride.effect:null!==(t=null===(e=this._getDrawWrapper())||void 0===e?void 0:e.effect)&&void 0!==t?t:null}get _drawWrapper(){var e;return null!==(e=this._mainDrawWrapperOverride)&&void 0!==e?e:this._getDrawWrapper(void 0,!0)}get _drawWrapperOverride(){return this._mainDrawWrapperOverride}_setMainDrawWrapperOverride(e){this._mainDrawWrapperOverride=e}setEffect(e,t=null,i,r=!0){let s=this._drawWrapper;s.setEffect(e,t,r),void 0!==i&&(s.materialContext=i),e||(s.defines=null,s.materialContext=void 0)}resetDrawCache(e){if(this._drawWrappers){if(void 0!==e){this._removeDrawWrapper(e);return}for(let e of this._drawWrappers)null==e||e.dispose()}this._drawWrappers=[]}static AddToMesh(e,t,i,r,s,n,a,o=!0){return new nf(e,t,i,r,s,n,a,o)}constructor(e,t,i,r,s,n,a,o=!0,l=!0){this.materialIndex=e,this.verticesStart=t,this.verticesCount=i,this.indexStart=r,this.indexCount=s,this._mainDrawWrapperOverride=null,this._linesIndexCount=0,this._linesIndexBuffer=null,this._lastColliderWorldVertices=null,this._lastColliderTransformMatrix=null,this._wasDispatched=!1,this._renderId=0,this._alphaIndex=0,this._distanceToCamera=0,this._currentMaterial=null,this._mesh=n,this._renderingMesh=a||n,l&&n.subMeshes.push(this),this._engine=this._mesh.getScene().getEngine(),this.resetDrawCache(),this._trianglePlanes=[],this._id=n.subMeshes.length-1,o&&(this.refreshBoundingInfo(),n.computeWorldMatrix(!0))}get IsGlobal(){return 0===this.verticesStart&&this.verticesCount===this._mesh.getTotalVertices()&&0===this.indexStart&&this.indexCount===this._mesh.getTotalIndices()}getBoundingInfo(){return this.IsGlobal||this._mesh.hasThinInstances?this._mesh.getBoundingInfo():this._boundingInfo}setBoundingInfo(e){return this._boundingInfo=e,this}getMesh(){return this._mesh}getRenderingMesh(){return this._renderingMesh}getReplacementMesh(){return this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:null}getEffectiveMesh(){return(this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:null)||this._renderingMesh}getMaterial(e=!0){var t;let i=null!==(t=this._renderingMesh.getMaterialForRenderPass(this._engine.currentRenderPassId))&&void 0!==t?t:this._renderingMesh.material;if(!i)return e?this._mesh.getScene().defaultMaterial:null;if(this._isMultiMaterial(i)){let e=i.getSubMaterial(this.materialIndex);return this._currentMaterial!==e&&(this._currentMaterial=e,this.resetDrawCache()),e}return i}_isMultiMaterial(e){return void 0!==e.getSubMaterial}refreshBoundingInfo(e=null){let t;if(this._lastColliderWorldVertices=null,this.IsGlobal||!this._renderingMesh||!this._renderingMesh.geometry)return this;if(e||(e=this._renderingMesh.getVerticesData(sf.PositionKind)),!e)return this._boundingInfo=this._mesh.getBoundingInfo(),this;let i=this._renderingMesh.getIndices();if(0===this.indexStart&&this.indexCount===i.length){let e=this._renderingMesh.getBoundingInfo();t={minimum:e.minimum.clone(),maximum:e.maximum.clone()}}else t=function(e,t,i,r,s=null){let n=new t5(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),a=new t5(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);return np.extractMinAndMaxIndexed(e,t,i,r,n,a),s&&(n.x-=n.x*s.x+s.y,n.y-=n.y*s.x+s.y,n.z-=n.z*s.x+s.y,a.x+=a.x*s.x+s.y,a.y+=a.y*s.x+s.y,a.z+=a.z*s.x+s.y),{minimum:n,maximum:a}}(e,i,this.indexStart,this.indexCount,this._renderingMesh.geometry.boundingBias);return this._boundingInfo?this._boundingInfo.reConstruct(t.minimum,t.maximum):this._boundingInfo=new nd(t.minimum,t.maximum),this}_checkCollision(e){return this.getBoundingInfo()._checkCollision(e)}updateBoundingInfo(e){let t=this.getBoundingInfo();return t||(this.refreshBoundingInfo(),t=this.getBoundingInfo()),t&&t.update(e),this}isInFrustum(e){let t=this.getBoundingInfo();return!!t&&t.isInFrustum(e,this._mesh.cullingStrategy)}isCompletelyInFrustum(e){let t=this.getBoundingInfo();return!!t&&t.isCompletelyInFrustum(e)}render(e){return this._renderingMesh.render(this,e,this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:void 0),this}_getLinesIndexBuffer(e,t){if(!this._linesIndexBuffer){let i=[];for(let t=this.indexStart;to&&(o=t)}return new nf(e,a,o-a+1,t,i,r,s,n)}}class nm{}class ng{constructor(){var e;this.uniqueId=0,this.metadata={},this._applyTo=(e=this._applyToCoroutine.bind(this),(...t)=>nt(e(...t),void 0)),this.uniqueId=ng._UniqueIDGenerator,ng._UniqueIDGenerator++}set(e,t){switch(e.length||ig.Warn(`Setting vertex data kind '${t}' with an empty array`),t){case sf.PositionKind:this.positions=e;break;case sf.NormalKind:this.normals=e;break;case sf.TangentKind:this.tangents=e;break;case sf.UVKind:this.uvs=e;break;case sf.UV2Kind:this.uvs2=e;break;case sf.UV3Kind:this.uvs3=e;break;case sf.UV4Kind:this.uvs4=e;break;case sf.UV5Kind:this.uvs5=e;break;case sf.UV6Kind:this.uvs6=e;break;case sf.ColorKind:this.colors=e;break;case sf.MatricesIndicesKind:this.matricesIndices=e;break;case sf.MatricesWeightsKind:this.matricesWeights=e;break;case sf.MatricesIndicesExtraKind:this.matricesIndicesExtra=e;break;case sf.MatricesWeightsExtraKind:this.matricesWeightsExtra=e}}applyToMesh(e,t){return this._applyTo(e,t,!1),this}applyToGeometry(e,t){return this._applyTo(e,t,!1),this}updateMesh(e){return this._update(e),this}updateGeometry(e){return this._update(e),this}*_applyToCoroutine(e,t=!1,i){if(this.positions&&(e.setVerticesData(sf.PositionKind,this.positions,t),i&&(yield)),this.normals&&(e.setVerticesData(sf.NormalKind,this.normals,t),i&&(yield)),this.tangents&&(e.setVerticesData(sf.TangentKind,this.tangents,t),i&&(yield)),this.uvs&&(e.setVerticesData(sf.UVKind,this.uvs,t),i&&(yield)),this.uvs2&&(e.setVerticesData(sf.UV2Kind,this.uvs2,t),i&&(yield)),this.uvs3&&(e.setVerticesData(sf.UV3Kind,this.uvs3,t),i&&(yield)),this.uvs4&&(e.setVerticesData(sf.UV4Kind,this.uvs4,t),i&&(yield)),this.uvs5&&(e.setVerticesData(sf.UV5Kind,this.uvs5,t),i&&(yield)),this.uvs6&&(e.setVerticesData(sf.UV6Kind,this.uvs6,t),i&&(yield)),this.colors&&(e.setVerticesData(sf.ColorKind,this.colors,t),i&&(yield)),this.matricesIndices&&(e.setVerticesData(sf.MatricesIndicesKind,this.matricesIndices,t),i&&(yield)),this.matricesWeights&&(e.setVerticesData(sf.MatricesWeightsKind,this.matricesWeights,t),i&&(yield)),this.matricesIndicesExtra&&(e.setVerticesData(sf.MatricesIndicesExtraKind,this.matricesIndicesExtra,t),i&&(yield)),this.matricesWeightsExtra&&(e.setVerticesData(sf.MatricesWeightsExtraKind,this.matricesWeightsExtra,t),i&&(yield)),this.indices?(e.setIndices(this.indices,null,t),i&&(yield)):e.setIndices([],null),e.subMeshes&&this.materialInfos&&this.materialInfos.length>1)for(let t of(e.subMeshes=[],this.materialInfos))new nf(t.materialIndex,t.verticesStart,t.verticesCount,t.indexStart,t.indexCount,e);return this}_update(e,t,i){return this.positions&&e.updateVerticesData(sf.PositionKind,this.positions,t,i),this.normals&&e.updateVerticesData(sf.NormalKind,this.normals,t,i),this.tangents&&e.updateVerticesData(sf.TangentKind,this.tangents,t,i),this.uvs&&e.updateVerticesData(sf.UVKind,this.uvs,t,i),this.uvs2&&e.updateVerticesData(sf.UV2Kind,this.uvs2,t,i),this.uvs3&&e.updateVerticesData(sf.UV3Kind,this.uvs3,t,i),this.uvs4&&e.updateVerticesData(sf.UV4Kind,this.uvs4,t,i),this.uvs5&&e.updateVerticesData(sf.UV5Kind,this.uvs5,t,i),this.uvs6&&e.updateVerticesData(sf.UV6Kind,this.uvs6,t,i),this.colors&&e.updateVerticesData(sf.ColorKind,this.colors,t,i),this.matricesIndices&&e.updateVerticesData(sf.MatricesIndicesKind,this.matricesIndices,t,i),this.matricesWeights&&e.updateVerticesData(sf.MatricesWeightsKind,this.matricesWeights,t,i),this.matricesIndicesExtra&&e.updateVerticesData(sf.MatricesIndicesExtraKind,this.matricesIndicesExtra,t,i),this.matricesWeightsExtra&&e.updateVerticesData(sf.MatricesWeightsExtraKind,this.matricesWeightsExtra,t,i),this.indices&&e.setIndices(this.indices,null),this}static _TransformVector3Coordinates(e,t,i=0,r=e.length){let s=ie.Vector3[0],n=ie.Vector3[1];for(let a=i;ae.determinant();return this.positions&&ng._TransformVector3Coordinates(this.positions,e),this.normals&&ng._TransformVector3Normals(this.normals,e),this.tangents&&ng._TransformVector4Normals(this.tangents,e),t&&this.indices&&ng._FlipFaces(this.indices),this}splitBasedOnMaterialID(){if(!this.materialInfos||this.materialInfos.length<2)return[this];let e=[];for(let t of this.materialInfos){let i=new ng;if(this.positions&&(i.positions=this.positions.slice(3*t.verticesStart,(t.verticesCount+t.verticesStart)*3)),this.normals&&(i.normals=this.normals.slice(3*t.verticesStart,(t.verticesCount+t.verticesStart)*3)),this.tangents&&(i.tangents=this.tangents.slice(4*t.verticesStart,(t.verticesCount+t.verticesStart)*4)),this.colors&&(i.colors=this.colors.slice(4*t.verticesStart,(t.verticesCount+t.verticesStart)*4)),this.uvs&&(i.uvs=this.uvs.slice(2*t.verticesStart,(t.verticesCount+t.verticesStart)*2)),this.uvs2&&(i.uvs2=this.uvs2.slice(2*t.verticesStart,(t.verticesCount+t.verticesStart)*2)),this.uvs3&&(i.uvs3=this.uvs3.slice(2*t.verticesStart,(t.verticesCount+t.verticesStart)*2)),this.uvs4&&(i.uvs4=this.uvs4.slice(2*t.verticesStart,(t.verticesCount+t.verticesStart)*2)),this.uvs5&&(i.uvs5=this.uvs5.slice(2*t.verticesStart,(t.verticesCount+t.verticesStart)*2)),this.uvs6&&(i.uvs6=this.uvs6.slice(2*t.verticesStart,(t.verticesCount+t.verticesStart)*2)),this.matricesIndices&&(i.matricesIndices=this.matricesIndices.slice(4*t.verticesStart,(t.verticesCount+t.verticesStart)*4)),this.matricesIndicesExtra&&(i.matricesIndicesExtra=this.matricesIndicesExtra.slice(4*t.verticesStart,(t.verticesCount+t.verticesStart)*4)),this.matricesWeights&&(i.matricesWeights=this.matricesWeights.slice(4*t.verticesStart,(t.verticesCount+t.verticesStart)*4)),this.matricesWeightsExtra&&(i.matricesWeightsExtra=this.matricesWeightsExtra.slice(4*t.verticesStart,(t.verticesCount+t.verticesStart)*4)),this.indices){i.indices=[];for(let e=t.indexStart;e({vertexData:e})):[{vertexData:e}];return nt(this._mergeCoroutine(void 0,n,t,!1,i,r,s))}*_mergeCoroutine(e,t,i=!1,r,s,n=!1,a=!1){var o,l,h,u;this._validate();let c=t.map(e=>e.vertexData),d=this;if(a)for(let e of c)e&&(e._validate(),!this.normals&&e.normals&&(this.normals=new Float32Array(this.positions.length)),!this.tangents&&e.tangents&&(this.tangents=new Float32Array(this.positions.length/3*4)),!this.uvs&&e.uvs&&(this.uvs=new Float32Array(this.positions.length/3*2)),!this.uvs2&&e.uvs2&&(this.uvs2=new Float32Array(this.positions.length/3*2)),!this.uvs3&&e.uvs3&&(this.uvs3=new Float32Array(this.positions.length/3*2)),!this.uvs4&&e.uvs4&&(this.uvs4=new Float32Array(this.positions.length/3*2)),!this.uvs5&&e.uvs5&&(this.uvs5=new Float32Array(this.positions.length/3*2)),!this.uvs6&&e.uvs6&&(this.uvs6=new Float32Array(this.positions.length/3*2)),!this.colors&&e.colors&&(this.colors=new Float32Array(this.positions.length/3*4),this.colors.fill(1)),!this.matricesIndices&&e.matricesIndices&&(this.matricesIndices=new Float32Array(this.positions.length/3*4)),!this.matricesWeights&&e.matricesWeights&&(this.matricesWeights=new Float32Array(this.positions.length/3*4)),!this.matricesIndicesExtra&&e.matricesIndicesExtra&&(this.matricesIndicesExtra=new Float32Array(this.positions.length/3*4)),!this.matricesWeightsExtra&&e.matricesWeightsExtra&&(this.matricesWeightsExtra=new Float32Array(this.positions.length/3*4)));for(let e of c)if(e){if(a)this.normals&&!e.normals&&(e.normals=new Float32Array(e.positions.length)),this.tangents&&!e.tangents&&(e.tangents=new Float32Array(e.positions.length/3*4)),this.uvs&&!e.uvs&&(e.uvs=new Float32Array(e.positions.length/3*2)),this.uvs2&&!e.uvs2&&(e.uvs2=new Float32Array(e.positions.length/3*2)),this.uvs3&&!e.uvs3&&(e.uvs3=new Float32Array(e.positions.length/3*2)),this.uvs4&&!e.uvs4&&(e.uvs4=new Float32Array(e.positions.length/3*2)),this.uvs5&&!e.uvs5&&(e.uvs5=new Float32Array(e.positions.length/3*2)),this.uvs6&&!e.uvs6&&(e.uvs6=new Float32Array(e.positions.length/3*2)),this.colors&&!e.colors&&(e.colors=new Float32Array(e.positions.length/3*4),e.colors.fill(1)),this.matricesIndices&&!e.matricesIndices&&(e.matricesIndices=new Float32Array(e.positions.length/3*4)),this.matricesWeights&&!e.matricesWeights&&(e.matricesWeights=new Float32Array(e.positions.length/3*4)),this.matricesIndicesExtra&&!e.matricesIndicesExtra&&(e.matricesIndicesExtra=new Float32Array(e.positions.length/3*4)),this.matricesWeightsExtra&&!e.matricesWeightsExtra&&(e.matricesWeightsExtra=new Float32Array(e.positions.length/3*4));else if(e._validate(),!this.normals!=!e.normals||!this.tangents!=!e.tangents||!this.uvs!=!e.uvs||!this.uvs2!=!e.uvs2||!this.uvs3!=!e.uvs3||!this.uvs4!=!e.uvs4||!this.uvs5!=!e.uvs5||!this.uvs6!=!e.uvs6||!this.colors!=!e.colors||!this.matricesIndices!=!e.matricesIndices||!this.matricesWeights!=!e.matricesWeights||!this.matricesIndicesExtra!=!e.matricesIndicesExtra||!this.matricesWeightsExtra!=!e.matricesWeightsExtra)throw Error("Cannot merge vertex data that do not have the same set of attributes")}if(n){let i=0,r=0,s=0,n=[],a=null,o=[];for(let t of this.splitBasedOnMaterialID())o.push({vertexData:t,transform:e});for(let e of t)if(e.vertexData)for(let t of e.vertexData.splitBasedOnMaterialID())o.push({vertexData:t,transform:e.transform});for(let e of(o.sort((e,t)=>{let i=e.vertexData.materialInfos?e.vertexData.materialInfos[0].materialIndex:0,r=t.vertexData.materialInfos?t.vertexData.materialInfos[0].materialIndex:0;return i>r?1:i===r?0:-1}),o)){let t=e.vertexData;if(i=t.materialInfos?t.materialInfos[0].materialIndex:0,a&&a.materialIndex===i)a.indexCount+=t.indices.length,a.verticesCount+=t.positions.length/3;else{let e=new nm;e.materialIndex=i,e.indexStart=r,e.indexCount=t.indices.length,e.verticesStart=s,e.verticesCount=t.positions.length/3,n.push(e),a=e}r+=t.indices.length,s+=t.positions.length/3}let l=o.splice(0,1)[0];d=l.vertexData,e=l.transform,c=o.map(e=>e.vertexData),t=o,this.materialInfos=n}let p=c.reduce((e,t)=>{var i,r;return e+(null!==(r=null===(i=t.indices)||void 0===i?void 0:i.length)&&void 0!==r?r:0)},null!==(l=null===(o=d.indices)||void 0===o?void 0:o.length)&&void 0!==l?l:0),_=s||c.some(e=>e.indices===d.indices)?null===(h=d.indices)||void 0===h?void 0:h.slice():d.indices;if(p>0){let s=null!==(u=null==_?void 0:_.length)&&void 0!==u?u:0;if(_||(_=Array(p)),_.length!==p){if(Array.isArray(_))_.length=p;else{let e=i||_ instanceof Uint32Array?new Uint32Array(p):new Uint16Array(p);e.set(_),_=e}e&&0>e.determinant()&&ng._FlipFaces(_,0,s)}let n=d.positions?d.positions.length/3:0;for(let{vertexData:e,transform:i}of t)if(e.indices){for(let t=0;ti.determinant()&&ng._FlipFaces(_,s,e.indices.length),n+=e.positions.length/3,s+=e.indices.length,r&&(yield)}}return this.indices=_,this.positions=ng._MergeElement(sf.PositionKind,d.positions,e,t.map(e=>[e.vertexData.positions,e.transform])),r&&(yield),d.normals&&(this.normals=ng._MergeElement(sf.NormalKind,d.normals,e,t.map(e=>[e.vertexData.normals,e.transform])),r&&(yield)),d.tangents&&(this.tangents=ng._MergeElement(sf.TangentKind,d.tangents,e,t.map(e=>[e.vertexData.tangents,e.transform])),r&&(yield)),d.uvs&&(this.uvs=ng._MergeElement(sf.UVKind,d.uvs,e,t.map(e=>[e.vertexData.uvs,e.transform])),r&&(yield)),d.uvs2&&(this.uvs2=ng._MergeElement(sf.UV2Kind,d.uvs2,e,t.map(e=>[e.vertexData.uvs2,e.transform])),r&&(yield)),d.uvs3&&(this.uvs3=ng._MergeElement(sf.UV3Kind,d.uvs3,e,t.map(e=>[e.vertexData.uvs3,e.transform])),r&&(yield)),d.uvs4&&(this.uvs4=ng._MergeElement(sf.UV4Kind,d.uvs4,e,t.map(e=>[e.vertexData.uvs4,e.transform])),r&&(yield)),d.uvs5&&(this.uvs5=ng._MergeElement(sf.UV5Kind,d.uvs5,e,t.map(e=>[e.vertexData.uvs5,e.transform])),r&&(yield)),d.uvs6&&(this.uvs6=ng._MergeElement(sf.UV6Kind,d.uvs6,e,t.map(e=>[e.vertexData.uvs6,e.transform])),r&&(yield)),d.colors&&(this.colors=ng._MergeElement(sf.ColorKind,d.colors,e,t.map(e=>[e.vertexData.colors,e.transform])),r&&(yield)),d.matricesIndices&&(this.matricesIndices=ng._MergeElement(sf.MatricesIndicesKind,d.matricesIndices,e,t.map(e=>[e.vertexData.matricesIndices,e.transform])),r&&(yield)),d.matricesWeights&&(this.matricesWeights=ng._MergeElement(sf.MatricesWeightsKind,d.matricesWeights,e,t.map(e=>[e.vertexData.matricesWeights,e.transform])),r&&(yield)),d.matricesIndicesExtra&&(this.matricesIndicesExtra=ng._MergeElement(sf.MatricesIndicesExtraKind,d.matricesIndicesExtra,e,t.map(e=>[e.vertexData.matricesIndicesExtra,e.transform])),r&&(yield)),d.matricesWeightsExtra&&(this.matricesWeightsExtra=ng._MergeElement(sf.MatricesWeightsExtraKind,d.matricesWeightsExtra,e,t.map(e=>[e.vertexData.matricesWeightsExtra,e.transform]))),this}static _MergeElement(e,t,i,r){let s=r.filter(e=>null!==e[0]&&void 0!==e[0]);if(!t&&0==s.length)return t;if(!t)return this._MergeElement(e,s[0][0],s[0][1],s.slice(1));let n=s.reduce((e,t)=>e+t[0].length,t.length),a=e===sf.PositionKind?ng._TransformVector3Coordinates:e===sf.NormalKind?ng._TransformVector3Normals:e===sf.TangentKind?ng._TransformVector4Normals:()=>{};if(t instanceof Float32Array){let e=new Float32Array(n);e.set(t),i&&a(e,i,0,t.length);let r=t.length;for(let[t,i]of s)e.set(t,r),i&&a(e,i,r,t.length),r+=t.length;return e}{let e=Array(n);for(let i=0;i{let i=sf.DeduceStride(e);if(t.length%i!=0)throw Error("The "+e+"s array count must be a multiple of "+i);return t.length/i},t=e(sf.PositionKind,this.positions),i=(i,r)=>{let s=e(i,r);if(s!==t)throw Error("The "+i+"s element count ("+s+") does not match the positions count ("+t+")")};this.normals&&i(sf.NormalKind,this.normals),this.tangents&&i(sf.TangentKind,this.tangents),this.uvs&&i(sf.UVKind,this.uvs),this.uvs2&&i(sf.UV2Kind,this.uvs2),this.uvs3&&i(sf.UV3Kind,this.uvs3),this.uvs4&&i(sf.UV4Kind,this.uvs4),this.uvs5&&i(sf.UV5Kind,this.uvs5),this.uvs6&&i(sf.UV6Kind,this.uvs6),this.colors&&i(sf.ColorKind,this.colors),this.matricesIndices&&i(sf.MatricesIndicesKind,this.matricesIndices),this.matricesWeights&&i(sf.MatricesWeightsKind,this.matricesWeights),this.matricesIndicesExtra&&i(sf.MatricesIndicesExtraKind,this.matricesIndicesExtra),this.matricesWeightsExtra&&i(sf.MatricesWeightsExtraKind,this.matricesWeightsExtra)}clone(){let e=this.serialize();return ng.Parse(e)}serialize(){let e={};if(this.positions&&(e.positions=Array.from(this.positions)),this.normals&&(e.normals=Array.from(this.normals)),this.tangents&&(e.tangents=Array.from(this.tangents)),this.uvs&&(e.uvs=Array.from(this.uvs)),this.uvs2&&(e.uvs2=Array.from(this.uvs2)),this.uvs3&&(e.uvs3=Array.from(this.uvs3)),this.uvs4&&(e.uvs4=Array.from(this.uvs4)),this.uvs5&&(e.uvs5=Array.from(this.uvs5)),this.uvs6&&(e.uvs6=Array.from(this.uvs6)),this.colors&&(e.colors=Array.from(this.colors)),this.matricesIndices&&(e.matricesIndices=Array.from(this.matricesIndices),e.matricesIndices._isExpanded=!0),this.matricesWeights&&(e.matricesWeights=Array.from(this.matricesWeights)),this.matricesIndicesExtra&&(e.matricesIndicesExtra=Array.from(this.matricesIndicesExtra),e.matricesIndicesExtra._isExpanded=!0),this.matricesWeightsExtra&&(e.matricesWeightsExtra=Array.from(this.matricesWeightsExtra)),e.indices=Array.from(this.indices),this.materialInfos)for(let t of(e.materialInfos=[],this.materialInfos)){let i={indexStart:t.indexStart,indexCount:t.indexCount,materialIndex:t.materialIndex,verticesStart:t.verticesStart,verticesCount:t.verticesCount};e.materialInfos.push(i)}return e}static ExtractFromMesh(e,t,i){return ng._ExtractFrom(e,t,i)}static ExtractFromGeometry(e,t,i){return ng._ExtractFrom(e,t,i)}static _ExtractFrom(e,t,i){let r=new ng;return e.isVerticesDataPresent(sf.PositionKind)&&(r.positions=e.getVerticesData(sf.PositionKind,t,i)),e.isVerticesDataPresent(sf.NormalKind)&&(r.normals=e.getVerticesData(sf.NormalKind,t,i)),e.isVerticesDataPresent(sf.TangentKind)&&(r.tangents=e.getVerticesData(sf.TangentKind,t,i)),e.isVerticesDataPresent(sf.UVKind)&&(r.uvs=e.getVerticesData(sf.UVKind,t,i)),e.isVerticesDataPresent(sf.UV2Kind)&&(r.uvs2=e.getVerticesData(sf.UV2Kind,t,i)),e.isVerticesDataPresent(sf.UV3Kind)&&(r.uvs3=e.getVerticesData(sf.UV3Kind,t,i)),e.isVerticesDataPresent(sf.UV4Kind)&&(r.uvs4=e.getVerticesData(sf.UV4Kind,t,i)),e.isVerticesDataPresent(sf.UV5Kind)&&(r.uvs5=e.getVerticesData(sf.UV5Kind,t,i)),e.isVerticesDataPresent(sf.UV6Kind)&&(r.uvs6=e.getVerticesData(sf.UV6Kind,t,i)),e.isVerticesDataPresent(sf.ColorKind)&&(r.colors=e.getVerticesData(sf.ColorKind,t,i)),e.isVerticesDataPresent(sf.MatricesIndicesKind)&&(r.matricesIndices=e.getVerticesData(sf.MatricesIndicesKind,t,i)),e.isVerticesDataPresent(sf.MatricesWeightsKind)&&(r.matricesWeights=e.getVerticesData(sf.MatricesWeightsKind,t,i)),e.isVerticesDataPresent(sf.MatricesIndicesExtraKind)&&(r.matricesIndicesExtra=e.getVerticesData(sf.MatricesIndicesExtraKind,t,i)),e.isVerticesDataPresent(sf.MatricesWeightsExtraKind)&&(r.matricesWeightsExtra=e.getVerticesData(sf.MatricesWeightsExtraKind,t,i)),r.indices=e.getIndices(t,i),r}static CreateRibbon(e){throw iL("ribbonBuilder")}static CreateBox(e){throw iL("boxBuilder")}static CreateTiledBox(e){throw iL("tiledBoxBuilder")}static CreateTiledPlane(e){throw iL("tiledPlaneBuilder")}static CreateSphere(e){throw iL("sphereBuilder")}static CreateCylinder(e){throw iL("cylinderBuilder")}static CreateTorus(e){throw iL("torusBuilder")}static CreateLineSystem(e){throw iL("linesBuilder")}static CreateDashedLines(e){throw iL("linesBuilder")}static CreateGround(e){throw iL("groundBuilder")}static CreateTiledGround(e){throw iL("groundBuilder")}static CreateGroundFromHeightMap(e){throw iL("groundBuilder")}static CreatePlane(e){throw iL("planeBuilder")}static CreateDisc(e){throw iL("discBuilder")}static CreatePolygon(e,t,i,r,s,n,a){throw iL("polygonBuilder")}static CreateIcoSphere(e){throw iL("icoSphereBuilder")}static CreatePolyhedron(e){throw iL("polyhedronBuilder")}static CreateCapsule(e={orientation:t5.Up(),subdivisions:2,tessellation:16,height:1,radius:.25,capSubdivisions:6}){throw iL("capsuleBuilder")}static CreateTorusKnot(e){throw iL("torusKnotBuilder")}static ComputeNormals(e,t,i,r){let s=0,n=0,a=0,o=0,l=0,h=0,u=0,c=0,d=0,p=0,_=0,f=0,m=0,g=0,v=0,x=0,T=0,b=0,E=0,S=0,C=!1,y=!1,A=!1,R=!1,I=1,P=0,M=null;r&&(C=!!r.facetNormals,y=!!r.facetPositions,A=!!r.facetPartitioning,I=!0===r.useRightHandedSystem?-1:1,P=r.ratio||0,R=!!r.depthSort,M=r.distanceTo,R&&void 0===M&&(M=t5.Zero()));let D=0,O=0,N=0,F=0;for(A&&r&&r.bbSize&&(D=r.subDiv.X*P/r.bbSize.x,O=r.subDiv.Y*P/r.bbSize.y,N=r.subDiv.Z*P/r.bbSize.z,F=r.subDiv.max*r.subDiv.max,r.facetPartitioning.length=0),s=0;s!Array.isArray(e))],ng,"_TransformVector3Coordinates",null),iZ([iq.filter((...[e])=>!Array.isArray(e))],ng,"_TransformVector3Normals",null),iZ([iq.filter((...[e])=>!Array.isArray(e))],ng,"_TransformVector4Normals",null),iZ([iq.filter((...[e])=>!Array.isArray(e))],ng,"_FlipFaces",null);class nv{static get ForceFullSceneLoadingForIncremental(){return nv._ForceFullSceneLoadingForIncremental}static set ForceFullSceneLoadingForIncremental(e){nv._ForceFullSceneLoadingForIncremental=e}static get ShowLoadingScreen(){return nv._ShowLoadingScreen}static set ShowLoadingScreen(e){nv._ShowLoadingScreen=e}static get loggingLevel(){return nv._LoggingLevel}static set loggingLevel(e){nv._LoggingLevel=e}static get CleanBoneMatrixWeights(){return nv._CleanBoneMatrixWeights}static set CleanBoneMatrixWeights(e){nv._CleanBoneMatrixWeights=e}}nv._ForceFullSceneLoadingForIncremental=!1,nv._ShowLoadingScreen=!0,nv._CleanBoneMatrixWeights=!1,nv._LoggingLevel=0;class nx{}nx.UseOpenGLOrientationForUV=!1;class nT{get boundingBias(){return this._boundingBias}set boundingBias(e){this._boundingBias?this._boundingBias.copyFrom(e):this._boundingBias=e.clone(),this._updateBoundingInfo(!0,null)}static CreateGeometryForMesh(e){let t=new nT(nT.RandomId(),e.getScene());return t.applyToMesh(e),t}get meshes(){return this._meshes}constructor(e,t,i,r=!1,s=null){if(this.delayLoadState=0,this._totalVertices=0,this._isDisposed=!1,this._indexBufferIsUpdatable=!1,this._positionsCache=[],this._parentContainer=null,this.useBoundingInfoFromGeometry=!1,this._scene=t||t2.LastCreatedScene,!this._scene)return;this.id=e,this.uniqueId=this._scene.getUniqueId(),this._engine=this._scene.getEngine(),this._meshes=[],this._vertexBuffers={},this._indices=[],this._updatable=r,i?this.setAllVerticesData(i,r):this._totalVertices=0,this._engine.getCaps().vertexArrayObject&&(this._vertexArrayObjects={}),s&&(this.applyToMesh(s),s.computeWorldMatrix(!0))}get extend(){return this._extend}getScene(){return this._scene}getEngine(){return this._engine}isReady(){return 1===this.delayLoadState||0===this.delayLoadState}get doNotSerialize(){for(let e=0;e65535),this._meshes))r._createGlobalSubMesh(!0),r.synchronizeInstances();this._notifyUpdate()}setIndices(e,t=null,i=!1){for(let r of(this._indexBuffer&&this._engine._releaseBuffer(this._indexBuffer),this._indices=e,this._indexBufferIsUpdatable=i,0!==this._meshes.length&&this._indices&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices,i,"Geometry_"+this.id+"_IndexBuffer")),void 0!=t&&(this._totalVertices=t),this._meshes))r._createGlobalSubMesh(!0),r.synchronizeInstances();this._notifyUpdate()}getTotalIndices(){return this.isReady()?void 0!==this._totalIndices?this._totalIndices:this._indices.length:0}getIndices(e,t){if(!this.isReady())return null;let i=this._indices;return t||e&&1!==this._meshes.length?i.slice():i}getIndexBuffer(){return this.isReady()?this._indexBuffer:null}_releaseVertexArrayObject(e=null){e&&this._vertexArrayObjects&&this._vertexArrayObjects[e.key]&&(this._engine.releaseVertexArrayObject(this._vertexArrayObjects[e.key]),delete this._vertexArrayObjects[e.key])}releaseForMesh(e,t){let i=this._meshes,r=i.indexOf(e);-1!==r&&(i.splice(r,1),this._vertexArrayObjects&&e._invalidateInstanceVertexArrayObject(),e._geometry=null,0===i.length&&t&&this.dispose())}applyToMesh(e){if(e._geometry===this)return;let t=e._geometry;t&&t.releaseForMesh(e),this._vertexArrayObjects&&e._invalidateInstanceVertexArrayObject();let i=this._meshes;e._geometry=this,e._internalAbstractMeshDataInfo._positions=null,this._scene.pushGeometry(this),i.push(e),this.isReady()?this._applyToMesh(e):this._boundingInfo&&e.setBoundingInfo(this._boundingInfo)}_updateExtend(e=null){if(this.useBoundingInfoFromGeometry&&this._boundingInfo)this._extend={minimum:this._boundingInfo.minimum.clone(),maximum:this._boundingInfo.maximum.clone()};else{if(!e&&!(e=this.getVerticesData(sf.PositionKind)))return;this._extend=n_(e,0,this._totalVertices,this.boundingBias,3)}}_applyToMesh(e){let t=this._meshes.length;for(let i in this._vertexBuffers)1===t&&this._vertexBuffers[i].create(),i===sf.PositionKind&&(this._extend||this._updateExtend(),e.buildBoundingInfo(this._extend.minimum,this._extend.maximum),e._createGlobalSubMesh(e.isUnIndexed),e._updateBoundingInfo());1===t&&this._indices&&this._indices.length>0&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices,this._updatable,"Geometry_"+this.id+"_IndexBuffer")),e._syncGeometryWithMorphTargetManager(),e.synchronizeInstances()}_notifyUpdate(e){for(let t of(this.onGeometryUpdated&&this.onGeometryUpdated(this,e),this._vertexArrayObjects&&this._disposeVertexArrayObjects(),this._meshes))t._markSubMeshesAsAttributesDirty()}load(e,t){if(2!==this.delayLoadState){if(this.isReady()){t&&t();return}this.delayLoadState=2,this._queueLoad(e,t)}}_queueLoad(e,t){this.delayLoadingFile&&(e.addPendingData(this),e._loadFile(this.delayLoadingFile,i=>{if(!this._delayLoadingFunction)return;this._delayLoadingFunction(JSON.parse(i),this),this.delayLoadState=1,this._delayInfo=[],e.removePendingData(this);let r=this._meshes,s=r.length;for(let e=0;e0){for(let t=0;t0){for(let e=0;e0){for(let e=0;e-1&&this._parentContainer.geometries.splice(e,1),this._parentContainer=null}this._isDisposed=!0}copy(e){let t;let i=new ng;i.indices=[];let r=this.getIndices();if(r)for(let e=0;e0){let r=new Float32Array(e,i.positionsAttrDesc.offset,i.positionsAttrDesc.count);t.setVerticesData(sf.PositionKind,r,!1)}if(i.normalsAttrDesc&&i.normalsAttrDesc.count>0){let r=new Float32Array(e,i.normalsAttrDesc.offset,i.normalsAttrDesc.count);t.setVerticesData(sf.NormalKind,r,!1)}if(i.tangetsAttrDesc&&i.tangetsAttrDesc.count>0){let r=new Float32Array(e,i.tangetsAttrDesc.offset,i.tangetsAttrDesc.count);t.setVerticesData(sf.TangentKind,r,!1)}if(i.uvsAttrDesc&&i.uvsAttrDesc.count>0){let r=new Float32Array(e,i.uvsAttrDesc.offset,i.uvsAttrDesc.count);if(nx.UseOpenGLOrientationForUV)for(let e=1;e0){let r=new Float32Array(e,i.uvs2AttrDesc.offset,i.uvs2AttrDesc.count);if(nx.UseOpenGLOrientationForUV)for(let e=1;e0){let r=new Float32Array(e,i.uvs3AttrDesc.offset,i.uvs3AttrDesc.count);if(nx.UseOpenGLOrientationForUV)for(let e=1;e0){let r=new Float32Array(e,i.uvs4AttrDesc.offset,i.uvs4AttrDesc.count);if(nx.UseOpenGLOrientationForUV)for(let e=1;e0){let r=new Float32Array(e,i.uvs5AttrDesc.offset,i.uvs5AttrDesc.count);if(nx.UseOpenGLOrientationForUV)for(let e=1;e0){let r=new Float32Array(e,i.uvs6AttrDesc.offset,i.uvs6AttrDesc.count);if(nx.UseOpenGLOrientationForUV)for(let e=1;e0){let r=new Float32Array(e,i.colorsAttrDesc.offset,i.colorsAttrDesc.count);t.setVerticesData(sf.ColorKind,r,!1,i.colorsAttrDesc.stride)}if(i.matricesIndicesAttrDesc&&i.matricesIndicesAttrDesc.count>0){let r=new Int32Array(e,i.matricesIndicesAttrDesc.offset,i.matricesIndicesAttrDesc.count),s=[];for(let e=0;e>8),s.push((16711680&t)>>16),s.push(t>>24&255)}t.setVerticesData(sf.MatricesIndicesKind,s,!1)}if(i.matricesIndicesExtraAttrDesc&&i.matricesIndicesExtraAttrDesc.count>0){let r=new Int32Array(e,i.matricesIndicesExtraAttrDesc.offset,i.matricesIndicesExtraAttrDesc.count),s=[];for(let e=0;e>8),s.push((16711680&t)>>16),s.push(t>>24&255)}t.setVerticesData(sf.MatricesIndicesExtraKind,s,!1)}if(i.matricesWeightsAttrDesc&&i.matricesWeightsAttrDesc.count>0){let r=new Float32Array(e,i.matricesWeightsAttrDesc.offset,i.matricesWeightsAttrDesc.count);t.setVerticesData(sf.MatricesWeightsKind,r,!1)}if(i.indicesAttrDesc&&i.indicesAttrDesc.count>0){let r=new Int32Array(e,i.indicesAttrDesc.offset,i.indicesAttrDesc.count);t.setIndices(r,null)}if(i.subMeshesAttrDesc&&i.subMeshesAttrDesc.count>0){let r=new Int32Array(e,i.subMeshesAttrDesc.offset,5*i.subMeshesAttrDesc.count);t.subMeshes=[];for(let e=0;e>8),i.push((16711680&r)>>16),i.push(r>>24&255)}t.setVerticesData(sf.MatricesIndicesKind,i,e.matricesIndices._updatable)}}if(e.matricesIndicesExtra){if(e.matricesIndicesExtra._isExpanded)delete e.matricesIndices._isExpanded,t.setVerticesData(sf.MatricesIndicesExtraKind,e.matricesIndicesExtra,e.matricesIndicesExtra._updatable);else{let i=[];for(let t=0;t>8),i.push((16711680&r)>>16),i.push(r>>24&255)}t.setVerticesData(sf.MatricesIndicesExtraKind,i,e.matricesIndicesExtra._updatable)}}e.matricesWeights&&(nT._CleanMatricesWeights(e,t),t.setVerticesData(sf.MatricesWeightsKind,e.matricesWeights,e.matricesWeights._updatable)),e.matricesWeightsExtra&&t.setVerticesData(sf.MatricesWeightsExtraKind,e.matricesWeightsExtra,e.matricesWeights._updatable),t.setIndices(e.indices,null)}if(e.subMeshes){t.subMeshes=[];for(let i=0;i-1))return;{let r=t.getScene().getLastSkeletonById(e.skeletonId);if(!r)return;i=r.bones.length}let r=t.getVerticesData(sf.MatricesIndicesKind),s=t.getVerticesData(sf.MatricesIndicesExtraKind),n=e.matricesWeights,a=e.matricesWeightsExtra,o=e.numBoneInfluencer,l=n.length;for(let e=0;eo-1)&&(l=o-1),t>.001){let i=1/t;for(let t=0;t<4;t++)n[e+t]*=i;if(a)for(let t=0;t<4;t++)a[e+t]*=i}else l>=4?(a[e+l-4]=1-t,s[e+l-4]=i):(n[e+l]=1-t,r[e+l]=i)}t.setVerticesData(sf.MatricesIndicesKind,r),e.matricesWeightsExtra&&t.setVerticesData(sf.MatricesIndicesExtraKind,s)}static Parse(e,t,i){let r=new nT(e.id,t,void 0,e.updatable);return r._loadedUniqueId=e.uniqueId,iF&&iF.AddTagsTo(r,e.tags),e.delayLoadingFile?(r.delayLoadState=4,r.delayLoadingFile=i+e.delayLoadingFile,r._boundingInfo=new nd(t5.FromArray(e.boundingBoxMinimum),t5.FromArray(e.boundingBoxMaximum)),r._delayInfo=[],e.hasUVs&&r._delayInfo.push(sf.UVKind),e.hasUVs2&&r._delayInfo.push(sf.UV2Kind),e.hasUVs3&&r._delayInfo.push(sf.UV3Kind),e.hasUVs4&&r._delayInfo.push(sf.UV4Kind),e.hasUVs5&&r._delayInfo.push(sf.UV5Kind),e.hasUVs6&&r._delayInfo.push(sf.UV6Kind),e.hasColors&&r._delayInfo.push(sf.ColorKind),e.hasMatricesIndices&&r._delayInfo.push(sf.MatricesIndicesKind),e.hasMatricesWeights&&r._delayInfo.push(sf.MatricesWeightsKind),r._delayLoadingFunction=ng.ImportVertexData):ng.ImportVertexData(e,r),t.pushGeometry(r,!0),r}}class nb{constructor(e=30){this._enabled=!0,this._rollingFrameTime=new nE(e)}sampleFrame(e=ra.Now){if(this._enabled){if(null!=this._lastFrameTimeMs){let t=e-this._lastFrameTimeMs;this._rollingFrameTime.add(t)}this._lastFrameTimeMs=e}}get averageFrameTime(){return this._rollingFrameTime.average}get averageFrameTimeVariance(){return this._rollingFrameTime.variance}get instantaneousFrameTime(){return this._rollingFrameTime.history(0)}get averageFPS(){return 1e3/this._rollingFrameTime.average}get instantaneousFPS(){let e=this._rollingFrameTime.history(0);return 0===e?0:1e3/e}get isSaturated(){return this._rollingFrameTime.isSaturated()}enable(){this._enabled=!0}disable(){this._enabled=!1,this._lastFrameTimeMs=null}get isEnabled(){return this._enabled}reset(){this._lastFrameTimeMs=null,this._rollingFrameTime.reset()}}class nE{constructor(e){this._samples=Array(e),this.reset()}add(e){let t;if(this.isSaturated()){let e=this._samples[this._pos];t=e-this.average,this.average-=t/(this._sampleCount-1),this._m2-=t*(e-this.average)}else this._sampleCount++;t=e-this.average,this.average+=t/this._sampleCount,this._m2+=t*(e-this.average),this.variance=this._m2/(this._sampleCount-1),this._samples[this._pos]=e,this._pos++,this._pos%=this._samples.length}history(e){if(e>=this._sampleCount||e>=this._samples.length)return 0;let t=this._wrapPosition(this._pos-1);return this._samples[this._wrapPosition(t-e)]}isSaturated(){return this._sampleCount>=this._samples.length}reset(){this.average=0,this.variance=0,this._sampleCount=0,this._pos=0,this._m2=0}_wrapPosition(e){let t=this._samples.length;return(e%t+t)%t}}function nS(e,t,i=!1,r){switch(e){case 3:{let e=(ArrayBuffer,new Int8Array(t));return r&&e.set(new Int8Array(r)),e}case 0:{let e=(ArrayBuffer,new Uint8Array(t));return r&&e.set(new Uint8Array(r)),e}case 4:{let e=new Int16Array(t instanceof ArrayBuffer?t:i?t/2:t);return r&&e.set(new Int16Array(r)),e}case 5:case 8:case 9:case 10:case 2:{let e=new Uint16Array(t instanceof ArrayBuffer?t:i?t/2:t);return r&&e.set(new Uint16Array(r)),e}case 6:{let e=new Int32Array(t instanceof ArrayBuffer?t:i?t/4:t);return r&&e.set(new Int32Array(r)),e}case 7:case 11:case 12:case 13:case 14:case 15:{let e=new Uint32Array(t instanceof ArrayBuffer?t:i?t/4:t);return r&&e.set(new Uint32Array(r)),e}case 1:{let e=new Float32Array(t instanceof ArrayBuffer?t:i?t/4:t);return r&&e.set(new Float32Array(r)),e}}let s=(ArrayBuffer,new Uint8Array(t));return r&&s.set(new Uint8Array(r)),s}r$.prototype.setAlphaConstants=function(e,t,i,r){this._alphaState.setAlphaBlendConstants(e,t,i,r)},r$.prototype.setAlphaMode=function(e,t=!1){if(this._alphaMode===e){if(!t){let t=0===e;this.depthCullingState.depthMask!==t&&(this.depthCullingState.depthMask=t)}return}switch(e){case 0:this._alphaState.alphaBlend=!1;break;case 7:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 8:case 14:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case 2:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 6:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 1:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 3:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 4:this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR,this._gl.ZERO,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 5:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 9:this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR,this._gl.ONE_MINUS_CONSTANT_COLOR,this._gl.CONSTANT_ALPHA,this._gl.ONE_MINUS_CONSTANT_ALPHA),this._alphaState.alphaBlend=!0;break;case 10:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case 11:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 12:this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA,this._gl.ONE,this._gl.ZERO,this._gl.ZERO),this._alphaState.alphaBlend=!0;break;case 13:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE_MINUS_DST_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case 15:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ONE,this._gl.ZERO),this._alphaState.alphaBlend=!0;break;case 16:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 17:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0}t||(this.depthCullingState.depthMask=0===e),this._alphaMode=e},r$.prototype.getAlphaMode=function(){return this._alphaMode},r$.prototype.setAlphaEquation=function(e){if(this._alphaEquation!==e){switch(e){case 0:this._alphaState.setAlphaEquationParameters(32774,32774);break;case 1:this._alphaState.setAlphaEquationParameters(32778,32778);break;case 2:this._alphaState.setAlphaEquationParameters(32779,32779);break;case 3:this._alphaState.setAlphaEquationParameters(32776,32776);break;case 4:this._alphaState.setAlphaEquationParameters(32775,32775);break;case 5:this._alphaState.setAlphaEquationParameters(32775,32774)}this._alphaEquation=e}},r$.prototype.getAlphaEquation=function(){return this._alphaEquation},r$.prototype._readTexturePixelsSync=function(e,t,i,r=-1,s=0,n=null,a=!0,o=!1,l=0,h=0){var u,c;let d=this._gl;if(!d)throw Error("Engine does not have gl rendering context.");if(!this._dummyFramebuffer){let e=d.createFramebuffer();if(!e)throw Error("Unable to create dummy framebuffer");this._dummyFramebuffer=e}d.bindFramebuffer(d.FRAMEBUFFER,this._dummyFramebuffer),r>-1?d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_CUBE_MAP_POSITIVE_X+r,null===(u=e._hardwareTexture)||void 0===u?void 0:u.underlyingResource,s):d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,null===(c=e._hardwareTexture)||void 0===c?void 0:c.underlyingResource,s);let p=void 0!==e.type?this._getWebGLTextureType(e.type):d.UNSIGNED_BYTE;return o?n||(n=nS(e.type,4*t*i)):p===d.UNSIGNED_BYTE?(n||(n=new Uint8Array(4*t*i)),p=d.UNSIGNED_BYTE):(n||(n=new Float32Array(4*t*i)),p=d.FLOAT),a&&this.flushFramebuffer(),d.readPixels(l,h,t,i,d.RGBA,p,n),d.bindFramebuffer(d.FRAMEBUFFER,this._currentFramebuffer),n},r$.prototype._readTexturePixels=function(e,t,i,r=-1,s=0,n=null,a=!0,o=!1,l=0,h=0){return Promise.resolve(this._readTexturePixelsSync(e,t,i,r,s,n,a,o,l,h))},r$.prototype.updateDynamicIndexBuffer=function(e,t,i=0){let r;this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER]=null,this.bindIndexBuffer(e),r=e.is32Bits?t instanceof Uint32Array?t:new Uint32Array(t):t instanceof Uint16Array?t:new Uint16Array(t),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,r,this._gl.DYNAMIC_DRAW),this._resetIndexBufferBinding()},r$.prototype.updateDynamicVertexBuffer=function(e,t,i,r){this.bindArrayBuffer(e),void 0===i&&(i=0);let s=t.byteLength||t.length;void 0===r||r>=s&&0===i?t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,i,new Float32Array(t)):this._gl.bufferSubData(this._gl.ARRAY_BUFFER,i,t):t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,new Float32Array(t).subarray(i,i+r)):(t=t instanceof ArrayBuffer?new Uint8Array(t,i,r):new Uint8Array(t.buffer,t.byteOffset+i,r),this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,t)),this._resetVertexBufferBinding()};class nC extends r${static get NpmPackage(){return r$.NpmPackage}static get Version(){return r$.Version}static get Instances(){return t2.Instances}static get LastCreatedEngine(){return t2.LastCreatedEngine}static get LastCreatedScene(){return t2.LastCreatedScene}_createImageBitmapFromSource(e,t){return new Promise((i,r)=>{let s=new Image;s.onload=()=>{s.decode().then(()=>{this.createImageBitmap(s,t).then(e=>{i(e)})})},s.onerror=()=>{r(`Error loading image ${s.src}`)},s.src=e})}createImageBitmap(e,t){return createImageBitmap(e,t)}resizeImageBitmap(e,t,i){let r=this.createCanvas(t,i).getContext("2d");if(!r)throw Error("Unable to get 2d context for resizeImageBitmap");return r.drawImage(e,0,0),r.getImageData(0,0,t,i).data}static MarkAllMaterialsAsDirty(e,t){for(let i=0;i{this.onCanvasFocusObservable.notifyObservers(this)},this._onCanvasBlur=()=>{this.onCanvasBlurObservable.notifyObservers(this)},this._onCanvasContextMenu=e=>{this.disableContextMenu&&e.preventDefault()},e.addEventListener("focus",this._onCanvasFocus),e.addEventListener("blur",this._onCanvasBlur),e.addEventListener("contextmenu",this._onCanvasContextMenu),this._onBlur=()=>{this.disablePerformanceMonitorInBackground&&this._performanceMonitor.disable(),this._windowIsBackground=!0},this._onFocus=()=>{this.disablePerformanceMonitorInBackground&&this._performanceMonitor.enable(),this._windowIsBackground=!1},this._onCanvasPointerOut=t=>{document.elementFromPoint(t.clientX,t.clientY)!==e&&this.onCanvasPointerOutObservable.notifyObservers(t)};let t=this.getHostWindow();t&&"function"==typeof t.addEventListener&&(t.addEventListener("blur",this._onBlur),t.addEventListener("focus",this._onFocus)),e.addEventListener("pointerout",this._onCanvasPointerOut),this._creationOptions.doNotHandleTouchAction||this._disableTouchAction(),!nC.audioEngine&&this._creationOptions.audioEngine&&nC.AudioEngineFactory&&(nC.audioEngine=nC.AudioEngineFactory(this.getRenderingCanvas(),this.getAudioContext(),this.getAudioDestination())),rs()&&(this._onFullscreenChange=()=>{this.isFullscreen=!!document.fullscreenElement,this.isFullscreen&&this._pointerLockRequested&&e&&nC._RequestPointerlock(e)},document.addEventListener("fullscreenchange",this._onFullscreenChange,!1),document.addEventListener("webkitfullscreenchange",this._onFullscreenChange,!1),this._onPointerLockChange=()=>{this.isPointerLock=document.pointerLockElement===e},document.addEventListener("pointerlockchange",this._onPointerLockChange,!1),document.addEventListener("webkitpointerlockchange",this._onPointerLockChange,!1)),this.enableOfflineSupport=void 0!==nC.OfflineProviderFactory,this._deterministicLockstep=!!this._creationOptions.deterministicLockstep,this._lockstepMaxSteps=this._creationOptions.lockstepMaxSteps||0,this._timeStep=this._creationOptions.timeStep||1/60}_verifyPointerLock(){var e;null===(e=this._onPointerLockChange)||void 0===e||e.call(this)}getAspectRatio(e,t=!1){let i=e.viewport;return this.getRenderWidth(t)*i.width/(this.getRenderHeight(t)*i.height)}getScreenAspectRatio(){return this.getRenderWidth(!0)/this.getRenderHeight(!0)}getRenderingCanvasClientRect(){return this._renderingCanvas?this._renderingCanvas.getBoundingClientRect():null}getInputElementClientRect(){return this._renderingCanvas?this.getInputElement().getBoundingClientRect():null}isDeterministicLockStep(){return this._deterministicLockstep}getLockstepMaxSteps(){return this._lockstepMaxSteps}getTimeStep(){return 1e3*this._timeStep}generateMipMapsForCubemap(e,t=!0){if(e.generateMipMaps){let i=this._gl;this._bindTextureDirectly(i.TEXTURE_CUBE_MAP,e,!0),i.generateMipmap(i.TEXTURE_CUBE_MAP),t&&this._bindTextureDirectly(i.TEXTURE_CUBE_MAP,null)}}getDepthWrite(){return this._depthCullingState.depthMask}setDepthWrite(e){this._depthCullingState.depthMask=e}getStencilBuffer(){return this._stencilState.stencilTest}setStencilBuffer(e){this._stencilState.stencilTest=e}getStencilMask(){return this._stencilState.stencilMask}setStencilMask(e){this._stencilState.stencilMask=e}getStencilFunction(){return this._stencilState.stencilFunc}getStencilFunctionReference(){return this._stencilState.stencilFuncRef}getStencilFunctionMask(){return this._stencilState.stencilFuncMask}setStencilFunction(e){this._stencilState.stencilFunc=e}setStencilFunctionReference(e){this._stencilState.stencilFuncRef=e}setStencilFunctionMask(e){this._stencilState.stencilFuncMask=e}getStencilOperationFail(){return this._stencilState.stencilOpStencilFail}getStencilOperationDepthFail(){return this._stencilState.stencilOpDepthFail}getStencilOperationPass(){return this._stencilState.stencilOpStencilDepthPass}setStencilOperationFail(e){this._stencilState.stencilOpStencilFail=e}setStencilOperationDepthFail(e){this._stencilState.stencilOpDepthFail=e}setStencilOperationPass(e){this._stencilState.stencilOpStencilDepthPass=e}setDitheringState(e){e?this._gl.enable(this._gl.DITHER):this._gl.disable(this._gl.DITHER)}setRasterizerState(e){e?this._gl.disable(this._gl.RASTERIZER_DISCARD):this._gl.enable(this._gl.RASTERIZER_DISCARD)}getDepthFunction(){return this._depthCullingState.depthFunc}setDepthFunction(e){this._depthCullingState.depthFunc=e}setDepthFunctionToGreater(){this.setDepthFunction(516)}setDepthFunctionToGreaterOrEqual(){this.setDepthFunction(518)}setDepthFunctionToLess(){this.setDepthFunction(513)}setDepthFunctionToLessOrEqual(){this.setDepthFunction(515)}cacheStencilState(){this._cachedStencilBuffer=this.getStencilBuffer(),this._cachedStencilFunction=this.getStencilFunction(),this._cachedStencilMask=this.getStencilMask(),this._cachedStencilOperationPass=this.getStencilOperationPass(),this._cachedStencilOperationFail=this.getStencilOperationFail(),this._cachedStencilOperationDepthFail=this.getStencilOperationDepthFail(),this._cachedStencilReference=this.getStencilFunctionReference()}restoreStencilState(){this.setStencilFunction(this._cachedStencilFunction),this.setStencilMask(this._cachedStencilMask),this.setStencilBuffer(this._cachedStencilBuffer),this.setStencilOperationPass(this._cachedStencilOperationPass),this.setStencilOperationFail(this._cachedStencilOperationFail),this.setStencilOperationDepthFail(this._cachedStencilOperationDepthFail),this.setStencilFunctionReference(this._cachedStencilReference)}setDirectViewport(e,t,i,r){let s=this._cachedViewport;return this._cachedViewport=null,this._viewport(e,t,i,r),s}scissorClear(e,t,i,r,s){this.enableScissor(e,t,i,r),this.clear(s,!0,!0,!0),this.disableScissor()}enableScissor(e,t,i,r){let s=this._gl;s.enable(s.SCISSOR_TEST),s.scissor(e,t,i,r)}disableScissor(){let e=this._gl;e.disable(e.SCISSOR_TEST)}_reportDrawCall(e=1){this._drawCalls.addCount(e,!1)}_loadFileAsync(e,t,i){return new Promise((r,s)=>{this._loadFile(e,e=>{r(e)},void 0,t,i,(e,t)=>{s(t)})})}getVertexShaderSource(e){let t=this._gl.getAttachedShaders(e);return t?this._gl.getShaderSource(t[0]):null}getFragmentShaderSource(e){let t=this._gl.getAttachedShaders(e);return t?this._gl.getShaderSource(t[1]):null}setDepthStencilTexture(e,t,i,r){void 0!==e&&(t&&(this._boundUniforms[e]=t),i&&i.depthStencilTexture?this._setTexture(e,i,!1,!0,r):this._setTexture(e,null,void 0,void 0,r))}setTextureFromPostProcess(e,t,i){var r;let s=null;t&&(t._forcedOutputTexture?s=t._forcedOutputTexture:t._textures.data[t._currentRenderTextureInd]&&(s=t._textures.data[t._currentRenderTextureInd])),this._bindTexture(e,null!==(r=null==s?void 0:s.texture)&&void 0!==r?r:null,i)}setTextureFromPostProcessOutput(e,t,i){var r,s;this._bindTexture(e,null!==(s=null===(r=null==t?void 0:t._outputTexture)||void 0===r?void 0:r.texture)&&void 0!==s?s:null,i)}_rebuildBuffers(){for(let e of this.scenes)e.resetCachedMaterial(),e._rebuildGeometries();for(let e of this._virtualScenes)e.resetCachedMaterial(),e._rebuildGeometries();super._rebuildBuffers()}_rebuildTextures(){for(let e of this.scenes)e._rebuildTextures();for(let e of this._virtualScenes)e._rebuildTextures();super._rebuildTextures()}_renderFrame(){for(let e=0;e0?this.customAnimationFrameRequester?(this.customAnimationFrameRequester.requestID=this._queueNewFrame(this.customAnimationFrameRequester.renderFunction||this._boundRenderFunction,this.customAnimationFrameRequester),this._frameHandler=this.customAnimationFrameRequester.requestID):this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1}_renderViews(){return!1}switchFullscreen(e){this.isFullscreen?this.exitFullscreen():this.enterFullscreen(e)}enterFullscreen(e){!this.isFullscreen&&(this._pointerLockRequested=e,this._renderingCanvas&&nC._RequestFullscreen(this._renderingCanvas))}exitFullscreen(){this.isFullscreen&&nC._ExitFullscreen()}enterPointerlock(){this._renderingCanvas&&nC._RequestPointerlock(this._renderingCanvas)}exitPointerlock(){nC._ExitPointerlock()}beginFrame(){this._measureFps(),this.onBeginFrameObservable.notifyObservers(this),super.beginFrame()}endFrame(){super.endFrame(),this.onEndFrameObservable.notifyObservers(this)}setSize(e,t,i=!1){if(!this._renderingCanvas||!super.setSize(e,t,i))return!1;if(this.scenes){for(let e=0;e1&&s){let t=this.createTransformFeedback();this.bindTransformFeedback(t),this.setTranformFeedbackVaryings(n,s),e.transformFeedback=t}return r.linkProgram(n),this.webGLVersion>1&&s&&this.bindTransformFeedback(null),e.context=r,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),n}_releaseTexture(e){super._releaseTexture(e)}_releaseRenderTargetWrapper(e){super._releaseRenderTargetWrapper(e),this.scenes.forEach(t=>{t.postProcesses.forEach(t=>{t._outputTexture===e&&(t._outputTexture=null)}),t.cameras.forEach(t=>{t._postProcesses.forEach(t=>{t&&t._outputTexture===e&&(t._outputTexture=null)})})})}getRenderPassNames(){return this._renderPassNames}getCurrentRenderPassName(){return this._renderPassNames[this.currentRenderPassId]}createRenderPassId(e){let t=++nC._RenderPassIdCounter;return this._renderPassNames[t]=null!=e?e:"NONAME",t}releaseRenderPassId(e){this._renderPassNames[e]=void 0;for(let t=0;t{this._rescalePostProcess.onApply=function(t){t._bindTexture("textureSampler",e)};let a=i;a||(a=this.scenes[this.scenes.length-1]),a.postProcessManager.directRender([this._rescalePostProcess],n,!0),this._bindTextureDirectly(this._gl.TEXTURE_2D,t,!0),this._gl.copyTexImage2D(this._gl.TEXTURE_2D,0,r,0,0,t.width,t.height,0),this.unBindFramebuffer(n),n.dispose(),s&&s()}))}getFps(){return this._fps}getDeltaTime(){return this._deltaTime}_measureFps(){this._performanceMonitor.sampleFrame(),this._fps=this._performanceMonitor.averageFPS,this._deltaTime=this._performanceMonitor.instantaneousFrameTime||0}wrapWebGLTexture(e,t=!1,i=3,r=0,s=0){let n=new rX(e,this._gl),a=new rU(this,m.Unknown,!0);return a._hardwareTexture=n,a.baseWidth=r,a.baseHeight=s,a.width=r,a.height=s,a.isReady=!0,a.useMipMaps=t,this.updateTextureSamplingMode(i,a),a}_uploadImageToTexture(e,t,i=0,r=0){let s=this._gl,n=this._getWebGLTextureType(e.type),a=this._getInternalFormat(e.format),o=this._getRGBABufferInternalSizedFormat(e.type,a),l=e.isCube?s.TEXTURE_CUBE_MAP:s.TEXTURE_2D;this._bindTextureDirectly(l,e,!0),this._unpackFlipY(e.invertY);let h=s.TEXTURE_2D;e.isCube&&(h=s.TEXTURE_CUBE_MAP_POSITIVE_X+i),s.texImage2D(h,r,o,a,n,t),this._bindTextureDirectly(l,null,!0)}updateTextureComparisonFunction(e,t){if(1===this.webGLVersion){ig.Error("WebGL 1 does not support texture comparison.");return}let i=this._gl;e.isCube?(this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,e,!0),0===t?(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,515),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,t),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)):(this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),0===t?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,515),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)),e._comparisonFunction=t}createInstancesBuffer(e){let t=this._gl.createBuffer();if(!t)throw Error("Unable to create instance buffer");let i=new rW(t);return i.capacity=e,this.bindArrayBuffer(i),this._gl.bufferData(this._gl.ARRAY_BUFFER,e,this._gl.DYNAMIC_DRAW),i.references=1,i}deleteInstancesBuffer(e){this._gl.deleteBuffer(e)}_clientWaitAsync(e,t=0,i=10){let r=this._gl;return new Promise((s,n)=>{let a=()=>{let o=r.clientWaitSync(e,t,0);if(o==r.WAIT_FAILED){n();return}if(o==r.TIMEOUT_EXPIRED){setTimeout(a,i);return}s()};a()})}_readPixelsAsync(e,t,i,r,s,n,a){if(this._webGLVersion<2)throw Error("_readPixelsAsync only work on WebGL2+");let o=this._gl,l=o.createBuffer();o.bindBuffer(o.PIXEL_PACK_BUFFER,l),o.bufferData(o.PIXEL_PACK_BUFFER,a.byteLength,o.STREAM_READ),o.readPixels(e,t,i,r,s,n,0),o.bindBuffer(o.PIXEL_PACK_BUFFER,null);let h=o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE,0);return h?(o.flush(),this._clientWaitAsync(h,0,10).then(()=>(o.deleteSync(h),o.bindBuffer(o.PIXEL_PACK_BUFFER,l),o.getBufferSubData(o.PIXEL_PACK_BUFFER,0,a),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),o.deleteBuffer(l),a))):null}dispose(){for(this.hideLoadingUI(),this.onNewSceneAddedObservable.clear();this.postProcesses.length;)this.postProcesses[0].dispose();for(this._rescalePostProcess&&this._rescalePostProcess.dispose();this.scenes.length;)this.scenes[0].dispose();for(;this._virtualScenes.length;)this._virtualScenes[0].dispose();1===t2.Instances.length&&nC.audioEngine&&(nC.audioEngine.dispose(),nC.audioEngine=null);let e=this.getHostWindow();e&&"function"==typeof e.removeEventListener&&(e.removeEventListener("blur",this._onBlur),e.removeEventListener("focus",this._onFocus)),this._renderingCanvas&&(this._renderingCanvas.removeEventListener("focus",this._onCanvasFocus),this._renderingCanvas.removeEventListener("blur",this._onCanvasBlur),this._renderingCanvas.removeEventListener("pointerout",this._onCanvasPointerOut),this._renderingCanvas.removeEventListener("contextmenu",this._onCanvasContextMenu)),rs()&&(document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("mozfullscreenchange",this._onFullscreenChange),document.removeEventListener("webkitfullscreenchange",this._onFullscreenChange),document.removeEventListener("msfullscreenchange",this._onFullscreenChange),document.removeEventListener("pointerlockchange",this._onPointerLockChange),document.removeEventListener("mspointerlockchange",this._onPointerLockChange),document.removeEventListener("mozpointerlockchange",this._onPointerLockChange),document.removeEventListener("webkitpointerlockchange",this._onPointerLockChange)),super.dispose();let t=t2.Instances.indexOf(this);t>=0&&t2.Instances.splice(t,1),nC.Instances.length||t2.OnEnginesDisposedObservable.notifyObservers(this),this.onResizeObservable.clear(),this.onCanvasBlurObservable.clear(),this.onCanvasFocusObservable.clear(),this.onCanvasPointerOutObservable.clear(),this.onBeginFrameObservable.clear(),this.onEndFrameObservable.clear()}_disableTouchAction(){this._renderingCanvas&&this._renderingCanvas.setAttribute&&(this._renderingCanvas.setAttribute("touch-action","none"),this._renderingCanvas.style.touchAction="none",this._renderingCanvas.style.webkitTapHighlightColor="transparent")}displayLoadingUI(){}hideLoadingUI(){}get loadingScreen(){return!this._loadingScreen&&this._renderingCanvas&&(this._loadingScreen=nC.DefaultLoadingScreenFactory(this._renderingCanvas)),this._loadingScreen}set loadingScreen(e){this._loadingScreen=e}set loadingUIText(e){this.loadingScreen.loadingUIText=e}set loadingUIBackgroundColor(e){this.loadingScreen.loadingUIBackgroundColor=e}createVideoElement(e){return document.createElement("video")}static _RequestPointerlock(e){if(e.requestPointerLock){let t=e.requestPointerLock();t instanceof Promise?t.then(()=>{e.focus()}).catch(()=>{}):e.focus()}}static _ExitPointerlock(){document.exitPointerLock&&document.exitPointerLock()}static _RequestFullscreen(e){let t=e.requestFullscreen||e.webkitRequestFullscreen;t&&t.call(e)}static _ExitFullscreen(){let e=document;document.exitFullscreen?document.exitFullscreen():e.webkitCancelFullScreen&&e.webkitCancelFullScreen()}getFontOffset(e){let t=document.createElement("span");t.innerHTML="Hg",t.setAttribute("style",`font: ${e} !important`);let i=document.createElement("div");i.style.display="inline-block",i.style.width="1px",i.style.height="0px",i.style.verticalAlign="bottom";let r=document.createElement("div");r.style.whiteSpace="nowrap",r.appendChild(t),r.appendChild(i),document.body.appendChild(r);let s=0,n=0;try{n=i.getBoundingClientRect().top-t.getBoundingClientRect().top,i.style.verticalAlign="baseline",s=i.getBoundingClientRect().top-t.getBoundingClientRect().top}finally{document.body.removeChild(r)}return{ascent:s,height:n,descent:n-s}}}nC.ALPHA_DISABLE=0,nC.ALPHA_ADD=1,nC.ALPHA_COMBINE=2,nC.ALPHA_SUBTRACT=3,nC.ALPHA_MULTIPLY=4,nC.ALPHA_MAXIMIZED=5,nC.ALPHA_ONEONE=6,nC.ALPHA_PREMULTIPLIED=7,nC.ALPHA_PREMULTIPLIED_PORTERDUFF=8,nC.ALPHA_INTERPOLATE=9,nC.ALPHA_SCREENMODE=10,nC.DELAYLOADSTATE_NONE=0,nC.DELAYLOADSTATE_LOADED=1,nC.DELAYLOADSTATE_LOADING=2,nC.DELAYLOADSTATE_NOTLOADED=4,nC.NEVER=512,nC.ALWAYS=519,nC.LESS=513,nC.EQUAL=514,nC.LEQUAL=515,nC.GREATER=516,nC.GEQUAL=518,nC.NOTEQUAL=517,nC.KEEP=7680,nC.REPLACE=7681,nC.INCR=7682,nC.DECR=7683,nC.INVERT=5386,nC.INCR_WRAP=34055,nC.DECR_WRAP=34056,nC.TEXTURE_CLAMP_ADDRESSMODE=0,nC.TEXTURE_WRAP_ADDRESSMODE=1,nC.TEXTURE_MIRROR_ADDRESSMODE=2,nC.TEXTUREFORMAT_ALPHA=0,nC.TEXTUREFORMAT_LUMINANCE=1,nC.TEXTUREFORMAT_LUMINANCE_ALPHA=2,nC.TEXTUREFORMAT_RGB=4,nC.TEXTUREFORMAT_RGBA=5,nC.TEXTUREFORMAT_RED=6,nC.TEXTUREFORMAT_R=6,nC.TEXTUREFORMAT_RG=7,nC.TEXTUREFORMAT_RED_INTEGER=8,nC.TEXTUREFORMAT_R_INTEGER=8,nC.TEXTUREFORMAT_RG_INTEGER=9,nC.TEXTUREFORMAT_RGB_INTEGER=10,nC.TEXTUREFORMAT_RGBA_INTEGER=11,nC.TEXTURETYPE_UNSIGNED_BYTE=0,nC.TEXTURETYPE_UNSIGNED_INT=0,nC.TEXTURETYPE_FLOAT=1,nC.TEXTURETYPE_HALF_FLOAT=2,nC.TEXTURETYPE_BYTE=3,nC.TEXTURETYPE_SHORT=4,nC.TEXTURETYPE_UNSIGNED_SHORT=5,nC.TEXTURETYPE_INT=6,nC.TEXTURETYPE_UNSIGNED_INTEGER=7,nC.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=8,nC.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=9,nC.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=10,nC.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=11,nC.TEXTURETYPE_UNSIGNED_INT_24_8=12,nC.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=13,nC.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=14,nC.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=15,nC.TEXTURE_NEAREST_SAMPLINGMODE=1,nC.TEXTURE_BILINEAR_SAMPLINGMODE=2,nC.TEXTURE_TRILINEAR_SAMPLINGMODE=3,nC.TEXTURE_NEAREST_NEAREST_MIPLINEAR=8,nC.TEXTURE_LINEAR_LINEAR_MIPNEAREST=11,nC.TEXTURE_LINEAR_LINEAR_MIPLINEAR=3,nC.TEXTURE_NEAREST_NEAREST_MIPNEAREST=4,nC.TEXTURE_NEAREST_LINEAR_MIPNEAREST=5,nC.TEXTURE_NEAREST_LINEAR_MIPLINEAR=6,nC.TEXTURE_NEAREST_LINEAR=7,nC.TEXTURE_NEAREST_NEAREST=1,nC.TEXTURE_LINEAR_NEAREST_MIPNEAREST=9,nC.TEXTURE_LINEAR_NEAREST_MIPLINEAR=10,nC.TEXTURE_LINEAR_LINEAR=2,nC.TEXTURE_LINEAR_NEAREST=12,nC.TEXTURE_EXPLICIT_MODE=0,nC.TEXTURE_SPHERICAL_MODE=1,nC.TEXTURE_PLANAR_MODE=2,nC.TEXTURE_CUBIC_MODE=3,nC.TEXTURE_PROJECTION_MODE=4,nC.TEXTURE_SKYBOX_MODE=5,nC.TEXTURE_INVCUBIC_MODE=6,nC.TEXTURE_EQUIRECTANGULAR_MODE=7,nC.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=8,nC.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,nC.SCALEMODE_FLOOR=1,nC.SCALEMODE_NEAREST=2,nC.SCALEMODE_CEILING=3,nC._RescalePostProcessFactory=null,nC._RenderPassIdCounter=0;let ny=t7.Compose(t5.One(),t8.FromEulerAngles(0,Math.PI,0),t5.Zero());class nA extends i0{get billboardMode(){return this._billboardMode}set billboardMode(e){this._billboardMode!==e&&(this._billboardMode=e,this._cache.useBillboardPosition=(this._billboardMode&nA.BILLBOARDMODE_USE_POSITION)!=0,this._computeUseBillboardPath())}get preserveParentRotationForBillboard(){return this._preserveParentRotationForBillboard}set preserveParentRotationForBillboard(e){e!==this._preserveParentRotationForBillboard&&(this._preserveParentRotationForBillboard=e,this._computeUseBillboardPath())}_computeUseBillboardPath(){this._cache.useBillboardPath=this._billboardMode!==nA.BILLBOARDMODE_NONE&&!this.preserveParentRotationForBillboard}get infiniteDistance(){return this._infiniteDistance}set infiniteDistance(e){this._infiniteDistance!==e&&(this._infiniteDistance=e)}constructor(e,t=null,i=!0){super(e,t),this._forward=new t5(0,0,1),this._up=new t5(0,1,0),this._right=new t5(1,0,0),this._position=t5.Zero(),this._rotation=t5.Zero(),this._rotationQuaternion=null,this._scaling=t5.One(),this._transformToBoneReferal=null,this._isAbsoluteSynced=!1,this._billboardMode=nA.BILLBOARDMODE_NONE,this._preserveParentRotationForBillboard=!1,this.scalingDeterminant=1,this._infiniteDistance=!1,this.ignoreNonUniformScaling=!1,this.reIntegrateRotationIntoRotationQuaternion=!1,this._poseMatrix=null,this._localMatrix=t7.Zero(),this._usePivotMatrix=!1,this._absolutePosition=t5.Zero(),this._absoluteScaling=t5.Zero(),this._absoluteRotationQuaternion=t8.Identity(),this._pivotMatrix=t7.Identity(),this._postMultiplyPivotMatrix=!1,this._isWorldMatrixFrozen=!1,this._indexInSceneTransformNodesArray=-1,this.onAfterWorldMatrixUpdateObservable=new tj,this._nonUniformScaling=!1,i&&this.getScene().addTransformNode(this)}getClassName(){return"TransformNode"}get position(){return this._position}set position(e){this._position=e,this._isDirty=!0}isUsingPivotMatrix(){return this._usePivotMatrix}isUsingPostMultiplyPivotMatrix(){return this._postMultiplyPivotMatrix}get rotation(){return this._rotation}set rotation(e){this._rotation=e,this._rotationQuaternion=null,this._isDirty=!0}get scaling(){return this._scaling}set scaling(e){this._scaling=e,this._isDirty=!0}get rotationQuaternion(){return this._rotationQuaternion}set rotationQuaternion(e){this._rotationQuaternion=e,e&&this._rotation.setAll(0),this._isDirty=!0}get forward(){return t5.TransformNormalFromFloatsToRef(0,0,this.getScene().useRightHandedSystem?-1:1,this.getWorldMatrix(),this._forward),this._forward.normalize()}get up(){return t5.TransformNormalFromFloatsToRef(0,1,0,this.getWorldMatrix(),this._up),this._up.normalize()}get right(){return t5.TransformNormalFromFloatsToRef(this.getScene().useRightHandedSystem?-1:1,0,0,this.getWorldMatrix(),this._right),this._right.normalize()}updatePoseMatrix(e){return this._poseMatrix?this._poseMatrix.copyFrom(e):this._poseMatrix=e.clone(),this}getPoseMatrix(){return this._poseMatrix||(this._poseMatrix=t7.Identity()),this._poseMatrix}_isSynchronized(){let e=this._cache;return this._billboardMode===e.billboardMode&&this._billboardMode===nA.BILLBOARDMODE_NONE&&!e.pivotMatrixUpdated&&!this._infiniteDistance&&!this._position._isDirty&&!this._scaling._isDirty&&(!this._rotationQuaternion||!this._rotationQuaternion._isDirty)&&!this._rotation._isDirty}_initCache(){super._initCache();let e=this._cache;e.localMatrixUpdated=!1,e.billboardMode=-1,e.infiniteDistance=!1,e.useBillboardPosition=!1,e.useBillboardPath=!1}get absolutePosition(){return this.getAbsolutePosition()}get absoluteScaling(){return this._syncAbsoluteScalingAndRotation(),this._absoluteScaling}get absoluteRotationQuaternion(){return this._syncAbsoluteScalingAndRotation(),this._absoluteRotationQuaternion}setPreTransformMatrix(e){return this.setPivotMatrix(e,!1)}setPivotMatrix(e,t=!0){return this._pivotMatrix.copyFrom(e),this._usePivotMatrix=!this._pivotMatrix.isIdentity(),this._cache.pivotMatrixUpdated=!0,this._postMultiplyPivotMatrix=t,this._postMultiplyPivotMatrix&&(this._pivotMatrixInverse?this._pivotMatrix.invertToRef(this._pivotMatrixInverse):this._pivotMatrixInverse=t7.Invert(this._pivotMatrix)),this}getPivotMatrix(){return this._pivotMatrix}instantiateHierarchy(e=null,t,i){let r=this.clone("Clone of "+(this.name||this.id),e||this.parent,!0);for(let e of(r&&i&&i(this,r),this.getChildTransformNodes(!0)))e.instantiateHierarchy(r,t,i);return r}freezeWorldMatrix(e=null,t=!1){return e?t?(this._rotation.setAll(0),this._rotationQuaternion=this._rotationQuaternion||t8.Identity(),e.decompose(this._scaling,this._rotationQuaternion,this._position),this.computeWorldMatrix(!0)):(this._worldMatrix=e,this._absolutePosition.copyFromFloats(this._worldMatrix.m[12],this._worldMatrix.m[13],this._worldMatrix.m[14]),this._afterComputeWorldMatrix()):(this._isWorldMatrixFrozen=!1,this.computeWorldMatrix(!0)),this._isDirty=!1,this._isWorldMatrixFrozen=!0,this}unfreezeWorldMatrix(){return this._isWorldMatrixFrozen=!1,this.computeWorldMatrix(!0),this}get isWorldMatrixFrozen(){return this._isWorldMatrixFrozen}getAbsolutePosition(){return this.computeWorldMatrix(),this._absolutePosition}setAbsolutePosition(e){let t,i,r;if(!e)return this;if(void 0===e.x){if(arguments.length<3)return this;t=arguments[0],i=arguments[1],r=arguments[2]}else t=e.x,i=e.y,r=e.z;if(this.parent){let e=ie.Matrix[0];this.parent.getWorldMatrix().invertToRef(e),t5.TransformCoordinatesFromFloatsToRef(t,i,r,e,this.position)}else this.position.x=t,this.position.y=i,this.position.z=r;return this._absolutePosition.copyFrom(e),this}setPositionWithLocalVector(e){return this.computeWorldMatrix(),this.position=t5.TransformNormal(e,this._localMatrix),this}getPositionExpressedInLocalSpace(){this.computeWorldMatrix();let e=ie.Matrix[0];return this._localMatrix.invertToRef(e),t5.TransformNormal(this.position,e)}locallyTranslate(e){return this.computeWorldMatrix(!0),this.position=t5.TransformCoordinates(e,this._localMatrix),this}lookAt(e,t=0,i=0,r=0,s=A.LOCAL){let n=nA._LookAtVectorCache,a=s===A.LOCAL?this.position:this.getAbsolutePosition();if(e.subtractToRef(a,n),this.setDirection(n,t,i,r),s===A.WORLD&&this.parent){if(this.rotationQuaternion){let e=ie.Matrix[0];this.rotationQuaternion.toRotationMatrix(e);let t=ie.Matrix[1];this.parent.getWorldMatrix().getRotationMatrixToRef(t),t.invert(),e.multiplyToRef(t,e),this.rotationQuaternion.fromRotationMatrix(e)}else{let e=ie.Quaternion[0];t8.FromEulerVectorToRef(this.rotation,e);let t=ie.Matrix[0];e.toRotationMatrix(t);let i=ie.Matrix[1];this.parent.getWorldMatrix().getRotationMatrixToRef(i),i.invert(),t.multiplyToRef(i,t),e.fromRotationMatrix(t),e.toEulerAnglesToRef(this.rotation)}}return this}getDirection(e){let t=t5.Zero();return this.getDirectionToRef(e,t),t}getDirectionToRef(e,t){return t5.TransformNormalToRef(e,this.getWorldMatrix(),t),this}setDirection(e,t=0,i=0,r=0){let s=-Math.atan2(e.z,e.x)+Math.PI/2,n=Math.sqrt(e.x*e.x+e.z*e.z),a=-Math.atan2(e.y,n);return this.rotationQuaternion?t8.RotationYawPitchRollToRef(s+t,a+i,r,this.rotationQuaternion):(this.rotation.x=a+i,this.rotation.y=s+t,this.rotation.z=r),this}setPivotPoint(e,t=A.LOCAL){0==this.getScene().getRenderId()&&this.computeWorldMatrix(!0);let i=this.getWorldMatrix();if(t==A.WORLD){let t=ie.Matrix[0];i.invertToRef(t),e=t5.TransformCoordinates(e,t)}return this.setPivotMatrix(t7.Translation(-e.x,-e.y,-e.z),!0)}getPivotPoint(){let e=t5.Zero();return this.getPivotPointToRef(e),e}getPivotPointToRef(e){return e.x=-this._pivotMatrix.m[12],e.y=-this._pivotMatrix.m[13],e.z=-this._pivotMatrix.m[14],this}getAbsolutePivotPoint(){let e=t5.Zero();return this.getAbsolutePivotPointToRef(e),e}getAbsolutePivotPointToRef(e){return this.getPivotPointToRef(e),t5.TransformCoordinatesToRef(e,this.getWorldMatrix(),e),this}markAsDirty(e){if(this._isDirty)return this;if(this._children)for(let t of this._children)t.markAsDirty(e);return super.markAsDirty(e)}setParent(e,t=!1,i=!1){if(!e&&!this.parent)return this;let r=ie.Quaternion[0],s=ie.Vector3[0],n=ie.Vector3[1],a=ie.Matrix[1];t7.IdentityToRef(a);let o=ie.Matrix[0];this.computeWorldMatrix(!0);let l=this.rotationQuaternion;return l||(l=nA._TmpRotation,t8.RotationYawPitchRollToRef(this._rotation.y,this._rotation.x,this._rotation.z,l)),t7.ComposeToRef(this.scaling,l,this.position,o),this.parent&&o.multiplyToRef(this.parent.computeWorldMatrix(!0),o),e&&(e.computeWorldMatrix(!0).invertToRef(a),o.multiplyToRef(a,o)),o.decompose(n,r,s,t?this:void 0),this.rotationQuaternion?this.rotationQuaternion.copyFrom(r):r.toEulerAnglesToRef(this.rotation),this.scaling.copyFrom(n),this.position.copyFrom(s),this.parent=e,i&&this.setPivotMatrix(t7.Identity()),this}get nonUniformScaling(){return this._nonUniformScaling}_updateNonUniformScalingState(e){return this._nonUniformScaling!==e&&(this._nonUniformScaling=e,!0)}attachToBone(e,t){return this._currentParentWhenAttachingToBone=this.parent,this._transformToBoneReferal=t,this.parent=e,e.getSkeleton().prepare(!0),0>e.getFinalMatrix().determinant()&&(this.scalingDeterminant*=-1),this}detachFromBone(e=!1){return this.parent?(0>this.parent.getWorldMatrix().determinant()&&(this.scalingDeterminant*=-1),this._transformToBoneReferal=null,e?this.parent=this._currentParentWhenAttachingToBone:this.parent=null):e&&(this.parent=this._currentParentWhenAttachingToBone),this}rotate(e,t,i){let r;if(e.normalize(),this.rotationQuaternion||(this.rotationQuaternion=this.rotation.toQuaternion(),this.rotation.setAll(0)),i&&i!==A.LOCAL){if(this.parent){let i=this.parent.getWorldMatrix(),r=ie.Matrix[0];i.invertToRef(r),e=t5.TransformNormal(e,r),0>i.determinant()&&(t*=-1)}(r=t8.RotationAxisToRef(e,t,nA._RotationAxisCache)).multiplyToRef(this.rotationQuaternion,this.rotationQuaternion)}else r=t8.RotationAxisToRef(e,t,nA._RotationAxisCache),this.rotationQuaternion.multiplyToRef(r,this.rotationQuaternion);return this}rotateAround(e,t,i){t.normalize(),this.rotationQuaternion||(this.rotationQuaternion=t8.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z),this.rotation.setAll(0));let r=ie.Vector3[0],s=ie.Vector3[1],n=ie.Vector3[2],a=ie.Quaternion[0],o=ie.Matrix[0],l=ie.Matrix[1],h=ie.Matrix[2],u=ie.Matrix[3];return e.subtractToRef(this.position,r),t7.TranslationToRef(r.x,r.y,r.z,o),t7.TranslationToRef(-r.x,-r.y,-r.z,l),t7.RotationAxisToRef(t,i,h),l.multiplyToRef(h,u),u.multiplyToRef(o,u),u.decompose(s,a,n),this.position.addInPlace(n),a.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion),this}translate(e,t,i){let r=e.scale(t);if(i&&i!==A.LOCAL)this.setAbsolutePosition(this.getAbsolutePosition().add(r));else{let e=this.getPositionExpressedInLocalSpace().add(r);this.setPositionWithLocalVector(e)}return this}addRotation(e,t,i){let r;this.rotationQuaternion?r=this.rotationQuaternion:(r=ie.Quaternion[1],t8.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,r));let s=ie.Quaternion[0];return t8.RotationYawPitchRollToRef(t,e,i,s),r.multiplyInPlace(s),this.rotationQuaternion||r.toEulerAnglesToRef(this.rotation),this}_getEffectiveParent(){return this.parent}isWorldMatrixCameraDependent(){return this._infiniteDistance&&!this.parent||this._billboardMode!==nA.BILLBOARDMODE_NONE&&!this.preserveParentRotationForBillboard}computeWorldMatrix(e=!1,t=null){let i;if(this._isWorldMatrixFrozen&&!this._isDirty)return this._worldMatrix;let r=this.getScene().getRenderId();if(!this._isDirty&&!e&&(this._currentRenderId===r||this.isSynchronized()))return this._currentRenderId=r,this._worldMatrix;t=t||this.getScene().activeCamera,this._updateCache();let s=this._cache;s.pivotMatrixUpdated=!1,s.billboardMode=this.billboardMode,s.infiniteDistance=this.infiniteDistance,s.parent=this._parentNode,this._currentRenderId=r,this._childUpdateId+=1,this._isDirty=!1,this._position._isDirty=!1,this._rotation._isDirty=!1,this._scaling._isDirty=!1;let n=this._getEffectiveParent(),a=nA._TmpScaling,o=this._position;if(this._infiniteDistance&&!this.parent&&t){let e=t.getWorldMatrix(),i=new t5(e.m[12],e.m[13],e.m[14]);(o=nA._TmpTranslation).copyFromFloats(this._position.x+i.x,this._position.y+i.y,this._position.z+i.z)}if(a.copyFromFloats(this._scaling.x*this.scalingDeterminant,this._scaling.y*this.scalingDeterminant,this._scaling.z*this.scalingDeterminant),this._rotationQuaternion?(this._rotationQuaternion._isDirty=!1,i=this._rotationQuaternion,this.reIntegrateRotationIntoRotationQuaternion&&this.rotation.lengthSquared()&&(this._rotationQuaternion.multiplyInPlace(t8.RotationYawPitchRoll(this._rotation.y,this._rotation.x,this._rotation.z)),this._rotation.copyFromFloats(0,0,0))):(i=nA._TmpRotation,t8.RotationYawPitchRollToRef(this._rotation.y,this._rotation.x,this._rotation.z,i)),this._usePivotMatrix){let e=ie.Matrix[1];t7.ScalingToRef(a.x,a.y,a.z,e);let t=ie.Matrix[0];i.toRotationMatrix(t),this._pivotMatrix.multiplyToRef(e,ie.Matrix[4]),ie.Matrix[4].multiplyToRef(t,this._localMatrix),this._postMultiplyPivotMatrix&&this._localMatrix.multiplyToRef(this._pivotMatrixInverse,this._localMatrix),this._localMatrix.addTranslationFromFloats(o.x,o.y,o.z)}else t7.ComposeToRef(a,i,o,this._localMatrix);if(n&&n.getWorldMatrix){if(e&&n.computeWorldMatrix(e),s.useBillboardPath){if(this._transformToBoneReferal){let e=this.parent;e.getSkeleton().prepare(),e.getFinalMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(),ie.Matrix[7])}else ie.Matrix[7].copyFrom(n.getWorldMatrix());let e=ie.Vector3[5],t=ie.Vector3[6],i=ie.Quaternion[0];ie.Matrix[7].decompose(t,i,e),t7.ScalingToRef(t.x,t.y,t.z,ie.Matrix[7]),ie.Matrix[7].setTranslation(e),nA.BillboardUseParentOrientation&&(this._position.applyRotationQuaternionToRef(i,e),this._localMatrix.setTranslation(e)),this._localMatrix.multiplyToRef(ie.Matrix[7],this._worldMatrix)}else if(this._transformToBoneReferal){let e=this.parent;e.getSkeleton().prepare(),this._localMatrix.multiplyToRef(e.getFinalMatrix(),ie.Matrix[6]),ie.Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(),this._worldMatrix)}else this._localMatrix.multiplyToRef(n.getWorldMatrix(),this._worldMatrix);this._markSyncedWithParent()}else this._worldMatrix.copyFrom(this._localMatrix);if(s.useBillboardPath&&t&&this.billboardMode&&!s.useBillboardPosition){let e=ie.Vector3[0];if(this._worldMatrix.getTranslationToRef(e),ie.Matrix[1].copyFrom(t.getViewMatrix()),this._scene.useRightHandedSystem&&ie.Matrix[1].multiplyToRef(ny,ie.Matrix[1]),ie.Matrix[1].setTranslationFromFloats(0,0,0),ie.Matrix[1].invertToRef(ie.Matrix[0]),(this.billboardMode&nA.BILLBOARDMODE_ALL)!==nA.BILLBOARDMODE_ALL){ie.Matrix[0].decompose(void 0,ie.Quaternion[0],void 0);let e=ie.Vector3[1];ie.Quaternion[0].toEulerAnglesToRef(e),(this.billboardMode&nA.BILLBOARDMODE_X)!==nA.BILLBOARDMODE_X&&(e.x=0),(this.billboardMode&nA.BILLBOARDMODE_Y)!==nA.BILLBOARDMODE_Y&&(e.y=0),(this.billboardMode&nA.BILLBOARDMODE_Z)!==nA.BILLBOARDMODE_Z&&(e.z=0),t7.RotationYawPitchRollToRef(e.y,e.x,e.z,ie.Matrix[0])}this._worldMatrix.setTranslationFromFloats(0,0,0),this._worldMatrix.multiplyToRef(ie.Matrix[0],this._worldMatrix),this._worldMatrix.setTranslation(ie.Vector3[0])}else if(s.useBillboardPath&&t&&s.useBillboardPosition){let e=ie.Vector3[0];this._worldMatrix.getTranslationToRef(e);let i=t.globalPosition;this._worldMatrix.invertToRef(ie.Matrix[1]);let r=ie.Vector3[1];t5.TransformCoordinatesToRef(i,ie.Matrix[1],r),r.normalize();let s=-Math.atan2(r.z,r.x)+Math.PI/2,n=Math.sqrt(r.x*r.x+r.z*r.z),a=-Math.atan2(r.y,n);if(t8.RotationYawPitchRollToRef(s,a,0,ie.Quaternion[0]),(this.billboardMode&nA.BILLBOARDMODE_ALL)!==nA.BILLBOARDMODE_ALL){let e=ie.Vector3[1];ie.Quaternion[0].toEulerAnglesToRef(e),(this.billboardMode&nA.BILLBOARDMODE_X)!==nA.BILLBOARDMODE_X&&(e.x=0),(this.billboardMode&nA.BILLBOARDMODE_Y)!==nA.BILLBOARDMODE_Y&&(e.y=0),(this.billboardMode&nA.BILLBOARDMODE_Z)!==nA.BILLBOARDMODE_Z&&(e.z=0),t7.RotationYawPitchRollToRef(e.y,e.x,e.z,ie.Matrix[0])}else t7.FromQuaternionToRef(ie.Quaternion[0],ie.Matrix[0]);this._worldMatrix.setTranslationFromFloats(0,0,0),this._worldMatrix.multiplyToRef(ie.Matrix[0],this._worldMatrix),this._worldMatrix.setTranslation(ie.Vector3[0])}return this.ignoreNonUniformScaling?this._updateNonUniformScalingState(!1):this._scaling.isNonUniformWithinEpsilon(1e-6)?this._updateNonUniformScalingState(!0):n&&n._nonUniformScaling?this._updateNonUniformScalingState(n._nonUniformScaling):this._updateNonUniformScalingState(!1),this._afterComputeWorldMatrix(),this._absolutePosition.copyFromFloats(this._worldMatrix.m[12],this._worldMatrix.m[13],this._worldMatrix.m[14]),this._isAbsoluteSynced=!1,this.onAfterWorldMatrixUpdateObservable.notifyObservers(this),this._poseMatrix||(this._poseMatrix=t7.Invert(this._worldMatrix)),this._worldMatrixDeterminantIsDirty=!0,this._worldMatrix}resetLocalMatrix(e=!0){if(this.computeWorldMatrix(),e){let e=this.getChildren();for(let t=0;tnew nA(e,this.getScene()),this);if(r.name=e,r.id=e,t&&(r.parent=t),!i){let t=this.getDescendants(!0);for(let i=0;inew nA(e.name,t),e,t,i);return e.localMatrix?r.setPreTransformMatrix(t7.FromArray(e.localMatrix)):e.pivotMatrix&&r.setPivotMatrix(t7.FromArray(e.pivotMatrix)),r.setEnabled(e.isEnabled),r._waitingParsedUniqueId=e.uniqueId,void 0!==e.parentId&&(r._waitingParentId=e.parentId),void 0!==e.parentInstanceIndex&&(r._waitingParentInstanceIndex=e.parentInstanceIndex),r}getChildTransformNodes(e,t){let i=[];return this._getDescendants(i,e,e=>(!t||t(e))&&e instanceof nA),i}dispose(e,t=!1){if(this.getScene().stopAnimation(this),this.getScene().removeTransformNode(this),this._parentContainer){let e=this._parentContainer.transformNodes.indexOf(this);e>-1&&this._parentContainer.transformNodes.splice(e,1),this._parentContainer=null}if(this.onAfterWorldMatrixUpdateObservable.clear(),e)for(let e of this.getChildTransformNodes(!0))e.parent=null,e.computeWorldMatrix(!0);super.dispose(e,t)}normalizeToUnitCube(e=!0,t=!1,i){let r=null,s=null;t&&(this.rotationQuaternion?(s=this.rotationQuaternion.clone(),this.rotationQuaternion.copyFromFloats(0,0,0,1)):this.rotation&&(r=this.rotation.clone(),this.rotation.copyFromFloats(0,0,0)));let n=this.getHierarchyBoundingVectors(e,i),a=n.max.subtract(n.min),o=Math.max(a.x,a.y,a.z);return 0===o||(this.scaling.scaleInPlace(1/o),t&&(this.rotationQuaternion&&s?this.rotationQuaternion.copyFrom(s):this.rotation&&r&&this.rotation.copyFrom(r))),this}_syncAbsoluteScalingAndRotation(){this._isAbsoluteSynced||(this._worldMatrix.decompose(this._absoluteScaling,this._absoluteRotationQuaternion),this._isAbsoluteSynced=!0)}}nA.BILLBOARDMODE_NONE=0,nA.BILLBOARDMODE_X=1,nA.BILLBOARDMODE_Y=2,nA.BILLBOARDMODE_Z=4,nA.BILLBOARDMODE_ALL=7,nA.BILLBOARDMODE_USE_POSITION=128,nA.BillboardUseParentOrientation=!1,nA._TmpRotation=t8.Zero(),nA._TmpScaling=t5.Zero(),nA._TmpTranslation=t5.Zero(),nA._LookAtVectorCache=new t5(0,0,0),nA._RotationAxisCache=new t8,iZ([ij("position")],nA.prototype,"_position",void 0),iZ([ij("rotation")],nA.prototype,"_rotation",void 0),iZ([iG(10,"rotationQuaternion")],nA.prototype,"_rotationQuaternion",void 0),iZ([ij("scaling")],nA.prototype,"_scaling",void 0),iZ([iW("billboardMode")],nA.prototype,"_billboardMode",void 0),iZ([iW()],nA.prototype,"scalingDeterminant",void 0),iZ([iW("infiniteDistance")],nA.prototype,"_infiniteDistance",void 0),iZ([iW()],nA.prototype,"ignoreNonUniformScaling",void 0),iZ([iW()],nA.prototype,"reIntegrateRotationIntoRotationQuaternion",void 0);class nR{constructor(){this._checkCollisions=!1,this._collisionMask=-1,this._collisionGroup=-1,this._surroundingMeshes=null,this._collider=null,this._oldPositionForCollisions=new t5(0,0,0),this._diffPositionForCollisions=new t5(0,0,0),this._collisionResponse=!0}}class nI{constructor(){this.facetNb=0,this.partitioningSubdivisions=10,this.partitioningBBoxRatio=1.01,this.facetDataEnabled=!1,this.facetParameters={},this.bbSize=t5.Zero(),this.subDiv={max:1,X:1,Y:1,Z:1},this.facetDepthSort=!1,this.facetDepthSortEnabled=!1}}class nP{constructor(){this._hasVertexAlpha=!1,this._useVertexColors=!0,this._numBoneInfluencers=4,this._applyFog=!0,this._receiveShadows=!1,this._facetData=new nI,this._visibility=1,this._skeleton=null,this._layerMask=268435455,this._computeBonesUsingShaders=!0,this._isActive=!1,this._onlyForInstances=!1,this._isActiveIntermediate=!1,this._onlyForInstancesIntermediate=!1,this._actAsRegularMesh=!1,this._currentLOD=null,this._currentLODIsUpToDate=!1,this._collisionRetryCount=3,this._morphTargetManager=null,this._renderingGroupId=0,this._bakedVertexAnimationManager=null,this._material=null,this._positions=null,this._pointerOverDisableMeshTesting=!1,this._meshCollisionData=new nR,this._enableDistantPicking=!1,this._rawBoundingInfo=null}}class nM extends nA{static get BILLBOARDMODE_NONE(){return nA.BILLBOARDMODE_NONE}static get BILLBOARDMODE_X(){return nA.BILLBOARDMODE_X}static get BILLBOARDMODE_Y(){return nA.BILLBOARDMODE_Y}static get BILLBOARDMODE_Z(){return nA.BILLBOARDMODE_Z}static get BILLBOARDMODE_ALL(){return nA.BILLBOARDMODE_ALL}static get BILLBOARDMODE_USE_POSITION(){return nA.BILLBOARDMODE_USE_POSITION}get facetNb(){return this._internalAbstractMeshDataInfo._facetData.facetNb}get partitioningSubdivisions(){return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions}set partitioningSubdivisions(e){this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions=e}get partitioningBBoxRatio(){return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio}set partitioningBBoxRatio(e){this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio=e}get mustDepthSortFacets(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSort}set mustDepthSortFacets(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSort=e}get facetDepthSortFrom(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom}set facetDepthSortFrom(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom=e}get collisionRetryCount(){return this._internalAbstractMeshDataInfo._collisionRetryCount}set collisionRetryCount(e){this._internalAbstractMeshDataInfo._collisionRetryCount=e}get isFacetDataEnabled(){return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled}get morphTargetManager(){return this._internalAbstractMeshDataInfo._morphTargetManager}set morphTargetManager(e){this._internalAbstractMeshDataInfo._morphTargetManager!==e&&(this._internalAbstractMeshDataInfo._morphTargetManager=e,this._syncGeometryWithMorphTargetManager())}get bakedVertexAnimationManager(){return this._internalAbstractMeshDataInfo._bakedVertexAnimationManager}set bakedVertexAnimationManager(e){this._internalAbstractMeshDataInfo._bakedVertexAnimationManager!==e&&(this._internalAbstractMeshDataInfo._bakedVertexAnimationManager=e,this._markSubMeshesAsAttributesDirty())}_syncGeometryWithMorphTargetManager(){}_updateNonUniformScalingState(e){return!!super._updateNonUniformScalingState(e)&&(this._markSubMeshesAsMiscDirty(),!0)}get rawBoundingInfo(){return this._internalAbstractMeshDataInfo._rawBoundingInfo}set rawBoundingInfo(e){this._internalAbstractMeshDataInfo._rawBoundingInfo=e}set onCollide(e){this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver&&this.onCollideObservable.remove(this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver),this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver=this.onCollideObservable.add(e)}set onCollisionPositionChange(e){this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver&&this.onCollisionPositionChangeObservable.remove(this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver),this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver=this.onCollisionPositionChangeObservable.add(e)}get visibility(){return this._internalAbstractMeshDataInfo._visibility}set visibility(e){if(this._internalAbstractMeshDataInfo._visibility===e)return;let t=this._internalAbstractMeshDataInfo._visibility;this._internalAbstractMeshDataInfo._visibility=e,(1===t&&1!==e||1!==t&&1===e)&&this._markSubMeshesAsDirty(e=>{e.markAsMiscDirty(),e.markAsPrePassDirty()})}get pointerOverDisableMeshTesting(){return this._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting}set pointerOverDisableMeshTesting(e){this._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting=e}get renderingGroupId(){return this._internalAbstractMeshDataInfo._renderingGroupId}set renderingGroupId(e){this._internalAbstractMeshDataInfo._renderingGroupId=e}get material(){return this._internalAbstractMeshDataInfo._material}set material(e){this._internalAbstractMeshDataInfo._material!==e&&(this._internalAbstractMeshDataInfo._material&&this._internalAbstractMeshDataInfo._material.meshMap&&(this._internalAbstractMeshDataInfo._material.meshMap[this.uniqueId]=void 0),this._internalAbstractMeshDataInfo._material=e,e&&e.meshMap&&(e.meshMap[this.uniqueId]=this),this.onMaterialChangedObservable.hasObservers()&&this.onMaterialChangedObservable.notifyObservers(this),this.subMeshes&&(this.resetDrawCache(),this._unBindEffect()))}getMaterialForRenderPass(e){var t;return null===(t=this._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===t?void 0:t[e]}setMaterialForRenderPass(e,t){this.resetDrawCache(e),this._internalAbstractMeshDataInfo._materialForRenderPass||(this._internalAbstractMeshDataInfo._materialForRenderPass=[]),this._internalAbstractMeshDataInfo._materialForRenderPass[e]=t}get receiveShadows(){return this._internalAbstractMeshDataInfo._receiveShadows}set receiveShadows(e){this._internalAbstractMeshDataInfo._receiveShadows!==e&&(this._internalAbstractMeshDataInfo._receiveShadows=e,this._markSubMeshesAsLightDirty())}get hasVertexAlpha(){return this._internalAbstractMeshDataInfo._hasVertexAlpha}set hasVertexAlpha(e){this._internalAbstractMeshDataInfo._hasVertexAlpha!==e&&(this._internalAbstractMeshDataInfo._hasVertexAlpha=e,this._markSubMeshesAsAttributesDirty(),this._markSubMeshesAsMiscDirty())}get useVertexColors(){return this._internalAbstractMeshDataInfo._useVertexColors}set useVertexColors(e){this._internalAbstractMeshDataInfo._useVertexColors!==e&&(this._internalAbstractMeshDataInfo._useVertexColors=e,this._markSubMeshesAsAttributesDirty())}get computeBonesUsingShaders(){return this._internalAbstractMeshDataInfo._computeBonesUsingShaders}set computeBonesUsingShaders(e){this._internalAbstractMeshDataInfo._computeBonesUsingShaders!==e&&(this._internalAbstractMeshDataInfo._computeBonesUsingShaders=e,this._markSubMeshesAsAttributesDirty())}get numBoneInfluencers(){return this._internalAbstractMeshDataInfo._numBoneInfluencers}set numBoneInfluencers(e){this._internalAbstractMeshDataInfo._numBoneInfluencers!==e&&(this._internalAbstractMeshDataInfo._numBoneInfluencers=e,this._markSubMeshesAsAttributesDirty())}get applyFog(){return this._internalAbstractMeshDataInfo._applyFog}set applyFog(e){this._internalAbstractMeshDataInfo._applyFog!==e&&(this._internalAbstractMeshDataInfo._applyFog=e,this._markSubMeshesAsMiscDirty())}get enableDistantPicking(){return this._internalAbstractMeshDataInfo._enableDistantPicking}set enableDistantPicking(e){this._internalAbstractMeshDataInfo._enableDistantPicking=e}get layerMask(){return this._internalAbstractMeshDataInfo._layerMask}set layerMask(e){e!==this._internalAbstractMeshDataInfo._layerMask&&(this._internalAbstractMeshDataInfo._layerMask=e,this._resyncLightSources())}get collisionMask(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionMask}set collisionMask(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionMask=isNaN(e)?-1:e}get collisionResponse(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionResponse}set collisionResponse(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionResponse=e}get collisionGroup(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionGroup}set collisionGroup(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionGroup=isNaN(e)?-1:e}get surroundingMeshes(){return this._internalAbstractMeshDataInfo._meshCollisionData._surroundingMeshes}set surroundingMeshes(e){this._internalAbstractMeshDataInfo._meshCollisionData._surroundingMeshes=e}get lightSources(){return this._lightSources}get _positions(){return null}set skeleton(e){let t=this._internalAbstractMeshDataInfo._skeleton;t&&t.needInitialSkinMatrix&&t._unregisterMeshWithPoseMatrix(this),e&&e.needInitialSkinMatrix&&e._registerMeshWithPoseMatrix(this),this._internalAbstractMeshDataInfo._skeleton=e,this._internalAbstractMeshDataInfo._skeleton||(this._bonesTransformMatrices=null),this._markSubMeshesAsAttributesDirty()}get skeleton(){return this._internalAbstractMeshDataInfo._skeleton}constructor(e,t=null){switch(super(e,t,!1),this._internalAbstractMeshDataInfo=new nP,this._waitingMaterialId=null,this.cullingStrategy=nM.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY,this.onCollideObservable=new tj,this.onCollisionPositionChangeObservable=new tj,this.onMaterialChangedObservable=new tj,this.definedFacingForward=!0,this._occlusionQuery=null,this._renderingGroup=null,this.alphaIndex=Number.MAX_VALUE,this.isVisible=!0,this.isPickable=!0,this.isNearPickable=!1,this.isNearGrabbable=!1,this.showSubMeshesBoundingBox=!1,this.isBlocker=!1,this.enablePointerMoveEvents=!1,this.outlineColor=io.Red(),this.outlineWidth=.02,this.overlayColor=io.Red(),this.overlayAlpha=.5,this.useOctreeForRenderingSelection=!0,this.useOctreeForPicking=!0,this.useOctreeForCollisions=!0,this.alwaysSelectAsActiveMesh=!1,this.doNotSyncBoundingInfo=!1,this.actionManager=null,this.ellipsoid=new t5(.5,1,.5),this.ellipsoidOffset=new t5(0,0,0),this.edgesWidth=1,this.edgesColor=new il(1,0,0,1),this._edgesRenderer=null,this._masterMesh=null,this._boundingInfo=null,this._boundingInfoIsDirty=!0,this._renderId=0,this._intersectionsInProgress=[],this._unIndexed=!1,this._lightSources=[],this._waitingData={lods:null,actions:null,freezeWorldMatrix:null},this._bonesTransformMatrices=null,this._transformMatrixTexture=null,this.onRebuildObservable=new tj,this._onCollisionPositionChange=(e,t,i=null)=>{t.subtractToRef(this._internalAbstractMeshDataInfo._meshCollisionData._oldPositionForCollisions,this._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions),this._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions.length()>nC.CollisionsEpsilon&&this.position.addInPlace(this._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions),i&&this.onCollideObservable.notifyObservers(i),this.onCollisionPositionChangeObservable.notifyObservers(this.position)},(t=this.getScene()).addMesh(this),this._resyncLightSources(),this._uniformBuffer=new sp(this.getScene().getEngine(),void 0,void 0,e,!this.getScene().getEngine().isWebGPU),this._buildUniformLayout(),t.performancePriority){case y.Aggressive:this.doNotSyncBoundingInfo=!0;case y.Intermediate:this.alwaysSelectAsActiveMesh=!0,this.isPickable=!1}}_buildUniformLayout(){this._uniformBuffer.addUniform("world",16),this._uniformBuffer.addUniform("visibility",1),this._uniformBuffer.create()}transferToEffect(e){let t=this._uniformBuffer;t.updateMatrix("world",e),t.updateFloat("visibility",this._internalAbstractMeshDataInfo._visibility),t.update()}getMeshUniformBuffer(){return this._uniformBuffer}getClassName(){return"AbstractMesh"}toString(e){let t="Name: "+this.name+", isInstance: "+("InstancedMesh"!==this.getClassName()?"YES":"NO");t+=", # of submeshes: "+(this.subMeshes?this.subMeshes.length:0);let i=this._internalAbstractMeshDataInfo._skeleton;return i&&(t+=", skeleton: "+i.name),e&&(t+=", billboard mode: "+["NONE","X","Y",null,"Z",null,null,"ALL"][this.billboardMode]+", freeze wrld mat: "+(this._isWorldMatrixFrozen||this._waitingData.freezeWorldMatrix?"YES":"NO")),t}_getEffectiveParent(){return this._masterMesh&&this.billboardMode!==nA.BILLBOARDMODE_NONE?this._masterMesh:super._getEffectiveParent()}_getActionManagerForTrigger(e,t=!0){return this.actionManager&&(t||this.actionManager.isRecursive)&&(!e||this.actionManager.hasSpecificTrigger(e))?this.actionManager:this.parent?this.parent._getActionManagerForTrigger(e,!1):null}_rebuild(e=!1){if(this.onRebuildObservable.notifyObservers(this),null!==this._occlusionQuery&&(this._occlusionQuery=null),this.subMeshes)for(let e of this.subMeshes)e._rebuild()}_resyncLightSources(){for(let e of(this._lightSources.length=0,this.getScene().lights))e.isEnabled()&&e.canAffectMesh(this)&&this._lightSources.push(e);this._markSubMeshesAsLightDirty()}_resyncLightSource(e){let t=e.isEnabled()&&e.canAffectMesh(this),i=this._lightSources.indexOf(e),r=!1;if(-1===i){if(!t)return;this._lightSources.push(e)}else{if(t)return;r=!0,this._lightSources.splice(i,1)}this._markSubMeshesAsLightDirty(r)}_unBindEffect(){for(let e of this.subMeshes)e.setEffect(null)}_removeLightSource(e,t){let i=this._lightSources.indexOf(e);-1!==i&&(this._lightSources.splice(i,1),this._markSubMeshesAsLightDirty(t))}_markSubMeshesAsDirty(e){if(this.subMeshes)for(let t of this.subMeshes)for(let i=0;it.markAsLightDirty(e))}_markSubMeshesAsAttributesDirty(){this._markSubMeshesAsDirty(e=>e.markAsAttributesDirty())}_markSubMeshesAsMiscDirty(){this._markSubMeshesAsDirty(e=>e.markAsMiscDirty())}markAsDirty(e){return this._currentRenderId=Number.MAX_VALUE,this._isDirty=!0,this}resetDrawCache(e){if(this.subMeshes)for(let t of this.subMeshes)t.resetDrawCache(e)}get isBlocked(){return!1}getLOD(e){return this}getTotalVertices(){return 0}getTotalIndices(){return 0}getIndices(){return null}getVerticesData(e){return null}setVerticesData(e,t,i,r){return this}updateVerticesData(e,t,i,r){return this}setIndices(e,t){return this}isVerticesDataPresent(e){return!1}getBoundingInfo(){return this._masterMesh?this._masterMesh.getBoundingInfo():(this._boundingInfoIsDirty&&(this._boundingInfoIsDirty=!1,this._updateBoundingInfo()),this._boundingInfo)}getRawBoundingInfo(){var e;return null!==(e=this.rawBoundingInfo)&&void 0!==e?e:this.getBoundingInfo()}setBoundingInfo(e){return this._boundingInfo=e,this}get hasBoundingInfo(){return null!==this._boundingInfo}buildBoundingInfo(e,t,i){return this._boundingInfo=new nd(e,t,i),this._boundingInfo}normalizeToUnitCube(e=!0,t=!1,i){return super.normalizeToUnitCube(e,t,i)}get useBones(){return this.skeleton&&this.getScene().skeletonsEnabled&&this.isVerticesDataPresent(sf.MatricesIndicesKind)&&this.isVerticesDataPresent(sf.MatricesWeightsKind)}_preActivate(){}_preActivateForIntermediateRendering(e){}_activate(e,t){return this._renderId=e,!0}_postActivate(){}_freeze(){}_unFreeze(){}getWorldMatrix(){return this._masterMesh&&this.billboardMode===nA.BILLBOARDMODE_NONE?this._masterMesh.getWorldMatrix():super.getWorldMatrix()}_getWorldMatrixDeterminant(){return this._masterMesh?this._masterMesh._getWorldMatrixDeterminant():super._getWorldMatrixDeterminant()}get isAnInstance(){return!1}get hasInstances(){return!1}get hasThinInstances(){return!1}movePOV(e,t,i){return this.position.addInPlace(this.calcMovePOV(e,t,i)),this}calcMovePOV(e,t,i){let r=new t7;(this.rotationQuaternion?this.rotationQuaternion:t8.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z)).toRotationMatrix(r);let s=t5.Zero(),n=this.definedFacingForward?-1:1;return t5.TransformCoordinatesFromFloatsToRef(e*n,t,i*n,r,s),s}rotatePOV(e,t,i){return this.rotation.addInPlace(this.calcRotatePOV(e,t,i)),this}calcRotatePOV(e,t,i){let r=this.definedFacingForward?1:-1;return new t5(e*r,t,i*r)}refreshBoundingInfo(e=!1,t=!1){return this._boundingInfo&&this._boundingInfo.isLocked||this._refreshBoundingInfo(this._getPositionData(e,t),null),this}_refreshBoundingInfo(e,t){if(e){let i=n_(e,0,this.getTotalVertices(),t);this._boundingInfo?this._boundingInfo.reConstruct(i.minimum,i.maximum):this._boundingInfo=new nd(i.minimum,i.maximum)}if(this.subMeshes)for(let t=0;t4,n=s?this.getVerticesData(sf.MatricesIndicesExtraKind):null,a=s?this.getVerticesData(sf.MatricesWeightsExtraKind):null,o=this.skeleton.getTransformMatrices(this),l=ie.Vector3[0],h=ie.Matrix[0],u=ie.Matrix[1],c=0;for(let d=0;d0&&(t7.FromFloat32ArrayToRefScaled(o,Math.floor(16*e[c+p]),_,u),h.addToSelf(u));if(s)for(p=0;p<4;p++)(_=a[c+p])>0&&(t7.FromFloat32ArrayToRefScaled(o,Math.floor(16*n[c+p]),_,u),h.addToSelf(u));r===sf.NormalKind?t5.TransformNormalFromFloatsToRef(i[d],i[d+1],i[d+2],h,l):t5.TransformCoordinatesFromFloatsToRef(i[d],i[d+1],i[d+2],h,l),l.toArray(i,d),r===sf.PositionKind&&this._positions&&this._positions[d/3].copyFrom(l)}}}return i}getNormalsData(e=!1,t=!1){return this._getData(e,t,null,sf.NormalKind)}getPositionData(e=!1,t=!1,i){return this._getData(e,t,i,sf.PositionKind)}_getPositionData(e,t){var i;let r=this.getVerticesData(sf.PositionKind);if(this._internalAbstractMeshDataInfo._positions&&(this._internalAbstractMeshDataInfo._positions=null),r&&(e&&this.skeleton||t&&this.morphTargetManager)){if(r=r.slice(),this._generatePointsArray(),this._positions){let e=this._positions;this._internalAbstractMeshDataInfo._positions=Array(e.length);for(let t=0;t1||!r.IsGlobal)&&r.updateBoundingInfo(e)}return this}_afterComputeWorldMatrix(){this.doNotSyncBoundingInfo||(this._boundingInfoIsDirty=!0)}isInFrustum(e){return this.getBoundingInfo().isInFrustum(e,this.cullingStrategy)}isCompletelyInFrustum(e){return this.getBoundingInfo().isCompletelyInFrustum(e)}intersectsMesh(e,t=!1,i){let r=this.getBoundingInfo(),s=e.getBoundingInfo();if(r.intersects(s,t))return!0;if(i){for(let i of this.getChildMeshes())if(i.intersectsMesh(e,t,!0))return!0}return!1}intersectsPoint(e){return this.getBoundingInfo().intersectsPoint(e)}get checkCollisions(){return this._internalAbstractMeshDataInfo._meshCollisionData._checkCollisions}set checkCollisions(e){this._internalAbstractMeshDataInfo._meshCollisionData._checkCollisions=e}get collider(){return this._internalAbstractMeshDataInfo._meshCollisionData._collider}moveWithCollisions(e){this.getAbsolutePosition().addToRef(this.ellipsoidOffset,this._internalAbstractMeshDataInfo._meshCollisionData._oldPositionForCollisions);let t=this.getScene().collisionCoordinator;return this._internalAbstractMeshDataInfo._meshCollisionData._collider||(this._internalAbstractMeshDataInfo._meshCollisionData._collider=t.createCollider()),this._internalAbstractMeshDataInfo._meshCollisionData._collider._radius=this.ellipsoid,t.getNewPosition(this._internalAbstractMeshDataInfo._meshCollisionData._oldPositionForCollisions,e,this._internalAbstractMeshDataInfo._meshCollisionData._collider,this.collisionRetryCount,this,this._onCollisionPositionChange,this.uniqueId),this}_collideForSubMesh(e,t,i){var r;if(this._generatePointsArray(),!this._positions)return this;if(!e._lastColliderWorldVertices||!e._lastColliderTransformMatrix.equals(t)){e._lastColliderTransformMatrix=t.clone(),e._lastColliderWorldVertices=[],e._trianglePlanes=[];let i=e.verticesStart,r=e.verticesStart+e.verticesCount;for(let s=i;s1)||n._checkCollision(e))&&this._collideForSubMesh(n,t,e)}return this}_shouldConvertRHS(){return!1}_checkCollision(e){if(!this.getBoundingInfo()._checkCollision(e))return this;let t=ie.Matrix[0],i=ie.Matrix[1];return t7.ScalingToRef(1/e._radius.x,1/e._radius.y,1/e._radius.z,t),this.worldMatrixFromCache.multiplyToRef(t,i),this._processCollisionsForSubMeshes(e,i),this}_generatePointsArray(){return!1}intersects(e,t,i,r=!1,s,n=!1){let a=new sm,o=this.getClassName(),l="InstancedLinesMesh"===o||"LinesMesh"===o||"GreasedLineMesh"===o?this.intersectionThreshold:0,h=this.getBoundingInfo();if(!this.subMeshes||!n&&(!e.intersectsSphere(h.boundingSphere,l)||!e.intersectsBox(h.boundingBox,l)))return a;if(r)return a.hit=!n,a.pickedMesh=n?null:this,a.distance=n?0:t5.Distance(e.origin,h.boundingSphere.center),a.subMeshId=0,a;if(!this._generatePointsArray())return a;let u=null,c=this._scene.getIntersectingSubMeshCandidates(this,e),d=c.length,p=!1;for(let e=0;e1&&!n&&!s.canIntersects(e))continue;let a=s.intersects(e,this._positions,this.getIndices(),t,i);if(a&&(t||!u||a.distancee!==this&&e.actionManager===this.actionManager)||this.actionManager.dispose(),this.actionManager=null),this._internalAbstractMeshDataInfo._skeleton=null,this._transformMatrixTexture&&(this._transformMatrixTexture.dispose(),this._transformMatrixTexture=null),i=0;i{let t=e.includedOnlyMeshes.indexOf(this);-1!==t&&e.includedOnlyMeshes.splice(t,1),-1!==(t=e.excludedMeshes.indexOf(this))&&e.excludedMeshes.splice(t,1);let i=e.getShadowGenerators();if(i){let e=i.values();for(let i=e.next();!0!==i.done;i=e.next()){let e=i.value.getShadowMap();e&&e.renderList&&-1!==(t=e.renderList.indexOf(this))&&e.renderList.splice(t,1)}}}),("InstancedMesh"!==this.getClassName()||"InstancedLinesMesh"!==this.getClassName())&&this.releaseSubMeshes();let s=r.getEngine();if(null!==this._occlusionQuery&&(this.isOcclusionQueryInProgress=!1,s.deleteQuery(this._occlusionQuery),this._occlusionQuery=null),s.wipeCaches(),r.removeMesh(this),this._parentContainer){let e=this._parentContainer.meshes.indexOf(this);e>-1&&this._parentContainer.meshes.splice(e,1),this._parentContainer=null}if(t&&this.material&&("MultiMaterial"===this.material.getClassName()?this.material.dispose(!1,!0,!0):this.material.dispose(!1,!0)),!e)for(i=0;i65535){t=!0;break}t?e.depthSortedIndices=new Uint32Array(i):e.depthSortedIndices=new Uint16Array(i)}if(e.facetDepthSortFunction=function(e,t){return t.sqDistance-e.sqDistance},!e.facetDepthSortFrom){let t=this.getScene().activeCamera;e.facetDepthSortFrom=t?t.position:t5.Zero()}e.depthSortedFacets=[];for(let t=0;t.001?s.maximum.x-s.minimum.x:.001,e.bbSize.y=s.maximum.y-s.minimum.y>.001?s.maximum.y-s.minimum.y:.001,e.bbSize.z=s.maximum.z-s.minimum.z>.001?s.maximum.z-s.minimum.z:.001;let n=e.bbSize.x>e.bbSize.y?e.bbSize.x:e.bbSize.y;if(n=n>e.bbSize.z?n:e.bbSize.z,e.subDiv.max=e.partitioningSubdivisions,e.subDiv.X=Math.floor(e.subDiv.max*e.bbSize.x/n),e.subDiv.Y=Math.floor(e.subDiv.max*e.bbSize.y/n),e.subDiv.Z=Math.floor(e.subDiv.max*e.bbSize.z/n),e.subDiv.X=e.subDiv.X<1?1:e.subDiv.X,e.subDiv.Y=e.subDiv.Y<1?1:e.subDiv.Y,e.subDiv.Z=e.subDiv.Z<1?1:e.subDiv.Z,e.facetParameters.facetNormals=this.getFacetLocalNormals(),e.facetParameters.facetPositions=this.getFacetLocalPositions(),e.facetParameters.facetPartitioning=this.getFacetLocalPartitioning(),e.facetParameters.bInfo=s,e.facetParameters.bbSize=e.bbSize,e.facetParameters.subDiv=e.subDiv,e.facetParameters.ratio=this.partitioningBBoxRatio,e.facetParameters.depthSort=e.facetDepthSort,e.facetDepthSort&&e.facetDepthSortEnabled&&(this.computeWorldMatrix(!0),this._worldMatrix.invertToRef(e.invertedMatrix),t5.TransformCoordinatesToRef(e.facetDepthSortFrom,e.invertedMatrix,e.facetDepthSortOrigin),e.facetParameters.distanceTo=e.facetDepthSortOrigin),e.facetParameters.depthSortedFacets=e.depthSortedFacets,r&&ng.ComputeNormals(t,i,r,e.facetParameters),e.facetDepthSort&&e.facetDepthSortEnabled){e.depthSortedFacets.sort(e.facetDepthSortFunction);let t=e.depthSortedIndices.length/3|0;for(let r=0;rs.subDiv.max||a<0||a>s.subDiv.max||o<0||o>s.subDiv.max?null:s.facetPartitioning[n+s.subDiv.max*a+s.subDiv.max*s.subDiv.max*o]}getClosestFacetAtCoordinates(e,t,i,r,s=!1,n=!0){let a=this.getWorldMatrix(),o=ie.Matrix[5];a.invertToRef(o);let l=ie.Vector3[8];t5.TransformCoordinatesFromFloatsToRef(e,t,i,o,l);let h=this.getClosestFacetAtLocalCoordinates(l.x,l.y,l.z,r,s,n);return r&&t5.TransformCoordinatesFromFloatsToRef(r.x,r.y,r.z,a,r),h}getClosestFacetAtLocalCoordinates(e,t,i,r,s=!1,n=!0){let a,o,l,h=null,u=0,c=0,d=0,p=0,_=0,f=0,m=0,g=0,v=this.getFacetLocalPositions(),x=this.getFacetLocalNormals(),T=this.getFacetsAtLocalCoordinates(e,t,i);if(!T)return null;let b=Number.MAX_VALUE,E=b;for(let S=0;S=0||s&&!n&&p<=0)&&(p=o.x*l.x+o.y*l.y+o.z*l.z,_=-(o.x*e+o.y*t+o.z*i-p)/(o.x*o.x+o.y*o.y+o.z*o.z),f=e+o.x*_,m=t+o.y*_,g=i+o.z*_,(E=(u=f-e)*u+(c=m-t)*c+(d=g-i)*d)e.emitter===this)}}function nD(e){-1===e.indexOf("vClipPlane")&&e.push("vClipPlane"),-1===e.indexOf("vClipPlane2")&&e.push("vClipPlane2"),-1===e.indexOf("vClipPlane3")&&e.push("vClipPlane3"),-1===e.indexOf("vClipPlane4")&&e.push("vClipPlane4"),-1===e.indexOf("vClipPlane5")&&e.push("vClipPlane5"),-1===e.indexOf("vClipPlane6")&&e.push("vClipPlane6")}function nO(e,t,i){var r,s,n,a,o,l;let h=!!(null!==(r=e.clipPlane)&&void 0!==r?r:t.clipPlane),u=!!(null!==(s=e.clipPlane2)&&void 0!==s?s:t.clipPlane2),c=!!(null!==(n=e.clipPlane3)&&void 0!==n?n:t.clipPlane3),d=!!(null!==(a=e.clipPlane4)&&void 0!==a?a:t.clipPlane4),p=!!(null!==(o=e.clipPlane5)&&void 0!==o?o:t.clipPlane5),_=!!(null!==(l=e.clipPlane6)&&void 0!==l?l:t.clipPlane6);h&&i.push("#define CLIPPLANE"),u&&i.push("#define CLIPPLANE2"),c&&i.push("#define CLIPPLANE3"),d&&i.push("#define CLIPPLANE4"),p&&i.push("#define CLIPPLANE5"),_&&i.push("#define CLIPPLANE6")}function nN(e,t,i){var r,s,n,a,o,l;let h=null!==(r=t.clipPlane)&&void 0!==r?r:i.clipPlane;nF(e,"vClipPlane",h),nF(e,"vClipPlane2",h=null!==(s=t.clipPlane2)&&void 0!==s?s:i.clipPlane2),nF(e,"vClipPlane3",h=null!==(n=t.clipPlane3)&&void 0!==n?n:i.clipPlane3),nF(e,"vClipPlane4",h=null!==(a=t.clipPlane4)&&void 0!==a?a:i.clipPlane4),nF(e,"vClipPlane5",h=null!==(o=t.clipPlane5)&&void 0!==o?o:i.clipPlane5),nF(e,"vClipPlane6",h=null!==(l=t.clipPlane6)&&void 0!==l?l:i.clipPlane6)}function nF(e,t,i){i&&e.setFloat4(t,i.normal.x,i.normal.y,i.normal.z,i.d)}nM.OCCLUSION_TYPE_NONE=0,nM.OCCLUSION_TYPE_OPTIMISTIC=1,nM.OCCLUSION_TYPE_STRICT=2,nM.OCCLUSION_ALGORITHM_TYPE_ACCURATE=0,nM.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE=1,nM.CULLINGSTRATEGY_STANDARD=0,nM.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY=1,nM.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION=2,nM.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY=3,t0["BABYLON.AbstractMesh"]=nM;class nw{static BindSceneUniformBuffer(e,t){t.bindToEffect(e,"Scene")}static PrepareDefinesForMergedUV(e,t,i){t._needUVs=!0,t[i]=!0,e.optimizeUVAllocation&&e.getTextureMatrix().isIdentityAs3x2()?(t[i+"DIRECTUV"]=e.coordinatesIndex+1,t["MAINUV"+(e.coordinatesIndex+1)]=!0):t[i+"DIRECTUV"]=0}static BindTextureMatrix(e,t,i){let r=e.getTextureMatrix();t.updateMatrix(i+"Matrix",r)}static GetFogState(e,t){return t.fogEnabled&&e.applyFog&&t.fogMode!==sY.FOGMODE_NONE}static PrepareDefinesForMisc(e,t,i,r,s,n,a,o=!1){a._areMiscDirty&&(a.LOGARITHMICDEPTH=i,a.POINTSIZE=r,a.FOG=s&&this.GetFogState(e,t),a.NONUNIFORMSCALING=e.nonUniformScaling,a.ALPHATEST=n,a.DECAL_AFTER_DETAIL=o)}static PrepareDefinesForCamera(e,t){let i=!1;if(e.activeCamera){let r=t.CAMERA_ORTHOGRAPHIC?1:0,s=t.CAMERA_PERSPECTIVE?1:0,n=e.activeCamera.mode===ns.ORTHOGRAPHIC_CAMERA?1:0,a=e.activeCamera.mode===ns.PERSPECTIVE_CAMERA?1:0;(r^n||s^a)&&(t.CAMERA_ORTHOGRAPHIC=1===n,t.CAMERA_PERSPECTIVE=1===a,i=!0)}return i}static PrepareDefinesForFrameBoundValues(e,t,i,r,s,n=null,a=!1){let o=nw.PrepareDefinesForCamera(e,r);!1!==n&&(o=function(e,t,i){var r,s,n,a,o,l;let h=!1,u=!!(null!==(r=e.clipPlane)&&void 0!==r?r:t.clipPlane),c=!!(null!==(s=e.clipPlane2)&&void 0!==s?s:t.clipPlane2),d=!!(null!==(n=e.clipPlane3)&&void 0!==n?n:t.clipPlane3),p=!!(null!==(a=e.clipPlane4)&&void 0!==a?a:t.clipPlane4),_=!!(null!==(o=e.clipPlane5)&&void 0!==o?o:t.clipPlane5),f=!!(null!==(l=e.clipPlane6)&&void 0!==l?l:t.clipPlane6);return i.CLIPPLANE!==u&&(i.CLIPPLANE=u,h=!0),i.CLIPPLANE2!==c&&(i.CLIPPLANE2=c,h=!0),i.CLIPPLANE3!==d&&(i.CLIPPLANE3=d,h=!0),i.CLIPPLANE4!==p&&(i.CLIPPLANE4=p,h=!0),i.CLIPPLANE5!==_&&(i.CLIPPLANE5=_,h=!0),i.CLIPPLANE6!==f&&(i.CLIPPLANE6=f,h=!0),h}(i,e,r)),!t.getColorWrite()!==r.DEPTHPREPASS&&(r.DEPTHPREPASS=!r.DEPTHPREPASS,o=!0),r.INSTANCES!==s&&(r.INSTANCES=s,o=!0),r.THIN_INSTANCES!==a&&(r.THIN_INSTANCES=a,o=!0),o&&r.markAsUnprocessed()}static PrepareDefinesForBones(e,t){if(e.useBones&&e.computeBonesUsingShaders&&e.skeleton){t.NUM_BONE_INFLUENCERS=e.numBoneInfluencers;let i=void 0!==t.BONETEXTURE;if(e.skeleton.isUsingTextureForMatrices&&i)t.BONETEXTURE=!0;else{t.BonesPerMesh=e.skeleton.bones.length+1,t.BONETEXTURE=!i&&void 0;let r=e.getScene().prePassRenderer;if(r&&r.enabled){let i=-1===r.excludedSkinnedMesh.indexOf(e);t.BONES_VELOCITY_ENABLED=i}}}else t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,void 0!==t.BONETEXTURE&&(t.BONETEXTURE=!1)}static PrepareDefinesForMorphTargets(e,t){let i=e.morphTargetManager;i?(t.MORPHTARGETS_UV=i.supportsUVs&&t.UV1,t.MORPHTARGETS_TANGENT=i.supportsTangents&&t.TANGENT,t.MORPHTARGETS_NORMAL=i.supportsNormals&&t.NORMAL,t.MORPHTARGETS=i.numInfluencers>0,t.NUM_MORPH_INFLUENCERS=i.numInfluencers,t.MORPHTARGETS_TEXTURE=i.isUsingTextureForTargets):(t.MORPHTARGETS_UV=!1,t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS=!1,t.NUM_MORPH_INFLUENCERS=0)}static PrepareDefinesForBakedVertexAnimation(e,t){let i=e.bakedVertexAnimationManager;t.BAKED_VERTEX_ANIMATION_TEXTURE=!!i&&!!i.isEnabled}static PrepareDefinesForAttributes(e,t,i,r,s=!1,n=!0,a=!0){if(!t._areAttributesDirty&&t._needNormals===t._normals&&t._needUVs===t._uvs)return!1;t._normals=t._needNormals,t._uvs=t._needUVs,t.NORMAL=t._needNormals&&e.isVerticesDataPresent(sf.NormalKind),t._needNormals&&e.isVerticesDataPresent(sf.TangentKind)&&(t.TANGENT=!0);for(let i=1;i<=6;++i)t["UV"+i]=!!t._needUVs&&e.isVerticesDataPresent(`uv${1===i?"":i}`);if(i){let i=e.useVertexColors&&e.isVerticesDataPresent(sf.ColorKind);t.VERTEXCOLOR=i,t.VERTEXALPHA=e.hasVertexAlpha&&i&&n}return e.isVerticesDataPresent(sf.ColorInstanceKind)&&(e.hasInstances||e.hasThinInstances)&&(t.INSTANCESCOLOR=!0),r&&this.PrepareDefinesForBones(e,t),s&&this.PrepareDefinesForMorphTargets(e,t),a&&this.PrepareDefinesForBakedVertexAnimation(e,t),!0}static PrepareDefinesForMultiview(e,t){if(e.activeCamera){let i=t.MULTIVIEW;t.MULTIVIEW=null!==e.activeCamera.outputRenderTarget&&e.activeCamera.outputRenderTarget.getViewCount()>1,t.MULTIVIEW!=i&&t.markAsUnprocessed()}}static PrepareDefinesForOIT(e,t,i){let r=t.ORDER_INDEPENDENT_TRANSPARENCY,s=t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS;t.ORDER_INDEPENDENT_TRANSPARENCY=e.useOrderIndependentTransparency&&i,t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!e.getEngine().getCaps().textureFloatLinearFiltering,(r!==t.ORDER_INDEPENDENT_TRANSPARENCY||s!==t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS)&&t.markAsUnprocessed()}static PrepareDefinesForPrePass(e,t,i){let r=t.PREPASS;if(!t._arePrePassDirty)return;let s=[{type:1,define:"PREPASS_POSITION",index:"PREPASS_POSITION_INDEX"},{type:2,define:"PREPASS_VELOCITY",index:"PREPASS_VELOCITY_INDEX"},{type:3,define:"PREPASS_REFLECTIVITY",index:"PREPASS_REFLECTIVITY_INDEX"},{type:0,define:"PREPASS_IRRADIANCE",index:"PREPASS_IRRADIANCE_INDEX"},{type:7,define:"PREPASS_ALBEDO_SQRT",index:"PREPASS_ALBEDO_SQRT_INDEX"},{type:5,define:"PREPASS_DEPTH",index:"PREPASS_DEPTH_INDEX"},{type:6,define:"PREPASS_NORMAL",index:"PREPASS_NORMAL_INDEX"}];if(e.prePassRenderer&&e.prePassRenderer.enabled&&i){t.PREPASS=!0,t.SCENE_MRT_COUNT=e.prePassRenderer.mrtCount,t.PREPASS_NORMAL_WORLDSPACE=e.prePassRenderer.generateNormalsInWorldSpace;for(let i=0;i0&&(a.shadowEnabled=!0,t.prepareDefines(s,r))}}i.lightmapMode!=sH.LIGHTMAP_DEFAULT?(a.lightmapMode=!0,s["LIGHTMAPEXCLUDED"+r]=!0,s["LIGHTMAPNOSPECULAR"+r]=i.lightmapMode==sH.LIGHTMAP_SHADOWSONLY):(s["LIGHTMAPEXCLUDED"+r]=!1,s["LIGHTMAPNOSPECULAR"+r]=!1)}static PrepareDefinesForLights(e,t,i,r,s=4,n=!1){if(!i._areLightsDirty)return i._needNormals;let a=0,o={needNormals:i._needNormals,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1};if(e.lightsEnabled&&!n){for(let n of t.lightSources)if(this.PrepareDefinesForLight(e,t,n,a,i,r,o),++a===s)break}i.SPECULARTERM=o.specularEnabled,i.SHADOWS=o.shadowEnabled;for(let e=a;e0&&(s=r+n,t.addFallback(s,"LIGHT"+n)),!e.SHADOWS&&(e["SHADOW"+n]&&t.addFallback(r,"SHADOW"+n),e["SHADOWPCF"+n]&&t.addFallback(r,"SHADOWPCF"+n),e["SHADOWPCSS"+n]&&t.addFallback(r,"SHADOWPCSS"+n),e["SHADOWPOISSON"+n]&&t.addFallback(r,"SHADOWPOISSON"+n),e["SHADOWESM"+n]&&t.addFallback(r,"SHADOWESM"+n),e["SHADOWCLOSEESM"+n]&&t.addFallback(r,"SHADOWCLOSEESM"+n));return s++}static PrepareAttributesForMorphTargetsInfluencers(e,t,i){this._TmpMorphInfluencers.NUM_MORPH_INFLUENCERS=i,this.PrepareAttributesForMorphTargets(e,t,this._TmpMorphInfluencers)}static PrepareAttributesForMorphTargets(e,t,i){let r=i.NUM_MORPH_INFLUENCERS;if(r>0&&t2.LastCreatedEngine){let s=t2.LastCreatedEngine.getCaps().maxVertexAttribs,n=t.morphTargetManager;if(null==n?void 0:n.isUsingTextureForTargets)return;let a=n&&n.supportsNormals&&i.NORMAL,o=n&&n.supportsTangents&&i.TANGENT,l=n&&n.supportsUVs&&i.UV1;for(let i=0;is&&ig.Error("Cannot add more vertex attributes for mesh "+t.name)}}static PrepareAttributesForBakedVertexAnimation(e,t,i){i.BAKED_VERTEX_ANIMATION_TEXTURE&&i.INSTANCES&&e.push("bakedVertexAnimationSettingsInstanced")}static PrepareAttributesForBones(e,t,i,r){i.NUM_BONE_INFLUENCERS>0&&(r.addCPUSkinningFallback(0,t),e.push(sf.MatricesIndicesKind),e.push(sf.MatricesWeightsKind),i.NUM_BONE_INFLUENCERS>4&&(e.push(sf.MatricesIndicesExtraKind),e.push(sf.MatricesWeightsExtraKind)))}static PrepareAttributesForInstances(e,t){(t.INSTANCES||t.THIN_INSTANCES)&&this.PushAttributesForInstances(e,!!t.PREPASS_VELOCITY),t.INSTANCESCOLOR&&e.push(sf.ColorInstanceKind)}static PushAttributesForInstances(e,t=!1){e.push("world0"),e.push("world1"),e.push("world2"),e.push("world3"),t&&(e.push("previousWorld0"),e.push("previousWorld1"),e.push("previousWorld2"),e.push("previousWorld3"))}static BindLightProperties(e,t,i){e.transferToEffect(t,i+"")}static BindLight(e,t,i,r,s,n=!0){e._bindLight(t,i,r,s,n)}static BindLights(e,t,i,r,s=4){let n=Math.min(t.lightSources.length,s);for(let s=0;s-1){let i=r.getTransformMatrixTexture(e);t.setTexture("boneSampler",i),t.setFloat("boneTextureWidth",4*(r.bones.length+1))}else{let s=r.getTransformMatrices(e);s&&(t.setMatrices("mBones",s),i&&e.getScene().prePassRenderer&&e.getScene().prePassRenderer.getIndex(2)&&(i.previousBones[e.uniqueId]||(i.previousBones[e.uniqueId]=s.slice()),t.setMatrices("mPreviousBones",i.previousBones[e.uniqueId]),nw._CopyBonesTransformationMatrices(s,i.previousBones[e.uniqueId])))}}}static _CopyBonesTransformationMatrices(e,t){return t.set(e),t}static BindMorphTargetParameters(e,t){let i=e.morphTargetManager;e&&i&&t.setFloatArray("morphTargetInfluences",i.influences)}static BindLogDepth(e,t,i){if(!e||e.LOGARITHMICDEPTH||e.indexOf&&e.indexOf("LOGARITHMICDEPTH")>=0){let e=i.activeCamera;e.mode===ns.ORTHOGRAPHIC_CAMERA&&ig.Error("Logarithmic depth is not compatible with orthographic cameras!",20),t.setFloat("logarithmicDepthConstant",2/(Math.log(e.maxZ+1)/Math.LN2))}}}nw._TmpMorphInfluencers={NUM_MORPH_INFLUENCERS:0},nw._TempFogColor=io.Black();class nL{constructor(){this.reset()}reset(){this.enabled=!1,this.mask=255,this.func=519,this.funcRef=1,this.funcMask=255,this.opStencilFail=7680,this.opDepthFail=7680,this.opStencilDepthPass=7681}get func(){return this._func}set func(e){this._func=e}get funcRef(){return this._funcRef}set funcRef(e){this._funcRef=e}get funcMask(){return this._funcMask}set funcMask(e){this._funcMask=e}get opStencilFail(){return this._opStencilFail}set opStencilFail(e){this._opStencilFail=e}get opDepthFail(){return this._opDepthFail}set opDepthFail(e){this._opDepthFail=e}get opStencilDepthPass(){return this._opStencilDepthPass}set opStencilDepthPass(e){this._opStencilDepthPass=e}get mask(){return this._mask}set mask(e){this._mask=e}get enabled(){return this._enabled}set enabled(e){this._enabled=e}getClassName(){return"MaterialStencilState"}copyTo(e){i$.Clone(()=>e,this)}serialize(){return i$.Serialize(this)}parse(e,t,i){i$.Parse(()=>this,e,t,i)}}iZ([iW()],nL.prototype,"func",null),iZ([iW()],nL.prototype,"funcRef",null),iZ([iW()],nL.prototype,"funcMask",null),iZ([iW()],nL.prototype,"opStencilFail",null),iZ([iW()],nL.prototype,"opDepthFail",null),iZ([iW()],nL.prototype,"opStencilDepthPass",null),iZ([iW()],nL.prototype,"mask",null),iZ([iW()],nL.prototype,"enabled",null),function(e){e[e.Created=1]="Created",e[e.Disposed=2]="Disposed",e[e.GetDefineNames=4]="GetDefineNames",e[e.PrepareUniformBuffer=8]="PrepareUniformBuffer",e[e.IsReadyForSubMesh=16]="IsReadyForSubMesh",e[e.PrepareDefines=32]="PrepareDefines",e[e.BindForSubMesh=64]="BindForSubMesh",e[e.PrepareEffect=128]="PrepareEffect",e[e.GetAnimatables=256]="GetAnimatables",e[e.GetActiveTextures=512]="GetActiveTextures",e[e.HasTexture=1024]="HasTexture",e[e.FillRenderTargetTextures=2048]="FillRenderTargetTextures",e[e.HasRenderTargetTextures=4096]="HasRenderTargetTextures",e[e.HardBindForSubMesh=8192]="HardBindForSubMesh"}(M||(M={}));class nB{get canRenderToMRT(){return!1}set alpha(e){if(this._alpha===e)return;let t=this._alpha;this._alpha=e,(1===t||1===e)&&this.markAsDirty(nB.MiscDirtyFlag+nB.PrePassDirtyFlag)}get alpha(){return this._alpha}set backFaceCulling(e){this._backFaceCulling!==e&&(this._backFaceCulling=e,this.markAsDirty(nB.TextureDirtyFlag))}get backFaceCulling(){return this._backFaceCulling}set cullBackFaces(e){this._cullBackFaces!==e&&(this._cullBackFaces=e,this.markAsDirty(nB.TextureDirtyFlag))}get cullBackFaces(){return this._cullBackFaces}get blockDirtyMechanism(){return this._blockDirtyMechanism}set blockDirtyMechanism(e){this._blockDirtyMechanism!==e&&(this._blockDirtyMechanism=e,e||this.markDirty())}atomicMaterialsUpdate(e){this.blockDirtyMechanism=!0;try{e(this)}finally{this.blockDirtyMechanism=!1}}get hasRenderTargetTextures(){return this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._eventInfo.hasRenderTargetTextures}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}get onBindObservable(){return this._onBindObservable||(this._onBindObservable=new tj),this._onBindObservable}set onBind(e){this._onBindObserver&&this.onBindObservable.remove(this._onBindObserver),this._onBindObserver=this.onBindObservable.add(e)}get onUnBindObservable(){return this._onUnBindObservable||(this._onUnBindObservable=new tj),this._onUnBindObservable}get onEffectCreatedObservable(){return this._onEffectCreatedObservable||(this._onEffectCreatedObservable=new tj),this._onEffectCreatedObservable}set alphaMode(e){this._alphaMode!==e&&(this._alphaMode=e,this.markAsDirty(nB.TextureDirtyFlag))}get alphaMode(){return this._alphaMode}set needDepthPrePass(e){this._needDepthPrePass!==e&&(this._needDepthPrePass=e,this._needDepthPrePass&&(this.checkReadyOnEveryCall=!0))}get needDepthPrePass(){return this._needDepthPrePass}get isPrePassCapable(){return!1}set fogEnabled(e){this._fogEnabled!==e&&(this._fogEnabled=e,this.markAsDirty(nB.MiscDirtyFlag))}get fogEnabled(){return this._fogEnabled}get wireframe(){switch(this._fillMode){case nB.WireFrameFillMode:case nB.LineListDrawMode:case nB.LineLoopDrawMode:case nB.LineStripDrawMode:return!0}return this._scene.forceWireframe}set wireframe(e){this.fillMode=e?nB.WireFrameFillMode:nB.TriangleFillMode}get pointsCloud(){switch(this._fillMode){case nB.PointFillMode:case nB.PointListDrawMode:return!0}return this._scene.forcePointsCloud}set pointsCloud(e){this.fillMode=e?nB.PointFillMode:nB.TriangleFillMode}get fillMode(){return this._fillMode}set fillMode(e){this._fillMode!==e&&(this._fillMode=e,this.markAsDirty(nB.MiscDirtyFlag))}get useLogarithmicDepth(){return this._useLogarithmicDepth}set useLogarithmicDepth(e){let t=this.getScene().getEngine().getCaps().fragmentDepthSupported;e&&!t&&ig.Warn("Logarithmic depth has been requested for a material on a device that doesn't support it."),this._useLogarithmicDepth=e&&t,this._markAllSubMeshesAsMiscDirty()}_getDrawWrapper(){return this._drawWrapper}_setDrawWrapper(e){this._drawWrapper=e}constructor(e,t,i){this.shadowDepthWrapper=null,this.allowShaderHotSwapping=!0,this.metadata=null,this.reservedDataStore=null,this.checkReadyOnEveryCall=!1,this.checkReadyOnlyOnce=!1,this.state="",this._alpha=1,this._backFaceCulling=!0,this._cullBackFaces=!0,this._blockDirtyMechanism=!1,this.onCompiled=null,this.onError=null,this.getRenderTargetTextures=null,this.doNotSerialize=!1,this._storeEffectOnSubMeshes=!1,this.animations=null,this.onDisposeObservable=new tj,this._onDisposeObserver=null,this._onUnBindObservable=null,this._onBindObserver=null,this._alphaMode=2,this._needDepthPrePass=!1,this.disableDepthWrite=!1,this.disableColorWrite=!1,this.forceDepthWrite=!1,this.depthFunction=0,this.separateCullingPass=!1,this._fogEnabled=!0,this.pointSize=1,this.zOffset=0,this.zOffsetUnits=0,this.stencil=new nL,this._useUBO=!1,this._fillMode=nB.TriangleFillMode,this._cachedDepthWriteState=!1,this._cachedColorWriteState=!1,this._cachedDepthFunctionState=0,this._indexInSceneMaterialArray=-1,this.meshMap=null,this._parentContainer=null,this._uniformBufferLayoutBuilt=!1,this._eventInfo={},this._callbackPluginEventGeneric=()=>void 0,this._callbackPluginEventIsReadyForSubMesh=()=>void 0,this._callbackPluginEventPrepareDefines=()=>void 0,this._callbackPluginEventPrepareDefinesBeforeAttributes=()=>void 0,this._callbackPluginEventHardBindForSubMesh=()=>void 0,this._callbackPluginEventBindForSubMesh=()=>void 0,this._callbackPluginEventHasRenderTargetTextures=()=>void 0,this._callbackPluginEventFillRenderTargetTextures=()=>void 0,this._forceAlphaTest=!1,this._transparencyMode=null,this.name=e;let r=t||t2.LastCreatedScene;if(!r)return;this._scene=r,this._dirtyCallbacks={},this._dirtyCallbacks[1]=this._markAllSubMeshesAsTexturesDirty.bind(this),this._dirtyCallbacks[2]=this._markAllSubMeshesAsLightsDirty.bind(this),this._dirtyCallbacks[4]=this._markAllSubMeshesAsFresnelDirty.bind(this),this._dirtyCallbacks[8]=this._markAllSubMeshesAsAttributesDirty.bind(this),this._dirtyCallbacks[16]=this._markAllSubMeshesAsMiscDirty.bind(this),this._dirtyCallbacks[32]=this._markAllSubMeshesAsPrePassDirty.bind(this),this._dirtyCallbacks[63]=this._markAllSubMeshesAsAllDirty.bind(this),this.id=e||ss.RandomId(),this.uniqueId=this._scene.getUniqueId(),this._materialContext=this._scene.getEngine().createMaterialContext(),this._drawWrapper=new rY(this._scene.getEngine(),!1),this._drawWrapper.materialContext=this._materialContext,this._scene.useRightHandedSystem?this.sideOrientation=nB.ClockWiseSideOrientation:this.sideOrientation=nB.CounterClockWiseSideOrientation,this._uniformBuffer=new sp(this._scene.getEngine(),void 0,void 0,e),this._useUBO=this.getScene().getEngine().supportsUniformBuffers,i||this._scene.addMaterial(this),this._scene.useMaterialMeshMap&&(this.meshMap={}),nB.OnEventObservable.notifyObservers(this,M.Created)}toString(e){return"Name: "+this.name}getClassName(){return"Material"}get _isMaterial(){return!0}get isFrozen(){return this.checkReadyOnlyOnce}freeze(){this.markDirty(),this.checkReadyOnlyOnce=!0}unfreeze(){this.markDirty(),this.checkReadyOnlyOnce=!1}isReady(e,t){return!0}isReadyForSubMesh(e,t,i){let r=t.materialDefines;return!!r&&(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=r,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),this._eventInfo.isReadyForSubMesh)}getEffect(){return this._drawWrapper.effect}getScene(){return this._scene}get transparencyMode(){return this._transparencyMode}set transparencyMode(e){this._transparencyMode!==e&&(this._transparencyMode=e,this._forceAlphaTest=e===nB.MATERIAL_ALPHATESTANDBLEND,this._markAllSubMeshesAsTexturesAndMiscDirty())}get _disableAlphaBlending(){return this._transparencyMode===nB.MATERIAL_OPAQUE||this._transparencyMode===nB.MATERIAL_ALPHATEST}needAlphaBlending(){return!this._disableAlphaBlending&&this.alpha<1}needAlphaBlendingForMesh(e){return e.visibility<1||!this._disableAlphaBlending&&(e.hasVertexAlpha||this.needAlphaBlending())}needAlphaTesting(){return!!this._forceAlphaTest}_shouldTurnAlphaTestOn(e){return!this.needAlphaBlendingForMesh(e)&&this.needAlphaTesting()}getAlphaTestTexture(){return null}markDirty(e=!1){for(let t of this.getScene().meshes)if(t.subMeshes)for(let i of t.subMeshes)i.getMaterial()===this&&i.effect&&(i.effect._wasPreviouslyReady=!1,i.effect._wasPreviouslyUsingInstances=null,i.effect._forceRebindOnNextCall=e);e&&this.markAsDirty(nB.AllDirtyFlag)}_preBind(e,t=null){let i=this._scene.getEngine(),r=(null==t?this.sideOrientation:t)===nB.ClockWiseSideOrientation;return i.enableEffect(e||this._getDrawWrapper()),i.setState(this.backFaceCulling,this.zOffset,!1,r,this._scene._mirroredCameraPosition?!this.cullBackFaces:this.cullBackFaces,this.stencil,this.zOffsetUnits),r}bind(e,t){}buildUniformLayout(){let e=this._uniformBuffer;this._eventInfo.ubo=e,this._callbackPluginEventGeneric(M.PrepareUniformBuffer,this._eventInfo),e.create(),this._uniformBufferLayoutBuilt=!0}bindForSubMesh(e,t,i){let r=i.effect;r&&(this._eventInfo.subMesh=i,this._callbackPluginEventBindForSubMesh(this._eventInfo),r._forceRebindOnNextCall=!1)}bindOnlyWorldMatrix(e){}bindView(e){this._useUBO?this._needToBindSceneUbo=!0:e.setMatrix("view",this.getScene().getViewMatrix())}bindViewProjection(e){this._useUBO?this._needToBindSceneUbo=!0:(e.setMatrix("viewProjection",this.getScene().getTransformMatrix()),e.setMatrix("projection",this.getScene().getProjectionMatrix()))}bindEyePosition(e,t){this._useUBO?this._needToBindSceneUbo=!0:this._scene.bindEyePosition(e,t)}_afterBind(e,t=null){if(this._scene._cachedMaterial=this,this._needToBindSceneUbo&&t&&(this._needToBindSceneUbo=!1,nw.BindSceneUniformBuffer(t,this.getScene().getSceneUniformBuffer()),this._scene.finalizeSceneUbo()),e?this._scene._cachedVisibility=e.visibility:this._scene._cachedVisibility=1,this._onBindObservable&&e&&this._onBindObservable.notifyObservers(e),this.disableDepthWrite){let e=this._scene.getEngine();this._cachedDepthWriteState=e.getDepthWrite(),e.setDepthWrite(!1)}if(this.disableColorWrite){let e=this._scene.getEngine();this._cachedColorWriteState=e.getColorWrite(),e.setColorWrite(!1)}if(0!==this.depthFunction){let e=this._scene.getEngine();this._cachedDepthFunctionState=e.getDepthFunction()||0,e.setDepthFunction(this.depthFunction)}}unbind(){this._onUnBindObservable&&this._onUnBindObservable.notifyObservers(this),0!==this.depthFunction&&this._scene.getEngine().setDepthFunction(this._cachedDepthFunctionState),this.disableDepthWrite&&this._scene.getEngine().setDepthWrite(this._cachedDepthWriteState),this.disableColorWrite&&this._scene.getEngine().setColorWrite(this._cachedColorWriteState)}getAnimatables(){return this._eventInfo.animatables=[],this._callbackPluginEventGeneric(M.GetAnimatables,this._eventInfo),this._eventInfo.animatables}getActiveTextures(){return this._eventInfo.activeTextures=[],this._callbackPluginEventGeneric(M.GetActiveTextures,this._eventInfo),this._eventInfo.activeTextures}hasTexture(e){return this._eventInfo.hasTexture=!1,this._eventInfo.texture=e,this._callbackPluginEventGeneric(M.HasTexture,this._eventInfo),this._eventInfo.hasTexture}clone(e){return null}_clonePlugins(e,t){let i={};if(this._serializePlugins(i),nB._parsePlugins(i,e,this._scene,t),this.pluginManager)for(let t of this.pluginManager._plugins){let i=e.pluginManager.getPlugin(t.name);i&&t.copyTo(i)}}getBindedMeshes(){if(!this.meshMap)return this._scene.meshes.filter(e=>e.material===this);{let e=[];for(let t in this.meshMap){let i=this.meshMap[t];i&&e.push(i)}return e}}forceCompilation(e,t,i,r){let s=Object.assign({clipPlane:!1,useInstances:!1},i),n=this.getScene(),a=this.allowShaderHotSwapping;this.allowShaderHotSwapping=!1;let o=()=>{if(!this._scene||!this._scene.getEngine())return;let i=n.clipPlane;if(s.clipPlane&&(n.clipPlane=new sG(0,0,0,1)),this._storeEffectOnSubMeshes){let i=!0,n=null;if(e.subMeshes){let t=new nf(0,0,0,0,0,e,void 0,!1,!1);t.materialDefines&&(t.materialDefines._renderId=-1),this.isReadyForSubMesh(e,t,s.useInstances)||(t.effect&&t.effect.getCompilationError()&&t.effect.allFallbacksProcessed()?n=t.effect.getCompilationError():(i=!1,setTimeout(o,16)))}i&&(this.allowShaderHotSwapping=a,n&&r&&r(n),t&&t(this))}else this.isReady()?(this.allowShaderHotSwapping=a,t&&t(this)):setTimeout(o,16);s.clipPlane&&(n.clipPlane=i)};o()}forceCompilationAsync(e,t){return new Promise((i,r)=>{this.forceCompilation(e,()=>{i()},t,e=>{r(e)})})}markAsDirty(e){this.getScene().blockMaterialDirtyMechanism||this._blockDirtyMechanism||(nB._DirtyCallbackArray.length=0,e&nB.TextureDirtyFlag&&nB._DirtyCallbackArray.push(nB._TextureDirtyCallBack),e&nB.LightDirtyFlag&&nB._DirtyCallbackArray.push(nB._LightsDirtyCallBack),e&nB.FresnelDirtyFlag&&nB._DirtyCallbackArray.push(nB._FresnelDirtyCallBack),e&nB.AttributesDirtyFlag&&nB._DirtyCallbackArray.push(nB._AttributeDirtyCallBack),e&nB.MiscDirtyFlag&&nB._DirtyCallbackArray.push(nB._MiscDirtyCallBack),e&nB.PrePassDirtyFlag&&nB._DirtyCallbackArray.push(nB._PrePassDirtyCallBack),nB._DirtyCallbackArray.length&&this._markAllSubMeshesAsDirty(nB._RunDirtyCallBacks),this.getScene().resetCachedMaterial())}resetDrawCache(){for(let e of this.getScene().meshes)if(e.subMeshes)for(let t of e.subMeshes)t.getMaterial()===this&&t.resetDrawCache()}_markAllSubMeshesAsDirty(e){if(!this.getScene().blockMaterialDirtyMechanism&&!this._blockDirtyMechanism){for(let t of this.getScene().meshes)if(t.subMeshes){for(let i of t.subMeshes)if(i.getMaterial(!1)===this)for(let t of i._drawWrappers)t&&t.defines&&t.defines.markAllAsDirty&&this._materialContext===t.materialContext&&e(t.defines)}}}_markScenePrePassDirty(){if(this.getScene().blockMaterialDirtyMechanism||this._blockDirtyMechanism)return;let e=this.getScene().enablePrePassRenderer();e&&e.markAsDirty()}_markAllSubMeshesAsAllDirty(){this._markAllSubMeshesAsDirty(nB._AllDirtyCallBack)}_markAllSubMeshesAsImageProcessingDirty(){this._markAllSubMeshesAsDirty(nB._ImageProcessingDirtyCallBack)}_markAllSubMeshesAsTexturesDirty(){this._markAllSubMeshesAsDirty(nB._TextureDirtyCallBack)}_markAllSubMeshesAsFresnelDirty(){this._markAllSubMeshesAsDirty(nB._FresnelDirtyCallBack)}_markAllSubMeshesAsFresnelAndMiscDirty(){this._markAllSubMeshesAsDirty(nB._FresnelAndMiscDirtyCallBack)}_markAllSubMeshesAsLightsDirty(){this._markAllSubMeshesAsDirty(nB._LightsDirtyCallBack)}_markAllSubMeshesAsAttributesDirty(){this._markAllSubMeshesAsDirty(nB._AttributeDirtyCallBack)}_markAllSubMeshesAsMiscDirty(){this._markAllSubMeshesAsDirty(nB._MiscDirtyCallBack)}_markAllSubMeshesAsPrePassDirty(){this._markAllSubMeshesAsDirty(nB._MiscDirtyCallBack)}_markAllSubMeshesAsTexturesAndMiscDirty(){this._markAllSubMeshesAsDirty(nB._TextureAndMiscDirtyCallBack)}_checkScenePerformancePriority(){if(this._scene.performancePriority!==y.BackwardCompatible){this.checkReadyOnlyOnce=!0;let e=this._scene.onScenePerformancePriorityChangedObservable.addOnce(()=>{this.checkReadyOnlyOnce=!1});this.onDisposeObservable.add(()=>{this._scene.onScenePerformancePriorityChangedObservable.remove(e)})}}setPrePassRenderer(e){return!1}dispose(e,t,i){let r=this.getScene();if(r.stopAnimation(this),r.freeProcessedMaterials(),r.removeMaterial(this),this._eventInfo.forceDisposeTextures=t,this._callbackPluginEventGeneric(M.Disposed,this._eventInfo),this._parentContainer){let e=this._parentContainer.materials.indexOf(this);e>-1&&this._parentContainer.materials.splice(e,1),this._parentContainer=null}if(!0!==i){if(this.meshMap)for(let t in this.meshMap){let i=this.meshMap[t];i&&(i.material=null,this.releaseVertexArrayObject(i,e))}else for(let t of r.meshes)t.material!==this||t.sourceMesh||(t.material=null,this.releaseVertexArrayObject(t,e))}this._uniformBuffer.dispose(),e&&this._drawWrapper.effect&&(this._storeEffectOnSubMeshes||this._drawWrapper.effect.dispose(),this._drawWrapper.effect=null),this.metadata=null,this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this._onBindObservable&&this._onBindObservable.clear(),this._onUnBindObservable&&this._onUnBindObservable.clear(),this._onEffectCreatedObservable&&this._onEffectCreatedObservable.clear(),this._eventInfo&&(this._eventInfo={})}releaseVertexArrayObject(e,t){let i=e.geometry;if(i){if(this._storeEffectOnSubMeshes){if(e.subMeshes)for(let r of e.subMeshes)i._releaseVertexArrayObject(r.effect),t&&r.effect&&r.effect.dispose()}else i._releaseVertexArrayObject(this._drawWrapper.effect)}}serialize(){let e=i$.Serialize(this);return e.stencil=this.stencil.serialize(),e.uniqueId=this.uniqueId,this._serializePlugins(e),e}_serializePlugins(e){if(e.plugins={},this.pluginManager)for(let t of this.pluginManager._plugins)e.plugins[t.getClassName()]=t.serialize()}static Parse(e,t,i){if(e.customType){if("BABYLON.PBRMaterial"===e.customType&&e.overloadedAlbedo&&(e.customType="BABYLON.LegacyPBRMaterial",!BABYLON.LegacyPBRMaterial))return ig.Error("Your scene is trying to load a legacy version of the PBRMaterial, please, include it from the materials library."),null}else e.customType="BABYLON.StandardMaterial";let r=ss.Instantiate(e.customType).Parse(e,t,i);return r._loadedUniqueId=e.uniqueId,r}static _parsePlugins(e,t,i,r){var s;if(e.plugins)for(let n in e.plugins){let a=e.plugins[n],o=null===(s=t.pluginManager)||void 0===s?void 0:s.getPlugin(a.name);if(!o){let e=ss.Instantiate("BABYLON."+n);e&&(o=new e(t))}null==o||o.parse(a,i,r)}}}nB.TriangleFillMode=0,nB.WireFrameFillMode=1,nB.PointFillMode=2,nB.PointListDrawMode=3,nB.LineListDrawMode=4,nB.LineLoopDrawMode=5,nB.LineStripDrawMode=6,nB.TriangleStripDrawMode=7,nB.TriangleFanDrawMode=8,nB.ClockWiseSideOrientation=0,nB.CounterClockWiseSideOrientation=1,nB.TextureDirtyFlag=1,nB.LightDirtyFlag=2,nB.FresnelDirtyFlag=4,nB.AttributesDirtyFlag=8,nB.MiscDirtyFlag=16,nB.PrePassDirtyFlag=32,nB.AllDirtyFlag=63,nB.MATERIAL_OPAQUE=0,nB.MATERIAL_ALPHATEST=1,nB.MATERIAL_ALPHABLEND=2,nB.MATERIAL_ALPHATESTANDBLEND=3,nB.MATERIAL_NORMALBLENDMETHOD_WHITEOUT=0,nB.MATERIAL_NORMALBLENDMETHOD_RNM=1,nB.OnEventObservable=new tj,nB._AllDirtyCallBack=e=>e.markAllAsDirty(),nB._ImageProcessingDirtyCallBack=e=>e.markAsImageProcessingDirty(),nB._TextureDirtyCallBack=e=>e.markAsTexturesDirty(),nB._FresnelDirtyCallBack=e=>e.markAsFresnelDirty(),nB._MiscDirtyCallBack=e=>e.markAsMiscDirty(),nB._PrePassDirtyCallBack=e=>e.markAsPrePassDirty(),nB._LightsDirtyCallBack=e=>e.markAsLightDirty(),nB._AttributeDirtyCallBack=e=>e.markAsAttributesDirty(),nB._FresnelAndMiscDirtyCallBack=e=>{nB._FresnelDirtyCallBack(e),nB._MiscDirtyCallBack(e)},nB._TextureAndMiscDirtyCallBack=e=>{nB._TextureDirtyCallBack(e),nB._MiscDirtyCallBack(e)},nB._DirtyCallbackArray=[],nB._RunDirtyCallBacks=e=>{for(let t of nB._DirtyCallbackArray)t(e)},iZ([iW()],nB.prototype,"id",void 0),iZ([iW()],nB.prototype,"uniqueId",void 0),iZ([iW()],nB.prototype,"name",void 0),iZ([iW()],nB.prototype,"metadata",void 0),iZ([iW()],nB.prototype,"checkReadyOnEveryCall",void 0),iZ([iW()],nB.prototype,"checkReadyOnlyOnce",void 0),iZ([iW()],nB.prototype,"state",void 0),iZ([iW("alpha")],nB.prototype,"_alpha",void 0),iZ([iW("backFaceCulling")],nB.prototype,"_backFaceCulling",void 0),iZ([iW("cullBackFaces")],nB.prototype,"_cullBackFaces",void 0),iZ([iW()],nB.prototype,"sideOrientation",void 0),iZ([iW("alphaMode")],nB.prototype,"_alphaMode",void 0),iZ([iW()],nB.prototype,"_needDepthPrePass",void 0),iZ([iW()],nB.prototype,"disableDepthWrite",void 0),iZ([iW()],nB.prototype,"disableColorWrite",void 0),iZ([iW()],nB.prototype,"forceDepthWrite",void 0),iZ([iW()],nB.prototype,"depthFunction",void 0),iZ([iW()],nB.prototype,"separateCullingPass",void 0),iZ([iW("fogEnabled")],nB.prototype,"_fogEnabled",void 0),iZ([iW()],nB.prototype,"pointSize",void 0),iZ([iW()],nB.prototype,"zOffset",void 0),iZ([iW()],nB.prototype,"zOffsetUnits",void 0),iZ([iW()],nB.prototype,"pointsCloud",null),iZ([iW()],nB.prototype,"fillMode",null),iZ([iW()],nB.prototype,"useLogarithmicDepth",null),iZ([iW()],nB.prototype,"transparencyMode",null);class nU extends nB{get subMaterials(){return this._subMaterials}set subMaterials(e){this._subMaterials=e,this._hookArray(e)}getChildren(){return this.subMaterials}constructor(e,t){super(e,t,!0),this._waitingSubMaterialsUniqueIds=[],this.getScene().addMultiMaterial(this),this.subMaterials=[],this._storeEffectOnSubMeshes=!0}_hookArray(e){let t=e.push;e.push=(...i)=>{let r=t.apply(e,i);return this._markAllSubMeshesAsTexturesDirty(),r};let i=e.splice;e.splice=(t,r)=>{let s=i.apply(e,[t,r]);return this._markAllSubMeshesAsTexturesDirty(),s}}getSubMaterial(e){return e<0||e>=this.subMaterials.length?this.getScene().defaultMaterial:this.subMaterials[e]}getActiveTextures(){return super.getActiveTextures().concat(...this.subMaterials.map(e=>e?e.getActiveTextures():[]))}hasTexture(e){var t;if(super.hasTexture(e))return!0;for(let i=0;i=0&&r.multiMaterials.splice(s,1),super.dispose(e,t)}static ParseMultiMaterial(e,t){let i=new nU(e.name,t);return i.id=e.id,i._loadedUniqueId=e.uniqueId,iF&&iF.AddTagsTo(i,e.tags),e.materialsUniqueIds?i._waitingSubMaterialsUniqueIds=e.materialsUniqueIds:e.materials.forEach(e=>i.subMaterials.push(t.getLastMaterialById(e))),i}}t0["BABYLON.MultiMaterial"]=nU;class nV{constructor(e,t){this.distanceOrScreenCoverage=e,this.mesh=t}}class nk{}class nG{constructor(){this.visibleInstances={},this.batchCache=new nz,this.batchCacheReplacementModeInFrozenMode=new nz,this.instancesBufferSize=2048}}class nz{constructor(){this.mustReturn=!1,this.visibleInstances=[],this.renderSelf=[],this.hardwareInstancedRendering=[]}}class nW{constructor(){this.instancesCount=0,this.matrixBuffer=null,this.previousMatrixBuffer=null,this.matrixBufferSize=512,this.matrixData=null,this.boundingVectors=[],this.worldMatrices=null}}class nH{constructor(){this._areNormalsFrozen=!1,this._source=null,this.meshMap=null,this._preActivateId=-1,this._LODLevels=[],this._useLODScreenCoverage=!1,this._effectiveMaterial=null,this._forcedInstanceCount=0,this._overrideRenderingFillMode=null}}class nX extends nM{static _GetDefaultSideOrientation(e){return e||nX.FRONTSIDE}get useLODScreenCoverage(){return this._internalMeshDataInfo._useLODScreenCoverage}set useLODScreenCoverage(e){this._internalMeshDataInfo._useLODScreenCoverage=e,this._sortLODLevels()}get computeBonesUsingShaders(){return this._internalAbstractMeshDataInfo._computeBonesUsingShaders}set computeBonesUsingShaders(e){this._internalAbstractMeshDataInfo._computeBonesUsingShaders!==e&&(e&&this._internalMeshDataInfo._sourcePositions&&(this.setVerticesData(sf.PositionKind,this._internalMeshDataInfo._sourcePositions,!0),this._internalMeshDataInfo._sourceNormals&&this.setVerticesData(sf.NormalKind,this._internalMeshDataInfo._sourceNormals,!0),this._internalMeshDataInfo._sourcePositions=null,this._internalMeshDataInfo._sourceNormals=null),this._internalAbstractMeshDataInfo._computeBonesUsingShaders=e,this._markSubMeshesAsAttributesDirty())}get onBeforeRenderObservable(){return this._internalMeshDataInfo._onBeforeRenderObservable||(this._internalMeshDataInfo._onBeforeRenderObservable=new tj),this._internalMeshDataInfo._onBeforeRenderObservable}get onBeforeBindObservable(){return this._internalMeshDataInfo._onBeforeBindObservable||(this._internalMeshDataInfo._onBeforeBindObservable=new tj),this._internalMeshDataInfo._onBeforeBindObservable}get onAfterRenderObservable(){return this._internalMeshDataInfo._onAfterRenderObservable||(this._internalMeshDataInfo._onAfterRenderObservable=new tj),this._internalMeshDataInfo._onAfterRenderObservable}get onBetweenPassObservable(){return this._internalMeshDataInfo._onBetweenPassObservable||(this._internalMeshDataInfo._onBetweenPassObservable=new tj),this._internalMeshDataInfo._onBetweenPassObservable}get onBeforeDrawObservable(){return this._internalMeshDataInfo._onBeforeDrawObservable||(this._internalMeshDataInfo._onBeforeDrawObservable=new tj),this._internalMeshDataInfo._onBeforeDrawObservable}set onBeforeDraw(e){this._onBeforeDrawObserver&&this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver),this._onBeforeDrawObserver=this.onBeforeDrawObservable.add(e)}get hasInstances(){return this.instances.length>0}get hasThinInstances(){return(this.forcedInstanceCount||this._thinInstanceDataStorage.instancesCount||0)>0}get forcedInstanceCount(){return this._internalMeshDataInfo._forcedInstanceCount}set forcedInstanceCount(e){this._internalMeshDataInfo._forcedInstanceCount=e}get overrideRenderingFillMode(){return this._internalMeshDataInfo._overrideRenderingFillMode}set overrideRenderingFillMode(e){this._internalMeshDataInfo._overrideRenderingFillMode=e}get source(){return this._internalMeshDataInfo._source}get cloneMeshMap(){return this._internalMeshDataInfo.meshMap}get isUnIndexed(){return this._unIndexed}set isUnIndexed(e){this._unIndexed!==e&&(this._unIndexed=e,this._markSubMeshesAsAttributesDirty())}get worldMatrixInstancedBuffer(){return this._instanceDataStorage.instancesData}get previousWorldMatrixInstancedBuffer(){return this._instanceDataStorage.instancesPreviousData}get manualUpdateOfWorldMatrixInstancedBuffer(){return this._instanceDataStorage.manualUpdate}set manualUpdateOfWorldMatrixInstancedBuffer(e){this._instanceDataStorage.manualUpdate=e}get manualUpdateOfPreviousWorldMatrixInstancedBuffer(){return this._instanceDataStorage.previousManualUpdate}set manualUpdateOfPreviousWorldMatrixInstancedBuffer(e){this._instanceDataStorage.previousManualUpdate=e}get forceWorldMatrixInstancedBufferUpdate(){return this._instanceDataStorage.forceMatrixUpdates}set forceWorldMatrixInstancedBufferUpdate(e){this._instanceDataStorage.forceMatrixUpdates=e}constructor(e,t=null,i=null,r=null,s,n=!0){if(super(e,t),this._internalMeshDataInfo=new nH,this.delayLoadState=0,this.instances=[],this._creationDataStorage=null,this._geometry=null,this._instanceDataStorage=new nG,this._thinInstanceDataStorage=new nW,this._shouldGenerateFlatShading=!1,this._originalBuilderSideOrientation=nX.DEFAULTSIDE,this.overrideMaterialSideOrientation=null,this.ignoreCameraMaxZ=!1,t=this.getScene(),this._onBeforeDraw=(e,t,i)=>{e&&i&&(this._uniformBuffer?this.transferToEffect(t):i.bindOnlyWorldMatrix(t))},r){if(r._geometry&&r._geometry.applyToMesh(this),iP.DeepCopy(r,this,["name","material","skeleton","instances","parent","uniqueId","source","metadata","morphTargetManager","hasInstances","worldMatrixInstancedBuffer","previousWorldMatrixInstancedBuffer","hasLODLevels","geometry","isBlocked","areNormalsFrozen","facetNb","isFacetDataEnabled","lightSources","useBones","isAnInstance","collider","edgesRenderer","forward","up","right","absolutePosition","absoluteScaling","absoluteRotationQuaternion","isWorldMatrixFrozen","nonUniformScaling","behaviors","worldMatrixFromCache","hasThinInstances","cloneMeshMap","hasBoundingInfo","physicsBody","physicsImpostor"],["_poseMatrix"]),this._internalMeshDataInfo._source=r,t.useClonedMeshMap&&(r._internalMeshDataInfo.meshMap||(r._internalMeshDataInfo.meshMap={}),r._internalMeshDataInfo.meshMap[this.uniqueId]=this),this._originalBuilderSideOrientation=r._originalBuilderSideOrientation,this._creationDataStorage=r._creationDataStorage,r._ranges){let e=r._ranges;for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&e[t]&&this.createAnimationRange(t,e[t].from,e[t].to)}if(r.metadata&&r.metadata.clone?this.metadata=r.metadata.clone():this.metadata=r.metadata,this._internalMetadata=r._internalMetadata,iF&&iF.HasTags(r)&&iF.AddTagsTo(this,iF.GetTags(r,!0)),this.setEnabled(r.isEnabled(!1)),this.parent=r.parent,this.setPivotMatrix(r.getPivotMatrix()),this.id=e+"."+r.id,this.material=r.material,!s){let t=r.getDescendants(!0);for(let i=0;i{e.unregisterOnNextCall=!0,this.isReady(!0)?this.onMeshReadyObservable.notifyObservers(this):this._internalMeshDataInfo._checkReadinessObserver||(this._internalMeshDataInfo._checkReadinessObserver=this._scene.onBeforeRenderObservable.add(()=>{this.isReady(!0)&&(this._scene.onBeforeRenderObservable.remove(this._internalMeshDataInfo._checkReadinessObserver),this._internalMeshDataInfo._checkReadinessObserver=null,this.onMeshReadyObservable.notifyObservers(this))}))},this.onMeshReadyObservable=new tj(this._internalMeshDataInfo._onMeshReadyObserverAdded),r&&r.onClonedObservable.notifyObservers(this)}instantiateHierarchy(e=null,t,i){let r=0===this.getTotalVertices()||t&&t.doNotInstantiate&&(!0===t.doNotInstantiate||t.doNotInstantiate(this))?this.clone("Clone of "+(this.name||this.id),e||this.parent,!0):this.createInstance("instance of "+(this.name||this.id));for(let s of(r.parent=e||this.parent,r.position=this.position.clone(),r.scaling=this.scaling.clone(),this.rotationQuaternion?r.rotationQuaternion=this.rotationQuaternion.clone():r.rotation=this.rotation.clone(),i&&i(this,r),this.getChildTransformNodes(!0)))"InstancedMesh"===s.getClassName()&&"Mesh"===r.getClassName()&&s.sourceMesh===this?s.instantiateHierarchy(r,{doNotInstantiate:t&&t.doNotInstantiate||!1,newSourcedMesh:r},i):s.instantiateHierarchy(r,t,i);return r}getClassName(){return"Mesh"}get _isMesh(){return!0}toString(e){let t=super.toString(e);if(t+=", n vertices: "+this.getTotalVertices()+", parent: "+(this._waitingParentId?this._waitingParentId:this.parent?this.parent.name:"NONE"),this.animations)for(let i=0;i0}getLODLevels(){return this._internalMeshDataInfo._LODLevels}_sortLODLevels(){let e=this._internalMeshDataInfo._useLODScreenCoverage?-1:1;this._internalMeshDataInfo._LODLevels.sort((t,i)=>t.distanceOrScreenCoveragei.distanceOrScreenCoverage?-e:0)}addLODLevel(e,t){if(t&&t._masterMesh)return ig.Warn("You cannot use a mesh as LOD level twice"),this;let i=new nV(e,t);return this._internalMeshDataInfo._LODLevels.push(i),t&&(t._masterMesh=this),this._sortLODLevels(),this}getLODLevelAtDistance(e){let t=this._internalMeshDataInfo;for(let i=0;ia*n)return this.onLODLevelSelection&&this.onLODLevelSelection(n,this,this),this;for(let e=0;e0||this.hasThinInstances);this.computeWorldMatrix();let d=this.material||u.defaultMaterial;if(d){if(d._storeEffectOnSubMeshes)for(let e of this.subMeshes){let t=e.getMaterial();if(t){if(t._storeEffectOnSubMeshes){if(!t.isReadyForSubMesh(this,e,c))return!1}else if(!t.isReady(this,c))return!1}}else if(!d.isReady(this,c))return!1}let p=h.currentRenderPassId;for(let e of this.lightSources){let t=e.getShadowGenerators();if(!t)continue;let u=t.values();for(let e=u.next();!0!==e.done;e=u.next()){let t=e.value;if(t&&(!(null===(i=t.getShadowMap())||void 0===i?void 0:i.renderList)||(null===(r=t.getShadowMap())||void 0===r?void 0:r.renderList)&&(null===(n=null===(s=t.getShadowMap())||void 0===s?void 0:s.renderList)||void 0===n?void 0:n.indexOf(this))!==-1)){let e=null!==(a=t.getShadowMap().renderPassIds)&&void 0!==a?a:[h.currentRenderPassId];for(let i=0;i0){let i=this.getIndices();if(!i)return null;let r=i.length,s=!1;if(e)s=!0;else for(let e of this.subMeshes)if(e.indexStart+e.indexCount>r||e.verticesStart+e.verticesCount>t){s=!0;break}if(!s)return this.subMeshes[0]}return this.releaseSubMeshes(),new nf(0,0,t,0,this.getTotalIndices(),this)}subdivide(e){if(e<1)return;let t=this.getTotalIndices(),i=t/e|0,r=0;for(;i%3!=0;)i++;this.releaseSubMeshes();for(let s=0;s=t);s++)nf.CreateFromIndices(0,r,s===e-1?t-r:i,this,void 0,!1),r+=i;this.refreshBoundingInfo(),this.synchronizeInstances()}setVerticesData(e,t,i=!1,r){if(this._geometry)this._geometry.setVerticesData(e,t,i,r);else{let r=new ng;r.set(t,e);let s=this.getScene();new nT(nT.RandomId(),s,r,i,this)}return this}removeVerticesData(e){this._geometry&&this._geometry.removeVerticesData(e)}markVerticesDataAsUpdatable(e,t=!0){let i=this.getVertexBuffer(e);i&&i.isUpdatable()!==t&&this.setVerticesData(e,this.getVerticesData(e),t)}setVerticesBuffer(e,t=!0){return this._geometry||(this._geometry=nT.CreateGeometryForMesh(this)),this._geometry.setVerticesBuffer(e,null,t),this}updateVerticesData(e,t,i,r){return this._geometry&&(r?(this.makeGeometryUnique(),this.updateVerticesData(e,t,i,!1)):this._geometry.updateVerticesData(e,t,i)),this}updateMeshPositions(e,t=!0){let i=this.getVerticesData(sf.PositionKind);if(!i)return this;if(e(i),this.updateVerticesData(sf.PositionKind,i,!1,!1),t){let e=this.getIndices(),t=this.getVerticesData(sf.NormalKind);if(!t)return this;ng.ComputeNormals(i,e,t),this.updateVerticesData(sf.NormalKind,t,!1,!1)}return this}makeGeometryUnique(){if(!this._geometry||1===this._geometry.meshes.length)return this;let e=this._geometry,t=this._geometry.copy(nT.RandomId());return e.releaseForMesh(this,!0),t.applyToMesh(this),this}setIndexBuffer(e,t,i){let r=this._geometry;r||(r=new nT(nT.RandomId(),this.getScene(),void 0,void 0,this)),r.setIndexBuffer(e,t,i)}setIndices(e,t=null,i=!1){if(this._geometry)this._geometry.setIndices(e,t,i);else{let t=new ng;t.indices=e;let r=this.getScene();new nT(nT.RandomId(),r,t,i,this)}return this}updateIndices(e,t,i=!1){return this._geometry&&this._geometry.updateIndices(e,t,i),this}toLeftHanded(){return this._geometry&&this._geometry.toLeftHanded(),this}_bind(e,t,i,r=!0){let s;if(!this._geometry)return this;let n=this.getScene().getEngine();if(this.morphTargetManager&&this.morphTargetManager.isUsingTextureForTargets&&this.morphTargetManager._bind(t),this._unIndexed)s=null;else switch(this._getRenderingFillMode(i)){case nB.PointFillMode:s=null;break;case nB.WireFrameFillMode:s=e._getLinesIndexBuffer(this.getIndices(),n);break;default:case nB.TriangleFillMode:s=this._geometry.getIndexBuffer()}return r&&this._userInstancedBuffersStorage&&!this.hasThinInstances?this._geometry._bind(t,s,this._userInstancedBuffersStorage.vertexBuffers,this._userInstancedBuffersStorage.vertexArrayObjects):this._geometry._bind(t,s),this}_draw(e,t,i){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;this._internalMeshDataInfo._onBeforeDrawObservable&&this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);let r=this.getScene().getEngine();return this._unIndexed||t==nB.PointFillMode?r.drawArraysType(t,e.verticesStart,e.verticesCount,this.forcedInstanceCount||i):t==nB.WireFrameFillMode?r.drawElementsType(t,0,e._linesIndexCount,this.forcedInstanceCount||i):r.drawElementsType(t,e.indexStart,e.indexCount,this.forcedInstanceCount||i),this}registerBeforeRender(e){return this.onBeforeRenderObservable.add(e),this}unregisterBeforeRender(e){return this.onBeforeRenderObservable.removeCallback(e),this}registerAfterRender(e){return this.onAfterRenderObservable.add(e),this}unregisterAfterRender(e){return this.onAfterRenderObservable.removeCallback(e),this}_getInstancesRenderList(e,t=!1){if(this._instanceDataStorage.isFrozen){if(t)return this._instanceDataStorage.batchCacheReplacementModeInFrozenMode.hardwareInstancedRendering[e]=!1,this._instanceDataStorage.batchCacheReplacementModeInFrozenMode.renderSelf[e]=!0,this._instanceDataStorage.batchCacheReplacementModeInFrozenMode;if(this._instanceDataStorage.previousBatch)return this._instanceDataStorage.previousBatch}let i=this.getScene(),r=i._isInIntermediateRendering(),s=r?this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate:this._internalAbstractMeshDataInfo._onlyForInstances,n=this._instanceDataStorage.batchCache;if(n.mustReturn=!1,n.renderSelf[e]=t||!s&&this.isEnabled()&&this.isVisible,n.visibleInstances[e]=null,this._instanceDataStorage.visibleInstances&&!t){let t=this._instanceDataStorage.visibleInstances,s=i.getRenderId(),a=r?t.intermediateDefaultRenderId:t.defaultRenderId;n.visibleInstances[e]=t[s],!n.visibleInstances[e]&&a&&(n.visibleInstances[e]=t[a])}return n.hardwareInstancedRendering[e]=!t&&this._instanceDataStorage.hardwareInstancedRendering&&null!==n.visibleInstances[e]&&void 0!==n.visibleInstances[e],this._instanceDataStorage.previousBatch=n,n}_renderWithInstances(e,t,i,r,s){var n;let a=i.visibleInstances[e._id],o=a?a.length:0,l=this._instanceDataStorage,h=l.instancesBufferSize,u=l.instancesBuffer,c=l.instancesPreviousBuffer,d=64*(o+1);for(;l.instancesBufferSizee._distanceToCamera>t._distanceToCamera?-1:e._distanceToCamera1&&u.activeCamera===u.activeCameras[0]||c<=1)&&this._checkOcclusionQuery()&&!this._occlusionDataStorage.forceRenderingWhenOccluded)return this;let d=this._getInstancesRenderList(e._id,!!i);if(d.mustReturn||!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;let p=u.getEngine(),_=0,f=null;this.ignoreCameraMaxZ&&u.activeCamera&&!u._isInIntermediateRendering()&&(_=u.activeCamera.maxZ,f=u.activeCamera,u.activeCamera.maxZ=0,u.updateTransformMatrix(!0)),this._internalMeshDataInfo._onBeforeRenderObservable&&this._internalMeshDataInfo._onBeforeRenderObservable.notifyObservers(this);let m=e.getRenderingMesh(),g=d.hardwareInstancedRendering[e._id]||m.hasThinInstances||!!this._userInstancedBuffersStorage&&!e.getMesh()._internalAbstractMeshDataInfo._actAsRegularMesh,v=this._instanceDataStorage,x=e.getMaterial();if(!x)return f&&(f.maxZ=_,u.updateTransformMatrix(!0)),this;if(v.isFrozen&&this._internalMeshDataInfo._effectiveMaterial&&this._internalMeshDataInfo._effectiveMaterial===x){if(x._storeEffectOnSubMeshes&&!(null===(n=e.effect)||void 0===n?void 0:n._wasPreviouslyReady)||!x._storeEffectOnSubMeshes&&!(null===(a=x.getEffect())||void 0===a?void 0:a._wasPreviouslyReady))return f&&(f.maxZ=_,u.updateTransformMatrix(!0)),this}else{if(x._storeEffectOnSubMeshes){if(!x.isReadyForSubMesh(this,e,g))return f&&(f.maxZ=_,u.updateTransformMatrix(!0)),this}else if(!x.isReady(this,g))return f&&(f.maxZ=_,u.updateTransformMatrix(!0)),this;this._internalMeshDataInfo._effectiveMaterial=x}t&&p.setAlphaMode(this._internalMeshDataInfo._effectiveMaterial.alphaMode);let T=null!==(o=null==(l=this._internalMeshDataInfo._effectiveMaterial._storeEffectOnSubMeshes?e._drawWrapper:this._internalMeshDataInfo._effectiveMaterial._getDrawWrapper())?void 0:l.effect)&&void 0!==o?o:null;for(let t of u._beforeRenderingMeshStage)t.action(this,e,d,T);if(!l||!T)return f&&(f.maxZ=_,u.updateTransformMatrix(!0)),this;let b=i||this;if(!v.isFrozen&&(this._internalMeshDataInfo._effectiveMaterial.backFaceCulling||null!==this.overrideMaterialSideOrientation||this._internalMeshDataInfo._effectiveMaterial.twoSidedLighting)){let e=b._getWorldMatrixDeterminant();null==(h=this.overrideMaterialSideOrientation)&&(h=this._internalMeshDataInfo._effectiveMaterial.sideOrientation),e<0&&(h=h===nB.ClockWiseSideOrientation?nB.CounterClockWiseSideOrientation:nB.ClockWiseSideOrientation),v.sideOrientation=h}else h=v.sideOrientation;let E=this._internalMeshDataInfo._effectiveMaterial._preBind(l,h);this._internalMeshDataInfo._effectiveMaterial.forceDepthWrite&&p.setDepthWrite(!0);let S=this._internalMeshDataInfo._effectiveMaterial,C=S.fillMode;this._internalMeshDataInfo._onBeforeBindObservable&&this._internalMeshDataInfo._onBeforeBindObservable.notifyObservers(this),g||this._bind(e,T,C,!1);let A=b.getWorldMatrix();for(let t of(S._storeEffectOnSubMeshes?S.bindForSubMesh(A,this,e):S.bind(A,this),!S.backFaceCulling&&S.separateCullingPass&&(p.setState(!0,S.zOffset,!1,!E,S.cullBackFaces,S.stencil,S.zOffsetUnits),this._processRendering(this,e,T,C,d,g,this._onBeforeDraw,this._internalMeshDataInfo._effectiveMaterial),p.setState(!0,S.zOffset,!1,E,S.cullBackFaces,S.stencil,S.zOffsetUnits),this._internalMeshDataInfo._onBetweenPassObservable&&this._internalMeshDataInfo._onBetweenPassObservable.notifyObservers(e)),this._processRendering(this,e,T,C,d,g,this._onBeforeDraw,this._internalMeshDataInfo._effectiveMaterial),this._internalMeshDataInfo._effectiveMaterial.unbind(),u._afterRenderingMeshStage))t.action(this,e,d,T);return this._internalMeshDataInfo._onAfterRenderObservable&&this._internalMeshDataInfo._onAfterRenderObservable.notifyObservers(this),f&&(f.maxZ=_,u.updateTransformMatrix(!0)),u.performancePriority!==y.Aggressive||v.isFrozen||this._freeze(),this}cleanMatrixWeights(){this.isVerticesDataPresent(sf.MatricesWeightsKind)&&(this.isVerticesDataPresent(sf.MatricesWeightsExtraKind)?this._normalizeSkinWeightsAndExtra():this._normalizeSkinFourWeights())}_normalizeSkinFourWeights(){let e=this.getVerticesData(sf.MatricesWeightsKind),t=e.length;for(let i=0;ii&&r++,0!==n&&c++,u+=n,i=n}if(l[c]++,c>n&&(n=c),0===u)s++;else{let i=1/u,r=0;for(let s=0;s.001&&a++}}let h=this.skeleton.bones.length,u=this.getVerticesData(sf.MatricesIndicesKind),c=this.getVerticesData(sf.MatricesIndicesExtraKind),d=0;for(let e=0;e=h||i<0)&&d++}let p="Number of Weights = "+i/4+"\nMaximum influences = "+n+"\nMissing Weights = "+s+"\nNot Sorted = "+r+"\nNot Normalized = "+a+"\nWeightCounts = ["+l+"]\nNumber of bones = "+h+"\nBad Bone Indices = "+d;return{skinned:!0,valid:0===s&&0===a&&0===d,report:p}}_checkDelayState(){let e=this.getScene();return this._geometry?this._geometry.load(e):4===this.delayLoadState&&(this.delayLoadState=2,this._queueLoad(e)),this}_queueLoad(e){e.addPendingData(this);let t=-1!==this.delayLoadingFile.indexOf(".babylonbinarymeshdata");return ss.LoadFile(this.delayLoadingFile,t=>{t instanceof ArrayBuffer?this._delayLoadingFunction(t,this):this._delayLoadingFunction(JSON.parse(t),this),this.instances.forEach(e=>{e.refreshBoundingInfo(),e._syncSubMeshes()}),this.delayLoadState=1,e.removePendingData(this)},()=>{},e.offlineProvider,t),this}isInFrustum(e){return!!(2!==this.delayLoadState&&super.isInFrustum(e))&&(this._checkDelayState(),!0)}setMaterialById(e){let t;let i=this.getScene().materials;for(t=i.length-1;t>-1;t--)if(i[t].id===e)return this.material=i[t],this;let r=this.getScene().multiMaterials;for(t=r.length-1;t>-1;t--)if(r[t].id===e){this.material=r[t];break}return this}getAnimatables(){let e=[];return this.material&&e.push(this.material),this.skeleton&&e.push(this.skeleton),e}bakeTransformIntoVertices(e){let t;if(!this.isVerticesDataPresent(sf.PositionKind))return this;let i=this.subMeshes.splice(0);this._resetPointsArrayCache();let r=this.getVerticesData(sf.PositionKind),s=t5.Zero();for(t=0;te.determinant()&&this.flipFaces(),this.releaseSubMeshes(),this.subMeshes=i,this}bakeCurrentTransformIntoVertices(e=!0){return this.bakeTransformIntoVertices(this.computeWorldMatrix(!0)),this.resetLocalMatrix(e),this}get _positions(){return this._internalAbstractMeshDataInfo._positions?this._internalAbstractMeshDataInfo._positions:this._geometry?this._geometry._positions:null}_resetPointsArrayCache(){return this._geometry&&this._geometry._resetPointsArrayCache(),this}_generatePointsArray(){return!!this._geometry&&this._geometry._generatePointsArray()}clone(e="",t=null,i,r=!0){return new nX(e,this.getScene(),t,this,i,r)}dispose(e,t=!1){this.morphTargetManager=null,this._geometry&&this._geometry.releaseForMesh(this,!0);let i=this._internalMeshDataInfo;if(i._onBeforeDrawObservable&&i._onBeforeDrawObservable.clear(),i._onBeforeBindObservable&&i._onBeforeBindObservable.clear(),i._onBeforeRenderObservable&&i._onBeforeRenderObservable.clear(),i._onAfterRenderObservable&&i._onAfterRenderObservable.clear(),i._onBetweenPassObservable&&i._onBetweenPassObservable.clear(),this._scene.useClonedMeshMap){if(i.meshMap)for(let e in i.meshMap){let t=i.meshMap[e];t&&(t._internalMeshDataInfo._source=null,i.meshMap[e]=void 0)}i._source&&i._source._internalMeshDataInfo.meshMap&&(i._source._internalMeshDataInfo.meshMap[this.uniqueId]=void 0)}else for(let e of this.getScene().meshes)e._internalMeshDataInfo&&e._internalMeshDataInfo._source&&e._internalMeshDataInfo._source===this&&(e._internalMeshDataInfo._source=null);i._source=null,this._instanceDataStorage.visibleInstances={},this._disposeInstanceSpecificData(),this._disposeThinInstanceSpecificData(),this._internalMeshDataInfo._checkReadinessObserver&&this._scene.onBeforeRenderObservable.remove(this._internalMeshDataInfo._checkReadinessObserver),super.dispose(e,t)}_disposeInstanceSpecificData(){}_disposeThinInstanceSpecificData(){}_invalidateInstanceVertexArrayObject(){}applyDisplacementMap(e,t,i,r,s,n,a=!1,o){let l=this.getScene();return ss.LoadImage(e,e=>{let o=e.width,l=e.height,h=this.getEngine().createCanvas(o,l).getContext("2d");h.drawImage(e,0,0);let u=h.getImageData(0,0,o,l).data;this.applyDisplacementMapFromBuffer(u,o,l,t,i,s,n,a),r&&r(this)},o||(()=>{}),l.offlineProvider),this}applyDisplacementMapFromBuffer(e,t,i,r,s,n,a,o=!1){if(!this.isVerticesDataPresent(sf.PositionKind)||!this.isVerticesDataPresent(sf.NormalKind)||!this.isVerticesDataPresent(sf.UVKind))return ig.Warn("Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing"),this;let l=this.getVerticesData(sf.PositionKind,!0,!0),h=this.getVerticesData(sf.NormalKind),u=this.getVerticesData(sf.UVKind),c=t5.Zero(),d=t5.Zero(),p=t4.Zero();n=n||t4.Zero(),a=a||new t4(1,1);for(let o=0;o{let r=new Float32Array(i.length*t),s=0;for(let n=0;nMath.abs(r[3*u[e]+t])&&(r[3*u[e]+t]=0),x[e]+=r[3*u[e]+t]+"|"}if(!(x[0]==x[1]||x[0]==x[2]||x[1]==x[2]))for(let e=0;e<3;e++){if(void 0===(h=b[x[e]])){b[x[e]]=T,h=T++;for(let t=0;t<3;t++)c.push(r[3*u[e]+t]);if(null!=s)for(let t=0;t<4;t++)_.push(s[4*u[e]+t]);if(null!=t)for(let i=0;i<2;i++)p.push(t[2*u[e]+i]);if(null!=n)for(let t=0;t<4;t++)f.push(n[4*u[e]+t]);if(null!=a)for(let t=0;t<4;t++)m.push(a[4*u[e]+t]);if(null!=o)for(let t=0;t<4;t++)g.push(o[4*u[e]+t]);if(null!=l)for(let t=0;t<4;t++)v.push(l[4*u[e]+t])}d.push(h)}}let E=[];ng.ComputeNormals(c,d,E),e.positions=c,e.indices=d,e.normals=E,null!=t&&(e.uvs=p),null!=s&&(e.colors=_),null!=n&&(e.matricesIndices=f),null!=a&&(e.matricesWeights=m),null!=o&&(e.matricesIndicesExtra=g),null!=a&&(e.matricesWeightsExtra=v),e.applyToMesh(this,this.isVertexBufferUpdatable(sf.PositionKind))}}static _instancedMeshFactory(e,t){throw iL("InstancedMesh")}static _PhysicsImpostorParser(e,t,i){throw iL("PhysicsImpostor")}createInstance(e){return nX._instancedMeshFactory(e,this)}synchronizeInstances(){for(let e=0;e{let t=r.length-1-e,i=r[t];for(let e=0;e{for(let e=0;e-1&&(r.morphTargetManager=t.getMorphTargetManagerById(e.morphTargetManagerId)),void 0!==e.skeletonId&&null!==e.skeletonId&&(r.skeleton=t.getLastSkeletonById(e.skeletonId),e.numBoneInfluencers&&(r.numBoneInfluencers=e.numBoneInfluencers)),e.animations){for(let t=0;t4,h=l?this.getVerticesData(sf.MatricesIndicesExtraKind):null,u=l?this.getVerticesData(sf.MatricesWeightsExtraKind):null,c=e.getTransformMatrices(this),d=t5.Zero(),p=new t7,_=new t7,f=0;for(let e=0;e0&&(t7.FromFloat32ArrayToRefScaled(c,Math.floor(16*a[f+t]),m,_),p.addToSelf(_));if(l)for(t=0;t<4;t++)(m=u[f+t])>0&&(t7.FromFloat32ArrayToRefScaled(c,Math.floor(16*h[f+t]),m,_),p.addToSelf(_));t5.TransformCoordinatesFromFloatsToRef(r._sourcePositions[e],r._sourcePositions[e+1],r._sourcePositions[e+2],p,d),d.toArray(s,e),i&&(t5.TransformNormalFromFloatsToRef(r._sourceNormals[e],r._sourceNormals[e+1],r._sourceNormals[e+2],p,d),d.toArray(n,e)),p.reset()}return this.updateVerticesData(sf.PositionKind,s),i&&this.updateVerticesData(sf.NormalKind,n),this}static MinMax(e){let t=null,i=null;return(e.forEach(function(e){let r=e.getBoundingInfo().boundingBox;t&&i?(t.minimizeInPlace(r.minimumWorld),i.maximizeInPlace(r.maximumWorld)):(t=r.minimumWorld,i=r.maximumWorld)}),t&&i)?{min:t,max:i}:{min:t5.Zero(),max:t5.Zero()}}static Center(e){let t=e instanceof Array?nX.MinMax(e):e;return t5.Center(t.min,t.max)}static MergeMeshes(e,t=!0,i,r,s,n){return nt(nX._MergeMeshesCoroutine(e,t,i,r,s,n,!1))}static MergeMeshesAsync(e,t=!0,i,r,s,n){return ni(nX._MergeMeshesCoroutine(e,t,i,r,s,n,!0),function(e=25){let t;return(i,r,s)=>{let n=performance.now();void 0===t||n-t>e?(t=n,setTimeout(()=>{s9(i,r,s)},0)):s9(i,r,s)}}())}static*_MergeMeshesCoroutine(e,t=!0,i,r,s,n,a){let o;if(0===(e=e.filter(Boolean)).length)return null;if(!i){let t=0;for(o=0;o=65536)return ig.Warn("Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices"),null}n&&(s=!1);let l=[],h=[],u=[],c=e[0].overrideMaterialSideOrientation;for(o=0;ol.indexOf(e.subMaterials[t])&&l.push(e.subMaterials[t]);for(let i=0;il.indexOf(e)&&l.push(e);for(let i=0;i{let t=e.computeWorldMatrix(!0);return{vertexData:ng.ExtractFromMesh(e,!1,!1),transform:t}},{vertexData:_,transform:f}=p(d);a&&(yield);let m=Array(e.length-1);for(let t=1;t{throw iL("GroundMesh")},nX._GoldbergMeshParser=(e,t)=>{throw iL("GoldbergMesh")},nX._LinesMeshParser=(e,t)=>{throw iL("LinesMesh")},nX._GreasedLineMeshParser=(e,t)=>{throw iL("GreasedLineMesh")},nX._GreasedLineRibbonMeshParser=(e,t)=>{throw iL("GreasedLineRibbonMesh")},nX._TrailMeshParser=(e,t)=>{throw iL("TrailMesh")},t0["BABYLON.Mesh"]=nX,nX._instancedMeshFactory=(e,t)=>{let i=new nY(e,t);if(t.instancedBuffers)for(let e in i.instancedBuffers={},t.instancedBuffers)i.instancedBuffers[e]=t.instancedBuffers[e];return i};class nY extends nM{constructor(e,t){for(let i of(super(e,t.getScene()),this._indexInSourceMeshInstanceArray=-1,this._distanceToCamera=0,t.addInstance(this),this._sourceMesh=t,this._unIndexed=t._unIndexed,this.position.copyFrom(t.position),this.rotation.copyFrom(t.rotation),this.scaling.copyFrom(t.scaling),t.rotationQuaternion&&(this.rotationQuaternion=t.rotationQuaternion.clone()),this.animations=t.animations.slice(),t.getAnimationRanges()))null!=i&&this.createAnimationRange(i.name,i.from,i.to);this.infiniteDistance=t.infiniteDistance,this.setPivotMatrix(t.getPivotMatrix()),this.refreshBoundingInfo(!0,!0),this._syncSubMeshes()}getClassName(){return"InstancedMesh"}get lightSources(){return this._sourceMesh._lightSources}_resyncLightSources(){}_resyncLightSource(){}_removeLightSource(){}get receiveShadows(){return this._sourceMesh.receiveShadows}set receiveShadows(e){var t;(null===(t=this._sourceMesh)||void 0===t?void 0:t.receiveShadows)!==e&&ss.Warn("Setting receiveShadows on an instanced mesh has no effect")}get material(){return this._sourceMesh.material}set material(e){var t;(null===(t=this._sourceMesh)||void 0===t?void 0:t.material)!==e&&ss.Warn("Setting material on an instanced mesh has no effect")}get visibility(){return this._sourceMesh.visibility}set visibility(e){var t;(null===(t=this._sourceMesh)||void 0===t?void 0:t.visibility)!==e&&ss.Warn("Setting visibility on an instanced mesh has no effect")}get skeleton(){return this._sourceMesh.skeleton}set skeleton(e){var t;(null===(t=this._sourceMesh)||void 0===t?void 0:t.skeleton)!==e&&ss.Warn("Setting skeleton on an instanced mesh has no effect")}get renderingGroupId(){return this._sourceMesh.renderingGroupId}set renderingGroupId(e){this._sourceMesh&&e!==this._sourceMesh.renderingGroupId&&ig.Warn("Note - setting renderingGroupId of an instanced mesh has no effect on the scene")}getTotalVertices(){return this._sourceMesh?this._sourceMesh.getTotalVertices():0}getTotalIndices(){return this._sourceMesh.getTotalIndices()}get sourceMesh(){return this._sourceMesh}createInstance(e){return this._sourceMesh.createInstance(e)}isReady(e=!1){return this._sourceMesh.isReady(e,!0)}getVerticesData(e,t,i){return this._sourceMesh.getVerticesData(e,t,i)}setVerticesData(e,t,i,r){return this.sourceMesh&&this.sourceMesh.setVerticesData(e,t,i,r),this.sourceMesh}updateVerticesData(e,t,i,r){return this.sourceMesh&&this.sourceMesh.updateVerticesData(e,t,i,r),this.sourceMesh}setIndices(e,t=null){return this.sourceMesh&&this.sourceMesh.setIndices(e,t),this.sourceMesh}isVerticesDataPresent(e){return this._sourceMesh.isVerticesDataPresent(e)}getIndices(){return this._sourceMesh.getIndices()}get _positions(){return this._sourceMesh._positions}refreshBoundingInfo(e=!1,t=!1){if(this.hasBoundingInfo&&this.getBoundingInfo().isLocked)return this;let i=this._sourceMesh.geometry?this._sourceMesh.geometry.boundingBias:null;return this._refreshBoundingInfo(this._sourceMesh._getPositionData(e,t),i),this}_preActivate(){return this._currentLOD&&this._currentLOD._preActivate(),this}_activate(e,t){if(super._activate(e,t),this._sourceMesh.subMeshes||ig.Warn("Instances should only be created for meshes with geometry."),this._currentLOD){if(this._currentLOD._getWorldMatrixDeterminant()>=0!=this._getWorldMatrixDeterminant()>=0)return this._internalAbstractMeshDataInfo._actAsRegularMesh=!0,!0;if(this._internalAbstractMeshDataInfo._actAsRegularMesh=!1,this._currentLOD._registerInstanceForRenderId(this,e),t){if(!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate=!0,!0}else if(!this._currentLOD._internalAbstractMeshDataInfo._isActive)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances=!0,!0}return!1}_postActivate(){this._sourceMesh.edgesShareWithInstances&&this._sourceMesh._edgesRenderer&&this._sourceMesh._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup?(this._sourceMesh._renderingGroup._edgesRenderers.pushNoDuplicate(this._sourceMesh._edgesRenderer),this._sourceMesh._edgesRenderer.customInstances.push(this.getWorldMatrix())):this._edgesRenderer&&this._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup&&this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer)}getWorldMatrix(){if(this._currentLOD&&this._currentLOD.billboardMode!==nA.BILLBOARDMODE_NONE&&this._currentLOD._masterMesh!==this){this._billboardWorldMatrix||(this._billboardWorldMatrix=new t7);let e=this._currentLOD._masterMesh;return this._currentLOD._masterMesh=this,ie.Vector3[7].copyFrom(this._currentLOD.position),this._currentLOD.position.set(0,0,0),this._billboardWorldMatrix.copyFrom(this._currentLOD.computeWorldMatrix(!0)),this._currentLOD.position.copyFrom(ie.Vector3[7]),this._currentLOD._masterMesh=e,this._billboardWorldMatrix}return super.getWorldMatrix()}get isAnInstance(){return!0}getLOD(e){if(!e)return this;let t=this.sourceMesh.getLODLevels();if(t&&0!==t.length){let t=this.getBoundingInfo();this._currentLOD=this.sourceMesh.getLOD(e,t.boundingSphere)}else this._currentLOD=this.sourceMesh;return this._currentLOD}_preActivateForIntermediateRendering(e){return this.sourceMesh._preActivateForIntermediateRendering(e)}_syncSubMeshes(){if(this.releaseSubMeshes(),this._sourceMesh.subMeshes)for(let e=0;e0)||-1!==this.includedOnlyMeshes.indexOf(e))&&(!this.excludedMeshes||!(this.excludedMeshes.length>0)||-1===this.excludedMeshes.indexOf(e))&&(0===this.includeOnlyWithLayerMask||(this.includeOnlyWithLayerMask&e.layerMask)!=0)&&(0===this.excludeWithLayerMask||!(this.excludeWithLayerMask&e.layerMask))}dispose(e,t=!1){if(this._shadowGenerators){let e=this._shadowGenerators.values();for(let t=e.next();!0!==t.done;t=e.next())t.value.dispose();this._shadowGenerators=null}if(this.getScene().stopAnimation(this),this._parentContainer){let e=this._parentContainer.lights.indexOf(this);e>-1&&this._parentContainer.lights.splice(e,1),this._parentContainer=null}for(let e of this.getScene().meshes)e._removeLightSource(this,!0);this._uniformBuffer.dispose(),this.getScene().removeLight(this),super.dispose(e,t)}getTypeID(){return 0}getScaledIntensity(){return this._photometricScale*this.intensity}clone(e,t=null){let i=nj.GetConstructorFromName(this.getTypeID(),e,this.getScene());if(!i)return null;let r=i$.Clone(i,this);return e&&(r.name=e),t&&(r.parent=t),r.setEnabled(this.isEnabled()),this.onClonedObservable.notifyObservers(r),r}serialize(){let e=i$.Serialize(this);return e.uniqueId=this.uniqueId,e.type=this.getTypeID(),this.parent&&this.parent._serializeAsParent(e),this.excludedMeshes.length>0&&(e.excludedMeshesIds=[],this.excludedMeshes.forEach(t=>{e.excludedMeshesIds.push(t.id)})),this.includedOnlyMeshes.length>0&&(e.includedOnlyMeshesIds=[],this.includedOnlyMeshes.forEach(t=>{e.includedOnlyMeshesIds.push(t.id)})),i$.AppendSerializedAnimations(this,e),e.ranges=this.serializeAnimationRanges(),e.isEnabled=this.isEnabled(),e}static GetConstructorFromName(e,t,i){return i0.Construct("Light_Type_"+e,t,i)||null}static Parse(e,t){let i=nj.GetConstructorFromName(e.type,e.name,t);if(!i)return null;let r=i$.Parse(i,e,t);if(e.excludedMeshesIds&&(r._excludedMeshesIds=e.excludedMeshesIds),e.includedOnlyMeshesIds&&(r._includedOnlyMeshesIds=e.includedOnlyMeshesIds),void 0!==e.parentId&&(r._waitingParentId=e.parentId),void 0!==e.parentInstanceIndex&&(r._waitingParentInstanceIndex=e.parentInstanceIndex),void 0!==e.falloffType&&(r.falloffType=e.falloffType),void 0!==e.lightmapMode&&(r.lightmapMode=e.lightmapMode),e.animations){for(let t=0;t{let r=t.apply(e,i);for(let e of i)e._resyncLightSource(this);return r};let i=e.splice;for(let t of(e.splice=(t,r)=>{let s=i.apply(e,[t,r]);for(let e of s)e._resyncLightSource(this);return s},e))t._resyncLightSource(this)}_hookArrayForIncludedOnly(e){let t=e.push;e.push=(...i)=>{let r=t.apply(e,i);return this._resyncMeshes(),r};let i=e.splice;e.splice=(t,r)=>{let s=i.apply(e,[t,r]);return this._resyncMeshes(),s},this._resyncMeshes()}_resyncMeshes(){for(let e of this.getScene().meshes)e._resyncLightSource(this)}_markMeshesAsLightDirty(){for(let e of this.getScene().meshes)-1!==e.lightSources.indexOf(this)&&e._markSubMeshesAsLightDirty()}_computePhotometricScale(){this._photometricScale=this._getPhotometricScale(),this.getScene().resetCachedMaterial()}_getPhotometricScale(){let e=0,t=this.getTypeID(),i=this.intensityMode;switch(i===nj.INTENSITYMODE_AUTOMATIC&&(i=t===nj.LIGHTTYPEID_DIRECTIONALLIGHT?nj.INTENSITYMODE_ILLUMINANCE:nj.INTENSITYMODE_LUMINOUSINTENSITY),t){case nj.LIGHTTYPEID_POINTLIGHT:case nj.LIGHTTYPEID_SPOTLIGHT:switch(i){case nj.INTENSITYMODE_LUMINOUSPOWER:e=1/(4*Math.PI);break;case nj.INTENSITYMODE_LUMINOUSINTENSITY:e=1;break;case nj.INTENSITYMODE_LUMINANCE:e=this.radius*this.radius}break;case nj.LIGHTTYPEID_DIRECTIONALLIGHT:switch(i){case nj.INTENSITYMODE_ILLUMINANCE:e=1;break;case nj.INTENSITYMODE_LUMINANCE:{let t=this.radius;e=2*Math.PI*(1-Math.cos(t=Math.max(t,.001)))}}break;case nj.LIGHTTYPEID_HEMISPHERICLIGHT:e=1}return e}_reorderLightsInScene(){let e=this.getScene();0!=this._renderPriority&&(e.requireLightSorting=!0),this.getScene().sortLightsByPriority()}}nj.FALLOFF_DEFAULT=sH.FALLOFF_DEFAULT,nj.FALLOFF_PHYSICAL=sH.FALLOFF_PHYSICAL,nj.FALLOFF_GLTF=sH.FALLOFF_GLTF,nj.FALLOFF_STANDARD=sH.FALLOFF_STANDARD,nj.LIGHTMAP_DEFAULT=sH.LIGHTMAP_DEFAULT,nj.LIGHTMAP_SPECULAR=sH.LIGHTMAP_SPECULAR,nj.LIGHTMAP_SHADOWSONLY=sH.LIGHTMAP_SHADOWSONLY,nj.INTENSITYMODE_AUTOMATIC=sH.INTENSITYMODE_AUTOMATIC,nj.INTENSITYMODE_LUMINOUSPOWER=sH.INTENSITYMODE_LUMINOUSPOWER,nj.INTENSITYMODE_LUMINOUSINTENSITY=sH.INTENSITYMODE_LUMINOUSINTENSITY,nj.INTENSITYMODE_ILLUMINANCE=sH.INTENSITYMODE_ILLUMINANCE,nj.INTENSITYMODE_LUMINANCE=sH.INTENSITYMODE_LUMINANCE,nj.LIGHTTYPEID_POINTLIGHT=sH.LIGHTTYPEID_POINTLIGHT,nj.LIGHTTYPEID_DIRECTIONALLIGHT=sH.LIGHTTYPEID_DIRECTIONALLIGHT,nj.LIGHTTYPEID_SPOTLIGHT=sH.LIGHTTYPEID_SPOTLIGHT,nj.LIGHTTYPEID_HEMISPHERICLIGHT=sH.LIGHTTYPEID_HEMISPHERICLIGHT,iZ([iX()],nj.prototype,"diffuse",void 0),iZ([iX()],nj.prototype,"specular",void 0),iZ([iW()],nj.prototype,"falloffType",void 0),iZ([iW()],nj.prototype,"intensity",void 0),iZ([iW()],nj.prototype,"range",null),iZ([iW()],nj.prototype,"intensityMode",null),iZ([iW()],nj.prototype,"radius",null),iZ([iW()],nj.prototype,"_renderPriority",void 0),iZ([iz("_reorderLightsInScene")],nj.prototype,"renderPriority",void 0),iZ([iW("shadowEnabled")],nj.prototype,"_shadowEnabled",void 0),iZ([iW("excludeWithLayerMask")],nj.prototype,"_excludeWithLayerMask",void 0),iZ([iW("includeOnlyWithLayerMask")],nj.prototype,"_includeOnlyWithLayerMask",void 0),iZ([iW("lightmapMode")],nj.prototype,"_lightmapMode",void 0);class nK extends tW{}class n${constructor(){this.rootNodes=[],this.skeletons=[],this.animationGroups=[]}dispose(){this.rootNodes.slice(0).forEach(e=>{e.dispose()}),this.rootNodes.length=0,this.skeletons.slice(0).forEach(e=>{e.dispose()}),this.skeletons.length=0,this.animationGroups.slice(0).forEach(e=>{e.dispose()}),this.animationGroups.length=0}}class nq extends tW{constructor(e){if(super(),this._wasAddedToScene=!1,!(e=e||t2.LastCreatedScene))return;this.scene=e,this.sounds=[],this.effectLayers=[],this.layers=[],this.lensFlareSystems=[],this.proceduralTextures=[],this.reflectionProbes=[],e.onDisposeObservable.add(()=>{this._wasAddedToScene||this.dispose()}),this._onContextRestoredObserver=e.getEngine().onContextRestoredObservable.add(()=>{for(let e of this.geometries)e._rebuild();for(let e of this.meshes)e._rebuild();for(let e of this.particleSystems)e.rebuild();for(let e of this.textures)e._rebuild()})}_topologicalSort(e){let t=new Map;for(let i of e)t.set(i.uniqueId,i);let i={dependsOn:new Map,dependedBy:new Map};for(let t of e){let e=t.uniqueId;i.dependsOn.set(e,new Set),i.dependedBy.set(e,new Set)}for(let r of e){let e=r.uniqueId,s=i.dependsOn.get(e);if(r instanceof nY){let n=r.sourceMesh;t.has(n.uniqueId)&&(s.add(n.uniqueId),i.dependedBy.get(n.uniqueId).add(e))}let n=i.dependedBy.get(e);for(let s of r.getDescendants()){let r=s.uniqueId;t.has(r)&&(n.add(r),i.dependsOn.get(r).add(e))}}let r=[],s=[];for(let r of e){let e=r.uniqueId;0===i.dependsOn.get(e).size&&(s.push(r),t.delete(e))}for(;s.length>0;){let e=s.shift();for(let n of(r.push(e),Array.from(i.dependedBy.get(e.uniqueId).values()))){let r=i.dependsOn.get(n);r.delete(e.uniqueId),0===r.size&&t.get(n)&&(s.push(t.get(n)),t.delete(n))}}return t.size>0&&(ig.Error("SceneSerializer._topologicalSort: There were unvisited nodes:"),t.forEach(e=>ig.Error(e.name))),r}_addNodeAndDescendantsToList(e,t,i,r){if(!(!i||r&&!r(i)||t.has(i.uniqueId)))for(let s of(e.push(i),t.add(i.uniqueId),i.getDescendants(!0)))this._addNodeAndDescendantsToList(e,t,s,r)}_isNodeInContainer(e){return e instanceof nX&&-1!==this.meshes.indexOf(e)||e instanceof nA&&-1!==this.transformNodes.indexOf(e)||e instanceof nj&&-1!==this.lights.indexOf(e)||e instanceof ns&&-1!==this.cameras.indexOf(e)}_isValidHierarchy(){for(let e of this.meshes)if(e.parent&&!this._isNodeInContainer(e.parent))return ig.Warn(`Node ${e.name} has a parent that is not in the container.`),!1;for(let e of this.transformNodes)if(e.parent&&!this._isNodeInContainer(e.parent))return ig.Warn(`Node ${e.name} has a parent that is not in the container.`),!1;for(let e of this.lights)if(e.parent&&!this._isNodeInContainer(e.parent))return ig.Warn(`Node ${e.name} has a parent that is not in the container.`),!1;for(let e of this.cameras)if(e.parent&&!this._isNodeInContainer(e.parent))return ig.Warn(`Node ${e.name} has a parent that is not in the container.`),!1;return!0}instantiateModelsToScene(e,t=!1,i){this._isValidHierarchy()||ss.Warn("SceneSerializer.InstantiateModelsToScene: The Asset Container hierarchy is not valid.");let r={},s={},n=new n$,a=[],o=[],l=Object.assign({doNotInstantiate:!0},i),h=(t,i)=>{if(r[t.uniqueId]=i.uniqueId,s[i.uniqueId]=i,e&&(i.name=e(t.name)),i instanceof nX&&i.morphTargetManager){let e=t.morphTargetManager;i.morphTargetManager=e.clone();for(let t=0;t{if(h(i,a),i.parent){let e=s[r[i.parent.uniqueId]];e?a.parent=e:a.parent=i.parent}if(a.position&&i.position&&a.position.copyFrom(i.position),a.rotationQuaternion&&i.rotationQuaternion&&a.rotationQuaternion.copyFrom(i.rotationQuaternion),a.rotation&&i.rotation&&a.rotation.copyFrom(i.rotation),a.scaling&&i.scaling&&a.scaling.copyFrom(i.scaling),a.material&&a.material){if(t){let t=i.material;if(-1===o.indexOf(t)){let i=t.clone(e?e(t.name):"Clone of "+t.name);if(o.push(t),r[t.uniqueId]=i.uniqueId,s[i.uniqueId]=i,"MultiMaterial"===t.getClassName()){for(let n of t.subMaterials)n&&(i=n.clone(e?e(n.name):"Clone of "+n.name),o.push(n),r[n.uniqueId]=i.uniqueId,s[i.uniqueId]=i);t.subMaterials=t.subMaterials.map(e=>e&&s[r[e.uniqueId]])}}"InstancedMesh"!==a.getClassName()&&(a.material=s[r[t.uniqueId]])}else"MultiMaterial"===a.material.getClassName()?-1===this.scene.multiMaterials.indexOf(a.material)&&this.scene.addMultiMaterial(a.material):-1===this.scene.materials.indexOf(a.material)&&this.scene.addMaterial(a.material)}null===a.parent&&n.rootNodes.push(a)};return d.forEach(e=>{if("InstancedMesh"===e.getClassName()){let t=e.sourceMesh,i=r[t.uniqueId],n=("number"==typeof i?s[i]:t).createInstance(e.name);p(e,n)}else{let t=!0;"TransformNode"===e.getClassName()||"Node"===e.getClassName()||e.skeleton||!e.getTotalVertices||0===e.getTotalVertices()?t=!1:l.doNotInstantiate&&(t="function"==typeof l.doNotInstantiate?!l.doNotInstantiate(e):!l.doNotInstantiate);let i=t?e.createInstance(`instance of ${e.name}`):e.clone(`Clone of ${e.name}`,null,!0);if(!i)throw Error(`Could not clone or instantiate node on Asset Container ${e.name}`);p(e,i)}}),this.skeletons.forEach(t=>{if(l.predicate&&!l.predicate(t))return;let i=t.clone(e?e(t.name):"Clone of "+t.name);for(let e of this.meshes)if(e.skeleton===t&&!e.isAnInstance){let t=s[r[e.uniqueId]];if(!t||t.isAnInstance||(t.skeleton=i,-1!==a.indexOf(i)))continue;for(let e of(a.push(i),i.bones))e._linkedTransformNode&&(e._linkedTransformNode=s[r[e._linkedTransformNode.uniqueId]])}n.skeletons.push(i)}),this.animationGroups.forEach(t=>{if(l.predicate&&!l.predicate(t))return;let i=t.clone(e?e(t.name):"Clone of "+t.name,e=>s[r[e.uniqueId]]||e);n.animationGroups.push(i)}),n}addAllToScene(){if(!this._wasAddedToScene){for(let e of(this._isValidHierarchy()||ss.Warn("SceneSerializer.addAllToScene: The Asset Container hierarchy is not valid."),this._wasAddedToScene=!0,this.addToScene(null),this.environmentTexture&&(this.scene.environmentTexture=this.environmentTexture),this.scene._serializableComponents))e.addFromContainer(this);this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null}}addToScene(e=null){let t=[];for(let i of(this.cameras.forEach(i=>{(!e||e(i))&&(this.scene.addCamera(i),t.push(i))}),this.lights.forEach(i=>{(!e||e(i))&&(this.scene.addLight(i),t.push(i))}),this.meshes.forEach(i=>{(!e||e(i))&&(this.scene.addMesh(i),t.push(i))}),this.skeletons.forEach(t=>{(!e||e(t))&&this.scene.addSkeleton(t)}),this.animations.forEach(t=>{(!e||e(t))&&this.scene.addAnimation(t)}),this.animationGroups.forEach(t=>{(!e||e(t))&&this.scene.addAnimationGroup(t)}),this.multiMaterials.forEach(t=>{(!e||e(t))&&this.scene.addMultiMaterial(t)}),this.materials.forEach(t=>{(!e||e(t))&&this.scene.addMaterial(t)}),this.morphTargetManagers.forEach(t=>{(!e||e(t))&&this.scene.addMorphTargetManager(t)}),this.geometries.forEach(t=>{(!e||e(t))&&this.scene.addGeometry(t)}),this.transformNodes.forEach(i=>{(!e||e(i))&&(this.scene.addTransformNode(i),t.push(i))}),this.actionManagers.forEach(t=>{(!e||e(t))&&this.scene.addActionManager(t)}),this.textures.forEach(t=>{(!e||e(t))&&this.scene.addTexture(t)}),this.reflectionProbes.forEach(t=>{(!e||e(t))&&this.scene.addReflectionProbe(t)}),t))i.parent&&-1===this.scene.getNodes().indexOf(i.parent)&&(i.setParent?i.setParent(null):i.parent=null)}removeAllFromScene(){for(let e of(this._isValidHierarchy()||ss.Warn("SceneSerializer.removeAllFromScene: The Asset Container hierarchy is not valid."),this._wasAddedToScene=!1,this.removeFromScene(null),this.environmentTexture===this.scene.environmentTexture&&(this.scene.environmentTexture=null),this.scene._serializableComponents))e.removeFromContainer(this)}removeFromScene(e=null){this.cameras.forEach(t=>{(!e||e(t))&&this.scene.removeCamera(t)}),this.lights.forEach(t=>{(!e||e(t))&&this.scene.removeLight(t)}),this.meshes.forEach(t=>{(!e||e(t))&&this.scene.removeMesh(t,!0)}),this.skeletons.forEach(t=>{(!e||e(t))&&this.scene.removeSkeleton(t)}),this.animations.forEach(t=>{(!e||e(t))&&this.scene.removeAnimation(t)}),this.animationGroups.forEach(t=>{(!e||e(t))&&this.scene.removeAnimationGroup(t)}),this.multiMaterials.forEach(t=>{(!e||e(t))&&this.scene.removeMultiMaterial(t)}),this.materials.forEach(t=>{(!e||e(t))&&this.scene.removeMaterial(t)}),this.morphTargetManagers.forEach(t=>{(!e||e(t))&&this.scene.removeMorphTargetManager(t)}),this.geometries.forEach(t=>{(!e||e(t))&&this.scene.removeGeometry(t)}),this.transformNodes.forEach(t=>{(!e||e(t))&&this.scene.removeTransformNode(t)}),this.actionManagers.forEach(t=>{(!e||e(t))&&this.scene.removeActionManager(t)}),this.textures.forEach(t=>{(!e||e(t))&&this.scene.removeTexture(t)}),this.reflectionProbes.forEach(t=>{(!e||e(t))&&this.scene.removeReflectionProbe(t)})}dispose(){for(let e of(this.cameras.slice(0).forEach(e=>{e.dispose()}),this.cameras.length=0,this.lights.slice(0).forEach(e=>{e.dispose()}),this.lights.length=0,this.meshes.slice(0).forEach(e=>{e.dispose()}),this.meshes.length=0,this.skeletons.slice(0).forEach(e=>{e.dispose()}),this.skeletons.length=0,this.animationGroups.slice(0).forEach(e=>{e.dispose()}),this.animationGroups.length=0,this.multiMaterials.slice(0).forEach(e=>{e.dispose()}),this.multiMaterials.length=0,this.materials.slice(0).forEach(e=>{e.dispose()}),this.materials.length=0,this.geometries.slice(0).forEach(e=>{e.dispose()}),this.geometries.length=0,this.transformNodes.slice(0).forEach(e=>{e.dispose()}),this.transformNodes.length=0,this.actionManagers.slice(0).forEach(e=>{e.dispose()}),this.actionManagers.length=0,this.textures.slice(0).forEach(e=>{e.dispose()}),this.textures.length=0,this.reflectionProbes.slice(0).forEach(e=>{e.dispose()}),this.reflectionProbes.length=0,this.morphTargetManagers.slice(0).forEach(e=>{e.dispose()}),this.morphTargetManagers.length=0,this.environmentTexture&&(this.environmentTexture.dispose(),this.environmentTexture=null),this.scene._serializableComponents))e.removeFromContainer(this,!0);this._onContextRestoredObserver&&(this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null)}_moveAssets(e,t,i){if(e&&t)for(let r of e){let e=!0;if(i){for(let t of i)if(r===t){e=!1;break}}e&&(t.push(r),r._parentContainer=this)}}moveAllFromScene(e){for(let t in this._wasAddedToScene=!1,void 0===e&&(e=new nK),this)Object.prototype.hasOwnProperty.call(this,t)&&(this[t]=this[t]||("_environmentTexture"===t?null:[]),this._moveAssets(this.scene[t],this[t],e[t]));this.environmentTexture=this.scene.environmentTexture,this.removeAllFromScene()}createRootMesh(){let e=new nX("assetContainerRootMesh",this.scene);return this.meshes.forEach(t=>{t.parent||e.addChild(t)}),this.meshes.unshift(e),e}mergeAnimationsTo(e=t2.LastCreatedScene,t,i=null){if(!e)return ig.Error("No scene available to merge animations to"),[];let r=i||(t=>{let i=null,r=t.animations.length?t.animations[0].targetProperty:"",s=t.name.split(".").join("").split("_primitive")[0];switch(r){case"position":case"rotationQuaternion":i=e.getTransformNodeByName(t.name)||e.getTransformNodeByName(s);break;case"influence":i=e.getMorphTargetByName(t.name)||e.getMorphTargetByName(s);break;default:i=e.getNodeByName(t.name)||e.getNodeByName(s)}return i});this.getNodes().forEach(e=>{let t=r(e);if(null!==t){for(let i of e.animations)for(let e of t.animations.filter(e=>e.targetProperty===i.targetProperty)){let i=t.animations.indexOf(e,0);i>-1&&t.animations.splice(i,1)}t.animations=t.animations.concat(e.animations)}});let s=[];return this.animationGroups.slice().forEach(e=>{s.push(e.clone(e.name,r)),e.animatables.forEach(e=>{e.stop()})}),t.forEach(t=>{let i=r(t.target);i&&(e.beginAnimation(i,t.fromFrame,t.toFrame,t.loopAnimation,t.speedRatio,t.onAnimationEnd?t.onAnimationEnd:void 0,void 0,!0,void 0,t.onAnimationLoop?t.onAnimationLoop:void 0),e.stopAnimation(t.target))}),s}populateRootNodes(){this.rootNodes.length=0,this.meshes.forEach(e=>{e.parent||-1!==this.rootNodes.indexOf(e)||this.rootNodes.push(e)}),this.transformNodes.forEach(e=>{e.parent||-1!==this.rootNodes.indexOf(e)||this.rootNodes.push(e)}),this.lights.forEach(e=>{e.parent||-1!==this.rootNodes.indexOf(e)||this.rootNodes.push(e)}),this.cameras.forEach(e=>{e.parent||-1!==this.rootNodes.indexOf(e)||this.rootNodes.push(e)})}addAllAssetsToContainer(e){if(!e)return;let t=[],i=new Set;for(t.push(e);t.length>0;){let e=t.pop();if(e instanceof nX?(e.geometry&&-1===this.geometries.indexOf(e.geometry)&&this.geometries.push(e.geometry),this.meshes.push(e)):e instanceof nA?this.transformNodes.push(e):e instanceof nj?this.lights.push(e):e instanceof ns&&this.cameras.push(e),e instanceof nM){if(e.material&&-1===this.materials.indexOf(e.material))for(let t of(this.materials.push(e.material),e.material.getActiveTextures()))-1===this.textures.indexOf(t)&&this.textures.push(t);e.skeleton&&-1===this.skeletons.indexOf(e.skeleton)&&this.skeletons.push(e.skeleton),e.morphTargetManager&&-1===this.morphTargetManagers.indexOf(e.morphTargetManager)&&this.morphTargetManagers.push(e.morphTargetManager)}for(let r of e.getChildren())i.has(r)||t.push(r);i.add(e)}this.populateRootNodes()}}nC.AudioEngineFactory=(e,t,i)=>new nQ(e,t,i);class nQ{get audioContext(){return this._audioContextInitialized||this._initializeAudioContext(),this._audioContext}constructor(e=null,t=null,i=null){this._audioContext=null,this._audioContextInitialized=!1,this._muteButton=null,this._audioDestination=null,this.canUseWebAudio=!1,this.WarnedWebAudioUnsupported=!1,this.isMP3supported=!1,this.isOGGsupported=!1,this.unlocked=!1,this.useCustomUnlockedButton=!1,this.onAudioUnlockedObservable=new tj,this.onAudioLockedObservable=new tj,this._tryToRun=!1,this._onResize=()=>{this._moveButtonToTopLeft()};return}lock(){this._triggerSuspendedState()}unlock(){var e,t;if((null===(e=this._audioContext)||void 0===e?void 0:e.state)==="running"){this._hideMuteButton();return}this._tryToRun?null===(t=this._audioContext)||void 0===t||t.suspend().then(()=>{this._tryToRun=!1,this._triggerRunningState()}):this._triggerRunningState()}_resumeAudioContext(){var e;return(null===(e=this._audioContext)||void 0===e?void 0:e.resume)?this._audioContext.resume():Promise.resolve()}_initializeAudioContext(){try{this.canUseWebAudio&&(this._audioContext||(this._audioContext=new AudioContext),this.masterGain=this._audioContext.createGain(),this.masterGain.gain.value=1,this._audioDestination||(this._audioDestination=this._audioContext.destination),this.masterGain.connect(this._audioDestination),this._audioContextInitialized=!0,"running"===this._audioContext.state&&this._triggerRunningState())}catch(e){this.canUseWebAudio=!1,ig.Error("Web Audio: "+e.message)}}_triggerRunningState(){this._tryToRun||(this._tryToRun=!0,this._resumeAudioContext().then(()=>{this._tryToRun=!1,this._muteButton&&this._hideMuteButton(),this.unlocked=!0,this.onAudioUnlockedObservable.notifyObservers(this)}).catch(()=>{this._tryToRun=!1,this.unlocked=!1}))}_triggerSuspendedState(){this.unlocked=!1,this.onAudioLockedObservable.notifyObservers(this),this._displayMuteButton()}_displayMuteButton(){if(this.useCustomUnlockedButton||this._muteButton)return;this._muteButton=document.createElement("BUTTON"),this._muteButton.className="babylonUnmuteIcon",this._muteButton.id="babylonUnmuteIconBtn",this._muteButton.title="Unmute";let e=window.SVGSVGElement?"data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2239%22%20height%3D%2232%22%20viewBox%3D%220%200%2039%2032%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22M9.625%2018.938l-0.031%200.016h-4.953q-0.016%200-0.031-0.016v-12.453q0-0.016%200.031-0.016h4.953q0.031%200%200.031%200.016v12.453zM12.125%207.688l8.719-8.703v27.453l-8.719-8.719-0.016-0.047v-9.938zM23.359%207.875l1.406-1.406%204.219%204.203%204.203-4.203%201.422%201.406-4.219%204.219%204.219%204.203-1.484%201.359-4.141-4.156-4.219%204.219-1.406-1.422%204.219-4.203z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E":"https://cdn.babylonjs.com/Assets/audio.png",t=document.createElement("style");t.appendChild(document.createTextNode(".babylonUnmuteIcon { position: absolute; left: 20px; top: 20px; height: 40px; width: 60px; background-color: rgba(51,51,51,0.7); background-image: url("+e+"); background-size: 80%; background-repeat:no-repeat; background-position: center; background-position-y: 4px; border: none; outline: none; transition: transform 0.125s ease-out; cursor: pointer; z-index: 9999; } .babylonUnmuteIcon:hover { transform: scale(1.05) } .babylonUnmuteIcon:active { background-color: rgba(51,51,51,1) }")),document.getElementsByTagName("head")[0].appendChild(t),document.body.appendChild(this._muteButton),this._moveButtonToTopLeft(),this._muteButton.addEventListener("touchend",()=>{this._triggerRunningState()},!0),this._muteButton.addEventListener("click",()=>{this.unlock()},!0),window.addEventListener("resize",this._onResize)}_moveButtonToTopLeft(){this._hostElement&&this._muteButton&&(this._muteButton.style.top=this._hostElement.offsetTop+20+"px",this._muteButton.style.left=this._hostElement.offsetLeft+20+"px")}_hideMuteButton(){this._muteButton&&(document.body.removeChild(this._muteButton),this._muteButton=null)}dispose(){this.canUseWebAudio&&this._audioContextInitialized&&(this._connectedAnalyser&&this._audioContext&&(this._connectedAnalyser.stopDebugCanvas(),this._connectedAnalyser.dispose(),this.masterGain.disconnect(),this.masterGain.connect(this._audioContext.destination),this._connectedAnalyser=null),this.masterGain.gain.value=1),this.WarnedWebAudioUnsupported=!1,this._hideMuteButton(),window.removeEventListener("resize",this._onResize),this.onAudioUnlockedObservable.clear(),this.onAudioLockedObservable.clear()}getGlobalVolume(){return this.canUseWebAudio&&this._audioContextInitialized?this.masterGain.gain.value:-1}setGlobalVolume(e){this.canUseWebAudio&&this._audioContextInitialized&&(this.masterGain.gain.value=e)}connectToAnalyser(e){this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas(),this.canUseWebAudio&&this._audioContextInitialized&&this._audioContext&&(this._connectedAnalyser=e,this.masterGain.disconnect(),this._connectedAnalyser.connectAudioNodes(this.masterGain,this._audioContext.destination))}}class nZ{get loop(){return this._loop}set loop(e){e!==this._loop&&(this._loop=e,this.updateOptions({loop:e}))}get currentTime(){var e;if(this._htmlAudioElement)return this._htmlAudioElement.currentTime;if((null===(e=nC.audioEngine)||void 0===e?void 0:e.audioContext)&&(this.isPlaying||this.isPaused)){let e=this.isPaused?0:nC.audioEngine.audioContext.currentTime-this._startTime;return this._currentTime+e}return 0}get spatialSound(){return this._spatialSound}set spatialSound(e){if(e==this._spatialSound)return;let t=this.isPlaying;this.pause(),e?(this._spatialSound=e,this._updateSpatialParameters()):this._disableSpatialSound(),t&&this.play()}constructor(e,t,i,r=null,s){var n,a,o,l,h;if(this.autoplay=!1,this._loop=!1,this.useCustomAttenuation=!1,this.isPlaying=!1,this.isPaused=!1,this.refDistance=1,this.rolloffFactor=1,this.maxDistance=100,this.distanceModel="linear",this.metadata=null,this.onEndedObservable=new tj,this._spatialSound=!1,this._panningModel="equalpower",this._playbackRate=1,this._streaming=!1,this._startTime=0,this._currentTime=0,this._position=t5.Zero(),this._localDirection=new t5(1,0,0),this._volume=1,this._isReadyToPlay=!1,this._isDirectional=!1,this._coneInnerAngle=360,this._coneOuterAngle=360,this._coneOuterGain=0,this._isOutputConnected=!1,this._urlType="Unknown",this.name=e,!(i=i||t2.LastCreatedScene))return;if(this._scene=i,nZ._SceneComponentInitialization(i),this._readyToPlayCallback=r,this._customAttenuationFunction=(e,t,i,r,s)=>t0&&(r=!0,this._soundLoaded(t));break;case"AudioBuffer":this._audioBufferLoaded(t);break;case"String":i.push(t);case"Array":0===i.length&&(i=t);for(let e=0;e{this._isReadyToPlay=!0,this.autoplay&&this.play(0,this._offset,this._length),this._readyToPlayCallback&&this._readyToPlayCallback()}),document.body.appendChild(this._htmlAudioElement),this._htmlAudioElement.load()):this._scene._loadFile(t,e=>{this._soundLoaded(e)},void 0,!0,!0,e=>{e&&ig.Error("XHR "+e.status+" error on: "+t+"."),ig.Error("Sound creation aborted."),this._scene.mainSoundTrack.removeSound(this)});break}}break;default:e=!1}e?!r&&(this._isReadyToPlay=!0,this._readyToPlayCallback&&setTimeout(()=>{this._readyToPlayCallback&&this._readyToPlayCallback()},1e3)):ig.Error("Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.")}catch(e){ig.Error("Unexpected error. Sound creation aborted."),this._scene.mainSoundTrack.removeSound(this)}}else this._scene.mainSoundTrack.addSound(this),nC.audioEngine&&!nC.audioEngine.WarnedWebAudioUnsupported&&(ig.Error("Web Audio is not supported by your browser."),nC.audioEngine.WarnedWebAudioUnsupported=!0),this._readyToPlayCallback&&setTimeout(()=>{this._readyToPlayCallback&&this._readyToPlayCallback()},1e3)}dispose(){var e;(null===(e=nC.audioEngine)||void 0===e?void 0:e.canUseWebAudio)&&(this.isPlaying&&this.stop(),this._isReadyToPlay=!1,-1===this.soundTrackId?this._scene.mainSoundTrack.removeSound(this):this._scene.soundTracks&&this._scene.soundTracks[this.soundTrackId].removeSound(this),this._soundGain&&(this._soundGain.disconnect(),this._soundGain=null),this._soundPanner&&(this._soundPanner.disconnect(),this._soundPanner=null),this._soundSource&&(this._soundSource.disconnect(),this._soundSource=null),this._audioBuffer=null,this._htmlAudioElement&&(this._htmlAudioElement.pause(),this._htmlAudioElement.src="",document.body.removeChild(this._htmlAudioElement)),this._streamingSource&&this._streamingSource.disconnect(),this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._connectedTransformNode=null),this._clearTimeoutsAndObservers())}isReady(){return this._isReadyToPlay}getClassName(){return"Sound"}_audioBufferLoaded(e){var t;(null===(t=nC.audioEngine)||void 0===t?void 0:t.audioContext)&&(this._audioBuffer=e,this._isReadyToPlay=!0,this.autoplay&&this.play(0,this._offset,this._length),this._readyToPlayCallback&&this._readyToPlayCallback())}_soundLoaded(e){var t;(null===(t=nC.audioEngine)||void 0===t?void 0:t.audioContext)&&nC.audioEngine.audioContext.decodeAudioData(e,e=>{this._audioBufferLoaded(e)},e=>{ig.Error("Error while decoding audio data for: "+this.name+" / Error: "+e)})}setAudioBuffer(e){var t;(null===(t=nC.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&(this._audioBuffer=e,this._isReadyToPlay=!0)}updateOptions(e){var t,i,r,s,n,a,o,l,h,u,c;e&&(this.loop=null!==(t=e.loop)&&void 0!==t?t:this.loop,this.maxDistance=null!==(i=e.maxDistance)&&void 0!==i?i:this.maxDistance,this.useCustomAttenuation=null!==(r=e.useCustomAttenuation)&&void 0!==r?r:this.useCustomAttenuation,this.rolloffFactor=null!==(s=e.rolloffFactor)&&void 0!==s?s:this.rolloffFactor,this.refDistance=null!==(n=e.refDistance)&&void 0!==n?n:this.refDistance,this.distanceModel=null!==(a=e.distanceModel)&&void 0!==a?a:this.distanceModel,this._playbackRate=null!==(o=e.playbackRate)&&void 0!==o?o:this._playbackRate,this._length=null!==(l=e.length)&&void 0!==l?l:void 0,this.spatialSound=null!==(h=e.spatialSound)&&void 0!==h?h:this._spatialSound,this._setOffset(null!==(u=e.offset)&&void 0!==u?u:void 0),this.setVolume(null!==(c=e.volume)&&void 0!==c?c:this._volume),this._updateSpatialParameters(),this.isPlaying&&(this._streaming&&this._htmlAudioElement?(this._htmlAudioElement.playbackRate=this._playbackRate,this._htmlAudioElement.loop!==this.loop&&(this._htmlAudioElement.loop=this.loop)):this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate,this._soundSource.loop!==this.loop&&(this._soundSource.loop=this.loop),void 0!==this._offset&&this._soundSource.loopStart!==this._offset&&(this._soundSource.loopStart=this._offset),void 0!==this._length&&this._length!==this._soundSource.loopEnd&&(this._soundSource.loopEnd=(0|this._offset)+this._length))))}_createSpatialParameters(){var e,t;(null===(e=nC.audioEngine)||void 0===e?void 0:e.canUseWebAudio)&&nC.audioEngine.audioContext&&(this._scene.headphone&&(this._panningModel="HRTF"),this._soundPanner=null!==(t=this._soundPanner)&&void 0!==t?t:nC.audioEngine.audioContext.createPanner(),this._soundPanner&&this._outputAudioNode&&(this._updateSpatialParameters(),this._soundPanner.connect(this._outputAudioNode),this._inputAudioNode=this._soundPanner))}_disableSpatialSound(){var e;this._spatialSound&&(this._inputAudioNode=this._soundGain,null===(e=this._soundPanner)||void 0===e||e.disconnect(),this._soundPanner=null,this._spatialSound=!1)}_updateSpatialParameters(){this._spatialSound&&(this._soundPanner?(this.useCustomAttenuation?(this._soundPanner.distanceModel="linear",this._soundPanner.maxDistance=Number.MAX_VALUE,this._soundPanner.refDistance=1,this._soundPanner.rolloffFactor=1):(this._soundPanner.distanceModel=this.distanceModel,this._soundPanner.maxDistance=this.maxDistance,this._soundPanner.refDistance=this.refDistance,this._soundPanner.rolloffFactor=this.rolloffFactor),this._soundPanner.panningModel=this._panningModel):this._createSpatialParameters())}switchPanningModelToHRTF(){this._panningModel="HRTF",this._switchPanningModel()}switchPanningModelToEqualPower(){this._panningModel="equalpower",this._switchPanningModel()}_switchPanningModel(){var e;(null===(e=nC.audioEngine)||void 0===e?void 0:e.canUseWebAudio)&&this._spatialSound&&this._soundPanner&&(this._soundPanner.panningModel=this._panningModel)}connectToSoundTrackAudioNode(e){var t;(null===(t=nC.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&this._outputAudioNode&&(this._isOutputConnected&&this._outputAudioNode.disconnect(),this._outputAudioNode.connect(e),this._isOutputConnected=!0)}setDirectionalCone(e,t,i){if(t{this._onended()},this._htmlAudioElement.playbackRate=this._playbackRate),this._streamingSource.disconnect(),this._inputAudioNode&&this._streamingSource.connect(this._inputAudioNode),this._htmlAudioElement){let e=()=>{var t,i;if(null===(t=nC.audioEngine)||void 0===t?void 0:t.unlocked){let t=this._htmlAudioElement.play();void 0!==t&&t.catch(()=>{var t,i;null===(t=nC.audioEngine)||void 0===t||t.lock(),(this.loop||this.autoplay)&&(this._audioUnlockedObserver=null===(i=nC.audioEngine)||void 0===i?void 0:i.onAudioUnlockedObservable.addOnce(()=>{e()}))})}else(this.loop||this.autoplay)&&(this._audioUnlockedObserver=null===(i=nC.audioEngine)||void 0===i?void 0:i.onAudioUnlockedObservable.addOnce(()=>{e()}))};e()}}else{let s=()=>{var s,n,a,o;if(null===(s=nC.audioEngine)||void 0===s?void 0:s.audioContext){if(i=i||this._length,void 0!==t&&this._setOffset(t),this._soundSource){let e=this._soundSource;e.onended=()=>{e.disconnect()}}if(this._soundSource=null===(n=nC.audioEngine)||void 0===n?void 0:n.audioContext.createBufferSource(),this._soundSource&&this._inputAudioNode){this._soundSource.buffer=this._audioBuffer,this._soundSource.connect(this._inputAudioNode),this._soundSource.loop=this.loop,void 0!==t&&(this._soundSource.loopStart=t),void 0!==i&&(this._soundSource.loopEnd=(0|t)+i),this._soundSource.playbackRate.value=this._playbackRate,this._soundSource.onended=()=>{this._onended()},r=e?(null===(a=nC.audioEngine)||void 0===a?void 0:a.audioContext.currentTime)+e:nC.audioEngine.audioContext.currentTime;let s=((this.isPaused?this.currentTime:0)+(null!==(o=this._offset)&&void 0!==o?o:0))%this._soundSource.buffer.duration;this._soundSource.start(r,s,this.loop?void 0:i)}}};(null===(a=nC.audioEngine)||void 0===a?void 0:a.audioContext.state)==="suspended"?this._tryToPlayTimeout=setTimeout(()=>{var e;(null===(e=nC.audioEngine)||void 0===e?void 0:e.audioContext.state)==="suspended"?(nC.audioEngine.lock(),(this.loop||this.autoplay)&&(this._audioUnlockedObserver=nC.audioEngine.onAudioUnlockedObservable.addOnce(()=>{s()}))):s()},500):s()}this._startTime=r,this.isPlaying=!0,this.isPaused=!1}catch(e){ig.Error("Error while trying to play audio: "+this.name+", "+e.message)}}_onended(){this.isPlaying=!1,this._startTime=0,this._currentTime=0,this.onended&&this.onended(),this.onEndedObservable.notifyObservers(this)}stop(e){var t;if(this.isPlaying){if(this._clearTimeoutsAndObservers(),this._streaming)this._htmlAudioElement?(this._htmlAudioElement.pause(),this._htmlAudioElement.currentTime>0&&(this._htmlAudioElement.currentTime=0)):this._streamingSource.disconnect(),this.isPlaying=!1;else if((null===(t=nC.audioEngine)||void 0===t?void 0:t.audioContext)&&this._soundSource){let t=e?nC.audioEngine.audioContext.currentTime+e:void 0;this._soundSource.onended=()=>{this.isPlaying=!1,this.isPaused=!1,this._startTime=0,this._currentTime=0,this._soundSource&&(this._soundSource.onended=()=>void 0),this._onended()},this._soundSource.stop(t)}else this.isPlaying=!1}else this.isPaused&&(this.isPaused=!1,this._startTime=0,this._currentTime=0)}pause(){var e;this.isPlaying&&(this._clearTimeoutsAndObservers(),this._streaming?(this._htmlAudioElement?this._htmlAudioElement.pause():this._streamingSource.disconnect(),this.isPlaying=!1,this.isPaused=!0):(null===(e=nC.audioEngine)||void 0===e?void 0:e.audioContext)&&this._soundSource&&(this._soundSource.onended=()=>void 0,this._soundSource.stop(),this.isPlaying=!1,this.isPaused=!0,this._currentTime+=nC.audioEngine.audioContext.currentTime-this._startTime))}setVolume(e,t){var i;(null===(i=nC.audioEngine)||void 0===i?void 0:i.canUseWebAudio)&&this._soundGain&&(t&&nC.audioEngine.audioContext?(this._soundGain.gain.cancelScheduledValues(nC.audioEngine.audioContext.currentTime),this._soundGain.gain.setValueAtTime(this._soundGain.gain.value,nC.audioEngine.audioContext.currentTime),this._soundGain.gain.linearRampToValueAtTime(e,nC.audioEngine.audioContext.currentTime+t)):this._soundGain.gain.value=e),this._volume=e}setPlaybackRate(e){this._playbackRate=e,this.isPlaying&&(this._streaming&&this._htmlAudioElement?this._htmlAudioElement.playbackRate=this._playbackRate:this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate))}getPlaybackRate(){return this._playbackRate}getVolume(){return this._volume}attachToMesh(e){this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null),this._connectedTransformNode=e,!this._spatialSound&&(this._spatialSound=!0,this._createSpatialParameters(),this.isPlaying&&this.loop&&(this.stop(),this.play(0,this._offset,this._length))),this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode),this._registerFunc=e=>this._onRegisterAfterWorldMatrixUpdate(e),this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc)}detachFromMesh(){this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null,this._connectedTransformNode=null)}_onRegisterAfterWorldMatrixUpdate(e){var t;if(e.getBoundingInfo){let t=e.getBoundingInfo();this.setPosition(t.boundingSphere.centerWorld)}else this.setPosition(e.absolutePosition);(null===(t=nC.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&this._isDirectional&&this.isPlaying&&this._updateDirection()}clone(){if(this._streaming)return null;{let e=()=>{this._isReadyToPlay?(i._audioBuffer=this.getAudioBuffer(),i._isReadyToPlay=!0,i.autoplay&&i.play(0,this._offset,this._length)):setTimeout(e,300)},t={autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this._spatialSound,maxDistance:this.maxDistance,useCustomAttenuation:this.useCustomAttenuation,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel},i=new nZ(this.name+"_cloned",new ArrayBuffer(0),this._scene,null,t);return this.useCustomAttenuation&&i.setAttenuationFunction(this._customAttenuationFunction),i.setPosition(this._position),i.setPlaybackRate(this._playbackRate),e(),i}}getAudioBuffer(){return this._audioBuffer}getSoundSource(){return this._soundSource}getSoundGain(){return this._soundGain}serialize(){let e={name:this.name,url:this._url,autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this._spatialSound,maxDistance:this.maxDistance,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel,playbackRate:this._playbackRate,panningModel:this._panningModel,soundTrackId:this.soundTrackId,metadata:this.metadata};return this._spatialSound&&(this._connectedTransformNode&&(e.connectedMeshId=this._connectedTransformNode.id),e.position=this._position.asArray(),e.refDistance=this.refDistance,e.distanceModel=this.distanceModel,e.isDirectional=this._isDirectional,e.localDirectionToMesh=this._localDirection.asArray(),e.coneInnerAngle=this._coneInnerAngle,e.coneOuterAngle=this._coneOuterAngle,e.coneOuterGain=this._coneOuterGain),e}static Parse(e,t,i,r){let s,n;let a=e.name;s=e.url?i+e.url:i+a;let o={autoplay:e.autoplay,loop:e.loop,volume:e.volume,spatialSound:e.spatialSound,maxDistance:e.maxDistance,rolloffFactor:e.rolloffFactor,refDistance:e.refDistance,distanceModel:e.distanceModel,playbackRate:e.playbackRate};if(r){let e=()=>{r._isReadyToPlay?(n._audioBuffer=r.getAudioBuffer(),n._isReadyToPlay=!0,n.autoplay&&n.play(0,n._offset,n._length)):setTimeout(e,300)};n=new nZ(a,new ArrayBuffer(0),t,null,o),e()}else n=new nZ(a,s,t,()=>{t.removePendingData(n)},o),t.addPendingData(n);if(e.position){let t=t5.FromArray(e.position);n.setPosition(t)}if(e.isDirectional&&(n.setDirectionalCone(e.coneInnerAngle||360,e.coneOuterAngle||360,e.coneOuterGain||0),e.localDirectionToMesh)){let t=t5.FromArray(e.localDirectionToMesh);n.setLocalDirectionToMesh(t)}if(e.connectedMeshId){let i=t.getMeshById(e.connectedMeshId);i&&n.attachToMesh(i)}return e.metadata&&(n.metadata=e.metadata),n}_setOffset(e){this._offset!==e&&(this.isPaused&&(this.stop(),this.isPaused=!1),this._offset=e)}_clearTimeoutsAndObservers(){var e;this._tryToPlayTimeout&&(clearTimeout(this._tryToPlayTimeout),this._tryToPlayTimeout=null),this._audioUnlockedObserver&&(null===(e=nC.audioEngine)||void 0===e||e.onAudioUnlockedObservable.remove(this._audioUnlockedObserver),this._audioUnlockedObserver=null)}}nZ._SceneComponentInitialization=e=>{throw iL("AudioSceneComponent")};class nJ{constructor(e,t={}){if(this.id=-1,this._isInitialized=!1,!(e=e||t2.LastCreatedScene))return;this._scene=e,this.soundCollection=[],this._options=t,!this._options.mainTrack&&this._scene.soundTracks&&(this._scene.soundTracks.push(this),this.id=this._scene.soundTracks.length-1)}_initializeSoundTrackAudioGraph(){var e;(null===(e=nC.audioEngine)||void 0===e?void 0:e.canUseWebAudio)&&nC.audioEngine.audioContext&&(this._outputAudioNode=nC.audioEngine.audioContext.createGain(),this._outputAudioNode.connect(nC.audioEngine.masterGain),this._options&&this._options.volume&&(this._outputAudioNode.gain.value=this._options.volume),this._isInitialized=!0)}dispose(){if(nC.audioEngine&&nC.audioEngine.canUseWebAudio){for(this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas();this.soundCollection.length;)this.soundCollection[0].dispose();this._outputAudioNode&&this._outputAudioNode.disconnect(),this._outputAudioNode=null}}addSound(e){var t;this._isInitialized||this._initializeSoundTrackAudioGraph(),(null===(t=nC.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&this._outputAudioNode&&e.connectToSoundTrackAudioNode(this._outputAudioNode),void 0!==e.soundTrackId&&(-1===e.soundTrackId?this._scene.mainSoundTrack.removeSound(e):this._scene.soundTracks&&this._scene.soundTracks[e.soundTrackId].removeSound(e)),this.soundCollection.push(e),e.soundTrackId=this.id}removeSound(e){let t=this.soundCollection.indexOf(e);-1!==t&&this.soundCollection.splice(t,1)}setVolume(e){var t;(null===(t=nC.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&this._outputAudioNode&&(this._outputAudioNode.gain.value=e)}switchPanningModelToHRTF(){var e;if(null===(e=nC.audioEngine)||void 0===e?void 0:e.canUseWebAudio)for(let e=0;e{var s;let n;let a=[];if(i.sounds=i.sounds||[],void 0!==e.sounds&&null!==e.sounds)for(let o=0,l=e.sounds.length;o{e.play(),e.autoplay=!0,this.scene.mainSoundTrack.addSound(e)})}removeFromContainer(e,t=!1){e.sounds&&e.sounds.forEach(e=>{e.stop(),e.autoplay=!1,this.scene.mainSoundTrack.removeSound(e),t&&e.dispose()})}dispose(){let e=this.scene;if(e._mainSoundTrack&&e.mainSoundTrack.dispose(),e.soundTracks)for(let t=0;t0&&(r=t.activeCameras[0]),this.audioListenerPositionProvider){let e=this.audioListenerPositionProvider();i.audioContext.listener.setPosition(e.x||0,e.y||0,e.z||0)}else r?this._cachedCameraPosition.equals(r.globalPosition)||(this._cachedCameraPosition.copyFrom(r.globalPosition),i.audioContext.listener.setPosition(r.globalPosition.x,r.globalPosition.y,r.globalPosition.z)):i.audioContext.listener.setPosition(0,0,0);if(this.audioListenerRotationProvider){let e=this.audioListenerRotationProvider();i.audioContext.listener.setOrientation(e.x||0,e.y||0,e.z||0,0,1,0)}else r?(r.rigCameras&&r.rigCameras.length>0&&(r=r.rigCameras[0]),r.getViewMatrix().invertToRef(this._invertMatrixTemp),t5.TransformNormalToRef(n0._CameraDirection,this._invertMatrixTemp,this._cameraDirectionTemp),this._cameraDirectionTemp.normalize(),isNaN(this._cameraDirectionTemp.x)||isNaN(this._cameraDirectionTemp.y)||isNaN(this._cameraDirectionTemp.z)||this._cachedCameraDirection.equals(this._cameraDirectionTemp)||(this._cachedCameraDirection.copyFrom(this._cameraDirectionTemp),i.audioContext.listener.setOrientation(this._cameraDirectionTemp.x,this._cameraDirectionTemp.y,this._cameraDirectionTemp.z,0,1,0))):i.audioContext.listener.setOrientation(0,0,0,0,1,0);for(e=0;e{let t=e._getComponent(sb.NAME_AUDIO);t||(t=new n0(e),e._addComponent(t))};class n1{constructor(e){if(this._texture=null,this._isEnabled=!0,this.isEnabled=!0,this.time=0,!(e=e||t2.LastCreatedScene))return;this._scene=e,this.animationParameters=new t6(0,0,0,30)}_markSubMeshesAsAttributesDirty(){for(let e of this._scene.meshes)e.bakedVertexAnimationManager===this&&e._markSubMeshesAsAttributesDirty()}bind(e,t=!1){if(!this._texture||!this._isEnabled)return;let i=this._texture.getSize();e.setFloat2("bakedVertexAnimationTextureSizeInverted",1/i.width,1/i.height),e.setFloat("bakedVertexAnimationTime",this.time),t||e.setVector4("bakedVertexAnimationSettings",this.animationParameters),e.setTexture("bakedVertexAnimationTexture",this._texture)}clone(){let e=new n1(this._scene);return this.copyTo(e),e}setAnimationParameters(e,t,i=0,r=30){this.animationParameters=new t6(e,t,i,r)}dispose(e){var t;e&&(null===(t=this._texture)||void 0===t||t.dispose())}getClassName(){return"BakedVertexAnimationManager"}copyTo(e){i$.Clone(()=>e,this)}serialize(){return i$.Serialize(this)}parse(e,t,i){i$.Parse(()=>this,e,t,i)}}iZ([iH(),iz("_markSubMeshesAsAttributesDirty")],n1.prototype,"texture",void 0),iZ([iW(),iz("_markSubMeshesAsAttributesDirty")],n1.prototype,"isEnabled",void 0),iZ([iW()],n1.prototype,"animationParameters",void 0),iZ([iW()],n1.prototype,"time",void 0);class n2{get wrapU(){return this._wrapU}set wrapU(e){this._wrapU=e}get wrapV(){return this._wrapV}set wrapV(e){this._wrapV=e}get coordinatesMode(){return 0}get isCube(){return!!this._texture&&this._texture.isCube}set isCube(e){this._texture&&(this._texture.isCube=e)}get is3D(){return!!this._texture&&this._texture.is3D}set is3D(e){this._texture&&(this._texture.is3D=e)}get is2DArray(){return!!this._texture&&this._texture.is2DArray}set is2DArray(e){this._texture&&(this._texture.is2DArray=e)}getClassName(){return"ThinTexture"}static _IsRenderTargetWrapper(e){return(null==e?void 0:e._shareDepth)!==void 0}constructor(e){this._wrapU=1,this._wrapV=1,this.wrapR=1,this.anisotropicFilteringLevel=4,this.delayLoadState=0,this._texture=null,this._engine=null,this._cachedSize=i1.Zero(),this._cachedBaseSize=i1.Zero(),this._initialSamplingMode=2,this._texture=n2._IsRenderTargetWrapper(e)?e.texture:e,this._texture&&(this._engine=this._texture.getEngine())}isReady(){return 4===this.delayLoadState?(this.delayLoad(),!1):!!this._texture&&this._texture.isReady}delayLoad(){}getInternalTexture(){return this._texture}getSize(){if(this._texture){if(this._texture.width)return this._cachedSize.width=this._texture.width,this._cachedSize.height=this._texture.height,this._cachedSize;this._texture._size&&(this._cachedSize.width=this._texture._size,this._cachedSize.height=this._texture._size)}return this._cachedSize}getBaseSize(){return this.isReady()&&this._texture?this._texture._size?(this._cachedBaseSize.width=this._texture._size,this._cachedBaseSize.height=this._texture._size):(this._cachedBaseSize.width=this._texture.baseWidth,this._cachedBaseSize.height=this._texture.baseHeight):(this._cachedBaseSize.width=0,this._cachedBaseSize.height=0),this._cachedBaseSize}get samplingMode(){return this._texture?this._texture.samplingMode:this._initialSamplingMode}updateSamplingMode(e){this._texture&&this._engine&&this._engine.updateTextureSamplingMode(e,this._texture)}releaseInternalTexture(){this._texture&&(this._texture.dispose(),this._texture=null)}dispose(){this._texture&&(this.releaseInternalTexture(),this._engine=null)}}class n3 extends n2{set hasAlpha(e){this._hasAlpha!==e&&(this._hasAlpha=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get hasAlpha(){return this._hasAlpha}set getAlphaFromRGB(e){this._getAlphaFromRGB!==e&&(this._getAlphaFromRGB=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get getAlphaFromRGB(){return this._getAlphaFromRGB}set coordinatesIndex(e){this._coordinatesIndex!==e&&(this._coordinatesIndex=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get coordinatesIndex(){return this._coordinatesIndex}set coordinatesMode(e){this._coordinatesMode!==e&&(this._coordinatesMode=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get coordinatesMode(){return this._coordinatesMode}get wrapU(){return this._wrapU}set wrapU(e){this._wrapU=e}get wrapV(){return this._wrapV}set wrapV(e){this._wrapV=e}get isCube(){return this._texture?this._texture.isCube:this._isCube}set isCube(e){this._texture?this._texture.isCube=e:this._isCube=e}get is3D(){return!!this._texture&&this._texture.is3D}set is3D(e){this._texture&&(this._texture.is3D=e)}get is2DArray(){return!!this._texture&&this._texture.is2DArray}set is2DArray(e){this._texture&&(this._texture.is2DArray=e)}get gammaSpace(){return this._texture?(null===this._texture._gammaSpace&&(this._texture._gammaSpace=this._gammaSpace),this._texture._gammaSpace&&!this._texture._useSRGBBuffer):this._gammaSpace}set gammaSpace(e){var t;if(this._texture){if(this._texture._gammaSpace===e)return;this._texture._gammaSpace=e}else{if(this._gammaSpace===e)return;this._gammaSpace=e}null===(t=this.getScene())||void 0===t||t.markAllMaterialsAsDirty(1,e=>e.hasTexture(this))}get isRGBD(){return null!=this._texture&&this._texture._isRGBD}set isRGBD(e){var t;e!==this.isRGBD&&(this._texture&&(this._texture._isRGBD=e),null===(t=this.getScene())||void 0===t||t.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get noMipmap(){return!1}get lodGenerationOffset(){return this._texture?this._texture._lodGenerationOffset:0}set lodGenerationOffset(e){this._texture&&(this._texture._lodGenerationOffset=e)}get lodGenerationScale(){return this._texture?this._texture._lodGenerationScale:0}set lodGenerationScale(e){this._texture&&(this._texture._lodGenerationScale=e)}get linearSpecularLOD(){return!!this._texture&&this._texture._linearSpecularLOD}set linearSpecularLOD(e){this._texture&&(this._texture._linearSpecularLOD=e)}get irradianceTexture(){return this._texture?this._texture._irradianceTexture:null}set irradianceTexture(e){this._texture&&(this._texture._irradianceTexture=e)}get uid(){return this._uid||(this._uid=sr()),this._uid}toString(){return this.name}getClassName(){return"BaseTexture"}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}get isBlocking(){return!0}get loadingError(){return this._loadingError}get errorObject(){return this._errorObject}constructor(e,t=null){super(null),this.metadata=null,this.reservedDataStore=null,this._hasAlpha=!1,this._getAlphaFromRGB=!1,this.level=1,this._coordinatesIndex=0,this.optimizeUVAllocation=!0,this._coordinatesMode=0,this.wrapR=1,this.anisotropicFilteringLevel=n3.DEFAULT_ANISOTROPIC_FILTERING_LEVEL,this._isCube=!1,this._gammaSpace=!0,this.invertZ=!1,this.lodLevelInAlpha=!1,this.isRenderTarget=!1,this._prefiltered=!1,this._forceSerialize=!1,this.animations=[],this.onDisposeObservable=new tj,this._onDisposeObserver=null,this._scene=null,this._uid=null,this._parentContainer=null,this._loadingError=!1,e?n3._IsScene(e)?this._scene=e:this._engine=e:this._scene=t2.LastCreatedScene,this._scene&&(this.uniqueId=this._scene.getUniqueId(),this._scene.addTexture(this),this._engine=this._scene.getEngine()),this._texture=t,this._uid=null}getScene(){return this._scene}_getEngine(){return this._engine}checkTransformsAreIdentical(e){return null!==e}getTextureMatrix(){return t7.IdentityReadOnly}getReflectionTextureMatrix(){return t7.IdentityReadOnly}getRefractionTextureMatrix(){return this.getReflectionTextureMatrix()}isReadyOrNotBlocking(){return!this.isBlocking||this.isReady()||this.loadingError}scale(e){}get canRescale(){return!1}_getFromCache(e,t,i,r,s,n){let a=this._getEngine();if(!a)return null;let o=a._getUseSRGBBuffer(!!s,t),l=a.getLoadedTexturesCache();for(let a=0;a=0&&this._scene.textures.splice(e,1),this._scene.onTextureRemovedObservable.notifyObservers(this),this._scene=null,this._parentContainer){let e=this._parentContainer.textures.indexOf(this);e>-1&&this._parentContainer.textures.splice(e,1),this._parentContainer=null}}this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.metadata=null,super.dispose()}serialize(e=!1){if(!this.name&&!e)return null;let t=i$.Serialize(this);return i$.AppendSerializedAnimations(this,t),t}static WhenAllReady(e,t){let i=e.length;if(0===i){t();return}for(let r=0;r{0==--i&&t()}):0==--i&&t()}}}static _IsScene(e){return"Scene"===e.getClassName()}}function n4(e,t,i=!1){let r=t.width,s=t.height;if(e instanceof Float32Array){let t=e.byteLength/e.BYTES_PER_ELEMENT,i=new Uint8Array(t);for(;--t>=0;){let r=e[t];r<0?r=0:r>1&&(r=1),i[t]=255*r}e=i}let n=document.createElement("canvas");n.width=r,n.height=s;let a=n.getContext("2d");if(!a)return null;let o=a.createImageData(r,s);if(o.data.set(e),a.putImageData(o,0,0),i){let e=document.createElement("canvas");e.width=r,e.height=s;let t=e.getContext("2d");return t?(t.translate(0,s),t.scale(1,-1),t.drawImage(n,0,0),e.toDataURL("image/png")):null}return n.toDataURL("image/png")}async function n5(e,t=0,i=0){let r=e.getInternalTexture();if(!r)return null;let s=await e.readPixels(t,i);return s?n4(s,e.getSize(),r.invertY):null}n3.DEFAULT_ANISOTROPIC_FILTERING_LEVEL=4,iZ([iW()],n3.prototype,"uniqueId",void 0),iZ([iW()],n3.prototype,"name",void 0),iZ([iW()],n3.prototype,"metadata",void 0),iZ([iW("hasAlpha")],n3.prototype,"_hasAlpha",void 0),iZ([iW("getAlphaFromRGB")],n3.prototype,"_getAlphaFromRGB",void 0),iZ([iW()],n3.prototype,"level",void 0),iZ([iW("coordinatesIndex")],n3.prototype,"_coordinatesIndex",void 0),iZ([iW()],n3.prototype,"optimizeUVAllocation",void 0),iZ([iW("coordinatesMode")],n3.prototype,"_coordinatesMode",void 0),iZ([iW()],n3.prototype,"wrapU",null),iZ([iW()],n3.prototype,"wrapV",null),iZ([iW()],n3.prototype,"wrapR",void 0),iZ([iW()],n3.prototype,"anisotropicFilteringLevel",void 0),iZ([iW()],n3.prototype,"isCube",null),iZ([iW()],n3.prototype,"is3D",null),iZ([iW()],n3.prototype,"is2DArray",null),iZ([iW()],n3.prototype,"gammaSpace",null),iZ([iW()],n3.prototype,"invertZ",void 0),iZ([iW()],n3.prototype,"lodLevelInAlpha",void 0),iZ([iW()],n3.prototype,"lodGenerationOffset",null),iZ([iW()],n3.prototype,"lodGenerationScale",null),iZ([iW()],n3.prototype,"linearSpecularLOD",null),iZ([iH()],n3.prototype,"irradianceTexture",null),iZ([iW()],n3.prototype,"isRenderTarget",void 0);class n6 extends n3{static _CreateVideoTexture(e,t,i,r=!1,s=!1,n=n6.TRILINEAR_SAMPLINGMODE,a={},o,l=5){throw iL("VideoTexture")}get noMipmap(){return this._noMipmap}get mimeType(){return this._mimeType}set isBlocking(e){this._isBlocking=e}get isBlocking(){return this._isBlocking}get invertY(){return this._invertY}constructor(e,t,i,r,s=n6.TRILINEAR_SAMPLINGMODE,n=null,a=null,o=null,l=!1,h,u,c,d,p){var _,f,m,g,v,x,T,b,E,S;let C;super(t),this.url=null,this.uOffset=0,this.vOffset=0,this.uScale=1,this.vScale=1,this.uAng=0,this.vAng=0,this.wAng=0,this.uRotationCenter=.5,this.vRotationCenter=.5,this.wRotationCenter=.5,this.homogeneousRotationInUVTransform=!1,this.inspectableCustomProperties=null,this._noMipmap=!1,this._invertY=!1,this._rowGenerationMatrix=null,this._cachedTextureMatrix=null,this._projectionModeMatrix=null,this._t0=null,this._t1=null,this._t2=null,this._cachedUOffset=-1,this._cachedVOffset=-1,this._cachedUScale=0,this._cachedVScale=0,this._cachedUAng=-1,this._cachedVAng=-1,this._cachedWAng=-1,this._cachedReflectionProjectionMatrixId=-1,this._cachedURotationCenter=-1,this._cachedVRotationCenter=-1,this._cachedWRotationCenter=-1,this._cachedHomogeneousRotationInUVTransform=!1,this._cachedReflectionTextureMatrix=null,this._cachedReflectionUOffset=-1,this._cachedReflectionVOffset=-1,this._cachedReflectionUScale=0,this._cachedReflectionVScale=0,this._cachedReflectionCoordinatesMode=-1,this._buffer=null,this._deleteBuffer=!1,this._format=null,this._delayedOnLoad=null,this._delayedOnError=null,this.onLoadObservable=new tj,this._isBlocking=!0,this.name=e||"",this.url=e;let y=!1,A=null,R=!0;"object"==typeof i&&null!==i?(C=null!==(_=i.noMipmap)&&void 0!==_&&_,r=null!==(f=i.invertY)&&void 0!==f?f:!nx.UseOpenGLOrientationForUV,s=null!==(m=i.samplingMode)&&void 0!==m?m:n6.TRILINEAR_SAMPLINGMODE,n=null!==(g=i.onLoad)&&void 0!==g?g:null,a=null!==(v=i.onError)&&void 0!==v?v:null,o=null!==(x=i.buffer)&&void 0!==x?x:null,l=null!==(T=i.deleteBuffer)&&void 0!==T&&T,h=i.format,u=i.mimeType,c=i.loaderOptions,d=i.creationFlags,y=null!==(b=i.useSRGBBuffer)&&void 0!==b&&b,A=null!==(E=i.internalTexture)&&void 0!==E?E:null,R=null!==(S=i.gammaSpace)&&void 0!==S?S:R):C=!!i,this._gammaSpace=R,this._noMipmap=C,this._invertY=void 0===r?!nx.UseOpenGLOrientationForUV:r,this._initialSamplingMode=s,this._buffer=o,this._deleteBuffer=l,this._mimeType=u,this._loaderOptions=c,this._creationFlags=d,this._useSRGBBuffer=y,this._forcedExtension=p,h&&(this._format=h);let I=this.getScene(),P=this._getEngine();if(!P)return;P.onBeforeTextureInitObservable.notifyObservers(this);let M=()=>{this._texture&&(this._texture._invertVScale&&(this.vScale*=-1,this.vOffset+=1),null!==this._texture._cachedWrapU&&(this.wrapU=this._texture._cachedWrapU,this._texture._cachedWrapU=null),null!==this._texture._cachedWrapV&&(this.wrapV=this._texture._cachedWrapV,this._texture._cachedWrapV=null),null!==this._texture._cachedWrapR&&(this.wrapR=this._texture._cachedWrapR,this._texture._cachedWrapR=null)),this.onLoadObservable.hasObservers()&&this.onLoadObservable.notifyObservers(this),n&&n(),!this.isBlocking&&I&&I.resetCachedMaterial()},D=(e,t)=>{this._loadingError=!0,this._errorObject={message:e,exception:t},a&&a(e,t),n6.OnTextureLoadErrorObservable.notifyObservers(this)};if(!this.url&&!A){this._delayedOnLoad=M,this._delayedOnError=D;return}if(this._texture=null!=A?A:this._getFromCache(this.url,C,s,this._invertY,y,this.isCube),this._texture){if(this._texture.isReady)rq.SetImmediate(()=>M());else{let e=this._texture.onLoadedObservable.add(M);this._texture.onErrorObservable.add(t=>{var i;D(t.message,t.exception),null===(i=this._texture)||void 0===i||i.onLoadedObservable.remove(e)})}}else if(I&&I.useDelayedTextureLoading)this.delayLoadState=4,this._delayedOnLoad=M,this._delayedOnError=D;else{try{this._texture=P.createTexture(this.url,C,this._invertY,I,s,M,D,this._buffer,void 0,this._format,this._forcedExtension,u,c,d,y)}catch(e){throw D("error loading",e),e}l&&(this._buffer=null)}}updateURL(e,t=null,i,r){this.url&&(this.releaseInternalTexture(),this.getScene().markAllMaterialsAsDirty(1,e=>e.hasTexture(this))),(!this.name||this.name.startsWith("data:"))&&(this.name=e),this.url=e,this._buffer=t,this._forcedExtension=r,this.delayLoadState=4,i&&(this._delayedOnLoad=i),this.delayLoad()}delayLoad(){if(4!==this.delayLoadState)return;let e=this.getScene();e&&(this.delayLoadState=1,this._texture=this._getFromCache(this.url,this._noMipmap,this.samplingMode,this._invertY,this._useSRGBBuffer,this.isCube),this._texture?this._delayedOnLoad&&(this._texture.isReady?rq.SetImmediate(this._delayedOnLoad):this._texture.onLoadedObservable.add(this._delayedOnLoad)):(this._texture=e.getEngine().createTexture(this.url,this._noMipmap,this._invertY,e,this.samplingMode,this._delayedOnLoad,this._delayedOnError,this._buffer,null,this._format,this._forcedExtension,this._mimeType,this._loaderOptions,this._creationFlags,this._useSRGBBuffer),this._deleteBuffer&&(this._buffer=null)),this._delayedOnLoad=null,this._delayedOnError=null)}_prepareRowForTextureGeneration(e,t,i,r){e*=this._cachedUScale,t*=this._cachedVScale,e-=this.uRotationCenter*this._cachedUScale,t-=this.vRotationCenter*this._cachedVScale,i-=this.wRotationCenter,t5.TransformCoordinatesFromFloatsToRef(e,t,i,this._rowGenerationMatrix,r),r.x+=this.uRotationCenter*this._cachedUScale+this._cachedUOffset,r.y+=this.vRotationCenter*this._cachedVScale+this._cachedVOffset,r.z+=this.wRotationCenter}checkTransformsAreIdentical(e){return null!==e&&this.uOffset===e.uOffset&&this.vOffset===e.vOffset&&this.uScale===e.uScale&&this.vScale===e.vScale&&this.uAng===e.uAng&&this.vAng===e.vAng&&this.wAng===e.wAng}getTextureMatrix(e=1){if(this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale*e===this._cachedUScale&&this.vScale===this._cachedVScale&&this.uAng===this._cachedUAng&&this.vAng===this._cachedVAng&&this.wAng===this._cachedWAng&&this.uRotationCenter===this._cachedURotationCenter&&this.vRotationCenter===this._cachedVRotationCenter&&this.wRotationCenter===this._cachedWRotationCenter&&this.homogeneousRotationInUVTransform===this._cachedHomogeneousRotationInUVTransform)return this._cachedTextureMatrix;this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale*e,this._cachedVScale=this.vScale,this._cachedUAng=this.uAng,this._cachedVAng=this.vAng,this._cachedWAng=this.wAng,this._cachedURotationCenter=this.uRotationCenter,this._cachedVRotationCenter=this.vRotationCenter,this._cachedWRotationCenter=this.wRotationCenter,this._cachedHomogeneousRotationInUVTransform=this.homogeneousRotationInUVTransform,this._cachedTextureMatrix&&this._rowGenerationMatrix||(this._cachedTextureMatrix=t7.Zero(),this._rowGenerationMatrix=new t7,this._t0=t5.Zero(),this._t1=t5.Zero(),this._t2=t5.Zero()),t7.RotationYawPitchRollToRef(this.vAng,this.uAng,this.wAng,this._rowGenerationMatrix),this.homogeneousRotationInUVTransform?(t7.TranslationToRef(-this._cachedURotationCenter,-this._cachedVRotationCenter,-this._cachedWRotationCenter,ie.Matrix[0]),t7.TranslationToRef(this._cachedURotationCenter,this._cachedVRotationCenter,this._cachedWRotationCenter,ie.Matrix[1]),t7.ScalingToRef(this._cachedUScale,this._cachedVScale,0,ie.Matrix[2]),t7.TranslationToRef(this._cachedUOffset,this._cachedVOffset,0,ie.Matrix[3]),ie.Matrix[0].multiplyToRef(this._rowGenerationMatrix,this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(ie.Matrix[1],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(ie.Matrix[2],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(ie.Matrix[3],this._cachedTextureMatrix),this._cachedTextureMatrix.setRowFromFloats(2,this._cachedTextureMatrix.m[12],this._cachedTextureMatrix.m[13],this._cachedTextureMatrix.m[14],1)):(this._prepareRowForTextureGeneration(0,0,0,this._t0),this._prepareRowForTextureGeneration(1,0,0,this._t1),this._prepareRowForTextureGeneration(0,1,0,this._t2),this._t1.subtractInPlace(this._t0),this._t2.subtractInPlace(this._t0),t7.FromValuesToRef(this._t1.x,this._t1.y,this._t1.z,0,this._t2.x,this._t2.y,this._t2.z,0,this._t0.x,this._t0.y,this._t0.z,0,0,0,0,1,this._cachedTextureMatrix));let t=this.getScene();return t&&this.optimizeUVAllocation&&t.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)),this._cachedTextureMatrix}getReflectionTextureMatrix(){let e=this.getScene();if(!e||this.uOffset===this._cachedReflectionUOffset&&this.vOffset===this._cachedReflectionVOffset&&this.uScale===this._cachedReflectionUScale&&this.vScale===this._cachedReflectionVScale&&this.coordinatesMode===this._cachedReflectionCoordinatesMode&&(this.coordinatesMode!==n6.PROJECTION_MODE||this._cachedReflectionProjectionMatrixId===e.getProjectionMatrix().updateFlag))return this._cachedReflectionTextureMatrix;this._cachedReflectionTextureMatrix||(this._cachedReflectionTextureMatrix=t7.Zero()),this._projectionModeMatrix||(this._projectionModeMatrix=t7.Zero());let t=this._cachedReflectionCoordinatesMode!==this.coordinatesMode;switch(this._cachedReflectionUOffset=this.uOffset,this._cachedReflectionVOffset=this.vOffset,this._cachedReflectionUScale=this.uScale,this._cachedReflectionVScale=this.vScale,this._cachedReflectionCoordinatesMode=this.coordinatesMode,this.coordinatesMode){case n6.PLANAR_MODE:t7.IdentityToRef(this._cachedReflectionTextureMatrix),this._cachedReflectionTextureMatrix[0]=this.uScale,this._cachedReflectionTextureMatrix[5]=this.vScale,this._cachedReflectionTextureMatrix[12]=this.uOffset,this._cachedReflectionTextureMatrix[13]=this.vOffset;break;case n6.PROJECTION_MODE:{t7.FromValuesToRef(.5,0,0,0,0,-.5,0,0,0,0,0,0,.5,.5,1,1,this._projectionModeMatrix);let t=e.getProjectionMatrix();this._cachedReflectionProjectionMatrixId=t.updateFlag,t.multiplyToRef(this._projectionModeMatrix,this._cachedReflectionTextureMatrix);break}default:t7.IdentityToRef(this._cachedReflectionTextureMatrix)}return t&&e.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)),this._cachedReflectionTextureMatrix}clone(){let e={noMipmap:this._noMipmap,invertY:this._invertY,samplingMode:this.samplingMode,onLoad:void 0,onError:void 0,buffer:this._texture?this._texture._buffer:void 0,deleteBuffer:this._deleteBuffer,format:this.textureFormat,mimeType:this.mimeType,loaderOptions:this._loaderOptions,creationFlags:this._creationFlags,useSRGBBuffer:this._useSRGBBuffer};return i$.Clone(()=>new n6(this._texture?this._texture.url:null,this.getScene(),e),this)}serialize(){var e,t;let i=this.name;!n6.SerializeBuffers&&this.name.startsWith("data:")&&(this.name=""),this.name.startsWith("data:")&&this.url===this.name&&(this.url="");let r=super.serialize(n6._SerializeInternalTextureUniqueId);return r?((n6.SerializeBuffers||n6.ForceSerializeBuffers)&&("string"==typeof this._buffer&&"data:"===this._buffer.substr(0,5)?(r.base64String=this._buffer,r.name=r.name.replace("data:","")):this.url&&this.url.startsWith("data:")&&this._buffer instanceof Uint8Array?r.base64String="data:image/png;base64,"+rd(this._buffer):(n6.ForceSerializeBuffers||this.url&&this.url.startsWith("blob:")||this._forceSerialize)&&(r.base64String=!this._engine||this._engine._features.supportSyncTextureRead?function(e,t=0,i=0){let r=e.getInternalTexture();if(!r)return null;let s=e._readPixelsSync(t,i);return s?n4(s,e.getSize(),r.invertY):null}(this):n5(this))),r.invertY=this._invertY,r.samplingMode=this.samplingMode,r._creationFlags=this._creationFlags,r._useSRGBBuffer=this._useSRGBBuffer,n6._SerializeInternalTextureUniqueId&&(r.internalTextureUniqueId=null!==(t=null===(e=this._texture)||void 0===e?void 0:e.uniqueId)&&void 0!==t?t:void 0),r.noMipmap=this._noMipmap,this.name=i,r):null}getClassName(){return"Texture"}dispose(){super.dispose(),this.onLoadObservable.clear(),this._delayedOnLoad=null,this._delayedOnError=null,this._buffer=null}static Parse(e,t,i){let r;if(e.customType){let r=si.Instantiate(e.customType).Parse(e,t,i);return e.samplingMode&&r.updateSamplingMode&&r._samplingMode&&r._samplingMode!==e.samplingMode&&r.updateSamplingMode(e.samplingMode),r}if(e.isCube&&!e.isRenderTarget)return n6._CubeTextureParser(e,t,i);let s=void 0!==e.internalTextureUniqueId;if(!e.name&&!e.isRenderTarget&&!s)return null;if(s){for(let i of t.getEngine().getLoadedTexturesCache())if(i.uniqueId===e.internalTextureUniqueId){r=i;break}}let n=t=>{var i;if(t&&t._texture&&(t._texture._cachedWrapU=null,t._texture._cachedWrapV=null,t._texture._cachedWrapR=null),e.samplingMode){let i=e.samplingMode;t&&t.samplingMode!==i&&t.updateSamplingMode(i)}if(t&&e.animations)for(let i=0;i{var s,a,o;let l=!0;if(e.noMipmap&&(l=!1),e.mirrorPlane){let i=n6._CreateMirror(e.name,e.renderTargetSize,t,l);return i._waitingRenderList=e.renderList,i.mirrorPlane=sG.FromArray(e.mirrorPlane),n(i),i}if(e.isRenderTarget){let i=null;if(e.isCube){if(t.reflectionProbes)for(let i=0;i{n(s)},null!==(a=e._creationFlags)&&void 0!==a?a:0,null!==(o=e._useSRGBBuffer)&&void 0!==o&&o)).name=e.name;else{let a;a=e.name&&(e.name.indexOf("://")>0||e.name.startsWith("data:"))?e.name:i+e.name,e.url&&(e.url.startsWith("data:")||n6.UseSerializedUrlIfAny)&&(a=e.url),s=new n6(a,t,{noMipmap:!l,invertY:e.invertY,samplingMode:e.samplingMode,onLoad:()=>{n(s)},internalTexture:r})}return s}},e,t)}static CreateFromBase64String(e,t,i,r,s,n=n6.TRILINEAR_SAMPLINGMODE,a=null,o=null,l=5,h){return new n6("data:"+t,i,r,s,n,a,o,e,!1,l,void 0,void 0,h)}static LoadFromDataString(e,t,i,r=!1,s,n=!0,a=n6.TRILINEAR_SAMPLINGMODE,o=null,l=null,h=5,u){return"data:"!==e.substr(0,5)&&(e="data:"+e),new n6(e,i,s,n,a,o,l,t,r,h,void 0,void 0,u)}}function n8(e,t,i,r){let s;let n=1;1===r?s=new Float32Array(t*i*4):2===r?(s=new Uint16Array(t*i*4),n=15360):s=7===r?new Uint32Array(t*i*4):new Uint8Array(t*i*4);for(let r=0;r{throw iL("CubeTexture")},n6._CreateMirror=(e,t,i,r)=>{throw iL("MirrorTexture")},n6._CreateRenderTargetTexture=(e,t,i,r,s)=>{throw iL("RenderTargetTexture")},n6.NEAREST_SAMPLINGMODE=1,n6.NEAREST_NEAREST_MIPLINEAR=8,n6.BILINEAR_SAMPLINGMODE=2,n6.LINEAR_LINEAR_MIPNEAREST=11,n6.TRILINEAR_SAMPLINGMODE=3,n6.LINEAR_LINEAR_MIPLINEAR=3,n6.NEAREST_NEAREST_MIPNEAREST=4,n6.NEAREST_LINEAR_MIPNEAREST=5,n6.NEAREST_LINEAR_MIPLINEAR=6,n6.NEAREST_LINEAR=7,n6.NEAREST_NEAREST=1,n6.LINEAR_NEAREST_MIPNEAREST=9,n6.LINEAR_NEAREST_MIPLINEAR=10,n6.LINEAR_LINEAR=2,n6.LINEAR_NEAREST=12,n6.EXPLICIT_MODE=0,n6.SPHERICAL_MODE=1,n6.PLANAR_MODE=2,n6.CUBIC_MODE=3,n6.PROJECTION_MODE=4,n6.SKYBOX_MODE=5,n6.INVCUBIC_MODE=6,n6.EQUIRECTANGULAR_MODE=7,n6.FIXED_EQUIRECTANGULAR_MODE=8,n6.FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,n6.CLAMP_ADDRESSMODE=0,n6.WRAP_ADDRESSMODE=1,n6.MIRROR_ADDRESSMODE=2,n6.UseSerializedUrlIfAny=!1,iZ([iW()],n6.prototype,"url",void 0),iZ([iW()],n6.prototype,"uOffset",void 0),iZ([iW()],n6.prototype,"vOffset",void 0),iZ([iW()],n6.prototype,"uScale",void 0),iZ([iW()],n6.prototype,"vScale",void 0),iZ([iW()],n6.prototype,"uAng",void 0),iZ([iW()],n6.prototype,"vAng",void 0),iZ([iW()],n6.prototype,"wAng",void 0),iZ([iW()],n6.prototype,"uRotationCenter",void 0),iZ([iW()],n6.prototype,"vRotationCenter",void 0),iZ([iW()],n6.prototype,"wRotationCenter",void 0),iZ([iW()],n6.prototype,"homogeneousRotationInUVTransform",void 0),iZ([iW()],n6.prototype,"isBlocking",null),t0["BABYLON.Texture"]=n6,i$._TextureParser=n6.Parse,r$.prototype.updateRawTexture=function(e,t,i,r,s=null,n=0,a=!1){if(!e)return;let o=this._getRGBABufferInternalSizedFormat(n,i,a),l=this._getInternalFormat(i),h=this._getWebGLTextureType(n);this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),this._unpackFlipY(void 0===r||!!r),this._doNotHandleContextLost||(e._bufferView=t,e.format=i,e.type=n,e.invertY=r,e._compression=s),e.width%4!=0&&this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT,1),s&&t?this._gl.compressedTexImage2D(this._gl.TEXTURE_2D,0,this.getCaps().s3tc[s],e.width,e.height,0,t):this._gl.texImage2D(this._gl.TEXTURE_2D,0,o,e.width,e.height,0,l,h,t),e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),e.isReady=!0},r$.prototype.createRawTexture=function(e,t,i,r,s,n,a,o=null,l=0,h=0,u=!1){let c=new rU(this,m.Raw);c.baseWidth=t,c.baseHeight=i,c.width=t,c.height=i,c.format=r,c.generateMipMaps=s,c.samplingMode=a,c.invertY=n,c._compression=o,c.type=l,c._useSRGBBuffer=this._getUseSRGBBuffer(u,!s),this._doNotHandleContextLost||(c._bufferView=e),this.updateRawTexture(c,e,r,n,o,l,c._useSRGBBuffer),this._bindTextureDirectly(this._gl.TEXTURE_2D,c,!0);let d=this._getSamplingParameters(a,s);return this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,d.mag),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,d.min),s&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._internalTexturesCache.push(c),c},r$.prototype.createRawCubeTexture=function(e,t,i,r,s,n,a,o=null){let l=this._gl,h=new rU(this,m.CubeRaw);h.isCube=!0,h.format=i,h.type=r,this._doNotHandleContextLost||(h._bufferViewArray=e);let u=this._getWebGLTextureType(r),c=this._getInternalFormat(i);if(c===l.RGB&&(c=l.RGBA),u!==l.FLOAT||this._caps.textureFloatLinearFiltering?u!==this._gl.HALF_FLOAT_OES||this._caps.textureHalfFloatLinearFiltering?u!==l.FLOAT||this._caps.textureFloatRender?u!==l.HALF_FLOAT||this._caps.colorBufferFloat||(s=!1,ig.Warn("Render to half float textures is not supported. Mipmap generation forced to false.")):(s=!1,ig.Warn("Render to float textures is not supported. Mipmap generation forced to false.")):(s=!1,a=1,ig.Warn("Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.")):(s=!1,a=1,ig.Warn("Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.")),h.width=t,h.height=t,h.invertY=n,h._compression=o,!this.needPOTTextures||ss.IsExponentOfTwo(h.width)&&ss.IsExponentOfTwo(h.height)||(s=!1),e)this.updateRawCubeTexture(h,e,i,r,n,o);else{let e=this._getRGBABufferInternalSizedFormat(r);this._bindTextureDirectly(l.TEXTURE_CUBE_MAP,h,!0);for(let t=0;t<6;t++)o?l.compressedTexImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,this.getCaps().s3tc[o],h.width,h.height,0,void 0):l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,e,h.width,h.height,0,c,u,null);this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)}this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,h,!0),e&&s&&this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);let d=this._getSamplingParameters(a,s);return l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MAG_FILTER,d.mag),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MIN_FILTER,d.min),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),this._bindTextureDirectly(l.TEXTURE_CUBE_MAP,null),h.generateMipMaps=s,h.samplingMode=a,h.isReady=!0,h},r$.prototype.updateRawCubeTexture=function(e,t,i,r,s,n=null,a=0){e._bufferViewArray=t,e.format=i,e.type=r,e.invertY=s,e._compression=n;let o=this._gl,l=this._getWebGLTextureType(r),h=this._getInternalFormat(i),u=this._getRGBABufferInternalSizedFormat(r),c=!1;h===o.RGB&&(h=o.RGBA,c=!0),this._bindTextureDirectly(o.TEXTURE_CUBE_MAP,e,!0),this._unpackFlipY(void 0===s||!!s),e.width%4!=0&&o.pixelStorei(o.UNPACK_ALIGNMENT,1);for(let i=0;i<6;i++){let s=t[i];n?o.compressedTexImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+i,a,this.getCaps().s3tc[n],e.width,e.height,0,s):(c&&(s=n8(s,e.width,e.height,r)),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+i,a,u,e.width,e.height,0,h,l,s))}(!this.needPOTTextures||ss.IsExponentOfTwo(e.width)&&ss.IsExponentOfTwo(e.height))&&e.generateMipMaps&&0===a&&this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),e.isReady=!0},r$.prototype.createRawCubeTextureFromUrl=function(e,t,i,r,s,n,a,o,l=null,h=null,u=3,c=!1){let d=this._gl,p=this.createRawCubeTexture(null,i,r,s,!n,c,u,null);null==t||t.addPendingData(p),p.url=e,p.isReady=!1,this._internalTexturesCache.push(p);let _=e=>{let i=p.width,n=a(e);if(n){if(o){let e=this._getWebGLTextureType(s),t=this._getInternalFormat(r),a=this._getRGBABufferInternalSizedFormat(s),l=!1;t===d.RGB&&(t=d.RGBA,l=!0),this._bindTextureDirectly(d.TEXTURE_CUBE_MAP,p,!0),this._unpackFlipY(!1);let h=o(n);for(let r=0;r