diff --git a/tools/ui/node_modules/workbox-strategies/src/_version.ts b/tools/ui/node_modules/workbox-strategies/src/_version.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e8fe137c86ce1b992cfa411d6d976098ec5e6d7c
--- /dev/null
+++ b/tools/ui/node_modules/workbox-strategies/src/_version.ts
@@ -0,0 +1,2 @@
+// @ts-ignore
+try{self['workbox:strategies:7.4.1']&&_()}catch(e){}
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-strategies/src/index.ts b/tools/ui/node_modules/workbox-strategies/src/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2ad7dbc91139c1c4ae4685638510eaa65c0c1bc1
--- /dev/null
+++ b/tools/ui/node_modules/workbox-strategies/src/index.ts
@@ -0,0 +1,44 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import {CacheFirst} from './CacheFirst.js';
+import {CacheOnly} from './CacheOnly.js';
+import {NetworkFirst, NetworkFirstOptions} from './NetworkFirst.js';
+import {NetworkOnly, NetworkOnlyOptions} from './NetworkOnly.js';
+import {StaleWhileRevalidate} from './StaleWhileRevalidate.js';
+import {Strategy, StrategyOptions} from './Strategy.js';
+import {StrategyHandler} from './StrategyHandler.js';
+import './_version.js';
+
+// See https://github.com/GoogleChrome/workbox/issues/2946
+declare global {
+ interface FetchEvent {
+ // See https://github.com/GoogleChrome/workbox/issues/2974
+ readonly preloadResponse: Promise;
+ }
+}
+
+/**
+ * There are common caching strategies that most service workers will need
+ * and use. This module provides simple implementations of these strategies.
+ *
+ * @module workbox-strategies
+ */
+
+export {
+ CacheFirst,
+ CacheOnly,
+ NetworkFirst,
+ NetworkFirstOptions,
+ NetworkOnly,
+ NetworkOnlyOptions,
+ StaleWhileRevalidate,
+ Strategy,
+ StrategyHandler,
+ StrategyOptions,
+};
diff --git a/tools/ui/node_modules/workbox-strategies/src/plugins/cacheOkAndOpaquePlugin.ts b/tools/ui/node_modules/workbox-strategies/src/plugins/cacheOkAndOpaquePlugin.ts
new file mode 100644
index 0000000000000000000000000000000000000000..5f64a5fe22372e21e697ace1513f1c62bde63c74
--- /dev/null
+++ b/tools/ui/node_modules/workbox-strategies/src/plugins/cacheOkAndOpaquePlugin.ts
@@ -0,0 +1,29 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import {WorkboxPlugin} from 'workbox-core/types.js';
+import '../_version.js';
+
+export const cacheOkAndOpaquePlugin: WorkboxPlugin = {
+ /**
+ * Returns a valid response (to allow caching) if the status is 200 (OK) or
+ * 0 (opaque).
+ *
+ * @param {Object} options
+ * @param {Response} options.response
+ * @return {Response|null}
+ *
+ * @private
+ */
+ cacheWillUpdate: async ({response}) => {
+ if (response.status === 200 || response.status === 0) {
+ return response;
+ }
+ return null;
+ },
+};
diff --git a/tools/ui/node_modules/workbox-strategies/src/utils/messages.ts b/tools/ui/node_modules/workbox-strategies/src/utils/messages.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f6d647e88de415778223f9fffd9caa0eea82ea0f
--- /dev/null
+++ b/tools/ui/node_modules/workbox-strategies/src/utils/messages.ts
@@ -0,0 +1,23 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import {logger} from 'workbox-core/_private/logger.js';
+import {getFriendlyURL} from 'workbox-core/_private/getFriendlyURL.js';
+import '../_version.js';
+
+export const messages = {
+ strategyStart: (strategyName: string, request: Request): string =>
+ `Using ${strategyName} to respond to '${getFriendlyURL(request.url)}'`,
+ printFinalResponse: (response?: Response): void => {
+ if (response) {
+ logger.groupCollapsed(`View the final response here.`);
+ logger.log(response || '[No response returned]');
+ logger.groupEnd();
+ }
+ },
+};
diff --git a/tools/ui/node_modules/workbox-strategies/tsconfig.json b/tools/ui/node_modules/workbox-strategies/tsconfig.json
new file mode 100644
index 0000000000000000000000000000000000000000..3bb2772b586c4d0ceee3d014e64dba7aafbdd570
--- /dev/null
+++ b/tools/ui/node_modules/workbox-strategies/tsconfig.json
@@ -0,0 +1,11 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "composite": true,
+ "outDir": "./",
+ "rootDir": "./src",
+ "tsBuildInfoFile": "./tsconfig.tsbuildinfo"
+ },
+ "include": ["src/**/*.ts"],
+ "references": [{"path": "../workbox-core/"}]
+}
diff --git a/tools/ui/node_modules/workbox-strategies/tsconfig.tsbuildinfo b/tools/ui/node_modules/workbox-strategies/tsconfig.tsbuildinfo
new file mode 100644
index 0000000000000000000000000000000000000000..ffcd98ee698154738762986a8d357d2f65b5e748
--- /dev/null
+++ b/tools/ui/node_modules/workbox-strategies/tsconfig.tsbuildinfo
@@ -0,0 +1 @@
+{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.webworker.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../infra/type-overrides.d.ts","../workbox-core/_version.d.ts","../workbox-core/types.d.ts","../workbox-core/_private/assert.d.ts","../workbox-core/_private/logger.d.ts","../workbox-core/_private/workboxerror.d.ts","../workbox-core/_private/cachenames.d.ts","../workbox-core/_private/getfriendlyurl.d.ts","../workbox-core/_private/cachematchignoreparams.d.ts","../workbox-core/_private/deferred.d.ts","../workbox-core/_private/executequotaerrorcallbacks.d.ts","../workbox-core/_private/timeout.d.ts","./src/_version.ts","./src/strategyhandler.ts","./src/strategy.ts","./src/utils/messages.ts","./src/cachefirst.ts","./src/cacheonly.ts","./src/plugins/cacheokandopaqueplugin.ts","./src/networkfirst.ts","./src/networkonly.ts","./src/stalewhilerevalidate.ts","./src/index.ts","../../node_modules/@babel/types/lib/index.d.ts","../../node_modules/@types/babel__generator/index.d.ts","../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../node_modules/@types/babel__template/index.d.ts","../../node_modules/@types/babel__traverse/index.d.ts","../../node_modules/@types/babel__core/index.d.ts","../../node_modules/@types/babel__preset-env/index.d.ts","../../node_modules/@types/common-tags/index.d.ts","../../node_modules/@types/eslint/helpers.d.ts","../../node_modules/@types/estree/index.d.ts","../../node_modules/@types/json-schema/index.d.ts","../../node_modules/@types/eslint/index.d.ts","../../node_modules/@types/eslint-scope/index.d.ts","../../node_modules/@types/node/compatibility/disposable.d.ts","../../node_modules/@types/node/compatibility/indexable.d.ts","../../node_modules/@types/node/compatibility/iterators.d.ts","../../node_modules/@types/node/compatibility/index.d.ts","../../node_modules/@types/node/ts5.6/globals.typedarray.d.ts","../../node_modules/@types/node/ts5.6/buffer.buffer.d.ts","../../node_modules/undici-types/header.d.ts","../../node_modules/undici-types/readable.d.ts","../../node_modules/undici-types/file.d.ts","../../node_modules/undici-types/fetch.d.ts","../../node_modules/undici-types/formdata.d.ts","../../node_modules/undici-types/connector.d.ts","../../node_modules/undici-types/client.d.ts","../../node_modules/undici-types/errors.d.ts","../../node_modules/undici-types/dispatcher.d.ts","../../node_modules/undici-types/global-dispatcher.d.ts","../../node_modules/undici-types/global-origin.d.ts","../../node_modules/undici-types/pool-stats.d.ts","../../node_modules/undici-types/pool.d.ts","../../node_modules/undici-types/handlers.d.ts","../../node_modules/undici-types/balanced-pool.d.ts","../../node_modules/undici-types/agent.d.ts","../../node_modules/undici-types/mock-interceptor.d.ts","../../node_modules/undici-types/mock-agent.d.ts","../../node_modules/undici-types/mock-client.d.ts","../../node_modules/undici-types/mock-pool.d.ts","../../node_modules/undici-types/mock-errors.d.ts","../../node_modules/undici-types/proxy-agent.d.ts","../../node_modules/undici-types/env-http-proxy-agent.d.ts","../../node_modules/undici-types/retry-handler.d.ts","../../node_modules/undici-types/retry-agent.d.ts","../../node_modules/undici-types/api.d.ts","../../node_modules/undici-types/interceptors.d.ts","../../node_modules/undici-types/util.d.ts","../../node_modules/undici-types/cookies.d.ts","../../node_modules/undici-types/patch.d.ts","../../node_modules/undici-types/websocket.d.ts","../../node_modules/undici-types/eventsource.d.ts","../../node_modules/undici-types/filereader.d.ts","../../node_modules/undici-types/diagnostics-channel.d.ts","../../node_modules/undici-types/content-type.d.ts","../../node_modules/undici-types/cache.d.ts","../../node_modules/undici-types/index.d.ts","../../node_modules/@types/node/globals.d.ts","../../node_modules/@types/node/assert.d.ts","../../node_modules/@types/node/assert/strict.d.ts","../../node_modules/@types/node/async_hooks.d.ts","../../node_modules/@types/node/buffer.d.ts","../../node_modules/@types/node/child_process.d.ts","../../node_modules/@types/node/cluster.d.ts","../../node_modules/@types/node/console.d.ts","../../node_modules/@types/node/constants.d.ts","../../node_modules/@types/node/crypto.d.ts","../../node_modules/@types/node/dgram.d.ts","../../node_modules/@types/node/diagnostics_channel.d.ts","../../node_modules/@types/node/dns.d.ts","../../node_modules/@types/node/dns/promises.d.ts","../../node_modules/@types/node/domain.d.ts","../../node_modules/@types/node/dom-events.d.ts","../../node_modules/@types/node/events.d.ts","../../node_modules/@types/node/fs.d.ts","../../node_modules/@types/node/fs/promises.d.ts","../../node_modules/@types/node/http.d.ts","../../node_modules/@types/node/http2.d.ts","../../node_modules/@types/node/https.d.ts","../../node_modules/@types/node/inspector.d.ts","../../node_modules/@types/node/module.d.ts","../../node_modules/@types/node/net.d.ts","../../node_modules/@types/node/os.d.ts","../../node_modules/@types/node/path.d.ts","../../node_modules/@types/node/perf_hooks.d.ts","../../node_modules/@types/node/process.d.ts","../../node_modules/@types/node/punycode.d.ts","../../node_modules/@types/node/querystring.d.ts","../../node_modules/@types/node/readline.d.ts","../../node_modules/@types/node/readline/promises.d.ts","../../node_modules/@types/node/repl.d.ts","../../node_modules/@types/node/sea.d.ts","../../node_modules/@types/node/stream.d.ts","../../node_modules/@types/node/stream/promises.d.ts","../../node_modules/@types/node/stream/consumers.d.ts","../../node_modules/@types/node/stream/web.d.ts","../../node_modules/@types/node/string_decoder.d.ts","../../node_modules/@types/node/test.d.ts","../../node_modules/@types/node/timers.d.ts","../../node_modules/@types/node/timers/promises.d.ts","../../node_modules/@types/node/tls.d.ts","../../node_modules/@types/node/trace_events.d.ts","../../node_modules/@types/node/tty.d.ts","../../node_modules/@types/node/url.d.ts","../../node_modules/@types/node/util.d.ts","../../node_modules/@types/node/v8.d.ts","../../node_modules/@types/node/vm.d.ts","../../node_modules/@types/node/wasi.d.ts","../../node_modules/@types/node/worker_threads.d.ts","../../node_modules/@types/node/zlib.d.ts","../../node_modules/@types/node/ts5.6/index.d.ts","../../node_modules/@types/fs-extra/index.d.ts","../../node_modules/@types/minimatch/index.d.ts","../../node_modules/@types/glob/index.d.ts","../../node_modules/@types/html-minifier-terser/index.d.ts","../../node_modules/@types/linkify-it/index.d.ts","../../node_modules/@types/mdurl/encode.d.ts","../../node_modules/@types/mdurl/decode.d.ts","../../node_modules/@types/mdurl/parse.d.ts","../../node_modules/@types/mdurl/format.d.ts","../../node_modules/@types/mdurl/index.d.ts","../../node_modules/@types/markdown-it/lib/common/utils.d.ts","../../node_modules/@types/markdown-it/lib/token.d.ts","../../node_modules/@types/markdown-it/lib/rules_inline/state_inline.d.ts","../../node_modules/@types/markdown-it/lib/helpers/parse_link_label.d.ts","../../node_modules/@types/markdown-it/lib/helpers/parse_link_destination.d.ts","../../node_modules/@types/markdown-it/lib/helpers/parse_link_title.d.ts","../../node_modules/@types/markdown-it/lib/helpers/index.d.ts","../../node_modules/@types/markdown-it/lib/ruler.d.ts","../../node_modules/@types/markdown-it/lib/rules_block/state_block.d.ts","../../node_modules/@types/markdown-it/lib/parser_block.d.ts","../../node_modules/@types/markdown-it/lib/rules_core/state_core.d.ts","../../node_modules/@types/markdown-it/lib/parser_core.d.ts","../../node_modules/@types/markdown-it/lib/parser_inline.d.ts","../../node_modules/@types/markdown-it/lib/renderer.d.ts","../../node_modules/@types/markdown-it/lib/index.d.ts","../../node_modules/@types/markdown-it/index.d.ts","../../node_modules/@types/minimist/index.d.ts","../../node_modules/@types/normalize-package-data/index.d.ts","../../node_modules/@types/parse-json/index.d.ts","../../node_modules/@types/resolve/index.d.ts","../../node_modules/@types/semver/classes/semver.d.ts","../../node_modules/@types/semver/functions/parse.d.ts","../../node_modules/@types/semver/functions/valid.d.ts","../../node_modules/@types/semver/functions/clean.d.ts","../../node_modules/@types/semver/functions/inc.d.ts","../../node_modules/@types/semver/functions/diff.d.ts","../../node_modules/@types/semver/functions/major.d.ts","../../node_modules/@types/semver/functions/minor.d.ts","../../node_modules/@types/semver/functions/patch.d.ts","../../node_modules/@types/semver/functions/prerelease.d.ts","../../node_modules/@types/semver/functions/compare.d.ts","../../node_modules/@types/semver/functions/rcompare.d.ts","../../node_modules/@types/semver/functions/compare-loose.d.ts","../../node_modules/@types/semver/functions/compare-build.d.ts","../../node_modules/@types/semver/functions/sort.d.ts","../../node_modules/@types/semver/functions/rsort.d.ts","../../node_modules/@types/semver/functions/gt.d.ts","../../node_modules/@types/semver/functions/lt.d.ts","../../node_modules/@types/semver/functions/eq.d.ts","../../node_modules/@types/semver/functions/neq.d.ts","../../node_modules/@types/semver/functions/gte.d.ts","../../node_modules/@types/semver/functions/lte.d.ts","../../node_modules/@types/semver/functions/cmp.d.ts","../../node_modules/@types/semver/functions/coerce.d.ts","../../node_modules/@types/semver/classes/comparator.d.ts","../../node_modules/@types/semver/classes/range.d.ts","../../node_modules/@types/semver/functions/satisfies.d.ts","../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../node_modules/@types/semver/ranges/min-version.d.ts","../../node_modules/@types/semver/ranges/valid.d.ts","../../node_modules/@types/semver/ranges/outside.d.ts","../../node_modules/@types/semver/ranges/gtr.d.ts","../../node_modules/@types/semver/ranges/ltr.d.ts","../../node_modules/@types/semver/ranges/intersects.d.ts","../../node_modules/@types/semver/ranges/simplify.d.ts","../../node_modules/@types/semver/ranges/subset.d.ts","../../node_modules/@types/semver/internals/identifiers.d.ts","../../node_modules/@types/semver/index.d.ts","../../node_modules/@types/source-list-map/index.d.ts","../../node_modules/@types/stringify-object/index.d.ts","../../node_modules/@types/tapable/index.d.ts","../../node_modules/@types/uglify-js/node_modules/source-map/source-map.d.ts","../../node_modules/@types/uglify-js/index.d.ts","../../node_modules/@types/webpack-sources/node_modules/source-map/source-map.d.ts","../../node_modules/@types/webpack-sources/lib/source.d.ts","../../node_modules/@types/webpack-sources/lib/compatsource.d.ts","../../node_modules/@types/webpack-sources/lib/concatsource.d.ts","../../node_modules/@types/webpack-sources/lib/originalsource.d.ts","../../node_modules/@types/webpack-sources/lib/prefixsource.d.ts","../../node_modules/@types/webpack-sources/lib/rawsource.d.ts","../../node_modules/@types/webpack-sources/lib/replacesource.d.ts","../../node_modules/@types/webpack-sources/lib/sizeonlysource.d.ts","../../node_modules/@types/webpack-sources/lib/sourcemapsource.d.ts","../../node_modules/@types/webpack-sources/lib/index.d.ts","../../node_modules/@types/webpack-sources/lib/cachedsource.d.ts","../../node_modules/@types/webpack-sources/index.d.ts"],"fileInfos":[{"version":"8730f4bf322026ff5229336391a18bcaa1f94d4f82416c8b2f3954e2ccaae2ba","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","4b421cbfb3a38a27c279dec1e9112c3d1da296f77a1a85ddadf7e7a425d45d18","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"d3f4771304b6b07e5a2bb992e75af76ac060de78803b1b21f0475ffc5654d817","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"5f406584aef28a331c36523df688ca3650288d14f39c5d2e555c95f0d2ff8f6f","affectsGlobalScope":true},{"version":"22f230e544b35349cfb3bd9110b6ef37b41c6d6c43c3314a31bd0d9652fcec72","affectsGlobalScope":true},{"version":"7ea0b55f6b315cf9ac2ad622b0a7813315bb6e97bf4bb3fbf8f8affbca7dc695","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"eb26de841c52236d8222f87e9e6a235332e0788af8c87a71e9e210314300410a","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"5e5e095c4470c8bab227dbbc61374878ecead104c74ab9960d3adcccfee23205","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"2768ef564cfc0689a1b76106c421a2909bdff0acbe87da010785adab80efdd5c","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"0396119f8b76a074eddc16de8dbc4231a448f2534f4c64c5ab7b71908eb6e646","affectsGlobalScope":true},"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","f0ae1ac99c66a4827469b8942101642ae65971e36db438afe67d4985caa31222","7f5bced3f1bd3647585b59564e0b0fda67e1c2930325507ee922698fe8366aca",{"version":"d763b9ef68a16f3896187af5b51b5a959b479218cc65c2930bcb440cbbf10728","affectsGlobalScope":true},"0b066351c69855f76970a460fe20a500d20f369a02d2069aa49e1195cd04c3c5","dda5c129fa8b8e72bee6609a4fc48148f58f2f656d70a395d3122431193569f9","9fd40388bab591ded1f8c05b64fbfe3e342c6cd70d594d5238f42dd2186980ff","9848c9644b2c1209f90ca5bf13f81d268365178241ba40bee6cf334643a8d5a0","88fa7615e71089c0cab3b688aae073a6e9dae6f489ec1357da407c155d2e9d84","4e7a6d022b2a963e993bec8a6e92bd6053f2e46495ef058b015cfd25fa6520b9","f69dd422840e809218633c76acb5eed2a6aa81914299f9b8d74101148526e27e",{"version":"5302edf159925979044d12d1d880b11026afc72e3792a26c3cdf26c79f13cc95","signature":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","affectsGlobalScope":true},{"version":"e7205dfd323234bf4e0b792a81edc050a8aa3dea2bdff6c4f6a69cefe9fb3f85","signature":"c0f693310aa76645335728d3636021e61130aff7651ae44c512662a194ac3b63"},{"version":"709b7e9bbcb674471087b3c0ed1a1f5f8281716606751f8c1ac77ff03a6f8f8d","signature":"98962a67c31e31dbb0f7eb27082465ca9bfd4b59c9f36537a70c27b1a3982e65"},{"version":"e0920a4cf384f4e5b669d369c2b2c807308b3f1b7f0f1fee0336c86e5745a617","signature":"cf3911e52a035c3412ffaac2597bcda4b211022a9f9f3172f1b2f5f5786a9a8e"},{"version":"3c479b29aaea6365e3ab2b22d720b80924f51a4d22048e06bf718056b3420299","signature":"b7a945ae3d451d0150046845f80e668e0dcbeeee2c8b7616b85623c5619b8ecb"},{"version":"f6802c83be81f4724096014bc99fd01745085cdd10004be8841b5fbf6952476a","signature":"4da3eff99723cfb997d249dd6f008c605671fbb47d2f670b4f9e76bf441afa48"},{"version":"e2f1cbd77a92bf2611826404da3e4ab2c60a10019a42c696628a60fbf8aac761","signature":"697ecabf6994c375c59c13d044ecf94d7d01b931a7122e11d0ec4fcc08c6b996"},{"version":"592a1d38f841175483eee47035e578fdf61344fb8f96e245717cdfea387d60dc","signature":"504186e6db5cd2c600ce2f134732e4d6ff94beddac01357e597d720735a3100e"},{"version":"75362edce62f192fff1c8bedbbf6ac9fcf3d1c1664c0de9043379df181b77742","signature":"ca6d208c53e8678ded971927ab4dec73a131ff603b0d3739cb16a905751e7275"},{"version":"b0dc8d7745f05499e819a5bda82f59387bfe164e3f2c97568ea5cee6cf97c3fe","signature":"f47f28fe817c1c06e48ba005a96d4166e0e66b32d1dacd020a0fc8b7af91f20d"},{"version":"8bf18b8b55ef77bd493dd0d1f74dfeea5cba48514c5e0de6f65b7232f19ffee3","signature":"28e03569a522e96af67ad1007d85fd78ed86be623133ff59e6645d77375126e7","affectsGlobalScope":true},"c2c2a861a338244d7dd700d0c52a78916b4bb75b98fc8ca5e7c501899fc03796","b25c5f2970d06c729f464c0aeaa64b1a5b5f1355aa93554bb5f9c199b8624b1e","adb467429462e3891de5bb4a82a4189b92005d61c7f9367c089baf03997c104e","3051751533eee92572241b3cef28333212401408c4e7aa21718714b793c0f4ed","691aea9772797ca98334eb743e7686e29325b02c6931391bcee4cc7bf27a9f3b","069bebfee29864e3955378107e243508b163e77ab10de6a5ee03ae06939f0bb9","d83a458e35dfd3cfe0c94758b0b621a733df35ff6b24db007c2721da6574705d","0aeab9bac83e1f076d9f5487c5c783288fe9be64064ee7de3c81eecee157f506",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"151ff381ef9ff8da2da9b9663ebf657eac35c4c9a19183420c05728f31a6761d","f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","7852500a7dc3f9cb6b73d619f6e0249119211ea662fd5e16c59ee5aba3deeb80","1f68ab0e055994eb337b67aa87d2a15e0200951e9664959b3866ee6f6b11a0fe",{"version":"70521b6ab0dcba37539e5303104f29b721bfb2940b2776da4cc818c07e1fefc1","affectsGlobalScope":true},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true},"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a",{"version":"613b21ccdf3be6329d56e6caa13b258c842edf8377be7bc9f014ed14cdcfc308","affectsGlobalScope":true},{"version":"20fb08397d22742771868b52f647cddfbf44b263f26b6519b449257f8c9f7364","affectsGlobalScope":true},"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","24bd580b5743dc56402c440dc7f9a4f5d592ad7a419f25414d37a7bfe11e342b","25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","6bdc71028db658243775263e93a7db2fd2abfce3ca569c3cca5aee6ed5eb186d","cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","4d2b0eb911816f66abe4970898f97a2cfc902bcd743cbfa5017fad79f7ef90d8","bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","e53a3c2a9f624d90f24bf4588aacd223e7bec1b9d0d479b68d2f4a9e6011147f","24b8685c62562f5d98615c5a0c1d05f297cf5065f15246edfe99e81ec4c0e011","93507c745e8f29090efb99399c3f77bec07db17acd75634249dc92f961573387","339dc5265ee5ed92e536a93a04c4ebbc2128f45eeec6ed29f379e0085283542c","4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107",{"version":"08faa97886e71757779428dd4c69a545c32c85fd629d1116d42710b32c6378bc","affectsGlobalScope":true},"6b042aa5d277ad6963e2837179fd2f8fbb01968ac67115b0833c0244e93d1d50","7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","3d77c73be94570813f8cadd1f05ebc3dc5e2e4fdefe4d340ca20cd018724ee36",{"version":"23cfd70b42094e54cc3c5dab996d81b97e2b6f38ccb24ead85454b8ddfe2fc4f","affectsGlobalScope":true},"f3e58c4c18a031cbb17abec7a4ad0bd5ae9fc70c1f4ba1e7fb921ad87c504aca","a3e8bafb2af8e850c644f4be7f5156cf7d23b7bfdc3b786bd4d10ed40329649c",{"version":"35ec8b6760fd7138bbf5809b84551e31028fb2ba7b6dc91d95d098bf212ca8b4","affectsGlobalScope":true},"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a",{"version":"4b87f767c7bc841511113c876a6b8bf1fd0cb0b718c888ad84478b372ec486b1","affectsGlobalScope":true},"8d04e3640dd9eb67f7f1e5bd3d0bf96c784666f7aefc8ac1537af6f2d38d4c29","3c884d9d9ec454bdf0d5a0b8465bf8297d2caa4d853851d92cc417ac6f30b969","5a369483ac4cfbdf0331c248deeb36140e6907db5e1daed241546b4a2055f82c","e8f5b5cc36615c17d330eaf8eebbc0d6bdd942c25991f96ef122f246f4ff722f","f0bd7e6d931657b59605c44112eaf8b980ba7f957a5051ed21cb93d978cf2f45",{"version":"ee1ee365d88c4c6c0c0a5a5701d66ebc27ccd0bcfcfaa482c6e2e7fe7b98edf7","affectsGlobalScope":true},{"version":"0ada07543808f3b967624645a8e1ccd446f8b01ade47842acf1328aec899fed0","affectsGlobalScope":true},"0a37b8d00d03f0381d2db2fe31b0571dc9d7cc0f4b87ca103cc3cd2277690ba0","71adf5dbc59568663d252a46179e71e4d544c053978bfc526d11543a3f716f42","38bf8ff1b403c861e9052c9ea651cb4f38c1ecc084a34d79f8acc6d6477a7321","93bd413918fa921c8729cef45302b24d8b6c7855d72d5bf82d3972595ae8dcbf","4ff41188773cbf465807dd2f7059c7494cbee5115608efc297383832a1150c43","dccdf1677e531e33f8ac961a68bc537418c9a414797c1ea7e91307501cdc3f5e",{"version":"e184c4b8918ef56c8c9e68bd79f3f3780e2d0d75bf2b8a41da1509a40c2deb46","affectsGlobalScope":true},"d206b4baf4ddcc15d9d69a9a2f4999a72a2c6adeaa8af20fa7a9960816287555","93f437e1398a4f06a984f441f7fa7a9f0535c04399619b5c22e0b87bdee182cb","afbe24ab0d74694372baa632ecb28bb375be53f3be53f9b07ecd7fc994907de5",{"version":"70731d10d5311bd4cf710ef7f6539b62660f4b0bfdbb3f9fbe1d25fe6366a7fa","affectsGlobalScope":true},{"version":"6b19db3600a17af69d4f33d08cc7076a7d19fb65bb36e442cac58929ec7c9482","affectsGlobalScope":true},"9e043a1bc8fbf2a255bccf9bf27e0f1caf916c3b0518ea34aa72357c0afd42ec","137c2894e8f3e9672d401cc0a305dc7b1db7c69511cf6d3970fb53302f9eae09","3bc2f1e2c95c04048212c569ed38e338873f6a8593930cf5a7ef24ffb38fc3b6","8145e07aad6da5f23f2fcd8c8e4c5c13fb26ee986a79d03b0829b8fce152d8b2","f9d9d753d430ed050dc1bf2667a1bab711ccbb1c1507183d794cc195a5b085cc","9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","ba1f814c22fd970255ddd60d61fb7e00c28271c933ab5d5cc19cd3ca66b8f57c","37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","125d792ec6c0c0f657d758055c494301cc5fdb327d9d9d5960b3f129aff76093",{"version":"295f068af94245ee9d780555351bef98adfd58f8baf0b9dadbc31a489b881f8b","affectsGlobalScope":true},"1851a3b4db78664f83901bb9cac9e45e03a37bb5933cc5bf37e10bb7e91ab4eb",{"version":"09d479208911ac3ac6a7c2fe86217fc1abe6c4f04e2d52e4890e500699eeab32","affectsGlobalScope":true},{"version":"12ed4559eba17cd977aa0db658d25c4047067444b51acfdcbf38470630642b23","affectsGlobalScope":true},"f3ffabc95802521e1e4bcba4c88d8615176dc6e09111d920c7a213bdda6e1d65","4f029899f9bae07e225c43aef893590541b2b43267383bf5e32e3a884d219ed5","ae56f65caf3be91108707bd8dfbccc2a57a91feb5daabf7165a06a945545ed26","a136d5de521da20f31631a0a96bf712370779d1c05b7015d7019a9b2a0446ca9",{"version":"5b566927cad2ed2139655d55d690ffa87df378b956e7fe1c96024c4d9f75c4cf","affectsGlobalScope":true},{"version":"bce947017cb7a2deebcc4f5ba04cead891ce6ad1602a4438ae45ed9aa1f39104","affectsGlobalScope":true},"d3dffd70e6375b872f0b4e152de4ae682d762c61a24881ecc5eb9f04c5caf76f","e2c72c065a36bc9ab2a00ac6a6f51e71501619a72c0609defd304d46610487a4","d91a7d8b5655c42986f1bdfe2105c4408f472831c8f20cf11a8c3345b6b56c8c",{"version":"616075a6ac578cf5a013ee12964188b4412823796ce0b202c6f1d2e4ca8480d7","affectsGlobalScope":true},"e8a979b8af001c9fc2e774e7809d233c8ca955a28756f52ee5dee88ccb0611d2","9091e564b81e7b4c382a33c62de704a699e10508190547d4f7c1c3e039d2db2b","ed19da84b7dbf00952ad0b98ce5c194f1903bcf7c94d8103e8e0d63b271543ae","1d1e6bd176eee5970968423d7e215bfd66828b6db8d54d17afec05a831322633","393137c76bd922ba70a2f8bf1ade4f59a16171a02fb25918c168d48875b0cfb0","6767cce098e1e6369c26258b7a1f9e569c5467d501a47a090136d5ea6e80ae6d","6503fb6addf62f9b10f8564d9869ad824565a914ec1ac3dd7d13da14a3f57036","f313731860257325f13351575f381fef333d4dfe30daf5a2e72f894208feea08","951b37f7d86f6012f09e6b35f1de57c69d75f16908cb0adaa56b93675ea0b853","3816fc03ffd9cbd1a7a3362a264756a4a1d547caabea50ca68303046be40e376","0c417b4ec46b88fb62a43ec00204700b560d01eb5677c7faa8ecd34610f096a8","13d29cdeb64e8496424edf42749bbb47de5e42d201cf958911a4638cbcffbd3f","0f9e381eecc5860f693c31fe463b3ca20a64ca9b8db0cf6208cd4a053f064809","95902d5561c6aac5dfc40568a12b0aca324037749dcd32a81f23423bfde69bab","5dfb2aca4136abdc5a2740f14be8134a6e6b66fd53470bb2e954e40f8abfaf3e","577463167dd69bd81f76697dfc3f7b22b77a6152f60a602a9218e52e3183ad67","b8396e9024d554b611cbe31a024b176ba7116063d19354b5a02dccd8f0118989","4b28e1c5bf88d891e07a1403358b81a51b3ba2eae1ffada51cca7476b5ac6407","7150ad575d28bf98fae321a1c0f10ad17b127927811f488ded6ff1d88d4244e5","8b155c4757d197969553de3762c8d23d5866710301de41e1b66b97c9ed867003","93733466609dd8bf72eace502a24ca7574bd073d934216e628f1b615c8d3cb3c","45e9228761aabcadb79c82fb3008523db334491525bdb8e74e0f26eaf7a4f7f4","aeacac2778c9821512b6b889da79ac31606a863610c8f28da1e483579627bf90","569fdb354062fc098a6a3ba93a029edf22d6fe480cf72b231b3c07832b2e7c97","bf9876e62fb7f4237deafab8c7444770ef6e82b4cad2d5dc768664ff340feeb2","6cf60e76d37faf0fbc2f80a873eab0fd545f6b1bf300e7f0823f956ddb3083e9","6adaa6103086f931e3eee20f0987e86e8879e9d13aa6bd6075ccfc58b9c5681c","ee0af0f2b8d3b4d0baf669f2ff6fcef4a8816a473c894cc7c905029f7505fed0","209e814e8e71aec74f69686a9506dd7610b97ab59dcee9446266446f72a76d05","6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","cf3d384d082b933d987c4e2fe7bfb8710adfd9dc8155190056ed6695a25a559e","9871b7ee672bc16c78833bdab3052615834b08375cb144e4d2cba74473f4a589","c863198dae89420f3c552b5a03da6ed6d0acfa3807a64772b895db624b0de707","8b03a5e327d7db67112ebbc93b4f744133eda2c1743dbb0a990c61a8007823ef","86c73f2ee1752bac8eeeece234fd05dfcf0637a4fbd8032e4f5f43102faa8eec","42fad1f540271e35ca37cecda12c4ce2eef27f0f5cf0f8dd761d723c744d3159","ff3743a5de32bee10906aff63d1de726f6a7fd6ee2da4b8229054dfa69de2c34","83acd370f7f84f203e71ebba33ba61b7f1291ca027d7f9a662c6307d74e4ac22","1445cec898f90bdd18b2949b9590b3c012f5b7e1804e6e329fb0fe053946d5ec","0e5318ec2275d8da858b541920d9306650ae6ac8012f0e872fe66eb50321a669","cf530297c3fb3a92ec9591dd4fa229d58b5981e45fe6702a0bd2bea53a5e59be","c1f6f7d08d42148ddfe164d36d7aba91f467dbcb3caa715966ff95f55048b3a4","f4e9bf9103191ef3b3612d3ec0044ca4044ca5be27711fe648ada06fad4bcc85","0c1ee27b8f6a00097c2d6d91a21ee4d096ab52c1e28350f6362542b55380059a","7677d5b0db9e020d3017720f853ba18f415219fb3a9597343b1b1012cfd699f7","bc1c6bc119c1784b1a2be6d9c47addec0d83ef0d52c8fbe1f14a51b4dfffc675","52cf2ce99c2a23de70225e252e9822a22b4e0adb82643ab0b710858810e00bf1","770625067bb27a20b9826255a8d47b6b5b0a2d3dfcbd21f89904c731f671ba77","d1ed6765f4d7906a05968fb5cd6d1db8afa14dbe512a4884e8ea5c0f5e142c80","799c0f1b07c092626cf1efd71d459997635911bb5f7fc1196efe449bba87e965","2a184e4462b9914a30b1b5c41cf80c6d3428f17b20d3afb711fff3f0644001fd","9eabde32a3aa5d80de34af2c2206cdc3ee094c6504a8d0c2d6d20c7c179503cc","397c8051b6cfcb48aa22656f0faca2553c5f56187262135162ee79d2b2f6c966","a8ead142e0c87dcd5dc130eba1f8eeed506b08952d905c47621dc2f583b1bff9","a02f10ea5f73130efca046429254a4e3c06b5475baecc8f7b99a0014731be8b3","c2576a4083232b0e2d9bd06875dd43d371dee2e090325a9eac0133fd5650c1cb","4c9a0564bb317349de6a24eb4efea8bb79898fa72ad63a1809165f5bd42970dd","f40ac11d8859092d20f953aae14ba967282c3bb056431a37fced1866ec7a2681","cc11e9e79d4746cc59e0e17473a59d6f104692fd0eeea1bdb2e206eabed83b03","b444a410d34fb5e98aa5ee2b381362044f4884652e8bc8a11c8fe14bbd85518e","c35808c1f5e16d2c571aa65067e3cb95afeff843b259ecfa2fc107a9519b5392","14d5dc055143e941c8743c6a21fa459f961cbc3deedf1bfe47b11587ca4b3ef5","a3ad4e1fc542751005267d50a6298e6765928c0c3a8dce1572f2ba6ca518661c","f237e7c97a3a89f4591afd49ecb3bd8d14f51a1c4adc8fcae3430febedff5eb6","3ffdfbec93b7aed71082af62b8c3e0cc71261cc68d796665faa1e91604fbae8f","662201f943ed45b1ad600d03a90dffe20841e725203ced8b708c91fcd7f9379a","c9ef74c64ed051ea5b958621e7fb853fe3b56e8787c1587aefc6ea988b3c7e79","2462ccfac5f3375794b861abaa81da380f1bbd9401de59ffa43119a0b644253d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","7d8ddf0f021c53099e34ee831a06c394d50371816caa98684812f089b4c6b3d4","67fc055eb86a0632e2e072838f889ffe1754083cb13c8c80a06a7d895d877aae","2905bf42cddf7ba20c88922d36b7afa5431523c1cab119fdb38bf5baab02adf1","d558a0fe921ebcc88d3212c2c42108abf9f0d694d67ebdeba37d7728c044f579","2887592574fcdfd087647c539dcb0fbe5af2521270dad4a37f9d17c16190d579","9d74c7330800b325bb19cc8c1a153a612c080a60094e1ab6cfb6e39cf1b88c36","b90c59ac4682368a01c83881b814738eb151de8a58f52eb7edadea2bcffb11b9","8560a87b2e9f8e2c3808c8f6172c9b7eb6c9b08cb9f937db71c285ecf292c81d","ffe3931ff864f28d80ae2f33bd11123ad3d7bad9896b910a1e61504cc093e1f5","083c1bd82f8dc3a1ed6fc9e8eaddf141f7c05df418eca386598821e045253af9","274ebe605bd7f71ce161f9f5328febc7d547a2929f803f04b44ec4a7d8729517","6ca0207e70d985a24396583f55836b10dc181063ab6069733561bfde404d1bad","5908142efeaab38ffdf43927ee0af681ae77e0d7672b956dfb8b6c705dbfe106","f772b188b943549b5c5eb803133314b8aa7689eced80eed0b70e2f30ca07ab9c","0026b816ef05cfbf290e8585820eef0f13250438669107dfc44482bac007b14f","05d64cc1118031b29786632a9a0f6d7cf1dcacb303f27023a466cf3cdc860538","e0fff9119e1a5d2fdd46345734126cd6cb99c2d98a9debf0257047fe3937cc3f","d84398556ba4595ee6be554671da142cfe964cbdebb2f0c517a10f76f2b016c0","e275297155ec3251200abbb334c7f5641fecc68b2a9573e40eed50dff7584762"],"options":{"composite":true,"declaration":true,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","preserveConstEnums":true,"rootDir":"./src","strict":true,"target":4,"tsBuildInfoFile":"./tsconfig.tsbuildinfo"},"fileIdsList":[[83,125],[65,83,125],[65,66,67,68,69,83,125],[65,67,83,125],[74,76,83,125],[73,74,75,83,125],[83,125,138,174],[83,125,137,174,176],[83,125,199],[83,125,184],[83,125,188,189,190],[83,125,187],[83,125,189],[83,125,179,185,186,191,194,196,197,198],[83,125,186,192,193,199],[83,125,192,195],[83,125,186,187,192,199],[83,125,186,199],[83,125,180,181,182,183],[83,122,125],[83,124,125],[83,125,130,159],[83,125,126,131,137,138,145,156,167],[83,125,126,127,137,145],[78,79,80,83,125],[83,125,128,168],[83,125,129,130,138,146],[83,125,130,156,164],[83,125,131,133,137,145],[83,124,125,132],[83,125,133,134],[83,125,137],[83,125,135,137],[83,124,125,137],[83,125,137,138,139,156,167],[83,125,137,138,139,152,156,159],[83,120,125,172],[83,125,133,137,140,145,156,167],[83,125,137,138,140,141,145,156,164,167],[83,125,140,142,156,164,167],[83,125,137,143],[83,125,144,167,172],[83,125,133,137,145,156],[83,125,146],[83,125,147],[83,124,125,148],[83,122,123,124,125,126,127,128,129,130,131,132,133,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173],[83,125,150],[83,125,151],[83,125,137,152,153],[83,125,152,154,168,170],[83,125,137,156,157,159],[83,125,158,159],[83,125,156,157],[83,125,159],[83,125,160],[83,122,125,156],[83,125,137,162,163],[83,125,162,163],[83,125,130,145,156,164],[83,125,165],[125],[81,82,83,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173],[83,125,145,166],[83,125,140,151,167],[83,125,130,168],[83,125,156,169],[83,125,144,170],[83,125,171],[83,125,130,137,139,148,156,167,170,172],[83,125,156,173],[83,125,205,244],[83,125,205,229,244],[83,125,244],[83,125,205],[83,125,205,230,244],[83,125,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243],[83,125,230,244],[83,125,248],[83,125,174,251,252,253,254,255,256,257,258,259,260,261],[83,125,250,251,260],[83,125,251,260],[83,125,245,250,251,260],[83,125,250,251,252,253,254,255,256,257,258,259,261],[83,125,251],[83,125,130,250,260],[83,92,96,125,167],[83,92,125,156,167],[83,87,125],[83,89,92,125,164,167],[83,125,145,164],[83,125,174],[83,87,125,174],[83,89,92,125,145,167],[83,84,85,88,91,125,137,156,167],[83,92,99,125],[83,84,90,125],[83,92,113,114,125],[83,88,92,125,159,167,174],[83,113,125,174],[83,86,87,125,174],[83,92,125],[83,86,87,88,89,90,91,92,93,94,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,114,115,116,117,118,119,125],[83,92,107,125],[83,92,99,100,125],[83,90,92,100,101,125],[83,91,125],[83,84,87,92,125],[83,92,96,100,101,125],[83,96,125],[83,90,92,95,125,167],[83,84,89,92,99,125],[83,125,156],[83,87,92,113,125,172,174],[44,83,125],[45,46,47,55,56,57,83,125],[55,56,58,59,61,62,63,83,125],[45,46,47,55,56,57,60,83,125],[45,46,47,53,55,56,57,83,125],[44,46,47,48,49,55,83,125],[44,45,46,47,49,50,51,52,53,56,83,125],[46,49,83,125],[55,56],[55,56,58,59,61,62,63],[44],[44,55],[44,56]],"referencedMap":[[42,1],[67,2],[65,1],[70,3],[66,2],[71,1],[68,4],[69,2],[72,1],[77,5],[73,1],[76,6],[74,1],[175,7],[177,8],[178,1],[75,1],[179,1],[200,9],[185,10],[191,11],[189,1],[188,12],[190,13],[199,14],[194,15],[196,16],[197,17],[198,18],[192,1],[193,18],[195,18],[187,18],[186,1],[181,1],[180,1],[183,10],[184,19],[182,10],[176,1],[201,1],[122,20],[123,20],[124,21],[125,22],[126,23],[127,24],[78,1],[81,25],[79,1],[80,1],[128,26],[129,27],[130,28],[131,29],[132,30],[133,31],[134,31],[136,32],[135,33],[137,34],[138,35],[139,36],[121,37],[140,38],[141,39],[142,40],[143,41],[144,42],[145,43],[146,44],[147,45],[148,46],[149,47],[150,48],[151,49],[152,50],[153,50],[154,51],[155,1],[156,52],[158,53],[157,54],[159,55],[160,56],[161,57],[162,58],[163,59],[164,60],[165,61],[83,62],[82,1],[174,63],[166,64],[167,65],[168,66],[169,67],[170,68],[171,69],[172,70],[173,71],[202,1],[203,1],[204,1],[229,72],[230,73],[205,74],[208,74],[227,72],[228,72],[218,72],[217,75],[215,72],[210,72],[223,72],[221,72],[225,72],[209,72],[222,72],[226,72],[211,72],[212,72],[224,72],[206,72],[213,72],[214,72],[216,72],[220,72],[231,76],[219,72],[207,72],[244,77],[243,1],[238,76],[240,78],[239,76],[232,76],[233,76],[235,76],[237,76],[241,78],[242,78],[234,78],[236,78],[245,1],[246,1],[247,1],[249,79],[248,1],[262,80],[261,81],[252,82],[253,83],[260,84],[254,83],[255,82],[256,82],[257,82],[258,85],[251,86],[259,81],[250,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[33,1],[30,1],[31,1],[32,1],[34,1],[7,1],[35,1],[40,1],[41,1],[36,1],[37,1],[38,1],[39,1],[1,1],[8,1],[99,87],[109,88],[98,87],[119,89],[90,90],[89,91],[118,92],[112,93],[117,94],[92,95],[106,96],[91,97],[115,98],[87,99],[86,92],[116,100],[88,101],[93,102],[94,1],[97,102],[84,1],[120,103],[110,104],[101,105],[102,106],[104,107],[100,108],[103,109],[113,92],[95,110],[96,111],[105,112],[85,113],[108,104],[107,102],[111,1],[114,114],[45,115],[50,1],[48,1],[51,1],[52,1],[49,1],[46,1],[53,1],[47,115],[43,1],[44,1],[54,1],[58,116],[59,116],[64,117],[61,118],[62,119],[60,115],[63,118],[56,120],[55,121],[57,122]],"exportedModulesMap":[[42,1],[67,2],[65,1],[70,3],[66,2],[71,1],[68,4],[69,2],[72,1],[77,5],[73,1],[76,6],[74,1],[175,7],[177,8],[178,1],[75,1],[179,1],[200,9],[185,10],[191,11],[189,1],[188,12],[190,13],[199,14],[194,15],[196,16],[197,17],[198,18],[192,1],[193,18],[195,18],[187,18],[186,1],[181,1],[180,1],[183,10],[184,19],[182,10],[176,1],[201,1],[122,20],[123,20],[124,21],[125,22],[126,23],[127,24],[78,1],[81,25],[79,1],[80,1],[128,26],[129,27],[130,28],[131,29],[132,30],[133,31],[134,31],[136,32],[135,33],[137,34],[138,35],[139,36],[121,37],[140,38],[141,39],[142,40],[143,41],[144,42],[145,43],[146,44],[147,45],[148,46],[149,47],[150,48],[151,49],[152,50],[153,50],[154,51],[155,1],[156,52],[158,53],[157,54],[159,55],[160,56],[161,57],[162,58],[163,59],[164,60],[165,61],[83,62],[82,1],[174,63],[166,64],[167,65],[168,66],[169,67],[170,68],[171,69],[172,70],[173,71],[202,1],[203,1],[204,1],[229,72],[230,73],[205,74],[208,74],[227,72],[228,72],[218,72],[217,75],[215,72],[210,72],[223,72],[221,72],[225,72],[209,72],[222,72],[226,72],[211,72],[212,72],[224,72],[206,72],[213,72],[214,72],[216,72],[220,72],[231,76],[219,72],[207,72],[244,77],[243,1],[238,76],[240,78],[239,76],[232,76],[233,76],[235,76],[237,76],[241,78],[242,78],[234,78],[236,78],[245,1],[246,1],[247,1],[249,79],[248,1],[262,80],[261,81],[252,82],[253,83],[260,84],[254,83],[255,82],[256,82],[257,82],[258,85],[251,86],[259,81],[250,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[33,1],[30,1],[31,1],[32,1],[34,1],[7,1],[35,1],[40,1],[41,1],[36,1],[37,1],[38,1],[39,1],[1,1],[8,1],[99,87],[109,88],[98,87],[119,89],[90,90],[89,91],[118,92],[112,93],[117,94],[92,95],[106,96],[91,97],[115,98],[87,99],[86,92],[116,100],[88,101],[93,102],[94,1],[97,102],[84,1],[120,103],[110,104],[101,105],[102,106],[104,107],[100,108],[103,109],[113,92],[95,110],[96,111],[105,112],[85,113],[108,104],[107,102],[111,1],[114,114],[45,115],[50,1],[48,1],[51,1],[52,1],[49,1],[46,1],[53,1],[47,115],[43,1],[44,1],[58,123],[59,123],[64,124],[61,123],[62,123],[60,125],[63,123],[56,126],[55,127]],"semanticDiagnosticsPerFile":[42,67,65,70,66,71,68,69,72,77,73,76,74,175,177,178,75,179,200,185,191,189,188,190,199,194,196,197,198,192,193,195,187,186,181,180,183,184,182,176,201,122,123,124,125,126,127,78,81,79,80,128,129,130,131,132,133,134,136,135,137,138,139,121,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,158,157,159,160,161,162,163,164,165,83,82,174,166,167,168,169,170,171,172,173,202,203,204,229,230,205,208,227,228,218,217,215,210,223,221,225,209,222,226,211,212,224,206,213,214,216,220,231,219,207,244,243,238,240,239,232,233,235,237,241,242,234,236,245,246,247,249,248,262,261,252,253,260,254,255,256,257,258,251,259,250,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,33,30,31,32,34,7,35,40,41,36,37,38,39,1,8,99,109,98,119,90,89,118,112,117,92,106,91,115,87,86,116,88,93,94,97,84,120,110,101,102,104,100,103,113,95,96,105,85,108,107,111,114,45,50,48,51,52,49,46,53,47,43,44,54,58,59,64,61,62,60,63,56,55,57],"latestChangedDtsFile":"./index.d.ts"},"version":"4.9.5"}
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-strategies/utils/messages.d.ts b/tools/ui/node_modules/workbox-strategies/utils/messages.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..09e79a708df89c665985b74f58596e624a317fac
--- /dev/null
+++ b/tools/ui/node_modules/workbox-strategies/utils/messages.d.ts
@@ -0,0 +1,5 @@
+import '../_version.js';
+export declare const messages: {
+ strategyStart: (strategyName: string, request: Request) => string;
+ printFinalResponse: (response?: Response) => void;
+};
diff --git a/tools/ui/node_modules/workbox-strategies/utils/messages.js b/tools/ui/node_modules/workbox-strategies/utils/messages.js
new file mode 100644
index 0000000000000000000000000000000000000000..b91da44f6b07b208729f26a052fb6d6870c6fa23
--- /dev/null
+++ b/tools/ui/node_modules/workbox-strategies/utils/messages.js
@@ -0,0 +1,20 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+import { logger } from 'workbox-core/_private/logger.js';
+import { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';
+import '../_version.js';
+export const messages = {
+ strategyStart: (strategyName, request) => `Using ${strategyName} to respond to '${getFriendlyURL(request.url)}'`,
+ printFinalResponse: (response) => {
+ if (response) {
+ logger.groupCollapsed(`View the final response here.`);
+ logger.log(response || '[No response returned]');
+ logger.groupEnd();
+ }
+ },
+};
diff --git a/tools/ui/node_modules/workbox-strategies/utils/messages.mjs b/tools/ui/node_modules/workbox-strategies/utils/messages.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..fcad226c2238011ab36b9799e8999b5109083c3e
--- /dev/null
+++ b/tools/ui/node_modules/workbox-strategies/utils/messages.mjs
@@ -0,0 +1 @@
+export * from './messages.js';
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-streams/LICENSE b/tools/ui/node_modules/workbox-streams/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..845b545fd0f5031a944cda8cf9018eb066500040
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/LICENSE
@@ -0,0 +1,19 @@
+Copyright 2018 Google LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/tools/ui/node_modules/workbox-streams/README.md b/tools/ui/node_modules/workbox-streams/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..8abfa9cd30fe374ded9552126bfcc10a203c7fc3
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/README.md
@@ -0,0 +1 @@
+This module's documentation can be found at https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-streams
diff --git a/tools/ui/node_modules/workbox-streams/_types.d.ts b/tools/ui/node_modules/workbox-streams/_types.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..1ecb1ba8725ebcd476d1caa090c944d9cfe1bdde
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/_types.d.ts
@@ -0,0 +1,6 @@
+import './_version.js';
+export type StreamSource = Response | ReadableStream | BodyInit;
+/**
+ * @typedef {Response|ReadableStream|BodyInit} StreamSource
+ * @memberof workbox-streams
+ */
diff --git a/tools/ui/node_modules/workbox-streams/_types.js b/tools/ui/node_modules/workbox-streams/_types.js
new file mode 100644
index 0000000000000000000000000000000000000000..a9c28b0702cf5c1e4ae19fd67743b6050d8f1e69
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/_types.js
@@ -0,0 +1,18 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+import './_version.js';
+// * * * IMPORTANT! * * *
+// ------------------------------------------------------------------------- //
+// jdsoc type definitions cannot be declared above TypeScript definitions or
+// they'll be stripped from the built `.js` files, and they'll only be in the
+// `d.ts` files, which aren't read by the jsdoc generator. As a result we
+// have to put declare them below.
+/**
+ * @typedef {Response|ReadableStream|BodyInit} StreamSource
+ * @memberof workbox-streams
+ */
diff --git a/tools/ui/node_modules/workbox-streams/_types.mjs b/tools/ui/node_modules/workbox-streams/_types.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..fb0ccdd9e49605f634b19eb6c43bd521a13a66ab
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/_types.mjs
@@ -0,0 +1 @@
+export * from './_types.js';
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-streams/_version.d.ts b/tools/ui/node_modules/workbox-streams/_version.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/tools/ui/node_modules/workbox-streams/_version.js b/tools/ui/node_modules/workbox-streams/_version.js
new file mode 100644
index 0000000000000000000000000000000000000000..53e31d2305087b08713f8f6bb06e9cc79a383fb8
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/_version.js
@@ -0,0 +1,6 @@
+"use strict";
+// @ts-ignore
+try {
+ self['workbox:streams:7.4.0'] && _();
+}
+catch (e) { }
diff --git a/tools/ui/node_modules/workbox-streams/_version.mjs b/tools/ui/node_modules/workbox-streams/_version.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..3ff1476b4e91b6216668d5d9ffacd17ef7ea47d4
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/_version.mjs
@@ -0,0 +1 @@
+try{self['workbox:streams:7.4.1']&&_()}catch(e){}// eslint-disable-line
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-streams/build/workbox-streams.dev.js b/tools/ui/node_modules/workbox-streams/build/workbox-streams.dev.js
new file mode 100644
index 0000000000000000000000000000000000000000..4b0a575e8dc1ea840923021c2be587cc79600310
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/build/workbox-streams.dev.js
@@ -0,0 +1,303 @@
+this.workbox = this.workbox || {};
+this.workbox.streams = (function (exports, assert_js, Deferred_js, logger_js, WorkboxError_js, canConstructReadableStream_js) {
+ 'use strict';
+
+ // @ts-ignore
+ try {
+ self['workbox:streams:7.4.0'] && _();
+ } catch (e) {}
+
+ /*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+ */
+ /**
+ * Takes either a Response, a ReadableStream, or a
+ * [BodyInit](https://fetch.spec.whatwg.org/#bodyinit) and returns the
+ * ReadableStreamReader object associated with it.
+ *
+ * @param {workbox-streams.StreamSource} source
+ * @return {ReadableStreamReader}
+ * @private
+ */
+ function _getReaderFromSource(source) {
+ if (source instanceof Response) {
+ // See https://github.com/GoogleChrome/workbox/issues/2998
+ if (source.body) {
+ return source.body.getReader();
+ }
+ throw new WorkboxError_js.WorkboxError('opaque-streams-source', {
+ type: source.type
+ });
+ }
+ if (source instanceof ReadableStream) {
+ return source.getReader();
+ }
+ return new Response(source).body.getReader();
+ }
+ /**
+ * Takes multiple source Promises, each of which could resolve to a Response, a
+ * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit).
+ *
+ * Returns an object exposing a ReadableStream with each individual stream's
+ * data returned in sequence, along with a Promise which signals when the
+ * stream is finished (useful for passing to a FetchEvent's waitUntil()).
+ *
+ * @param {Array>} sourcePromises
+ * @return {Object<{done: Promise, stream: ReadableStream}>}
+ *
+ * @memberof workbox-streams
+ */
+ function concatenate(sourcePromises) {
+ {
+ assert_js.assert.isArray(sourcePromises, {
+ moduleName: 'workbox-streams',
+ funcName: 'concatenate',
+ paramName: 'sourcePromises'
+ });
+ }
+ const readerPromises = sourcePromises.map(sourcePromise => {
+ return Promise.resolve(sourcePromise).then(source => {
+ return _getReaderFromSource(source);
+ });
+ });
+ const streamDeferred = new Deferred_js.Deferred();
+ let i = 0;
+ const logMessages = [];
+ const stream = new ReadableStream({
+ pull(controller) {
+ return readerPromises[i].then(reader => {
+ if (reader instanceof ReadableStreamDefaultReader) {
+ return reader.read();
+ } else {
+ return;
+ }
+ }).then(result => {
+ if (result === null || result === void 0 ? void 0 : result.done) {
+ {
+ logMessages.push(['Reached the end of source:', sourcePromises[i]]);
+ }
+ i++;
+ if (i >= readerPromises.length) {
+ // Log all the messages in the group at once in a single group.
+ {
+ logger_js.logger.groupCollapsed(`Concatenating ${readerPromises.length} sources.`);
+ for (const message of logMessages) {
+ if (Array.isArray(message)) {
+ logger_js.logger.log(...message);
+ } else {
+ logger_js.logger.log(message);
+ }
+ }
+ logger_js.logger.log('Finished reading all sources.');
+ logger_js.logger.groupEnd();
+ }
+ controller.close();
+ streamDeferred.resolve();
+ return;
+ }
+ // The `pull` method is defined because we're inside it.
+ return this.pull(controller);
+ } else {
+ controller.enqueue(result === null || result === void 0 ? void 0 : result.value);
+ }
+ }).catch(error => {
+ {
+ logger_js.logger.error('An error occurred:', error);
+ }
+ streamDeferred.reject(error);
+ throw error;
+ });
+ },
+ cancel() {
+ {
+ logger_js.logger.warn('The ReadableStream was cancelled.');
+ }
+ streamDeferred.resolve();
+ }
+ });
+ return {
+ done: streamDeferred.promise,
+ stream
+ };
+ }
+
+ /*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+ */
+ /**
+ * This is a utility method that determines whether the current browser supports
+ * the features required to create streamed responses. Currently, it checks if
+ * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
+ * is available.
+ *
+ * @private
+ * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
+ * `'text/html'` will be used by default.
+ * @return {boolean} `true`, if the current browser meets the requirements for
+ * streaming responses, and `false` otherwise.
+ *
+ * @memberof workbox-streams
+ */
+ function createHeaders(headersInit = {}) {
+ // See https://github.com/GoogleChrome/workbox/issues/1461
+ const headers = new Headers(headersInit);
+ if (!headers.has('content-type')) {
+ headers.set('content-type', 'text/html');
+ }
+ return headers;
+ }
+
+ /*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+ */
+ /**
+ * Takes multiple source Promises, each of which could resolve to a Response, a
+ * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit),
+ * along with a
+ * [HeadersInit](https://fetch.spec.whatwg.org/#typedefdef-headersinit).
+ *
+ * Returns an object exposing a Response whose body consists of each individual
+ * stream's data returned in sequence, along with a Promise which signals when
+ * the stream is finished (useful for passing to a FetchEvent's waitUntil()).
+ *
+ * @param {Array>} sourcePromises
+ * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
+ * `'text/html'` will be used by default.
+ * @return {Object<{done: Promise, response: Response}>}
+ *
+ * @memberof workbox-streams
+ */
+ function concatenateToResponse(sourcePromises, headersInit) {
+ const {
+ done,
+ stream
+ } = concatenate(sourcePromises);
+ const headers = createHeaders(headersInit);
+ const response = new Response(stream, {
+ headers
+ });
+ return {
+ done,
+ response
+ };
+ }
+
+ /*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+ */
+ /**
+ * This is a utility method that determines whether the current browser supports
+ * the features required to create streamed responses. Currently, it checks if
+ * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
+ * can be created.
+ *
+ * @return {boolean} `true`, if the current browser meets the requirements for
+ * streaming responses, and `false` otherwise.
+ *
+ * @memberof workbox-streams
+ */
+ function isSupported() {
+ return canConstructReadableStream_js.canConstructReadableStream();
+ }
+
+ /*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+ */
+ /**
+ * A shortcut to create a strategy that could be dropped-in to Workbox's router.
+ *
+ * On browsers that do not support constructing new `ReadableStream`s, this
+ * strategy will automatically wait for all the `sourceFunctions` to complete,
+ * and create a final response that concatenates their values together.
+ *
+ * @param {Array} sourceFunctions
+ * An array of functions similar to {@link workbox-routing~handlerCallback}
+ * but that instead return a {@link workbox-streams.StreamSource} (or a
+ * Promise which resolves to one).
+ * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
+ * `'text/html'` will be used by default.
+ * @return {workbox-routing~handlerCallback}
+ * @memberof workbox-streams
+ */
+ function strategy(sourceFunctions, headersInit) {
+ return async ({
+ event,
+ request,
+ url,
+ params
+ }) => {
+ const sourcePromises = sourceFunctions.map(fn => {
+ // Ensure the return value of the function is always a promise.
+ return Promise.resolve(fn({
+ event,
+ request,
+ url,
+ params
+ }));
+ });
+ if (isSupported()) {
+ const {
+ done,
+ response
+ } = concatenateToResponse(sourcePromises, headersInit);
+ if (event) {
+ event.waitUntil(done);
+ }
+ return response;
+ }
+ {
+ logger_js.logger.log(`The current browser doesn't support creating response ` + `streams. Falling back to non-streaming response instead.`);
+ }
+ // Fallback to waiting for everything to finish, and concatenating the
+ // responses.
+ const blobPartsPromises = sourcePromises.map(async sourcePromise => {
+ const source = await sourcePromise;
+ if (source instanceof Response) {
+ return source.blob();
+ } else {
+ // Technically, a `StreamSource` object can include any valid
+ // `BodyInit` type, including `FormData` and `URLSearchParams`, which
+ // cannot be passed to the Blob constructor directly, so we have to
+ // convert them to actual Blobs first.
+ return new Response(source).blob();
+ }
+ });
+ const blobParts = await Promise.all(blobPartsPromises);
+ const headers = createHeaders(headersInit);
+ // Constructing a new Response from a Blob source is well-supported.
+ // So is constructing a new Blob from multiple source Blobs or strings.
+ return new Response(new Blob(blobParts), {
+ headers
+ });
+ };
+ }
+
+ exports.concatenate = concatenate;
+ exports.concatenateToResponse = concatenateToResponse;
+ exports.isSupported = isSupported;
+ exports.strategy = strategy;
+
+ return exports;
+
+})({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private);
+//# sourceMappingURL=workbox-streams.dev.js.map
diff --git a/tools/ui/node_modules/workbox-streams/build/workbox-streams.dev.js.map b/tools/ui/node_modules/workbox-streams/build/workbox-streams.dev.js.map
new file mode 100644
index 0000000000000000000000000000000000000000..3bf9b2f43b7283f3c689ab5b97e533bb129eb3c7
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/build/workbox-streams.dev.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"workbox-streams.dev.js","sources":["../_version.js","../concatenate.js","../utils/createHeaders.js","../concatenateToResponse.js","../isSupported.js","../strategy.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:streams:7.4.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { Deferred } from 'workbox-core/_private/Deferred.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport './_version.js';\n/**\n * Takes either a Response, a ReadableStream, or a\n * [BodyInit](https://fetch.spec.whatwg.org/#bodyinit) and returns the\n * ReadableStreamReader object associated with it.\n *\n * @param {workbox-streams.StreamSource} source\n * @return {ReadableStreamReader}\n * @private\n */\nfunction _getReaderFromSource(source) {\n if (source instanceof Response) {\n // See https://github.com/GoogleChrome/workbox/issues/2998\n if (source.body) {\n return source.body.getReader();\n }\n throw new WorkboxError('opaque-streams-source', { type: source.type });\n }\n if (source instanceof ReadableStream) {\n return source.getReader();\n }\n return new Response(source).body.getReader();\n}\n/**\n * Takes multiple source Promises, each of which could resolve to a Response, a\n * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit).\n *\n * Returns an object exposing a ReadableStream with each individual stream's\n * data returned in sequence, along with a Promise which signals when the\n * stream is finished (useful for passing to a FetchEvent's waitUntil()).\n *\n * @param {Array>} sourcePromises\n * @return {Object<{done: Promise, stream: ReadableStream}>}\n *\n * @memberof workbox-streams\n */\nfunction concatenate(sourcePromises) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isArray(sourcePromises, {\n moduleName: 'workbox-streams',\n funcName: 'concatenate',\n paramName: 'sourcePromises',\n });\n }\n const readerPromises = sourcePromises.map((sourcePromise) => {\n return Promise.resolve(sourcePromise).then((source) => {\n return _getReaderFromSource(source);\n });\n });\n const streamDeferred = new Deferred();\n let i = 0;\n const logMessages = [];\n const stream = new ReadableStream({\n pull(controller) {\n return readerPromises[i]\n .then((reader) => {\n if (reader instanceof ReadableStreamDefaultReader) {\n return reader.read();\n }\n else {\n return;\n }\n })\n .then((result) => {\n if (result === null || result === void 0 ? void 0 : result.done) {\n if (process.env.NODE_ENV !== 'production') {\n logMessages.push([\n 'Reached the end of source:',\n sourcePromises[i],\n ]);\n }\n i++;\n if (i >= readerPromises.length) {\n // Log all the messages in the group at once in a single group.\n if (process.env.NODE_ENV !== 'production') {\n logger.groupCollapsed(`Concatenating ${readerPromises.length} sources.`);\n for (const message of logMessages) {\n if (Array.isArray(message)) {\n logger.log(...message);\n }\n else {\n logger.log(message);\n }\n }\n logger.log('Finished reading all sources.');\n logger.groupEnd();\n }\n controller.close();\n streamDeferred.resolve();\n return;\n }\n // The `pull` method is defined because we're inside it.\n return this.pull(controller);\n }\n else {\n controller.enqueue(result === null || result === void 0 ? void 0 : result.value);\n }\n })\n .catch((error) => {\n if (process.env.NODE_ENV !== 'production') {\n logger.error('An error occurred:', error);\n }\n streamDeferred.reject(error);\n throw error;\n });\n },\n cancel() {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn('The ReadableStream was cancelled.');\n }\n streamDeferred.resolve();\n },\n });\n return { done: streamDeferred.promise, stream };\n}\nexport { concatenate };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * This is a utility method that determines whether the current browser supports\n * the features required to create streamed responses. Currently, it checks if\n * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)\n * is available.\n *\n * @private\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {boolean} `true`, if the current browser meets the requirements for\n * streaming responses, and `false` otherwise.\n *\n * @memberof workbox-streams\n */\nfunction createHeaders(headersInit = {}) {\n // See https://github.com/GoogleChrome/workbox/issues/1461\n const headers = new Headers(headersInit);\n if (!headers.has('content-type')) {\n headers.set('content-type', 'text/html');\n }\n return headers;\n}\nexport { createHeaders };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { createHeaders } from './utils/createHeaders.js';\nimport { concatenate } from './concatenate.js';\nimport './_version.js';\n/**\n * Takes multiple source Promises, each of which could resolve to a Response, a\n * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit),\n * along with a\n * [HeadersInit](https://fetch.spec.whatwg.org/#typedefdef-headersinit).\n *\n * Returns an object exposing a Response whose body consists of each individual\n * stream's data returned in sequence, along with a Promise which signals when\n * the stream is finished (useful for passing to a FetchEvent's waitUntil()).\n *\n * @param {Array>} sourcePromises\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {Object<{done: Promise, response: Response}>}\n *\n * @memberof workbox-streams\n */\nfunction concatenateToResponse(sourcePromises, headersInit) {\n const { done, stream } = concatenate(sourcePromises);\n const headers = createHeaders(headersInit);\n const response = new Response(stream, { headers });\n return { done, response };\n}\nexport { concatenateToResponse };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { canConstructReadableStream } from 'workbox-core/_private/canConstructReadableStream.js';\nimport './_version.js';\n/**\n * This is a utility method that determines whether the current browser supports\n * the features required to create streamed responses. Currently, it checks if\n * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)\n * can be created.\n *\n * @return {boolean} `true`, if the current browser meets the requirements for\n * streaming responses, and `false` otherwise.\n *\n * @memberof workbox-streams\n */\nfunction isSupported() {\n return canConstructReadableStream();\n}\nexport { isSupported };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { createHeaders } from './utils/createHeaders.js';\nimport { concatenateToResponse } from './concatenateToResponse.js';\nimport { isSupported } from './isSupported.js';\nimport './_version.js';\n/**\n * A shortcut to create a strategy that could be dropped-in to Workbox's router.\n *\n * On browsers that do not support constructing new `ReadableStream`s, this\n * strategy will automatically wait for all the `sourceFunctions` to complete,\n * and create a final response that concatenates their values together.\n *\n * @param {Array} sourceFunctions\n * An array of functions similar to {@link workbox-routing~handlerCallback}\n * but that instead return a {@link workbox-streams.StreamSource} (or a\n * Promise which resolves to one).\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {workbox-routing~handlerCallback}\n * @memberof workbox-streams\n */\nfunction strategy(sourceFunctions, headersInit) {\n return async ({ event, request, url, params }) => {\n const sourcePromises = sourceFunctions.map((fn) => {\n // Ensure the return value of the function is always a promise.\n return Promise.resolve(fn({ event, request, url, params }));\n });\n if (isSupported()) {\n const { done, response } = concatenateToResponse(sourcePromises, headersInit);\n if (event) {\n event.waitUntil(done);\n }\n return response;\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`The current browser doesn't support creating response ` +\n `streams. Falling back to non-streaming response instead.`);\n }\n // Fallback to waiting for everything to finish, and concatenating the\n // responses.\n const blobPartsPromises = sourcePromises.map(async (sourcePromise) => {\n const source = await sourcePromise;\n if (source instanceof Response) {\n return source.blob();\n }\n else {\n // Technically, a `StreamSource` object can include any valid\n // `BodyInit` type, including `FormData` and `URLSearchParams`, which\n // cannot be passed to the Blob constructor directly, so we have to\n // convert them to actual Blobs first.\n return new Response(source).blob();\n }\n });\n const blobParts = await Promise.all(blobPartsPromises);\n const headers = createHeaders(headersInit);\n // Constructing a new Response from a Blob source is well-supported.\n // So is constructing a new Blob from multiple source Blobs or strings.\n return new Response(new Blob(blobParts), { headers });\n };\n}\nexport { strategy };\n"],"names":["self","_","e","_getReaderFromSource","source","Response","body","getReader","WorkboxError","type","ReadableStream","concatenate","sourcePromises","assert","isArray","moduleName","funcName","paramName","readerPromises","map","sourcePromise","Promise","resolve","then","streamDeferred","Deferred","i","logMessages","stream","pull","controller","reader","ReadableStreamDefaultReader","read","result","done","push","length","logger","groupCollapsed","message","Array","log","groupEnd","close","enqueue","value","catch","error","reject","cancel","warn","promise","createHeaders","headersInit","headers","Headers","has","set","concatenateToResponse","response","isSupported","canConstructReadableStream","strategy","sourceFunctions","event","request","url","params","fn","waitUntil","blobPartsPromises","blob","blobParts","all","Blob"],"mappings":"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"}
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-streams/build/workbox-streams.prod.js b/tools/ui/node_modules/workbox-streams/build/workbox-streams.prod.js
new file mode 100644
index 0000000000000000000000000000000000000000..498ee1763fce6fcec2a17f12ccd8231a138b8035
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/build/workbox-streams.prod.js
@@ -0,0 +1,2 @@
+this.workbox=this.workbox||{},this.workbox.streams=function(e,n,t,r){"use strict";try{self["workbox:streams:7.4.0"]&&_()}catch(e){}function s(e){const r=e.map((e=>Promise.resolve(e).then((e=>function(e){if(e instanceof Response){if(e.body)return e.body.getReader();throw new t.WorkboxError("opaque-streams-source",{type:e.type})}return e instanceof ReadableStream?e.getReader():new Response(e).body.getReader()}(e))))),s=new n.Deferred;let o=0;const a=new ReadableStream({pull(e){return r[o].then((e=>e instanceof ReadableStreamDefaultReader?e.read():void 0)).then((n=>{if(null==n?void 0:n.done)return o++,o>=r.length?(e.close(),void s.resolve()):this.pull(e);e.enqueue(null==n?void 0:n.value)})).catch((e=>{throw s.reject(e),e}))},cancel(){s.resolve()}});return{done:s.promise,stream:a}}function o(e={}){const n=new Headers(e);return n.has("content-type")||n.set("content-type","text/html"),n}function a(e,n){const{done:t,stream:r}=s(e),a=o(n);return{done:t,response:new Response(r,{headers:a})}}function u(){return r.canConstructReadableStream()}return e.concatenate=s,e.concatenateToResponse=a,e.isSupported=u,e.strategy=function(e,n){return async({event:t,request:r,url:s,params:c})=>{const i=e.map((e=>Promise.resolve(e({event:t,request:r,url:s,params:c}))));if(u()){const{done:e,response:r}=a(i,n);return t&&t.waitUntil(e),r}const f=i.map((async e=>{const n=await e;return n instanceof Response?n.blob():new Response(n).blob()})),l=await Promise.all(f),w=o(n);return new Response(new Blob(l),{headers:w})}},e}({},workbox.core._private,workbox.core._private,workbox.core._private);
+//# sourceMappingURL=workbox-streams.prod.js.map
diff --git a/tools/ui/node_modules/workbox-streams/build/workbox-streams.prod.js.map b/tools/ui/node_modules/workbox-streams/build/workbox-streams.prod.js.map
new file mode 100644
index 0000000000000000000000000000000000000000..8caa8722f24ce0e5819cc02aa62c9de146fcc6e2
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/build/workbox-streams.prod.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"workbox-streams.prod.js","sources":["../_version.js","../concatenate.js","../utils/createHeaders.js","../concatenateToResponse.js","../isSupported.js","../strategy.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:streams:7.4.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { Deferred } from 'workbox-core/_private/Deferred.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport './_version.js';\n/**\n * Takes either a Response, a ReadableStream, or a\n * [BodyInit](https://fetch.spec.whatwg.org/#bodyinit) and returns the\n * ReadableStreamReader object associated with it.\n *\n * @param {workbox-streams.StreamSource} source\n * @return {ReadableStreamReader}\n * @private\n */\nfunction _getReaderFromSource(source) {\n if (source instanceof Response) {\n // See https://github.com/GoogleChrome/workbox/issues/2998\n if (source.body) {\n return source.body.getReader();\n }\n throw new WorkboxError('opaque-streams-source', { type: source.type });\n }\n if (source instanceof ReadableStream) {\n return source.getReader();\n }\n return new Response(source).body.getReader();\n}\n/**\n * Takes multiple source Promises, each of which could resolve to a Response, a\n * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit).\n *\n * Returns an object exposing a ReadableStream with each individual stream's\n * data returned in sequence, along with a Promise which signals when the\n * stream is finished (useful for passing to a FetchEvent's waitUntil()).\n *\n * @param {Array>} sourcePromises\n * @return {Object<{done: Promise, stream: ReadableStream}>}\n *\n * @memberof workbox-streams\n */\nfunction concatenate(sourcePromises) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isArray(sourcePromises, {\n moduleName: 'workbox-streams',\n funcName: 'concatenate',\n paramName: 'sourcePromises',\n });\n }\n const readerPromises = sourcePromises.map((sourcePromise) => {\n return Promise.resolve(sourcePromise).then((source) => {\n return _getReaderFromSource(source);\n });\n });\n const streamDeferred = new Deferred();\n let i = 0;\n const logMessages = [];\n const stream = new ReadableStream({\n pull(controller) {\n return readerPromises[i]\n .then((reader) => {\n if (reader instanceof ReadableStreamDefaultReader) {\n return reader.read();\n }\n else {\n return;\n }\n })\n .then((result) => {\n if (result === null || result === void 0 ? void 0 : result.done) {\n if (process.env.NODE_ENV !== 'production') {\n logMessages.push([\n 'Reached the end of source:',\n sourcePromises[i],\n ]);\n }\n i++;\n if (i >= readerPromises.length) {\n // Log all the messages in the group at once in a single group.\n if (process.env.NODE_ENV !== 'production') {\n logger.groupCollapsed(`Concatenating ${readerPromises.length} sources.`);\n for (const message of logMessages) {\n if (Array.isArray(message)) {\n logger.log(...message);\n }\n else {\n logger.log(message);\n }\n }\n logger.log('Finished reading all sources.');\n logger.groupEnd();\n }\n controller.close();\n streamDeferred.resolve();\n return;\n }\n // The `pull` method is defined because we're inside it.\n return this.pull(controller);\n }\n else {\n controller.enqueue(result === null || result === void 0 ? void 0 : result.value);\n }\n })\n .catch((error) => {\n if (process.env.NODE_ENV !== 'production') {\n logger.error('An error occurred:', error);\n }\n streamDeferred.reject(error);\n throw error;\n });\n },\n cancel() {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn('The ReadableStream was cancelled.');\n }\n streamDeferred.resolve();\n },\n });\n return { done: streamDeferred.promise, stream };\n}\nexport { concatenate };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * This is a utility method that determines whether the current browser supports\n * the features required to create streamed responses. Currently, it checks if\n * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)\n * is available.\n *\n * @private\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {boolean} `true`, if the current browser meets the requirements for\n * streaming responses, and `false` otherwise.\n *\n * @memberof workbox-streams\n */\nfunction createHeaders(headersInit = {}) {\n // See https://github.com/GoogleChrome/workbox/issues/1461\n const headers = new Headers(headersInit);\n if (!headers.has('content-type')) {\n headers.set('content-type', 'text/html');\n }\n return headers;\n}\nexport { createHeaders };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { createHeaders } from './utils/createHeaders.js';\nimport { concatenate } from './concatenate.js';\nimport './_version.js';\n/**\n * Takes multiple source Promises, each of which could resolve to a Response, a\n * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit),\n * along with a\n * [HeadersInit](https://fetch.spec.whatwg.org/#typedefdef-headersinit).\n *\n * Returns an object exposing a Response whose body consists of each individual\n * stream's data returned in sequence, along with a Promise which signals when\n * the stream is finished (useful for passing to a FetchEvent's waitUntil()).\n *\n * @param {Array>} sourcePromises\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {Object<{done: Promise, response: Response}>}\n *\n * @memberof workbox-streams\n */\nfunction concatenateToResponse(sourcePromises, headersInit) {\n const { done, stream } = concatenate(sourcePromises);\n const headers = createHeaders(headersInit);\n const response = new Response(stream, { headers });\n return { done, response };\n}\nexport { concatenateToResponse };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { canConstructReadableStream } from 'workbox-core/_private/canConstructReadableStream.js';\nimport './_version.js';\n/**\n * This is a utility method that determines whether the current browser supports\n * the features required to create streamed responses. Currently, it checks if\n * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)\n * can be created.\n *\n * @return {boolean} `true`, if the current browser meets the requirements for\n * streaming responses, and `false` otherwise.\n *\n * @memberof workbox-streams\n */\nfunction isSupported() {\n return canConstructReadableStream();\n}\nexport { isSupported };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { createHeaders } from './utils/createHeaders.js';\nimport { concatenateToResponse } from './concatenateToResponse.js';\nimport { isSupported } from './isSupported.js';\nimport './_version.js';\n/**\n * A shortcut to create a strategy that could be dropped-in to Workbox's router.\n *\n * On browsers that do not support constructing new `ReadableStream`s, this\n * strategy will automatically wait for all the `sourceFunctions` to complete,\n * and create a final response that concatenates their values together.\n *\n * @param {Array} sourceFunctions\n * An array of functions similar to {@link workbox-routing~handlerCallback}\n * but that instead return a {@link workbox-streams.StreamSource} (or a\n * Promise which resolves to one).\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {workbox-routing~handlerCallback}\n * @memberof workbox-streams\n */\nfunction strategy(sourceFunctions, headersInit) {\n return async ({ event, request, url, params }) => {\n const sourcePromises = sourceFunctions.map((fn) => {\n // Ensure the return value of the function is always a promise.\n return Promise.resolve(fn({ event, request, url, params }));\n });\n if (isSupported()) {\n const { done, response } = concatenateToResponse(sourcePromises, headersInit);\n if (event) {\n event.waitUntil(done);\n }\n return response;\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`The current browser doesn't support creating response ` +\n `streams. Falling back to non-streaming response instead.`);\n }\n // Fallback to waiting for everything to finish, and concatenating the\n // responses.\n const blobPartsPromises = sourcePromises.map(async (sourcePromise) => {\n const source = await sourcePromise;\n if (source instanceof Response) {\n return source.blob();\n }\n else {\n // Technically, a `StreamSource` object can include any valid\n // `BodyInit` type, including `FormData` and `URLSearchParams`, which\n // cannot be passed to the Blob constructor directly, so we have to\n // convert them to actual Blobs first.\n return new Response(source).blob();\n }\n });\n const blobParts = await Promise.all(blobPartsPromises);\n const headers = createHeaders(headersInit);\n // Constructing a new Response from a Blob source is well-supported.\n // So is constructing a new Blob from multiple source Blobs or strings.\n return new Response(new Blob(blobParts), { headers });\n };\n}\nexport { strategy };\n"],"names":["self","_","e","concatenate","sourcePromises","readerPromises","map","sourcePromise","Promise","resolve","then","source","Response","body","getReader","WorkboxError","type","ReadableStream","_getReaderFromSource","streamDeferred","Deferred","i","stream","pull","controller","reader","ReadableStreamDefaultReader","read","result","done","length","close","this","enqueue","value","catch","error","reject","cancel","promise","createHeaders","headersInit","headers","Headers","has","set","concatenateToResponse","response","isSupported","canConstructReadableStream","sourceFunctions","async","event","request","url","params","fn","waitUntil","blobPartsPromises","blob","blobParts","all","Blob"],"mappings":"kFAEA,IACIA,KAAK,0BAA4BC,GACrC,CACA,MAAOC,GAAK,CC0CZ,SAASC,EAAYC,GAQjB,MAAMC,EAAiBD,EAAeE,KAAKC,GAChCC,QAAQC,QAAQF,GAAeG,MAAMC,GAnCpD,SAA8BA,GAC1B,GAAIA,aAAkBC,SAAU,CAE5B,GAAID,EAAOE,KACP,OAAOF,EAAOE,KAAKC,YAEvB,MAAM,IAAIC,EAAAA,aAAa,wBAAyB,CAAEC,KAAML,EAAOK,MACnE,CACA,OAAIL,aAAkBM,eACXN,EAAOG,YAEX,IAAIF,SAASD,GAAQE,KAAKC,WACrC,CAwBmBI,CAAqBP,OAG9BQ,EAAiB,IAAIC,WAC3B,IAAIC,EAAI,EAER,MAAMC,EAAS,IAAIL,eAAe,CAC9BM,KAAKC,GACD,OAAOnB,EAAegB,GACjBX,MAAMe,GACHA,aAAkBC,4BACXD,EAAOE,YAGd,IAGHjB,MAAMkB,IACP,GAAIA,aAAuC,EAASA,EAAOC,KAQvD,OADAR,IACIA,GAAKhB,EAAeyB,QAepBN,EAAWO,aACXZ,EAAeV,WAIZuB,KAAKT,KAAKC,GAGjBA,EAAWS,QAAQL,aAAuC,EAASA,EAAOM,MAC9E,IAECC,OAAOC,IAKR,MADAjB,EAAekB,OAAOD,GAChBA,CAAK,GAEnB,EACAE,SAIInB,EAAeV,SACnB,IAEJ,MAAO,CAAEoB,KAAMV,EAAeoB,QAASjB,SAC3C,CCvGA,SAASkB,EAAcC,EAAc,IAEjC,MAAMC,EAAU,IAAIC,QAAQF,GAI5B,OAHKC,EAAQE,IAAI,iBACbF,EAAQG,IAAI,eAAgB,aAEzBH,CACX,CCFA,SAASI,EAAsB1C,EAAgBqC,GAC3C,MAAMZ,KAAEA,EAAIP,OAAEA,GAAWnB,EAAYC,GAC/BsC,EAAUF,EAAcC,GAE9B,MAAO,CAAEZ,OAAMkB,SADE,IAAInC,SAASU,EAAQ,CAAEoB,YAE5C,CCZA,SAASM,IACL,OAAOC,8BACX,6ECMA,SAAkBC,EAAiBT,GAC/B,OAAOU,OAASC,QAAOC,UAASC,MAAKC,aACjC,MAAMnD,EAAiB8C,EAAgB5C,KAAKkD,GAEjChD,QAAQC,QAAQ+C,EAAG,CAAEJ,QAAOC,UAASC,MAAKC,cAErD,GAAIP,IAAe,CACf,MAAMnB,KAAEA,EAAIkB,SAAEA,GAAaD,EAAsB1C,EAAgBqC,GAIjE,OAHIW,GACAA,EAAMK,UAAU5B,GAEbkB,CACX,CAOA,MAAMW,EAAoBtD,EAAeE,KAAI6C,UACzC,MAAMxC,QAAeJ,EACrB,OAAII,aAAkBC,SACXD,EAAOgD,OAOP,IAAI/C,SAASD,GAAQgD,MAChC,IAEEC,QAAkBpD,QAAQqD,IAAIH,GAC9BhB,EAAUF,EAAcC,GAG9B,OAAO,IAAI7B,SAAS,IAAIkD,KAAKF,GAAY,CAAElB,WAAU,CAE7D"}
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-streams/concatenate.d.ts b/tools/ui/node_modules/workbox-streams/concatenate.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6135131bcec3b9c4c0b87200910ea32ba4b810d8
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/concatenate.d.ts
@@ -0,0 +1,20 @@
+import { StreamSource } from './_types.js';
+import './_version.js';
+/**
+ * Takes multiple source Promises, each of which could resolve to a Response, a
+ * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit).
+ *
+ * Returns an object exposing a ReadableStream with each individual stream's
+ * data returned in sequence, along with a Promise which signals when the
+ * stream is finished (useful for passing to a FetchEvent's waitUntil()).
+ *
+ * @param {Array>} sourcePromises
+ * @return {Object<{done: Promise, stream: ReadableStream}>}
+ *
+ * @memberof workbox-streams
+ */
+declare function concatenate(sourcePromises: Promise[]): {
+ done: Promise;
+ stream: ReadableStream;
+};
+export { concatenate };
diff --git a/tools/ui/node_modules/workbox-streams/concatenate.js b/tools/ui/node_modules/workbox-streams/concatenate.js
new file mode 100644
index 0000000000000000000000000000000000000000..5d34f2301083c59f5e946a95d4e3cec2d746aaf8
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/concatenate.js
@@ -0,0 +1,127 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+import { assert } from 'workbox-core/_private/assert.js';
+import { Deferred } from 'workbox-core/_private/Deferred.js';
+import { logger } from 'workbox-core/_private/logger.js';
+import { WorkboxError } from 'workbox-core/_private/WorkboxError.js';
+import './_version.js';
+/**
+ * Takes either a Response, a ReadableStream, or a
+ * [BodyInit](https://fetch.spec.whatwg.org/#bodyinit) and returns the
+ * ReadableStreamReader object associated with it.
+ *
+ * @param {workbox-streams.StreamSource} source
+ * @return {ReadableStreamReader}
+ * @private
+ */
+function _getReaderFromSource(source) {
+ if (source instanceof Response) {
+ // See https://github.com/GoogleChrome/workbox/issues/2998
+ if (source.body) {
+ return source.body.getReader();
+ }
+ throw new WorkboxError('opaque-streams-source', { type: source.type });
+ }
+ if (source instanceof ReadableStream) {
+ return source.getReader();
+ }
+ return new Response(source).body.getReader();
+}
+/**
+ * Takes multiple source Promises, each of which could resolve to a Response, a
+ * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit).
+ *
+ * Returns an object exposing a ReadableStream with each individual stream's
+ * data returned in sequence, along with a Promise which signals when the
+ * stream is finished (useful for passing to a FetchEvent's waitUntil()).
+ *
+ * @param {Array>} sourcePromises
+ * @return {Object<{done: Promise, stream: ReadableStream}>}
+ *
+ * @memberof workbox-streams
+ */
+function concatenate(sourcePromises) {
+ if (process.env.NODE_ENV !== 'production') {
+ assert.isArray(sourcePromises, {
+ moduleName: 'workbox-streams',
+ funcName: 'concatenate',
+ paramName: 'sourcePromises',
+ });
+ }
+ const readerPromises = sourcePromises.map((sourcePromise) => {
+ return Promise.resolve(sourcePromise).then((source) => {
+ return _getReaderFromSource(source);
+ });
+ });
+ const streamDeferred = new Deferred();
+ let i = 0;
+ const logMessages = [];
+ const stream = new ReadableStream({
+ pull(controller) {
+ return readerPromises[i]
+ .then((reader) => {
+ if (reader instanceof ReadableStreamDefaultReader) {
+ return reader.read();
+ }
+ else {
+ return;
+ }
+ })
+ .then((result) => {
+ if (result === null || result === void 0 ? void 0 : result.done) {
+ if (process.env.NODE_ENV !== 'production') {
+ logMessages.push([
+ 'Reached the end of source:',
+ sourcePromises[i],
+ ]);
+ }
+ i++;
+ if (i >= readerPromises.length) {
+ // Log all the messages in the group at once in a single group.
+ if (process.env.NODE_ENV !== 'production') {
+ logger.groupCollapsed(`Concatenating ${readerPromises.length} sources.`);
+ for (const message of logMessages) {
+ if (Array.isArray(message)) {
+ logger.log(...message);
+ }
+ else {
+ logger.log(message);
+ }
+ }
+ logger.log('Finished reading all sources.');
+ logger.groupEnd();
+ }
+ controller.close();
+ streamDeferred.resolve();
+ return;
+ }
+ // The `pull` method is defined because we're inside it.
+ return this.pull(controller);
+ }
+ else {
+ controller.enqueue(result === null || result === void 0 ? void 0 : result.value);
+ }
+ })
+ .catch((error) => {
+ if (process.env.NODE_ENV !== 'production') {
+ logger.error('An error occurred:', error);
+ }
+ streamDeferred.reject(error);
+ throw error;
+ });
+ },
+ cancel() {
+ if (process.env.NODE_ENV !== 'production') {
+ logger.warn('The ReadableStream was cancelled.');
+ }
+ streamDeferred.resolve();
+ },
+ });
+ return { done: streamDeferred.promise, stream };
+}
+export { concatenate };
diff --git a/tools/ui/node_modules/workbox-streams/concatenate.mjs b/tools/ui/node_modules/workbox-streams/concatenate.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..1b37f7a838f920249a0701c4a68a139d3d798f51
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/concatenate.mjs
@@ -0,0 +1 @@
+export * from './concatenate.js';
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-streams/concatenateToResponse.d.ts b/tools/ui/node_modules/workbox-streams/concatenateToResponse.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..9d732892b9261ff7e73ad268e21668cf455b5263
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/concatenateToResponse.d.ts
@@ -0,0 +1,24 @@
+import { StreamSource } from './_types.js';
+import './_version.js';
+/**
+ * Takes multiple source Promises, each of which could resolve to a Response, a
+ * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit),
+ * along with a
+ * [HeadersInit](https://fetch.spec.whatwg.org/#typedefdef-headersinit).
+ *
+ * Returns an object exposing a Response whose body consists of each individual
+ * stream's data returned in sequence, along with a Promise which signals when
+ * the stream is finished (useful for passing to a FetchEvent's waitUntil()).
+ *
+ * @param {Array>} sourcePromises
+ * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
+ * `'text/html'` will be used by default.
+ * @return {Object<{done: Promise, response: Response}>}
+ *
+ * @memberof workbox-streams
+ */
+declare function concatenateToResponse(sourcePromises: Promise[], headersInit: HeadersInit): {
+ done: Promise;
+ response: Response;
+};
+export { concatenateToResponse };
diff --git a/tools/ui/node_modules/workbox-streams/concatenateToResponse.js b/tools/ui/node_modules/workbox-streams/concatenateToResponse.js
new file mode 100644
index 0000000000000000000000000000000000000000..8eb81a19c3288c1acab051b5c4e14479b13f2921
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/concatenateToResponse.js
@@ -0,0 +1,34 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+import { createHeaders } from './utils/createHeaders.js';
+import { concatenate } from './concatenate.js';
+import './_version.js';
+/**
+ * Takes multiple source Promises, each of which could resolve to a Response, a
+ * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit),
+ * along with a
+ * [HeadersInit](https://fetch.spec.whatwg.org/#typedefdef-headersinit).
+ *
+ * Returns an object exposing a Response whose body consists of each individual
+ * stream's data returned in sequence, along with a Promise which signals when
+ * the stream is finished (useful for passing to a FetchEvent's waitUntil()).
+ *
+ * @param {Array>} sourcePromises
+ * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
+ * `'text/html'` will be used by default.
+ * @return {Object<{done: Promise, response: Response}>}
+ *
+ * @memberof workbox-streams
+ */
+function concatenateToResponse(sourcePromises, headersInit) {
+ const { done, stream } = concatenate(sourcePromises);
+ const headers = createHeaders(headersInit);
+ const response = new Response(stream, { headers });
+ return { done, response };
+}
+export { concatenateToResponse };
diff --git a/tools/ui/node_modules/workbox-streams/concatenateToResponse.mjs b/tools/ui/node_modules/workbox-streams/concatenateToResponse.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..28a2e2cb0101ccaf18f699997b6fa280400c896d
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/concatenateToResponse.mjs
@@ -0,0 +1 @@
+export * from './concatenateToResponse.js';
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-streams/index.d.ts b/tools/ui/node_modules/workbox-streams/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..b8ea5123508d261fc7d50b823ab3adcb9bc2a541
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/index.d.ts
@@ -0,0 +1,10 @@
+import { concatenate } from './concatenate.js';
+import { concatenateToResponse } from './concatenateToResponse.js';
+import { isSupported } from './isSupported.js';
+import { strategy, StreamsHandlerCallback } from './strategy.js';
+import './_version.js';
+/**
+ * @module workbox-streams
+ */
+export { concatenate, concatenateToResponse, isSupported, strategy, StreamsHandlerCallback, };
+export * from './_types.js';
diff --git a/tools/ui/node_modules/workbox-streams/index.js b/tools/ui/node_modules/workbox-streams/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..93d8ca7c786204d9fb4abfa5f8d23c5577e8c4ee
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/index.js
@@ -0,0 +1,17 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+import { concatenate } from './concatenate.js';
+import { concatenateToResponse } from './concatenateToResponse.js';
+import { isSupported } from './isSupported.js';
+import { strategy } from './strategy.js';
+import './_version.js';
+/**
+ * @module workbox-streams
+ */
+export { concatenate, concatenateToResponse, isSupported, strategy, };
+export * from './_types.js';
diff --git a/tools/ui/node_modules/workbox-streams/index.mjs b/tools/ui/node_modules/workbox-streams/index.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..833b6a2f3226fec78490a3b7a622dc5146f94b53
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/index.mjs
@@ -0,0 +1 @@
+export * from './index.js';
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-streams/isSupported.d.ts b/tools/ui/node_modules/workbox-streams/isSupported.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e588b35cfcbbedf3ed4d89318a9a66118e7859f1
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/isSupported.d.ts
@@ -0,0 +1,14 @@
+import './_version.js';
+/**
+ * This is a utility method that determines whether the current browser supports
+ * the features required to create streamed responses. Currently, it checks if
+ * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
+ * can be created.
+ *
+ * @return {boolean} `true`, if the current browser meets the requirements for
+ * streaming responses, and `false` otherwise.
+ *
+ * @memberof workbox-streams
+ */
+declare function isSupported(): boolean;
+export { isSupported };
diff --git a/tools/ui/node_modules/workbox-streams/isSupported.js b/tools/ui/node_modules/workbox-streams/isSupported.js
new file mode 100644
index 0000000000000000000000000000000000000000..97afd40b67313997ddf8ba814c777a90f40ef75a
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/isSupported.js
@@ -0,0 +1,24 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+import { canConstructReadableStream } from 'workbox-core/_private/canConstructReadableStream.js';
+import './_version.js';
+/**
+ * This is a utility method that determines whether the current browser supports
+ * the features required to create streamed responses. Currently, it checks if
+ * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
+ * can be created.
+ *
+ * @return {boolean} `true`, if the current browser meets the requirements for
+ * streaming responses, and `false` otherwise.
+ *
+ * @memberof workbox-streams
+ */
+function isSupported() {
+ return canConstructReadableStream();
+}
+export { isSupported };
diff --git a/tools/ui/node_modules/workbox-streams/isSupported.mjs b/tools/ui/node_modules/workbox-streams/isSupported.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..e4ec954938b7476095238ddcdab20e8f49b69f0b
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/isSupported.mjs
@@ -0,0 +1 @@
+export * from './isSupported.js';
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-streams/package.json b/tools/ui/node_modules/workbox-streams/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..48624dfff38947ccd0dd54d2893d8b560edcef22
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/package.json
@@ -0,0 +1,33 @@
+{
+ "name": "workbox-streams",
+ "version": "7.4.1",
+ "license": "MIT",
+ "author": "Google's Web DevRel Team and Google's Aurora Team",
+ "description": "A library that makes it easier to work with Streams in the browser.",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/googlechrome/workbox.git"
+ },
+ "bugs": "https://github.com/googlechrome/workbox/issues",
+ "homepage": "https://github.com/GoogleChrome/workbox",
+ "keywords": [
+ "workbox",
+ "workboxjs",
+ "service worker",
+ "sw",
+ "streams",
+ "readablestream"
+ ],
+ "workbox": {
+ "browserNamespace": "workbox.streams",
+ "packageType": "sw"
+ },
+ "main": "index.js",
+ "module": "index.mjs",
+ "types": "index.d.ts",
+ "dependencies": {
+ "workbox-core": "7.4.1",
+ "workbox-routing": "7.4.1"
+ },
+ "gitHead": "62b9d8ba8eb3c1a2ab8aac9d84c90cda7865d6a3"
+}
diff --git a/tools/ui/node_modules/workbox-streams/src/_types.ts b/tools/ui/node_modules/workbox-streams/src/_types.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2a3f3878c6579497520e1ec8a3a0aef66a4e3bea
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/src/_types.ts
@@ -0,0 +1,23 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import './_version.js';
+
+export type StreamSource = Response | ReadableStream | BodyInit;
+
+// * * * IMPORTANT! * * *
+// ------------------------------------------------------------------------- //
+// jdsoc type definitions cannot be declared above TypeScript definitions or
+// they'll be stripped from the built `.js` files, and they'll only be in the
+// `d.ts` files, which aren't read by the jsdoc generator. As a result we
+// have to put declare them below.
+
+/**
+ * @typedef {Response|ReadableStream|BodyInit} StreamSource
+ * @memberof workbox-streams
+ */
diff --git a/tools/ui/node_modules/workbox-streams/src/_version.ts b/tools/ui/node_modules/workbox-streams/src/_version.ts
new file mode 100644
index 0000000000000000000000000000000000000000..46a1ed83ce0703daa5c10756c52da5b8be6b01ce
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/src/_version.ts
@@ -0,0 +1,2 @@
+// @ts-ignore
+try{self['workbox:streams:7.4.1']&&_()}catch(e){}
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-streams/src/concatenate.ts b/tools/ui/node_modules/workbox-streams/src/concatenate.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c6ba329f6d314d54c9ab6058e1e309585c49f2f1
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/src/concatenate.ts
@@ -0,0 +1,146 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import {assert} from 'workbox-core/_private/assert.js';
+import {Deferred} from 'workbox-core/_private/Deferred.js';
+import {logger} from 'workbox-core/_private/logger.js';
+import {StreamSource} from './_types.js';
+import {WorkboxError} from 'workbox-core/_private/WorkboxError.js';
+
+import './_version.js';
+
+/**
+ * Takes either a Response, a ReadableStream, or a
+ * [BodyInit](https://fetch.spec.whatwg.org/#bodyinit) and returns the
+ * ReadableStreamReader object associated with it.
+ *
+ * @param {workbox-streams.StreamSource} source
+ * @return {ReadableStreamReader}
+ * @private
+ */
+function _getReaderFromSource(
+ source: StreamSource,
+): ReadableStreamReader {
+ if (source instanceof Response) {
+ // See https://github.com/GoogleChrome/workbox/issues/2998
+ if (source.body) {
+ return source.body.getReader();
+ }
+ throw new WorkboxError('opaque-streams-source', {type: source.type});
+ }
+ if (source instanceof ReadableStream) {
+ return source.getReader();
+ }
+ return new Response(source as BodyInit).body!.getReader();
+}
+
+/**
+ * Takes multiple source Promises, each of which could resolve to a Response, a
+ * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit).
+ *
+ * Returns an object exposing a ReadableStream with each individual stream's
+ * data returned in sequence, along with a Promise which signals when the
+ * stream is finished (useful for passing to a FetchEvent's waitUntil()).
+ *
+ * @param {Array>} sourcePromises
+ * @return {Object<{done: Promise, stream: ReadableStream}>}
+ *
+ * @memberof workbox-streams
+ */
+function concatenate(sourcePromises: Promise[]): {
+ done: Promise;
+ stream: ReadableStream;
+} {
+ if (process.env.NODE_ENV !== 'production') {
+ assert!.isArray(sourcePromises, {
+ moduleName: 'workbox-streams',
+ funcName: 'concatenate',
+ paramName: 'sourcePromises',
+ });
+ }
+
+ const readerPromises = sourcePromises.map((sourcePromise) => {
+ return Promise.resolve(sourcePromise).then((source) => {
+ return _getReaderFromSource(source);
+ });
+ });
+
+ const streamDeferred: Deferred = new Deferred();
+
+ let i = 0;
+ const logMessages: any[] = [];
+ const stream = new ReadableStream({
+ pull(controller: ReadableStreamDefaultController) {
+ return readerPromises[i]
+ .then((reader) => {
+ if (reader instanceof ReadableStreamDefaultReader) {
+ return reader.read();
+ } else {
+ return;
+ }
+ })
+ .then((result) => {
+ if (result?.done) {
+ if (process.env.NODE_ENV !== 'production') {
+ logMessages.push([
+ 'Reached the end of source:',
+ sourcePromises[i],
+ ]);
+ }
+
+ i++;
+ if (i >= readerPromises.length) {
+ // Log all the messages in the group at once in a single group.
+ if (process.env.NODE_ENV !== 'production') {
+ logger.groupCollapsed(
+ `Concatenating ${readerPromises.length} sources.`,
+ );
+ for (const message of logMessages) {
+ if (Array.isArray(message)) {
+ logger.log(...message);
+ } else {
+ logger.log(message);
+ }
+ }
+ logger.log('Finished reading all sources.');
+ logger.groupEnd();
+ }
+
+ controller.close();
+ streamDeferred.resolve();
+ return;
+ }
+
+ // The `pull` method is defined because we're inside it.
+ return this.pull!(controller);
+ } else {
+ controller.enqueue(result?.value);
+ }
+ })
+ .catch((error) => {
+ if (process.env.NODE_ENV !== 'production') {
+ logger.error('An error occurred:', error);
+ }
+ streamDeferred.reject(error);
+ throw error;
+ });
+ },
+
+ cancel() {
+ if (process.env.NODE_ENV !== 'production') {
+ logger.warn('The ReadableStream was cancelled.');
+ }
+
+ streamDeferred.resolve();
+ },
+ });
+
+ return {done: streamDeferred.promise, stream};
+}
+
+export {concatenate};
diff --git a/tools/ui/node_modules/workbox-streams/src/concatenateToResponse.ts b/tools/ui/node_modules/workbox-streams/src/concatenateToResponse.ts
new file mode 100644
index 0000000000000000000000000000000000000000..5e45fbbc1bc477d1c250df9bf0138bc01523be2d
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/src/concatenateToResponse.ts
@@ -0,0 +1,43 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import {createHeaders} from './utils/createHeaders.js';
+import {concatenate} from './concatenate.js';
+import {StreamSource} from './_types.js';
+import './_version.js';
+
+/**
+ * Takes multiple source Promises, each of which could resolve to a Response, a
+ * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit),
+ * along with a
+ * [HeadersInit](https://fetch.spec.whatwg.org/#typedefdef-headersinit).
+ *
+ * Returns an object exposing a Response whose body consists of each individual
+ * stream's data returned in sequence, along with a Promise which signals when
+ * the stream is finished (useful for passing to a FetchEvent's waitUntil()).
+ *
+ * @param {Array>} sourcePromises
+ * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
+ * `'text/html'` will be used by default.
+ * @return {Object<{done: Promise, response: Response}>}
+ *
+ * @memberof workbox-streams
+ */
+function concatenateToResponse(
+ sourcePromises: Promise[],
+ headersInit: HeadersInit,
+): {done: Promise; response: Response} {
+ const {done, stream} = concatenate(sourcePromises);
+
+ const headers = createHeaders(headersInit);
+ const response = new Response(stream, {headers});
+
+ return {done, response};
+}
+
+export {concatenateToResponse};
diff --git a/tools/ui/node_modules/workbox-streams/src/index.ts b/tools/ui/node_modules/workbox-streams/src/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e4c929465aa1ca9b288641b97c65f132c737fa6f
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/src/index.ts
@@ -0,0 +1,28 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import {concatenate} from './concatenate.js';
+import {concatenateToResponse} from './concatenateToResponse.js';
+import {isSupported} from './isSupported.js';
+import {strategy, StreamsHandlerCallback} from './strategy.js';
+
+import './_version.js';
+
+/**
+ * @module workbox-streams
+ */
+
+export {
+ concatenate,
+ concatenateToResponse,
+ isSupported,
+ strategy,
+ StreamsHandlerCallback,
+};
+
+export * from './_types.js';
diff --git a/tools/ui/node_modules/workbox-streams/src/isSupported.ts b/tools/ui/node_modules/workbox-streams/src/isSupported.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d6107ee7dd61e3bf40b356f9fc6f53487a63b355
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/src/isSupported.ts
@@ -0,0 +1,27 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import {canConstructReadableStream} from 'workbox-core/_private/canConstructReadableStream.js';
+import './_version.js';
+
+/**
+ * This is a utility method that determines whether the current browser supports
+ * the features required to create streamed responses. Currently, it checks if
+ * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
+ * can be created.
+ *
+ * @return {boolean} `true`, if the current browser meets the requirements for
+ * streaming responses, and `false` otherwise.
+ *
+ * @memberof workbox-streams
+ */
+function isSupported(): boolean {
+ return canConstructReadableStream();
+}
+
+export {isSupported};
diff --git a/tools/ui/node_modules/workbox-streams/src/strategy.ts b/tools/ui/node_modules/workbox-streams/src/strategy.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f90cd378561918b6b1be6c5640b18704beafbd51
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/src/strategy.ts
@@ -0,0 +1,94 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import {logger} from 'workbox-core/_private/logger.js';
+import {
+ RouteHandlerCallback,
+ RouteHandlerCallbackOptions,
+} from 'workbox-core/types.js';
+import {createHeaders} from './utils/createHeaders.js';
+import {concatenateToResponse} from './concatenateToResponse.js';
+import {isSupported} from './isSupported.js';
+import {StreamSource} from './_types.js';
+import './_version.js';
+
+export interface StreamsHandlerCallback {
+ ({url, request, event, params}: RouteHandlerCallbackOptions):
+ | Promise
+ | StreamSource;
+}
+
+/**
+ * A shortcut to create a strategy that could be dropped-in to Workbox's router.
+ *
+ * On browsers that do not support constructing new `ReadableStream`s, this
+ * strategy will automatically wait for all the `sourceFunctions` to complete,
+ * and create a final response that concatenates their values together.
+ *
+ * @param {Array} sourceFunctions
+ * An array of functions similar to {@link workbox-routing~handlerCallback}
+ * but that instead return a {@link workbox-streams.StreamSource} (or a
+ * Promise which resolves to one).
+ * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
+ * `'text/html'` will be used by default.
+ * @return {workbox-routing~handlerCallback}
+ * @memberof workbox-streams
+ */
+function strategy(
+ sourceFunctions: StreamsHandlerCallback[],
+ headersInit: HeadersInit,
+): RouteHandlerCallback {
+ return async ({event, request, url, params}: RouteHandlerCallbackOptions) => {
+ const sourcePromises = sourceFunctions.map((fn) => {
+ // Ensure the return value of the function is always a promise.
+ return Promise.resolve(fn({event, request, url, params}));
+ });
+
+ if (isSupported()) {
+ const {done, response} = concatenateToResponse(
+ sourcePromises,
+ headersInit,
+ );
+
+ if (event) {
+ event.waitUntil(done);
+ }
+ return response;
+ }
+
+ if (process.env.NODE_ENV !== 'production') {
+ logger.log(
+ `The current browser doesn't support creating response ` +
+ `streams. Falling back to non-streaming response instead.`,
+ );
+ }
+
+ // Fallback to waiting for everything to finish, and concatenating the
+ // responses.
+ const blobPartsPromises = sourcePromises.map(async (sourcePromise) => {
+ const source = await sourcePromise;
+ if (source instanceof Response) {
+ return source.blob();
+ } else {
+ // Technically, a `StreamSource` object can include any valid
+ // `BodyInit` type, including `FormData` and `URLSearchParams`, which
+ // cannot be passed to the Blob constructor directly, so we have to
+ // convert them to actual Blobs first.
+ return new Response(source).blob();
+ }
+ });
+ const blobParts = await Promise.all(blobPartsPromises);
+ const headers = createHeaders(headersInit);
+
+ // Constructing a new Response from a Blob source is well-supported.
+ // So is constructing a new Blob from multiple source Blobs or strings.
+ return new Response(new Blob(blobParts), {headers});
+ };
+}
+
+export {strategy};
diff --git a/tools/ui/node_modules/workbox-streams/src/utils/createHeaders.ts b/tools/ui/node_modules/workbox-streams/src/utils/createHeaders.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c3e51b94465af09ef6e15d065f889e8e58cccfc9
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/src/utils/createHeaders.ts
@@ -0,0 +1,34 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import '../_version.js';
+
+/**
+ * This is a utility method that determines whether the current browser supports
+ * the features required to create streamed responses. Currently, it checks if
+ * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
+ * is available.
+ *
+ * @private
+ * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
+ * `'text/html'` will be used by default.
+ * @return {boolean} `true`, if the current browser meets the requirements for
+ * streaming responses, and `false` otherwise.
+ *
+ * @memberof workbox-streams
+ */
+function createHeaders(headersInit = {}): Headers {
+ // See https://github.com/GoogleChrome/workbox/issues/1461
+ const headers = new Headers(headersInit);
+ if (!headers.has('content-type')) {
+ headers.set('content-type', 'text/html');
+ }
+ return headers;
+}
+
+export {createHeaders};
diff --git a/tools/ui/node_modules/workbox-streams/strategy.d.ts b/tools/ui/node_modules/workbox-streams/strategy.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..5c5f53affd94368ebb54a6597ee6fb9b655c65a1
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/strategy.d.ts
@@ -0,0 +1,24 @@
+import { RouteHandlerCallback, RouteHandlerCallbackOptions } from 'workbox-core/types.js';
+import { StreamSource } from './_types.js';
+import './_version.js';
+export interface StreamsHandlerCallback {
+ ({ url, request, event, params }: RouteHandlerCallbackOptions): Promise | StreamSource;
+}
+/**
+ * A shortcut to create a strategy that could be dropped-in to Workbox's router.
+ *
+ * On browsers that do not support constructing new `ReadableStream`s, this
+ * strategy will automatically wait for all the `sourceFunctions` to complete,
+ * and create a final response that concatenates their values together.
+ *
+ * @param {Array} sourceFunctions
+ * An array of functions similar to {@link workbox-routing~handlerCallback}
+ * but that instead return a {@link workbox-streams.StreamSource} (or a
+ * Promise which resolves to one).
+ * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
+ * `'text/html'` will be used by default.
+ * @return {workbox-routing~handlerCallback}
+ * @memberof workbox-streams
+ */
+declare function strategy(sourceFunctions: StreamsHandlerCallback[], headersInit: HeadersInit): RouteHandlerCallback;
+export { strategy };
diff --git a/tools/ui/node_modules/workbox-streams/strategy.js b/tools/ui/node_modules/workbox-streams/strategy.js
new file mode 100644
index 0000000000000000000000000000000000000000..227abd81ba4fcdb69b3738d30a4dbf0017ec3a1f
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/strategy.js
@@ -0,0 +1,68 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+import { logger } from 'workbox-core/_private/logger.js';
+import { createHeaders } from './utils/createHeaders.js';
+import { concatenateToResponse } from './concatenateToResponse.js';
+import { isSupported } from './isSupported.js';
+import './_version.js';
+/**
+ * A shortcut to create a strategy that could be dropped-in to Workbox's router.
+ *
+ * On browsers that do not support constructing new `ReadableStream`s, this
+ * strategy will automatically wait for all the `sourceFunctions` to complete,
+ * and create a final response that concatenates their values together.
+ *
+ * @param {Array} sourceFunctions
+ * An array of functions similar to {@link workbox-routing~handlerCallback}
+ * but that instead return a {@link workbox-streams.StreamSource} (or a
+ * Promise which resolves to one).
+ * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
+ * `'text/html'` will be used by default.
+ * @return {workbox-routing~handlerCallback}
+ * @memberof workbox-streams
+ */
+function strategy(sourceFunctions, headersInit) {
+ return async ({ event, request, url, params }) => {
+ const sourcePromises = sourceFunctions.map((fn) => {
+ // Ensure the return value of the function is always a promise.
+ return Promise.resolve(fn({ event, request, url, params }));
+ });
+ if (isSupported()) {
+ const { done, response } = concatenateToResponse(sourcePromises, headersInit);
+ if (event) {
+ event.waitUntil(done);
+ }
+ return response;
+ }
+ if (process.env.NODE_ENV !== 'production') {
+ logger.log(`The current browser doesn't support creating response ` +
+ `streams. Falling back to non-streaming response instead.`);
+ }
+ // Fallback to waiting for everything to finish, and concatenating the
+ // responses.
+ const blobPartsPromises = sourcePromises.map(async (sourcePromise) => {
+ const source = await sourcePromise;
+ if (source instanceof Response) {
+ return source.blob();
+ }
+ else {
+ // Technically, a `StreamSource` object can include any valid
+ // `BodyInit` type, including `FormData` and `URLSearchParams`, which
+ // cannot be passed to the Blob constructor directly, so we have to
+ // convert them to actual Blobs first.
+ return new Response(source).blob();
+ }
+ });
+ const blobParts = await Promise.all(blobPartsPromises);
+ const headers = createHeaders(headersInit);
+ // Constructing a new Response from a Blob source is well-supported.
+ // So is constructing a new Blob from multiple source Blobs or strings.
+ return new Response(new Blob(blobParts), { headers });
+ };
+}
+export { strategy };
diff --git a/tools/ui/node_modules/workbox-streams/strategy.mjs b/tools/ui/node_modules/workbox-streams/strategy.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..92a4cc2261db7044f7c5d87410a6a784efd3c811
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/strategy.mjs
@@ -0,0 +1 @@
+export * from './strategy.js';
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-streams/tsconfig.json b/tools/ui/node_modules/workbox-streams/tsconfig.json
new file mode 100644
index 0000000000000000000000000000000000000000..2457eadcf8e39664b6315f538007e7de076be21d
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/tsconfig.json
@@ -0,0 +1,10 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "./",
+ "rootDir": "./src",
+ "tsBuildInfoFile": "./tsconfig.tsbuildinfo"
+ },
+ "include": ["src/**/*.ts"],
+ "references": [{"path": "../workbox-core/"}]
+}
diff --git a/tools/ui/node_modules/workbox-streams/tsconfig.tsbuildinfo b/tools/ui/node_modules/workbox-streams/tsconfig.tsbuildinfo
new file mode 100644
index 0000000000000000000000000000000000000000..014bbd925beae5134e602ee727bf8d2958d87a4e
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/tsconfig.tsbuildinfo
@@ -0,0 +1 @@
+{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.webworker.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../infra/type-overrides.d.ts","./src/_version.ts","./src/_types.ts","../workbox-core/_version.d.ts","../workbox-core/types.d.ts","../workbox-core/_private/assert.d.ts","../workbox-core/_private/deferred.d.ts","../workbox-core/_private/logger.d.ts","../workbox-core/_private/workboxerror.d.ts","./src/concatenate.ts","./src/utils/createheaders.ts","./src/concatenatetoresponse.ts","../workbox-core/_private/canconstructreadablestream.d.ts","./src/issupported.ts","./src/strategy.ts","./src/index.ts","../../node_modules/@babel/types/lib/index.d.ts","../../node_modules/@types/babel__generator/index.d.ts","../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../node_modules/@types/babel__template/index.d.ts","../../node_modules/@types/babel__traverse/index.d.ts","../../node_modules/@types/babel__core/index.d.ts","../../node_modules/@types/babel__preset-env/index.d.ts","../../node_modules/@types/common-tags/index.d.ts","../../node_modules/@types/eslint/helpers.d.ts","../../node_modules/@types/estree/index.d.ts","../../node_modules/@types/json-schema/index.d.ts","../../node_modules/@types/eslint/index.d.ts","../../node_modules/@types/eslint-scope/index.d.ts","../../node_modules/@types/node/compatibility/disposable.d.ts","../../node_modules/@types/node/compatibility/indexable.d.ts","../../node_modules/@types/node/compatibility/iterators.d.ts","../../node_modules/@types/node/compatibility/index.d.ts","../../node_modules/@types/node/ts5.6/globals.typedarray.d.ts","../../node_modules/@types/node/ts5.6/buffer.buffer.d.ts","../../node_modules/undici-types/header.d.ts","../../node_modules/undici-types/readable.d.ts","../../node_modules/undici-types/file.d.ts","../../node_modules/undici-types/fetch.d.ts","../../node_modules/undici-types/formdata.d.ts","../../node_modules/undici-types/connector.d.ts","../../node_modules/undici-types/client.d.ts","../../node_modules/undici-types/errors.d.ts","../../node_modules/undici-types/dispatcher.d.ts","../../node_modules/undici-types/global-dispatcher.d.ts","../../node_modules/undici-types/global-origin.d.ts","../../node_modules/undici-types/pool-stats.d.ts","../../node_modules/undici-types/pool.d.ts","../../node_modules/undici-types/handlers.d.ts","../../node_modules/undici-types/balanced-pool.d.ts","../../node_modules/undici-types/agent.d.ts","../../node_modules/undici-types/mock-interceptor.d.ts","../../node_modules/undici-types/mock-agent.d.ts","../../node_modules/undici-types/mock-client.d.ts","../../node_modules/undici-types/mock-pool.d.ts","../../node_modules/undici-types/mock-errors.d.ts","../../node_modules/undici-types/proxy-agent.d.ts","../../node_modules/undici-types/env-http-proxy-agent.d.ts","../../node_modules/undici-types/retry-handler.d.ts","../../node_modules/undici-types/retry-agent.d.ts","../../node_modules/undici-types/api.d.ts","../../node_modules/undici-types/interceptors.d.ts","../../node_modules/undici-types/util.d.ts","../../node_modules/undici-types/cookies.d.ts","../../node_modules/undici-types/patch.d.ts","../../node_modules/undici-types/websocket.d.ts","../../node_modules/undici-types/eventsource.d.ts","../../node_modules/undici-types/filereader.d.ts","../../node_modules/undici-types/diagnostics-channel.d.ts","../../node_modules/undici-types/content-type.d.ts","../../node_modules/undici-types/cache.d.ts","../../node_modules/undici-types/index.d.ts","../../node_modules/@types/node/globals.d.ts","../../node_modules/@types/node/assert.d.ts","../../node_modules/@types/node/assert/strict.d.ts","../../node_modules/@types/node/async_hooks.d.ts","../../node_modules/@types/node/buffer.d.ts","../../node_modules/@types/node/child_process.d.ts","../../node_modules/@types/node/cluster.d.ts","../../node_modules/@types/node/console.d.ts","../../node_modules/@types/node/constants.d.ts","../../node_modules/@types/node/crypto.d.ts","../../node_modules/@types/node/dgram.d.ts","../../node_modules/@types/node/diagnostics_channel.d.ts","../../node_modules/@types/node/dns.d.ts","../../node_modules/@types/node/dns/promises.d.ts","../../node_modules/@types/node/domain.d.ts","../../node_modules/@types/node/dom-events.d.ts","../../node_modules/@types/node/events.d.ts","../../node_modules/@types/node/fs.d.ts","../../node_modules/@types/node/fs/promises.d.ts","../../node_modules/@types/node/http.d.ts","../../node_modules/@types/node/http2.d.ts","../../node_modules/@types/node/https.d.ts","../../node_modules/@types/node/inspector.d.ts","../../node_modules/@types/node/module.d.ts","../../node_modules/@types/node/net.d.ts","../../node_modules/@types/node/os.d.ts","../../node_modules/@types/node/path.d.ts","../../node_modules/@types/node/perf_hooks.d.ts","../../node_modules/@types/node/process.d.ts","../../node_modules/@types/node/punycode.d.ts","../../node_modules/@types/node/querystring.d.ts","../../node_modules/@types/node/readline.d.ts","../../node_modules/@types/node/readline/promises.d.ts","../../node_modules/@types/node/repl.d.ts","../../node_modules/@types/node/sea.d.ts","../../node_modules/@types/node/stream.d.ts","../../node_modules/@types/node/stream/promises.d.ts","../../node_modules/@types/node/stream/consumers.d.ts","../../node_modules/@types/node/stream/web.d.ts","../../node_modules/@types/node/string_decoder.d.ts","../../node_modules/@types/node/test.d.ts","../../node_modules/@types/node/timers.d.ts","../../node_modules/@types/node/timers/promises.d.ts","../../node_modules/@types/node/tls.d.ts","../../node_modules/@types/node/trace_events.d.ts","../../node_modules/@types/node/tty.d.ts","../../node_modules/@types/node/url.d.ts","../../node_modules/@types/node/util.d.ts","../../node_modules/@types/node/v8.d.ts","../../node_modules/@types/node/vm.d.ts","../../node_modules/@types/node/wasi.d.ts","../../node_modules/@types/node/worker_threads.d.ts","../../node_modules/@types/node/zlib.d.ts","../../node_modules/@types/node/ts5.6/index.d.ts","../../node_modules/@types/fs-extra/index.d.ts","../../node_modules/@types/minimatch/index.d.ts","../../node_modules/@types/glob/index.d.ts","../../node_modules/@types/html-minifier-terser/index.d.ts","../../node_modules/@types/linkify-it/index.d.ts","../../node_modules/@types/mdurl/encode.d.ts","../../node_modules/@types/mdurl/decode.d.ts","../../node_modules/@types/mdurl/parse.d.ts","../../node_modules/@types/mdurl/format.d.ts","../../node_modules/@types/mdurl/index.d.ts","../../node_modules/@types/markdown-it/lib/common/utils.d.ts","../../node_modules/@types/markdown-it/lib/token.d.ts","../../node_modules/@types/markdown-it/lib/rules_inline/state_inline.d.ts","../../node_modules/@types/markdown-it/lib/helpers/parse_link_label.d.ts","../../node_modules/@types/markdown-it/lib/helpers/parse_link_destination.d.ts","../../node_modules/@types/markdown-it/lib/helpers/parse_link_title.d.ts","../../node_modules/@types/markdown-it/lib/helpers/index.d.ts","../../node_modules/@types/markdown-it/lib/ruler.d.ts","../../node_modules/@types/markdown-it/lib/rules_block/state_block.d.ts","../../node_modules/@types/markdown-it/lib/parser_block.d.ts","../../node_modules/@types/markdown-it/lib/rules_core/state_core.d.ts","../../node_modules/@types/markdown-it/lib/parser_core.d.ts","../../node_modules/@types/markdown-it/lib/parser_inline.d.ts","../../node_modules/@types/markdown-it/lib/renderer.d.ts","../../node_modules/@types/markdown-it/lib/index.d.ts","../../node_modules/@types/markdown-it/index.d.ts","../../node_modules/@types/minimist/index.d.ts","../../node_modules/@types/normalize-package-data/index.d.ts","../../node_modules/@types/parse-json/index.d.ts","../../node_modules/@types/resolve/index.d.ts","../../node_modules/@types/semver/classes/semver.d.ts","../../node_modules/@types/semver/functions/parse.d.ts","../../node_modules/@types/semver/functions/valid.d.ts","../../node_modules/@types/semver/functions/clean.d.ts","../../node_modules/@types/semver/functions/inc.d.ts","../../node_modules/@types/semver/functions/diff.d.ts","../../node_modules/@types/semver/functions/major.d.ts","../../node_modules/@types/semver/functions/minor.d.ts","../../node_modules/@types/semver/functions/patch.d.ts","../../node_modules/@types/semver/functions/prerelease.d.ts","../../node_modules/@types/semver/functions/compare.d.ts","../../node_modules/@types/semver/functions/rcompare.d.ts","../../node_modules/@types/semver/functions/compare-loose.d.ts","../../node_modules/@types/semver/functions/compare-build.d.ts","../../node_modules/@types/semver/functions/sort.d.ts","../../node_modules/@types/semver/functions/rsort.d.ts","../../node_modules/@types/semver/functions/gt.d.ts","../../node_modules/@types/semver/functions/lt.d.ts","../../node_modules/@types/semver/functions/eq.d.ts","../../node_modules/@types/semver/functions/neq.d.ts","../../node_modules/@types/semver/functions/gte.d.ts","../../node_modules/@types/semver/functions/lte.d.ts","../../node_modules/@types/semver/functions/cmp.d.ts","../../node_modules/@types/semver/functions/coerce.d.ts","../../node_modules/@types/semver/classes/comparator.d.ts","../../node_modules/@types/semver/classes/range.d.ts","../../node_modules/@types/semver/functions/satisfies.d.ts","../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../node_modules/@types/semver/ranges/min-version.d.ts","../../node_modules/@types/semver/ranges/valid.d.ts","../../node_modules/@types/semver/ranges/outside.d.ts","../../node_modules/@types/semver/ranges/gtr.d.ts","../../node_modules/@types/semver/ranges/ltr.d.ts","../../node_modules/@types/semver/ranges/intersects.d.ts","../../node_modules/@types/semver/ranges/simplify.d.ts","../../node_modules/@types/semver/ranges/subset.d.ts","../../node_modules/@types/semver/internals/identifiers.d.ts","../../node_modules/@types/semver/index.d.ts","../../node_modules/@types/source-list-map/index.d.ts","../../node_modules/@types/stringify-object/index.d.ts","../../node_modules/@types/tapable/index.d.ts","../../node_modules/@types/uglify-js/node_modules/source-map/source-map.d.ts","../../node_modules/@types/uglify-js/index.d.ts","../../node_modules/@types/webpack-sources/node_modules/source-map/source-map.d.ts","../../node_modules/@types/webpack-sources/lib/source.d.ts","../../node_modules/@types/webpack-sources/lib/compatsource.d.ts","../../node_modules/@types/webpack-sources/lib/concatsource.d.ts","../../node_modules/@types/webpack-sources/lib/originalsource.d.ts","../../node_modules/@types/webpack-sources/lib/prefixsource.d.ts","../../node_modules/@types/webpack-sources/lib/rawsource.d.ts","../../node_modules/@types/webpack-sources/lib/replacesource.d.ts","../../node_modules/@types/webpack-sources/lib/sizeonlysource.d.ts","../../node_modules/@types/webpack-sources/lib/sourcemapsource.d.ts","../../node_modules/@types/webpack-sources/lib/index.d.ts","../../node_modules/@types/webpack-sources/lib/cachedsource.d.ts","../../node_modules/@types/webpack-sources/index.d.ts"],"fileInfos":[{"version":"8730f4bf322026ff5229336391a18bcaa1f94d4f82416c8b2f3954e2ccaae2ba","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","4b421cbfb3a38a27c279dec1e9112c3d1da296f77a1a85ddadf7e7a425d45d18","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"d3f4771304b6b07e5a2bb992e75af76ac060de78803b1b21f0475ffc5654d817","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"5f406584aef28a331c36523df688ca3650288d14f39c5d2e555c95f0d2ff8f6f","affectsGlobalScope":true},{"version":"22f230e544b35349cfb3bd9110b6ef37b41c6d6c43c3314a31bd0d9652fcec72","affectsGlobalScope":true},{"version":"7ea0b55f6b315cf9ac2ad622b0a7813315bb6e97bf4bb3fbf8f8affbca7dc695","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"eb26de841c52236d8222f87e9e6a235332e0788af8c87a71e9e210314300410a","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"5e5e095c4470c8bab227dbbc61374878ecead104c74ab9960d3adcccfee23205","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"2768ef564cfc0689a1b76106c421a2909bdff0acbe87da010785adab80efdd5c","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"0396119f8b76a074eddc16de8dbc4231a448f2534f4c64c5ab7b71908eb6e646","affectsGlobalScope":true},{"version":"576844ac0dd93e200226d7b04c97983b6584da698687d94cbc88bcb5dc239dd3","signature":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","affectsGlobalScope":true},{"version":"43b283a961efe9fb5f6db7fb5e5da1a1fbe1dc2a40fbbf2bb69f9a684f5123cb","signature":"3330a565c3ba823beaafa8c291aaf4bd32324ad062a9881d9b256fb1a01cae83"},"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","f0ae1ac99c66a4827469b8942101642ae65971e36db438afe67d4985caa31222","7f5bced3f1bd3647585b59564e0b0fda67e1c2930325507ee922698fe8366aca","88fa7615e71089c0cab3b688aae073a6e9dae6f489ec1357da407c155d2e9d84",{"version":"d763b9ef68a16f3896187af5b51b5a959b479218cc65c2930bcb440cbbf10728","affectsGlobalScope":true},"0b066351c69855f76970a460fe20a500d20f369a02d2069aa49e1195cd04c3c5",{"version":"3175aa69fb597c3d5279aa7c033bfbabefd48f2e46c961de29aaf1d568353907","signature":"2939ba53a856cc8a5ec94e48c4df4a271f156547b89ef10e72dc6fb4bfde1d64"},{"version":"a7284af4d336e107a3a5d73ff779e7aafe6e20bd1d31ce8e5cb270eeeb6123b6","signature":"50957b2b2ca06175ba0b8b21fcc449c4d92d15b2c74e7b2af241f0bfe491e143"},{"version":"b953eb8ee25e34b1059c1d1d683dca007f11e05e1bd810df52220d351b666166","signature":"01f26f7267a10e2b1d6dd3f7619a7a80d18a3ca36f50823afe80f2af8c96a453"},"96804c81b1d2ede6f9a247b098b54423eede03752d4cc7b6a1872e0832e7f4e8",{"version":"3469a10bdf3cf1719c608ff69e4e228d9abe6db1e145a158f5c85e28257d8c4e","signature":"6b9f89086659e8a070c9d16552bc0d02c1565c72d55404162bf9f15b65fcc0e1"},{"version":"c159abe7dbffb4156659b3ff4991b17078060f33fed71b9eb72425617dab0512","signature":"e9d5a098eada88588f6a2ab40fc22c556d9f2dcea96cbc49ce8e1fcd305e3c5f"},{"version":"a56fdeb10ea26f54cfe15049b92dd7965fccb3f98394f652ba77eb1028911efa","signature":"543bbad49d20c5afe6e9c9ed54b066c25a0aaf876f49c6c0194cde8ad8a311bc"},"c2c2a861a338244d7dd700d0c52a78916b4bb75b98fc8ca5e7c501899fc03796","b25c5f2970d06c729f464c0aeaa64b1a5b5f1355aa93554bb5f9c199b8624b1e","adb467429462e3891de5bb4a82a4189b92005d61c7f9367c089baf03997c104e","3051751533eee92572241b3cef28333212401408c4e7aa21718714b793c0f4ed","691aea9772797ca98334eb743e7686e29325b02c6931391bcee4cc7bf27a9f3b","069bebfee29864e3955378107e243508b163e77ab10de6a5ee03ae06939f0bb9","d83a458e35dfd3cfe0c94758b0b621a733df35ff6b24db007c2721da6574705d","0aeab9bac83e1f076d9f5487c5c783288fe9be64064ee7de3c81eecee157f506",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"151ff381ef9ff8da2da9b9663ebf657eac35c4c9a19183420c05728f31a6761d","f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","7852500a7dc3f9cb6b73d619f6e0249119211ea662fd5e16c59ee5aba3deeb80","1f68ab0e055994eb337b67aa87d2a15e0200951e9664959b3866ee6f6b11a0fe",{"version":"70521b6ab0dcba37539e5303104f29b721bfb2940b2776da4cc818c07e1fefc1","affectsGlobalScope":true},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true},"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a",{"version":"613b21ccdf3be6329d56e6caa13b258c842edf8377be7bc9f014ed14cdcfc308","affectsGlobalScope":true},{"version":"20fb08397d22742771868b52f647cddfbf44b263f26b6519b449257f8c9f7364","affectsGlobalScope":true},"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","24bd580b5743dc56402c440dc7f9a4f5d592ad7a419f25414d37a7bfe11e342b","25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","6bdc71028db658243775263e93a7db2fd2abfce3ca569c3cca5aee6ed5eb186d","cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","4d2b0eb911816f66abe4970898f97a2cfc902bcd743cbfa5017fad79f7ef90d8","bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","e53a3c2a9f624d90f24bf4588aacd223e7bec1b9d0d479b68d2f4a9e6011147f","24b8685c62562f5d98615c5a0c1d05f297cf5065f15246edfe99e81ec4c0e011","93507c745e8f29090efb99399c3f77bec07db17acd75634249dc92f961573387","339dc5265ee5ed92e536a93a04c4ebbc2128f45eeec6ed29f379e0085283542c","4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107",{"version":"08faa97886e71757779428dd4c69a545c32c85fd629d1116d42710b32c6378bc","affectsGlobalScope":true},"6b042aa5d277ad6963e2837179fd2f8fbb01968ac67115b0833c0244e93d1d50","7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","3d77c73be94570813f8cadd1f05ebc3dc5e2e4fdefe4d340ca20cd018724ee36",{"version":"23cfd70b42094e54cc3c5dab996d81b97e2b6f38ccb24ead85454b8ddfe2fc4f","affectsGlobalScope":true},"f3e58c4c18a031cbb17abec7a4ad0bd5ae9fc70c1f4ba1e7fb921ad87c504aca","a3e8bafb2af8e850c644f4be7f5156cf7d23b7bfdc3b786bd4d10ed40329649c",{"version":"35ec8b6760fd7138bbf5809b84551e31028fb2ba7b6dc91d95d098bf212ca8b4","affectsGlobalScope":true},"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a",{"version":"4b87f767c7bc841511113c876a6b8bf1fd0cb0b718c888ad84478b372ec486b1","affectsGlobalScope":true},"8d04e3640dd9eb67f7f1e5bd3d0bf96c784666f7aefc8ac1537af6f2d38d4c29","3c884d9d9ec454bdf0d5a0b8465bf8297d2caa4d853851d92cc417ac6f30b969","5a369483ac4cfbdf0331c248deeb36140e6907db5e1daed241546b4a2055f82c","e8f5b5cc36615c17d330eaf8eebbc0d6bdd942c25991f96ef122f246f4ff722f","f0bd7e6d931657b59605c44112eaf8b980ba7f957a5051ed21cb93d978cf2f45",{"version":"ee1ee365d88c4c6c0c0a5a5701d66ebc27ccd0bcfcfaa482c6e2e7fe7b98edf7","affectsGlobalScope":true},{"version":"0ada07543808f3b967624645a8e1ccd446f8b01ade47842acf1328aec899fed0","affectsGlobalScope":true},"0a37b8d00d03f0381d2db2fe31b0571dc9d7cc0f4b87ca103cc3cd2277690ba0","71adf5dbc59568663d252a46179e71e4d544c053978bfc526d11543a3f716f42","38bf8ff1b403c861e9052c9ea651cb4f38c1ecc084a34d79f8acc6d6477a7321","93bd413918fa921c8729cef45302b24d8b6c7855d72d5bf82d3972595ae8dcbf","4ff41188773cbf465807dd2f7059c7494cbee5115608efc297383832a1150c43","dccdf1677e531e33f8ac961a68bc537418c9a414797c1ea7e91307501cdc3f5e",{"version":"e184c4b8918ef56c8c9e68bd79f3f3780e2d0d75bf2b8a41da1509a40c2deb46","affectsGlobalScope":true},"d206b4baf4ddcc15d9d69a9a2f4999a72a2c6adeaa8af20fa7a9960816287555","93f437e1398a4f06a984f441f7fa7a9f0535c04399619b5c22e0b87bdee182cb","afbe24ab0d74694372baa632ecb28bb375be53f3be53f9b07ecd7fc994907de5",{"version":"70731d10d5311bd4cf710ef7f6539b62660f4b0bfdbb3f9fbe1d25fe6366a7fa","affectsGlobalScope":true},{"version":"6b19db3600a17af69d4f33d08cc7076a7d19fb65bb36e442cac58929ec7c9482","affectsGlobalScope":true},"9e043a1bc8fbf2a255bccf9bf27e0f1caf916c3b0518ea34aa72357c0afd42ec","137c2894e8f3e9672d401cc0a305dc7b1db7c69511cf6d3970fb53302f9eae09","3bc2f1e2c95c04048212c569ed38e338873f6a8593930cf5a7ef24ffb38fc3b6","8145e07aad6da5f23f2fcd8c8e4c5c13fb26ee986a79d03b0829b8fce152d8b2","f9d9d753d430ed050dc1bf2667a1bab711ccbb1c1507183d794cc195a5b085cc","9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","ba1f814c22fd970255ddd60d61fb7e00c28271c933ab5d5cc19cd3ca66b8f57c","37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","125d792ec6c0c0f657d758055c494301cc5fdb327d9d9d5960b3f129aff76093",{"version":"295f068af94245ee9d780555351bef98adfd58f8baf0b9dadbc31a489b881f8b","affectsGlobalScope":true},"1851a3b4db78664f83901bb9cac9e45e03a37bb5933cc5bf37e10bb7e91ab4eb",{"version":"09d479208911ac3ac6a7c2fe86217fc1abe6c4f04e2d52e4890e500699eeab32","affectsGlobalScope":true},{"version":"12ed4559eba17cd977aa0db658d25c4047067444b51acfdcbf38470630642b23","affectsGlobalScope":true},"f3ffabc95802521e1e4bcba4c88d8615176dc6e09111d920c7a213bdda6e1d65","4f029899f9bae07e225c43aef893590541b2b43267383bf5e32e3a884d219ed5","ae56f65caf3be91108707bd8dfbccc2a57a91feb5daabf7165a06a945545ed26","a136d5de521da20f31631a0a96bf712370779d1c05b7015d7019a9b2a0446ca9",{"version":"5b566927cad2ed2139655d55d690ffa87df378b956e7fe1c96024c4d9f75c4cf","affectsGlobalScope":true},{"version":"bce947017cb7a2deebcc4f5ba04cead891ce6ad1602a4438ae45ed9aa1f39104","affectsGlobalScope":true},"d3dffd70e6375b872f0b4e152de4ae682d762c61a24881ecc5eb9f04c5caf76f","e2c72c065a36bc9ab2a00ac6a6f51e71501619a72c0609defd304d46610487a4","d91a7d8b5655c42986f1bdfe2105c4408f472831c8f20cf11a8c3345b6b56c8c",{"version":"616075a6ac578cf5a013ee12964188b4412823796ce0b202c6f1d2e4ca8480d7","affectsGlobalScope":true},"e8a979b8af001c9fc2e774e7809d233c8ca955a28756f52ee5dee88ccb0611d2","9091e564b81e7b4c382a33c62de704a699e10508190547d4f7c1c3e039d2db2b","ed19da84b7dbf00952ad0b98ce5c194f1903bcf7c94d8103e8e0d63b271543ae","1d1e6bd176eee5970968423d7e215bfd66828b6db8d54d17afec05a831322633","393137c76bd922ba70a2f8bf1ade4f59a16171a02fb25918c168d48875b0cfb0","6767cce098e1e6369c26258b7a1f9e569c5467d501a47a090136d5ea6e80ae6d","6503fb6addf62f9b10f8564d9869ad824565a914ec1ac3dd7d13da14a3f57036","f313731860257325f13351575f381fef333d4dfe30daf5a2e72f894208feea08","951b37f7d86f6012f09e6b35f1de57c69d75f16908cb0adaa56b93675ea0b853","3816fc03ffd9cbd1a7a3362a264756a4a1d547caabea50ca68303046be40e376","0c417b4ec46b88fb62a43ec00204700b560d01eb5677c7faa8ecd34610f096a8","13d29cdeb64e8496424edf42749bbb47de5e42d201cf958911a4638cbcffbd3f","0f9e381eecc5860f693c31fe463b3ca20a64ca9b8db0cf6208cd4a053f064809","95902d5561c6aac5dfc40568a12b0aca324037749dcd32a81f23423bfde69bab","5dfb2aca4136abdc5a2740f14be8134a6e6b66fd53470bb2e954e40f8abfaf3e","577463167dd69bd81f76697dfc3f7b22b77a6152f60a602a9218e52e3183ad67","b8396e9024d554b611cbe31a024b176ba7116063d19354b5a02dccd8f0118989","4b28e1c5bf88d891e07a1403358b81a51b3ba2eae1ffada51cca7476b5ac6407","7150ad575d28bf98fae321a1c0f10ad17b127927811f488ded6ff1d88d4244e5","8b155c4757d197969553de3762c8d23d5866710301de41e1b66b97c9ed867003","93733466609dd8bf72eace502a24ca7574bd073d934216e628f1b615c8d3cb3c","45e9228761aabcadb79c82fb3008523db334491525bdb8e74e0f26eaf7a4f7f4","aeacac2778c9821512b6b889da79ac31606a863610c8f28da1e483579627bf90","569fdb354062fc098a6a3ba93a029edf22d6fe480cf72b231b3c07832b2e7c97","bf9876e62fb7f4237deafab8c7444770ef6e82b4cad2d5dc768664ff340feeb2","6cf60e76d37faf0fbc2f80a873eab0fd545f6b1bf300e7f0823f956ddb3083e9","6adaa6103086f931e3eee20f0987e86e8879e9d13aa6bd6075ccfc58b9c5681c","ee0af0f2b8d3b4d0baf669f2ff6fcef4a8816a473c894cc7c905029f7505fed0","209e814e8e71aec74f69686a9506dd7610b97ab59dcee9446266446f72a76d05","6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","cf3d384d082b933d987c4e2fe7bfb8710adfd9dc8155190056ed6695a25a559e","9871b7ee672bc16c78833bdab3052615834b08375cb144e4d2cba74473f4a589","c863198dae89420f3c552b5a03da6ed6d0acfa3807a64772b895db624b0de707","8b03a5e327d7db67112ebbc93b4f744133eda2c1743dbb0a990c61a8007823ef","86c73f2ee1752bac8eeeece234fd05dfcf0637a4fbd8032e4f5f43102faa8eec","42fad1f540271e35ca37cecda12c4ce2eef27f0f5cf0f8dd761d723c744d3159","ff3743a5de32bee10906aff63d1de726f6a7fd6ee2da4b8229054dfa69de2c34","83acd370f7f84f203e71ebba33ba61b7f1291ca027d7f9a662c6307d74e4ac22","1445cec898f90bdd18b2949b9590b3c012f5b7e1804e6e329fb0fe053946d5ec","0e5318ec2275d8da858b541920d9306650ae6ac8012f0e872fe66eb50321a669","cf530297c3fb3a92ec9591dd4fa229d58b5981e45fe6702a0bd2bea53a5e59be","c1f6f7d08d42148ddfe164d36d7aba91f467dbcb3caa715966ff95f55048b3a4","f4e9bf9103191ef3b3612d3ec0044ca4044ca5be27711fe648ada06fad4bcc85","0c1ee27b8f6a00097c2d6d91a21ee4d096ab52c1e28350f6362542b55380059a","7677d5b0db9e020d3017720f853ba18f415219fb3a9597343b1b1012cfd699f7","bc1c6bc119c1784b1a2be6d9c47addec0d83ef0d52c8fbe1f14a51b4dfffc675","52cf2ce99c2a23de70225e252e9822a22b4e0adb82643ab0b710858810e00bf1","770625067bb27a20b9826255a8d47b6b5b0a2d3dfcbd21f89904c731f671ba77","d1ed6765f4d7906a05968fb5cd6d1db8afa14dbe512a4884e8ea5c0f5e142c80","799c0f1b07c092626cf1efd71d459997635911bb5f7fc1196efe449bba87e965","2a184e4462b9914a30b1b5c41cf80c6d3428f17b20d3afb711fff3f0644001fd","9eabde32a3aa5d80de34af2c2206cdc3ee094c6504a8d0c2d6d20c7c179503cc","397c8051b6cfcb48aa22656f0faca2553c5f56187262135162ee79d2b2f6c966","a8ead142e0c87dcd5dc130eba1f8eeed506b08952d905c47621dc2f583b1bff9","a02f10ea5f73130efca046429254a4e3c06b5475baecc8f7b99a0014731be8b3","c2576a4083232b0e2d9bd06875dd43d371dee2e090325a9eac0133fd5650c1cb","4c9a0564bb317349de6a24eb4efea8bb79898fa72ad63a1809165f5bd42970dd","f40ac11d8859092d20f953aae14ba967282c3bb056431a37fced1866ec7a2681","cc11e9e79d4746cc59e0e17473a59d6f104692fd0eeea1bdb2e206eabed83b03","b444a410d34fb5e98aa5ee2b381362044f4884652e8bc8a11c8fe14bbd85518e","c35808c1f5e16d2c571aa65067e3cb95afeff843b259ecfa2fc107a9519b5392","14d5dc055143e941c8743c6a21fa459f961cbc3deedf1bfe47b11587ca4b3ef5","a3ad4e1fc542751005267d50a6298e6765928c0c3a8dce1572f2ba6ca518661c","f237e7c97a3a89f4591afd49ecb3bd8d14f51a1c4adc8fcae3430febedff5eb6","3ffdfbec93b7aed71082af62b8c3e0cc71261cc68d796665faa1e91604fbae8f","662201f943ed45b1ad600d03a90dffe20841e725203ced8b708c91fcd7f9379a","c9ef74c64ed051ea5b958621e7fb853fe3b56e8787c1587aefc6ea988b3c7e79","2462ccfac5f3375794b861abaa81da380f1bbd9401de59ffa43119a0b644253d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","7d8ddf0f021c53099e34ee831a06c394d50371816caa98684812f089b4c6b3d4","67fc055eb86a0632e2e072838f889ffe1754083cb13c8c80a06a7d895d877aae","2905bf42cddf7ba20c88922d36b7afa5431523c1cab119fdb38bf5baab02adf1","d558a0fe921ebcc88d3212c2c42108abf9f0d694d67ebdeba37d7728c044f579","2887592574fcdfd087647c539dcb0fbe5af2521270dad4a37f9d17c16190d579","9d74c7330800b325bb19cc8c1a153a612c080a60094e1ab6cfb6e39cf1b88c36","b90c59ac4682368a01c83881b814738eb151de8a58f52eb7edadea2bcffb11b9","8560a87b2e9f8e2c3808c8f6172c9b7eb6c9b08cb9f937db71c285ecf292c81d","ffe3931ff864f28d80ae2f33bd11123ad3d7bad9896b910a1e61504cc093e1f5","083c1bd82f8dc3a1ed6fc9e8eaddf141f7c05df418eca386598821e045253af9","274ebe605bd7f71ce161f9f5328febc7d547a2929f803f04b44ec4a7d8729517","6ca0207e70d985a24396583f55836b10dc181063ab6069733561bfde404d1bad","5908142efeaab38ffdf43927ee0af681ae77e0d7672b956dfb8b6c705dbfe106","f772b188b943549b5c5eb803133314b8aa7689eced80eed0b70e2f30ca07ab9c","0026b816ef05cfbf290e8585820eef0f13250438669107dfc44482bac007b14f","05d64cc1118031b29786632a9a0f6d7cf1dcacb303f27023a466cf3cdc860538","e0fff9119e1a5d2fdd46345734126cd6cb99c2d98a9debf0257047fe3937cc3f","d84398556ba4595ee6be554671da142cfe964cbdebb2f0c517a10f76f2b016c0","e275297155ec3251200abbb334c7f5641fecc68b2a9573e40eed50dff7584762"],"options":{"composite":true,"declaration":true,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","preserveConstEnums":true,"rootDir":"./src","strict":true,"target":4,"tsBuildInfoFile":"./tsconfig.tsbuildinfo"},"fileIdsList":[[76,118],[58,76,118],[58,59,60,61,62,76,118],[58,60,76,118],[67,69,76,118],[66,67,68,76,118],[76,118,131,167],[76,118,130,167,169],[76,118,192],[76,118,177],[76,118,181,182,183],[76,118,180],[76,118,182],[76,118,172,178,179,184,187,189,190,191],[76,118,179,185,186,192],[76,118,185,188],[76,118,179,180,185,192],[76,118,179,192],[76,118,173,174,175,176],[76,115,118],[76,117,118],[76,118,123,152],[76,118,119,124,130,131,138,149,160],[76,118,119,120,130,138],[71,72,73,76,118],[76,118,121,161],[76,118,122,123,131,139],[76,118,123,149,157],[76,118,124,126,130,138],[76,117,118,125],[76,118,126,127],[76,118,130],[76,118,128,130],[76,117,118,130],[76,118,130,131,132,149,160],[76,118,130,131,132,145,149,152],[76,113,118,165],[76,118,126,130,133,138,149,160],[76,118,130,131,133,134,138,149,157,160],[76,118,133,135,149,157,160],[76,118,130,136],[76,118,137,160,165],[76,118,126,130,138,149],[76,118,139],[76,118,140],[76,117,118,141],[76,115,116,117,118,119,120,121,122,123,124,125,126,127,128,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166],[76,118,143],[76,118,144],[76,118,130,145,146],[76,118,145,147,161,163],[76,118,130,149,150,152],[76,118,151,152],[76,118,149,150],[76,118,152],[76,118,153],[76,115,118,149],[76,118,130,155,156],[76,118,155,156],[76,118,123,138,149,157],[76,118,158],[118],[74,75,76,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166],[76,118,138,159],[76,118,133,144,160],[76,118,123,161],[76,118,149,162],[76,118,137,163],[76,118,164],[76,118,123,130,132,141,149,160,163,165],[76,118,149,166],[76,118,198,237],[76,118,198,222,237],[76,118,237],[76,118,198],[76,118,198,223,237],[76,118,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236],[76,118,223,237],[76,118,241],[76,118,167,244,245,246,247,248,249,250,251,252,253,254],[76,118,243,244,253],[76,118,244,253],[76,118,238,243,244,253],[76,118,243,244,245,246,247,248,249,250,251,252,254],[76,118,244],[76,118,123,243,253],[76,85,89,118,160],[76,85,118,149,160],[76,80,118],[76,82,85,118,157,160],[76,118,138,157],[76,118,167],[76,80,118,167],[76,82,85,118,138,160],[76,77,78,81,84,118,130,149,160],[76,85,92,118],[76,77,83,118],[76,85,106,107,118],[76,81,85,118,152,160,167],[76,106,118,167],[76,79,80,118,167],[76,85,118],[76,79,80,81,82,83,84,85,86,87,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,107,108,109,110,111,112,118],[76,85,100,118],[76,85,92,93,118],[76,83,85,93,94,118],[76,84,118],[76,77,80,85,118],[76,85,89,93,94,118],[76,89,118],[76,83,85,88,118,160],[76,77,82,85,92,118],[76,118,149],[76,80,85,106,118,165,167],[46,76,118],[44,47,48,49,50,76,118],[44,51,52,76,118],[44,51,53,55,56,76,118],[54,76,118],[44,46,49,52,53,55,76,118],[44],[44,51,53,55,56],[44,46]],"referencedMap":[[42,1],[60,2],[58,1],[63,3],[59,2],[64,1],[61,4],[62,2],[65,1],[70,5],[66,1],[69,6],[67,1],[168,7],[170,8],[171,1],[68,1],[172,1],[193,9],[178,10],[184,11],[182,1],[181,12],[183,13],[192,14],[187,15],[189,16],[190,17],[191,18],[185,1],[186,18],[188,18],[180,18],[179,1],[174,1],[173,1],[176,10],[177,19],[175,10],[169,1],[194,1],[115,20],[116,20],[117,21],[118,22],[119,23],[120,24],[71,1],[74,25],[72,1],[73,1],[121,26],[122,27],[123,28],[124,29],[125,30],[126,31],[127,31],[129,32],[128,33],[130,34],[131,35],[132,36],[114,37],[133,38],[134,39],[135,40],[136,41],[137,42],[138,43],[139,44],[140,45],[141,46],[142,47],[143,48],[144,49],[145,50],[146,50],[147,51],[148,1],[149,52],[151,53],[150,54],[152,55],[153,56],[154,57],[155,58],[156,59],[157,60],[158,61],[76,62],[75,1],[167,63],[159,64],[160,65],[161,66],[162,67],[163,68],[164,69],[165,70],[166,71],[195,1],[196,1],[197,1],[222,72],[223,73],[198,74],[201,74],[220,72],[221,72],[211,72],[210,75],[208,72],[203,72],[216,72],[214,72],[218,72],[202,72],[215,72],[219,72],[204,72],[205,72],[217,72],[199,72],[206,72],[207,72],[209,72],[213,72],[224,76],[212,72],[200,72],[237,77],[236,1],[231,76],[233,78],[232,76],[225,76],[226,76],[228,76],[230,76],[234,78],[235,78],[227,78],[229,78],[238,1],[239,1],[240,1],[242,79],[241,1],[255,80],[254,81],[245,82],[246,83],[253,84],[247,83],[248,82],[249,82],[250,82],[251,85],[244,86],[252,81],[243,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[33,1],[30,1],[31,1],[32,1],[34,1],[7,1],[35,1],[40,1],[41,1],[36,1],[37,1],[38,1],[39,1],[1,1],[8,1],[92,87],[102,88],[91,87],[112,89],[83,90],[82,91],[111,92],[105,93],[110,94],[85,95],[99,96],[84,97],[108,98],[80,99],[79,92],[109,100],[81,101],[86,102],[87,1],[90,102],[77,1],[113,103],[103,104],[94,105],[95,106],[97,107],[93,108],[96,109],[106,92],[88,110],[89,111],[98,112],[78,113],[101,104],[100,102],[104,1],[107,114],[47,115],[54,1],[48,1],[49,1],[50,115],[45,1],[46,1],[44,1],[43,1],[51,116],[53,117],[57,118],[55,119],[56,120],[52,1]],"exportedModulesMap":[[42,1],[60,2],[58,1],[63,3],[59,2],[64,1],[61,4],[62,2],[65,1],[70,5],[66,1],[69,6],[67,1],[168,7],[170,8],[171,1],[68,1],[172,1],[193,9],[178,10],[184,11],[182,1],[181,12],[183,13],[192,14],[187,15],[189,16],[190,17],[191,18],[185,1],[186,18],[188,18],[180,18],[179,1],[174,1],[173,1],[176,10],[177,19],[175,10],[169,1],[194,1],[115,20],[116,20],[117,21],[118,22],[119,23],[120,24],[71,1],[74,25],[72,1],[73,1],[121,26],[122,27],[123,28],[124,29],[125,30],[126,31],[127,31],[129,32],[128,33],[130,34],[131,35],[132,36],[114,37],[133,38],[134,39],[135,40],[136,41],[137,42],[138,43],[139,44],[140,45],[141,46],[142,47],[143,48],[144,49],[145,50],[146,50],[147,51],[148,1],[149,52],[151,53],[150,54],[152,55],[153,56],[154,57],[155,58],[156,59],[157,60],[158,61],[76,62],[75,1],[167,63],[159,64],[160,65],[161,66],[162,67],[163,68],[164,69],[165,70],[166,71],[195,1],[196,1],[197,1],[222,72],[223,73],[198,74],[201,74],[220,72],[221,72],[211,72],[210,75],[208,72],[203,72],[216,72],[214,72],[218,72],[202,72],[215,72],[219,72],[204,72],[205,72],[217,72],[199,72],[206,72],[207,72],[209,72],[213,72],[224,76],[212,72],[200,72],[237,77],[236,1],[231,76],[233,78],[232,76],[225,76],[226,76],[228,76],[230,76],[234,78],[235,78],[227,78],[229,78],[238,1],[239,1],[240,1],[242,79],[241,1],[255,80],[254,81],[245,82],[246,83],[253,84],[247,83],[248,82],[249,82],[250,82],[251,85],[244,86],[252,81],[243,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[33,1],[30,1],[31,1],[32,1],[34,1],[7,1],[35,1],[40,1],[41,1],[36,1],[37,1],[38,1],[39,1],[1,1],[8,1],[92,87],[102,88],[91,87],[112,89],[83,90],[82,91],[111,92],[105,93],[110,94],[85,95],[99,96],[84,97],[108,98],[80,99],[79,92],[109,100],[81,101],[86,102],[87,1],[90,102],[77,1],[113,103],[103,104],[94,105],[95,106],[97,107],[93,108],[96,109],[106,92],[88,110],[89,111],[98,112],[78,113],[101,104],[100,102],[104,1],[107,114],[47,115],[54,1],[48,1],[49,1],[50,115],[45,1],[46,1],[51,121],[53,121],[57,122],[56,123]],"semanticDiagnosticsPerFile":[42,60,58,63,59,64,61,62,65,70,66,69,67,168,170,171,68,172,193,178,184,182,181,183,192,187,189,190,191,185,186,188,180,179,174,173,176,177,175,169,194,115,116,117,118,119,120,71,74,72,73,121,122,123,124,125,126,127,129,128,130,131,132,114,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,151,150,152,153,154,155,156,157,158,76,75,167,159,160,161,162,163,164,165,166,195,196,197,222,223,198,201,220,221,211,210,208,203,216,214,218,202,215,219,204,205,217,199,206,207,209,213,224,212,200,237,236,231,233,232,225,226,228,230,234,235,227,229,238,239,240,242,241,255,254,245,246,253,247,248,249,250,251,244,252,243,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,33,30,31,32,34,7,35,40,41,36,37,38,39,1,8,92,102,91,112,83,82,111,105,110,85,99,84,108,80,79,109,81,86,87,90,77,113,103,94,95,97,93,96,106,88,89,98,78,101,100,104,107,47,54,48,49,50,45,46,44,43,51,53,57,55,56,52],"latestChangedDtsFile":"./index.d.ts"},"version":"4.9.5"}
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-streams/utils/createHeaders.d.ts b/tools/ui/node_modules/workbox-streams/utils/createHeaders.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..368132415fd099b4051fe55d23394281b761a550
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/utils/createHeaders.d.ts
@@ -0,0 +1,17 @@
+import '../_version.js';
+/**
+ * This is a utility method that determines whether the current browser supports
+ * the features required to create streamed responses. Currently, it checks if
+ * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
+ * is available.
+ *
+ * @private
+ * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
+ * `'text/html'` will be used by default.
+ * @return {boolean} `true`, if the current browser meets the requirements for
+ * streaming responses, and `false` otherwise.
+ *
+ * @memberof workbox-streams
+ */
+declare function createHeaders(headersInit?: {}): Headers;
+export { createHeaders };
diff --git a/tools/ui/node_modules/workbox-streams/utils/createHeaders.js b/tools/ui/node_modules/workbox-streams/utils/createHeaders.js
new file mode 100644
index 0000000000000000000000000000000000000000..2115d9a013d44b3123ac6ce2484e7644e3675e65
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/utils/createHeaders.js
@@ -0,0 +1,31 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+import '../_version.js';
+/**
+ * This is a utility method that determines whether the current browser supports
+ * the features required to create streamed responses. Currently, it checks if
+ * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
+ * is available.
+ *
+ * @private
+ * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
+ * `'text/html'` will be used by default.
+ * @return {boolean} `true`, if the current browser meets the requirements for
+ * streaming responses, and `false` otherwise.
+ *
+ * @memberof workbox-streams
+ */
+function createHeaders(headersInit = {}) {
+ // See https://github.com/GoogleChrome/workbox/issues/1461
+ const headers = new Headers(headersInit);
+ if (!headers.has('content-type')) {
+ headers.set('content-type', 'text/html');
+ }
+ return headers;
+}
+export { createHeaders };
diff --git a/tools/ui/node_modules/workbox-streams/utils/createHeaders.mjs b/tools/ui/node_modules/workbox-streams/utils/createHeaders.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..c91c0c42652d820eeb8a7961929d33e86ca388e3
--- /dev/null
+++ b/tools/ui/node_modules/workbox-streams/utils/createHeaders.mjs
@@ -0,0 +1 @@
+export * from './createHeaders.js';
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-sw/LICENSE b/tools/ui/node_modules/workbox-sw/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..845b545fd0f5031a944cda8cf9018eb066500040
--- /dev/null
+++ b/tools/ui/node_modules/workbox-sw/LICENSE
@@ -0,0 +1,19 @@
+Copyright 2018 Google LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/tools/ui/node_modules/workbox-sw/README.md b/tools/ui/node_modules/workbox-sw/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..b4504bf72a328e1a8068689437c18993a9b061c1
--- /dev/null
+++ b/tools/ui/node_modules/workbox-sw/README.md
@@ -0,0 +1 @@
+This module's documentation can be found at https://developers.google.com/web/tools/workbox/modules/workbox-sw
diff --git a/tools/ui/node_modules/workbox-sw/_types.mjs b/tools/ui/node_modules/workbox-sw/_types.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..a06757b7b581d1566b4806a03e658458ddb44daf
--- /dev/null
+++ b/tools/ui/node_modules/workbox-sw/_types.mjs
@@ -0,0 +1,24 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import './_version.mjs';
+
+/**
+ * A `ModulePathCallback` function can be used to modify the modify the where
+ * Workbox modules are loaded.
+ *
+ * @callback ~ModulePathCallback
+ * @param {string} moduleName The name of the module to load (i.e.
+ * 'workbox-core', 'workbox-precaching' etc.).
+ * @param {boolean} debug When true, `dev` builds should be loaded, otherwise
+ * load `prod` builds.
+ * @return {string} This callback should return a path of module. This will
+ * be passed to `importScripts()`.
+ *
+ * @memberof workbox
+ */
diff --git a/tools/ui/node_modules/workbox-sw/_version.mjs b/tools/ui/node_modules/workbox-sw/_version.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..db26649438c273b1c3c5d4644f15d0c45cc429d2
--- /dev/null
+++ b/tools/ui/node_modules/workbox-sw/_version.mjs
@@ -0,0 +1 @@
+try{self['workbox:sw:7.4.1']&&_()}catch(e){}// eslint-disable-line
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-sw/build/workbox-sw.js b/tools/ui/node_modules/workbox-sw/build/workbox-sw.js
new file mode 100644
index 0000000000000000000000000000000000000000..13a45e262d84f8887d1d14c6e65353909a6702f8
--- /dev/null
+++ b/tools/ui/node_modules/workbox-sw/build/workbox-sw.js
@@ -0,0 +1,2 @@
+!function(){"use strict";try{self["workbox:sw:7.4.1"]&&_()}catch(t){}const t={backgroundSync:"background-sync",broadcastUpdate:"broadcast-update",cacheableResponse:"cacheable-response",core:"core",expiration:"expiration",googleAnalytics:"offline-ga",navigationPreload:"navigation-preload",precaching:"precaching",rangeRequests:"range-requests",routing:"routing",strategies:"strategies",streams:"streams",recipes:"recipes"};self.workbox=new class{constructor(){return this.v={},this.t={debug:"localhost"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.o=this.t.debug?"dev":"prod",this.i=!1,new Proxy(this,{get(e,s){if(e[s])return e[s];const o=t[s];return o&&e.loadModule(`workbox-${o}`),e[s]}})}setConfig(t={}){if(this.i)throw new Error("Config must be set before accessing workbox.* modules");Object.assign(this.t,t),this.o=this.t.debug?"dev":"prod"}loadModule(t){const e=this.h(t);try{importScripts(e),this.i=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}h(t){if(this.t.modulePathCb)return this.t.modulePathCb(t,this.t.debug);let e=["https://storage.googleapis.com/workbox-cdn/releases/7.4.1"];const s=`${t}.${this.o}.js`,o=this.t.modulePathPrefix;return o&&(e=o.split("/"),""===e[e.length-1]&&e.splice(e.length-1,1)),e.push(s),e.join("/")}}}();
+//# sourceMappingURL=workbox-sw.js.map
diff --git a/tools/ui/node_modules/workbox-sw/build/workbox-sw.js.map b/tools/ui/node_modules/workbox-sw/build/workbox-sw.js.map
new file mode 100644
index 0000000000000000000000000000000000000000..e68d31fddeb7a8b63cd270aa9dc7ea4000fee2b9
--- /dev/null
+++ b/tools/ui/node_modules/workbox-sw/build/workbox-sw.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"workbox-sw.js","sources":["../_version.mjs","../controllers/WorkboxSW.mjs","../index.mjs"],"sourcesContent":["try{self['workbox:sw:7.4.1']&&_()}catch(e){}// eslint-disable-line","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport '../_version.mjs';\n\nconst CDN_PATH = `WORKBOX_CDN_ROOT_URL`;\n\nconst MODULE_KEY_TO_NAME_MAPPING = {\n /**\n * @name backgroundSync\n * @memberof workbox\n * @see module:workbox-background-sync\n */\n backgroundSync: 'background-sync',\n /**\n * @name broadcastUpdate\n * @memberof workbox\n * @see module:workbox-broadcast-update\n */\n broadcastUpdate: 'broadcast-update',\n /**\n * @name cacheableResponse\n * @memberof workbox\n * @see module:workbox-cacheable-response\n */\n cacheableResponse: 'cacheable-response',\n /**\n * @name core\n * @memberof workbox\n * @see module:workbox-core\n */\n core: 'core',\n /**\n * @name expiration\n * @memberof workbox\n * @see module:workbox-expiration\n */\n expiration: 'expiration',\n /**\n * @name googleAnalytics\n * @memberof workbox\n * @see module:workbox-google-analytics\n */\n googleAnalytics: 'offline-ga',\n /**\n * @name navigationPreload\n * @memberof workbox\n * @see module:workbox-navigation-preload\n */\n navigationPreload: 'navigation-preload',\n /**\n * @name precaching\n * @memberof workbox\n * @see module:workbox-precaching\n */\n precaching: 'precaching',\n /**\n * @name rangeRequests\n * @memberof workbox\n * @see module:workbox-range-requests\n */\n rangeRequests: 'range-requests',\n /**\n * @name routing\n * @memberof workbox\n * @see module:workbox-routing\n */\n routing: 'routing',\n /**\n * @name strategies\n * @memberof workbox\n * @see module:workbox-strategies\n */\n strategies: 'strategies',\n /**\n * @name streams\n * @memberof workbox\n * @see module:workbox-streams\n */\n streams: 'streams',\n /**\n * @name recipes\n * @memberof workbox\n * @see module:workbox-recipes\n */\n recipes: 'recipes',\n};\n\n/**\n * This class can be used to make it easy to use the various parts of\n * Workbox.\n *\n * @private\n */\nexport class WorkboxSW {\n /**\n * Creates a proxy that automatically loads workbox namespaces on demand.\n *\n * @private\n */\n constructor() {\n this.v = {};\n this._options = {\n debug: self.location.hostname === 'localhost',\n modulePathPrefix: null,\n modulePathCb: null,\n };\n\n this._env = this._options.debug ? 'dev' : 'prod';\n this._modulesLoaded = false;\n\n return new Proxy(this, {\n get(target, key) {\n if (target[key]) {\n return target[key];\n }\n\n const moduleName = MODULE_KEY_TO_NAME_MAPPING[key];\n if (moduleName) {\n target.loadModule(`workbox-${moduleName}`);\n }\n\n return target[key];\n },\n });\n }\n\n /**\n * Updates the configuration options. You can specify whether to treat as a\n * debug build and whether to use a CDN or a specific path when importing\n * other workbox-modules\n *\n * @param {Object} [options]\n * @param {boolean} [options.debug] If true, `dev` builds are using, otherwise\n * `prod` builds are used. By default, `prod` is used unless on localhost.\n * @param {Function} [options.modulePathPrefix] To avoid using the CDN with\n * `workbox-sw` set the path prefix of where modules should be loaded from.\n * For example `modulePathPrefix: '/third_party/workbox/v3.0.0/'`.\n * @param {workbox~ModulePathCallback} [options.modulePathCb] If defined,\n * this callback will be responsible for determining the path of each\n * workbox module.\n *\n * @alias workbox.setConfig\n */\n setConfig(options = {}) {\n if (!this._modulesLoaded) {\n Object.assign(this._options, options);\n this._env = this._options.debug ? 'dev' : 'prod';\n } else {\n throw new Error('Config must be set before accessing workbox.* modules');\n }\n }\n\n /**\n * Load a Workbox module by passing in the appropriate module name.\n *\n * This is not generally needed unless you know there are modules that are\n * dynamically used and you want to safe guard use of the module while the\n * user may be offline.\n *\n * @param {string} moduleName\n *\n * @alias workbox.loadModule\n */\n loadModule(moduleName) {\n const modulePath = this._getImportPath(moduleName);\n try {\n importScripts(modulePath);\n this._modulesLoaded = true;\n } catch (err) {\n // TODO Add context of this error if using the CDN vs the local file.\n\n // We can't rely on workbox-core being loaded so using console\n // eslint-disable-next-line\n console.error(\n `Unable to import module '${moduleName}' from '${modulePath}'.`);\n throw err;\n }\n }\n\n /**\n * This method will get the path / CDN URL to be used for importScript calls.\n *\n * @param {string} moduleName\n * @return {string} URL to the desired module.\n *\n * @private\n */\n _getImportPath(moduleName) {\n if (this._options.modulePathCb) {\n return this._options.modulePathCb(moduleName, this._options.debug);\n }\n\n // TODO: This needs to be dynamic some how.\n let pathParts = [CDN_PATH];\n\n const fileName = `${moduleName}.${this._env}.js`;\n\n const pathPrefix = this._options.modulePathPrefix;\n if (pathPrefix) {\n // Split to avoid issues with developers ending / not ending with slash\n pathParts = pathPrefix.split('/');\n\n // We don't need a slash at the end as we will be adding\n // a filename regardless\n if (pathParts[pathParts.length - 1] === '') {\n pathParts.splice(pathParts.length - 1, 1);\n }\n }\n\n pathParts.push(fileName);\n\n return pathParts.join('/');\n }\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {WorkboxSW} from './controllers/WorkboxSW.mjs';\nimport './_version.mjs';\n\n/**\n * @namespace workbox\n */\n\n// Don't export anything, just expose a global.\nself.workbox = new WorkboxSW();\n"],"names":["self","_","e","MODULE_KEY_TO_NAME_MAPPING","backgroundSync","broadcastUpdate","cacheableResponse","core","expiration","googleAnalytics","navigationPreload","precaching","rangeRequests","routing","strategies","streams","recipes","workbox","constructor","this","v","_options","debug","location","hostname","modulePathPrefix","modulePathCb","_env","_modulesLoaded","Proxy","get","target","key","moduleName","loadModule","setConfig","options","Error","Object","assign","modulePath","_getImportPath","importScripts","err","console","error","pathParts","fileName","pathPrefix","split","length","splice","push","join"],"mappings":"yBAAA,IAAIA,KAAK,qBAAqBC,GAAG,CAAC,MAAMC,GAAG,CCU3C,MAEMC,EAA6B,CAMjCC,eAAgB,kBAMhBC,gBAAiB,mBAMjBC,kBAAmB,qBAMnBC,KAAM,OAMNC,WAAY,aAMZC,gBAAiB,aAMjBC,kBAAmB,qBAMnBC,WAAY,aAMZC,cAAe,iBAMfC,QAAS,UAMTC,WAAY,aAMZC,QAAS,UAMTC,QAAS,WC1EXhB,KAAKiB,QAAU,IDmFR,MAMLC,cAWE,OAVAC,KAAKC,EAAI,CAAA,EACTD,KAAKE,EAAW,CACdC,MAAkC,cAA3BtB,KAAKuB,SAASC,SACrBC,iBAAkB,KAClBC,aAAc,MAGhBP,KAAKQ,EAAOR,KAAKE,EAASC,MAAQ,MAAQ,OAC1CH,KAAKS,GAAiB,EAEf,IAAIC,MAAMV,KAAM,CACrBW,IAAIC,EAAQC,GACV,GAAID,EAAOC,GACT,OAAOD,EAAOC,GAGhB,MAAMC,EAAa9B,EAA2B6B,GAK9C,OAJIC,GACFF,EAAOG,WAAY,WAAUD,KAGxBF,EAAOC,EAChB,GAEJ,CAmBAG,UAAUC,EAAU,IAClB,GAAKjB,KAAKS,EAIR,MAAM,IAAIS,MAAM,yDAHhBC,OAAOC,OAAOpB,KAAKE,EAAUe,GAC7BjB,KAAKQ,EAAOR,KAAKE,EAASC,MAAQ,MAAQ,MAI9C,CAaAY,WAAWD,GACT,MAAMO,EAAarB,KAAKsB,EAAeR,GACvC,IACES,cAAcF,GACdrB,KAAKS,GAAiB,CACxB,CAAE,MAAOe,GAOP,MAFAC,QAAQC,MACH,4BAA2BZ,YAAqBO,OAC/CG,CACR,CACF,CAUAF,EAAeR,GACb,GAAId,KAAKE,EAASK,aAChB,OAAOP,KAAKE,EAASK,aAAaO,EAAYd,KAAKE,EAASC,OAI9D,IAAIwB,EAAY,CA7LF,6DA+Ld,MAAMC,EAAY,GAAEd,KAAcd,KAAKQ,OAEjCqB,EAAa7B,KAAKE,EAASI,iBAcjC,OAbIuB,IAEFF,EAAYE,EAAWC,MAAM,KAIW,KAApCH,EAAUA,EAAUI,OAAS,IAC/BJ,EAAUK,OAAOL,EAAUI,OAAS,EAAG,IAI3CJ,EAAUM,KAAKL,GAERD,EAAUO,KAAK,IACxB"}
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-sw/controllers/WorkboxSW.mjs b/tools/ui/node_modules/workbox-sw/controllers/WorkboxSW.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..e5c4f2f45e113e6912485e9b8a796d8c181694dd
--- /dev/null
+++ b/tools/ui/node_modules/workbox-sw/controllers/WorkboxSW.mjs
@@ -0,0 +1,220 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import '../_version.mjs';
+
+const CDN_PATH = `WORKBOX_CDN_ROOT_URL`;
+
+const MODULE_KEY_TO_NAME_MAPPING = {
+ /**
+ * @name backgroundSync
+ * @memberof workbox
+ * @see module:workbox-background-sync
+ */
+ backgroundSync: 'background-sync',
+ /**
+ * @name broadcastUpdate
+ * @memberof workbox
+ * @see module:workbox-broadcast-update
+ */
+ broadcastUpdate: 'broadcast-update',
+ /**
+ * @name cacheableResponse
+ * @memberof workbox
+ * @see module:workbox-cacheable-response
+ */
+ cacheableResponse: 'cacheable-response',
+ /**
+ * @name core
+ * @memberof workbox
+ * @see module:workbox-core
+ */
+ core: 'core',
+ /**
+ * @name expiration
+ * @memberof workbox
+ * @see module:workbox-expiration
+ */
+ expiration: 'expiration',
+ /**
+ * @name googleAnalytics
+ * @memberof workbox
+ * @see module:workbox-google-analytics
+ */
+ googleAnalytics: 'offline-ga',
+ /**
+ * @name navigationPreload
+ * @memberof workbox
+ * @see module:workbox-navigation-preload
+ */
+ navigationPreload: 'navigation-preload',
+ /**
+ * @name precaching
+ * @memberof workbox
+ * @see module:workbox-precaching
+ */
+ precaching: 'precaching',
+ /**
+ * @name rangeRequests
+ * @memberof workbox
+ * @see module:workbox-range-requests
+ */
+ rangeRequests: 'range-requests',
+ /**
+ * @name routing
+ * @memberof workbox
+ * @see module:workbox-routing
+ */
+ routing: 'routing',
+ /**
+ * @name strategies
+ * @memberof workbox
+ * @see module:workbox-strategies
+ */
+ strategies: 'strategies',
+ /**
+ * @name streams
+ * @memberof workbox
+ * @see module:workbox-streams
+ */
+ streams: 'streams',
+ /**
+ * @name recipes
+ * @memberof workbox
+ * @see module:workbox-recipes
+ */
+ recipes: 'recipes',
+};
+
+/**
+ * This class can be used to make it easy to use the various parts of
+ * Workbox.
+ *
+ * @private
+ */
+export class WorkboxSW {
+ /**
+ * Creates a proxy that automatically loads workbox namespaces on demand.
+ *
+ * @private
+ */
+ constructor() {
+ this.v = {};
+ this._options = {
+ debug: self.location.hostname === 'localhost',
+ modulePathPrefix: null,
+ modulePathCb: null,
+ };
+
+ this._env = this._options.debug ? 'dev' : 'prod';
+ this._modulesLoaded = false;
+
+ return new Proxy(this, {
+ get(target, key) {
+ if (target[key]) {
+ return target[key];
+ }
+
+ const moduleName = MODULE_KEY_TO_NAME_MAPPING[key];
+ if (moduleName) {
+ target.loadModule(`workbox-${moduleName}`);
+ }
+
+ return target[key];
+ },
+ });
+ }
+
+ /**
+ * Updates the configuration options. You can specify whether to treat as a
+ * debug build and whether to use a CDN or a specific path when importing
+ * other workbox-modules
+ *
+ * @param {Object} [options]
+ * @param {boolean} [options.debug] If true, `dev` builds are using, otherwise
+ * `prod` builds are used. By default, `prod` is used unless on localhost.
+ * @param {Function} [options.modulePathPrefix] To avoid using the CDN with
+ * `workbox-sw` set the path prefix of where modules should be loaded from.
+ * For example `modulePathPrefix: '/third_party/workbox/v3.0.0/'`.
+ * @param {workbox~ModulePathCallback} [options.modulePathCb] If defined,
+ * this callback will be responsible for determining the path of each
+ * workbox module.
+ *
+ * @alias workbox.setConfig
+ */
+ setConfig(options = {}) {
+ if (!this._modulesLoaded) {
+ Object.assign(this._options, options);
+ this._env = this._options.debug ? 'dev' : 'prod';
+ } else {
+ throw new Error('Config must be set before accessing workbox.* modules');
+ }
+ }
+
+ /**
+ * Load a Workbox module by passing in the appropriate module name.
+ *
+ * This is not generally needed unless you know there are modules that are
+ * dynamically used and you want to safe guard use of the module while the
+ * user may be offline.
+ *
+ * @param {string} moduleName
+ *
+ * @alias workbox.loadModule
+ */
+ loadModule(moduleName) {
+ const modulePath = this._getImportPath(moduleName);
+ try {
+ importScripts(modulePath);
+ this._modulesLoaded = true;
+ } catch (err) {
+ // TODO Add context of this error if using the CDN vs the local file.
+
+ // We can't rely on workbox-core being loaded so using console
+ // eslint-disable-next-line
+ console.error(
+ `Unable to import module '${moduleName}' from '${modulePath}'.`);
+ throw err;
+ }
+ }
+
+ /**
+ * This method will get the path / CDN URL to be used for importScript calls.
+ *
+ * @param {string} moduleName
+ * @return {string} URL to the desired module.
+ *
+ * @private
+ */
+ _getImportPath(moduleName) {
+ if (this._options.modulePathCb) {
+ return this._options.modulePathCb(moduleName, this._options.debug);
+ }
+
+ // TODO: This needs to be dynamic some how.
+ let pathParts = [CDN_PATH];
+
+ const fileName = `${moduleName}.${this._env}.js`;
+
+ const pathPrefix = this._options.modulePathPrefix;
+ if (pathPrefix) {
+ // Split to avoid issues with developers ending / not ending with slash
+ pathParts = pathPrefix.split('/');
+
+ // We don't need a slash at the end as we will be adding
+ // a filename regardless
+ if (pathParts[pathParts.length - 1] === '') {
+ pathParts.splice(pathParts.length - 1, 1);
+ }
+ }
+
+ pathParts.push(fileName);
+
+ return pathParts.join('/');
+ }
+}
diff --git a/tools/ui/node_modules/workbox-sw/index.mjs b/tools/ui/node_modules/workbox-sw/index.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..f019fb03d504635a1f94aa955b740a5f6c692b9d
--- /dev/null
+++ b/tools/ui/node_modules/workbox-sw/index.mjs
@@ -0,0 +1,17 @@
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import {WorkboxSW} from './controllers/WorkboxSW.mjs';
+import './_version.mjs';
+
+/**
+ * @namespace workbox
+ */
+
+// Don't export anything, just expose a global.
+self.workbox = new WorkboxSW();
diff --git a/tools/ui/node_modules/workbox-sw/package.json b/tools/ui/node_modules/workbox-sw/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..b542687475a18b03d507fd55493123c527ced27e
--- /dev/null
+++ b/tools/ui/node_modules/workbox-sw/package.json
@@ -0,0 +1,27 @@
+{
+ "name": "workbox-sw",
+ "version": "7.4.1",
+ "license": "MIT",
+ "author": "Google's Web DevRel Team and Google's Aurora Team",
+ "description": "This module makes it easy to get started with the Workbox service worker libraries.",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/googlechrome/workbox.git"
+ },
+ "bugs": "https://github.com/googlechrome/workbox/issues",
+ "homepage": "https://github.com/GoogleChrome/workbox",
+ "keywords": [
+ "workbox",
+ "workboxjs",
+ "service worker",
+ "sw"
+ ],
+ "workbox": {
+ "browserNamespace": "workbox",
+ "packageType": "sw",
+ "prodOnly": true
+ },
+ "main": "build/workbox-sw.js",
+ "module": "index.mjs",
+ "gitHead": "62b9d8ba8eb3c1a2ab8aac9d84c90cda7865d6a3"
+}
diff --git a/tools/ui/node_modules/workbox-window/LICENSE b/tools/ui/node_modules/workbox-window/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..845b545fd0f5031a944cda8cf9018eb066500040
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/LICENSE
@@ -0,0 +1,19 @@
+Copyright 2018 Google LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/tools/ui/node_modules/workbox-window/README.md b/tools/ui/node_modules/workbox-window/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..a8c9b9b474c300493f95ee03b4515b3aaf0d71e1
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/README.md
@@ -0,0 +1 @@
+This module's documentation can be found at https://developers.google.com/web/tools/workbox/modules/workbox-window
diff --git a/tools/ui/node_modules/workbox-window/Workbox.d.ts b/tools/ui/node_modules/workbox-window/Workbox.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..3fafc77e9e70b9f9b286f01bca7edf53459b7340
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/Workbox.d.ts
@@ -0,0 +1,272 @@
+import { TrustedScriptURL } from 'trusted-types/lib';
+import { WorkboxEventTarget } from './utils/WorkboxEventTarget.js';
+import './_version.js';
+/**
+ * A class to aid in handling service worker registration, updates, and
+ * reacting to service worker lifecycle events.
+ *
+ * @fires {@link workbox-window.Workbox#message}
+ * @fires {@link workbox-window.Workbox#installed}
+ * @fires {@link workbox-window.Workbox#waiting}
+ * @fires {@link workbox-window.Workbox#controlling}
+ * @fires {@link workbox-window.Workbox#activated}
+ * @fires {@link workbox-window.Workbox#redundant}
+ * @memberof workbox-window
+ */
+declare class Workbox extends WorkboxEventTarget {
+ private readonly _scriptURL;
+ private readonly _registerOptions;
+ private _updateFoundCount;
+ private readonly _swDeferred;
+ private readonly _activeDeferred;
+ private readonly _controllingDeferred;
+ private _registrationTime;
+ private _isUpdate?;
+ private _compatibleControllingSW?;
+ private _registration?;
+ private _sw?;
+ private readonly _ownSWs;
+ private _externalSW?;
+ private _waitingTimeout?;
+ /**
+ * Creates a new Workbox instance with a script URL and service worker
+ * options. The script URL and options are the same as those used when
+ * calling [navigator.serviceWorker.register(scriptURL, options)](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).
+ *
+ * @param {string|TrustedScriptURL} scriptURL The service worker script
+ * associated with this instance. Using a
+ * [`TrustedScriptURL`](https://web.dev/trusted-types/) is supported.
+ * @param {Object} [registerOptions] The service worker options associated
+ * with this instance.
+ */
+ constructor(scriptURL: string | TrustedScriptURL, registerOptions?: {});
+ /**
+ * Registers a service worker for this instances script URL and service
+ * worker options. By default this method delays registration until after
+ * the window has loaded.
+ *
+ * @param {Object} [options]
+ * @param {Function} [options.immediate=false] Setting this to true will
+ * register the service worker immediately, even if the window has
+ * not loaded (not recommended).
+ */
+ register({ immediate }?: {
+ immediate?: boolean | undefined;
+ }): Promise;
+ /**
+ * Checks for updates of the registered service worker.
+ */
+ update(): Promise;
+ /**
+ * Resolves to the service worker registered by this instance as soon as it
+ * is active. If a service worker was already controlling at registration
+ * time then it will resolve to that if the script URLs (and optionally
+ * script versions) match, otherwise it will wait until an update is found
+ * and activates.
+ *
+ * @return {Promise}
+ */
+ get active(): Promise;
+ /**
+ * Resolves to the service worker registered by this instance as soon as it
+ * is controlling the page. If a service worker was already controlling at
+ * registration time then it will resolve to that if the script URLs (and
+ * optionally script versions) match, otherwise it will wait until an update
+ * is found and starts controlling the page.
+ * Note: the first time a service worker is installed it will active but
+ * not start controlling the page unless `clients.claim()` is called in the
+ * service worker.
+ *
+ * @return {Promise}
+ */
+ get controlling(): Promise;
+ /**
+ * Resolves with a reference to a service worker that matches the script URL
+ * of this instance, as soon as it's available.
+ *
+ * If, at registration time, there's already an active or waiting service
+ * worker with a matching script URL, it will be used (with the waiting
+ * service worker taking precedence over the active service worker if both
+ * match, since the waiting service worker would have been registered more
+ * recently).
+ * If there's no matching active or waiting service worker at registration
+ * time then the promise will not resolve until an update is found and starts
+ * installing, at which point the installing service worker is used.
+ *
+ * @return {Promise}
+ */
+ getSW(): Promise;
+ /**
+ * Sends the passed data object to the service worker registered by this
+ * instance (via {@link workbox-window.Workbox#getSW}) and resolves
+ * with a response (if any).
+ *
+ * A response can be set in a message handler in the service worker by
+ * calling `event.ports[0].postMessage(...)`, which will resolve the promise
+ * returned by `messageSW()`. If no response is set, the promise will never
+ * resolve.
+ *
+ * @param {Object} data An object to send to the service worker
+ * @return {Promise}
+ */
+ messageSW(data: object): Promise;
+ /**
+ * Sends a `{type: 'SKIP_WAITING'}` message to the service worker that's
+ * currently in the `waiting` state associated with the current registration.
+ *
+ * If there is no current registration or no service worker is `waiting`,
+ * calling this will have no effect.
+ */
+ messageSkipWaiting(): void;
+ /**
+ * Checks for a service worker already controlling the page and returns
+ * it if its script URL matches.
+ *
+ * @private
+ * @return {ServiceWorker|undefined}
+ */
+ private _getControllingSWIfCompatible;
+ /**
+ * Registers a service worker for this instances script URL and register
+ * options and tracks the time registration was complete.
+ *
+ * @private
+ */
+ private _registerScript;
+ /**
+ * @private
+ */
+ private readonly _onUpdateFound;
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ private readonly _onStateChange;
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ private readonly _onControllerChange;
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ private readonly _onMessage;
+}
+export { Workbox };
+/**
+ * The `message` event is dispatched any time a `postMessage` is received.
+ *
+ * @event workbox-window.Workbox#message
+ * @type {WorkboxEvent}
+ * @property {*} data The `data` property from the original `message` event.
+ * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}
+ * event.
+ * @property {string} type `message`.
+ * @property {MessagePort[]} ports The `ports` value from `originalEvent`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `installed` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}
+ * changes to `installed`.
+ *
+ * Then can happen either the very first time a service worker is installed,
+ * or after an update to the current service worker is found. In the case
+ * of an update being found, the event's `isUpdate` property will be `true`.
+ *
+ * @event workbox-window.Workbox#installed
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `installed`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `waiting` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}
+ * changes to `installed` and then doesn't immediately change to `activating`.
+ * It may also be dispatched if a service worker with the same
+ * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}
+ * was already waiting when the {@link workbox-window.Workbox#register}
+ * method was called.
+ *
+ * @event workbox-window.Workbox#waiting
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event|undefined} originalEvent The original
+ * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event, or `undefined` in the case where the service worker was waiting
+ * to before `.register()` was called.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with
+ * a matching `scriptURL` was already waiting when this `Workbox`
+ * instance called `register()`.
+ * @property {string} type `waiting`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `controlling` event is dispatched if a
+ * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}
+ * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}
+ * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}
+ * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}
+ * matches the `scriptURL` of the `Workbox` instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.
+ *
+ * @event workbox-window.Workbox#controlling
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this service worker was registered.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `controlling`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `activated` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}
+ * changes to `activated`.
+ *
+ * @event workbox-window.Workbox#activated
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `activated`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `redundant` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}
+ * changes to `redundant`.
+ *
+ * @event workbox-window.Workbox#redundant
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {string} type `redundant`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
diff --git a/tools/ui/node_modules/workbox-window/Workbox.js b/tools/ui/node_modules/workbox-window/Workbox.js
new file mode 100644
index 0000000000000000000000000000000000000000..06fb687e23a18a6152de9c7d51b19ad055375102
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/Workbox.js
@@ -0,0 +1,620 @@
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+import { Deferred } from 'workbox-core/_private/Deferred.js';
+import { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';
+import { logger } from 'workbox-core/_private/logger.js';
+import { messageSW } from './messageSW.js';
+import { WorkboxEventTarget } from './utils/WorkboxEventTarget.js';
+import { urlsMatch } from './utils/urlsMatch.js';
+import { WorkboxEvent } from './utils/WorkboxEvent.js';
+import './_version.js';
+// The time a SW must be in the waiting phase before we can conclude
+// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically
+// chosen, but it seems to avoid false positives in my testing.
+const WAITING_TIMEOUT_DURATION = 200;
+// The amount of time after a registration that we can reasonably conclude
+// that the registration didn't trigger an update.
+const REGISTRATION_TIMEOUT_DURATION = 60000;
+// The de facto standard message that a service worker should be listening for
+// to trigger a call to skipWaiting().
+const SKIP_WAITING_MESSAGE = { type: 'SKIP_WAITING' };
+/**
+ * A class to aid in handling service worker registration, updates, and
+ * reacting to service worker lifecycle events.
+ *
+ * @fires {@link workbox-window.Workbox#message}
+ * @fires {@link workbox-window.Workbox#installed}
+ * @fires {@link workbox-window.Workbox#waiting}
+ * @fires {@link workbox-window.Workbox#controlling}
+ * @fires {@link workbox-window.Workbox#activated}
+ * @fires {@link workbox-window.Workbox#redundant}
+ * @memberof workbox-window
+ */
+class Workbox extends WorkboxEventTarget {
+ /**
+ * Creates a new Workbox instance with a script URL and service worker
+ * options. The script URL and options are the same as those used when
+ * calling [navigator.serviceWorker.register(scriptURL, options)](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).
+ *
+ * @param {string|TrustedScriptURL} scriptURL The service worker script
+ * associated with this instance. Using a
+ * [`TrustedScriptURL`](https://web.dev/trusted-types/) is supported.
+ * @param {Object} [registerOptions] The service worker options associated
+ * with this instance.
+ */
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ constructor(scriptURL, registerOptions = {}) {
+ super();
+ this._registerOptions = {};
+ this._updateFoundCount = 0;
+ // Deferreds we can resolve later.
+ this._swDeferred = new Deferred();
+ this._activeDeferred = new Deferred();
+ this._controllingDeferred = new Deferred();
+ this._registrationTime = 0;
+ this._ownSWs = new Set();
+ /**
+ * @private
+ */
+ this._onUpdateFound = () => {
+ // `this._registration` will never be `undefined` after an update is found.
+ const registration = this._registration;
+ const installingSW = registration.installing;
+ // If the script URL passed to `navigator.serviceWorker.register()` is
+ // different from the current controlling SW's script URL, we know any
+ // successful registration calls will trigger an `updatefound` event.
+ // But if the registered script URL is the same as the current controlling
+ // SW's script URL, we'll only get an `updatefound` event if the file
+ // changed since it was last registered. This can be a problem if the user
+ // opens up the same page in a different tab, and that page registers
+ // a SW that triggers an update. It's a problem because this page has no
+ // good way of knowing whether the `updatefound` event came from the SW
+ // script it registered or from a registration attempt made by a newer
+ // version of the page running in another tab.
+ // To minimize the possibility of a false positive, we use the logic here:
+ const updateLikelyTriggeredExternally =
+ // Since we enforce only calling `register()` once, and since we don't
+ // add the `updatefound` event listener until the `register()` call, if
+ // `_updateFoundCount` is > 0 then it means this method has already
+ // been called, thus this SW must be external
+ this._updateFoundCount > 0 ||
+ // If the script URL of the installing SW is different from this
+ // instance's script URL, we know it's definitely not from our
+ // registration.
+ !urlsMatch(installingSW.scriptURL, this._scriptURL.toString()) ||
+ // If all of the above are false, then we use a time-based heuristic:
+ // Any `updatefound` event that occurs long after our registration is
+ // assumed to be external.
+ performance.now() > this._registrationTime + REGISTRATION_TIMEOUT_DURATION
+ ? // If any of the above are not true, we assume the update was
+ // triggered by this instance.
+ true
+ : false;
+ if (updateLikelyTriggeredExternally) {
+ this._externalSW = installingSW;
+ registration.removeEventListener('updatefound', this._onUpdateFound);
+ }
+ else {
+ // If the update was not triggered externally we know the installing
+ // SW is the one we registered, so we set it.
+ this._sw = installingSW;
+ this._ownSWs.add(installingSW);
+ this._swDeferred.resolve(installingSW);
+ // The `installing` state isn't something we have a dedicated
+ // callback for, but we do log messages for it in development.
+ if (process.env.NODE_ENV !== 'production') {
+ if (navigator.serviceWorker.controller) {
+ logger.log('Updated service worker found. Installing now...');
+ }
+ else {
+ logger.log('Service worker is installing...');
+ }
+ }
+ }
+ // Increment the `updatefound` count, so future invocations of this
+ // method can be sure they were triggered externally.
+ ++this._updateFoundCount;
+ // Add a `statechange` listener regardless of whether this update was
+ // triggered externally, since we have callbacks for both.
+ installingSW.addEventListener('statechange', this._onStateChange);
+ };
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ this._onStateChange = (originalEvent) => {
+ // `this._registration` will never be `undefined` after an update is found.
+ const registration = this._registration;
+ const sw = originalEvent.target;
+ const { state } = sw;
+ const isExternal = sw === this._externalSW;
+ const eventProps = {
+ sw,
+ isExternal,
+ originalEvent,
+ };
+ if (!isExternal && this._isUpdate) {
+ eventProps.isUpdate = true;
+ }
+ this.dispatchEvent(new WorkboxEvent(state, eventProps));
+ if (state === 'installed') {
+ // This timeout is used to ignore cases where the service worker calls
+ // `skipWaiting()` in the install event, thus moving it directly in the
+ // activating state. (Since all service workers *must* go through the
+ // waiting phase, the only way to detect `skipWaiting()` called in the
+ // install event is to observe that the time spent in the waiting phase
+ // is very short.)
+ // NOTE: we don't need separate timeouts for the own and external SWs
+ // since they can't go through these phases at the same time.
+ this._waitingTimeout = self.setTimeout(() => {
+ // Ensure the SW is still waiting (it may now be redundant).
+ if (state === 'installed' && registration.waiting === sw) {
+ this.dispatchEvent(new WorkboxEvent('waiting', eventProps));
+ if (process.env.NODE_ENV !== 'production') {
+ if (isExternal) {
+ logger.warn('An external service worker has installed but is ' +
+ 'waiting for this client to close before activating...');
+ }
+ else {
+ logger.warn('The service worker has installed but is waiting ' +
+ 'for existing clients to close before activating...');
+ }
+ }
+ }
+ }, WAITING_TIMEOUT_DURATION);
+ }
+ else if (state === 'activating') {
+ clearTimeout(this._waitingTimeout);
+ if (!isExternal) {
+ this._activeDeferred.resolve(sw);
+ }
+ }
+ if (process.env.NODE_ENV !== 'production') {
+ switch (state) {
+ case 'installed':
+ if (isExternal) {
+ logger.warn('An external service worker has installed. ' +
+ 'You may want to suggest users reload this page.');
+ }
+ else {
+ logger.log('Registered service worker installed.');
+ }
+ break;
+ case 'activated':
+ if (isExternal) {
+ logger.warn('An external service worker has activated.');
+ }
+ else {
+ logger.log('Registered service worker activated.');
+ if (sw !== navigator.serviceWorker.controller) {
+ logger.warn('The registered service worker is active but ' +
+ 'not yet controlling the page. Reload or run ' +
+ '`clients.claim()` in the service worker.');
+ }
+ }
+ break;
+ case 'redundant':
+ if (sw === this._compatibleControllingSW) {
+ logger.log('Previously controlling service worker now redundant!');
+ }
+ else if (!isExternal) {
+ logger.log('Registered service worker now redundant!');
+ }
+ break;
+ }
+ }
+ };
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ this._onControllerChange = (originalEvent) => {
+ const sw = this._sw;
+ const isExternal = sw !== navigator.serviceWorker.controller;
+ // Unconditionally dispatch the controlling event, with isExternal set
+ // to distinguish between controller changes due to the initial registration
+ // vs. an update-check or other tab's registration.
+ // See https://github.com/GoogleChrome/workbox/issues/2786
+ this.dispatchEvent(new WorkboxEvent('controlling', {
+ isExternal,
+ originalEvent,
+ sw,
+ isUpdate: this._isUpdate,
+ }));
+ if (!isExternal) {
+ if (process.env.NODE_ENV !== 'production') {
+ logger.log('Registered service worker now controlling this page.');
+ }
+ this._controllingDeferred.resolve(sw);
+ }
+ };
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ this._onMessage = async (originalEvent) => {
+ // Can't change type 'any' of data.
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ const { data, ports, source } = originalEvent;
+ // Wait until there's an "own" service worker. This is used to buffer
+ // `message` events that may be received prior to calling `register()`.
+ await this.getSW();
+ // If the service worker that sent the message is in the list of own
+ // service workers for this instance, dispatch a `message` event.
+ // NOTE: we check for all previously owned service workers rather than
+ // just the current one because some messages (e.g. cache updates) use
+ // a timeout when sent and may be delayed long enough for a service worker
+ // update to be found.
+ if (this._ownSWs.has(source)) {
+ this.dispatchEvent(new WorkboxEvent('message', {
+ // Can't change type 'any' of data.
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ data,
+ originalEvent,
+ ports,
+ sw: source,
+ }));
+ }
+ };
+ this._scriptURL = scriptURL;
+ this._registerOptions = registerOptions;
+ // Add a message listener immediately since messages received during
+ // page load are buffered only until the DOMContentLoaded event:
+ // https://github.com/GoogleChrome/workbox/issues/2202
+ navigator.serviceWorker.addEventListener('message', this._onMessage);
+ }
+ /**
+ * Registers a service worker for this instances script URL and service
+ * worker options. By default this method delays registration until after
+ * the window has loaded.
+ *
+ * @param {Object} [options]
+ * @param {Function} [options.immediate=false] Setting this to true will
+ * register the service worker immediately, even if the window has
+ * not loaded (not recommended).
+ */
+ async register({ immediate = false } = {}) {
+ if (process.env.NODE_ENV !== 'production') {
+ if (this._registrationTime) {
+ logger.error('Cannot re-register a Workbox instance after it has ' +
+ 'been registered. Create a new instance instead.');
+ return;
+ }
+ }
+ if (!immediate && document.readyState !== 'complete') {
+ await new Promise((res) => window.addEventListener('load', res));
+ }
+ // Set this flag to true if any service worker was controlling the page
+ // at registration time.
+ this._isUpdate = Boolean(navigator.serviceWorker.controller);
+ // Before registering, attempt to determine if a SW is already controlling
+ // the page, and if that SW script (and version, if specified) matches this
+ // instance's script.
+ this._compatibleControllingSW = this._getControllingSWIfCompatible();
+ this._registration = await this._registerScript();
+ // If we have a compatible controller, store the controller as the "own"
+ // SW, resolve active/controlling deferreds and add necessary listeners.
+ if (this._compatibleControllingSW) {
+ this._sw = this._compatibleControllingSW;
+ this._activeDeferred.resolve(this._compatibleControllingSW);
+ this._controllingDeferred.resolve(this._compatibleControllingSW);
+ this._compatibleControllingSW.addEventListener('statechange', this._onStateChange, { once: true });
+ }
+ // If there's a waiting service worker with a matching URL before the
+ // `updatefound` event fires, it likely means that this site is open
+ // in another tab, or the user refreshed the page (and thus the previous
+ // page wasn't fully unloaded before this page started loading).
+ // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting
+ const waitingSW = this._registration.waiting;
+ if (waitingSW &&
+ urlsMatch(waitingSW.scriptURL, this._scriptURL.toString())) {
+ // Store the waiting SW as the "own" Sw, even if it means overwriting
+ // a compatible controller.
+ this._sw = waitingSW;
+ // Run this in the next microtask, so any code that adds an event
+ // listener after awaiting `register()` will get this event.
+ dontWaitFor(Promise.resolve().then(() => {
+ this.dispatchEvent(new WorkboxEvent('waiting', {
+ sw: waitingSW,
+ wasWaitingBeforeRegister: true,
+ }));
+ if (process.env.NODE_ENV !== 'production') {
+ logger.warn('A service worker was already waiting to activate ' +
+ 'before this script was registered...');
+ }
+ }));
+ }
+ // If an "own" SW is already set, resolve the deferred.
+ if (this._sw) {
+ this._swDeferred.resolve(this._sw);
+ this._ownSWs.add(this._sw);
+ }
+ if (process.env.NODE_ENV !== 'production') {
+ logger.log('Successfully registered service worker.', this._scriptURL.toString());
+ if (navigator.serviceWorker.controller) {
+ if (this._compatibleControllingSW) {
+ logger.debug('A service worker with the same script URL ' +
+ 'is already controlling this page.');
+ }
+ else {
+ logger.debug('A service worker with a different script URL is ' +
+ 'currently controlling the page. The browser is now fetching ' +
+ 'the new script now...');
+ }
+ }
+ const currentPageIsOutOfScope = () => {
+ const scopeURL = new URL(this._registerOptions.scope || this._scriptURL.toString(), document.baseURI);
+ const scopeURLBasePath = new URL('./', scopeURL.href).pathname;
+ return !location.pathname.startsWith(scopeURLBasePath);
+ };
+ if (currentPageIsOutOfScope()) {
+ logger.warn('The current page is not in scope for the registered ' +
+ 'service worker. Was this a mistake?');
+ }
+ }
+ this._registration.addEventListener('updatefound', this._onUpdateFound);
+ navigator.serviceWorker.addEventListener('controllerchange', this._onControllerChange);
+ return this._registration;
+ }
+ /**
+ * Checks for updates of the registered service worker.
+ */
+ async update() {
+ if (!this._registration) {
+ if (process.env.NODE_ENV !== 'production') {
+ logger.error('Cannot update a Workbox instance without ' +
+ 'being registered. Register the Workbox instance first.');
+ }
+ return;
+ }
+ // Try to update registration
+ await this._registration.update();
+ }
+ /**
+ * Resolves to the service worker registered by this instance as soon as it
+ * is active. If a service worker was already controlling at registration
+ * time then it will resolve to that if the script URLs (and optionally
+ * script versions) match, otherwise it will wait until an update is found
+ * and activates.
+ *
+ * @return {Promise}
+ */
+ get active() {
+ return this._activeDeferred.promise;
+ }
+ /**
+ * Resolves to the service worker registered by this instance as soon as it
+ * is controlling the page. If a service worker was already controlling at
+ * registration time then it will resolve to that if the script URLs (and
+ * optionally script versions) match, otherwise it will wait until an update
+ * is found and starts controlling the page.
+ * Note: the first time a service worker is installed it will active but
+ * not start controlling the page unless `clients.claim()` is called in the
+ * service worker.
+ *
+ * @return {Promise}
+ */
+ get controlling() {
+ return this._controllingDeferred.promise;
+ }
+ /**
+ * Resolves with a reference to a service worker that matches the script URL
+ * of this instance, as soon as it's available.
+ *
+ * If, at registration time, there's already an active or waiting service
+ * worker with a matching script URL, it will be used (with the waiting
+ * service worker taking precedence over the active service worker if both
+ * match, since the waiting service worker would have been registered more
+ * recently).
+ * If there's no matching active or waiting service worker at registration
+ * time then the promise will not resolve until an update is found and starts
+ * installing, at which point the installing service worker is used.
+ *
+ * @return {Promise}
+ */
+ getSW() {
+ // If `this._sw` is set, resolve with that as we want `getSW()` to
+ // return the correct (new) service worker if an update is found.
+ return this._sw !== undefined
+ ? Promise.resolve(this._sw)
+ : this._swDeferred.promise;
+ }
+ /**
+ * Sends the passed data object to the service worker registered by this
+ * instance (via {@link workbox-window.Workbox#getSW}) and resolves
+ * with a response (if any).
+ *
+ * A response can be set in a message handler in the service worker by
+ * calling `event.ports[0].postMessage(...)`, which will resolve the promise
+ * returned by `messageSW()`. If no response is set, the promise will never
+ * resolve.
+ *
+ * @param {Object} data An object to send to the service worker
+ * @return {Promise}
+ */
+ // We might be able to change the 'data' type to Record in the future.
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ async messageSW(data) {
+ const sw = await this.getSW();
+ return messageSW(sw, data);
+ }
+ /**
+ * Sends a `{type: 'SKIP_WAITING'}` message to the service worker that's
+ * currently in the `waiting` state associated with the current registration.
+ *
+ * If there is no current registration or no service worker is `waiting`,
+ * calling this will have no effect.
+ */
+ messageSkipWaiting() {
+ if (this._registration && this._registration.waiting) {
+ void messageSW(this._registration.waiting, SKIP_WAITING_MESSAGE);
+ }
+ }
+ /**
+ * Checks for a service worker already controlling the page and returns
+ * it if its script URL matches.
+ *
+ * @private
+ * @return {ServiceWorker|undefined}
+ */
+ _getControllingSWIfCompatible() {
+ const controller = navigator.serviceWorker.controller;
+ if (controller &&
+ urlsMatch(controller.scriptURL, this._scriptURL.toString())) {
+ return controller;
+ }
+ else {
+ return undefined;
+ }
+ }
+ /**
+ * Registers a service worker for this instances script URL and register
+ * options and tracks the time registration was complete.
+ *
+ * @private
+ */
+ async _registerScript() {
+ try {
+ // this._scriptURL may be a TrustedScriptURL, but there's no support for
+ // passing that to register() in lib.dom right now.
+ // https://github.com/GoogleChrome/workbox/issues/2855
+ const reg = await navigator.serviceWorker.register(this._scriptURL, this._registerOptions);
+ // Keep track of when registration happened, so it can be used in the
+ // `this._onUpdateFound` heuristic. Also use the presence of this
+ // property as a way to see if `.register()` has been called.
+ this._registrationTime = performance.now();
+ return reg;
+ }
+ catch (error) {
+ if (process.env.NODE_ENV !== 'production') {
+ logger.error(error);
+ }
+ // Re-throw the error.
+ throw error;
+ }
+ }
+}
+export { Workbox };
+// The jsdoc comments below outline the events this instance may dispatch:
+// -----------------------------------------------------------------------
+/**
+ * The `message` event is dispatched any time a `postMessage` is received.
+ *
+ * @event workbox-window.Workbox#message
+ * @type {WorkboxEvent}
+ * @property {*} data The `data` property from the original `message` event.
+ * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}
+ * event.
+ * @property {string} type `message`.
+ * @property {MessagePort[]} ports The `ports` value from `originalEvent`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `installed` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}
+ * changes to `installed`.
+ *
+ * Then can happen either the very first time a service worker is installed,
+ * or after an update to the current service worker is found. In the case
+ * of an update being found, the event's `isUpdate` property will be `true`.
+ *
+ * @event workbox-window.Workbox#installed
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `installed`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `waiting` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}
+ * changes to `installed` and then doesn't immediately change to `activating`.
+ * It may also be dispatched if a service worker with the same
+ * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}
+ * was already waiting when the {@link workbox-window.Workbox#register}
+ * method was called.
+ *
+ * @event workbox-window.Workbox#waiting
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event|undefined} originalEvent The original
+ * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event, or `undefined` in the case where the service worker was waiting
+ * to before `.register()` was called.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with
+ * a matching `scriptURL` was already waiting when this `Workbox`
+ * instance called `register()`.
+ * @property {string} type `waiting`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `controlling` event is dispatched if a
+ * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}
+ * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}
+ * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}
+ * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}
+ * matches the `scriptURL` of the `Workbox` instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.
+ *
+ * @event workbox-window.Workbox#controlling
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this service worker was registered.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `controlling`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `activated` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}
+ * changes to `activated`.
+ *
+ * @event workbox-window.Workbox#activated
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `activated`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `redundant` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}
+ * changes to `redundant`.
+ *
+ * @event workbox-window.Workbox#redundant
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {string} type `redundant`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
diff --git a/tools/ui/node_modules/workbox-window/Workbox.mjs b/tools/ui/node_modules/workbox-window/Workbox.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..ef3b8aab206f211cec2cd99903f950b79cd2b8af
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/Workbox.mjs
@@ -0,0 +1 @@
+export * from './Workbox.js';
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-window/_version.d.ts b/tools/ui/node_modules/workbox-window/_version.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/tools/ui/node_modules/workbox-window/_version.js b/tools/ui/node_modules/workbox-window/_version.js
new file mode 100644
index 0000000000000000000000000000000000000000..3848955433d6c27c04b6eca6d250009f4741b4be
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/_version.js
@@ -0,0 +1,6 @@
+"use strict";
+// @ts-ignore
+try {
+ self['workbox:window:7.4.0'] && _();
+}
+catch (e) { }
diff --git a/tools/ui/node_modules/workbox-window/_version.mjs b/tools/ui/node_modules/workbox-window/_version.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..9b182773b30454171477120e237db366f1775ca8
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/_version.mjs
@@ -0,0 +1 @@
+try{self['workbox:window:7.4.1']&&_()}catch(e){}// eslint-disable-line
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-window/build/workbox-window.dev.es5.mjs b/tools/ui/node_modules/workbox-window/build/workbox-window.dev.es5.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..eba949dfe499392e0994e5d6e6ec9fb3c9b41b0b
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/build/workbox-window.dev.es5.mjs
@@ -0,0 +1,997 @@
+// @ts-ignore
+try {
+ self['workbox:window:7.4.0'] && _();
+} catch (e) {}
+
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+/**
+ * Sends a data object to a service worker via `postMessage` and resolves with
+ * a response (if any).
+ *
+ * A response can be set in a message handler in the service worker by
+ * calling `event.ports[0].postMessage(...)`, which will resolve the promise
+ * returned by `messageSW()`. If no response is set, the promise will not
+ * resolve.
+ *
+ * @param {ServiceWorker} sw The service worker to send the message to.
+ * @param {Object} data An object to send to the service worker.
+ * @return {Promise}
+ * @memberof workbox-window
+ */
+// Better not change type of data.
+// eslint-disable-next-line @typescript-eslint/ban-types
+function messageSW(sw, data) {
+ return new Promise(function (resolve) {
+ var messageChannel = new MessageChannel();
+ messageChannel.port1.onmessage = function (event) {
+ resolve(event.data);
+ };
+ sw.postMessage(data, [messageChannel.port2]);
+ });
+}
+
+function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+}
+function _defineProperties(e, r) {
+ for (var t = 0; t < r.length; t++) {
+ var o = r[t];
+ o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
+ }
+}
+function _createClass(e, r, t) {
+ return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
+ writable: false
+ }), e;
+}
+function _createForOfIteratorHelperLoose(r, e) {
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
+ if (t) return (t = t.call(r)).next.bind(t);
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
+ t && (r = t);
+ var o = 0;
+ return function () {
+ return o >= r.length ? {
+ done: true
+ } : {
+ done: false,
+ value: r[o++]
+ };
+ };
+ }
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
+}
+function _inheritsLoose(t, o) {
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
+}
+function _setPrototypeOf(t, e) {
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
+ return t.__proto__ = e, t;
+ }, _setPrototypeOf(t, e);
+}
+function _toPrimitive(t, r) {
+ if ("object" != typeof t || !t) return t;
+ var e = t[Symbol.toPrimitive];
+ if (void 0 !== e) {
+ var i = e.call(t, r);
+ if ("object" != typeof i) return i;
+ throw new TypeError("@@toPrimitive must return a primitive value.");
+ }
+ return (String )(t);
+}
+function _toPropertyKey(t) {
+ var i = _toPrimitive(t, "string");
+ return "symbol" == typeof i ? i : i + "";
+}
+function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
+ }
+}
+
+// @ts-ignore
+try {
+ self['workbox:core:7.4.0'] && _();
+} catch (e) {}
+
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+/**
+ * The Deferred class composes Promises in a way that allows for them to be
+ * resolved or rejected from outside the constructor. In most cases promises
+ * should be used directly, but Deferreds can be necessary when the logic to
+ * resolve a promise must be separate.
+ *
+ * @private
+ */
+var Deferred =
+/**
+ * Creates a promise and exposes its resolve and reject functions as methods.
+ */
+function Deferred() {
+ var _this = this;
+ this.promise = new Promise(function (resolve, reject) {
+ _this.resolve = resolve;
+ _this.reject = reject;
+ });
+};
+
+/*
+ Copyright 2019 Google LLC
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+/**
+ * A helper function that prevents a promise from being flagged as unused.
+ *
+ * @private
+ **/
+function dontWaitFor(promise) {
+ // Effective no-op.
+ void promise.then(function () {});
+}
+
+/*
+ Copyright 2019 Google LLC
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+var logger = function () {
+ // Don't overwrite this value if it's already set.
+ // See https://github.com/GoogleChrome/workbox/pull/2284#issuecomment-560470923
+ if (!('__WB_DISABLE_DEV_LOGS' in globalThis)) {
+ self.__WB_DISABLE_DEV_LOGS = false;
+ }
+ var inGroup = false;
+ var methodToColorMap = {
+ debug: "#7f8c8d",
+ log: "#2ecc71",
+ warn: "#f39c12",
+ error: "#c0392b",
+ groupCollapsed: "#3498db",
+ groupEnd: null // No colored prefix on groupEnd
+ };
+ var print = function print(method, args) {
+ var _console2;
+ if (self.__WB_DISABLE_DEV_LOGS) {
+ return;
+ }
+ if (method === 'groupCollapsed') {
+ // Safari doesn't print all console.groupCollapsed() arguments:
+ // https://bugs.webkit.org/show_bug.cgi?id=182754
+ if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
+ var _console;
+ (_console = console)[method].apply(_console, args);
+ return;
+ }
+ }
+ var styles = ["background: " + methodToColorMap[method], "border-radius: 0.5em", "color: white", "font-weight: bold", "padding: 2px 0.5em"];
+ // When in a group, the workbox prefix is not displayed.
+ var logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];
+ (_console2 = console)[method].apply(_console2, logPrefix.concat(args));
+ if (method === 'groupCollapsed') {
+ inGroup = true;
+ }
+ if (method === 'groupEnd') {
+ inGroup = false;
+ }
+ };
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ var api = {};
+ var loggerMethods = Object.keys(methodToColorMap);
+ var _loop = function _loop() {
+ var key = _loggerMethods[_i];
+ var method = key;
+ api[method] = function () {
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+ print(method, args);
+ };
+ };
+ for (var _i = 0, _loggerMethods = loggerMethods; _i < _loggerMethods.length; _i++) {
+ _loop();
+ }
+ return api;
+}();
+
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+/**
+ * A minimal `EventTarget` shim.
+ * This is necessary because not all browsers support constructable
+ * `EventTarget`, so using a real `EventTarget` will error.
+ * @private
+ */
+var WorkboxEventTarget = /*#__PURE__*/function () {
+ function WorkboxEventTarget() {
+ this._eventListenerRegistry = new Map();
+ }
+ /**
+ * @param {string} type
+ * @param {Function} listener
+ * @private
+ */
+ var _proto = WorkboxEventTarget.prototype;
+ _proto.addEventListener = function addEventListener(type, listener) {
+ var foo = this._getEventListenersByType(type);
+ foo.add(listener);
+ }
+ /**
+ * @param {string} type
+ * @param {Function} listener
+ * @private
+ */;
+ _proto.removeEventListener = function removeEventListener(type, listener) {
+ this._getEventListenersByType(type).delete(listener);
+ }
+ /**
+ * @param {Object} event
+ * @private
+ */;
+ _proto.dispatchEvent = function dispatchEvent(event) {
+ event.target = this;
+ var listeners = this._getEventListenersByType(event.type);
+ for (var _iterator = _createForOfIteratorHelperLoose(listeners), _step; !(_step = _iterator()).done;) {
+ var listener = _step.value;
+ listener(event);
+ }
+ }
+ /**
+ * Returns a Set of listeners associated with the passed event type.
+ * If no handlers have been registered, an empty Set is returned.
+ *
+ * @param {string} type The event type.
+ * @return {Set} An array of handler functions.
+ * @private
+ */;
+ _proto._getEventListenersByType = function _getEventListenersByType(type) {
+ if (!this._eventListenerRegistry.has(type)) {
+ this._eventListenerRegistry.set(type, new Set());
+ }
+ return this._eventListenerRegistry.get(type);
+ };
+ return WorkboxEventTarget;
+}();
+
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+/**
+ * Returns true if two URLs have the same `.href` property. The URLS can be
+ * relative, and if they are the current location href is used to resolve URLs.
+ *
+ * @private
+ * @param {string} url1
+ * @param {string} url2
+ * @return {boolean}
+ */
+function urlsMatch(url1, url2) {
+ var _location = location,
+ href = _location.href;
+ return new URL(url1, href).href === new URL(url2, href).href;
+}
+
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+/**
+ * A minimal `Event` subclass shim.
+ * This doesn't *actually* subclass `Event` because not all browsers support
+ * constructable `EventTarget`, and using a real `Event` will error.
+ * @private
+ */
+var WorkboxEvent = function WorkboxEvent(type, props) {
+ this.type = type;
+ Object.assign(this, props);
+};
+
+// The time a SW must be in the waiting phase before we can conclude
+// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically
+// chosen, but it seems to avoid false positives in my testing.
+
+function _await(value, then, direct) {
+ if (!value || !value.then) {
+ value = Promise.resolve(value);
+ }
+ return then ? value.then(then) : value;
+}
+var WAITING_TIMEOUT_DURATION = 200;
+// The amount of time after a registration that we can reasonably conclude
+// that the registration didn't trigger an update.
+
+function _async(f) {
+ return function () {
+ for (var args = [], i = 0; i < arguments.length; i++) {
+ args[i] = arguments[i];
+ }
+ try {
+ return Promise.resolve(f.apply(this, args));
+ } catch (e) {
+ return Promise.reject(e);
+ }
+ };
+}
+var REGISTRATION_TIMEOUT_DURATION = 60000;
+// The de facto standard message that a service worker should be listening for
+// to trigger a call to skipWaiting().
+
+function _empty() {}
+var SKIP_WAITING_MESSAGE = {
+ type: 'SKIP_WAITING'
+};
+/**
+ * A class to aid in handling service worker registration, updates, and
+ * reacting to service worker lifecycle events.
+ *
+ * @fires {@link workbox-window.Workbox#message}
+ * @fires {@link workbox-window.Workbox#installed}
+ * @fires {@link workbox-window.Workbox#waiting}
+ * @fires {@link workbox-window.Workbox#controlling}
+ * @fires {@link workbox-window.Workbox#activated}
+ * @fires {@link workbox-window.Workbox#redundant}
+ * @memberof workbox-window
+ */
+
+function _awaitIgnored(value, direct) {
+ {
+ return value && value.then ? value.then(_empty) : Promise.resolve();
+ }
+}
+var Workbox = /*#__PURE__*/function (_WorkboxEventTarget) {
+ /**
+ * Creates a new Workbox instance with a script URL and service worker
+ * options. The script URL and options are the same as those used when
+ * calling [navigator.serviceWorker.register(scriptURL, options)](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).
+ *
+ * @param {string|TrustedScriptURL} scriptURL The service worker script
+ * associated with this instance. Using a
+ * [`TrustedScriptURL`](https://web.dev/trusted-types/) is supported.
+ * @param {Object} [registerOptions] The service worker options associated
+ * with this instance.
+ */
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ function Workbox(scriptURL, registerOptions) {
+ var _this;
+ if (registerOptions === void 0) {
+ registerOptions = {};
+ }
+ _this = _WorkboxEventTarget.call(this) || this;
+ _this._registerOptions = {};
+ _this._updateFoundCount = 0;
+ // Deferreds we can resolve later.
+ _this._swDeferred = new Deferred();
+ _this._activeDeferred = new Deferred();
+ _this._controllingDeferred = new Deferred();
+ _this._registrationTime = 0;
+ _this._ownSWs = new Set();
+ /**
+ * @private
+ */
+ _this._onUpdateFound = function () {
+ // `this._registration` will never be `undefined` after an update is found.
+ var registration = _this._registration;
+ var installingSW = registration.installing;
+ // If the script URL passed to `navigator.serviceWorker.register()` is
+ // different from the current controlling SW's script URL, we know any
+ // successful registration calls will trigger an `updatefound` event.
+ // But if the registered script URL is the same as the current controlling
+ // SW's script URL, we'll only get an `updatefound` event if the file
+ // changed since it was last registered. This can be a problem if the user
+ // opens up the same page in a different tab, and that page registers
+ // a SW that triggers an update. It's a problem because this page has no
+ // good way of knowing whether the `updatefound` event came from the SW
+ // script it registered or from a registration attempt made by a newer
+ // version of the page running in another tab.
+ // To minimize the possibility of a false positive, we use the logic here:
+ var updateLikelyTriggeredExternally =
+ // Since we enforce only calling `register()` once, and since we don't
+ // add the `updatefound` event listener until the `register()` call, if
+ // `_updateFoundCount` is > 0 then it means this method has already
+ // been called, thus this SW must be external
+ _this._updateFoundCount > 0 ||
+ // If the script URL of the installing SW is different from this
+ // instance's script URL, we know it's definitely not from our
+ // registration.
+ !urlsMatch(installingSW.scriptURL, _this._scriptURL.toString()) ||
+ // If all of the above are false, then we use a time-based heuristic:
+ // Any `updatefound` event that occurs long after our registration is
+ // assumed to be external.
+ performance.now() > _this._registrationTime + REGISTRATION_TIMEOUT_DURATION ?
+ // If any of the above are not true, we assume the update was
+ // triggered by this instance.
+ true : false;
+ if (updateLikelyTriggeredExternally) {
+ _this._externalSW = installingSW;
+ registration.removeEventListener('updatefound', _this._onUpdateFound);
+ } else {
+ // If the update was not triggered externally we know the installing
+ // SW is the one we registered, so we set it.
+ _this._sw = installingSW;
+ _this._ownSWs.add(installingSW);
+ _this._swDeferred.resolve(installingSW);
+ // The `installing` state isn't something we have a dedicated
+ // callback for, but we do log messages for it in development.
+ {
+ if (navigator.serviceWorker.controller) {
+ logger.log('Updated service worker found. Installing now...');
+ } else {
+ logger.log('Service worker is installing...');
+ }
+ }
+ }
+ // Increment the `updatefound` count, so future invocations of this
+ // method can be sure they were triggered externally.
+ ++_this._updateFoundCount;
+ // Add a `statechange` listener regardless of whether this update was
+ // triggered externally, since we have callbacks for both.
+ installingSW.addEventListener('statechange', _this._onStateChange);
+ };
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ _this._onStateChange = function (originalEvent) {
+ // `this._registration` will never be `undefined` after an update is found.
+ var registration = _this._registration;
+ var sw = originalEvent.target;
+ var state = sw.state;
+ var isExternal = sw === _this._externalSW;
+ var eventProps = {
+ sw: sw,
+ isExternal: isExternal,
+ originalEvent: originalEvent
+ };
+ if (!isExternal && _this._isUpdate) {
+ eventProps.isUpdate = true;
+ }
+ _this.dispatchEvent(new WorkboxEvent(state, eventProps));
+ if (state === 'installed') {
+ // This timeout is used to ignore cases where the service worker calls
+ // `skipWaiting()` in the install event, thus moving it directly in the
+ // activating state. (Since all service workers *must* go through the
+ // waiting phase, the only way to detect `skipWaiting()` called in the
+ // install event is to observe that the time spent in the waiting phase
+ // is very short.)
+ // NOTE: we don't need separate timeouts for the own and external SWs
+ // since they can't go through these phases at the same time.
+ _this._waitingTimeout = self.setTimeout(function () {
+ // Ensure the SW is still waiting (it may now be redundant).
+ if (state === 'installed' && registration.waiting === sw) {
+ _this.dispatchEvent(new WorkboxEvent('waiting', eventProps));
+ {
+ if (isExternal) {
+ logger.warn('An external service worker has installed but is ' + 'waiting for this client to close before activating...');
+ } else {
+ logger.warn('The service worker has installed but is waiting ' + 'for existing clients to close before activating...');
+ }
+ }
+ }
+ }, WAITING_TIMEOUT_DURATION);
+ } else if (state === 'activating') {
+ clearTimeout(_this._waitingTimeout);
+ if (!isExternal) {
+ _this._activeDeferred.resolve(sw);
+ }
+ }
+ {
+ switch (state) {
+ case 'installed':
+ if (isExternal) {
+ logger.warn('An external service worker has installed. ' + 'You may want to suggest users reload this page.');
+ } else {
+ logger.log('Registered service worker installed.');
+ }
+ break;
+ case 'activated':
+ if (isExternal) {
+ logger.warn('An external service worker has activated.');
+ } else {
+ logger.log('Registered service worker activated.');
+ if (sw !== navigator.serviceWorker.controller) {
+ logger.warn('The registered service worker is active but ' + 'not yet controlling the page. Reload or run ' + '`clients.claim()` in the service worker.');
+ }
+ }
+ break;
+ case 'redundant':
+ if (sw === _this._compatibleControllingSW) {
+ logger.log('Previously controlling service worker now redundant!');
+ } else if (!isExternal) {
+ logger.log('Registered service worker now redundant!');
+ }
+ break;
+ }
+ }
+ };
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ _this._onControllerChange = function (originalEvent) {
+ var sw = _this._sw;
+ var isExternal = sw !== navigator.serviceWorker.controller;
+ // Unconditionally dispatch the controlling event, with isExternal set
+ // to distinguish between controller changes due to the initial registration
+ // vs. an update-check or other tab's registration.
+ // See https://github.com/GoogleChrome/workbox/issues/2786
+ _this.dispatchEvent(new WorkboxEvent('controlling', {
+ isExternal: isExternal,
+ originalEvent: originalEvent,
+ sw: sw,
+ isUpdate: _this._isUpdate
+ }));
+ if (!isExternal) {
+ {
+ logger.log('Registered service worker now controlling this page.');
+ }
+ _this._controllingDeferred.resolve(sw);
+ }
+ };
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ _this._onMessage = _async(function (originalEvent) {
+ // Can't change type 'any' of data.
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ var data = originalEvent.data,
+ ports = originalEvent.ports,
+ source = originalEvent.source;
+ // Wait until there's an "own" service worker. This is used to buffer
+ // `message` events that may be received prior to calling `register()`.
+ return _await(_this.getSW(), function () {
+ if (_this._ownSWs.has(source)) {
+ _this.dispatchEvent(new WorkboxEvent('message', {
+ // Can't change type 'any' of data.
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ data: data,
+ originalEvent: originalEvent,
+ ports: ports,
+ sw: source
+ }));
+ }
+ }); // If the service worker that sent the message is in the list of own
+ // service workers for this instance, dispatch a `message` event.
+ // NOTE: we check for all previously owned service workers rather than
+ // just the current one because some messages (e.g. cache updates) use
+ // a timeout when sent and may be delayed long enough for a service worker
+ // update to be found.
+ });
+ _this._scriptURL = scriptURL;
+ _this._registerOptions = registerOptions;
+ // Add a message listener immediately since messages received during
+ // page load are buffered only until the DOMContentLoaded event:
+ // https://github.com/GoogleChrome/workbox/issues/2202
+ navigator.serviceWorker.addEventListener('message', _this._onMessage);
+ return _this;
+ }
+ /**
+ * Registers a service worker for this instances script URL and service
+ * worker options. By default this method delays registration until after
+ * the window has loaded.
+ *
+ * @param {Object} [options]
+ * @param {Function} [options.immediate=false] Setting this to true will
+ * register the service worker immediately, even if the window has
+ * not loaded (not recommended).
+ */
+ _inheritsLoose(Workbox, _WorkboxEventTarget);
+ var _proto = Workbox.prototype;
+ _proto.register = function register(_temp) {
+ var _ref = _temp === void 0 ? {} : _temp,
+ _ref$immediate = _ref.immediate,
+ immediate = _ref$immediate === void 0 ? false : _ref$immediate;
+ try {
+ var _this2 = this;
+ if ("dev" !== 'production') {
+ if (_this2._registrationTime) {
+ logger.error('Cannot re-register a Workbox instance after it has ' + 'been registered. Create a new instance instead.');
+ return _await();
+ }
+ }
+ return _await(_invoke(function () {
+ if (!immediate && document.readyState !== 'complete') {
+ return _awaitIgnored(new Promise(function (res) {
+ return window.addEventListener('load', res);
+ }));
+ }
+ }, function () {
+ // Set this flag to true if any service worker was controlling the page
+ // at registration time.
+ _this2._isUpdate = Boolean(navigator.serviceWorker.controller);
+ // Before registering, attempt to determine if a SW is already controlling
+ // the page, and if that SW script (and version, if specified) matches this
+ // instance's script.
+ _this2._compatibleControllingSW = _this2._getControllingSWIfCompatible();
+ return _await(_this2._registerScript(), function (_this2$_registerScrip) {
+ _this2._registration = _this2$_registerScrip;
+ // If we have a compatible controller, store the controller as the "own"
+ // SW, resolve active/controlling deferreds and add necessary listeners.
+ if (_this2._compatibleControllingSW) {
+ _this2._sw = _this2._compatibleControllingSW;
+ _this2._activeDeferred.resolve(_this2._compatibleControllingSW);
+ _this2._controllingDeferred.resolve(_this2._compatibleControllingSW);
+ _this2._compatibleControllingSW.addEventListener('statechange', _this2._onStateChange, {
+ once: true
+ });
+ }
+ // If there's a waiting service worker with a matching URL before the
+ // `updatefound` event fires, it likely means that this site is open
+ // in another tab, or the user refreshed the page (and thus the previous
+ // page wasn't fully unloaded before this page started loading).
+ // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting
+ var waitingSW = _this2._registration.waiting;
+ if (waitingSW && urlsMatch(waitingSW.scriptURL, _this2._scriptURL.toString())) {
+ // Store the waiting SW as the "own" Sw, even if it means overwriting
+ // a compatible controller.
+ _this2._sw = waitingSW;
+ // Run this in the next microtask, so any code that adds an event
+ // listener after awaiting `register()` will get this event.
+ dontWaitFor(Promise.resolve().then(function () {
+ _this2.dispatchEvent(new WorkboxEvent('waiting', {
+ sw: waitingSW,
+ wasWaitingBeforeRegister: true
+ }));
+ if ("dev" !== 'production') {
+ logger.warn('A service worker was already waiting to activate ' + 'before this script was registered...');
+ }
+ }));
+ }
+ // If an "own" SW is already set, resolve the deferred.
+ if (_this2._sw) {
+ _this2._swDeferred.resolve(_this2._sw);
+ _this2._ownSWs.add(_this2._sw);
+ }
+ if ("dev" !== 'production') {
+ logger.log('Successfully registered service worker.', _this2._scriptURL.toString());
+ if (navigator.serviceWorker.controller) {
+ if (_this2._compatibleControllingSW) {
+ logger.debug('A service worker with the same script URL ' + 'is already controlling this page.');
+ } else {
+ logger.debug('A service worker with a different script URL is ' + 'currently controlling the page. The browser is now fetching ' + 'the new script now...');
+ }
+ }
+ var currentPageIsOutOfScope = function currentPageIsOutOfScope() {
+ var scopeURL = new URL(_this2._registerOptions.scope || _this2._scriptURL.toString(), document.baseURI);
+ var scopeURLBasePath = new URL('./', scopeURL.href).pathname;
+ return !location.pathname.startsWith(scopeURLBasePath);
+ };
+ if (currentPageIsOutOfScope()) {
+ logger.warn('The current page is not in scope for the registered ' + 'service worker. Was this a mistake?');
+ }
+ }
+ _this2._registration.addEventListener('updatefound', _this2._onUpdateFound);
+ navigator.serviceWorker.addEventListener('controllerchange', _this2._onControllerChange);
+ return _this2._registration;
+ });
+ }));
+ } catch (e) {
+ return Promise.reject(e);
+ }
+ }
+ /**
+ * Checks for updates of the registered service worker.
+ */
+ ;
+ _proto.update = function update() {
+ try {
+ var _this3 = this;
+ if (!_this3._registration) {
+ if ("dev" !== 'production') {
+ logger.error('Cannot update a Workbox instance without ' + 'being registered. Register the Workbox instance first.');
+ }
+ return _await();
+ }
+ // Try to update registration
+ return _await(_awaitIgnored(_this3._registration.update()));
+ } catch (e) {
+ return Promise.reject(e);
+ }
+ }
+ /**
+ * Resolves to the service worker registered by this instance as soon as it
+ * is active. If a service worker was already controlling at registration
+ * time then it will resolve to that if the script URLs (and optionally
+ * script versions) match, otherwise it will wait until an update is found
+ * and activates.
+ *
+ * @return {Promise}
+ */
+ ;
+ /**
+ * Resolves with a reference to a service worker that matches the script URL
+ * of this instance, as soon as it's available.
+ *
+ * If, at registration time, there's already an active or waiting service
+ * worker with a matching script URL, it will be used (with the waiting
+ * service worker taking precedence over the active service worker if both
+ * match, since the waiting service worker would have been registered more
+ * recently).
+ * If there's no matching active or waiting service worker at registration
+ * time then the promise will not resolve until an update is found and starts
+ * installing, at which point the installing service worker is used.
+ *
+ * @return {Promise}
+ */
+ _proto.getSW = function getSW() {
+ // If `this._sw` is set, resolve with that as we want `getSW()` to
+ // return the correct (new) service worker if an update is found.
+ return this._sw !== undefined ? Promise.resolve(this._sw) : this._swDeferred.promise;
+ }
+ /**
+ * Sends the passed data object to the service worker registered by this
+ * instance (via {@link workbox-window.Workbox#getSW}) and resolves
+ * with a response (if any).
+ *
+ * A response can be set in a message handler in the service worker by
+ * calling `event.ports[0].postMessage(...)`, which will resolve the promise
+ * returned by `messageSW()`. If no response is set, the promise will never
+ * resolve.
+ *
+ * @param {Object} data An object to send to the service worker
+ * @return {Promise}
+ */
+ // We might be able to change the 'data' type to Record in the future.
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ ;
+ _proto.messageSW = function messageSW$1(data) {
+ try {
+ var _this4 = this;
+ return _await(_this4.getSW(), function (sw) {
+ return messageSW(sw, data);
+ });
+ } catch (e) {
+ return Promise.reject(e);
+ }
+ }
+ /**
+ * Sends a `{type: 'SKIP_WAITING'}` message to the service worker that's
+ * currently in the `waiting` state associated with the current registration.
+ *
+ * If there is no current registration or no service worker is `waiting`,
+ * calling this will have no effect.
+ */
+ ;
+ _proto.messageSkipWaiting = function messageSkipWaiting() {
+ if (this._registration && this._registration.waiting) {
+ void messageSW(this._registration.waiting, SKIP_WAITING_MESSAGE);
+ }
+ }
+ /**
+ * Checks for a service worker already controlling the page and returns
+ * it if its script URL matches.
+ *
+ * @private
+ * @return {ServiceWorker|undefined}
+ */;
+ _proto._getControllingSWIfCompatible = function _getControllingSWIfCompatible() {
+ var controller = navigator.serviceWorker.controller;
+ if (controller && urlsMatch(controller.scriptURL, this._scriptURL.toString())) {
+ return controller;
+ } else {
+ return undefined;
+ }
+ }
+ /**
+ * Registers a service worker for this instances script URL and register
+ * options and tracks the time registration was complete.
+ *
+ * @private
+ */;
+ _proto._registerScript = function _registerScript() {
+ try {
+ var _this5 = this;
+ return _await(_catch(function () {
+ // this._scriptURL may be a TrustedScriptURL, but there's no support for
+ // passing that to register() in lib.dom right now.
+ // https://github.com/GoogleChrome/workbox/issues/2855
+ return _await(navigator.serviceWorker.register(_this5._scriptURL, _this5._registerOptions), function (reg) {
+ // Keep track of when registration happened, so it can be used in the
+ // `this._onUpdateFound` heuristic. Also use the presence of this
+ // property as a way to see if `.register()` has been called.
+ _this5._registrationTime = performance.now();
+ return reg;
+ });
+ }, function (error) {
+ if ("dev" !== 'production') {
+ logger.error(error);
+ }
+ // Re-throw the error.
+ throw error;
+ }));
+ } catch (e) {
+ return Promise.reject(e);
+ }
+ };
+ return _createClass(Workbox, [{
+ key: "active",
+ get: function get() {
+ return this._activeDeferred.promise;
+ }
+ /**
+ * Resolves to the service worker registered by this instance as soon as it
+ * is controlling the page. If a service worker was already controlling at
+ * registration time then it will resolve to that if the script URLs (and
+ * optionally script versions) match, otherwise it will wait until an update
+ * is found and starts controlling the page.
+ * Note: the first time a service worker is installed it will active but
+ * not start controlling the page unless `clients.claim()` is called in the
+ * service worker.
+ *
+ * @return {Promise}
+ */
+ }, {
+ key: "controlling",
+ get: function get() {
+ return this._controllingDeferred.promise;
+ }
+ }]);
+}(WorkboxEventTarget);
+function _invoke(body, then) {
+ var result = body();
+ if (result && result.then) {
+ return result.then(then);
+ }
+ return then(result);
+} // The jsdoc comments below outline the events this instance may dispatch:
+// -----------------------------------------------------------------------
+/**
+ * The `message` event is dispatched any time a `postMessage` is received.
+ *
+ * @event workbox-window.Workbox#message
+ * @type {WorkboxEvent}
+ * @property {*} data The `data` property from the original `message` event.
+ * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}
+ * event.
+ * @property {string} type `message`.
+ * @property {MessagePort[]} ports The `ports` value from `originalEvent`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `installed` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}
+ * changes to `installed`.
+ *
+ * Then can happen either the very first time a service worker is installed,
+ * or after an update to the current service worker is found. In the case
+ * of an update being found, the event's `isUpdate` property will be `true`.
+ *
+ * @event workbox-window.Workbox#installed
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `installed`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `waiting` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}
+ * changes to `installed` and then doesn't immediately change to `activating`.
+ * It may also be dispatched if a service worker with the same
+ * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}
+ * was already waiting when the {@link workbox-window.Workbox#register}
+ * method was called.
+ *
+ * @event workbox-window.Workbox#waiting
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event|undefined} originalEvent The original
+ * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event, or `undefined` in the case where the service worker was waiting
+ * to before `.register()` was called.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with
+ * a matching `scriptURL` was already waiting when this `Workbox`
+ * instance called `register()`.
+ * @property {string} type `waiting`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `controlling` event is dispatched if a
+ * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}
+ * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}
+ * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}
+ * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}
+ * matches the `scriptURL` of the `Workbox` instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.
+ *
+ * @event workbox-window.Workbox#controlling
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this service worker was registered.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `controlling`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `activated` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}
+ * changes to `activated`.
+ *
+ * @event workbox-window.Workbox#activated
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `activated`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `redundant` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}
+ * changes to `redundant`.
+ *
+ * @event workbox-window.Workbox#redundant
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {string} type `redundant`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+function _catch(body, recover) {
+ try {
+ var result = body();
+ } catch (e) {
+ return recover(e);
+ }
+ if (result && result.then) {
+ return result.then(void 0, recover);
+ }
+ return result;
+}
+
+export { Workbox, WorkboxEvent, messageSW };
+//# sourceMappingURL=workbox-window.dev.es5.mjs.map
diff --git a/tools/ui/node_modules/workbox-window/build/workbox-window.dev.es5.mjs.map b/tools/ui/node_modules/workbox-window/build/workbox-window.dev.es5.mjs.map
new file mode 100644
index 0000000000000000000000000000000000000000..9b08ec7697b828889acf6d6e3e332bb039b47f1b
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/build/workbox-window.dev.es5.mjs.map
@@ -0,0 +1 @@
+{"version":3,"file":"workbox-window.dev.es5.mjs","sources":["../_version.js","../messageSW.js","../../workbox-core/_version.js","../../workbox-core/_private/Deferred.js","../../workbox-core/_private/dontWaitFor.js","../../workbox-core/_private/logger.js","../utils/WorkboxEventTarget.js","../utils/urlsMatch.js","../utils/WorkboxEvent.js","../Workbox.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:window:7.4.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport './_version.js';\n/**\n * Sends a data object to a service worker via `postMessage` and resolves with\n * a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will not\n * resolve.\n *\n * @param {ServiceWorker} sw The service worker to send the message to.\n * @param {Object} data An object to send to the service worker.\n * @return {Promise}\n * @memberof workbox-window\n */\n// Better not change type of data.\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction messageSW(sw, data) {\n return new Promise((resolve) => {\n const messageChannel = new MessageChannel();\n messageChannel.port1.onmessage = (event) => {\n resolve(event.data);\n };\n sw.postMessage(data, [messageChannel.port2]);\n });\n}\nexport { messageSW };\n","\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:core:7.4.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * The Deferred class composes Promises in a way that allows for them to be\n * resolved or rejected from outside the constructor. In most cases promises\n * should be used directly, but Deferreds can be necessary when the logic to\n * resolve a promise must be separate.\n *\n * @private\n */\nclass Deferred {\n /**\n * Creates a promise and exposes its resolve and reject functions as methods.\n */\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n}\nexport { Deferred };\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A helper function that prevents a promise from being flagged as unused.\n *\n * @private\n **/\nexport function dontWaitFor(promise) {\n // Effective no-op.\n void promise.then(() => { });\n}\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nconst logger = (process.env.NODE_ENV === 'production'\n ? null\n : (() => {\n // Don't overwrite this value if it's already set.\n // See https://github.com/GoogleChrome/workbox/pull/2284#issuecomment-560470923\n if (!('__WB_DISABLE_DEV_LOGS' in globalThis)) {\n self.__WB_DISABLE_DEV_LOGS = false;\n }\n let inGroup = false;\n const methodToColorMap = {\n debug: `#7f8c8d`,\n log: `#2ecc71`,\n warn: `#f39c12`,\n error: `#c0392b`,\n groupCollapsed: `#3498db`,\n groupEnd: null, // No colored prefix on groupEnd\n };\n const print = function (method, args) {\n if (self.__WB_DISABLE_DEV_LOGS) {\n return;\n }\n if (method === 'groupCollapsed') {\n // Safari doesn't print all console.groupCollapsed() arguments:\n // https://bugs.webkit.org/show_bug.cgi?id=182754\n if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {\n console[method](...args);\n return;\n }\n }\n const styles = [\n `background: ${methodToColorMap[method]}`,\n `border-radius: 0.5em`,\n `color: white`,\n `font-weight: bold`,\n `padding: 2px 0.5em`,\n ];\n // When in a group, the workbox prefix is not displayed.\n const logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];\n console[method](...logPrefix, ...args);\n if (method === 'groupCollapsed') {\n inGroup = true;\n }\n if (method === 'groupEnd') {\n inGroup = false;\n }\n };\n // eslint-disable-next-line @typescript-eslint/ban-types\n const api = {};\n const loggerMethods = Object.keys(methodToColorMap);\n for (const key of loggerMethods) {\n const method = key;\n api[method] = (...args) => {\n print(method, args);\n };\n }\n return api;\n })());\nexport { logger };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n/**\n * A minimal `EventTarget` shim.\n * This is necessary because not all browsers support constructable\n * `EventTarget`, so using a real `EventTarget` will error.\n * @private\n */\nexport class WorkboxEventTarget {\n constructor() {\n this._eventListenerRegistry = new Map();\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n addEventListener(type, listener) {\n const foo = this._getEventListenersByType(type);\n foo.add(listener);\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n removeEventListener(type, listener) {\n this._getEventListenersByType(type).delete(listener);\n }\n /**\n * @param {Object} event\n * @private\n */\n dispatchEvent(event) {\n event.target = this;\n const listeners = this._getEventListenersByType(event.type);\n for (const listener of listeners) {\n listener(event);\n }\n }\n /**\n * Returns a Set of listeners associated with the passed event type.\n * If no handlers have been registered, an empty Set is returned.\n *\n * @param {string} type The event type.\n * @return {Set} An array of handler functions.\n * @private\n */\n _getEventListenersByType(type) {\n if (!this._eventListenerRegistry.has(type)) {\n this._eventListenerRegistry.set(type, new Set());\n }\n return this._eventListenerRegistry.get(type);\n }\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * Returns true if two URLs have the same `.href` property. The URLS can be\n * relative, and if they are the current location href is used to resolve URLs.\n *\n * @private\n * @param {string} url1\n * @param {string} url2\n * @return {boolean}\n */\nexport function urlsMatch(url1, url2) {\n const { href } = location;\n return new URL(url1, href).href === new URL(url2, href).href;\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A minimal `Event` subclass shim.\n * This doesn't *actually* subclass `Event` because not all browsers support\n * constructable `EventTarget`, and using a real `Event` will error.\n * @private\n */\nexport class WorkboxEvent {\n constructor(type, props) {\n this.type = type;\n Object.assign(this, props);\n }\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { Deferred } from 'workbox-core/_private/Deferred.js';\nimport { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { messageSW } from './messageSW.js';\nimport { WorkboxEventTarget } from './utils/WorkboxEventTarget.js';\nimport { urlsMatch } from './utils/urlsMatch.js';\nimport { WorkboxEvent } from './utils/WorkboxEvent.js';\nimport './_version.js';\n// The time a SW must be in the waiting phase before we can conclude\n// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically\n// chosen, but it seems to avoid false positives in my testing.\nconst WAITING_TIMEOUT_DURATION = 200;\n// The amount of time after a registration that we can reasonably conclude\n// that the registration didn't trigger an update.\nconst REGISTRATION_TIMEOUT_DURATION = 60000;\n// The de facto standard message that a service worker should be listening for\n// to trigger a call to skipWaiting().\nconst SKIP_WAITING_MESSAGE = { type: 'SKIP_WAITING' };\n/**\n * A class to aid in handling service worker registration, updates, and\n * reacting to service worker lifecycle events.\n *\n * @fires {@link workbox-window.Workbox#message}\n * @fires {@link workbox-window.Workbox#installed}\n * @fires {@link workbox-window.Workbox#waiting}\n * @fires {@link workbox-window.Workbox#controlling}\n * @fires {@link workbox-window.Workbox#activated}\n * @fires {@link workbox-window.Workbox#redundant}\n * @memberof workbox-window\n */\nclass Workbox extends WorkboxEventTarget {\n /**\n * Creates a new Workbox instance with a script URL and service worker\n * options. The script URL and options are the same as those used when\n * calling [navigator.serviceWorker.register(scriptURL, options)](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).\n *\n * @param {string|TrustedScriptURL} scriptURL The service worker script\n * associated with this instance. Using a\n * [`TrustedScriptURL`](https://web.dev/trusted-types/) is supported.\n * @param {Object} [registerOptions] The service worker options associated\n * with this instance.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n constructor(scriptURL, registerOptions = {}) {\n super();\n this._registerOptions = {};\n this._updateFoundCount = 0;\n // Deferreds we can resolve later.\n this._swDeferred = new Deferred();\n this._activeDeferred = new Deferred();\n this._controllingDeferred = new Deferred();\n this._registrationTime = 0;\n this._ownSWs = new Set();\n /**\n * @private\n */\n this._onUpdateFound = () => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const installingSW = registration.installing;\n // If the script URL passed to `navigator.serviceWorker.register()` is\n // different from the current controlling SW's script URL, we know any\n // successful registration calls will trigger an `updatefound` event.\n // But if the registered script URL is the same as the current controlling\n // SW's script URL, we'll only get an `updatefound` event if the file\n // changed since it was last registered. This can be a problem if the user\n // opens up the same page in a different tab, and that page registers\n // a SW that triggers an update. It's a problem because this page has no\n // good way of knowing whether the `updatefound` event came from the SW\n // script it registered or from a registration attempt made by a newer\n // version of the page running in another tab.\n // To minimize the possibility of a false positive, we use the logic here:\n const updateLikelyTriggeredExternally = \n // Since we enforce only calling `register()` once, and since we don't\n // add the `updatefound` event listener until the `register()` call, if\n // `_updateFoundCount` is > 0 then it means this method has already\n // been called, thus this SW must be external\n this._updateFoundCount > 0 ||\n // If the script URL of the installing SW is different from this\n // instance's script URL, we know it's definitely not from our\n // registration.\n !urlsMatch(installingSW.scriptURL, this._scriptURL.toString()) ||\n // If all of the above are false, then we use a time-based heuristic:\n // Any `updatefound` event that occurs long after our registration is\n // assumed to be external.\n performance.now() > this._registrationTime + REGISTRATION_TIMEOUT_DURATION\n ? // If any of the above are not true, we assume the update was\n // triggered by this instance.\n true\n : false;\n if (updateLikelyTriggeredExternally) {\n this._externalSW = installingSW;\n registration.removeEventListener('updatefound', this._onUpdateFound);\n }\n else {\n // If the update was not triggered externally we know the installing\n // SW is the one we registered, so we set it.\n this._sw = installingSW;\n this._ownSWs.add(installingSW);\n this._swDeferred.resolve(installingSW);\n // The `installing` state isn't something we have a dedicated\n // callback for, but we do log messages for it in development.\n if (process.env.NODE_ENV !== 'production') {\n if (navigator.serviceWorker.controller) {\n logger.log('Updated service worker found. Installing now...');\n }\n else {\n logger.log('Service worker is installing...');\n }\n }\n }\n // Increment the `updatefound` count, so future invocations of this\n // method can be sure they were triggered externally.\n ++this._updateFoundCount;\n // Add a `statechange` listener regardless of whether this update was\n // triggered externally, since we have callbacks for both.\n installingSW.addEventListener('statechange', this._onStateChange);\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onStateChange = (originalEvent) => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const sw = originalEvent.target;\n const { state } = sw;\n const isExternal = sw === this._externalSW;\n const eventProps = {\n sw,\n isExternal,\n originalEvent,\n };\n if (!isExternal && this._isUpdate) {\n eventProps.isUpdate = true;\n }\n this.dispatchEvent(new WorkboxEvent(state, eventProps));\n if (state === 'installed') {\n // This timeout is used to ignore cases where the service worker calls\n // `skipWaiting()` in the install event, thus moving it directly in the\n // activating state. (Since all service workers *must* go through the\n // waiting phase, the only way to detect `skipWaiting()` called in the\n // install event is to observe that the time spent in the waiting phase\n // is very short.)\n // NOTE: we don't need separate timeouts for the own and external SWs\n // since they can't go through these phases at the same time.\n this._waitingTimeout = self.setTimeout(() => {\n // Ensure the SW is still waiting (it may now be redundant).\n if (state === 'installed' && registration.waiting === sw) {\n this.dispatchEvent(new WorkboxEvent('waiting', eventProps));\n if (process.env.NODE_ENV !== 'production') {\n if (isExternal) {\n logger.warn('An external service worker has installed but is ' +\n 'waiting for this client to close before activating...');\n }\n else {\n logger.warn('The service worker has installed but is waiting ' +\n 'for existing clients to close before activating...');\n }\n }\n }\n }, WAITING_TIMEOUT_DURATION);\n }\n else if (state === 'activating') {\n clearTimeout(this._waitingTimeout);\n if (!isExternal) {\n this._activeDeferred.resolve(sw);\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n switch (state) {\n case 'installed':\n if (isExternal) {\n logger.warn('An external service worker has installed. ' +\n 'You may want to suggest users reload this page.');\n }\n else {\n logger.log('Registered service worker installed.');\n }\n break;\n case 'activated':\n if (isExternal) {\n logger.warn('An external service worker has activated.');\n }\n else {\n logger.log('Registered service worker activated.');\n if (sw !== navigator.serviceWorker.controller) {\n logger.warn('The registered service worker is active but ' +\n 'not yet controlling the page. Reload or run ' +\n '`clients.claim()` in the service worker.');\n }\n }\n break;\n case 'redundant':\n if (sw === this._compatibleControllingSW) {\n logger.log('Previously controlling service worker now redundant!');\n }\n else if (!isExternal) {\n logger.log('Registered service worker now redundant!');\n }\n break;\n }\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onControllerChange = (originalEvent) => {\n const sw = this._sw;\n const isExternal = sw !== navigator.serviceWorker.controller;\n // Unconditionally dispatch the controlling event, with isExternal set\n // to distinguish between controller changes due to the initial registration\n // vs. an update-check or other tab's registration.\n // See https://github.com/GoogleChrome/workbox/issues/2786\n this.dispatchEvent(new WorkboxEvent('controlling', {\n isExternal,\n originalEvent,\n sw,\n isUpdate: this._isUpdate,\n }));\n if (!isExternal) {\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Registered service worker now controlling this page.');\n }\n this._controllingDeferred.resolve(sw);\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onMessage = async (originalEvent) => {\n // Can't change type 'any' of data.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const { data, ports, source } = originalEvent;\n // Wait until there's an \"own\" service worker. This is used to buffer\n // `message` events that may be received prior to calling `register()`.\n await this.getSW();\n // If the service worker that sent the message is in the list of own\n // service workers for this instance, dispatch a `message` event.\n // NOTE: we check for all previously owned service workers rather than\n // just the current one because some messages (e.g. cache updates) use\n // a timeout when sent and may be delayed long enough for a service worker\n // update to be found.\n if (this._ownSWs.has(source)) {\n this.dispatchEvent(new WorkboxEvent('message', {\n // Can't change type 'any' of data.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n data,\n originalEvent,\n ports,\n sw: source,\n }));\n }\n };\n this._scriptURL = scriptURL;\n this._registerOptions = registerOptions;\n // Add a message listener immediately since messages received during\n // page load are buffered only until the DOMContentLoaded event:\n // https://github.com/GoogleChrome/workbox/issues/2202\n navigator.serviceWorker.addEventListener('message', this._onMessage);\n }\n /**\n * Registers a service worker for this instances script URL and service\n * worker options. By default this method delays registration until after\n * the window has loaded.\n *\n * @param {Object} [options]\n * @param {Function} [options.immediate=false] Setting this to true will\n * register the service worker immediately, even if the window has\n * not loaded (not recommended).\n */\n async register({ immediate = false } = {}) {\n if (process.env.NODE_ENV !== 'production') {\n if (this._registrationTime) {\n logger.error('Cannot re-register a Workbox instance after it has ' +\n 'been registered. Create a new instance instead.');\n return;\n }\n }\n if (!immediate && document.readyState !== 'complete') {\n await new Promise((res) => window.addEventListener('load', res));\n }\n // Set this flag to true if any service worker was controlling the page\n // at registration time.\n this._isUpdate = Boolean(navigator.serviceWorker.controller);\n // Before registering, attempt to determine if a SW is already controlling\n // the page, and if that SW script (and version, if specified) matches this\n // instance's script.\n this._compatibleControllingSW = this._getControllingSWIfCompatible();\n this._registration = await this._registerScript();\n // If we have a compatible controller, store the controller as the \"own\"\n // SW, resolve active/controlling deferreds and add necessary listeners.\n if (this._compatibleControllingSW) {\n this._sw = this._compatibleControllingSW;\n this._activeDeferred.resolve(this._compatibleControllingSW);\n this._controllingDeferred.resolve(this._compatibleControllingSW);\n this._compatibleControllingSW.addEventListener('statechange', this._onStateChange, { once: true });\n }\n // If there's a waiting service worker with a matching URL before the\n // `updatefound` event fires, it likely means that this site is open\n // in another tab, or the user refreshed the page (and thus the previous\n // page wasn't fully unloaded before this page started loading).\n // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting\n const waitingSW = this._registration.waiting;\n if (waitingSW &&\n urlsMatch(waitingSW.scriptURL, this._scriptURL.toString())) {\n // Store the waiting SW as the \"own\" Sw, even if it means overwriting\n // a compatible controller.\n this._sw = waitingSW;\n // Run this in the next microtask, so any code that adds an event\n // listener after awaiting `register()` will get this event.\n dontWaitFor(Promise.resolve().then(() => {\n this.dispatchEvent(new WorkboxEvent('waiting', {\n sw: waitingSW,\n wasWaitingBeforeRegister: true,\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.warn('A service worker was already waiting to activate ' +\n 'before this script was registered...');\n }\n }));\n }\n // If an \"own\" SW is already set, resolve the deferred.\n if (this._sw) {\n this._swDeferred.resolve(this._sw);\n this._ownSWs.add(this._sw);\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Successfully registered service worker.', this._scriptURL.toString());\n if (navigator.serviceWorker.controller) {\n if (this._compatibleControllingSW) {\n logger.debug('A service worker with the same script URL ' +\n 'is already controlling this page.');\n }\n else {\n logger.debug('A service worker with a different script URL is ' +\n 'currently controlling the page. The browser is now fetching ' +\n 'the new script now...');\n }\n }\n const currentPageIsOutOfScope = () => {\n const scopeURL = new URL(this._registerOptions.scope || this._scriptURL.toString(), document.baseURI);\n const scopeURLBasePath = new URL('./', scopeURL.href).pathname;\n return !location.pathname.startsWith(scopeURLBasePath);\n };\n if (currentPageIsOutOfScope()) {\n logger.warn('The current page is not in scope for the registered ' +\n 'service worker. Was this a mistake?');\n }\n }\n this._registration.addEventListener('updatefound', this._onUpdateFound);\n navigator.serviceWorker.addEventListener('controllerchange', this._onControllerChange);\n return this._registration;\n }\n /**\n * Checks for updates of the registered service worker.\n */\n async update() {\n if (!this._registration) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error('Cannot update a Workbox instance without ' +\n 'being registered. Register the Workbox instance first.');\n }\n return;\n }\n // Try to update registration\n await this._registration.update();\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is active. If a service worker was already controlling at registration\n * time then it will resolve to that if the script URLs (and optionally\n * script versions) match, otherwise it will wait until an update is found\n * and activates.\n *\n * @return {Promise}\n */\n get active() {\n return this._activeDeferred.promise;\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is controlling the page. If a service worker was already controlling at\n * registration time then it will resolve to that if the script URLs (and\n * optionally script versions) match, otherwise it will wait until an update\n * is found and starts controlling the page.\n * Note: the first time a service worker is installed it will active but\n * not start controlling the page unless `clients.claim()` is called in the\n * service worker.\n *\n * @return {Promise}\n */\n get controlling() {\n return this._controllingDeferred.promise;\n }\n /**\n * Resolves with a reference to a service worker that matches the script URL\n * of this instance, as soon as it's available.\n *\n * If, at registration time, there's already an active or waiting service\n * worker with a matching script URL, it will be used (with the waiting\n * service worker taking precedence over the active service worker if both\n * match, since the waiting service worker would have been registered more\n * recently).\n * If there's no matching active or waiting service worker at registration\n * time then the promise will not resolve until an update is found and starts\n * installing, at which point the installing service worker is used.\n *\n * @return {Promise}\n */\n getSW() {\n // If `this._sw` is set, resolve with that as we want `getSW()` to\n // return the correct (new) service worker if an update is found.\n return this._sw !== undefined\n ? Promise.resolve(this._sw)\n : this._swDeferred.promise;\n }\n /**\n * Sends the passed data object to the service worker registered by this\n * instance (via {@link workbox-window.Workbox#getSW}) and resolves\n * with a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will never\n * resolve.\n *\n * @param {Object} data An object to send to the service worker\n * @return {Promise}\n */\n // We might be able to change the 'data' type to Record in the future.\n // eslint-disable-next-line @typescript-eslint/ban-types\n async messageSW(data) {\n const sw = await this.getSW();\n return messageSW(sw, data);\n }\n /**\n * Sends a `{type: 'SKIP_WAITING'}` message to the service worker that's\n * currently in the `waiting` state associated with the current registration.\n *\n * If there is no current registration or no service worker is `waiting`,\n * calling this will have no effect.\n */\n messageSkipWaiting() {\n if (this._registration && this._registration.waiting) {\n void messageSW(this._registration.waiting, SKIP_WAITING_MESSAGE);\n }\n }\n /**\n * Checks for a service worker already controlling the page and returns\n * it if its script URL matches.\n *\n * @private\n * @return {ServiceWorker|undefined}\n */\n _getControllingSWIfCompatible() {\n const controller = navigator.serviceWorker.controller;\n if (controller &&\n urlsMatch(controller.scriptURL, this._scriptURL.toString())) {\n return controller;\n }\n else {\n return undefined;\n }\n }\n /**\n * Registers a service worker for this instances script URL and register\n * options and tracks the time registration was complete.\n *\n * @private\n */\n async _registerScript() {\n try {\n // this._scriptURL may be a TrustedScriptURL, but there's no support for\n // passing that to register() in lib.dom right now.\n // https://github.com/GoogleChrome/workbox/issues/2855\n const reg = await navigator.serviceWorker.register(this._scriptURL, this._registerOptions);\n // Keep track of when registration happened, so it can be used in the\n // `this._onUpdateFound` heuristic. Also use the presence of this\n // property as a way to see if `.register()` has been called.\n this._registrationTime = performance.now();\n return reg;\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(error);\n }\n // Re-throw the error.\n throw error;\n }\n }\n}\nexport { Workbox };\n// The jsdoc comments below outline the events this instance may dispatch:\n// -----------------------------------------------------------------------\n/**\n * The `message` event is dispatched any time a `postMessage` is received.\n *\n * @event workbox-window.Workbox#message\n * @type {WorkboxEvent}\n * @property {*} data The `data` property from the original `message` event.\n * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}\n * event.\n * @property {string} type `message`.\n * @property {MessagePort[]} ports The `ports` value from `originalEvent`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `installed` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}\n * changes to `installed`.\n *\n * Then can happen either the very first time a service worker is installed,\n * or after an update to the current service worker is found. In the case\n * of an update being found, the event's `isUpdate` property will be `true`.\n *\n * @event workbox-window.Workbox#installed\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `installed`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `waiting` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed` and then doesn't immediately change to `activating`.\n * It may also be dispatched if a service worker with the same\n * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * was already waiting when the {@link workbox-window.Workbox#register}\n * method was called.\n *\n * @event workbox-window.Workbox#waiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event|undefined} originalEvent The original\n * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event, or `undefined` in the case where the service worker was waiting\n * to before `.register()` was called.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with\n * a matching `scriptURL` was already waiting when this `Workbox`\n * instance called `register()`.\n * @property {string} type `waiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `controlling` event is dispatched if a\n * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}\n * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}\n * matches the `scriptURL` of the `Workbox` instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.\n *\n * @event workbox-window.Workbox#controlling\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this service worker was registered.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `controlling`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `activated` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}\n * changes to `activated`.\n *\n * @event workbox-window.Workbox#activated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `activated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `redundant` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `redundant`.\n *\n * @event workbox-window.Workbox#redundant\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `redundant`.\n * @property {Workbox} target The `Workbox` instance.\n */\n"],"names":["self","_","e","messageSW","sw","data","Promise","resolve","messageChannel","MessageChannel","port1","onmessage","event","postMessage","port2","Deferred","_this","promise","reject","dontWaitFor","then","logger","globalThis","__WB_DISABLE_DEV_LOGS","inGroup","methodToColorMap","debug","log","warn","error","groupCollapsed","groupEnd","print","method","args","_console2","test","navigator","userAgent","_console","console","apply","styles","logPrefix","join","concat","api","loggerMethods","Object","keys","_loop","key","_loggerMethods","_i","_len","arguments","length","Array","_key","WorkboxEventTarget","_eventListenerRegistry","Map","_proto","prototype","addEventListener","type","listener","foo","_getEventListenersByType","add","removeEventListener","delete","dispatchEvent","target","listeners","_iterator","_createForOfIteratorHelperLoose","_step","done","value","has","set","Set","get","urlsMatch","url1","url2","_location","location","href","URL","WorkboxEvent","props","assign","_await","direct","WAITING_TIMEOUT_DURATION","_async","f","i","REGISTRATION_TIMEOUT_DURATION","_empty","SKIP_WAITING_MESSAGE","_awaitIgnored","Workbox","_WorkboxEventTarget","scriptURL","registerOptions","call","_registerOptions","_updateFoundCount","_swDeferred","_activeDeferred","_controllingDeferred","_registrationTime","_ownSWs","_onUpdateFound","registration","_registration","installingSW","installing","updateLikelyTriggeredExternally","_scriptURL","toString","performance","now","_externalSW","_sw","serviceWorker","controller","_onStateChange","originalEvent","state","isExternal","eventProps","_isUpdate","isUpdate","_waitingTimeout","setTimeout","waiting","clearTimeout","_compatibleControllingSW","_onControllerChange","_onMessage","ports","source","getSW","_inheritsLoose","register","_temp","_ref","_ref$immediate","immediate","_this2","process","_invoke","document","readyState","res","window","Boolean","_getControllingSWIfCompatible","_registerScript","_this2$_registerScrip","once","waitingSW","wasWaitingBeforeRegister","currentPageIsOutOfScope","scopeURL","scope","baseURI","scopeURLBasePath","pathname","startsWith","update","_this3","undefined","_this4","messageSkipWaiting","_this5","_catch","reg","_createClass","body","result","recover"],"mappings":"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,CAAC;AACzB,EAAA;EACA,OAAOA,IAAI,CAACoK,MAAM,CAAC;AACpB,CAAC;AAhDD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzDO,SAAAJ,MAAAA,CAAgBG,IAAI,EAAEE,OAAO,EAAE;EACrC,IAAI;AACH,IAAA,IAAID,MAAM,GAAGD,IAAI,EAAE;EACpB,CAAC,CAAC,OAAMrL,CAAC,EAAE;IACV,OAAOuL,OAAO,CAACvL,CAAC,CAAC;AAClB,EAAA;AACA,EAAA,IAAIsL,MAAM,IAAIA,MAAM,CAACpK,IAAI,EAAE;IAC1B,OAAOoK,MAAM,CAACpK,IAAI,CAAC,MAAM,EAAEqK,OAAO,CAAC;AACpC,EAAA;AACA,EAAA,OAAOD,MAAM;AACd;;;;"}
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-window/build/workbox-window.dev.mjs b/tools/ui/node_modules/workbox-window/build/workbox-window.dev.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..3138f2ffef6bd1a137e4bfe70d0d17ca3338f996
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/build/workbox-window.dev.mjs
@@ -0,0 +1,845 @@
+// @ts-ignore
+try {
+ self['workbox:window:7.4.0'] && _();
+} catch (e) {}
+
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+/**
+ * Sends a data object to a service worker via `postMessage` and resolves with
+ * a response (if any).
+ *
+ * A response can be set in a message handler in the service worker by
+ * calling `event.ports[0].postMessage(...)`, which will resolve the promise
+ * returned by `messageSW()`. If no response is set, the promise will not
+ * resolve.
+ *
+ * @param {ServiceWorker} sw The service worker to send the message to.
+ * @param {Object} data An object to send to the service worker.
+ * @return {Promise}
+ * @memberof workbox-window
+ */
+// Better not change type of data.
+// eslint-disable-next-line @typescript-eslint/ban-types
+function messageSW(sw, data) {
+ return new Promise(resolve => {
+ const messageChannel = new MessageChannel();
+ messageChannel.port1.onmessage = event => {
+ resolve(event.data);
+ };
+ sw.postMessage(data, [messageChannel.port2]);
+ });
+}
+
+// @ts-ignore
+try {
+ self['workbox:core:7.4.0'] && _();
+} catch (e) {}
+
+/*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+/**
+ * The Deferred class composes Promises in a way that allows for them to be
+ * resolved or rejected from outside the constructor. In most cases promises
+ * should be used directly, but Deferreds can be necessary when the logic to
+ * resolve a promise must be separate.
+ *
+ * @private
+ */
+class Deferred {
+ /**
+ * Creates a promise and exposes its resolve and reject functions as methods.
+ */
+ constructor() {
+ this.promise = new Promise((resolve, reject) => {
+ this.resolve = resolve;
+ this.reject = reject;
+ });
+ }
+}
+
+/*
+ Copyright 2019 Google LLC
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+/**
+ * A helper function that prevents a promise from being flagged as unused.
+ *
+ * @private
+ **/
+function dontWaitFor(promise) {
+ // Effective no-op.
+ void promise.then(() => {});
+}
+
+/*
+ Copyright 2019 Google LLC
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+const logger = (() => {
+ // Don't overwrite this value if it's already set.
+ // See https://github.com/GoogleChrome/workbox/pull/2284#issuecomment-560470923
+ if (!('__WB_DISABLE_DEV_LOGS' in globalThis)) {
+ self.__WB_DISABLE_DEV_LOGS = false;
+ }
+ let inGroup = false;
+ const methodToColorMap = {
+ debug: `#7f8c8d`,
+ log: `#2ecc71`,
+ warn: `#f39c12`,
+ error: `#c0392b`,
+ groupCollapsed: `#3498db`,
+ groupEnd: null // No colored prefix on groupEnd
+ };
+ const print = function (method, args) {
+ if (self.__WB_DISABLE_DEV_LOGS) {
+ return;
+ }
+ if (method === 'groupCollapsed') {
+ // Safari doesn't print all console.groupCollapsed() arguments:
+ // https://bugs.webkit.org/show_bug.cgi?id=182754
+ if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
+ console[method](...args);
+ return;
+ }
+ }
+ const styles = [`background: ${methodToColorMap[method]}`, `border-radius: 0.5em`, `color: white`, `font-weight: bold`, `padding: 2px 0.5em`];
+ // When in a group, the workbox prefix is not displayed.
+ const logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];
+ console[method](...logPrefix, ...args);
+ if (method === 'groupCollapsed') {
+ inGroup = true;
+ }
+ if (method === 'groupEnd') {
+ inGroup = false;
+ }
+ };
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ const api = {};
+ const loggerMethods = Object.keys(methodToColorMap);
+ for (const key of loggerMethods) {
+ const method = key;
+ api[method] = (...args) => {
+ print(method, args);
+ };
+ }
+ return api;
+})();
+
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+/**
+ * A minimal `EventTarget` shim.
+ * This is necessary because not all browsers support constructable
+ * `EventTarget`, so using a real `EventTarget` will error.
+ * @private
+ */
+class WorkboxEventTarget {
+ constructor() {
+ this._eventListenerRegistry = new Map();
+ }
+ /**
+ * @param {string} type
+ * @param {Function} listener
+ * @private
+ */
+ addEventListener(type, listener) {
+ const foo = this._getEventListenersByType(type);
+ foo.add(listener);
+ }
+ /**
+ * @param {string} type
+ * @param {Function} listener
+ * @private
+ */
+ removeEventListener(type, listener) {
+ this._getEventListenersByType(type).delete(listener);
+ }
+ /**
+ * @param {Object} event
+ * @private
+ */
+ dispatchEvent(event) {
+ event.target = this;
+ const listeners = this._getEventListenersByType(event.type);
+ for (const listener of listeners) {
+ listener(event);
+ }
+ }
+ /**
+ * Returns a Set of listeners associated with the passed event type.
+ * If no handlers have been registered, an empty Set is returned.
+ *
+ * @param {string} type The event type.
+ * @return {Set} An array of handler functions.
+ * @private
+ */
+ _getEventListenersByType(type) {
+ if (!this._eventListenerRegistry.has(type)) {
+ this._eventListenerRegistry.set(type, new Set());
+ }
+ return this._eventListenerRegistry.get(type);
+ }
+}
+
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+/**
+ * Returns true if two URLs have the same `.href` property. The URLS can be
+ * relative, and if they are the current location href is used to resolve URLs.
+ *
+ * @private
+ * @param {string} url1
+ * @param {string} url2
+ * @return {boolean}
+ */
+function urlsMatch(url1, url2) {
+ const {
+ href
+ } = location;
+ return new URL(url1, href).href === new URL(url2, href).href;
+}
+
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+/**
+ * A minimal `Event` subclass shim.
+ * This doesn't *actually* subclass `Event` because not all browsers support
+ * constructable `EventTarget`, and using a real `Event` will error.
+ * @private
+ */
+class WorkboxEvent {
+ constructor(type, props) {
+ this.type = type;
+ Object.assign(this, props);
+ }
+}
+
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+// The time a SW must be in the waiting phase before we can conclude
+// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically
+// chosen, but it seems to avoid false positives in my testing.
+const WAITING_TIMEOUT_DURATION = 200;
+// The amount of time after a registration that we can reasonably conclude
+// that the registration didn't trigger an update.
+const REGISTRATION_TIMEOUT_DURATION = 60000;
+// The de facto standard message that a service worker should be listening for
+// to trigger a call to skipWaiting().
+const SKIP_WAITING_MESSAGE = {
+ type: 'SKIP_WAITING'
+};
+/**
+ * A class to aid in handling service worker registration, updates, and
+ * reacting to service worker lifecycle events.
+ *
+ * @fires {@link workbox-window.Workbox#message}
+ * @fires {@link workbox-window.Workbox#installed}
+ * @fires {@link workbox-window.Workbox#waiting}
+ * @fires {@link workbox-window.Workbox#controlling}
+ * @fires {@link workbox-window.Workbox#activated}
+ * @fires {@link workbox-window.Workbox#redundant}
+ * @memberof workbox-window
+ */
+class Workbox extends WorkboxEventTarget {
+ /**
+ * Creates a new Workbox instance with a script URL and service worker
+ * options. The script URL and options are the same as those used when
+ * calling [navigator.serviceWorker.register(scriptURL, options)](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).
+ *
+ * @param {string|TrustedScriptURL} scriptURL The service worker script
+ * associated with this instance. Using a
+ * [`TrustedScriptURL`](https://web.dev/trusted-types/) is supported.
+ * @param {Object} [registerOptions] The service worker options associated
+ * with this instance.
+ */
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ constructor(scriptURL, registerOptions = {}) {
+ super();
+ this._registerOptions = {};
+ this._updateFoundCount = 0;
+ // Deferreds we can resolve later.
+ this._swDeferred = new Deferred();
+ this._activeDeferred = new Deferred();
+ this._controllingDeferred = new Deferred();
+ this._registrationTime = 0;
+ this._ownSWs = new Set();
+ /**
+ * @private
+ */
+ this._onUpdateFound = () => {
+ // `this._registration` will never be `undefined` after an update is found.
+ const registration = this._registration;
+ const installingSW = registration.installing;
+ // If the script URL passed to `navigator.serviceWorker.register()` is
+ // different from the current controlling SW's script URL, we know any
+ // successful registration calls will trigger an `updatefound` event.
+ // But if the registered script URL is the same as the current controlling
+ // SW's script URL, we'll only get an `updatefound` event if the file
+ // changed since it was last registered. This can be a problem if the user
+ // opens up the same page in a different tab, and that page registers
+ // a SW that triggers an update. It's a problem because this page has no
+ // good way of knowing whether the `updatefound` event came from the SW
+ // script it registered or from a registration attempt made by a newer
+ // version of the page running in another tab.
+ // To minimize the possibility of a false positive, we use the logic here:
+ const updateLikelyTriggeredExternally =
+ // Since we enforce only calling `register()` once, and since we don't
+ // add the `updatefound` event listener until the `register()` call, if
+ // `_updateFoundCount` is > 0 then it means this method has already
+ // been called, thus this SW must be external
+ this._updateFoundCount > 0 ||
+ // If the script URL of the installing SW is different from this
+ // instance's script URL, we know it's definitely not from our
+ // registration.
+ !urlsMatch(installingSW.scriptURL, this._scriptURL.toString()) ||
+ // If all of the above are false, then we use a time-based heuristic:
+ // Any `updatefound` event that occurs long after our registration is
+ // assumed to be external.
+ performance.now() > this._registrationTime + REGISTRATION_TIMEOUT_DURATION ?
+ // If any of the above are not true, we assume the update was
+ // triggered by this instance.
+ true : false;
+ if (updateLikelyTriggeredExternally) {
+ this._externalSW = installingSW;
+ registration.removeEventListener('updatefound', this._onUpdateFound);
+ } else {
+ // If the update was not triggered externally we know the installing
+ // SW is the one we registered, so we set it.
+ this._sw = installingSW;
+ this._ownSWs.add(installingSW);
+ this._swDeferred.resolve(installingSW);
+ // The `installing` state isn't something we have a dedicated
+ // callback for, but we do log messages for it in development.
+ {
+ if (navigator.serviceWorker.controller) {
+ logger.log('Updated service worker found. Installing now...');
+ } else {
+ logger.log('Service worker is installing...');
+ }
+ }
+ }
+ // Increment the `updatefound` count, so future invocations of this
+ // method can be sure they were triggered externally.
+ ++this._updateFoundCount;
+ // Add a `statechange` listener regardless of whether this update was
+ // triggered externally, since we have callbacks for both.
+ installingSW.addEventListener('statechange', this._onStateChange);
+ };
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ this._onStateChange = originalEvent => {
+ // `this._registration` will never be `undefined` after an update is found.
+ const registration = this._registration;
+ const sw = originalEvent.target;
+ const {
+ state
+ } = sw;
+ const isExternal = sw === this._externalSW;
+ const eventProps = {
+ sw,
+ isExternal,
+ originalEvent
+ };
+ if (!isExternal && this._isUpdate) {
+ eventProps.isUpdate = true;
+ }
+ this.dispatchEvent(new WorkboxEvent(state, eventProps));
+ if (state === 'installed') {
+ // This timeout is used to ignore cases where the service worker calls
+ // `skipWaiting()` in the install event, thus moving it directly in the
+ // activating state. (Since all service workers *must* go through the
+ // waiting phase, the only way to detect `skipWaiting()` called in the
+ // install event is to observe that the time spent in the waiting phase
+ // is very short.)
+ // NOTE: we don't need separate timeouts for the own and external SWs
+ // since they can't go through these phases at the same time.
+ this._waitingTimeout = self.setTimeout(() => {
+ // Ensure the SW is still waiting (it may now be redundant).
+ if (state === 'installed' && registration.waiting === sw) {
+ this.dispatchEvent(new WorkboxEvent('waiting', eventProps));
+ {
+ if (isExternal) {
+ logger.warn('An external service worker has installed but is ' + 'waiting for this client to close before activating...');
+ } else {
+ logger.warn('The service worker has installed but is waiting ' + 'for existing clients to close before activating...');
+ }
+ }
+ }
+ }, WAITING_TIMEOUT_DURATION);
+ } else if (state === 'activating') {
+ clearTimeout(this._waitingTimeout);
+ if (!isExternal) {
+ this._activeDeferred.resolve(sw);
+ }
+ }
+ {
+ switch (state) {
+ case 'installed':
+ if (isExternal) {
+ logger.warn('An external service worker has installed. ' + 'You may want to suggest users reload this page.');
+ } else {
+ logger.log('Registered service worker installed.');
+ }
+ break;
+ case 'activated':
+ if (isExternal) {
+ logger.warn('An external service worker has activated.');
+ } else {
+ logger.log('Registered service worker activated.');
+ if (sw !== navigator.serviceWorker.controller) {
+ logger.warn('The registered service worker is active but ' + 'not yet controlling the page. Reload or run ' + '`clients.claim()` in the service worker.');
+ }
+ }
+ break;
+ case 'redundant':
+ if (sw === this._compatibleControllingSW) {
+ logger.log('Previously controlling service worker now redundant!');
+ } else if (!isExternal) {
+ logger.log('Registered service worker now redundant!');
+ }
+ break;
+ }
+ }
+ };
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ this._onControllerChange = originalEvent => {
+ const sw = this._sw;
+ const isExternal = sw !== navigator.serviceWorker.controller;
+ // Unconditionally dispatch the controlling event, with isExternal set
+ // to distinguish between controller changes due to the initial registration
+ // vs. an update-check or other tab's registration.
+ // See https://github.com/GoogleChrome/workbox/issues/2786
+ this.dispatchEvent(new WorkboxEvent('controlling', {
+ isExternal,
+ originalEvent,
+ sw,
+ isUpdate: this._isUpdate
+ }));
+ if (!isExternal) {
+ {
+ logger.log('Registered service worker now controlling this page.');
+ }
+ this._controllingDeferred.resolve(sw);
+ }
+ };
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ this._onMessage = async originalEvent => {
+ // Can't change type 'any' of data.
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ const {
+ data,
+ ports,
+ source
+ } = originalEvent;
+ // Wait until there's an "own" service worker. This is used to buffer
+ // `message` events that may be received prior to calling `register()`.
+ await this.getSW();
+ // If the service worker that sent the message is in the list of own
+ // service workers for this instance, dispatch a `message` event.
+ // NOTE: we check for all previously owned service workers rather than
+ // just the current one because some messages (e.g. cache updates) use
+ // a timeout when sent and may be delayed long enough for a service worker
+ // update to be found.
+ if (this._ownSWs.has(source)) {
+ this.dispatchEvent(new WorkboxEvent('message', {
+ // Can't change type 'any' of data.
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ data,
+ originalEvent,
+ ports,
+ sw: source
+ }));
+ }
+ };
+ this._scriptURL = scriptURL;
+ this._registerOptions = registerOptions;
+ // Add a message listener immediately since messages received during
+ // page load are buffered only until the DOMContentLoaded event:
+ // https://github.com/GoogleChrome/workbox/issues/2202
+ navigator.serviceWorker.addEventListener('message', this._onMessage);
+ }
+ /**
+ * Registers a service worker for this instances script URL and service
+ * worker options. By default this method delays registration until after
+ * the window has loaded.
+ *
+ * @param {Object} [options]
+ * @param {Function} [options.immediate=false] Setting this to true will
+ * register the service worker immediately, even if the window has
+ * not loaded (not recommended).
+ */
+ async register({
+ immediate = false
+ } = {}) {
+ {
+ if (this._registrationTime) {
+ logger.error('Cannot re-register a Workbox instance after it has ' + 'been registered. Create a new instance instead.');
+ return;
+ }
+ }
+ if (!immediate && document.readyState !== 'complete') {
+ await new Promise(res => window.addEventListener('load', res));
+ }
+ // Set this flag to true if any service worker was controlling the page
+ // at registration time.
+ this._isUpdate = Boolean(navigator.serviceWorker.controller);
+ // Before registering, attempt to determine if a SW is already controlling
+ // the page, and if that SW script (and version, if specified) matches this
+ // instance's script.
+ this._compatibleControllingSW = this._getControllingSWIfCompatible();
+ this._registration = await this._registerScript();
+ // If we have a compatible controller, store the controller as the "own"
+ // SW, resolve active/controlling deferreds and add necessary listeners.
+ if (this._compatibleControllingSW) {
+ this._sw = this._compatibleControllingSW;
+ this._activeDeferred.resolve(this._compatibleControllingSW);
+ this._controllingDeferred.resolve(this._compatibleControllingSW);
+ this._compatibleControllingSW.addEventListener('statechange', this._onStateChange, {
+ once: true
+ });
+ }
+ // If there's a waiting service worker with a matching URL before the
+ // `updatefound` event fires, it likely means that this site is open
+ // in another tab, or the user refreshed the page (and thus the previous
+ // page wasn't fully unloaded before this page started loading).
+ // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting
+ const waitingSW = this._registration.waiting;
+ if (waitingSW && urlsMatch(waitingSW.scriptURL, this._scriptURL.toString())) {
+ // Store the waiting SW as the "own" Sw, even if it means overwriting
+ // a compatible controller.
+ this._sw = waitingSW;
+ // Run this in the next microtask, so any code that adds an event
+ // listener after awaiting `register()` will get this event.
+ dontWaitFor(Promise.resolve().then(() => {
+ this.dispatchEvent(new WorkboxEvent('waiting', {
+ sw: waitingSW,
+ wasWaitingBeforeRegister: true
+ }));
+ {
+ logger.warn('A service worker was already waiting to activate ' + 'before this script was registered...');
+ }
+ }));
+ }
+ // If an "own" SW is already set, resolve the deferred.
+ if (this._sw) {
+ this._swDeferred.resolve(this._sw);
+ this._ownSWs.add(this._sw);
+ }
+ {
+ logger.log('Successfully registered service worker.', this._scriptURL.toString());
+ if (navigator.serviceWorker.controller) {
+ if (this._compatibleControllingSW) {
+ logger.debug('A service worker with the same script URL ' + 'is already controlling this page.');
+ } else {
+ logger.debug('A service worker with a different script URL is ' + 'currently controlling the page. The browser is now fetching ' + 'the new script now...');
+ }
+ }
+ const currentPageIsOutOfScope = () => {
+ const scopeURL = new URL(this._registerOptions.scope || this._scriptURL.toString(), document.baseURI);
+ const scopeURLBasePath = new URL('./', scopeURL.href).pathname;
+ return !location.pathname.startsWith(scopeURLBasePath);
+ };
+ if (currentPageIsOutOfScope()) {
+ logger.warn('The current page is not in scope for the registered ' + 'service worker. Was this a mistake?');
+ }
+ }
+ this._registration.addEventListener('updatefound', this._onUpdateFound);
+ navigator.serviceWorker.addEventListener('controllerchange', this._onControllerChange);
+ return this._registration;
+ }
+ /**
+ * Checks for updates of the registered service worker.
+ */
+ async update() {
+ if (!this._registration) {
+ {
+ logger.error('Cannot update a Workbox instance without ' + 'being registered. Register the Workbox instance first.');
+ }
+ return;
+ }
+ // Try to update registration
+ await this._registration.update();
+ }
+ /**
+ * Resolves to the service worker registered by this instance as soon as it
+ * is active. If a service worker was already controlling at registration
+ * time then it will resolve to that if the script URLs (and optionally
+ * script versions) match, otherwise it will wait until an update is found
+ * and activates.
+ *
+ * @return {Promise}
+ */
+ get active() {
+ return this._activeDeferred.promise;
+ }
+ /**
+ * Resolves to the service worker registered by this instance as soon as it
+ * is controlling the page. If a service worker was already controlling at
+ * registration time then it will resolve to that if the script URLs (and
+ * optionally script versions) match, otherwise it will wait until an update
+ * is found and starts controlling the page.
+ * Note: the first time a service worker is installed it will active but
+ * not start controlling the page unless `clients.claim()` is called in the
+ * service worker.
+ *
+ * @return {Promise}
+ */
+ get controlling() {
+ return this._controllingDeferred.promise;
+ }
+ /**
+ * Resolves with a reference to a service worker that matches the script URL
+ * of this instance, as soon as it's available.
+ *
+ * If, at registration time, there's already an active or waiting service
+ * worker with a matching script URL, it will be used (with the waiting
+ * service worker taking precedence over the active service worker if both
+ * match, since the waiting service worker would have been registered more
+ * recently).
+ * If there's no matching active or waiting service worker at registration
+ * time then the promise will not resolve until an update is found and starts
+ * installing, at which point the installing service worker is used.
+ *
+ * @return {Promise}
+ */
+ getSW() {
+ // If `this._sw` is set, resolve with that as we want `getSW()` to
+ // return the correct (new) service worker if an update is found.
+ return this._sw !== undefined ? Promise.resolve(this._sw) : this._swDeferred.promise;
+ }
+ /**
+ * Sends the passed data object to the service worker registered by this
+ * instance (via {@link workbox-window.Workbox#getSW}) and resolves
+ * with a response (if any).
+ *
+ * A response can be set in a message handler in the service worker by
+ * calling `event.ports[0].postMessage(...)`, which will resolve the promise
+ * returned by `messageSW()`. If no response is set, the promise will never
+ * resolve.
+ *
+ * @param {Object} data An object to send to the service worker
+ * @return {Promise}
+ */
+ // We might be able to change the 'data' type to Record in the future.
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ async messageSW(data) {
+ const sw = await this.getSW();
+ return messageSW(sw, data);
+ }
+ /**
+ * Sends a `{type: 'SKIP_WAITING'}` message to the service worker that's
+ * currently in the `waiting` state associated with the current registration.
+ *
+ * If there is no current registration or no service worker is `waiting`,
+ * calling this will have no effect.
+ */
+ messageSkipWaiting() {
+ if (this._registration && this._registration.waiting) {
+ void messageSW(this._registration.waiting, SKIP_WAITING_MESSAGE);
+ }
+ }
+ /**
+ * Checks for a service worker already controlling the page and returns
+ * it if its script URL matches.
+ *
+ * @private
+ * @return {ServiceWorker|undefined}
+ */
+ _getControllingSWIfCompatible() {
+ const controller = navigator.serviceWorker.controller;
+ if (controller && urlsMatch(controller.scriptURL, this._scriptURL.toString())) {
+ return controller;
+ } else {
+ return undefined;
+ }
+ }
+ /**
+ * Registers a service worker for this instances script URL and register
+ * options and tracks the time registration was complete.
+ *
+ * @private
+ */
+ async _registerScript() {
+ try {
+ // this._scriptURL may be a TrustedScriptURL, but there's no support for
+ // passing that to register() in lib.dom right now.
+ // https://github.com/GoogleChrome/workbox/issues/2855
+ const reg = await navigator.serviceWorker.register(this._scriptURL, this._registerOptions);
+ // Keep track of when registration happened, so it can be used in the
+ // `this._onUpdateFound` heuristic. Also use the presence of this
+ // property as a way to see if `.register()` has been called.
+ this._registrationTime = performance.now();
+ return reg;
+ } catch (error) {
+ {
+ logger.error(error);
+ }
+ // Re-throw the error.
+ throw error;
+ }
+ }
+}
+// The jsdoc comments below outline the events this instance may dispatch:
+// -----------------------------------------------------------------------
+/**
+ * The `message` event is dispatched any time a `postMessage` is received.
+ *
+ * @event workbox-window.Workbox#message
+ * @type {WorkboxEvent}
+ * @property {*} data The `data` property from the original `message` event.
+ * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}
+ * event.
+ * @property {string} type `message`.
+ * @property {MessagePort[]} ports The `ports` value from `originalEvent`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `installed` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}
+ * changes to `installed`.
+ *
+ * Then can happen either the very first time a service worker is installed,
+ * or after an update to the current service worker is found. In the case
+ * of an update being found, the event's `isUpdate` property will be `true`.
+ *
+ * @event workbox-window.Workbox#installed
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `installed`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `waiting` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}
+ * changes to `installed` and then doesn't immediately change to `activating`.
+ * It may also be dispatched if a service worker with the same
+ * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}
+ * was already waiting when the {@link workbox-window.Workbox#register}
+ * method was called.
+ *
+ * @event workbox-window.Workbox#waiting
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event|undefined} originalEvent The original
+ * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event, or `undefined` in the case where the service worker was waiting
+ * to before `.register()` was called.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with
+ * a matching `scriptURL` was already waiting when this `Workbox`
+ * instance called `register()`.
+ * @property {string} type `waiting`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `controlling` event is dispatched if a
+ * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}
+ * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}
+ * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}
+ * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}
+ * matches the `scriptURL` of the `Workbox` instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.
+ *
+ * @event workbox-window.Workbox#controlling
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this service worker was registered.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `controlling`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `activated` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}
+ * changes to `activated`.
+ *
+ * @event workbox-window.Workbox#activated
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `activated`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+/**
+ * The `redundant` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}
+ * changes to `redundant`.
+ *
+ * @event workbox-window.Workbox#redundant
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {string} type `redundant`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+
+export { Workbox, WorkboxEvent, messageSW };
+//# sourceMappingURL=workbox-window.dev.mjs.map
diff --git a/tools/ui/node_modules/workbox-window/build/workbox-window.dev.mjs.map b/tools/ui/node_modules/workbox-window/build/workbox-window.dev.mjs.map
new file mode 100644
index 0000000000000000000000000000000000000000..bfb072e9ad2fe4f78ac0d2be055389e0f392ebb8
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/build/workbox-window.dev.mjs.map
@@ -0,0 +1 @@
+{"version":3,"file":"workbox-window.dev.mjs","sources":["../_version.js","../messageSW.js","../../workbox-core/_version.js","../../workbox-core/_private/Deferred.js","../../workbox-core/_private/dontWaitFor.js","../../workbox-core/_private/logger.js","../utils/WorkboxEventTarget.js","../utils/urlsMatch.js","../utils/WorkboxEvent.js","../Workbox.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:window:7.4.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport './_version.js';\n/**\n * Sends a data object to a service worker via `postMessage` and resolves with\n * a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will not\n * resolve.\n *\n * @param {ServiceWorker} sw The service worker to send the message to.\n * @param {Object} data An object to send to the service worker.\n * @return {Promise}\n * @memberof workbox-window\n */\n// Better not change type of data.\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction messageSW(sw, data) {\n return new Promise((resolve) => {\n const messageChannel = new MessageChannel();\n messageChannel.port1.onmessage = (event) => {\n resolve(event.data);\n };\n sw.postMessage(data, [messageChannel.port2]);\n });\n}\nexport { messageSW };\n","\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:core:7.4.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * The Deferred class composes Promises in a way that allows for them to be\n * resolved or rejected from outside the constructor. In most cases promises\n * should be used directly, but Deferreds can be necessary when the logic to\n * resolve a promise must be separate.\n *\n * @private\n */\nclass Deferred {\n /**\n * Creates a promise and exposes its resolve and reject functions as methods.\n */\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n}\nexport { Deferred };\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A helper function that prevents a promise from being flagged as unused.\n *\n * @private\n **/\nexport function dontWaitFor(promise) {\n // Effective no-op.\n void promise.then(() => { });\n}\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nconst logger = (process.env.NODE_ENV === 'production'\n ? null\n : (() => {\n // Don't overwrite this value if it's already set.\n // See https://github.com/GoogleChrome/workbox/pull/2284#issuecomment-560470923\n if (!('__WB_DISABLE_DEV_LOGS' in globalThis)) {\n self.__WB_DISABLE_DEV_LOGS = false;\n }\n let inGroup = false;\n const methodToColorMap = {\n debug: `#7f8c8d`,\n log: `#2ecc71`,\n warn: `#f39c12`,\n error: `#c0392b`,\n groupCollapsed: `#3498db`,\n groupEnd: null, // No colored prefix on groupEnd\n };\n const print = function (method, args) {\n if (self.__WB_DISABLE_DEV_LOGS) {\n return;\n }\n if (method === 'groupCollapsed') {\n // Safari doesn't print all console.groupCollapsed() arguments:\n // https://bugs.webkit.org/show_bug.cgi?id=182754\n if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {\n console[method](...args);\n return;\n }\n }\n const styles = [\n `background: ${methodToColorMap[method]}`,\n `border-radius: 0.5em`,\n `color: white`,\n `font-weight: bold`,\n `padding: 2px 0.5em`,\n ];\n // When in a group, the workbox prefix is not displayed.\n const logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];\n console[method](...logPrefix, ...args);\n if (method === 'groupCollapsed') {\n inGroup = true;\n }\n if (method === 'groupEnd') {\n inGroup = false;\n }\n };\n // eslint-disable-next-line @typescript-eslint/ban-types\n const api = {};\n const loggerMethods = Object.keys(methodToColorMap);\n for (const key of loggerMethods) {\n const method = key;\n api[method] = (...args) => {\n print(method, args);\n };\n }\n return api;\n })());\nexport { logger };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n/**\n * A minimal `EventTarget` shim.\n * This is necessary because not all browsers support constructable\n * `EventTarget`, so using a real `EventTarget` will error.\n * @private\n */\nexport class WorkboxEventTarget {\n constructor() {\n this._eventListenerRegistry = new Map();\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n addEventListener(type, listener) {\n const foo = this._getEventListenersByType(type);\n foo.add(listener);\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n removeEventListener(type, listener) {\n this._getEventListenersByType(type).delete(listener);\n }\n /**\n * @param {Object} event\n * @private\n */\n dispatchEvent(event) {\n event.target = this;\n const listeners = this._getEventListenersByType(event.type);\n for (const listener of listeners) {\n listener(event);\n }\n }\n /**\n * Returns a Set of listeners associated with the passed event type.\n * If no handlers have been registered, an empty Set is returned.\n *\n * @param {string} type The event type.\n * @return {Set} An array of handler functions.\n * @private\n */\n _getEventListenersByType(type) {\n if (!this._eventListenerRegistry.has(type)) {\n this._eventListenerRegistry.set(type, new Set());\n }\n return this._eventListenerRegistry.get(type);\n }\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * Returns true if two URLs have the same `.href` property. The URLS can be\n * relative, and if they are the current location href is used to resolve URLs.\n *\n * @private\n * @param {string} url1\n * @param {string} url2\n * @return {boolean}\n */\nexport function urlsMatch(url1, url2) {\n const { href } = location;\n return new URL(url1, href).href === new URL(url2, href).href;\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A minimal `Event` subclass shim.\n * This doesn't *actually* subclass `Event` because not all browsers support\n * constructable `EventTarget`, and using a real `Event` will error.\n * @private\n */\nexport class WorkboxEvent {\n constructor(type, props) {\n this.type = type;\n Object.assign(this, props);\n }\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { Deferred } from 'workbox-core/_private/Deferred.js';\nimport { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { messageSW } from './messageSW.js';\nimport { WorkboxEventTarget } from './utils/WorkboxEventTarget.js';\nimport { urlsMatch } from './utils/urlsMatch.js';\nimport { WorkboxEvent } from './utils/WorkboxEvent.js';\nimport './_version.js';\n// The time a SW must be in the waiting phase before we can conclude\n// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically\n// chosen, but it seems to avoid false positives in my testing.\nconst WAITING_TIMEOUT_DURATION = 200;\n// The amount of time after a registration that we can reasonably conclude\n// that the registration didn't trigger an update.\nconst REGISTRATION_TIMEOUT_DURATION = 60000;\n// The de facto standard message that a service worker should be listening for\n// to trigger a call to skipWaiting().\nconst SKIP_WAITING_MESSAGE = { type: 'SKIP_WAITING' };\n/**\n * A class to aid in handling service worker registration, updates, and\n * reacting to service worker lifecycle events.\n *\n * @fires {@link workbox-window.Workbox#message}\n * @fires {@link workbox-window.Workbox#installed}\n * @fires {@link workbox-window.Workbox#waiting}\n * @fires {@link workbox-window.Workbox#controlling}\n * @fires {@link workbox-window.Workbox#activated}\n * @fires {@link workbox-window.Workbox#redundant}\n * @memberof workbox-window\n */\nclass Workbox extends WorkboxEventTarget {\n /**\n * Creates a new Workbox instance with a script URL and service worker\n * options. The script URL and options are the same as those used when\n * calling [navigator.serviceWorker.register(scriptURL, options)](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).\n *\n * @param {string|TrustedScriptURL} scriptURL The service worker script\n * associated with this instance. Using a\n * [`TrustedScriptURL`](https://web.dev/trusted-types/) is supported.\n * @param {Object} [registerOptions] The service worker options associated\n * with this instance.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n constructor(scriptURL, registerOptions = {}) {\n super();\n this._registerOptions = {};\n this._updateFoundCount = 0;\n // Deferreds we can resolve later.\n this._swDeferred = new Deferred();\n this._activeDeferred = new Deferred();\n this._controllingDeferred = new Deferred();\n this._registrationTime = 0;\n this._ownSWs = new Set();\n /**\n * @private\n */\n this._onUpdateFound = () => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const installingSW = registration.installing;\n // If the script URL passed to `navigator.serviceWorker.register()` is\n // different from the current controlling SW's script URL, we know any\n // successful registration calls will trigger an `updatefound` event.\n // But if the registered script URL is the same as the current controlling\n // SW's script URL, we'll only get an `updatefound` event if the file\n // changed since it was last registered. This can be a problem if the user\n // opens up the same page in a different tab, and that page registers\n // a SW that triggers an update. It's a problem because this page has no\n // good way of knowing whether the `updatefound` event came from the SW\n // script it registered or from a registration attempt made by a newer\n // version of the page running in another tab.\n // To minimize the possibility of a false positive, we use the logic here:\n const updateLikelyTriggeredExternally = \n // Since we enforce only calling `register()` once, and since we don't\n // add the `updatefound` event listener until the `register()` call, if\n // `_updateFoundCount` is > 0 then it means this method has already\n // been called, thus this SW must be external\n this._updateFoundCount > 0 ||\n // If the script URL of the installing SW is different from this\n // instance's script URL, we know it's definitely not from our\n // registration.\n !urlsMatch(installingSW.scriptURL, this._scriptURL.toString()) ||\n // If all of the above are false, then we use a time-based heuristic:\n // Any `updatefound` event that occurs long after our registration is\n // assumed to be external.\n performance.now() > this._registrationTime + REGISTRATION_TIMEOUT_DURATION\n ? // If any of the above are not true, we assume the update was\n // triggered by this instance.\n true\n : false;\n if (updateLikelyTriggeredExternally) {\n this._externalSW = installingSW;\n registration.removeEventListener('updatefound', this._onUpdateFound);\n }\n else {\n // If the update was not triggered externally we know the installing\n // SW is the one we registered, so we set it.\n this._sw = installingSW;\n this._ownSWs.add(installingSW);\n this._swDeferred.resolve(installingSW);\n // The `installing` state isn't something we have a dedicated\n // callback for, but we do log messages for it in development.\n if (process.env.NODE_ENV !== 'production') {\n if (navigator.serviceWorker.controller) {\n logger.log('Updated service worker found. Installing now...');\n }\n else {\n logger.log('Service worker is installing...');\n }\n }\n }\n // Increment the `updatefound` count, so future invocations of this\n // method can be sure they were triggered externally.\n ++this._updateFoundCount;\n // Add a `statechange` listener regardless of whether this update was\n // triggered externally, since we have callbacks for both.\n installingSW.addEventListener('statechange', this._onStateChange);\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onStateChange = (originalEvent) => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const sw = originalEvent.target;\n const { state } = sw;\n const isExternal = sw === this._externalSW;\n const eventProps = {\n sw,\n isExternal,\n originalEvent,\n };\n if (!isExternal && this._isUpdate) {\n eventProps.isUpdate = true;\n }\n this.dispatchEvent(new WorkboxEvent(state, eventProps));\n if (state === 'installed') {\n // This timeout is used to ignore cases where the service worker calls\n // `skipWaiting()` in the install event, thus moving it directly in the\n // activating state. (Since all service workers *must* go through the\n // waiting phase, the only way to detect `skipWaiting()` called in the\n // install event is to observe that the time spent in the waiting phase\n // is very short.)\n // NOTE: we don't need separate timeouts for the own and external SWs\n // since they can't go through these phases at the same time.\n this._waitingTimeout = self.setTimeout(() => {\n // Ensure the SW is still waiting (it may now be redundant).\n if (state === 'installed' && registration.waiting === sw) {\n this.dispatchEvent(new WorkboxEvent('waiting', eventProps));\n if (process.env.NODE_ENV !== 'production') {\n if (isExternal) {\n logger.warn('An external service worker has installed but is ' +\n 'waiting for this client to close before activating...');\n }\n else {\n logger.warn('The service worker has installed but is waiting ' +\n 'for existing clients to close before activating...');\n }\n }\n }\n }, WAITING_TIMEOUT_DURATION);\n }\n else if (state === 'activating') {\n clearTimeout(this._waitingTimeout);\n if (!isExternal) {\n this._activeDeferred.resolve(sw);\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n switch (state) {\n case 'installed':\n if (isExternal) {\n logger.warn('An external service worker has installed. ' +\n 'You may want to suggest users reload this page.');\n }\n else {\n logger.log('Registered service worker installed.');\n }\n break;\n case 'activated':\n if (isExternal) {\n logger.warn('An external service worker has activated.');\n }\n else {\n logger.log('Registered service worker activated.');\n if (sw !== navigator.serviceWorker.controller) {\n logger.warn('The registered service worker is active but ' +\n 'not yet controlling the page. Reload or run ' +\n '`clients.claim()` in the service worker.');\n }\n }\n break;\n case 'redundant':\n if (sw === this._compatibleControllingSW) {\n logger.log('Previously controlling service worker now redundant!');\n }\n else if (!isExternal) {\n logger.log('Registered service worker now redundant!');\n }\n break;\n }\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onControllerChange = (originalEvent) => {\n const sw = this._sw;\n const isExternal = sw !== navigator.serviceWorker.controller;\n // Unconditionally dispatch the controlling event, with isExternal set\n // to distinguish between controller changes due to the initial registration\n // vs. an update-check or other tab's registration.\n // See https://github.com/GoogleChrome/workbox/issues/2786\n this.dispatchEvent(new WorkboxEvent('controlling', {\n isExternal,\n originalEvent,\n sw,\n isUpdate: this._isUpdate,\n }));\n if (!isExternal) {\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Registered service worker now controlling this page.');\n }\n this._controllingDeferred.resolve(sw);\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onMessage = async (originalEvent) => {\n // Can't change type 'any' of data.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const { data, ports, source } = originalEvent;\n // Wait until there's an \"own\" service worker. This is used to buffer\n // `message` events that may be received prior to calling `register()`.\n await this.getSW();\n // If the service worker that sent the message is in the list of own\n // service workers for this instance, dispatch a `message` event.\n // NOTE: we check for all previously owned service workers rather than\n // just the current one because some messages (e.g. cache updates) use\n // a timeout when sent and may be delayed long enough for a service worker\n // update to be found.\n if (this._ownSWs.has(source)) {\n this.dispatchEvent(new WorkboxEvent('message', {\n // Can't change type 'any' of data.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n data,\n originalEvent,\n ports,\n sw: source,\n }));\n }\n };\n this._scriptURL = scriptURL;\n this._registerOptions = registerOptions;\n // Add a message listener immediately since messages received during\n // page load are buffered only until the DOMContentLoaded event:\n // https://github.com/GoogleChrome/workbox/issues/2202\n navigator.serviceWorker.addEventListener('message', this._onMessage);\n }\n /**\n * Registers a service worker for this instances script URL and service\n * worker options. By default this method delays registration until after\n * the window has loaded.\n *\n * @param {Object} [options]\n * @param {Function} [options.immediate=false] Setting this to true will\n * register the service worker immediately, even if the window has\n * not loaded (not recommended).\n */\n async register({ immediate = false } = {}) {\n if (process.env.NODE_ENV !== 'production') {\n if (this._registrationTime) {\n logger.error('Cannot re-register a Workbox instance after it has ' +\n 'been registered. Create a new instance instead.');\n return;\n }\n }\n if (!immediate && document.readyState !== 'complete') {\n await new Promise((res) => window.addEventListener('load', res));\n }\n // Set this flag to true if any service worker was controlling the page\n // at registration time.\n this._isUpdate = Boolean(navigator.serviceWorker.controller);\n // Before registering, attempt to determine if a SW is already controlling\n // the page, and if that SW script (and version, if specified) matches this\n // instance's script.\n this._compatibleControllingSW = this._getControllingSWIfCompatible();\n this._registration = await this._registerScript();\n // If we have a compatible controller, store the controller as the \"own\"\n // SW, resolve active/controlling deferreds and add necessary listeners.\n if (this._compatibleControllingSW) {\n this._sw = this._compatibleControllingSW;\n this._activeDeferred.resolve(this._compatibleControllingSW);\n this._controllingDeferred.resolve(this._compatibleControllingSW);\n this._compatibleControllingSW.addEventListener('statechange', this._onStateChange, { once: true });\n }\n // If there's a waiting service worker with a matching URL before the\n // `updatefound` event fires, it likely means that this site is open\n // in another tab, or the user refreshed the page (and thus the previous\n // page wasn't fully unloaded before this page started loading).\n // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting\n const waitingSW = this._registration.waiting;\n if (waitingSW &&\n urlsMatch(waitingSW.scriptURL, this._scriptURL.toString())) {\n // Store the waiting SW as the \"own\" Sw, even if it means overwriting\n // a compatible controller.\n this._sw = waitingSW;\n // Run this in the next microtask, so any code that adds an event\n // listener after awaiting `register()` will get this event.\n dontWaitFor(Promise.resolve().then(() => {\n this.dispatchEvent(new WorkboxEvent('waiting', {\n sw: waitingSW,\n wasWaitingBeforeRegister: true,\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.warn('A service worker was already waiting to activate ' +\n 'before this script was registered...');\n }\n }));\n }\n // If an \"own\" SW is already set, resolve the deferred.\n if (this._sw) {\n this._swDeferred.resolve(this._sw);\n this._ownSWs.add(this._sw);\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Successfully registered service worker.', this._scriptURL.toString());\n if (navigator.serviceWorker.controller) {\n if (this._compatibleControllingSW) {\n logger.debug('A service worker with the same script URL ' +\n 'is already controlling this page.');\n }\n else {\n logger.debug('A service worker with a different script URL is ' +\n 'currently controlling the page. The browser is now fetching ' +\n 'the new script now...');\n }\n }\n const currentPageIsOutOfScope = () => {\n const scopeURL = new URL(this._registerOptions.scope || this._scriptURL.toString(), document.baseURI);\n const scopeURLBasePath = new URL('./', scopeURL.href).pathname;\n return !location.pathname.startsWith(scopeURLBasePath);\n };\n if (currentPageIsOutOfScope()) {\n logger.warn('The current page is not in scope for the registered ' +\n 'service worker. Was this a mistake?');\n }\n }\n this._registration.addEventListener('updatefound', this._onUpdateFound);\n navigator.serviceWorker.addEventListener('controllerchange', this._onControllerChange);\n return this._registration;\n }\n /**\n * Checks for updates of the registered service worker.\n */\n async update() {\n if (!this._registration) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error('Cannot update a Workbox instance without ' +\n 'being registered. Register the Workbox instance first.');\n }\n return;\n }\n // Try to update registration\n await this._registration.update();\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is active. If a service worker was already controlling at registration\n * time then it will resolve to that if the script URLs (and optionally\n * script versions) match, otherwise it will wait until an update is found\n * and activates.\n *\n * @return {Promise}\n */\n get active() {\n return this._activeDeferred.promise;\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is controlling the page. If a service worker was already controlling at\n * registration time then it will resolve to that if the script URLs (and\n * optionally script versions) match, otherwise it will wait until an update\n * is found and starts controlling the page.\n * Note: the first time a service worker is installed it will active but\n * not start controlling the page unless `clients.claim()` is called in the\n * service worker.\n *\n * @return {Promise}\n */\n get controlling() {\n return this._controllingDeferred.promise;\n }\n /**\n * Resolves with a reference to a service worker that matches the script URL\n * of this instance, as soon as it's available.\n *\n * If, at registration time, there's already an active or waiting service\n * worker with a matching script URL, it will be used (with the waiting\n * service worker taking precedence over the active service worker if both\n * match, since the waiting service worker would have been registered more\n * recently).\n * If there's no matching active or waiting service worker at registration\n * time then the promise will not resolve until an update is found and starts\n * installing, at which point the installing service worker is used.\n *\n * @return {Promise}\n */\n getSW() {\n // If `this._sw` is set, resolve with that as we want `getSW()` to\n // return the correct (new) service worker if an update is found.\n return this._sw !== undefined\n ? Promise.resolve(this._sw)\n : this._swDeferred.promise;\n }\n /**\n * Sends the passed data object to the service worker registered by this\n * instance (via {@link workbox-window.Workbox#getSW}) and resolves\n * with a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will never\n * resolve.\n *\n * @param {Object} data An object to send to the service worker\n * @return {Promise}\n */\n // We might be able to change the 'data' type to Record in the future.\n // eslint-disable-next-line @typescript-eslint/ban-types\n async messageSW(data) {\n const sw = await this.getSW();\n return messageSW(sw, data);\n }\n /**\n * Sends a `{type: 'SKIP_WAITING'}` message to the service worker that's\n * currently in the `waiting` state associated with the current registration.\n *\n * If there is no current registration or no service worker is `waiting`,\n * calling this will have no effect.\n */\n messageSkipWaiting() {\n if (this._registration && this._registration.waiting) {\n void messageSW(this._registration.waiting, SKIP_WAITING_MESSAGE);\n }\n }\n /**\n * Checks for a service worker already controlling the page and returns\n * it if its script URL matches.\n *\n * @private\n * @return {ServiceWorker|undefined}\n */\n _getControllingSWIfCompatible() {\n const controller = navigator.serviceWorker.controller;\n if (controller &&\n urlsMatch(controller.scriptURL, this._scriptURL.toString())) {\n return controller;\n }\n else {\n return undefined;\n }\n }\n /**\n * Registers a service worker for this instances script URL and register\n * options and tracks the time registration was complete.\n *\n * @private\n */\n async _registerScript() {\n try {\n // this._scriptURL may be a TrustedScriptURL, but there's no support for\n // passing that to register() in lib.dom right now.\n // https://github.com/GoogleChrome/workbox/issues/2855\n const reg = await navigator.serviceWorker.register(this._scriptURL, this._registerOptions);\n // Keep track of when registration happened, so it can be used in the\n // `this._onUpdateFound` heuristic. Also use the presence of this\n // property as a way to see if `.register()` has been called.\n this._registrationTime = performance.now();\n return reg;\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(error);\n }\n // Re-throw the error.\n throw error;\n }\n }\n}\nexport { Workbox };\n// The jsdoc comments below outline the events this instance may dispatch:\n// -----------------------------------------------------------------------\n/**\n * The `message` event is dispatched any time a `postMessage` is received.\n *\n * @event workbox-window.Workbox#message\n * @type {WorkboxEvent}\n * @property {*} data The `data` property from the original `message` event.\n * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}\n * event.\n * @property {string} type `message`.\n * @property {MessagePort[]} ports The `ports` value from `originalEvent`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `installed` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}\n * changes to `installed`.\n *\n * Then can happen either the very first time a service worker is installed,\n * or after an update to the current service worker is found. In the case\n * of an update being found, the event's `isUpdate` property will be `true`.\n *\n * @event workbox-window.Workbox#installed\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `installed`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `waiting` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed` and then doesn't immediately change to `activating`.\n * It may also be dispatched if a service worker with the same\n * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * was already waiting when the {@link workbox-window.Workbox#register}\n * method was called.\n *\n * @event workbox-window.Workbox#waiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event|undefined} originalEvent The original\n * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event, or `undefined` in the case where the service worker was waiting\n * to before `.register()` was called.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with\n * a matching `scriptURL` was already waiting when this `Workbox`\n * instance called `register()`.\n * @property {string} type `waiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `controlling` event is dispatched if a\n * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}\n * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}\n * matches the `scriptURL` of the `Workbox` instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.\n *\n * @event workbox-window.Workbox#controlling\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this service worker was registered.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `controlling`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `activated` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}\n * changes to `activated`.\n *\n * @event workbox-window.Workbox#activated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `activated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `redundant` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `redundant`.\n *\n * @event workbox-window.Workbox#redundant\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `redundant`.\n * @property {Workbox} target The `Workbox` instance.\n */\n"],"names":["self","_","e","messageSW","sw","data","Promise","resolve","messageChannel","MessageChannel","port1","onmessage","event","postMessage","port2","Deferred","constructor","promise","reject","dontWaitFor","then","logger","globalThis","__WB_DISABLE_DEV_LOGS","inGroup","methodToColorMap","debug","log","warn","error","groupCollapsed","groupEnd","print","method","args","test","navigator","userAgent","console","styles","logPrefix","join","api","loggerMethods","Object","keys","key","WorkboxEventTarget","_eventListenerRegistry","Map","addEventListener","type","listener","foo","_getEventListenersByType","add","removeEventListener","delete","dispatchEvent","target","listeners","has","set","Set","get","urlsMatch","url1","url2","href","location","URL","WorkboxEvent","props","assign","WAITING_TIMEOUT_DURATION","REGISTRATION_TIMEOUT_DURATION","SKIP_WAITING_MESSAGE","Workbox","scriptURL","registerOptions","_registerOptions","_updateFoundCount","_swDeferred","_activeDeferred","_controllingDeferred","_registrationTime","_ownSWs","_onUpdateFound","registration","_registration","installingSW","installing","updateLikelyTriggeredExternally","_scriptURL","toString","performance","now","_externalSW","_sw","serviceWorker","controller","_onStateChange","originalEvent","state","isExternal","eventProps","_isUpdate","isUpdate","_waitingTimeout","setTimeout","waiting","clearTimeout","_compatibleControllingSW","_onControllerChange","_onMessage","ports","source","getSW","register","immediate","document","readyState","res","window","Boolean","_getControllingSWIfCompatible","_registerScript","once","waitingSW","wasWaitingBeforeRegister","currentPageIsOutOfScope","scopeURL","scope","baseURI","scopeURLBasePath","pathname","startsWith","update","active","controlling","undefined","messageSkipWaiting","reg"],"mappings":"AACA;AACA,IAAI;AACAA,EAAAA,IAAI,CAAC,sBAAsB,CAAC,IAAIC,CAAC,EAAE;AACvC,CAAC,CACD,OAAOC,CAAC,EAAE,CAAE;;ACLZ;AACA;;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,SAASA,CAACC,EAAE,EAAEC,IAAI,EAAE;AACzB,EAAA,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAK;AAC5B,IAAA,MAAMC,cAAc,GAAG,IAAIC,cAAc,EAAE;AAC3CD,IAAAA,cAAc,CAACE,KAAK,CAACC,SAAS,GAAIC,KAAK,IAAK;AACxCL,MAAAA,OAAO,CAACK,KAAK,CAACP,IAAI,CAAC;IACvB,CAAC;IACDD,EAAE,CAACS,WAAW,CAACR,IAAI,EAAE,CAACG,cAAc,CAACM,KAAK,CAAC,CAAC;AAChD,EAAA,CAAC,CAAC;AACN;;AC/BA;AACA,IAAI;AACAd,EAAAA,IAAI,CAAC,oBAAoB,CAAC,IAAIC,CAAC,EAAE;AACrC,CAAC,CACD,OAAOC,CAAC,EAAE,CAAE;;ACLZ;AACA;;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMa,QAAQ,CAAC;AACX;AACJ;AACA;AACIC,EAAAA,WAAWA,GAAG;IACV,IAAI,CAACC,OAAO,GAAG,IAAIX,OAAO,CAAC,CAACC,OAAO,EAAEW,MAAM,KAAK;MAC5C,IAAI,CAACX,OAAO,GAAGA,OAAO;MACtB,IAAI,CAACW,MAAM,GAAGA,MAAM;AACxB,IAAA,CAAC,CAAC;AACN,EAAA;AACJ;;AC1BA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAACF,OAAO,EAAE;AACjC;AACA,EAAA,KAAKA,OAAO,CAACG,IAAI,CAAC,MAAM,CAAE,CAAC,CAAC;AAChC;;ACfA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMC,MAAM,GAEN,CAAC,MAAM;AACL;AACA;AACA,EAAA,IAAI,EAAE,uBAAuB,IAAIC,UAAU,CAAC,EAAE;IAC1CtB,IAAI,CAACuB,qBAAqB,GAAG,KAAK;AACtC,EAAA;EACA,IAAIC,OAAO,GAAG,KAAK;AACnB,EAAA,MAAMC,gBAAgB,GAAG;AACrBC,IAAAA,KAAK,EAAG,CAAA,OAAA,CAAQ;AAChBC,IAAAA,GAAG,EAAG,CAAA,OAAA,CAAQ;AACdC,IAAAA,IAAI,EAAG,CAAA,OAAA,CAAQ;AACfC,IAAAA,KAAK,EAAG,CAAA,OAAA,CAAQ;AAChBC,IAAAA,cAAc,EAAG,CAAA,OAAA,CAAQ;IACzBC,QAAQ,EAAE,IAAI;GACjB;AACD,EAAA,MAAMC,KAAK,GAAG,UAAUC,MAAM,EAAEC,IAAI,EAAE;IAClC,IAAIlC,IAAI,CAACuB,qBAAqB,EAAE;AAC5B,MAAA;AACJ,IAAA;IACA,IAAIU,MAAM,KAAK,gBAAgB,EAAE;AAC7B;AACA;MACA,IAAI,gCAAgC,CAACE,IAAI,CAACC,SAAS,CAACC,SAAS,CAAC,EAAE;AAC5DC,QAAAA,OAAO,CAACL,MAAM,CAAC,CAAC,GAAGC,IAAI,CAAC;AACxB,QAAA;AACJ,MAAA;AACJ,IAAA;AACA,IAAA,MAAMK,MAAM,GAAG,CACV,CAAA,YAAA,EAAcd,gBAAgB,CAACQ,MAAM,CAAE,CAAA,CAAC,EACxC,sBAAqB,EACrB,CAAA,YAAA,CAAa,EACb,CAAA,iBAAA,CAAkB,EAClB,oBAAmB,CACvB;AACD;AACA,IAAA,MAAMO,SAAS,GAAGhB,OAAO,GAAG,EAAE,GAAG,CAAC,WAAW,EAAEe,MAAM,CAACE,IAAI,CAAC,GAAG,CAAC,CAAC;IAChEH,OAAO,CAACL,MAAM,CAAC,CAAC,GAAGO,SAAS,EAAE,GAAGN,IAAI,CAAC;IACtC,IAAID,MAAM,KAAK,gBAAgB,EAAE;AAC7BT,MAAAA,OAAO,GAAG,IAAI;AAClB,IAAA;IACA,IAAIS,MAAM,KAAK,UAAU,EAAE;AACvBT,MAAAA,OAAO,GAAG,KAAK;AACnB,IAAA;EACJ,CAAC;AACD;EACA,MAAMkB,GAAG,GAAG,EAAE;AACd,EAAA,MAAMC,aAAa,GAAGC,MAAM,CAACC,IAAI,CAACpB,gBAAgB,CAAC;AACnD,EAAA,KAAK,MAAMqB,GAAG,IAAIH,aAAa,EAAE;IAC7B,MAAMV,MAAM,GAAGa,GAAG;AAClBJ,IAAAA,GAAG,CAACT,MAAM,CAAC,GAAG,CAAC,GAAGC,IAAI,KAAK;AACvBF,MAAAA,KAAK,CAACC,MAAM,EAAEC,IAAI,CAAC;IACvB,CAAC;AACL,EAAA;AACA,EAAA,OAAOQ,GAAG;AACd,CAAC,GAAI;;AC/DT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMK,kBAAkB,CAAC;AAC5B/B,EAAAA,WAAWA,GAAG;AACV,IAAA,IAAI,CAACgC,sBAAsB,GAAG,IAAIC,GAAG,EAAE;AAC3C,EAAA;AACA;AACJ;AACA;AACA;AACA;AACIC,EAAAA,gBAAgBA,CAACC,IAAI,EAAEC,QAAQ,EAAE;AAC7B,IAAA,MAAMC,GAAG,GAAG,IAAI,CAACC,wBAAwB,CAACH,IAAI,CAAC;AAC/CE,IAAAA,GAAG,CAACE,GAAG,CAACH,QAAQ,CAAC;AACrB,EAAA;AACA;AACJ;AACA;AACA;AACA;AACII,EAAAA,mBAAmBA,CAACL,IAAI,EAAEC,QAAQ,EAAE;IAChC,IAAI,CAACE,wBAAwB,CAACH,IAAI,CAAC,CAACM,MAAM,CAACL,QAAQ,CAAC;AACxD,EAAA;AACA;AACJ;AACA;AACA;EACIM,aAAaA,CAAC9C,KAAK,EAAE;IACjBA,KAAK,CAAC+C,MAAM,GAAG,IAAI;IACnB,MAAMC,SAAS,GAAG,IAAI,CAACN,wBAAwB,CAAC1C,KAAK,CAACuC,IAAI,CAAC;AAC3D,IAAA,KAAK,MAAMC,QAAQ,IAAIQ,SAAS,EAAE;MAC9BR,QAAQ,CAACxC,KAAK,CAAC;AACnB,IAAA;AACJ,EAAA;AACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;EACI0C,wBAAwBA,CAACH,IAAI,EAAE;IAC3B,IAAI,CAAC,IAAI,CAACH,sBAAsB,CAACa,GAAG,CAACV,IAAI,CAAC,EAAE;MACxC,IAAI,CAACH,sBAAsB,CAACc,GAAG,CAACX,IAAI,EAAE,IAAIY,GAAG,EAAE,CAAC;AACpD,IAAA;AACA,IAAA,OAAO,IAAI,CAACf,sBAAsB,CAACgB,GAAG,CAACb,IAAI,CAAC;AAChD,EAAA;AACJ;;AC3DA;AACA;;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASc,SAASA,CAACC,IAAI,EAAEC,IAAI,EAAE;EAClC,MAAM;AAAEC,IAAAA;AAAK,GAAC,GAAGC,QAAQ;AACzB,EAAA,OAAO,IAAIC,GAAG,CAACJ,IAAI,EAAEE,IAAI,CAAC,CAACA,IAAI,KAAK,IAAIE,GAAG,CAACH,IAAI,EAAEC,IAAI,CAAC,CAACA,IAAI;AAChE;;ACpBA;AACA;;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,YAAY,CAAC;AACtBvD,EAAAA,WAAWA,CAACmC,IAAI,EAAEqB,KAAK,EAAE;IACrB,IAAI,CAACrB,IAAI,GAAGA,IAAI;AAChBP,IAAAA,MAAM,CAAC6B,MAAM,CAAC,IAAI,EAAED,KAAK,CAAC;AAC9B,EAAA;AACJ;;ACnBA;AACA;;AAEA;AACA;AACA;AACA;AASA;AACA;AACA;AACA,MAAME,wBAAwB,GAAG,GAAG;AACpC;AACA;AACA,MAAMC,6BAA6B,GAAG,KAAK;AAC3C;AACA;AACA,MAAMC,oBAAoB,GAAG;AAAEzB,EAAAA,IAAI,EAAE;AAAe,CAAC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM0B,OAAO,SAAS9B,kBAAkB,CAAC;AACrC;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACI;AACA/B,EAAAA,WAAWA,CAAC8D,SAAS,EAAEC,eAAe,GAAG,EAAE,EAAE;AACzC,IAAA,KAAK,EAAE;AACP,IAAA,IAAI,CAACC,gBAAgB,GAAG,EAAE;IAC1B,IAAI,CAACC,iBAAiB,GAAG,CAAC;AAC1B;AACA,IAAA,IAAI,CAACC,WAAW,GAAG,IAAInE,QAAQ,EAAE;AACjC,IAAA,IAAI,CAACoE,eAAe,GAAG,IAAIpE,QAAQ,EAAE;AACrC,IAAA,IAAI,CAACqE,oBAAoB,GAAG,IAAIrE,QAAQ,EAAE;IAC1C,IAAI,CAACsE,iBAAiB,GAAG,CAAC;AAC1B,IAAA,IAAI,CAACC,OAAO,GAAG,IAAIvB,GAAG,EAAE;AACxB;AACR;AACA;IACQ,IAAI,CAACwB,cAAc,GAAG,MAAM;AACxB;AACA,MAAA,MAAMC,YAAY,GAAG,IAAI,CAACC,aAAa;AACvC,MAAA,MAAMC,YAAY,GAAGF,YAAY,CAACG,UAAU;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAA,MAAMC,+BAA+B;AACrC;AACA;AACA;AACA;MACA,IAAI,CAACX,iBAAiB,GAAG,CAAC;AACtB;AACA;AACA;AACA,MAAA,CAAChB,SAAS,CAACyB,YAAY,CAACZ,SAAS,EAAE,IAAI,CAACe,UAAU,CAACC,QAAQ,EAAE,CAAC;AAC9D;AACA;AACA;MACAC,WAAW,CAACC,GAAG,EAAE,GAAG,IAAI,CAACX,iBAAiB,GAAGV,6BAA6B;AACxE;AACE;AACA,MAAA,IAAI,GACN,KAAK;AACX,MAAA,IAAIiB,+BAA+B,EAAE;QACjC,IAAI,CAACK,WAAW,GAAGP,YAAY;QAC/BF,YAAY,CAAChC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC+B,cAAc,CAAC;AACxE,MAAA,CAAC,MACI;AACD;AACA;QACA,IAAI,CAACW,GAAG,GAAGR,YAAY;AACvB,QAAA,IAAI,CAACJ,OAAO,CAAC/B,GAAG,CAACmC,YAAY,CAAC;AAC9B,QAAA,IAAI,CAACR,WAAW,CAAC3E,OAAO,CAACmF,YAAY,CAAC;AACtC;AACA;AACA,QAA2C;AACvC,UAAA,IAAItD,SAAS,CAAC+D,aAAa,CAACC,UAAU,EAAE;AACpC/E,YAAAA,MAAM,CAACM,GAAG,CAAC,iDAAiD,CAAC;AACjE,UAAA,CAAC,MACI;AACDN,YAAAA,MAAM,CAACM,GAAG,CAAC,iCAAiC,CAAC;AACjD,UAAA;AACJ,QAAA;AACJ,MAAA;AACA;AACA;MACA,EAAE,IAAI,CAACsD,iBAAiB;AACxB;AACA;MACAS,YAAY,CAACxC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAACmD,cAAc,CAAC;IACrE,CAAC;AACD;AACR;AACA;AACA;AACQ,IAAA,IAAI,CAACA,cAAc,GAAIC,aAAa,IAAK;AACrC;AACA,MAAA,MAAMd,YAAY,GAAG,IAAI,CAACC,aAAa;AACvC,MAAA,MAAMrF,EAAE,GAAGkG,aAAa,CAAC3C,MAAM;MAC/B,MAAM;AAAE4C,QAAAA;AAAM,OAAC,GAAGnG,EAAE;AACpB,MAAA,MAAMoG,UAAU,GAAGpG,EAAE,KAAK,IAAI,CAAC6F,WAAW;AAC1C,MAAA,MAAMQ,UAAU,GAAG;QACfrG,EAAE;QACFoG,UAAU;AACVF,QAAAA;OACH;AACD,MAAA,IAAI,CAACE,UAAU,IAAI,IAAI,CAACE,SAAS,EAAE;QAC/BD,UAAU,CAACE,QAAQ,GAAG,IAAI;AAC9B,MAAA;MACA,IAAI,CAACjD,aAAa,CAAC,IAAIa,YAAY,CAACgC,KAAK,EAAEE,UAAU,CAAC,CAAC;MACvD,IAAIF,KAAK,KAAK,WAAW,EAAE;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAA,IAAI,CAACK,eAAe,GAAG5G,IAAI,CAAC6G,UAAU,CAAC,MAAM;AACzC;UACA,IAAIN,KAAK,KAAK,WAAW,IAAIf,YAAY,CAACsB,OAAO,KAAK1G,EAAE,EAAE;YACtD,IAAI,CAACsD,aAAa,CAAC,IAAIa,YAAY,CAAC,SAAS,EAAEkC,UAAU,CAAC,CAAC;AAC3D,YAA2C;AACvC,cAAA,IAAID,UAAU,EAAE;AACZnF,gBAAAA,MAAM,CAACO,IAAI,CAAC,kDAAkD,GAC1D,uDAAuD,CAAC;AAChE,cAAA,CAAC,MACI;AACDP,gBAAAA,MAAM,CAACO,IAAI,CAAC,kDAAkD,GAC1D,oDAAoD,CAAC;AAC7D,cAAA;AACJ,YAAA;AACJ,UAAA;QACJ,CAAC,EAAE8C,wBAAwB,CAAC;AAChC,MAAA,CAAC,MACI,IAAI6B,KAAK,KAAK,YAAY,EAAE;AAC7BQ,QAAAA,YAAY,CAAC,IAAI,CAACH,eAAe,CAAC;QAClC,IAAI,CAACJ,UAAU,EAAE;AACb,UAAA,IAAI,CAACrB,eAAe,CAAC5E,OAAO,CAACH,EAAE,CAAC;AACpC,QAAA;AACJ,MAAA;AACA,MAA2C;AACvC,QAAA,QAAQmG,KAAK;AACT,UAAA,KAAK,WAAW;AACZ,YAAA,IAAIC,UAAU,EAAE;AACZnF,cAAAA,MAAM,CAACO,IAAI,CAAC,4CAA4C,GACpD,iDAAiD,CAAC;AAC1D,YAAA,CAAC,MACI;AACDP,cAAAA,MAAM,CAACM,GAAG,CAAC,sCAAsC,CAAC;AACtD,YAAA;AACA,YAAA;AACJ,UAAA,KAAK,WAAW;AACZ,YAAA,IAAI6E,UAAU,EAAE;AACZnF,cAAAA,MAAM,CAACO,IAAI,CAAC,2CAA2C,CAAC;AAC5D,YAAA,CAAC,MACI;AACDP,cAAAA,MAAM,CAACM,GAAG,CAAC,sCAAsC,CAAC;AAClD,cAAA,IAAIvB,EAAE,KAAKgC,SAAS,CAAC+D,aAAa,CAACC,UAAU,EAAE;gBAC3C/E,MAAM,CAACO,IAAI,CAAC,8CAA8C,GACtD,8CAA8C,GAC9C,0CAA0C,CAAC;AACnD,cAAA;AACJ,YAAA;AACA,YAAA;AACJ,UAAA,KAAK,WAAW;AACZ,YAAA,IAAIxB,EAAE,KAAK,IAAI,CAAC4G,wBAAwB,EAAE;AACtC3F,cAAAA,MAAM,CAACM,GAAG,CAAC,sDAAsD,CAAC;AACtE,YAAA,CAAC,MACI,IAAI,CAAC6E,UAAU,EAAE;AAClBnF,cAAAA,MAAM,CAACM,GAAG,CAAC,0CAA0C,CAAC;AAC1D,YAAA;AACA,YAAA;AACR;AACJ,MAAA;IACJ,CAAC;AACD;AACR;AACA;AACA;AACQ,IAAA,IAAI,CAACsF,mBAAmB,GAAIX,aAAa,IAAK;AAC1C,MAAA,MAAMlG,EAAE,GAAG,IAAI,CAAC8F,GAAG;MACnB,MAAMM,UAAU,GAAGpG,EAAE,KAAKgC,SAAS,CAAC+D,aAAa,CAACC,UAAU;AAC5D;AACA;AACA;AACA;AACA,MAAA,IAAI,CAAC1C,aAAa,CAAC,IAAIa,YAAY,CAAC,aAAa,EAAE;QAC/CiC,UAAU;QACVF,aAAa;QACblG,EAAE;QACFuG,QAAQ,EAAE,IAAI,CAACD;AACnB,OAAC,CAAC,CAAC;MACH,IAAI,CAACF,UAAU,EAAE;AACb,QAA2C;AACvCnF,UAAAA,MAAM,CAACM,GAAG,CAAC,sDAAsD,CAAC;AACtE,QAAA;AACA,QAAA,IAAI,CAACyD,oBAAoB,CAAC7E,OAAO,CAACH,EAAE,CAAC;AACzC,MAAA;IACJ,CAAC;AACD;AACR;AACA;AACA;AACQ,IAAA,IAAI,CAAC8G,UAAU,GAAG,MAAOZ,aAAa,IAAK;AACvC;AACA;MACA,MAAM;QAAEjG,IAAI;QAAE8G,KAAK;AAAEC,QAAAA;AAAO,OAAC,GAAGd,aAAa;AAC7C;AACA;AACA,MAAA,MAAM,IAAI,CAACe,KAAK,EAAE;AAClB;AACA;AACA;AACA;AACA;AACA;MACA,IAAI,IAAI,CAAC/B,OAAO,CAACzB,GAAG,CAACuD,MAAM,CAAC,EAAE;AAC1B,QAAA,IAAI,CAAC1D,aAAa,CAAC,IAAIa,YAAY,CAAC,SAAS,EAAE;AAC3C;AACA;UACAlE,IAAI;UACJiG,aAAa;UACba,KAAK;AACL/G,UAAAA,EAAE,EAAEgH;AACR,SAAC,CAAC,CAAC;AACP,MAAA;IACJ,CAAC;IACD,IAAI,CAACvB,UAAU,GAAGf,SAAS;IAC3B,IAAI,CAACE,gBAAgB,GAAGD,eAAe;AACvC;AACA;AACA;IACA3C,SAAS,CAAC+D,aAAa,CAACjD,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAACgE,UAAU,CAAC;AACxE,EAAA;AACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACI,EAAA,MAAMI,QAAQA,CAAC;AAAEC,IAAAA,SAAS,GAAG;GAAO,GAAG,EAAE,EAAE;AACvC,IAA2C;MACvC,IAAI,IAAI,CAAClC,iBAAiB,EAAE;AACxBhE,QAAAA,MAAM,CAACQ,KAAK,CAAC,qDAAqD,GAC9D,iDAAiD,CAAC;AACtD,QAAA;AACJ,MAAA;AACJ,IAAA;IACA,IAAI,CAAC0F,SAAS,IAAIC,QAAQ,CAACC,UAAU,KAAK,UAAU,EAAE;AAClD,MAAA,MAAM,IAAInH,OAAO,CAAEoH,GAAG,IAAKC,MAAM,CAACzE,gBAAgB,CAAC,MAAM,EAAEwE,GAAG,CAAC,CAAC;AACpE,IAAA;AACA;AACA;IACA,IAAI,CAAChB,SAAS,GAAGkB,OAAO,CAACxF,SAAS,CAAC+D,aAAa,CAACC,UAAU,CAAC;AAC5D;AACA;AACA;AACA,IAAA,IAAI,CAACY,wBAAwB,GAAG,IAAI,CAACa,6BAA6B,EAAE;IACpE,IAAI,CAACpC,aAAa,GAAG,MAAM,IAAI,CAACqC,eAAe,EAAE;AACjD;AACA;IACA,IAAI,IAAI,CAACd,wBAAwB,EAAE;AAC/B,MAAA,IAAI,CAACd,GAAG,GAAG,IAAI,CAACc,wBAAwB;MACxC,IAAI,CAAC7B,eAAe,CAAC5E,OAAO,CAAC,IAAI,CAACyG,wBAAwB,CAAC;MAC3D,IAAI,CAAC5B,oBAAoB,CAAC7E,OAAO,CAAC,IAAI,CAACyG,wBAAwB,CAAC;MAChE,IAAI,CAACA,wBAAwB,CAAC9D,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAACmD,cAAc,EAAE;AAAE0B,QAAAA,IAAI,EAAE;AAAK,OAAC,CAAC;AACtG,IAAA;AACA;AACA;AACA;AACA;AACA;AACA,IAAA,MAAMC,SAAS,GAAG,IAAI,CAACvC,aAAa,CAACqB,OAAO;AAC5C,IAAA,IAAIkB,SAAS,IACT/D,SAAS,CAAC+D,SAAS,CAAClD,SAAS,EAAE,IAAI,CAACe,UAAU,CAACC,QAAQ,EAAE,CAAC,EAAE;AAC5D;AACA;MACA,IAAI,CAACI,GAAG,GAAG8B,SAAS;AACpB;AACA;MACA7G,WAAW,CAACb,OAAO,CAACC,OAAO,EAAE,CAACa,IAAI,CAAC,MAAM;AACrC,QAAA,IAAI,CAACsC,aAAa,CAAC,IAAIa,YAAY,CAAC,SAAS,EAAE;AAC3CnE,UAAAA,EAAE,EAAE4H,SAAS;AACbC,UAAAA,wBAAwB,EAAE;AAC9B,SAAC,CAAC,CAAC;AACH,QAA2C;AACvC5G,UAAAA,MAAM,CAACO,IAAI,CAAC,mDAAmD,GAC3D,sCAAsC,CAAC;AAC/C,QAAA;AACJ,MAAA,CAAC,CAAC,CAAC;AACP,IAAA;AACA;IACA,IAAI,IAAI,CAACsE,GAAG,EAAE;MACV,IAAI,CAAChB,WAAW,CAAC3E,OAAO,CAAC,IAAI,CAAC2F,GAAG,CAAC;MAClC,IAAI,CAACZ,OAAO,CAAC/B,GAAG,CAAC,IAAI,CAAC2C,GAAG,CAAC;AAC9B,IAAA;AACA,IAA2C;AACvC7E,MAAAA,MAAM,CAACM,GAAG,CAAC,yCAAyC,EAAE,IAAI,CAACkE,UAAU,CAACC,QAAQ,EAAE,CAAC;AACjF,MAAA,IAAI1D,SAAS,CAAC+D,aAAa,CAACC,UAAU,EAAE;QACpC,IAAI,IAAI,CAACY,wBAAwB,EAAE;AAC/B3F,UAAAA,MAAM,CAACK,KAAK,CAAC,4CAA4C,GACrD,mCAAmC,CAAC;AAC5C,QAAA,CAAC,MACI;UACDL,MAAM,CAACK,KAAK,CAAC,kDAAkD,GAC3D,8DAA8D,GAC9D,uBAAuB,CAAC;AAChC,QAAA;AACJ,MAAA;MACA,MAAMwG,uBAAuB,GAAGA,MAAM;QAClC,MAAMC,QAAQ,GAAG,IAAI7D,GAAG,CAAC,IAAI,CAACU,gBAAgB,CAACoD,KAAK,IAAI,IAAI,CAACvC,UAAU,CAACC,QAAQ,EAAE,EAAE0B,QAAQ,CAACa,OAAO,CAAC;AACrG,QAAA,MAAMC,gBAAgB,GAAG,IAAIhE,GAAG,CAAC,IAAI,EAAE6D,QAAQ,CAAC/D,IAAI,CAAC,CAACmE,QAAQ;QAC9D,OAAO,CAAClE,QAAQ,CAACkE,QAAQ,CAACC,UAAU,CAACF,gBAAgB,CAAC;MAC1D,CAAC;MACD,IAAIJ,uBAAuB,EAAE,EAAE;AAC3B7G,QAAAA,MAAM,CAACO,IAAI,CAAC,sDAAsD,GAC9D,qCAAqC,CAAC;AAC9C,MAAA;AACJ,IAAA;IACA,IAAI,CAAC6D,aAAa,CAACvC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAACqC,cAAc,CAAC;IACvEnD,SAAS,CAAC+D,aAAa,CAACjD,gBAAgB,CAAC,kBAAkB,EAAE,IAAI,CAAC+D,mBAAmB,CAAC;IACtF,OAAO,IAAI,CAACxB,aAAa;AAC7B,EAAA;AACA;AACJ;AACA;EACI,MAAMgD,MAAMA,GAAG;AACX,IAAA,IAAI,CAAC,IAAI,CAAChD,aAAa,EAAE;AACrB,MAA2C;AACvCpE,QAAAA,MAAM,CAACQ,KAAK,CAAC,2CAA2C,GACpD,wDAAwD,CAAC;AACjE,MAAA;AACA,MAAA;AACJ,IAAA;AACA;AACA,IAAA,MAAM,IAAI,CAAC4D,aAAa,CAACgD,MAAM,EAAE;AACrC,EAAA;AACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACI,IAAIC,MAAMA,GAAG;AACT,IAAA,OAAO,IAAI,CAACvD,eAAe,CAAClE,OAAO;AACvC,EAAA;AACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACI,IAAI0H,WAAWA,GAAG;AACd,IAAA,OAAO,IAAI,CAACvD,oBAAoB,CAACnE,OAAO;AAC5C,EAAA;AACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACIoG,EAAAA,KAAKA,GAAG;AACJ;AACA;AACA,IAAA,OAAO,IAAI,CAACnB,GAAG,KAAK0C,SAAS,GACvBtI,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC2F,GAAG,CAAC,GACzB,IAAI,CAAChB,WAAW,CAACjE,OAAO;AAClC,EAAA;AACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACI;AACA;EACA,MAAMd,SAASA,CAACE,IAAI,EAAE;AAClB,IAAA,MAAMD,EAAE,GAAG,MAAM,IAAI,CAACiH,KAAK,EAAE;AAC7B,IAAA,OAAOlH,SAAS,CAACC,EAAE,EAAEC,IAAI,CAAC;AAC9B,EAAA;AACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACIwI,EAAAA,kBAAkBA,GAAG;IACjB,IAAI,IAAI,CAACpD,aAAa,IAAI,IAAI,CAACA,aAAa,CAACqB,OAAO,EAAE;MAClD,KAAK3G,SAAS,CAAC,IAAI,CAACsF,aAAa,CAACqB,OAAO,EAAElC,oBAAoB,CAAC;AACpE,IAAA;AACJ,EAAA;AACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACIiD,EAAAA,6BAA6BA,GAAG;AAC5B,IAAA,MAAMzB,UAAU,GAAGhE,SAAS,CAAC+D,aAAa,CAACC,UAAU;AACrD,IAAA,IAAIA,UAAU,IACVnC,SAAS,CAACmC,UAAU,CAACtB,SAAS,EAAE,IAAI,CAACe,UAAU,CAACC,QAAQ,EAAE,CAAC,EAAE;AAC7D,MAAA,OAAOM,UAAU;AACrB,IAAA,CAAC,MACI;AACD,MAAA,OAAOwC,SAAS;AACpB,IAAA;AACJ,EAAA;AACA;AACJ;AACA;AACA;AACA;AACA;EACI,MAAMd,eAAeA,GAAG;IACpB,IAAI;AACA;AACA;AACA;AACA,MAAA,MAAMgB,GAAG,GAAG,MAAM1G,SAAS,CAAC+D,aAAa,CAACmB,QAAQ,CAAC,IAAI,CAACzB,UAAU,EAAE,IAAI,CAACb,gBAAgB,CAAC;AAC1F;AACA;AACA;AACA,MAAA,IAAI,CAACK,iBAAiB,GAAGU,WAAW,CAACC,GAAG,EAAE;AAC1C,MAAA,OAAO8C,GAAG;IACd,CAAC,CACD,OAAOjH,KAAK,EAAE;AACV,MAA2C;AACvCR,QAAAA,MAAM,CAACQ,KAAK,CAACA,KAAK,CAAC;AACvB,MAAA;AACA;AACA,MAAA,MAAMA,KAAK;AACf,IAAA;AACJ,EAAA;AACJ;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-window/build/workbox-window.dev.umd.js b/tools/ui/node_modules/workbox-window/build/workbox-window.dev.umd.js
new file mode 100644
index 0000000000000000000000000000000000000000..9a3e40a8dfa12f71559febb7a9523874c8dc9723
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/build/workbox-window.dev.umd.js
@@ -0,0 +1,1007 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.workbox = {}));
+})(this, (function (exports) { 'use strict';
+
+ // @ts-ignore
+ try {
+ self['workbox:window:7.4.0'] && _();
+ } catch (e) {}
+
+ /*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+ */
+ /**
+ * Sends a data object to a service worker via `postMessage` and resolves with
+ * a response (if any).
+ *
+ * A response can be set in a message handler in the service worker by
+ * calling `event.ports[0].postMessage(...)`, which will resolve the promise
+ * returned by `messageSW()`. If no response is set, the promise will not
+ * resolve.
+ *
+ * @param {ServiceWorker} sw The service worker to send the message to.
+ * @param {Object} data An object to send to the service worker.
+ * @return {Promise}
+ * @memberof workbox-window
+ */
+ // Better not change type of data.
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ function messageSW(sw, data) {
+ return new Promise(function (resolve) {
+ var messageChannel = new MessageChannel();
+ messageChannel.port1.onmessage = function (event) {
+ resolve(event.data);
+ };
+ sw.postMessage(data, [messageChannel.port2]);
+ });
+ }
+
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+ function _defineProperties(e, r) {
+ for (var t = 0; t < r.length; t++) {
+ var o = r[t];
+ o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
+ }
+ }
+ function _createClass(e, r, t) {
+ return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
+ writable: false
+ }), e;
+ }
+ function _createForOfIteratorHelperLoose(r, e) {
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
+ if (t) return (t = t.call(r)).next.bind(t);
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
+ t && (r = t);
+ var o = 0;
+ return function () {
+ return o >= r.length ? {
+ done: true
+ } : {
+ done: false,
+ value: r[o++]
+ };
+ };
+ }
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
+ }
+ function _inheritsLoose(t, o) {
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
+ }
+ function _setPrototypeOf(t, e) {
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
+ return t.__proto__ = e, t;
+ }, _setPrototypeOf(t, e);
+ }
+ function _toPrimitive(t, r) {
+ if ("object" != typeof t || !t) return t;
+ var e = t[Symbol.toPrimitive];
+ if (void 0 !== e) {
+ var i = e.call(t, r);
+ if ("object" != typeof i) return i;
+ throw new TypeError("@@toPrimitive must return a primitive value.");
+ }
+ return (String )(t);
+ }
+ function _toPropertyKey(t) {
+ var i = _toPrimitive(t, "string");
+ return "symbol" == typeof i ? i : i + "";
+ }
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
+ }
+ }
+
+ // @ts-ignore
+ try {
+ self['workbox:core:7.4.0'] && _();
+ } catch (e) {}
+
+ /*
+ Copyright 2018 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+ */
+ /**
+ * The Deferred class composes Promises in a way that allows for them to be
+ * resolved or rejected from outside the constructor. In most cases promises
+ * should be used directly, but Deferreds can be necessary when the logic to
+ * resolve a promise must be separate.
+ *
+ * @private
+ */
+ var Deferred =
+ /**
+ * Creates a promise and exposes its resolve and reject functions as methods.
+ */
+ function Deferred() {
+ var _this = this;
+ this.promise = new Promise(function (resolve, reject) {
+ _this.resolve = resolve;
+ _this.reject = reject;
+ });
+ };
+
+ /*
+ Copyright 2019 Google LLC
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+ */
+ /**
+ * A helper function that prevents a promise from being flagged as unused.
+ *
+ * @private
+ **/
+ function dontWaitFor(promise) {
+ // Effective no-op.
+ void promise.then(function () {});
+ }
+
+ /*
+ Copyright 2019 Google LLC
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+ */
+ var logger = function () {
+ // Don't overwrite this value if it's already set.
+ // See https://github.com/GoogleChrome/workbox/pull/2284#issuecomment-560470923
+ if (!('__WB_DISABLE_DEV_LOGS' in globalThis)) {
+ self.__WB_DISABLE_DEV_LOGS = false;
+ }
+ var inGroup = false;
+ var methodToColorMap = {
+ debug: "#7f8c8d",
+ log: "#2ecc71",
+ warn: "#f39c12",
+ error: "#c0392b",
+ groupCollapsed: "#3498db",
+ groupEnd: null // No colored prefix on groupEnd
+ };
+ var print = function print(method, args) {
+ var _console2;
+ if (self.__WB_DISABLE_DEV_LOGS) {
+ return;
+ }
+ if (method === 'groupCollapsed') {
+ // Safari doesn't print all console.groupCollapsed() arguments:
+ // https://bugs.webkit.org/show_bug.cgi?id=182754
+ if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
+ var _console;
+ (_console = console)[method].apply(_console, args);
+ return;
+ }
+ }
+ var styles = ["background: " + methodToColorMap[method], "border-radius: 0.5em", "color: white", "font-weight: bold", "padding: 2px 0.5em"];
+ // When in a group, the workbox prefix is not displayed.
+ var logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];
+ (_console2 = console)[method].apply(_console2, logPrefix.concat(args));
+ if (method === 'groupCollapsed') {
+ inGroup = true;
+ }
+ if (method === 'groupEnd') {
+ inGroup = false;
+ }
+ };
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ var api = {};
+ var loggerMethods = Object.keys(methodToColorMap);
+ var _loop = function _loop() {
+ var key = _loggerMethods[_i];
+ var method = key;
+ api[method] = function () {
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+ print(method, args);
+ };
+ };
+ for (var _i = 0, _loggerMethods = loggerMethods; _i < _loggerMethods.length; _i++) {
+ _loop();
+ }
+ return api;
+ }();
+
+ /*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+ */
+ /**
+ * A minimal `EventTarget` shim.
+ * This is necessary because not all browsers support constructable
+ * `EventTarget`, so using a real `EventTarget` will error.
+ * @private
+ */
+ var WorkboxEventTarget = /*#__PURE__*/function () {
+ function WorkboxEventTarget() {
+ this._eventListenerRegistry = new Map();
+ }
+ /**
+ * @param {string} type
+ * @param {Function} listener
+ * @private
+ */
+ var _proto = WorkboxEventTarget.prototype;
+ _proto.addEventListener = function addEventListener(type, listener) {
+ var foo = this._getEventListenersByType(type);
+ foo.add(listener);
+ }
+ /**
+ * @param {string} type
+ * @param {Function} listener
+ * @private
+ */;
+ _proto.removeEventListener = function removeEventListener(type, listener) {
+ this._getEventListenersByType(type).delete(listener);
+ }
+ /**
+ * @param {Object} event
+ * @private
+ */;
+ _proto.dispatchEvent = function dispatchEvent(event) {
+ event.target = this;
+ var listeners = this._getEventListenersByType(event.type);
+ for (var _iterator = _createForOfIteratorHelperLoose(listeners), _step; !(_step = _iterator()).done;) {
+ var listener = _step.value;
+ listener(event);
+ }
+ }
+ /**
+ * Returns a Set of listeners associated with the passed event type.
+ * If no handlers have been registered, an empty Set is returned.
+ *
+ * @param {string} type The event type.
+ * @return {Set} An array of handler functions.
+ * @private
+ */;
+ _proto._getEventListenersByType = function _getEventListenersByType(type) {
+ if (!this._eventListenerRegistry.has(type)) {
+ this._eventListenerRegistry.set(type, new Set());
+ }
+ return this._eventListenerRegistry.get(type);
+ };
+ return WorkboxEventTarget;
+ }();
+
+ /*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+ */
+ /**
+ * Returns true if two URLs have the same `.href` property. The URLS can be
+ * relative, and if they are the current location href is used to resolve URLs.
+ *
+ * @private
+ * @param {string} url1
+ * @param {string} url2
+ * @return {boolean}
+ */
+ function urlsMatch(url1, url2) {
+ var _location = location,
+ href = _location.href;
+ return new URL(url1, href).href === new URL(url2, href).href;
+ }
+
+ /*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+ */
+ /**
+ * A minimal `Event` subclass shim.
+ * This doesn't *actually* subclass `Event` because not all browsers support
+ * constructable `EventTarget`, and using a real `Event` will error.
+ * @private
+ */
+ var WorkboxEvent = function WorkboxEvent(type, props) {
+ this.type = type;
+ Object.assign(this, props);
+ };
+
+ // The time a SW must be in the waiting phase before we can conclude
+ // `skipWaiting()` wasn't called. This 200 amount wasn't scientifically
+ // chosen, but it seems to avoid false positives in my testing.
+
+ function _await(value, then, direct) {
+ if (!value || !value.then) {
+ value = Promise.resolve(value);
+ }
+ return then ? value.then(then) : value;
+ }
+ var WAITING_TIMEOUT_DURATION = 200;
+ // The amount of time after a registration that we can reasonably conclude
+ // that the registration didn't trigger an update.
+
+ function _async(f) {
+ return function () {
+ for (var args = [], i = 0; i < arguments.length; i++) {
+ args[i] = arguments[i];
+ }
+ try {
+ return Promise.resolve(f.apply(this, args));
+ } catch (e) {
+ return Promise.reject(e);
+ }
+ };
+ }
+ var REGISTRATION_TIMEOUT_DURATION = 60000;
+ // The de facto standard message that a service worker should be listening for
+ // to trigger a call to skipWaiting().
+
+ function _empty() {}
+ var SKIP_WAITING_MESSAGE = {
+ type: 'SKIP_WAITING'
+ };
+ /**
+ * A class to aid in handling service worker registration, updates, and
+ * reacting to service worker lifecycle events.
+ *
+ * @fires {@link workbox-window.Workbox#message}
+ * @fires {@link workbox-window.Workbox#installed}
+ * @fires {@link workbox-window.Workbox#waiting}
+ * @fires {@link workbox-window.Workbox#controlling}
+ * @fires {@link workbox-window.Workbox#activated}
+ * @fires {@link workbox-window.Workbox#redundant}
+ * @memberof workbox-window
+ */
+
+ function _awaitIgnored(value, direct) {
+ {
+ return value && value.then ? value.then(_empty) : Promise.resolve();
+ }
+ }
+ var Workbox = /*#__PURE__*/function (_WorkboxEventTarget) {
+ /**
+ * Creates a new Workbox instance with a script URL and service worker
+ * options. The script URL and options are the same as those used when
+ * calling [navigator.serviceWorker.register(scriptURL, options)](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).
+ *
+ * @param {string|TrustedScriptURL} scriptURL The service worker script
+ * associated with this instance. Using a
+ * [`TrustedScriptURL`](https://web.dev/trusted-types/) is supported.
+ * @param {Object} [registerOptions] The service worker options associated
+ * with this instance.
+ */
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ function Workbox(scriptURL, registerOptions) {
+ var _this;
+ if (registerOptions === void 0) {
+ registerOptions = {};
+ }
+ _this = _WorkboxEventTarget.call(this) || this;
+ _this._registerOptions = {};
+ _this._updateFoundCount = 0;
+ // Deferreds we can resolve later.
+ _this._swDeferred = new Deferred();
+ _this._activeDeferred = new Deferred();
+ _this._controllingDeferred = new Deferred();
+ _this._registrationTime = 0;
+ _this._ownSWs = new Set();
+ /**
+ * @private
+ */
+ _this._onUpdateFound = function () {
+ // `this._registration` will never be `undefined` after an update is found.
+ var registration = _this._registration;
+ var installingSW = registration.installing;
+ // If the script URL passed to `navigator.serviceWorker.register()` is
+ // different from the current controlling SW's script URL, we know any
+ // successful registration calls will trigger an `updatefound` event.
+ // But if the registered script URL is the same as the current controlling
+ // SW's script URL, we'll only get an `updatefound` event if the file
+ // changed since it was last registered. This can be a problem if the user
+ // opens up the same page in a different tab, and that page registers
+ // a SW that triggers an update. It's a problem because this page has no
+ // good way of knowing whether the `updatefound` event came from the SW
+ // script it registered or from a registration attempt made by a newer
+ // version of the page running in another tab.
+ // To minimize the possibility of a false positive, we use the logic here:
+ var updateLikelyTriggeredExternally =
+ // Since we enforce only calling `register()` once, and since we don't
+ // add the `updatefound` event listener until the `register()` call, if
+ // `_updateFoundCount` is > 0 then it means this method has already
+ // been called, thus this SW must be external
+ _this._updateFoundCount > 0 ||
+ // If the script URL of the installing SW is different from this
+ // instance's script URL, we know it's definitely not from our
+ // registration.
+ !urlsMatch(installingSW.scriptURL, _this._scriptURL.toString()) ||
+ // If all of the above are false, then we use a time-based heuristic:
+ // Any `updatefound` event that occurs long after our registration is
+ // assumed to be external.
+ performance.now() > _this._registrationTime + REGISTRATION_TIMEOUT_DURATION ?
+ // If any of the above are not true, we assume the update was
+ // triggered by this instance.
+ true : false;
+ if (updateLikelyTriggeredExternally) {
+ _this._externalSW = installingSW;
+ registration.removeEventListener('updatefound', _this._onUpdateFound);
+ } else {
+ // If the update was not triggered externally we know the installing
+ // SW is the one we registered, so we set it.
+ _this._sw = installingSW;
+ _this._ownSWs.add(installingSW);
+ _this._swDeferred.resolve(installingSW);
+ // The `installing` state isn't something we have a dedicated
+ // callback for, but we do log messages for it in development.
+ {
+ if (navigator.serviceWorker.controller) {
+ logger.log('Updated service worker found. Installing now...');
+ } else {
+ logger.log('Service worker is installing...');
+ }
+ }
+ }
+ // Increment the `updatefound` count, so future invocations of this
+ // method can be sure they were triggered externally.
+ ++_this._updateFoundCount;
+ // Add a `statechange` listener regardless of whether this update was
+ // triggered externally, since we have callbacks for both.
+ installingSW.addEventListener('statechange', _this._onStateChange);
+ };
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ _this._onStateChange = function (originalEvent) {
+ // `this._registration` will never be `undefined` after an update is found.
+ var registration = _this._registration;
+ var sw = originalEvent.target;
+ var state = sw.state;
+ var isExternal = sw === _this._externalSW;
+ var eventProps = {
+ sw: sw,
+ isExternal: isExternal,
+ originalEvent: originalEvent
+ };
+ if (!isExternal && _this._isUpdate) {
+ eventProps.isUpdate = true;
+ }
+ _this.dispatchEvent(new WorkboxEvent(state, eventProps));
+ if (state === 'installed') {
+ // This timeout is used to ignore cases where the service worker calls
+ // `skipWaiting()` in the install event, thus moving it directly in the
+ // activating state. (Since all service workers *must* go through the
+ // waiting phase, the only way to detect `skipWaiting()` called in the
+ // install event is to observe that the time spent in the waiting phase
+ // is very short.)
+ // NOTE: we don't need separate timeouts for the own and external SWs
+ // since they can't go through these phases at the same time.
+ _this._waitingTimeout = self.setTimeout(function () {
+ // Ensure the SW is still waiting (it may now be redundant).
+ if (state === 'installed' && registration.waiting === sw) {
+ _this.dispatchEvent(new WorkboxEvent('waiting', eventProps));
+ {
+ if (isExternal) {
+ logger.warn('An external service worker has installed but is ' + 'waiting for this client to close before activating...');
+ } else {
+ logger.warn('The service worker has installed but is waiting ' + 'for existing clients to close before activating...');
+ }
+ }
+ }
+ }, WAITING_TIMEOUT_DURATION);
+ } else if (state === 'activating') {
+ clearTimeout(_this._waitingTimeout);
+ if (!isExternal) {
+ _this._activeDeferred.resolve(sw);
+ }
+ }
+ {
+ switch (state) {
+ case 'installed':
+ if (isExternal) {
+ logger.warn('An external service worker has installed. ' + 'You may want to suggest users reload this page.');
+ } else {
+ logger.log('Registered service worker installed.');
+ }
+ break;
+ case 'activated':
+ if (isExternal) {
+ logger.warn('An external service worker has activated.');
+ } else {
+ logger.log('Registered service worker activated.');
+ if (sw !== navigator.serviceWorker.controller) {
+ logger.warn('The registered service worker is active but ' + 'not yet controlling the page. Reload or run ' + '`clients.claim()` in the service worker.');
+ }
+ }
+ break;
+ case 'redundant':
+ if (sw === _this._compatibleControllingSW) {
+ logger.log('Previously controlling service worker now redundant!');
+ } else if (!isExternal) {
+ logger.log('Registered service worker now redundant!');
+ }
+ break;
+ }
+ }
+ };
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ _this._onControllerChange = function (originalEvent) {
+ var sw = _this._sw;
+ var isExternal = sw !== navigator.serviceWorker.controller;
+ // Unconditionally dispatch the controlling event, with isExternal set
+ // to distinguish between controller changes due to the initial registration
+ // vs. an update-check or other tab's registration.
+ // See https://github.com/GoogleChrome/workbox/issues/2786
+ _this.dispatchEvent(new WorkboxEvent('controlling', {
+ isExternal: isExternal,
+ originalEvent: originalEvent,
+ sw: sw,
+ isUpdate: _this._isUpdate
+ }));
+ if (!isExternal) {
+ {
+ logger.log('Registered service worker now controlling this page.');
+ }
+ _this._controllingDeferred.resolve(sw);
+ }
+ };
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ _this._onMessage = _async(function (originalEvent) {
+ // Can't change type 'any' of data.
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ var data = originalEvent.data,
+ ports = originalEvent.ports,
+ source = originalEvent.source;
+ // Wait until there's an "own" service worker. This is used to buffer
+ // `message` events that may be received prior to calling `register()`.
+ return _await(_this.getSW(), function () {
+ if (_this._ownSWs.has(source)) {
+ _this.dispatchEvent(new WorkboxEvent('message', {
+ // Can't change type 'any' of data.
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ data: data,
+ originalEvent: originalEvent,
+ ports: ports,
+ sw: source
+ }));
+ }
+ }); // If the service worker that sent the message is in the list of own
+ // service workers for this instance, dispatch a `message` event.
+ // NOTE: we check for all previously owned service workers rather than
+ // just the current one because some messages (e.g. cache updates) use
+ // a timeout when sent and may be delayed long enough for a service worker
+ // update to be found.
+ });
+ _this._scriptURL = scriptURL;
+ _this._registerOptions = registerOptions;
+ // Add a message listener immediately since messages received during
+ // page load are buffered only until the DOMContentLoaded event:
+ // https://github.com/GoogleChrome/workbox/issues/2202
+ navigator.serviceWorker.addEventListener('message', _this._onMessage);
+ return _this;
+ }
+ /**
+ * Registers a service worker for this instances script URL and service
+ * worker options. By default this method delays registration until after
+ * the window has loaded.
+ *
+ * @param {Object} [options]
+ * @param {Function} [options.immediate=false] Setting this to true will
+ * register the service worker immediately, even if the window has
+ * not loaded (not recommended).
+ */
+ _inheritsLoose(Workbox, _WorkboxEventTarget);
+ var _proto = Workbox.prototype;
+ _proto.register = function register(_temp) {
+ var _ref = _temp === void 0 ? {} : _temp,
+ _ref$immediate = _ref.immediate,
+ immediate = _ref$immediate === void 0 ? false : _ref$immediate;
+ try {
+ var _this2 = this;
+ if ("dev" !== 'production') {
+ if (_this2._registrationTime) {
+ logger.error('Cannot re-register a Workbox instance after it has ' + 'been registered. Create a new instance instead.');
+ return _await();
+ }
+ }
+ return _await(_invoke(function () {
+ if (!immediate && document.readyState !== 'complete') {
+ return _awaitIgnored(new Promise(function (res) {
+ return window.addEventListener('load', res);
+ }));
+ }
+ }, function () {
+ // Set this flag to true if any service worker was controlling the page
+ // at registration time.
+ _this2._isUpdate = Boolean(navigator.serviceWorker.controller);
+ // Before registering, attempt to determine if a SW is already controlling
+ // the page, and if that SW script (and version, if specified) matches this
+ // instance's script.
+ _this2._compatibleControllingSW = _this2._getControllingSWIfCompatible();
+ return _await(_this2._registerScript(), function (_this2$_registerScrip) {
+ _this2._registration = _this2$_registerScrip;
+ // If we have a compatible controller, store the controller as the "own"
+ // SW, resolve active/controlling deferreds and add necessary listeners.
+ if (_this2._compatibleControllingSW) {
+ _this2._sw = _this2._compatibleControllingSW;
+ _this2._activeDeferred.resolve(_this2._compatibleControllingSW);
+ _this2._controllingDeferred.resolve(_this2._compatibleControllingSW);
+ _this2._compatibleControllingSW.addEventListener('statechange', _this2._onStateChange, {
+ once: true
+ });
+ }
+ // If there's a waiting service worker with a matching URL before the
+ // `updatefound` event fires, it likely means that this site is open
+ // in another tab, or the user refreshed the page (and thus the previous
+ // page wasn't fully unloaded before this page started loading).
+ // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting
+ var waitingSW = _this2._registration.waiting;
+ if (waitingSW && urlsMatch(waitingSW.scriptURL, _this2._scriptURL.toString())) {
+ // Store the waiting SW as the "own" Sw, even if it means overwriting
+ // a compatible controller.
+ _this2._sw = waitingSW;
+ // Run this in the next microtask, so any code that adds an event
+ // listener after awaiting `register()` will get this event.
+ dontWaitFor(Promise.resolve().then(function () {
+ _this2.dispatchEvent(new WorkboxEvent('waiting', {
+ sw: waitingSW,
+ wasWaitingBeforeRegister: true
+ }));
+ if ("dev" !== 'production') {
+ logger.warn('A service worker was already waiting to activate ' + 'before this script was registered...');
+ }
+ }));
+ }
+ // If an "own" SW is already set, resolve the deferred.
+ if (_this2._sw) {
+ _this2._swDeferred.resolve(_this2._sw);
+ _this2._ownSWs.add(_this2._sw);
+ }
+ if ("dev" !== 'production') {
+ logger.log('Successfully registered service worker.', _this2._scriptURL.toString());
+ if (navigator.serviceWorker.controller) {
+ if (_this2._compatibleControllingSW) {
+ logger.debug('A service worker with the same script URL ' + 'is already controlling this page.');
+ } else {
+ logger.debug('A service worker with a different script URL is ' + 'currently controlling the page. The browser is now fetching ' + 'the new script now...');
+ }
+ }
+ var currentPageIsOutOfScope = function currentPageIsOutOfScope() {
+ var scopeURL = new URL(_this2._registerOptions.scope || _this2._scriptURL.toString(), document.baseURI);
+ var scopeURLBasePath = new URL('./', scopeURL.href).pathname;
+ return !location.pathname.startsWith(scopeURLBasePath);
+ };
+ if (currentPageIsOutOfScope()) {
+ logger.warn('The current page is not in scope for the registered ' + 'service worker. Was this a mistake?');
+ }
+ }
+ _this2._registration.addEventListener('updatefound', _this2._onUpdateFound);
+ navigator.serviceWorker.addEventListener('controllerchange', _this2._onControllerChange);
+ return _this2._registration;
+ });
+ }));
+ } catch (e) {
+ return Promise.reject(e);
+ }
+ }
+ /**
+ * Checks for updates of the registered service worker.
+ */
+ ;
+ _proto.update = function update() {
+ try {
+ var _this3 = this;
+ if (!_this3._registration) {
+ if ("dev" !== 'production') {
+ logger.error('Cannot update a Workbox instance without ' + 'being registered. Register the Workbox instance first.');
+ }
+ return _await();
+ }
+ // Try to update registration
+ return _await(_awaitIgnored(_this3._registration.update()));
+ } catch (e) {
+ return Promise.reject(e);
+ }
+ }
+ /**
+ * Resolves to the service worker registered by this instance as soon as it
+ * is active. If a service worker was already controlling at registration
+ * time then it will resolve to that if the script URLs (and optionally
+ * script versions) match, otherwise it will wait until an update is found
+ * and activates.
+ *
+ * @return {Promise}
+ */
+ ;
+ /**
+ * Resolves with a reference to a service worker that matches the script URL
+ * of this instance, as soon as it's available.
+ *
+ * If, at registration time, there's already an active or waiting service
+ * worker with a matching script URL, it will be used (with the waiting
+ * service worker taking precedence over the active service worker if both
+ * match, since the waiting service worker would have been registered more
+ * recently).
+ * If there's no matching active or waiting service worker at registration
+ * time then the promise will not resolve until an update is found and starts
+ * installing, at which point the installing service worker is used.
+ *
+ * @return {Promise}
+ */
+ _proto.getSW = function getSW() {
+ // If `this._sw` is set, resolve with that as we want `getSW()` to
+ // return the correct (new) service worker if an update is found.
+ return this._sw !== undefined ? Promise.resolve(this._sw) : this._swDeferred.promise;
+ }
+ /**
+ * Sends the passed data object to the service worker registered by this
+ * instance (via {@link workbox-window.Workbox#getSW}) and resolves
+ * with a response (if any).
+ *
+ * A response can be set in a message handler in the service worker by
+ * calling `event.ports[0].postMessage(...)`, which will resolve the promise
+ * returned by `messageSW()`. If no response is set, the promise will never
+ * resolve.
+ *
+ * @param {Object} data An object to send to the service worker
+ * @return {Promise}
+ */
+ // We might be able to change the 'data' type to Record in the future.
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ ;
+ _proto.messageSW = function messageSW$1(data) {
+ try {
+ var _this4 = this;
+ return _await(_this4.getSW(), function (sw) {
+ return messageSW(sw, data);
+ });
+ } catch (e) {
+ return Promise.reject(e);
+ }
+ }
+ /**
+ * Sends a `{type: 'SKIP_WAITING'}` message to the service worker that's
+ * currently in the `waiting` state associated with the current registration.
+ *
+ * If there is no current registration or no service worker is `waiting`,
+ * calling this will have no effect.
+ */
+ ;
+ _proto.messageSkipWaiting = function messageSkipWaiting() {
+ if (this._registration && this._registration.waiting) {
+ void messageSW(this._registration.waiting, SKIP_WAITING_MESSAGE);
+ }
+ }
+ /**
+ * Checks for a service worker already controlling the page and returns
+ * it if its script URL matches.
+ *
+ * @private
+ * @return {ServiceWorker|undefined}
+ */;
+ _proto._getControllingSWIfCompatible = function _getControllingSWIfCompatible() {
+ var controller = navigator.serviceWorker.controller;
+ if (controller && urlsMatch(controller.scriptURL, this._scriptURL.toString())) {
+ return controller;
+ } else {
+ return undefined;
+ }
+ }
+ /**
+ * Registers a service worker for this instances script URL and register
+ * options and tracks the time registration was complete.
+ *
+ * @private
+ */;
+ _proto._registerScript = function _registerScript() {
+ try {
+ var _this5 = this;
+ return _await(_catch(function () {
+ // this._scriptURL may be a TrustedScriptURL, but there's no support for
+ // passing that to register() in lib.dom right now.
+ // https://github.com/GoogleChrome/workbox/issues/2855
+ return _await(navigator.serviceWorker.register(_this5._scriptURL, _this5._registerOptions), function (reg) {
+ // Keep track of when registration happened, so it can be used in the
+ // `this._onUpdateFound` heuristic. Also use the presence of this
+ // property as a way to see if `.register()` has been called.
+ _this5._registrationTime = performance.now();
+ return reg;
+ });
+ }, function (error) {
+ if ("dev" !== 'production') {
+ logger.error(error);
+ }
+ // Re-throw the error.
+ throw error;
+ }));
+ } catch (e) {
+ return Promise.reject(e);
+ }
+ };
+ return _createClass(Workbox, [{
+ key: "active",
+ get: function get() {
+ return this._activeDeferred.promise;
+ }
+ /**
+ * Resolves to the service worker registered by this instance as soon as it
+ * is controlling the page. If a service worker was already controlling at
+ * registration time then it will resolve to that if the script URLs (and
+ * optionally script versions) match, otherwise it will wait until an update
+ * is found and starts controlling the page.
+ * Note: the first time a service worker is installed it will active but
+ * not start controlling the page unless `clients.claim()` is called in the
+ * service worker.
+ *
+ * @return {Promise}
+ */
+ }, {
+ key: "controlling",
+ get: function get() {
+ return this._controllingDeferred.promise;
+ }
+ }]);
+ }(WorkboxEventTarget);
+ function _invoke(body, then) {
+ var result = body();
+ if (result && result.then) {
+ return result.then(then);
+ }
+ return then(result);
+ } // The jsdoc comments below outline the events this instance may dispatch:
+ // -----------------------------------------------------------------------
+ /**
+ * The `message` event is dispatched any time a `postMessage` is received.
+ *
+ * @event workbox-window.Workbox#message
+ * @type {WorkboxEvent}
+ * @property {*} data The `data` property from the original `message` event.
+ * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}
+ * event.
+ * @property {string} type `message`.
+ * @property {MessagePort[]} ports The `ports` value from `originalEvent`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+ /**
+ * The `installed` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}
+ * changes to `installed`.
+ *
+ * Then can happen either the very first time a service worker is installed,
+ * or after an update to the current service worker is found. In the case
+ * of an update being found, the event's `isUpdate` property will be `true`.
+ *
+ * @event workbox-window.Workbox#installed
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `installed`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+ /**
+ * The `waiting` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}
+ * changes to `installed` and then doesn't immediately change to `activating`.
+ * It may also be dispatched if a service worker with the same
+ * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}
+ * was already waiting when the {@link workbox-window.Workbox#register}
+ * method was called.
+ *
+ * @event workbox-window.Workbox#waiting
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event|undefined} originalEvent The original
+ * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event, or `undefined` in the case where the service worker was waiting
+ * to before `.register()` was called.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with
+ * a matching `scriptURL` was already waiting when this `Workbox`
+ * instance called `register()`.
+ * @property {string} type `waiting`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+ /**
+ * The `controlling` event is dispatched if a
+ * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}
+ * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}
+ * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}
+ * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}
+ * matches the `scriptURL` of the `Workbox` instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.
+ *
+ * @event workbox-window.Workbox#controlling
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this service worker was registered.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `controlling`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+ /**
+ * The `activated` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}
+ * changes to `activated`.
+ *
+ * @event workbox-window.Workbox#activated
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `activated`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+ /**
+ * The `redundant` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}
+ * changes to `redundant`.
+ *
+ * @event workbox-window.Workbox#redundant
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {string} type `redundant`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+ function _catch(body, recover) {
+ try {
+ var result = body();
+ } catch (e) {
+ return recover(e);
+ }
+ if (result && result.then) {
+ return result.then(void 0, recover);
+ }
+ return result;
+ }
+
+ exports.Workbox = Workbox;
+ exports.WorkboxEvent = WorkboxEvent;
+ exports.messageSW = messageSW;
+
+}));
+//# sourceMappingURL=workbox-window.dev.umd.js.map
diff --git a/tools/ui/node_modules/workbox-window/build/workbox-window.dev.umd.js.map b/tools/ui/node_modules/workbox-window/build/workbox-window.dev.umd.js.map
new file mode 100644
index 0000000000000000000000000000000000000000..255532956c38ece080b149b75b4026628d8e1034
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/build/workbox-window.dev.umd.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"workbox-window.dev.umd.js","sources":["../_version.js","../messageSW.js","../../workbox-core/_version.js","../../workbox-core/_private/Deferred.js","../../workbox-core/_private/dontWaitFor.js","../../workbox-core/_private/logger.js","../utils/WorkboxEventTarget.js","../utils/urlsMatch.js","../utils/WorkboxEvent.js","../Workbox.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:window:7.4.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport './_version.js';\n/**\n * Sends a data object to a service worker via `postMessage` and resolves with\n * a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will not\n * resolve.\n *\n * @param {ServiceWorker} sw The service worker to send the message to.\n * @param {Object} data An object to send to the service worker.\n * @return {Promise}\n * @memberof workbox-window\n */\n// Better not change type of data.\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction messageSW(sw, data) {\n return new Promise((resolve) => {\n const messageChannel = new MessageChannel();\n messageChannel.port1.onmessage = (event) => {\n resolve(event.data);\n };\n sw.postMessage(data, [messageChannel.port2]);\n });\n}\nexport { messageSW };\n","\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:core:7.4.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * The Deferred class composes Promises in a way that allows for them to be\n * resolved or rejected from outside the constructor. In most cases promises\n * should be used directly, but Deferreds can be necessary when the logic to\n * resolve a promise must be separate.\n *\n * @private\n */\nclass Deferred {\n /**\n * Creates a promise and exposes its resolve and reject functions as methods.\n */\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n}\nexport { Deferred };\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A helper function that prevents a promise from being flagged as unused.\n *\n * @private\n **/\nexport function dontWaitFor(promise) {\n // Effective no-op.\n void promise.then(() => { });\n}\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nconst logger = (process.env.NODE_ENV === 'production'\n ? null\n : (() => {\n // Don't overwrite this value if it's already set.\n // See https://github.com/GoogleChrome/workbox/pull/2284#issuecomment-560470923\n if (!('__WB_DISABLE_DEV_LOGS' in globalThis)) {\n self.__WB_DISABLE_DEV_LOGS = false;\n }\n let inGroup = false;\n const methodToColorMap = {\n debug: `#7f8c8d`,\n log: `#2ecc71`,\n warn: `#f39c12`,\n error: `#c0392b`,\n groupCollapsed: `#3498db`,\n groupEnd: null, // No colored prefix on groupEnd\n };\n const print = function (method, args) {\n if (self.__WB_DISABLE_DEV_LOGS) {\n return;\n }\n if (method === 'groupCollapsed') {\n // Safari doesn't print all console.groupCollapsed() arguments:\n // https://bugs.webkit.org/show_bug.cgi?id=182754\n if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {\n console[method](...args);\n return;\n }\n }\n const styles = [\n `background: ${methodToColorMap[method]}`,\n `border-radius: 0.5em`,\n `color: white`,\n `font-weight: bold`,\n `padding: 2px 0.5em`,\n ];\n // When in a group, the workbox prefix is not displayed.\n const logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];\n console[method](...logPrefix, ...args);\n if (method === 'groupCollapsed') {\n inGroup = true;\n }\n if (method === 'groupEnd') {\n inGroup = false;\n }\n };\n // eslint-disable-next-line @typescript-eslint/ban-types\n const api = {};\n const loggerMethods = Object.keys(methodToColorMap);\n for (const key of loggerMethods) {\n const method = key;\n api[method] = (...args) => {\n print(method, args);\n };\n }\n return api;\n })());\nexport { logger };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n/**\n * A minimal `EventTarget` shim.\n * This is necessary because not all browsers support constructable\n * `EventTarget`, so using a real `EventTarget` will error.\n * @private\n */\nexport class WorkboxEventTarget {\n constructor() {\n this._eventListenerRegistry = new Map();\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n addEventListener(type, listener) {\n const foo = this._getEventListenersByType(type);\n foo.add(listener);\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n removeEventListener(type, listener) {\n this._getEventListenersByType(type).delete(listener);\n }\n /**\n * @param {Object} event\n * @private\n */\n dispatchEvent(event) {\n event.target = this;\n const listeners = this._getEventListenersByType(event.type);\n for (const listener of listeners) {\n listener(event);\n }\n }\n /**\n * Returns a Set of listeners associated with the passed event type.\n * If no handlers have been registered, an empty Set is returned.\n *\n * @param {string} type The event type.\n * @return {Set} An array of handler functions.\n * @private\n */\n _getEventListenersByType(type) {\n if (!this._eventListenerRegistry.has(type)) {\n this._eventListenerRegistry.set(type, new Set());\n }\n return this._eventListenerRegistry.get(type);\n }\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * Returns true if two URLs have the same `.href` property. The URLS can be\n * relative, and if they are the current location href is used to resolve URLs.\n *\n * @private\n * @param {string} url1\n * @param {string} url2\n * @return {boolean}\n */\nexport function urlsMatch(url1, url2) {\n const { href } = location;\n return new URL(url1, href).href === new URL(url2, href).href;\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A minimal `Event` subclass shim.\n * This doesn't *actually* subclass `Event` because not all browsers support\n * constructable `EventTarget`, and using a real `Event` will error.\n * @private\n */\nexport class WorkboxEvent {\n constructor(type, props) {\n this.type = type;\n Object.assign(this, props);\n }\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { Deferred } from 'workbox-core/_private/Deferred.js';\nimport { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { messageSW } from './messageSW.js';\nimport { WorkboxEventTarget } from './utils/WorkboxEventTarget.js';\nimport { urlsMatch } from './utils/urlsMatch.js';\nimport { WorkboxEvent } from './utils/WorkboxEvent.js';\nimport './_version.js';\n// The time a SW must be in the waiting phase before we can conclude\n// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically\n// chosen, but it seems to avoid false positives in my testing.\nconst WAITING_TIMEOUT_DURATION = 200;\n// The amount of time after a registration that we can reasonably conclude\n// that the registration didn't trigger an update.\nconst REGISTRATION_TIMEOUT_DURATION = 60000;\n// The de facto standard message that a service worker should be listening for\n// to trigger a call to skipWaiting().\nconst SKIP_WAITING_MESSAGE = { type: 'SKIP_WAITING' };\n/**\n * A class to aid in handling service worker registration, updates, and\n * reacting to service worker lifecycle events.\n *\n * @fires {@link workbox-window.Workbox#message}\n * @fires {@link workbox-window.Workbox#installed}\n * @fires {@link workbox-window.Workbox#waiting}\n * @fires {@link workbox-window.Workbox#controlling}\n * @fires {@link workbox-window.Workbox#activated}\n * @fires {@link workbox-window.Workbox#redundant}\n * @memberof workbox-window\n */\nclass Workbox extends WorkboxEventTarget {\n /**\n * Creates a new Workbox instance with a script URL and service worker\n * options. The script URL and options are the same as those used when\n * calling [navigator.serviceWorker.register(scriptURL, options)](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).\n *\n * @param {string|TrustedScriptURL} scriptURL The service worker script\n * associated with this instance. Using a\n * [`TrustedScriptURL`](https://web.dev/trusted-types/) is supported.\n * @param {Object} [registerOptions] The service worker options associated\n * with this instance.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n constructor(scriptURL, registerOptions = {}) {\n super();\n this._registerOptions = {};\n this._updateFoundCount = 0;\n // Deferreds we can resolve later.\n this._swDeferred = new Deferred();\n this._activeDeferred = new Deferred();\n this._controllingDeferred = new Deferred();\n this._registrationTime = 0;\n this._ownSWs = new Set();\n /**\n * @private\n */\n this._onUpdateFound = () => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const installingSW = registration.installing;\n // If the script URL passed to `navigator.serviceWorker.register()` is\n // different from the current controlling SW's script URL, we know any\n // successful registration calls will trigger an `updatefound` event.\n // But if the registered script URL is the same as the current controlling\n // SW's script URL, we'll only get an `updatefound` event if the file\n // changed since it was last registered. This can be a problem if the user\n // opens up the same page in a different tab, and that page registers\n // a SW that triggers an update. It's a problem because this page has no\n // good way of knowing whether the `updatefound` event came from the SW\n // script it registered or from a registration attempt made by a newer\n // version of the page running in another tab.\n // To minimize the possibility of a false positive, we use the logic here:\n const updateLikelyTriggeredExternally = \n // Since we enforce only calling `register()` once, and since we don't\n // add the `updatefound` event listener until the `register()` call, if\n // `_updateFoundCount` is > 0 then it means this method has already\n // been called, thus this SW must be external\n this._updateFoundCount > 0 ||\n // If the script URL of the installing SW is different from this\n // instance's script URL, we know it's definitely not from our\n // registration.\n !urlsMatch(installingSW.scriptURL, this._scriptURL.toString()) ||\n // If all of the above are false, then we use a time-based heuristic:\n // Any `updatefound` event that occurs long after our registration is\n // assumed to be external.\n performance.now() > this._registrationTime + REGISTRATION_TIMEOUT_DURATION\n ? // If any of the above are not true, we assume the update was\n // triggered by this instance.\n true\n : false;\n if (updateLikelyTriggeredExternally) {\n this._externalSW = installingSW;\n registration.removeEventListener('updatefound', this._onUpdateFound);\n }\n else {\n // If the update was not triggered externally we know the installing\n // SW is the one we registered, so we set it.\n this._sw = installingSW;\n this._ownSWs.add(installingSW);\n this._swDeferred.resolve(installingSW);\n // The `installing` state isn't something we have a dedicated\n // callback for, but we do log messages for it in development.\n if (process.env.NODE_ENV !== 'production') {\n if (navigator.serviceWorker.controller) {\n logger.log('Updated service worker found. Installing now...');\n }\n else {\n logger.log('Service worker is installing...');\n }\n }\n }\n // Increment the `updatefound` count, so future invocations of this\n // method can be sure they were triggered externally.\n ++this._updateFoundCount;\n // Add a `statechange` listener regardless of whether this update was\n // triggered externally, since we have callbacks for both.\n installingSW.addEventListener('statechange', this._onStateChange);\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onStateChange = (originalEvent) => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const sw = originalEvent.target;\n const { state } = sw;\n const isExternal = sw === this._externalSW;\n const eventProps = {\n sw,\n isExternal,\n originalEvent,\n };\n if (!isExternal && this._isUpdate) {\n eventProps.isUpdate = true;\n }\n this.dispatchEvent(new WorkboxEvent(state, eventProps));\n if (state === 'installed') {\n // This timeout is used to ignore cases where the service worker calls\n // `skipWaiting()` in the install event, thus moving it directly in the\n // activating state. (Since all service workers *must* go through the\n // waiting phase, the only way to detect `skipWaiting()` called in the\n // install event is to observe that the time spent in the waiting phase\n // is very short.)\n // NOTE: we don't need separate timeouts for the own and external SWs\n // since they can't go through these phases at the same time.\n this._waitingTimeout = self.setTimeout(() => {\n // Ensure the SW is still waiting (it may now be redundant).\n if (state === 'installed' && registration.waiting === sw) {\n this.dispatchEvent(new WorkboxEvent('waiting', eventProps));\n if (process.env.NODE_ENV !== 'production') {\n if (isExternal) {\n logger.warn('An external service worker has installed but is ' +\n 'waiting for this client to close before activating...');\n }\n else {\n logger.warn('The service worker has installed but is waiting ' +\n 'for existing clients to close before activating...');\n }\n }\n }\n }, WAITING_TIMEOUT_DURATION);\n }\n else if (state === 'activating') {\n clearTimeout(this._waitingTimeout);\n if (!isExternal) {\n this._activeDeferred.resolve(sw);\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n switch (state) {\n case 'installed':\n if (isExternal) {\n logger.warn('An external service worker has installed. ' +\n 'You may want to suggest users reload this page.');\n }\n else {\n logger.log('Registered service worker installed.');\n }\n break;\n case 'activated':\n if (isExternal) {\n logger.warn('An external service worker has activated.');\n }\n else {\n logger.log('Registered service worker activated.');\n if (sw !== navigator.serviceWorker.controller) {\n logger.warn('The registered service worker is active but ' +\n 'not yet controlling the page. Reload or run ' +\n '`clients.claim()` in the service worker.');\n }\n }\n break;\n case 'redundant':\n if (sw === this._compatibleControllingSW) {\n logger.log('Previously controlling service worker now redundant!');\n }\n else if (!isExternal) {\n logger.log('Registered service worker now redundant!');\n }\n break;\n }\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onControllerChange = (originalEvent) => {\n const sw = this._sw;\n const isExternal = sw !== navigator.serviceWorker.controller;\n // Unconditionally dispatch the controlling event, with isExternal set\n // to distinguish between controller changes due to the initial registration\n // vs. an update-check or other tab's registration.\n // See https://github.com/GoogleChrome/workbox/issues/2786\n this.dispatchEvent(new WorkboxEvent('controlling', {\n isExternal,\n originalEvent,\n sw,\n isUpdate: this._isUpdate,\n }));\n if (!isExternal) {\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Registered service worker now controlling this page.');\n }\n this._controllingDeferred.resolve(sw);\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onMessage = async (originalEvent) => {\n // Can't change type 'any' of data.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const { data, ports, source } = originalEvent;\n // Wait until there's an \"own\" service worker. This is used to buffer\n // `message` events that may be received prior to calling `register()`.\n await this.getSW();\n // If the service worker that sent the message is in the list of own\n // service workers for this instance, dispatch a `message` event.\n // NOTE: we check for all previously owned service workers rather than\n // just the current one because some messages (e.g. cache updates) use\n // a timeout when sent and may be delayed long enough for a service worker\n // update to be found.\n if (this._ownSWs.has(source)) {\n this.dispatchEvent(new WorkboxEvent('message', {\n // Can't change type 'any' of data.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n data,\n originalEvent,\n ports,\n sw: source,\n }));\n }\n };\n this._scriptURL = scriptURL;\n this._registerOptions = registerOptions;\n // Add a message listener immediately since messages received during\n // page load are buffered only until the DOMContentLoaded event:\n // https://github.com/GoogleChrome/workbox/issues/2202\n navigator.serviceWorker.addEventListener('message', this._onMessage);\n }\n /**\n * Registers a service worker for this instances script URL and service\n * worker options. By default this method delays registration until after\n * the window has loaded.\n *\n * @param {Object} [options]\n * @param {Function} [options.immediate=false] Setting this to true will\n * register the service worker immediately, even if the window has\n * not loaded (not recommended).\n */\n async register({ immediate = false } = {}) {\n if (process.env.NODE_ENV !== 'production') {\n if (this._registrationTime) {\n logger.error('Cannot re-register a Workbox instance after it has ' +\n 'been registered. Create a new instance instead.');\n return;\n }\n }\n if (!immediate && document.readyState !== 'complete') {\n await new Promise((res) => window.addEventListener('load', res));\n }\n // Set this flag to true if any service worker was controlling the page\n // at registration time.\n this._isUpdate = Boolean(navigator.serviceWorker.controller);\n // Before registering, attempt to determine if a SW is already controlling\n // the page, and if that SW script (and version, if specified) matches this\n // instance's script.\n this._compatibleControllingSW = this._getControllingSWIfCompatible();\n this._registration = await this._registerScript();\n // If we have a compatible controller, store the controller as the \"own\"\n // SW, resolve active/controlling deferreds and add necessary listeners.\n if (this._compatibleControllingSW) {\n this._sw = this._compatibleControllingSW;\n this._activeDeferred.resolve(this._compatibleControllingSW);\n this._controllingDeferred.resolve(this._compatibleControllingSW);\n this._compatibleControllingSW.addEventListener('statechange', this._onStateChange, { once: true });\n }\n // If there's a waiting service worker with a matching URL before the\n // `updatefound` event fires, it likely means that this site is open\n // in another tab, or the user refreshed the page (and thus the previous\n // page wasn't fully unloaded before this page started loading).\n // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting\n const waitingSW = this._registration.waiting;\n if (waitingSW &&\n urlsMatch(waitingSW.scriptURL, this._scriptURL.toString())) {\n // Store the waiting SW as the \"own\" Sw, even if it means overwriting\n // a compatible controller.\n this._sw = waitingSW;\n // Run this in the next microtask, so any code that adds an event\n // listener after awaiting `register()` will get this event.\n dontWaitFor(Promise.resolve().then(() => {\n this.dispatchEvent(new WorkboxEvent('waiting', {\n sw: waitingSW,\n wasWaitingBeforeRegister: true,\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.warn('A service worker was already waiting to activate ' +\n 'before this script was registered...');\n }\n }));\n }\n // If an \"own\" SW is already set, resolve the deferred.\n if (this._sw) {\n this._swDeferred.resolve(this._sw);\n this._ownSWs.add(this._sw);\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Successfully registered service worker.', this._scriptURL.toString());\n if (navigator.serviceWorker.controller) {\n if (this._compatibleControllingSW) {\n logger.debug('A service worker with the same script URL ' +\n 'is already controlling this page.');\n }\n else {\n logger.debug('A service worker with a different script URL is ' +\n 'currently controlling the page. The browser is now fetching ' +\n 'the new script now...');\n }\n }\n const currentPageIsOutOfScope = () => {\n const scopeURL = new URL(this._registerOptions.scope || this._scriptURL.toString(), document.baseURI);\n const scopeURLBasePath = new URL('./', scopeURL.href).pathname;\n return !location.pathname.startsWith(scopeURLBasePath);\n };\n if (currentPageIsOutOfScope()) {\n logger.warn('The current page is not in scope for the registered ' +\n 'service worker. Was this a mistake?');\n }\n }\n this._registration.addEventListener('updatefound', this._onUpdateFound);\n navigator.serviceWorker.addEventListener('controllerchange', this._onControllerChange);\n return this._registration;\n }\n /**\n * Checks for updates of the registered service worker.\n */\n async update() {\n if (!this._registration) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error('Cannot update a Workbox instance without ' +\n 'being registered. Register the Workbox instance first.');\n }\n return;\n }\n // Try to update registration\n await this._registration.update();\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is active. If a service worker was already controlling at registration\n * time then it will resolve to that if the script URLs (and optionally\n * script versions) match, otherwise it will wait until an update is found\n * and activates.\n *\n * @return {Promise}\n */\n get active() {\n return this._activeDeferred.promise;\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is controlling the page. If a service worker was already controlling at\n * registration time then it will resolve to that if the script URLs (and\n * optionally script versions) match, otherwise it will wait until an update\n * is found and starts controlling the page.\n * Note: the first time a service worker is installed it will active but\n * not start controlling the page unless `clients.claim()` is called in the\n * service worker.\n *\n * @return {Promise}\n */\n get controlling() {\n return this._controllingDeferred.promise;\n }\n /**\n * Resolves with a reference to a service worker that matches the script URL\n * of this instance, as soon as it's available.\n *\n * If, at registration time, there's already an active or waiting service\n * worker with a matching script URL, it will be used (with the waiting\n * service worker taking precedence over the active service worker if both\n * match, since the waiting service worker would have been registered more\n * recently).\n * If there's no matching active or waiting service worker at registration\n * time then the promise will not resolve until an update is found and starts\n * installing, at which point the installing service worker is used.\n *\n * @return {Promise}\n */\n getSW() {\n // If `this._sw` is set, resolve with that as we want `getSW()` to\n // return the correct (new) service worker if an update is found.\n return this._sw !== undefined\n ? Promise.resolve(this._sw)\n : this._swDeferred.promise;\n }\n /**\n * Sends the passed data object to the service worker registered by this\n * instance (via {@link workbox-window.Workbox#getSW}) and resolves\n * with a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will never\n * resolve.\n *\n * @param {Object} data An object to send to the service worker\n * @return {Promise}\n */\n // We might be able to change the 'data' type to Record in the future.\n // eslint-disable-next-line @typescript-eslint/ban-types\n async messageSW(data) {\n const sw = await this.getSW();\n return messageSW(sw, data);\n }\n /**\n * Sends a `{type: 'SKIP_WAITING'}` message to the service worker that's\n * currently in the `waiting` state associated with the current registration.\n *\n * If there is no current registration or no service worker is `waiting`,\n * calling this will have no effect.\n */\n messageSkipWaiting() {\n if (this._registration && this._registration.waiting) {\n void messageSW(this._registration.waiting, SKIP_WAITING_MESSAGE);\n }\n }\n /**\n * Checks for a service worker already controlling the page and returns\n * it if its script URL matches.\n *\n * @private\n * @return {ServiceWorker|undefined}\n */\n _getControllingSWIfCompatible() {\n const controller = navigator.serviceWorker.controller;\n if (controller &&\n urlsMatch(controller.scriptURL, this._scriptURL.toString())) {\n return controller;\n }\n else {\n return undefined;\n }\n }\n /**\n * Registers a service worker for this instances script URL and register\n * options and tracks the time registration was complete.\n *\n * @private\n */\n async _registerScript() {\n try {\n // this._scriptURL may be a TrustedScriptURL, but there's no support for\n // passing that to register() in lib.dom right now.\n // https://github.com/GoogleChrome/workbox/issues/2855\n const reg = await navigator.serviceWorker.register(this._scriptURL, this._registerOptions);\n // Keep track of when registration happened, so it can be used in the\n // `this._onUpdateFound` heuristic. Also use the presence of this\n // property as a way to see if `.register()` has been called.\n this._registrationTime = performance.now();\n return reg;\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(error);\n }\n // Re-throw the error.\n throw error;\n }\n }\n}\nexport { Workbox };\n// The jsdoc comments below outline the events this instance may dispatch:\n// -----------------------------------------------------------------------\n/**\n * The `message` event is dispatched any time a `postMessage` is received.\n *\n * @event workbox-window.Workbox#message\n * @type {WorkboxEvent}\n * @property {*} data The `data` property from the original `message` event.\n * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}\n * event.\n * @property {string} type `message`.\n * @property {MessagePort[]} ports The `ports` value from `originalEvent`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `installed` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}\n * changes to `installed`.\n *\n * Then can happen either the very first time a service worker is installed,\n * or after an update to the current service worker is found. In the case\n * of an update being found, the event's `isUpdate` property will be `true`.\n *\n * @event workbox-window.Workbox#installed\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `installed`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `waiting` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed` and then doesn't immediately change to `activating`.\n * It may also be dispatched if a service worker with the same\n * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * was already waiting when the {@link workbox-window.Workbox#register}\n * method was called.\n *\n * @event workbox-window.Workbox#waiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event|undefined} originalEvent The original\n * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event, or `undefined` in the case where the service worker was waiting\n * to before `.register()` was called.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with\n * a matching `scriptURL` was already waiting when this `Workbox`\n * instance called `register()`.\n * @property {string} type `waiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `controlling` event is dispatched if a\n * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}\n * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}\n * matches the `scriptURL` of the `Workbox` instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.\n *\n * @event workbox-window.Workbox#controlling\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this service worker was registered.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `controlling`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `activated` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}\n * changes to `activated`.\n *\n * @event workbox-window.Workbox#activated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `activated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `redundant` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `redundant`.\n *\n * @event workbox-window.Workbox#redundant\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `redundant`.\n * @property {Workbox} target The `Workbox` instance.\n */\n"],"names":["self","_","e","messageSW","sw","data","Promise","resolve","messageChannel","MessageChannel","port1","onmessage","event","postMessage","port2","Deferred","_this","promise","reject","dontWaitFor","then","logger","globalThis","__WB_DISABLE_DEV_LOGS","inGroup","methodToColorMap","debug","log","warn","error","groupCollapsed","groupEnd","print","method","args","_console2","test","navigator","userAgent","_console","console","apply","styles","logPrefix","join","concat","api","loggerMethods","Object","keys","_loop","key","_loggerMethods","_i","_len","arguments","length","Array","_key","WorkboxEventTarget","_eventListenerRegistry","Map","_proto","prototype","addEventListener","type","listener","foo","_getEventListenersByType","add","removeEventListener","delete","dispatchEvent","target","listeners","_iterator","_createForOfIteratorHelperLoose","_step","done","value","has","set","Set","get","urlsMatch","url1","url2","_location","location","href","URL","WorkboxEvent","props","assign","_await","direct","WAITING_TIMEOUT_DURATION","_async","f","i","REGISTRATION_TIMEOUT_DURATION","_empty","SKIP_WAITING_MESSAGE","_awaitIgnored","Workbox","_WorkboxEventTarget","scriptURL","registerOptions","call","_registerOptions","_updateFoundCount","_swDeferred","_activeDeferred","_controllingDeferred","_registrationTime","_ownSWs","_onUpdateFound","registration","_registration","installingSW","installing","updateLikelyTriggeredExternally","_scriptURL","toString","performance","now","_externalSW","_sw","serviceWorker","controller","_onStateChange","originalEvent","state","isExternal","eventProps","_isUpdate","isUpdate","_waitingTimeout","setTimeout","waiting","clearTimeout","_compatibleControllingSW","_onControllerChange","_onMessage","ports","source","getSW","_inheritsLoose","register","_temp","_ref","_ref$immediate","immediate","_this2","process","_invoke","document","readyState","res","window","Boolean","_getControllingSWIfCompatible","_registerScript","_this2$_registerScrip","once","waitingSW","wasWaitingBeforeRegister","currentPageIsOutOfScope","scopeURL","scope","baseURI","scopeURLBasePath","pathname","startsWith","update","_this3","undefined","_this4","messageSkipWaiting","_this5","_catch","reg","_createClass","body","result","recover"],"mappings":"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CpK,IAAI,CAACA,IAAI,CAAC;IACzB,EAAA;MACA,OAAOA,IAAI,CAACoK,MAAM,CAAC;IACpB,CAAC;IAhDD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAzDO,SAAAJ,MAAAA,CAAgBG,IAAI,EAAEE,OAAO,EAAE;MACrC,IAAI;IACH,IAAA,IAAID,MAAM,GAAGD,IAAI,EAAE;MACpB,CAAC,CAAC,OAAMrL,CAAC,EAAE;QACV,OAAOuL,OAAO,CAACvL,CAAC,CAAC;IAClB,EAAA;IACA,EAAA,IAAIsL,MAAM,IAAIA,MAAM,CAACpK,IAAI,EAAE;QAC1B,OAAOoK,MAAM,CAACpK,IAAI,CAAC,MAAM,EAAEqK,OAAO,CAAC;IACpC,EAAA;IACA,EAAA,OAAOD,MAAM;IACd;;;;;;;;;;"}
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-window/build/workbox-window.prod.es5.mjs b/tools/ui/node_modules/workbox-window/build/workbox-window.prod.es5.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..52aae8a834033d8c3ab33fc68bf7a58ec225f5b2
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/build/workbox-window.prod.es5.mjs
@@ -0,0 +1,2 @@
+try{self["workbox:window:7.4.0"]&&_()}catch(n){}function n(n,t){return new Promise((function(r){var e=new MessageChannel;e.port1.onmessage=function(n){r(n.data)},n.postMessage(t,[e.port2])}))}function t(n,t){(null==t||t>n.length)&&(t=n.length);for(var r=0,e=Array(t);r=n.length?{done:!0}:{done:!1,value:n[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(n,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,t){return n.__proto__=t,n},i(n,t)}function o(n){var t=function(n,t){if("object"!=typeof n||!n)return n;var r=n[Symbol.toPrimitive];if(void 0!==r){var e=r.call(n,t);if("object"!=typeof e)return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n,"string");return"symbol"==typeof t?t:t+""}try{self["workbox:core:7.4.0"]&&_()}catch(n){}var u=function(){var n=this;this.promise=new Promise((function(t,r){n.resolve=t,n.reject=r}))};function a(n,t){var r=location.href;return new URL(n,r).href===new URL(t,r).href}var c=function(n,t){this.type=n,Object.assign(this,t)};function f(n,t,r){return n&&n.then||(n=Promise.resolve(n)),t?n.then(t):n}function s(){}var v={type:"SKIP_WAITING"};function h(n,t){return n&&n.then?n.then(s):Promise.resolve()}var l=function(t){function e(n,r){var e,i;return void 0===r&&(r={}),(e=t.call(this)||this).nn={},e.tn=0,e.rn=new u,e.en=new u,e.on=new u,e.un=0,e.an=new Set,e.cn=function(){var n=e.fn,t=n.installing;e.tn>0||!a(t.scriptURL,e.sn.toString())||performance.now()>e.un+6e4?(e.vn=t,n.removeEventListener("updatefound",e.cn)):(e.hn=t,e.an.add(t),e.rn.resolve(t)),++e.tn,t.addEventListener("statechange",e.ln)},e.ln=function(n){var t=e.fn,r=n.target,i=r.state,o=r===e.vn,u={sw:r,isExternal:o,originalEvent:n};!o&&e.mn&&(u.isUpdate=!0),e.dispatchEvent(new c(i,u)),"installed"===i?e.wn=self.setTimeout((function(){"installed"===i&&t.waiting===r&&e.dispatchEvent(new c("waiting",u))}),200):"activating"===i&&(clearTimeout(e.wn),o||e.en.resolve(r))},e.yn=function(n){var t=e.hn,r=t!==navigator.serviceWorker.controller;e.dispatchEvent(new c("controlling",{isExternal:r,originalEvent:n,sw:t,isUpdate:e.mn})),r||e.on.resolve(t)},e.gn=(i=function(n){var t=n.data,r=n.ports,i=n.source;return f(e.getSW(),(function(){e.an.has(i)&&e.dispatchEvent(new c("message",{data:t,originalEvent:n,ports:r,sw:i}))}))},function(){for(var n=[],t=0;t}\n * @memberof workbox-window\n */\n// Better not change type of data.\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction messageSW(sw, data) {\n return new Promise((resolve) => {\n const messageChannel = new MessageChannel();\n messageChannel.port1.onmessage = (event) => {\n resolve(event.data);\n };\n sw.postMessage(data, [messageChannel.port2]);\n });\n}\nexport { messageSW };\n","\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:core:7.4.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * The Deferred class composes Promises in a way that allows for them to be\n * resolved or rejected from outside the constructor. In most cases promises\n * should be used directly, but Deferreds can be necessary when the logic to\n * resolve a promise must be separate.\n *\n * @private\n */\nclass Deferred {\n /**\n * Creates a promise and exposes its resolve and reject functions as methods.\n */\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n}\nexport { Deferred };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * Returns true if two URLs have the same `.href` property. The URLS can be\n * relative, and if they are the current location href is used to resolve URLs.\n *\n * @private\n * @param {string} url1\n * @param {string} url2\n * @return {boolean}\n */\nexport function urlsMatch(url1, url2) {\n const { href } = location;\n return new URL(url1, href).href === new URL(url2, href).href;\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A minimal `Event` subclass shim.\n * This doesn't *actually* subclass `Event` because not all browsers support\n * constructable `EventTarget`, and using a real `Event` will error.\n * @private\n */\nexport class WorkboxEvent {\n constructor(type, props) {\n this.type = type;\n Object.assign(this, props);\n }\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { Deferred } from 'workbox-core/_private/Deferred.js';\nimport { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { messageSW } from './messageSW.js';\nimport { WorkboxEventTarget } from './utils/WorkboxEventTarget.js';\nimport { urlsMatch } from './utils/urlsMatch.js';\nimport { WorkboxEvent } from './utils/WorkboxEvent.js';\nimport './_version.js';\n// The time a SW must be in the waiting phase before we can conclude\n// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically\n// chosen, but it seems to avoid false positives in my testing.\nconst WAITING_TIMEOUT_DURATION = 200;\n// The amount of time after a registration that we can reasonably conclude\n// that the registration didn't trigger an update.\nconst REGISTRATION_TIMEOUT_DURATION = 60000;\n// The de facto standard message that a service worker should be listening for\n// to trigger a call to skipWaiting().\nconst SKIP_WAITING_MESSAGE = { type: 'SKIP_WAITING' };\n/**\n * A class to aid in handling service worker registration, updates, and\n * reacting to service worker lifecycle events.\n *\n * @fires {@link workbox-window.Workbox#message}\n * @fires {@link workbox-window.Workbox#installed}\n * @fires {@link workbox-window.Workbox#waiting}\n * @fires {@link workbox-window.Workbox#controlling}\n * @fires {@link workbox-window.Workbox#activated}\n * @fires {@link workbox-window.Workbox#redundant}\n * @memberof workbox-window\n */\nclass Workbox extends WorkboxEventTarget {\n /**\n * Creates a new Workbox instance with a script URL and service worker\n * options. The script URL and options are the same as those used when\n * calling [navigator.serviceWorker.register(scriptURL, options)](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).\n *\n * @param {string|TrustedScriptURL} scriptURL The service worker script\n * associated with this instance. Using a\n * [`TrustedScriptURL`](https://web.dev/trusted-types/) is supported.\n * @param {Object} [registerOptions] The service worker options associated\n * with this instance.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n constructor(scriptURL, registerOptions = {}) {\n super();\n this._registerOptions = {};\n this._updateFoundCount = 0;\n // Deferreds we can resolve later.\n this._swDeferred = new Deferred();\n this._activeDeferred = new Deferred();\n this._controllingDeferred = new Deferred();\n this._registrationTime = 0;\n this._ownSWs = new Set();\n /**\n * @private\n */\n this._onUpdateFound = () => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const installingSW = registration.installing;\n // If the script URL passed to `navigator.serviceWorker.register()` is\n // different from the current controlling SW's script URL, we know any\n // successful registration calls will trigger an `updatefound` event.\n // But if the registered script URL is the same as the current controlling\n // SW's script URL, we'll only get an `updatefound` event if the file\n // changed since it was last registered. This can be a problem if the user\n // opens up the same page in a different tab, and that page registers\n // a SW that triggers an update. It's a problem because this page has no\n // good way of knowing whether the `updatefound` event came from the SW\n // script it registered or from a registration attempt made by a newer\n // version of the page running in another tab.\n // To minimize the possibility of a false positive, we use the logic here:\n const updateLikelyTriggeredExternally = \n // Since we enforce only calling `register()` once, and since we don't\n // add the `updatefound` event listener until the `register()` call, if\n // `_updateFoundCount` is > 0 then it means this method has already\n // been called, thus this SW must be external\n this._updateFoundCount > 0 ||\n // If the script URL of the installing SW is different from this\n // instance's script URL, we know it's definitely not from our\n // registration.\n !urlsMatch(installingSW.scriptURL, this._scriptURL.toString()) ||\n // If all of the above are false, then we use a time-based heuristic:\n // Any `updatefound` event that occurs long after our registration is\n // assumed to be external.\n performance.now() > this._registrationTime + REGISTRATION_TIMEOUT_DURATION\n ? // If any of the above are not true, we assume the update was\n // triggered by this instance.\n true\n : false;\n if (updateLikelyTriggeredExternally) {\n this._externalSW = installingSW;\n registration.removeEventListener('updatefound', this._onUpdateFound);\n }\n else {\n // If the update was not triggered externally we know the installing\n // SW is the one we registered, so we set it.\n this._sw = installingSW;\n this._ownSWs.add(installingSW);\n this._swDeferred.resolve(installingSW);\n // The `installing` state isn't something we have a dedicated\n // callback for, but we do log messages for it in development.\n if (process.env.NODE_ENV !== 'production') {\n if (navigator.serviceWorker.controller) {\n logger.log('Updated service worker found. Installing now...');\n }\n else {\n logger.log('Service worker is installing...');\n }\n }\n }\n // Increment the `updatefound` count, so future invocations of this\n // method can be sure they were triggered externally.\n ++this._updateFoundCount;\n // Add a `statechange` listener regardless of whether this update was\n // triggered externally, since we have callbacks for both.\n installingSW.addEventListener('statechange', this._onStateChange);\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onStateChange = (originalEvent) => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const sw = originalEvent.target;\n const { state } = sw;\n const isExternal = sw === this._externalSW;\n const eventProps = {\n sw,\n isExternal,\n originalEvent,\n };\n if (!isExternal && this._isUpdate) {\n eventProps.isUpdate = true;\n }\n this.dispatchEvent(new WorkboxEvent(state, eventProps));\n if (state === 'installed') {\n // This timeout is used to ignore cases where the service worker calls\n // `skipWaiting()` in the install event, thus moving it directly in the\n // activating state. (Since all service workers *must* go through the\n // waiting phase, the only way to detect `skipWaiting()` called in the\n // install event is to observe that the time spent in the waiting phase\n // is very short.)\n // NOTE: we don't need separate timeouts for the own and external SWs\n // since they can't go through these phases at the same time.\n this._waitingTimeout = self.setTimeout(() => {\n // Ensure the SW is still waiting (it may now be redundant).\n if (state === 'installed' && registration.waiting === sw) {\n this.dispatchEvent(new WorkboxEvent('waiting', eventProps));\n if (process.env.NODE_ENV !== 'production') {\n if (isExternal) {\n logger.warn('An external service worker has installed but is ' +\n 'waiting for this client to close before activating...');\n }\n else {\n logger.warn('The service worker has installed but is waiting ' +\n 'for existing clients to close before activating...');\n }\n }\n }\n }, WAITING_TIMEOUT_DURATION);\n }\n else if (state === 'activating') {\n clearTimeout(this._waitingTimeout);\n if (!isExternal) {\n this._activeDeferred.resolve(sw);\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n switch (state) {\n case 'installed':\n if (isExternal) {\n logger.warn('An external service worker has installed. ' +\n 'You may want to suggest users reload this page.');\n }\n else {\n logger.log('Registered service worker installed.');\n }\n break;\n case 'activated':\n if (isExternal) {\n logger.warn('An external service worker has activated.');\n }\n else {\n logger.log('Registered service worker activated.');\n if (sw !== navigator.serviceWorker.controller) {\n logger.warn('The registered service worker is active but ' +\n 'not yet controlling the page. Reload or run ' +\n '`clients.claim()` in the service worker.');\n }\n }\n break;\n case 'redundant':\n if (sw === this._compatibleControllingSW) {\n logger.log('Previously controlling service worker now redundant!');\n }\n else if (!isExternal) {\n logger.log('Registered service worker now redundant!');\n }\n break;\n }\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onControllerChange = (originalEvent) => {\n const sw = this._sw;\n const isExternal = sw !== navigator.serviceWorker.controller;\n // Unconditionally dispatch the controlling event, with isExternal set\n // to distinguish between controller changes due to the initial registration\n // vs. an update-check or other tab's registration.\n // See https://github.com/GoogleChrome/workbox/issues/2786\n this.dispatchEvent(new WorkboxEvent('controlling', {\n isExternal,\n originalEvent,\n sw,\n isUpdate: this._isUpdate,\n }));\n if (!isExternal) {\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Registered service worker now controlling this page.');\n }\n this._controllingDeferred.resolve(sw);\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onMessage = async (originalEvent) => {\n // Can't change type 'any' of data.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const { data, ports, source } = originalEvent;\n // Wait until there's an \"own\" service worker. This is used to buffer\n // `message` events that may be received prior to calling `register()`.\n await this.getSW();\n // If the service worker that sent the message is in the list of own\n // service workers for this instance, dispatch a `message` event.\n // NOTE: we check for all previously owned service workers rather than\n // just the current one because some messages (e.g. cache updates) use\n // a timeout when sent and may be delayed long enough for a service worker\n // update to be found.\n if (this._ownSWs.has(source)) {\n this.dispatchEvent(new WorkboxEvent('message', {\n // Can't change type 'any' of data.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n data,\n originalEvent,\n ports,\n sw: source,\n }));\n }\n };\n this._scriptURL = scriptURL;\n this._registerOptions = registerOptions;\n // Add a message listener immediately since messages received during\n // page load are buffered only until the DOMContentLoaded event:\n // https://github.com/GoogleChrome/workbox/issues/2202\n navigator.serviceWorker.addEventListener('message', this._onMessage);\n }\n /**\n * Registers a service worker for this instances script URL and service\n * worker options. By default this method delays registration until after\n * the window has loaded.\n *\n * @param {Object} [options]\n * @param {Function} [options.immediate=false] Setting this to true will\n * register the service worker immediately, even if the window has\n * not loaded (not recommended).\n */\n async register({ immediate = false } = {}) {\n if (process.env.NODE_ENV !== 'production') {\n if (this._registrationTime) {\n logger.error('Cannot re-register a Workbox instance after it has ' +\n 'been registered. Create a new instance instead.');\n return;\n }\n }\n if (!immediate && document.readyState !== 'complete') {\n await new Promise((res) => window.addEventListener('load', res));\n }\n // Set this flag to true if any service worker was controlling the page\n // at registration time.\n this._isUpdate = Boolean(navigator.serviceWorker.controller);\n // Before registering, attempt to determine if a SW is already controlling\n // the page, and if that SW script (and version, if specified) matches this\n // instance's script.\n this._compatibleControllingSW = this._getControllingSWIfCompatible();\n this._registration = await this._registerScript();\n // If we have a compatible controller, store the controller as the \"own\"\n // SW, resolve active/controlling deferreds and add necessary listeners.\n if (this._compatibleControllingSW) {\n this._sw = this._compatibleControllingSW;\n this._activeDeferred.resolve(this._compatibleControllingSW);\n this._controllingDeferred.resolve(this._compatibleControllingSW);\n this._compatibleControllingSW.addEventListener('statechange', this._onStateChange, { once: true });\n }\n // If there's a waiting service worker with a matching URL before the\n // `updatefound` event fires, it likely means that this site is open\n // in another tab, or the user refreshed the page (and thus the previous\n // page wasn't fully unloaded before this page started loading).\n // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting\n const waitingSW = this._registration.waiting;\n if (waitingSW &&\n urlsMatch(waitingSW.scriptURL, this._scriptURL.toString())) {\n // Store the waiting SW as the \"own\" Sw, even if it means overwriting\n // a compatible controller.\n this._sw = waitingSW;\n // Run this in the next microtask, so any code that adds an event\n // listener after awaiting `register()` will get this event.\n dontWaitFor(Promise.resolve().then(() => {\n this.dispatchEvent(new WorkboxEvent('waiting', {\n sw: waitingSW,\n wasWaitingBeforeRegister: true,\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.warn('A service worker was already waiting to activate ' +\n 'before this script was registered...');\n }\n }));\n }\n // If an \"own\" SW is already set, resolve the deferred.\n if (this._sw) {\n this._swDeferred.resolve(this._sw);\n this._ownSWs.add(this._sw);\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Successfully registered service worker.', this._scriptURL.toString());\n if (navigator.serviceWorker.controller) {\n if (this._compatibleControllingSW) {\n logger.debug('A service worker with the same script URL ' +\n 'is already controlling this page.');\n }\n else {\n logger.debug('A service worker with a different script URL is ' +\n 'currently controlling the page. The browser is now fetching ' +\n 'the new script now...');\n }\n }\n const currentPageIsOutOfScope = () => {\n const scopeURL = new URL(this._registerOptions.scope || this._scriptURL.toString(), document.baseURI);\n const scopeURLBasePath = new URL('./', scopeURL.href).pathname;\n return !location.pathname.startsWith(scopeURLBasePath);\n };\n if (currentPageIsOutOfScope()) {\n logger.warn('The current page is not in scope for the registered ' +\n 'service worker. Was this a mistake?');\n }\n }\n this._registration.addEventListener('updatefound', this._onUpdateFound);\n navigator.serviceWorker.addEventListener('controllerchange', this._onControllerChange);\n return this._registration;\n }\n /**\n * Checks for updates of the registered service worker.\n */\n async update() {\n if (!this._registration) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error('Cannot update a Workbox instance without ' +\n 'being registered. Register the Workbox instance first.');\n }\n return;\n }\n // Try to update registration\n await this._registration.update();\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is active. If a service worker was already controlling at registration\n * time then it will resolve to that if the script URLs (and optionally\n * script versions) match, otherwise it will wait until an update is found\n * and activates.\n *\n * @return {Promise}\n */\n get active() {\n return this._activeDeferred.promise;\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is controlling the page. If a service worker was already controlling at\n * registration time then it will resolve to that if the script URLs (and\n * optionally script versions) match, otherwise it will wait until an update\n * is found and starts controlling the page.\n * Note: the first time a service worker is installed it will active but\n * not start controlling the page unless `clients.claim()` is called in the\n * service worker.\n *\n * @return {Promise}\n */\n get controlling() {\n return this._controllingDeferred.promise;\n }\n /**\n * Resolves with a reference to a service worker that matches the script URL\n * of this instance, as soon as it's available.\n *\n * If, at registration time, there's already an active or waiting service\n * worker with a matching script URL, it will be used (with the waiting\n * service worker taking precedence over the active service worker if both\n * match, since the waiting service worker would have been registered more\n * recently).\n * If there's no matching active or waiting service worker at registration\n * time then the promise will not resolve until an update is found and starts\n * installing, at which point the installing service worker is used.\n *\n * @return {Promise}\n */\n getSW() {\n // If `this._sw` is set, resolve with that as we want `getSW()` to\n // return the correct (new) service worker if an update is found.\n return this._sw !== undefined\n ? Promise.resolve(this._sw)\n : this._swDeferred.promise;\n }\n /**\n * Sends the passed data object to the service worker registered by this\n * instance (via {@link workbox-window.Workbox#getSW}) and resolves\n * with a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will never\n * resolve.\n *\n * @param {Object} data An object to send to the service worker\n * @return {Promise}\n */\n // We might be able to change the 'data' type to Record in the future.\n // eslint-disable-next-line @typescript-eslint/ban-types\n async messageSW(data) {\n const sw = await this.getSW();\n return messageSW(sw, data);\n }\n /**\n * Sends a `{type: 'SKIP_WAITING'}` message to the service worker that's\n * currently in the `waiting` state associated with the current registration.\n *\n * If there is no current registration or no service worker is `waiting`,\n * calling this will have no effect.\n */\n messageSkipWaiting() {\n if (this._registration && this._registration.waiting) {\n void messageSW(this._registration.waiting, SKIP_WAITING_MESSAGE);\n }\n }\n /**\n * Checks for a service worker already controlling the page and returns\n * it if its script URL matches.\n *\n * @private\n * @return {ServiceWorker|undefined}\n */\n _getControllingSWIfCompatible() {\n const controller = navigator.serviceWorker.controller;\n if (controller &&\n urlsMatch(controller.scriptURL, this._scriptURL.toString())) {\n return controller;\n }\n else {\n return undefined;\n }\n }\n /**\n * Registers a service worker for this instances script URL and register\n * options and tracks the time registration was complete.\n *\n * @private\n */\n async _registerScript() {\n try {\n // this._scriptURL may be a TrustedScriptURL, but there's no support for\n // passing that to register() in lib.dom right now.\n // https://github.com/GoogleChrome/workbox/issues/2855\n const reg = await navigator.serviceWorker.register(this._scriptURL, this._registerOptions);\n // Keep track of when registration happened, so it can be used in the\n // `this._onUpdateFound` heuristic. Also use the presence of this\n // property as a way to see if `.register()` has been called.\n this._registrationTime = performance.now();\n return reg;\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(error);\n }\n // Re-throw the error.\n throw error;\n }\n }\n}\nexport { Workbox };\n// The jsdoc comments below outline the events this instance may dispatch:\n// -----------------------------------------------------------------------\n/**\n * The `message` event is dispatched any time a `postMessage` is received.\n *\n * @event workbox-window.Workbox#message\n * @type {WorkboxEvent}\n * @property {*} data The `data` property from the original `message` event.\n * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}\n * event.\n * @property {string} type `message`.\n * @property {MessagePort[]} ports The `ports` value from `originalEvent`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `installed` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}\n * changes to `installed`.\n *\n * Then can happen either the very first time a service worker is installed,\n * or after an update to the current service worker is found. In the case\n * of an update being found, the event's `isUpdate` property will be `true`.\n *\n * @event workbox-window.Workbox#installed\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `installed`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `waiting` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed` and then doesn't immediately change to `activating`.\n * It may also be dispatched if a service worker with the same\n * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * was already waiting when the {@link workbox-window.Workbox#register}\n * method was called.\n *\n * @event workbox-window.Workbox#waiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event|undefined} originalEvent The original\n * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event, or `undefined` in the case where the service worker was waiting\n * to before `.register()` was called.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with\n * a matching `scriptURL` was already waiting when this `Workbox`\n * instance called `register()`.\n * @property {string} type `waiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `controlling` event is dispatched if a\n * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}\n * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}\n * matches the `scriptURL` of the `Workbox` instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.\n *\n * @event workbox-window.Workbox#controlling\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this service worker was registered.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `controlling`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `activated` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}\n * changes to `activated`.\n *\n * @event workbox-window.Workbox#activated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `activated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `redundant` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `redundant`.\n *\n * @event workbox-window.Workbox#redundant\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `redundant`.\n * @property {Workbox} target The `Workbox` instance.\n */\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A helper function that prevents a promise from being flagged as unused.\n *\n * @private\n **/\nexport function dontWaitFor(promise) {\n // Effective no-op.\n void promise.then(() => { });\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n/**\n * A minimal `EventTarget` shim.\n * This is necessary because not all browsers support constructable\n * `EventTarget`, so using a real `EventTarget` will error.\n * @private\n */\nexport class WorkboxEventTarget {\n constructor() {\n this._eventListenerRegistry = new Map();\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n addEventListener(type, listener) {\n const foo = this._getEventListenersByType(type);\n foo.add(listener);\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n removeEventListener(type, listener) {\n this._getEventListenersByType(type).delete(listener);\n }\n /**\n * @param {Object} event\n * @private\n */\n dispatchEvent(event) {\n event.target = this;\n const listeners = this._getEventListenersByType(event.type);\n for (const listener of listeners) {\n listener(event);\n }\n }\n /**\n * Returns a Set of listeners associated with the passed event type.\n * If no handlers have been registered, an empty Set is returned.\n *\n * @param {string} type The event type.\n * @return {Set} An array of handler functions.\n * @private\n */\n _getEventListenersByType(type) {\n if (!this._eventListenerRegistry.has(type)) {\n this._eventListenerRegistry.set(type, new Set());\n }\n return this._eventListenerRegistry.get(type);\n }\n}\n"],"names":["self","_","e","messageSW","sw","data","Promise","resolve","messageChannel","MessageChannel","port1","onmessage","event","postMessage","port2","Deferred","_this","this","promise","reject","urlsMatch","url1","url2","href","location","URL","WorkboxEvent","type","props","Object","assign","_await","value","then","direct","_empty","SKIP_WAITING_MESSAGE","_awaitIgnored","Workbox","_WorkboxEventTarget","scriptURL","registerOptions","f","call","_registerOptions","_updateFoundCount","_swDeferred","_activeDeferred","_controllingDeferred","_registrationTime","_ownSWs","Set","_onUpdateFound","registration","_registration","installingSW","installing","_scriptURL","toString","performance","now","_externalSW","removeEventListener","_sw","add","addEventListener","_onStateChange","originalEvent","target","state","isExternal","eventProps","_isUpdate","isUpdate","dispatchEvent","_waitingTimeout","setTimeout","waiting","clearTimeout","_onControllerChange","navigator","serviceWorker","controller","_onMessage","ports","source","getSW","has","args","i","arguments","length","apply","_proto","prototype","register","_temp","_ref$immediate","immediate","_this2","body","result","_invoke","document","readyState","res","window","Boolean","_compatibleControllingSW","_getControllingSWIfCompatible","_registerScript","_this2$_registerScrip","once","waitingSW","wasWaitingBeforeRegister","update","undefined","messageSkipWaiting","_this5","recover","_catch","reg","error","_createClass","key","get","WorkboxEventTarget","_eventListenerRegistry","Map","listener","_getEventListenersByType","delete","_step","_iterator","_createForOfIteratorHelperLoose","done","set"],"mappings":"AAEA,IACIA,KAAK,yBAA2BC,GACpC,CACA,MAAOC,GAAK,CCmBZ,SAASC,EAAUC,EAAIC,GACnB,OAAO,IAAIC,SAAQ,SAACC,GAChB,IAAMC,EAAiB,IAAIC,eAC3BD,EAAeE,MAAMC,UAAY,SAACC,GAC9BL,EAAQK,EAAMP,KAClB,EACAD,EAAGS,YAAYR,EAAM,CAACG,EAAeM,OACzC,GACJ,26CC9BA,IACId,KAAK,uBAAyBC,GAClC,CACA,MAAOC,GAAK,CCGZ,IAQMa,EAIF,WAAc,IAAAC,EAAAC,KACVA,KAAKC,QAAU,IAAIZ,SAAQ,SAACC,EAASY,GACjCH,EAAKT,QAAUA,EACfS,EAAKG,OAASA,CAClB,GACJ,ECRG,SAASC,EAAUC,EAAMC,GAC5B,IAAQC,EAASC,SAATD,KACR,OAAO,IAAIE,IAAIJ,EAAME,GAAMA,OAAS,IAAIE,IAAIH,EAAMC,GAAMA,IAC5D,CCNA,IAAaG,EACT,SAAYC,EAAMC,GACdX,KAAKU,KAAOA,EACZE,OAAOC,OAAOb,KAAMW,EACxB,ECkEG,SAASG,EAAOC,EAAOC,EAAMC,GAOnC,OAHKF,GAAUA,EAAMC,OACpBD,EAAQ1B,QAAQC,QAAQyB,IAElBC,EAAOD,EAAMC,KAAKA,GAAQD,CAClC,CAogBO,SAASG,IAChB,CAzkBA,IAAMC,EAAuB,CAAET,KAAM,gBAuE9B,SAASU,EAAcL,EAAOE,GAEnC,OAAOF,GAASA,EAAMC,KAAOD,EAAMC,KAAKE,GAAU7B,QAAQC,SAE5D,CAAC,IA9DK+B,WAAOC,GAaT,SAAAD,EAAYE,EAAWC,GAAsB,IAAAzB,EAoB1B0B,EAsMsD,YA1NnC,IAAfD,IAAAA,EAAkB,CAAA,IACrCzB,EAAAuB,EAAAI,YAAO1B,MACF2B,GAAmB,CAAA,EACxB5B,EAAK6B,GAAoB,EAEzB7B,EAAK8B,GAAc,IAAI/B,EACvBC,EAAK+B,GAAkB,IAAIhC,EAC3BC,EAAKgC,GAAuB,IAAIjC,EAChCC,EAAKiC,GAAoB,EACzBjC,EAAKkC,GAAU,IAAIC,IAInBnC,EAAKoC,GAAiB,WAElB,IAAMC,EAAerC,EAAKsC,GACpBC,EAAeF,EAAaG,WAkBlCxC,EAAK6B,GAAoB,IAIpBzB,EAAUmC,EAAaf,UAAWxB,EAAKyC,GAAWC,aAInDC,YAAYC,MAAQ5C,EAAKiC,GAvEH,KA6EtBjC,EAAK6C,GAAcN,EACnBF,EAAaS,oBAAoB,cAAe9C,EAAKoC,MAKrDpC,EAAK+C,GAAMR,EACXvC,EAAKkC,GAAQc,IAAIT,GACjBvC,EAAK8B,GAAYvC,QAAQgD,MAc3BvC,EAAK6B,GAGPU,EAAaU,iBAAiB,cAAejD,EAAKkD,GACtD,EAKAlD,EAAKkD,GAAiB,SAACC,GAEnB,IAAMd,EAAerC,EAAKsC,GACpBlD,EAAK+D,EAAcC,OACjBC,EAAUjE,EAAViE,MACFC,EAAalE,IAAOY,EAAK6C,GACzBU,EAAa,CACfnE,GAAAA,EACAkE,WAAAA,EACAH,cAAAA,IAECG,GAActD,EAAKwD,KACpBD,EAAWE,UAAW,GAE1BzD,EAAK0D,cAAc,IAAIhD,EAAa2C,EAAOE,IAC7B,cAAVF,EASArD,EAAK2D,GAAkB3E,KAAK4E,YAAW,WAErB,cAAVP,GAAyBhB,EAAawB,UAAYzE,GAClDY,EAAK0D,cAAc,IAAIhD,EAAa,UAAW6C,GAYvD,GAtJiB,KAwJF,eAAVF,IACLS,aAAa9D,EAAK2D,IACbL,GACDtD,EAAK+B,GAAgBxC,QAAQH,GAqCzC,EAKAY,EAAK+D,GAAsB,SAACZ,GACxB,IAAM/D,EAAKY,EAAK+C,GACVO,EAAalE,IAAO4E,UAAUC,cAAcC,WAKlDlE,EAAK0D,cAAc,IAAIhD,EAAa,cAAe,CAC/C4C,WAAAA,EACAH,cAAAA,EACA/D,GAAAA,EACAqE,SAAUzD,EAAKwD,MAEdF,GAIDtD,EAAKgC,GAAqBzC,QAAQH,EAE1C,EAKAY,EAAKmE,IAzKUzC,EAyKA,SAAUyB,GAGrB,IAAQ9D,EAAwB8D,EAAxB9D,KAAM+E,EAAkBjB,EAAlBiB,MAAOC,EAAWlB,EAAXkB,OAErB,OAAAtD,EACMf,EAAKsE,SAAO,WAOdtE,EAAKkC,GAAQqC,IAAIF,IACjBrE,EAAK0D,cAAc,IAAIhD,EAAa,UAAW,CAG3CrB,KAAAA,EACA8D,cAAAA,EACAiB,MAAAA,EACAhF,GAAIiF,IACJ,GAEZ,EA/LA,WACN,IAAK,IAAIG,EAAO,GAAIC,EAAI,EAAGA,EAAIC,UAAUC,OAAQF,IAChDD,EAAKC,GAAKC,UAAUD,GAErB,IACC,OAAOnF,QAAQC,QAAQmC,EAAEkD,MAAM3E,KAAMuE,GACtC,CAAE,MAAMtF,GACP,OAAOI,QAAQa,OAAOjB,EACvB,CACD,GAuLOc,EAAKyC,GAAajB,EAClBxB,EAAK4B,GAAmBH,EAIxBuC,UAAUC,cAAchB,iBAAiB,UAAWjD,EAAKmE,IAAYnE,CACzE,WACAuB,KAAAD,yEAAA,IAAAuD,EAAAvD,EAAAwD,UAqOC,OArODD,EAUME,SAAQ,SAAAC,GAAA,IAA2BC,YAA3BD,EAAyB,CAAA,EAAEA,GAAxBE,UAAAA,OAAS,IAAAD,GAAQA,EAAA,IAAS,IAAAE,EAE/BlF,KAKP,OAAAc,EAkQF,SAAiBqE,EAAMnE,GAC7B,IAAIoE,EAASD,IACb,GAAIC,GAAUA,EAAOpE,KACpB,OAAOoE,EAAOpE,KAAKA,GAEpB,OAAOA,EAAKoE,EACb,CAxQSC,EAAA,WAAA,IACIJ,GAAqC,aAAxBK,SAASC,WAAyB,OAAAnE,EAC1C,IAAI/B,SAAQ,SAACmG,GAAG,OAAKC,OAAOzC,iBAAiB,OAAQwC,EAAI,IAAC,IAAA,WAQC,OAJrEN,EAAK3B,GAAYmC,QAAQ3B,UAAUC,cAAcC,YAIjDiB,EAAKS,GAA2BT,EAAKU,KAAgC9E,EAC1CoE,EAAKW,eAAiBC,GAAjDZ,EAAK7C,GAAayD,EAGdZ,EAAKS,KACLT,EAAKpC,GAAMoC,EAAKS,GAChBT,EAAKpD,GAAgBxC,QAAQ4F,EAAKS,IAClCT,EAAKnD,GAAqBzC,QAAQ4F,EAAKS,IACvCT,EAAKS,GAAyB3C,iBAAiB,cAAekC,EAAKjC,GAAgB,CAAE8C,MAAM,KAO/F,IAAMC,EAAYd,EAAK7C,GAAcuB,QAiDrC,OAhDIoC,GACA7F,EAAU6F,EAAUzE,UAAW2D,EAAK1C,GAAWC,cAG/CyC,EAAKpC,GAAMkD,EAGC3G,QAAQC,UAAU0B,MAAK,WAC/BkE,EAAKzB,cAAc,IAAIhD,EAAa,UAAW,CAC3CtB,GAAI6G,EACJC,0BAA0B,IAMlC,IC3TKjF,MAAK,WAAQ,KD8TlBkE,EAAKpC,KACLoC,EAAKrD,GAAYvC,QAAQ4F,EAAKpC,IAC9BoC,EAAKjD,GAAQc,IAAImC,EAAKpC,KAyB1BoC,EAAK7C,GAAcW,iBAAiB,cAAekC,EAAK/C,IACxD4B,UAAUC,cAAchB,iBAAiB,mBAAoBkC,EAAKpB,IAC3DoB,EAAK7C,EAAc,GAAA,IAC9B,OAACpD,GAAA,OAAAI,QAAAa,OAAAjB,EAAA,CAAA,EACD2F,EAGMsB,OAAM,WAAA,IACR,OAAKlG,KAAKqC,GAOVvB,EAAAM,EAPKpB,KAQMqC,GAAc6D,WAHrBpF,GAIR,OAAC7B,GAAA,OAAAI,QAAAa,OAAAjB,EAAA,CAAA,EA4BD2F,EAeAP,MAAA,WAGI,YAAoB8B,IAAbnG,KAAK8C,GACNzD,QAAQC,QAAQU,KAAK8C,IACrB9C,KAAK6B,GAAY5B,OAC3B,EAeA2E,EACM1F,UAAS,SAACE,GAAI,IACK,OAAA0B,EAAJd,KAAKqE,kBAAhBlF,GACN,OAAOD,EAAUC,EAAIC,EAAM,GAC/B,OAACH,GAAA,OAAAI,QAAAa,OAAAjB,EAAA,CAAA,EACD2F,EAOAwB,mBAAA,WACQpG,KAAKqC,IAAiBrC,KAAKqC,GAAcuB,SACpC1E,EAAUc,KAAKqC,GAAcuB,QAASzC,EAEnD,EACAyD,EAOAgB,GAAA,WACI,IAAM3B,EAAaF,UAAUC,cAAcC,WAC3C,OAAIA,GACA9D,EAAU8D,EAAW1C,UAAWvB,KAAKwC,GAAWC,YACzCwB,OAGP,CAER,EACAW,EAMMiB,GAAe,WAAA,IAAG,IAAAQ,EAKmCrG,KAAI,OAAAc,EA6E5D,SAAgBqE,EAAMmB,GAC5B,IACC,IAAIlB,EAASD,GACd,CAAE,MAAMlG,GACP,OAAOqH,EAAQrH,EAChB,CACA,GAAImG,GAAUA,EAAOpE,KACpB,OAAOoE,EAAOpE,UAAK,EAAQsF,GAE5B,OAAOlB,CACR,CAvFmEmB,EAAA,WADvD,OAAAzF,EACkBiD,UAAUC,cAAcc,SAASuB,EAAK7D,GAAY6D,EAAK1E,cAAnE6E,GAKN,OADAH,EAAKrE,GAAoBU,YAAYC,MAC9B6D,CAAI,GACf,IAAC,SACMC,GAKH,MAAMA,CACV,IACJ,OAACxH,GAAA,OAAAI,QAAAa,OAAAjB,EAAA,CAAA,EAAAyH,EAAArF,EAAA,CAAA,CAAAsF,IAAA,SAAAC,IAjHD,WACI,OAAO5G,KAAK8B,GAAgB7B,OAChC,GACA,CAAA0G,IAAA,cAAAC,IAYA,WACI,OAAO5G,KAAK+B,GAAqB9B,OACrC,IAAC,EEtY0B,WAC3B,SAAA4G,IACI7G,KAAK8G,GAAyB,IAAIC,GACtC,CACA,IAAAnC,EAAAiC,EAAAhC,UAyCC,OAzCDD,EAKA5B,iBAAA,SAAiBtC,EAAMsG,GACPhH,KAAKiH,GAAyBvG,GACtCqC,IAAIiE,EACZ,EACApC,EAKA/B,oBAAA,SAAoBnC,EAAMsG,GACtBhH,KAAKiH,GAAyBvG,GAAMwG,OAAOF,EAC/C,EACApC,EAIAnB,cAAA,SAAc9D,GACVA,EAAMwD,OAASnD,KAEf,IADA,IACgCmH,EAAhCC,EAAAC,EADkBrH,KAAKiH,GAAyBtH,EAAMe,SACtByG,EAAAC,KAAAE,MAAE,EAC9BN,EADeG,EAAApG,OACNpB,EACb,CACJ,EACAiF,EAQAqC,GAAA,SAAyBvG,GAIrB,OAHKV,KAAK8G,GAAuBxC,IAAI5D,IACjCV,KAAK8G,GAAuBS,IAAI7G,EAAM,IAAIwB,KAEvClC,KAAK8G,GAAuBF,IAAIlG,EAC3C,EAACmG,CAAA,CA7C0B"}
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-window/build/workbox-window.prod.mjs b/tools/ui/node_modules/workbox-window/build/workbox-window.prod.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..9548807937a2e67200116317f2804411f6b61e79
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/build/workbox-window.prod.mjs
@@ -0,0 +1,2 @@
+try{self["workbox:window:7.4.0"]&&_()}catch(t){}function t(t,s){return new Promise((i=>{const e=new MessageChannel;e.port1.onmessage=t=>{i(t.data)},t.postMessage(s,[e.port2])}))}try{self["workbox:core:7.4.0"]&&_()}catch(t){}class s{constructor(){this.promise=new Promise(((t,s)=>{this.resolve=t,this.reject=s}))}}class i{constructor(){this.Pt=new Map}addEventListener(t,s){this.Wt(t).add(s)}removeEventListener(t,s){this.Wt(t).delete(s)}dispatchEvent(t){t.target=this;const s=this.Wt(t.type);for(const i of s)i(t)}Wt(t){return this.Pt.has(t)||this.Pt.set(t,new Set),this.Pt.get(t)}}function e(t,s){const{href:i}=location;return new URL(t,i).href===new URL(s,i).href}class h{constructor(t,s){this.type=t,Object.assign(this,s)}}const n={type:"SKIP_WAITING"};class a extends i{constructor(t,i={}){super(),this._t={},this.Lt=0,this.Ct=new s,this.Tt=new s,this.Ut=new s,this.Mt=0,this.Gt=new Set,this.Kt=()=>{const t=this.Nt,s=t.installing;this.Lt>0||!e(s.scriptURL,this.Ot.toString())||performance.now()>this.Mt+6e4?(this.zt=s,t.removeEventListener("updatefound",this.Kt)):(this.Ft=s,this.Gt.add(s),this.Ct.resolve(s)),++this.Lt,s.addEventListener("statechange",this.Ht)},this.Ht=t=>{const s=this.Nt,i=t.target,{state:e}=i,n=i===this.zt,a={sw:i,isExternal:n,originalEvent:t};!n&&this.Jt&&(a.isUpdate=!0),this.dispatchEvent(new h(e,a)),"installed"===e?this.Qt=self.setTimeout((()=>{"installed"===e&&s.waiting===i&&this.dispatchEvent(new h("waiting",a))}),200):"activating"===e&&(clearTimeout(this.Qt),n||this.Tt.resolve(i))},this.Vt=t=>{const s=this.Ft,i=s!==navigator.serviceWorker.controller;this.dispatchEvent(new h("controlling",{isExternal:i,originalEvent:t,sw:s,isUpdate:this.Jt})),i||this.Ut.resolve(s)},this.Xt=async t=>{const{data:s,ports:i,source:e}=t;await this.getSW(),this.Gt.has(e)&&this.dispatchEvent(new h("message",{data:s,originalEvent:t,ports:i,sw:e}))},this.Ot=t,this._t=i,navigator.serviceWorker.addEventListener("message",this.Xt)}async register({immediate:t=!1}={}){t||"complete"===document.readyState||await new Promise((t=>window.addEventListener("load",t))),this.Jt=Boolean(navigator.serviceWorker.controller),this.Yt=this.Zt(),this.Nt=await this.$t(),this.Yt&&(this.Ft=this.Yt,this.Tt.resolve(this.Yt),this.Ut.resolve(this.Yt),this.Yt.addEventListener("statechange",this.Ht,{once:!0}));const s=this.Nt.waiting;return s&&e(s.scriptURL,this.Ot.toString())&&(this.Ft=s,Promise.resolve().then((()=>{this.dispatchEvent(new h("waiting",{sw:s,wasWaitingBeforeRegister:!0}))})).then((()=>{}))),this.Ft&&(this.Ct.resolve(this.Ft),this.Gt.add(this.Ft)),this.Nt.addEventListener("updatefound",this.Kt),navigator.serviceWorker.addEventListener("controllerchange",this.Vt),this.Nt}async update(){this.Nt&&await this.Nt.update()}get active(){return this.Tt.promise}get controlling(){return this.Ut.promise}getSW(){return void 0!==this.Ft?Promise.resolve(this.Ft):this.Ct.promise}async messageSW(s){return t(await this.getSW(),s)}messageSkipWaiting(){this.Nt&&this.Nt.waiting&&t(this.Nt.waiting,n)}Zt(){const t=navigator.serviceWorker.controller;return t&&e(t.scriptURL,this.Ot.toString())?t:void 0}async $t(){try{const t=await navigator.serviceWorker.register(this.Ot,this._t);return this.Mt=performance.now(),t}catch(t){throw t}}}export{a as Workbox,h as WorkboxEvent,t as messageSW};
+//# sourceMappingURL=workbox-window.prod.mjs.map
diff --git a/tools/ui/node_modules/workbox-window/build/workbox-window.prod.mjs.map b/tools/ui/node_modules/workbox-window/build/workbox-window.prod.mjs.map
new file mode 100644
index 0000000000000000000000000000000000000000..17edd845f7e0a9faeb6ae22e2b517fb04bcec713
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/build/workbox-window.prod.mjs.map
@@ -0,0 +1 @@
+{"version":3,"file":"workbox-window.prod.mjs","sources":["../_version.js","../messageSW.js","../../workbox-core/_version.js","../../workbox-core/_private/Deferred.js","../utils/WorkboxEventTarget.js","../utils/urlsMatch.js","../utils/WorkboxEvent.js","../Workbox.js","../../workbox-core/_private/dontWaitFor.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:window:7.4.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport './_version.js';\n/**\n * Sends a data object to a service worker via `postMessage` and resolves with\n * a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will not\n * resolve.\n *\n * @param {ServiceWorker} sw The service worker to send the message to.\n * @param {Object} data An object to send to the service worker.\n * @return {Promise}\n * @memberof workbox-window\n */\n// Better not change type of data.\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction messageSW(sw, data) {\n return new Promise((resolve) => {\n const messageChannel = new MessageChannel();\n messageChannel.port1.onmessage = (event) => {\n resolve(event.data);\n };\n sw.postMessage(data, [messageChannel.port2]);\n });\n}\nexport { messageSW };\n","\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:core:7.4.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * The Deferred class composes Promises in a way that allows for them to be\n * resolved or rejected from outside the constructor. In most cases promises\n * should be used directly, but Deferreds can be necessary when the logic to\n * resolve a promise must be separate.\n *\n * @private\n */\nclass Deferred {\n /**\n * Creates a promise and exposes its resolve and reject functions as methods.\n */\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n}\nexport { Deferred };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n/**\n * A minimal `EventTarget` shim.\n * This is necessary because not all browsers support constructable\n * `EventTarget`, so using a real `EventTarget` will error.\n * @private\n */\nexport class WorkboxEventTarget {\n constructor() {\n this._eventListenerRegistry = new Map();\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n addEventListener(type, listener) {\n const foo = this._getEventListenersByType(type);\n foo.add(listener);\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n removeEventListener(type, listener) {\n this._getEventListenersByType(type).delete(listener);\n }\n /**\n * @param {Object} event\n * @private\n */\n dispatchEvent(event) {\n event.target = this;\n const listeners = this._getEventListenersByType(event.type);\n for (const listener of listeners) {\n listener(event);\n }\n }\n /**\n * Returns a Set of listeners associated with the passed event type.\n * If no handlers have been registered, an empty Set is returned.\n *\n * @param {string} type The event type.\n * @return {Set} An array of handler functions.\n * @private\n */\n _getEventListenersByType(type) {\n if (!this._eventListenerRegistry.has(type)) {\n this._eventListenerRegistry.set(type, new Set());\n }\n return this._eventListenerRegistry.get(type);\n }\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * Returns true if two URLs have the same `.href` property. The URLS can be\n * relative, and if they are the current location href is used to resolve URLs.\n *\n * @private\n * @param {string} url1\n * @param {string} url2\n * @return {boolean}\n */\nexport function urlsMatch(url1, url2) {\n const { href } = location;\n return new URL(url1, href).href === new URL(url2, href).href;\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A minimal `Event` subclass shim.\n * This doesn't *actually* subclass `Event` because not all browsers support\n * constructable `EventTarget`, and using a real `Event` will error.\n * @private\n */\nexport class WorkboxEvent {\n constructor(type, props) {\n this.type = type;\n Object.assign(this, props);\n }\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { Deferred } from 'workbox-core/_private/Deferred.js';\nimport { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { messageSW } from './messageSW.js';\nimport { WorkboxEventTarget } from './utils/WorkboxEventTarget.js';\nimport { urlsMatch } from './utils/urlsMatch.js';\nimport { WorkboxEvent } from './utils/WorkboxEvent.js';\nimport './_version.js';\n// The time a SW must be in the waiting phase before we can conclude\n// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically\n// chosen, but it seems to avoid false positives in my testing.\nconst WAITING_TIMEOUT_DURATION = 200;\n// The amount of time after a registration that we can reasonably conclude\n// that the registration didn't trigger an update.\nconst REGISTRATION_TIMEOUT_DURATION = 60000;\n// The de facto standard message that a service worker should be listening for\n// to trigger a call to skipWaiting().\nconst SKIP_WAITING_MESSAGE = { type: 'SKIP_WAITING' };\n/**\n * A class to aid in handling service worker registration, updates, and\n * reacting to service worker lifecycle events.\n *\n * @fires {@link workbox-window.Workbox#message}\n * @fires {@link workbox-window.Workbox#installed}\n * @fires {@link workbox-window.Workbox#waiting}\n * @fires {@link workbox-window.Workbox#controlling}\n * @fires {@link workbox-window.Workbox#activated}\n * @fires {@link workbox-window.Workbox#redundant}\n * @memberof workbox-window\n */\nclass Workbox extends WorkboxEventTarget {\n /**\n * Creates a new Workbox instance with a script URL and service worker\n * options. The script URL and options are the same as those used when\n * calling [navigator.serviceWorker.register(scriptURL, options)](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).\n *\n * @param {string|TrustedScriptURL} scriptURL The service worker script\n * associated with this instance. Using a\n * [`TrustedScriptURL`](https://web.dev/trusted-types/) is supported.\n * @param {Object} [registerOptions] The service worker options associated\n * with this instance.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n constructor(scriptURL, registerOptions = {}) {\n super();\n this._registerOptions = {};\n this._updateFoundCount = 0;\n // Deferreds we can resolve later.\n this._swDeferred = new Deferred();\n this._activeDeferred = new Deferred();\n this._controllingDeferred = new Deferred();\n this._registrationTime = 0;\n this._ownSWs = new Set();\n /**\n * @private\n */\n this._onUpdateFound = () => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const installingSW = registration.installing;\n // If the script URL passed to `navigator.serviceWorker.register()` is\n // different from the current controlling SW's script URL, we know any\n // successful registration calls will trigger an `updatefound` event.\n // But if the registered script URL is the same as the current controlling\n // SW's script URL, we'll only get an `updatefound` event if the file\n // changed since it was last registered. This can be a problem if the user\n // opens up the same page in a different tab, and that page registers\n // a SW that triggers an update. It's a problem because this page has no\n // good way of knowing whether the `updatefound` event came from the SW\n // script it registered or from a registration attempt made by a newer\n // version of the page running in another tab.\n // To minimize the possibility of a false positive, we use the logic here:\n const updateLikelyTriggeredExternally = \n // Since we enforce only calling `register()` once, and since we don't\n // add the `updatefound` event listener until the `register()` call, if\n // `_updateFoundCount` is > 0 then it means this method has already\n // been called, thus this SW must be external\n this._updateFoundCount > 0 ||\n // If the script URL of the installing SW is different from this\n // instance's script URL, we know it's definitely not from our\n // registration.\n !urlsMatch(installingSW.scriptURL, this._scriptURL.toString()) ||\n // If all of the above are false, then we use a time-based heuristic:\n // Any `updatefound` event that occurs long after our registration is\n // assumed to be external.\n performance.now() > this._registrationTime + REGISTRATION_TIMEOUT_DURATION\n ? // If any of the above are not true, we assume the update was\n // triggered by this instance.\n true\n : false;\n if (updateLikelyTriggeredExternally) {\n this._externalSW = installingSW;\n registration.removeEventListener('updatefound', this._onUpdateFound);\n }\n else {\n // If the update was not triggered externally we know the installing\n // SW is the one we registered, so we set it.\n this._sw = installingSW;\n this._ownSWs.add(installingSW);\n this._swDeferred.resolve(installingSW);\n // The `installing` state isn't something we have a dedicated\n // callback for, but we do log messages for it in development.\n if (process.env.NODE_ENV !== 'production') {\n if (navigator.serviceWorker.controller) {\n logger.log('Updated service worker found. Installing now...');\n }\n else {\n logger.log('Service worker is installing...');\n }\n }\n }\n // Increment the `updatefound` count, so future invocations of this\n // method can be sure they were triggered externally.\n ++this._updateFoundCount;\n // Add a `statechange` listener regardless of whether this update was\n // triggered externally, since we have callbacks for both.\n installingSW.addEventListener('statechange', this._onStateChange);\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onStateChange = (originalEvent) => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const sw = originalEvent.target;\n const { state } = sw;\n const isExternal = sw === this._externalSW;\n const eventProps = {\n sw,\n isExternal,\n originalEvent,\n };\n if (!isExternal && this._isUpdate) {\n eventProps.isUpdate = true;\n }\n this.dispatchEvent(new WorkboxEvent(state, eventProps));\n if (state === 'installed') {\n // This timeout is used to ignore cases where the service worker calls\n // `skipWaiting()` in the install event, thus moving it directly in the\n // activating state. (Since all service workers *must* go through the\n // waiting phase, the only way to detect `skipWaiting()` called in the\n // install event is to observe that the time spent in the waiting phase\n // is very short.)\n // NOTE: we don't need separate timeouts for the own and external SWs\n // since they can't go through these phases at the same time.\n this._waitingTimeout = self.setTimeout(() => {\n // Ensure the SW is still waiting (it may now be redundant).\n if (state === 'installed' && registration.waiting === sw) {\n this.dispatchEvent(new WorkboxEvent('waiting', eventProps));\n if (process.env.NODE_ENV !== 'production') {\n if (isExternal) {\n logger.warn('An external service worker has installed but is ' +\n 'waiting for this client to close before activating...');\n }\n else {\n logger.warn('The service worker has installed but is waiting ' +\n 'for existing clients to close before activating...');\n }\n }\n }\n }, WAITING_TIMEOUT_DURATION);\n }\n else if (state === 'activating') {\n clearTimeout(this._waitingTimeout);\n if (!isExternal) {\n this._activeDeferred.resolve(sw);\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n switch (state) {\n case 'installed':\n if (isExternal) {\n logger.warn('An external service worker has installed. ' +\n 'You may want to suggest users reload this page.');\n }\n else {\n logger.log('Registered service worker installed.');\n }\n break;\n case 'activated':\n if (isExternal) {\n logger.warn('An external service worker has activated.');\n }\n else {\n logger.log('Registered service worker activated.');\n if (sw !== navigator.serviceWorker.controller) {\n logger.warn('The registered service worker is active but ' +\n 'not yet controlling the page. Reload or run ' +\n '`clients.claim()` in the service worker.');\n }\n }\n break;\n case 'redundant':\n if (sw === this._compatibleControllingSW) {\n logger.log('Previously controlling service worker now redundant!');\n }\n else if (!isExternal) {\n logger.log('Registered service worker now redundant!');\n }\n break;\n }\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onControllerChange = (originalEvent) => {\n const sw = this._sw;\n const isExternal = sw !== navigator.serviceWorker.controller;\n // Unconditionally dispatch the controlling event, with isExternal set\n // to distinguish between controller changes due to the initial registration\n // vs. an update-check or other tab's registration.\n // See https://github.com/GoogleChrome/workbox/issues/2786\n this.dispatchEvent(new WorkboxEvent('controlling', {\n isExternal,\n originalEvent,\n sw,\n isUpdate: this._isUpdate,\n }));\n if (!isExternal) {\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Registered service worker now controlling this page.');\n }\n this._controllingDeferred.resolve(sw);\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onMessage = async (originalEvent) => {\n // Can't change type 'any' of data.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const { data, ports, source } = originalEvent;\n // Wait until there's an \"own\" service worker. This is used to buffer\n // `message` events that may be received prior to calling `register()`.\n await this.getSW();\n // If the service worker that sent the message is in the list of own\n // service workers for this instance, dispatch a `message` event.\n // NOTE: we check for all previously owned service workers rather than\n // just the current one because some messages (e.g. cache updates) use\n // a timeout when sent and may be delayed long enough for a service worker\n // update to be found.\n if (this._ownSWs.has(source)) {\n this.dispatchEvent(new WorkboxEvent('message', {\n // Can't change type 'any' of data.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n data,\n originalEvent,\n ports,\n sw: source,\n }));\n }\n };\n this._scriptURL = scriptURL;\n this._registerOptions = registerOptions;\n // Add a message listener immediately since messages received during\n // page load are buffered only until the DOMContentLoaded event:\n // https://github.com/GoogleChrome/workbox/issues/2202\n navigator.serviceWorker.addEventListener('message', this._onMessage);\n }\n /**\n * Registers a service worker for this instances script URL and service\n * worker options. By default this method delays registration until after\n * the window has loaded.\n *\n * @param {Object} [options]\n * @param {Function} [options.immediate=false] Setting this to true will\n * register the service worker immediately, even if the window has\n * not loaded (not recommended).\n */\n async register({ immediate = false } = {}) {\n if (process.env.NODE_ENV !== 'production') {\n if (this._registrationTime) {\n logger.error('Cannot re-register a Workbox instance after it has ' +\n 'been registered. Create a new instance instead.');\n return;\n }\n }\n if (!immediate && document.readyState !== 'complete') {\n await new Promise((res) => window.addEventListener('load', res));\n }\n // Set this flag to true if any service worker was controlling the page\n // at registration time.\n this._isUpdate = Boolean(navigator.serviceWorker.controller);\n // Before registering, attempt to determine if a SW is already controlling\n // the page, and if that SW script (and version, if specified) matches this\n // instance's script.\n this._compatibleControllingSW = this._getControllingSWIfCompatible();\n this._registration = await this._registerScript();\n // If we have a compatible controller, store the controller as the \"own\"\n // SW, resolve active/controlling deferreds and add necessary listeners.\n if (this._compatibleControllingSW) {\n this._sw = this._compatibleControllingSW;\n this._activeDeferred.resolve(this._compatibleControllingSW);\n this._controllingDeferred.resolve(this._compatibleControllingSW);\n this._compatibleControllingSW.addEventListener('statechange', this._onStateChange, { once: true });\n }\n // If there's a waiting service worker with a matching URL before the\n // `updatefound` event fires, it likely means that this site is open\n // in another tab, or the user refreshed the page (and thus the previous\n // page wasn't fully unloaded before this page started loading).\n // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting\n const waitingSW = this._registration.waiting;\n if (waitingSW &&\n urlsMatch(waitingSW.scriptURL, this._scriptURL.toString())) {\n // Store the waiting SW as the \"own\" Sw, even if it means overwriting\n // a compatible controller.\n this._sw = waitingSW;\n // Run this in the next microtask, so any code that adds an event\n // listener after awaiting `register()` will get this event.\n dontWaitFor(Promise.resolve().then(() => {\n this.dispatchEvent(new WorkboxEvent('waiting', {\n sw: waitingSW,\n wasWaitingBeforeRegister: true,\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.warn('A service worker was already waiting to activate ' +\n 'before this script was registered...');\n }\n }));\n }\n // If an \"own\" SW is already set, resolve the deferred.\n if (this._sw) {\n this._swDeferred.resolve(this._sw);\n this._ownSWs.add(this._sw);\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Successfully registered service worker.', this._scriptURL.toString());\n if (navigator.serviceWorker.controller) {\n if (this._compatibleControllingSW) {\n logger.debug('A service worker with the same script URL ' +\n 'is already controlling this page.');\n }\n else {\n logger.debug('A service worker with a different script URL is ' +\n 'currently controlling the page. The browser is now fetching ' +\n 'the new script now...');\n }\n }\n const currentPageIsOutOfScope = () => {\n const scopeURL = new URL(this._registerOptions.scope || this._scriptURL.toString(), document.baseURI);\n const scopeURLBasePath = new URL('./', scopeURL.href).pathname;\n return !location.pathname.startsWith(scopeURLBasePath);\n };\n if (currentPageIsOutOfScope()) {\n logger.warn('The current page is not in scope for the registered ' +\n 'service worker. Was this a mistake?');\n }\n }\n this._registration.addEventListener('updatefound', this._onUpdateFound);\n navigator.serviceWorker.addEventListener('controllerchange', this._onControllerChange);\n return this._registration;\n }\n /**\n * Checks for updates of the registered service worker.\n */\n async update() {\n if (!this._registration) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error('Cannot update a Workbox instance without ' +\n 'being registered. Register the Workbox instance first.');\n }\n return;\n }\n // Try to update registration\n await this._registration.update();\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is active. If a service worker was already controlling at registration\n * time then it will resolve to that if the script URLs (and optionally\n * script versions) match, otherwise it will wait until an update is found\n * and activates.\n *\n * @return {Promise}\n */\n get active() {\n return this._activeDeferred.promise;\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is controlling the page. If a service worker was already controlling at\n * registration time then it will resolve to that if the script URLs (and\n * optionally script versions) match, otherwise it will wait until an update\n * is found and starts controlling the page.\n * Note: the first time a service worker is installed it will active but\n * not start controlling the page unless `clients.claim()` is called in the\n * service worker.\n *\n * @return {Promise}\n */\n get controlling() {\n return this._controllingDeferred.promise;\n }\n /**\n * Resolves with a reference to a service worker that matches the script URL\n * of this instance, as soon as it's available.\n *\n * If, at registration time, there's already an active or waiting service\n * worker with a matching script URL, it will be used (with the waiting\n * service worker taking precedence over the active service worker if both\n * match, since the waiting service worker would have been registered more\n * recently).\n * If there's no matching active or waiting service worker at registration\n * time then the promise will not resolve until an update is found and starts\n * installing, at which point the installing service worker is used.\n *\n * @return {Promise}\n */\n getSW() {\n // If `this._sw` is set, resolve with that as we want `getSW()` to\n // return the correct (new) service worker if an update is found.\n return this._sw !== undefined\n ? Promise.resolve(this._sw)\n : this._swDeferred.promise;\n }\n /**\n * Sends the passed data object to the service worker registered by this\n * instance (via {@link workbox-window.Workbox#getSW}) and resolves\n * with a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will never\n * resolve.\n *\n * @param {Object} data An object to send to the service worker\n * @return {Promise}\n */\n // We might be able to change the 'data' type to Record in the future.\n // eslint-disable-next-line @typescript-eslint/ban-types\n async messageSW(data) {\n const sw = await this.getSW();\n return messageSW(sw, data);\n }\n /**\n * Sends a `{type: 'SKIP_WAITING'}` message to the service worker that's\n * currently in the `waiting` state associated with the current registration.\n *\n * If there is no current registration or no service worker is `waiting`,\n * calling this will have no effect.\n */\n messageSkipWaiting() {\n if (this._registration && this._registration.waiting) {\n void messageSW(this._registration.waiting, SKIP_WAITING_MESSAGE);\n }\n }\n /**\n * Checks for a service worker already controlling the page and returns\n * it if its script URL matches.\n *\n * @private\n * @return {ServiceWorker|undefined}\n */\n _getControllingSWIfCompatible() {\n const controller = navigator.serviceWorker.controller;\n if (controller &&\n urlsMatch(controller.scriptURL, this._scriptURL.toString())) {\n return controller;\n }\n else {\n return undefined;\n }\n }\n /**\n * Registers a service worker for this instances script URL and register\n * options and tracks the time registration was complete.\n *\n * @private\n */\n async _registerScript() {\n try {\n // this._scriptURL may be a TrustedScriptURL, but there's no support for\n // passing that to register() in lib.dom right now.\n // https://github.com/GoogleChrome/workbox/issues/2855\n const reg = await navigator.serviceWorker.register(this._scriptURL, this._registerOptions);\n // Keep track of when registration happened, so it can be used in the\n // `this._onUpdateFound` heuristic. Also use the presence of this\n // property as a way to see if `.register()` has been called.\n this._registrationTime = performance.now();\n return reg;\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(error);\n }\n // Re-throw the error.\n throw error;\n }\n }\n}\nexport { Workbox };\n// The jsdoc comments below outline the events this instance may dispatch:\n// -----------------------------------------------------------------------\n/**\n * The `message` event is dispatched any time a `postMessage` is received.\n *\n * @event workbox-window.Workbox#message\n * @type {WorkboxEvent}\n * @property {*} data The `data` property from the original `message` event.\n * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}\n * event.\n * @property {string} type `message`.\n * @property {MessagePort[]} ports The `ports` value from `originalEvent`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `installed` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}\n * changes to `installed`.\n *\n * Then can happen either the very first time a service worker is installed,\n * or after an update to the current service worker is found. In the case\n * of an update being found, the event's `isUpdate` property will be `true`.\n *\n * @event workbox-window.Workbox#installed\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `installed`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `waiting` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed` and then doesn't immediately change to `activating`.\n * It may also be dispatched if a service worker with the same\n * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * was already waiting when the {@link workbox-window.Workbox#register}\n * method was called.\n *\n * @event workbox-window.Workbox#waiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event|undefined} originalEvent The original\n * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event, or `undefined` in the case where the service worker was waiting\n * to before `.register()` was called.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with\n * a matching `scriptURL` was already waiting when this `Workbox`\n * instance called `register()`.\n * @property {string} type `waiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `controlling` event is dispatched if a\n * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}\n * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}\n * matches the `scriptURL` of the `Workbox` instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.\n *\n * @event workbox-window.Workbox#controlling\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this service worker was registered.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `controlling`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `activated` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}\n * changes to `activated`.\n *\n * @event workbox-window.Workbox#activated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `activated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `redundant` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `redundant`.\n *\n * @event workbox-window.Workbox#redundant\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `redundant`.\n * @property {Workbox} target The `Workbox` instance.\n */\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A helper function that prevents a promise from being flagged as unused.\n *\n * @private\n **/\nexport function dontWaitFor(promise) {\n // Effective no-op.\n void promise.then(() => { });\n}\n"],"names":["self","_","e","messageSW","sw","data","Promise","resolve","messageChannel","MessageChannel","port1","onmessage","event","postMessage","port2","Deferred","constructor","this","promise","reject","WorkboxEventTarget","_eventListenerRegistry","Map","addEventListener","type","listener","_getEventListenersByType","add","removeEventListener","delete","dispatchEvent","target","listeners","has","set","Set","get","urlsMatch","url1","url2","href","location","URL","WorkboxEvent","props","Object","assign","SKIP_WAITING_MESSAGE","Workbox","scriptURL","registerOptions","super","_registerOptions","_updateFoundCount","_swDeferred","_activeDeferred","_controllingDeferred","_registrationTime","_ownSWs","_onUpdateFound","registration","_registration","installingSW","installing","_scriptURL","toString","performance","now","_externalSW","_sw","_onStateChange","originalEvent","state","isExternal","eventProps","_isUpdate","isUpdate","_waitingTimeout","setTimeout","waiting","clearTimeout","_onControllerChange","navigator","serviceWorker","controller","_onMessage","async","ports","source","getSW","immediate","document","readyState","res","window","Boolean","_compatibleControllingSW","_getControllingSWIfCompatible","_registerScript","once","waitingSW","then","wasWaitingBeforeRegister","update","active","controlling","undefined","messageSkipWaiting","reg","register","error"],"mappings":"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"}
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-window/build/workbox-window.prod.umd.js b/tools/ui/node_modules/workbox-window/build/workbox-window.prod.umd.js
new file mode 100644
index 0000000000000000000000000000000000000000..9a83aba388c4af5b8cc40b62ca8d84f503634afd
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/build/workbox-window.prod.umd.js
@@ -0,0 +1,2 @@
+!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).workbox={})}(this,(function(n){"use strict";try{self["workbox:window:7.4.0"]&&_()}catch(n){}function t(n,t){return new Promise((function(r){var e=new MessageChannel;e.port1.onmessage=function(n){r(n.data)},n.postMessage(t,[e.port2])}))}function r(n,t){(null==t||t>n.length)&&(t=n.length);for(var r=0,e=Array(t);r=n.length?{done:!0}:{done:!1,value:n[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(n,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,t){return n.__proto__=t,n},o(n,t)}function u(n){var t=function(n,t){if("object"!=typeof n||!n)return n;var r=n[Symbol.toPrimitive];if(void 0!==r){var e=r.call(n,t);if("object"!=typeof e)return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n,"string");return"symbol"==typeof t?t:t+""}try{self["workbox:core:7.4.0"]&&_()}catch(n){}var a=function(){var n=this;this.promise=new Promise((function(t,r){n.resolve=t,n.reject=r}))};function c(n,t){var r=location.href;return new URL(n,r).href===new URL(t,r).href}var f=function(n,t){this.type=n,Object.assign(this,t)};function s(n,t,r){return n&&n.then||(n=Promise.resolve(n)),t?n.then(t):n}function v(){}var h={type:"SKIP_WAITING"};function l(n,t){return n&&n.then?n.then(v):Promise.resolve()}var d=function(n){function r(t,r){var e,i;return void 0===r&&(r={}),(e=n.call(this)||this).nn={},e.tn=0,e.rn=new a,e.en=new a,e.on=new a,e.un=0,e.an=new Set,e.cn=function(){var n=e.fn,t=n.installing;e.tn>0||!c(t.scriptURL,e.sn.toString())||performance.now()>e.un+6e4?(e.vn=t,n.removeEventListener("updatefound",e.cn)):(e.hn=t,e.an.add(t),e.rn.resolve(t)),++e.tn,t.addEventListener("statechange",e.ln)},e.ln=function(n){var t=e.fn,r=n.target,i=r.state,o=r===e.vn,u={sw:r,isExternal:o,originalEvent:n};!o&&e.dn&&(u.isUpdate=!0),e.dispatchEvent(new f(i,u)),"installed"===i?e.mn=self.setTimeout((function(){"installed"===i&&t.waiting===r&&e.dispatchEvent(new f("waiting",u))}),200):"activating"===i&&(clearTimeout(e.mn),o||e.en.resolve(r))},e.yn=function(n){var t=e.hn,r=t!==navigator.serviceWorker.controller;e.dispatchEvent(new f("controlling",{isExternal:r,originalEvent:n,sw:t,isUpdate:e.dn})),r||e.on.resolve(t)},e.wn=(i=function(n){var t=n.data,r=n.ports,i=n.source;return s(e.getSW(),(function(){e.an.has(i)&&e.dispatchEvent(new f("message",{data:t,originalEvent:n,ports:r,sw:i}))}))},function(){for(var n=[],t=0;t}\n * @memberof workbox-window\n */\n// Better not change type of data.\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction messageSW(sw, data) {\n return new Promise((resolve) => {\n const messageChannel = new MessageChannel();\n messageChannel.port1.onmessage = (event) => {\n resolve(event.data);\n };\n sw.postMessage(data, [messageChannel.port2]);\n });\n}\nexport { messageSW };\n","\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:core:7.4.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * The Deferred class composes Promises in a way that allows for them to be\n * resolved or rejected from outside the constructor. In most cases promises\n * should be used directly, but Deferreds can be necessary when the logic to\n * resolve a promise must be separate.\n *\n * @private\n */\nclass Deferred {\n /**\n * Creates a promise and exposes its resolve and reject functions as methods.\n */\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n}\nexport { Deferred };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * Returns true if two URLs have the same `.href` property. The URLS can be\n * relative, and if they are the current location href is used to resolve URLs.\n *\n * @private\n * @param {string} url1\n * @param {string} url2\n * @return {boolean}\n */\nexport function urlsMatch(url1, url2) {\n const { href } = location;\n return new URL(url1, href).href === new URL(url2, href).href;\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A minimal `Event` subclass shim.\n * This doesn't *actually* subclass `Event` because not all browsers support\n * constructable `EventTarget`, and using a real `Event` will error.\n * @private\n */\nexport class WorkboxEvent {\n constructor(type, props) {\n this.type = type;\n Object.assign(this, props);\n }\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { Deferred } from 'workbox-core/_private/Deferred.js';\nimport { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { messageSW } from './messageSW.js';\nimport { WorkboxEventTarget } from './utils/WorkboxEventTarget.js';\nimport { urlsMatch } from './utils/urlsMatch.js';\nimport { WorkboxEvent } from './utils/WorkboxEvent.js';\nimport './_version.js';\n// The time a SW must be in the waiting phase before we can conclude\n// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically\n// chosen, but it seems to avoid false positives in my testing.\nconst WAITING_TIMEOUT_DURATION = 200;\n// The amount of time after a registration that we can reasonably conclude\n// that the registration didn't trigger an update.\nconst REGISTRATION_TIMEOUT_DURATION = 60000;\n// The de facto standard message that a service worker should be listening for\n// to trigger a call to skipWaiting().\nconst SKIP_WAITING_MESSAGE = { type: 'SKIP_WAITING' };\n/**\n * A class to aid in handling service worker registration, updates, and\n * reacting to service worker lifecycle events.\n *\n * @fires {@link workbox-window.Workbox#message}\n * @fires {@link workbox-window.Workbox#installed}\n * @fires {@link workbox-window.Workbox#waiting}\n * @fires {@link workbox-window.Workbox#controlling}\n * @fires {@link workbox-window.Workbox#activated}\n * @fires {@link workbox-window.Workbox#redundant}\n * @memberof workbox-window\n */\nclass Workbox extends WorkboxEventTarget {\n /**\n * Creates a new Workbox instance with a script URL and service worker\n * options. The script URL and options are the same as those used when\n * calling [navigator.serviceWorker.register(scriptURL, options)](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).\n *\n * @param {string|TrustedScriptURL} scriptURL The service worker script\n * associated with this instance. Using a\n * [`TrustedScriptURL`](https://web.dev/trusted-types/) is supported.\n * @param {Object} [registerOptions] The service worker options associated\n * with this instance.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n constructor(scriptURL, registerOptions = {}) {\n super();\n this._registerOptions = {};\n this._updateFoundCount = 0;\n // Deferreds we can resolve later.\n this._swDeferred = new Deferred();\n this._activeDeferred = new Deferred();\n this._controllingDeferred = new Deferred();\n this._registrationTime = 0;\n this._ownSWs = new Set();\n /**\n * @private\n */\n this._onUpdateFound = () => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const installingSW = registration.installing;\n // If the script URL passed to `navigator.serviceWorker.register()` is\n // different from the current controlling SW's script URL, we know any\n // successful registration calls will trigger an `updatefound` event.\n // But if the registered script URL is the same as the current controlling\n // SW's script URL, we'll only get an `updatefound` event if the file\n // changed since it was last registered. This can be a problem if the user\n // opens up the same page in a different tab, and that page registers\n // a SW that triggers an update. It's a problem because this page has no\n // good way of knowing whether the `updatefound` event came from the SW\n // script it registered or from a registration attempt made by a newer\n // version of the page running in another tab.\n // To minimize the possibility of a false positive, we use the logic here:\n const updateLikelyTriggeredExternally = \n // Since we enforce only calling `register()` once, and since we don't\n // add the `updatefound` event listener until the `register()` call, if\n // `_updateFoundCount` is > 0 then it means this method has already\n // been called, thus this SW must be external\n this._updateFoundCount > 0 ||\n // If the script URL of the installing SW is different from this\n // instance's script URL, we know it's definitely not from our\n // registration.\n !urlsMatch(installingSW.scriptURL, this._scriptURL.toString()) ||\n // If all of the above are false, then we use a time-based heuristic:\n // Any `updatefound` event that occurs long after our registration is\n // assumed to be external.\n performance.now() > this._registrationTime + REGISTRATION_TIMEOUT_DURATION\n ? // If any of the above are not true, we assume the update was\n // triggered by this instance.\n true\n : false;\n if (updateLikelyTriggeredExternally) {\n this._externalSW = installingSW;\n registration.removeEventListener('updatefound', this._onUpdateFound);\n }\n else {\n // If the update was not triggered externally we know the installing\n // SW is the one we registered, so we set it.\n this._sw = installingSW;\n this._ownSWs.add(installingSW);\n this._swDeferred.resolve(installingSW);\n // The `installing` state isn't something we have a dedicated\n // callback for, but we do log messages for it in development.\n if (process.env.NODE_ENV !== 'production') {\n if (navigator.serviceWorker.controller) {\n logger.log('Updated service worker found. Installing now...');\n }\n else {\n logger.log('Service worker is installing...');\n }\n }\n }\n // Increment the `updatefound` count, so future invocations of this\n // method can be sure they were triggered externally.\n ++this._updateFoundCount;\n // Add a `statechange` listener regardless of whether this update was\n // triggered externally, since we have callbacks for both.\n installingSW.addEventListener('statechange', this._onStateChange);\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onStateChange = (originalEvent) => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const sw = originalEvent.target;\n const { state } = sw;\n const isExternal = sw === this._externalSW;\n const eventProps = {\n sw,\n isExternal,\n originalEvent,\n };\n if (!isExternal && this._isUpdate) {\n eventProps.isUpdate = true;\n }\n this.dispatchEvent(new WorkboxEvent(state, eventProps));\n if (state === 'installed') {\n // This timeout is used to ignore cases where the service worker calls\n // `skipWaiting()` in the install event, thus moving it directly in the\n // activating state. (Since all service workers *must* go through the\n // waiting phase, the only way to detect `skipWaiting()` called in the\n // install event is to observe that the time spent in the waiting phase\n // is very short.)\n // NOTE: we don't need separate timeouts for the own and external SWs\n // since they can't go through these phases at the same time.\n this._waitingTimeout = self.setTimeout(() => {\n // Ensure the SW is still waiting (it may now be redundant).\n if (state === 'installed' && registration.waiting === sw) {\n this.dispatchEvent(new WorkboxEvent('waiting', eventProps));\n if (process.env.NODE_ENV !== 'production') {\n if (isExternal) {\n logger.warn('An external service worker has installed but is ' +\n 'waiting for this client to close before activating...');\n }\n else {\n logger.warn('The service worker has installed but is waiting ' +\n 'for existing clients to close before activating...');\n }\n }\n }\n }, WAITING_TIMEOUT_DURATION);\n }\n else if (state === 'activating') {\n clearTimeout(this._waitingTimeout);\n if (!isExternal) {\n this._activeDeferred.resolve(sw);\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n switch (state) {\n case 'installed':\n if (isExternal) {\n logger.warn('An external service worker has installed. ' +\n 'You may want to suggest users reload this page.');\n }\n else {\n logger.log('Registered service worker installed.');\n }\n break;\n case 'activated':\n if (isExternal) {\n logger.warn('An external service worker has activated.');\n }\n else {\n logger.log('Registered service worker activated.');\n if (sw !== navigator.serviceWorker.controller) {\n logger.warn('The registered service worker is active but ' +\n 'not yet controlling the page. Reload or run ' +\n '`clients.claim()` in the service worker.');\n }\n }\n break;\n case 'redundant':\n if (sw === this._compatibleControllingSW) {\n logger.log('Previously controlling service worker now redundant!');\n }\n else if (!isExternal) {\n logger.log('Registered service worker now redundant!');\n }\n break;\n }\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onControllerChange = (originalEvent) => {\n const sw = this._sw;\n const isExternal = sw !== navigator.serviceWorker.controller;\n // Unconditionally dispatch the controlling event, with isExternal set\n // to distinguish between controller changes due to the initial registration\n // vs. an update-check or other tab's registration.\n // See https://github.com/GoogleChrome/workbox/issues/2786\n this.dispatchEvent(new WorkboxEvent('controlling', {\n isExternal,\n originalEvent,\n sw,\n isUpdate: this._isUpdate,\n }));\n if (!isExternal) {\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Registered service worker now controlling this page.');\n }\n this._controllingDeferred.resolve(sw);\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onMessage = async (originalEvent) => {\n // Can't change type 'any' of data.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const { data, ports, source } = originalEvent;\n // Wait until there's an \"own\" service worker. This is used to buffer\n // `message` events that may be received prior to calling `register()`.\n await this.getSW();\n // If the service worker that sent the message is in the list of own\n // service workers for this instance, dispatch a `message` event.\n // NOTE: we check for all previously owned service workers rather than\n // just the current one because some messages (e.g. cache updates) use\n // a timeout when sent and may be delayed long enough for a service worker\n // update to be found.\n if (this._ownSWs.has(source)) {\n this.dispatchEvent(new WorkboxEvent('message', {\n // Can't change type 'any' of data.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n data,\n originalEvent,\n ports,\n sw: source,\n }));\n }\n };\n this._scriptURL = scriptURL;\n this._registerOptions = registerOptions;\n // Add a message listener immediately since messages received during\n // page load are buffered only until the DOMContentLoaded event:\n // https://github.com/GoogleChrome/workbox/issues/2202\n navigator.serviceWorker.addEventListener('message', this._onMessage);\n }\n /**\n * Registers a service worker for this instances script URL and service\n * worker options. By default this method delays registration until after\n * the window has loaded.\n *\n * @param {Object} [options]\n * @param {Function} [options.immediate=false] Setting this to true will\n * register the service worker immediately, even if the window has\n * not loaded (not recommended).\n */\n async register({ immediate = false } = {}) {\n if (process.env.NODE_ENV !== 'production') {\n if (this._registrationTime) {\n logger.error('Cannot re-register a Workbox instance after it has ' +\n 'been registered. Create a new instance instead.');\n return;\n }\n }\n if (!immediate && document.readyState !== 'complete') {\n await new Promise((res) => window.addEventListener('load', res));\n }\n // Set this flag to true if any service worker was controlling the page\n // at registration time.\n this._isUpdate = Boolean(navigator.serviceWorker.controller);\n // Before registering, attempt to determine if a SW is already controlling\n // the page, and if that SW script (and version, if specified) matches this\n // instance's script.\n this._compatibleControllingSW = this._getControllingSWIfCompatible();\n this._registration = await this._registerScript();\n // If we have a compatible controller, store the controller as the \"own\"\n // SW, resolve active/controlling deferreds and add necessary listeners.\n if (this._compatibleControllingSW) {\n this._sw = this._compatibleControllingSW;\n this._activeDeferred.resolve(this._compatibleControllingSW);\n this._controllingDeferred.resolve(this._compatibleControllingSW);\n this._compatibleControllingSW.addEventListener('statechange', this._onStateChange, { once: true });\n }\n // If there's a waiting service worker with a matching URL before the\n // `updatefound` event fires, it likely means that this site is open\n // in another tab, or the user refreshed the page (and thus the previous\n // page wasn't fully unloaded before this page started loading).\n // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting\n const waitingSW = this._registration.waiting;\n if (waitingSW &&\n urlsMatch(waitingSW.scriptURL, this._scriptURL.toString())) {\n // Store the waiting SW as the \"own\" Sw, even if it means overwriting\n // a compatible controller.\n this._sw = waitingSW;\n // Run this in the next microtask, so any code that adds an event\n // listener after awaiting `register()` will get this event.\n dontWaitFor(Promise.resolve().then(() => {\n this.dispatchEvent(new WorkboxEvent('waiting', {\n sw: waitingSW,\n wasWaitingBeforeRegister: true,\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.warn('A service worker was already waiting to activate ' +\n 'before this script was registered...');\n }\n }));\n }\n // If an \"own\" SW is already set, resolve the deferred.\n if (this._sw) {\n this._swDeferred.resolve(this._sw);\n this._ownSWs.add(this._sw);\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Successfully registered service worker.', this._scriptURL.toString());\n if (navigator.serviceWorker.controller) {\n if (this._compatibleControllingSW) {\n logger.debug('A service worker with the same script URL ' +\n 'is already controlling this page.');\n }\n else {\n logger.debug('A service worker with a different script URL is ' +\n 'currently controlling the page. The browser is now fetching ' +\n 'the new script now...');\n }\n }\n const currentPageIsOutOfScope = () => {\n const scopeURL = new URL(this._registerOptions.scope || this._scriptURL.toString(), document.baseURI);\n const scopeURLBasePath = new URL('./', scopeURL.href).pathname;\n return !location.pathname.startsWith(scopeURLBasePath);\n };\n if (currentPageIsOutOfScope()) {\n logger.warn('The current page is not in scope for the registered ' +\n 'service worker. Was this a mistake?');\n }\n }\n this._registration.addEventListener('updatefound', this._onUpdateFound);\n navigator.serviceWorker.addEventListener('controllerchange', this._onControllerChange);\n return this._registration;\n }\n /**\n * Checks for updates of the registered service worker.\n */\n async update() {\n if (!this._registration) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error('Cannot update a Workbox instance without ' +\n 'being registered. Register the Workbox instance first.');\n }\n return;\n }\n // Try to update registration\n await this._registration.update();\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is active. If a service worker was already controlling at registration\n * time then it will resolve to that if the script URLs (and optionally\n * script versions) match, otherwise it will wait until an update is found\n * and activates.\n *\n * @return {Promise}\n */\n get active() {\n return this._activeDeferred.promise;\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is controlling the page. If a service worker was already controlling at\n * registration time then it will resolve to that if the script URLs (and\n * optionally script versions) match, otherwise it will wait until an update\n * is found and starts controlling the page.\n * Note: the first time a service worker is installed it will active but\n * not start controlling the page unless `clients.claim()` is called in the\n * service worker.\n *\n * @return {Promise}\n */\n get controlling() {\n return this._controllingDeferred.promise;\n }\n /**\n * Resolves with a reference to a service worker that matches the script URL\n * of this instance, as soon as it's available.\n *\n * If, at registration time, there's already an active or waiting service\n * worker with a matching script URL, it will be used (with the waiting\n * service worker taking precedence over the active service worker if both\n * match, since the waiting service worker would have been registered more\n * recently).\n * If there's no matching active or waiting service worker at registration\n * time then the promise will not resolve until an update is found and starts\n * installing, at which point the installing service worker is used.\n *\n * @return {Promise}\n */\n getSW() {\n // If `this._sw` is set, resolve with that as we want `getSW()` to\n // return the correct (new) service worker if an update is found.\n return this._sw !== undefined\n ? Promise.resolve(this._sw)\n : this._swDeferred.promise;\n }\n /**\n * Sends the passed data object to the service worker registered by this\n * instance (via {@link workbox-window.Workbox#getSW}) and resolves\n * with a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will never\n * resolve.\n *\n * @param {Object} data An object to send to the service worker\n * @return {Promise}\n */\n // We might be able to change the 'data' type to Record in the future.\n // eslint-disable-next-line @typescript-eslint/ban-types\n async messageSW(data) {\n const sw = await this.getSW();\n return messageSW(sw, data);\n }\n /**\n * Sends a `{type: 'SKIP_WAITING'}` message to the service worker that's\n * currently in the `waiting` state associated with the current registration.\n *\n * If there is no current registration or no service worker is `waiting`,\n * calling this will have no effect.\n */\n messageSkipWaiting() {\n if (this._registration && this._registration.waiting) {\n void messageSW(this._registration.waiting, SKIP_WAITING_MESSAGE);\n }\n }\n /**\n * Checks for a service worker already controlling the page and returns\n * it if its script URL matches.\n *\n * @private\n * @return {ServiceWorker|undefined}\n */\n _getControllingSWIfCompatible() {\n const controller = navigator.serviceWorker.controller;\n if (controller &&\n urlsMatch(controller.scriptURL, this._scriptURL.toString())) {\n return controller;\n }\n else {\n return undefined;\n }\n }\n /**\n * Registers a service worker for this instances script URL and register\n * options and tracks the time registration was complete.\n *\n * @private\n */\n async _registerScript() {\n try {\n // this._scriptURL may be a TrustedScriptURL, but there's no support for\n // passing that to register() in lib.dom right now.\n // https://github.com/GoogleChrome/workbox/issues/2855\n const reg = await navigator.serviceWorker.register(this._scriptURL, this._registerOptions);\n // Keep track of when registration happened, so it can be used in the\n // `this._onUpdateFound` heuristic. Also use the presence of this\n // property as a way to see if `.register()` has been called.\n this._registrationTime = performance.now();\n return reg;\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(error);\n }\n // Re-throw the error.\n throw error;\n }\n }\n}\nexport { Workbox };\n// The jsdoc comments below outline the events this instance may dispatch:\n// -----------------------------------------------------------------------\n/**\n * The `message` event is dispatched any time a `postMessage` is received.\n *\n * @event workbox-window.Workbox#message\n * @type {WorkboxEvent}\n * @property {*} data The `data` property from the original `message` event.\n * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}\n * event.\n * @property {string} type `message`.\n * @property {MessagePort[]} ports The `ports` value from `originalEvent`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `installed` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}\n * changes to `installed`.\n *\n * Then can happen either the very first time a service worker is installed,\n * or after an update to the current service worker is found. In the case\n * of an update being found, the event's `isUpdate` property will be `true`.\n *\n * @event workbox-window.Workbox#installed\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `installed`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `waiting` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed` and then doesn't immediately change to `activating`.\n * It may also be dispatched if a service worker with the same\n * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * was already waiting when the {@link workbox-window.Workbox#register}\n * method was called.\n *\n * @event workbox-window.Workbox#waiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event|undefined} originalEvent The original\n * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event, or `undefined` in the case where the service worker was waiting\n * to before `.register()` was called.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with\n * a matching `scriptURL` was already waiting when this `Workbox`\n * instance called `register()`.\n * @property {string} type `waiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `controlling` event is dispatched if a\n * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}\n * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}\n * matches the `scriptURL` of the `Workbox` instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.\n *\n * @event workbox-window.Workbox#controlling\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this service worker was registered.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `controlling`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `activated` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}\n * changes to `activated`.\n *\n * @event workbox-window.Workbox#activated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} isExternal True if this event is associated\n * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.\n * @property {string} type `activated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `redundant` event is dispatched if the state of a\n * {@link workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `redundant`.\n *\n * @event workbox-window.Workbox#redundant\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `redundant`.\n * @property {Workbox} target The `Workbox` instance.\n */\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A helper function that prevents a promise from being flagged as unused.\n *\n * @private\n **/\nexport function dontWaitFor(promise) {\n // Effective no-op.\n void promise.then(() => { });\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n/**\n * A minimal `EventTarget` shim.\n * This is necessary because not all browsers support constructable\n * `EventTarget`, so using a real `EventTarget` will error.\n * @private\n */\nexport class WorkboxEventTarget {\n constructor() {\n this._eventListenerRegistry = new Map();\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n addEventListener(type, listener) {\n const foo = this._getEventListenersByType(type);\n foo.add(listener);\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n removeEventListener(type, listener) {\n this._getEventListenersByType(type).delete(listener);\n }\n /**\n * @param {Object} event\n * @private\n */\n dispatchEvent(event) {\n event.target = this;\n const listeners = this._getEventListenersByType(event.type);\n for (const listener of listeners) {\n listener(event);\n }\n }\n /**\n * Returns a Set of listeners associated with the passed event type.\n * If no handlers have been registered, an empty Set is returned.\n *\n * @param {string} type The event type.\n * @return {Set} An array of handler functions.\n * @private\n */\n _getEventListenersByType(type) {\n if (!this._eventListenerRegistry.has(type)) {\n this._eventListenerRegistry.set(type, new Set());\n }\n return this._eventListenerRegistry.get(type);\n }\n}\n"],"names":["self","_","e","messageSW","sw","data","Promise","resolve","messageChannel","MessageChannel","port1","onmessage","event","postMessage","port2","Deferred","_this","this","promise","reject","urlsMatch","url1","url2","href","location","URL","WorkboxEvent","type","props","Object","assign","_await","value","then","direct","_empty","SKIP_WAITING_MESSAGE","_awaitIgnored","Workbox","_WorkboxEventTarget","scriptURL","registerOptions","f","call","_registerOptions","_updateFoundCount","_swDeferred","_activeDeferred","_controllingDeferred","_registrationTime","_ownSWs","Set","_onUpdateFound","registration","_registration","installingSW","installing","_scriptURL","toString","performance","now","_externalSW","removeEventListener","_sw","add","addEventListener","_onStateChange","originalEvent","target","state","isExternal","eventProps","_isUpdate","isUpdate","dispatchEvent","_waitingTimeout","setTimeout","waiting","clearTimeout","_onControllerChange","navigator","serviceWorker","controller","_onMessage","ports","source","getSW","has","args","i","arguments","length","apply","_proto","prototype","register","_temp","_ref$immediate","immediate","_this2","body","result","_invoke","document","readyState","res","window","Boolean","_compatibleControllingSW","_getControllingSWIfCompatible","_registerScript","_this2$_registerScrip","once","waitingSW","wasWaitingBeforeRegister","update","undefined","messageSkipWaiting","_this5","recover","_catch","reg","error","_createClass","key","get","WorkboxEventTarget","_eventListenerRegistry","Map","listener","_getEventListenersByType","delete","_step","_iterator","_createForOfIteratorHelperLoose","done","set"],"mappings":"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"}
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-window/index.d.ts b/tools/ui/node_modules/workbox-window/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..877b8d4028c66e9dc50b94ac7e57dabac8994c80
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/index.d.ts
@@ -0,0 +1,8 @@
+import { messageSW } from './messageSW.js';
+import { Workbox } from './Workbox.js';
+import './_version.js';
+/**
+ * @module workbox-window
+ */
+export { messageSW, Workbox };
+export * from './utils/WorkboxEvent.js';
diff --git a/tools/ui/node_modules/workbox-window/index.js b/tools/ui/node_modules/workbox-window/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..ad4641462c437e4d6f6798dbd3bde8ea51115772
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/index.js
@@ -0,0 +1,16 @@
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+import { messageSW } from './messageSW.js';
+import { Workbox } from './Workbox.js';
+import './_version.js';
+/**
+ * @module workbox-window
+ */
+export { messageSW, Workbox };
+// See https://github.com/GoogleChrome/workbox/issues/2770
+export * from './utils/WorkboxEvent.js';
diff --git a/tools/ui/node_modules/workbox-window/index.mjs b/tools/ui/node_modules/workbox-window/index.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..833b6a2f3226fec78490a3b7a622dc5146f94b53
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/index.mjs
@@ -0,0 +1 @@
+export * from './index.js';
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-window/messageSW.d.ts b/tools/ui/node_modules/workbox-window/messageSW.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..11f390f4a0ccbca3d1ae68f344ec39375ad7f902
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/messageSW.d.ts
@@ -0,0 +1,17 @@
+import './_version.js';
+/**
+ * Sends a data object to a service worker via `postMessage` and resolves with
+ * a response (if any).
+ *
+ * A response can be set in a message handler in the service worker by
+ * calling `event.ports[0].postMessage(...)`, which will resolve the promise
+ * returned by `messageSW()`. If no response is set, the promise will not
+ * resolve.
+ *
+ * @param {ServiceWorker} sw The service worker to send the message to.
+ * @param {Object} data An object to send to the service worker.
+ * @return {Promise}
+ * @memberof workbox-window
+ */
+declare function messageSW(sw: ServiceWorker, data: {}): Promise;
+export { messageSW };
diff --git a/tools/ui/node_modules/workbox-window/messageSW.js b/tools/ui/node_modules/workbox-window/messageSW.js
new file mode 100644
index 0000000000000000000000000000000000000000..1d627bc5ade08357739838bee0fe475a635d7b6b
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/messageSW.js
@@ -0,0 +1,34 @@
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+import './_version.js';
+/**
+ * Sends a data object to a service worker via `postMessage` and resolves with
+ * a response (if any).
+ *
+ * A response can be set in a message handler in the service worker by
+ * calling `event.ports[0].postMessage(...)`, which will resolve the promise
+ * returned by `messageSW()`. If no response is set, the promise will not
+ * resolve.
+ *
+ * @param {ServiceWorker} sw The service worker to send the message to.
+ * @param {Object} data An object to send to the service worker.
+ * @return {Promise}
+ * @memberof workbox-window
+ */
+// Better not change type of data.
+// eslint-disable-next-line @typescript-eslint/ban-types
+function messageSW(sw, data) {
+ return new Promise((resolve) => {
+ const messageChannel = new MessageChannel();
+ messageChannel.port1.onmessage = (event) => {
+ resolve(event.data);
+ };
+ sw.postMessage(data, [messageChannel.port2]);
+ });
+}
+export { messageSW };
diff --git a/tools/ui/node_modules/workbox-window/messageSW.mjs b/tools/ui/node_modules/workbox-window/messageSW.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..12ac5dc26777503b45767c74d9632172d3ddb909
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/messageSW.mjs
@@ -0,0 +1 @@
+export * from './messageSW.js';
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-window/package.json b/tools/ui/node_modules/workbox-window/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..d128031cacf8cf92ee5df26e1ff05d0daf44d4f9
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/package.json
@@ -0,0 +1,34 @@
+{
+ "name": "workbox-window",
+ "version": "7.4.1",
+ "license": "MIT",
+ "author": "Google's Web DevRel Team and Google's Aurora Team",
+ "description": "Simplifies communications with Workbox packages running in the service worker",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/googlechrome/workbox.git"
+ },
+ "bugs": "https://github.com/googlechrome/workbox/issues",
+ "homepage": "https://github.com/GoogleChrome/workbox",
+ "keywords": [
+ "workbox",
+ "workboxjs",
+ "service worker",
+ "sw",
+ "window",
+ "message",
+ "postMessage"
+ ],
+ "workbox": {
+ "packageType": "window",
+ "primaryBuild": "build/workbox-window.prod.mjs"
+ },
+ "main": "build/workbox-window.prod.umd.js",
+ "module": "build/workbox-window.prod.es5.mjs",
+ "types": "index.d.ts",
+ "dependencies": {
+ "@types/trusted-types": "^2.0.2",
+ "workbox-core": "7.4.1"
+ },
+ "gitHead": "62b9d8ba8eb3c1a2ab8aac9d84c90cda7865d6a3"
+}
diff --git a/tools/ui/node_modules/workbox-window/src/Workbox.ts b/tools/ui/node_modules/workbox-window/src/Workbox.ts
new file mode 100644
index 0000000000000000000000000000000000000000..b43baeef3221763e5aa5e304f8a9147db7d52ca4
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/src/Workbox.ts
@@ -0,0 +1,740 @@
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import {Deferred} from 'workbox-core/_private/Deferred.js';
+import {dontWaitFor} from 'workbox-core/_private/dontWaitFor.js';
+import {logger} from 'workbox-core/_private/logger.js';
+import {TrustedScriptURL} from 'trusted-types/lib';
+
+import {messageSW} from './messageSW.js';
+import {WorkboxEventTarget} from './utils/WorkboxEventTarget.js';
+import {urlsMatch} from './utils/urlsMatch.js';
+import {WorkboxEvent, WorkboxLifecycleEventMap} from './utils/WorkboxEvent.js';
+
+import './_version.js';
+
+// The time a SW must be in the waiting phase before we can conclude
+// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically
+// chosen, but it seems to avoid false positives in my testing.
+const WAITING_TIMEOUT_DURATION = 200;
+
+// The amount of time after a registration that we can reasonably conclude
+// that the registration didn't trigger an update.
+const REGISTRATION_TIMEOUT_DURATION = 60000;
+
+// The de facto standard message that a service worker should be listening for
+// to trigger a call to skipWaiting().
+const SKIP_WAITING_MESSAGE = {type: 'SKIP_WAITING'};
+
+/**
+ * A class to aid in handling service worker registration, updates, and
+ * reacting to service worker lifecycle events.
+ *
+ * @fires {@link workbox-window.Workbox#message}
+ * @fires {@link workbox-window.Workbox#installed}
+ * @fires {@link workbox-window.Workbox#waiting}
+ * @fires {@link workbox-window.Workbox#controlling}
+ * @fires {@link workbox-window.Workbox#activated}
+ * @fires {@link workbox-window.Workbox#redundant}
+ * @memberof workbox-window
+ */
+class Workbox extends WorkboxEventTarget {
+ private readonly _scriptURL: string | TrustedScriptURL;
+ private readonly _registerOptions: RegistrationOptions = {};
+ private _updateFoundCount = 0;
+
+ // Deferreds we can resolve later.
+ private readonly _swDeferred: Deferred = new Deferred();
+ private readonly _activeDeferred: Deferred = new Deferred();
+ private readonly _controllingDeferred: Deferred =
+ new Deferred();
+
+ private _registrationTime: DOMHighResTimeStamp = 0;
+ private _isUpdate?: boolean;
+ private _compatibleControllingSW?: ServiceWorker;
+ private _registration?: ServiceWorkerRegistration;
+ private _sw?: ServiceWorker;
+ private readonly _ownSWs: Set = new Set();
+ private _externalSW?: ServiceWorker;
+ private _waitingTimeout?: number;
+
+ /**
+ * Creates a new Workbox instance with a script URL and service worker
+ * options. The script URL and options are the same as those used when
+ * calling [navigator.serviceWorker.register(scriptURL, options)](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register).
+ *
+ * @param {string|TrustedScriptURL} scriptURL The service worker script
+ * associated with this instance. Using a
+ * [`TrustedScriptURL`](https://web.dev/trusted-types/) is supported.
+ * @param {Object} [registerOptions] The service worker options associated
+ * with this instance.
+ */
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ constructor(scriptURL: string | TrustedScriptURL, registerOptions: {} = {}) {
+ super();
+
+ this._scriptURL = scriptURL;
+ this._registerOptions = registerOptions;
+
+ // Add a message listener immediately since messages received during
+ // page load are buffered only until the DOMContentLoaded event:
+ // https://github.com/GoogleChrome/workbox/issues/2202
+ navigator.serviceWorker.addEventListener('message', this._onMessage);
+ }
+
+ /**
+ * Registers a service worker for this instances script URL and service
+ * worker options. By default this method delays registration until after
+ * the window has loaded.
+ *
+ * @param {Object} [options]
+ * @param {Function} [options.immediate=false] Setting this to true will
+ * register the service worker immediately, even if the window has
+ * not loaded (not recommended).
+ */
+ async register({immediate = false} = {}): Promise<
+ ServiceWorkerRegistration | undefined
+ > {
+ if (process.env.NODE_ENV !== 'production') {
+ if (this._registrationTime) {
+ logger.error(
+ 'Cannot re-register a Workbox instance after it has ' +
+ 'been registered. Create a new instance instead.',
+ );
+ return;
+ }
+ }
+
+ if (!immediate && document.readyState !== 'complete') {
+ await new Promise((res) => window.addEventListener('load', res));
+ }
+
+ // Set this flag to true if any service worker was controlling the page
+ // at registration time.
+ this._isUpdate = Boolean(navigator.serviceWorker.controller);
+
+ // Before registering, attempt to determine if a SW is already controlling
+ // the page, and if that SW script (and version, if specified) matches this
+ // instance's script.
+ this._compatibleControllingSW = this._getControllingSWIfCompatible();
+
+ this._registration = await this._registerScript();
+
+ // If we have a compatible controller, store the controller as the "own"
+ // SW, resolve active/controlling deferreds and add necessary listeners.
+ if (this._compatibleControllingSW) {
+ this._sw = this._compatibleControllingSW;
+ this._activeDeferred.resolve(this._compatibleControllingSW);
+ this._controllingDeferred.resolve(this._compatibleControllingSW);
+
+ this._compatibleControllingSW.addEventListener(
+ 'statechange',
+ this._onStateChange,
+ {once: true},
+ );
+ }
+
+ // If there's a waiting service worker with a matching URL before the
+ // `updatefound` event fires, it likely means that this site is open
+ // in another tab, or the user refreshed the page (and thus the previous
+ // page wasn't fully unloaded before this page started loading).
+ // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting
+ const waitingSW = this._registration.waiting;
+ if (
+ waitingSW &&
+ urlsMatch(waitingSW.scriptURL, this._scriptURL.toString())
+ ) {
+ // Store the waiting SW as the "own" Sw, even if it means overwriting
+ // a compatible controller.
+ this._sw = waitingSW;
+
+ // Run this in the next microtask, so any code that adds an event
+ // listener after awaiting `register()` will get this event.
+ dontWaitFor(
+ Promise.resolve().then(() => {
+ this.dispatchEvent(
+ new WorkboxEvent('waiting', {
+ sw: waitingSW,
+ wasWaitingBeforeRegister: true,
+ }),
+ );
+ if (process.env.NODE_ENV !== 'production') {
+ logger.warn(
+ 'A service worker was already waiting to activate ' +
+ 'before this script was registered...',
+ );
+ }
+ }),
+ );
+ }
+
+ // If an "own" SW is already set, resolve the deferred.
+ if (this._sw) {
+ this._swDeferred.resolve(this._sw);
+ this._ownSWs.add(this._sw);
+ }
+
+ if (process.env.NODE_ENV !== 'production') {
+ logger.log(
+ 'Successfully registered service worker.',
+ this._scriptURL.toString(),
+ );
+
+ if (navigator.serviceWorker.controller) {
+ if (this._compatibleControllingSW) {
+ logger.debug(
+ 'A service worker with the same script URL ' +
+ 'is already controlling this page.',
+ );
+ } else {
+ logger.debug(
+ 'A service worker with a different script URL is ' +
+ 'currently controlling the page. The browser is now fetching ' +
+ 'the new script now...',
+ );
+ }
+ }
+
+ const currentPageIsOutOfScope = () => {
+ const scopeURL = new URL(
+ this._registerOptions.scope || this._scriptURL.toString(),
+ document.baseURI,
+ );
+ const scopeURLBasePath = new URL('./', scopeURL.href).pathname;
+ return !location.pathname.startsWith(scopeURLBasePath);
+ };
+ if (currentPageIsOutOfScope()) {
+ logger.warn(
+ 'The current page is not in scope for the registered ' +
+ 'service worker. Was this a mistake?',
+ );
+ }
+ }
+
+ this._registration.addEventListener('updatefound', this._onUpdateFound);
+ navigator.serviceWorker.addEventListener(
+ 'controllerchange',
+ this._onControllerChange,
+ );
+
+ return this._registration;
+ }
+
+ /**
+ * Checks for updates of the registered service worker.
+ */
+ async update(): Promise {
+ if (!this._registration) {
+ if (process.env.NODE_ENV !== 'production') {
+ logger.error(
+ 'Cannot update a Workbox instance without ' +
+ 'being registered. Register the Workbox instance first.',
+ );
+ }
+ return;
+ }
+
+ // Try to update registration
+ await this._registration.update();
+ }
+
+ /**
+ * Resolves to the service worker registered by this instance as soon as it
+ * is active. If a service worker was already controlling at registration
+ * time then it will resolve to that if the script URLs (and optionally
+ * script versions) match, otherwise it will wait until an update is found
+ * and activates.
+ *
+ * @return {Promise}
+ */
+ get active(): Promise {
+ return this._activeDeferred.promise;
+ }
+
+ /**
+ * Resolves to the service worker registered by this instance as soon as it
+ * is controlling the page. If a service worker was already controlling at
+ * registration time then it will resolve to that if the script URLs (and
+ * optionally script versions) match, otherwise it will wait until an update
+ * is found and starts controlling the page.
+ * Note: the first time a service worker is installed it will active but
+ * not start controlling the page unless `clients.claim()` is called in the
+ * service worker.
+ *
+ * @return {Promise}
+ */
+ get controlling(): Promise {
+ return this._controllingDeferred.promise;
+ }
+
+ /**
+ * Resolves with a reference to a service worker that matches the script URL
+ * of this instance, as soon as it's available.
+ *
+ * If, at registration time, there's already an active or waiting service
+ * worker with a matching script URL, it will be used (with the waiting
+ * service worker taking precedence over the active service worker if both
+ * match, since the waiting service worker would have been registered more
+ * recently).
+ * If there's no matching active or waiting service worker at registration
+ * time then the promise will not resolve until an update is found and starts
+ * installing, at which point the installing service worker is used.
+ *
+ * @return {Promise}
+ */
+ getSW(): Promise {
+ // If `this._sw` is set, resolve with that as we want `getSW()` to
+ // return the correct (new) service worker if an update is found.
+ return this._sw !== undefined
+ ? Promise.resolve(this._sw)
+ : this._swDeferred.promise;
+ }
+
+ /**
+ * Sends the passed data object to the service worker registered by this
+ * instance (via {@link workbox-window.Workbox#getSW}) and resolves
+ * with a response (if any).
+ *
+ * A response can be set in a message handler in the service worker by
+ * calling `event.ports[0].postMessage(...)`, which will resolve the promise
+ * returned by `messageSW()`. If no response is set, the promise will never
+ * resolve.
+ *
+ * @param {Object} data An object to send to the service worker
+ * @return {Promise}
+ */
+ // We might be able to change the 'data' type to Record in the future.
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ async messageSW(data: object): Promise {
+ const sw = await this.getSW();
+ return messageSW(sw, data);
+ }
+
+ /**
+ * Sends a `{type: 'SKIP_WAITING'}` message to the service worker that's
+ * currently in the `waiting` state associated with the current registration.
+ *
+ * If there is no current registration or no service worker is `waiting`,
+ * calling this will have no effect.
+ */
+ messageSkipWaiting(): void {
+ if (this._registration && this._registration.waiting) {
+ void messageSW(this._registration.waiting, SKIP_WAITING_MESSAGE);
+ }
+ }
+
+ /**
+ * Checks for a service worker already controlling the page and returns
+ * it if its script URL matches.
+ *
+ * @private
+ * @return {ServiceWorker|undefined}
+ */
+ private _getControllingSWIfCompatible() {
+ const controller = navigator.serviceWorker.controller;
+ if (
+ controller &&
+ urlsMatch(controller.scriptURL, this._scriptURL.toString())
+ ) {
+ return controller;
+ } else {
+ return undefined;
+ }
+ }
+
+ /**
+ * Registers a service worker for this instances script URL and register
+ * options and tracks the time registration was complete.
+ *
+ * @private
+ */
+ private async _registerScript() {
+ try {
+ // this._scriptURL may be a TrustedScriptURL, but there's no support for
+ // passing that to register() in lib.dom right now.
+ // https://github.com/GoogleChrome/workbox/issues/2855
+ const reg = await navigator.serviceWorker.register(
+ this._scriptURL as string,
+ this._registerOptions,
+ );
+
+ // Keep track of when registration happened, so it can be used in the
+ // `this._onUpdateFound` heuristic. Also use the presence of this
+ // property as a way to see if `.register()` has been called.
+ this._registrationTime = performance.now();
+
+ return reg;
+ } catch (error) {
+ if (process.env.NODE_ENV !== 'production') {
+ logger.error(error);
+ }
+ // Re-throw the error.
+ throw error;
+ }
+ }
+
+ /**
+ * @private
+ */
+ private readonly _onUpdateFound = () => {
+ // `this._registration` will never be `undefined` after an update is found.
+ const registration = this._registration!;
+ const installingSW = registration.installing as ServiceWorker;
+
+ // If the script URL passed to `navigator.serviceWorker.register()` is
+ // different from the current controlling SW's script URL, we know any
+ // successful registration calls will trigger an `updatefound` event.
+ // But if the registered script URL is the same as the current controlling
+ // SW's script URL, we'll only get an `updatefound` event if the file
+ // changed since it was last registered. This can be a problem if the user
+ // opens up the same page in a different tab, and that page registers
+ // a SW that triggers an update. It's a problem because this page has no
+ // good way of knowing whether the `updatefound` event came from the SW
+ // script it registered or from a registration attempt made by a newer
+ // version of the page running in another tab.
+ // To minimize the possibility of a false positive, we use the logic here:
+ const updateLikelyTriggeredExternally =
+ // Since we enforce only calling `register()` once, and since we don't
+ // add the `updatefound` event listener until the `register()` call, if
+ // `_updateFoundCount` is > 0 then it means this method has already
+ // been called, thus this SW must be external
+ this._updateFoundCount > 0 ||
+ // If the script URL of the installing SW is different from this
+ // instance's script URL, we know it's definitely not from our
+ // registration.
+ !urlsMatch(installingSW.scriptURL, this._scriptURL.toString()) ||
+ // If all of the above are false, then we use a time-based heuristic:
+ // Any `updatefound` event that occurs long after our registration is
+ // assumed to be external.
+ performance.now() > this._registrationTime + REGISTRATION_TIMEOUT_DURATION
+ ? // If any of the above are not true, we assume the update was
+ // triggered by this instance.
+ true
+ : false;
+
+ if (updateLikelyTriggeredExternally) {
+ this._externalSW = installingSW;
+ registration.removeEventListener('updatefound', this._onUpdateFound);
+ } else {
+ // If the update was not triggered externally we know the installing
+ // SW is the one we registered, so we set it.
+ this._sw = installingSW;
+ this._ownSWs.add(installingSW);
+ this._swDeferred.resolve(installingSW);
+
+ // The `installing` state isn't something we have a dedicated
+ // callback for, but we do log messages for it in development.
+ if (process.env.NODE_ENV !== 'production') {
+ if (navigator.serviceWorker.controller) {
+ logger.log('Updated service worker found. Installing now...');
+ } else {
+ logger.log('Service worker is installing...');
+ }
+ }
+ }
+
+ // Increment the `updatefound` count, so future invocations of this
+ // method can be sure they were triggered externally.
+ ++this._updateFoundCount;
+
+ // Add a `statechange` listener regardless of whether this update was
+ // triggered externally, since we have callbacks for both.
+ installingSW.addEventListener('statechange', this._onStateChange);
+ };
+
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ private readonly _onStateChange = (originalEvent: Event) => {
+ // `this._registration` will never be `undefined` after an update is found.
+ const registration = this._registration!;
+ const sw = originalEvent.target as ServiceWorker;
+ const {state} = sw;
+ const isExternal = sw === this._externalSW;
+
+ const eventProps: {
+ sw: ServiceWorker;
+ originalEvent: Event;
+ isUpdate?: boolean;
+ isExternal: boolean;
+ } = {
+ sw,
+ isExternal,
+ originalEvent,
+ };
+ if (!isExternal && this._isUpdate) {
+ eventProps.isUpdate = true;
+ }
+
+ this.dispatchEvent(
+ new WorkboxEvent(state as keyof WorkboxLifecycleEventMap, eventProps),
+ );
+
+ if (state === 'installed') {
+ // This timeout is used to ignore cases where the service worker calls
+ // `skipWaiting()` in the install event, thus moving it directly in the
+ // activating state. (Since all service workers *must* go through the
+ // waiting phase, the only way to detect `skipWaiting()` called in the
+ // install event is to observe that the time spent in the waiting phase
+ // is very short.)
+ // NOTE: we don't need separate timeouts for the own and external SWs
+ // since they can't go through these phases at the same time.
+ this._waitingTimeout = self.setTimeout(() => {
+ // Ensure the SW is still waiting (it may now be redundant).
+ if (state === 'installed' && registration.waiting === sw) {
+ this.dispatchEvent(new WorkboxEvent('waiting', eventProps));
+
+ if (process.env.NODE_ENV !== 'production') {
+ if (isExternal) {
+ logger.warn(
+ 'An external service worker has installed but is ' +
+ 'waiting for this client to close before activating...',
+ );
+ } else {
+ logger.warn(
+ 'The service worker has installed but is waiting ' +
+ 'for existing clients to close before activating...',
+ );
+ }
+ }
+ }
+ }, WAITING_TIMEOUT_DURATION);
+ } else if (state === 'activating') {
+ clearTimeout(this._waitingTimeout);
+ if (!isExternal) {
+ this._activeDeferred.resolve(sw);
+ }
+ }
+
+ if (process.env.NODE_ENV !== 'production') {
+ switch (state) {
+ case 'installed':
+ if (isExternal) {
+ logger.warn(
+ 'An external service worker has installed. ' +
+ 'You may want to suggest users reload this page.',
+ );
+ } else {
+ logger.log('Registered service worker installed.');
+ }
+ break;
+ case 'activated':
+ if (isExternal) {
+ logger.warn('An external service worker has activated.');
+ } else {
+ logger.log('Registered service worker activated.');
+ if (sw !== navigator.serviceWorker.controller) {
+ logger.warn(
+ 'The registered service worker is active but ' +
+ 'not yet controlling the page. Reload or run ' +
+ '`clients.claim()` in the service worker.',
+ );
+ }
+ }
+ break;
+ case 'redundant':
+ if (sw === this._compatibleControllingSW) {
+ logger.log('Previously controlling service worker now redundant!');
+ } else if (!isExternal) {
+ logger.log('Registered service worker now redundant!');
+ }
+ break;
+ }
+ }
+ };
+
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ private readonly _onControllerChange = (originalEvent: Event) => {
+ const sw = this._sw;
+ const isExternal = sw !== navigator.serviceWorker.controller;
+
+ // Unconditionally dispatch the controlling event, with isExternal set
+ // to distinguish between controller changes due to the initial registration
+ // vs. an update-check or other tab's registration.
+ // See https://github.com/GoogleChrome/workbox/issues/2786
+ this.dispatchEvent(
+ new WorkboxEvent('controlling', {
+ isExternal,
+ originalEvent,
+ sw,
+ isUpdate: this._isUpdate,
+ }),
+ );
+
+ if (!isExternal) {
+ if (process.env.NODE_ENV !== 'production') {
+ logger.log('Registered service worker now controlling this page.');
+ }
+ this._controllingDeferred.resolve(sw);
+ }
+ };
+
+ /**
+ * @private
+ * @param {Event} originalEvent
+ */
+ private readonly _onMessage = async (originalEvent: MessageEvent) => {
+ // Can't change type 'any' of data.
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ const {data, ports, source} = originalEvent;
+
+ // Wait until there's an "own" service worker. This is used to buffer
+ // `message` events that may be received prior to calling `register()`.
+ await this.getSW();
+
+ // If the service worker that sent the message is in the list of own
+ // service workers for this instance, dispatch a `message` event.
+ // NOTE: we check for all previously owned service workers rather than
+ // just the current one because some messages (e.g. cache updates) use
+ // a timeout when sent and may be delayed long enough for a service worker
+ // update to be found.
+ if (this._ownSWs.has(source as ServiceWorker)) {
+ this.dispatchEvent(
+ new WorkboxEvent('message', {
+ // Can't change type 'any' of data.
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ data,
+ originalEvent,
+ ports,
+ sw: source as ServiceWorker,
+ }),
+ );
+ }
+ };
+}
+
+export {Workbox};
+
+// The jsdoc comments below outline the events this instance may dispatch:
+// -----------------------------------------------------------------------
+
+/**
+ * The `message` event is dispatched any time a `postMessage` is received.
+ *
+ * @event workbox-window.Workbox#message
+ * @type {WorkboxEvent}
+ * @property {*} data The `data` property from the original `message` event.
+ * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}
+ * event.
+ * @property {string} type `message`.
+ * @property {MessagePort[]} ports The `ports` value from `originalEvent`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+
+/**
+ * The `installed` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}
+ * changes to `installed`.
+ *
+ * Then can happen either the very first time a service worker is installed,
+ * or after an update to the current service worker is found. In the case
+ * of an update being found, the event's `isUpdate` property will be `true`.
+ *
+ * @event workbox-window.Workbox#installed
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `installed`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+
+/**
+ * The `waiting` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}
+ * changes to `installed` and then doesn't immediately change to `activating`.
+ * It may also be dispatched if a service worker with the same
+ * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}
+ * was already waiting when the {@link workbox-window.Workbox#register}
+ * method was called.
+ *
+ * @event workbox-window.Workbox#waiting
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event|undefined} originalEvent The original
+ * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event, or `undefined` in the case where the service worker was waiting
+ * to before `.register()` was called.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with
+ * a matching `scriptURL` was already waiting when this `Workbox`
+ * instance called `register()`.
+ * @property {string} type `waiting`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+
+/**
+ * The `controlling` event is dispatched if a
+ * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}
+ * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}
+ * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}
+ * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}
+ * matches the `scriptURL` of the `Workbox` instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.
+ *
+ * @event workbox-window.Workbox#controlling
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this service worker was registered.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `controlling`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+
+/**
+ * The `activated` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * {@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw|registered service worker}
+ * changes to `activated`.
+ *
+ * @event workbox-window.Workbox#activated
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {boolean|undefined} isExternal True if this event is associated
+ * with an [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}.
+ * @property {string} type `activated`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
+
+/**
+ * The `redundant` event is dispatched if the state of a
+ * {@link workbox-window.Workbox} instance's
+ * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}
+ * changes to `redundant`.
+ *
+ * @event workbox-window.Workbox#redundant
+ * @type {WorkboxEvent}
+ * @property {ServiceWorker} sw The service worker instance.
+ * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}
+ * event.
+ * @property {boolean|undefined} isUpdate True if a service worker was already
+ * controlling when this `Workbox` instance called `register()`.
+ * @property {string} type `redundant`.
+ * @property {Workbox} target The `Workbox` instance.
+ */
diff --git a/tools/ui/node_modules/workbox-window/src/_version.ts b/tools/ui/node_modules/workbox-window/src/_version.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2fab4abe969f248bff7966aa9a77a70552ac1659
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/src/_version.ts
@@ -0,0 +1,2 @@
+// @ts-ignore
+try{self['workbox:window:7.4.1']&&_()}catch(e){}
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-window/src/index.ts b/tools/ui/node_modules/workbox-window/src/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..dfb99a1e3ba4689169caf55b3e2639b94e35325f
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/src/index.ts
@@ -0,0 +1,20 @@
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import {messageSW} from './messageSW.js';
+import {Workbox} from './Workbox.js';
+
+import './_version.js';
+
+/**
+ * @module workbox-window
+ */
+export {messageSW, Workbox};
+
+// See https://github.com/GoogleChrome/workbox/issues/2770
+export * from './utils/WorkboxEvent.js';
diff --git a/tools/ui/node_modules/workbox-window/src/messageSW.ts b/tools/ui/node_modules/workbox-window/src/messageSW.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c4146e21c11434a75466a31263f94bd7798c82e6
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/src/messageSW.ts
@@ -0,0 +1,37 @@
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import './_version.js';
+
+/**
+ * Sends a data object to a service worker via `postMessage` and resolves with
+ * a response (if any).
+ *
+ * A response can be set in a message handler in the service worker by
+ * calling `event.ports[0].postMessage(...)`, which will resolve the promise
+ * returned by `messageSW()`. If no response is set, the promise will not
+ * resolve.
+ *
+ * @param {ServiceWorker} sw The service worker to send the message to.
+ * @param {Object} data An object to send to the service worker.
+ * @return {Promise}
+ * @memberof workbox-window
+ */
+// Better not change type of data.
+// eslint-disable-next-line @typescript-eslint/ban-types
+function messageSW(sw: ServiceWorker, data: {}): Promise {
+ return new Promise((resolve) => {
+ const messageChannel = new MessageChannel();
+ messageChannel.port1.onmessage = (event: MessageEvent) => {
+ resolve(event.data);
+ };
+ sw.postMessage(data, [messageChannel.port2]);
+ });
+}
+
+export {messageSW};
diff --git a/tools/ui/node_modules/workbox-window/src/utils/WorkboxEvent.ts b/tools/ui/node_modules/workbox-window/src/utils/WorkboxEvent.ts
new file mode 100644
index 0000000000000000000000000000000000000000..a038e2bbc20c55e7d66a0b45ca4b24639730e9c8
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/src/utils/WorkboxEvent.ts
@@ -0,0 +1,59 @@
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import {WorkboxEventTarget} from './WorkboxEventTarget.js';
+import '../_version.js';
+
+/**
+ * A minimal `Event` subclass shim.
+ * This doesn't *actually* subclass `Event` because not all browsers support
+ * constructable `EventTarget`, and using a real `Event` will error.
+ * @private
+ */
+export class WorkboxEvent {
+ target?: WorkboxEventTarget;
+ sw?: ServiceWorker;
+ originalEvent?: Event;
+ isExternal?: boolean;
+
+ constructor(
+ public type: K,
+ props: Omit,
+ ) {
+ Object.assign(this, props);
+ }
+}
+
+export interface WorkboxMessageEvent extends WorkboxEvent<'message'> {
+ data: any;
+ originalEvent: Event;
+ ports: readonly MessagePort[];
+}
+
+export interface WorkboxLifecycleEvent
+ extends WorkboxEvent {
+ isUpdate?: boolean;
+}
+
+export interface WorkboxLifecycleWaitingEvent extends WorkboxLifecycleEvent {
+ wasWaitingBeforeRegister?: boolean;
+}
+
+export interface WorkboxLifecycleEventMap {
+ installing: WorkboxLifecycleEvent;
+ installed: WorkboxLifecycleEvent;
+ waiting: WorkboxLifecycleWaitingEvent;
+ activating: WorkboxLifecycleEvent;
+ activated: WorkboxLifecycleEvent;
+ controlling: WorkboxLifecycleEvent;
+ redundant: WorkboxLifecycleEvent;
+}
+
+export interface WorkboxEventMap extends WorkboxLifecycleEventMap {
+ message: WorkboxMessageEvent;
+}
diff --git a/tools/ui/node_modules/workbox-window/src/utils/WorkboxEventTarget.ts b/tools/ui/node_modules/workbox-window/src/utils/WorkboxEventTarget.ts
new file mode 100644
index 0000000000000000000000000000000000000000..aa5c16e8c8b231701e4145d4a2753bc879f09a9a
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/src/utils/WorkboxEventTarget.ts
@@ -0,0 +1,77 @@
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import {WorkboxEvent, WorkboxEventMap} from './WorkboxEvent.js';
+
+export type ListenerCallback = (event: WorkboxEvent) => any;
+
+/**
+ * A minimal `EventTarget` shim.
+ * This is necessary because not all browsers support constructable
+ * `EventTarget`, so using a real `EventTarget` will error.
+ * @private
+ */
+export class WorkboxEventTarget {
+ private readonly _eventListenerRegistry: Map<
+ keyof WorkboxEventMap,
+ Set
+ > = new Map();
+
+ /**
+ * @param {string} type
+ * @param {Function} listener
+ * @private
+ */
+ addEventListener(
+ type: K,
+ listener: (event: WorkboxEventMap[K]) => any,
+ ): void {
+ const foo = this._getEventListenersByType(type);
+ foo.add(listener as ListenerCallback);
+ }
+
+ /**
+ * @param {string} type
+ * @param {Function} listener
+ * @private
+ */
+ removeEventListener(
+ type: K,
+ listener: (event: WorkboxEventMap[K]) => any,
+ ): void {
+ this._getEventListenersByType(type).delete(listener as ListenerCallback);
+ }
+
+ /**
+ * @param {Object} event
+ * @private
+ */
+ dispatchEvent(event: WorkboxEvent): void {
+ event.target = this;
+
+ const listeners = this._getEventListenersByType(event.type);
+ for (const listener of listeners) {
+ listener(event);
+ }
+ }
+
+ /**
+ * Returns a Set of listeners associated with the passed event type.
+ * If no handlers have been registered, an empty Set is returned.
+ *
+ * @param {string} type The event type.
+ * @return {Set} An array of handler functions.
+ * @private
+ */
+ private _getEventListenersByType(type: keyof WorkboxEventMap) {
+ if (!this._eventListenerRegistry.has(type)) {
+ this._eventListenerRegistry.set(type, new Set());
+ }
+ return this._eventListenerRegistry.get(type)!;
+ }
+}
diff --git a/tools/ui/node_modules/workbox-window/src/utils/urlsMatch.ts b/tools/ui/node_modules/workbox-window/src/utils/urlsMatch.ts
new file mode 100644
index 0000000000000000000000000000000000000000..882011a90caad08ad013a3851fd225a73cd72688
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/src/utils/urlsMatch.ts
@@ -0,0 +1,23 @@
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+
+import '../_version.js';
+
+/**
+ * Returns true if two URLs have the same `.href` property. The URLS can be
+ * relative, and if they are the current location href is used to resolve URLs.
+ *
+ * @private
+ * @param {string} url1
+ * @param {string} url2
+ * @return {boolean}
+ */
+export function urlsMatch(url1: string, url2: string): boolean {
+ const {href} = location;
+ return new URL(url1, href).href === new URL(url2, href).href;
+}
diff --git a/tools/ui/node_modules/workbox-window/tsconfig.json b/tools/ui/node_modules/workbox-window/tsconfig.json
new file mode 100644
index 0000000000000000000000000000000000000000..79279e1641dcac93a4863387ab8198ca58da7b71
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/tsconfig.json
@@ -0,0 +1,15 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "lib": ["es2017", "dom"],
+ "outDir": "./",
+ "rootDir": "./src",
+ "tsBuildInfoFile": "./tsconfig.tsbuildinfo"
+ },
+ "include": ["src/**/*.ts"],
+ "references": [
+ {
+ "path": "../workbox-core/"
+ }
+ ]
+}
diff --git a/tools/ui/node_modules/workbox-window/tsconfig.tsbuildinfo b/tools/ui/node_modules/workbox-window/tsconfig.tsbuildinfo
new file mode 100644
index 0000000000000000000000000000000000000000..1bf9950cf01841577027181e6025ccc0531cbad1
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/tsconfig.tsbuildinfo
@@ -0,0 +1 @@
+{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../infra/type-overrides.d.ts","../workbox-core/_version.d.ts","../workbox-core/_private/deferred.d.ts","../workbox-core/_private/dontwaitfor.d.ts","../workbox-core/_private/logger.d.ts","./node_modules/@types/trusted-types/lib/index.d.ts","./src/_version.ts","./src/messagesw.ts","./src/utils/workboxevent.ts","./src/utils/workboxeventtarget.ts","./src/utils/urlsmatch.ts","./src/workbox.ts","./src/index.ts","./node_modules/@types/trusted-types/index.d.ts","../../node_modules/@babel/types/lib/index.d.ts","../../node_modules/@types/babel__generator/index.d.ts","../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../node_modules/@types/babel__template/index.d.ts","../../node_modules/@types/babel__traverse/index.d.ts","../../node_modules/@types/babel__core/index.d.ts","../../node_modules/@types/babel__preset-env/index.d.ts","../../node_modules/@types/common-tags/index.d.ts","../../node_modules/@types/eslint/helpers.d.ts","../../node_modules/@types/estree/index.d.ts","../../node_modules/@types/json-schema/index.d.ts","../../node_modules/@types/eslint/index.d.ts","../../node_modules/@types/eslint-scope/index.d.ts","../../node_modules/@types/node/compatibility/disposable.d.ts","../../node_modules/@types/node/compatibility/indexable.d.ts","../../node_modules/@types/node/compatibility/iterators.d.ts","../../node_modules/@types/node/compatibility/index.d.ts","../../node_modules/@types/node/ts5.6/globals.typedarray.d.ts","../../node_modules/@types/node/ts5.6/buffer.buffer.d.ts","../../node_modules/undici-types/header.d.ts","../../node_modules/undici-types/readable.d.ts","../../node_modules/undici-types/file.d.ts","../../node_modules/undici-types/fetch.d.ts","../../node_modules/undici-types/formdata.d.ts","../../node_modules/undici-types/connector.d.ts","../../node_modules/undici-types/client.d.ts","../../node_modules/undici-types/errors.d.ts","../../node_modules/undici-types/dispatcher.d.ts","../../node_modules/undici-types/global-dispatcher.d.ts","../../node_modules/undici-types/global-origin.d.ts","../../node_modules/undici-types/pool-stats.d.ts","../../node_modules/undici-types/pool.d.ts","../../node_modules/undici-types/handlers.d.ts","../../node_modules/undici-types/balanced-pool.d.ts","../../node_modules/undici-types/agent.d.ts","../../node_modules/undici-types/mock-interceptor.d.ts","../../node_modules/undici-types/mock-agent.d.ts","../../node_modules/undici-types/mock-client.d.ts","../../node_modules/undici-types/mock-pool.d.ts","../../node_modules/undici-types/mock-errors.d.ts","../../node_modules/undici-types/proxy-agent.d.ts","../../node_modules/undici-types/env-http-proxy-agent.d.ts","../../node_modules/undici-types/retry-handler.d.ts","../../node_modules/undici-types/retry-agent.d.ts","../../node_modules/undici-types/api.d.ts","../../node_modules/undici-types/interceptors.d.ts","../../node_modules/undici-types/util.d.ts","../../node_modules/undici-types/cookies.d.ts","../../node_modules/undici-types/patch.d.ts","../../node_modules/undici-types/websocket.d.ts","../../node_modules/undici-types/eventsource.d.ts","../../node_modules/undici-types/filereader.d.ts","../../node_modules/undici-types/diagnostics-channel.d.ts","../../node_modules/undici-types/content-type.d.ts","../../node_modules/undici-types/cache.d.ts","../../node_modules/undici-types/index.d.ts","../../node_modules/@types/node/globals.d.ts","../../node_modules/@types/node/assert.d.ts","../../node_modules/@types/node/assert/strict.d.ts","../../node_modules/@types/node/async_hooks.d.ts","../../node_modules/@types/node/buffer.d.ts","../../node_modules/@types/node/child_process.d.ts","../../node_modules/@types/node/cluster.d.ts","../../node_modules/@types/node/console.d.ts","../../node_modules/@types/node/constants.d.ts","../../node_modules/@types/node/crypto.d.ts","../../node_modules/@types/node/dgram.d.ts","../../node_modules/@types/node/diagnostics_channel.d.ts","../../node_modules/@types/node/dns.d.ts","../../node_modules/@types/node/dns/promises.d.ts","../../node_modules/@types/node/domain.d.ts","../../node_modules/@types/node/dom-events.d.ts","../../node_modules/@types/node/events.d.ts","../../node_modules/@types/node/fs.d.ts","../../node_modules/@types/node/fs/promises.d.ts","../../node_modules/@types/node/http.d.ts","../../node_modules/@types/node/http2.d.ts","../../node_modules/@types/node/https.d.ts","../../node_modules/@types/node/inspector.d.ts","../../node_modules/@types/node/module.d.ts","../../node_modules/@types/node/net.d.ts","../../node_modules/@types/node/os.d.ts","../../node_modules/@types/node/path.d.ts","../../node_modules/@types/node/perf_hooks.d.ts","../../node_modules/@types/node/process.d.ts","../../node_modules/@types/node/punycode.d.ts","../../node_modules/@types/node/querystring.d.ts","../../node_modules/@types/node/readline.d.ts","../../node_modules/@types/node/readline/promises.d.ts","../../node_modules/@types/node/repl.d.ts","../../node_modules/@types/node/sea.d.ts","../../node_modules/@types/node/stream.d.ts","../../node_modules/@types/node/stream/promises.d.ts","../../node_modules/@types/node/stream/consumers.d.ts","../../node_modules/@types/node/stream/web.d.ts","../../node_modules/@types/node/string_decoder.d.ts","../../node_modules/@types/node/test.d.ts","../../node_modules/@types/node/timers.d.ts","../../node_modules/@types/node/timers/promises.d.ts","../../node_modules/@types/node/tls.d.ts","../../node_modules/@types/node/trace_events.d.ts","../../node_modules/@types/node/tty.d.ts","../../node_modules/@types/node/url.d.ts","../../node_modules/@types/node/util.d.ts","../../node_modules/@types/node/v8.d.ts","../../node_modules/@types/node/vm.d.ts","../../node_modules/@types/node/wasi.d.ts","../../node_modules/@types/node/worker_threads.d.ts","../../node_modules/@types/node/zlib.d.ts","../../node_modules/@types/node/ts5.6/index.d.ts","../../node_modules/@types/fs-extra/index.d.ts","../../node_modules/@types/minimatch/index.d.ts","../../node_modules/@types/glob/index.d.ts","../../node_modules/@types/html-minifier-terser/index.d.ts","../../node_modules/@types/linkify-it/index.d.ts","../../node_modules/@types/mdurl/encode.d.ts","../../node_modules/@types/mdurl/decode.d.ts","../../node_modules/@types/mdurl/parse.d.ts","../../node_modules/@types/mdurl/format.d.ts","../../node_modules/@types/mdurl/index.d.ts","../../node_modules/@types/markdown-it/lib/common/utils.d.ts","../../node_modules/@types/markdown-it/lib/token.d.ts","../../node_modules/@types/markdown-it/lib/rules_inline/state_inline.d.ts","../../node_modules/@types/markdown-it/lib/helpers/parse_link_label.d.ts","../../node_modules/@types/markdown-it/lib/helpers/parse_link_destination.d.ts","../../node_modules/@types/markdown-it/lib/helpers/parse_link_title.d.ts","../../node_modules/@types/markdown-it/lib/helpers/index.d.ts","../../node_modules/@types/markdown-it/lib/ruler.d.ts","../../node_modules/@types/markdown-it/lib/rules_block/state_block.d.ts","../../node_modules/@types/markdown-it/lib/parser_block.d.ts","../../node_modules/@types/markdown-it/lib/rules_core/state_core.d.ts","../../node_modules/@types/markdown-it/lib/parser_core.d.ts","../../node_modules/@types/markdown-it/lib/parser_inline.d.ts","../../node_modules/@types/markdown-it/lib/renderer.d.ts","../../node_modules/@types/markdown-it/lib/index.d.ts","../../node_modules/@types/markdown-it/index.d.ts","../../node_modules/@types/minimist/index.d.ts","../../node_modules/@types/normalize-package-data/index.d.ts","../../node_modules/@types/parse-json/index.d.ts","../../node_modules/@types/resolve/index.d.ts","../../node_modules/@types/semver/classes/semver.d.ts","../../node_modules/@types/semver/functions/parse.d.ts","../../node_modules/@types/semver/functions/valid.d.ts","../../node_modules/@types/semver/functions/clean.d.ts","../../node_modules/@types/semver/functions/inc.d.ts","../../node_modules/@types/semver/functions/diff.d.ts","../../node_modules/@types/semver/functions/major.d.ts","../../node_modules/@types/semver/functions/minor.d.ts","../../node_modules/@types/semver/functions/patch.d.ts","../../node_modules/@types/semver/functions/prerelease.d.ts","../../node_modules/@types/semver/functions/compare.d.ts","../../node_modules/@types/semver/functions/rcompare.d.ts","../../node_modules/@types/semver/functions/compare-loose.d.ts","../../node_modules/@types/semver/functions/compare-build.d.ts","../../node_modules/@types/semver/functions/sort.d.ts","../../node_modules/@types/semver/functions/rsort.d.ts","../../node_modules/@types/semver/functions/gt.d.ts","../../node_modules/@types/semver/functions/lt.d.ts","../../node_modules/@types/semver/functions/eq.d.ts","../../node_modules/@types/semver/functions/neq.d.ts","../../node_modules/@types/semver/functions/gte.d.ts","../../node_modules/@types/semver/functions/lte.d.ts","../../node_modules/@types/semver/functions/cmp.d.ts","../../node_modules/@types/semver/functions/coerce.d.ts","../../node_modules/@types/semver/classes/comparator.d.ts","../../node_modules/@types/semver/classes/range.d.ts","../../node_modules/@types/semver/functions/satisfies.d.ts","../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../node_modules/@types/semver/ranges/min-version.d.ts","../../node_modules/@types/semver/ranges/valid.d.ts","../../node_modules/@types/semver/ranges/outside.d.ts","../../node_modules/@types/semver/ranges/gtr.d.ts","../../node_modules/@types/semver/ranges/ltr.d.ts","../../node_modules/@types/semver/ranges/intersects.d.ts","../../node_modules/@types/semver/ranges/simplify.d.ts","../../node_modules/@types/semver/ranges/subset.d.ts","../../node_modules/@types/semver/internals/identifiers.d.ts","../../node_modules/@types/semver/index.d.ts","../../node_modules/@types/source-list-map/index.d.ts","../../node_modules/@types/stringify-object/index.d.ts","../../node_modules/@types/tapable/index.d.ts","../../node_modules/@types/uglify-js/node_modules/source-map/source-map.d.ts","../../node_modules/@types/uglify-js/index.d.ts","../../node_modules/@types/webpack-sources/node_modules/source-map/source-map.d.ts","../../node_modules/@types/webpack-sources/lib/source.d.ts","../../node_modules/@types/webpack-sources/lib/compatsource.d.ts","../../node_modules/@types/webpack-sources/lib/concatsource.d.ts","../../node_modules/@types/webpack-sources/lib/originalsource.d.ts","../../node_modules/@types/webpack-sources/lib/prefixsource.d.ts","../../node_modules/@types/webpack-sources/lib/rawsource.d.ts","../../node_modules/@types/webpack-sources/lib/replacesource.d.ts","../../node_modules/@types/webpack-sources/lib/sizeonlysource.d.ts","../../node_modules/@types/webpack-sources/lib/sourcemapsource.d.ts","../../node_modules/@types/webpack-sources/lib/index.d.ts","../../node_modules/@types/webpack-sources/lib/cachedsource.d.ts","../../node_modules/@types/webpack-sources/index.d.ts"],"fileInfos":[{"version":"8730f4bf322026ff5229336391a18bcaa1f94d4f82416c8b2f3954e2ccaae2ba","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","4b421cbfb3a38a27c279dec1e9112c3d1da296f77a1a85ddadf7e7a425d45d18","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"3aafcb693fe5b5c3bd277bd4c3a617b53db474fe498fc5df067c5603b1eebde7","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"5f406584aef28a331c36523df688ca3650288d14f39c5d2e555c95f0d2ff8f6f","affectsGlobalScope":true},{"version":"22f230e544b35349cfb3bd9110b6ef37b41c6d6c43c3314a31bd0d9652fcec72","affectsGlobalScope":true},{"version":"7ea0b55f6b315cf9ac2ad622b0a7813315bb6e97bf4bb3fbf8f8affbca7dc695","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"eb26de841c52236d8222f87e9e6a235332e0788af8c87a71e9e210314300410a","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"5e5e095c4470c8bab227dbbc61374878ecead104c74ab9960d3adcccfee23205","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"2768ef564cfc0689a1b76106c421a2909bdff0acbe87da010785adab80efdd5c","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"0396119f8b76a074eddc16de8dbc4231a448f2534f4c64c5ab7b71908eb6e646","affectsGlobalScope":true},"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","88fa7615e71089c0cab3b688aae073a6e9dae6f489ec1357da407c155d2e9d84","365f3bd8994af50572b562a002e0fa2e72e74f54ed996e2444ea3df562678f50",{"version":"d763b9ef68a16f3896187af5b51b5a959b479218cc65c2930bcb440cbbf10728","affectsGlobalScope":true},"2fcd2d22b1f30555e785105597cd8f57ed50300e213c4f1bbca6ae149f782c38",{"version":"8dc5232ae8e9e04d40eaffd926b4338049b49530833f1f0a60bdb2acd3c90a55","signature":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","affectsGlobalScope":true},{"version":"748fbd9cc071296ba928bf2611f6c47a04f15370907a51f20bf74dbb194018e5","signature":"759f43eb885b9cba0c0bbb706f70b9723c79db41df105b9404053242846851dd"},{"version":"f1cf4d050360461e021c3e28762afc82760c7f95b58930b757d68e775cd5d6ea","signature":"73a9260bf2aa47f7046f4df2560672284f9f451d500d81c12267aa85667dfeac"},{"version":"d2ac52ee1f774b75fe44fc4cbbfaa76074923c78edf5899684701bfc53faf7d8","signature":"60f19322d7e043b7bc55cefa04764ca3849a1bb2b7cf3c76eeafea8d0d21fcb0"},{"version":"2f8bf938d1327d80ae6e5b3345cb822821bbf5b3e92baef949142b29dad9bfcb","signature":"5bdd9132b5e1fde4442a53530751ff0778664918844b1ddbdfe0d05ebe7dc1c5"},{"version":"7828953854ab8c6c47a67c447fe2585dadfdd807e570471f2e0ca7d2629f08cd","signature":"4209522796417c3f3e426113ce3abbb829685eb5612ceb4d0c2a2bb701d9a4c3"},{"version":"40522cc72b5227d8ec2bb98648ddc095d978f2fcf45c52232c8c3209dca0c3a4","signature":"bf71a95d2678d0809906515a82fa9c345757863a025e6bcc59a05a1f76c2f5f5"},{"version":"bb4248c7f953233ac52332088fac897d62b82be07244e551d87c5049600b6cf7","affectsGlobalScope":true},"c2c2a861a338244d7dd700d0c52a78916b4bb75b98fc8ca5e7c501899fc03796","b25c5f2970d06c729f464c0aeaa64b1a5b5f1355aa93554bb5f9c199b8624b1e","adb467429462e3891de5bb4a82a4189b92005d61c7f9367c089baf03997c104e","3051751533eee92572241b3cef28333212401408c4e7aa21718714b793c0f4ed","691aea9772797ca98334eb743e7686e29325b02c6931391bcee4cc7bf27a9f3b","069bebfee29864e3955378107e243508b163e77ab10de6a5ee03ae06939f0bb9","d83a458e35dfd3cfe0c94758b0b621a733df35ff6b24db007c2721da6574705d","0aeab9bac83e1f076d9f5487c5c783288fe9be64064ee7de3c81eecee157f506",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"151ff381ef9ff8da2da9b9663ebf657eac35c4c9a19183420c05728f31a6761d","f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","7852500a7dc3f9cb6b73d619f6e0249119211ea662fd5e16c59ee5aba3deeb80","1f68ab0e055994eb337b67aa87d2a15e0200951e9664959b3866ee6f6b11a0fe",{"version":"70521b6ab0dcba37539e5303104f29b721bfb2940b2776da4cc818c07e1fefc1","affectsGlobalScope":true},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true},"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a",{"version":"613b21ccdf3be6329d56e6caa13b258c842edf8377be7bc9f014ed14cdcfc308","affectsGlobalScope":true},{"version":"20fb08397d22742771868b52f647cddfbf44b263f26b6519b449257f8c9f7364","affectsGlobalScope":true},"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","24bd580b5743dc56402c440dc7f9a4f5d592ad7a419f25414d37a7bfe11e342b","25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","6bdc71028db658243775263e93a7db2fd2abfce3ca569c3cca5aee6ed5eb186d","cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","4d2b0eb911816f66abe4970898f97a2cfc902bcd743cbfa5017fad79f7ef90d8","bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","e53a3c2a9f624d90f24bf4588aacd223e7bec1b9d0d479b68d2f4a9e6011147f","24b8685c62562f5d98615c5a0c1d05f297cf5065f15246edfe99e81ec4c0e011","93507c745e8f29090efb99399c3f77bec07db17acd75634249dc92f961573387","339dc5265ee5ed92e536a93a04c4ebbc2128f45eeec6ed29f379e0085283542c","4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107",{"version":"08faa97886e71757779428dd4c69a545c32c85fd629d1116d42710b32c6378bc","affectsGlobalScope":true},"6b042aa5d277ad6963e2837179fd2f8fbb01968ac67115b0833c0244e93d1d50","7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","3d77c73be94570813f8cadd1f05ebc3dc5e2e4fdefe4d340ca20cd018724ee36",{"version":"23cfd70b42094e54cc3c5dab996d81b97e2b6f38ccb24ead85454b8ddfe2fc4f","affectsGlobalScope":true},"f3e58c4c18a031cbb17abec7a4ad0bd5ae9fc70c1f4ba1e7fb921ad87c504aca","a3e8bafb2af8e850c644f4be7f5156cf7d23b7bfdc3b786bd4d10ed40329649c",{"version":"35ec8b6760fd7138bbf5809b84551e31028fb2ba7b6dc91d95d098bf212ca8b4","affectsGlobalScope":true},"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a",{"version":"4b87f767c7bc841511113c876a6b8bf1fd0cb0b718c888ad84478b372ec486b1","affectsGlobalScope":true},"8d04e3640dd9eb67f7f1e5bd3d0bf96c784666f7aefc8ac1537af6f2d38d4c29","3c884d9d9ec454bdf0d5a0b8465bf8297d2caa4d853851d92cc417ac6f30b969","5a369483ac4cfbdf0331c248deeb36140e6907db5e1daed241546b4a2055f82c","e8f5b5cc36615c17d330eaf8eebbc0d6bdd942c25991f96ef122f246f4ff722f","f0bd7e6d931657b59605c44112eaf8b980ba7f957a5051ed21cb93d978cf2f45",{"version":"ee1ee365d88c4c6c0c0a5a5701d66ebc27ccd0bcfcfaa482c6e2e7fe7b98edf7","affectsGlobalScope":true},{"version":"0ada07543808f3b967624645a8e1ccd446f8b01ade47842acf1328aec899fed0","affectsGlobalScope":true},"0a37b8d00d03f0381d2db2fe31b0571dc9d7cc0f4b87ca103cc3cd2277690ba0","71adf5dbc59568663d252a46179e71e4d544c053978bfc526d11543a3f716f42","38bf8ff1b403c861e9052c9ea651cb4f38c1ecc084a34d79f8acc6d6477a7321","93bd413918fa921c8729cef45302b24d8b6c7855d72d5bf82d3972595ae8dcbf","4ff41188773cbf465807dd2f7059c7494cbee5115608efc297383832a1150c43","dccdf1677e531e33f8ac961a68bc537418c9a414797c1ea7e91307501cdc3f5e",{"version":"e184c4b8918ef56c8c9e68bd79f3f3780e2d0d75bf2b8a41da1509a40c2deb46","affectsGlobalScope":true},"d206b4baf4ddcc15d9d69a9a2f4999a72a2c6adeaa8af20fa7a9960816287555","93f437e1398a4f06a984f441f7fa7a9f0535c04399619b5c22e0b87bdee182cb","afbe24ab0d74694372baa632ecb28bb375be53f3be53f9b07ecd7fc994907de5",{"version":"70731d10d5311bd4cf710ef7f6539b62660f4b0bfdbb3f9fbe1d25fe6366a7fa","affectsGlobalScope":true},{"version":"6b19db3600a17af69d4f33d08cc7076a7d19fb65bb36e442cac58929ec7c9482","affectsGlobalScope":true},"9e043a1bc8fbf2a255bccf9bf27e0f1caf916c3b0518ea34aa72357c0afd42ec","137c2894e8f3e9672d401cc0a305dc7b1db7c69511cf6d3970fb53302f9eae09","3bc2f1e2c95c04048212c569ed38e338873f6a8593930cf5a7ef24ffb38fc3b6","8145e07aad6da5f23f2fcd8c8e4c5c13fb26ee986a79d03b0829b8fce152d8b2","f9d9d753d430ed050dc1bf2667a1bab711ccbb1c1507183d794cc195a5b085cc","9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","ba1f814c22fd970255ddd60d61fb7e00c28271c933ab5d5cc19cd3ca66b8f57c","37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","125d792ec6c0c0f657d758055c494301cc5fdb327d9d9d5960b3f129aff76093",{"version":"295f068af94245ee9d780555351bef98adfd58f8baf0b9dadbc31a489b881f8b","affectsGlobalScope":true},"1851a3b4db78664f83901bb9cac9e45e03a37bb5933cc5bf37e10bb7e91ab4eb",{"version":"09d479208911ac3ac6a7c2fe86217fc1abe6c4f04e2d52e4890e500699eeab32","affectsGlobalScope":true},{"version":"12ed4559eba17cd977aa0db658d25c4047067444b51acfdcbf38470630642b23","affectsGlobalScope":true},"f3ffabc95802521e1e4bcba4c88d8615176dc6e09111d920c7a213bdda6e1d65","4f029899f9bae07e225c43aef893590541b2b43267383bf5e32e3a884d219ed5","ae56f65caf3be91108707bd8dfbccc2a57a91feb5daabf7165a06a945545ed26","a136d5de521da20f31631a0a96bf712370779d1c05b7015d7019a9b2a0446ca9",{"version":"5b566927cad2ed2139655d55d690ffa87df378b956e7fe1c96024c4d9f75c4cf","affectsGlobalScope":true},{"version":"bce947017cb7a2deebcc4f5ba04cead891ce6ad1602a4438ae45ed9aa1f39104","affectsGlobalScope":true},"d3dffd70e6375b872f0b4e152de4ae682d762c61a24881ecc5eb9f04c5caf76f","e2c72c065a36bc9ab2a00ac6a6f51e71501619a72c0609defd304d46610487a4","d91a7d8b5655c42986f1bdfe2105c4408f472831c8f20cf11a8c3345b6b56c8c",{"version":"616075a6ac578cf5a013ee12964188b4412823796ce0b202c6f1d2e4ca8480d7","affectsGlobalScope":true},"e8a979b8af001c9fc2e774e7809d233c8ca955a28756f52ee5dee88ccb0611d2","9091e564b81e7b4c382a33c62de704a699e10508190547d4f7c1c3e039d2db2b","ed19da84b7dbf00952ad0b98ce5c194f1903bcf7c94d8103e8e0d63b271543ae","1d1e6bd176eee5970968423d7e215bfd66828b6db8d54d17afec05a831322633","393137c76bd922ba70a2f8bf1ade4f59a16171a02fb25918c168d48875b0cfb0","6767cce098e1e6369c26258b7a1f9e569c5467d501a47a090136d5ea6e80ae6d","6503fb6addf62f9b10f8564d9869ad824565a914ec1ac3dd7d13da14a3f57036","f313731860257325f13351575f381fef333d4dfe30daf5a2e72f894208feea08","951b37f7d86f6012f09e6b35f1de57c69d75f16908cb0adaa56b93675ea0b853","3816fc03ffd9cbd1a7a3362a264756a4a1d547caabea50ca68303046be40e376","0c417b4ec46b88fb62a43ec00204700b560d01eb5677c7faa8ecd34610f096a8","13d29cdeb64e8496424edf42749bbb47de5e42d201cf958911a4638cbcffbd3f","0f9e381eecc5860f693c31fe463b3ca20a64ca9b8db0cf6208cd4a053f064809","95902d5561c6aac5dfc40568a12b0aca324037749dcd32a81f23423bfde69bab","5dfb2aca4136abdc5a2740f14be8134a6e6b66fd53470bb2e954e40f8abfaf3e","577463167dd69bd81f76697dfc3f7b22b77a6152f60a602a9218e52e3183ad67","b8396e9024d554b611cbe31a024b176ba7116063d19354b5a02dccd8f0118989","4b28e1c5bf88d891e07a1403358b81a51b3ba2eae1ffada51cca7476b5ac6407","7150ad575d28bf98fae321a1c0f10ad17b127927811f488ded6ff1d88d4244e5","8b155c4757d197969553de3762c8d23d5866710301de41e1b66b97c9ed867003","93733466609dd8bf72eace502a24ca7574bd073d934216e628f1b615c8d3cb3c","45e9228761aabcadb79c82fb3008523db334491525bdb8e74e0f26eaf7a4f7f4","aeacac2778c9821512b6b889da79ac31606a863610c8f28da1e483579627bf90","569fdb354062fc098a6a3ba93a029edf22d6fe480cf72b231b3c07832b2e7c97","bf9876e62fb7f4237deafab8c7444770ef6e82b4cad2d5dc768664ff340feeb2","6cf60e76d37faf0fbc2f80a873eab0fd545f6b1bf300e7f0823f956ddb3083e9","6adaa6103086f931e3eee20f0987e86e8879e9d13aa6bd6075ccfc58b9c5681c","ee0af0f2b8d3b4d0baf669f2ff6fcef4a8816a473c894cc7c905029f7505fed0","209e814e8e71aec74f69686a9506dd7610b97ab59dcee9446266446f72a76d05","6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","cf3d384d082b933d987c4e2fe7bfb8710adfd9dc8155190056ed6695a25a559e","9871b7ee672bc16c78833bdab3052615834b08375cb144e4d2cba74473f4a589","c863198dae89420f3c552b5a03da6ed6d0acfa3807a64772b895db624b0de707","8b03a5e327d7db67112ebbc93b4f744133eda2c1743dbb0a990c61a8007823ef","86c73f2ee1752bac8eeeece234fd05dfcf0637a4fbd8032e4f5f43102faa8eec","42fad1f540271e35ca37cecda12c4ce2eef27f0f5cf0f8dd761d723c744d3159","ff3743a5de32bee10906aff63d1de726f6a7fd6ee2da4b8229054dfa69de2c34","83acd370f7f84f203e71ebba33ba61b7f1291ca027d7f9a662c6307d74e4ac22","1445cec898f90bdd18b2949b9590b3c012f5b7e1804e6e329fb0fe053946d5ec","0e5318ec2275d8da858b541920d9306650ae6ac8012f0e872fe66eb50321a669","cf530297c3fb3a92ec9591dd4fa229d58b5981e45fe6702a0bd2bea53a5e59be","c1f6f7d08d42148ddfe164d36d7aba91f467dbcb3caa715966ff95f55048b3a4","f4e9bf9103191ef3b3612d3ec0044ca4044ca5be27711fe648ada06fad4bcc85","0c1ee27b8f6a00097c2d6d91a21ee4d096ab52c1e28350f6362542b55380059a","7677d5b0db9e020d3017720f853ba18f415219fb3a9597343b1b1012cfd699f7","bc1c6bc119c1784b1a2be6d9c47addec0d83ef0d52c8fbe1f14a51b4dfffc675","52cf2ce99c2a23de70225e252e9822a22b4e0adb82643ab0b710858810e00bf1","770625067bb27a20b9826255a8d47b6b5b0a2d3dfcbd21f89904c731f671ba77","d1ed6765f4d7906a05968fb5cd6d1db8afa14dbe512a4884e8ea5c0f5e142c80","799c0f1b07c092626cf1efd71d459997635911bb5f7fc1196efe449bba87e965","2a184e4462b9914a30b1b5c41cf80c6d3428f17b20d3afb711fff3f0644001fd","9eabde32a3aa5d80de34af2c2206cdc3ee094c6504a8d0c2d6d20c7c179503cc","397c8051b6cfcb48aa22656f0faca2553c5f56187262135162ee79d2b2f6c966","a8ead142e0c87dcd5dc130eba1f8eeed506b08952d905c47621dc2f583b1bff9","a02f10ea5f73130efca046429254a4e3c06b5475baecc8f7b99a0014731be8b3","c2576a4083232b0e2d9bd06875dd43d371dee2e090325a9eac0133fd5650c1cb","4c9a0564bb317349de6a24eb4efea8bb79898fa72ad63a1809165f5bd42970dd","f40ac11d8859092d20f953aae14ba967282c3bb056431a37fced1866ec7a2681","cc11e9e79d4746cc59e0e17473a59d6f104692fd0eeea1bdb2e206eabed83b03","b444a410d34fb5e98aa5ee2b381362044f4884652e8bc8a11c8fe14bbd85518e","c35808c1f5e16d2c571aa65067e3cb95afeff843b259ecfa2fc107a9519b5392","14d5dc055143e941c8743c6a21fa459f961cbc3deedf1bfe47b11587ca4b3ef5","a3ad4e1fc542751005267d50a6298e6765928c0c3a8dce1572f2ba6ca518661c","f237e7c97a3a89f4591afd49ecb3bd8d14f51a1c4adc8fcae3430febedff5eb6","3ffdfbec93b7aed71082af62b8c3e0cc71261cc68d796665faa1e91604fbae8f","662201f943ed45b1ad600d03a90dffe20841e725203ced8b708c91fcd7f9379a","c9ef74c64ed051ea5b958621e7fb853fe3b56e8787c1587aefc6ea988b3c7e79","2462ccfac5f3375794b861abaa81da380f1bbd9401de59ffa43119a0b644253d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","7d8ddf0f021c53099e34ee831a06c394d50371816caa98684812f089b4c6b3d4","67fc055eb86a0632e2e072838f889ffe1754083cb13c8c80a06a7d895d877aae","2905bf42cddf7ba20c88922d36b7afa5431523c1cab119fdb38bf5baab02adf1","d558a0fe921ebcc88d3212c2c42108abf9f0d694d67ebdeba37d7728c044f579","2887592574fcdfd087647c539dcb0fbe5af2521270dad4a37f9d17c16190d579","9d74c7330800b325bb19cc8c1a153a612c080a60094e1ab6cfb6e39cf1b88c36","b90c59ac4682368a01c83881b814738eb151de8a58f52eb7edadea2bcffb11b9","8560a87b2e9f8e2c3808c8f6172c9b7eb6c9b08cb9f937db71c285ecf292c81d","ffe3931ff864f28d80ae2f33bd11123ad3d7bad9896b910a1e61504cc093e1f5","083c1bd82f8dc3a1ed6fc9e8eaddf141f7c05df418eca386598821e045253af9","274ebe605bd7f71ce161f9f5328febc7d547a2929f803f04b44ec4a7d8729517","6ca0207e70d985a24396583f55836b10dc181063ab6069733561bfde404d1bad","5908142efeaab38ffdf43927ee0af681ae77e0d7672b956dfb8b6c705dbfe106","f772b188b943549b5c5eb803133314b8aa7689eced80eed0b70e2f30ca07ab9c","0026b816ef05cfbf290e8585820eef0f13250438669107dfc44482bac007b14f","05d64cc1118031b29786632a9a0f6d7cf1dcacb303f27023a466cf3cdc860538","e0fff9119e1a5d2fdd46345734126cd6cb99c2d98a9debf0257047fe3937cc3f","d84398556ba4595ee6be554671da142cfe964cbdebb2f0c517a10f76f2b016c0","e275297155ec3251200abbb334c7f5641fecc68b2a9573e40eed50dff7584762"],"options":{"composite":true,"declaration":true,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","preserveConstEnums":true,"rootDir":"./src","strict":true,"target":4,"tsBuildInfoFile":"./tsconfig.tsbuildinfo"},"fileIdsList":[[74,116],[56,74,116],[56,57,58,59,60,74,116],[56,58,74,116],[65,67,74,116],[64,65,66,74,116],[74,116,129,165],[74,116,128,165,167],[74,116,190],[74,116,175],[74,116,179,180,181],[74,116,178],[74,116,180],[74,116,170,176,177,182,185,187,188,189],[74,116,177,183,184,190],[74,116,183,186],[74,116,177,178,183,190],[74,116,177,190],[74,116,171,172,173,174],[74,113,116],[74,115,116],[74,116,121,150],[74,116,117,122,128,129,136,147,158],[74,116,117,118,128,136],[69,70,71,74,116],[74,116,119,159],[74,116,120,121,129,137],[74,116,121,147,155],[74,116,122,124,128,136],[74,115,116,123],[74,116,124,125],[74,116,128],[74,116,126,128],[74,115,116,128],[74,116,128,129,130,147,158],[74,116,128,129,130,143,147,150],[74,111,116,163],[74,116,124,128,131,136,147,158],[74,116,128,129,131,132,136,147,155,158],[74,116,131,133,147,155,158],[74,116,128,134],[74,116,135,158,163],[74,116,124,128,136,147],[74,116,137],[74,116,138],[74,115,116,139],[74,113,114,115,116,117,118,119,120,121,122,123,124,125,126,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164],[74,116,141],[74,116,142],[74,116,128,143,144],[74,116,143,145,159,161],[74,116,128,147,148,150],[74,116,149,150],[74,116,147,148],[74,116,150],[74,116,151],[74,113,116,147],[74,116,128,153,154],[74,116,153,154],[74,116,121,136,147,155],[74,116,156],[116],[72,73,74,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164],[74,116,136,157],[74,116,131,142,158],[74,116,121,159],[74,116,147,160],[74,116,135,161],[74,116,162],[74,116,121,128,130,139,147,158,161,163],[74,116,147,164],[74,116,196,235],[74,116,196,220,235],[74,116,235],[74,116,196],[74,116,196,221,235],[74,116,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234],[74,116,221,235],[74,116,239],[74,116,165,242,243,244,245,246,247,248,249,250,251,252],[74,116,241,242,251],[74,116,242,251],[74,116,236,241,242,251],[74,116,241,242,243,244,245,246,247,248,249,250,252],[74,116,242],[74,116,121,241,251],[74,83,87,116,158],[74,83,116,147,158],[74,78,116],[74,80,83,116,155,158],[74,116,136,155],[74,116,165],[74,78,116,165],[74,80,83,116,136,158],[74,75,76,79,82,116,128,147,158],[74,83,90,116],[74,75,81,116],[74,83,104,105,116],[74,79,83,116,150,158,165],[74,104,116,165],[74,77,78,116,165],[74,83,116],[74,77,78,79,80,81,82,83,84,85,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,105,106,107,108,109,110,116],[74,83,98,116],[74,83,90,91,116],[74,81,83,91,92,116],[74,82,116],[74,75,78,83,116],[74,83,87,91,92,116],[74,87,116],[74,81,83,86,116,158],[74,75,80,83,90,116],[74,116,147],[74,78,83,104,116,163,165],[47,74,116],[49,50,53,74,116],[51,74,116],[50,74,116],[44,45,46,47,49,50,51,52,74,116],[49,50,53],[51],[50],[47,51]],"referencedMap":[[42,1],[58,2],[56,1],[61,3],[57,2],[62,1],[59,4],[60,2],[63,1],[68,5],[64,1],[67,6],[65,1],[166,7],[168,8],[169,1],[66,1],[170,1],[191,9],[176,10],[182,11],[180,1],[179,12],[181,13],[190,14],[185,15],[187,16],[188,17],[189,18],[183,1],[184,18],[186,18],[178,18],[177,1],[172,1],[171,1],[174,10],[175,19],[173,10],[167,1],[192,1],[113,20],[114,20],[115,21],[116,22],[117,23],[118,24],[69,1],[72,25],[70,1],[71,1],[119,26],[120,27],[121,28],[122,29],[123,30],[124,31],[125,31],[127,32],[126,33],[128,34],[129,35],[130,36],[112,37],[131,38],[132,39],[133,40],[134,41],[135,42],[136,43],[137,44],[138,45],[139,46],[140,47],[141,48],[142,49],[143,50],[144,50],[145,51],[146,1],[147,52],[149,53],[148,54],[150,55],[151,56],[152,57],[153,58],[154,59],[155,60],[156,61],[74,62],[73,1],[165,63],[157,64],[158,65],[159,66],[160,67],[161,68],[162,69],[163,70],[164,71],[193,1],[194,1],[195,1],[220,72],[221,73],[196,74],[199,74],[218,72],[219,72],[209,72],[208,75],[206,72],[201,72],[214,72],[212,72],[216,72],[200,72],[213,72],[217,72],[202,72],[203,72],[215,72],[197,72],[204,72],[205,72],[207,72],[211,72],[222,76],[210,72],[198,72],[235,77],[234,1],[229,76],[231,78],[230,76],[223,76],[224,76],[226,76],[228,76],[232,78],[233,78],[225,78],[227,78],[236,1],[237,1],[238,1],[240,79],[239,1],[253,80],[252,81],[243,82],[244,83],[251,84],[245,83],[246,82],[247,82],[248,82],[249,85],[242,86],[250,81],[241,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[33,1],[30,1],[31,1],[32,1],[34,1],[7,1],[35,1],[40,1],[41,1],[36,1],[37,1],[38,1],[39,1],[1,1],[90,87],[100,88],[89,87],[110,89],[81,90],[80,91],[109,92],[103,93],[108,94],[83,95],[97,96],[82,97],[106,98],[78,99],[77,92],[107,100],[79,101],[84,102],[85,1],[88,102],[75,1],[111,103],[101,104],[92,105],[93,106],[95,107],[91,108],[94,109],[104,92],[86,110],[87,111],[96,112],[76,113],[99,104],[98,102],[102,1],[105,114],[44,1],[45,1],[46,1],[43,1],[55,115],[47,1],[48,1],[54,116],[49,1],[52,1],[50,117],[51,118],[53,119]],"exportedModulesMap":[[42,1],[58,2],[56,1],[61,3],[57,2],[62,1],[59,4],[60,2],[63,1],[68,5],[64,1],[67,6],[65,1],[166,7],[168,8],[169,1],[66,1],[170,1],[191,9],[176,10],[182,11],[180,1],[179,12],[181,13],[190,14],[185,15],[187,16],[188,17],[189,18],[183,1],[184,18],[186,18],[178,18],[177,1],[172,1],[171,1],[174,10],[175,19],[173,10],[167,1],[192,1],[113,20],[114,20],[115,21],[116,22],[117,23],[118,24],[69,1],[72,25],[70,1],[71,1],[119,26],[120,27],[121,28],[122,29],[123,30],[124,31],[125,31],[127,32],[126,33],[128,34],[129,35],[130,36],[112,37],[131,38],[132,39],[133,40],[134,41],[135,42],[136,43],[137,44],[138,45],[139,46],[140,47],[141,48],[142,49],[143,50],[144,50],[145,51],[146,1],[147,52],[149,53],[148,54],[150,55],[151,56],[152,57],[153,58],[154,59],[155,60],[156,61],[74,62],[73,1],[165,63],[157,64],[158,65],[159,66],[160,67],[161,68],[162,69],[163,70],[164,71],[193,1],[194,1],[195,1],[220,72],[221,73],[196,74],[199,74],[218,72],[219,72],[209,72],[208,75],[206,72],[201,72],[214,72],[212,72],[216,72],[200,72],[213,72],[217,72],[202,72],[203,72],[215,72],[197,72],[204,72],[205,72],[207,72],[211,72],[222,76],[210,72],[198,72],[235,77],[234,1],[229,76],[231,78],[230,76],[223,76],[224,76],[226,76],[228,76],[232,78],[233,78],[225,78],[227,78],[236,1],[237,1],[238,1],[240,79],[239,1],[253,80],[252,81],[243,82],[244,83],[251,84],[245,83],[246,82],[247,82],[248,82],[249,85],[242,86],[250,81],[241,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[33,1],[30,1],[31,1],[32,1],[34,1],[7,1],[35,1],[40,1],[41,1],[36,1],[37,1],[38,1],[39,1],[1,1],[90,87],[100,88],[89,87],[110,89],[81,90],[80,91],[109,92],[103,93],[108,94],[83,95],[97,96],[82,97],[106,98],[78,99],[77,92],[107,100],[79,101],[84,102],[85,1],[88,102],[75,1],[111,103],[101,104],[92,105],[93,106],[95,107],[91,108],[94,109],[104,92],[86,110],[87,111],[96,112],[76,113],[99,104],[98,102],[102,1],[105,114],[44,1],[45,1],[46,1],[43,1],[55,115],[47,1],[54,120],[50,121],[51,122],[53,123]],"semanticDiagnosticsPerFile":[42,58,56,61,57,62,59,60,63,68,64,67,65,166,168,169,66,170,191,176,182,180,179,181,190,185,187,188,189,183,184,186,178,177,172,171,174,175,173,167,192,113,114,115,116,117,118,69,72,70,71,119,120,121,122,123,124,125,127,126,128,129,130,112,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,149,148,150,151,152,153,154,155,156,74,73,165,157,158,159,160,161,162,163,164,193,194,195,220,221,196,199,218,219,209,208,206,201,214,212,216,200,213,217,202,203,215,197,204,205,207,211,222,210,198,235,234,229,231,230,223,224,226,228,232,233,225,227,236,237,238,240,239,253,252,243,244,251,245,246,247,248,249,242,250,241,8,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,33,30,31,32,34,7,35,40,41,36,37,38,39,1,90,100,89,110,81,80,109,103,108,83,97,82,106,78,77,107,79,84,85,88,75,111,101,92,93,95,91,94,104,86,87,96,76,99,98,102,105,44,45,46,43,55,47,48,54,49,52,50,51,53],"latestChangedDtsFile":"./index.d.ts"},"version":"4.9.5"}
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-window/utils/WorkboxEvent.d.ts b/tools/ui/node_modules/workbox-window/utils/WorkboxEvent.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..caf301fb75c2b017c4a802eb5a3dea29e3ade6e4
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/utils/WorkboxEvent.d.ts
@@ -0,0 +1,39 @@
+import { WorkboxEventTarget } from './WorkboxEventTarget.js';
+import '../_version.js';
+/**
+ * A minimal `Event` subclass shim.
+ * This doesn't *actually* subclass `Event` because not all browsers support
+ * constructable `EventTarget`, and using a real `Event` will error.
+ * @private
+ */
+export declare class WorkboxEvent {
+ type: K;
+ target?: WorkboxEventTarget;
+ sw?: ServiceWorker;
+ originalEvent?: Event;
+ isExternal?: boolean;
+ constructor(type: K, props: Omit);
+}
+export interface WorkboxMessageEvent extends WorkboxEvent<'message'> {
+ data: any;
+ originalEvent: Event;
+ ports: readonly MessagePort[];
+}
+export interface WorkboxLifecycleEvent extends WorkboxEvent {
+ isUpdate?: boolean;
+}
+export interface WorkboxLifecycleWaitingEvent extends WorkboxLifecycleEvent {
+ wasWaitingBeforeRegister?: boolean;
+}
+export interface WorkboxLifecycleEventMap {
+ installing: WorkboxLifecycleEvent;
+ installed: WorkboxLifecycleEvent;
+ waiting: WorkboxLifecycleWaitingEvent;
+ activating: WorkboxLifecycleEvent;
+ activated: WorkboxLifecycleEvent;
+ controlling: WorkboxLifecycleEvent;
+ redundant: WorkboxLifecycleEvent;
+}
+export interface WorkboxEventMap extends WorkboxLifecycleEventMap {
+ message: WorkboxMessageEvent;
+}
diff --git a/tools/ui/node_modules/workbox-window/utils/WorkboxEvent.js b/tools/ui/node_modules/workbox-window/utils/WorkboxEvent.js
new file mode 100644
index 0000000000000000000000000000000000000000..e0dbe1a3dbca1567a007a22ae42f94f07f834ce6
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/utils/WorkboxEvent.js
@@ -0,0 +1,20 @@
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+import '../_version.js';
+/**
+ * A minimal `Event` subclass shim.
+ * This doesn't *actually* subclass `Event` because not all browsers support
+ * constructable `EventTarget`, and using a real `Event` will error.
+ * @private
+ */
+export class WorkboxEvent {
+ constructor(type, props) {
+ this.type = type;
+ Object.assign(this, props);
+ }
+}
diff --git a/tools/ui/node_modules/workbox-window/utils/WorkboxEvent.mjs b/tools/ui/node_modules/workbox-window/utils/WorkboxEvent.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..452057a51d2ee76a40619b277ac747b762f32087
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/utils/WorkboxEvent.mjs
@@ -0,0 +1 @@
+export * from './WorkboxEvent.js';
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-window/utils/WorkboxEventTarget.d.ts b/tools/ui/node_modules/workbox-window/utils/WorkboxEventTarget.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..1724ea28ab3c2c8c7cdc974188cddbfc3b50bc11
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/utils/WorkboxEventTarget.d.ts
@@ -0,0 +1,37 @@
+import { WorkboxEvent, WorkboxEventMap } from './WorkboxEvent.js';
+export type ListenerCallback = (event: WorkboxEvent) => any;
+/**
+ * A minimal `EventTarget` shim.
+ * This is necessary because not all browsers support constructable
+ * `EventTarget`, so using a real `EventTarget` will error.
+ * @private
+ */
+export declare class WorkboxEventTarget {
+ private readonly _eventListenerRegistry;
+ /**
+ * @param {string} type
+ * @param {Function} listener
+ * @private
+ */
+ addEventListener(type: K, listener: (event: WorkboxEventMap[K]) => any): void;
+ /**
+ * @param {string} type
+ * @param {Function} listener
+ * @private
+ */
+ removeEventListener(type: K, listener: (event: WorkboxEventMap[K]) => any): void;
+ /**
+ * @param {Object} event
+ * @private
+ */
+ dispatchEvent(event: WorkboxEvent): void;
+ /**
+ * Returns a Set of listeners associated with the passed event type.
+ * If no handlers have been registered, an empty Set is returned.
+ *
+ * @param {string} type The event type.
+ * @return {Set} An array of handler functions.
+ * @private
+ */
+ private _getEventListenersByType;
+}
diff --git a/tools/ui/node_modules/workbox-window/utils/WorkboxEventTarget.js b/tools/ui/node_modules/workbox-window/utils/WorkboxEventTarget.js
new file mode 100644
index 0000000000000000000000000000000000000000..73e6fe233e86dd370be08e472e451b4bae2864fb
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/utils/WorkboxEventTarget.js
@@ -0,0 +1,60 @@
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+/**
+ * A minimal `EventTarget` shim.
+ * This is necessary because not all browsers support constructable
+ * `EventTarget`, so using a real `EventTarget` will error.
+ * @private
+ */
+export class WorkboxEventTarget {
+ constructor() {
+ this._eventListenerRegistry = new Map();
+ }
+ /**
+ * @param {string} type
+ * @param {Function} listener
+ * @private
+ */
+ addEventListener(type, listener) {
+ const foo = this._getEventListenersByType(type);
+ foo.add(listener);
+ }
+ /**
+ * @param {string} type
+ * @param {Function} listener
+ * @private
+ */
+ removeEventListener(type, listener) {
+ this._getEventListenersByType(type).delete(listener);
+ }
+ /**
+ * @param {Object} event
+ * @private
+ */
+ dispatchEvent(event) {
+ event.target = this;
+ const listeners = this._getEventListenersByType(event.type);
+ for (const listener of listeners) {
+ listener(event);
+ }
+ }
+ /**
+ * Returns a Set of listeners associated with the passed event type.
+ * If no handlers have been registered, an empty Set is returned.
+ *
+ * @param {string} type The event type.
+ * @return {Set} An array of handler functions.
+ * @private
+ */
+ _getEventListenersByType(type) {
+ if (!this._eventListenerRegistry.has(type)) {
+ this._eventListenerRegistry.set(type, new Set());
+ }
+ return this._eventListenerRegistry.get(type);
+ }
+}
diff --git a/tools/ui/node_modules/workbox-window/utils/WorkboxEventTarget.mjs b/tools/ui/node_modules/workbox-window/utils/WorkboxEventTarget.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..be5d13fdd71d202f1bfb02d232b1d12c376a8daf
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/utils/WorkboxEventTarget.mjs
@@ -0,0 +1 @@
+export * from './WorkboxEventTarget.js';
\ No newline at end of file
diff --git a/tools/ui/node_modules/workbox-window/utils/urlsMatch.d.ts b/tools/ui/node_modules/workbox-window/utils/urlsMatch.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..48908072895cdd752358fa2561e0080a1668450e
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/utils/urlsMatch.d.ts
@@ -0,0 +1,11 @@
+import '../_version.js';
+/**
+ * Returns true if two URLs have the same `.href` property. The URLS can be
+ * relative, and if they are the current location href is used to resolve URLs.
+ *
+ * @private
+ * @param {string} url1
+ * @param {string} url2
+ * @return {boolean}
+ */
+export declare function urlsMatch(url1: string, url2: string): boolean;
diff --git a/tools/ui/node_modules/workbox-window/utils/urlsMatch.js b/tools/ui/node_modules/workbox-window/utils/urlsMatch.js
new file mode 100644
index 0000000000000000000000000000000000000000..002447165aab348c2eb8290378e44d538accafb8
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/utils/urlsMatch.js
@@ -0,0 +1,21 @@
+/*
+ Copyright 2019 Google LLC
+
+ Use of this source code is governed by an MIT-style
+ license that can be found in the LICENSE file or at
+ https://opensource.org/licenses/MIT.
+*/
+import '../_version.js';
+/**
+ * Returns true if two URLs have the same `.href` property. The URLS can be
+ * relative, and if they are the current location href is used to resolve URLs.
+ *
+ * @private
+ * @param {string} url1
+ * @param {string} url2
+ * @return {boolean}
+ */
+export function urlsMatch(url1, url2) {
+ const { href } = location;
+ return new URL(url1, href).href === new URL(url2, href).href;
+}
diff --git a/tools/ui/node_modules/workbox-window/utils/urlsMatch.mjs b/tools/ui/node_modules/workbox-window/utils/urlsMatch.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..cd871a5eb0579b7febd10a082ff77f8560865b71
--- /dev/null
+++ b/tools/ui/node_modules/workbox-window/utils/urlsMatch.mjs
@@ -0,0 +1 @@
+export * from './urlsMatch.js';
\ No newline at end of file
diff --git a/tools/ui/node_modules/wrappy/LICENSE b/tools/ui/node_modules/wrappy/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..19129e315fe593965a2fdd50ec0d1253bcbd2ece
--- /dev/null
+++ b/tools/ui/node_modules/wrappy/LICENSE
@@ -0,0 +1,15 @@
+The ISC License
+
+Copyright (c) Isaac Z. Schlueter and Contributors
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/tools/ui/node_modules/wrappy/README.md b/tools/ui/node_modules/wrappy/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..98eab2522b86e5fe32c92524c4ec778b98066cbf
--- /dev/null
+++ b/tools/ui/node_modules/wrappy/README.md
@@ -0,0 +1,36 @@
+# wrappy
+
+Callback wrapping utility
+
+## USAGE
+
+```javascript
+var wrappy = require("wrappy")
+
+// var wrapper = wrappy(wrapperFunction)
+
+// make sure a cb is called only once
+// See also: http://npm.im/once for this specific use case
+var once = wrappy(function (cb) {
+ var called = false
+ return function () {
+ if (called) return
+ called = true
+ return cb.apply(this, arguments)
+ }
+})
+
+function printBoo () {
+ console.log('boo')
+}
+// has some rando property
+printBoo.iAmBooPrinter = true
+
+var onlyPrintOnce = once(printBoo)
+
+onlyPrintOnce() // prints 'boo'
+onlyPrintOnce() // does nothing
+
+// random property is retained!
+assert.equal(onlyPrintOnce.iAmBooPrinter, true)
+```
diff --git a/tools/ui/node_modules/wrappy/package.json b/tools/ui/node_modules/wrappy/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..130752046714d686d4b76ce039375d75293d74c5
--- /dev/null
+++ b/tools/ui/node_modules/wrappy/package.json
@@ -0,0 +1,29 @@
+{
+ "name": "wrappy",
+ "version": "1.0.2",
+ "description": "Callback wrapping utility",
+ "main": "wrappy.js",
+ "files": [
+ "wrappy.js"
+ ],
+ "directories": {
+ "test": "test"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "tap": "^2.3.1"
+ },
+ "scripts": {
+ "test": "tap --coverage test/*.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/npm/wrappy"
+ },
+ "author": "Isaac Z. Schlueter (http://blog.izs.me/)",
+ "license": "ISC",
+ "bugs": {
+ "url": "https://github.com/npm/wrappy/issues"
+ },
+ "homepage": "https://github.com/npm/wrappy"
+}
diff --git a/tools/ui/node_modules/wrappy/wrappy.js b/tools/ui/node_modules/wrappy/wrappy.js
new file mode 100644
index 0000000000000000000000000000000000000000..bb7e7d6fcf70fdff4c5a48b7fa2ae3c9ba36fe47
--- /dev/null
+++ b/tools/ui/node_modules/wrappy/wrappy.js
@@ -0,0 +1,33 @@
+// Returns a wrapper function that returns a wrapped callback
+// The wrapper function should do some stuff, and return a
+// presumably different callback function.
+// This makes sure that own properties are retained, so that
+// decorations and such are not lost along the way.
+module.exports = wrappy
+function wrappy (fn, cb) {
+ if (fn && cb) return wrappy(fn)(cb)
+
+ if (typeof fn !== 'function')
+ throw new TypeError('need wrapper function')
+
+ Object.keys(fn).forEach(function (k) {
+ wrapper[k] = fn[k]
+ })
+
+ return wrapper
+
+ function wrapper() {
+ var args = new Array(arguments.length)
+ for (var i = 0; i < args.length; i++) {
+ args[i] = arguments[i]
+ }
+ var ret = fn.apply(this, args)
+ var cb = args[args.length-1]
+ if (typeof ret === 'function' && ret !== cb) {
+ Object.keys(cb).forEach(function (k) {
+ ret[k] = cb[k]
+ })
+ }
+ return ret
+ }
+}
diff --git a/tools/ui/node_modules/ws/LICENSE b/tools/ui/node_modules/ws/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..1da5b96a11ac2c83160e3085188f04eba7e3dd7d
--- /dev/null
+++ b/tools/ui/node_modules/ws/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2011 Einar Otto Stangvik
+Copyright (c) 2013 Arnout Kazemier and contributors
+Copyright (c) 2016 Luigi Pinca and contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/tools/ui/node_modules/ws/README.md b/tools/ui/node_modules/ws/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..21f10df108e11042e02b9b9cb81528d2951e18e8
--- /dev/null
+++ b/tools/ui/node_modules/ws/README.md
@@ -0,0 +1,548 @@
+# ws: a Node.js WebSocket library
+
+[](https://www.npmjs.com/package/ws)
+[](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
+[](https://coveralls.io/github/websockets/ws)
+
+ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and
+server implementation.
+
+Passes the quite extensive Autobahn test suite: [server][server-report],
+[client][client-report].
+
+**Note**: This module does not work in the browser. The client in the docs is a
+reference to a backend with the role of a client in the WebSocket communication.
+Browser clients must use the native
+[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
+object. To make the same code work seamlessly on Node.js and the browser, you
+can use one of the many wrappers available on npm, like
+[isomorphic-ws](https://github.com/heineiuo/isomorphic-ws).
+
+## Table of Contents
+
+- [Protocol support](#protocol-support)
+- [Installing](#installing)
+ - [Opt-in for performance](#opt-in-for-performance)
+ - [Legacy opt-in for performance](#legacy-opt-in-for-performance)
+- [API docs](#api-docs)
+- [WebSocket compression](#websocket-compression)
+- [Usage examples](#usage-examples)
+ - [Sending and receiving text data](#sending-and-receiving-text-data)
+ - [Sending binary data](#sending-binary-data)
+ - [Simple server](#simple-server)
+ - [External HTTP/S server](#external-https-server)
+ - [Multiple servers sharing a single HTTP/S server](#multiple-servers-sharing-a-single-https-server)
+ - [Client authentication](#client-authentication)
+ - [Server broadcast](#server-broadcast)
+ - [Round-trip time](#round-trip-time)
+ - [Use the Node.js streams API](#use-the-nodejs-streams-api)
+ - [Other examples](#other-examples)
+- [FAQ](#faq)
+ - [How to get the IP address of the client?](#how-to-get-the-ip-address-of-the-client)
+ - [How to detect and close broken connections?](#how-to-detect-and-close-broken-connections)
+ - [How to connect via a proxy?](#how-to-connect-via-a-proxy)
+- [Changelog](#changelog)
+- [License](#license)
+
+## Protocol support
+
+- **HyBi drafts 07-12** (Use the option `protocolVersion: 8`)
+- **HyBi drafts 13-17** (Current default, alternatively option
+ `protocolVersion: 13`)
+
+## Installing
+
+```
+npm install ws
+```
+
+### Opt-in for performance
+
+[bufferutil][] is an optional module that can be installed alongside the ws
+module:
+
+```
+npm install --save-optional bufferutil
+```
+
+This is a binary addon that improves the performance of certain operations such
+as masking and unmasking the data payload of the WebSocket frames. Prebuilt
+binaries are available for the most popular platforms, so you don't necessarily
+need to have a C++ compiler installed on your machine.
+
+To force ws to not use bufferutil, use the
+[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) environment variable. This
+can be useful to enhance security in systems where a user can put a package in
+the package search path of an application of another user, due to how the
+Node.js resolver algorithm works.
+
+#### Legacy opt-in for performance
+
+If you are running on an old version of Node.js (prior to v18.14.0), ws also
+supports the [utf-8-validate][] module:
+
+```
+npm install --save-optional utf-8-validate
+```
+
+This contains a binary polyfill for [`buffer.isUtf8()`][].
+
+To force ws not to use utf-8-validate, use the
+[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment variable.
+
+## API docs
+
+See [`/doc/ws.md`](./doc/ws.md) for Node.js-like documentation of ws classes and
+utility functions.
+
+## WebSocket compression
+
+ws supports the [permessage-deflate extension][permessage-deflate] which enables
+the client and server to negotiate a compression algorithm and its parameters,
+and then selectively apply it to the data payloads of each WebSocket message.
+
+The extension is disabled by default on the server and enabled by default on the
+client. It adds a significant overhead in terms of performance and memory
+consumption so we suggest to enable it only if it is really needed.
+
+Note that Node.js has a variety of issues with high-performance compression,
+where increased concurrency, especially on Linux, can lead to [catastrophic
+memory fragmentation][node-zlib-bug] and slow performance. If you intend to use
+permessage-deflate in production, it is worthwhile to set up a test
+representative of your workload and ensure Node.js/zlib will handle it with
+acceptable performance and memory usage.
+
+Tuning of permessage-deflate can be done via the options defined below. You can
+also use `zlibDeflateOptions` and `zlibInflateOptions`, which is passed directly
+into the creation of [raw deflate/inflate streams][node-zlib-deflaterawdocs].
+
+See [the docs][ws-server-options] for more options.
+
+```js
+import WebSocket, { WebSocketServer } from 'ws';
+
+const wss = new WebSocketServer({
+ port: 8080,
+ perMessageDeflate: {
+ zlibDeflateOptions: {
+ // See zlib defaults.
+ chunkSize: 1024,
+ memLevel: 7,
+ level: 3
+ },
+ zlibInflateOptions: {
+ chunkSize: 10 * 1024
+ },
+ // Other options settable:
+ clientNoContextTakeover: true, // Defaults to negotiated value.
+ serverNoContextTakeover: true, // Defaults to negotiated value.
+ serverMaxWindowBits: 10, // Defaults to negotiated value.
+ // Below options specified as default values.
+ concurrencyLimit: 10, // Limits zlib concurrency for perf.
+ threshold: 1024 // Size (in bytes) below which messages
+ // should not be compressed if context takeover is disabled.
+ }
+});
+```
+
+The client will only use the extension if it is supported and enabled on the
+server. To always disable the extension on the client, set the
+`perMessageDeflate` option to `false`.
+
+```js
+import WebSocket from 'ws';
+
+const ws = new WebSocket('ws://www.host.com/path', {
+ perMessageDeflate: false
+});
+```
+
+## Usage examples
+
+### Sending and receiving text data
+
+```js
+import WebSocket from 'ws';
+
+const ws = new WebSocket('ws://www.host.com/path');
+
+ws.on('error', console.error);
+
+ws.on('open', function open() {
+ ws.send('something');
+});
+
+ws.on('message', function message(data) {
+ console.log('received: %s', data);
+});
+```
+
+### Sending binary data
+
+```js
+import WebSocket from 'ws';
+
+const ws = new WebSocket('ws://www.host.com/path');
+
+ws.on('error', console.error);
+
+ws.on('open', function open() {
+ const array = new Float32Array(5);
+
+ for (var i = 0; i < array.length; ++i) {
+ array[i] = i / 2;
+ }
+
+ ws.send(array);
+});
+```
+
+### Simple server
+
+```js
+import { WebSocketServer } from 'ws';
+
+const wss = new WebSocketServer({ port: 8080 });
+
+wss.on('connection', function connection(ws) {
+ ws.on('error', console.error);
+
+ ws.on('message', function message(data) {
+ console.log('received: %s', data);
+ });
+
+ ws.send('something');
+});
+```
+
+### External HTTP/S server
+
+```js
+import { createServer } from 'https';
+import { readFileSync } from 'fs';
+import { WebSocketServer } from 'ws';
+
+const server = createServer({
+ cert: readFileSync('/path/to/cert.pem'),
+ key: readFileSync('/path/to/key.pem')
+});
+const wss = new WebSocketServer({ server });
+
+wss.on('connection', function connection(ws) {
+ ws.on('error', console.error);
+
+ ws.on('message', function message(data) {
+ console.log('received: %s', data);
+ });
+
+ ws.send('something');
+});
+
+server.listen(8080);
+```
+
+### Multiple servers sharing a single HTTP/S server
+
+```js
+import { createServer } from 'http';
+import { WebSocketServer } from 'ws';
+
+const server = createServer();
+const wss1 = new WebSocketServer({ noServer: true });
+const wss2 = new WebSocketServer({ noServer: true });
+
+wss1.on('connection', function connection(ws) {
+ ws.on('error', console.error);
+
+ // ...
+});
+
+wss2.on('connection', function connection(ws) {
+ ws.on('error', console.error);
+
+ // ...
+});
+
+server.on('upgrade', function upgrade(request, socket, head) {
+ const { pathname } = new URL(request.url, 'wss://base.url');
+
+ if (pathname === '/foo') {
+ wss1.handleUpgrade(request, socket, head, function done(ws) {
+ wss1.emit('connection', ws, request);
+ });
+ } else if (pathname === '/bar') {
+ wss2.handleUpgrade(request, socket, head, function done(ws) {
+ wss2.emit('connection', ws, request);
+ });
+ } else {
+ socket.destroy();
+ }
+});
+
+server.listen(8080);
+```
+
+### Client authentication
+
+```js
+import { createServer } from 'http';
+import { WebSocketServer } from 'ws';
+
+function onSocketError(err) {
+ console.error(err);
+}
+
+const server = createServer();
+const wss = new WebSocketServer({ noServer: true });
+
+wss.on('connection', function connection(ws, request, client) {
+ ws.on('error', console.error);
+
+ ws.on('message', function message(data) {
+ console.log(`Received message ${data} from user ${client}`);
+ });
+});
+
+server.on('upgrade', function upgrade(request, socket, head) {
+ socket.on('error', onSocketError);
+
+ // This function is not defined on purpose. Implement it with your own logic.
+ authenticate(request, function next(err, client) {
+ if (err || !client) {
+ socket.write('HTTP/1.1 401 Unauthorized\r\n\r\n');
+ socket.destroy();
+ return;
+ }
+
+ socket.removeListener('error', onSocketError);
+
+ wss.handleUpgrade(request, socket, head, function done(ws) {
+ wss.emit('connection', ws, request, client);
+ });
+ });
+});
+
+server.listen(8080);
+```
+
+Also see the provided [example][session-parse-example] using `express-session`.
+
+### Server broadcast
+
+A client WebSocket broadcasting to all connected WebSocket clients, including
+itself.
+
+```js
+import WebSocket, { WebSocketServer } from 'ws';
+
+const wss = new WebSocketServer({ port: 8080 });
+
+wss.on('connection', function connection(ws) {
+ ws.on('error', console.error);
+
+ ws.on('message', function message(data, isBinary) {
+ wss.clients.forEach(function each(client) {
+ if (client.readyState === WebSocket.OPEN) {
+ client.send(data, { binary: isBinary });
+ }
+ });
+ });
+});
+```
+
+A client WebSocket broadcasting to every other connected WebSocket clients,
+excluding itself.
+
+```js
+import WebSocket, { WebSocketServer } from 'ws';
+
+const wss = new WebSocketServer({ port: 8080 });
+
+wss.on('connection', function connection(ws) {
+ ws.on('error', console.error);
+
+ ws.on('message', function message(data, isBinary) {
+ wss.clients.forEach(function each(client) {
+ if (client !== ws && client.readyState === WebSocket.OPEN) {
+ client.send(data, { binary: isBinary });
+ }
+ });
+ });
+});
+```
+
+### Round-trip time
+
+```js
+import WebSocket from 'ws';
+
+const ws = new WebSocket('wss://websocket-echo.com/');
+
+ws.on('error', console.error);
+
+ws.on('open', function open() {
+ console.log('connected');
+ ws.send(Date.now());
+});
+
+ws.on('close', function close() {
+ console.log('disconnected');
+});
+
+ws.on('message', function message(data) {
+ console.log(`Round-trip time: ${Date.now() - data} ms`);
+
+ setTimeout(function timeout() {
+ ws.send(Date.now());
+ }, 500);
+});
+```
+
+### Use the Node.js streams API
+
+```js
+import WebSocket, { createWebSocketStream } from 'ws';
+
+const ws = new WebSocket('wss://websocket-echo.com/');
+
+const duplex = createWebSocketStream(ws, { encoding: 'utf8' });
+
+duplex.on('error', console.error);
+
+duplex.pipe(process.stdout);
+process.stdin.pipe(duplex);
+```
+
+### Other examples
+
+For a full example with a browser client communicating with a ws server, see the
+examples folder.
+
+Otherwise, see the test cases.
+
+## FAQ
+
+### How to get the IP address of the client?
+
+The remote IP address can be obtained from the raw socket.
+
+```js
+import { WebSocketServer } from 'ws';
+
+const wss = new WebSocketServer({ port: 8080 });
+
+wss.on('connection', function connection(ws, req) {
+ const ip = req.socket.remoteAddress;
+
+ ws.on('error', console.error);
+});
+```
+
+When the server runs behind a proxy like NGINX, the de-facto standard is to use
+the `X-Forwarded-For` header.
+
+```js
+wss.on('connection', function connection(ws, req) {
+ const ip = req.headers['x-forwarded-for'].split(',')[0].trim();
+
+ ws.on('error', console.error);
+});
+```
+
+### How to detect and close broken connections?
+
+Sometimes, the link between the server and the client can be interrupted in a
+way that keeps both the server and the client unaware of the broken state of the
+connection (e.g. when pulling the cord).
+
+In these cases, ping messages can be used as a means to verify that the remote
+endpoint is still responsive.
+
+```js
+import { WebSocketServer } from 'ws';
+
+function heartbeat() {
+ this.isAlive = true;
+}
+
+const wss = new WebSocketServer({ port: 8080 });
+
+wss.on('connection', function connection(ws) {
+ ws.isAlive = true;
+ ws.on('error', console.error);
+ ws.on('pong', heartbeat);
+});
+
+const interval = setInterval(function ping() {
+ wss.clients.forEach(function each(ws) {
+ if (ws.isAlive === false) return ws.terminate();
+
+ ws.isAlive = false;
+ ws.ping();
+ });
+}, 30000);
+
+wss.on('close', function close() {
+ clearInterval(interval);
+});
+```
+
+Pong messages are automatically sent in response to ping messages as required by
+the spec.
+
+Just like the server example above, your clients might as well lose connection
+without knowing it. You might want to add a ping listener on your clients to
+prevent that. A simple implementation would be:
+
+```js
+import WebSocket from 'ws';
+
+function heartbeat() {
+ clearTimeout(this.pingTimeout);
+
+ // Use `WebSocket#terminate()`, which immediately destroys the connection,
+ // instead of `WebSocket#close()`, which waits for the close timer.
+ // Delay should be equal to the interval at which your server
+ // sends out pings plus a conservative assumption of the latency.
+ this.pingTimeout = setTimeout(() => {
+ this.terminate();
+ }, 30000 + 1000);
+}
+
+const client = new WebSocket('wss://websocket-echo.com/');
+
+client.on('error', console.error);
+client.on('open', heartbeat);
+client.on('ping', heartbeat);
+client.on('close', function clear() {
+ clearTimeout(this.pingTimeout);
+});
+```
+
+### How to connect via a proxy?
+
+Use a custom `http.Agent` implementation like [https-proxy-agent][] or
+[socks-proxy-agent][].
+
+## Changelog
+
+We're using the GitHub [releases][changelog] for changelog entries.
+
+## License
+
+[MIT](LICENSE)
+
+[`buffer.isutf8()`]: https://nodejs.org/api/buffer.html#bufferisutf8input
+[bufferutil]: https://github.com/websockets/bufferutil
+[changelog]: https://github.com/websockets/ws/releases
+[client-report]: http://websockets.github.io/ws/autobahn/clients/
+[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
+[node-zlib-bug]: https://github.com/nodejs/node/issues/8871
+[node-zlib-deflaterawdocs]:
+ https://nodejs.org/api/zlib.html#zlib_zlib_createdeflateraw_options
+[permessage-deflate]: https://tools.ietf.org/html/rfc7692
+[server-report]: http://websockets.github.io/ws/autobahn/servers/
+[session-parse-example]: ./examples/express-session-parse
+[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
+[utf-8-validate]: https://github.com/websockets/utf-8-validate
+[ws-server-options]: ./doc/ws.md#new-websocketserveroptions-callback
diff --git a/tools/ui/node_modules/ws/browser.js b/tools/ui/node_modules/ws/browser.js
new file mode 100644
index 0000000000000000000000000000000000000000..ca4f628ac17c80e5b1d40910d1b18c605490deda
--- /dev/null
+++ b/tools/ui/node_modules/ws/browser.js
@@ -0,0 +1,8 @@
+'use strict';
+
+module.exports = function () {
+ throw new Error(
+ 'ws does not work in the browser. Browser clients must use the native ' +
+ 'WebSocket object'
+ );
+};
diff --git a/tools/ui/node_modules/ws/index.js b/tools/ui/node_modules/ws/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..3fdb7b21030c13e27777d6349ab09ed2d9910c01
--- /dev/null
+++ b/tools/ui/node_modules/ws/index.js
@@ -0,0 +1,22 @@
+'use strict';
+
+const createWebSocketStream = require('./lib/stream');
+const extension = require('./lib/extension');
+const PerMessageDeflate = require('./lib/permessage-deflate');
+const Receiver = require('./lib/receiver');
+const Sender = require('./lib/sender');
+const subprotocol = require('./lib/subprotocol');
+const WebSocket = require('./lib/websocket');
+const WebSocketServer = require('./lib/websocket-server');
+
+WebSocket.createWebSocketStream = createWebSocketStream;
+WebSocket.extension = extension;
+WebSocket.PerMessageDeflate = PerMessageDeflate;
+WebSocket.Receiver = Receiver;
+WebSocket.Sender = Sender;
+WebSocket.Server = WebSocketServer;
+WebSocket.subprotocol = subprotocol;
+WebSocket.WebSocket = WebSocket;
+WebSocket.WebSocketServer = WebSocketServer;
+
+module.exports = WebSocket;
diff --git a/tools/ui/node_modules/ws/lib/buffer-util.js b/tools/ui/node_modules/ws/lib/buffer-util.js
new file mode 100644
index 0000000000000000000000000000000000000000..f7536e28efa570277e30e9ea001200ee11595fee
--- /dev/null
+++ b/tools/ui/node_modules/ws/lib/buffer-util.js
@@ -0,0 +1,131 @@
+'use strict';
+
+const { EMPTY_BUFFER } = require('./constants');
+
+const FastBuffer = Buffer[Symbol.species];
+
+/**
+ * Merges an array of buffers into a new buffer.
+ *
+ * @param {Buffer[]} list The array of buffers to concat
+ * @param {Number} totalLength The total length of buffers in the list
+ * @return {Buffer} The resulting buffer
+ * @public
+ */
+function concat(list, totalLength) {
+ if (list.length === 0) return EMPTY_BUFFER;
+ if (list.length === 1) return list[0];
+
+ const target = Buffer.allocUnsafe(totalLength);
+ let offset = 0;
+
+ for (let i = 0; i < list.length; i++) {
+ const buf = list[i];
+ target.set(buf, offset);
+ offset += buf.length;
+ }
+
+ if (offset < totalLength) {
+ return new FastBuffer(target.buffer, target.byteOffset, offset);
+ }
+
+ return target;
+}
+
+/**
+ * Masks a buffer using the given mask.
+ *
+ * @param {Buffer} source The buffer to mask
+ * @param {Buffer} mask The mask to use
+ * @param {Buffer} output The buffer where to store the result
+ * @param {Number} offset The offset at which to start writing
+ * @param {Number} length The number of bytes to mask.
+ * @public
+ */
+function _mask(source, mask, output, offset, length) {
+ for (let i = 0; i < length; i++) {
+ output[offset + i] = source[i] ^ mask[i & 3];
+ }
+}
+
+/**
+ * Unmasks a buffer using the given mask.
+ *
+ * @param {Buffer} buffer The buffer to unmask
+ * @param {Buffer} mask The mask to use
+ * @public
+ */
+function _unmask(buffer, mask) {
+ for (let i = 0; i < buffer.length; i++) {
+ buffer[i] ^= mask[i & 3];
+ }
+}
+
+/**
+ * Converts a buffer to an `ArrayBuffer`.
+ *
+ * @param {Buffer} buf The buffer to convert
+ * @return {ArrayBuffer} Converted buffer
+ * @public
+ */
+function toArrayBuffer(buf) {
+ if (buf.length === buf.buffer.byteLength) {
+ return buf.buffer;
+ }
+
+ return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);
+}
+
+/**
+ * Converts `data` to a `Buffer`.
+ *
+ * @param {*} data The data to convert
+ * @return {Buffer} The buffer
+ * @throws {TypeError}
+ * @public
+ */
+function toBuffer(data) {
+ toBuffer.readOnly = true;
+
+ if (Buffer.isBuffer(data)) return data;
+
+ let buf;
+
+ if (data instanceof ArrayBuffer) {
+ buf = new FastBuffer(data);
+ } else if (ArrayBuffer.isView(data)) {
+ buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength);
+ } else {
+ buf = Buffer.from(data);
+ toBuffer.readOnly = false;
+ }
+
+ return buf;
+}
+
+module.exports = {
+ concat,
+ mask: _mask,
+ toArrayBuffer,
+ toBuffer,
+ unmask: _unmask
+};
+
+/* istanbul ignore else */
+if (!process.env.WS_NO_BUFFER_UTIL) {
+ try {
+ const bufferUtil = require('bufferutil');
+
+ module.exports.mask = function (source, mask, output, offset, length) {
+ if (length < 48) _mask(source, mask, output, offset, length);
+ else bufferUtil.mask(source, mask, output, offset, length);
+ };
+
+ module.exports.unmask = function (buffer, mask) {
+ if (buffer.length < 32) _unmask(buffer, mask);
+ else bufferUtil.unmask(buffer, mask);
+ };
+ } catch (e) {
+ // Continue regardless of the error.
+ }
+}
diff --git a/tools/ui/node_modules/ws/lib/constants.js b/tools/ui/node_modules/ws/lib/constants.js
new file mode 100644
index 0000000000000000000000000000000000000000..69b2fe3c43f5fb4323b7540ea1a4f1d3ddfc2d5c
--- /dev/null
+++ b/tools/ui/node_modules/ws/lib/constants.js
@@ -0,0 +1,19 @@
+'use strict';
+
+const BINARY_TYPES = ['nodebuffer', 'arraybuffer', 'fragments'];
+const hasBlob = typeof Blob !== 'undefined';
+
+if (hasBlob) BINARY_TYPES.push('blob');
+
+module.exports = {
+ BINARY_TYPES,
+ CLOSE_TIMEOUT: 30000,
+ EMPTY_BUFFER: Buffer.alloc(0),
+ GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11',
+ hasBlob,
+ kForOnEventAttribute: Symbol('kIsForOnEventAttribute'),
+ kListener: Symbol('kListener'),
+ kStatusCode: Symbol('status-code'),
+ kWebSocket: Symbol('websocket'),
+ NOOP: () => {}
+};
diff --git a/tools/ui/node_modules/ws/lib/event-target.js b/tools/ui/node_modules/ws/lib/event-target.js
new file mode 100644
index 0000000000000000000000000000000000000000..fea4cbc52c3299d0bd5fea32245360594812b5a5
--- /dev/null
+++ b/tools/ui/node_modules/ws/lib/event-target.js
@@ -0,0 +1,292 @@
+'use strict';
+
+const { kForOnEventAttribute, kListener } = require('./constants');
+
+const kCode = Symbol('kCode');
+const kData = Symbol('kData');
+const kError = Symbol('kError');
+const kMessage = Symbol('kMessage');
+const kReason = Symbol('kReason');
+const kTarget = Symbol('kTarget');
+const kType = Symbol('kType');
+const kWasClean = Symbol('kWasClean');
+
+/**
+ * Class representing an event.
+ */
+class Event {
+ /**
+ * Create a new `Event`.
+ *
+ * @param {String} type The name of the event
+ * @throws {TypeError} If the `type` argument is not specified
+ */
+ constructor(type) {
+ this[kTarget] = null;
+ this[kType] = type;
+ }
+
+ /**
+ * @type {*}
+ */
+ get target() {
+ return this[kTarget];
+ }
+
+ /**
+ * @type {String}
+ */
+ get type() {
+ return this[kType];
+ }
+}
+
+Object.defineProperty(Event.prototype, 'target', { enumerable: true });
+Object.defineProperty(Event.prototype, 'type', { enumerable: true });
+
+/**
+ * Class representing a close event.
+ *
+ * @extends Event
+ */
+class CloseEvent extends Event {
+ /**
+ * Create a new `CloseEvent`.
+ *
+ * @param {String} type The name of the event
+ * @param {Object} [options] A dictionary object that allows for setting
+ * attributes via object members of the same name
+ * @param {Number} [options.code=0] The status code explaining why the
+ * connection was closed
+ * @param {String} [options.reason=''] A human-readable string explaining why
+ * the connection was closed
+ * @param {Boolean} [options.wasClean=false] Indicates whether or not the
+ * connection was cleanly closed
+ */
+ constructor(type, options = {}) {
+ super(type);
+
+ this[kCode] = options.code === undefined ? 0 : options.code;
+ this[kReason] = options.reason === undefined ? '' : options.reason;
+ this[kWasClean] = options.wasClean === undefined ? false : options.wasClean;
+ }
+
+ /**
+ * @type {Number}
+ */
+ get code() {
+ return this[kCode];
+ }
+
+ /**
+ * @type {String}
+ */
+ get reason() {
+ return this[kReason];
+ }
+
+ /**
+ * @type {Boolean}
+ */
+ get wasClean() {
+ return this[kWasClean];
+ }
+}
+
+Object.defineProperty(CloseEvent.prototype, 'code', { enumerable: true });
+Object.defineProperty(CloseEvent.prototype, 'reason', { enumerable: true });
+Object.defineProperty(CloseEvent.prototype, 'wasClean', { enumerable: true });
+
+/**
+ * Class representing an error event.
+ *
+ * @extends Event
+ */
+class ErrorEvent extends Event {
+ /**
+ * Create a new `ErrorEvent`.
+ *
+ * @param {String} type The name of the event
+ * @param {Object} [options] A dictionary object that allows for setting
+ * attributes via object members of the same name
+ * @param {*} [options.error=null] The error that generated this event
+ * @param {String} [options.message=''] The error message
+ */
+ constructor(type, options = {}) {
+ super(type);
+
+ this[kError] = options.error === undefined ? null : options.error;
+ this[kMessage] = options.message === undefined ? '' : options.message;
+ }
+
+ /**
+ * @type {*}
+ */
+ get error() {
+ return this[kError];
+ }
+
+ /**
+ * @type {String}
+ */
+ get message() {
+ return this[kMessage];
+ }
+}
+
+Object.defineProperty(ErrorEvent.prototype, 'error', { enumerable: true });
+Object.defineProperty(ErrorEvent.prototype, 'message', { enumerable: true });
+
+/**
+ * Class representing a message event.
+ *
+ * @extends Event
+ */
+class MessageEvent extends Event {
+ /**
+ * Create a new `MessageEvent`.
+ *
+ * @param {String} type The name of the event
+ * @param {Object} [options] A dictionary object that allows for setting
+ * attributes via object members of the same name
+ * @param {*} [options.data=null] The message content
+ */
+ constructor(type, options = {}) {
+ super(type);
+
+ this[kData] = options.data === undefined ? null : options.data;
+ }
+
+ /**
+ * @type {*}
+ */
+ get data() {
+ return this[kData];
+ }
+}
+
+Object.defineProperty(MessageEvent.prototype, 'data', { enumerable: true });
+
+/**
+ * This provides methods for emulating the `EventTarget` interface. It's not
+ * meant to be used directly.
+ *
+ * @mixin
+ */
+const EventTarget = {
+ /**
+ * Register an event listener.
+ *
+ * @param {String} type A string representing the event type to listen for
+ * @param {(Function|Object)} handler The listener to add
+ * @param {Object} [options] An options object specifies characteristics about
+ * the event listener
+ * @param {Boolean} [options.once=false] A `Boolean` indicating that the
+ * listener should be invoked at most once after being added. If `true`,
+ * the listener would be automatically removed when invoked.
+ * @public
+ */
+ addEventListener(type, handler, options = {}) {
+ for (const listener of this.listeners(type)) {
+ if (
+ !options[kForOnEventAttribute] &&
+ listener[kListener] === handler &&
+ !listener[kForOnEventAttribute]
+ ) {
+ return;
+ }
+ }
+
+ let wrapper;
+
+ if (type === 'message') {
+ wrapper = function onMessage(data, isBinary) {
+ const event = new MessageEvent('message', {
+ data: isBinary ? data : data.toString()
+ });
+
+ event[kTarget] = this;
+ callListener(handler, this, event);
+ };
+ } else if (type === 'close') {
+ wrapper = function onClose(code, message) {
+ const event = new CloseEvent('close', {
+ code,
+ reason: message.toString(),
+ wasClean: this._closeFrameReceived && this._closeFrameSent
+ });
+
+ event[kTarget] = this;
+ callListener(handler, this, event);
+ };
+ } else if (type === 'error') {
+ wrapper = function onError(error) {
+ const event = new ErrorEvent('error', {
+ error,
+ message: error.message
+ });
+
+ event[kTarget] = this;
+ callListener(handler, this, event);
+ };
+ } else if (type === 'open') {
+ wrapper = function onOpen() {
+ const event = new Event('open');
+
+ event[kTarget] = this;
+ callListener(handler, this, event);
+ };
+ } else {
+ return;
+ }
+
+ wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];
+ wrapper[kListener] = handler;
+
+ if (options.once) {
+ this.once(type, wrapper);
+ } else {
+ this.on(type, wrapper);
+ }
+ },
+
+ /**
+ * Remove an event listener.
+ *
+ * @param {String} type A string representing the event type to remove
+ * @param {(Function|Object)} handler The listener to remove
+ * @public
+ */
+ removeEventListener(type, handler) {
+ for (const listener of this.listeners(type)) {
+ if (listener[kListener] === handler && !listener[kForOnEventAttribute]) {
+ this.removeListener(type, listener);
+ break;
+ }
+ }
+ }
+};
+
+module.exports = {
+ CloseEvent,
+ ErrorEvent,
+ Event,
+ EventTarget,
+ MessageEvent
+};
+
+/**
+ * Call an event listener
+ *
+ * @param {(Function|Object)} listener The listener to call
+ * @param {*} thisArg The value to use as `this`` when calling the listener
+ * @param {Event} event The event to pass to the listener
+ * @private
+ */
+function callListener(listener, thisArg, event) {
+ if (typeof listener === 'object' && listener.handleEvent) {
+ listener.handleEvent.call(listener, event);
+ } else {
+ listener.call(thisArg, event);
+ }
+}
diff --git a/tools/ui/node_modules/ws/lib/extension.js b/tools/ui/node_modules/ws/lib/extension.js
new file mode 100644
index 0000000000000000000000000000000000000000..3d7895c1b0608d4bef7073a6acea9be39a4f8b74
--- /dev/null
+++ b/tools/ui/node_modules/ws/lib/extension.js
@@ -0,0 +1,203 @@
+'use strict';
+
+const { tokenChars } = require('./validation');
+
+/**
+ * Adds an offer to the map of extension offers or a parameter to the map of
+ * parameters.
+ *
+ * @param {Object} dest The map of extension offers or parameters
+ * @param {String} name The extension or parameter name
+ * @param {(Object|Boolean|String)} elem The extension parameters or the
+ * parameter value
+ * @private
+ */
+function push(dest, name, elem) {
+ if (dest[name] === undefined) dest[name] = [elem];
+ else dest[name].push(elem);
+}
+
+/**
+ * Parses the `Sec-WebSocket-Extensions` header into an object.
+ *
+ * @param {String} header The field value of the header
+ * @return {Object} The parsed object
+ * @public
+ */
+function parse(header) {
+ const offers = Object.create(null);
+ let params = Object.create(null);
+ let mustUnescape = false;
+ let isEscaping = false;
+ let inQuotes = false;
+ let extensionName;
+ let paramName;
+ let start = -1;
+ let code = -1;
+ let end = -1;
+ let i = 0;
+
+ for (; i < header.length; i++) {
+ code = header.charCodeAt(i);
+
+ if (extensionName === undefined) {
+ if (end === -1 && tokenChars[code] === 1) {
+ if (start === -1) start = i;
+ } else if (
+ i !== 0 &&
+ (code === 0x20 /* ' ' */ || code === 0x09) /* '\t' */
+ ) {
+ if (end === -1 && start !== -1) end = i;
+ } else if (code === 0x3b /* ';' */ || code === 0x2c /* ',' */) {
+ if (start === -1) {
+ throw new SyntaxError(`Unexpected character at index ${i}`);
+ }
+
+ if (end === -1) end = i;
+ const name = header.slice(start, end);
+ if (code === 0x2c) {
+ push(offers, name, params);
+ params = Object.create(null);
+ } else {
+ extensionName = name;
+ }
+
+ start = end = -1;
+ } else {
+ throw new SyntaxError(`Unexpected character at index ${i}`);
+ }
+ } else if (paramName === undefined) {
+ if (end === -1 && tokenChars[code] === 1) {
+ if (start === -1) start = i;
+ } else if (code === 0x20 || code === 0x09) {
+ if (end === -1 && start !== -1) end = i;
+ } else if (code === 0x3b || code === 0x2c) {
+ if (start === -1) {
+ throw new SyntaxError(`Unexpected character at index ${i}`);
+ }
+
+ if (end === -1) end = i;
+ push(params, header.slice(start, end), true);
+ if (code === 0x2c) {
+ push(offers, extensionName, params);
+ params = Object.create(null);
+ extensionName = undefined;
+ }
+
+ start = end = -1;
+ } else if (code === 0x3d /* '=' */ && start !== -1 && end === -1) {
+ paramName = header.slice(start, i);
+ start = end = -1;
+ } else {
+ throw new SyntaxError(`Unexpected character at index ${i}`);
+ }
+ } else {
+ //
+ // The value of a quoted-string after unescaping must conform to the
+ // token ABNF, so only token characters are valid.
+ // Ref: https://tools.ietf.org/html/rfc6455#section-9.1
+ //
+ if (isEscaping) {
+ if (tokenChars[code] !== 1) {
+ throw new SyntaxError(`Unexpected character at index ${i}`);
+ }
+ if (start === -1) start = i;
+ else if (!mustUnescape) mustUnescape = true;
+ isEscaping = false;
+ } else if (inQuotes) {
+ if (tokenChars[code] === 1) {
+ if (start === -1) start = i;
+ } else if (code === 0x22 /* '"' */ && start !== -1) {
+ inQuotes = false;
+ end = i;
+ } else if (code === 0x5c /* '\' */) {
+ isEscaping = true;
+ } else {
+ throw new SyntaxError(`Unexpected character at index ${i}`);
+ }
+ } else if (code === 0x22 && header.charCodeAt(i - 1) === 0x3d) {
+ inQuotes = true;
+ } else if (end === -1 && tokenChars[code] === 1) {
+ if (start === -1) start = i;
+ } else if (start !== -1 && (code === 0x20 || code === 0x09)) {
+ if (end === -1) end = i;
+ } else if (code === 0x3b || code === 0x2c) {
+ if (start === -1) {
+ throw new SyntaxError(`Unexpected character at index ${i}`);
+ }
+
+ if (end === -1) end = i;
+ let value = header.slice(start, end);
+ if (mustUnescape) {
+ value = value.replace(/\\/g, '');
+ mustUnescape = false;
+ }
+ push(params, paramName, value);
+ if (code === 0x2c) {
+ push(offers, extensionName, params);
+ params = Object.create(null);
+ extensionName = undefined;
+ }
+
+ paramName = undefined;
+ start = end = -1;
+ } else {
+ throw new SyntaxError(`Unexpected character at index ${i}`);
+ }
+ }
+ }
+
+ if (start === -1 || inQuotes || code === 0x20 || code === 0x09) {
+ throw new SyntaxError('Unexpected end of input');
+ }
+
+ if (end === -1) end = i;
+ const token = header.slice(start, end);
+ if (extensionName === undefined) {
+ push(offers, token, params);
+ } else {
+ if (paramName === undefined) {
+ push(params, token, true);
+ } else if (mustUnescape) {
+ push(params, paramName, token.replace(/\\/g, ''));
+ } else {
+ push(params, paramName, token);
+ }
+ push(offers, extensionName, params);
+ }
+
+ return offers;
+}
+
+/**
+ * Builds the `Sec-WebSocket-Extensions` header field value.
+ *
+ * @param {Object} extensions The map of extensions and parameters to format
+ * @return {String} A string representing the given object
+ * @public
+ */
+function format(extensions) {
+ return Object.keys(extensions)
+ .map((extension) => {
+ let configurations = extensions[extension];
+ if (!Array.isArray(configurations)) configurations = [configurations];
+ return configurations
+ .map((params) => {
+ return [extension]
+ .concat(
+ Object.keys(params).map((k) => {
+ let values = params[k];
+ if (!Array.isArray(values)) values = [values];
+ return values
+ .map((v) => (v === true ? k : `${k}=${v}`))
+ .join('; ');
+ })
+ )
+ .join('; ');
+ })
+ .join(', ');
+ })
+ .join(', ');
+}
+
+module.exports = { format, parse };
diff --git a/tools/ui/node_modules/ws/lib/limiter.js b/tools/ui/node_modules/ws/lib/limiter.js
new file mode 100644
index 0000000000000000000000000000000000000000..3fd35784ea9ea59cff8c112b6556a89cde7f7b6f
--- /dev/null
+++ b/tools/ui/node_modules/ws/lib/limiter.js
@@ -0,0 +1,55 @@
+'use strict';
+
+const kDone = Symbol('kDone');
+const kRun = Symbol('kRun');
+
+/**
+ * A very simple job queue with adjustable concurrency. Adapted from
+ * https://github.com/STRML/async-limiter
+ */
+class Limiter {
+ /**
+ * Creates a new `Limiter`.
+ *
+ * @param {Number} [concurrency=Infinity] The maximum number of jobs allowed
+ * to run concurrently
+ */
+ constructor(concurrency) {
+ this[kDone] = () => {
+ this.pending--;
+ this[kRun]();
+ };
+ this.concurrency = concurrency || Infinity;
+ this.jobs = [];
+ this.pending = 0;
+ }
+
+ /**
+ * Adds a job to the queue.
+ *
+ * @param {Function} job The job to run
+ * @public
+ */
+ add(job) {
+ this.jobs.push(job);
+ this[kRun]();
+ }
+
+ /**
+ * Removes a job from the queue and runs it if possible.
+ *
+ * @private
+ */
+ [kRun]() {
+ if (this.pending === this.concurrency) return;
+
+ if (this.jobs.length) {
+ const job = this.jobs.shift();
+
+ this.pending++;
+ job(this[kDone]);
+ }
+ }
+}
+
+module.exports = Limiter;
diff --git a/tools/ui/node_modules/ws/lib/permessage-deflate.js b/tools/ui/node_modules/ws/lib/permessage-deflate.js
new file mode 100644
index 0000000000000000000000000000000000000000..aa5db761dfa56144c1dc2d5d8c74b36101607f12
--- /dev/null
+++ b/tools/ui/node_modules/ws/lib/permessage-deflate.js
@@ -0,0 +1,528 @@
+'use strict';
+
+const zlib = require('zlib');
+
+const bufferUtil = require('./buffer-util');
+const Limiter = require('./limiter');
+const { kStatusCode } = require('./constants');
+
+const FastBuffer = Buffer[Symbol.species];
+const TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]);
+const kPerMessageDeflate = Symbol('permessage-deflate');
+const kTotalLength = Symbol('total-length');
+const kCallback = Symbol('callback');
+const kBuffers = Symbol('buffers');
+const kError = Symbol('error');
+
+//
+// We limit zlib concurrency, which prevents severe memory fragmentation
+// as documented in https://github.com/nodejs/node/issues/8871#issuecomment-250915913
+// and https://github.com/websockets/ws/issues/1202
+//
+// Intentionally global; it's the global thread pool that's an issue.
+//
+let zlibLimiter;
+
+/**
+ * permessage-deflate implementation.
+ */
+class PerMessageDeflate {
+ /**
+ * Creates a PerMessageDeflate instance.
+ *
+ * @param {Object} [options] Configuration options
+ * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support
+ * for, or request, a custom client window size
+ * @param {Boolean} [options.clientNoContextTakeover=false] Advertise/
+ * acknowledge disabling of client context takeover
+ * @param {Number} [options.concurrencyLimit=10] The number of concurrent
+ * calls to zlib
+ * @param {Boolean} [options.isServer=false] Create the instance in either
+ * server or client mode
+ * @param {Number} [options.maxPayload=0] The maximum allowed message length
+ * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the
+ * use of a custom server window size
+ * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept
+ * disabling of server context takeover
+ * @param {Number} [options.threshold=1024] Size (in bytes) below which
+ * messages should not be compressed if context takeover is disabled
+ * @param {Object} [options.zlibDeflateOptions] Options to pass to zlib on
+ * deflate
+ * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on
+ * inflate
+ */
+ constructor(options) {
+ this._options = options || {};
+ this._threshold =
+ this._options.threshold !== undefined ? this._options.threshold : 1024;
+ this._maxPayload = this._options.maxPayload | 0;
+ this._isServer = !!this._options.isServer;
+ this._deflate = null;
+ this._inflate = null;
+
+ this.params = null;
+
+ if (!zlibLimiter) {
+ const concurrency =
+ this._options.concurrencyLimit !== undefined
+ ? this._options.concurrencyLimit
+ : 10;
+ zlibLimiter = new Limiter(concurrency);
+ }
+ }
+
+ /**
+ * @type {String}
+ */
+ static get extensionName() {
+ return 'permessage-deflate';
+ }
+
+ /**
+ * Create an extension negotiation offer.
+ *
+ * @return {Object} Extension parameters
+ * @public
+ */
+ offer() {
+ const params = {};
+
+ if (this._options.serverNoContextTakeover) {
+ params.server_no_context_takeover = true;
+ }
+ if (this._options.clientNoContextTakeover) {
+ params.client_no_context_takeover = true;
+ }
+ if (this._options.serverMaxWindowBits) {
+ params.server_max_window_bits = this._options.serverMaxWindowBits;
+ }
+ if (this._options.clientMaxWindowBits) {
+ params.client_max_window_bits = this._options.clientMaxWindowBits;
+ } else if (this._options.clientMaxWindowBits == null) {
+ params.client_max_window_bits = true;
+ }
+
+ return params;
+ }
+
+ /**
+ * Accept an extension negotiation offer/response.
+ *
+ * @param {Array} configurations The extension negotiation offers/reponse
+ * @return {Object} Accepted configuration
+ * @public
+ */
+ accept(configurations) {
+ configurations = this.normalizeParams(configurations);
+
+ this.params = this._isServer
+ ? this.acceptAsServer(configurations)
+ : this.acceptAsClient(configurations);
+
+ return this.params;
+ }
+
+ /**
+ * Releases all resources used by the extension.
+ *
+ * @public
+ */
+ cleanup() {
+ if (this._inflate) {
+ this._inflate.close();
+ this._inflate = null;
+ }
+
+ if (this._deflate) {
+ const callback = this._deflate[kCallback];
+
+ this._deflate.close();
+ this._deflate = null;
+
+ if (callback) {
+ callback(
+ new Error(
+ 'The deflate stream was closed while data was being processed'
+ )
+ );
+ }
+ }
+ }
+
+ /**
+ * Accept an extension negotiation offer.
+ *
+ * @param {Array} offers The extension negotiation offers
+ * @return {Object} Accepted configuration
+ * @private
+ */
+ acceptAsServer(offers) {
+ const opts = this._options;
+ const accepted = offers.find((params) => {
+ if (
+ (opts.serverNoContextTakeover === false &&
+ params.server_no_context_takeover) ||
+ (params.server_max_window_bits &&
+ (opts.serverMaxWindowBits === false ||
+ (typeof opts.serverMaxWindowBits === 'number' &&
+ opts.serverMaxWindowBits > params.server_max_window_bits))) ||
+ (typeof opts.clientMaxWindowBits === 'number' &&
+ !params.client_max_window_bits)
+ ) {
+ return false;
+ }
+
+ return true;
+ });
+
+ if (!accepted) {
+ throw new Error('None of the extension offers can be accepted');
+ }
+
+ if (opts.serverNoContextTakeover) {
+ accepted.server_no_context_takeover = true;
+ }
+ if (opts.clientNoContextTakeover) {
+ accepted.client_no_context_takeover = true;
+ }
+ if (typeof opts.serverMaxWindowBits === 'number') {
+ accepted.server_max_window_bits = opts.serverMaxWindowBits;
+ }
+ if (typeof opts.clientMaxWindowBits === 'number') {
+ accepted.client_max_window_bits = opts.clientMaxWindowBits;
+ } else if (
+ accepted.client_max_window_bits === true ||
+ opts.clientMaxWindowBits === false
+ ) {
+ delete accepted.client_max_window_bits;
+ }
+
+ return accepted;
+ }
+
+ /**
+ * Accept the extension negotiation response.
+ *
+ * @param {Array} response The extension negotiation response
+ * @return {Object} Accepted configuration
+ * @private
+ */
+ acceptAsClient(response) {
+ const params = response[0];
+
+ if (
+ this._options.clientNoContextTakeover === false &&
+ params.client_no_context_takeover
+ ) {
+ throw new Error('Unexpected parameter "client_no_context_takeover"');
+ }
+
+ if (!params.client_max_window_bits) {
+ if (typeof this._options.clientMaxWindowBits === 'number') {
+ params.client_max_window_bits = this._options.clientMaxWindowBits;
+ }
+ } else if (
+ this._options.clientMaxWindowBits === false ||
+ (typeof this._options.clientMaxWindowBits === 'number' &&
+ params.client_max_window_bits > this._options.clientMaxWindowBits)
+ ) {
+ throw new Error(
+ 'Unexpected or invalid parameter "client_max_window_bits"'
+ );
+ }
+
+ return params;
+ }
+
+ /**
+ * Normalize parameters.
+ *
+ * @param {Array} configurations The extension negotiation offers/reponse
+ * @return {Array} The offers/response with normalized parameters
+ * @private
+ */
+ normalizeParams(configurations) {
+ configurations.forEach((params) => {
+ Object.keys(params).forEach((key) => {
+ let value = params[key];
+
+ if (value.length > 1) {
+ throw new Error(`Parameter "${key}" must have only a single value`);
+ }
+
+ value = value[0];
+
+ if (key === 'client_max_window_bits') {
+ if (value !== true) {
+ const num = +value;
+ if (!Number.isInteger(num) || num < 8 || num > 15) {
+ throw new TypeError(
+ `Invalid value for parameter "${key}": ${value}`
+ );
+ }
+ value = num;
+ } else if (!this._isServer) {
+ throw new TypeError(
+ `Invalid value for parameter "${key}": ${value}`
+ );
+ }
+ } else if (key === 'server_max_window_bits') {
+ const num = +value;
+ if (!Number.isInteger(num) || num < 8 || num > 15) {
+ throw new TypeError(
+ `Invalid value for parameter "${key}": ${value}`
+ );
+ }
+ value = num;
+ } else if (
+ key === 'client_no_context_takeover' ||
+ key === 'server_no_context_takeover'
+ ) {
+ if (value !== true) {
+ throw new TypeError(
+ `Invalid value for parameter "${key}": ${value}`
+ );
+ }
+ } else {
+ throw new Error(`Unknown parameter "${key}"`);
+ }
+
+ params[key] = value;
+ });
+ });
+
+ return configurations;
+ }
+
+ /**
+ * Decompress data. Concurrency limited.
+ *
+ * @param {Buffer} data Compressed data
+ * @param {Boolean} fin Specifies whether or not this is the last fragment
+ * @param {Function} callback Callback
+ * @public
+ */
+ decompress(data, fin, callback) {
+ zlibLimiter.add((done) => {
+ this._decompress(data, fin, (err, result) => {
+ done();
+ callback(err, result);
+ });
+ });
+ }
+
+ /**
+ * Compress data. Concurrency limited.
+ *
+ * @param {(Buffer|String)} data Data to compress
+ * @param {Boolean} fin Specifies whether or not this is the last fragment
+ * @param {Function} callback Callback
+ * @public
+ */
+ compress(data, fin, callback) {
+ zlibLimiter.add((done) => {
+ this._compress(data, fin, (err, result) => {
+ done();
+ callback(err, result);
+ });
+ });
+ }
+
+ /**
+ * Decompress data.
+ *
+ * @param {Buffer} data Compressed data
+ * @param {Boolean} fin Specifies whether or not this is the last fragment
+ * @param {Function} callback Callback
+ * @private
+ */
+ _decompress(data, fin, callback) {
+ const endpoint = this._isServer ? 'client' : 'server';
+
+ if (!this._inflate) {
+ const key = `${endpoint}_max_window_bits`;
+ const windowBits =
+ typeof this.params[key] !== 'number'
+ ? zlib.Z_DEFAULT_WINDOWBITS
+ : this.params[key];
+
+ this._inflate = zlib.createInflateRaw({
+ ...this._options.zlibInflateOptions,
+ windowBits
+ });
+ this._inflate[kPerMessageDeflate] = this;
+ this._inflate[kTotalLength] = 0;
+ this._inflate[kBuffers] = [];
+ this._inflate.on('error', inflateOnError);
+ this._inflate.on('data', inflateOnData);
+ }
+
+ this._inflate[kCallback] = callback;
+
+ this._inflate.write(data);
+ if (fin) this._inflate.write(TRAILER);
+
+ this._inflate.flush(() => {
+ const err = this._inflate[kError];
+
+ if (err) {
+ this._inflate.close();
+ this._inflate = null;
+ callback(err);
+ return;
+ }
+
+ const data = bufferUtil.concat(
+ this._inflate[kBuffers],
+ this._inflate[kTotalLength]
+ );
+
+ if (this._inflate._readableState.endEmitted) {
+ this._inflate.close();
+ this._inflate = null;
+ } else {
+ this._inflate[kTotalLength] = 0;
+ this._inflate[kBuffers] = [];
+
+ if (fin && this.params[`${endpoint}_no_context_takeover`]) {
+ this._inflate.reset();
+ }
+ }
+
+ callback(null, data);
+ });
+ }
+
+ /**
+ * Compress data.
+ *
+ * @param {(Buffer|String)} data Data to compress
+ * @param {Boolean} fin Specifies whether or not this is the last fragment
+ * @param {Function} callback Callback
+ * @private
+ */
+ _compress(data, fin, callback) {
+ const endpoint = this._isServer ? 'server' : 'client';
+
+ if (!this._deflate) {
+ const key = `${endpoint}_max_window_bits`;
+ const windowBits =
+ typeof this.params[key] !== 'number'
+ ? zlib.Z_DEFAULT_WINDOWBITS
+ : this.params[key];
+
+ this._deflate = zlib.createDeflateRaw({
+ ...this._options.zlibDeflateOptions,
+ windowBits
+ });
+
+ this._deflate[kTotalLength] = 0;
+ this._deflate[kBuffers] = [];
+
+ this._deflate.on('data', deflateOnData);
+ }
+
+ this._deflate[kCallback] = callback;
+
+ this._deflate.write(data);
+ this._deflate.flush(zlib.Z_SYNC_FLUSH, () => {
+ if (!this._deflate) {
+ //
+ // The deflate stream was closed while data was being processed.
+ //
+ return;
+ }
+
+ let data = bufferUtil.concat(
+ this._deflate[kBuffers],
+ this._deflate[kTotalLength]
+ );
+
+ if (fin) {
+ data = new FastBuffer(data.buffer, data.byteOffset, data.length - 4);
+ }
+
+ //
+ // Ensure that the callback will not be called again in
+ // `PerMessageDeflate#cleanup()`.
+ //
+ this._deflate[kCallback] = null;
+
+ this._deflate[kTotalLength] = 0;
+ this._deflate[kBuffers] = [];
+
+ if (fin && this.params[`${endpoint}_no_context_takeover`]) {
+ this._deflate.reset();
+ }
+
+ callback(null, data);
+ });
+ }
+}
+
+module.exports = PerMessageDeflate;
+
+/**
+ * The listener of the `zlib.DeflateRaw` stream `'data'` event.
+ *
+ * @param {Buffer} chunk A chunk of data
+ * @private
+ */
+function deflateOnData(chunk) {
+ this[kBuffers].push(chunk);
+ this[kTotalLength] += chunk.length;
+}
+
+/**
+ * The listener of the `zlib.InflateRaw` stream `'data'` event.
+ *
+ * @param {Buffer} chunk A chunk of data
+ * @private
+ */
+function inflateOnData(chunk) {
+ this[kTotalLength] += chunk.length;
+
+ if (
+ this[kPerMessageDeflate]._maxPayload < 1 ||
+ this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload
+ ) {
+ this[kBuffers].push(chunk);
+ return;
+ }
+
+ this[kError] = new RangeError('Max payload size exceeded');
+ this[kError].code = 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH';
+ this[kError][kStatusCode] = 1009;
+ this.removeListener('data', inflateOnData);
+
+ //
+ // The choice to employ `zlib.reset()` over `zlib.close()` is dictated by the
+ // fact that in Node.js versions prior to 13.10.0, the callback for
+ // `zlib.flush()` is not called if `zlib.close()` is used. Utilizing
+ // `zlib.reset()` ensures that either the callback is invoked or an error is
+ // emitted.
+ //
+ this.reset();
+}
+
+/**
+ * The listener of the `zlib.InflateRaw` stream `'error'` event.
+ *
+ * @param {Error} err The emitted error
+ * @private
+ */
+function inflateOnError(err) {
+ //
+ // There is no need to call `Zlib#close()` as the handle is automatically
+ // closed when an error is emitted.
+ //
+ this[kPerMessageDeflate]._inflate = null;
+
+ if (this[kError]) {
+ this[kCallback](this[kError]);
+ return;
+ }
+
+ err[kStatusCode] = 1007;
+ this[kCallback](err);
+}
diff --git a/tools/ui/node_modules/ws/lib/receiver.js b/tools/ui/node_modules/ws/lib/receiver.js
new file mode 100644
index 0000000000000000000000000000000000000000..784dbe1b5d6018eb631102251e8681ccc993a571
--- /dev/null
+++ b/tools/ui/node_modules/ws/lib/receiver.js
@@ -0,0 +1,743 @@
+'use strict';
+
+const { Writable } = require('stream');
+
+const PerMessageDeflate = require('./permessage-deflate');
+const {
+ BINARY_TYPES,
+ EMPTY_BUFFER,
+ kStatusCode,
+ kWebSocket
+} = require('./constants');
+const { concat, toArrayBuffer, unmask } = require('./buffer-util');
+const { isValidStatusCode, isValidUTF8 } = require('./validation');
+
+const FastBuffer = Buffer[Symbol.species];
+
+const GET_INFO = 0;
+const GET_PAYLOAD_LENGTH_16 = 1;
+const GET_PAYLOAD_LENGTH_64 = 2;
+const GET_MASK = 3;
+const GET_DATA = 4;
+const INFLATING = 5;
+const DEFER_EVENT = 6;
+
+/**
+ * HyBi Receiver implementation.
+ *
+ * @extends Writable
+ */
+class Receiver extends Writable {
+ /**
+ * Creates a Receiver instance.
+ *
+ * @param {Object} [options] Options object
+ * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether
+ * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
+ * multiple times in the same tick
+ * @param {String} [options.binaryType=nodebuffer] The type for binary data
+ * @param {Object} [options.extensions] An object containing the negotiated
+ * extensions
+ * @param {Boolean} [options.isServer=false] Specifies whether to operate in
+ * client or server mode
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
+ * buffered data chunks
+ * @param {Number} [options.maxFragments=0] The maximum number of message
+ * fragments
+ * @param {Number} [options.maxPayload=0] The maximum allowed message length
+ * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
+ * not to skip UTF-8 validation for text and close messages
+ */
+ constructor(options = {}) {
+ super();
+
+ this._allowSynchronousEvents =
+ options.allowSynchronousEvents !== undefined
+ ? options.allowSynchronousEvents
+ : true;
+ this._binaryType = options.binaryType || BINARY_TYPES[0];
+ this._extensions = options.extensions || {};
+ this._isServer = !!options.isServer;
+ this._maxBufferedChunks = options.maxBufferedChunks | 0;
+ this._maxFragments = options.maxFragments | 0;
+ this._maxPayload = options.maxPayload | 0;
+ this._skipUTF8Validation = !!options.skipUTF8Validation;
+ this[kWebSocket] = undefined;
+
+ this._bufferedBytes = 0;
+ this._buffers = [];
+
+ this._compressed = false;
+ this._payloadLength = 0;
+ this._mask = undefined;
+ this._fragmented = 0;
+ this._masked = false;
+ this._fin = false;
+ this._opcode = 0;
+
+ this._totalPayloadLength = 0;
+ this._messageLength = 0;
+ this._numFragments = 0;
+ this._fragments = [];
+
+ this._errored = false;
+ this._loop = false;
+ this._state = GET_INFO;
+ }
+
+ /**
+ * Implements `Writable.prototype._write()`.
+ *
+ * @param {Buffer} chunk The chunk of data to write
+ * @param {String} encoding The character encoding of `chunk`
+ * @param {Function} cb Callback
+ * @private
+ */
+ _write(chunk, encoding, cb) {
+ if (this._opcode === 0x08 && this._state == GET_INFO) return cb();
+
+ if (
+ this._maxBufferedChunks > 0 &&
+ this._buffers.length >= this._maxBufferedChunks
+ ) {
+ cb(
+ this.createError(
+ RangeError,
+ 'Too many buffered chunks',
+ false,
+ 1008,
+ 'WS_ERR_TOO_MANY_BUFFERED_PARTS'
+ )
+ );
+ return;
+ }
+
+ this._bufferedBytes += chunk.length;
+ this._buffers.push(chunk);
+ this.startLoop(cb);
+ }
+
+ /**
+ * Consumes `n` bytes from the buffered data.
+ *
+ * @param {Number} n The number of bytes to consume
+ * @return {Buffer} The consumed bytes
+ * @private
+ */
+ consume(n) {
+ this._bufferedBytes -= n;
+
+ if (n === this._buffers[0].length) return this._buffers.shift();
+
+ if (n < this._buffers[0].length) {
+ const buf = this._buffers[0];
+ this._buffers[0] = new FastBuffer(
+ buf.buffer,
+ buf.byteOffset + n,
+ buf.length - n
+ );
+
+ return new FastBuffer(buf.buffer, buf.byteOffset, n);
+ }
+
+ const dst = Buffer.allocUnsafe(n);
+
+ do {
+ const buf = this._buffers[0];
+ const offset = dst.length - n;
+
+ if (n >= buf.length) {
+ dst.set(this._buffers.shift(), offset);
+ } else {
+ dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset);
+ this._buffers[0] = new FastBuffer(
+ buf.buffer,
+ buf.byteOffset + n,
+ buf.length - n
+ );
+ }
+
+ n -= buf.length;
+ } while (n > 0);
+
+ return dst;
+ }
+
+ /**
+ * Starts the parsing loop.
+ *
+ * @param {Function} cb Callback
+ * @private
+ */
+ startLoop(cb) {
+ this._loop = true;
+
+ do {
+ switch (this._state) {
+ case GET_INFO:
+ this.getInfo(cb);
+ break;
+ case GET_PAYLOAD_LENGTH_16:
+ this.getPayloadLength16(cb);
+ break;
+ case GET_PAYLOAD_LENGTH_64:
+ this.getPayloadLength64(cb);
+ break;
+ case GET_MASK:
+ this.getMask();
+ break;
+ case GET_DATA:
+ this.getData(cb);
+ break;
+ case INFLATING:
+ case DEFER_EVENT:
+ this._loop = false;
+ return;
+ }
+ } while (this._loop);
+
+ if (!this._errored) cb();
+ }
+
+ /**
+ * Reads the first two bytes of a frame.
+ *
+ * @param {Function} cb Callback
+ * @private
+ */
+ getInfo(cb) {
+ if (this._bufferedBytes < 2) {
+ this._loop = false;
+ return;
+ }
+
+ const buf = this.consume(2);
+
+ if ((buf[0] & 0x30) !== 0x00) {
+ const error = this.createError(
+ RangeError,
+ 'RSV2 and RSV3 must be clear',
+ true,
+ 1002,
+ 'WS_ERR_UNEXPECTED_RSV_2_3'
+ );
+
+ cb(error);
+ return;
+ }
+
+ const compressed = (buf[0] & 0x40) === 0x40;
+
+ if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
+ const error = this.createError(
+ RangeError,
+ 'RSV1 must be clear',
+ true,
+ 1002,
+ 'WS_ERR_UNEXPECTED_RSV_1'
+ );
+
+ cb(error);
+ return;
+ }
+
+ this._fin = (buf[0] & 0x80) === 0x80;
+ this._opcode = buf[0] & 0x0f;
+ this._payloadLength = buf[1] & 0x7f;
+
+ if (this._opcode === 0x00) {
+ if (compressed) {
+ const error = this.createError(
+ RangeError,
+ 'RSV1 must be clear',
+ true,
+ 1002,
+ 'WS_ERR_UNEXPECTED_RSV_1'
+ );
+
+ cb(error);
+ return;
+ }
+
+ if (!this._fragmented) {
+ const error = this.createError(
+ RangeError,
+ 'invalid opcode 0',
+ true,
+ 1002,
+ 'WS_ERR_INVALID_OPCODE'
+ );
+
+ cb(error);
+ return;
+ }
+
+ this._opcode = this._fragmented;
+ } else if (this._opcode === 0x01 || this._opcode === 0x02) {
+ if (this._fragmented) {
+ const error = this.createError(
+ RangeError,
+ `invalid opcode ${this._opcode}`,
+ true,
+ 1002,
+ 'WS_ERR_INVALID_OPCODE'
+ );
+
+ cb(error);
+ return;
+ }
+
+ this._compressed = compressed;
+ } else if (this._opcode > 0x07 && this._opcode < 0x0b) {
+ if (!this._fin) {
+ const error = this.createError(
+ RangeError,
+ 'FIN must be set',
+ true,
+ 1002,
+ 'WS_ERR_EXPECTED_FIN'
+ );
+
+ cb(error);
+ return;
+ }
+
+ if (compressed) {
+ const error = this.createError(
+ RangeError,
+ 'RSV1 must be clear',
+ true,
+ 1002,
+ 'WS_ERR_UNEXPECTED_RSV_1'
+ );
+
+ cb(error);
+ return;
+ }
+
+ if (
+ this._payloadLength > 0x7d ||
+ (this._opcode === 0x08 && this._payloadLength === 1)
+ ) {
+ const error = this.createError(
+ RangeError,
+ `invalid payload length ${this._payloadLength}`,
+ true,
+ 1002,
+ 'WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH'
+ );
+
+ cb(error);
+ return;
+ }
+ } else {
+ const error = this.createError(
+ RangeError,
+ `invalid opcode ${this._opcode}`,
+ true,
+ 1002,
+ 'WS_ERR_INVALID_OPCODE'
+ );
+
+ cb(error);
+ return;
+ }
+
+ if (!this._fin && !this._fragmented) this._fragmented = this._opcode;
+ this._masked = (buf[1] & 0x80) === 0x80;
+
+ if (this._isServer) {
+ if (!this._masked) {
+ const error = this.createError(
+ RangeError,
+ 'MASK must be set',
+ true,
+ 1002,
+ 'WS_ERR_EXPECTED_MASK'
+ );
+
+ cb(error);
+ return;
+ }
+ } else if (this._masked) {
+ const error = this.createError(
+ RangeError,
+ 'MASK must be clear',
+ true,
+ 1002,
+ 'WS_ERR_UNEXPECTED_MASK'
+ );
+
+ cb(error);
+ return;
+ }
+
+ if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;
+ else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64;
+ else this.haveLength(cb);
+ }
+
+ /**
+ * Gets extended payload length (7+16).
+ *
+ * @param {Function} cb Callback
+ * @private
+ */
+ getPayloadLength16(cb) {
+ if (this._bufferedBytes < 2) {
+ this._loop = false;
+ return;
+ }
+
+ this._payloadLength = this.consume(2).readUInt16BE(0);
+ this.haveLength(cb);
+ }
+
+ /**
+ * Gets extended payload length (7+64).
+ *
+ * @param {Function} cb Callback
+ * @private
+ */
+ getPayloadLength64(cb) {
+ if (this._bufferedBytes < 8) {
+ this._loop = false;
+ return;
+ }
+
+ const buf = this.consume(8);
+ const num = buf.readUInt32BE(0);
+
+ //
+ // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned
+ // if payload length is greater than this number.
+ //
+ if (num > Math.pow(2, 53 - 32) - 1) {
+ const error = this.createError(
+ RangeError,
+ 'Unsupported WebSocket frame: payload length > 2^53 - 1',
+ false,
+ 1009,
+ 'WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH'
+ );
+
+ cb(error);
+ return;
+ }
+
+ this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
+ this.haveLength(cb);
+ }
+
+ /**
+ * Payload length has been read.
+ *
+ * @param {Function} cb Callback
+ * @private
+ */
+ haveLength(cb) {
+ if (this._payloadLength && this._opcode < 0x08) {
+ this._totalPayloadLength += this._payloadLength;
+ if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
+ const error = this.createError(
+ RangeError,
+ 'Max payload size exceeded',
+ false,
+ 1009,
+ 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'
+ );
+
+ cb(error);
+ return;
+ }
+ }
+
+ if (this._masked) this._state = GET_MASK;
+ else this._state = GET_DATA;
+ }
+
+ /**
+ * Reads mask bytes.
+ *
+ * @private
+ */
+ getMask() {
+ if (this._bufferedBytes < 4) {
+ this._loop = false;
+ return;
+ }
+
+ this._mask = this.consume(4);
+ this._state = GET_DATA;
+ }
+
+ /**
+ * Reads data bytes.
+ *
+ * @param {Function} cb Callback
+ * @private
+ */
+ getData(cb) {
+ let data = EMPTY_BUFFER;
+
+ if (this._payloadLength) {
+ if (this._bufferedBytes < this._payloadLength) {
+ this._loop = false;
+ return;
+ }
+
+ data = this.consume(this._payloadLength);
+
+ if (
+ this._masked &&
+ (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0
+ ) {
+ unmask(data, this._mask);
+ }
+ }
+
+ if (this._opcode > 0x07) {
+ this.controlMessage(data, cb);
+ return;
+ }
+
+ if (this._maxFragments > 0 && ++this._numFragments > this._maxFragments) {
+ const error = this.createError(
+ RangeError,
+ 'Too many message fragments',
+ false,
+ 1008,
+ 'WS_ERR_TOO_MANY_BUFFERED_PARTS'
+ );
+
+ cb(error);
+ return;
+ }
+
+ if (this._compressed) {
+ this._state = INFLATING;
+ this.decompress(data, cb);
+ return;
+ }
+
+ if (data.length) {
+ //
+ // This message is not compressed so its length is the sum of the payload
+ // length of all fragments.
+ //
+ this._messageLength = this._totalPayloadLength;
+ this._fragments.push(data);
+ }
+
+ this.dataMessage(cb);
+ }
+
+ /**
+ * Decompresses data.
+ *
+ * @param {Buffer} data Compressed data
+ * @param {Function} cb Callback
+ * @private
+ */
+ decompress(data, cb) {
+ const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
+
+ perMessageDeflate.decompress(data, this._fin, (err, buf) => {
+ if (err) return cb(err);
+
+ if (buf.length) {
+ this._messageLength += buf.length;
+ if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
+ const error = this.createError(
+ RangeError,
+ 'Max payload size exceeded',
+ false,
+ 1009,
+ 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'
+ );
+
+ cb(error);
+ return;
+ }
+
+ this._fragments.push(buf);
+ }
+
+ this.dataMessage(cb);
+ if (this._state === GET_INFO) this.startLoop(cb);
+ });
+ }
+
+ /**
+ * Handles a data message.
+ *
+ * @param {Function} cb Callback
+ * @private
+ */
+ dataMessage(cb) {
+ if (!this._fin) {
+ this._state = GET_INFO;
+ return;
+ }
+
+ const messageLength = this._messageLength;
+ const fragments = this._fragments;
+
+ this._totalPayloadLength = 0;
+ this._messageLength = 0;
+ this._fragmented = 0;
+ this._numFragments = 0;
+ this._fragments = [];
+
+ if (this._opcode === 2) {
+ let data;
+
+ if (this._binaryType === 'nodebuffer') {
+ data = concat(fragments, messageLength);
+ } else if (this._binaryType === 'arraybuffer') {
+ data = toArrayBuffer(concat(fragments, messageLength));
+ } else if (this._binaryType === 'blob') {
+ data = new Blob(fragments);
+ } else {
+ data = fragments;
+ }
+
+ if (this._allowSynchronousEvents) {
+ this.emit('message', data, true);
+ this._state = GET_INFO;
+ } else {
+ this._state = DEFER_EVENT;
+ setImmediate(() => {
+ this.emit('message', data, true);
+ this._state = GET_INFO;
+ this.startLoop(cb);
+ });
+ }
+ } else {
+ const buf = concat(fragments, messageLength);
+
+ if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
+ const error = this.createError(
+ Error,
+ 'invalid UTF-8 sequence',
+ true,
+ 1007,
+ 'WS_ERR_INVALID_UTF8'
+ );
+
+ cb(error);
+ return;
+ }
+
+ if (this._state === INFLATING || this._allowSynchronousEvents) {
+ this.emit('message', buf, false);
+ this._state = GET_INFO;
+ } else {
+ this._state = DEFER_EVENT;
+ setImmediate(() => {
+ this.emit('message', buf, false);
+ this._state = GET_INFO;
+ this.startLoop(cb);
+ });
+ }
+ }
+ }
+
+ /**
+ * Handles a control message.
+ *
+ * @param {Buffer} data Data to handle
+ * @return {(Error|RangeError|undefined)} A possible error
+ * @private
+ */
+ controlMessage(data, cb) {
+ if (this._opcode === 0x08) {
+ if (data.length === 0) {
+ this._loop = false;
+ this.emit('conclude', 1005, EMPTY_BUFFER);
+ this.end();
+ } else {
+ const code = data.readUInt16BE(0);
+
+ if (!isValidStatusCode(code)) {
+ const error = this.createError(
+ RangeError,
+ `invalid status code ${code}`,
+ true,
+ 1002,
+ 'WS_ERR_INVALID_CLOSE_CODE'
+ );
+
+ cb(error);
+ return;
+ }
+
+ const buf = new FastBuffer(
+ data.buffer,
+ data.byteOffset + 2,
+ data.length - 2
+ );
+
+ if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
+ const error = this.createError(
+ Error,
+ 'invalid UTF-8 sequence',
+ true,
+ 1007,
+ 'WS_ERR_INVALID_UTF8'
+ );
+
+ cb(error);
+ return;
+ }
+
+ this._loop = false;
+ this.emit('conclude', code, buf);
+ this.end();
+ }
+
+ this._state = GET_INFO;
+ return;
+ }
+
+ if (this._allowSynchronousEvents) {
+ this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data);
+ this._state = GET_INFO;
+ } else {
+ this._state = DEFER_EVENT;
+ setImmediate(() => {
+ this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data);
+ this._state = GET_INFO;
+ this.startLoop(cb);
+ });
+ }
+ }
+
+ /**
+ * Builds an error object.
+ *
+ * @param {function(new:Error|RangeError)} ErrorCtor The error constructor
+ * @param {String} message The error message
+ * @param {Boolean} prefix Specifies whether or not to add a default prefix to
+ * `message`
+ * @param {Number} statusCode The status code
+ * @param {String} errorCode The exposed error code
+ * @return {(Error|RangeError)} The error
+ * @private
+ */
+ createError(ErrorCtor, message, prefix, statusCode, errorCode) {
+ this._loop = false;
+ this._errored = true;
+
+ const err = new ErrorCtor(
+ prefix ? `Invalid WebSocket frame: ${message}` : message
+ );
+
+ Error.captureStackTrace(err, this.createError);
+ err.code = errorCode;
+ err[kStatusCode] = statusCode;
+ return err;
+ }
+}
+
+module.exports = Receiver;
diff --git a/tools/ui/node_modules/ws/lib/sender.js b/tools/ui/node_modules/ws/lib/sender.js
new file mode 100644
index 0000000000000000000000000000000000000000..2c767e2c62a7fb50a987454f0c148ec5b4a0a523
--- /dev/null
+++ b/tools/ui/node_modules/ws/lib/sender.js
@@ -0,0 +1,607 @@
+/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex" }] */
+
+'use strict';
+
+const { Duplex } = require('stream');
+const { randomFillSync } = require('crypto');
+const {
+ types: { isUint8Array }
+} = require('util');
+
+const PerMessageDeflate = require('./permessage-deflate');
+const { EMPTY_BUFFER, kWebSocket, NOOP } = require('./constants');
+const { isBlob, isValidStatusCode } = require('./validation');
+const { mask: applyMask, toBuffer } = require('./buffer-util');
+
+const kByteLength = Symbol('kByteLength');
+const maskBuffer = Buffer.alloc(4);
+const RANDOM_POOL_SIZE = 8 * 1024;
+let randomPool;
+let randomPoolPointer = RANDOM_POOL_SIZE;
+
+const DEFAULT = 0;
+const DEFLATING = 1;
+const GET_BLOB_DATA = 2;
+
+/**
+ * HyBi Sender implementation.
+ */
+class Sender {
+ /**
+ * Creates a Sender instance.
+ *
+ * @param {Duplex} socket The connection socket
+ * @param {Object} [extensions] An object containing the negotiated extensions
+ * @param {Function} [generateMask] The function used to generate the masking
+ * key
+ */
+ constructor(socket, extensions, generateMask) {
+ this._extensions = extensions || {};
+
+ if (generateMask) {
+ this._generateMask = generateMask;
+ this._maskBuffer = Buffer.alloc(4);
+ }
+
+ this._socket = socket;
+
+ this._firstFragment = true;
+ this._compress = false;
+
+ this._bufferedBytes = 0;
+ this._queue = [];
+ this._state = DEFAULT;
+ this.onerror = NOOP;
+ this[kWebSocket] = undefined;
+ }
+
+ /**
+ * Frames a piece of data according to the HyBi WebSocket protocol.
+ *
+ * @param {(Buffer|String)} data The data to frame
+ * @param {Object} options Options object
+ * @param {Boolean} [options.fin=false] Specifies whether or not to set the
+ * FIN bit
+ * @param {Function} [options.generateMask] The function used to generate the
+ * masking key
+ * @param {Boolean} [options.mask=false] Specifies whether or not to mask
+ * `data`
+ * @param {Buffer} [options.maskBuffer] The buffer used to store the masking
+ * key
+ * @param {Number} options.opcode The opcode
+ * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
+ * modified
+ * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
+ * RSV1 bit
+ * @return {(Buffer|String)[]} The framed data
+ * @public
+ */
+ static frame(data, options) {
+ let mask;
+ let merge = false;
+ let offset = 2;
+ let skipMasking = false;
+
+ if (options.mask) {
+ mask = options.maskBuffer || maskBuffer;
+
+ if (options.generateMask) {
+ options.generateMask(mask);
+ } else {
+ if (randomPoolPointer === RANDOM_POOL_SIZE) {
+ /* istanbul ignore else */
+ if (randomPool === undefined) {
+ //
+ // This is lazily initialized because server-sent frames must not
+ // be masked so it may never be used.
+ //
+ randomPool = Buffer.alloc(RANDOM_POOL_SIZE);
+ }
+
+ randomFillSync(randomPool, 0, RANDOM_POOL_SIZE);
+ randomPoolPointer = 0;
+ }
+
+ mask[0] = randomPool[randomPoolPointer++];
+ mask[1] = randomPool[randomPoolPointer++];
+ mask[2] = randomPool[randomPoolPointer++];
+ mask[3] = randomPool[randomPoolPointer++];
+ }
+
+ skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0;
+ offset = 6;
+ }
+
+ let dataLength;
+
+ if (typeof data === 'string') {
+ if (
+ (!options.mask || skipMasking) &&
+ options[kByteLength] !== undefined
+ ) {
+ dataLength = options[kByteLength];
+ } else {
+ data = Buffer.from(data);
+ dataLength = data.length;
+ }
+ } else {
+ dataLength = data.length;
+ merge = options.mask && options.readOnly && !skipMasking;
+ }
+
+ let payloadLength = dataLength;
+
+ if (dataLength >= 65536) {
+ offset += 8;
+ payloadLength = 127;
+ } else if (dataLength > 125) {
+ offset += 2;
+ payloadLength = 126;
+ }
+
+ const target = Buffer.allocUnsafe(merge ? dataLength + offset : offset);
+
+ target[0] = options.fin ? options.opcode | 0x80 : options.opcode;
+ if (options.rsv1) target[0] |= 0x40;
+
+ target[1] = payloadLength;
+
+ if (payloadLength === 126) {
+ target.writeUInt16BE(dataLength, 2);
+ } else if (payloadLength === 127) {
+ target[2] = target[3] = 0;
+ target.writeUIntBE(dataLength, 4, 6);
+ }
+
+ if (!options.mask) return [target, data];
+
+ target[1] |= 0x80;
+ target[offset - 4] = mask[0];
+ target[offset - 3] = mask[1];
+ target[offset - 2] = mask[2];
+ target[offset - 1] = mask[3];
+
+ if (skipMasking) return [target, data];
+
+ if (merge) {
+ applyMask(data, mask, target, offset, dataLength);
+ return [target];
+ }
+
+ applyMask(data, mask, data, 0, dataLength);
+ return [target, data];
+ }
+
+ /**
+ * Sends a close message to the other peer.
+ *
+ * @param {Number} [code] The status code component of the body
+ * @param {(String|Buffer)} [data] The message component of the body
+ * @param {Boolean} [mask=false] Specifies whether or not to mask the message
+ * @param {Function} [cb] Callback
+ * @public
+ */
+ close(code, data, mask, cb) {
+ let buf;
+
+ if (code === undefined) {
+ buf = EMPTY_BUFFER;
+ } else if (typeof code !== 'number' || !isValidStatusCode(code)) {
+ throw new TypeError('First argument must be a valid error code number');
+ } else if (data === undefined || !data.length) {
+ buf = Buffer.allocUnsafe(2);
+ buf.writeUInt16BE(code, 0);
+ } else {
+ const length = Buffer.byteLength(data);
+
+ if (length > 123) {
+ throw new RangeError('The message must not be greater than 123 bytes');
+ }
+
+ buf = Buffer.allocUnsafe(2 + length);
+ buf.writeUInt16BE(code, 0);
+
+ if (typeof data === 'string') {
+ buf.write(data, 2);
+ } else if (isUint8Array(data)) {
+ buf.set(data, 2);
+ } else {
+ throw new TypeError('Second argument must be a string or a Uint8Array');
+ }
+ }
+
+ const options = {
+ [kByteLength]: buf.length,
+ fin: true,
+ generateMask: this._generateMask,
+ mask,
+ maskBuffer: this._maskBuffer,
+ opcode: 0x08,
+ readOnly: false,
+ rsv1: false
+ };
+
+ if (this._state !== DEFAULT) {
+ this.enqueue([this.dispatch, buf, false, options, cb]);
+ } else {
+ this.sendFrame(Sender.frame(buf, options), cb);
+ }
+ }
+
+ /**
+ * Sends a ping message to the other peer.
+ *
+ * @param {*} data The message to send
+ * @param {Boolean} [mask=false] Specifies whether or not to mask `data`
+ * @param {Function} [cb] Callback
+ * @public
+ */
+ ping(data, mask, cb) {
+ let byteLength;
+ let readOnly;
+
+ if (typeof data === 'string') {
+ byteLength = Buffer.byteLength(data);
+ readOnly = false;
+ } else if (isBlob(data)) {
+ byteLength = data.size;
+ readOnly = false;
+ } else {
+ data = toBuffer(data);
+ byteLength = data.length;
+ readOnly = toBuffer.readOnly;
+ }
+
+ if (byteLength > 125) {
+ throw new RangeError('The data size must not be greater than 125 bytes');
+ }
+
+ const options = {
+ [kByteLength]: byteLength,
+ fin: true,
+ generateMask: this._generateMask,
+ mask,
+ maskBuffer: this._maskBuffer,
+ opcode: 0x09,
+ readOnly,
+ rsv1: false
+ };
+
+ if (isBlob(data)) {
+ if (this._state !== DEFAULT) {
+ this.enqueue([this.getBlobData, data, false, options, cb]);
+ } else {
+ this.getBlobData(data, false, options, cb);
+ }
+ } else if (this._state !== DEFAULT) {
+ this.enqueue([this.dispatch, data, false, options, cb]);
+ } else {
+ this.sendFrame(Sender.frame(data, options), cb);
+ }
+ }
+
+ /**
+ * Sends a pong message to the other peer.
+ *
+ * @param {*} data The message to send
+ * @param {Boolean} [mask=false] Specifies whether or not to mask `data`
+ * @param {Function} [cb] Callback
+ * @public
+ */
+ pong(data, mask, cb) {
+ let byteLength;
+ let readOnly;
+
+ if (typeof data === 'string') {
+ byteLength = Buffer.byteLength(data);
+ readOnly = false;
+ } else if (isBlob(data)) {
+ byteLength = data.size;
+ readOnly = false;
+ } else {
+ data = toBuffer(data);
+ byteLength = data.length;
+ readOnly = toBuffer.readOnly;
+ }
+
+ if (byteLength > 125) {
+ throw new RangeError('The data size must not be greater than 125 bytes');
+ }
+
+ const options = {
+ [kByteLength]: byteLength,
+ fin: true,
+ generateMask: this._generateMask,
+ mask,
+ maskBuffer: this._maskBuffer,
+ opcode: 0x0a,
+ readOnly,
+ rsv1: false
+ };
+
+ if (isBlob(data)) {
+ if (this._state !== DEFAULT) {
+ this.enqueue([this.getBlobData, data, false, options, cb]);
+ } else {
+ this.getBlobData(data, false, options, cb);
+ }
+ } else if (this._state !== DEFAULT) {
+ this.enqueue([this.dispatch, data, false, options, cb]);
+ } else {
+ this.sendFrame(Sender.frame(data, options), cb);
+ }
+ }
+
+ /**
+ * Sends a data message to the other peer.
+ *
+ * @param {*} data The message to send
+ * @param {Object} options Options object
+ * @param {Boolean} [options.binary=false] Specifies whether `data` is binary
+ * or text
+ * @param {Boolean} [options.compress=false] Specifies whether or not to
+ * compress `data`
+ * @param {Boolean} [options.fin=false] Specifies whether the fragment is the
+ * last one
+ * @param {Boolean} [options.mask=false] Specifies whether or not to mask
+ * `data`
+ * @param {Function} [cb] Callback
+ * @public
+ */
+ send(data, options, cb) {
+ const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
+ let opcode = options.binary ? 2 : 1;
+ let rsv1 = options.compress;
+
+ let byteLength;
+ let readOnly;
+
+ if (typeof data === 'string') {
+ byteLength = Buffer.byteLength(data);
+ readOnly = false;
+ } else if (isBlob(data)) {
+ byteLength = data.size;
+ readOnly = false;
+ } else {
+ data = toBuffer(data);
+ byteLength = data.length;
+ readOnly = toBuffer.readOnly;
+ }
+
+ if (this._firstFragment) {
+ this._firstFragment = false;
+ if (
+ rsv1 &&
+ perMessageDeflate &&
+ perMessageDeflate.params[
+ perMessageDeflate._isServer
+ ? 'server_no_context_takeover'
+ : 'client_no_context_takeover'
+ ]
+ ) {
+ rsv1 = byteLength >= perMessageDeflate._threshold;
+ }
+ this._compress = rsv1;
+ } else {
+ rsv1 = false;
+ opcode = 0;
+ }
+
+ if (options.fin) this._firstFragment = true;
+
+ const opts = {
+ [kByteLength]: byteLength,
+ fin: options.fin,
+ generateMask: this._generateMask,
+ mask: options.mask,
+ maskBuffer: this._maskBuffer,
+ opcode,
+ readOnly,
+ rsv1
+ };
+
+ if (isBlob(data)) {
+ if (this._state !== DEFAULT) {
+ this.enqueue([this.getBlobData, data, this._compress, opts, cb]);
+ } else {
+ this.getBlobData(data, this._compress, opts, cb);
+ }
+ } else if (this._state !== DEFAULT) {
+ this.enqueue([this.dispatch, data, this._compress, opts, cb]);
+ } else {
+ this.dispatch(data, this._compress, opts, cb);
+ }
+ }
+
+ /**
+ * Gets the contents of a blob as binary data.
+ *
+ * @param {Blob} blob The blob
+ * @param {Boolean} [compress=false] Specifies whether or not to compress
+ * the data
+ * @param {Object} options Options object
+ * @param {Boolean} [options.fin=false] Specifies whether or not to set the
+ * FIN bit
+ * @param {Function} [options.generateMask] The function used to generate the
+ * masking key
+ * @param {Boolean} [options.mask=false] Specifies whether or not to mask
+ * `data`
+ * @param {Buffer} [options.maskBuffer] The buffer used to store the masking
+ * key
+ * @param {Number} options.opcode The opcode
+ * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
+ * modified
+ * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
+ * RSV1 bit
+ * @param {Function} [cb] Callback
+ * @private
+ */
+ getBlobData(blob, compress, options, cb) {
+ this._bufferedBytes += options[kByteLength];
+ this._state = GET_BLOB_DATA;
+
+ blob
+ .arrayBuffer()
+ .then((arrayBuffer) => {
+ if (this._socket.destroyed) {
+ const err = new Error(
+ 'The socket was closed while the blob was being read'
+ );
+
+ //
+ // `callCallbacks` is called in the next tick to ensure that errors
+ // that might be thrown in the callbacks behave like errors thrown
+ // outside the promise chain.
+ //
+ process.nextTick(callCallbacks, this, err, cb);
+ return;
+ }
+
+ this._bufferedBytes -= options[kByteLength];
+ const data = toBuffer(arrayBuffer);
+
+ if (!compress) {
+ this._state = DEFAULT;
+ this.sendFrame(Sender.frame(data, options), cb);
+ this.dequeue();
+ } else {
+ this.dispatch(data, compress, options, cb);
+ }
+ })
+ .catch((err) => {
+ //
+ // `onError` is called in the next tick for the same reason that
+ // `callCallbacks` above is.
+ //
+ process.nextTick(onError, this, err, cb);
+ });
+ }
+
+ /**
+ * Dispatches a message.
+ *
+ * @param {(Buffer|String)} data The message to send
+ * @param {Boolean} [compress=false] Specifies whether or not to compress
+ * `data`
+ * @param {Object} options Options object
+ * @param {Boolean} [options.fin=false] Specifies whether or not to set the
+ * FIN bit
+ * @param {Function} [options.generateMask] The function used to generate the
+ * masking key
+ * @param {Boolean} [options.mask=false] Specifies whether or not to mask
+ * `data`
+ * @param {Buffer} [options.maskBuffer] The buffer used to store the masking
+ * key
+ * @param {Number} options.opcode The opcode
+ * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
+ * modified
+ * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
+ * RSV1 bit
+ * @param {Function} [cb] Callback
+ * @private
+ */
+ dispatch(data, compress, options, cb) {
+ if (!compress) {
+ this.sendFrame(Sender.frame(data, options), cb);
+ return;
+ }
+
+ const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
+
+ this._bufferedBytes += options[kByteLength];
+ this._state = DEFLATING;
+ perMessageDeflate.compress(data, options.fin, (_, buf) => {
+ if (this._socket.destroyed) {
+ const err = new Error(
+ 'The socket was closed while data was being compressed'
+ );
+
+ callCallbacks(this, err, cb);
+ return;
+ }
+
+ this._bufferedBytes -= options[kByteLength];
+ this._state = DEFAULT;
+ options.readOnly = false;
+ this.sendFrame(Sender.frame(buf, options), cb);
+ this.dequeue();
+ });
+ }
+
+ /**
+ * Executes queued send operations.
+ *
+ * @private
+ */
+ dequeue() {
+ while (this._state === DEFAULT && this._queue.length) {
+ const params = this._queue.shift();
+
+ this._bufferedBytes -= params[3][kByteLength];
+ Reflect.apply(params[0], this, params.slice(1));
+ }
+ }
+
+ /**
+ * Enqueues a send operation.
+ *
+ * @param {Array} params Send operation parameters.
+ * @private
+ */
+ enqueue(params) {
+ this._bufferedBytes += params[3][kByteLength];
+ this._queue.push(params);
+ }
+
+ /**
+ * Sends a frame.
+ *
+ * @param {(Buffer | String)[]} list The frame to send
+ * @param {Function} [cb] Callback
+ * @private
+ */
+ sendFrame(list, cb) {
+ if (list.length === 2) {
+ this._socket.cork();
+ this._socket.write(list[0]);
+ this._socket.write(list[1], cb);
+ this._socket.uncork();
+ } else {
+ this._socket.write(list[0], cb);
+ }
+ }
+}
+
+module.exports = Sender;
+
+/**
+ * Calls queued callbacks with an error.
+ *
+ * @param {Sender} sender The `Sender` instance
+ * @param {Error} err The error to call the callbacks with
+ * @param {Function} [cb] The first callback
+ * @private
+ */
+function callCallbacks(sender, err, cb) {
+ if (typeof cb === 'function') cb(err);
+
+ for (let i = 0; i < sender._queue.length; i++) {
+ const params = sender._queue[i];
+ const callback = params[params.length - 1];
+
+ if (typeof callback === 'function') callback(err);
+ }
+}
+
+/**
+ * Handles a `Sender` error.
+ *
+ * @param {Sender} sender The `Sender` instance
+ * @param {Error} err The error
+ * @param {Function} [cb] The first pending callback
+ * @private
+ */
+function onError(sender, err, cb) {
+ callCallbacks(sender, err, cb);
+ sender.onerror(err);
+}
diff --git a/tools/ui/node_modules/ws/lib/stream.js b/tools/ui/node_modules/ws/lib/stream.js
new file mode 100644
index 0000000000000000000000000000000000000000..4c58c911bc3da49c9b2610da77ff61b71f111810
--- /dev/null
+++ b/tools/ui/node_modules/ws/lib/stream.js
@@ -0,0 +1,161 @@
+/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^WebSocket$" }] */
+'use strict';
+
+const WebSocket = require('./websocket');
+const { Duplex } = require('stream');
+
+/**
+ * Emits the `'close'` event on a stream.
+ *
+ * @param {Duplex} stream The stream.
+ * @private
+ */
+function emitClose(stream) {
+ stream.emit('close');
+}
+
+/**
+ * The listener of the `'end'` event.
+ *
+ * @private
+ */
+function duplexOnEnd() {
+ if (!this.destroyed && this._writableState.finished) {
+ this.destroy();
+ }
+}
+
+/**
+ * The listener of the `'error'` event.
+ *
+ * @param {Error} err The error
+ * @private
+ */
+function duplexOnError(err) {
+ this.removeListener('error', duplexOnError);
+ this.destroy();
+ if (this.listenerCount('error') === 0) {
+ // Do not suppress the throwing behavior.
+ this.emit('error', err);
+ }
+}
+
+/**
+ * Wraps a `WebSocket` in a duplex stream.
+ *
+ * @param {WebSocket} ws The `WebSocket` to wrap
+ * @param {Object} [options] The options for the `Duplex` constructor
+ * @return {Duplex} The duplex stream
+ * @public
+ */
+function createWebSocketStream(ws, options) {
+ let terminateOnDestroy = true;
+
+ const duplex = new Duplex({
+ ...options,
+ autoDestroy: false,
+ emitClose: false,
+ objectMode: false,
+ writableObjectMode: false
+ });
+
+ ws.on('message', function message(msg, isBinary) {
+ const data =
+ !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
+
+ if (!duplex.push(data)) ws.pause();
+ });
+
+ ws.once('error', function error(err) {
+ if (duplex.destroyed) return;
+
+ // Prevent `ws.terminate()` from being called by `duplex._destroy()`.
+ //
+ // - If the `'error'` event is emitted before the `'open'` event, then
+ // `ws.terminate()` is a noop as no socket is assigned.
+ // - Otherwise, the error is re-emitted by the listener of the `'error'`
+ // event of the `Receiver` object. The listener already closes the
+ // connection by calling `ws.close()`. This allows a close frame to be
+ // sent to the other peer. If `ws.terminate()` is called right after this,
+ // then the close frame might not be sent.
+ terminateOnDestroy = false;
+ duplex.destroy(err);
+ });
+
+ ws.once('close', function close() {
+ if (duplex.destroyed) return;
+
+ duplex.push(null);
+ });
+
+ duplex._destroy = function (err, callback) {
+ if (ws.readyState === ws.CLOSED) {
+ callback(err);
+ process.nextTick(emitClose, duplex);
+ return;
+ }
+
+ let called = false;
+
+ ws.once('error', function error(err) {
+ called = true;
+ callback(err);
+ });
+
+ ws.once('close', function close() {
+ if (!called) callback(err);
+ process.nextTick(emitClose, duplex);
+ });
+
+ if (terminateOnDestroy) ws.terminate();
+ };
+
+ duplex._final = function (callback) {
+ if (ws.readyState === ws.CONNECTING) {
+ ws.once('open', function open() {
+ duplex._final(callback);
+ });
+ return;
+ }
+
+ // If the value of the `_socket` property is `null` it means that `ws` is a
+ // client websocket and the handshake failed. In fact, when this happens, a
+ // socket is never assigned to the websocket. Wait for the `'error'` event
+ // that will be emitted by the websocket.
+ if (ws._socket === null) return;
+
+ if (ws._socket._writableState.finished) {
+ callback();
+ if (duplex._readableState.endEmitted) duplex.destroy();
+ } else {
+ ws._socket.once('finish', function finish() {
+ // `duplex` is not destroyed here because the `'end'` event will be
+ // emitted on `duplex` after this `'finish'` event. The EOF signaling
+ // `null` chunk is, in fact, pushed when the websocket emits `'close'`.
+ callback();
+ });
+ ws.close();
+ }
+ };
+
+ duplex._read = function () {
+ if (ws.isPaused) ws.resume();
+ };
+
+ duplex._write = function (chunk, encoding, callback) {
+ if (ws.readyState === ws.CONNECTING) {
+ ws.once('open', function open() {
+ duplex._write(chunk, encoding, callback);
+ });
+ return;
+ }
+
+ ws.send(chunk, callback);
+ };
+
+ duplex.on('end', duplexOnEnd);
+ duplex.on('error', duplexOnError);
+ return duplex;
+}
+
+module.exports = createWebSocketStream;
diff --git a/tools/ui/node_modules/ws/lib/subprotocol.js b/tools/ui/node_modules/ws/lib/subprotocol.js
new file mode 100644
index 0000000000000000000000000000000000000000..d4381e8864fd055e81dd75eeb4b852d9da864673
--- /dev/null
+++ b/tools/ui/node_modules/ws/lib/subprotocol.js
@@ -0,0 +1,62 @@
+'use strict';
+
+const { tokenChars } = require('./validation');
+
+/**
+ * Parses the `Sec-WebSocket-Protocol` header into a set of subprotocol names.
+ *
+ * @param {String} header The field value of the header
+ * @return {Set} The subprotocol names
+ * @public
+ */
+function parse(header) {
+ const protocols = new Set();
+ let start = -1;
+ let end = -1;
+ let i = 0;
+
+ for (i; i < header.length; i++) {
+ const code = header.charCodeAt(i);
+
+ if (end === -1 && tokenChars[code] === 1) {
+ if (start === -1) start = i;
+ } else if (
+ i !== 0 &&
+ (code === 0x20 /* ' ' */ || code === 0x09) /* '\t' */
+ ) {
+ if (end === -1 && start !== -1) end = i;
+ } else if (code === 0x2c /* ',' */) {
+ if (start === -1) {
+ throw new SyntaxError(`Unexpected character at index ${i}`);
+ }
+
+ if (end === -1) end = i;
+
+ const protocol = header.slice(start, end);
+
+ if (protocols.has(protocol)) {
+ throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
+ }
+
+ protocols.add(protocol);
+ start = end = -1;
+ } else {
+ throw new SyntaxError(`Unexpected character at index ${i}`);
+ }
+ }
+
+ if (start === -1 || end !== -1) {
+ throw new SyntaxError('Unexpected end of input');
+ }
+
+ const protocol = header.slice(start, i);
+
+ if (protocols.has(protocol)) {
+ throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
+ }
+
+ protocols.add(protocol);
+ return protocols;
+}
+
+module.exports = { parse };
diff --git a/tools/ui/node_modules/ws/lib/validation.js b/tools/ui/node_modules/ws/lib/validation.js
new file mode 100644
index 0000000000000000000000000000000000000000..4a2e68d5127279431a74b6961e8d35161d3276e2
--- /dev/null
+++ b/tools/ui/node_modules/ws/lib/validation.js
@@ -0,0 +1,152 @@
+'use strict';
+
+const { isUtf8 } = require('buffer');
+
+const { hasBlob } = require('./constants');
+
+//
+// Allowed token characters:
+//
+// '!', '#', '$', '%', '&', ''', '*', '+', '-',
+// '.', 0-9, A-Z, '^', '_', '`', a-z, '|', '~'
+//
+// tokenChars[32] === 0 // ' '
+// tokenChars[33] === 1 // '!'
+// tokenChars[34] === 0 // '"'
+// ...
+//
+// prettier-ignore
+const tokenChars = [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31
+ 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, // 32 - 47
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, // 80 - 95
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 // 112 - 127
+];
+
+/**
+ * Checks if a status code is allowed in a close frame.
+ *
+ * @param {Number} code The status code
+ * @return {Boolean} `true` if the status code is valid, else `false`
+ * @public
+ */
+function isValidStatusCode(code) {
+ return (
+ (code >= 1000 &&
+ code <= 1014 &&
+ code !== 1004 &&
+ code !== 1005 &&
+ code !== 1006) ||
+ (code >= 3000 && code <= 4999)
+ );
+}
+
+/**
+ * Checks if a given buffer contains only correct UTF-8.
+ * Ported from https://www.cl.cam.ac.uk/%7Emgk25/ucs/utf8_check.c by
+ * Markus Kuhn.
+ *
+ * @param {Buffer} buf The buffer to check
+ * @return {Boolean} `true` if `buf` contains only correct UTF-8, else `false`
+ * @public
+ */
+function _isValidUTF8(buf) {
+ const len = buf.length;
+ let i = 0;
+
+ while (i < len) {
+ if ((buf[i] & 0x80) === 0) {
+ // 0xxxxxxx
+ i++;
+ } else if ((buf[i] & 0xe0) === 0xc0) {
+ // 110xxxxx 10xxxxxx
+ if (
+ i + 1 === len ||
+ (buf[i + 1] & 0xc0) !== 0x80 ||
+ (buf[i] & 0xfe) === 0xc0 // Overlong
+ ) {
+ return false;
+ }
+
+ i += 2;
+ } else if ((buf[i] & 0xf0) === 0xe0) {
+ // 1110xxxx 10xxxxxx 10xxxxxx
+ if (
+ i + 2 >= len ||
+ (buf[i + 1] & 0xc0) !== 0x80 ||
+ (buf[i + 2] & 0xc0) !== 0x80 ||
+ (buf[i] === 0xe0 && (buf[i + 1] & 0xe0) === 0x80) || // Overlong
+ (buf[i] === 0xed && (buf[i + 1] & 0xe0) === 0xa0) // Surrogate (U+D800 - U+DFFF)
+ ) {
+ return false;
+ }
+
+ i += 3;
+ } else if ((buf[i] & 0xf8) === 0xf0) {
+ // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ if (
+ i + 3 >= len ||
+ (buf[i + 1] & 0xc0) !== 0x80 ||
+ (buf[i + 2] & 0xc0) !== 0x80 ||
+ (buf[i + 3] & 0xc0) !== 0x80 ||
+ (buf[i] === 0xf0 && (buf[i + 1] & 0xf0) === 0x80) || // Overlong
+ (buf[i] === 0xf4 && buf[i + 1] > 0x8f) ||
+ buf[i] > 0xf4 // > U+10FFFF
+ ) {
+ return false;
+ }
+
+ i += 4;
+ } else {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+/**
+ * Determines whether a value is a `Blob`.
+ *
+ * @param {*} value The value to be tested
+ * @return {Boolean} `true` if `value` is a `Blob`, else `false`
+ * @private
+ */
+function isBlob(value) {
+ return (
+ hasBlob &&
+ typeof value === 'object' &&
+ typeof value.arrayBuffer === 'function' &&
+ typeof value.type === 'string' &&
+ typeof value.stream === 'function' &&
+ (value[Symbol.toStringTag] === 'Blob' ||
+ value[Symbol.toStringTag] === 'File')
+ );
+}
+
+module.exports = {
+ isBlob,
+ isValidStatusCode,
+ isValidUTF8: _isValidUTF8,
+ tokenChars
+};
+
+if (isUtf8) {
+ module.exports.isValidUTF8 = function (buf) {
+ return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);
+ };
+} /* istanbul ignore else */ else if (!process.env.WS_NO_UTF_8_VALIDATE) {
+ try {
+ const isValidUTF8 = require('utf-8-validate');
+
+ module.exports.isValidUTF8 = function (buf) {
+ return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
+ };
+ } catch (e) {
+ // Continue regardless of the error.
+ }
+}
diff --git a/tools/ui/node_modules/ws/lib/websocket-server.js b/tools/ui/node_modules/ws/lib/websocket-server.js
new file mode 100644
index 0000000000000000000000000000000000000000..4d859192b52cff6a7658ce689e5cebfc23cac3c1
--- /dev/null
+++ b/tools/ui/node_modules/ws/lib/websocket-server.js
@@ -0,0 +1,562 @@
+/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex$", "caughtErrors": "none" }] */
+
+'use strict';
+
+const EventEmitter = require('events');
+const http = require('http');
+const { Duplex } = require('stream');
+const { createHash } = require('crypto');
+
+const extension = require('./extension');
+const PerMessageDeflate = require('./permessage-deflate');
+const subprotocol = require('./subprotocol');
+const WebSocket = require('./websocket');
+const { CLOSE_TIMEOUT, GUID, kWebSocket } = require('./constants');
+
+const keyRegex = /^[+/0-9A-Za-z]{22}==$/;
+
+const RUNNING = 0;
+const CLOSING = 1;
+const CLOSED = 2;
+
+/**
+ * Class representing a WebSocket server.
+ *
+ * @extends EventEmitter
+ */
+class WebSocketServer extends EventEmitter {
+ /**
+ * Create a `WebSocketServer` instance.
+ *
+ * @param {Object} options Configuration options
+ * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether
+ * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
+ * multiple times in the same tick
+ * @param {Boolean} [options.autoPong=true] Specifies whether or not to
+ * automatically send a pong in response to a ping
+ * @param {Number} [options.backlog=511] The maximum length of the queue of
+ * pending connections
+ * @param {Boolean} [options.clientTracking=true] Specifies whether or not to
+ * track clients
+ * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to
+ * wait for the closing handshake to finish after `websocket.close()` is
+ * called
+ * @param {Function} [options.handleProtocols] A hook to handle protocols
+ * @param {String} [options.host] The hostname where to bind the server
+ * @param {Number} [options.maxBufferedChunks=262144] The maximum number of
+ * buffered data chunks
+ * @param {Number} [options.maxFragments=16384] The maximum number of message
+ * fragments
+ * @param {Number} [options.maxPayload=104857600] The maximum allowed message
+ * size
+ * @param {Boolean} [options.noServer=false] Enable no server mode
+ * @param {String} [options.path] Accept only connections matching this path
+ * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable
+ * permessage-deflate
+ * @param {Number} [options.port] The port where to bind the server
+ * @param {(http.Server|https.Server)} [options.server] A pre-created HTTP/S
+ * server to use
+ * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
+ * not to skip UTF-8 validation for text and close messages
+ * @param {Function} [options.verifyClient] A hook to reject connections
+ * @param {Function} [options.WebSocket=WebSocket] Specifies the `WebSocket`
+ * class to use. It must be the `WebSocket` class or class that extends it
+ * @param {Function} [callback] A listener for the `listening` event
+ */
+ constructor(options, callback) {
+ super();
+
+ options = {
+ allowSynchronousEvents: true,
+ autoPong: true,
+ maxBufferedChunks: 256 * 1024,
+ maxFragments: 16 * 1024,
+ maxPayload: 100 * 1024 * 1024,
+ skipUTF8Validation: false,
+ perMessageDeflate: false,
+ handleProtocols: null,
+ clientTracking: true,
+ closeTimeout: CLOSE_TIMEOUT,
+ verifyClient: null,
+ noServer: false,
+ backlog: null, // use default (511 as implemented in net.js)
+ server: null,
+ host: null,
+ path: null,
+ port: null,
+ WebSocket,
+ ...options
+ };
+
+ if (
+ (options.port == null && !options.server && !options.noServer) ||
+ (options.port != null && (options.server || options.noServer)) ||
+ (options.server && options.noServer)
+ ) {
+ throw new TypeError(
+ 'One and only one of the "port", "server", or "noServer" options ' +
+ 'must be specified'
+ );
+ }
+
+ if (options.port != null) {
+ this._server = http.createServer((req, res) => {
+ const body = http.STATUS_CODES[426];
+
+ res.writeHead(426, {
+ 'Content-Length': body.length,
+ 'Content-Type': 'text/plain'
+ });
+ res.end(body);
+ });
+ this._server.listen(
+ options.port,
+ options.host,
+ options.backlog,
+ callback
+ );
+ } else if (options.server) {
+ this._server = options.server;
+ }
+
+ if (this._server) {
+ const emitConnection = this.emit.bind(this, 'connection');
+
+ this._removeListeners = addListeners(this._server, {
+ listening: this.emit.bind(this, 'listening'),
+ error: this.emit.bind(this, 'error'),
+ upgrade: (req, socket, head) => {
+ this.handleUpgrade(req, socket, head, emitConnection);
+ }
+ });
+ }
+
+ if (options.perMessageDeflate === true) options.perMessageDeflate = {};
+ if (options.clientTracking) {
+ this.clients = new Set();
+ this._shouldEmitClose = false;
+ }
+
+ this.options = options;
+ this._state = RUNNING;
+ }
+
+ /**
+ * Returns the bound address, the address family name, and port of the server
+ * as reported by the operating system if listening on an IP socket.
+ * If the server is listening on a pipe or UNIX domain socket, the name is
+ * returned as a string.
+ *
+ * @return {(Object|String|null)} The address of the server
+ * @public
+ */
+ address() {
+ if (this.options.noServer) {
+ throw new Error('The server is operating in "noServer" mode');
+ }
+
+ if (!this._server) return null;
+ return this._server.address();
+ }
+
+ /**
+ * Stop the server from accepting new connections and emit the `'close'` event
+ * when all existing connections are closed.
+ *
+ * @param {Function} [cb] A one-time listener for the `'close'` event
+ * @public
+ */
+ close(cb) {
+ if (this._state === CLOSED) {
+ if (cb) {
+ this.once('close', () => {
+ cb(new Error('The server is not running'));
+ });
+ }
+
+ process.nextTick(emitClose, this);
+ return;
+ }
+
+ if (cb) this.once('close', cb);
+
+ if (this._state === CLOSING) return;
+ this._state = CLOSING;
+
+ if (this.options.noServer || this.options.server) {
+ if (this._server) {
+ this._removeListeners();
+ this._removeListeners = this._server = null;
+ }
+
+ if (this.clients) {
+ if (!this.clients.size) {
+ process.nextTick(emitClose, this);
+ } else {
+ this._shouldEmitClose = true;
+ }
+ } else {
+ process.nextTick(emitClose, this);
+ }
+ } else {
+ const server = this._server;
+
+ this._removeListeners();
+ this._removeListeners = this._server = null;
+
+ //
+ // The HTTP/S server was created internally. Close it, and rely on its
+ // `'close'` event.
+ //
+ server.close(() => {
+ emitClose(this);
+ });
+ }
+ }
+
+ /**
+ * See if a given request should be handled by this server instance.
+ *
+ * @param {http.IncomingMessage} req Request object to inspect
+ * @return {Boolean} `true` if the request is valid, else `false`
+ * @public
+ */
+ shouldHandle(req) {
+ if (this.options.path) {
+ const index = req.url.indexOf('?');
+ const pathname = index !== -1 ? req.url.slice(0, index) : req.url;
+
+ if (pathname !== this.options.path) return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Handle a HTTP Upgrade request.
+ *
+ * @param {http.IncomingMessage} req The request object
+ * @param {Duplex} socket The network socket between the server and client
+ * @param {Buffer} head The first packet of the upgraded stream
+ * @param {Function} cb Callback
+ * @public
+ */
+ handleUpgrade(req, socket, head, cb) {
+ socket.on('error', socketOnError);
+
+ const key = req.headers['sec-websocket-key'];
+ const upgrade = req.headers.upgrade;
+ const version = +req.headers['sec-websocket-version'];
+
+ if (req.method !== 'GET') {
+ const message = 'Invalid HTTP method';
+ abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
+ return;
+ }
+
+ if (upgrade === undefined || upgrade.toLowerCase() !== 'websocket') {
+ const message = 'Invalid Upgrade header';
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
+ return;
+ }
+
+ if (key === undefined || !keyRegex.test(key)) {
+ const message = 'Missing or invalid Sec-WebSocket-Key header';
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
+ return;
+ }
+
+ if (version !== 13 && version !== 8) {
+ const message = 'Missing or invalid Sec-WebSocket-Version header';
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
+ 'Sec-WebSocket-Version': '13, 8'
+ });
+ return;
+ }
+
+ if (!this.shouldHandle(req)) {
+ abortHandshake(socket, 400);
+ return;
+ }
+
+ const secWebSocketProtocol = req.headers['sec-websocket-protocol'];
+ let protocols = new Set();
+
+ if (secWebSocketProtocol !== undefined) {
+ try {
+ protocols = subprotocol.parse(secWebSocketProtocol);
+ } catch (err) {
+ const message = 'Invalid Sec-WebSocket-Protocol header';
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
+ return;
+ }
+ }
+
+ const secWebSocketExtensions = req.headers['sec-websocket-extensions'];
+ const extensions = {};
+
+ if (
+ this.options.perMessageDeflate &&
+ secWebSocketExtensions !== undefined
+ ) {
+ const perMessageDeflate = new PerMessageDeflate({
+ ...this.options.perMessageDeflate,
+ isServer: true,
+ maxPayload: this.options.maxPayload
+ });
+
+ try {
+ const offers = extension.parse(secWebSocketExtensions);
+
+ if (offers[PerMessageDeflate.extensionName]) {
+ perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]);
+ extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
+ }
+ } catch (err) {
+ const message =
+ 'Invalid or unacceptable Sec-WebSocket-Extensions header';
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
+ return;
+ }
+ }
+
+ //
+ // Optionally call external client verification handler.
+ //
+ if (this.options.verifyClient) {
+ const info = {
+ origin:
+ req.headers[`${version === 8 ? 'sec-websocket-origin' : 'origin'}`],
+ secure: !!(req.socket.authorized || req.socket.encrypted),
+ req
+ };
+
+ if (this.options.verifyClient.length === 2) {
+ this.options.verifyClient(info, (verified, code, message, headers) => {
+ if (!verified) {
+ return abortHandshake(socket, code || 401, message, headers);
+ }
+
+ this.completeUpgrade(
+ extensions,
+ key,
+ protocols,
+ req,
+ socket,
+ head,
+ cb
+ );
+ });
+ return;
+ }
+
+ if (!this.options.verifyClient(info)) return abortHandshake(socket, 401);
+ }
+
+ this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);
+ }
+
+ /**
+ * Upgrade the connection to WebSocket.
+ *
+ * @param {Object} extensions The accepted extensions
+ * @param {String} key The value of the `Sec-WebSocket-Key` header
+ * @param {Set} protocols The subprotocols
+ * @param {http.IncomingMessage} req The request object
+ * @param {Duplex} socket The network socket between the server and client
+ * @param {Buffer} head The first packet of the upgraded stream
+ * @param {Function} cb Callback
+ * @throws {Error} If called more than once with the same socket
+ * @private
+ */
+ completeUpgrade(extensions, key, protocols, req, socket, head, cb) {
+ //
+ // Destroy the socket if the client has already sent a FIN packet.
+ //
+ if (!socket.readable || !socket.writable) return socket.destroy();
+
+ if (socket[kWebSocket]) {
+ throw new Error(
+ 'server.handleUpgrade() was called more than once with the same ' +
+ 'socket, possibly due to a misconfiguration'
+ );
+ }
+
+ if (this._state > RUNNING) return abortHandshake(socket, 503);
+
+ const digest = createHash('sha1')
+ .update(key + GUID)
+ .digest('base64');
+
+ const headers = [
+ 'HTTP/1.1 101 Switching Protocols',
+ 'Upgrade: websocket',
+ 'Connection: Upgrade',
+ `Sec-WebSocket-Accept: ${digest}`
+ ];
+
+ const ws = new this.options.WebSocket(null, undefined, this.options);
+
+ if (protocols.size) {
+ //
+ // Optionally call external protocol selection handler.
+ //
+ const protocol = this.options.handleProtocols
+ ? this.options.handleProtocols(protocols, req)
+ : protocols.values().next().value;
+
+ if (protocol) {
+ headers.push(`Sec-WebSocket-Protocol: ${protocol}`);
+ ws._protocol = protocol;
+ }
+ }
+
+ if (extensions[PerMessageDeflate.extensionName]) {
+ const params = extensions[PerMessageDeflate.extensionName].params;
+ const value = extension.format({
+ [PerMessageDeflate.extensionName]: [params]
+ });
+ headers.push(`Sec-WebSocket-Extensions: ${value}`);
+ ws._extensions = extensions;
+ }
+
+ //
+ // Allow external modification/inspection of handshake headers.
+ //
+ this.emit('headers', headers, req);
+
+ socket.write(headers.concat('\r\n').join('\r\n'));
+ socket.removeListener('error', socketOnError);
+
+ ws.setSocket(socket, head, {
+ allowSynchronousEvents: this.options.allowSynchronousEvents,
+ maxBufferedChunks: this.options.maxBufferedChunks,
+ maxFragments: this.options.maxFragments,
+ maxPayload: this.options.maxPayload,
+ skipUTF8Validation: this.options.skipUTF8Validation
+ });
+
+ if (this.clients) {
+ this.clients.add(ws);
+ ws.on('close', () => {
+ this.clients.delete(ws);
+
+ if (this._shouldEmitClose && !this.clients.size) {
+ process.nextTick(emitClose, this);
+ }
+ });
+ }
+
+ cb(ws, req);
+ }
+}
+
+module.exports = WebSocketServer;
+
+/**
+ * Add event listeners on an `EventEmitter` using a map of
+ * pairs.
+ *
+ * @param {EventEmitter} server The event emitter
+ * @param {Object.} map The listeners to add
+ * @return {Function} A function that will remove the added listeners when
+ * called
+ * @private
+ */
+function addListeners(server, map) {
+ for (const event of Object.keys(map)) server.on(event, map[event]);
+
+ return function removeListeners() {
+ for (const event of Object.keys(map)) {
+ server.removeListener(event, map[event]);
+ }
+ };
+}
+
+/**
+ * Emit a `'close'` event on an `EventEmitter`.
+ *
+ * @param {EventEmitter} server The event emitter
+ * @private
+ */
+function emitClose(server) {
+ server._state = CLOSED;
+ server.emit('close');
+}
+
+/**
+ * Handle socket errors.
+ *
+ * @private
+ */
+function socketOnError() {
+ this.destroy();
+}
+
+/**
+ * Close the connection when preconditions are not fulfilled.
+ *
+ * @param {Duplex} socket The socket of the upgrade request
+ * @param {Number} code The HTTP response status code
+ * @param {String} [message] The HTTP response body
+ * @param {Object} [headers] Additional HTTP response headers
+ * @private
+ */
+function abortHandshake(socket, code, message, headers) {
+ //
+ // The socket is writable unless the user destroyed or ended it before calling
+ // `server.handleUpgrade()` or in the `verifyClient` function, which is a user
+ // error. Handling this does not make much sense as the worst that can happen
+ // is that some of the data written by the user might be discarded due to the
+ // call to `socket.end()` below, which triggers an `'error'` event that in
+ // turn causes the socket to be destroyed.
+ //
+ message = message || http.STATUS_CODES[code];
+ headers = {
+ Connection: 'close',
+ 'Content-Type': 'text/html',
+ 'Content-Length': Buffer.byteLength(message),
+ ...headers
+ };
+
+ socket.once('finish', socket.destroy);
+
+ socket.end(
+ `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r\n` +
+ Object.keys(headers)
+ .map((h) => `${h}: ${headers[h]}`)
+ .join('\r\n') +
+ '\r\n\r\n' +
+ message
+ );
+}
+
+/**
+ * Emit a `'wsClientError'` event on a `WebSocketServer` if there is at least
+ * one listener for it, otherwise call `abortHandshake()`.
+ *
+ * @param {WebSocketServer} server The WebSocket server
+ * @param {http.IncomingMessage} req The request object
+ * @param {Duplex} socket The socket of the upgrade request
+ * @param {Number} code The HTTP response status code
+ * @param {String} message The HTTP response body
+ * @param {Object} [headers] The HTTP response headers
+ * @private
+ */
+function abortHandshakeOrEmitwsClientError(
+ server,
+ req,
+ socket,
+ code,
+ message,
+ headers
+) {
+ if (server.listenerCount('wsClientError')) {
+ const err = new Error(message);
+ Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
+
+ server.emit('wsClientError', err, socket, req);
+ } else {
+ abortHandshake(socket, code, message, headers);
+ }
+}
diff --git a/tools/ui/node_modules/ws/lib/websocket.js b/tools/ui/node_modules/ws/lib/websocket.js
new file mode 100644
index 0000000000000000000000000000000000000000..ea58e7dfd1532bba50aa58683f6cab4fd54586ee
--- /dev/null
+++ b/tools/ui/node_modules/ws/lib/websocket.js
@@ -0,0 +1,1407 @@
+/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex|Readable$", "caughtErrors": "none" }] */
+
+'use strict';
+
+const EventEmitter = require('events');
+const https = require('https');
+const http = require('http');
+const net = require('net');
+const tls = require('tls');
+const { randomBytes, createHash } = require('crypto');
+const { Duplex, Readable } = require('stream');
+const { URL } = require('url');
+
+const PerMessageDeflate = require('./permessage-deflate');
+const Receiver = require('./receiver');
+const Sender = require('./sender');
+const { isBlob } = require('./validation');
+
+const {
+ BINARY_TYPES,
+ CLOSE_TIMEOUT,
+ EMPTY_BUFFER,
+ GUID,
+ kForOnEventAttribute,
+ kListener,
+ kStatusCode,
+ kWebSocket,
+ NOOP
+} = require('./constants');
+const {
+ EventTarget: { addEventListener, removeEventListener }
+} = require('./event-target');
+const { format, parse } = require('./extension');
+const { toBuffer } = require('./buffer-util');
+
+const kAborted = Symbol('kAborted');
+const protocolVersions = [8, 13];
+const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
+const subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
+
+/**
+ * Class representing a WebSocket.
+ *
+ * @extends EventEmitter
+ */
+class WebSocket extends EventEmitter {
+ /**
+ * Create a new `WebSocket`.
+ *
+ * @param {(String|URL)} address The URL to which to connect
+ * @param {(String|String[])} [protocols] The subprotocols
+ * @param {Object} [options] Connection options
+ */
+ constructor(address, protocols, options) {
+ super();
+
+ this._binaryType = BINARY_TYPES[0];
+ this._closeCode = 1006;
+ this._closeFrameReceived = false;
+ this._closeFrameSent = false;
+ this._closeMessage = EMPTY_BUFFER;
+ this._closeTimer = null;
+ this._errorEmitted = false;
+ this._extensions = {};
+ this._paused = false;
+ this._protocol = '';
+ this._readyState = WebSocket.CONNECTING;
+ this._receiver = null;
+ this._sender = null;
+ this._socket = null;
+
+ if (address !== null) {
+ this._bufferedAmount = 0;
+ this._isServer = false;
+ this._redirects = 0;
+
+ if (protocols === undefined) {
+ protocols = [];
+ } else if (!Array.isArray(protocols)) {
+ if (typeof protocols === 'object' && protocols !== null) {
+ options = protocols;
+ protocols = [];
+ } else {
+ protocols = [protocols];
+ }
+ }
+
+ initAsClient(this, address, protocols, options);
+ } else {
+ this._autoPong = options.autoPong;
+ this._closeTimeout = options.closeTimeout;
+ this._isServer = true;
+ }
+ }
+
+ /**
+ * For historical reasons, the custom "nodebuffer" type is used by the default
+ * instead of "blob".
+ *
+ * @type {String}
+ */
+ get binaryType() {
+ return this._binaryType;
+ }
+
+ set binaryType(type) {
+ if (!BINARY_TYPES.includes(type)) return;
+
+ this._binaryType = type;
+
+ //
+ // Allow to change `binaryType` on the fly.
+ //
+ if (this._receiver) this._receiver._binaryType = type;
+ }
+
+ /**
+ * @type {Number}
+ */
+ get bufferedAmount() {
+ if (!this._socket) return this._bufferedAmount;
+
+ return this._socket._writableState.length + this._sender._bufferedBytes;
+ }
+
+ /**
+ * @type {String}
+ */
+ get extensions() {
+ return Object.keys(this._extensions).join();
+ }
+
+ /**
+ * @type {Boolean}
+ */
+ get isPaused() {
+ return this._paused;
+ }
+
+ /**
+ * @type {Function}
+ */
+ /* istanbul ignore next */
+ get onclose() {
+ return null;
+ }
+
+ /**
+ * @type {Function}
+ */
+ /* istanbul ignore next */
+ get onerror() {
+ return null;
+ }
+
+ /**
+ * @type {Function}
+ */
+ /* istanbul ignore next */
+ get onopen() {
+ return null;
+ }
+
+ /**
+ * @type {Function}
+ */
+ /* istanbul ignore next */
+ get onmessage() {
+ return null;
+ }
+
+ /**
+ * @type {String}
+ */
+ get protocol() {
+ return this._protocol;
+ }
+
+ /**
+ * @type {Number}
+ */
+ get readyState() {
+ return this._readyState;
+ }
+
+ /**
+ * @type {String}
+ */
+ get url() {
+ return this._url;
+ }
+
+ /**
+ * Set up the socket and the internal resources.
+ *
+ * @param {Duplex} socket The network socket between the server and client
+ * @param {Buffer} head The first packet of the upgraded stream
+ * @param {Object} options Options object
+ * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether
+ * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
+ * multiple times in the same tick
+ * @param {Function} [options.generateMask] The function used to generate the
+ * masking key
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
+ * buffered data chunks
+ * @param {Number} [options.maxFragments=0] The maximum number of message
+ * fragments
+ * @param {Number} [options.maxPayload=0] The maximum allowed message size
+ * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
+ * not to skip UTF-8 validation for text and close messages
+ * @private
+ */
+ setSocket(socket, head, options) {
+ const receiver = new Receiver({
+ allowSynchronousEvents: options.allowSynchronousEvents,
+ binaryType: this.binaryType,
+ extensions: this._extensions,
+ isServer: this._isServer,
+ maxBufferedChunks: options.maxBufferedChunks,
+ maxFragments: options.maxFragments,
+ maxPayload: options.maxPayload,
+ skipUTF8Validation: options.skipUTF8Validation
+ });
+
+ const sender = new Sender(socket, this._extensions, options.generateMask);
+
+ this._receiver = receiver;
+ this._sender = sender;
+ this._socket = socket;
+
+ receiver[kWebSocket] = this;
+ sender[kWebSocket] = this;
+ socket[kWebSocket] = this;
+
+ receiver.on('conclude', receiverOnConclude);
+ receiver.on('drain', receiverOnDrain);
+ receiver.on('error', receiverOnError);
+ receiver.on('message', receiverOnMessage);
+ receiver.on('ping', receiverOnPing);
+ receiver.on('pong', receiverOnPong);
+
+ sender.onerror = senderOnError;
+
+ //
+ // These methods may not be available if `socket` is just a `Duplex`.
+ //
+ if (socket.setTimeout) socket.setTimeout(0);
+ if (socket.setNoDelay) socket.setNoDelay();
+
+ if (head.length > 0) socket.unshift(head);
+
+ socket.on('close', socketOnClose);
+ socket.on('data', socketOnData);
+ socket.on('end', socketOnEnd);
+ socket.on('error', socketOnError);
+
+ this._readyState = WebSocket.OPEN;
+ this.emit('open');
+ }
+
+ /**
+ * Emit the `'close'` event.
+ *
+ * @private
+ */
+ emitClose() {
+ if (!this._socket) {
+ this._readyState = WebSocket.CLOSED;
+ this.emit('close', this._closeCode, this._closeMessage);
+ return;
+ }
+
+ if (this._extensions[PerMessageDeflate.extensionName]) {
+ this._extensions[PerMessageDeflate.extensionName].cleanup();
+ }
+
+ this._receiver.removeAllListeners();
+ this._readyState = WebSocket.CLOSED;
+ this.emit('close', this._closeCode, this._closeMessage);
+ }
+
+ /**
+ * Start a closing handshake.
+ *
+ * +----------+ +-----------+ +----------+
+ * - - -|ws.close()|-->|close frame|-->|ws.close()|- - -
+ * | +----------+ +-----------+ +----------+ |
+ * +----------+ +-----------+ |
+ * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING
+ * +----------+ +-----------+ |
+ * | | | +---+ |
+ * +------------------------+-->|fin| - - - -
+ * | +---+ | +---+
+ * - - - - -|fin|<---------------------+
+ * +---+
+ *
+ * @param {Number} [code] Status code explaining why the connection is closing
+ * @param {(String|Buffer)} [data] The reason why the connection is
+ * closing
+ * @public
+ */
+ close(code, data) {
+ if (this.readyState === WebSocket.CLOSED) return;
+ if (this.readyState === WebSocket.CONNECTING) {
+ const msg = 'WebSocket was closed before the connection was established';
+ abortHandshake(this, this._req, msg);
+ return;
+ }
+
+ if (this.readyState === WebSocket.CLOSING) {
+ if (
+ this._closeFrameSent &&
+ (this._closeFrameReceived || this._receiver._writableState.errorEmitted)
+ ) {
+ this._socket.end();
+ }
+
+ return;
+ }
+
+ this._readyState = WebSocket.CLOSING;
+ this._sender.close(code, data, !this._isServer, (err) => {
+ //
+ // This error is handled by the `'error'` listener on the socket. We only
+ // want to know if the close frame has been sent here.
+ //
+ if (err) return;
+
+ this._closeFrameSent = true;
+
+ if (
+ this._closeFrameReceived ||
+ this._receiver._writableState.errorEmitted
+ ) {
+ this._socket.end();
+ }
+ });
+
+ setCloseTimer(this);
+ }
+
+ /**
+ * Pause the socket.
+ *
+ * @public
+ */
+ pause() {
+ if (
+ this.readyState === WebSocket.CONNECTING ||
+ this.readyState === WebSocket.CLOSED
+ ) {
+ return;
+ }
+
+ this._paused = true;
+ this._socket.pause();
+ }
+
+ /**
+ * Send a ping.
+ *
+ * @param {*} [data] The data to send
+ * @param {Boolean} [mask] Indicates whether or not to mask `data`
+ * @param {Function} [cb] Callback which is executed when the ping is sent
+ * @public
+ */
+ ping(data, mask, cb) {
+ if (this.readyState === WebSocket.CONNECTING) {
+ throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');
+ }
+
+ if (typeof data === 'function') {
+ cb = data;
+ data = mask = undefined;
+ } else if (typeof mask === 'function') {
+ cb = mask;
+ mask = undefined;
+ }
+
+ if (typeof data === 'number') data = data.toString();
+
+ if (this.readyState !== WebSocket.OPEN) {
+ sendAfterClose(this, data, cb);
+ return;
+ }
+
+ if (mask === undefined) mask = !this._isServer;
+ this._sender.ping(data || EMPTY_BUFFER, mask, cb);
+ }
+
+ /**
+ * Send a pong.
+ *
+ * @param {*} [data] The data to send
+ * @param {Boolean} [mask] Indicates whether or not to mask `data`
+ * @param {Function} [cb] Callback which is executed when the pong is sent
+ * @public
+ */
+ pong(data, mask, cb) {
+ if (this.readyState === WebSocket.CONNECTING) {
+ throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');
+ }
+
+ if (typeof data === 'function') {
+ cb = data;
+ data = mask = undefined;
+ } else if (typeof mask === 'function') {
+ cb = mask;
+ mask = undefined;
+ }
+
+ if (typeof data === 'number') data = data.toString();
+
+ if (this.readyState !== WebSocket.OPEN) {
+ sendAfterClose(this, data, cb);
+ return;
+ }
+
+ if (mask === undefined) mask = !this._isServer;
+ this._sender.pong(data || EMPTY_BUFFER, mask, cb);
+ }
+
+ /**
+ * Resume the socket.
+ *
+ * @public
+ */
+ resume() {
+ if (
+ this.readyState === WebSocket.CONNECTING ||
+ this.readyState === WebSocket.CLOSED
+ ) {
+ return;
+ }
+
+ this._paused = false;
+ if (!this._receiver._writableState.needDrain) this._socket.resume();
+ }
+
+ /**
+ * Send a data message.
+ *
+ * @param {*} data The message to send
+ * @param {Object} [options] Options object
+ * @param {Boolean} [options.binary] Specifies whether `data` is binary or
+ * text
+ * @param {Boolean} [options.compress] Specifies whether or not to compress
+ * `data`
+ * @param {Boolean} [options.fin=true] Specifies whether the fragment is the
+ * last one
+ * @param {Boolean} [options.mask] Specifies whether or not to mask `data`
+ * @param {Function} [cb] Callback which is executed when data is written out
+ * @public
+ */
+ send(data, options, cb) {
+ if (this.readyState === WebSocket.CONNECTING) {
+ throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');
+ }
+
+ if (typeof options === 'function') {
+ cb = options;
+ options = {};
+ }
+
+ if (typeof data === 'number') data = data.toString();
+
+ if (this.readyState !== WebSocket.OPEN) {
+ sendAfterClose(this, data, cb);
+ return;
+ }
+
+ const opts = {
+ binary: typeof data !== 'string',
+ mask: !this._isServer,
+ compress: true,
+ fin: true,
+ ...options
+ };
+
+ if (!this._extensions[PerMessageDeflate.extensionName]) {
+ opts.compress = false;
+ }
+
+ this._sender.send(data || EMPTY_BUFFER, opts, cb);
+ }
+
+ /**
+ * Forcibly close the connection.
+ *
+ * @public
+ */
+ terminate() {
+ if (this.readyState === WebSocket.CLOSED) return;
+ if (this.readyState === WebSocket.CONNECTING) {
+ const msg = 'WebSocket was closed before the connection was established';
+ abortHandshake(this, this._req, msg);
+ return;
+ }
+
+ if (this._socket) {
+ this._readyState = WebSocket.CLOSING;
+ this._socket.destroy();
+ }
+ }
+}
+
+/**
+ * @constant {Number} CONNECTING
+ * @memberof WebSocket
+ */
+Object.defineProperty(WebSocket, 'CONNECTING', {
+ enumerable: true,
+ value: readyStates.indexOf('CONNECTING')
+});
+
+/**
+ * @constant {Number} CONNECTING
+ * @memberof WebSocket.prototype
+ */
+Object.defineProperty(WebSocket.prototype, 'CONNECTING', {
+ enumerable: true,
+ value: readyStates.indexOf('CONNECTING')
+});
+
+/**
+ * @constant {Number} OPEN
+ * @memberof WebSocket
+ */
+Object.defineProperty(WebSocket, 'OPEN', {
+ enumerable: true,
+ value: readyStates.indexOf('OPEN')
+});
+
+/**
+ * @constant {Number} OPEN
+ * @memberof WebSocket.prototype
+ */
+Object.defineProperty(WebSocket.prototype, 'OPEN', {
+ enumerable: true,
+ value: readyStates.indexOf('OPEN')
+});
+
+/**
+ * @constant {Number} CLOSING
+ * @memberof WebSocket
+ */
+Object.defineProperty(WebSocket, 'CLOSING', {
+ enumerable: true,
+ value: readyStates.indexOf('CLOSING')
+});
+
+/**
+ * @constant {Number} CLOSING
+ * @memberof WebSocket.prototype
+ */
+Object.defineProperty(WebSocket.prototype, 'CLOSING', {
+ enumerable: true,
+ value: readyStates.indexOf('CLOSING')
+});
+
+/**
+ * @constant {Number} CLOSED
+ * @memberof WebSocket
+ */
+Object.defineProperty(WebSocket, 'CLOSED', {
+ enumerable: true,
+ value: readyStates.indexOf('CLOSED')
+});
+
+/**
+ * @constant {Number} CLOSED
+ * @memberof WebSocket.prototype
+ */
+Object.defineProperty(WebSocket.prototype, 'CLOSED', {
+ enumerable: true,
+ value: readyStates.indexOf('CLOSED')
+});
+
+[
+ 'binaryType',
+ 'bufferedAmount',
+ 'extensions',
+ 'isPaused',
+ 'protocol',
+ 'readyState',
+ 'url'
+].forEach((property) => {
+ Object.defineProperty(WebSocket.prototype, property, { enumerable: true });
+});
+
+//
+// Add the `onopen`, `onerror`, `onclose`, and `onmessage` attributes.
+// See https://html.spec.whatwg.org/multipage/comms.html#the-websocket-interface
+//
+['open', 'error', 'close', 'message'].forEach((method) => {
+ Object.defineProperty(WebSocket.prototype, `on${method}`, {
+ enumerable: true,
+ get() {
+ for (const listener of this.listeners(method)) {
+ if (listener[kForOnEventAttribute]) return listener[kListener];
+ }
+
+ return null;
+ },
+ set(handler) {
+ for (const listener of this.listeners(method)) {
+ if (listener[kForOnEventAttribute]) {
+ this.removeListener(method, listener);
+ break;
+ }
+ }
+
+ if (typeof handler !== 'function') return;
+
+ this.addEventListener(method, handler, {
+ [kForOnEventAttribute]: true
+ });
+ }
+ });
+});
+
+WebSocket.prototype.addEventListener = addEventListener;
+WebSocket.prototype.removeEventListener = removeEventListener;
+
+module.exports = WebSocket;
+
+/**
+ * Initialize a WebSocket client.
+ *
+ * @param {WebSocket} websocket The client to initialize
+ * @param {(String|URL)} address The URL to which to connect
+ * @param {Array} protocols The subprotocols
+ * @param {Object} [options] Connection options
+ * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether any
+ * of the `'message'`, `'ping'`, and `'pong'` events can be emitted multiple
+ * times in the same tick
+ * @param {Boolean} [options.autoPong=true] Specifies whether or not to
+ * automatically send a pong in response to a ping
+ * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to wait
+ * for the closing handshake to finish after `websocket.close()` is called
+ * @param {Function} [options.finishRequest] A function which can be used to
+ * customize the headers of each http request before it is sent
+ * @param {Boolean} [options.followRedirects=false] Whether or not to follow
+ * redirects
+ * @param {Function} [options.generateMask] The function used to generate the
+ * masking key
+ * @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the
+ * handshake request
+ * @param {Number} [options.maxBufferedChunks=262144] The maximum number of
+ * buffered data chunks
+ * @param {Number} [options.maxFragments=16384] The maximum number of message
+ * fragments
+ * @param {Number} [options.maxPayload=104857600] The maximum allowed message
+ * size
+ * @param {Number} [options.maxRedirects=10] The maximum number of redirects
+ * allowed
+ * @param {String} [options.origin] Value of the `Origin` or
+ * `Sec-WebSocket-Origin` header
+ * @param {(Boolean|Object)} [options.perMessageDeflate=true] Enable/disable
+ * permessage-deflate
+ * @param {Number} [options.protocolVersion=13] Value of the
+ * `Sec-WebSocket-Version` header
+ * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
+ * not to skip UTF-8 validation for text and close messages
+ * @private
+ */
+function initAsClient(websocket, address, protocols, options) {
+ const opts = {
+ allowSynchronousEvents: true,
+ autoPong: true,
+ closeTimeout: CLOSE_TIMEOUT,
+ protocolVersion: protocolVersions[1],
+ maxBufferedChunks: 256 * 1024,
+ maxFragments: 16 * 1024,
+ maxPayload: 100 * 1024 * 1024,
+ skipUTF8Validation: false,
+ perMessageDeflate: true,
+ followRedirects: false,
+ maxRedirects: 10,
+ ...options,
+ socketPath: undefined,
+ hostname: undefined,
+ protocol: undefined,
+ timeout: undefined,
+ method: 'GET',
+ host: undefined,
+ path: undefined,
+ port: undefined
+ };
+
+ websocket._autoPong = opts.autoPong;
+ websocket._closeTimeout = opts.closeTimeout;
+
+ if (!protocolVersions.includes(opts.protocolVersion)) {
+ throw new RangeError(
+ `Unsupported protocol version: ${opts.protocolVersion} ` +
+ `(supported versions: ${protocolVersions.join(', ')})`
+ );
+ }
+
+ let parsedUrl;
+
+ if (address instanceof URL) {
+ parsedUrl = address;
+ } else {
+ try {
+ parsedUrl = new URL(address);
+ } catch {
+ throw new SyntaxError(`Invalid URL: ${address}`);
+ }
+ }
+
+ if (parsedUrl.protocol === 'http:') {
+ parsedUrl.protocol = 'ws:';
+ } else if (parsedUrl.protocol === 'https:') {
+ parsedUrl.protocol = 'wss:';
+ }
+
+ websocket._url = parsedUrl.href;
+
+ const isSecure = parsedUrl.protocol === 'wss:';
+ const isIpcUrl = parsedUrl.protocol === 'ws+unix:';
+ let invalidUrlMessage;
+
+ if (parsedUrl.protocol !== 'ws:' && !isSecure && !isIpcUrl) {
+ invalidUrlMessage =
+ 'The URL\'s protocol must be one of "ws:", "wss:", ' +
+ '"http:", "https:", or "ws+unix:"';
+ } else if (isIpcUrl && !parsedUrl.pathname) {
+ invalidUrlMessage = "The URL's pathname is empty";
+ } else if (parsedUrl.hash) {
+ invalidUrlMessage = 'The URL contains a fragment identifier';
+ }
+
+ if (invalidUrlMessage) {
+ const err = new SyntaxError(invalidUrlMessage);
+
+ if (websocket._redirects === 0) {
+ throw err;
+ } else {
+ emitErrorAndClose(websocket, err);
+ return;
+ }
+ }
+
+ const defaultPort = isSecure ? 443 : 80;
+ const key = randomBytes(16).toString('base64');
+ const request = isSecure ? https.request : http.request;
+ const protocolSet = new Set();
+ let perMessageDeflate;
+
+ opts.createConnection =
+ opts.createConnection || (isSecure ? tlsConnect : netConnect);
+ opts.defaultPort = opts.defaultPort || defaultPort;
+ opts.port = parsedUrl.port || defaultPort;
+ opts.host = parsedUrl.hostname.startsWith('[')
+ ? parsedUrl.hostname.slice(1, -1)
+ : parsedUrl.hostname;
+ opts.headers = {
+ ...opts.headers,
+ 'Sec-WebSocket-Version': opts.protocolVersion,
+ 'Sec-WebSocket-Key': key,
+ Connection: 'Upgrade',
+ Upgrade: 'websocket'
+ };
+ opts.path = parsedUrl.pathname + parsedUrl.search;
+ opts.timeout = opts.handshakeTimeout;
+
+ if (opts.perMessageDeflate) {
+ perMessageDeflate = new PerMessageDeflate({
+ ...opts.perMessageDeflate,
+ isServer: false,
+ maxPayload: opts.maxPayload
+ });
+ opts.headers['Sec-WebSocket-Extensions'] = format({
+ [PerMessageDeflate.extensionName]: perMessageDeflate.offer()
+ });
+ }
+ if (protocols.length) {
+ for (const protocol of protocols) {
+ if (
+ typeof protocol !== 'string' ||
+ !subprotocolRegex.test(protocol) ||
+ protocolSet.has(protocol)
+ ) {
+ throw new SyntaxError(
+ 'An invalid or duplicated subprotocol was specified'
+ );
+ }
+
+ protocolSet.add(protocol);
+ }
+
+ opts.headers['Sec-WebSocket-Protocol'] = protocols.join(',');
+ }
+ if (opts.origin) {
+ if (opts.protocolVersion < 13) {
+ opts.headers['Sec-WebSocket-Origin'] = opts.origin;
+ } else {
+ opts.headers.Origin = opts.origin;
+ }
+ }
+ if (parsedUrl.username || parsedUrl.password) {
+ opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
+ }
+
+ if (isIpcUrl) {
+ const parts = opts.path.split(':');
+
+ opts.socketPath = parts[0];
+ opts.path = parts[1];
+ }
+
+ let req;
+
+ if (opts.followRedirects) {
+ if (websocket._redirects === 0) {
+ websocket._originalIpc = isIpcUrl;
+ websocket._originalSecure = isSecure;
+ websocket._originalHostOrSocketPath = isIpcUrl
+ ? opts.socketPath
+ : parsedUrl.host;
+
+ const headers = options && options.headers;
+
+ //
+ // Shallow copy the user provided options so that headers can be changed
+ // without mutating the original object.
+ //
+ options = { ...options, headers: {} };
+
+ if (headers) {
+ for (const [key, value] of Object.entries(headers)) {
+ options.headers[key.toLowerCase()] = value;
+ }
+ }
+ } else if (websocket.listenerCount('redirect') === 0) {
+ const isSameHost = isIpcUrl
+ ? websocket._originalIpc
+ ? opts.socketPath === websocket._originalHostOrSocketPath
+ : false
+ : websocket._originalIpc
+ ? false
+ : parsedUrl.host === websocket._originalHostOrSocketPath;
+
+ if (!isSameHost || (websocket._originalSecure && !isSecure)) {
+ //
+ // Match curl 7.77.0 behavior and drop the following headers. These
+ // headers are also dropped when following a redirect to a subdomain.
+ //
+ delete opts.headers.authorization;
+ delete opts.headers.cookie;
+
+ if (!isSameHost) delete opts.headers.host;
+
+ opts.auth = undefined;
+ }
+ }
+
+ //
+ // Match curl 7.77.0 behavior and make the first `Authorization` header win.
+ // If the `Authorization` header is set, then there is nothing to do as it
+ // will take precedence.
+ //
+ if (opts.auth && !options.headers.authorization) {
+ options.headers.authorization =
+ 'Basic ' + Buffer.from(opts.auth).toString('base64');
+ }
+
+ req = websocket._req = request(opts);
+
+ if (websocket._redirects) {
+ //
+ // Unlike what is done for the `'upgrade'` event, no early exit is
+ // triggered here if the user calls `websocket.close()` or
+ // `websocket.terminate()` from a listener of the `'redirect'` event. This
+ // is because the user can also call `request.destroy()` with an error
+ // before calling `websocket.close()` or `websocket.terminate()` and this
+ // would result in an error being emitted on the `request` object with no
+ // `'error'` event listeners attached.
+ //
+ websocket.emit('redirect', websocket.url, req);
+ }
+ } else {
+ req = websocket._req = request(opts);
+ }
+
+ if (opts.timeout) {
+ req.on('timeout', () => {
+ abortHandshake(websocket, req, 'Opening handshake has timed out');
+ });
+ }
+
+ req.on('error', (err) => {
+ if (req === null || req[kAborted]) return;
+
+ req = websocket._req = null;
+ emitErrorAndClose(websocket, err);
+ });
+
+ req.on('response', (res) => {
+ const location = res.headers.location;
+ const statusCode = res.statusCode;
+
+ if (
+ location &&
+ opts.followRedirects &&
+ statusCode >= 300 &&
+ statusCode < 400
+ ) {
+ if (++websocket._redirects > opts.maxRedirects) {
+ abortHandshake(websocket, req, 'Maximum redirects exceeded');
+ return;
+ }
+
+ req.abort();
+
+ let addr;
+
+ try {
+ addr = new URL(location, address);
+ } catch (e) {
+ const err = new SyntaxError(`Invalid URL: ${location}`);
+ emitErrorAndClose(websocket, err);
+ return;
+ }
+
+ initAsClient(websocket, addr, protocols, options);
+ } else if (!websocket.emit('unexpected-response', req, res)) {
+ abortHandshake(
+ websocket,
+ req,
+ `Unexpected server response: ${res.statusCode}`
+ );
+ }
+ });
+
+ req.on('upgrade', (res, socket, head) => {
+ websocket.emit('upgrade', res);
+
+ //
+ // The user may have closed the connection from a listener of the
+ // `'upgrade'` event.
+ //
+ if (websocket.readyState !== WebSocket.CONNECTING) return;
+
+ req = websocket._req = null;
+
+ const upgrade = res.headers.upgrade;
+
+ if (upgrade === undefined || upgrade.toLowerCase() !== 'websocket') {
+ abortHandshake(websocket, socket, 'Invalid Upgrade header');
+ return;
+ }
+
+ const digest = createHash('sha1')
+ .update(key + GUID)
+ .digest('base64');
+
+ if (res.headers['sec-websocket-accept'] !== digest) {
+ abortHandshake(websocket, socket, 'Invalid Sec-WebSocket-Accept header');
+ return;
+ }
+
+ const serverProt = res.headers['sec-websocket-protocol'];
+ let protError;
+
+ if (serverProt !== undefined) {
+ if (!protocolSet.size) {
+ protError = 'Server sent a subprotocol but none was requested';
+ } else if (!protocolSet.has(serverProt)) {
+ protError = 'Server sent an invalid subprotocol';
+ }
+ } else if (protocolSet.size) {
+ protError = 'Server sent no subprotocol';
+ }
+
+ if (protError) {
+ abortHandshake(websocket, socket, protError);
+ return;
+ }
+
+ if (serverProt) websocket._protocol = serverProt;
+
+ const secWebSocketExtensions = res.headers['sec-websocket-extensions'];
+
+ if (secWebSocketExtensions !== undefined) {
+ if (!perMessageDeflate) {
+ const message =
+ 'Server sent a Sec-WebSocket-Extensions header but no extension ' +
+ 'was requested';
+ abortHandshake(websocket, socket, message);
+ return;
+ }
+
+ let extensions;
+
+ try {
+ extensions = parse(secWebSocketExtensions);
+ } catch (err) {
+ const message = 'Invalid Sec-WebSocket-Extensions header';
+ abortHandshake(websocket, socket, message);
+ return;
+ }
+
+ const extensionNames = Object.keys(extensions);
+
+ if (
+ extensionNames.length !== 1 ||
+ extensionNames[0] !== PerMessageDeflate.extensionName
+ ) {
+ const message = 'Server indicated an extension that was not requested';
+ abortHandshake(websocket, socket, message);
+ return;
+ }
+
+ try {
+ perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]);
+ } catch (err) {
+ const message = 'Invalid Sec-WebSocket-Extensions header';
+ abortHandshake(websocket, socket, message);
+ return;
+ }
+
+ websocket._extensions[PerMessageDeflate.extensionName] =
+ perMessageDeflate;
+ }
+
+ websocket.setSocket(socket, head, {
+ allowSynchronousEvents: opts.allowSynchronousEvents,
+ generateMask: opts.generateMask,
+ maxBufferedChunks: opts.maxBufferedChunks,
+ maxFragments: opts.maxFragments,
+ maxPayload: opts.maxPayload,
+ skipUTF8Validation: opts.skipUTF8Validation
+ });
+ });
+
+ if (opts.finishRequest) {
+ opts.finishRequest(req, websocket);
+ } else {
+ req.end();
+ }
+}
+
+/**
+ * Emit the `'error'` and `'close'` events.
+ *
+ * @param {WebSocket} websocket The WebSocket instance
+ * @param {Error} The error to emit
+ * @private
+ */
+function emitErrorAndClose(websocket, err) {
+ websocket._readyState = WebSocket.CLOSING;
+ //
+ // The following assignment is practically useless and is done only for
+ // consistency.
+ //
+ websocket._errorEmitted = true;
+ websocket.emit('error', err);
+ websocket.emitClose();
+}
+
+/**
+ * Create a `net.Socket` and initiate a connection.
+ *
+ * @param {Object} options Connection options
+ * @return {net.Socket} The newly created socket used to start the connection
+ * @private
+ */
+function netConnect(options) {
+ options.path = options.socketPath;
+ return net.connect(options);
+}
+
+/**
+ * Create a `tls.TLSSocket` and initiate a connection.
+ *
+ * @param {Object} options Connection options
+ * @return {tls.TLSSocket} The newly created socket used to start the connection
+ * @private
+ */
+function tlsConnect(options) {
+ options.path = undefined;
+
+ if (!options.servername && options.servername !== '') {
+ options.servername = net.isIP(options.host) ? '' : options.host;
+ }
+
+ return tls.connect(options);
+}
+
+/**
+ * Abort the handshake and emit an error.
+ *
+ * @param {WebSocket} websocket The WebSocket instance
+ * @param {(http.ClientRequest|net.Socket|tls.Socket)} stream The request to
+ * abort or the socket to destroy
+ * @param {String} message The error message
+ * @private
+ */
+function abortHandshake(websocket, stream, message) {
+ websocket._readyState = WebSocket.CLOSING;
+
+ const err = new Error(message);
+ Error.captureStackTrace(err, abortHandshake);
+
+ if (stream.setHeader) {
+ stream[kAborted] = true;
+ stream.abort();
+
+ if (stream.socket && !stream.socket.destroyed) {
+ //
+ // On Node.js >= 14.3.0 `request.abort()` does not destroy the socket if
+ // called after the request completed. See
+ // https://github.com/websockets/ws/issues/1869.
+ //
+ stream.socket.destroy();
+ }
+
+ process.nextTick(emitErrorAndClose, websocket, err);
+ } else {
+ stream.destroy(err);
+ stream.once('error', websocket.emit.bind(websocket, 'error'));
+ stream.once('close', websocket.emitClose.bind(websocket));
+ }
+}
+
+/**
+ * Handle cases where the `ping()`, `pong()`, or `send()` methods are called
+ * when the `readyState` attribute is `CLOSING` or `CLOSED`.
+ *
+ * @param {WebSocket} websocket The WebSocket instance
+ * @param {*} [data] The data to send
+ * @param {Function} [cb] Callback
+ * @private
+ */
+function sendAfterClose(websocket, data, cb) {
+ if (data) {
+ const length = isBlob(data) ? data.size : toBuffer(data).length;
+
+ //
+ // The `_bufferedAmount` property is used only when the peer is a client and
+ // the opening handshake fails. Under these circumstances, in fact, the
+ // `setSocket()` method is not called, so the `_socket` and `_sender`
+ // properties are set to `null`.
+ //
+ if (websocket._socket) websocket._sender._bufferedBytes += length;
+ else websocket._bufferedAmount += length;
+ }
+
+ if (cb) {
+ const err = new Error(
+ `WebSocket is not open: readyState ${websocket.readyState} ` +
+ `(${readyStates[websocket.readyState]})`
+ );
+ process.nextTick(cb, err);
+ }
+}
+
+/**
+ * The listener of the `Receiver` `'conclude'` event.
+ *
+ * @param {Number} code The status code
+ * @param {Buffer} reason The reason for closing
+ * @private
+ */
+function receiverOnConclude(code, reason) {
+ const websocket = this[kWebSocket];
+
+ websocket._closeFrameReceived = true;
+ websocket._closeMessage = reason;
+ websocket._closeCode = code;
+
+ if (websocket._socket[kWebSocket] === undefined) return;
+
+ websocket._socket.removeListener('data', socketOnData);
+ process.nextTick(resume, websocket._socket);
+
+ if (code === 1005) websocket.close();
+ else websocket.close(code, reason);
+}
+
+/**
+ * The listener of the `Receiver` `'drain'` event.
+ *
+ * @private
+ */
+function receiverOnDrain() {
+ const websocket = this[kWebSocket];
+
+ if (!websocket.isPaused) websocket._socket.resume();
+}
+
+/**
+ * The listener of the `Receiver` `'error'` event.
+ *
+ * @param {(RangeError|Error)} err The emitted error
+ * @private
+ */
+function receiverOnError(err) {
+ const websocket = this[kWebSocket];
+
+ if (websocket._socket[kWebSocket] !== undefined) {
+ websocket._socket.removeListener('data', socketOnData);
+
+ //
+ // On Node.js < 14.0.0 the `'error'` event is emitted synchronously. See
+ // https://github.com/websockets/ws/issues/1940.
+ //
+ process.nextTick(resume, websocket._socket);
+
+ websocket.close(err[kStatusCode]);
+ }
+
+ if (!websocket._errorEmitted) {
+ websocket._errorEmitted = true;
+ websocket.emit('error', err);
+ }
+}
+
+/**
+ * The listener of the `Receiver` `'finish'` event.
+ *
+ * @private
+ */
+function receiverOnFinish() {
+ this[kWebSocket].emitClose();
+}
+
+/**
+ * The listener of the `Receiver` `'message'` event.
+ *
+ * @param {Buffer|ArrayBuffer|Buffer[])} data The message
+ * @param {Boolean} isBinary Specifies whether the message is binary or not
+ * @private
+ */
+function receiverOnMessage(data, isBinary) {
+ this[kWebSocket].emit('message', data, isBinary);
+}
+
+/**
+ * The listener of the `Receiver` `'ping'` event.
+ *
+ * @param {Buffer} data The data included in the ping frame
+ * @private
+ */
+function receiverOnPing(data) {
+ const websocket = this[kWebSocket];
+
+ if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
+ websocket.emit('ping', data);
+}
+
+/**
+ * The listener of the `Receiver` `'pong'` event.
+ *
+ * @param {Buffer} data The data included in the pong frame
+ * @private
+ */
+function receiverOnPong(data) {
+ this[kWebSocket].emit('pong', data);
+}
+
+/**
+ * Resume a readable stream
+ *
+ * @param {Readable} stream The readable stream
+ * @private
+ */
+function resume(stream) {
+ stream.resume();
+}
+
+/**
+ * The `Sender` error event handler.
+ *
+ * @param {Error} The error
+ * @private
+ */
+function senderOnError(err) {
+ const websocket = this[kWebSocket];
+
+ if (websocket.readyState === WebSocket.CLOSED) return;
+ if (websocket.readyState === WebSocket.OPEN) {
+ websocket._readyState = WebSocket.CLOSING;
+ setCloseTimer(websocket);
+ }
+
+ //
+ // `socket.end()` is used instead of `socket.destroy()` to allow the other
+ // peer to finish sending queued data. There is no need to set a timer here
+ // because `CLOSING` means that it is already set or not needed.
+ //
+ this._socket.end();
+
+ if (!websocket._errorEmitted) {
+ websocket._errorEmitted = true;
+ websocket.emit('error', err);
+ }
+}
+
+/**
+ * Set a timer to destroy the underlying raw socket of a WebSocket.
+ *
+ * @param {WebSocket} websocket The WebSocket instance
+ * @private
+ */
+function setCloseTimer(websocket) {
+ websocket._closeTimer = setTimeout(
+ websocket._socket.destroy.bind(websocket._socket),
+ websocket._closeTimeout
+ );
+}
+
+/**
+ * The listener of the socket `'close'` event.
+ *
+ * @private
+ */
+function socketOnClose() {
+ const websocket = this[kWebSocket];
+
+ this.removeListener('close', socketOnClose);
+ this.removeListener('data', socketOnData);
+ this.removeListener('end', socketOnEnd);
+
+ websocket._readyState = WebSocket.CLOSING;
+
+ //
+ // The close frame might not have been received or the `'end'` event emitted,
+ // for example, if the socket was destroyed due to an error. Ensure that the
+ // `receiver` stream is closed after writing any remaining buffered data to
+ // it. If the readable side of the socket is in flowing mode then there is no
+ // buffered data as everything has been already written. If instead, the
+ // socket is paused, any possible buffered data will be read as a single
+ // chunk.
+ //
+ if (
+ !this._readableState.endEmitted &&
+ !websocket._closeFrameReceived &&
+ !websocket._receiver._writableState.errorEmitted &&
+ this._readableState.length !== 0
+ ) {
+ const chunk = this.read(this._readableState.length);
+
+ websocket._receiver.write(chunk);
+ }
+
+ websocket._receiver.end();
+
+ this[kWebSocket] = undefined;
+
+ clearTimeout(websocket._closeTimer);
+
+ if (
+ websocket._receiver._writableState.finished ||
+ websocket._receiver._writableState.errorEmitted
+ ) {
+ websocket.emitClose();
+ } else {
+ websocket._receiver.on('error', receiverOnFinish);
+ websocket._receiver.on('finish', receiverOnFinish);
+ }
+}
+
+/**
+ * The listener of the socket `'data'` event.
+ *
+ * @param {Buffer} chunk A chunk of data
+ * @private
+ */
+function socketOnData(chunk) {
+ if (!this[kWebSocket]._receiver.write(chunk)) {
+ this.pause();
+ }
+}
+
+/**
+ * The listener of the socket `'end'` event.
+ *
+ * @private
+ */
+function socketOnEnd() {
+ const websocket = this[kWebSocket];
+
+ websocket._readyState = WebSocket.CLOSING;
+ websocket._receiver.end();
+ this.end();
+}
+
+/**
+ * The listener of the socket `'error'` event.
+ *
+ * @private
+ */
+function socketOnError() {
+ const websocket = this[kWebSocket];
+
+ this.removeListener('error', socketOnError);
+ this.on('error', NOOP);
+
+ if (websocket) {
+ websocket._readyState = WebSocket.CLOSING;
+ this.destroy();
+ }
+}
diff --git a/tools/ui/node_modules/ws/package.json b/tools/ui/node_modules/ws/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..2e6db6ab08aaa6c78bfae123838dfd68fea736d8
--- /dev/null
+++ b/tools/ui/node_modules/ws/package.json
@@ -0,0 +1,74 @@
+{
+ "name": "ws",
+ "version": "8.21.2",
+ "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js",
+ "keywords": [
+ "HyBi",
+ "Push",
+ "RFC-6455",
+ "WebSocket",
+ "WebSockets",
+ "real-time"
+ ],
+ "homepage": "https://github.com/websockets/ws",
+ "bugs": "https://github.com/websockets/ws/issues",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/websockets/ws.git"
+ },
+ "author": "Einar Otto Stangvik (http://2x.io)",
+ "license": "MIT",
+ "main": "index.js",
+ "exports": {
+ ".": {
+ "browser": "./browser.js",
+ "import": "./wrapper.mjs",
+ "require": "./index.js"
+ },
+ "./package.json": "./package.json"
+ },
+ "browser": "browser.js",
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "files": [
+ "browser.js",
+ "index.js",
+ "lib/*.js",
+ "wrapper.mjs"
+ ],
+ "scripts": {
+ "test": "nyc --reporter=lcov --reporter=text mocha --throw-deprecation test/*.test.js",
+ "integration": "mocha --throw-deprecation test/*.integration.js",
+ "lint": "eslint . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yaml,yml}\""
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": ">=5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ },
+ "devDependencies": {
+ "@eslint/js": "^10.0.1",
+ "benchmark": "^2.1.4",
+ "bufferutil": "^4.0.1",
+ "eslint": "^10.0.1",
+ "eslint-config-prettier": "^10.0.1",
+ "eslint-plugin-prettier": "^5.0.0",
+ "globals": "^17.0.0",
+ "mocha": "^8.4.0",
+ "nyc": "^15.0.0",
+ "prettier": "^3.0.0",
+ "utf-8-validate": "^6.0.0"
+ },
+ "allowScripts": {
+ "bufferutil": true,
+ "utf-8-validate": true
+ }
+}
diff --git a/tools/ui/node_modules/ws/wrapper.mjs b/tools/ui/node_modules/ws/wrapper.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..a8ffabbb0e7de8c578eeb056907b58ea31cc3b22
--- /dev/null
+++ b/tools/ui/node_modules/ws/wrapper.mjs
@@ -0,0 +1,21 @@
+import createWebSocketStream from './lib/stream.js';
+import extension from './lib/extension.js';
+import PerMessageDeflate from './lib/permessage-deflate.js';
+import Receiver from './lib/receiver.js';
+import Sender from './lib/sender.js';
+import subprotocol from './lib/subprotocol.js';
+import WebSocket from './lib/websocket.js';
+import WebSocketServer from './lib/websocket-server.js';
+
+export {
+ createWebSocketStream,
+ extension,
+ PerMessageDeflate,
+ Receiver,
+ Sender,
+ subprotocol,
+ WebSocket,
+ WebSocketServer
+};
+
+export default WebSocket;
diff --git a/tools/ui/node_modules/wsl-utils/index.d.ts b/tools/ui/node_modules/wsl-utils/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..7a41088e986cbf164e21651c23bdbd703938a0be
--- /dev/null
+++ b/tools/ui/node_modules/wsl-utils/index.d.ts
@@ -0,0 +1,21 @@
+/**
+Check if the current environment is Windows Subsystem for Linux (WSL).
+*/
+export const isWsl: boolean;
+
+/**
+Get the PowerShell executable path in WSL environment.
+*/
+export function powerShellPathFromWsl(): Promise;
+
+/**
+Get the PowerShell executable path for the current environment.
+
+Returns WSL path if in WSL, otherwise returns Windows path.
+*/
+export function powerShellPath(): Promise;
+
+/**
+Get the mount point for fixed drives in WSL.
+*/
+export function wslDrivesMountPoint(): Promise;
diff --git a/tools/ui/node_modules/wsl-utils/index.js b/tools/ui/node_modules/wsl-utils/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..8ae51879d98b2aad27b80a77e0a04436ea42ceb6
--- /dev/null
+++ b/tools/ui/node_modules/wsl-utils/index.js
@@ -0,0 +1,57 @@
+import process from 'node:process';
+import fs, {constants as fsConstants} from 'node:fs/promises';
+import isWsl from 'is-wsl';
+
+export const wslDrivesMountPoint = (() => {
+ // Default value for "root" param
+ // according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config
+ const defaultMountPoint = '/mnt/';
+
+ let mountPoint;
+
+ return async function () {
+ if (mountPoint) {
+ // Return memoized mount point value
+ return mountPoint;
+ }
+
+ const configFilePath = '/etc/wsl.conf';
+
+ let isConfigFileExists = false;
+ try {
+ await fs.access(configFilePath, fsConstants.F_OK);
+ isConfigFileExists = true;
+ } catch {}
+
+ if (!isConfigFileExists) {
+ return defaultMountPoint;
+ }
+
+ const configContent = await fs.readFile(configFilePath, {encoding: 'utf8'});
+ const configMountPoint = /(?.*)/g.exec(configContent);
+
+ if (!configMountPoint) {
+ return defaultMountPoint;
+ }
+
+ mountPoint = configMountPoint.groups.mountPoint.trim();
+ mountPoint = mountPoint.endsWith('/') ? mountPoint : `${mountPoint}/`;
+
+ return mountPoint;
+ };
+})();
+
+export const powerShellPathFromWsl = async () => {
+ const mountPoint = await wslDrivesMountPoint();
+ return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
+};
+
+export const powerShellPath = async () => {
+ if (isWsl) {
+ return powerShellPathFromWsl();
+ }
+
+ return `${process.env.SYSTEMROOT || process.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
+};
+
+export {default as isWsl} from 'is-wsl';
diff --git a/tools/ui/node_modules/wsl-utils/license b/tools/ui/node_modules/wsl-utils/license
new file mode 100644
index 0000000000000000000000000000000000000000..fa7ceba3eb4a9657a9db7f3ffca4e4e97a9019de
--- /dev/null
+++ b/tools/ui/node_modules/wsl-utils/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus (https://sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/tools/ui/node_modules/wsl-utils/package.json b/tools/ui/node_modules/wsl-utils/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..94456035ea1fee7d379e4a373b69749d9ae88388
--- /dev/null
+++ b/tools/ui/node_modules/wsl-utils/package.json
@@ -0,0 +1,46 @@
+{
+ "name": "wsl-utils",
+ "version": "0.1.0",
+ "description": "Utilities for working with Windows Subsystem for Linux (WSL)",
+ "license": "MIT",
+ "repository": "sindresorhus/wsl-utils",
+ "funding": "https://github.com/sponsors/sindresorhus",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "https://sindresorhus.com"
+ },
+ "type": "module",
+ "exports": {
+ "types": "./index.d.ts",
+ "default": "./index.js"
+ },
+ "sideEffects": false,
+ "engines": {
+ "node": ">=18"
+ },
+ "scripts": {
+ "test": "xo && ava && tsc index.d.ts --skipLibCheck"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "wsl",
+ "windows",
+ "subsystem",
+ "linux",
+ "powershell",
+ "mount",
+ "utilities"
+ ],
+ "dependencies": {
+ "is-wsl": "^3.1.0"
+ },
+ "devDependencies": {
+ "ava": "^6.3.0",
+ "typescript": "^5.8.3",
+ "xo": "^1.0.0"
+ }
+}
diff --git a/tools/ui/node_modules/wsl-utils/readme.md b/tools/ui/node_modules/wsl-utils/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..95666368496d950f1f8485251da37c31cace2a9a
--- /dev/null
+++ b/tools/ui/node_modules/wsl-utils/readme.md
@@ -0,0 +1,50 @@
+# wsl-utils
+
+> Utilities for working with [Windows Subsystem for Linux (WSL)](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux)
+
+## Install
+
+```sh
+npm install wsl-utils
+```
+
+## Usage
+
+```js
+import {isWsl, powerShellPathFromWsl} from 'wsl-utils';
+
+// Check if running in WSL
+console.log('Is WSL:', isWsl);
+
+// Get PowerShell path from WSL
+console.log('PowerShell path:', await powerShellPathFromWsl());
+//=> '/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe'
+```
+
+## API
+
+### isWsl
+
+Type: `boolean`
+
+Check if the current environment is Windows Subsystem for Linux (WSL).
+
+### powerShellPathFromWsl()
+
+Returns: `Promise`
+
+Get the PowerShell executable path in WSL environment.
+
+### powerShellPath()
+
+Returns: `Promise`
+
+Get the PowerShell executable path for the current environment.
+
+Returns WSL path if in WSL, otherwise returns Windows path.
+
+### wslDrivesMountPoint()
+
+Returns: `Promise`
+
+Get the mount point for fixed drives in WSL.
diff --git a/tools/ui/node_modules/yallist/LICENSE b/tools/ui/node_modules/yallist/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..19129e315fe593965a2fdd50ec0d1253bcbd2ece
--- /dev/null
+++ b/tools/ui/node_modules/yallist/LICENSE
@@ -0,0 +1,15 @@
+The ISC License
+
+Copyright (c) Isaac Z. Schlueter and Contributors
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/tools/ui/node_modules/yallist/README.md b/tools/ui/node_modules/yallist/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..f5861018696688887f69d055dd7d3ef54b38ebdc
--- /dev/null
+++ b/tools/ui/node_modules/yallist/README.md
@@ -0,0 +1,204 @@
+# yallist
+
+Yet Another Linked List
+
+There are many doubly-linked list implementations like it, but this
+one is mine.
+
+For when an array would be too big, and a Map can't be iterated in
+reverse order.
+
+
+[](https://travis-ci.org/isaacs/yallist) [](https://coveralls.io/github/isaacs/yallist)
+
+## basic usage
+
+```javascript
+var yallist = require('yallist')
+var myList = yallist.create([1, 2, 3])
+myList.push('foo')
+myList.unshift('bar')
+// of course pop() and shift() are there, too
+console.log(myList.toArray()) // ['bar', 1, 2, 3, 'foo']
+myList.forEach(function (k) {
+ // walk the list head to tail
+})
+myList.forEachReverse(function (k, index, list) {
+ // walk the list tail to head
+})
+var myDoubledList = myList.map(function (k) {
+ return k + k
+})
+// now myDoubledList contains ['barbar', 2, 4, 6, 'foofoo']
+// mapReverse is also a thing
+var myDoubledListReverse = myList.mapReverse(function (k) {
+ return k + k
+}) // ['foofoo', 6, 4, 2, 'barbar']
+
+var reduced = myList.reduce(function (set, entry) {
+ set += entry
+ return set
+}, 'start')
+console.log(reduced) // 'startfoo123bar'
+```
+
+## api
+
+The whole API is considered "public".
+
+Functions with the same name as an Array method work more or less the
+same way.
+
+There's reverse versions of most things because that's the point.
+
+### Yallist
+
+Default export, the class that holds and manages a list.
+
+Call it with either a forEach-able (like an array) or a set of
+arguments, to initialize the list.
+
+The Array-ish methods all act like you'd expect. No magic length,
+though, so if you change that it won't automatically prune or add
+empty spots.
+
+### Yallist.create(..)
+
+Alias for Yallist function. Some people like factories.
+
+#### yallist.head
+
+The first node in the list
+
+#### yallist.tail
+
+The last node in the list
+
+#### yallist.length
+
+The number of nodes in the list. (Change this at your peril. It is
+not magic like Array length.)
+
+#### yallist.toArray()
+
+Convert the list to an array.
+
+#### yallist.forEach(fn, [thisp])
+
+Call a function on each item in the list.
+
+#### yallist.forEachReverse(fn, [thisp])
+
+Call a function on each item in the list, in reverse order.
+
+#### yallist.get(n)
+
+Get the data at position `n` in the list. If you use this a lot,
+probably better off just using an Array.
+
+#### yallist.getReverse(n)
+
+Get the data at position `n`, counting from the tail.
+
+#### yallist.map(fn, thisp)
+
+Create a new Yallist with the result of calling the function on each
+item.
+
+#### yallist.mapReverse(fn, thisp)
+
+Same as `map`, but in reverse.
+
+#### yallist.pop()
+
+Get the data from the list tail, and remove the tail from the list.
+
+#### yallist.push(item, ...)
+
+Insert one or more items to the tail of the list.
+
+#### yallist.reduce(fn, initialValue)
+
+Like Array.reduce.
+
+#### yallist.reduceReverse
+
+Like Array.reduce, but in reverse.
+
+#### yallist.reverse
+
+Reverse the list in place.
+
+#### yallist.shift()
+
+Get the data from the list head, and remove the head from the list.
+
+#### yallist.slice([from], [to])
+
+Just like Array.slice, but returns a new Yallist.
+
+#### yallist.sliceReverse([from], [to])
+
+Just like yallist.slice, but the result is returned in reverse.
+
+#### yallist.toArray()
+
+Create an array representation of the list.
+
+#### yallist.toArrayReverse()
+
+Create a reversed array representation of the list.
+
+#### yallist.unshift(item, ...)
+
+Insert one or more items to the head of the list.
+
+#### yallist.unshiftNode(node)
+
+Move a Node object to the front of the list. (That is, pull it out of
+wherever it lives, and make it the new head.)
+
+If the node belongs to a different list, then that list will remove it
+first.
+
+#### yallist.pushNode(node)
+
+Move a Node object to the end of the list. (That is, pull it out of
+wherever it lives, and make it the new tail.)
+
+If the node belongs to a list already, then that list will remove it
+first.
+
+#### yallist.removeNode(node)
+
+Remove a node from the list, preserving referential integrity of head
+and tail and other nodes.
+
+Will throw an error if you try to have a list remove a node that
+doesn't belong to it.
+
+### Yallist.Node
+
+The class that holds the data and is actually the list.
+
+Call with `var n = new Node(value, previousNode, nextNode)`
+
+Note that if you do direct operations on Nodes themselves, it's very
+easy to get into weird states where the list is broken. Be careful :)
+
+#### node.next
+
+The next node in the list.
+
+#### node.prev
+
+The previous node in the list.
+
+#### node.value
+
+The data the node contains.
+
+#### node.list
+
+The list to which this node belongs. (Null if it does not belong to
+any list.)
diff --git a/tools/ui/node_modules/yallist/iterator.js b/tools/ui/node_modules/yallist/iterator.js
new file mode 100644
index 0000000000000000000000000000000000000000..d41c97a19f98495928bd657b330d3b687699e78c
--- /dev/null
+++ b/tools/ui/node_modules/yallist/iterator.js
@@ -0,0 +1,8 @@
+'use strict'
+module.exports = function (Yallist) {
+ Yallist.prototype[Symbol.iterator] = function* () {
+ for (let walker = this.head; walker; walker = walker.next) {
+ yield walker.value
+ }
+ }
+}
diff --git a/tools/ui/node_modules/yallist/package.json b/tools/ui/node_modules/yallist/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..271280992323aed8e192323c2907db530a48acb1
--- /dev/null
+++ b/tools/ui/node_modules/yallist/package.json
@@ -0,0 +1,29 @@
+{
+ "name": "yallist",
+ "version": "3.1.1",
+ "description": "Yet Another Linked List",
+ "main": "yallist.js",
+ "directories": {
+ "test": "test"
+ },
+ "files": [
+ "yallist.js",
+ "iterator.js"
+ ],
+ "dependencies": {},
+ "devDependencies": {
+ "tap": "^12.1.0"
+ },
+ "scripts": {
+ "test": "tap test/*.js --100",
+ "preversion": "npm test",
+ "postversion": "npm publish",
+ "postpublish": "git push origin --all; git push origin --tags"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/isaacs/yallist.git"
+ },
+ "author": "Isaac Z. Schlueter (http://blog.izs.me/)",
+ "license": "ISC"
+}
diff --git a/tools/ui/node_modules/yallist/yallist.js b/tools/ui/node_modules/yallist/yallist.js
new file mode 100644
index 0000000000000000000000000000000000000000..ed4e7303aa47d3e11cd8993666a101bde88834d6
--- /dev/null
+++ b/tools/ui/node_modules/yallist/yallist.js
@@ -0,0 +1,426 @@
+'use strict'
+module.exports = Yallist
+
+Yallist.Node = Node
+Yallist.create = Yallist
+
+function Yallist (list) {
+ var self = this
+ if (!(self instanceof Yallist)) {
+ self = new Yallist()
+ }
+
+ self.tail = null
+ self.head = null
+ self.length = 0
+
+ if (list && typeof list.forEach === 'function') {
+ list.forEach(function (item) {
+ self.push(item)
+ })
+ } else if (arguments.length > 0) {
+ for (var i = 0, l = arguments.length; i < l; i++) {
+ self.push(arguments[i])
+ }
+ }
+
+ return self
+}
+
+Yallist.prototype.removeNode = function (node) {
+ if (node.list !== this) {
+ throw new Error('removing node which does not belong to this list')
+ }
+
+ var next = node.next
+ var prev = node.prev
+
+ if (next) {
+ next.prev = prev
+ }
+
+ if (prev) {
+ prev.next = next
+ }
+
+ if (node === this.head) {
+ this.head = next
+ }
+ if (node === this.tail) {
+ this.tail = prev
+ }
+
+ node.list.length--
+ node.next = null
+ node.prev = null
+ node.list = null
+
+ return next
+}
+
+Yallist.prototype.unshiftNode = function (node) {
+ if (node === this.head) {
+ return
+ }
+
+ if (node.list) {
+ node.list.removeNode(node)
+ }
+
+ var head = this.head
+ node.list = this
+ node.next = head
+ if (head) {
+ head.prev = node
+ }
+
+ this.head = node
+ if (!this.tail) {
+ this.tail = node
+ }
+ this.length++
+}
+
+Yallist.prototype.pushNode = function (node) {
+ if (node === this.tail) {
+ return
+ }
+
+ if (node.list) {
+ node.list.removeNode(node)
+ }
+
+ var tail = this.tail
+ node.list = this
+ node.prev = tail
+ if (tail) {
+ tail.next = node
+ }
+
+ this.tail = node
+ if (!this.head) {
+ this.head = node
+ }
+ this.length++
+}
+
+Yallist.prototype.push = function () {
+ for (var i = 0, l = arguments.length; i < l; i++) {
+ push(this, arguments[i])
+ }
+ return this.length
+}
+
+Yallist.prototype.unshift = function () {
+ for (var i = 0, l = arguments.length; i < l; i++) {
+ unshift(this, arguments[i])
+ }
+ return this.length
+}
+
+Yallist.prototype.pop = function () {
+ if (!this.tail) {
+ return undefined
+ }
+
+ var res = this.tail.value
+ this.tail = this.tail.prev
+ if (this.tail) {
+ this.tail.next = null
+ } else {
+ this.head = null
+ }
+ this.length--
+ return res
+}
+
+Yallist.prototype.shift = function () {
+ if (!this.head) {
+ return undefined
+ }
+
+ var res = this.head.value
+ this.head = this.head.next
+ if (this.head) {
+ this.head.prev = null
+ } else {
+ this.tail = null
+ }
+ this.length--
+ return res
+}
+
+Yallist.prototype.forEach = function (fn, thisp) {
+ thisp = thisp || this
+ for (var walker = this.head, i = 0; walker !== null; i++) {
+ fn.call(thisp, walker.value, i, this)
+ walker = walker.next
+ }
+}
+
+Yallist.prototype.forEachReverse = function (fn, thisp) {
+ thisp = thisp || this
+ for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
+ fn.call(thisp, walker.value, i, this)
+ walker = walker.prev
+ }
+}
+
+Yallist.prototype.get = function (n) {
+ for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
+ // abort out of the list early if we hit a cycle
+ walker = walker.next
+ }
+ if (i === n && walker !== null) {
+ return walker.value
+ }
+}
+
+Yallist.prototype.getReverse = function (n) {
+ for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
+ // abort out of the list early if we hit a cycle
+ walker = walker.prev
+ }
+ if (i === n && walker !== null) {
+ return walker.value
+ }
+}
+
+Yallist.prototype.map = function (fn, thisp) {
+ thisp = thisp || this
+ var res = new Yallist()
+ for (var walker = this.head; walker !== null;) {
+ res.push(fn.call(thisp, walker.value, this))
+ walker = walker.next
+ }
+ return res
+}
+
+Yallist.prototype.mapReverse = function (fn, thisp) {
+ thisp = thisp || this
+ var res = new Yallist()
+ for (var walker = this.tail; walker !== null;) {
+ res.push(fn.call(thisp, walker.value, this))
+ walker = walker.prev
+ }
+ return res
+}
+
+Yallist.prototype.reduce = function (fn, initial) {
+ var acc
+ var walker = this.head
+ if (arguments.length > 1) {
+ acc = initial
+ } else if (this.head) {
+ walker = this.head.next
+ acc = this.head.value
+ } else {
+ throw new TypeError('Reduce of empty list with no initial value')
+ }
+
+ for (var i = 0; walker !== null; i++) {
+ acc = fn(acc, walker.value, i)
+ walker = walker.next
+ }
+
+ return acc
+}
+
+Yallist.prototype.reduceReverse = function (fn, initial) {
+ var acc
+ var walker = this.tail
+ if (arguments.length > 1) {
+ acc = initial
+ } else if (this.tail) {
+ walker = this.tail.prev
+ acc = this.tail.value
+ } else {
+ throw new TypeError('Reduce of empty list with no initial value')
+ }
+
+ for (var i = this.length - 1; walker !== null; i--) {
+ acc = fn(acc, walker.value, i)
+ walker = walker.prev
+ }
+
+ return acc
+}
+
+Yallist.prototype.toArray = function () {
+ var arr = new Array(this.length)
+ for (var i = 0, walker = this.head; walker !== null; i++) {
+ arr[i] = walker.value
+ walker = walker.next
+ }
+ return arr
+}
+
+Yallist.prototype.toArrayReverse = function () {
+ var arr = new Array(this.length)
+ for (var i = 0, walker = this.tail; walker !== null; i++) {
+ arr[i] = walker.value
+ walker = walker.prev
+ }
+ return arr
+}
+
+Yallist.prototype.slice = function (from, to) {
+ to = to || this.length
+ if (to < 0) {
+ to += this.length
+ }
+ from = from || 0
+ if (from < 0) {
+ from += this.length
+ }
+ var ret = new Yallist()
+ if (to < from || to < 0) {
+ return ret
+ }
+ if (from < 0) {
+ from = 0
+ }
+ if (to > this.length) {
+ to = this.length
+ }
+ for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
+ walker = walker.next
+ }
+ for (; walker !== null && i < to; i++, walker = walker.next) {
+ ret.push(walker.value)
+ }
+ return ret
+}
+
+Yallist.prototype.sliceReverse = function (from, to) {
+ to = to || this.length
+ if (to < 0) {
+ to += this.length
+ }
+ from = from || 0
+ if (from < 0) {
+ from += this.length
+ }
+ var ret = new Yallist()
+ if (to < from || to < 0) {
+ return ret
+ }
+ if (from < 0) {
+ from = 0
+ }
+ if (to > this.length) {
+ to = this.length
+ }
+ for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
+ walker = walker.prev
+ }
+ for (; walker !== null && i > from; i--, walker = walker.prev) {
+ ret.push(walker.value)
+ }
+ return ret
+}
+
+Yallist.prototype.splice = function (start, deleteCount /*, ...nodes */) {
+ if (start > this.length) {
+ start = this.length - 1
+ }
+ if (start < 0) {
+ start = this.length + start;
+ }
+
+ for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
+ walker = walker.next
+ }
+
+ var ret = []
+ for (var i = 0; walker && i < deleteCount; i++) {
+ ret.push(walker.value)
+ walker = this.removeNode(walker)
+ }
+ if (walker === null) {
+ walker = this.tail
+ }
+
+ if (walker !== this.head && walker !== this.tail) {
+ walker = walker.prev
+ }
+
+ for (var i = 2; i < arguments.length; i++) {
+ walker = insert(this, walker, arguments[i])
+ }
+ return ret;
+}
+
+Yallist.prototype.reverse = function () {
+ var head = this.head
+ var tail = this.tail
+ for (var walker = head; walker !== null; walker = walker.prev) {
+ var p = walker.prev
+ walker.prev = walker.next
+ walker.next = p
+ }
+ this.head = tail
+ this.tail = head
+ return this
+}
+
+function insert (self, node, value) {
+ var inserted = node === self.head ?
+ new Node(value, null, node, self) :
+ new Node(value, node, node.next, self)
+
+ if (inserted.next === null) {
+ self.tail = inserted
+ }
+ if (inserted.prev === null) {
+ self.head = inserted
+ }
+
+ self.length++
+
+ return inserted
+}
+
+function push (self, item) {
+ self.tail = new Node(item, self.tail, null, self)
+ if (!self.head) {
+ self.head = self.tail
+ }
+ self.length++
+}
+
+function unshift (self, item) {
+ self.head = new Node(item, null, self.head, self)
+ if (!self.tail) {
+ self.tail = self.head
+ }
+ self.length++
+}
+
+function Node (value, prev, next, list) {
+ if (!(this instanceof Node)) {
+ return new Node(value, prev, next, list)
+ }
+
+ this.list = list
+ this.value = value
+
+ if (prev) {
+ prev.next = this
+ this.prev = prev
+ } else {
+ this.prev = null
+ }
+
+ if (next) {
+ next.prev = this
+ this.next = next
+ } else {
+ this.next = null
+ }
+}
+
+try {
+ // add if support for Symbol.iterator is present
+ require('./iterator.js')(Yallist)
+} catch (er) {}
diff --git a/tools/ui/node_modules/yocto-queue/index.d.ts b/tools/ui/node_modules/yocto-queue/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..9541986b44c7169dfbc1764f06c4035881e870ac
--- /dev/null
+++ b/tools/ui/node_modules/yocto-queue/index.d.ts
@@ -0,0 +1,56 @@
+declare class Queue implements Iterable {
+ /**
+ The size of the queue.
+ */
+ readonly size: number;
+
+ /**
+ Tiny queue data structure.
+
+ The instance is an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols), which means you can iterate over the queue front to back with a “for…of” loop, or use spreading to convert the queue to an array. Don't do this unless you really need to though, since it's slow.
+
+ @example
+ ```
+ import Queue = require('yocto-queue');
+
+ const queue = new Queue();
+
+ queue.enqueue('🦄');
+ queue.enqueue('🌈');
+
+ console.log(queue.size);
+ //=> 2
+
+ console.log(...queue);
+ //=> '🦄 🌈'
+
+ console.log(queue.dequeue());
+ //=> '🦄'
+
+ console.log(queue.dequeue());
+ //=> '🌈'
+ ```
+ */
+ constructor();
+
+ [Symbol.iterator](): IterableIterator;
+
+ /**
+ Add a value to the queue.
+ */
+ enqueue(value: ValueType): void;
+
+ /**
+ Remove the next value in the queue.
+
+ @returns The removed value or `undefined` if the queue is empty.
+ */
+ dequeue(): ValueType | undefined;
+
+ /**
+ Clear the queue.
+ */
+ clear(): void;
+}
+
+export = Queue;
diff --git a/tools/ui/node_modules/yocto-queue/index.js b/tools/ui/node_modules/yocto-queue/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..2f3e6dcd7299584287a2e2961e6affd2e36f9141
--- /dev/null
+++ b/tools/ui/node_modules/yocto-queue/index.js
@@ -0,0 +1,68 @@
+class Node {
+ /// value;
+ /// next;
+
+ constructor(value) {
+ this.value = value;
+
+ // TODO: Remove this when targeting Node.js 12.
+ this.next = undefined;
+ }
+}
+
+class Queue {
+ // TODO: Use private class fields when targeting Node.js 12.
+ // #_head;
+ // #_tail;
+ // #_size;
+
+ constructor() {
+ this.clear();
+ }
+
+ enqueue(value) {
+ const node = new Node(value);
+
+ if (this._head) {
+ this._tail.next = node;
+ this._tail = node;
+ } else {
+ this._head = node;
+ this._tail = node;
+ }
+
+ this._size++;
+ }
+
+ dequeue() {
+ const current = this._head;
+ if (!current) {
+ return;
+ }
+
+ this._head = this._head.next;
+ this._size--;
+ return current.value;
+ }
+
+ clear() {
+ this._head = undefined;
+ this._tail = undefined;
+ this._size = 0;
+ }
+
+ get size() {
+ return this._size;
+ }
+
+ * [Symbol.iterator]() {
+ let current = this._head;
+
+ while (current) {
+ yield current.value;
+ current = current.next;
+ }
+ }
+}
+
+module.exports = Queue;
diff --git a/tools/ui/node_modules/yocto-queue/license b/tools/ui/node_modules/yocto-queue/license
new file mode 100644
index 0000000000000000000000000000000000000000..fa7ceba3eb4a9657a9db7f3ffca4e4e97a9019de
--- /dev/null
+++ b/tools/ui/node_modules/yocto-queue/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus (https://sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/tools/ui/node_modules/yocto-queue/package.json b/tools/ui/node_modules/yocto-queue/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..71a91017b6ee77b63075fee64993d931e33cd7ea
--- /dev/null
+++ b/tools/ui/node_modules/yocto-queue/package.json
@@ -0,0 +1,43 @@
+{
+ "name": "yocto-queue",
+ "version": "0.1.0",
+ "description": "Tiny queue data structure",
+ "license": "MIT",
+ "repository": "sindresorhus/yocto-queue",
+ "funding": "https://github.com/sponsors/sindresorhus",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "https://sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "queue",
+ "data",
+ "structure",
+ "algorithm",
+ "queues",
+ "queuing",
+ "list",
+ "array",
+ "linkedlist",
+ "fifo",
+ "enqueue",
+ "dequeue",
+ "data-structure"
+ ],
+ "devDependencies": {
+ "ava": "^2.4.0",
+ "tsd": "^0.13.1",
+ "xo": "^0.35.0"
+ }
+}
diff --git a/tools/ui/node_modules/yocto-queue/readme.md b/tools/ui/node_modules/yocto-queue/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..c72fefc486d495eb9a51c2a38a1245fc7dae18fc
--- /dev/null
+++ b/tools/ui/node_modules/yocto-queue/readme.md
@@ -0,0 +1,64 @@
+# yocto-queue [](https://bundlephobia.com/result?p=yocto-queue)
+
+> Tiny queue data structure
+
+You should use this package instead of an array if you do a lot of `Array#push()` and `Array#shift()` on large arrays, since `Array#shift()` has [linear time complexity](https://medium.com/@ariel.salem1989/an-easy-to-use-guide-to-big-o-time-complexity-5dcf4be8a444#:~:text=O(N)%E2%80%94Linear%20Time) *O(n)* while `Queue#dequeue()` has [constant time complexity](https://medium.com/@ariel.salem1989/an-easy-to-use-guide-to-big-o-time-complexity-5dcf4be8a444#:~:text=O(1)%20%E2%80%94%20Constant%20Time) *O(1)*. That makes a huge difference for large arrays.
+
+> A [queue](https://en.wikipedia.org/wiki/Queue_(abstract_data_type)) is an ordered list of elements where an element is inserted at the end of the queue and is removed from the front of the queue. A queue works based on the first-in, first-out ([FIFO](https://en.wikipedia.org/wiki/FIFO_(computing_and_electronics))) principle.
+
+## Install
+
+```
+$ npm install yocto-queue
+```
+
+## Usage
+
+```js
+const Queue = require('yocto-queue');
+
+const queue = new Queue();
+
+queue.enqueue('🦄');
+queue.enqueue('🌈');
+
+console.log(queue.size);
+//=> 2
+
+console.log(...queue);
+//=> '🦄 🌈'
+
+console.log(queue.dequeue());
+//=> '🦄'
+
+console.log(queue.dequeue());
+//=> '🌈'
+```
+
+## API
+
+### `queue = new Queue()`
+
+The instance is an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols), which means you can iterate over the queue front to back with a “for…of” loop, or use spreading to convert the queue to an array. Don't do this unless you really need to though, since it's slow.
+
+#### `.enqueue(value)`
+
+Add a value to the queue.
+
+#### `.dequeue()`
+
+Remove the next value in the queue.
+
+Returns the removed value or `undefined` if the queue is empty.
+
+#### `.clear()`
+
+Clear the queue.
+
+#### `.size`
+
+The size of the queue.
+
+## Related
+
+- [quick-lru](https://github.com/sindresorhus/quick-lru) - Simple “Least Recently Used” (LRU) cache
diff --git a/tools/ui/node_modules/zimmerframe/LICENSE b/tools/ui/node_modules/zimmerframe/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..de8796a3f3b5d29a458927dfd6892ab1c1b3468a
--- /dev/null
+++ b/tools/ui/node_modules/zimmerframe/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2023 [these people](https://github.com/Rich-Harris/zimmerframe/graphs/contributors)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/tools/ui/node_modules/zimmerframe/README.md b/tools/ui/node_modules/zimmerframe/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..1654d5424e7849ffef10dadccd9df3da2ad74b1e
--- /dev/null
+++ b/tools/ui/node_modules/zimmerframe/README.md
@@ -0,0 +1,180 @@
+# zimmerframe
+
+A tool for walking.
+
+Specifically, it's a tool for walking an abstract syntax tree (AST), where every node is an object with a `type: string`. This includes [ESTree](https://github.com/estree/estree) nodes, such as you might generate with [Acorn](https://github.com/acornjs/acorn) or [Meriyah](https://github.com/meriyah/meriyah), but also includes things like [CSSTree](https://github.com/csstree/csstree) or an arbitrary AST of your own devising.
+
+## Usage
+
+```ts
+import { walk } from 'zimmerframe';
+import { parse } from 'acorn';
+import { Node } from 'estree';
+
+const program = parse(`
+let message = 'hello';
+console.log(message);
+
+if (true) {
+ let answer = 42;
+ console.log(answer);
+}
+`);
+
+// You can pass in arbitrary state
+const state = {
+ declarations: [],
+ depth: 0
+};
+
+const transformed = walk(program as Node, state, {
+ _(node, { state, next }) {
+ // the `_` visitor is 'universal' — if provided,
+ // it will run for every node, before deferring
+ // to specialised visitors. you can pass a new
+ // `state` object to `next`
+ next({ ...state, answer: 42 });
+ },
+ VariableDeclarator(node, { state }) {
+ // `state` is passed into each visitor
+ if (node.id.type === 'Identifier') {
+ state.declarations.push({
+ depth: state.depth,
+ name: node.id.name
+ });
+ }
+ },
+ BlockStatement(node, { state, next, stop }) {
+ // you must call `next()` or `next(childState)`
+ // to visit child nodes
+ console.log('entering BlockStatement');
+ next({ ...state, depth: state.depth + 1 });
+ console.log('leaving BlockStatement');
+ },
+ Literal(node) {
+ // if you return something, it will replace
+ // the current node
+ if (node.value === 'hello') {
+ return {
+ ...node,
+ value: 'goodbye'
+ };
+ }
+ },
+ IfStatement(node, { visit }) {
+ // normally, returning a value will halt
+ // traversal into child nodes. you can
+ // transform children with the current
+ // visitors using `visit(node, state?)`
+ if (node.test.type === 'Literal' && node.test.value === true) {
+ return visit(node.consequent);
+ }
+ }
+});
+```
+
+The `transformed` AST would look like this:
+
+```js
+let message = 'goodbye';
+console.log(message);
+
+{
+ let answer = 42;
+ console.log(answer);
+}
+```
+
+## Types
+
+The type of `node` in each visitor is inferred from the visitor's name. For example:
+
+```ts
+walk(ast as estree.Node, state, {
+ ArrowFunctionExpression(node) {
+ // `node` is of type estree.ArrowFunctionExpression
+ }
+});
+```
+
+For this to work, the first argument should be casted to an union of all the types you plan to visit.
+
+You can import types from 'zimmerframe':
+
+```ts
+import {
+ walk,
+ type Visitor,
+ type Visitors,
+ type Context
+} from 'zimmerframe';
+import type { Node } from 'estree';
+
+interface State {...}
+
+const node: Node = {...};
+const state: State = {...};
+const visitors: Visitors = {...}
+
+walk(node, state, visitors);
+```
+
+## Context
+
+Each visitor receives a second argument, `context`, which is an object with the following properties and methods:
+
+- `next(state?: State): void` — a function that allows you to control when child nodes are visited, and which state they are visited with. If child visitors transform their inputs, this will return the transformed node (if not, returns `undefined`)
+- `path: Node[]` — an array of parent nodes. For example, to get the root node you would do `path.at(0)`; to get the current node's immediate parent you would do `path.at(-1)`
+- `state: State` — an object of the same type as the second argument to `walk`. Visitors can pass new state objects to their children with `next(childState)` or `visit(node, childState)`
+- `stop(): void` — prevents any subsequent traversal
+- `visit(node: Node, state?: State): Node` — returns the result of visiting `node` with the current set of visitors. If no `state` is provided, children will inherit the current state
+
+## Immutability
+
+ASTs are regarded as immutable. If you return a transformed node from a visitor, then all parents of the node will be replaced with clones, but unchanged subtrees will reuse the existing nodes.
+
+For example in this case, no transformation takes place, meaning that the returned value is identical to the original AST:
+
+```js
+const transformed = walk(original, state, {
+ Literal(node) {
+ console.log(node.value);
+ }
+});
+
+transformed === original; // true
+```
+
+In this case, however, we replace one of the nodes:
+
+```js
+const original = {
+ type: 'BinaryExpression',
+ operator: '+',
+ left: {
+ type: 'Identifier',
+ name: 'foo'
+ },
+ right: {
+ type: 'Identifier',
+ name: 'bar'
+ }
+};
+
+const transformed = walk(original, state, {
+ Identifier(node) {
+ if (node.name === 'bar') {
+ return { ...node, name: 'baz' };
+ }
+ }
+});
+
+transformed === original; // false, the BinaryExpression node is cloned
+transformed.left === original.left; // true, we can safely reuse this node
+```
+
+This makes it very easy to transform parts of your AST without incurring the performance and memory overhead of cloning the entire thing, and without the footgun of mutating it in place.
+
+## License
+
+MIT
diff --git a/tools/ui/node_modules/zimmerframe/package.json b/tools/ui/node_modules/zimmerframe/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..52c6e1e6644c7c4115455025ceb1afaccdb5b67f
--- /dev/null
+++ b/tools/ui/node_modules/zimmerframe/package.json
@@ -0,0 +1,35 @@
+{
+ "name": "zimmerframe",
+ "description": "A tool for walking ASTs",
+ "version": "1.1.4",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/sveltejs/zimmerframe"
+ },
+ "type": "module",
+ "exports": {
+ ".": {
+ "types": "./types/index.d.ts",
+ "import": "./src/walk.js"
+ }
+ },
+ "types": "./types/index.d.ts",
+ "files": [
+ "src",
+ "types"
+ ],
+ "devDependencies": {
+ "@changesets/cli": "^2.29.7",
+ "dts-buddy": "^0.6.2",
+ "typescript": "^5.9.2",
+ "vitest": "^3.2.4"
+ },
+ "license": "MIT",
+ "scripts": {
+ "changeset:version": "changeset version",
+ "changeset:publish": "changeset publish",
+ "check": "tsc",
+ "test": "vitest --run",
+ "test:watch": "vitest"
+ }
+}
\ No newline at end of file
diff --git a/tools/ui/node_modules/zimmerframe/src/index.d.ts b/tools/ui/node_modules/zimmerframe/src/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..cfa492b539c08398dea24e3e2e7c679788dda472
--- /dev/null
+++ b/tools/ui/node_modules/zimmerframe/src/index.d.ts
@@ -0,0 +1,2 @@
+export * from './walk.js';
+export * from './types.d.ts';
diff --git a/tools/ui/node_modules/zimmerframe/src/types.d.ts b/tools/ui/node_modules/zimmerframe/src/types.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..73095274b4d846032036dbb4c3accd39b9e0783a
--- /dev/null
+++ b/tools/ui/node_modules/zimmerframe/src/types.d.ts
@@ -0,0 +1,21 @@
+type BaseNode = { type: string };
+
+type NodeOf = X extends { type: T } ? X : never;
+
+type SpecialisedVisitors = {
+ [K in T['type']]?: Visitor, U, T>;
+};
+
+export type Visitor = (node: T, context: Context) => V | void;
+
+export type Visitors = T['type'] extends '_'
+ ? never
+ : SpecialisedVisitors & { _?: Visitor };
+
+export interface Context {
+ next: (state?: U) => T | void;
+ path: T[];
+ state: U;
+ stop: () => void;
+ visit: (node: T, state?: U) => T;
+}
diff --git a/tools/ui/node_modules/zimmerframe/src/walk.js b/tools/ui/node_modules/zimmerframe/src/walk.js
new file mode 100644
index 0000000000000000000000000000000000000000..551065b86214643008ae16dbac4e27688fac3672
--- /dev/null
+++ b/tools/ui/node_modules/zimmerframe/src/walk.js
@@ -0,0 +1,168 @@
+/** @import { Context, Visitor, Visitors } from './types.js' */
+
+/**
+ * @template {{ type: string }} T
+ * @template {Record | null} U
+ * @param {T} node
+ * @param {U} state
+ * @param {Visitors} visitors
+ */
+export function walk(node, state, visitors) {
+ const universal = visitors._;
+
+ let stopped = false;
+
+ /** @type {Visitor} _ */
+ function default_visitor(_, { next, state }) {
+ next(state);
+ }
+
+ /**
+ * @param {T} node
+ * @param {T[]} path
+ * @param {U} state
+ * @returns {T | undefined}
+ */
+ function visit(node, path, state) {
+ // Don't return the node here or it could lead to false-positive mutation detection
+ if (stopped) return;
+ if (!node.type) return;
+
+ /** @type {T | void} */
+ let result;
+
+ /** @type {Record} */
+ const mutations = {};
+
+ /** @type {Context} */
+ const context = {
+ path,
+ state,
+ next: (next_state = state) => {
+ path.push(node);
+ for (const key in node) {
+ if (key === 'type') continue;
+
+ const child_node = node[key];
+ if (child_node && typeof child_node === 'object') {
+ if (Array.isArray(child_node)) {
+ /** @type {Record} */
+ const array_mutations = {};
+ const len = child_node.length;
+
+ let mutated = false;
+
+ for (let i = 0; i < len; i++) {
+ const node = child_node[i];
+ if (node && typeof node === 'object') {
+ const result = visit(node, path, next_state);
+ if (result) {
+ array_mutations[i] = result;
+ mutated = true;
+ }
+ }
+ }
+
+ if (mutated) {
+ mutations[key] = child_node.map(
+ (node, i) => array_mutations[i] ?? node
+ );
+ }
+ } else {
+ const result = visit(
+ /** @type {T} */ (child_node),
+ path,
+ next_state
+ );
+
+ // @ts-ignore
+ if (result) {
+ mutations[key] = result;
+ }
+ }
+ }
+ }
+ path.pop();
+
+ if (Object.keys(mutations).length > 0) {
+ return apply_mutations(node, mutations);
+ }
+ },
+ stop: () => {
+ stopped = true;
+ },
+ visit: (next_node, next_state = state) => {
+ path.push(node);
+ const result = visit(next_node, path, next_state) ?? next_node;
+ path.pop();
+ return result;
+ }
+ };
+
+ let visitor = /** @type {Visitor} */ (
+ visitors[/** @type {T['type']} */ (node.type)] ?? default_visitor
+ );
+
+ if (universal) {
+ /** @type {T | void} */
+ let inner_result;
+
+ result = universal(node, {
+ ...context,
+ /** @param {U} next_state */
+ next: (next_state = state) => {
+ state = next_state; // make it the default for subsequent specialised visitors
+
+ inner_result = visitor(node, {
+ ...context,
+ state: next_state
+ });
+
+ return inner_result;
+ }
+ });
+
+ // @ts-expect-error TypeScript doesn't understand that `context.next(...)` is called immediately
+ if (!result && inner_result) {
+ result = inner_result;
+ }
+ } else {
+ result = visitor(node, context);
+ }
+
+ if (!result) {
+ if (Object.keys(mutations).length > 0) {
+ result = apply_mutations(node, mutations);
+ }
+ }
+
+ if (result) {
+ return result;
+ }
+ }
+
+ return visit(node, [], state) ?? node;
+}
+
+/**
+ * @template {Record} T
+ * @param {T} node
+ * @param {Record} mutations
+ * @returns {T}
+ */
+function apply_mutations(node, mutations) {
+ /** @type {Record} */
+ const obj = {};
+
+ const descriptors = Object.getOwnPropertyDescriptors(node);
+
+ for (const key in descriptors) {
+ Object.defineProperty(obj, key, descriptors[key]);
+ }
+
+ for (const key in mutations) {
+ obj[key] = mutations[key];
+ }
+
+ return /** @type {T} */ (obj);
+}
diff --git a/tools/ui/node_modules/zimmerframe/types/index.d.ts b/tools/ui/node_modules/zimmerframe/types/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..cc1f81ecc0d4e28028a86c76d33a1573c7fcadf0
--- /dev/null
+++ b/tools/ui/node_modules/zimmerframe/types/index.d.ts
@@ -0,0 +1,30 @@
+declare module 'zimmerframe' {
+ export function walk | null>(node: T, state: U, visitors: Visitors): T;
+ type BaseNode = { type: string };
+
+ type NodeOf = X extends { type: T } ? X : never;
+
+ type SpecialisedVisitors = {
+ [K in T['type']]?: Visitor, U, T>;
+ };
+
+ export type Visitor = (node: T, context: Context) => V | void;
+
+ export type Visitors = T['type'] extends '_'
+ ? never
+ : SpecialisedVisitors & { _?: Visitor };
+
+ export interface Context {
+ next: (state?: U) => T | void;
+ path: T[];
+ state: U;
+ stop: () => void;
+ visit: (node: T, state?: U) => T;
+ }
+
+ export {};
+}
+
+//# sourceMappingURL=index.d.ts.map
\ No newline at end of file
diff --git a/tools/ui/node_modules/zimmerframe/types/index.d.ts.map b/tools/ui/node_modules/zimmerframe/types/index.d.ts.map
new file mode 100644
index 0000000000000000000000000000000000000000..f20fad9a988f60d95d0a41ed722f742bad9c735e
--- /dev/null
+++ b/tools/ui/node_modules/zimmerframe/types/index.d.ts.map
@@ -0,0 +1,23 @@
+{
+ "version": 3,
+ "file": "index.d.ts",
+ "names": [
+ "walk",
+ "BaseNode",
+ "NodeOf",
+ "SpecialisedVisitors",
+ "Visitor",
+ "Visitors",
+ "Context"
+ ],
+ "sources": [
+ "../src/walk.js",
+ "../src/types.d.ts"
+ ],
+ "sourcesContent": [
+ null,
+ null
+ ],
+ "mappings": ";iBASgBA,IAAIA;;;MCTfC,QAAQA;;MAERC,MAAMA;;MAENC,mBAAmBA;;;;aAIZC,OAAOA;;aAEPC,QAAQA;;;;kBAIHC,OAAOA",
+ "ignoreList": []
+}
\ No newline at end of file
diff --git a/tools/ui/node_modules/zod-to-json-schema/.github/CR_logotype-full-color.png b/tools/ui/node_modules/zod-to-json-schema/.github/CR_logotype-full-color.png
new file mode 100644
index 0000000000000000000000000000000000000000..b9b916b370c21918c29ed688ef8c3aafdd64df92
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/.github/CR_logotype-full-color.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:fbff840670352c4c480ff6b686bca9c33e3946752aee15b9c3495550f7d6d965
+size 11047
diff --git a/tools/ui/node_modules/zod-to-json-schema/.github/FUNDING.yml b/tools/ui/node_modules/zod-to-json-schema/.github/FUNDING.yml
new file mode 100644
index 0000000000000000000000000000000000000000..cce355c092d231a5ca4e1ef3365a1770334fc88d
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/.github/FUNDING.yml
@@ -0,0 +1 @@
+github: [StefanTerdell]
diff --git a/tools/ui/node_modules/zod-to-json-schema/.prettierrc.json b/tools/ui/node_modules/zod-to-json-schema/.prettierrc.json
new file mode 100644
index 0000000000000000000000000000000000000000..0967ef424bce6791893e9a57bb952f80fd536e93
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/.prettierrc.json
@@ -0,0 +1 @@
+{}
diff --git a/tools/ui/node_modules/zod-to-json-schema/LICENSE b/tools/ui/node_modules/zod-to-json-schema/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..406daaf2d775f8a620662ea0dc5ed70e0f5668bf
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/LICENSE
@@ -0,0 +1,15 @@
+ISC License
+
+Copyright (c) 2020, Stefan Terdell
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
\ No newline at end of file
diff --git a/tools/ui/node_modules/zod-to-json-schema/README.md b/tools/ui/node_modules/zod-to-json-schema/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..57bc4ba1a98eb3f7fba2dc5790d5d0f01575c1fd
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/README.md
@@ -0,0 +1,390 @@
+# Zod to Json Schema
+
+[](https://npmjs.org/package/zod-to-json-schema)
+[](https://npmjs.org/package/zod-to-json-schema)
+
+## Notice of deprecation
+
+As of November 2025, this project will no longer be actively maintained. [Zod v4 natively supports generating JSON schemas](https://zod.dev/json-schema#ztojsonschema), so I recommend you switch to the new major.
+
+Thank you to all the contributors and sponsors throughout the years! So long, and thanks for all the fish.
+
+## Summary
+
+Does what it says on the tin; converts [Zod schemas](https://github.com/colinhacks/zod) into [JSON schemas](https://json-schema.org/)!
+
+- Supports all relevant schema types, basic string, number and array length validations and string patterns.
+- Resolves recursive and recurring schemas with internal `$ref`s.
+- Supports targeting legacy Open API 3.0 specification (3.1 supports regular Json Schema).
+- Supports Open AI strict mode schemas (Optional object properties are replaced with required but nullable ones).
+- As of v3.25 you can use Zod v4 as a peer-dependency, so long as you still provide v3-schemas.
+
+_Looking for the exact opposite? Check out [json-schema-to-zod](https://npmjs.org/package/json-schema-to-zod)_
+
+## Sponsors
+
+As this project will no longer be receiving updates I am no longer accepting new partnerships. Huge shout-out to CodeRabbit for keeping it real to the end <3
+
+
+
+
+
+
+
+
+ Cut code review time & bugs in half
+
+ coderabbit.ai
+
+
+
+
+
+
+## Usage
+
+### Basic example
+
+```typescript
+import { z } from "zod"; // Or, using v3.25 or v4, "zod/v3"
+import { zodToJsonSchema } from "zod-to-json-schema";
+
+const mySchema = z
+ .object({
+ myString: z.string().min(5),
+ myUnion: z.union([z.number(), z.boolean()]),
+ })
+ .describe("My neat object schema");
+
+const jsonSchema = zodToJsonSchema(mySchema, "mySchema");
+```
+
+#### Expected output
+
+```json
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$ref": "#/definitions/mySchema",
+ "definitions": {
+ "mySchema": {
+ "description": "My neat object schema",
+ "type": "object",
+ "properties": {
+ "myString": {
+ "type": "string",
+ "minLength": 5
+ },
+ "myUnion": {
+ "type": ["number", "boolean"]
+ }
+ },
+ "additionalProperties": false,
+ "required": ["myString", "myUnion"]
+ }
+ }
+}
+```
+
+## Options
+
+### Schema name
+
+You can pass a string as the second parameter of the main zodToJsonSchema function. If you do, your schema will end up inside a definitions object property on the root and referenced from there. Alternatively, you can pass the name as the `name` property of the options object (see below).
+
+### Options object
+
+Instead of the schema name (or nothing), you can pass an options object as the second parameter. The following options are available:
+
+| Option | Effect |
+| ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| **name**?: _string_ | As described above. |
+| **nameStrategy**?: "ref" \| "title" | Adds name as "title" meta instead of as a ref as described above |
+| **basePath**?: string[] | The base path of the root reference builder. Defaults to ["#"]. |
+| **$refStrategy**?: "root" \| "relative" \| "seen" \| "none" | The reference builder strategy; **"root"** resolves $refs from the root up, ie: "#/definitions/mySchema". **"relative"** uses [relative JSON pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). _See known issues!_ **"seen"** reuses the output of any "seen" Zod schema. In theory it's a more performant version of "none", but in practice this behaviour can cause issues with nested schemas and has now gotten its own option. **"none"** ignores referencing all together, creating a new schema branch even on "seen" schemas. Recursive references defaults to "any", ie `{}`. Defaults to "root". |
+| **effectStrategy**?: "input" \| "any" | The effects output strategy. Defaults to "input". _See known issues!_ |
+| **dateStrategy**?: "format:date" \| "format:date-time" \| "string" \| "integer" | Date strategy, integer allow to specify in unix-time min and max values. "format:date" creates a string schema with format: "date". "format:date-time" creates a string schema with format: "date-time". "string" is intepreted as "format:date-time". "integer" creates an integer schema with format "unix-time" (unless target "openApi3" is used min max checks are also respected) |
+| |
+| **emailStrategy**?: "format:email" \| "format:idn-email" \| "pattern:zod" | Choose how to handle the email string check. Defaults to "format:email". |
+| **base64Strategy**?: "format:binary" \| "contentEnconding:base64" \| "pattern:zod" | Choose how to handle the base64 string check. Defaults to "contentEncoding:base64" as described [here](https://json-schema.org/understanding-json-schema/reference/non_json_data#contentencoding). Note that "format:binary" is not represented in the output type as it's not part of the JSON Schema spec and only intended to be used when targeting OpenAPI 3.0. Later versions of OpenAPI support contentEncoding. |
+| **definitionPath**?: "definitions" \| "$defs" | The name of the definitions property when name is passed. Defaults to "definitions". |
+| **target**?: "jsonSchema7" \| "jsonSchema2019-09" \| "openApi3" \| "openAi" | Which spec to target. Defaults to "jsonSchema7" |
+| **strictUnions**?: boolean | Scrubs unions of any-like json schemas, like `{}` or `true`. Multiple zod types may result in these out of necessity, such as z.instanceof() |
+| **definitions**?: Record | See separate section below |
+| **errorMessages**?: boolean | Include custom error messages created via chained function checks for supported zod types. See section below |
+| **markdownDescription**?: boolean | Copies the `description` meta to `markdownDescription` |
+| **patternStrategy**?: "escape" \| "preserve" | The Zod string validations `.includes()`, `.startsWith()`, and `.endsWith()` must be converted to regex to be compatible with JSON Schema's `pattern`. For safety, all non-alphanumeric characters are `escape`d by default (consider `z.string().includes(".")`), but this can occasionally cause problems with Unicode-flagged regex parsers. Use `preserve` to prevent this escaping behaviour and preserve the exact string written, even if it results in an inaccurate regex. |
+| **applyRegexFlags**?: boolean | JSON Schema's `pattern` doesn't support RegExp flags, but Zod's `z.string().regex()` does. When this option is true (default false), a best-effort is made to transform regexes into a flag-independent form (e.g. `/x/i => /[xX]/` ). Supported flags: `i` (basic Latin only), `m`, `s`. |
+| **pipeStrategy**?: "all" \| "input" \| "output" | Decide which types should be included when using `z.pipe`, for example `z.string().pipe(z.number())` would return both `string` and `number` by default, only `string` for "input" and only `number` for "output". |
+| **removeAdditionalStrategy**?: "passthrough" \| "strict" | Decide when `additionalProperties` should be allowed. See the section on additional properties for details. |
+| **allowedAdditionalProperties**?: `true` \| `undefined` | What value to give `additionalProperties` when allowed. See the section on additional properties for details. |
+| **rejectedAdditionalProperties**?: `false` \| `undefined` | What value to give `additionalProperties` when rejected. See the section on additional properties for details. |
+| **override**?: callback | See section |
+| **postProcess**?: callback | See section |
+| **openAiAnyTypeName**?: string | Decides the name of a Json schema used to allow semi-arbitrary values in Open AI structured output. If any value in the Zod-schema resolves to any "any"-type schema it will reference a definition of this name. If no such definition is provided a default Json schema will be used. Defaults to "OpenAiAnyType" |
+
+### Definitions
+
+The definitions option lets you manually add recurring schemas into definitions for cleaner outputs. It's fully compatible with named schemas, changed definitions path and base path. Here's a simple example:
+
+```typescript
+const myRecurringSchema = z.string();
+const myObjectSchema = z.object({ a: myRecurringSchema, b: myRecurringSchema });
+
+const myJsonSchema = zodToJsonSchema(myObjectSchema, {
+ definitions: { myRecurringSchema },
+});
+```
+
+#### Result
+
+```json
+{
+ "type": "object",
+ "properties": {
+ "a": {
+ "$ref": "#/definitions/myRecurringSchema"
+ },
+ "b": {
+ "$ref": "#/definitions/myRecurringSchema"
+ }
+ },
+ "definitions": {
+ "myRecurringSchema": {
+ "type": "string"
+ }
+ }
+}
+```
+
+### Error Messages
+
+This feature allows optionally including error messages created via chained function calls for supported zod types:
+
+```ts
+// string schema with additional chained function call checks
+const EmailSchema = z.string().email("Invalid email").min(5, "Too short");
+
+const jsonSchema = zodToJsonSchema(EmailSchema, { errorMessages: true });
+```
+
+#### Result
+
+```json
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "type": "string",
+ "format": "email",
+ "minLength": 5,
+ "errorMessage": {
+ "format": "Invalid email",
+ "minLength": "Too short"
+ }
+}
+```
+
+This allows for field specific, validation step specific error messages which can be useful for building forms and such. This format is accepted by `react-hook-form`'s ajv resolver (and therefor `ajv-errors` which it uses under the hood). Note that if using AJV with this format will require [enabling `ajv-errors`](https://ajv.js.org/packages/ajv-errors.html#usage) as vanilla AJV does not accept this format by default.
+
+#### Custom Error Message Support
+
+- ZodString
+ - regex
+ - min, max
+ - email, cuid, uuid, url
+ - endsWith, startsWith
+- ZodNumber
+ - min, max, lt, lte, gt, gte,
+ - int
+ - multipleOf
+- ZodSet
+ - min, max
+- ZodArray
+ - min, max
+
+### Additional properties
+
+By default, Zod removes undeclared properties when parsing object schemas. In order to replicate the expected output of this behaviour, the default for behaviour of zodToJsonSchema is to set `"additionalProperties"` to `false` (although the correctness of this can be debated). If you wish to allow undeclared properties you can either:
+
+- Set `removeAdditionalStrategy` to `"strict"`. This will allow additional properties for any object schema that is not declared with `.strict()`.
+- Leave `removeAdditionalStrategy` set to its default value of `"passthrough"`, and add `.passtrough()` to your object schema.
+
+#### Removing the `additionalProperties` keyword using the `allowedAdditionalProperties` and/or `rejectedAdditionalProperties` options.
+
+Some schema definitions (like Googles Gen AI API for instance) does not allow the `additionalProperties` keyword at all. Luckily the JSON Schema spec allows for this: leaving the keyword undefined _should_ have the same effect as setting it to true (as per usual YMMV). To enable this behaviour, set the option `allowedAdditionalProperties` to `undefined`.
+
+To exclude the keyword even when additional properties are _not_ allowed, set the `rejectedAdditionalProperties` to `undefined` as well.
+
+_Heads up ⚠️: Both of these options will be ignored if your schema is declared with `.catchall(...)` as the provided schema will be used instead (if valid)._
+
+#### Expected outputs
+
+| `z.object({})` + option | `"additionalProperties"` value |
+| ------------------------- | ----------------------------------------------------------- |
+| `.strip()` (default) | `false` if strategy is `"passtrough"`, `true` if `"strict"` |
+| `.passtrough()` | `true` |
+| `.strict()` | `false` |
+| `.catchall(z.string())` | `{ "type": "string" }` |
+| `.catchall(z.function())` | `undefined` (function schemas are not currently parseable) |
+
+Substitute `true` and `false` for `undefined` according to `allowedAdditionalProperties` and/or `rejectedAdditionalProperties` respectively.
+
+### `override`
+
+This options takes a callback receiving a Zod schema definition, the current reference object (containing the current ref path and other options), an argument containing inforation about wether or not the schema has been encountered before, and a forceResolution argument.
+
+Important: if you don't want to override the current item you have to return the `ignoreOverride` symbol exported from the index. This is because `undefined` is a valid option to return when you want the property to be excluded from the resulting JSON schema.
+
+```typescript
+import zodToJsonSchema, { ignoreOverride } from "zod-to-json-schema";
+
+zodToJsonSchema(
+ z.object({
+ ignoreThis: z.string(),
+ overrideThis: z.string(),
+ removeThis: z.string(),
+ }),
+ {
+ override: (def, refs) => {
+ const path = refs.currentPath.join("/");
+
+ if (path === "#/properties/overrideThis") {
+ return {
+ type: "integer",
+ };
+ }
+
+ if (path === "#/properties/removeThis") {
+ return undefined;
+ }
+
+ // Important! Do not return `undefined` or void unless you want to remove the property from the resulting schema completely.
+ return ignoreOverride;
+ },
+ },
+);
+```
+
+Expected output:
+
+```json
+{
+ "type": "object",
+ "required": ["ignoreThis", "overrideThis"],
+ "properties": {
+ "ignoreThis": {
+ "type": "string"
+ },
+ "overrideThis": {
+ "type": "integer"
+ }
+ },
+ "additionalProperties": false
+}
+```
+
+### `postProcess`
+
+Besided receiving all arguments of the `override` callback, the `postProcess` callback also receives the generated schema. It should always return a JSON Schema, or `undefined` if you wish to filter it out. Unlike the `override` callback you do not have to return `ignoreOverride` if you are happy with the produced schema; simply return it unchanged.
+
+```typescript
+import zodToJsonSchema, { PostProcessCallback } from "zod-to-json-schema";
+
+// Define the callback to be used to process the output using the PostProcessCallback type:
+const postProcess: PostProcessCallback = (
+ // The original output produced by the package itself:
+ jsonSchema,
+ // The ZodSchema def used to produce the original schema:
+ def,
+ // The refs object containing the current path, passed options, etc.
+ refs,
+) => {
+ if (!jsonSchema) {
+ return jsonSchema;
+ }
+
+ // Try to expand description as JSON meta:
+ if (jsonSchema.description) {
+ try {
+ jsonSchema = {
+ ...jsonSchema,
+ ...JSON.parse(jsonSchema.description),
+ };
+ } catch {}
+ }
+
+ // Make all numbers nullable:
+ if ("type" in jsonSchema! && jsonSchema.type === "number") {
+ jsonSchema.type = ["number", "null"];
+ }
+
+ // Add the refs path, just because
+ (jsonSchema as any).path = refs.currentPath;
+
+ return jsonSchema;
+};
+
+const jsonSchema = zodToJsonSchema(zodSchema, { postProcess });
+```
+
+#### Using `postProcess` for including examples and other meta
+
+Adding support for examples and other JSON Schema meta keys are among the most commonly requested features for this project. Unfortunately the current Zod major (3) has pretty anemic support for this, so some userland hacking is required. Since this is such a common usecase I've included a helper function that simply tries to parse any description as JSON and expand it into the resulting schema.
+
+Simply stringify whatever you want added to the output schema as the description, then import and use `jsonDescription` as the postProcess option:
+
+```typescript
+import zodToJsonSchema, { jsonDescription } from "zod-to-json-schema";
+
+const zodSchema = z.string().describe(
+ JSON.stringify({
+ title: "My string",
+ description: "My description",
+ examples: ["Foo", "Bar"],
+ whatever: 123,
+ }),
+);
+
+const jsonSchema = zodToJsonSchema(zodSchema, {
+ postProcess: jsonDescription,
+});
+```
+
+Expected output:
+
+```json
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "type": "string",
+ "title": "My string",
+ "description": "My description",
+ "examples": ["Foo", "Bar"],
+ "whatever": 123
+}
+```
+
+## Known issues
+
+- The OpenAI target should be considered experimental for now, as some combination of options may break the compatibility.
+- When using `.transform`, the return type is inferred from the supplied function. In other words, there is no schema for the return type, and there is no way to convert it in runtime. Currently the JSON schema will therefore reflect the input side of the Zod schema and not necessarily the output (the latter aka. `z.infer`). If this causes problems with your schema, consider using the effectStrategy "any", which will allow any type of output.
+- JSON Schemas does not support any other key type than strings for objects. When using `z.record` with any other key type, this will be ignored. An exception to this rule is `z.enum` as is supported since 3.11.3
+- Relative JSON pointers, while published alongside [JSON schema draft 2020-12](https://json-schema.org/specification.html), is not technically a part of it. Currently, most resolvers do not handle them at all.
+- Since v3, the Object parser uses `.isOptional()` to check if a property should be included in `required` or not. This has the potentially dangerous behavior of calling `.safeParse` with `undefined`. To work around this, make sure your `preprocess` and other effects callbacks are pure and not liable to throw errors. An issue has been logged in the Zod repo and can be [tracked here](https://github.com/colinhacks/zod/issues/1460).
+- JSON Schema version 2020-12 is not yet officially supported. However, you should be able to use this library to obtain a compatible schema for the 2020-12 format just by changing the returned schema's `$schema` field to: "https://json-schema.org/draft/2020-12/schema#"
+
+## Versioning
+
+This package _does not_ follow semantic versioning. The major and minor versions of this package instead reflects feature parity with the [Zod package](http://npmjs.com/package/zod).
+
+I will do my best to keep API-breaking changes to an absolute minimum, but new features may appear as "patches", such as introducing the options pattern in 3.9.1.
+
+While v3.25 supports Zod v4 as a peer-dependency, it does _not_ mean it supports v4 schemas. Use `import { z } from "zod/v3"` and refer to the Zod documentation.
+
+## Changelog
+
+https://github.com/StefanTerdell/zod-to-json-schema/blob/master/changelog.md
diff --git a/tools/ui/node_modules/zod-to-json-schema/changelog.md b/tools/ui/node_modules/zod-to-json-schema/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..da0e94dae1b8fbfbe4492f3d87314dda72d63475
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/changelog.md
@@ -0,0 +1,83 @@
+# Changelog
+
+| Version | Change |
+| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| 3.25.2 | Bumps the peer dependency of Zod 3 to 3.25.28 - Versions before patch 13 caused [OOM issues](https://github.com/StefanTerdell/zod-to-json-schema/issues/185) and versions between that and 28 removed the /v3 import alias. |
+| 3.25.1 | Fixes large install size due to accidental inclusion of test files. Thanks, [Felix Mosheev](https://github.com/felixmosh)! |
+| 3.25.0 | Adds support for v3.25 and v3 through v4 (`import { z } from "zod/v3"`). Big thank you to both [Andrey Gubanovs](https://github.com/finom) and especially to [Faïz Hernawan Abdillah](https://github.com/Abdillah), whose more minimal implementation was merged. This will likely be the final release of `zod-to-json-schema`, as v4 now supports JSON schema natively. |
+| 3.24.6 | Removed use of instanceOf to check for optional properties as differing package versions could produce intermittent bugs. Added OpenAiAnyType to work around their schema restrictions. |
+| 3.24.5 | Update .npmignore to drop 2 mb of test files. Thanks [Misha Kaletsky](https://github.com/mmkal)! |
+| 3.24.4 | Added options to set the value of additionalProperties in objects and record |
+| 3.24.3 | Adds postProcess callback option |
+| 3.24.2 | Restructured internals to remove circular dependencies which apparently might cause some build systems to whine a bit. Big thanks to [Víctor Hernández](https://github.com/NanezX) for the fix. |
+| 3.24.1 | Adds OpenAI target |
+| 3.24.0 | Implements new string checks (jwt, base64url, cidr ipv4/v6), matching the new Zod version |
+| 3.23.5 | Module import hotfix by [Enzo Monjardín](https://github.com/enzomonjardin). Thanks! |
+| 3.23.4 | Fixes branded regex property names and a weird edgecase in arrays. Thanks to [Isaiah Marc Sanchez](https://github.com/imsanchez) and [Mitchell Merry](https://github.com/mitchell-merry)! |
+| 3.23.3 | More tests (Thanks [Brett Zamir!](https://github.com/brettz9)), removed dead code |
+| 3.23.2 | Lazily loads Emoji regex to avoid incompatibility with some environments. Thanks [Jacob Lee](https://github.com/jacoblee93)! |
+| 3.23.1 | Best-effort RegEx flag support by [Spappz](https://github.com/Spappz)! Some minor fixes and additions, such as the title option. |
+| 3.23.0 | Adds support for base64, date, time, duration and nanoid string validations. A warm welcome and a big thanks to [Colin](https://www.github.com/colinhacks), the creator of Zod, joining in as a contributor :) |
+| 3.22.5 | Adds new z.date() parsing options and override callback |
+| 3.22.4 | Adds fix for nullable references in OpenAPI mode |
+| 3.22.3 | Adjust root path from "#/" to "#" according to RFC 6901 |
+| 3.22.2 | Adds "output" pipe strategy |
+| 3.22.1 | Fixes broken imports when using some bundlers |
+| 3.22.0 | Support readonly. Export both CJS and ESM. Export everything from index. Alternative map parser. Improved pattern handling and updated sources. |
+| 3.21.4 | Fixes missing support for exact array length |
+| 3.21.3 | Fixes issue #77 (Reference path to nullable schemas in Open-API mode) |
+| 3.21.2 | Adds "integer" type Date output to support min/max checks, markdownDescription option, fixes "none" refStrategy by adding "seen" and adds an option to use "pattern" with Zods' email enum instead of "format". |
+| 3.21.1 | New target (2019-09) along with improved intersection schemas, improved mutual recursion references in definitions, descriptions respected in union parser and not removed in collapsed |
+| 3.21.0 | Added new string validations (ip, emoji, etc) and BigInt checks to support Zod 3.21 |
+| 3.20.5 | Added uniqueItems to Set and an option to disregard pipe schemas |
+| 3.20.4 | Bugfixes and improved record parsing for openApi3 |
+| 3.20.3 | Added Cuid2 support introduced in Zod 3.20.3 |
+| 3.20.2 | Reintroduced conditional simplified return-type for when target is OpenAPI 3 |
+| 3.20.1 | Fixed inconsistent casing in imports |
+| 3.20.0 | Adds support for Zod 3.20 with catch and pipe parser as well as new string validations. Refactored Ref handling; adding definitions no longer considered experimental. Main API function refactored and simplified; output type less defined but a lot easier to maintain. Doubt anyone will miss it. Narrator: Someone did in fact miss it
|
+| 3.19.4 | Adds custom error message support |
+| 3.19.3 | Mark `definitions` as experimental in the readme |
+| 3.19.2 | Added `definitions` option |
+| 3.19.1 | Strict unions fix |
+| 3.19.0 | No new features added in Zod, parity bump |
+| 3.18.2 | Fixes support for native enums |
+| 3.18.1 | Add strictUnions options |
+| 3.18.0 | Added support for branded types |
+| 3.17.2 | Fix for reference paths when supplying name option string. |
+| 3.17.1 | Added startsWith and endsWith string checks. Merge multiple pattern checks into allOf array. |
+| 3.17.0 | Added switch case handler for new trim "check". No changes to functionality. |
+| 3.15.x - 3.16.x | Skipped: Did not change the Zod API in any way relevant for this package. |
+| 3.14.1 | Dependabot security updates |
+| 3.14.0 | Moves Zod into peerDependencies. Supports checks for sets, NaN-type (sort of), discriminated union type and standalone optional properties (as unions with undefined) |
+| 3.12.x - 3.13.x | Skipped |
+| 3.11.3 | Joins unions of enums into single enum and allows enums as keys of records |
+| 3.11.2 | Adds option to target Open API 3 spec (paths) instead of Json Schema 7. |
+| 3.11.1 | Performance boost when using $refStrategy `none` and internal improvements. |
+| 3.11.0 | Added description support introduced in Zod 3.11.5 |
+| 3.10.x | Skipped: Minor 10 did not change the Zod API |
+| 3.9.5 | Type bug fix: used dev dependency types in package |
+| 3.9.4 | Path bug fix and test case when using optional definitions path |
+| 3.9.3 | Added option to change definition property name to $defs |
+| 3.9.2 | Added option to handle transform results as any instead of relying on their input schema. |
+| 3.9.1 | Refactored the way reference pointers are passed around and added options pattern to main function without braking backwards compatibility! You can now add a base path, change the reference strategy (or opt out), and still set the schema name inside the options object or outside as before. |
+| 3.9.0 | Added support for multipleOf number validaion, .rest() schemas for tuples and key validation for records (only compatible with string keys due to JSON Schema limitation). |
+| 3.7.x - 3.8.x | Skipped to reach functional parity with Zod versioning. |
+| 3.6.1 | Realised intersection had another potential ref pathing bug. Fixed. |
+| 3.6.0 | Added support for default & effects (refine). Broke out changelog.md |
+| 3.5.0 | Added support for CUID string validation |
+| 3.4.3 | Fixed $ref pathing for catchall and intersection. Additional tests and code structure fixes. |
+| 3.4.2 | Fixed broken intersection parser (Thanks [Noah2610](https://github.com/Noah2610)!) |
+| 3.4.1 | Fixed pathing bug for nullable items. |
+| 3.4.0 | Added support for z.lazy() |
+| 3.3.0 | Added support for catchall (additionalProperties schema on objects). Rebuilt object parser. |
+| 3.2.0 | Added support for Map and Set as seen by their most common JSON definitions. Beware no standardized definition seem to exist and JSON.parse doesn't handle either natively. Their implementations here are based on the spread approach. Also further simplified intersection definition to just allOf. |
+| 3.1.0 | String patterns finally supported! Fixed bugs include broken external type, unsafe nullable parsing, bad intersection implementation, and missing support for passthrough keys in objects. |
+| 3.0.3 | Fixed array deep pathing bug (path contained `array` instead of `items`) |
+| 3.0.2 | Fixed broken type usage (NonEmptyArrayDefinition was removed from Zod) |
+| 3.0.1 | Fixed a typo in the readme |
+| 3.0.0 | Compatible with Zod 3.2.0. Huge props to [Mr Hammad Asif](https://github.com/mrhammadasif) for his work on this. |
+| 0.6.2 | Hotfix for undefined object properties. Could crash the parser when using Pick |
+| 0.6.1 | Fixed bug in union pathing. `$Ref` was missing `/anyOf` |
+| 0.6.0 | Moved `@types/json-schema` and `typescript` to dev dependencies. `@types/json-schema` is now only used for the test suites. Using `strict: true` in ts config. |
+| 0.5.1 | First working release with all relevant Zod types present with most validations (except for string patterns due to Zod not exposing the source regexp pattern for those). |
+| < 0.5.1 | Deprecated due to broken package structure. Please be patient, I eat crayons. |
diff --git a/tools/ui/node_modules/zod-to-json-schema/contributing.md b/tools/ui/node_modules/zod-to-json-schema/contributing.md
new file mode 100644
index 0000000000000000000000000000000000000000..c8b4717f8c2e45bfaa6ad51c178b61b3b7b6b5ae
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/contributing.md
@@ -0,0 +1,9 @@
+# Contributing
+
+Hey, thanks for wanting to contribute.
+
+Before you open a PR, make sure to open an issue and discuss the problem you want to solve. I will not consider PRs without issues.
+
+I use [gitmoji](https://gitmoji.dev/) for my commit messages because I think it's fun. I encourage you to do the same, but won't enforce it.
+
+I check PRs and issues very rarely so please be patient.
diff --git a/tools/ui/node_modules/zod-to-json-schema/createIndex.ts b/tools/ui/node_modules/zod-to-json-schema/createIndex.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d126fcae543b9a3271c8952e81533e33417af79e
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/createIndex.ts
@@ -0,0 +1,32 @@
+import { readdirSync, writeFileSync, statSync } from "fs";
+
+const ignore = ["src/index.ts"];
+
+function checkSrcDir(path: string): string[] {
+ const lines: string[] = [];
+
+ for (const item of readdirSync(path)) {
+ const itemPath = path + "/" + item;
+
+ if (ignore.includes(itemPath)) {
+ continue;
+ }
+
+ if (statSync(itemPath).isDirectory()) {
+ lines.push(...checkSrcDir(itemPath));
+ } else if (item.endsWith(".ts")) {
+ lines.push('export * from "./' + itemPath.slice(4, -2) + 'js"');
+ }
+ }
+
+ return lines;
+}
+
+const lines = checkSrcDir("src");
+
+lines.push(
+ 'import { zodToJsonSchema } from "./zodToJsonSchema.js"',
+ "export default zodToJsonSchema;",
+);
+
+writeFileSync("./src/index.ts", lines.join(";\n"));
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/Options.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/Options.js
new file mode 100644
index 0000000000000000000000000000000000000000..63970bee50aac273a2fe0dfd209a2fbd6e4cba83
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/Options.js
@@ -0,0 +1,51 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.getDefaultOptions = exports.defaultOptions = exports.jsonDescription = exports.ignoreOverride = void 0;
+exports.ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
+const jsonDescription = (jsonSchema, def) => {
+ if (def.description) {
+ try {
+ return {
+ ...jsonSchema,
+ ...JSON.parse(def.description),
+ };
+ }
+ catch { }
+ }
+ return jsonSchema;
+};
+exports.jsonDescription = jsonDescription;
+exports.defaultOptions = {
+ name: undefined,
+ $refStrategy: "root",
+ basePath: ["#"],
+ effectStrategy: "input",
+ pipeStrategy: "all",
+ dateStrategy: "format:date-time",
+ mapStrategy: "entries",
+ removeAdditionalStrategy: "passthrough",
+ allowedAdditionalProperties: true,
+ rejectedAdditionalProperties: false,
+ definitionPath: "definitions",
+ target: "jsonSchema7",
+ strictUnions: false,
+ definitions: {},
+ errorMessages: false,
+ markdownDescription: false,
+ patternStrategy: "escape",
+ applyRegexFlags: false,
+ emailStrategy: "format:email",
+ base64Strategy: "contentEncoding:base64",
+ nameStrategy: "ref",
+ openAiAnyTypeName: "OpenAiAnyType"
+};
+const getDefaultOptions = (options) => (typeof options === "string"
+ ? {
+ ...exports.defaultOptions,
+ name: options,
+ }
+ : {
+ ...exports.defaultOptions,
+ ...options,
+ });
+exports.getDefaultOptions = getDefaultOptions;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/Refs.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/Refs.js
new file mode 100644
index 0000000000000000000000000000000000000000..04fd37b8b92633eadb563262a307bc0de9dbc7e5
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/Refs.js
@@ -0,0 +1,26 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.getRefs = void 0;
+const Options_js_1 = require("./Options.js");
+const getRefs = (options) => {
+ const _options = (0, Options_js_1.getDefaultOptions)(options);
+ const currentPath = _options.name !== undefined
+ ? [..._options.basePath, _options.definitionPath, _options.name]
+ : _options.basePath;
+ return {
+ ..._options,
+ flags: { hasReferencedOpenAiAnyType: false },
+ currentPath: currentPath,
+ propertyPath: undefined,
+ seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
+ def._def,
+ {
+ def: def._def,
+ path: [..._options.basePath, _options.definitionPath, name],
+ // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
+ jsonSchema: undefined,
+ },
+ ])),
+ };
+};
+exports.getRefs = getRefs;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/errorMessages.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/errorMessages.js
new file mode 100644
index 0000000000000000000000000000000000000000..a65eb082e64f9ef7ea91eb1191b7ff95526a2711
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/errorMessages.js
@@ -0,0 +1,19 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.setResponseValueAndErrors = exports.addErrorMessage = void 0;
+function addErrorMessage(res, key, errorMessage, refs) {
+ if (!refs?.errorMessages)
+ return;
+ if (errorMessage) {
+ res.errorMessage = {
+ ...res.errorMessage,
+ [key]: errorMessage,
+ };
+ }
+}
+exports.addErrorMessage = addErrorMessage;
+function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
+ res[key] = value;
+ addErrorMessage(res, key, errorMessage, refs);
+}
+exports.setResponseValueAndErrors = setResponseValueAndErrors;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/getRelativePath.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/getRelativePath.js
new file mode 100644
index 0000000000000000000000000000000000000000..03f4d787adebb769664e8472b1fa38985344fae4
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/getRelativePath.js
@@ -0,0 +1,12 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.getRelativePath = void 0;
+const getRelativePath = (pathA, pathB) => {
+ let i = 0;
+ for (; i < pathA.length && i < pathB.length; i++) {
+ if (pathA[i] !== pathB[i])
+ break;
+ }
+ return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
+};
+exports.getRelativePath = getRelativePath;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/index.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..c438d2cad422b4dcfc9f1302234d19c9616a1319
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/index.js
@@ -0,0 +1,56 @@
+"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __exportStar = (this && this.__exportStar) || function(m, exports) {
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+__exportStar(require("./Options.js"), exports);
+__exportStar(require("./Refs.js"), exports);
+__exportStar(require("./errorMessages.js"), exports);
+__exportStar(require("./getRelativePath.js"), exports);
+__exportStar(require("./parseDef.js"), exports);
+__exportStar(require("./parseTypes.js"), exports);
+__exportStar(require("./parsers/any.js"), exports);
+__exportStar(require("./parsers/array.js"), exports);
+__exportStar(require("./parsers/bigint.js"), exports);
+__exportStar(require("./parsers/boolean.js"), exports);
+__exportStar(require("./parsers/branded.js"), exports);
+__exportStar(require("./parsers/catch.js"), exports);
+__exportStar(require("./parsers/date.js"), exports);
+__exportStar(require("./parsers/default.js"), exports);
+__exportStar(require("./parsers/effects.js"), exports);
+__exportStar(require("./parsers/enum.js"), exports);
+__exportStar(require("./parsers/intersection.js"), exports);
+__exportStar(require("./parsers/literal.js"), exports);
+__exportStar(require("./parsers/map.js"), exports);
+__exportStar(require("./parsers/nativeEnum.js"), exports);
+__exportStar(require("./parsers/never.js"), exports);
+__exportStar(require("./parsers/null.js"), exports);
+__exportStar(require("./parsers/nullable.js"), exports);
+__exportStar(require("./parsers/number.js"), exports);
+__exportStar(require("./parsers/object.js"), exports);
+__exportStar(require("./parsers/optional.js"), exports);
+__exportStar(require("./parsers/pipeline.js"), exports);
+__exportStar(require("./parsers/promise.js"), exports);
+__exportStar(require("./parsers/readonly.js"), exports);
+__exportStar(require("./parsers/record.js"), exports);
+__exportStar(require("./parsers/set.js"), exports);
+__exportStar(require("./parsers/string.js"), exports);
+__exportStar(require("./parsers/tuple.js"), exports);
+__exportStar(require("./parsers/undefined.js"), exports);
+__exportStar(require("./parsers/union.js"), exports);
+__exportStar(require("./parsers/unknown.js"), exports);
+__exportStar(require("./selectParser.js"), exports);
+__exportStar(require("./zodToJsonSchema.js"), exports);
+const zodToJsonSchema_js_1 = require("./zodToJsonSchema.js");
+exports.default = zodToJsonSchema_js_1.zodToJsonSchema;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/package.json b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..0292b9956f2e40d6eb3d0f3998e710d973113aaa
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/package.json
@@ -0,0 +1 @@
+{"type":"commonjs"}
\ No newline at end of file
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parseDef.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parseDef.js
new file mode 100644
index 0000000000000000000000000000000000000000..1a4d35f6faf6d21a26cd4b0e8b5672e85d049509
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parseDef.js
@@ -0,0 +1,66 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseDef = void 0;
+const Options_js_1 = require("./Options.js");
+const selectParser_js_1 = require("./selectParser.js");
+const getRelativePath_js_1 = require("./getRelativePath.js");
+const any_js_1 = require("./parsers/any.js");
+function parseDef(def, refs, forceResolution = false) {
+ const seenItem = refs.seen.get(def);
+ if (refs.override) {
+ const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);
+ if (overrideResult !== Options_js_1.ignoreOverride) {
+ return overrideResult;
+ }
+ }
+ if (seenItem && !forceResolution) {
+ const seenSchema = get$ref(seenItem, refs);
+ if (seenSchema !== undefined) {
+ return seenSchema;
+ }
+ }
+ const newItem = { def, path: refs.currentPath, jsonSchema: undefined };
+ refs.seen.set(def, newItem);
+ const jsonSchemaOrGetter = (0, selectParser_js_1.selectParser)(def, def.typeName, refs);
+ // If the return was a function, then the inner definition needs to be extracted before a call to parseDef (recursive)
+ const jsonSchema = typeof jsonSchemaOrGetter === "function"
+ ? parseDef(jsonSchemaOrGetter(), refs)
+ : jsonSchemaOrGetter;
+ if (jsonSchema) {
+ addMeta(def, refs, jsonSchema);
+ }
+ if (refs.postProcess) {
+ const postProcessResult = refs.postProcess(jsonSchema, def, refs);
+ newItem.jsonSchema = jsonSchema;
+ return postProcessResult;
+ }
+ newItem.jsonSchema = jsonSchema;
+ return jsonSchema;
+}
+exports.parseDef = parseDef;
+const get$ref = (item, refs) => {
+ switch (refs.$refStrategy) {
+ case "root":
+ return { $ref: item.path.join("/") };
+ case "relative":
+ return { $ref: (0, getRelativePath_js_1.getRelativePath)(refs.currentPath, item.path) };
+ case "none":
+ case "seen": {
+ if (item.path.length < refs.currentPath.length &&
+ item.path.every((value, index) => refs.currentPath[index] === value)) {
+ console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
+ return (0, any_js_1.parseAnyDef)(refs);
+ }
+ return refs.$refStrategy === "seen" ? (0, any_js_1.parseAnyDef)(refs) : undefined;
+ }
+ }
+};
+const addMeta = (def, refs, jsonSchema) => {
+ if (def.description) {
+ jsonSchema.description = def.description;
+ if (refs.markdownDescription) {
+ jsonSchema.markdownDescription = def.description;
+ }
+ }
+ return jsonSchema;
+};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parseTypes.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parseTypes.js
new file mode 100644
index 0000000000000000000000000000000000000000..c8ad2e549bdc6801e0d1c80b0308d4b9bd4985ce
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parseTypes.js
@@ -0,0 +1,2 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/any.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/any.js
new file mode 100644
index 0000000000000000000000000000000000000000..d48e69dc86f7a4c25be7ff66fec2b931b2efa1d4
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/any.js
@@ -0,0 +1,21 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseAnyDef = void 0;
+const getRelativePath_js_1 = require("../getRelativePath.js");
+function parseAnyDef(refs) {
+ if (refs.target !== "openAi") {
+ return {};
+ }
+ const anyDefinitionPath = [
+ ...refs.basePath,
+ refs.definitionPath,
+ refs.openAiAnyTypeName,
+ ];
+ refs.flags.hasReferencedOpenAiAnyType = true;
+ return {
+ $ref: refs.$refStrategy === "relative"
+ ? (0, getRelativePath_js_1.getRelativePath)(anyDefinitionPath, refs.currentPath)
+ : anyDefinitionPath.join("/"),
+ };
+}
+exports.parseAnyDef = parseAnyDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/array.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/array.js
new file mode 100644
index 0000000000000000000000000000000000000000..4f7a3db61d42a464187b7951a8243bcb284e9dc9
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/array.js
@@ -0,0 +1,30 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseArrayDef = void 0;
+const v3_1 = require("zod/v3");
+const errorMessages_js_1 = require("../errorMessages.js");
+const parseDef_js_1 = require("../parseDef.js");
+function parseArrayDef(def, refs) {
+ const res = {
+ type: "array",
+ };
+ if (def.type?._def &&
+ def.type?._def?.typeName !== v3_1.ZodFirstPartyTypeKind.ZodAny) {
+ res.items = (0, parseDef_js_1.parseDef)(def.type._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "items"],
+ });
+ }
+ if (def.minLength) {
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minItems", def.minLength.value, def.minLength.message, refs);
+ }
+ if (def.maxLength) {
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
+ }
+ if (def.exactLength) {
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
+ }
+ return res;
+}
+exports.parseArrayDef = parseArrayDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/bigint.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/bigint.js
new file mode 100644
index 0000000000000000000000000000000000000000..239dd3423a78d3f24cf04f43a9c33ccdf8c26c69
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/bigint.js
@@ -0,0 +1,53 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseBigintDef = void 0;
+const errorMessages_js_1 = require("../errorMessages.js");
+function parseBigintDef(def, refs) {
+ const res = {
+ type: "integer",
+ format: "int64",
+ };
+ if (!def.checks)
+ return res;
+ for (const check of def.checks) {
+ switch (check.kind) {
+ case "min":
+ if (refs.target === "jsonSchema7") {
+ if (check.inclusive) {
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minimum", check.value, check.message, refs);
+ }
+ else {
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "exclusiveMinimum", check.value, check.message, refs);
+ }
+ }
+ else {
+ if (!check.inclusive) {
+ res.exclusiveMinimum = true;
+ }
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minimum", check.value, check.message, refs);
+ }
+ break;
+ case "max":
+ if (refs.target === "jsonSchema7") {
+ if (check.inclusive) {
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maximum", check.value, check.message, refs);
+ }
+ else {
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "exclusiveMaximum", check.value, check.message, refs);
+ }
+ }
+ else {
+ if (!check.inclusive) {
+ res.exclusiveMaximum = true;
+ }
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maximum", check.value, check.message, refs);
+ }
+ break;
+ case "multipleOf":
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "multipleOf", check.value, check.message, refs);
+ break;
+ }
+ }
+ return res;
+}
+exports.parseBigintDef = parseBigintDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/boolean.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/boolean.js
new file mode 100644
index 0000000000000000000000000000000000000000..504cfa17b7e915cf34042cd4299d4da42f961804
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/boolean.js
@@ -0,0 +1,9 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseBooleanDef = void 0;
+function parseBooleanDef() {
+ return {
+ type: "boolean",
+ };
+}
+exports.parseBooleanDef = parseBooleanDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/branded.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/branded.js
new file mode 100644
index 0000000000000000000000000000000000000000..db09a921c5aba7a2e4b6cb45d21632013a75e5b3
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/branded.js
@@ -0,0 +1,8 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseBrandedDef = void 0;
+const parseDef_js_1 = require("../parseDef.js");
+function parseBrandedDef(_def, refs) {
+ return (0, parseDef_js_1.parseDef)(_def.type._def, refs);
+}
+exports.parseBrandedDef = parseBrandedDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/catch.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/catch.js
new file mode 100644
index 0000000000000000000000000000000000000000..75d86c10c2374ce9c94f9c2271c9e5f89225e768
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/catch.js
@@ -0,0 +1,8 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseCatchDef = void 0;
+const parseDef_js_1 = require("../parseDef.js");
+const parseCatchDef = (def, refs) => {
+ return (0, parseDef_js_1.parseDef)(def.innerType._def, refs);
+};
+exports.parseCatchDef = parseCatchDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/date.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/date.js
new file mode 100644
index 0000000000000000000000000000000000000000..5a5229f7e25afc7208d546ac32f91d684dc4fee6
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/date.js
@@ -0,0 +1,50 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseDateDef = void 0;
+const errorMessages_js_1 = require("../errorMessages.js");
+function parseDateDef(def, refs, overrideDateStrategy) {
+ const strategy = overrideDateStrategy ?? refs.dateStrategy;
+ if (Array.isArray(strategy)) {
+ return {
+ anyOf: strategy.map((item, i) => parseDateDef(def, refs, item)),
+ };
+ }
+ switch (strategy) {
+ case "string":
+ case "format:date-time":
+ return {
+ type: "string",
+ format: "date-time",
+ };
+ case "format:date":
+ return {
+ type: "string",
+ format: "date",
+ };
+ case "integer":
+ return integerDateParser(def, refs);
+ }
+}
+exports.parseDateDef = parseDateDef;
+const integerDateParser = (def, refs) => {
+ const res = {
+ type: "integer",
+ format: "unix-time",
+ };
+ if (refs.target === "openApi3") {
+ return res;
+ }
+ for (const check of def.checks) {
+ switch (check.kind) {
+ case "min":
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minimum", check.value, // This is in milliseconds
+ check.message, refs);
+ break;
+ case "max":
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maximum", check.value, // This is in milliseconds
+ check.message, refs);
+ break;
+ }
+ }
+ return res;
+};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/default.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/default.js
new file mode 100644
index 0000000000000000000000000000000000000000..f558d0348dadab9b374f7349151b58571cb0ba64
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/default.js
@@ -0,0 +1,11 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseDefaultDef = void 0;
+const parseDef_js_1 = require("../parseDef.js");
+function parseDefaultDef(_def, refs) {
+ return {
+ ...(0, parseDef_js_1.parseDef)(_def.innerType._def, refs),
+ default: _def.defaultValue(),
+ };
+}
+exports.parseDefaultDef = parseDefaultDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/effects.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/effects.js
new file mode 100644
index 0000000000000000000000000000000000000000..e862cb4154085eaf905e725d95feefc34f48f4a7
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/effects.js
@@ -0,0 +1,11 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseEffectsDef = void 0;
+const parseDef_js_1 = require("../parseDef.js");
+const any_js_1 = require("./any.js");
+function parseEffectsDef(_def, refs) {
+ return refs.effectStrategy === "input"
+ ? (0, parseDef_js_1.parseDef)(_def.schema._def, refs)
+ : (0, any_js_1.parseAnyDef)(refs);
+}
+exports.parseEffectsDef = parseEffectsDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/enum.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/enum.js
new file mode 100644
index 0000000000000000000000000000000000000000..63d599141761d320cb4dc4b98cc4c0086fd1fe5e
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/enum.js
@@ -0,0 +1,10 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseEnumDef = void 0;
+function parseEnumDef(def) {
+ return {
+ type: "string",
+ enum: Array.from(def.values),
+ };
+}
+exports.parseEnumDef = parseEnumDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/intersection.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/intersection.js
new file mode 100644
index 0000000000000000000000000000000000000000..d68f73ef26eb03da777954b50215f42559a62c77
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/intersection.js
@@ -0,0 +1,56 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseIntersectionDef = void 0;
+const parseDef_js_1 = require("../parseDef.js");
+const isJsonSchema7AllOfType = (type) => {
+ if ("type" in type && type.type === "string")
+ return false;
+ return "allOf" in type;
+};
+function parseIntersectionDef(def, refs) {
+ const allOf = [
+ (0, parseDef_js_1.parseDef)(def.left._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "allOf", "0"],
+ }),
+ (0, parseDef_js_1.parseDef)(def.right._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "allOf", "1"],
+ }),
+ ].filter((x) => !!x);
+ let unevaluatedProperties = refs.target === "jsonSchema2019-09"
+ ? { unevaluatedProperties: false }
+ : undefined;
+ const mergedAllOf = [];
+ // If either of the schemas is an allOf, merge them into a single allOf
+ allOf.forEach((schema) => {
+ if (isJsonSchema7AllOfType(schema)) {
+ mergedAllOf.push(...schema.allOf);
+ if (schema.unevaluatedProperties === undefined) {
+ // If one of the schemas has no unevaluatedProperties set,
+ // the merged schema should also have no unevaluatedProperties set
+ unevaluatedProperties = undefined;
+ }
+ }
+ else {
+ let nestedSchema = schema;
+ if ("additionalProperties" in schema &&
+ schema.additionalProperties === false) {
+ const { additionalProperties, ...rest } = schema;
+ nestedSchema = rest;
+ }
+ else {
+ // As soon as one of the schemas has additionalProperties set not to false, we allow unevaluatedProperties
+ unevaluatedProperties = undefined;
+ }
+ mergedAllOf.push(nestedSchema);
+ }
+ });
+ return mergedAllOf.length
+ ? {
+ allOf: mergedAllOf,
+ ...unevaluatedProperties,
+ }
+ : undefined;
+}
+exports.parseIntersectionDef = parseIntersectionDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/literal.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/literal.js
new file mode 100644
index 0000000000000000000000000000000000000000..66c4ba063c06000d63acd109edbbcdaf32b897f7
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/literal.js
@@ -0,0 +1,25 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseLiteralDef = void 0;
+function parseLiteralDef(def, refs) {
+ const parsedType = typeof def.value;
+ if (parsedType !== "bigint" &&
+ parsedType !== "number" &&
+ parsedType !== "boolean" &&
+ parsedType !== "string") {
+ return {
+ type: Array.isArray(def.value) ? "array" : "object",
+ };
+ }
+ if (refs.target === "openApi3") {
+ return {
+ type: parsedType === "bigint" ? "integer" : parsedType,
+ enum: [def.value],
+ };
+ }
+ return {
+ type: parsedType === "bigint" ? "integer" : parsedType,
+ const: def.value,
+ };
+}
+exports.parseLiteralDef = parseLiteralDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/map.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/map.js
new file mode 100644
index 0000000000000000000000000000000000000000..9974688fa52c76c90b6eab99e64da994a377051c
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/map.js
@@ -0,0 +1,30 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseMapDef = void 0;
+const parseDef_js_1 = require("../parseDef.js");
+const record_js_1 = require("./record.js");
+const any_js_1 = require("./any.js");
+function parseMapDef(def, refs) {
+ if (refs.mapStrategy === "record") {
+ return (0, record_js_1.parseRecordDef)(def, refs);
+ }
+ const keys = (0, parseDef_js_1.parseDef)(def.keyType._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "items", "items", "0"],
+ }) || (0, any_js_1.parseAnyDef)(refs);
+ const values = (0, parseDef_js_1.parseDef)(def.valueType._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "items", "items", "1"],
+ }) || (0, any_js_1.parseAnyDef)(refs);
+ return {
+ type: "array",
+ maxItems: 125,
+ items: {
+ type: "array",
+ items: [keys, values],
+ minItems: 2,
+ maxItems: 2,
+ },
+ };
+}
+exports.parseMapDef = parseMapDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/nativeEnum.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/nativeEnum.js
new file mode 100644
index 0000000000000000000000000000000000000000..a3b35724dd9c14541fcb891bc3133564a538907d
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/nativeEnum.js
@@ -0,0 +1,20 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseNativeEnumDef = void 0;
+function parseNativeEnumDef(def) {
+ const object = def.values;
+ const actualKeys = Object.keys(def.values).filter((key) => {
+ return typeof object[object[key]] !== "number";
+ });
+ const actualValues = actualKeys.map((key) => object[key]);
+ const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
+ return {
+ type: parsedTypes.length === 1
+ ? parsedTypes[0] === "string"
+ ? "string"
+ : "number"
+ : ["string", "number"],
+ enum: actualValues,
+ };
+}
+exports.parseNativeEnumDef = parseNativeEnumDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/never.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/never.js
new file mode 100644
index 0000000000000000000000000000000000000000..01f24f9e4b525b15d52b95ef8999843270b6f2d9
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/never.js
@@ -0,0 +1,15 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseNeverDef = void 0;
+const any_js_1 = require("./any.js");
+function parseNeverDef(refs) {
+ return refs.target === "openAi"
+ ? undefined
+ : {
+ not: (0, any_js_1.parseAnyDef)({
+ ...refs,
+ currentPath: [...refs.currentPath, "not"],
+ }),
+ };
+}
+exports.parseNeverDef = parseNeverDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/null.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/null.js
new file mode 100644
index 0000000000000000000000000000000000000000..1b4bfa8f8d76374a81200a271dc94a958f92406e
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/null.js
@@ -0,0 +1,14 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseNullDef = void 0;
+function parseNullDef(refs) {
+ return refs.target === "openApi3"
+ ? {
+ enum: ["null"],
+ nullable: true,
+ }
+ : {
+ type: "null",
+ };
+}
+exports.parseNullDef = parseNullDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/nullable.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/nullable.js
new file mode 100644
index 0000000000000000000000000000000000000000..8890795ab1325d6587cd3282b5b9c06a82166f44
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/nullable.js
@@ -0,0 +1,37 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseNullableDef = void 0;
+const parseDef_js_1 = require("../parseDef.js");
+const union_js_1 = require("./union.js");
+function parseNullableDef(def, refs) {
+ if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) &&
+ (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
+ if (refs.target === "openApi3") {
+ return {
+ type: union_js_1.primitiveMappings[def.innerType._def.typeName],
+ nullable: true,
+ };
+ }
+ return {
+ type: [
+ union_js_1.primitiveMappings[def.innerType._def.typeName],
+ "null",
+ ],
+ };
+ }
+ if (refs.target === "openApi3") {
+ const base = (0, parseDef_js_1.parseDef)(def.innerType._def, {
+ ...refs,
+ currentPath: [...refs.currentPath],
+ });
+ if (base && "$ref" in base)
+ return { allOf: [base], nullable: true };
+ return base && { ...base, nullable: true };
+ }
+ const base = (0, parseDef_js_1.parseDef)(def.innerType._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "anyOf", "0"],
+ });
+ return base && { anyOf: [base, { type: "null" }] };
+}
+exports.parseNullableDef = parseNullableDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/number.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/number.js
new file mode 100644
index 0000000000000000000000000000000000000000..274014a94a0dbeaeb23c6f23ac270f91310146b8
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/number.js
@@ -0,0 +1,56 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseNumberDef = void 0;
+const errorMessages_js_1 = require("../errorMessages.js");
+function parseNumberDef(def, refs) {
+ const res = {
+ type: "number",
+ };
+ if (!def.checks)
+ return res;
+ for (const check of def.checks) {
+ switch (check.kind) {
+ case "int":
+ res.type = "integer";
+ (0, errorMessages_js_1.addErrorMessage)(res, "type", check.message, refs);
+ break;
+ case "min":
+ if (refs.target === "jsonSchema7") {
+ if (check.inclusive) {
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minimum", check.value, check.message, refs);
+ }
+ else {
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "exclusiveMinimum", check.value, check.message, refs);
+ }
+ }
+ else {
+ if (!check.inclusive) {
+ res.exclusiveMinimum = true;
+ }
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minimum", check.value, check.message, refs);
+ }
+ break;
+ case "max":
+ if (refs.target === "jsonSchema7") {
+ if (check.inclusive) {
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maximum", check.value, check.message, refs);
+ }
+ else {
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "exclusiveMaximum", check.value, check.message, refs);
+ }
+ }
+ else {
+ if (!check.inclusive) {
+ res.exclusiveMaximum = true;
+ }
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maximum", check.value, check.message, refs);
+ }
+ break;
+ case "multipleOf":
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "multipleOf", check.value, check.message, refs);
+ break;
+ }
+ }
+ return res;
+}
+exports.parseNumberDef = parseNumberDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/object.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/object.js
new file mode 100644
index 0000000000000000000000000000000000000000..87c77e781cf98ad3fabdc4be53f1e4b2b4d49707
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/object.js
@@ -0,0 +1,76 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseObjectDef = void 0;
+const parseDef_js_1 = require("../parseDef.js");
+function parseObjectDef(def, refs) {
+ const forceOptionalIntoNullable = refs.target === "openAi";
+ const result = {
+ type: "object",
+ properties: {},
+ };
+ const required = [];
+ const shape = def.shape();
+ for (const propName in shape) {
+ let propDef = shape[propName];
+ if (propDef === undefined || propDef._def === undefined) {
+ continue;
+ }
+ let propOptional = safeIsOptional(propDef);
+ if (propOptional && forceOptionalIntoNullable) {
+ if (propDef._def.typeName === "ZodOptional") {
+ propDef = propDef._def.innerType;
+ }
+ if (!propDef.isNullable()) {
+ propDef = propDef.nullable();
+ }
+ propOptional = false;
+ }
+ const parsedDef = (0, parseDef_js_1.parseDef)(propDef._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "properties", propName],
+ propertyPath: [...refs.currentPath, "properties", propName],
+ });
+ if (parsedDef === undefined) {
+ continue;
+ }
+ result.properties[propName] = parsedDef;
+ if (!propOptional) {
+ required.push(propName);
+ }
+ }
+ if (required.length) {
+ result.required = required;
+ }
+ const additionalProperties = decideAdditionalProperties(def, refs);
+ if (additionalProperties !== undefined) {
+ result.additionalProperties = additionalProperties;
+ }
+ return result;
+}
+exports.parseObjectDef = parseObjectDef;
+function decideAdditionalProperties(def, refs) {
+ if (def.catchall._def.typeName !== "ZodNever") {
+ return (0, parseDef_js_1.parseDef)(def.catchall._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "additionalProperties"],
+ });
+ }
+ switch (def.unknownKeys) {
+ case "passthrough":
+ return refs.allowedAdditionalProperties;
+ case "strict":
+ return refs.rejectedAdditionalProperties;
+ case "strip":
+ return refs.removeAdditionalStrategy === "strict"
+ ? refs.allowedAdditionalProperties
+ : refs.rejectedAdditionalProperties;
+ }
+}
+function safeIsOptional(schema) {
+ try {
+ return schema.isOptional();
+ }
+ catch {
+ return true;
+ }
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/optional.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/optional.js
new file mode 100644
index 0000000000000000000000000000000000000000..234d81902a31b13c5fa657b0ca834195bb6fb2ac
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/optional.js
@@ -0,0 +1,25 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseOptionalDef = void 0;
+const parseDef_js_1 = require("../parseDef.js");
+const any_js_1 = require("./any.js");
+const parseOptionalDef = (def, refs) => {
+ if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
+ return (0, parseDef_js_1.parseDef)(def.innerType._def, refs);
+ }
+ const innerSchema = (0, parseDef_js_1.parseDef)(def.innerType._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "anyOf", "1"],
+ });
+ return innerSchema
+ ? {
+ anyOf: [
+ {
+ not: (0, any_js_1.parseAnyDef)(refs),
+ },
+ innerSchema,
+ ],
+ }
+ : (0, any_js_1.parseAnyDef)(refs);
+};
+exports.parseOptionalDef = parseOptionalDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/pipeline.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/pipeline.js
new file mode 100644
index 0000000000000000000000000000000000000000..c05d0ef6b89a19a387a6d6eece6e87130448dcab
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/pipeline.js
@@ -0,0 +1,24 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parsePipelineDef = void 0;
+const parseDef_js_1 = require("../parseDef.js");
+const parsePipelineDef = (def, refs) => {
+ if (refs.pipeStrategy === "input") {
+ return (0, parseDef_js_1.parseDef)(def.in._def, refs);
+ }
+ else if (refs.pipeStrategy === "output") {
+ return (0, parseDef_js_1.parseDef)(def.out._def, refs);
+ }
+ const a = (0, parseDef_js_1.parseDef)(def.in._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "allOf", "0"],
+ });
+ const b = (0, parseDef_js_1.parseDef)(def.out._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"],
+ });
+ return {
+ allOf: [a, b].filter((x) => x !== undefined),
+ };
+};
+exports.parsePipelineDef = parsePipelineDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/promise.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/promise.js
new file mode 100644
index 0000000000000000000000000000000000000000..9f917e7aeefc6da57b0203f748faa689da5e84a2
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/promise.js
@@ -0,0 +1,8 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parsePromiseDef = void 0;
+const parseDef_js_1 = require("../parseDef.js");
+function parsePromiseDef(def, refs) {
+ return (0, parseDef_js_1.parseDef)(def.type._def, refs);
+}
+exports.parsePromiseDef = parsePromiseDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/readonly.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/readonly.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdccec882e9aa50f60e24ec3d0ca280877fdd7ee
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/readonly.js
@@ -0,0 +1,8 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseReadonlyDef = void 0;
+const parseDef_js_1 = require("../parseDef.js");
+const parseReadonlyDef = (def, refs) => {
+ return (0, parseDef_js_1.parseDef)(def.innerType._def, refs);
+};
+exports.parseReadonlyDef = parseReadonlyDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/record.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/record.js
new file mode 100644
index 0000000000000000000000000000000000000000..197f78f7546a1f1569df493e6f2b78d6ca8e356c
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/record.js
@@ -0,0 +1,65 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseRecordDef = void 0;
+const v3_1 = require("zod/v3");
+const parseDef_js_1 = require("../parseDef.js");
+const string_js_1 = require("./string.js");
+const branded_js_1 = require("./branded.js");
+const any_js_1 = require("./any.js");
+function parseRecordDef(def, refs) {
+ if (refs.target === "openAi") {
+ console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
+ }
+ if (refs.target === "openApi3" &&
+ def.keyType?._def.typeName === v3_1.ZodFirstPartyTypeKind.ZodEnum) {
+ return {
+ type: "object",
+ required: def.keyType._def.values,
+ properties: def.keyType._def.values.reduce((acc, key) => ({
+ ...acc,
+ [key]: (0, parseDef_js_1.parseDef)(def.valueType._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "properties", key],
+ }) ?? (0, any_js_1.parseAnyDef)(refs),
+ }), {}),
+ additionalProperties: refs.rejectedAdditionalProperties,
+ };
+ }
+ const schema = {
+ type: "object",
+ additionalProperties: (0, parseDef_js_1.parseDef)(def.valueType._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "additionalProperties"],
+ }) ?? refs.allowedAdditionalProperties,
+ };
+ if (refs.target === "openApi3") {
+ return schema;
+ }
+ if (def.keyType?._def.typeName === v3_1.ZodFirstPartyTypeKind.ZodString &&
+ def.keyType._def.checks?.length) {
+ const { type, ...keyType } = (0, string_js_1.parseStringDef)(def.keyType._def, refs);
+ return {
+ ...schema,
+ propertyNames: keyType,
+ };
+ }
+ else if (def.keyType?._def.typeName === v3_1.ZodFirstPartyTypeKind.ZodEnum) {
+ return {
+ ...schema,
+ propertyNames: {
+ enum: def.keyType._def.values,
+ },
+ };
+ }
+ else if (def.keyType?._def.typeName === v3_1.ZodFirstPartyTypeKind.ZodBranded &&
+ def.keyType._def.type._def.typeName === v3_1.ZodFirstPartyTypeKind.ZodString &&
+ def.keyType._def.type._def.checks?.length) {
+ const { type, ...keyType } = (0, branded_js_1.parseBrandedDef)(def.keyType._def, refs);
+ return {
+ ...schema,
+ propertyNames: keyType,
+ };
+ }
+ return schema;
+}
+exports.parseRecordDef = parseRecordDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/set.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/set.js
new file mode 100644
index 0000000000000000000000000000000000000000..8a2dee03cfb78d4d4569aed74e91fb84ec76e6db
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/set.js
@@ -0,0 +1,24 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseSetDef = void 0;
+const errorMessages_js_1 = require("../errorMessages.js");
+const parseDef_js_1 = require("../parseDef.js");
+function parseSetDef(def, refs) {
+ const items = (0, parseDef_js_1.parseDef)(def.valueType._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "items"],
+ });
+ const schema = {
+ type: "array",
+ uniqueItems: true,
+ items,
+ };
+ if (def.minSize) {
+ (0, errorMessages_js_1.setResponseValueAndErrors)(schema, "minItems", def.minSize.value, def.minSize.message, refs);
+ }
+ if (def.maxSize) {
+ (0, errorMessages_js_1.setResponseValueAndErrors)(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
+ }
+ return schema;
+}
+exports.parseSetDef = parseSetDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/string.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/string.js
new file mode 100644
index 0000000000000000000000000000000000000000..fd2ba9ebf345dd7ecfe18a888f9630b0a90c8b09
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/string.js
@@ -0,0 +1,356 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseStringDef = exports.zodPatterns = void 0;
+const errorMessages_js_1 = require("../errorMessages.js");
+let emojiRegex = undefined;
+/**
+ * Generated from the regular expressions found here as of 2024-05-22:
+ * https://github.com/colinhacks/zod/blob/master/src/types.ts.
+ *
+ * Expressions with /i flag have been changed accordingly.
+ */
+exports.zodPatterns = {
+ /**
+ * `c` was changed to `[cC]` to replicate /i flag
+ */
+ cuid: /^[cC][^\s-]{8,}$/,
+ cuid2: /^[0-9a-z]+$/,
+ ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
+ /**
+ * `a-z` was added to replicate /i flag
+ */
+ email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
+ /**
+ * Constructed a valid Unicode RegExp
+ *
+ * Lazily instantiate since this type of regex isn't supported
+ * in all envs (e.g. React Native).
+ *
+ * See:
+ * https://github.com/colinhacks/zod/issues/2433
+ * Fix in Zod:
+ * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
+ */
+ emoji: () => {
+ if (emojiRegex === undefined) {
+ emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
+ }
+ return emojiRegex;
+ },
+ /**
+ * Unused
+ */
+ uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
+ /**
+ * Unused
+ */
+ ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
+ ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
+ /**
+ * Unused
+ */
+ ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
+ ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
+ base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
+ base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
+ nanoid: /^[a-zA-Z0-9_-]{21}$/,
+ jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,
+};
+function parseStringDef(def, refs) {
+ const res = {
+ type: "string",
+ };
+ if (def.checks) {
+ for (const check of def.checks) {
+ switch (check.kind) {
+ case "min":
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minLength", typeof res.minLength === "number"
+ ? Math.max(res.minLength, check.value)
+ : check.value, check.message, refs);
+ break;
+ case "max":
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maxLength", typeof res.maxLength === "number"
+ ? Math.min(res.maxLength, check.value)
+ : check.value, check.message, refs);
+ break;
+ case "email":
+ switch (refs.emailStrategy) {
+ case "format:email":
+ addFormat(res, "email", check.message, refs);
+ break;
+ case "format:idn-email":
+ addFormat(res, "idn-email", check.message, refs);
+ break;
+ case "pattern:zod":
+ addPattern(res, exports.zodPatterns.email, check.message, refs);
+ break;
+ }
+ break;
+ case "url":
+ addFormat(res, "uri", check.message, refs);
+ break;
+ case "uuid":
+ addFormat(res, "uuid", check.message, refs);
+ break;
+ case "regex":
+ addPattern(res, check.regex, check.message, refs);
+ break;
+ case "cuid":
+ addPattern(res, exports.zodPatterns.cuid, check.message, refs);
+ break;
+ case "cuid2":
+ addPattern(res, exports.zodPatterns.cuid2, check.message, refs);
+ break;
+ case "startsWith":
+ addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);
+ break;
+ case "endsWith":
+ addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);
+ break;
+ case "datetime":
+ addFormat(res, "date-time", check.message, refs);
+ break;
+ case "date":
+ addFormat(res, "date", check.message, refs);
+ break;
+ case "time":
+ addFormat(res, "time", check.message, refs);
+ break;
+ case "duration":
+ addFormat(res, "duration", check.message, refs);
+ break;
+ case "length":
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minLength", typeof res.minLength === "number"
+ ? Math.max(res.minLength, check.value)
+ : check.value, check.message, refs);
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maxLength", typeof res.maxLength === "number"
+ ? Math.min(res.maxLength, check.value)
+ : check.value, check.message, refs);
+ break;
+ case "includes": {
+ addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);
+ break;
+ }
+ case "ip": {
+ if (check.version !== "v6") {
+ addFormat(res, "ipv4", check.message, refs);
+ }
+ if (check.version !== "v4") {
+ addFormat(res, "ipv6", check.message, refs);
+ }
+ break;
+ }
+ case "base64url":
+ addPattern(res, exports.zodPatterns.base64url, check.message, refs);
+ break;
+ case "jwt":
+ addPattern(res, exports.zodPatterns.jwt, check.message, refs);
+ break;
+ case "cidr": {
+ if (check.version !== "v6") {
+ addPattern(res, exports.zodPatterns.ipv4Cidr, check.message, refs);
+ }
+ if (check.version !== "v4") {
+ addPattern(res, exports.zodPatterns.ipv6Cidr, check.message, refs);
+ }
+ break;
+ }
+ case "emoji":
+ addPattern(res, exports.zodPatterns.emoji(), check.message, refs);
+ break;
+ case "ulid": {
+ addPattern(res, exports.zodPatterns.ulid, check.message, refs);
+ break;
+ }
+ case "base64": {
+ switch (refs.base64Strategy) {
+ case "format:binary": {
+ addFormat(res, "binary", check.message, refs);
+ break;
+ }
+ case "contentEncoding:base64": {
+ (0, errorMessages_js_1.setResponseValueAndErrors)(res, "contentEncoding", "base64", check.message, refs);
+ break;
+ }
+ case "pattern:zod": {
+ addPattern(res, exports.zodPatterns.base64, check.message, refs);
+ break;
+ }
+ }
+ break;
+ }
+ case "nanoid": {
+ addPattern(res, exports.zodPatterns.nanoid, check.message, refs);
+ }
+ case "toLowerCase":
+ case "toUpperCase":
+ case "trim":
+ break;
+ default:
+ ((_) => { })(check);
+ }
+ }
+ }
+ return res;
+}
+exports.parseStringDef = parseStringDef;
+function escapeLiteralCheckValue(literal, refs) {
+ return refs.patternStrategy === "escape"
+ ? escapeNonAlphaNumeric(literal)
+ : literal;
+}
+const ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
+function escapeNonAlphaNumeric(source) {
+ let result = "";
+ for (let i = 0; i < source.length; i++) {
+ if (!ALPHA_NUMERIC.has(source[i])) {
+ result += "\\";
+ }
+ result += source[i];
+ }
+ return result;
+}
+// Adds a "format" keyword to the schema. If a format exists, both formats will be joined in an allOf-node, along with subsequent ones.
+function addFormat(schema, value, message, refs) {
+ if (schema.format || schema.anyOf?.some((x) => x.format)) {
+ if (!schema.anyOf) {
+ schema.anyOf = [];
+ }
+ if (schema.format) {
+ schema.anyOf.push({
+ format: schema.format,
+ ...(schema.errorMessage &&
+ refs.errorMessages && {
+ errorMessage: { format: schema.errorMessage.format },
+ }),
+ });
+ delete schema.format;
+ if (schema.errorMessage) {
+ delete schema.errorMessage.format;
+ if (Object.keys(schema.errorMessage).length === 0) {
+ delete schema.errorMessage;
+ }
+ }
+ }
+ schema.anyOf.push({
+ format: value,
+ ...(message &&
+ refs.errorMessages && { errorMessage: { format: message } }),
+ });
+ }
+ else {
+ (0, errorMessages_js_1.setResponseValueAndErrors)(schema, "format", value, message, refs);
+ }
+}
+// Adds a "pattern" keyword to the schema. If a pattern exists, both patterns will be joined in an allOf-node, along with subsequent ones.
+function addPattern(schema, regex, message, refs) {
+ if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
+ if (!schema.allOf) {
+ schema.allOf = [];
+ }
+ if (schema.pattern) {
+ schema.allOf.push({
+ pattern: schema.pattern,
+ ...(schema.errorMessage &&
+ refs.errorMessages && {
+ errorMessage: { pattern: schema.errorMessage.pattern },
+ }),
+ });
+ delete schema.pattern;
+ if (schema.errorMessage) {
+ delete schema.errorMessage.pattern;
+ if (Object.keys(schema.errorMessage).length === 0) {
+ delete schema.errorMessage;
+ }
+ }
+ }
+ schema.allOf.push({
+ pattern: stringifyRegExpWithFlags(regex, refs),
+ ...(message &&
+ refs.errorMessages && { errorMessage: { pattern: message } }),
+ });
+ }
+ else {
+ (0, errorMessages_js_1.setResponseValueAndErrors)(schema, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
+ }
+}
+// Mutate z.string.regex() in a best attempt to accommodate for regex flags when applyRegexFlags is true
+function stringifyRegExpWithFlags(regex, refs) {
+ if (!refs.applyRegexFlags || !regex.flags) {
+ return regex.source;
+ }
+ // Currently handled flags
+ const flags = {
+ i: regex.flags.includes("i"),
+ m: regex.flags.includes("m"),
+ s: regex.flags.includes("s"), // `.` matches newlines
+ };
+ // The general principle here is to step through each character, one at a time, applying mutations as flags require. We keep track when the current character is escaped, and when it's inside a group /like [this]/ or (also) a range like /[a-z]/. The following is fairly brittle imperative code; edit at your peril!
+ const source = flags.i ? regex.source.toLowerCase() : regex.source;
+ let pattern = "";
+ let isEscaped = false;
+ let inCharGroup = false;
+ let inCharRange = false;
+ for (let i = 0; i < source.length; i++) {
+ if (isEscaped) {
+ pattern += source[i];
+ isEscaped = false;
+ continue;
+ }
+ if (flags.i) {
+ if (inCharGroup) {
+ if (source[i].match(/[a-z]/)) {
+ if (inCharRange) {
+ pattern += source[i];
+ pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
+ inCharRange = false;
+ }
+ else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
+ pattern += source[i];
+ inCharRange = true;
+ }
+ else {
+ pattern += `${source[i]}${source[i].toUpperCase()}`;
+ }
+ continue;
+ }
+ }
+ else if (source[i].match(/[a-z]/)) {
+ pattern += `[${source[i]}${source[i].toUpperCase()}]`;
+ continue;
+ }
+ }
+ if (flags.m) {
+ if (source[i] === "^") {
+ pattern += `(^|(?<=[\r\n]))`;
+ continue;
+ }
+ else if (source[i] === "$") {
+ pattern += `($|(?=[\r\n]))`;
+ continue;
+ }
+ }
+ if (flags.s && source[i] === ".") {
+ pattern += inCharGroup ? `${source[i]}\r\n` : `[${source[i]}\r\n]`;
+ continue;
+ }
+ pattern += source[i];
+ if (source[i] === "\\") {
+ isEscaped = true;
+ }
+ else if (inCharGroup && source[i] === "]") {
+ inCharGroup = false;
+ }
+ else if (!inCharGroup && source[i] === "[") {
+ inCharGroup = true;
+ }
+ }
+ try {
+ new RegExp(pattern);
+ }
+ catch {
+ console.warn(`Could not convert regex pattern at ${refs.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`);
+ return regex.source;
+ }
+ return pattern;
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/tuple.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/tuple.js
new file mode 100644
index 0000000000000000000000000000000000000000..e8b9fc568f7055fc38985e4378a2e263b0b81362
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/tuple.js
@@ -0,0 +1,36 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseTupleDef = void 0;
+const parseDef_js_1 = require("../parseDef.js");
+function parseTupleDef(def, refs) {
+ if (def.rest) {
+ return {
+ type: "array",
+ minItems: def.items.length,
+ items: def.items
+ .map((x, i) => (0, parseDef_js_1.parseDef)(x._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "items", `${i}`],
+ }))
+ .reduce((acc, x) => (x === undefined ? acc : [...acc, x]), []),
+ additionalItems: (0, parseDef_js_1.parseDef)(def.rest._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "additionalItems"],
+ }),
+ };
+ }
+ else {
+ return {
+ type: "array",
+ minItems: def.items.length,
+ maxItems: def.items.length,
+ items: def.items
+ .map((x, i) => (0, parseDef_js_1.parseDef)(x._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "items", `${i}`],
+ }))
+ .reduce((acc, x) => (x === undefined ? acc : [...acc, x]), []),
+ };
+ }
+}
+exports.parseTupleDef = parseTupleDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/undefined.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/undefined.js
new file mode 100644
index 0000000000000000000000000000000000000000..529d7ee2039268287e8e79c96d88c2f8971f6acc
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/undefined.js
@@ -0,0 +1,10 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseUndefinedDef = void 0;
+const any_js_1 = require("./any.js");
+function parseUndefinedDef(refs) {
+ return {
+ not: (0, any_js_1.parseAnyDef)(refs),
+ };
+}
+exports.parseUndefinedDef = parseUndefinedDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/union.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/union.js
new file mode 100644
index 0000000000000000000000000000000000000000..808e572723982af59928631a08e3efef4b4745a0
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/union.js
@@ -0,0 +1,84 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseUnionDef = exports.primitiveMappings = void 0;
+const parseDef_js_1 = require("../parseDef.js");
+exports.primitiveMappings = {
+ ZodString: "string",
+ ZodNumber: "number",
+ ZodBigInt: "integer",
+ ZodBoolean: "boolean",
+ ZodNull: "null",
+};
+function parseUnionDef(def, refs) {
+ if (refs.target === "openApi3")
+ return asAnyOf(def, refs);
+ const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
+ // This blocks tries to look ahead a bit to produce nicer looking schemas with type array instead of anyOf.
+ if (options.every((x) => x._def.typeName in exports.primitiveMappings &&
+ (!x._def.checks || !x._def.checks.length))) {
+ // all types in union are primitive and lack checks, so might as well squash into {type: [...]}
+ const types = options.reduce((types, x) => {
+ const type = exports.primitiveMappings[x._def.typeName]; //Can be safely casted due to row 43
+ return type && !types.includes(type) ? [...types, type] : types;
+ }, []);
+ return {
+ type: types.length > 1 ? types : types[0],
+ };
+ }
+ else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
+ // all options literals
+ const types = options.reduce((acc, x) => {
+ const type = typeof x._def.value;
+ switch (type) {
+ case "string":
+ case "number":
+ case "boolean":
+ return [...acc, type];
+ case "bigint":
+ return [...acc, "integer"];
+ case "object":
+ if (x._def.value === null)
+ return [...acc, "null"];
+ case "symbol":
+ case "undefined":
+ case "function":
+ default:
+ return acc;
+ }
+ }, []);
+ if (types.length === options.length) {
+ // all the literals are primitive, as far as null can be considered primitive
+ const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
+ return {
+ type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
+ enum: options.reduce((acc, x) => {
+ return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
+ }, []),
+ };
+ }
+ }
+ else if (options.every((x) => x._def.typeName === "ZodEnum")) {
+ return {
+ type: "string",
+ enum: options.reduce((acc, x) => [
+ ...acc,
+ ...x._def.values.filter((x) => !acc.includes(x)),
+ ], []),
+ };
+ }
+ return asAnyOf(def, refs);
+}
+exports.parseUnionDef = parseUnionDef;
+const asAnyOf = (def, refs) => {
+ const anyOf = (def.options instanceof Map
+ ? Array.from(def.options.values())
+ : def.options)
+ .map((x, i) => (0, parseDef_js_1.parseDef)(x._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "anyOf", `${i}`],
+ }))
+ .filter((x) => !!x &&
+ (!refs.strictUnions ||
+ (typeof x === "object" && Object.keys(x).length > 0)));
+ return anyOf.length ? { anyOf } : undefined;
+};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/unknown.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/unknown.js
new file mode 100644
index 0000000000000000000000000000000000000000..22e55649f113edf54e9693f558315a6d48ae773b
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/parsers/unknown.js
@@ -0,0 +1,8 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.parseUnknownDef = void 0;
+const any_js_1 = require("./any.js");
+function parseUnknownDef(refs) {
+ return (0, any_js_1.parseAnyDef)(refs);
+}
+exports.parseUnknownDef = parseUnknownDef;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/selectParser.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/selectParser.js
new file mode 100644
index 0000000000000000000000000000000000000000..fbe18d9ae06c1cbf1e4e11f09fb6402bc4ece03a
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/selectParser.js
@@ -0,0 +1,109 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.selectParser = void 0;
+const v3_1 = require("zod/v3");
+const any_js_1 = require("./parsers/any.js");
+const array_js_1 = require("./parsers/array.js");
+const bigint_js_1 = require("./parsers/bigint.js");
+const boolean_js_1 = require("./parsers/boolean.js");
+const branded_js_1 = require("./parsers/branded.js");
+const catch_js_1 = require("./parsers/catch.js");
+const date_js_1 = require("./parsers/date.js");
+const default_js_1 = require("./parsers/default.js");
+const effects_js_1 = require("./parsers/effects.js");
+const enum_js_1 = require("./parsers/enum.js");
+const intersection_js_1 = require("./parsers/intersection.js");
+const literal_js_1 = require("./parsers/literal.js");
+const map_js_1 = require("./parsers/map.js");
+const nativeEnum_js_1 = require("./parsers/nativeEnum.js");
+const never_js_1 = require("./parsers/never.js");
+const null_js_1 = require("./parsers/null.js");
+const nullable_js_1 = require("./parsers/nullable.js");
+const number_js_1 = require("./parsers/number.js");
+const object_js_1 = require("./parsers/object.js");
+const optional_js_1 = require("./parsers/optional.js");
+const pipeline_js_1 = require("./parsers/pipeline.js");
+const promise_js_1 = require("./parsers/promise.js");
+const record_js_1 = require("./parsers/record.js");
+const set_js_1 = require("./parsers/set.js");
+const string_js_1 = require("./parsers/string.js");
+const tuple_js_1 = require("./parsers/tuple.js");
+const undefined_js_1 = require("./parsers/undefined.js");
+const union_js_1 = require("./parsers/union.js");
+const unknown_js_1 = require("./parsers/unknown.js");
+const readonly_js_1 = require("./parsers/readonly.js");
+const selectParser = (def, typeName, refs) => {
+ switch (typeName) {
+ case v3_1.ZodFirstPartyTypeKind.ZodString:
+ return (0, string_js_1.parseStringDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodNumber:
+ return (0, number_js_1.parseNumberDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodObject:
+ return (0, object_js_1.parseObjectDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodBigInt:
+ return (0, bigint_js_1.parseBigintDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodBoolean:
+ return (0, boolean_js_1.parseBooleanDef)();
+ case v3_1.ZodFirstPartyTypeKind.ZodDate:
+ return (0, date_js_1.parseDateDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodUndefined:
+ return (0, undefined_js_1.parseUndefinedDef)(refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodNull:
+ return (0, null_js_1.parseNullDef)(refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodArray:
+ return (0, array_js_1.parseArrayDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodUnion:
+ case v3_1.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
+ return (0, union_js_1.parseUnionDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodIntersection:
+ return (0, intersection_js_1.parseIntersectionDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodTuple:
+ return (0, tuple_js_1.parseTupleDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodRecord:
+ return (0, record_js_1.parseRecordDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodLiteral:
+ return (0, literal_js_1.parseLiteralDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodEnum:
+ return (0, enum_js_1.parseEnumDef)(def);
+ case v3_1.ZodFirstPartyTypeKind.ZodNativeEnum:
+ return (0, nativeEnum_js_1.parseNativeEnumDef)(def);
+ case v3_1.ZodFirstPartyTypeKind.ZodNullable:
+ return (0, nullable_js_1.parseNullableDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodOptional:
+ return (0, optional_js_1.parseOptionalDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodMap:
+ return (0, map_js_1.parseMapDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodSet:
+ return (0, set_js_1.parseSetDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodLazy:
+ return () => def.getter()._def;
+ case v3_1.ZodFirstPartyTypeKind.ZodPromise:
+ return (0, promise_js_1.parsePromiseDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodNaN:
+ case v3_1.ZodFirstPartyTypeKind.ZodNever:
+ return (0, never_js_1.parseNeverDef)(refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodEffects:
+ return (0, effects_js_1.parseEffectsDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodAny:
+ return (0, any_js_1.parseAnyDef)(refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodUnknown:
+ return (0, unknown_js_1.parseUnknownDef)(refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodDefault:
+ return (0, default_js_1.parseDefaultDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodBranded:
+ return (0, branded_js_1.parseBrandedDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodReadonly:
+ return (0, readonly_js_1.parseReadonlyDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodCatch:
+ return (0, catch_js_1.parseCatchDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodPipeline:
+ return (0, pipeline_js_1.parsePipelineDef)(def, refs);
+ case v3_1.ZodFirstPartyTypeKind.ZodFunction:
+ case v3_1.ZodFirstPartyTypeKind.ZodVoid:
+ case v3_1.ZodFirstPartyTypeKind.ZodSymbol:
+ return undefined;
+ default:
+ return ((_) => undefined)(typeName);
+ }
+};
+exports.selectParser = selectParser;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/cjs/zodToJsonSchema.js b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/zodToJsonSchema.js
new file mode 100644
index 0000000000000000000000000000000000000000..2673e3a2e506aa6b8ab2d55a7a7d1a5386e32e1b
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/cjs/zodToJsonSchema.js
@@ -0,0 +1,90 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.zodToJsonSchema = void 0;
+const parseDef_js_1 = require("./parseDef.js");
+const Refs_js_1 = require("./Refs.js");
+const any_js_1 = require("./parsers/any.js");
+const zodToJsonSchema = (schema, options) => {
+ const refs = (0, Refs_js_1.getRefs)(options);
+ let definitions = typeof options === "object" && options.definitions
+ ? Object.entries(options.definitions).reduce((acc, [name, schema]) => ({
+ ...acc,
+ [name]: (0, parseDef_js_1.parseDef)(schema._def, {
+ ...refs,
+ currentPath: [...refs.basePath, refs.definitionPath, name],
+ }, true) ?? (0, any_js_1.parseAnyDef)(refs),
+ }), {})
+ : undefined;
+ const name = typeof options === "string"
+ ? options
+ : options?.nameStrategy === "title"
+ ? undefined
+ : options?.name;
+ const main = (0, parseDef_js_1.parseDef)(schema._def, name === undefined
+ ? refs
+ : {
+ ...refs,
+ currentPath: [...refs.basePath, refs.definitionPath, name],
+ }, false) ?? (0, any_js_1.parseAnyDef)(refs);
+ const title = typeof options === "object" &&
+ options.name !== undefined &&
+ options.nameStrategy === "title"
+ ? options.name
+ : undefined;
+ if (title !== undefined) {
+ main.title = title;
+ }
+ if (refs.flags.hasReferencedOpenAiAnyType) {
+ if (!definitions) {
+ definitions = {};
+ }
+ if (!definitions[refs.openAiAnyTypeName]) {
+ definitions[refs.openAiAnyTypeName] = {
+ // Skipping "object" as no properties can be defined and additionalProperties must be "false"
+ type: ["string", "number", "integer", "boolean", "array", "null"],
+ items: {
+ $ref: refs.$refStrategy === "relative"
+ ? "1"
+ : [
+ ...refs.basePath,
+ refs.definitionPath,
+ refs.openAiAnyTypeName,
+ ].join("/"),
+ },
+ };
+ }
+ }
+ const combined = name === undefined
+ ? definitions
+ ? {
+ ...main,
+ [refs.definitionPath]: definitions,
+ }
+ : main
+ : {
+ $ref: [
+ ...(refs.$refStrategy === "relative" ? [] : refs.basePath),
+ refs.definitionPath,
+ name,
+ ].join("/"),
+ [refs.definitionPath]: {
+ ...definitions,
+ [name]: main,
+ },
+ };
+ if (refs.target === "jsonSchema7") {
+ combined.$schema = "http://json-schema.org/draft-07/schema#";
+ }
+ else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") {
+ combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
+ }
+ if (refs.target === "openAi" &&
+ ("anyOf" in combined ||
+ "oneOf" in combined ||
+ "allOf" in combined ||
+ ("type" in combined && Array.isArray(combined.type)))) {
+ console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
+ }
+ return combined;
+};
+exports.zodToJsonSchema = zodToJsonSchema;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/Options.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/Options.js
new file mode 100644
index 0000000000000000000000000000000000000000..e26d8cec21b181b953c4154958c02710688f46d0
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/Options.js
@@ -0,0 +1,46 @@
+export const ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
+export const jsonDescription = (jsonSchema, def) => {
+ if (def.description) {
+ try {
+ return {
+ ...jsonSchema,
+ ...JSON.parse(def.description),
+ };
+ }
+ catch { }
+ }
+ return jsonSchema;
+};
+export const defaultOptions = {
+ name: undefined,
+ $refStrategy: "root",
+ basePath: ["#"],
+ effectStrategy: "input",
+ pipeStrategy: "all",
+ dateStrategy: "format:date-time",
+ mapStrategy: "entries",
+ removeAdditionalStrategy: "passthrough",
+ allowedAdditionalProperties: true,
+ rejectedAdditionalProperties: false,
+ definitionPath: "definitions",
+ target: "jsonSchema7",
+ strictUnions: false,
+ definitions: {},
+ errorMessages: false,
+ markdownDescription: false,
+ patternStrategy: "escape",
+ applyRegexFlags: false,
+ emailStrategy: "format:email",
+ base64Strategy: "contentEncoding:base64",
+ nameStrategy: "ref",
+ openAiAnyTypeName: "OpenAiAnyType"
+};
+export const getDefaultOptions = (options) => (typeof options === "string"
+ ? {
+ ...defaultOptions,
+ name: options,
+ }
+ : {
+ ...defaultOptions,
+ ...options,
+ });
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/Refs.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/Refs.js
new file mode 100644
index 0000000000000000000000000000000000000000..99a1e0b33cbbe5f9a2be41c128e03247dc7d664a
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/Refs.js
@@ -0,0 +1,22 @@
+import { getDefaultOptions } from "./Options.js";
+export const getRefs = (options) => {
+ const _options = getDefaultOptions(options);
+ const currentPath = _options.name !== undefined
+ ? [..._options.basePath, _options.definitionPath, _options.name]
+ : _options.basePath;
+ return {
+ ..._options,
+ flags: { hasReferencedOpenAiAnyType: false },
+ currentPath: currentPath,
+ propertyPath: undefined,
+ seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
+ def._def,
+ {
+ def: def._def,
+ path: [..._options.basePath, _options.definitionPath, name],
+ // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
+ jsonSchema: undefined,
+ },
+ ])),
+ };
+};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/errorMessages.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
new file mode 100644
index 0000000000000000000000000000000000000000..5a300a7f8e12ce3738fe02640c3120f1d904ed79
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
@@ -0,0 +1,14 @@
+export function addErrorMessage(res, key, errorMessage, refs) {
+ if (!refs?.errorMessages)
+ return;
+ if (errorMessage) {
+ res.errorMessage = {
+ ...res.errorMessage,
+ [key]: errorMessage,
+ };
+ }
+}
+export function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
+ res[key] = value;
+ addErrorMessage(res, key, errorMessage, refs);
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
new file mode 100644
index 0000000000000000000000000000000000000000..63a005cb483dfdd38f3bdd111755472fa8bc61ef
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
@@ -0,0 +1,8 @@
+export const getRelativePath = (pathA, pathB) => {
+ let i = 0;
+ for (; i < pathA.length && i < pathB.length; i++) {
+ if (pathA[i] !== pathB[i])
+ break;
+ }
+ return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
+};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/index.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdfb5306e4cb4f7362c269baeff84c525cda93be
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/index.js
@@ -0,0 +1,40 @@
+export * from "./Options.js";
+export * from "./Refs.js";
+export * from "./errorMessages.js";
+export * from "./getRelativePath.js";
+export * from "./parseDef.js";
+export * from "./parseTypes.js";
+export * from "./parsers/any.js";
+export * from "./parsers/array.js";
+export * from "./parsers/bigint.js";
+export * from "./parsers/boolean.js";
+export * from "./parsers/branded.js";
+export * from "./parsers/catch.js";
+export * from "./parsers/date.js";
+export * from "./parsers/default.js";
+export * from "./parsers/effects.js";
+export * from "./parsers/enum.js";
+export * from "./parsers/intersection.js";
+export * from "./parsers/literal.js";
+export * from "./parsers/map.js";
+export * from "./parsers/nativeEnum.js";
+export * from "./parsers/never.js";
+export * from "./parsers/null.js";
+export * from "./parsers/nullable.js";
+export * from "./parsers/number.js";
+export * from "./parsers/object.js";
+export * from "./parsers/optional.js";
+export * from "./parsers/pipeline.js";
+export * from "./parsers/promise.js";
+export * from "./parsers/readonly.js";
+export * from "./parsers/record.js";
+export * from "./parsers/set.js";
+export * from "./parsers/string.js";
+export * from "./parsers/tuple.js";
+export * from "./parsers/undefined.js";
+export * from "./parsers/union.js";
+export * from "./parsers/unknown.js";
+export * from "./selectParser.js";
+export * from "./zodToJsonSchema.js";
+import { zodToJsonSchema } from "./zodToJsonSchema.js";
+export default zodToJsonSchema;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/package.json b/tools/ui/node_modules/zod-to-json-schema/dist/esm/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..7b3eae25bb18d5a7f461baf8823d69f41e1afafa
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/package.json
@@ -0,0 +1 @@
+{"type":"module","main":"index.js"}
\ No newline at end of file
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parseDef.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parseDef.js
new file mode 100644
index 0000000000000000000000000000000000000000..87a615e4bb6d227dd3d9d2148e6032cb206210cc
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parseDef.js
@@ -0,0 +1,62 @@
+import { ignoreOverride } from "./Options.js";
+import { selectParser } from "./selectParser.js";
+import { getRelativePath } from "./getRelativePath.js";
+import { parseAnyDef } from "./parsers/any.js";
+export function parseDef(def, refs, forceResolution = false) {
+ const seenItem = refs.seen.get(def);
+ if (refs.override) {
+ const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);
+ if (overrideResult !== ignoreOverride) {
+ return overrideResult;
+ }
+ }
+ if (seenItem && !forceResolution) {
+ const seenSchema = get$ref(seenItem, refs);
+ if (seenSchema !== undefined) {
+ return seenSchema;
+ }
+ }
+ const newItem = { def, path: refs.currentPath, jsonSchema: undefined };
+ refs.seen.set(def, newItem);
+ const jsonSchemaOrGetter = selectParser(def, def.typeName, refs);
+ // If the return was a function, then the inner definition needs to be extracted before a call to parseDef (recursive)
+ const jsonSchema = typeof jsonSchemaOrGetter === "function"
+ ? parseDef(jsonSchemaOrGetter(), refs)
+ : jsonSchemaOrGetter;
+ if (jsonSchema) {
+ addMeta(def, refs, jsonSchema);
+ }
+ if (refs.postProcess) {
+ const postProcessResult = refs.postProcess(jsonSchema, def, refs);
+ newItem.jsonSchema = jsonSchema;
+ return postProcessResult;
+ }
+ newItem.jsonSchema = jsonSchema;
+ return jsonSchema;
+}
+const get$ref = (item, refs) => {
+ switch (refs.$refStrategy) {
+ case "root":
+ return { $ref: item.path.join("/") };
+ case "relative":
+ return { $ref: getRelativePath(refs.currentPath, item.path) };
+ case "none":
+ case "seen": {
+ if (item.path.length < refs.currentPath.length &&
+ item.path.every((value, index) => refs.currentPath[index] === value)) {
+ console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
+ return parseAnyDef(refs);
+ }
+ return refs.$refStrategy === "seen" ? parseAnyDef(refs) : undefined;
+ }
+ }
+};
+const addMeta = (def, refs, jsonSchema) => {
+ if (def.description) {
+ jsonSchema.description = def.description;
+ if (refs.markdownDescription) {
+ jsonSchema.markdownDescription = def.description;
+ }
+ }
+ return jsonSchema;
+};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parseTypes.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parseTypes.js
new file mode 100644
index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parseTypes.js
@@ -0,0 +1 @@
+export {};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/any.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
new file mode 100644
index 0000000000000000000000000000000000000000..ec9ddfdc3bac5af1bc4a33d880ac3510d8fecddb
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
@@ -0,0 +1,17 @@
+import { getRelativePath } from "../getRelativePath.js";
+export function parseAnyDef(refs) {
+ if (refs.target !== "openAi") {
+ return {};
+ }
+ const anyDefinitionPath = [
+ ...refs.basePath,
+ refs.definitionPath,
+ refs.openAiAnyTypeName,
+ ];
+ refs.flags.hasReferencedOpenAiAnyType = true;
+ return {
+ $ref: refs.$refStrategy === "relative"
+ ? getRelativePath(anyDefinitionPath, refs.currentPath)
+ : anyDefinitionPath.join("/"),
+ };
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/array.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
new file mode 100644
index 0000000000000000000000000000000000000000..6f275adb7f1e794b814bf7be28881e384156d070
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
@@ -0,0 +1,26 @@
+import { ZodFirstPartyTypeKind } from "zod/v3";
+import { setResponseValueAndErrors } from "../errorMessages.js";
+import { parseDef } from "../parseDef.js";
+export function parseArrayDef(def, refs) {
+ const res = {
+ type: "array",
+ };
+ if (def.type?._def &&
+ def.type?._def?.typeName !== ZodFirstPartyTypeKind.ZodAny) {
+ res.items = parseDef(def.type._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "items"],
+ });
+ }
+ if (def.minLength) {
+ setResponseValueAndErrors(res, "minItems", def.minLength.value, def.minLength.message, refs);
+ }
+ if (def.maxLength) {
+ setResponseValueAndErrors(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
+ }
+ if (def.exactLength) {
+ setResponseValueAndErrors(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
+ setResponseValueAndErrors(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
+ }
+ return res;
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
new file mode 100644
index 0000000000000000000000000000000000000000..1298a70df0ef790aff1ddcd8c523b22a87b267b8
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
@@ -0,0 +1,49 @@
+import { setResponseValueAndErrors } from "../errorMessages.js";
+export function parseBigintDef(def, refs) {
+ const res = {
+ type: "integer",
+ format: "int64",
+ };
+ if (!def.checks)
+ return res;
+ for (const check of def.checks) {
+ switch (check.kind) {
+ case "min":
+ if (refs.target === "jsonSchema7") {
+ if (check.inclusive) {
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
+ }
+ else {
+ setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
+ }
+ }
+ else {
+ if (!check.inclusive) {
+ res.exclusiveMinimum = true;
+ }
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
+ }
+ break;
+ case "max":
+ if (refs.target === "jsonSchema7") {
+ if (check.inclusive) {
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
+ }
+ else {
+ setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
+ }
+ }
+ else {
+ if (!check.inclusive) {
+ res.exclusiveMaximum = true;
+ }
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
+ }
+ break;
+ case "multipleOf":
+ setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
+ break;
+ }
+ }
+ return res;
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
new file mode 100644
index 0000000000000000000000000000000000000000..a7d9e5c0868a8a2f5928a444681071bd02f3c62f
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
@@ -0,0 +1,5 @@
+export function parseBooleanDef() {
+ return {
+ type: "boolean",
+ };
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
new file mode 100644
index 0000000000000000000000000000000000000000..fba4c9f024b6730978f5ab208b483306d863cbc3
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
@@ -0,0 +1,4 @@
+import { parseDef } from "../parseDef.js";
+export function parseBrandedDef(_def, refs) {
+ return parseDef(_def.type._def, refs);
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
new file mode 100644
index 0000000000000000000000000000000000000000..c1833f238e986347c2df275a81974ca661d2e98c
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
@@ -0,0 +1,4 @@
+import { parseDef } from "../parseDef.js";
+export const parseCatchDef = (def, refs) => {
+ return parseDef(def.innerType._def, refs);
+};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/date.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
new file mode 100644
index 0000000000000000000000000000000000000000..28408a52a867886deddd35e2532581dbb203da00
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
@@ -0,0 +1,46 @@
+import { setResponseValueAndErrors } from "../errorMessages.js";
+export function parseDateDef(def, refs, overrideDateStrategy) {
+ const strategy = overrideDateStrategy ?? refs.dateStrategy;
+ if (Array.isArray(strategy)) {
+ return {
+ anyOf: strategy.map((item, i) => parseDateDef(def, refs, item)),
+ };
+ }
+ switch (strategy) {
+ case "string":
+ case "format:date-time":
+ return {
+ type: "string",
+ format: "date-time",
+ };
+ case "format:date":
+ return {
+ type: "string",
+ format: "date",
+ };
+ case "integer":
+ return integerDateParser(def, refs);
+ }
+}
+const integerDateParser = (def, refs) => {
+ const res = {
+ type: "integer",
+ format: "unix-time",
+ };
+ if (refs.target === "openApi3") {
+ return res;
+ }
+ for (const check of def.checks) {
+ switch (check.kind) {
+ case "min":
+ setResponseValueAndErrors(res, "minimum", check.value, // This is in milliseconds
+ check.message, refs);
+ break;
+ case "max":
+ setResponseValueAndErrors(res, "maximum", check.value, // This is in milliseconds
+ check.message, refs);
+ break;
+ }
+ }
+ return res;
+};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/default.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
new file mode 100644
index 0000000000000000000000000000000000000000..7f1c4dbc079153c6988d22155d166a8226d25d03
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
@@ -0,0 +1,7 @@
+import { parseDef } from "../parseDef.js";
+export function parseDefaultDef(_def, refs) {
+ return {
+ ...parseDef(_def.innerType._def, refs),
+ default: _def.defaultValue(),
+ };
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
new file mode 100644
index 0000000000000000000000000000000000000000..780413e5018c193ae6d50a6e011bc9d49e994a8b
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
@@ -0,0 +1,7 @@
+import { parseDef } from "../parseDef.js";
+import { parseAnyDef } from "./any.js";
+export function parseEffectsDef(_def, refs) {
+ return refs.effectStrategy === "input"
+ ? parseDef(_def.schema._def, refs)
+ : parseAnyDef(refs);
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
new file mode 100644
index 0000000000000000000000000000000000000000..d6dbc068088ddcbc031b5bff847c024c74dbb4df
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
@@ -0,0 +1,6 @@
+export function parseEnumDef(def) {
+ return {
+ type: "string",
+ enum: Array.from(def.values),
+ };
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
new file mode 100644
index 0000000000000000000000000000000000000000..945f5b3db6f2edc9056a48144c6f87a094ca09a6
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
@@ -0,0 +1,52 @@
+import { parseDef } from "../parseDef.js";
+const isJsonSchema7AllOfType = (type) => {
+ if ("type" in type && type.type === "string")
+ return false;
+ return "allOf" in type;
+};
+export function parseIntersectionDef(def, refs) {
+ const allOf = [
+ parseDef(def.left._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "allOf", "0"],
+ }),
+ parseDef(def.right._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "allOf", "1"],
+ }),
+ ].filter((x) => !!x);
+ let unevaluatedProperties = refs.target === "jsonSchema2019-09"
+ ? { unevaluatedProperties: false }
+ : undefined;
+ const mergedAllOf = [];
+ // If either of the schemas is an allOf, merge them into a single allOf
+ allOf.forEach((schema) => {
+ if (isJsonSchema7AllOfType(schema)) {
+ mergedAllOf.push(...schema.allOf);
+ if (schema.unevaluatedProperties === undefined) {
+ // If one of the schemas has no unevaluatedProperties set,
+ // the merged schema should also have no unevaluatedProperties set
+ unevaluatedProperties = undefined;
+ }
+ }
+ else {
+ let nestedSchema = schema;
+ if ("additionalProperties" in schema &&
+ schema.additionalProperties === false) {
+ const { additionalProperties, ...rest } = schema;
+ nestedSchema = rest;
+ }
+ else {
+ // As soon as one of the schemas has additionalProperties set not to false, we allow unevaluatedProperties
+ unevaluatedProperties = undefined;
+ }
+ mergedAllOf.push(nestedSchema);
+ }
+ });
+ return mergedAllOf.length
+ ? {
+ allOf: mergedAllOf,
+ ...unevaluatedProperties,
+ }
+ : undefined;
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
new file mode 100644
index 0000000000000000000000000000000000000000..14cd677d1d0a9fb4e3abce830587fae52706ec85
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
@@ -0,0 +1,21 @@
+export function parseLiteralDef(def, refs) {
+ const parsedType = typeof def.value;
+ if (parsedType !== "bigint" &&
+ parsedType !== "number" &&
+ parsedType !== "boolean" &&
+ parsedType !== "string") {
+ return {
+ type: Array.isArray(def.value) ? "array" : "object",
+ };
+ }
+ if (refs.target === "openApi3") {
+ return {
+ type: parsedType === "bigint" ? "integer" : parsedType,
+ enum: [def.value],
+ };
+ }
+ return {
+ type: parsedType === "bigint" ? "integer" : parsedType,
+ const: def.value,
+ };
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/map.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
new file mode 100644
index 0000000000000000000000000000000000000000..7b35b7807229ccf12167ef97bf569f6cc765684e
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
@@ -0,0 +1,26 @@
+import { parseDef } from "../parseDef.js";
+import { parseRecordDef } from "./record.js";
+import { parseAnyDef } from "./any.js";
+export function parseMapDef(def, refs) {
+ if (refs.mapStrategy === "record") {
+ return parseRecordDef(def, refs);
+ }
+ const keys = parseDef(def.keyType._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "items", "items", "0"],
+ }) || parseAnyDef(refs);
+ const values = parseDef(def.valueType._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "items", "items", "1"],
+ }) || parseAnyDef(refs);
+ return {
+ type: "array",
+ maxItems: 125,
+ items: {
+ type: "array",
+ items: [keys, values],
+ minItems: 2,
+ maxItems: 2,
+ },
+ };
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
new file mode 100644
index 0000000000000000000000000000000000000000..fc411ba571c874b22af59ece6f5bca8703eba048
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
@@ -0,0 +1,16 @@
+export function parseNativeEnumDef(def) {
+ const object = def.values;
+ const actualKeys = Object.keys(def.values).filter((key) => {
+ return typeof object[object[key]] !== "number";
+ });
+ const actualValues = actualKeys.map((key) => object[key]);
+ const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
+ return {
+ type: parsedTypes.length === 1
+ ? parsedTypes[0] === "string"
+ ? "string"
+ : "number"
+ : ["string", "number"],
+ enum: actualValues,
+ };
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/never.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
new file mode 100644
index 0000000000000000000000000000000000000000..a9940cae33c23032166a7bc024698f817cb5b6f5
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
@@ -0,0 +1,11 @@
+import { parseAnyDef } from "./any.js";
+export function parseNeverDef(refs) {
+ return refs.target === "openAi"
+ ? undefined
+ : {
+ not: parseAnyDef({
+ ...refs,
+ currentPath: [...refs.currentPath, "not"],
+ }),
+ };
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/null.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
new file mode 100644
index 0000000000000000000000000000000000000000..5b47a8a3d7172d60bed52682500960460ae2ee3e
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
@@ -0,0 +1,10 @@
+export function parseNullDef(refs) {
+ return refs.target === "openApi3"
+ ? {
+ enum: ["null"],
+ nullable: true,
+ }
+ : {
+ type: "null",
+ };
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
new file mode 100644
index 0000000000000000000000000000000000000000..b4038d076b11c6b930bf0e27ec555217d3c516c2
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
@@ -0,0 +1,33 @@
+import { parseDef } from "../parseDef.js";
+import { primitiveMappings } from "./union.js";
+export function parseNullableDef(def, refs) {
+ if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) &&
+ (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
+ if (refs.target === "openApi3") {
+ return {
+ type: primitiveMappings[def.innerType._def.typeName],
+ nullable: true,
+ };
+ }
+ return {
+ type: [
+ primitiveMappings[def.innerType._def.typeName],
+ "null",
+ ],
+ };
+ }
+ if (refs.target === "openApi3") {
+ const base = parseDef(def.innerType._def, {
+ ...refs,
+ currentPath: [...refs.currentPath],
+ });
+ if (base && "$ref" in base)
+ return { allOf: [base], nullable: true };
+ return base && { ...base, nullable: true };
+ }
+ const base = parseDef(def.innerType._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "anyOf", "0"],
+ });
+ return base && { anyOf: [base, { type: "null" }] };
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/number.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
new file mode 100644
index 0000000000000000000000000000000000000000..2a0292c8147eab032d1420ae957529f7fb353497
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
@@ -0,0 +1,52 @@
+import { addErrorMessage, setResponseValueAndErrors, } from "../errorMessages.js";
+export function parseNumberDef(def, refs) {
+ const res = {
+ type: "number",
+ };
+ if (!def.checks)
+ return res;
+ for (const check of def.checks) {
+ switch (check.kind) {
+ case "int":
+ res.type = "integer";
+ addErrorMessage(res, "type", check.message, refs);
+ break;
+ case "min":
+ if (refs.target === "jsonSchema7") {
+ if (check.inclusive) {
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
+ }
+ else {
+ setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
+ }
+ }
+ else {
+ if (!check.inclusive) {
+ res.exclusiveMinimum = true;
+ }
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
+ }
+ break;
+ case "max":
+ if (refs.target === "jsonSchema7") {
+ if (check.inclusive) {
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
+ }
+ else {
+ setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
+ }
+ }
+ else {
+ if (!check.inclusive) {
+ res.exclusiveMaximum = true;
+ }
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
+ }
+ break;
+ case "multipleOf":
+ setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
+ break;
+ }
+ }
+ return res;
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/object.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
new file mode 100644
index 0000000000000000000000000000000000000000..cff67272a167fb9fb3a4ece121c7da2a7f693237
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
@@ -0,0 +1,72 @@
+import { parseDef } from "../parseDef.js";
+export function parseObjectDef(def, refs) {
+ const forceOptionalIntoNullable = refs.target === "openAi";
+ const result = {
+ type: "object",
+ properties: {},
+ };
+ const required = [];
+ const shape = def.shape();
+ for (const propName in shape) {
+ let propDef = shape[propName];
+ if (propDef === undefined || propDef._def === undefined) {
+ continue;
+ }
+ let propOptional = safeIsOptional(propDef);
+ if (propOptional && forceOptionalIntoNullable) {
+ if (propDef._def.typeName === "ZodOptional") {
+ propDef = propDef._def.innerType;
+ }
+ if (!propDef.isNullable()) {
+ propDef = propDef.nullable();
+ }
+ propOptional = false;
+ }
+ const parsedDef = parseDef(propDef._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "properties", propName],
+ propertyPath: [...refs.currentPath, "properties", propName],
+ });
+ if (parsedDef === undefined) {
+ continue;
+ }
+ result.properties[propName] = parsedDef;
+ if (!propOptional) {
+ required.push(propName);
+ }
+ }
+ if (required.length) {
+ result.required = required;
+ }
+ const additionalProperties = decideAdditionalProperties(def, refs);
+ if (additionalProperties !== undefined) {
+ result.additionalProperties = additionalProperties;
+ }
+ return result;
+}
+function decideAdditionalProperties(def, refs) {
+ if (def.catchall._def.typeName !== "ZodNever") {
+ return parseDef(def.catchall._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "additionalProperties"],
+ });
+ }
+ switch (def.unknownKeys) {
+ case "passthrough":
+ return refs.allowedAdditionalProperties;
+ case "strict":
+ return refs.rejectedAdditionalProperties;
+ case "strip":
+ return refs.removeAdditionalStrategy === "strict"
+ ? refs.allowedAdditionalProperties
+ : refs.rejectedAdditionalProperties;
+ }
+}
+function safeIsOptional(schema) {
+ try {
+ return schema.isOptional();
+ }
+ catch {
+ return true;
+ }
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
new file mode 100644
index 0000000000000000000000000000000000000000..2c5e53233ab303adc03b4a07b20f38ad7b4e4351
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
@@ -0,0 +1,21 @@
+import { parseDef } from "../parseDef.js";
+import { parseAnyDef } from "./any.js";
+export const parseOptionalDef = (def, refs) => {
+ if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
+ return parseDef(def.innerType._def, refs);
+ }
+ const innerSchema = parseDef(def.innerType._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "anyOf", "1"],
+ });
+ return innerSchema
+ ? {
+ anyOf: [
+ {
+ not: parseAnyDef(refs),
+ },
+ innerSchema,
+ ],
+ }
+ : parseAnyDef(refs);
+};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
new file mode 100644
index 0000000000000000000000000000000000000000..e8edfe296aa4f06b7288f786095bb027ea7aec2c
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
@@ -0,0 +1,20 @@
+import { parseDef } from "../parseDef.js";
+export const parsePipelineDef = (def, refs) => {
+ if (refs.pipeStrategy === "input") {
+ return parseDef(def.in._def, refs);
+ }
+ else if (refs.pipeStrategy === "output") {
+ return parseDef(def.out._def, refs);
+ }
+ const a = parseDef(def.in._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "allOf", "0"],
+ });
+ const b = parseDef(def.out._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"],
+ });
+ return {
+ allOf: [a, b].filter((x) => x !== undefined),
+ };
+};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
new file mode 100644
index 0000000000000000000000000000000000000000..bfb1f5d047b5f3b51816b9f390b2af91e9cc294d
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
@@ -0,0 +1,4 @@
+import { parseDef } from "../parseDef.js";
+export function parsePromiseDef(def, refs) {
+ return parseDef(def.type._def, refs);
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
new file mode 100644
index 0000000000000000000000000000000000000000..b36a73c96a4781cf40efd639a15a21aea4a0191b
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
@@ -0,0 +1,4 @@
+import { parseDef } from "../parseDef.js";
+export const parseReadonlyDef = (def, refs) => {
+ return parseDef(def.innerType._def, refs);
+};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/record.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
new file mode 100644
index 0000000000000000000000000000000000000000..dd75a92f4de5495d9fe631c11c93dc355c80b025
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
@@ -0,0 +1,61 @@
+import { ZodFirstPartyTypeKind, } from "zod/v3";
+import { parseDef } from "../parseDef.js";
+import { parseStringDef } from "./string.js";
+import { parseBrandedDef } from "./branded.js";
+import { parseAnyDef } from "./any.js";
+export function parseRecordDef(def, refs) {
+ if (refs.target === "openAi") {
+ console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
+ }
+ if (refs.target === "openApi3" &&
+ def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) {
+ return {
+ type: "object",
+ required: def.keyType._def.values,
+ properties: def.keyType._def.values.reduce((acc, key) => ({
+ ...acc,
+ [key]: parseDef(def.valueType._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "properties", key],
+ }) ?? parseAnyDef(refs),
+ }), {}),
+ additionalProperties: refs.rejectedAdditionalProperties,
+ };
+ }
+ const schema = {
+ type: "object",
+ additionalProperties: parseDef(def.valueType._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "additionalProperties"],
+ }) ?? refs.allowedAdditionalProperties,
+ };
+ if (refs.target === "openApi3") {
+ return schema;
+ }
+ if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString &&
+ def.keyType._def.checks?.length) {
+ const { type, ...keyType } = parseStringDef(def.keyType._def, refs);
+ return {
+ ...schema,
+ propertyNames: keyType,
+ };
+ }
+ else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) {
+ return {
+ ...schema,
+ propertyNames: {
+ enum: def.keyType._def.values,
+ },
+ };
+ }
+ else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded &&
+ def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString &&
+ def.keyType._def.type._def.checks?.length) {
+ const { type, ...keyType } = parseBrandedDef(def.keyType._def, refs);
+ return {
+ ...schema,
+ propertyNames: keyType,
+ };
+ }
+ return schema;
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/set.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
new file mode 100644
index 0000000000000000000000000000000000000000..88f0624bd513a340891c51e8ed15df075693f69b
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
@@ -0,0 +1,20 @@
+import { setResponseValueAndErrors } from "../errorMessages.js";
+import { parseDef } from "../parseDef.js";
+export function parseSetDef(def, refs) {
+ const items = parseDef(def.valueType._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "items"],
+ });
+ const schema = {
+ type: "array",
+ uniqueItems: true,
+ items,
+ };
+ if (def.minSize) {
+ setResponseValueAndErrors(schema, "minItems", def.minSize.value, def.minSize.message, refs);
+ }
+ if (def.maxSize) {
+ setResponseValueAndErrors(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
+ }
+ return schema;
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/string.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
new file mode 100644
index 0000000000000000000000000000000000000000..bc224a306fb2d936bb3c0236fad7a238136cf256
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
@@ -0,0 +1,352 @@
+import { setResponseValueAndErrors } from "../errorMessages.js";
+let emojiRegex = undefined;
+/**
+ * Generated from the regular expressions found here as of 2024-05-22:
+ * https://github.com/colinhacks/zod/blob/master/src/types.ts.
+ *
+ * Expressions with /i flag have been changed accordingly.
+ */
+export const zodPatterns = {
+ /**
+ * `c` was changed to `[cC]` to replicate /i flag
+ */
+ cuid: /^[cC][^\s-]{8,}$/,
+ cuid2: /^[0-9a-z]+$/,
+ ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
+ /**
+ * `a-z` was added to replicate /i flag
+ */
+ email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
+ /**
+ * Constructed a valid Unicode RegExp
+ *
+ * Lazily instantiate since this type of regex isn't supported
+ * in all envs (e.g. React Native).
+ *
+ * See:
+ * https://github.com/colinhacks/zod/issues/2433
+ * Fix in Zod:
+ * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
+ */
+ emoji: () => {
+ if (emojiRegex === undefined) {
+ emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
+ }
+ return emojiRegex;
+ },
+ /**
+ * Unused
+ */
+ uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
+ /**
+ * Unused
+ */
+ ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
+ ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
+ /**
+ * Unused
+ */
+ ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
+ ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
+ base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
+ base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
+ nanoid: /^[a-zA-Z0-9_-]{21}$/,
+ jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,
+};
+export function parseStringDef(def, refs) {
+ const res = {
+ type: "string",
+ };
+ if (def.checks) {
+ for (const check of def.checks) {
+ switch (check.kind) {
+ case "min":
+ setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number"
+ ? Math.max(res.minLength, check.value)
+ : check.value, check.message, refs);
+ break;
+ case "max":
+ setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number"
+ ? Math.min(res.maxLength, check.value)
+ : check.value, check.message, refs);
+ break;
+ case "email":
+ switch (refs.emailStrategy) {
+ case "format:email":
+ addFormat(res, "email", check.message, refs);
+ break;
+ case "format:idn-email":
+ addFormat(res, "idn-email", check.message, refs);
+ break;
+ case "pattern:zod":
+ addPattern(res, zodPatterns.email, check.message, refs);
+ break;
+ }
+ break;
+ case "url":
+ addFormat(res, "uri", check.message, refs);
+ break;
+ case "uuid":
+ addFormat(res, "uuid", check.message, refs);
+ break;
+ case "regex":
+ addPattern(res, check.regex, check.message, refs);
+ break;
+ case "cuid":
+ addPattern(res, zodPatterns.cuid, check.message, refs);
+ break;
+ case "cuid2":
+ addPattern(res, zodPatterns.cuid2, check.message, refs);
+ break;
+ case "startsWith":
+ addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);
+ break;
+ case "endsWith":
+ addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);
+ break;
+ case "datetime":
+ addFormat(res, "date-time", check.message, refs);
+ break;
+ case "date":
+ addFormat(res, "date", check.message, refs);
+ break;
+ case "time":
+ addFormat(res, "time", check.message, refs);
+ break;
+ case "duration":
+ addFormat(res, "duration", check.message, refs);
+ break;
+ case "length":
+ setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number"
+ ? Math.max(res.minLength, check.value)
+ : check.value, check.message, refs);
+ setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number"
+ ? Math.min(res.maxLength, check.value)
+ : check.value, check.message, refs);
+ break;
+ case "includes": {
+ addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);
+ break;
+ }
+ case "ip": {
+ if (check.version !== "v6") {
+ addFormat(res, "ipv4", check.message, refs);
+ }
+ if (check.version !== "v4") {
+ addFormat(res, "ipv6", check.message, refs);
+ }
+ break;
+ }
+ case "base64url":
+ addPattern(res, zodPatterns.base64url, check.message, refs);
+ break;
+ case "jwt":
+ addPattern(res, zodPatterns.jwt, check.message, refs);
+ break;
+ case "cidr": {
+ if (check.version !== "v6") {
+ addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);
+ }
+ if (check.version !== "v4") {
+ addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);
+ }
+ break;
+ }
+ case "emoji":
+ addPattern(res, zodPatterns.emoji(), check.message, refs);
+ break;
+ case "ulid": {
+ addPattern(res, zodPatterns.ulid, check.message, refs);
+ break;
+ }
+ case "base64": {
+ switch (refs.base64Strategy) {
+ case "format:binary": {
+ addFormat(res, "binary", check.message, refs);
+ break;
+ }
+ case "contentEncoding:base64": {
+ setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs);
+ break;
+ }
+ case "pattern:zod": {
+ addPattern(res, zodPatterns.base64, check.message, refs);
+ break;
+ }
+ }
+ break;
+ }
+ case "nanoid": {
+ addPattern(res, zodPatterns.nanoid, check.message, refs);
+ }
+ case "toLowerCase":
+ case "toUpperCase":
+ case "trim":
+ break;
+ default:
+ ((_) => { })(check);
+ }
+ }
+ }
+ return res;
+}
+function escapeLiteralCheckValue(literal, refs) {
+ return refs.patternStrategy === "escape"
+ ? escapeNonAlphaNumeric(literal)
+ : literal;
+}
+const ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
+function escapeNonAlphaNumeric(source) {
+ let result = "";
+ for (let i = 0; i < source.length; i++) {
+ if (!ALPHA_NUMERIC.has(source[i])) {
+ result += "\\";
+ }
+ result += source[i];
+ }
+ return result;
+}
+// Adds a "format" keyword to the schema. If a format exists, both formats will be joined in an allOf-node, along with subsequent ones.
+function addFormat(schema, value, message, refs) {
+ if (schema.format || schema.anyOf?.some((x) => x.format)) {
+ if (!schema.anyOf) {
+ schema.anyOf = [];
+ }
+ if (schema.format) {
+ schema.anyOf.push({
+ format: schema.format,
+ ...(schema.errorMessage &&
+ refs.errorMessages && {
+ errorMessage: { format: schema.errorMessage.format },
+ }),
+ });
+ delete schema.format;
+ if (schema.errorMessage) {
+ delete schema.errorMessage.format;
+ if (Object.keys(schema.errorMessage).length === 0) {
+ delete schema.errorMessage;
+ }
+ }
+ }
+ schema.anyOf.push({
+ format: value,
+ ...(message &&
+ refs.errorMessages && { errorMessage: { format: message } }),
+ });
+ }
+ else {
+ setResponseValueAndErrors(schema, "format", value, message, refs);
+ }
+}
+// Adds a "pattern" keyword to the schema. If a pattern exists, both patterns will be joined in an allOf-node, along with subsequent ones.
+function addPattern(schema, regex, message, refs) {
+ if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
+ if (!schema.allOf) {
+ schema.allOf = [];
+ }
+ if (schema.pattern) {
+ schema.allOf.push({
+ pattern: schema.pattern,
+ ...(schema.errorMessage &&
+ refs.errorMessages && {
+ errorMessage: { pattern: schema.errorMessage.pattern },
+ }),
+ });
+ delete schema.pattern;
+ if (schema.errorMessage) {
+ delete schema.errorMessage.pattern;
+ if (Object.keys(schema.errorMessage).length === 0) {
+ delete schema.errorMessage;
+ }
+ }
+ }
+ schema.allOf.push({
+ pattern: stringifyRegExpWithFlags(regex, refs),
+ ...(message &&
+ refs.errorMessages && { errorMessage: { pattern: message } }),
+ });
+ }
+ else {
+ setResponseValueAndErrors(schema, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
+ }
+}
+// Mutate z.string.regex() in a best attempt to accommodate for regex flags when applyRegexFlags is true
+function stringifyRegExpWithFlags(regex, refs) {
+ if (!refs.applyRegexFlags || !regex.flags) {
+ return regex.source;
+ }
+ // Currently handled flags
+ const flags = {
+ i: regex.flags.includes("i"),
+ m: regex.flags.includes("m"),
+ s: regex.flags.includes("s"), // `.` matches newlines
+ };
+ // The general principle here is to step through each character, one at a time, applying mutations as flags require. We keep track when the current character is escaped, and when it's inside a group /like [this]/ or (also) a range like /[a-z]/. The following is fairly brittle imperative code; edit at your peril!
+ const source = flags.i ? regex.source.toLowerCase() : regex.source;
+ let pattern = "";
+ let isEscaped = false;
+ let inCharGroup = false;
+ let inCharRange = false;
+ for (let i = 0; i < source.length; i++) {
+ if (isEscaped) {
+ pattern += source[i];
+ isEscaped = false;
+ continue;
+ }
+ if (flags.i) {
+ if (inCharGroup) {
+ if (source[i].match(/[a-z]/)) {
+ if (inCharRange) {
+ pattern += source[i];
+ pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
+ inCharRange = false;
+ }
+ else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
+ pattern += source[i];
+ inCharRange = true;
+ }
+ else {
+ pattern += `${source[i]}${source[i].toUpperCase()}`;
+ }
+ continue;
+ }
+ }
+ else if (source[i].match(/[a-z]/)) {
+ pattern += `[${source[i]}${source[i].toUpperCase()}]`;
+ continue;
+ }
+ }
+ if (flags.m) {
+ if (source[i] === "^") {
+ pattern += `(^|(?<=[\r\n]))`;
+ continue;
+ }
+ else if (source[i] === "$") {
+ pattern += `($|(?=[\r\n]))`;
+ continue;
+ }
+ }
+ if (flags.s && source[i] === ".") {
+ pattern += inCharGroup ? `${source[i]}\r\n` : `[${source[i]}\r\n]`;
+ continue;
+ }
+ pattern += source[i];
+ if (source[i] === "\\") {
+ isEscaped = true;
+ }
+ else if (inCharGroup && source[i] === "]") {
+ inCharGroup = false;
+ }
+ else if (!inCharGroup && source[i] === "[") {
+ inCharGroup = true;
+ }
+ }
+ try {
+ new RegExp(pattern);
+ }
+ catch {
+ console.warn(`Could not convert regex pattern at ${refs.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`);
+ return regex.source;
+ }
+ return pattern;
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
new file mode 100644
index 0000000000000000000000000000000000000000..5387936219afb06b89899b253a630fd544ba0e6f
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
@@ -0,0 +1,32 @@
+import { parseDef } from "../parseDef.js";
+export function parseTupleDef(def, refs) {
+ if (def.rest) {
+ return {
+ type: "array",
+ minItems: def.items.length,
+ items: def.items
+ .map((x, i) => parseDef(x._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "items", `${i}`],
+ }))
+ .reduce((acc, x) => (x === undefined ? acc : [...acc, x]), []),
+ additionalItems: parseDef(def.rest._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "additionalItems"],
+ }),
+ };
+ }
+ else {
+ return {
+ type: "array",
+ minItems: def.items.length,
+ maxItems: def.items.length,
+ items: def.items
+ .map((x, i) => parseDef(x._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "items", `${i}`],
+ }))
+ .reduce((acc, x) => (x === undefined ? acc : [...acc, x]), []),
+ };
+ }
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
new file mode 100644
index 0000000000000000000000000000000000000000..2209eff2d0b64e0e6ca51e4e41107a897fe61e1f
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
@@ -0,0 +1,6 @@
+import { parseAnyDef } from "./any.js";
+export function parseUndefinedDef(refs) {
+ return {
+ not: parseAnyDef(refs),
+ };
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/union.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
new file mode 100644
index 0000000000000000000000000000000000000000..45a105fe4d1e160be0ac6a988627763efee335df
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
@@ -0,0 +1,80 @@
+import { parseDef } from "../parseDef.js";
+export const primitiveMappings = {
+ ZodString: "string",
+ ZodNumber: "number",
+ ZodBigInt: "integer",
+ ZodBoolean: "boolean",
+ ZodNull: "null",
+};
+export function parseUnionDef(def, refs) {
+ if (refs.target === "openApi3")
+ return asAnyOf(def, refs);
+ const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
+ // This blocks tries to look ahead a bit to produce nicer looking schemas with type array instead of anyOf.
+ if (options.every((x) => x._def.typeName in primitiveMappings &&
+ (!x._def.checks || !x._def.checks.length))) {
+ // all types in union are primitive and lack checks, so might as well squash into {type: [...]}
+ const types = options.reduce((types, x) => {
+ const type = primitiveMappings[x._def.typeName]; //Can be safely casted due to row 43
+ return type && !types.includes(type) ? [...types, type] : types;
+ }, []);
+ return {
+ type: types.length > 1 ? types : types[0],
+ };
+ }
+ else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
+ // all options literals
+ const types = options.reduce((acc, x) => {
+ const type = typeof x._def.value;
+ switch (type) {
+ case "string":
+ case "number":
+ case "boolean":
+ return [...acc, type];
+ case "bigint":
+ return [...acc, "integer"];
+ case "object":
+ if (x._def.value === null)
+ return [...acc, "null"];
+ case "symbol":
+ case "undefined":
+ case "function":
+ default:
+ return acc;
+ }
+ }, []);
+ if (types.length === options.length) {
+ // all the literals are primitive, as far as null can be considered primitive
+ const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
+ return {
+ type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
+ enum: options.reduce((acc, x) => {
+ return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
+ }, []),
+ };
+ }
+ }
+ else if (options.every((x) => x._def.typeName === "ZodEnum")) {
+ return {
+ type: "string",
+ enum: options.reduce((acc, x) => [
+ ...acc,
+ ...x._def.values.filter((x) => !acc.includes(x)),
+ ], []),
+ };
+ }
+ return asAnyOf(def, refs);
+}
+const asAnyOf = (def, refs) => {
+ const anyOf = (def.options instanceof Map
+ ? Array.from(def.options.values())
+ : def.options)
+ .map((x, i) => parseDef(x._def, {
+ ...refs,
+ currentPath: [...refs.currentPath, "anyOf", `${i}`],
+ }))
+ .filter((x) => !!x &&
+ (!refs.strictUnions ||
+ (typeof x === "object" && Object.keys(x).length > 0)));
+ return anyOf.length ? { anyOf } : undefined;
+};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
new file mode 100644
index 0000000000000000000000000000000000000000..6d73f8276710195a936d71dee2c158d7e8a55e74
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
@@ -0,0 +1,4 @@
+import { parseAnyDef } from "./any.js";
+export function parseUnknownDef(refs) {
+ return parseAnyDef(refs);
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/selectParser.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/selectParser.js
new file mode 100644
index 0000000000000000000000000000000000000000..c4a05bb6afde2b082400643b408d78af76707158
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/selectParser.js
@@ -0,0 +1,105 @@
+import { ZodFirstPartyTypeKind } from "zod/v3";
+import { parseAnyDef } from "./parsers/any.js";
+import { parseArrayDef } from "./parsers/array.js";
+import { parseBigintDef } from "./parsers/bigint.js";
+import { parseBooleanDef } from "./parsers/boolean.js";
+import { parseBrandedDef } from "./parsers/branded.js";
+import { parseCatchDef } from "./parsers/catch.js";
+import { parseDateDef } from "./parsers/date.js";
+import { parseDefaultDef } from "./parsers/default.js";
+import { parseEffectsDef } from "./parsers/effects.js";
+import { parseEnumDef } from "./parsers/enum.js";
+import { parseIntersectionDef } from "./parsers/intersection.js";
+import { parseLiteralDef } from "./parsers/literal.js";
+import { parseMapDef } from "./parsers/map.js";
+import { parseNativeEnumDef } from "./parsers/nativeEnum.js";
+import { parseNeverDef } from "./parsers/never.js";
+import { parseNullDef } from "./parsers/null.js";
+import { parseNullableDef } from "./parsers/nullable.js";
+import { parseNumberDef } from "./parsers/number.js";
+import { parseObjectDef } from "./parsers/object.js";
+import { parseOptionalDef } from "./parsers/optional.js";
+import { parsePipelineDef } from "./parsers/pipeline.js";
+import { parsePromiseDef } from "./parsers/promise.js";
+import { parseRecordDef } from "./parsers/record.js";
+import { parseSetDef } from "./parsers/set.js";
+import { parseStringDef } from "./parsers/string.js";
+import { parseTupleDef } from "./parsers/tuple.js";
+import { parseUndefinedDef } from "./parsers/undefined.js";
+import { parseUnionDef } from "./parsers/union.js";
+import { parseUnknownDef } from "./parsers/unknown.js";
+import { parseReadonlyDef } from "./parsers/readonly.js";
+export const selectParser = (def, typeName, refs) => {
+ switch (typeName) {
+ case ZodFirstPartyTypeKind.ZodString:
+ return parseStringDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodNumber:
+ return parseNumberDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodObject:
+ return parseObjectDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodBigInt:
+ return parseBigintDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodBoolean:
+ return parseBooleanDef();
+ case ZodFirstPartyTypeKind.ZodDate:
+ return parseDateDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodUndefined:
+ return parseUndefinedDef(refs);
+ case ZodFirstPartyTypeKind.ZodNull:
+ return parseNullDef(refs);
+ case ZodFirstPartyTypeKind.ZodArray:
+ return parseArrayDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodUnion:
+ case ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
+ return parseUnionDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodIntersection:
+ return parseIntersectionDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodTuple:
+ return parseTupleDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodRecord:
+ return parseRecordDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodLiteral:
+ return parseLiteralDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodEnum:
+ return parseEnumDef(def);
+ case ZodFirstPartyTypeKind.ZodNativeEnum:
+ return parseNativeEnumDef(def);
+ case ZodFirstPartyTypeKind.ZodNullable:
+ return parseNullableDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodOptional:
+ return parseOptionalDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodMap:
+ return parseMapDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodSet:
+ return parseSetDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodLazy:
+ return () => def.getter()._def;
+ case ZodFirstPartyTypeKind.ZodPromise:
+ return parsePromiseDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodNaN:
+ case ZodFirstPartyTypeKind.ZodNever:
+ return parseNeverDef(refs);
+ case ZodFirstPartyTypeKind.ZodEffects:
+ return parseEffectsDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodAny:
+ return parseAnyDef(refs);
+ case ZodFirstPartyTypeKind.ZodUnknown:
+ return parseUnknownDef(refs);
+ case ZodFirstPartyTypeKind.ZodDefault:
+ return parseDefaultDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodBranded:
+ return parseBrandedDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodReadonly:
+ return parseReadonlyDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodCatch:
+ return parseCatchDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodPipeline:
+ return parsePipelineDef(def, refs);
+ case ZodFirstPartyTypeKind.ZodFunction:
+ case ZodFirstPartyTypeKind.ZodVoid:
+ case ZodFirstPartyTypeKind.ZodSymbol:
+ return undefined;
+ default:
+ return ((_) => undefined)(typeName);
+ }
+};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js b/tools/ui/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
new file mode 100644
index 0000000000000000000000000000000000000000..6359a758fcb92e480afebbfb94fef5f0f5a14c30
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
@@ -0,0 +1,87 @@
+import { parseDef } from "./parseDef.js";
+import { getRefs } from "./Refs.js";
+import { parseAnyDef } from "./parsers/any.js";
+const zodToJsonSchema = (schema, options) => {
+ const refs = getRefs(options);
+ let definitions = typeof options === "object" && options.definitions
+ ? Object.entries(options.definitions).reduce((acc, [name, schema]) => ({
+ ...acc,
+ [name]: parseDef(schema._def, {
+ ...refs,
+ currentPath: [...refs.basePath, refs.definitionPath, name],
+ }, true) ?? parseAnyDef(refs),
+ }), {})
+ : undefined;
+ const name = typeof options === "string"
+ ? options
+ : options?.nameStrategy === "title"
+ ? undefined
+ : options?.name;
+ const main = parseDef(schema._def, name === undefined
+ ? refs
+ : {
+ ...refs,
+ currentPath: [...refs.basePath, refs.definitionPath, name],
+ }, false) ?? parseAnyDef(refs);
+ const title = typeof options === "object" &&
+ options.name !== undefined &&
+ options.nameStrategy === "title"
+ ? options.name
+ : undefined;
+ if (title !== undefined) {
+ main.title = title;
+ }
+ if (refs.flags.hasReferencedOpenAiAnyType) {
+ if (!definitions) {
+ definitions = {};
+ }
+ if (!definitions[refs.openAiAnyTypeName]) {
+ definitions[refs.openAiAnyTypeName] = {
+ // Skipping "object" as no properties can be defined and additionalProperties must be "false"
+ type: ["string", "number", "integer", "boolean", "array", "null"],
+ items: {
+ $ref: refs.$refStrategy === "relative"
+ ? "1"
+ : [
+ ...refs.basePath,
+ refs.definitionPath,
+ refs.openAiAnyTypeName,
+ ].join("/"),
+ },
+ };
+ }
+ }
+ const combined = name === undefined
+ ? definitions
+ ? {
+ ...main,
+ [refs.definitionPath]: definitions,
+ }
+ : main
+ : {
+ $ref: [
+ ...(refs.$refStrategy === "relative" ? [] : refs.basePath),
+ refs.definitionPath,
+ name,
+ ].join("/"),
+ [refs.definitionPath]: {
+ ...definitions,
+ [name]: main,
+ },
+ };
+ if (refs.target === "jsonSchema7") {
+ combined.$schema = "http://json-schema.org/draft-07/schema#";
+ }
+ else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") {
+ combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
+ }
+ if (refs.target === "openAi" &&
+ ("anyOf" in combined ||
+ "oneOf" in combined ||
+ "allOf" in combined ||
+ ("type" in combined && Array.isArray(combined.type)))) {
+ console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
+ }
+ return combined;
+};
+export { zodToJsonSchema };
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/Options.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/Options.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..882f6ac77a3d0f6b1f4f72033e0b37d5104fb8ff
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/Options.d.ts
@@ -0,0 +1,37 @@
+import { ZodSchema, ZodTypeDef } from "zod/v3";
+import { Refs, Seen } from "./Refs";
+import { JsonSchema7Type } from "./parseTypes";
+export type Targets = "jsonSchema7" | "jsonSchema2019-09" | "openApi3" | "openAi";
+export type DateStrategy = "format:date-time" | "format:date" | "string" | "integer";
+export declare const ignoreOverride: unique symbol;
+export type OverrideCallback = (def: ZodTypeDef, refs: Refs, seen: Seen | undefined, forceResolution?: boolean) => JsonSchema7Type | undefined | typeof ignoreOverride;
+export type PostProcessCallback = (jsonSchema: JsonSchema7Type | undefined, def: ZodTypeDef, refs: Refs) => JsonSchema7Type | undefined;
+export declare const jsonDescription: PostProcessCallback;
+export type Options = {
+ name: string | undefined;
+ $refStrategy: "root" | "relative" | "none" | "seen";
+ basePath: string[];
+ effectStrategy: "input" | "any";
+ pipeStrategy: "input" | "output" | "all";
+ dateStrategy: DateStrategy | DateStrategy[];
+ mapStrategy: "entries" | "record";
+ removeAdditionalStrategy: "passthrough" | "strict";
+ allowedAdditionalProperties: true | undefined;
+ rejectedAdditionalProperties: false | undefined;
+ target: Target;
+ strictUnions: boolean;
+ definitionPath: string;
+ definitions: Record;
+ errorMessages: boolean;
+ markdownDescription: boolean;
+ patternStrategy: "escape" | "preserve";
+ applyRegexFlags: boolean;
+ emailStrategy: "format:email" | "format:idn-email" | "pattern:zod";
+ base64Strategy: "format:binary" | "contentEncoding:base64" | "pattern:zod";
+ nameStrategy: "ref" | "title";
+ override?: OverrideCallback;
+ postProcess?: PostProcessCallback;
+ openAiAnyTypeName: string;
+};
+export declare const defaultOptions: Options;
+export declare const getDefaultOptions: (options: string | Partial> | undefined) => Options;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/Refs.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/Refs.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..482838f3b4456ed0b1013d8f9fca22bd0709a831
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/Refs.d.ts
@@ -0,0 +1,17 @@
+import { ZodTypeDef } from "zod/v3";
+import { Options, Targets } from "./Options.js";
+import { JsonSchema7Type } from "./parseTypes.js";
+export type Refs = {
+ seen: Map;
+ currentPath: string[];
+ propertyPath: string[] | undefined;
+ flags: {
+ hasReferencedOpenAiAnyType: boolean;
+ };
+} & Options;
+export type Seen = {
+ def: ZodTypeDef;
+ path: string[];
+ jsonSchema: JsonSchema7Type | undefined;
+};
+export declare const getRefs: (options?: string | Partial>) => Refs;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/errorMessages.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/errorMessages.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..85cb5624803cfdd58233746e30713251eba27c86
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/errorMessages.d.ts
@@ -0,0 +1,15 @@
+import { JsonSchema7TypeUnion } from "./parseTypes.js";
+import { Refs } from "./Refs.js";
+export type ErrorMessages = Partial>;
+export declare function addErrorMessage;
+}>(res: T, key: keyof T, errorMessage: string | undefined, refs: Refs): void;
+export declare function setResponseValueAndErrors;
+}, Key extends keyof Omit>(res: Json7Type, key: Key, value: Json7Type[Key], errorMessage: string | undefined, refs: Refs): void;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/getRelativePath.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/getRelativePath.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..5cf67e314fb847562ebc542cfa4d533534ff2fc8
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/getRelativePath.d.ts
@@ -0,0 +1 @@
+export declare const getRelativePath: (pathA: string[], pathB: string[]) => string;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/index.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..cdfb5306e4cb4f7362c269baeff84c525cda93be
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/index.d.ts
@@ -0,0 +1,40 @@
+export * from "./Options.js";
+export * from "./Refs.js";
+export * from "./errorMessages.js";
+export * from "./getRelativePath.js";
+export * from "./parseDef.js";
+export * from "./parseTypes.js";
+export * from "./parsers/any.js";
+export * from "./parsers/array.js";
+export * from "./parsers/bigint.js";
+export * from "./parsers/boolean.js";
+export * from "./parsers/branded.js";
+export * from "./parsers/catch.js";
+export * from "./parsers/date.js";
+export * from "./parsers/default.js";
+export * from "./parsers/effects.js";
+export * from "./parsers/enum.js";
+export * from "./parsers/intersection.js";
+export * from "./parsers/literal.js";
+export * from "./parsers/map.js";
+export * from "./parsers/nativeEnum.js";
+export * from "./parsers/never.js";
+export * from "./parsers/null.js";
+export * from "./parsers/nullable.js";
+export * from "./parsers/number.js";
+export * from "./parsers/object.js";
+export * from "./parsers/optional.js";
+export * from "./parsers/pipeline.js";
+export * from "./parsers/promise.js";
+export * from "./parsers/readonly.js";
+export * from "./parsers/record.js";
+export * from "./parsers/set.js";
+export * from "./parsers/string.js";
+export * from "./parsers/tuple.js";
+export * from "./parsers/undefined.js";
+export * from "./parsers/union.js";
+export * from "./parsers/unknown.js";
+export * from "./selectParser.js";
+export * from "./zodToJsonSchema.js";
+import { zodToJsonSchema } from "./zodToJsonSchema.js";
+export default zodToJsonSchema;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parseDef.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parseDef.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..cbbf0d7eeda0b2875ccfed7f83a24116ceef7228
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parseDef.d.ts
@@ -0,0 +1,4 @@
+import { ZodTypeDef } from "zod/v3";
+import { Refs } from "./Refs.js";
+import { JsonSchema7Type } from "./parseTypes.js";
+export declare function parseDef(def: ZodTypeDef, refs: Refs, forceResolution?: boolean): JsonSchema7Type | undefined;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parseTypes.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parseTypes.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..dbfa17c84459253b55bd441440d4ce6b254e344d
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parseTypes.d.ts
@@ -0,0 +1,34 @@
+import { JsonSchema7AnyType } from "./parsers/any.js";
+import { JsonSchema7ArrayType } from "./parsers/array.js";
+import { JsonSchema7BigintType } from "./parsers/bigint.js";
+import { JsonSchema7BooleanType } from "./parsers/boolean.js";
+import { JsonSchema7DateType } from "./parsers/date.js";
+import { JsonSchema7EnumType } from "./parsers/enum.js";
+import { JsonSchema7AllOfType } from "./parsers/intersection.js";
+import { JsonSchema7LiteralType } from "./parsers/literal.js";
+import { JsonSchema7MapType } from "./parsers/map.js";
+import { JsonSchema7NativeEnumType } from "./parsers/nativeEnum.js";
+import { JsonSchema7NeverType } from "./parsers/never.js";
+import { JsonSchema7NullType } from "./parsers/null.js";
+import { JsonSchema7NullableType } from "./parsers/nullable.js";
+import { JsonSchema7NumberType } from "./parsers/number.js";
+import { JsonSchema7ObjectType } from "./parsers/object.js";
+import { JsonSchema7RecordType } from "./parsers/record.js";
+import { JsonSchema7SetType } from "./parsers/set.js";
+import { JsonSchema7StringType } from "./parsers/string.js";
+import { JsonSchema7TupleType } from "./parsers/tuple.js";
+import { JsonSchema7UndefinedType } from "./parsers/undefined.js";
+import { JsonSchema7UnionType } from "./parsers/union.js";
+import { JsonSchema7UnknownType } from "./parsers/unknown.js";
+type JsonSchema7RefType = {
+ $ref: string;
+};
+type JsonSchema7Meta = {
+ title?: string;
+ default?: any;
+ description?: string;
+ markdownDescription?: string;
+};
+export type JsonSchema7TypeUnion = JsonSchema7StringType | JsonSchema7ArrayType | JsonSchema7NumberType | JsonSchema7BigintType | JsonSchema7BooleanType | JsonSchema7DateType | JsonSchema7EnumType | JsonSchema7LiteralType | JsonSchema7NativeEnumType | JsonSchema7NullType | JsonSchema7NumberType | JsonSchema7ObjectType | JsonSchema7RecordType | JsonSchema7TupleType | JsonSchema7UnionType | JsonSchema7UndefinedType | JsonSchema7RefType | JsonSchema7NeverType | JsonSchema7MapType | JsonSchema7AnyType | JsonSchema7NullableType | JsonSchema7AllOfType | JsonSchema7UnknownType | JsonSchema7SetType;
+export type JsonSchema7Type = JsonSchema7TypeUnion & JsonSchema7Meta;
+export {};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/any.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/any.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..88deab458bfc1bb933a112d9250d10b2f5d5f99b
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/any.d.ts
@@ -0,0 +1,5 @@
+import { Refs } from "../Refs.js";
+export type JsonSchema7AnyType = {
+ $ref?: string;
+};
+export declare function parseAnyDef(refs: Refs): JsonSchema7AnyType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/array.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/array.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..a8049318e1e7f870564b5670a6abf695e08876e8
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/array.d.ts
@@ -0,0 +1,12 @@
+import { ZodArrayDef } from "zod/v3";
+import { ErrorMessages } from "../errorMessages.js";
+import { JsonSchema7Type } from "../parseTypes.js";
+import { Refs } from "../Refs.js";
+export type JsonSchema7ArrayType = {
+ type: "array";
+ items?: JsonSchema7Type;
+ minItems?: number;
+ maxItems?: number;
+ errorMessages?: ErrorMessages;
+};
+export declare function parseArrayDef(def: ZodArrayDef, refs: Refs): JsonSchema7ArrayType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/bigint.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/bigint.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..44ad42b9446084690f0ab1803a15565e6a42a43a
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/bigint.d.ts
@@ -0,0 +1,14 @@
+import { ZodBigIntDef } from "zod/v3";
+import { Refs } from "../Refs.js";
+import { ErrorMessages } from "../errorMessages.js";
+export type JsonSchema7BigintType = {
+ type: "integer";
+ format: "int64";
+ minimum?: BigInt;
+ exclusiveMinimum?: BigInt;
+ maximum?: BigInt;
+ exclusiveMaximum?: BigInt;
+ multipleOf?: BigInt;
+ errorMessage?: ErrorMessages;
+};
+export declare function parseBigintDef(def: ZodBigIntDef, refs: Refs): JsonSchema7BigintType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/boolean.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/boolean.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c69bb884f0adf0d8f6ffef25f42bc5571055f33c
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/boolean.d.ts
@@ -0,0 +1,4 @@
+export type JsonSchema7BooleanType = {
+ type: "boolean";
+};
+export declare function parseBooleanDef(): JsonSchema7BooleanType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/branded.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/branded.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..cf319c2a77f3f552b0ebb8af16ee1578a33d45e4
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/branded.d.ts
@@ -0,0 +1,3 @@
+import { ZodBrandedDef } from "zod/v3";
+import { Refs } from "../Refs.js";
+export declare function parseBrandedDef(_def: ZodBrandedDef, refs: Refs): import("../parseTypes.js").JsonSchema7Type | undefined;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/catch.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/catch.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..92693e92e8619d458a2b3b6e59259895f31b50ec
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/catch.d.ts
@@ -0,0 +1,3 @@
+import { ZodCatchDef } from "zod/v3";
+import { Refs } from "../Refs.js";
+export declare const parseCatchDef: (def: ZodCatchDef, refs: Refs) => import("../parseTypes.js").JsonSchema7Type | undefined;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/date.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/date.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d3cc800bf0e4b4976ffc25f8cf3154247a94edaf
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/date.d.ts
@@ -0,0 +1,15 @@
+import { ZodDateDef } from "zod/v3";
+import { Refs } from "../Refs.js";
+import { ErrorMessages } from "../errorMessages.js";
+import { JsonSchema7NumberType } from "./number.js";
+import { DateStrategy } from "../Options.js";
+export type JsonSchema7DateType = {
+ type: "integer" | "string";
+ format: "unix-time" | "date-time" | "date";
+ minimum?: number;
+ maximum?: number;
+ errorMessage?: ErrorMessages;
+} | {
+ anyOf: JsonSchema7DateType[];
+};
+export declare function parseDateDef(def: ZodDateDef, refs: Refs, overrideDateStrategy?: DateStrategy): JsonSchema7DateType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/default.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/default.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..58c6ae94f1f98546346c2908a7a7cd66adc9bf90
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/default.d.ts
@@ -0,0 +1,6 @@
+import { ZodDefaultDef } from "zod/v3";
+import { JsonSchema7Type } from "../parseTypes.js";
+import { Refs } from "../Refs.js";
+export declare function parseDefaultDef(_def: ZodDefaultDef, refs: Refs): JsonSchema7Type & {
+ default: any;
+};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/effects.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/effects.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..15239c720a20691f9bc10b18e3351fe7066416b2
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/effects.d.ts
@@ -0,0 +1,4 @@
+import { ZodEffectsDef } from "zod/v3";
+import { JsonSchema7Type } from "../parseTypes.js";
+import { Refs } from "../Refs.js";
+export declare function parseEffectsDef(_def: ZodEffectsDef, refs: Refs): JsonSchema7Type | undefined;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/enum.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/enum.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ce30dbb7c05c50939eec04dbc942047de1dd0919
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/enum.d.ts
@@ -0,0 +1,6 @@
+import { ZodEnumDef } from "zod/v3";
+export type JsonSchema7EnumType = {
+ type: "string";
+ enum: string[];
+};
+export declare function parseEnumDef(def: ZodEnumDef): JsonSchema7EnumType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/intersection.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/intersection.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d86a349b591996c79aaf509a21fa0611b2346b2c
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/intersection.d.ts
@@ -0,0 +1,8 @@
+import { ZodIntersectionDef } from "zod/v3";
+import { JsonSchema7Type } from "../parseTypes.js";
+import { Refs } from "../Refs.js";
+export type JsonSchema7AllOfType = {
+ allOf: JsonSchema7Type[];
+ unevaluatedProperties?: boolean;
+};
+export declare function parseIntersectionDef(def: ZodIntersectionDef, refs: Refs): JsonSchema7AllOfType | JsonSchema7Type | undefined;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/literal.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/literal.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..1e55226a89d410cd73667a92f2f522c5588bc70d
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/literal.d.ts
@@ -0,0 +1,9 @@
+import { ZodLiteralDef } from "zod/v3";
+import { Refs } from "../Refs.js";
+export type JsonSchema7LiteralType = {
+ type: "string" | "number" | "integer" | "boolean";
+ const: string | number | boolean;
+} | {
+ type: "object" | "array";
+};
+export declare function parseLiteralDef(def: ZodLiteralDef, refs: Refs): JsonSchema7LiteralType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/map.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/map.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..3663e7ae2aa6089eacb756c3e4b4761caf9bd0b1
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/map.d.ts
@@ -0,0 +1,15 @@
+import { ZodMapDef } from "zod/v3";
+import { JsonSchema7Type } from "../parseTypes.js";
+import { Refs } from "../Refs.js";
+import { JsonSchema7RecordType } from "./record.js";
+export type JsonSchema7MapType = {
+ type: "array";
+ maxItems: 125;
+ items: {
+ type: "array";
+ items: [JsonSchema7Type, JsonSchema7Type];
+ minItems: 2;
+ maxItems: 2;
+ };
+};
+export declare function parseMapDef(def: ZodMapDef, refs: Refs): JsonSchema7MapType | JsonSchema7RecordType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/nativeEnum.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/nativeEnum.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6be16b02e25f7406781de58f2d65c2d2b5c718ef
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/nativeEnum.d.ts
@@ -0,0 +1,6 @@
+import { ZodNativeEnumDef } from "zod/v3";
+export type JsonSchema7NativeEnumType = {
+ type: "string" | "number" | ["string", "number"];
+ enum: (string | number)[];
+};
+export declare function parseNativeEnumDef(def: ZodNativeEnumDef): JsonSchema7NativeEnumType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/never.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/never.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..1301358fe414c7ab06ecdef624273c13532ca896
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/never.d.ts
@@ -0,0 +1,6 @@
+import { Refs } from "../Refs.js";
+import { JsonSchema7AnyType } from "./any.js";
+export type JsonSchema7NeverType = {
+ not: JsonSchema7AnyType;
+};
+export declare function parseNeverDef(refs: Refs): JsonSchema7NeverType | undefined;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/null.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/null.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..509a568a817d0e245445045c61f48aa488e755c2
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/null.d.ts
@@ -0,0 +1,5 @@
+import { Refs } from "../Refs.js";
+export type JsonSchema7NullType = {
+ type: "null";
+};
+export declare function parseNullDef(refs: Refs): JsonSchema7NullType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/nullable.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/nullable.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..68fc4daca400abd5dbb475dc9b113c5b3c2275ce
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/nullable.d.ts
@@ -0,0 +1,10 @@
+import { ZodNullableDef } from "zod/v3";
+import { JsonSchema7Type } from "../parseTypes.js";
+import { Refs } from "../Refs.js";
+import { JsonSchema7NullType } from "./null.js";
+export type JsonSchema7NullableType = {
+ anyOf: [JsonSchema7Type, JsonSchema7NullType];
+} | {
+ type: [string, "null"];
+};
+export declare function parseNullableDef(def: ZodNullableDef, refs: Refs): JsonSchema7NullableType | undefined;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/number.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/number.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6aca58678a07e29ad675be9f591bc9b9e356f5ff
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/number.d.ts
@@ -0,0 +1,13 @@
+import { ZodNumberDef } from "zod/v3";
+import { ErrorMessages } from "../errorMessages.js";
+import { Refs } from "../Refs.js";
+export type JsonSchema7NumberType = {
+ type: "number" | "integer";
+ minimum?: number;
+ exclusiveMinimum?: number;
+ maximum?: number;
+ exclusiveMaximum?: number;
+ multipleOf?: number;
+ errorMessage?: ErrorMessages;
+};
+export declare function parseNumberDef(def: ZodNumberDef, refs: Refs): JsonSchema7NumberType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/object.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/object.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6269c6206e8c319c73de332f1a62656077bd69b5
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/object.d.ts
@@ -0,0 +1,10 @@
+import { ZodObjectDef } from "zod/v3";
+import { JsonSchema7Type } from "../parseTypes.js";
+import { Refs } from "../Refs.js";
+export type JsonSchema7ObjectType = {
+ type: "object";
+ properties: Record;
+ additionalProperties?: boolean | JsonSchema7Type;
+ required?: string[];
+};
+export declare function parseObjectDef(def: ZodObjectDef, refs: Refs): JsonSchema7ObjectType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/optional.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/optional.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..7799cd0608795183ef6ea8c302456c00181cf2da
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/optional.d.ts
@@ -0,0 +1,4 @@
+import { ZodOptionalDef } from "zod/v3";
+import { JsonSchema7Type } from "../parseTypes.js";
+import { Refs } from "../Refs.js";
+export declare const parseOptionalDef: (def: ZodOptionalDef, refs: Refs) => JsonSchema7Type | undefined;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/pipeline.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/pipeline.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..0382eacf3098e4437928afdb02bc2c3f28d26a2a
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/pipeline.d.ts
@@ -0,0 +1,5 @@
+import { ZodPipelineDef } from "zod/v3";
+import { JsonSchema7Type } from "../parseTypes.js";
+import { Refs } from "../Refs.js";
+import { JsonSchema7AllOfType } from "./intersection.js";
+export declare const parsePipelineDef: (def: ZodPipelineDef, refs: Refs) => JsonSchema7AllOfType | JsonSchema7Type | undefined;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/promise.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/promise.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..9b0d55a838987bff92f5a619e7e94c5c747d74f4
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/promise.d.ts
@@ -0,0 +1,4 @@
+import { ZodPromiseDef } from "zod/v3";
+import { JsonSchema7Type } from "../parseTypes.js";
+import { Refs } from "../Refs.js";
+export declare function parsePromiseDef(def: ZodPromiseDef, refs: Refs): JsonSchema7Type | undefined;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/readonly.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/readonly.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..bf5b480262bff422e5536f8bb71141918f24f829
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/readonly.d.ts
@@ -0,0 +1,3 @@
+import { ZodReadonlyDef } from "zod/v3";
+import { Refs } from "../Refs.js";
+export declare const parseReadonlyDef: (def: ZodReadonlyDef, refs: Refs) => import("../parseTypes.js").JsonSchema7Type | undefined;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/record.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/record.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..784d378d100d8b31c807a1fba0b9a513304673d1
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/record.d.ts
@@ -0,0 +1,13 @@
+import { ZodMapDef, ZodRecordDef, ZodTypeAny } from "zod/v3";
+import { JsonSchema7Type } from "../parseTypes.js";
+import { Refs } from "../Refs.js";
+import { JsonSchema7EnumType } from "./enum.js";
+import { JsonSchema7StringType } from "./string.js";
+type JsonSchema7RecordPropertyNamesType = Omit | Omit;
+export type JsonSchema7RecordType = {
+ type: "object";
+ additionalProperties?: JsonSchema7Type | true;
+ propertyNames?: JsonSchema7RecordPropertyNamesType;
+};
+export declare function parseRecordDef(def: ZodRecordDef | ZodMapDef, refs: Refs): JsonSchema7RecordType;
+export {};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/set.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/set.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d527b48f5009d7dc5326258cff9688ed8e33c6a1
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/set.d.ts
@@ -0,0 +1,13 @@
+import { ZodSetDef } from "zod/v3";
+import { ErrorMessages } from "../errorMessages.js";
+import { JsonSchema7Type } from "../parseTypes.js";
+import { Refs } from "../Refs.js";
+export type JsonSchema7SetType = {
+ type: "array";
+ uniqueItems: true;
+ items?: JsonSchema7Type;
+ minItems?: number;
+ maxItems?: number;
+ errorMessage?: ErrorMessages;
+};
+export declare function parseSetDef(def: ZodSetDef, refs: Refs): JsonSchema7SetType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/string.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/string.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..296e75c3f1e6424090dab686f81765ccd29a903d
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/string.d.ts
@@ -0,0 +1,73 @@
+import { ZodStringDef } from "zod/v3";
+import { ErrorMessages } from "../errorMessages.js";
+import { Refs } from "../Refs.js";
+/**
+ * Generated from the regular expressions found here as of 2024-05-22:
+ * https://github.com/colinhacks/zod/blob/master/src/types.ts.
+ *
+ * Expressions with /i flag have been changed accordingly.
+ */
+export declare const zodPatterns: {
+ /**
+ * `c` was changed to `[cC]` to replicate /i flag
+ */
+ readonly cuid: RegExp;
+ readonly cuid2: RegExp;
+ readonly ulid: RegExp;
+ /**
+ * `a-z` was added to replicate /i flag
+ */
+ readonly email: RegExp;
+ /**
+ * Constructed a valid Unicode RegExp
+ *
+ * Lazily instantiate since this type of regex isn't supported
+ * in all envs (e.g. React Native).
+ *
+ * See:
+ * https://github.com/colinhacks/zod/issues/2433
+ * Fix in Zod:
+ * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
+ */
+ readonly emoji: () => RegExp;
+ /**
+ * Unused
+ */
+ readonly uuid: RegExp;
+ /**
+ * Unused
+ */
+ readonly ipv4: RegExp;
+ readonly ipv4Cidr: RegExp;
+ /**
+ * Unused
+ */
+ readonly ipv6: RegExp;
+ readonly ipv6Cidr: RegExp;
+ readonly base64: RegExp;
+ readonly base64url: RegExp;
+ readonly nanoid: RegExp;
+ readonly jwt: RegExp;
+};
+export type JsonSchema7StringType = {
+ type: "string";
+ minLength?: number;
+ maxLength?: number;
+ format?: "email" | "idn-email" | "uri" | "uuid" | "date-time" | "ipv4" | "ipv6" | "date" | "time" | "duration";
+ pattern?: string;
+ allOf?: {
+ pattern: string;
+ errorMessage?: ErrorMessages<{
+ pattern: string;
+ }>;
+ }[];
+ anyOf?: {
+ format: string;
+ errorMessage?: ErrorMessages<{
+ format: string;
+ }>;
+ }[];
+ errorMessage?: ErrorMessages;
+ contentEncoding?: string;
+};
+export declare function parseStringDef(def: ZodStringDef, refs: Refs): JsonSchema7StringType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/tuple.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/tuple.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..25a5833be43b975575d4ee30c85c33148fd16b87
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/tuple.d.ts
@@ -0,0 +1,13 @@
+import { ZodTupleDef, ZodTupleItems, ZodTypeAny } from "zod/v3";
+import { JsonSchema7Type } from "../parseTypes.js";
+import { Refs } from "../Refs.js";
+export type JsonSchema7TupleType = {
+ type: "array";
+ minItems: number;
+ items: JsonSchema7Type[];
+} & ({
+ maxItems: number;
+} | {
+ additionalItems?: JsonSchema7Type;
+});
+export declare function parseTupleDef(def: ZodTupleDef, refs: Refs): JsonSchema7TupleType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/undefined.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/undefined.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..48e891921dfcb344623b6b409c243b3d5fc9dd6c
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/undefined.d.ts
@@ -0,0 +1,6 @@
+import { Refs } from "../Refs.js";
+import { JsonSchema7AnyType } from "./any.js";
+export type JsonSchema7UndefinedType = {
+ not: JsonSchema7AnyType;
+};
+export declare function parseUndefinedDef(refs: Refs): JsonSchema7UndefinedType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/union.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/union.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..cd9e498005a1ca6cc533939caf9b1316c7945307
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/union.d.ts
@@ -0,0 +1,23 @@
+import { ZodDiscriminatedUnionDef, ZodUnionDef } from "zod/v3";
+import { JsonSchema7Type } from "../parseTypes.js";
+import { Refs } from "../Refs.js";
+export declare const primitiveMappings: {
+ readonly ZodString: "string";
+ readonly ZodNumber: "number";
+ readonly ZodBigInt: "integer";
+ readonly ZodBoolean: "boolean";
+ readonly ZodNull: "null";
+};
+type JsonSchema7Primitive = (typeof primitiveMappings)[keyof typeof primitiveMappings];
+export type JsonSchema7UnionType = JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType;
+type JsonSchema7PrimitiveUnionType = {
+ type: JsonSchema7Primitive | JsonSchema7Primitive[];
+} | {
+ type: JsonSchema7Primitive | JsonSchema7Primitive[];
+ enum: (string | number | bigint | boolean | null)[];
+};
+type JsonSchema7AnyOfType = {
+ anyOf: JsonSchema7Type[];
+};
+export declare function parseUnionDef(def: ZodUnionDef | ZodDiscriminatedUnionDef, refs: Refs): JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType | undefined;
+export {};
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/unknown.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/unknown.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..a905d03530a71b8509c31ac24e8d6947f2f13c79
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/parsers/unknown.d.ts
@@ -0,0 +1,4 @@
+import { Refs } from "../Refs";
+import { JsonSchema7AnyType } from "./any.js";
+export type JsonSchema7UnknownType = JsonSchema7AnyType;
+export declare function parseUnknownDef(refs: Refs): JsonSchema7UnknownType;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/selectParser.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/selectParser.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..39bee49509718c11a97d6b4b33efc9e16bdc9861
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/selectParser.d.ts
@@ -0,0 +1,5 @@
+import { ZodFirstPartyTypeKind } from "zod/v3";
+import { Refs } from "./Refs.js";
+import { JsonSchema7Type } from "./parseTypes.js";
+export type InnerDefGetter = () => any;
+export declare const selectParser: (def: any, typeName: ZodFirstPartyTypeKind, refs: Refs) => JsonSchema7Type | undefined | InnerDefGetter;
diff --git a/tools/ui/node_modules/zod-to-json-schema/dist/types/zodToJsonSchema.d.ts b/tools/ui/node_modules/zod-to-json-schema/dist/types/zodToJsonSchema.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..17853b7e0382d61de7eb79e700850ec642fd0db0
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/dist/types/zodToJsonSchema.d.ts
@@ -0,0 +1,10 @@
+import { ZodSchema } from "zod/v3";
+import { Options, Targets } from "./Options.js";
+import { JsonSchema7Type } from "./parseTypes.js";
+declare const zodToJsonSchema: (schema: ZodSchema, options?: string | Partial> | undefined) => (Target extends "jsonSchema7" ? JsonSchema7Type : object) & {
+ $schema?: string | undefined;
+ definitions?: {
+ [key: string]: Target extends "jsonSchema7" ? JsonSchema7Type : Target extends "jsonSchema2019-09" ? JsonSchema7Type : object;
+ } | undefined;
+};
+export { zodToJsonSchema };
diff --git a/tools/ui/node_modules/zod-to-json-schema/package.json b/tools/ui/node_modules/zod-to-json-schema/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..75b3274a2624d7786ba8f6e7b250c15a2aa8311f
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/package.json
@@ -0,0 +1,85 @@
+{
+ "name": "zod-to-json-schema",
+ "version": "3.25.2",
+ "description": "Converts Zod schemas to Json Schemas",
+ "types": "./dist/types/index.d.ts",
+ "main": "./dist/cjs/index.js",
+ "module": "./dist/esm/index.js",
+ "exports": {
+ "import": {
+ "types": "./dist/types/index.d.ts",
+ "default": "./dist/esm/index.js"
+ },
+ "require": {
+ "types": "./dist/types/index.d.ts",
+ "default": "./dist/cjs/index.js"
+ }
+ },
+ "scripts": {
+ "build:test": "npm --prefix ./dist-test-v3 test && npm --prefix ./dist-test-v4 test",
+ "build:types": "tsc -p tsconfig.types.json",
+ "build:cjs": "tsc -p tsconfig.cjs.json && tsx postcjs.ts",
+ "build:esm": "tsc -p tsconfig.esm.json && tsx postesm.ts",
+ "build": "npm i && npm run gen && npm test && rimraf ./dist && npm run build:types && npm run build:cjs && npm run build:esm && npm run build:test",
+ "dry": "npm run build && npm pub --dry-run",
+ "test:watch": "tsx watch test/index.ts",
+ "test:gen": "tsx test/createIndex.ts",
+ "test": "tsx test/index.ts",
+ "gen": "tsx createIndex.ts"
+ },
+ "keywords": [
+ "zod",
+ "json",
+ "schema",
+ "open",
+ "api",
+ "conversion"
+ ],
+ "author": "Stefan Terdell",
+ "contributors": [
+ "Hammad Asif (https://github.com/mrhammadasif)",
+ "Noah Rosenzweig (https://github.com/Noah2610)",
+ "John Wright (https://github.com/johngeorgewright)",
+ "Krzysztof Ciombor (https://github.com/krzysztofciombor)",
+ "Yuta Mombetsu (https://github.com/mokocm)",
+ "Tom Arad (https://github.com/tomarad)",
+ "Isaac Way (https://github.com/iway1)",
+ "Andreas Berger (https://github.com/Andy2003)",
+ "Jan Potoms (https://github.com/Janpot)",
+ "Santiago Cammi (https://github.com/scammi)",
+ "Philipp Burckhardt (https://github.com/Planeshifter)",
+ "Bram del Canho (https://github.com/Bram-dc)",
+ "Gilad Hecht (https://github.com/gthecht)",
+ "Colin McDonnell (https://github.com/colinhacks)",
+ "Spappz (https://github.com/Spappz)",
+ "Jacob Lee (https://github.com/jacoblee93)",
+ "Brett Zamir (https://github.com/brettz9)",
+ "Isaiah Marc Sanchez (https://github.com/imsanchez)",
+ "Mitchell Merry (https://github.com/mitchell-merry)",
+ "Enzo Monjardín (https://github.com/enzomonjardin)",
+ "Víctor Hernández (https://github.com/NanezX)",
+ "Faïz Hernawan Abdillah (https://github.com/Abdillah)",
+ "Felix Mosheev (https://github.com/felixmosh)"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/StefanTerdell/zod-to-json-schema"
+ },
+ "license": "ISC",
+ "peerDependencies": {
+ "zod": "^3.25.28 || ^4"
+ },
+ "devDependencies": {
+ "@types/json-schema": "^7.0.9",
+ "@types/node": "^20.9.0",
+ "ajv": "^8.6.3",
+ "ajv-errors": "^3.0.0",
+ "ajv-formats": "^2.1.1",
+ "fast-diff": "^1.3.0",
+ "local-ref-resolver": "^0.2.0",
+ "rimraf": "^6.1.3",
+ "tsx": "^4.19.0",
+ "typescript": "^5.1.3",
+ "zod": "^3.25.28 || ^4"
+ }
+}
diff --git a/tools/ui/node_modules/zod-to-json-schema/postcjs.ts b/tools/ui/node_modules/zod-to-json-schema/postcjs.ts
new file mode 100644
index 0000000000000000000000000000000000000000..57c29eb60908798cb61c26613d4150cf25e2af20
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/postcjs.ts
@@ -0,0 +1,3 @@
+import { writeFileSync } from "fs";
+
+writeFileSync("./dist/cjs/package.json", '{"type":"commonjs"}', "utf-8");
diff --git a/tools/ui/node_modules/zod-to-json-schema/postesm.ts b/tools/ui/node_modules/zod-to-json-schema/postesm.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d9a7429fe55f096a22086ab037fc503c6f88344d
--- /dev/null
+++ b/tools/ui/node_modules/zod-to-json-schema/postesm.ts
@@ -0,0 +1,3 @@
+import { writeFileSync } from "fs";
+
+writeFileSync("./dist/esm/package.json", '{"type":"module","main":"index.js"}', "utf-8");
diff --git a/tools/ui/node_modules/zod/LICENSE b/tools/ui/node_modules/zod/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..c06579627b432d09779094cd0166b7f37fe51db8
--- /dev/null
+++ b/tools/ui/node_modules/zod/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2025 Colin McDonnell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/tools/ui/node_modules/zod/README.md b/tools/ui/node_modules/zod/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..cefb2a3bbc574608ddce064ba21676484cdf83bb
--- /dev/null
+++ b/tools/ui/node_modules/zod/README.md
@@ -0,0 +1,191 @@
+
+
+
Zod
+
+ TypeScript-first schema validation with static type inference
+
+ by @colinhacks
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+### [Read the docs →](https://zod.dev/api)
+
+
+
+
+## What is Zod?
+
+Zod is a TypeScript-first validation library. Define a schema and parse some data with it. You'll get back a strongly typed, validated result.
+
+```ts
+import * as z from "zod";
+
+const User = z.object({
+ name: z.string(),
+});
+
+// some untrusted data...
+const input = {
+ /* stuff */
+};
+
+// the parsed result is validated and type safe!
+const data = User.parse(input);
+
+// so you can use it with confidence :)
+console.log(data.name);
+```
+
+
+
+## Features
+
+- Zero external dependencies
+- Works in Node.js and all modern browsers
+- Tiny: `2kb` core bundle (gzipped)
+- Immutable API: methods return a new instance
+- Concise interface
+- Works with TypeScript and plain JS
+- Built-in JSON Schema conversion
+- Extensive ecosystem
+
+
+
+## Installation
+
+```sh
+npm install zod
+```
+
+
+
+## Basic usage
+
+Before you can do anything else, you need to define a schema. For the purposes of this guide, we'll use a simple object schema.
+
+```ts
+import * as z from "zod";
+
+const Player = z.object({
+ username: z.string(),
+ xp: z.number(),
+});
+```
+
+### Parsing data
+
+Given any Zod schema, use `.parse` to validate an input. If it's valid, Zod returns a strongly-typed _deep clone_ of the input.
+
+```ts
+Player.parse({ username: "billie", xp: 100 });
+// => returns { username: "billie", xp: 100 }
+```
+
+**Note** — If your schema uses certain asynchronous APIs like `async` [refinements](https://zod.dev/api#refinements) or [transforms](https://zod.dev/api#transforms), you'll need to use the `.parseAsync()` method instead.
+
+```ts
+const schema = z.string().refine(async (val) => val.length <= 8);
+
+await schema.parseAsync("hello");
+// => "hello"
+```
+
+### Handling errors
+
+When validation fails, the `.parse()` method will throw a `ZodError` instance with granular information about the validation issues.
+
+```ts
+try {
+ Player.parse({ username: 42, xp: "100" });
+} catch (err) {
+ if (err instanceof z.ZodError) {
+ err.issues;
+ /* [
+ {
+ expected: 'string',
+ code: 'invalid_type',
+ path: [ 'username' ],
+ message: 'Invalid input: expected string'
+ },
+ {
+ expected: 'number',
+ code: 'invalid_type',
+ path: [ 'xp' ],
+ message: 'Invalid input: expected number'
+ }
+ ] */
+ }
+}
+```
+
+To avoid a `try/catch` block, you can use the `.safeParse()` method to get back a plain result object containing either the successfully parsed data or a `ZodError`. The result type is a [discriminated union](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions), so you can handle both cases conveniently.
+
+```ts
+const result = Player.safeParse({ username: 42, xp: "100" });
+if (!result.success) {
+ result.error; // ZodError instance
+} else {
+ result.data; // { username: string; xp: number }
+}
+```
+
+**Note** — If your schema uses certain asynchronous APIs like `async` [refinements](https://zod.dev/api#refinements) or [transforms](https://zod.dev/api#transforms), you'll need to use the `.safeParseAsync()` method instead.
+
+```ts
+const schema = z.string().refine(async (val) => val.length <= 8);
+
+await schema.safeParseAsync("hello");
+// => { success: true; data: "hello" }
+```
+
+### Inferring types
+
+Zod infers a static type from your schema definitions. You can extract this type with the `z.infer<>` utility and use it however you like.
+
+```ts
+const Player = z.object({
+ username: z.string(),
+ xp: z.number(),
+});
+
+// extract the inferred type
+type Player = z.infer;
+
+// use it in your code
+const player: Player = { username: "billie", xp: 100 };
+```
+
+In some cases, the input & output types of a schema can diverge. For instance, the `.transform()` API can convert the input from one type to another. In these cases, you can extract the input and output types independently:
+
+```ts
+const mySchema = z.string().transform((val) => val.length);
+
+type MySchemaIn = z.input;
+// => string
+
+type MySchemaOut = z.output; // equivalent to z.infer
+// number
+```
diff --git a/tools/ui/node_modules/zod/index.cjs b/tools/ui/node_modules/zod/index.cjs
new file mode 100644
index 0000000000000000000000000000000000000000..3e30380fbb5d71076cd01b3f28cad42d3d53136a
--- /dev/null
+++ b/tools/ui/node_modules/zod/index.cjs
@@ -0,0 +1,33 @@
+"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+var __exportStar = (this && this.__exportStar) || function(m, exports) {
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.z = void 0;
+const z = __importStar(require("./v4/classic/external.cjs"));
+exports.z = z;
+__exportStar(require("./v4/classic/external.cjs"), exports);
+exports.default = z;
diff --git a/tools/ui/node_modules/zod/index.d.cts b/tools/ui/node_modules/zod/index.d.cts
new file mode 100644
index 0000000000000000000000000000000000000000..ed2f3c30c3db5598d4fc16ccdc532ec64e202d16
--- /dev/null
+++ b/tools/ui/node_modules/zod/index.d.cts
@@ -0,0 +1,4 @@
+import * as z from "./v4/classic/external.cjs";
+export * from "./v4/classic/external.cjs";
+export { z };
+export default z;
diff --git a/tools/ui/node_modules/zod/index.d.ts b/tools/ui/node_modules/zod/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..b0bbaefb767b76b3b59cf6598f08fa189e426f16
--- /dev/null
+++ b/tools/ui/node_modules/zod/index.d.ts
@@ -0,0 +1,4 @@
+import * as z from "./v4/classic/external.js";
+export * from "./v4/classic/external.js";
+export { z };
+export default z;
diff --git a/tools/ui/node_modules/zod/index.js b/tools/ui/node_modules/zod/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..b0bbaefb767b76b3b59cf6598f08fa189e426f16
--- /dev/null
+++ b/tools/ui/node_modules/zod/index.js
@@ -0,0 +1,4 @@
+import * as z from "./v4/classic/external.js";
+export * from "./v4/classic/external.js";
+export { z };
+export default z;
diff --git a/tools/ui/node_modules/zod/locales/index.cjs b/tools/ui/node_modules/zod/locales/index.cjs
new file mode 100644
index 0000000000000000000000000000000000000000..65f2079f7148d5e82c5429326d5dc0bc81b1ccef
--- /dev/null
+++ b/tools/ui/node_modules/zod/locales/index.cjs
@@ -0,0 +1,17 @@
+"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __exportStar = (this && this.__exportStar) || function(m, exports) {
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+__exportStar(require("../v4/locales/index.cjs"), exports);
diff --git a/tools/ui/node_modules/zod/locales/index.d.cts b/tools/ui/node_modules/zod/locales/index.d.cts
new file mode 100644
index 0000000000000000000000000000000000000000..cd70ce63df73c2e1c1ee1c194ab73b35639c6556
--- /dev/null
+++ b/tools/ui/node_modules/zod/locales/index.d.cts
@@ -0,0 +1 @@
+export * from "../v4/locales/index.cjs";
diff --git a/tools/ui/node_modules/zod/locales/index.d.ts b/tools/ui/node_modules/zod/locales/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e6e7dd67c13286f3d529ee32ff37d25dcc848612
--- /dev/null
+++ b/tools/ui/node_modules/zod/locales/index.d.ts
@@ -0,0 +1 @@
+export * from "../v4/locales/index.js";
diff --git a/tools/ui/node_modules/zod/locales/index.js b/tools/ui/node_modules/zod/locales/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e6e7dd67c13286f3d529ee32ff37d25dcc848612
--- /dev/null
+++ b/tools/ui/node_modules/zod/locales/index.js
@@ -0,0 +1 @@
+export * from "../v4/locales/index.js";
diff --git a/tools/ui/node_modules/zod/locales/package.json b/tools/ui/node_modules/zod/locales/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..f5d2e90cdae223ed38764ab1d69169a1c54b6661
--- /dev/null
+++ b/tools/ui/node_modules/zod/locales/package.json
@@ -0,0 +1,7 @@
+{
+ "type": "module",
+ "main": "./index.cjs",
+ "module": "./index.js",
+ "types": "./index.d.cts",
+ "sideEffects": false
+}
diff --git a/tools/ui/node_modules/zod/mini/index.cjs b/tools/ui/node_modules/zod/mini/index.cjs
new file mode 100644
index 0000000000000000000000000000000000000000..90a31e2ce84b8341446f7627c304cb6c9e9582b0
--- /dev/null
+++ b/tools/ui/node_modules/zod/mini/index.cjs
@@ -0,0 +1,32 @@
+"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+var __exportStar = (this && this.__exportStar) || function(m, exports) {
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.z = void 0;
+const z = __importStar(require("../v4/mini/external.cjs"));
+exports.z = z;
+__exportStar(require("../v4/mini/external.cjs"), exports);
diff --git a/tools/ui/node_modules/zod/mini/index.d.cts b/tools/ui/node_modules/zod/mini/index.d.cts
new file mode 100644
index 0000000000000000000000000000000000000000..bca69bd601008bc06ec8db3a95dfb78ccf550cd9
--- /dev/null
+++ b/tools/ui/node_modules/zod/mini/index.d.cts
@@ -0,0 +1,3 @@
+import * as z from "../v4/mini/external.cjs";
+export * from "../v4/mini/external.cjs";
+export { z };
diff --git a/tools/ui/node_modules/zod/mini/index.d.ts b/tools/ui/node_modules/zod/mini/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..bb95da0a24829980395bc1300b1edcc8474b3dfb
--- /dev/null
+++ b/tools/ui/node_modules/zod/mini/index.d.ts
@@ -0,0 +1,3 @@
+import * as z from "../v4/mini/external.js";
+export * from "../v4/mini/external.js";
+export { z };
diff --git a/tools/ui/node_modules/zod/mini/index.js b/tools/ui/node_modules/zod/mini/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..bb95da0a24829980395bc1300b1edcc8474b3dfb
--- /dev/null
+++ b/tools/ui/node_modules/zod/mini/index.js
@@ -0,0 +1,3 @@
+import * as z from "../v4/mini/external.js";
+export * from "../v4/mini/external.js";
+export { z };
diff --git a/tools/ui/node_modules/zod/mini/package.json b/tools/ui/node_modules/zod/mini/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..f5d2e90cdae223ed38764ab1d69169a1c54b6661
--- /dev/null
+++ b/tools/ui/node_modules/zod/mini/package.json
@@ -0,0 +1,7 @@
+{
+ "type": "module",
+ "main": "./index.cjs",
+ "module": "./index.js",
+ "types": "./index.d.cts",
+ "sideEffects": false
+}
diff --git a/tools/ui/node_modules/zod/package.json b/tools/ui/node_modules/zod/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..8a0c194e0958637d8e6c9d8a6c2ee66701582c35
--- /dev/null
+++ b/tools/ui/node_modules/zod/package.json
@@ -0,0 +1,135 @@
+{
+ "name": "zod",
+ "version": "4.4.3",
+ "type": "module",
+ "license": "MIT",
+ "author": "Colin McDonnell ",
+ "description": "TypeScript-first schema declaration and validation library with static type inference",
+ "homepage": "https://zod.dev",
+ "llms": "https://zod.dev/llms.txt",
+ "llmsFull": "https://zod.dev/llms-full.txt",
+ "mcpServer": "https://mcp.inkeep.com/zod/mcp",
+ "funding": "https://github.com/sponsors/colinhacks",
+ "sideEffects": false,
+ "files": [
+ "src",
+ "**/*.js",
+ "**/*.mjs",
+ "**/*.cjs",
+ "**/*.d.ts",
+ "**/*.d.mts",
+ "**/*.d.cts",
+ "**/package.json"
+ ],
+ "keywords": [
+ "typescript",
+ "schema",
+ "validation",
+ "type",
+ "inference"
+ ],
+ "main": "./index.cjs",
+ "types": "./index.d.cts",
+ "module": "./index.js",
+ "zshy": {
+ "exports": {
+ "./package.json": "./package.json",
+ ".": "./src/index.ts",
+ "./mini": "./src/mini/index.ts",
+ "./locales": "./src/locales/index.ts",
+ "./v3": "./src/v3/index.ts",
+ "./v4": "./src/v4/index.ts",
+ "./v4-mini": "./src/v4-mini/index.ts",
+ "./v4/mini": "./src/v4/mini/index.ts",
+ "./v4/core": "./src/v4/core/index.ts",
+ "./v4/locales": "./src/v4/locales/index.ts",
+ "./v4/locales/*": "./src/v4/locales/*"
+ },
+ "conditions": {
+ "@zod/source": "src"
+ }
+ },
+ "exports": {
+ "./package.json": "./package.json",
+ ".": {
+ "@zod/source": "./src/index.ts",
+ "types": "./index.d.cts",
+ "import": "./index.js",
+ "require": "./index.cjs"
+ },
+ "./mini": {
+ "@zod/source": "./src/mini/index.ts",
+ "types": "./mini/index.d.cts",
+ "import": "./mini/index.js",
+ "require": "./mini/index.cjs"
+ },
+ "./locales": {
+ "@zod/source": "./src/locales/index.ts",
+ "types": "./locales/index.d.cts",
+ "import": "./locales/index.js",
+ "require": "./locales/index.cjs"
+ },
+ "./v3": {
+ "@zod/source": "./src/v3/index.ts",
+ "types": "./v3/index.d.cts",
+ "import": "./v3/index.js",
+ "require": "./v3/index.cjs"
+ },
+ "./v4": {
+ "@zod/source": "./src/v4/index.ts",
+ "types": "./v4/index.d.cts",
+ "import": "./v4/index.js",
+ "require": "./v4/index.cjs"
+ },
+ "./v4-mini": {
+ "@zod/source": "./src/v4-mini/index.ts",
+ "types": "./v4-mini/index.d.cts",
+ "import": "./v4-mini/index.js",
+ "require": "./v4-mini/index.cjs"
+ },
+ "./v4/mini": {
+ "@zod/source": "./src/v4/mini/index.ts",
+ "types": "./v4/mini/index.d.cts",
+ "import": "./v4/mini/index.js",
+ "require": "./v4/mini/index.cjs"
+ },
+ "./v4/core": {
+ "@zod/source": "./src/v4/core/index.ts",
+ "types": "./v4/core/index.d.cts",
+ "import": "./v4/core/index.js",
+ "require": "./v4/core/index.cjs"
+ },
+ "./v4/locales": {
+ "@zod/source": "./src/v4/locales/index.ts",
+ "types": "./v4/locales/index.d.cts",
+ "import": "./v4/locales/index.js",
+ "require": "./v4/locales/index.cjs"
+ },
+ "./v4/locales/*": {
+ "@zod/source": "./src/v4/locales/*",
+ "types": "./v4/locales/*",
+ "import": "./v4/locales/*",
+ "require": "./v4/locales/*"
+ }
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/colinhacks/zod.git"
+ },
+ "bugs": {
+ "url": "https://github.com/colinhacks/zod/issues"
+ },
+ "support": {
+ "backing": {
+ "npm-funding": true
+ }
+ },
+ "scripts": {
+ "clean": "git clean -xdf . -e node_modules",
+ "build": "zshy --project tsconfig.build.json",
+ "postbuild": "tsx ../../scripts/write-stub-package-jsons.ts && pnpm biome check --write .",
+ "test:watch": "pnpm vitest",
+ "test": "pnpm vitest run",
+ "prepublishOnly": "tsx ../../scripts/check-versions.ts"
+ }
+}
diff --git a/tools/ui/node_modules/zod/src/index.ts b/tools/ui/node_modules/zod/src/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..b0bbaefb767b76b3b59cf6598f08fa189e426f16
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/index.ts
@@ -0,0 +1,4 @@
+import * as z from "./v4/classic/external.js";
+export * from "./v4/classic/external.js";
+export { z };
+export default z;
diff --git a/tools/ui/node_modules/zod/src/locales/index.ts b/tools/ui/node_modules/zod/src/locales/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e6e7dd67c13286f3d529ee32ff37d25dcc848612
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/locales/index.ts
@@ -0,0 +1 @@
+export * from "../v4/locales/index.js";
diff --git a/tools/ui/node_modules/zod/src/mini/index.ts b/tools/ui/node_modules/zod/src/mini/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..bb95da0a24829980395bc1300b1edcc8474b3dfb
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/mini/index.ts
@@ -0,0 +1,3 @@
+import * as z from "../v4/mini/external.js";
+export * from "../v4/mini/external.js";
+export { z };
diff --git a/tools/ui/node_modules/zod/src/v3/ZodError.ts b/tools/ui/node_modules/zod/src/v3/ZodError.ts
new file mode 100644
index 0000000000000000000000000000000000000000..b4c6865c43b192bc0ad85a25e08f12e7d3bc1787
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/ZodError.ts
@@ -0,0 +1,330 @@
+import type { Primitive } from "./helpers/typeAliases.js";
+import { util, type ZodParsedType } from "./helpers/util.js";
+import type { TypeOf, ZodType } from "./index.js";
+
+type allKeys = T extends any ? keyof T : never;
+
+export type inferFlattenedErrors, U = string> = typeToFlattenedError, U>;
+export type typeToFlattenedError = {
+ formErrors: U[];
+ fieldErrors: {
+ [P in allKeys]?: U[];
+ };
+};
+
+export const ZodIssueCode = util.arrayToEnum([
+ "invalid_type",
+ "invalid_literal",
+ "custom",
+ "invalid_union",
+ "invalid_union_discriminator",
+ "invalid_enum_value",
+ "unrecognized_keys",
+ "invalid_arguments",
+ "invalid_return_type",
+ "invalid_date",
+ "invalid_string",
+ "too_small",
+ "too_big",
+ "invalid_intersection_types",
+ "not_multiple_of",
+ "not_finite",
+]);
+
+export type ZodIssueCode = keyof typeof ZodIssueCode;
+
+export type ZodIssueBase = {
+ path: (string | number)[];
+ message?: string | undefined;
+};
+
+export interface ZodInvalidTypeIssue extends ZodIssueBase {
+ code: typeof ZodIssueCode.invalid_type;
+ expected: ZodParsedType;
+ received: ZodParsedType;
+}
+
+export interface ZodInvalidLiteralIssue extends ZodIssueBase {
+ code: typeof ZodIssueCode.invalid_literal;
+ expected: unknown;
+ received: unknown;
+}
+
+export interface ZodUnrecognizedKeysIssue extends ZodIssueBase {
+ code: typeof ZodIssueCode.unrecognized_keys;
+ keys: string[];
+}
+
+export interface ZodInvalidUnionIssue extends ZodIssueBase {
+ code: typeof ZodIssueCode.invalid_union;
+ unionErrors: ZodError[];
+}
+
+export interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase {
+ code: typeof ZodIssueCode.invalid_union_discriminator;
+ options: Primitive[];
+}
+
+export interface ZodInvalidEnumValueIssue extends ZodIssueBase {
+ received: string | number;
+ code: typeof ZodIssueCode.invalid_enum_value;
+ options: (string | number)[];
+}
+
+export interface ZodInvalidArgumentsIssue extends ZodIssueBase {
+ code: typeof ZodIssueCode.invalid_arguments;
+ argumentsError: ZodError;
+}
+
+export interface ZodInvalidReturnTypeIssue extends ZodIssueBase {
+ code: typeof ZodIssueCode.invalid_return_type;
+ returnTypeError: ZodError;
+}
+
+export interface ZodInvalidDateIssue extends ZodIssueBase {
+ code: typeof ZodIssueCode.invalid_date;
+}
+
+export type StringValidation =
+ | "email"
+ | "url"
+ | "emoji"
+ | "uuid"
+ | "nanoid"
+ | "regex"
+ | "cuid"
+ | "cuid2"
+ | "ulid"
+ | "datetime"
+ | "date"
+ | "time"
+ | "duration"
+ | "ip"
+ | "cidr"
+ | "base64"
+ | "jwt"
+ | "base64url"
+ | { includes: string; position?: number | undefined }
+ | { startsWith: string }
+ | { endsWith: string };
+
+export interface ZodInvalidStringIssue extends ZodIssueBase {
+ code: typeof ZodIssueCode.invalid_string;
+ validation: StringValidation;
+}
+
+export interface ZodTooSmallIssue extends ZodIssueBase {
+ code: typeof ZodIssueCode.too_small;
+ minimum: number | bigint;
+ inclusive: boolean;
+ exact?: boolean;
+ type: "array" | "string" | "number" | "set" | "date" | "bigint";
+}
+
+export interface ZodTooBigIssue extends ZodIssueBase {
+ code: typeof ZodIssueCode.too_big;
+ maximum: number | bigint;
+ inclusive: boolean;
+ exact?: boolean;
+ type: "array" | "string" | "number" | "set" | "date" | "bigint";
+}
+
+export interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {
+ code: typeof ZodIssueCode.invalid_intersection_types;
+}
+
+export interface ZodNotMultipleOfIssue extends ZodIssueBase {
+ code: typeof ZodIssueCode.not_multiple_of;
+ multipleOf: number | bigint;
+}
+
+export interface ZodNotFiniteIssue extends ZodIssueBase {
+ code: typeof ZodIssueCode.not_finite;
+}
+
+export interface ZodCustomIssue extends ZodIssueBase {
+ code: typeof ZodIssueCode.custom;
+ params?: { [k: string]: any };
+}
+
+export type DenormalizedError = { [k: string]: DenormalizedError | string[] };
+
+export type ZodIssueOptionalMessage =
+ | ZodInvalidTypeIssue
+ | ZodInvalidLiteralIssue
+ | ZodUnrecognizedKeysIssue
+ | ZodInvalidUnionIssue
+ | ZodInvalidUnionDiscriminatorIssue
+ | ZodInvalidEnumValueIssue
+ | ZodInvalidArgumentsIssue
+ | ZodInvalidReturnTypeIssue
+ | ZodInvalidDateIssue
+ | ZodInvalidStringIssue
+ | ZodTooSmallIssue
+ | ZodTooBigIssue
+ | ZodInvalidIntersectionTypesIssue
+ | ZodNotMultipleOfIssue
+ | ZodNotFiniteIssue
+ | ZodCustomIssue;
+
+export type ZodIssue = ZodIssueOptionalMessage & {
+ fatal?: boolean | undefined;
+ message: string;
+};
+
+export const quotelessJson = (obj: any) => {
+ const json = JSON.stringify(obj, null, 2);
+ return json.replace(/"([^"]+)":/g, "$1:");
+};
+
+type recursiveZodFormattedError = T extends [any, ...any[]]
+ ? { [K in keyof T]?: ZodFormattedError }
+ : T extends any[]
+ ? { [k: number]: ZodFormattedError }
+ : T extends object
+ ? { [K in keyof T]?: ZodFormattedError }
+ : unknown;
+
+export type ZodFormattedError = {
+ _errors: U[];
+} & recursiveZodFormattedError>;
+
+export type inferFormattedError, U = string> = ZodFormattedError, U>;
+
+export class ZodError extends Error {
+ issues: ZodIssue[] = [];
+
+ get errors() {
+ return this.issues;
+ }
+
+ constructor(issues: ZodIssue[]) {
+ super();
+
+ const actualProto = new.target.prototype;
+ if (Object.setPrototypeOf) {
+ // eslint-disable-next-line ban/ban
+ Object.setPrototypeOf(this, actualProto);
+ } else {
+ (this as any).__proto__ = actualProto;
+ }
+ this.name = "ZodError";
+ this.issues = issues;
+ }
+
+ format(): ZodFormattedError;
+ format(mapper: (issue: ZodIssue) => U): ZodFormattedError;
+ format(_mapper?: any) {
+ const mapper: (issue: ZodIssue) => any =
+ _mapper ||
+ function (issue: ZodIssue) {
+ return issue.message;
+ };
+ const fieldErrors: ZodFormattedError = { _errors: [] } as any;
+ const processError = (error: ZodError) => {
+ for (const issue of error.issues) {
+ if (issue.code === "invalid_union") {
+ issue.unionErrors.map(processError);
+ } else if (issue.code === "invalid_return_type") {
+ processError(issue.returnTypeError);
+ } else if (issue.code === "invalid_arguments") {
+ processError(issue.argumentsError);
+ } else if (issue.path.length === 0) {
+ (fieldErrors as any)._errors.push(mapper(issue));
+ } else {
+ let curr: any = fieldErrors;
+ let i = 0;
+ while (i < issue.path.length) {
+ const el = issue.path[i]!;
+ const terminal = i === issue.path.length - 1;
+
+ if (!terminal) {
+ curr[el] = curr[el] || { _errors: [] };
+ // if (typeof el === "string") {
+ // curr[el] = curr[el] || { _errors: [] };
+ // } else if (typeof el === "number") {
+ // const errorArray: any = [];
+ // errorArray._errors = [];
+ // curr[el] = curr[el] || errorArray;
+ // }
+ } else {
+ curr[el] = curr[el] || { _errors: [] };
+ curr[el]._errors.push(mapper(issue));
+ }
+
+ curr = curr[el];
+ i++;
+ }
+ }
+ }
+ };
+
+ processError(this);
+ return fieldErrors;
+ }
+
+ static create = (issues: ZodIssue[]) => {
+ const error = new ZodError(issues);
+ return error;
+ };
+
+ static assert(value: unknown): asserts value is ZodError {
+ if (!(value instanceof ZodError)) {
+ throw new Error(`Not a ZodError: ${value}`);
+ }
+ }
+
+ override toString() {
+ return this.message;
+ }
+ override get message() {
+ return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
+ }
+
+ get isEmpty(): boolean {
+ return this.issues.length === 0;
+ }
+
+ addIssue = (sub: ZodIssue) => {
+ this.issues = [...this.issues, sub];
+ };
+
+ addIssues = (subs: ZodIssue[] = []) => {
+ this.issues = [...this.issues, ...subs];
+ };
+
+ flatten(): typeToFlattenedError;
+ flatten(mapper?: (issue: ZodIssue) => U): typeToFlattenedError;
+ flatten(mapper: (issue: ZodIssue) => U = (issue: ZodIssue) => issue.message as any): any {
+ const fieldErrors: any = Object.create(null);
+ const formErrors: U[] = [];
+ for (const sub of this.issues) {
+ if (sub.path.length > 0) {
+ const firstEl = sub.path[0]!;
+ fieldErrors[firstEl] = fieldErrors[firstEl] || [];
+ fieldErrors[firstEl].push(mapper(sub));
+ } else {
+ formErrors.push(mapper(sub));
+ }
+ }
+ return { formErrors, fieldErrors };
+ }
+
+ get formErrors() {
+ return this.flatten();
+ }
+}
+
+type stripPath = T extends any ? util.OmitKeys : never;
+
+export type IssueData = stripPath & {
+ path?: (string | number)[];
+ fatal?: boolean | undefined;
+};
+
+export type ErrorMapCtx = {
+ defaultError: string;
+ data: any;
+};
+
+export type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => { message: string };
diff --git a/tools/ui/node_modules/zod/src/v3/benchmarks/datetime.ts b/tools/ui/node_modules/zod/src/v3/benchmarks/datetime.ts
new file mode 100644
index 0000000000000000000000000000000000000000..85552c254597cca742ff15351a99b5b862abd63e
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/benchmarks/datetime.ts
@@ -0,0 +1,58 @@
+import Benchmark from "benchmark";
+
+const datetimeValidationSuite = new Benchmark.Suite("datetime");
+
+const DATA = "2021-01-01";
+const MONTHS_31 = new Set([1, 3, 5, 7, 8, 10, 12]);
+const MONTHS_30 = new Set([4, 6, 9, 11]);
+
+const simpleDatetimeRegex = /^(\d{4})-(\d{2})-(\d{2})$/;
+const datetimeRegexNoLeapYearValidation =
+ /^\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\d|2\d))$/;
+const datetimeRegexWithLeapYearValidation =
+ /^((\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\d|3[01])|(0[469]|11)-(0[1-9]|[12]\d|30)|(02)-(0[1-9]|1\d|2[0-8])))$/;
+
+datetimeValidationSuite
+ .add("new Date()", () => {
+ return !Number.isNaN(new Date(DATA).getTime());
+ })
+ .add("regex (no validation)", () => {
+ return simpleDatetimeRegex.test(DATA);
+ })
+ .add("regex (no leap year)", () => {
+ return datetimeRegexNoLeapYearValidation.test(DATA);
+ })
+ .add("regex (w/ leap year)", () => {
+ return datetimeRegexWithLeapYearValidation.test(DATA);
+ })
+ .add("capture groups + code", () => {
+ const match = DATA.match(simpleDatetimeRegex);
+ if (!match) return false;
+
+ // Extract year, month, and day from the capture groups
+ const year = Number.parseInt(match[1], 10);
+ const month = Number.parseInt(match[2], 10); // month is 0-indexed in JavaScript Date, so subtract 1
+ const day = Number.parseInt(match[3], 10);
+
+ if (month === 2) {
+ if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {
+ return day <= 29;
+ }
+ return day <= 28;
+ }
+ if (MONTHS_30.has(month)) {
+ return day <= 30;
+ }
+ if (MONTHS_31.has(month)) {
+ return day <= 31;
+ }
+ return false;
+ })
+
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`${datetimeValidationSuite.name!}: ${e.target}`);
+ });
+
+export default {
+ suites: [datetimeValidationSuite],
+};
diff --git a/tools/ui/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts b/tools/ui/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts
new file mode 100644
index 0000000000000000000000000000000000000000..47737e6c382b0bf6b239bc7c147dbb336a20c778
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts
@@ -0,0 +1,80 @@
+import Benchmark from "benchmark";
+
+import { z } from "zod/v3";
+
+const doubleSuite = new Benchmark.Suite("z.discriminatedUnion: double");
+const manySuite = new Benchmark.Suite("z.discriminatedUnion: many");
+
+const aSchema = z.object({
+ type: z.literal("a"),
+});
+const objA = {
+ type: "a",
+};
+
+const bSchema = z.object({
+ type: z.literal("b"),
+});
+const objB = {
+ type: "b",
+};
+
+const cSchema = z.object({
+ type: z.literal("c"),
+});
+const objC = {
+ type: "c",
+};
+
+const dSchema = z.object({
+ type: z.literal("d"),
+});
+
+const double = z.discriminatedUnion("type", [aSchema, bSchema]);
+const many = z.discriminatedUnion("type", [aSchema, bSchema, cSchema, dSchema]);
+
+doubleSuite
+ .add("valid: a", () => {
+ double.parse(objA);
+ })
+ .add("valid: b", () => {
+ double.parse(objB);
+ })
+ .add("invalid: null", () => {
+ try {
+ double.parse(null);
+ } catch (_err) {}
+ })
+ .add("invalid: wrong shape", () => {
+ try {
+ double.parse(objC);
+ } catch (_err) {}
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`${(doubleSuite as any).name}: ${e.target}`);
+ });
+
+manySuite
+ .add("valid: a", () => {
+ many.parse(objA);
+ })
+ .add("valid: c", () => {
+ many.parse(objC);
+ })
+ .add("invalid: null", () => {
+ try {
+ many.parse(null);
+ } catch (_err) {}
+ })
+ .add("invalid: wrong shape", () => {
+ try {
+ many.parse({ type: "unknown" });
+ } catch (_err) {}
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`${(manySuite as any).name}: ${e.target}`);
+ });
+
+export default {
+ suites: [doubleSuite, manySuite],
+};
diff --git a/tools/ui/node_modules/zod/src/v3/benchmarks/index.ts b/tools/ui/node_modules/zod/src/v3/benchmarks/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ca81c5bb9e300b4917d46e31fdb87dc4f6146bcc
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/benchmarks/index.ts
@@ -0,0 +1,59 @@
+import type Benchmark from "benchmark";
+
+import datetimeBenchmarks from "./datetime.js";
+import discriminatedUnionBenchmarks from "./discriminatedUnion.js";
+import ipv4Benchmarks from "./ipv4.js";
+import objectBenchmarks from "./object.js";
+import primitiveBenchmarks from "./primitives.js";
+import realworld from "./realworld.js";
+import stringBenchmarks from "./string.js";
+import unionBenchmarks from "./union.js";
+
+const argv = process.argv.slice(2);
+let suites: Benchmark.Suite[] = [];
+
+if (!argv.length) {
+ suites = [
+ ...realworld.suites,
+ ...primitiveBenchmarks.suites,
+ ...stringBenchmarks.suites,
+ ...objectBenchmarks.suites,
+ ...unionBenchmarks.suites,
+ ...discriminatedUnionBenchmarks.suites,
+ ];
+} else {
+ if (argv.includes("--realworld")) {
+ suites.push(...realworld.suites);
+ }
+ if (argv.includes("--primitives")) {
+ suites.push(...primitiveBenchmarks.suites);
+ }
+ if (argv.includes("--string")) {
+ suites.push(...stringBenchmarks.suites);
+ }
+ if (argv.includes("--object")) {
+ suites.push(...objectBenchmarks.suites);
+ }
+ if (argv.includes("--union")) {
+ suites.push(...unionBenchmarks.suites);
+ }
+ if (argv.includes("--discriminatedUnion")) {
+ suites.push(...datetimeBenchmarks.suites);
+ }
+ if (argv.includes("--datetime")) {
+ suites.push(...datetimeBenchmarks.suites);
+ }
+ if (argv.includes("--ipv4")) {
+ suites.push(...ipv4Benchmarks.suites);
+ }
+}
+
+for (const suite of suites) {
+ suite.run({});
+}
+
+// exit on Ctrl-C
+process.on("SIGINT", function () {
+ console.log("Exiting...");
+ process.exit();
+});
diff --git a/tools/ui/node_modules/zod/src/v3/benchmarks/ipv4.ts b/tools/ui/node_modules/zod/src/v3/benchmarks/ipv4.ts
new file mode 100644
index 0000000000000000000000000000000000000000..913ffd4166b7061b1505eb635687ea7eabf403d2
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/benchmarks/ipv4.ts
@@ -0,0 +1,57 @@
+import Benchmark from "benchmark";
+
+const suite = new Benchmark.Suite("ipv4");
+
+const DATA = "127.0.0.1";
+const ipv4RegexA =
+ /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;
+const ipv4RegexB =
+ /^(?:(?:(?=(25[0-5]))\1|(?=(2[0-4][0-9]))\2|(?=(1[0-9]{2}))\3|(?=([0-9]{1,2}))\4)\.){3}(?:(?=(25[0-5]))\5|(?=(2[0-4][0-9]))\6|(?=(1[0-9]{2}))\7|(?=([0-9]{1,2}))\8)$/;
+const ipv4RegexC = /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;
+const ipv4RegexD = /^(\b25[0-5]|\b2[0-4][0-9]|\b[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/;
+const ipv4RegexE = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.){3}(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)$/;
+const ipv4RegexF = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/;
+const ipv4RegexG = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/;
+const ipv4RegexH = /^((25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])(\.(?!$)|$)){4}$/;
+const ipv4RegexI =
+ /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
+
+suite
+ .add("A", () => {
+ return ipv4RegexA.test(DATA);
+ })
+ .add("B", () => {
+ return ipv4RegexB.test(DATA);
+ })
+ .add("C", () => {
+ return ipv4RegexC.test(DATA);
+ })
+ .add("D", () => {
+ return ipv4RegexD.test(DATA);
+ })
+ .add("E", () => {
+ return ipv4RegexE.test(DATA);
+ })
+ .add("F", () => {
+ return ipv4RegexF.test(DATA);
+ })
+ .add("G", () => {
+ return ipv4RegexG.test(DATA);
+ })
+ .add("H", () => {
+ return ipv4RegexH.test(DATA);
+ })
+ .add("I", () => {
+ return ipv4RegexI.test(DATA);
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`${suite.name!}: ${e.target}`);
+ });
+
+export default {
+ suites: [suite],
+};
+
+if (require.main === module) {
+ suite.run();
+}
diff --git a/tools/ui/node_modules/zod/src/v3/benchmarks/object.ts b/tools/ui/node_modules/zod/src/v3/benchmarks/object.ts
new file mode 100644
index 0000000000000000000000000000000000000000..3c1da1022a6e049fe7a6fb6d4fd5cfa5da10d538
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/benchmarks/object.ts
@@ -0,0 +1,69 @@
+import Benchmark from "benchmark";
+
+import { z } from "zod/v3";
+
+const emptySuite = new Benchmark.Suite("z.object: empty");
+const shortSuite = new Benchmark.Suite("z.object: short");
+const longSuite = new Benchmark.Suite("z.object: long");
+
+const empty = z.object({});
+const short = z.object({
+ string: z.string(),
+});
+const long = z.object({
+ string: z.string(),
+ number: z.number(),
+ boolean: z.boolean(),
+});
+
+emptySuite
+ .add("valid", () => {
+ empty.parse({});
+ })
+ .add("valid: extra keys", () => {
+ empty.parse({ string: "string" });
+ })
+ .add("invalid: null", () => {
+ try {
+ empty.parse(null);
+ } catch (_err) {}
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`${(emptySuite as any).name}: ${e.target}`);
+ });
+
+shortSuite
+ .add("valid", () => {
+ short.parse({ string: "string" });
+ })
+ .add("valid: extra keys", () => {
+ short.parse({ string: "string", number: 42 });
+ })
+ .add("invalid: null", () => {
+ try {
+ short.parse(null);
+ } catch (_err) {}
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`${(shortSuite as any).name}: ${e.target}`);
+ });
+
+longSuite
+ .add("valid", () => {
+ long.parse({ string: "string", number: 42, boolean: true });
+ })
+ .add("valid: extra keys", () => {
+ long.parse({ string: "string", number: 42, boolean: true, list: [] });
+ })
+ .add("invalid: null", () => {
+ try {
+ long.parse(null);
+ } catch (_err) {}
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`${(longSuite as any).name}: ${e.target}`);
+ });
+
+export default {
+ suites: [emptySuite, shortSuite, longSuite],
+};
diff --git a/tools/ui/node_modules/zod/src/v3/benchmarks/primitives.ts b/tools/ui/node_modules/zod/src/v3/benchmarks/primitives.ts
new file mode 100644
index 0000000000000000000000000000000000000000..fd61b38fefe0b9c31aa69f5ed247ef2d6dd88cb5
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/benchmarks/primitives.ts
@@ -0,0 +1,162 @@
+import Benchmark from "benchmark";
+
+import { z } from "zod/v3";
+import { Mocker } from "../tests/Mocker.js";
+
+const val = new Mocker();
+
+const enumSuite = new Benchmark.Suite("z.enum");
+const enumSchema = z.enum(["a", "b", "c"]);
+
+enumSuite
+ .add("valid", () => {
+ enumSchema.parse("a");
+ })
+ .add("invalid", () => {
+ try {
+ enumSchema.parse("x");
+ } catch (_e: any) {}
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`z.enum: ${e.target}`);
+ });
+
+const longEnumSuite = new Benchmark.Suite("long z.enum");
+const longEnumSchema = z.enum([
+ "one",
+ "two",
+ "three",
+ "four",
+ "five",
+ "six",
+ "seven",
+ "eight",
+ "nine",
+ "ten",
+ "eleven",
+ "twelve",
+ "thirteen",
+ "fourteen",
+ "fifteen",
+ "sixteen",
+ "seventeen",
+]);
+
+longEnumSuite
+ .add("valid", () => {
+ longEnumSchema.parse("five");
+ })
+ .add("invalid", () => {
+ try {
+ longEnumSchema.parse("invalid");
+ } catch (_e: any) {}
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`long z.enum: ${e.target}`);
+ });
+
+const undefinedSuite = new Benchmark.Suite("z.undefined");
+const undefinedSchema = z.undefined();
+
+undefinedSuite
+ .add("valid", () => {
+ undefinedSchema.parse(undefined);
+ })
+ .add("invalid", () => {
+ try {
+ undefinedSchema.parse(1);
+ } catch (_e: any) {}
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`z.undefined: ${e.target}`);
+ });
+
+const literalSuite = new Benchmark.Suite("z.literal");
+const short = "short";
+const bad = "bad";
+const literalSchema = z.literal("short");
+
+literalSuite
+ .add("valid", () => {
+ literalSchema.parse(short);
+ })
+ .add("invalid", () => {
+ try {
+ literalSchema.parse(bad);
+ } catch (_e: any) {}
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`z.literal: ${e.target}`);
+ });
+
+const numberSuite = new Benchmark.Suite("z.number");
+const numberSchema = z.number().int();
+
+numberSuite
+ .add("valid", () => {
+ numberSchema.parse(1);
+ })
+ .add("invalid type", () => {
+ try {
+ numberSchema.parse("bad");
+ } catch (_e: any) {}
+ })
+ .add("invalid number", () => {
+ try {
+ numberSchema.parse(0.5);
+ } catch (_e: any) {}
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`z.number: ${e.target}`);
+ });
+
+const dateSuite = new Benchmark.Suite("z.date");
+
+const plainDate = z.date();
+const minMaxDate = z.date().min(new Date("2021-01-01")).max(new Date("2030-01-01"));
+
+dateSuite
+ .add("valid", () => {
+ plainDate.parse(new Date());
+ })
+ .add("invalid", () => {
+ try {
+ plainDate.parse(1);
+ } catch (_e: any) {}
+ })
+ .add("valid min and max", () => {
+ minMaxDate.parse(new Date("2023-01-01"));
+ })
+ .add("invalid min", () => {
+ try {
+ minMaxDate.parse(new Date("2019-01-01"));
+ } catch (_e: any) {}
+ })
+ .add("invalid max", () => {
+ try {
+ minMaxDate.parse(new Date("2031-01-01"));
+ } catch (_e: any) {}
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`z.date: ${e.target}`);
+ });
+
+const symbolSuite = new Benchmark.Suite("z.symbol");
+const symbolSchema = z.symbol();
+
+symbolSuite
+ .add("valid", () => {
+ symbolSchema.parse(val.symbol);
+ })
+ .add("invalid", () => {
+ try {
+ symbolSchema.parse(1);
+ } catch (_e: any) {}
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`z.symbol: ${e.target}`);
+ });
+
+export default {
+ suites: [enumSuite, longEnumSuite, undefinedSuite, literalSuite, numberSuite, dateSuite, symbolSuite],
+};
diff --git a/tools/ui/node_modules/zod/src/v3/benchmarks/realworld.ts b/tools/ui/node_modules/zod/src/v3/benchmarks/realworld.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d64c4f0d0986a4d0ce7b2c6cd394b65fab1ee7d5
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/benchmarks/realworld.ts
@@ -0,0 +1,63 @@
+import Benchmark from "benchmark";
+
+import { z } from "zod/v3";
+
+const shortSuite = new Benchmark.Suite("realworld");
+
+const People = z.array(
+ z.object({
+ type: z.literal("person"),
+ hair: z.enum(["blue", "brown"]),
+ active: z.boolean(),
+ name: z.string(),
+ age: z.number().int(),
+ hobbies: z.array(z.string()),
+ address: z.object({
+ street: z.string(),
+ zip: z.string(),
+ country: z.string(),
+ }),
+ })
+);
+
+let i = 0;
+
+function num() {
+ return ++i;
+}
+
+function str() {
+ return (++i % 100).toString(16);
+}
+
+function array(fn: () => T): T[] {
+ return Array.from({ length: ++i % 10 }, () => fn());
+}
+
+const people = Array.from({ length: 100 }, () => {
+ return {
+ type: "person",
+ hair: i % 2 ? "blue" : "brown",
+ active: !!(i % 2),
+ name: str(),
+ age: num(),
+ hobbies: array(str),
+ address: {
+ street: str(),
+ zip: str(),
+ country: str(),
+ },
+ };
+});
+
+shortSuite
+ .add("valid", () => {
+ People.parse(people);
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`${(shortSuite as any).name}: ${e.target}`);
+ });
+
+export default {
+ suites: [shortSuite],
+};
diff --git a/tools/ui/node_modules/zod/src/v3/benchmarks/string.ts b/tools/ui/node_modules/zod/src/v3/benchmarks/string.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6b3d29f94083571f7693a615849758cac5ef8b7f
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/benchmarks/string.ts
@@ -0,0 +1,55 @@
+import Benchmark from "benchmark";
+
+import { z } from "zod/v3";
+
+const SUITE_NAME = "z.string";
+const suite = new Benchmark.Suite(SUITE_NAME);
+
+const empty = "";
+const short = "short";
+const long = "long".repeat(256);
+const manual = (str: unknown) => {
+ if (typeof str !== "string") {
+ throw new Error("Not a string");
+ }
+
+ return str;
+};
+const stringSchema = z.string();
+const optionalStringSchema = z.string().optional();
+const optionalNullableStringSchema = z.string().optional().nullable();
+
+suite
+ .add("empty string", () => {
+ stringSchema.parse(empty);
+ })
+ .add("short string", () => {
+ stringSchema.parse(short);
+ })
+ .add("long string", () => {
+ stringSchema.parse(long);
+ })
+ .add("optional string", () => {
+ optionalStringSchema.parse(long);
+ })
+ .add("nullable string", () => {
+ optionalNullableStringSchema.parse(long);
+ })
+ .add("nullable (null) string", () => {
+ optionalNullableStringSchema.parse(null);
+ })
+ .add("invalid: null", () => {
+ try {
+ stringSchema.parse(null);
+ } catch (_err) {}
+ })
+ .add("manual parser: long", () => {
+ manual(long);
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`${SUITE_NAME}: ${e.target}`);
+ });
+
+export default {
+ suites: [suite],
+};
diff --git a/tools/ui/node_modules/zod/src/v3/benchmarks/union.ts b/tools/ui/node_modules/zod/src/v3/benchmarks/union.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d716dcef0eb61e1b94ea9b71ee20c093913c2327
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/benchmarks/union.ts
@@ -0,0 +1,80 @@
+import Benchmark from "benchmark";
+
+import { z } from "zod/v3";
+
+const doubleSuite = new Benchmark.Suite("z.union: double");
+const manySuite = new Benchmark.Suite("z.union: many");
+
+const aSchema = z.object({
+ type: z.literal("a"),
+});
+const objA = {
+ type: "a",
+};
+
+const bSchema = z.object({
+ type: z.literal("b"),
+});
+const objB = {
+ type: "b",
+};
+
+const cSchema = z.object({
+ type: z.literal("c"),
+});
+const objC = {
+ type: "c",
+};
+
+const dSchema = z.object({
+ type: z.literal("d"),
+});
+
+const double = z.union([aSchema, bSchema]);
+const many = z.union([aSchema, bSchema, cSchema, dSchema]);
+
+doubleSuite
+ .add("valid: a", () => {
+ double.parse(objA);
+ })
+ .add("valid: b", () => {
+ double.parse(objB);
+ })
+ .add("invalid: null", () => {
+ try {
+ double.parse(null);
+ } catch (_err) {}
+ })
+ .add("invalid: wrong shape", () => {
+ try {
+ double.parse(objC);
+ } catch (_err) {}
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`${(doubleSuite as any).name}: ${e.target}`);
+ });
+
+manySuite
+ .add("valid: a", () => {
+ many.parse(objA);
+ })
+ .add("valid: c", () => {
+ many.parse(objC);
+ })
+ .add("invalid: null", () => {
+ try {
+ many.parse(null);
+ } catch (_err) {}
+ })
+ .add("invalid: wrong shape", () => {
+ try {
+ many.parse({ type: "unknown" });
+ } catch (_err) {}
+ })
+ .on("cycle", (e: Benchmark.Event) => {
+ console.log(`${(manySuite as any).name}: ${e.target}`);
+ });
+
+export default {
+ suites: [doubleSuite, manySuite],
+};
diff --git a/tools/ui/node_modules/zod/src/v3/errors.ts b/tools/ui/node_modules/zod/src/v3/errors.ts
new file mode 100644
index 0000000000000000000000000000000000000000..3c0dae65964dc95c61870d9b28de67b97d6a94fa
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/errors.ts
@@ -0,0 +1,13 @@
+import type { ZodErrorMap } from "./ZodError.js";
+import defaultErrorMap from "./locales/en.js";
+
+let overrideErrorMap = defaultErrorMap;
+export { defaultErrorMap };
+
+export function setErrorMap(map: ZodErrorMap) {
+ overrideErrorMap = map;
+}
+
+export function getErrorMap() {
+ return overrideErrorMap;
+}
diff --git a/tools/ui/node_modules/zod/src/v3/external.ts b/tools/ui/node_modules/zod/src/v3/external.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f0a4be4c7aa63b363b654384b103396050a06e29
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/external.ts
@@ -0,0 +1,6 @@
+export * from "./errors.js";
+export * from "./helpers/parseUtil.js";
+export * from "./helpers/typeAliases.js";
+export * from "./helpers/util.js";
+export * from "./types.js";
+export * from "./ZodError.js";
diff --git a/tools/ui/node_modules/zod/src/v3/helpers/enumUtil.ts b/tools/ui/node_modules/zod/src/v3/helpers/enumUtil.ts
new file mode 100644
index 0000000000000000000000000000000000000000..526b22736af39391898dd888762d2eabe6ed5e04
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/helpers/enumUtil.ts
@@ -0,0 +1,17 @@
+export namespace enumUtil {
+ type UnionToIntersectionFn = (T extends unknown ? (k: () => T) => void : never) extends (
+ k: infer Intersection
+ ) => void
+ ? Intersection
+ : never;
+
+ type GetUnionLast = UnionToIntersectionFn extends () => infer Last ? Last : never;
+
+ type UnionToTuple = [T] extends [never]
+ ? Tuple
+ : UnionToTuple>, [GetUnionLast, ...Tuple]>;
+
+ type CastToStringTuple = T extends [string, ...string[]] ? T : never;
+
+ export type UnionToTupleString = CastToStringTuple>;
+}
diff --git a/tools/ui/node_modules/zod/src/v3/helpers/errorUtil.ts b/tools/ui/node_modules/zod/src/v3/helpers/errorUtil.ts
new file mode 100644
index 0000000000000000000000000000000000000000..319ef6b74c8fd0ffee2fe8ea60edc3d8bada9d0a
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/helpers/errorUtil.ts
@@ -0,0 +1,8 @@
+export namespace errorUtil {
+ export type ErrMessage = string | { message?: string | undefined };
+ export const errToObj = (message?: ErrMessage): { message?: string | undefined } =>
+ typeof message === "string" ? { message } : message || {};
+ // biome-ignore lint:
+ export const toString = (message?: ErrMessage): string | undefined =>
+ typeof message === "string" ? message : message?.message;
+}
diff --git a/tools/ui/node_modules/zod/src/v3/helpers/parseUtil.ts b/tools/ui/node_modules/zod/src/v3/helpers/parseUtil.ts
new file mode 100644
index 0000000000000000000000000000000000000000..1076ad9de1418b0fee118cd210f041060a1e132a
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/helpers/parseUtil.ts
@@ -0,0 +1,176 @@
+import type { IssueData, ZodErrorMap, ZodIssue } from "../ZodError.js";
+import { getErrorMap } from "../errors.js";
+import defaultErrorMap from "../locales/en.js";
+import type { ZodParsedType } from "./util.js";
+
+export const makeIssue = (params: {
+ data: any;
+ path: (string | number)[];
+ errorMaps: ZodErrorMap[];
+ issueData: IssueData;
+}): ZodIssue => {
+ const { data, path, errorMaps, issueData } = params;
+ const fullPath = [...path, ...(issueData.path || [])];
+ const fullIssue = {
+ ...issueData,
+ path: fullPath,
+ };
+
+ if (issueData.message !== undefined) {
+ return {
+ ...issueData,
+ path: fullPath,
+ message: issueData.message,
+ };
+ }
+
+ let errorMessage = "";
+ const maps = errorMaps
+ .filter((m) => !!m)
+ .slice()
+ .reverse();
+ for (const map of maps) {
+ errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
+ }
+
+ return {
+ ...issueData,
+ path: fullPath,
+ message: errorMessage,
+ };
+};
+
+export type ParseParams = {
+ path: (string | number)[];
+ errorMap: ZodErrorMap;
+ async: boolean;
+};
+
+export type ParsePathComponent = string | number;
+export type ParsePath = ParsePathComponent[];
+export const EMPTY_PATH: ParsePath = [];
+
+export interface ParseContext {
+ readonly common: {
+ readonly issues: ZodIssue[];
+ readonly contextualErrorMap?: ZodErrorMap | undefined;
+ readonly async: boolean;
+ };
+ readonly path: ParsePath;
+ readonly schemaErrorMap?: ZodErrorMap | undefined;
+ readonly parent: ParseContext | null;
+ readonly data: any;
+ readonly parsedType: ZodParsedType;
+}
+
+export type ParseInput = {
+ data: any;
+ path: (string | number)[];
+ parent: ParseContext;
+};
+
+export function addIssueToContext(ctx: ParseContext, issueData: IssueData): void {
+ const overrideMap = getErrorMap();
+ const issue = makeIssue({
+ issueData: issueData,
+ data: ctx.data,
+ path: ctx.path,
+ errorMaps: [
+ ctx.common.contextualErrorMap, // contextual error map is first priority
+ ctx.schemaErrorMap, // then schema-bound map if available
+ overrideMap, // then global override map
+ overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map
+ ].filter((x) => !!x),
+ });
+ ctx.common.issues.push(issue);
+}
+
+export type ObjectPair = {
+ key: SyncParseReturnType;
+ value: SyncParseReturnType;
+};
+export class ParseStatus {
+ value: "aborted" | "dirty" | "valid" = "valid";
+ dirty(): void {
+ if (this.value === "valid") this.value = "dirty";
+ }
+ abort(): void {
+ if (this.value !== "aborted") this.value = "aborted";
+ }
+
+ static mergeArray(status: ParseStatus, results: SyncParseReturnType[]): SyncParseReturnType {
+ const arrayValue: any[] = [];
+ for (const s of results) {
+ if (s.status === "aborted") return INVALID;
+ if (s.status === "dirty") status.dirty();
+ arrayValue.push(s.value);
+ }
+
+ return { status: status.value, value: arrayValue };
+ }
+
+ static async mergeObjectAsync(
+ status: ParseStatus,
+ pairs: { key: ParseReturnType; value: ParseReturnType }[]
+ ): Promise> {
+ const syncPairs: ObjectPair[] = [];
+ for (const pair of pairs) {
+ const key = await pair.key;
+ const value = await pair.value;
+ syncPairs.push({
+ key,
+ value,
+ });
+ }
+ return ParseStatus.mergeObjectSync(status, syncPairs);
+ }
+
+ static mergeObjectSync(
+ status: ParseStatus,
+ pairs: {
+ key: SyncParseReturnType;
+ value: SyncParseReturnType;
+ alwaysSet?: boolean;
+ }[]
+ ): SyncParseReturnType {
+ const finalObject: any = {};
+ for (const pair of pairs) {
+ const { key, value } = pair;
+ if (key.status === "aborted") return INVALID;
+ if (value.status === "aborted") return INVALID;
+ if (key.status === "dirty") status.dirty();
+ if (value.status === "dirty") status.dirty();
+
+ if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
+ finalObject[key.value] = value.value;
+ }
+ }
+
+ return { status: status.value, value: finalObject };
+ }
+}
+export interface ParseResult {
+ status: "aborted" | "dirty" | "valid";
+ data: any;
+}
+
+export type INVALID = { status: "aborted" };
+export const INVALID: INVALID = Object.freeze({
+ status: "aborted",
+});
+
+export type DIRTY = { status: "dirty"; value: T };
+export const DIRTY = (value: T): DIRTY => ({ status: "dirty", value });
+
+export type OK = { status: "valid"; value: T };
+export const OK = (value: T): OK => ({ status: "valid", value });
+
+export type SyncParseReturnType = OK | DIRTY | INVALID;
+export type AsyncParseReturnType = Promise>;
+export type ParseReturnType = SyncParseReturnType | AsyncParseReturnType;
+
+export const isAborted = (x: ParseReturnType): x is INVALID => (x as any).status === "aborted";
+export const isDirty = (x: ParseReturnType): x is OK | DIRTY => (x as any).status === "dirty";
+export const isValid = (x: ParseReturnType): x is OK => (x as any).status === "valid";
+export const isAsync = (x: ParseReturnType): x is AsyncParseReturnType =>
+ typeof Promise !== "undefined" && x instanceof Promise;
diff --git a/tools/ui/node_modules/zod/src/v3/helpers/partialUtil.ts b/tools/ui/node_modules/zod/src/v3/helpers/partialUtil.ts
new file mode 100644
index 0000000000000000000000000000000000000000..0eff8ff34ca6b96f41383ef554752e9f9fda6db9
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/helpers/partialUtil.ts
@@ -0,0 +1,34 @@
+import type {
+ ZodArray,
+ ZodNullable,
+ ZodObject,
+ ZodOptional,
+ ZodRawShape,
+ ZodTuple,
+ ZodTupleItems,
+ ZodTypeAny,
+} from "../types.js";
+
+export namespace partialUtil {
+ export type DeepPartial = T extends ZodObject
+ ? ZodObject<
+ { [k in keyof T["shape"]]: ZodOptional> },
+ T["_def"]["unknownKeys"],
+ T["_def"]["catchall"]
+ >
+ : T extends ZodArray
+ ? ZodArray, Card>
+ : T extends ZodOptional
+ ? ZodOptional>
+ : T extends ZodNullable
+ ? ZodNullable>
+ : T extends ZodTuple
+ ? {
+ [k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial : never;
+ } extends infer PI
+ ? PI extends ZodTupleItems
+ ? ZodTuple
+ : never
+ : never
+ : T;
+}
diff --git a/tools/ui/node_modules/zod/src/v3/helpers/typeAliases.ts b/tools/ui/node_modules/zod/src/v3/helpers/typeAliases.ts
new file mode 100644
index 0000000000000000000000000000000000000000..32df022ca3b929528dace9023f77212204324422
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/helpers/typeAliases.ts
@@ -0,0 +1,2 @@
+export type Primitive = string | number | symbol | bigint | boolean | null | undefined;
+export type Scalars = Primitive | Primitive[];
diff --git a/tools/ui/node_modules/zod/src/v3/helpers/util.ts b/tools/ui/node_modules/zod/src/v3/helpers/util.ts
new file mode 100644
index 0000000000000000000000000000000000000000..030ea821b694ed03e210b418c8742c7a535ac816
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/helpers/util.ts
@@ -0,0 +1,224 @@
+export namespace util {
+ type AssertEqual = (() => V extends T ? 1 : 2) extends () => V extends U ? 1 : 2 ? true : false;
+
+ export type isAny = 0 extends 1 & T ? true : false;
+ export const assertEqual = (_: AssertEqual ): void => {};
+ export function assertIs(_arg: T): void {}
+ export function assertNever(_x: never): never {
+ throw new Error();
+ }
+
+ export type Omit = Pick>;
+ export type OmitKeys = Pick>;
+ export type MakePartial = Omit & Partial>;
+ export type Exactly = T & Record, never>;
+ export type InexactPartial = { [k in keyof T]?: T[k] | undefined };
+ export const arrayToEnum = (items: U): { [k in U[number]]: k } => {
+ const obj: any = {};
+ for (const item of items) {
+ obj[item] = item;
+ }
+ return obj;
+ };
+
+ export const getValidEnumValues = (obj: any): any[] => {
+ const validKeys = objectKeys(obj).filter((k: any) => typeof obj[obj[k]] !== "number");
+ const filtered: any = {};
+ for (const k of validKeys) {
+ filtered[k] = obj[k];
+ }
+ return objectValues(filtered);
+ };
+
+ export const objectValues = (obj: any): any[] => {
+ return objectKeys(obj).map(function (e) {
+ return obj[e];
+ });
+ };
+
+ export const objectKeys: ObjectConstructor["keys"] =
+ typeof Object.keys === "function" // eslint-disable-line ban/ban
+ ? (obj: any) => Object.keys(obj) // eslint-disable-line ban/ban
+ : (object: any) => {
+ const keys = [];
+ for (const key in object) {
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
+ keys.push(key);
+ }
+ }
+ return keys;
+ };
+
+ export const find = (arr: T[], checker: (arg: T) => any): T | undefined => {
+ for (const item of arr) {
+ if (checker(item)) return item;
+ }
+ return undefined;
+ };
+
+ export type identity = objectUtil.identity;
+ export type flatten = objectUtil.flatten;
+
+ export type noUndefined = T extends undefined ? never : T;
+
+ export const isInteger: NumberConstructor["isInteger"] =
+ typeof Number.isInteger === "function"
+ ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
+ : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
+
+ export function joinValues(array: T, separator = " | "): string {
+ return array.map((val) => (typeof val === "string" ? `'${val}'` : val)).join(separator);
+ }
+
+ export const jsonStringifyReplacer = (_: string, value: any): any => {
+ if (typeof value === "bigint") {
+ return value.toString();
+ }
+ return value;
+ };
+}
+
+export namespace objectUtil {
+ export type MergeShapes =
+ // fast path when there is no keys overlap
+ keyof U & keyof V extends never
+ ? U & V
+ : {
+ [k in Exclude]: U[k];
+ } & V;
+
+ type optionalKeys = {
+ [k in keyof T]: undefined extends T[k] ? k : never;
+ }[keyof T];
+ type requiredKeys = {
+ [k in keyof T]: undefined extends T[k] ? never : k;
+ }[keyof T];
+ export type addQuestionMarks = {
+ [K in requiredKeys]: T[K];
+ } & {
+ [K in optionalKeys]?: T[K];
+ } & { [k in keyof T]?: unknown };
+
+ export type identity = T;
+ export type flatten = identity<{ [k in keyof T]: T[k] }>;
+
+ export type noNeverKeys = {
+ [k in keyof T]: [T[k]] extends [never] ? never : k;
+ }[keyof T];
+
+ export type noNever = identity<{
+ [k in noNeverKeys]: k extends keyof T ? T[k] : never;
+ }>;
+
+ export const mergeShapes = (first: U, second: T): T & U => {
+ return {
+ ...first,
+ ...second, // second overwrites first
+ };
+ };
+
+ export type extendShape = keyof A & keyof B extends never // fast path when there is no keys overlap
+ ? A & B
+ : {
+ [K in keyof A as K extends keyof B ? never : K]: A[K];
+ } & {
+ [K in keyof B]: B[K];
+ };
+}
+
+export const ZodParsedType: {
+ string: "string";
+ nan: "nan";
+ number: "number";
+ integer: "integer";
+ float: "float";
+ boolean: "boolean";
+ date: "date";
+ bigint: "bigint";
+ symbol: "symbol";
+ function: "function";
+ undefined: "undefined";
+ null: "null";
+ array: "array";
+ object: "object";
+ unknown: "unknown";
+ promise: "promise";
+ void: "void";
+ never: "never";
+ map: "map";
+ set: "set";
+} = util.arrayToEnum([
+ "string",
+ "nan",
+ "number",
+ "integer",
+ "float",
+ "boolean",
+ "date",
+ "bigint",
+ "symbol",
+ "function",
+ "undefined",
+ "null",
+ "array",
+ "object",
+ "unknown",
+ "promise",
+ "void",
+ "never",
+ "map",
+ "set",
+]);
+
+export type ZodParsedType = keyof typeof ZodParsedType;
+
+export const getParsedType = (data: any): ZodParsedType => {
+ const t = typeof data;
+
+ switch (t) {
+ case "undefined":
+ return ZodParsedType.undefined;
+
+ case "string":
+ return ZodParsedType.string;
+
+ case "number":
+ return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
+
+ case "boolean":
+ return ZodParsedType.boolean;
+
+ case "function":
+ return ZodParsedType.function;
+
+ case "bigint":
+ return ZodParsedType.bigint;
+
+ case "symbol":
+ return ZodParsedType.symbol;
+
+ case "object":
+ if (Array.isArray(data)) {
+ return ZodParsedType.array;
+ }
+ if (data === null) {
+ return ZodParsedType.null;
+ }
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
+ return ZodParsedType.promise;
+ }
+ if (typeof Map !== "undefined" && data instanceof Map) {
+ return ZodParsedType.map;
+ }
+ if (typeof Set !== "undefined" && data instanceof Set) {
+ return ZodParsedType.set;
+ }
+ if (typeof Date !== "undefined" && data instanceof Date) {
+ return ZodParsedType.date;
+ }
+ return ZodParsedType.object;
+
+ default:
+ return ZodParsedType.unknown;
+ }
+};
diff --git a/tools/ui/node_modules/zod/src/v3/index.ts b/tools/ui/node_modules/zod/src/v3/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..a9dab57383baf1f27b9531f2dafc7a48c3dc4f81
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/index.ts
@@ -0,0 +1,4 @@
+import * as z from "./external.js";
+export * from "./external.js";
+export { z };
+export default z;
diff --git a/tools/ui/node_modules/zod/src/v3/locales/en.ts b/tools/ui/node_modules/zod/src/v3/locales/en.ts
new file mode 100644
index 0000000000000000000000000000000000000000..0264f82ef2e381ed4e855932c1992a10da28b015
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/locales/en.ts
@@ -0,0 +1,124 @@
+import { type ZodErrorMap, ZodIssueCode } from "../ZodError.js";
+import { util, ZodParsedType } from "../helpers/util.js";
+
+const errorMap: ZodErrorMap = (issue, _ctx) => {
+ let message: string;
+ switch (issue.code) {
+ case ZodIssueCode.invalid_type:
+ if (issue.received === ZodParsedType.undefined) {
+ message = "Required";
+ } else {
+ message = `Expected ${issue.expected}, received ${issue.received}`;
+ }
+ break;
+ case ZodIssueCode.invalid_literal:
+ message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
+ break;
+ case ZodIssueCode.unrecognized_keys:
+ message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
+ break;
+ case ZodIssueCode.invalid_union:
+ message = `Invalid input`;
+ break;
+ case ZodIssueCode.invalid_union_discriminator:
+ message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
+ break;
+ case ZodIssueCode.invalid_enum_value:
+ message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
+ break;
+ case ZodIssueCode.invalid_arguments:
+ message = `Invalid function arguments`;
+ break;
+ case ZodIssueCode.invalid_return_type:
+ message = `Invalid function return type`;
+ break;
+ case ZodIssueCode.invalid_date:
+ message = `Invalid date`;
+ break;
+ case ZodIssueCode.invalid_string:
+ if (typeof issue.validation === "object") {
+ if ("includes" in issue.validation) {
+ message = `Invalid input: must include "${issue.validation.includes}"`;
+
+ if (typeof issue.validation.position === "number") {
+ message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
+ }
+ } else if ("startsWith" in issue.validation) {
+ message = `Invalid input: must start with "${issue.validation.startsWith}"`;
+ } else if ("endsWith" in issue.validation) {
+ message = `Invalid input: must end with "${issue.validation.endsWith}"`;
+ } else {
+ util.assertNever(issue.validation);
+ }
+ } else if (issue.validation !== "regex") {
+ message = `Invalid ${issue.validation}`;
+ } else {
+ message = "Invalid";
+ }
+ break;
+ case ZodIssueCode.too_small:
+ if (issue.type === "array")
+ message = `Array must contain ${
+ issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`
+ } ${issue.minimum} element(s)`;
+ else if (issue.type === "string")
+ message = `String must contain ${
+ issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`
+ } ${issue.minimum} character(s)`;
+ else if (issue.type === "number")
+ message = `Number must be ${
+ issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `
+ }${issue.minimum}`;
+ else if (issue.type === "bigint")
+ message = `Number must be ${
+ issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `
+ }${issue.minimum}`;
+ else if (issue.type === "date")
+ message = `Date must be ${
+ issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `
+ }${new Date(Number(issue.minimum))}`;
+ else message = "Invalid input";
+ break;
+ case ZodIssueCode.too_big:
+ if (issue.type === "array")
+ message = `Array must contain ${
+ issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`
+ } ${issue.maximum} element(s)`;
+ else if (issue.type === "string")
+ message = `String must contain ${
+ issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`
+ } ${issue.maximum} character(s)`;
+ else if (issue.type === "number")
+ message = `Number must be ${
+ issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`
+ } ${issue.maximum}`;
+ else if (issue.type === "bigint")
+ message = `BigInt must be ${
+ issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`
+ } ${issue.maximum}`;
+ else if (issue.type === "date")
+ message = `Date must be ${
+ issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`
+ } ${new Date(Number(issue.maximum))}`;
+ else message = "Invalid input";
+ break;
+ case ZodIssueCode.custom:
+ message = `Invalid input`;
+ break;
+ case ZodIssueCode.invalid_intersection_types:
+ message = `Intersection results could not be merged`;
+ break;
+ case ZodIssueCode.not_multiple_of:
+ message = `Number must be a multiple of ${issue.multipleOf}`;
+ break;
+ case ZodIssueCode.not_finite:
+ message = "Number must be finite";
+ break;
+ default:
+ message = _ctx.defaultError;
+ util.assertNever(issue);
+ }
+ return { message };
+};
+
+export default errorMap;
diff --git a/tools/ui/node_modules/zod/src/v3/standard-schema.ts b/tools/ui/node_modules/zod/src/v3/standard-schema.ts
new file mode 100644
index 0000000000000000000000000000000000000000..07193fd135b70d85ed46a806faf921fea9370ad3
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/standard-schema.ts
@@ -0,0 +1,113 @@
+/**
+ * The Standard Schema interface.
+ */
+export type StandardSchemaV1 = {
+ /**
+ * The Standard Schema properties.
+ */
+ readonly "~standard": StandardSchemaV1.Props ;
+};
+
+export declare namespace StandardSchemaV1 {
+ /**
+ * The Standard Schema properties interface.
+ */
+ export interface Props {
+ /**
+ * The version number of the standard.
+ */
+ readonly version: 1;
+ /**
+ * The vendor name of the schema library.
+ */
+ readonly vendor: string;
+ /**
+ * Validates unknown input values.
+ */
+ readonly validate: (value: unknown) => Result | Promise>;
+ /**
+ * Inferred types associated with the schema.
+ */
+ readonly types?: Types | undefined;
+ }
+
+ /**
+ * The result interface of the validate function.
+ */
+ export type Result = SuccessResult | FailureResult;
+
+ /**
+ * The result interface if validation succeeds.
+ */
+ export interface SuccessResult {
+ /**
+ * The typed output value.
+ */
+ readonly value: Output;
+ /**
+ * The non-existent issues.
+ */
+ readonly issues?: undefined;
+ }
+
+ /**
+ * The result interface if validation fails.
+ */
+ export interface FailureResult {
+ /**
+ * The issues of failed validation.
+ */
+ readonly issues: ReadonlyArray;
+ }
+
+ /**
+ * The issue interface of the failure output.
+ */
+ export interface Issue {
+ /**
+ * The error message of the issue.
+ */
+ readonly message: string;
+ /**
+ * The path of the issue, if any.
+ */
+ readonly path?: ReadonlyArray | undefined;
+ }
+
+ /**
+ * The path segment interface of the issue.
+ */
+ export interface PathSegment {
+ /**
+ * The key representing a path segment.
+ */
+ readonly key: PropertyKey;
+ }
+
+ /**
+ * The Standard Schema types interface.
+ */
+ export interface Types {
+ /**
+ * The input type of the schema.
+ */
+ readonly input: Input;
+ /**
+ * The output type of the schema.
+ */
+ readonly output: Output;
+ }
+
+ /**
+ * Infers the input type of a Standard Schema.
+ */
+ export type InferInput = NonNullable["input"];
+
+ /**
+ * Infers the output type of a Standard Schema.
+ */
+ export type InferOutput = NonNullable["output"];
+
+ // biome-ignore lint/complexity/noUselessEmptyExport: needed for granular visibility control of TS namespace
+ export {};
+}
diff --git a/tools/ui/node_modules/zod/src/v3/tests/Mocker.ts b/tools/ui/node_modules/zod/src/v3/tests/Mocker.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c9fbdd51a5aecd3fc18b2c8e3b7fbf362e30ee60
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/Mocker.ts
@@ -0,0 +1,54 @@
+function getRandomInt(max: number) {
+ return Math.floor(Math.random() * Math.floor(max));
+}
+
+const testSymbol = Symbol("test");
+
+export class Mocker {
+ pick = (...args: any[]): any => {
+ return args[getRandomInt(args.length)];
+ };
+
+ get string(): string {
+ return Math.random().toString(36).substring(7);
+ }
+ get number(): number {
+ return Math.random() * 100;
+ }
+ get bigint(): bigint {
+ return BigInt(Math.floor(Math.random() * 10000));
+ }
+ get boolean(): boolean {
+ return Math.random() < 0.5;
+ }
+ get date(): Date {
+ return new Date(Math.floor(Date.now() * Math.random()));
+ }
+ get symbol(): symbol {
+ return testSymbol;
+ }
+ get null(): null {
+ return null;
+ }
+ get undefined(): undefined {
+ return undefined;
+ }
+ get stringOptional(): string | undefined {
+ return this.pick(this.string, this.undefined);
+ }
+ get stringNullable(): string | null {
+ return this.pick(this.string, this.null);
+ }
+ get numberOptional(): number | undefined {
+ return this.pick(this.number, this.undefined);
+ }
+ get numberNullable(): number | null {
+ return this.pick(this.number, this.null);
+ }
+ get booleanOptional(): boolean | undefined {
+ return this.pick(this.boolean, this.undefined);
+ }
+ get booleanNullable(): boolean | null {
+ return this.pick(this.boolean, this.null);
+ }
+}
diff --git a/tools/ui/node_modules/zod/src/v3/tests/all-errors.test.ts b/tools/ui/node_modules/zod/src/v3/tests/all-errors.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..212cfa88daedbe0dd66cef2bee0588f3faea9e05
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/all-errors.test.ts
@@ -0,0 +1,157 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+import { util } from "../helpers/util.js";
+
+const Test = z.object({
+ f1: z.number(),
+ f2: z.string().optional(),
+ f3: z.string().nullable(),
+ f4: z.array(z.object({ t: z.union([z.string(), z.boolean()]) })),
+});
+type TestFlattenedErrors = z.inferFlattenedErrors;
+type TestFormErrors = z.inferFlattenedErrors;
+
+test("default flattened errors type inference", () => {
+ type TestTypeErrors = {
+ formErrors: string[];
+ fieldErrors: { [P in keyof z.TypeOf]?: string[] };
+ };
+
+ util.assertEqual, TestTypeErrors>(true);
+ util.assertEqual, TestTypeErrors>(false);
+});
+
+test("custom flattened errors type inference", () => {
+ type ErrorType = { message: string; code: number };
+ type TestTypeErrors = {
+ formErrors: ErrorType[];
+ fieldErrors: {
+ [P in keyof z.TypeOf]?: ErrorType[];
+ };
+ };
+
+ util.assertEqual, TestTypeErrors>(false);
+ util.assertEqual, TestTypeErrors>(true);
+ util.assertEqual, TestTypeErrors>(false);
+});
+
+test("form errors type inference", () => {
+ type TestTypeErrors = {
+ formErrors: string[];
+ fieldErrors: { [P in keyof z.TypeOf]?: string[] };
+ };
+
+ util.assertEqual, TestTypeErrors>(true);
+});
+
+test(".flatten() type assertion", () => {
+ const parsed = Test.safeParse({}) as z.SafeParseError;
+ const validFlattenedErrors: TestFlattenedErrors = parsed.error.flatten(() => ({ message: "", code: 0 }));
+ // @ts-expect-error should fail assertion between `TestFlattenedErrors` and unmapped `flatten()`.
+ const invalidFlattenedErrors: TestFlattenedErrors = parsed.error.flatten();
+ const validFormErrors: TestFormErrors = parsed.error.flatten();
+ // @ts-expect-error should fail assertion between `TestFormErrors` and mapped `flatten()`.
+ const invalidFormErrors: TestFormErrors = parsed.error.flatten(() => ({
+ message: "string",
+ code: 0,
+ }));
+
+ [validFlattenedErrors, invalidFlattenedErrors, validFormErrors, invalidFormErrors];
+});
+
+test(".formErrors type assertion", () => {
+ const parsed = Test.safeParse({}) as z.SafeParseError;
+ const validFormErrors: TestFormErrors = parsed.error.formErrors;
+ // @ts-expect-error should fail assertion between `TestFlattenedErrors` and `.formErrors`.
+ const invalidFlattenedErrors: TestFlattenedErrors = parsed.error.formErrors;
+
+ [validFormErrors, invalidFlattenedErrors];
+});
+
+test("all errors", () => {
+ const propertySchema = z.string();
+ const schema = z
+ .object({
+ a: propertySchema,
+ b: propertySchema,
+ })
+ .refine(
+ (val) => {
+ return val.a === val.b;
+ },
+ { message: "Must be equal" }
+ );
+
+ try {
+ schema.parse({
+ a: "asdf",
+ b: "qwer",
+ });
+ } catch (error) {
+ if (error instanceof z.ZodError) {
+ expect(error.flatten()).toEqual({
+ formErrors: ["Must be equal"],
+ fieldErrors: {},
+ });
+ }
+ }
+
+ try {
+ schema.parse({
+ a: null,
+ b: null,
+ });
+ } catch (_error) {
+ const error = _error as z.ZodError;
+ expect(error.flatten()).toEqual({
+ formErrors: [],
+ fieldErrors: {
+ a: ["Expected string, received null"],
+ b: ["Expected string, received null"],
+ },
+ });
+
+ expect(error.flatten((iss) => iss.message.toUpperCase())).toEqual({
+ formErrors: [],
+ fieldErrors: {
+ a: ["EXPECTED STRING, RECEIVED NULL"],
+ b: ["EXPECTED STRING, RECEIVED NULL"],
+ },
+ });
+ // Test identity
+
+ expect(error.flatten((i: z.ZodIssue) => i)).toEqual({
+ formErrors: [],
+ fieldErrors: {
+ a: [
+ {
+ code: "invalid_type",
+ expected: "string",
+ message: "Expected string, received null",
+ path: ["a"],
+ received: "null",
+ },
+ ],
+ b: [
+ {
+ code: "invalid_type",
+ expected: "string",
+ message: "Expected string, received null",
+ path: ["b"],
+ received: "null",
+ },
+ ],
+ },
+ });
+ // Test mapping
+ expect(error.flatten((i: z.ZodIssue) => i.message.length)).toEqual({
+ formErrors: [],
+ fieldErrors: {
+ a: ["Expected string, received null".length],
+ b: ["Expected string, received null".length],
+ },
+ });
+ }
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/anyunknown.test.ts b/tools/ui/node_modules/zod/src/v3/tests/anyunknown.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..49d07db2c8b3a4600a6f7eeb0f51e1ec27228d98
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/anyunknown.test.ts
@@ -0,0 +1,28 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+import { util } from "../helpers/util.js";
+
+test("check any inference", () => {
+ const t1 = z.any();
+ t1.optional();
+ t1.nullable();
+ type t1 = z.infer;
+ util.assertEqual(true);
+});
+
+test("check unknown inference", () => {
+ const t1 = z.unknown();
+ t1.optional();
+ t1.nullable();
+ type t1 = z.infer;
+ util.assertEqual(true);
+});
+
+test("check never inference", () => {
+ const t1 = z.never();
+ expect(() => t1.parse(undefined)).toThrow();
+ expect(() => t1.parse("asdf")).toThrow();
+ expect(() => t1.parse(null)).toThrow();
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/array.test.ts b/tools/ui/node_modules/zod/src/v3/tests/array.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..df5b9d373ce740719c95908d00c11038a939e06c
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/array.test.ts
@@ -0,0 +1,71 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+import { util } from "../helpers/util.js";
+
+const minTwo = z.string().array().min(2);
+const maxTwo = z.string().array().max(2);
+const justTwo = z.string().array().length(2);
+const intNum = z.string().array().nonempty();
+const nonEmptyMax = z.string().array().nonempty().max(2);
+
+type t1 = z.infer;
+util.assertEqual<[string, ...string[]], t1>(true);
+
+type t2 = z.infer;
+util.assertEqual(true);
+
+test("passing validations", () => {
+ minTwo.parse(["a", "a"]);
+ minTwo.parse(["a", "a", "a"]);
+ maxTwo.parse(["a", "a"]);
+ maxTwo.parse(["a"]);
+ justTwo.parse(["a", "a"]);
+ intNum.parse(["a"]);
+ nonEmptyMax.parse(["a"]);
+});
+
+test("failing validations", () => {
+ expect(() => minTwo.parse(["a"])).toThrow();
+ expect(() => maxTwo.parse(["a", "a", "a"])).toThrow();
+ expect(() => justTwo.parse(["a"])).toThrow();
+ expect(() => justTwo.parse(["a", "a", "a"])).toThrow();
+ expect(() => intNum.parse([])).toThrow();
+ expect(() => nonEmptyMax.parse([])).toThrow();
+ expect(() => nonEmptyMax.parse(["a", "a", "a"])).toThrow();
+});
+
+test("parse empty array in nonempty", () => {
+ expect(() =>
+ z
+ .array(z.string())
+ .nonempty()
+ .parse([] as any)
+ ).toThrow();
+});
+
+test("get element", () => {
+ justTwo.element.parse("asdf");
+ expect(() => justTwo.element.parse(12)).toThrow();
+});
+
+test("continue parsing despite array size error", () => {
+ const schema = z.object({
+ people: z.string().array().min(2),
+ });
+
+ const result = schema.safeParse({
+ people: [123],
+ });
+ expect(result.success).toEqual(false);
+ if (!result.success) {
+ expect(result.error.issues.length).toEqual(2);
+ }
+});
+
+test("parse should fail given sparse array", () => {
+ const schema = z.array(z.string()).nonempty().min(1).max(3);
+
+ expect(() => schema.parse(new Array(3))).toThrow();
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/async-parsing.test.ts b/tools/ui/node_modules/zod/src/v3/tests/async-parsing.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..01dbc4f1e1acee18b28771fedfef1eb0fc8e4928
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/async-parsing.test.ts
@@ -0,0 +1,388 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+
+/// string
+const stringSchema = z.string();
+
+test("string async parse", async () => {
+ const goodData = "XXX";
+ const badData = 12;
+
+ const goodResult = await stringSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(goodData);
+
+ const badResult = await stringSchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(false);
+ if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// number
+const numberSchema = z.number();
+test("number async parse", async () => {
+ const goodData = 1234.2353;
+ const badData = "1234";
+
+ const goodResult = await numberSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(goodData);
+
+ const badResult = await numberSchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(false);
+ if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// bigInt
+const bigIntSchema = z.bigint();
+test("bigInt async parse", async () => {
+ const goodData = BigInt(145);
+ const badData = 134;
+
+ const goodResult = await bigIntSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(goodData);
+
+ const badResult = await bigIntSchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(false);
+ if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// boolean
+const booleanSchema = z.boolean();
+test("boolean async parse", async () => {
+ const goodData = true;
+ const badData = 1;
+
+ const goodResult = await booleanSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(goodData);
+
+ const badResult = await booleanSchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(false);
+ if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// date
+const dateSchema = z.date();
+test("date async parse", async () => {
+ const goodData = new Date();
+ const badData = new Date().toISOString();
+
+ const goodResult = await dateSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(goodData);
+
+ const badResult = await dateSchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(false);
+ if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// undefined
+const undefinedSchema = z.undefined();
+test("undefined async parse", async () => {
+ const goodData = undefined;
+ const badData = "XXX";
+
+ const goodResult = await undefinedSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(undefined);
+
+ const badResult = await undefinedSchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(false);
+ if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// null
+const nullSchema = z.null();
+test("null async parse", async () => {
+ const goodData = null;
+ const badData = undefined;
+
+ const goodResult = await nullSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(goodData);
+
+ const badResult = await nullSchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(false);
+ if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// any
+const anySchema = z.any();
+test("any async parse", async () => {
+ const goodData = [{}];
+ // const badData = 'XXX';
+
+ const goodResult = await anySchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(goodData);
+
+ // const badResult = await anySchema.safeParseAsync(badData);
+ // expect(badResult.success).toBe(false);
+ // if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// unknown
+const unknownSchema = z.unknown();
+test("unknown async parse", async () => {
+ const goodData = ["asdf", 124, () => {}];
+ // const badData = 'XXX';
+
+ const goodResult = await unknownSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(goodData);
+
+ // const badResult = await unknownSchema.safeParseAsync(badData);
+ // expect(badResult.success).toBe(false);
+ // if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// void
+const voidSchema = z.void();
+test("void async parse", async () => {
+ const goodData = undefined;
+ const badData = 0;
+
+ const goodResult = await voidSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(goodData);
+
+ const badResult = await voidSchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(false);
+ if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// array
+const arraySchema = z.array(z.string());
+test("array async parse", async () => {
+ const goodData = ["XXX"];
+ const badData = "XXX";
+
+ const goodResult = await arraySchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(goodData);
+
+ const badResult = await arraySchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(false);
+ if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// object
+const objectSchema = z.object({ string: z.string() });
+test("object async parse", async () => {
+ const goodData = { string: "XXX" };
+ const badData = { string: 12 };
+
+ const goodResult = await objectSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(goodData);
+
+ const badResult = await objectSchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(false);
+ if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// union
+const unionSchema = z.union([z.string(), z.undefined()]);
+test("union async parse", async () => {
+ const goodData = undefined;
+ const badData = null;
+
+ const goodResult = await unionSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(goodData);
+
+ const badResult = await unionSchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(false);
+ if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// record
+const recordSchema = z.record(z.object({}));
+test("record async parse", async () => {
+ const goodData = { adsf: {}, asdf: {} };
+ const badData = [{}];
+
+ const goodResult = await recordSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(goodData);
+
+ const badResult = await recordSchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(false);
+ if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// function
+const functionSchema = z.function();
+test("function async parse", async () => {
+ const goodData = () => {};
+ const badData = "XXX";
+
+ const goodResult = await functionSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(typeof goodResult.data).toEqual("function");
+
+ const badResult = await functionSchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(false);
+ if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// literal
+const literalSchema = z.literal("asdf");
+test("literal async parse", async () => {
+ const goodData = "asdf";
+ const badData = "asdff";
+
+ const goodResult = await literalSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(goodData);
+
+ const badResult = await literalSchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(false);
+ if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// enum
+const enumSchema = z.enum(["fish", "whale"]);
+test("enum async parse", async () => {
+ const goodData = "whale";
+ const badData = "leopard";
+
+ const goodResult = await enumSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(goodData);
+
+ const badResult = await enumSchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(false);
+ if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// nativeEnum
+enum nativeEnumTest {
+ asdf = "qwer",
+}
+// @ts-ignore
+const nativeEnumSchema = z.nativeEnum(nativeEnumTest);
+test("nativeEnum async parse", async () => {
+ const goodData = nativeEnumTest.asdf;
+ const badData = "asdf";
+
+ const goodResult = await nativeEnumSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) expect(goodResult.data).toEqual(goodData);
+
+ const badResult = await nativeEnumSchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(false);
+ if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError);
+});
+
+/// promise
+const promiseSchema = z.promise(z.number());
+test("promise async parse good", async () => {
+ const goodData = Promise.resolve(123);
+
+ const goodResult = await promiseSchema.safeParseAsync(goodData);
+ expect(goodResult.success).toBe(true);
+ if (goodResult.success) {
+ expect(goodResult.data).toBeInstanceOf(Promise);
+ const data = await goodResult.data;
+ expect(data).toEqual(123);
+ // expect(goodResult.data).resolves.toEqual(124);
+ // return goodResult.data;
+ } else {
+ throw new Error("success should be true");
+ }
+});
+
+test("promise async parse bad", async () => {
+ const badData = Promise.resolve("XXX");
+ const badResult = await promiseSchema.safeParseAsync(badData);
+ expect(badResult.success).toBe(true);
+ if (badResult.success) {
+ await expect(badResult.data).rejects.toBeInstanceOf(z.ZodError);
+ } else {
+ throw new Error("success should be true");
+ }
+});
+
+test("async validation non-empty strings", async () => {
+ const base = z.object({
+ hello: z.string().refine((x) => x && x.length > 0),
+ foo: z.string().refine((x) => x && x.length > 0),
+ });
+
+ const testval = { hello: "", foo: "" };
+ const result1 = base.safeParse(testval);
+ const result2 = base.safeParseAsync(testval);
+
+ const r1 = result1;
+ await result2.then((r2) => {
+ if (r1.success === false && r2.success === false) expect(r1.error.issues.length).toBe(r2.error.issues.length); // <--- r1 has length 2, r2 has length 1
+ });
+});
+
+test("async validation multiple errors 1", async () => {
+ const base = z.object({
+ hello: z.string(),
+ foo: z.number(),
+ });
+
+ const testval = { hello: 3, foo: "hello" };
+ const result1 = base.safeParse(testval);
+ const result2 = base.safeParseAsync(testval);
+
+ const r1 = result1;
+ await result2.then((r2) => {
+ if (r1.success === false && r2.success === false) expect(r2.error.issues.length).toBe(r1.error.issues.length);
+ });
+});
+
+test("async validation multiple errors 2", async () => {
+ const base = (is_async?: boolean) =>
+ z.object({
+ hello: z.string(),
+ foo: z.object({
+ bar: z.number().refine(is_async ? async () => false : () => false),
+ }),
+ });
+
+ const testval = { hello: 3, foo: { bar: 4 } };
+ const result1 = base().safeParse(testval);
+ const result2 = base(true).safeParseAsync(testval);
+
+ const r1 = result1;
+ await result2.then((r2) => {
+ if (r1.success === false && r2.success === false) expect(r2.error.issues.length).toBe(r1.error.issues.length);
+ });
+});
+
+test("ensure early async failure prevents follow-up refinement checks", async () => {
+ let count = 0;
+ const base = z.object({
+ hello: z.string(),
+ foo: z
+ .number()
+ .refine(async () => {
+ count++;
+ return true;
+ })
+ .refine(async () => {
+ count++;
+ return true;
+ }, "Good"),
+ });
+
+ const testval = { hello: "bye", foo: 3 };
+ const result = await base.safeParseAsync(testval);
+ if (result.success === false) {
+ expect(result.error.issues.length).toBe(1);
+ expect(count).toBe(1);
+ }
+
+ // await result.then((r) => {
+ // if (r.success === false) expect(r.error.issues.length).toBe(1);
+ // expect(count).toBe(2);
+ // });
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/async-refinements.test.ts b/tools/ui/node_modules/zod/src/v3/tests/async-refinements.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..509475db62905630d39959ef3af2c0033b55b18a
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/async-refinements.test.ts
@@ -0,0 +1,46 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+
+test("parse async test", async () => {
+ const schema1 = z.string().refine(async (_val) => false);
+ expect(() => schema1.parse("asdf")).toThrow();
+
+ const schema2 = z.string().refine((_val) => Promise.resolve(true));
+ return await expect(() => schema2.parse("asdf")).toThrow();
+});
+
+test("parseAsync async test", async () => {
+ const schema1 = z.string().refine(async (_val) => true);
+ await schema1.parseAsync("asdf");
+
+ const schema2 = z.string().refine(async (_val) => false);
+ return await expect(schema2.parseAsync("asdf")).rejects.toBeDefined();
+ // expect(async () => await schema2.parseAsync('asdf')).toThrow();
+});
+
+test("parseAsync async test", async () => {
+ // expect.assertions(2);
+
+ const schema1 = z.string().refine((_val) => Promise.resolve(true));
+ const v1 = await schema1.parseAsync("asdf");
+ expect(v1).toEqual("asdf");
+
+ const schema2 = z.string().refine((_val) => Promise.resolve(false));
+ await expect(schema2.parseAsync("asdf")).rejects.toBeDefined();
+
+ const schema3 = z.string().refine((_val) => Promise.resolve(true));
+ await expect(schema3.parseAsync("asdf")).resolves.toEqual("asdf");
+ return await expect(schema3.parseAsync("qwer")).resolves.toEqual("qwer");
+});
+
+test("parseAsync async with value", async () => {
+ const schema1 = z.string().refine(async (val) => {
+ return val.length > 5;
+ });
+ await expect(schema1.parseAsync("asdf")).rejects.toBeDefined();
+
+ const v = await schema1.parseAsync("asdf123");
+ return await expect(v).toEqual("asdf123");
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/base.test.ts b/tools/ui/node_modules/zod/src/v3/tests/base.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ab743d565d365ec62c13dde7506419c0468b4f92
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/base.test.ts
@@ -0,0 +1,29 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+import { util } from "../helpers/util.js";
+
+test("type guard", () => {
+ const stringToNumber = z.string().transform((arg) => arg.length);
+
+ const s1 = z.object({
+ stringToNumber,
+ });
+ type t1 = z.input;
+
+ const data = { stringToNumber: "asdf" };
+ const parsed = s1.safeParse(data);
+ if (parsed.success) {
+ util.assertEqual(true);
+ }
+});
+
+test("test this binding", () => {
+ const callback = (predicate: (val: string) => boolean) => {
+ return predicate("hello");
+ };
+
+ expect(callback((value) => z.string().safeParse(value).success)).toBe(true); // true
+ expect(callback((value) => z.string().safeParse(value).success)).toBe(true); // true
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/bigint.test.ts b/tools/ui/node_modules/zod/src/v3/tests/bigint.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..9692f570018d981d89165772d23a68c6573f2f17
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/bigint.test.ts
@@ -0,0 +1,55 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+
+const gtFive = z.bigint().gt(BigInt(5));
+const gteFive = z.bigint().gte(BigInt(5));
+const ltFive = z.bigint().lt(BigInt(5));
+const lteFive = z.bigint().lte(BigInt(5));
+const positive = z.bigint().positive();
+const negative = z.bigint().negative();
+const nonnegative = z.bigint().nonnegative();
+const nonpositive = z.bigint().nonpositive();
+const multipleOfFive = z.bigint().multipleOf(BigInt(5));
+
+test("passing validations", () => {
+ z.bigint().parse(BigInt(1));
+ z.bigint().parse(BigInt(0));
+ z.bigint().parse(BigInt(-1));
+ gtFive.parse(BigInt(6));
+ gteFive.parse(BigInt(5));
+ gteFive.parse(BigInt(6));
+ ltFive.parse(BigInt(4));
+ lteFive.parse(BigInt(5));
+ lteFive.parse(BigInt(4));
+ positive.parse(BigInt(3));
+ negative.parse(BigInt(-2));
+ nonnegative.parse(BigInt(0));
+ nonnegative.parse(BigInt(7));
+ nonpositive.parse(BigInt(0));
+ nonpositive.parse(BigInt(-12));
+ multipleOfFive.parse(BigInt(15));
+});
+
+test("failing validations", () => {
+ expect(() => gtFive.parse(BigInt(5))).toThrow();
+ expect(() => gteFive.parse(BigInt(4))).toThrow();
+ expect(() => ltFive.parse(BigInt(5))).toThrow();
+ expect(() => lteFive.parse(BigInt(6))).toThrow();
+ expect(() => positive.parse(BigInt(0))).toThrow();
+ expect(() => positive.parse(BigInt(-2))).toThrow();
+ expect(() => negative.parse(BigInt(0))).toThrow();
+ expect(() => negative.parse(BigInt(3))).toThrow();
+ expect(() => nonnegative.parse(BigInt(-1))).toThrow();
+ expect(() => nonpositive.parse(BigInt(1))).toThrow();
+ expect(() => multipleOfFive.parse(BigInt(13))).toThrow();
+});
+
+test("min max getters", () => {
+ expect(z.bigint().min(BigInt(5)).minValue).toEqual(BigInt(5));
+ expect(z.bigint().min(BigInt(5)).min(BigInt(10)).minValue).toEqual(BigInt(10));
+
+ expect(z.bigint().max(BigInt(5)).maxValue).toEqual(BigInt(5));
+ expect(z.bigint().max(BigInt(5)).max(BigInt(1)).maxValue).toEqual(BigInt(1));
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/branded.test.ts b/tools/ui/node_modules/zod/src/v3/tests/branded.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..b19786cf6bf501e1b23396df08fdfec268cc173f
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/branded.test.ts
@@ -0,0 +1,53 @@
+// @ts-ignore TS6133
+import { test } from "vitest";
+
+import * as z from "zod/v3";
+import { util } from "../helpers/util.js";
+
+test("branded types", () => {
+ const mySchema = z
+ .object({
+ name: z.string(),
+ })
+ .brand<"superschema">();
+
+ // simple branding
+ type MySchema = z.infer;
+ util.assertEqual(true);
+
+ const doStuff = (arg: MySchema) => arg;
+ doStuff(mySchema.parse({ name: "hello there" }));
+
+ // inheritance
+ const extendedSchema = mySchema.brand<"subschema">();
+ type ExtendedSchema = z.infer;
+ util.assertEqual & z.BRAND<"subschema">>(true);
+
+ doStuff(extendedSchema.parse({ name: "hello again" }));
+
+ // number branding
+ const numberSchema = z.number().brand<42>();
+ type NumberSchema = z.infer;
+ util.assertEqual(true);
+
+ // symbol branding
+ const MyBrand: unique symbol = Symbol("hello");
+ type MyBrand = typeof MyBrand;
+ const symbolBrand = z.number().brand<"sup">().brand();
+ type SymbolBrand = z.infer;
+ // number & { [z.BRAND]: { sup: true, [MyBrand]: true } }
+ util.assertEqual & z.BRAND>(true);
+
+ // keeping brands out of input types
+ const age = z.number().brand<"age">();
+
+ type Age = z.infer;
+ type AgeInput = z.input;
+
+ util.assertEqual(false);
+ util.assertEqual(true);
+ util.assertEqual, Age>(true);
+
+ // @ts-expect-error
+ doStuff({ name: "hello there!" });
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/catch.test.ts b/tools/ui/node_modules/zod/src/v3/tests/catch.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..94d12aa2b8314479e71472f451cba35c7b1c7fcd
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/catch.test.ts
@@ -0,0 +1,220 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import { z } from "zod/v3";
+import { util } from "../helpers/util.js";
+
+test("basic catch", () => {
+ expect(z.string().catch("default").parse(undefined)).toBe("default");
+});
+
+test("catch fn does not run when parsing succeeds", () => {
+ let isCalled = false;
+ const cb = () => {
+ isCalled = true;
+ return "asdf";
+ };
+ expect(z.string().catch(cb).parse("test")).toBe("test");
+ expect(isCalled).toEqual(false);
+});
+
+test("basic catch async", async () => {
+ const result = await z.string().catch("default").parseAsync(1243);
+ expect(result).toBe("default");
+});
+
+test("catch replace wrong types", () => {
+ expect(z.string().catch("default").parse(true)).toBe("default");
+ expect(z.string().catch("default").parse(true)).toBe("default");
+ expect(z.string().catch("default").parse(15)).toBe("default");
+ expect(z.string().catch("default").parse([])).toBe("default");
+ expect(z.string().catch("default").parse(new Map())).toBe("default");
+ expect(z.string().catch("default").parse(new Set())).toBe("default");
+ expect(z.string().catch("default").parse({})).toBe("default");
+});
+
+test("catch with transform", () => {
+ const stringWithDefault = z
+ .string()
+ .transform((val) => val.toUpperCase())
+ .catch("default");
+ expect(stringWithDefault.parse(undefined)).toBe("default");
+ expect(stringWithDefault.parse(15)).toBe("default");
+ expect(stringWithDefault).toBeInstanceOf(z.ZodCatch);
+ expect(stringWithDefault._def.innerType).toBeInstanceOf(z.ZodEffects);
+ expect(stringWithDefault._def.innerType._def.schema).toBeInstanceOf(z.ZodSchema);
+
+ type inp = z.input;
+ util.assertEqual(true);
+ type out = z.output;
+ util.assertEqual(true);
+});
+
+test("catch on existing optional", () => {
+ const stringWithDefault = z.string().optional().catch("asdf");
+ expect(stringWithDefault.parse(undefined)).toBe(undefined);
+ expect(stringWithDefault.parse(15)).toBe("asdf");
+ expect(stringWithDefault).toBeInstanceOf(z.ZodCatch);
+ expect(stringWithDefault._def.innerType).toBeInstanceOf(z.ZodOptional);
+ expect(stringWithDefault._def.innerType._def.innerType).toBeInstanceOf(z.ZodString);
+
+ type inp = z.input;
+ util.assertEqual(true);
+ type out = z.output;
+ util.assertEqual(true);
+});
+
+test("optional on catch", () => {
+ const stringWithDefault = z.string().catch("asdf").optional();
+
+ type inp = z.input;
+ util.assertEqual(true);
+ type out = z.output;
+ util.assertEqual(true);
+});
+
+test("complex chain example", () => {
+ const complex = z
+ .string()
+ .catch("asdf")
+ .transform((val) => val + "!")
+ .transform((val) => val.toUpperCase())
+ .catch("qwer")
+ .removeCatch()
+ .optional()
+ .catch("asdfasdf");
+
+ expect(complex.parse("qwer")).toBe("QWER!");
+ expect(complex.parse(15)).toBe("ASDF!");
+ expect(complex.parse(true)).toBe("ASDF!");
+});
+
+test("removeCatch", () => {
+ const stringWithRemovedDefault = z.string().catch("asdf").removeCatch();
+
+ type out = z.output;
+ util.assertEqual(true);
+});
+
+test("nested", () => {
+ const inner = z.string().catch("asdf");
+ const outer = z.object({ inner }).catch({
+ inner: "asdf",
+ });
+ type input = z.input;
+ util.assertEqual (true);
+ type out = z.output;
+ util.assertEqual(true);
+ expect(outer.parse(undefined)).toEqual({ inner: "asdf" });
+ expect(outer.parse({})).toEqual({ inner: "asdf" });
+ expect(outer.parse({ inner: undefined })).toEqual({ inner: "asdf" });
+});
+
+test("chained catch", () => {
+ const stringWithDefault = z.string().catch("inner").catch("outer");
+ const result = stringWithDefault.parse(undefined);
+ expect(result).toEqual("inner");
+ const resultDiff = stringWithDefault.parse(5);
+ expect(resultDiff).toEqual("inner");
+});
+
+test("factory", () => {
+ z.ZodCatch.create(z.string(), {
+ catch: "asdf",
+ }).parse(undefined);
+});
+
+test("native enum", () => {
+ enum Fruits {
+ apple = "apple",
+ orange = "orange",
+ }
+
+ const schema = z.object({
+ fruit: z.nativeEnum(Fruits).catch(Fruits.apple),
+ });
+
+ expect(schema.parse({})).toEqual({ fruit: Fruits.apple });
+ expect(schema.parse({ fruit: 15 })).toEqual({ fruit: Fruits.apple });
+});
+
+test("enum", () => {
+ const schema = z.object({
+ fruit: z.enum(["apple", "orange"]).catch("apple"),
+ });
+
+ expect(schema.parse({})).toEqual({ fruit: "apple" });
+ expect(schema.parse({ fruit: true })).toEqual({ fruit: "apple" });
+ expect(schema.parse({ fruit: 15 })).toEqual({ fruit: "apple" });
+});
+
+test("reported issues with nested usage", () => {
+ const schema = z.object({
+ string: z.string(),
+ obj: z.object({
+ sub: z.object({
+ lit: z.literal("a"),
+ subCatch: z.number().catch(23),
+ }),
+ midCatch: z.number().catch(42),
+ }),
+ number: z.number().catch(0),
+ bool: z.boolean(),
+ });
+
+ try {
+ schema.parse({
+ string: {},
+ obj: {
+ sub: {
+ lit: "b",
+ subCatch: "24",
+ },
+ midCatch: 444,
+ },
+ number: "",
+ bool: "yes",
+ });
+ } catch (error) {
+ const issues = (error as z.ZodError).issues;
+
+ expect(issues.length).toEqual(3);
+ expect(issues[0].message).toMatch("string");
+ expect(issues[1].message).toMatch("literal");
+ expect(issues[2].message).toMatch("boolean");
+ }
+});
+
+test("catch error", () => {
+ let catchError: z.ZodError | undefined = undefined;
+
+ const schema = z.object({
+ age: z.number(),
+ name: z.string().catch((ctx) => {
+ catchError = ctx.error;
+
+ return "John Doe";
+ }),
+ });
+
+ const result = schema.safeParse({
+ age: null,
+ name: null,
+ });
+
+ expect(result.success).toEqual(false);
+ expect(!result.success && result.error.issues.length).toEqual(1);
+ expect(!result.success && result.error.issues[0].message).toMatch("number");
+
+ expect(catchError).toBeInstanceOf(z.ZodError);
+ expect(catchError !== undefined && (catchError as z.ZodError).issues.length).toEqual(1);
+ expect(catchError !== undefined && (catchError as z.ZodError).issues[0].message).toMatch("string");
+});
+
+test("ctx.input", () => {
+ const schema = z.string().catch((ctx) => {
+ return String(ctx.input);
+ });
+
+ expect(schema.parse(123)).toEqual("123");
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/coerce.test.ts b/tools/ui/node_modules/zod/src/v3/tests/coerce.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..1f5300416a727575e72a68cdcfcee6baad446ef3
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/coerce.test.ts
@@ -0,0 +1,133 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+
+test("string coercion", () => {
+ const schema = z.coerce.string();
+ expect(schema.parse("sup")).toEqual("sup");
+ expect(schema.parse("")).toEqual("");
+ expect(schema.parse(12)).toEqual("12");
+ expect(schema.parse(0)).toEqual("0");
+ expect(schema.parse(-12)).toEqual("-12");
+ expect(schema.parse(3.14)).toEqual("3.14");
+ expect(schema.parse(BigInt(15))).toEqual("15");
+ expect(schema.parse(Number.NaN)).toEqual("NaN");
+ expect(schema.parse(Number.POSITIVE_INFINITY)).toEqual("Infinity");
+ expect(schema.parse(Number.NEGATIVE_INFINITY)).toEqual("-Infinity");
+ expect(schema.parse(true)).toEqual("true");
+ expect(schema.parse(false)).toEqual("false");
+ expect(schema.parse(null)).toEqual("null");
+ expect(schema.parse(undefined)).toEqual("undefined");
+ expect(schema.parse({ hello: "world!" })).toEqual("[object Object]");
+ expect(schema.parse(["item", "another_item"])).toEqual("item,another_item");
+ expect(schema.parse([])).toEqual("");
+ expect(schema.parse(new Date("2022-01-01T00:00:00.000Z"))).toEqual(new Date("2022-01-01T00:00:00.000Z").toString());
+});
+
+test("number coercion", () => {
+ const schema = z.coerce.number();
+ expect(schema.parse("12")).toEqual(12);
+ expect(schema.parse("0")).toEqual(0);
+ expect(schema.parse("-12")).toEqual(-12);
+ expect(schema.parse("3.14")).toEqual(3.14);
+ expect(schema.parse("")).toEqual(0);
+ expect(() => schema.parse("NOT_A_NUMBER")).toThrow(); // z.ZodError
+ expect(schema.parse(12)).toEqual(12);
+ expect(schema.parse(0)).toEqual(0);
+ expect(schema.parse(-12)).toEqual(-12);
+ expect(schema.parse(3.14)).toEqual(3.14);
+ expect(schema.parse(BigInt(15))).toEqual(15);
+ expect(() => schema.parse(Number.NaN)).toThrow(); // z.ZodError
+ expect(schema.parse(Number.POSITIVE_INFINITY)).toEqual(Number.POSITIVE_INFINITY);
+ expect(schema.parse(Number.NEGATIVE_INFINITY)).toEqual(Number.NEGATIVE_INFINITY);
+ expect(schema.parse(true)).toEqual(1);
+ expect(schema.parse(false)).toEqual(0);
+ expect(schema.parse(null)).toEqual(0);
+ expect(() => schema.parse(undefined)).toThrow(); // z.ZodError
+ expect(() => schema.parse({ hello: "world!" })).toThrow(); // z.ZodError
+ expect(() => schema.parse(["item", "another_item"])).toThrow(); // z.ZodError
+ expect(schema.parse([])).toEqual(0);
+ expect(schema.parse(new Date(1670139203496))).toEqual(1670139203496);
+});
+
+test("boolean coercion", () => {
+ const schema = z.coerce.boolean();
+ expect(schema.parse("true")).toEqual(true);
+ expect(schema.parse("false")).toEqual(true);
+ expect(schema.parse("0")).toEqual(true);
+ expect(schema.parse("1")).toEqual(true);
+ expect(schema.parse("")).toEqual(false);
+ expect(schema.parse(1)).toEqual(true);
+ expect(schema.parse(0)).toEqual(false);
+ expect(schema.parse(-1)).toEqual(true);
+ expect(schema.parse(3.14)).toEqual(true);
+ expect(schema.parse(BigInt(15))).toEqual(true);
+ expect(schema.parse(Number.NaN)).toEqual(false);
+ expect(schema.parse(Number.POSITIVE_INFINITY)).toEqual(true);
+ expect(schema.parse(Number.NEGATIVE_INFINITY)).toEqual(true);
+ expect(schema.parse(true)).toEqual(true);
+ expect(schema.parse(false)).toEqual(false);
+ expect(schema.parse(null)).toEqual(false);
+ expect(schema.parse(undefined)).toEqual(false);
+ expect(schema.parse({ hello: "world!" })).toEqual(true);
+ expect(schema.parse(["item", "another_item"])).toEqual(true);
+ expect(schema.parse([])).toEqual(true);
+ expect(schema.parse(new Date(1670139203496))).toEqual(true);
+});
+
+test("bigint coercion", () => {
+ const schema = z.coerce.bigint();
+ expect(schema.parse("5")).toEqual(BigInt(5));
+ expect(schema.parse("0")).toEqual(BigInt(0));
+ expect(schema.parse("-5")).toEqual(BigInt(-5));
+ expect(() => schema.parse("3.14")).toThrow(); // not a z.ZodError!
+ expect(schema.parse("")).toEqual(BigInt(0));
+ expect(() => schema.parse("NOT_A_NUMBER")).toThrow(); // not a z.ZodError!
+ expect(schema.parse(5)).toEqual(BigInt(5));
+ expect(schema.parse(0)).toEqual(BigInt(0));
+ expect(schema.parse(-5)).toEqual(BigInt(-5));
+ expect(() => schema.parse(3.14)).toThrow(); // not a z.ZodError!
+ expect(schema.parse(BigInt(5))).toEqual(BigInt(5));
+ expect(() => schema.parse(Number.NaN)).toThrow(); // not a z.ZodError!
+ expect(() => schema.parse(Number.POSITIVE_INFINITY)).toThrow(); // not a z.ZodError!
+ expect(() => schema.parse(Number.NEGATIVE_INFINITY)).toThrow(); // not a z.ZodError!
+ expect(schema.parse(true)).toEqual(BigInt(1));
+ expect(schema.parse(false)).toEqual(BigInt(0));
+ expect(() => schema.parse(null)).toThrow(); // not a z.ZodError!
+ expect(() => schema.parse(undefined)).toThrow(); // not a z.ZodError!
+ expect(() => schema.parse({ hello: "world!" })).toThrow(); // not a z.ZodError!
+ expect(() => schema.parse(["item", "another_item"])).toThrow(); // not a z.ZodError!
+ expect(schema.parse([])).toEqual(BigInt(0));
+ expect(schema.parse(new Date(1670139203496))).toEqual(BigInt(1670139203496));
+});
+
+test("date coercion", () => {
+ const schema = z.coerce.date();
+ expect(schema.parse(new Date().toDateString())).toBeInstanceOf(Date);
+ expect(schema.parse(new Date().toISOString())).toBeInstanceOf(Date);
+ expect(schema.parse(new Date().toUTCString())).toBeInstanceOf(Date);
+ expect(schema.parse("5")).toBeInstanceOf(Date);
+ expect(schema.parse("2000-01-01")).toBeInstanceOf(Date);
+ // expect(schema.parse("0")).toBeInstanceOf(Date);
+ // expect(schema.parse("-5")).toBeInstanceOf(Date);
+ // expect(schema.parse("3.14")).toBeInstanceOf(Date);
+ expect(() => schema.parse("")).toThrow(); // z.ZodError
+ expect(() => schema.parse("NOT_A_DATE")).toThrow(); // z.ZodError
+ expect(schema.parse(5)).toBeInstanceOf(Date);
+ expect(schema.parse(0)).toBeInstanceOf(Date);
+ expect(schema.parse(-5)).toBeInstanceOf(Date);
+ expect(schema.parse(3.14)).toBeInstanceOf(Date);
+ expect(() => schema.parse(BigInt(5))).toThrow(); // not a z.ZodError!
+ expect(() => schema.parse(Number.NaN)).toThrow(); // z.ZodError
+ expect(() => schema.parse(Number.POSITIVE_INFINITY)).toThrow(); // z.ZodError
+ expect(() => schema.parse(Number.NEGATIVE_INFINITY)).toThrow(); // z.ZodError
+ expect(schema.parse(true)).toBeInstanceOf(Date);
+ expect(schema.parse(false)).toBeInstanceOf(Date);
+ expect(schema.parse(null)).toBeInstanceOf(Date);
+ expect(() => schema.parse(undefined)).toThrow(); // z.ZodError
+ expect(() => schema.parse({ hello: "world!" })).toThrow(); // z.ZodError
+ expect(() => schema.parse(["item", "another_item"])).toThrow(); // z.ZodError
+ expect(() => schema.parse([])).toThrow(); // z.ZodError
+ expect(schema.parse(new Date())).toBeInstanceOf(Date);
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/complex.test.ts b/tools/ui/node_modules/zod/src/v3/tests/complex.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..1d0303320f70836a41c9e57322cae8b1fcbef9f4
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/complex.test.ts
@@ -0,0 +1,70 @@
+import { expect, test } from "vitest";
+import * as z from "zod/v3";
+
+const crazySchema = z.object({
+ tuple: z.tuple([
+ z.string().nullable().optional(),
+ z.number().nullable().optional(),
+ z.boolean().nullable().optional(),
+ z.null().nullable().optional(),
+ z.undefined().nullable().optional(),
+ z.literal("1234").nullable().optional(),
+ ]),
+ merged: z
+ .object({
+ k1: z.string().optional(),
+ })
+ .merge(z.object({ k1: z.string().nullable(), k2: z.number() })),
+ union: z.array(z.union([z.literal("asdf"), z.literal(12)])).nonempty(),
+ array: z.array(z.number()),
+ // sumTransformer: z.transformer(z.array(z.number()), z.number(), (arg) => {
+ // return arg.reduce((a, b) => a + b, 0);
+ // }),
+ sumMinLength: z.array(z.number()).refine((arg) => arg.length > 5),
+ intersection: z.intersection(z.object({ p1: z.string().optional() }), z.object({ p1: z.number().optional() })),
+ enum: z.intersection(z.enum(["zero", "one"]), z.enum(["one", "two"])),
+ nonstrict: z.object({ points: z.number() }).nonstrict(),
+ numProm: z.promise(z.number()),
+ lenfun: z.function(z.tuple([z.string()]), z.boolean()),
+});
+
+// const asyncCrazySchema = crazySchema.extend({
+// // async_transform: z.transformer(
+// // z.array(z.number()),
+// // z.number(),
+// // async (arg) => {
+// // return arg.reduce((a, b) => a + b, 0);
+// // }
+// // ),
+// async_refine: z.array(z.number()).refine(async (arg) => arg.length > 5),
+// });
+
+test("parse", () => {
+ const input = {
+ tuple: ["asdf", 1234, true, null, undefined, "1234"],
+ merged: { k1: "asdf", k2: 12 },
+ union: ["asdf", 12, "asdf", 12, "asdf", 12],
+ array: [12, 15, 16],
+ // sumTransformer: [12, 15, 16],
+ sumMinLength: [12, 15, 16, 98, 24, 63],
+ intersection: {},
+ enum: "one",
+ nonstrict: { points: 1234 },
+ numProm: Promise.resolve(12),
+ lenfun: (x: string) => x.length,
+ };
+
+ const result = crazySchema.parse(input);
+
+ // Verify the parsed result structure
+ expect(result.tuple).toEqual(input.tuple);
+ expect(result.merged).toEqual(input.merged);
+ expect(result.union).toEqual(input.union);
+ expect(result.array).toEqual(input.array);
+ expect(result.sumMinLength).toEqual(input.sumMinLength);
+ expect(result.intersection).toEqual(input.intersection);
+ expect(result.enum).toEqual(input.enum);
+ expect(result.nonstrict).toEqual(input.nonstrict);
+ expect(result.numProm).toBeInstanceOf(Promise);
+ expect(typeof result.lenfun).toBe("function");
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/custom.test.ts b/tools/ui/node_modules/zod/src/v3/tests/custom.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..b24b6762dcf11e40a69fc96486333e219f96e910
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/custom.test.ts
@@ -0,0 +1,31 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+
+test("passing validations", () => {
+ const example1 = z.custom((x) => typeof x === "number");
+ example1.parse(1234);
+ expect(() => example1.parse({})).toThrow();
+});
+
+test("string params", () => {
+ const example1 = z.custom((x) => typeof x !== "number", "customerr");
+ const result = example1.safeParse(1234);
+ expect(result.success).toEqual(false);
+ // @ts-ignore
+ expect(JSON.stringify(result.error).includes("customerr")).toEqual(true);
+});
+
+test("async validations", async () => {
+ const example1 = z.custom(async (x) => {
+ return typeof x === "number";
+ });
+ const r1 = await example1.safeParseAsync(1234);
+ expect(r1.success).toEqual(true);
+ expect(r1.data).toEqual(1234);
+
+ const r2 = await example1.safeParseAsync("asdf");
+ expect(r2.success).toEqual(false);
+ expect(r2.error!.issues.length).toEqual(1);
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/date.test.ts b/tools/ui/node_modules/zod/src/v3/tests/date.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c86dc84fc56062af09081fe7e444a9651e8b64b1
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/date.test.ts
@@ -0,0 +1,32 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+
+const beforeBenchmarkDate = new Date(2022, 10, 4);
+const benchmarkDate = new Date(2022, 10, 5);
+const afterBenchmarkDate = new Date(2022, 10, 6);
+
+const minCheck = z.date().min(benchmarkDate);
+const maxCheck = z.date().max(benchmarkDate);
+
+test("passing validations", () => {
+ minCheck.parse(benchmarkDate);
+ minCheck.parse(afterBenchmarkDate);
+
+ maxCheck.parse(benchmarkDate);
+ maxCheck.parse(beforeBenchmarkDate);
+});
+
+test("failing validations", () => {
+ expect(() => minCheck.parse(beforeBenchmarkDate)).toThrow();
+ expect(() => maxCheck.parse(afterBenchmarkDate)).toThrow();
+});
+
+test("min max getters", () => {
+ expect(minCheck.minDate).toEqual(benchmarkDate);
+ expect(minCheck.min(afterBenchmarkDate).minDate).toEqual(afterBenchmarkDate);
+
+ expect(maxCheck.maxDate).toEqual(benchmarkDate);
+ expect(maxCheck.max(beforeBenchmarkDate).maxDate).toEqual(beforeBenchmarkDate);
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/deepmasking.test.ts b/tools/ui/node_modules/zod/src/v3/tests/deepmasking.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d707e79a07f16373480571dd3466d2bce7f14200
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/deepmasking.test.ts
@@ -0,0 +1,186 @@
+// @ts-ignore TS6133
+import { test } from "vitest";
+
+import * as z from "zod/v3";
+
+test("test", () => {
+ z;
+});
+
+// const fish = z.object({
+// name: z.string(),
+// props: z.object({
+// color: z.string(),
+// numScales: z.number(),
+// }),
+// });
+
+// const nonStrict = z
+// .object({
+// name: z.string(),
+// color: z.string(),
+// })
+// .nonstrict();
+
+// test('object pick type', () => {
+// const modNonStrictFish = nonStrict.omit({ name: true });
+// modNonStrictFish.parse({ color: 'asdf' });
+
+// const bad1 = () => fish.pick({ props: { unknown: true } } as any);
+// const bad2 = () => fish.omit({ name: true, props: { unknown: true } } as any);
+
+// expect(bad1).toThrow();
+// expect(bad2).toThrow();
+// });
+
+// test('f1', () => {
+// const f1 = fish.pick(true);
+// f1.parse({ name: 'a', props: { color: 'b', numScales: 3 } });
+// });
+// test('f2', () => {
+// const f2 = fish.pick({ props: true });
+// f2.parse({ props: { color: 'asdf', numScales: 1 } });
+// const badcheck2 = () => f2.parse({ name: 'a', props: { color: 'b', numScales: 3 } } as any);
+// expect(badcheck2).toThrow();
+// });
+// test('f3', () => {
+// const f3 = fish.pick({ props: { color: true } });
+// f3.parse({ props: { color: 'b' } });
+// const badcheck3 = () => f3.parse({ name: 'a', props: { color: 'b', numScales: 3 } } as any);
+// expect(badcheck3).toThrow();
+// });
+// test('f4', () => {
+// const badcheck4 = () => fish.pick({ props: { color: true, unknown: true } });
+// expect(badcheck4).toThrow();
+// });
+// test('f6', () => {
+// const f6 = fish.omit({ props: true });
+// const badcheck6 = () => f6.parse({ name: 'a', props: { color: 'b', numScales: 3 } } as any);
+// f6.parse({ name: 'adsf' });
+// expect(badcheck6).toThrow();
+// });
+// test('f7', () => {
+// const f7 = fish.omit({ props: { color: true } });
+// f7.parse({ name: 'a', props: { numScales: 3 } });
+// const badcheck7 = () => f7.parse({ name: 'a', props: { color: 'b', numScales: 3 } } as any);
+// expect(badcheck7).toThrow();
+// });
+// test('f8', () => {
+// const badcheck8 = () => fish.omit({ props: { color: true, unknown: true } });
+// expect(badcheck8).toThrow();
+// });
+// test('f9', () => {
+// const f9 = nonStrict.pick(true);
+// f9.parse({ name: 'a', color: 'asdf' });
+// });
+// test('f10', () => {
+// const f10 = nonStrict.pick({ name: true });
+// f10.parse({ name: 'a' });
+// const val = f10.parse({ name: 'a', color: 'b' });
+// expect(val).toEqual({ name: 'a' });
+// });
+// test('f12', () => {
+// const badfcheck12 = () => nonStrict.omit({ color: true, asdf: true });
+// expect(badfcheck12).toThrow();
+// });
+
+// test('array masking', () => {
+// const fishArray = z.array(fish);
+// const modFishArray = fishArray.pick({
+// name: true,
+// props: {
+// numScales: true,
+// },
+// });
+
+// modFishArray.parse([{ name: 'fish', props: { numScales: 12 } }]);
+// const bad1 = () => modFishArray.parse([{ name: 'fish', props: { numScales: 12, color: 'asdf' } }] as any);
+// expect(bad1).toThrow();
+// });
+
+// test('array masking', () => {
+// const fishArray = z.array(fish);
+// const fail = () =>
+// fishArray.pick({
+// name: true,
+// props: {
+// whatever: true,
+// },
+// } as any);
+// expect(fail).toThrow();
+// });
+
+// test('array masking', () => {
+// const fishArray = z.array(fish);
+// const fail = () =>
+// fishArray.omit({
+// whateve: true,
+// } as any);
+// expect(fail).toThrow();
+// });
+
+// test('array masking', () => {
+// const fishArray = z.array(fish);
+// const modFishList = fishArray.omit({
+// name: true,
+// props: {
+// color: true,
+// },
+// });
+
+// modFishList.parse([{ props: { numScales: 12 } }]);
+// const fail = () => modFishList.parse([{ name: 'hello', props: { numScales: 12 } }] as any);
+// expect(fail).toThrow();
+// });
+
+// test('primitive array masking', () => {
+// const fishArray = z.array(z.number());
+// const fail = () => fishArray.pick({} as any);
+// expect(fail).toThrow();
+// });
+
+// test('other array masking', () => {
+// const fishArray = z.array(z.array(z.number()));
+// const fail = () => fishArray.pick({} as any);
+// expect(fail).toThrow();
+// });
+
+// test('invalid mask #1', () => {
+// const fail = () => fish.pick(1 as any);
+// expect(fail).toThrow();
+// });
+
+// test('invalid mask #2', () => {
+// const fail = () => fish.pick([] as any);
+// expect(fail).toThrow();
+// });
+
+// test('invalid mask #3', () => {
+// const fail = () => fish.pick(false as any);
+// expect(fail).toThrow();
+// });
+
+// test('invalid mask #4', () => {
+// const fail = () => fish.pick('asdf' as any);
+// expect(fail).toThrow();
+// });
+
+// test('invalid mask #5', () => {
+// const fail = () => fish.omit(1 as any);
+// expect(fail).toThrow();
+// });
+
+// test('invalid mask #6', () => {
+// const fail = () => fish.omit([] as any);
+// expect(fail).toThrow();
+// });
+
+// test('invalid mask #7', () => {
+// const fail = () => fish.omit(false as any);
+// expect(fail).toThrow();
+// });
+
+// test('invalid mask #8', () => {
+// const fail = () => fish.omit('asdf' as any);
+// expect(fail).toThrow();
+// });
diff --git a/tools/ui/node_modules/zod/src/v3/tests/default.test.ts b/tools/ui/node_modules/zod/src/v3/tests/default.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..29e007c93d030d20b00e7c19da6463e35f20ff37
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/default.test.ts
@@ -0,0 +1,112 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import { z } from "zod/v3";
+import { util } from "../helpers/util.js";
+
+test("basic defaults", () => {
+ expect(z.string().default("default").parse(undefined)).toBe("default");
+});
+
+test("default with transform", () => {
+ const stringWithDefault = z
+ .string()
+ .transform((val) => val.toUpperCase())
+ .default("default");
+ expect(stringWithDefault.parse(undefined)).toBe("DEFAULT");
+ expect(stringWithDefault).toBeInstanceOf(z.ZodDefault);
+ expect(stringWithDefault._def.innerType).toBeInstanceOf(z.ZodEffects);
+ expect(stringWithDefault._def.innerType._def.schema).toBeInstanceOf(z.ZodSchema);
+
+ type inp = z.input;
+ util.assertEqual(true);
+ type out = z.output;
+ util.assertEqual(true);
+});
+
+test("default on existing optional", () => {
+ const stringWithDefault = z.string().optional().default("asdf");
+ expect(stringWithDefault.parse(undefined)).toBe("asdf");
+ expect(stringWithDefault).toBeInstanceOf(z.ZodDefault);
+ expect(stringWithDefault._def.innerType).toBeInstanceOf(z.ZodOptional);
+ expect(stringWithDefault._def.innerType._def.innerType).toBeInstanceOf(z.ZodString);
+
+ type inp = z.input;
+ util.assertEqual(true);
+ type out = z.output;
+ util.assertEqual(true);
+});
+
+test("optional on default", () => {
+ const stringWithDefault = z.string().default("asdf").optional();
+
+ type inp = z.input;
+ util.assertEqual(true);
+ type out = z.output;
+ util.assertEqual(true);
+});
+
+test("complex chain example", () => {
+ const complex = z
+ .string()
+ .default("asdf")
+ .transform((val) => val.toUpperCase())
+ .default("qwer")
+ .removeDefault()
+ .optional()
+ .default("asdfasdf");
+
+ expect(complex.parse(undefined)).toBe("ASDFASDF");
+});
+
+test("removeDefault", () => {
+ const stringWithRemovedDefault = z.string().default("asdf").removeDefault();
+
+ type out = z.output;
+ util.assertEqual(true);
+});
+
+test("nested", () => {
+ const inner = z.string().default("asdf");
+ const outer = z.object({ inner }).default({
+ inner: undefined,
+ });
+ type input = z.input;
+ util.assertEqual (true);
+ type out = z.output;
+ util.assertEqual(true);
+ expect(outer.parse(undefined)).toEqual({ inner: "asdf" });
+ expect(outer.parse({})).toEqual({ inner: "asdf" });
+ expect(outer.parse({ inner: undefined })).toEqual({ inner: "asdf" });
+});
+
+test("chained defaults", () => {
+ const stringWithDefault = z.string().default("inner").default("outer");
+ const result = stringWithDefault.parse(undefined);
+ expect(result).toEqual("outer");
+});
+
+test("factory", () => {
+ expect(z.ZodDefault.create(z.string(), { default: "asdf" }).parse(undefined)).toEqual("asdf");
+});
+
+test("native enum", () => {
+ enum Fruits {
+ apple = "apple",
+ orange = "orange",
+ }
+
+ const schema = z.object({
+ fruit: z.nativeEnum(Fruits).default(Fruits.apple),
+ });
+
+ expect(schema.parse({})).toEqual({ fruit: Fruits.apple });
+});
+
+test("enum", () => {
+ const schema = z.object({
+ fruit: z.enum(["apple", "orange"]).default("apple"),
+ });
+
+ expect(schema.parse({})).toEqual({ fruit: "apple" });
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/description.test.ts b/tools/ui/node_modules/zod/src/v3/tests/description.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..1edaa1cc2ee1a575db568d914992944bd9bfd210
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/description.test.ts
@@ -0,0 +1,33 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+
+const description = "a description";
+
+test("passing `description` to schema should add a description", () => {
+ expect(z.string({ description }).description).toEqual(description);
+ expect(z.number({ description }).description).toEqual(description);
+ expect(z.boolean({ description }).description).toEqual(description);
+});
+
+test("`.describe` should add a description", () => {
+ expect(z.string().describe(description).description).toEqual(description);
+ expect(z.number().describe(description).description).toEqual(description);
+ expect(z.boolean().describe(description).description).toEqual(description);
+});
+
+test("description should carry over to chained schemas", () => {
+ const schema = z.string({ description });
+ expect(schema.description).toEqual(description);
+ expect(schema.optional().description).toEqual(description);
+ expect(schema.optional().nullable().default("default").description).toEqual(description);
+});
+
+test("description should not carry over to chained array schema", () => {
+ const schema = z.string().describe(description);
+
+ expect(schema.description).toEqual(description);
+ expect(schema.array().description).toEqual(undefined);
+ expect(z.array(schema).description).toEqual(undefined);
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/discriminated-unions.test.ts b/tools/ui/node_modules/zod/src/v3/tests/discriminated-unions.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..7fb5cfefe80b18f2c26bee891a47bc8c50153170
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/discriminated-unions.test.ts
@@ -0,0 +1,315 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+
+test("valid", () => {
+ expect(
+ z
+ .discriminatedUnion("type", [
+ z.object({ type: z.literal("a"), a: z.string() }),
+ z.object({ type: z.literal("b"), b: z.string() }),
+ ])
+ .parse({ type: "a", a: "abc" })
+ ).toEqual({ type: "a", a: "abc" });
+});
+
+test("valid - discriminator value of various primitive types", () => {
+ const schema = z.discriminatedUnion("type", [
+ z.object({ type: z.literal("1"), val: z.literal(1) }),
+ z.object({ type: z.literal(1), val: z.literal(2) }),
+ z.object({ type: z.literal(BigInt(1)), val: z.literal(3) }),
+ z.object({ type: z.literal("true"), val: z.literal(4) }),
+ z.object({ type: z.literal(true), val: z.literal(5) }),
+ z.object({ type: z.literal("null"), val: z.literal(6) }),
+ z.object({ type: z.literal(null), val: z.literal(7) }),
+ z.object({ type: z.literal("undefined"), val: z.literal(8) }),
+ z.object({ type: z.literal(undefined), val: z.literal(9) }),
+ z.object({ type: z.literal("transform"), val: z.literal(10) }),
+ z.object({ type: z.literal("refine"), val: z.literal(11) }),
+ z.object({ type: z.literal("superRefine"), val: z.literal(12) }),
+ ]);
+
+ expect(schema.parse({ type: "1", val: 1 })).toEqual({ type: "1", val: 1 });
+ expect(schema.parse({ type: 1, val: 2 })).toEqual({ type: 1, val: 2 });
+ expect(schema.parse({ type: BigInt(1), val: 3 })).toEqual({
+ type: BigInt(1),
+ val: 3,
+ });
+ expect(schema.parse({ type: "true", val: 4 })).toEqual({
+ type: "true",
+ val: 4,
+ });
+ expect(schema.parse({ type: true, val: 5 })).toEqual({
+ type: true,
+ val: 5,
+ });
+ expect(schema.parse({ type: "null", val: 6 })).toEqual({
+ type: "null",
+ val: 6,
+ });
+ expect(schema.parse({ type: null, val: 7 })).toEqual({
+ type: null,
+ val: 7,
+ });
+ expect(schema.parse({ type: "undefined", val: 8 })).toEqual({
+ type: "undefined",
+ val: 8,
+ });
+ expect(schema.parse({ type: undefined, val: 9 })).toEqual({
+ type: undefined,
+ val: 9,
+ });
+});
+
+test("invalid - null", () => {
+ try {
+ z.discriminatedUnion("type", [
+ z.object({ type: z.literal("a"), a: z.string() }),
+ z.object({ type: z.literal("b"), b: z.string() }),
+ ]).parse(null);
+ throw new Error();
+ } catch (e: any) {
+ expect(JSON.parse(e.message)).toEqual([
+ {
+ code: z.ZodIssueCode.invalid_type,
+ expected: z.ZodParsedType.object,
+ message: "Expected object, received null",
+ received: z.ZodParsedType.null,
+ path: [],
+ },
+ ]);
+ }
+});
+
+test("invalid discriminator value", () => {
+ try {
+ z.discriminatedUnion("type", [
+ z.object({ type: z.literal("a"), a: z.string() }),
+ z.object({ type: z.literal("b"), b: z.string() }),
+ ]).parse({ type: "x", a: "abc" });
+ throw new Error();
+ } catch (e: any) {
+ expect(JSON.parse(e.message)).toEqual([
+ {
+ code: z.ZodIssueCode.invalid_union_discriminator,
+ options: ["a", "b"],
+ message: "Invalid discriminator value. Expected 'a' | 'b'",
+ path: ["type"],
+ },
+ ]);
+ }
+});
+
+test("valid discriminator value, invalid data", () => {
+ try {
+ z.discriminatedUnion("type", [
+ z.object({ type: z.literal("a"), a: z.string() }),
+ z.object({ type: z.literal("b"), b: z.string() }),
+ ]).parse({ type: "a", b: "abc" });
+ throw new Error();
+ } catch (e: any) {
+ expect(JSON.parse(e.message)).toEqual([
+ {
+ code: z.ZodIssueCode.invalid_type,
+ expected: z.ZodParsedType.string,
+ message: "Required",
+ path: ["a"],
+ received: z.ZodParsedType.undefined,
+ },
+ ]);
+ }
+});
+
+test("wrong schema - missing discriminator", () => {
+ try {
+ z.discriminatedUnion("type", [
+ z.object({ type: z.literal("a"), a: z.string() }),
+ z.object({ b: z.string() }) as any,
+ ]);
+ throw new Error();
+ } catch (e: any) {
+ expect(e.message.includes("could not be extracted")).toBe(true);
+ }
+});
+
+test("wrong schema - duplicate discriminator values", () => {
+ try {
+ z.discriminatedUnion("type", [
+ z.object({ type: z.literal("a"), a: z.string() }),
+ z.object({ type: z.literal("a"), b: z.string() }),
+ ]);
+ throw new Error();
+ } catch (e: any) {
+ expect(e.message.includes("has duplicate value")).toEqual(true);
+ }
+});
+
+test("async - valid", async () => {
+ expect(
+ await z
+ .discriminatedUnion("type", [
+ z.object({
+ type: z.literal("a"),
+ a: z
+ .string()
+ .refine(async () => true)
+ .transform(async (val) => Number(val)),
+ }),
+ z.object({
+ type: z.literal("b"),
+ b: z.string(),
+ }),
+ ])
+ .parseAsync({ type: "a", a: "1" })
+ ).toEqual({ type: "a", a: 1 });
+});
+
+test("async - invalid", async () => {
+ try {
+ await z
+ .discriminatedUnion("type", [
+ z.object({
+ type: z.literal("a"),
+ a: z
+ .string()
+ .refine(async () => true)
+ .transform(async (val) => val),
+ }),
+ z.object({
+ type: z.literal("b"),
+ b: z.string(),
+ }),
+ ])
+ .parseAsync({ type: "a", a: 1 });
+ throw new Error();
+ } catch (e: any) {
+ expect(JSON.parse(e.message)).toEqual([
+ {
+ code: "invalid_type",
+ expected: "string",
+ received: "number",
+ path: ["a"],
+ message: "Expected string, received number",
+ },
+ ]);
+ }
+});
+
+test("valid - literals with .default or .preprocess", () => {
+ const schema = z.discriminatedUnion("type", [
+ z.object({
+ type: z.literal("foo").default("foo"),
+ a: z.string(),
+ }),
+ z.object({
+ type: z.literal("custom"),
+ method: z.string(),
+ }),
+ z.object({
+ type: z.preprocess((val) => String(val), z.literal("bar")),
+ c: z.string(),
+ }),
+ ]);
+ expect(schema.parse({ type: "foo", a: "foo" })).toEqual({
+ type: "foo",
+ a: "foo",
+ });
+});
+
+test("enum and nativeEnum", () => {
+ enum MyEnum {
+ d = 0,
+ e = "e",
+ }
+
+ const schema = z.discriminatedUnion("key", [
+ z.object({
+ key: z.literal("a"),
+ // Add other properties specific to this option
+ }),
+ z.object({
+ key: z.enum(["b", "c"]),
+ // Add other properties specific to this option
+ }),
+ z.object({
+ key: z.nativeEnum(MyEnum),
+ // Add other properties specific to this option
+ }),
+ ]);
+
+ // type schema = z.infer;
+
+ schema.parse({ key: "a" });
+ schema.parse({ key: "b" });
+ schema.parse({ key: "c" });
+ schema.parse({ key: MyEnum.d });
+ schema.parse({ key: MyEnum.e });
+ schema.parse({ key: "e" });
+});
+
+test("branded", () => {
+ const schema = z.discriminatedUnion("key", [
+ z.object({
+ key: z.literal("a"),
+ // Add other properties specific to this option
+ }),
+ z.object({
+ key: z.literal("b").brand("asdfaf"),
+ // Add other properties specific to this option
+ }),
+ ]);
+
+ // type schema = z.infer;
+
+ schema.parse({ key: "a" });
+ schema.parse({ key: "b" });
+ expect(() => {
+ schema.parse({ key: "c" });
+ }).toThrow();
+});
+
+test("optional and nullable", () => {
+ const schema = z.discriminatedUnion("key", [
+ z.object({
+ key: z.literal("a").optional(),
+ a: z.literal(true),
+ }),
+ z.object({
+ key: z.literal("b").nullable(),
+ b: z.literal(true),
+ // Add other properties specific to this option
+ }),
+ ]);
+
+ type schema = z.infer;
+ z.util.assertEqual(true);
+
+ schema.parse({ key: "a", a: true });
+ schema.parse({ key: undefined, a: true });
+ schema.parse({ key: "b", b: true });
+ schema.parse({ key: null, b: true });
+ expect(() => {
+ schema.parse({ key: null, a: true });
+ }).toThrow();
+ expect(() => {
+ schema.parse({ key: "b", a: true });
+ }).toThrow();
+
+ const value = schema.parse({ key: null, b: true });
+
+ if (!("key" in value)) value.a;
+ if (value.key === undefined) value.a;
+ if (value.key === "a") value.a;
+ if (value.key === "b") value.b;
+ if (value.key === null) value.b;
+});
+
+test("readonly array of options", () => {
+ const options = [
+ z.object({ type: z.literal("x"), val: z.literal(1) }),
+ z.object({ type: z.literal("y"), val: z.literal(2) }),
+ ] as const;
+
+ expect(z.discriminatedUnion("type", options).parse({ type: "x", val: 1 })).toEqual({ type: "x", val: 1 });
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/enum.test.ts b/tools/ui/node_modules/zod/src/v3/tests/enum.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..53f4a3e8444766a94563777dc5e9e30d8b2b9fb5
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/enum.test.ts
@@ -0,0 +1,80 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+import { util } from "../helpers/util.js";
+
+test("create enum", () => {
+ const MyEnum = z.enum(["Red", "Green", "Blue"]);
+ expect(MyEnum.Values.Red).toEqual("Red");
+ expect(MyEnum.Enum.Red).toEqual("Red");
+ expect(MyEnum.enum.Red).toEqual("Red");
+});
+
+test("infer enum", () => {
+ const MyEnum = z.enum(["Red", "Green", "Blue"]);
+ type MyEnum = z.infer;
+ util.assertEqual(true);
+});
+
+test("get options", () => {
+ expect(z.enum(["tuna", "trout"]).options).toEqual(["tuna", "trout"]);
+});
+
+test("readonly enum", () => {
+ const HTTP_SUCCESS = ["200", "201"] as const;
+ const arg = z.enum(HTTP_SUCCESS);
+ type arg = z.infer;
+ util.assertEqual(true);
+
+ arg.parse("201");
+ expect(() => arg.parse("202")).toThrow();
+});
+
+test("error params", () => {
+ const result = z.enum(["test"], { required_error: "REQUIRED" }).safeParse(undefined);
+ expect(result.success).toEqual(false);
+ if (!result.success) {
+ expect(result.error.issues[0].message).toEqual("REQUIRED");
+ }
+});
+
+test("extract/exclude", () => {
+ const foods = ["Pasta", "Pizza", "Tacos", "Burgers", "Salad"] as const;
+ const FoodEnum = z.enum(foods);
+ const ItalianEnum = FoodEnum.extract(["Pasta", "Pizza"]);
+ const UnhealthyEnum = FoodEnum.exclude(["Salad"]);
+ const EmptyFoodEnum = FoodEnum.exclude(foods);
+
+ util.assertEqual, "Pasta" | "Pizza">(true);
+ util.assertEqual, "Pasta" | "Pizza" | "Tacos" | "Burgers">(true);
+ // @ts-expect-error TS2344
+ util.assertEqual>(true);
+ util.assertEqual, never>(true);
+});
+
+test("error map in extract/exclude", () => {
+ const foods = ["Pasta", "Pizza", "Tacos", "Burgers", "Salad"] as const;
+ const FoodEnum = z.enum(foods, {
+ errorMap: () => ({ message: "This is not food!" }),
+ });
+ const ItalianEnum = FoodEnum.extract(["Pasta", "Pizza"]);
+ const foodsError = FoodEnum.safeParse("Cucumbers");
+ const italianError = ItalianEnum.safeParse("Tacos");
+ if (!foodsError.success && !italianError.success) {
+ expect(foodsError.error.issues[0].message).toEqual(italianError.error.issues[0].message);
+ }
+
+ const UnhealthyEnum = FoodEnum.exclude(["Salad"], {
+ errorMap: () => ({ message: "This is not healthy food!" }),
+ });
+ const unhealthyError = UnhealthyEnum.safeParse("Salad");
+ if (!unhealthyError.success) {
+ expect(unhealthyError.error.issues[0].message).toEqual("This is not healthy food!");
+ }
+});
+
+test("readonly in ZodEnumDef", () => {
+ let _t!: z.ZodEnumDef;
+ _t;
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/error.test.ts b/tools/ui/node_modules/zod/src/v3/tests/error.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..5caaa6d81b34049f0c3467872905b60b1b60438d
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/error.test.ts
@@ -0,0 +1,551 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+import { ZodError, ZodIssueCode } from "../ZodError.js";
+import { ZodParsedType } from "../helpers/util.js";
+
+test("error creation", () => {
+ const err1 = ZodError.create([]);
+ err1.addIssue({
+ code: ZodIssueCode.invalid_type,
+ expected: ZodParsedType.object,
+ received: ZodParsedType.string,
+ path: [],
+ message: "",
+ fatal: true,
+ });
+ err1.isEmpty;
+
+ const err2 = ZodError.create(err1.issues);
+ const err3 = new ZodError([]);
+ err3.addIssues(err1.issues);
+ err3.addIssue(err1.issues[0]);
+ err1.message;
+ err2.message;
+ err3.message;
+});
+
+const errorMap: z.ZodErrorMap = (error, ctx) => {
+ if (error.code === ZodIssueCode.invalid_type) {
+ if (error.expected === "string") {
+ return { message: "bad type!" };
+ }
+ }
+ if (error.code === ZodIssueCode.custom) {
+ return { message: `less-than-${error.params?.minimum}` };
+ }
+ return { message: ctx.defaultError };
+};
+
+test("type error with custom error map", () => {
+ try {
+ z.string().parse(234, { errorMap });
+ } catch (err) {
+ const zerr: z.ZodError = err as any;
+
+ expect(zerr.issues[0].code).toEqual(z.ZodIssueCode.invalid_type);
+ expect(zerr.issues[0].message).toEqual(`bad type!`);
+ }
+});
+
+test("refinement fail with params", () => {
+ try {
+ z.number()
+ .refine((val) => val >= 3, {
+ params: { minimum: 3 },
+ })
+ .parse(2, { errorMap });
+ } catch (err) {
+ const zerr: z.ZodError = err as any;
+ expect(zerr.issues[0].code).toEqual(z.ZodIssueCode.custom);
+ expect(zerr.issues[0].message).toEqual(`less-than-3`);
+ }
+});
+
+test("custom error with custom errormap", () => {
+ try {
+ z.string()
+ .refine((val) => val.length > 12, {
+ params: { minimum: 13 },
+ message: "override",
+ })
+ .parse("asdf", { errorMap });
+ } catch (err) {
+ const zerr: z.ZodError = err as any;
+ expect(zerr.issues[0].message).toEqual("override");
+ }
+});
+
+test("default error message", () => {
+ try {
+ z.number()
+ .refine((x) => x > 3)
+ .parse(2);
+ } catch (err) {
+ const zerr: z.ZodError = err as any;
+ expect(zerr.issues.length).toEqual(1);
+ expect(zerr.issues[0].message).toEqual("Invalid input");
+ }
+});
+
+test("override error in refine", () => {
+ try {
+ z.number()
+ .refine((x) => x > 3, "override")
+ .parse(2);
+ } catch (err) {
+ const zerr: z.ZodError = err as any;
+ expect(zerr.issues.length).toEqual(1);
+ expect(zerr.issues[0].message).toEqual("override");
+ }
+});
+
+test("override error in refinement", () => {
+ try {
+ z.number()
+ .refine((x) => x > 3, {
+ message: "override",
+ })
+ .parse(2);
+ } catch (err) {
+ const zerr: z.ZodError = err as any;
+ expect(zerr.issues.length).toEqual(1);
+ expect(zerr.issues[0].message).toEqual("override");
+ }
+});
+
+test("array minimum", () => {
+ try {
+ z.array(z.string()).min(3, "tooshort").parse(["asdf", "qwer"]);
+ } catch (err) {
+ const zerr: ZodError = err as any;
+ expect(zerr.issues[0].code).toEqual(ZodIssueCode.too_small);
+ expect(zerr.issues[0].message).toEqual("tooshort");
+ }
+ try {
+ z.array(z.string()).min(3).parse(["asdf", "qwer"]);
+ } catch (err) {
+ const zerr: ZodError = err as any;
+ expect(zerr.issues[0].code).toEqual(ZodIssueCode.too_small);
+ expect(zerr.issues[0].message).toEqual(`Array must contain at least 3 element(s)`);
+ }
+});
+
+// implement test for semi-smart union logic that checks for type error on either left or right
+// test("union smart errors", () => {
+// // expect.assertions(2);
+
+// const p1 = z
+// .union([z.string(), z.number().refine((x) => x > 0)])
+// .safeParse(-3.2);
+
+// if (p1.success === true) throw new Error();
+// expect(p1.success).toBe(false);
+// expect(p1.error.issues[0].code).toEqual(ZodIssueCode.custom);
+
+// const p2 = z.union([z.string(), z.number()]).safeParse(false);
+// // .catch(err => expect(err.issues[0].code).toEqual(ZodIssueCode.invalid_union));
+// if (p2.success === true) throw new Error();
+// expect(p2.success).toBe(false);
+// expect(p2.error.issues[0].code).toEqual(ZodIssueCode.invalid_union);
+// });
+
+test("custom path in custom error map", () => {
+ const schema = z.object({
+ items: z.array(z.string()).refine((data) => data.length > 3, {
+ path: ["items-too-few"],
+ }),
+ });
+
+ const errorMap: z.ZodErrorMap = (error) => {
+ expect(error.path.length).toBe(2);
+ return { message: "doesnt matter" };
+ };
+ const result = schema.safeParse({ items: ["first"] }, { errorMap });
+ expect(result.success).toEqual(false);
+ if (!result.success) {
+ expect(result.error.issues[0].path).toEqual(["items", "items-too-few"]);
+ }
+});
+
+test("error metadata from value", () => {
+ const dynamicRefine = z.string().refine(
+ (val) => val === val.toUpperCase(),
+ (val) => ({ params: { val } })
+ );
+
+ const result = dynamicRefine.safeParse("asdf");
+ expect(result.success).toEqual(false);
+ if (!result.success) {
+ const sub = result.error.issues[0];
+ expect(result.error.issues[0].code).toEqual("custom");
+ if (sub.code === "custom") {
+ expect(sub.params!.val).toEqual("asdf");
+ }
+ }
+});
+
+// test("don't call refine after validation failed", () => {
+// const asdf = z
+// .union([
+// z.number(),
+// z.string().transform(z.number(), (val) => {
+// return parseFloat(val);
+// }),
+// ])
+// .refine((v) => v >= 1);
+
+// expect(() => asdf.safeParse("foo")).not.toThrow();
+// });
+
+test("root level formatting", () => {
+ const schema = z.string().email();
+ const result = schema.safeParse("asdfsdf");
+ expect(result.success).toEqual(false);
+ if (!result.success) {
+ expect(result.error.format()._errors).toEqual(["Invalid email"]);
+ }
+});
+
+test("custom path", () => {
+ const schema = z
+ .object({
+ password: z.string(),
+ confirm: z.string(),
+ })
+ .refine((val) => val.confirm === val.password, { path: ["confirm"] });
+
+ const result = schema.safeParse({
+ password: "peanuts",
+ confirm: "qeanuts",
+ });
+
+ expect(result.success).toEqual(false);
+ if (!result.success) {
+ // nested errors
+ const error = result.error.format();
+ expect(error._errors).toEqual([]);
+ expect(error.password?._errors).toEqual(undefined);
+ expect(error.confirm?._errors).toEqual(["Invalid input"]);
+ }
+});
+
+test("custom path", () => {
+ const schema = z
+ .object({
+ password: z.string().min(6),
+ confirm: z.string().min(6),
+ })
+ .refine((val) => val.confirm === val.password);
+
+ const result = schema.safeParse({
+ password: "qwer",
+ confirm: "asdf",
+ });
+
+ expect(result.success).toEqual(false);
+ if (!result.success) {
+ expect(result.error.issues.length).toEqual(3);
+ }
+});
+
+const schema = z.object({
+ inner: z.object({
+ name: z
+ .string()
+ .refine((val) => val.length > 5)
+ .array()
+ .refine((val) => val.length <= 1),
+ }),
+});
+
+test("no abort early on refinements", () => {
+ const invalidItem = {
+ inner: { name: ["aasd", "asdfasdfasfd"] },
+ };
+
+ const result1 = schema.safeParse(invalidItem);
+ expect(result1.success).toEqual(false);
+ if (!result1.success) {
+ expect(result1.error.issues.length).toEqual(2);
+ }
+});
+test("formatting", () => {
+ const invalidItem = {
+ inner: { name: ["aasd", "asdfasdfasfd"] },
+ };
+ const invalidArray = {
+ inner: { name: ["asdfasdf", "asdfasdfasfd"] },
+ };
+ const result1 = schema.safeParse(invalidItem);
+ const result2 = schema.safeParse(invalidArray);
+
+ expect(result1.success).toEqual(false);
+ expect(result2.success).toEqual(false);
+ if (!result1.success) {
+ const error = result1.error.format();
+
+ expect(error._errors).toEqual([]);
+ expect(error.inner?._errors).toEqual([]);
+ // expect(error.inner?.name?._errors).toEqual(["Invalid input"]);
+ // expect(error.inner?.name?.[0]._errors).toEqual(["Invalid input"]);
+ expect(error.inner?.name?.[1]).toEqual(undefined);
+ }
+ if (!result2.success) {
+ type FormattedError = z.inferFormattedError;
+ const error: FormattedError = result2.error.format();
+ expect(error._errors).toEqual([]);
+ expect(error.inner?._errors).toEqual([]);
+ expect(error.inner?.name?._errors).toEqual(["Invalid input"]);
+ expect(error.inner?.name?.[0]).toEqual(undefined);
+ expect(error.inner?.name?.[1]).toEqual(undefined);
+ expect(error.inner?.name?.[2]).toEqual(undefined);
+ }
+
+ // test custom mapper
+ if (!result2.success) {
+ type FormattedError = z.inferFormattedError;
+ const error: FormattedError = result2.error.format(() => 5);
+ expect(error._errors).toEqual([]);
+ expect(error.inner?._errors).toEqual([]);
+ expect(error.inner?.name?._errors).toEqual([5]);
+ }
+});
+
+test("formatting with nullable and optional fields", () => {
+ const nameSchema = z.string().refine((val) => val.length > 5);
+ const schema = z.object({
+ nullableObject: z.object({ name: nameSchema }).nullable(),
+ nullableArray: z.array(nameSchema).nullable(),
+ nullableTuple: z.tuple([nameSchema, nameSchema, z.number()]).nullable(),
+ optionalObject: z.object({ name: nameSchema }).optional(),
+ optionalArray: z.array(nameSchema).optional(),
+ optionalTuple: z.tuple([nameSchema, nameSchema, z.number()]).optional(),
+ });
+ const invalidItem = {
+ nullableObject: { name: "abcd" },
+ nullableArray: ["abcd"],
+ nullableTuple: ["abcd", "abcd", 1],
+ optionalObject: { name: "abcd" },
+ optionalArray: ["abcd"],
+ optionalTuple: ["abcd", "abcd", 1],
+ };
+ const result = schema.safeParse(invalidItem);
+ expect(result.success).toEqual(false);
+ if (!result.success) {
+ type FormattedError = z.inferFormattedError;
+ const error: FormattedError = result.error.format();
+ expect(error._errors).toEqual([]);
+ expect(error.nullableObject?._errors).toEqual([]);
+ expect(error.nullableObject?.name?._errors).toEqual(["Invalid input"]);
+ expect(error.nullableArray?._errors).toEqual([]);
+ expect(error.nullableArray?.[0]?._errors).toEqual(["Invalid input"]);
+ expect(error.nullableTuple?._errors).toEqual([]);
+ expect(error.nullableTuple?.[0]?._errors).toEqual(["Invalid input"]);
+ expect(error.nullableTuple?.[1]?._errors).toEqual(["Invalid input"]);
+ expect(error.optionalObject?._errors).toEqual([]);
+ expect(error.optionalObject?.name?._errors).toEqual(["Invalid input"]);
+ expect(error.optionalArray?._errors).toEqual([]);
+ expect(error.optionalArray?.[0]?._errors).toEqual(["Invalid input"]);
+ expect(error.optionalTuple?._errors).toEqual([]);
+ expect(error.optionalTuple?.[0]?._errors).toEqual(["Invalid input"]);
+ expect(error.optionalTuple?.[1]?._errors).toEqual(["Invalid input"]);
+ }
+});
+
+const stringWithCustomError = z.string({
+ errorMap: (issue, ctx) => ({
+ message: issue.code === "invalid_type" ? (ctx.data ? "Invalid name" : "Name is required") : ctx.defaultError,
+ }),
+});
+
+test("schema-bound error map", () => {
+ const result = stringWithCustomError.safeParse(1234);
+ expect(result.success).toEqual(false);
+ if (!result.success) {
+ expect(result.error.issues[0].message).toEqual("Invalid name");
+ }
+
+ const result2 = stringWithCustomError.safeParse(undefined);
+ expect(result2.success).toEqual(false);
+ if (!result2.success) {
+ expect(result2.error.issues[0].message).toEqual("Name is required");
+ }
+
+ // support contextual override
+ const result3 = stringWithCustomError.safeParse(undefined, {
+ errorMap: () => ({ message: "OVERRIDE" }),
+ });
+ expect(result3.success).toEqual(false);
+ if (!result3.success) {
+ expect(result3.error.issues[0].message).toEqual("OVERRIDE");
+ }
+});
+
+test("overrideErrorMap", () => {
+ // support overrideErrorMap
+ z.setErrorMap(() => ({ message: "OVERRIDE" }));
+ const result4 = stringWithCustomError.min(10).safeParse("tooshort");
+ expect(result4.success).toEqual(false);
+ if (!result4.success) {
+ expect(result4.error.issues[0].message).toEqual("OVERRIDE");
+ }
+ z.setErrorMap(z.defaultErrorMap);
+});
+
+test("invalid and required", () => {
+ const str = z.string({
+ invalid_type_error: "Invalid name",
+ required_error: "Name is required",
+ });
+ const result1 = str.safeParse(1234);
+ expect(result1.success).toEqual(false);
+ if (!result1.success) {
+ expect(result1.error.issues[0].message).toEqual("Invalid name");
+ }
+ const result2 = str.safeParse(undefined);
+ expect(result2.success).toEqual(false);
+ if (!result2.success) {
+ expect(result2.error.issues[0].message).toEqual("Name is required");
+ }
+});
+
+test("Fallback to default required error", () => {
+ const str = z.string({
+ invalid_type_error: "Invalid name",
+ // required_error: "Name is required",
+ });
+
+ const result2 = str.safeParse(undefined);
+ expect(result2.success).toEqual(false);
+ if (!result2.success) {
+ expect(result2.error.issues[0].message).toEqual("Required");
+ }
+});
+
+test("invalid and required and errorMap", () => {
+ expect(() => {
+ return z.string({
+ invalid_type_error: "Invalid name",
+ required_error: "Name is required",
+ errorMap: () => ({ message: "OVERRIDE" }),
+ });
+ }).toThrow();
+});
+
+test("strict error message", () => {
+ const errorMsg = "Invalid object";
+ const obj = z.object({ x: z.string() }).strict(errorMsg);
+ const result = obj.safeParse({ x: "a", y: "b" });
+ expect(result.success).toEqual(false);
+ if (!result.success) {
+ expect(result.error.issues[0].message).toEqual(errorMsg);
+ }
+});
+
+test("enum error message, invalid enum elementstring", () => {
+ try {
+ z.enum(["Tuna", "Trout"]).parse("Salmon");
+ } catch (err) {
+ const zerr: z.ZodError = err as any;
+ expect(zerr.issues.length).toEqual(1);
+ expect(zerr.issues[0].message).toEqual("Invalid enum value. Expected 'Tuna' | 'Trout', received 'Salmon'");
+ }
+});
+
+test("enum error message, invalid type", () => {
+ try {
+ z.enum(["Tuna", "Trout"]).parse(12);
+ } catch (err) {
+ const zerr: z.ZodError = err as any;
+ expect(zerr.issues.length).toEqual(1);
+ expect(zerr.issues[0].message).toEqual("Expected 'Tuna' | 'Trout', received number");
+ }
+});
+
+test("nativeEnum default error message", () => {
+ enum Fish {
+ Tuna = "Tuna",
+ Trout = "Trout",
+ }
+ try {
+ z.nativeEnum(Fish).parse("Salmon");
+ } catch (err) {
+ const zerr: z.ZodError = err as any;
+ expect(zerr.issues.length).toEqual(1);
+ expect(zerr.issues[0].message).toEqual("Invalid enum value. Expected 'Tuna' | 'Trout', received 'Salmon'");
+ }
+});
+
+test("literal default error message", () => {
+ try {
+ z.literal("Tuna").parse("Trout");
+ } catch (err) {
+ const zerr: z.ZodError = err as any;
+ expect(zerr.issues.length).toEqual(1);
+ expect(zerr.issues[0].message).toEqual(`Invalid literal value, expected "Tuna"`);
+ }
+});
+
+test("literal bigint default error message", () => {
+ try {
+ z.literal(BigInt(12)).parse(BigInt(13));
+ } catch (err) {
+ const zerr: z.ZodError = err as any;
+ expect(zerr.issues.length).toEqual(1);
+ expect(zerr.issues[0].message).toEqual(`Invalid literal value, expected "12"`);
+ }
+});
+
+test("enum with message returns the custom error message", () => {
+ const schema = z.enum(["apple", "banana"], {
+ message: "the value provided is invalid",
+ });
+
+ const result1 = schema.safeParse("berries");
+ expect(result1.success).toEqual(false);
+ if (!result1.success) {
+ expect(result1.error.issues[0].message).toEqual("the value provided is invalid");
+ }
+
+ const result2 = schema.safeParse(undefined);
+ expect(result2.success).toEqual(false);
+ if (!result2.success) {
+ expect(result2.error.issues[0].message).toEqual("the value provided is invalid");
+ }
+
+ const result3 = schema.safeParse("banana");
+ expect(result3.success).toEqual(true);
+
+ const result4 = schema.safeParse(null);
+ expect(result4.success).toEqual(false);
+ if (!result4.success) {
+ expect(result4.error.issues[0].message).toEqual("the value provided is invalid");
+ }
+});
+
+test("when the message is falsy, it is used as is provided", () => {
+ const schema = z.string().max(1, { message: "" });
+ const result = schema.safeParse("asdf");
+ expect(result.success).toEqual(false);
+ if (!result.success) {
+ expect(result.error.issues[0].message).toEqual("");
+ }
+});
+
+// test("dont short circuit on continuable errors", () => {
+// const user = z
+// .object({
+// password: z.string().min(6),
+// confirm: z.string(),
+// })
+// .refine((data) => data.password === data.confirm, {
+// message: "Passwords don't match",
+// path: ["confirm"],
+// });
+// const result = user.safeParse({ password: "asdf", confirm: "qwer" });
+// if (!result.success) {
+// expect(result.error.issues.length).toEqual(2);
+// }
+// });
diff --git a/tools/ui/node_modules/zod/src/v3/tests/firstparty.test.ts b/tools/ui/node_modules/zod/src/v3/tests/firstparty.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..017a1c13e48a2570642ce99d66b345020e3ca0aa
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/firstparty.test.ts
@@ -0,0 +1,87 @@
+// @ts-ignore TS6133
+import { test } from "vitest";
+
+import * as z from "zod/v3";
+import { util } from "../helpers/util.js";
+
+test("first party switch", () => {
+ const myType = z.string() as z.ZodFirstPartySchemaTypes;
+ const def = myType._def;
+
+ switch (def.typeName) {
+ case z.ZodFirstPartyTypeKind.ZodString:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodNumber:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodNaN:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodBigInt:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodBoolean:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodDate:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodUndefined:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodNull:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodAny:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodUnknown:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodNever:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodVoid:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodArray:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodObject:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodUnion:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodIntersection:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodTuple:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodRecord:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodMap:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodSet:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodFunction:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodLazy:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodLiteral:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodEnum:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodEffects:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodNativeEnum:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodOptional:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodNullable:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodDefault:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodCatch:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodPromise:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodBranded:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodPipeline:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodSymbol:
+ break;
+ case z.ZodFirstPartyTypeKind.ZodReadonly:
+ break;
+ default:
+ util.assertNever(def);
+ }
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts b/tools/ui/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ad397d8b8eb5ea9df3bf7af27662cf073fd5f2d9
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts
@@ -0,0 +1,21 @@
+// @ts-ignore TS6133
+import { test } from "vitest";
+
+import type { ZodFirstPartySchemaTypes, ZodFirstPartyTypeKind } from "zod/v3";
+import { util } from "../helpers/util.js";
+
+test("Identify missing [ZodFirstPartySchemaTypes]", () => {
+ type ZodFirstPartySchemaForType = ZodFirstPartySchemaTypes extends infer Schema
+ ? Schema extends { _def: { typeName: T } }
+ ? Schema
+ : never
+ : never;
+ type ZodMappedTypes = {
+ [key in ZodFirstPartyTypeKind]: ZodFirstPartySchemaForType;
+ };
+ type ZodFirstPartySchemaTypesMissingFromUnion = keyof {
+ [key in keyof ZodMappedTypes as ZodMappedTypes[key] extends { _def: never } ? key : never]: unknown;
+ };
+
+ util.assertEqual(true);
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/function.test.ts b/tools/ui/node_modules/zod/src/v3/tests/function.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..9a9e193bf5dd33280c79552b8ac4207c7bfd7b09
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/function.test.ts
@@ -0,0 +1,261 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+import { util } from "../helpers/util.js";
+
+const args1 = z.tuple([z.string()]);
+const returns1 = z.number();
+const func1 = z.function(args1, returns1);
+
+test("function parsing", () => {
+ const parsed = func1.parse((arg: any) => arg.length);
+ const result = parsed("asdf");
+ expect(result).toBe(4);
+});
+
+test("parsed function fail 1", () => {
+ const parsed = func1.parse((x: string) => x);
+ expect(() => parsed("asdf")).toThrow();
+});
+
+test("parsed function fail 2", () => {
+ const parsed = func1.parse((x: string) => x);
+ expect(() => parsed(13 as any)).toThrow();
+});
+
+test("function inference 1", () => {
+ type func1 = z.TypeOf;
+ util.assertEqual number>(true);
+});
+
+test("method parsing", () => {
+ const methodObject = z.object({
+ property: z.number(),
+ method: z.function().args(z.string()).returns(z.number()),
+ });
+ const methodInstance = {
+ property: 3,
+ method: function (s: string) {
+ return s.length + this.property;
+ },
+ };
+ const parsed = methodObject.parse(methodInstance);
+ expect(parsed.method("length=8")).toBe(11); // 8 length + 3 property
+});
+
+test("async method parsing", async () => {
+ const methodObject = z.object({
+ property: z.number(),
+ method: z.function().args(z.string()).returns(z.promise(z.number())),
+ });
+ const methodInstance = {
+ property: 3,
+ method: async function (s: string) {
+ return s.length + this.property;
+ },
+ };
+ const parsed = methodObject.parse(methodInstance);
+ expect(await parsed.method("length=8")).toBe(11); // 8 length + 3 property
+});
+
+test("args method", () => {
+ const t1 = z.function();
+ type t1 = z.infer;
+ util.assertEqual unknown>(true);
+
+ const t2 = t1.args(z.string());
+ type t2 = z.infer;
+ util.assertEqual unknown>(true);
+
+ const t3 = t2.returns(z.boolean());
+ type t3 = z.infer;
+ util.assertEqual boolean>(true);
+});
+
+const args2 = z.tuple([
+ z.object({
+ f1: z.number(),
+ f2: z.string().nullable(),
+ f3: z.array(z.boolean().optional()).optional(),
+ }),
+]);
+const returns2 = z.union([z.string(), z.number()]);
+
+const func2 = z.function(args2, returns2);
+
+test("function inference 2", () => {
+ type func2 = z.TypeOf;
+ util.assertEqual<
+ func2,
+ (arg: {
+ f1: number;
+ f2: string | null;
+ f3?: (boolean | undefined)[] | undefined;
+ }) => string | number
+ >(true);
+});
+
+test("valid function run", () => {
+ const validFunc2Instance = func2.validate((_x) => {
+ return "adf" as any;
+ });
+
+ const checker = () => {
+ validFunc2Instance({
+ f1: 21,
+ f2: "asdf",
+ f3: [true, false],
+ });
+ };
+
+ checker();
+});
+
+test("input validation error", () => {
+ const invalidFuncInstance = func2.validate((_x) => {
+ return "adf" as any;
+ });
+
+ const checker = () => {
+ invalidFuncInstance("Invalid_input" as any);
+ };
+
+ expect(checker).toThrow();
+});
+
+test("output validation error", () => {
+ const invalidFuncInstance = func2.validate((_x) => {
+ return ["this", "is", "not", "valid", "output"] as any;
+ });
+
+ const checker = () => {
+ invalidFuncInstance({
+ f1: 21,
+ f2: "asdf",
+ f3: [true, false],
+ });
+ };
+
+ expect(checker).toThrow();
+});
+
+z.function(z.tuple([z.string()])).args()._def.args;
+
+test("special function error codes", () => {
+ const checker = z.function(z.tuple([z.string()]), z.boolean()).implement((arg) => {
+ return arg.length as any;
+ });
+ try {
+ checker("12" as any);
+ } catch (err) {
+ const zerr = err as z.ZodError;
+ const first = zerr.issues[0];
+ if (first.code !== z.ZodIssueCode.invalid_return_type) throw new Error();
+
+ expect(first.returnTypeError).toBeInstanceOf(z.ZodError);
+ }
+
+ try {
+ checker(12 as any);
+ } catch (err) {
+ const zerr = err as z.ZodError;
+ const first = zerr.issues[0];
+ if (first.code !== z.ZodIssueCode.invalid_arguments) throw new Error();
+ expect(first.argumentsError).toBeInstanceOf(z.ZodError);
+ }
+});
+
+test("function with async refinements", async () => {
+ const func = z
+ .function()
+ .args(z.string().refine(async (val) => val.length > 10))
+ .returns(z.promise(z.number().refine(async (val) => val > 10)))
+ .implement(async (val) => {
+ return val.length;
+ });
+ const results = [];
+ try {
+ await func("asdfasdf");
+ results.push("success");
+ } catch (_err) {
+ results.push("fail");
+ }
+ try {
+ await func("asdflkjasdflkjsf");
+ results.push("success");
+ } catch (_err) {
+ results.push("fail");
+ }
+
+ expect(results).toEqual(["fail", "success"]);
+});
+
+test("non async function with async refinements should fail", async () => {
+ const func = z
+ .function()
+ .args(z.string().refine(async (val) => val.length > 10))
+ .returns(z.number().refine(async (val) => val > 10))
+ .implement((val) => {
+ return val.length;
+ });
+
+ const results = [];
+ try {
+ await func("asdasdfasdffasdf");
+ results.push("success");
+ } catch (_err) {
+ results.push("fail");
+ }
+
+ expect(results).toEqual(["fail"]);
+});
+
+test("allow extra parameters", () => {
+ const maxLength5 = z
+ .function()
+ .args(z.string())
+ .returns(z.boolean())
+ .implement((str, _arg, _qewr) => {
+ return str.length <= 5;
+ });
+
+ const filteredList = ["apple", "orange", "pear", "banana", "strawberry"].filter(maxLength5);
+ expect(filteredList.length).toEqual(2);
+});
+
+test("params and returnType getters", () => {
+ const func = z.function().args(z.string()).returns(z.string());
+
+ const paramResult = func.parameters().items[0].parse("asdf");
+ expect(paramResult).toBe("asdf");
+
+ const returnResult = func.returnType().parse("asdf");
+ expect(returnResult).toBe("asdf");
+});
+
+test("inference with transforms", () => {
+ const funcSchema = z
+ .function()
+ .args(z.string().transform((val) => val.length))
+ .returns(z.object({ val: z.number() }));
+ const myFunc = funcSchema.implement((val) => {
+ return { val, extra: "stuff" };
+ });
+ myFunc("asdf");
+
+ util.assertEqual { val: number; extra: string }>(true);
+});
+
+test("fallback to OuterTypeOfFunction", () => {
+ const funcSchema = z
+ .function()
+ .args(z.string().transform((val) => val.length))
+ .returns(z.object({ arg: z.number() }).transform((val) => val.arg));
+
+ const myFunc = funcSchema.implement((val) => {
+ return { arg: val, arg2: false };
+ });
+
+ util.assertEqual number>(true);
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/generics.test.ts b/tools/ui/node_modules/zod/src/v3/tests/generics.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e0af470f07639a56497f748d520db2d13b82c56c
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/generics.test.ts
@@ -0,0 +1,48 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+import { util } from "../helpers/util.js";
+
+test("generics", () => {
+ async function stripOuter(schema: TData, data: unknown) {
+ return z
+ .object({
+ nested: schema, // as z.ZodTypeAny,
+ })
+ .transform((data) => {
+ return data.nested!;
+ })
+ .parse({ nested: data });
+ }
+
+ const result = stripOuter(z.object({ a: z.string() }), { a: "asdf" });
+ util.assertEqual>(true);
+});
+
+// test("assignability", () => {
+// const createSchemaAndParse = (
+// key: K,
+// valueSchema: VS,
+// data: unknown
+// ) => {
+// const schema = z.object({
+// [key]: valueSchema,
+// } as { [k in K]: VS });
+// return { [key]: valueSchema };
+// const parsed = schema.parse(data);
+// return parsed;
+// // const inferred: z.infer> = parsed;
+// // return inferred;
+// };
+// const parsed = createSchemaAndParse("foo", z.string(), { foo: "" });
+// util.assertEqual(true);
+// });
+
+test("nested no undefined", () => {
+ const inner = z.string().or(z.array(z.string()));
+ const outer = z.object({ inner });
+ type outerSchema = z.infer;
+ z.util.assertEqual(true);
+ expect(outer.safeParse({ inner: undefined }).success).toEqual(false);
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/instanceof.test.ts b/tools/ui/node_modules/zod/src/v3/tests/instanceof.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..de66f3f09f9127d970f431d7d54e12d9a38e0f43
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/instanceof.test.ts
@@ -0,0 +1,37 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+import { util } from "../helpers/util.js";
+
+test("instanceof", async () => {
+ class Test {}
+ class Subtest extends Test {}
+ abstract class AbstractBar {
+ constructor(public val: string) {}
+ }
+ class Bar extends AbstractBar {}
+
+ const TestSchema = z.instanceof(Test);
+ const SubtestSchema = z.instanceof(Subtest);
+ const AbstractSchema = z.instanceof(AbstractBar);
+ const BarSchema = z.instanceof(Bar);
+
+ TestSchema.parse(new Test());
+ TestSchema.parse(new Subtest());
+ SubtestSchema.parse(new Subtest());
+ AbstractSchema.parse(new Bar("asdf"));
+ const bar = BarSchema.parse(new Bar("asdf"));
+ expect(bar.val).toEqual("asdf");
+
+ await expect(() => SubtestSchema.parse(new Test())).toThrow(/Input not instance of Subtest/);
+ await expect(() => TestSchema.parse(12)).toThrow(/Input not instance of Test/);
+
+ util.assertEqual>(true);
+});
+
+test("instanceof fatal", () => {
+ const schema = z.instanceof(Date).refine((d) => d.toString());
+ const res = schema.safeParse(null);
+ expect(res.success).toBe(false);
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/intersection.test.ts b/tools/ui/node_modules/zod/src/v3/tests/intersection.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6d7936c199ca6202d32b84d47fe17719c68511b3
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/intersection.test.ts
@@ -0,0 +1,110 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+
+test("object intersection", () => {
+ const BaseTeacher = z.object({
+ subjects: z.array(z.string()),
+ });
+ const HasID = z.object({ id: z.string() });
+
+ const Teacher = z.intersection(BaseTeacher.passthrough(), HasID); // BaseTeacher.merge(HasID);
+ const data = {
+ subjects: ["math"],
+ id: "asdfasdf",
+ };
+ expect(Teacher.parse(data)).toEqual(data);
+ expect(() => Teacher.parse({ subject: data.subjects })).toThrow();
+ expect(Teacher.parse({ ...data, extra: 12 })).toEqual({ ...data, extra: 12 });
+
+ expect(() => z.intersection(BaseTeacher.strict(), HasID).parse({ ...data, extra: 12 })).toThrow();
+});
+
+test("deep intersection", () => {
+ const Animal = z.object({
+ properties: z.object({
+ is_animal: z.boolean(),
+ }),
+ });
+ const Cat = z
+ .object({
+ properties: z.object({
+ jumped: z.boolean(),
+ }),
+ })
+ .and(Animal);
+
+ type _Cat = z.infer;
+ // const cat:Cat = 'asdf' as any;
+ const cat = Cat.parse({ properties: { is_animal: true, jumped: true } });
+ expect(cat.properties).toEqual({ is_animal: true, jumped: true });
+});
+
+test("deep intersection of arrays", async () => {
+ const Author = z.object({
+ posts: z.array(
+ z.object({
+ post_id: z.number(),
+ })
+ ),
+ });
+ const Registry = z
+ .object({
+ posts: z.array(
+ z.object({
+ title: z.string(),
+ })
+ ),
+ })
+ .and(Author);
+
+ const posts = [
+ { post_id: 1, title: "Novels" },
+ { post_id: 2, title: "Fairy tales" },
+ ];
+ const cat = Registry.parse({ posts });
+ expect(cat.posts).toEqual(posts);
+ const asyncCat = await Registry.parseAsync({ posts });
+ expect(asyncCat.posts).toEqual(posts);
+});
+
+test("invalid intersection types", async () => {
+ const numberIntersection = z.intersection(
+ z.number(),
+ z.number().transform((x) => x + 1)
+ );
+
+ const syncResult = numberIntersection.safeParse(1234);
+ expect(syncResult.success).toEqual(false);
+ if (!syncResult.success) {
+ expect(syncResult.error.issues[0].code).toEqual(z.ZodIssueCode.invalid_intersection_types);
+ }
+
+ const asyncResult = await numberIntersection.spa(1234);
+ expect(asyncResult.success).toEqual(false);
+ if (!asyncResult.success) {
+ expect(asyncResult.error.issues[0].code).toEqual(z.ZodIssueCode.invalid_intersection_types);
+ }
+});
+
+test("invalid array merge", async () => {
+ const stringArrInt = z.intersection(
+ z.string().array(),
+ z
+ .string()
+ .array()
+ .transform((val) => [...val, "asdf"])
+ );
+ const syncResult = stringArrInt.safeParse(["asdf", "qwer"]);
+ expect(syncResult.success).toEqual(false);
+ if (!syncResult.success) {
+ expect(syncResult.error.issues[0].code).toEqual(z.ZodIssueCode.invalid_intersection_types);
+ }
+
+ const asyncResult = await stringArrInt.spa(["asdf", "qwer"]);
+ expect(asyncResult.success).toEqual(false);
+ if (!asyncResult.success) {
+ expect(asyncResult.error.issues[0].code).toEqual(z.ZodIssueCode.invalid_intersection_types);
+ }
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/language-server.source.ts b/tools/ui/node_modules/zod/src/v3/tests/language-server.source.ts
new file mode 100644
index 0000000000000000000000000000000000000000..cbe818bb3783a8d625a9c6fa8eb08c0db6829b77
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/language-server.source.ts
@@ -0,0 +1,76 @@
+import * as z from "zod/v3";
+
+export const filePath = __filename;
+
+// z.object()
+
+export const Test = z.object({
+ f1: z.number(),
+});
+
+export type Test = z.infer;
+
+export const instanceOfTest: Test = {
+ f1: 1,
+};
+
+// z.object().merge()
+
+export const TestMerge = z
+ .object({
+ f2: z.string().optional(),
+ })
+ .merge(Test);
+
+export type TestMerge = z.infer;
+
+export const instanceOfTestMerge: TestMerge = {
+ f1: 1,
+ f2: "string",
+};
+
+// z.union()
+
+export const TestUnion = z.union([
+ z.object({
+ f2: z.string().optional(),
+ }),
+ Test,
+]);
+
+export type TestUnion = z.infer;
+
+export const instanceOfTestUnion: TestUnion = {
+ f1: 1,
+ f2: "string",
+};
+
+// z.object().partial()
+
+export const TestPartial = Test.partial();
+
+export type TestPartial = z.infer;
+
+export const instanceOfTestPartial: TestPartial = {
+ f1: 1,
+};
+
+// z.object().pick()
+
+export const TestPick = TestMerge.pick({ f1: true });
+
+export type TestPick = z.infer;
+
+export const instanceOfTestPick: TestPick = {
+ f1: 1,
+};
+
+// z.object().omit()
+
+export const TestOmit = TestMerge.omit({ f2: true });
+
+export type TestOmit = z.infer;
+
+export const instanceOfTestOmit: TestOmit = {
+ f1: 1,
+};
diff --git a/tools/ui/node_modules/zod/src/v3/tests/language-server.test.ts b/tools/ui/node_modules/zod/src/v3/tests/language-server.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..851fdc483925537d0479ad506e9db521e5217810
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/language-server.test.ts
@@ -0,0 +1,207 @@
+import { test } from "vitest";
+// import path from "path";
+// import { Node, Project, SyntaxKind } from "ts-morph";
+
+// import { filePath } from "./language-server.source";
+
+// The following tool is helpful for understanding the TypeScript AST associated with these tests:
+// https://ts-ast-viewer.com/ (just copy the contents of language-server.source into the viewer)
+
+test("", () => {});
+// describe("Executing Go To Definition (and therefore Find Usages and Rename Refactoring) using an IDE works on inferred object properties", () => {
+// // Compile file developmentEnvironment.source
+// const project = new Project({
+// tsConfigFilePath: path.join(__dirname, "..", "..", "tsconfig.json"),
+// skipAddingFilesFromTsConfig: true,
+// });
+// const sourceFile = project.addSourceFileAtPath(filePath);
+
+// test("works for object properties inferred from z.object()", () => {
+// // Find usage of Test.f1 property
+// const instanceVariable =
+// sourceFile.getVariableDeclarationOrThrow("instanceOfTest");
+// const propertyBeingAssigned = getPropertyBeingAssigned(
+// instanceVariable,
+// "f1"
+// );
+
+// // Find definition of Test.f1 property
+// const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0];
+// const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind(
+// SyntaxKind.VariableDeclaration
+// );
+
+// // Assert that find definition returned the Zod definition of Test
+// expect(definitionOfProperty?.getText()).toEqual("f1: z.number()");
+// expect(parentOfProperty?.getName()).toEqual("Test");
+// });
+
+// // test("works for first object properties inferred from z.object().merge()", () => {
+// // // Find usage of TestMerge.f1 property
+// // const instanceVariable = sourceFile.getVariableDeclarationOrThrow(
+// // "instanceOfTestMerge"
+// // );
+// // const propertyBeingAssigned = getPropertyBeingAssigned(
+// // instanceVariable,
+// // "f1"
+// // );
+
+// // // Find definition of TestMerge.f1 property
+// // const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0];
+// // const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind(
+// // SyntaxKind.VariableDeclaration
+// // );
+
+// // // Assert that find definition returned the Zod definition of Test
+// // expect(definitionOfProperty?.getText()).toEqual("f1: z.number()");
+// // expect(parentOfProperty?.getName()).toEqual("Test");
+// // });
+
+// // test("works for second object properties inferred from z.object().merge()", () => {
+// // // Find usage of TestMerge.f2 property
+// // const instanceVariable = sourceFile.getVariableDeclarationOrThrow(
+// // "instanceOfTestMerge"
+// // );
+// // const propertyBeingAssigned = getPropertyBeingAssigned(
+// // instanceVariable,
+// // "f2"
+// // );
+
+// // // Find definition of TestMerge.f2 property
+// // const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0];
+// // const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind(
+// // SyntaxKind.VariableDeclaration
+// // );
+
+// // // Assert that find definition returned the Zod definition of TestMerge
+// // expect(definitionOfProperty?.getText()).toEqual(
+// // "f2: z.string().optional()"
+// // );
+// // expect(parentOfProperty?.getName()).toEqual("TestMerge");
+// // });
+
+// test("works for first object properties inferred from z.union()", () => {
+// // Find usage of TestUnion.f1 property
+// const instanceVariable = sourceFile.getVariableDeclarationOrThrow(
+// "instanceOfTestUnion"
+// );
+// const propertyBeingAssigned = getPropertyBeingAssigned(
+// instanceVariable,
+// "f1"
+// );
+
+// // Find definition of TestUnion.f1 property
+// const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0];
+// const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind(
+// SyntaxKind.VariableDeclaration
+// );
+
+// // Assert that find definition returned the Zod definition of Test
+// expect(definitionOfProperty?.getText()).toEqual("f1: z.number()");
+// expect(parentOfProperty?.getName()).toEqual("Test");
+// });
+
+// test("works for second object properties inferred from z.union()", () => {
+// // Find usage of TestUnion.f2 property
+// const instanceVariable = sourceFile.getVariableDeclarationOrThrow(
+// "instanceOfTestUnion"
+// );
+// const propertyBeingAssigned = getPropertyBeingAssigned(
+// instanceVariable,
+// "f2"
+// );
+
+// // Find definition of TestUnion.f2 property
+// const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0];
+// const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind(
+// SyntaxKind.VariableDeclaration
+// );
+
+// // Assert that find definition returned the Zod definition of TestUnion
+// expect(definitionOfProperty?.getText()).toEqual(
+// "f2: z.string().optional()"
+// );
+// expect(parentOfProperty?.getName()).toEqual("TestUnion");
+// });
+
+// test("works for object properties inferred from z.object().partial()", () => {
+// // Find usage of TestPartial.f1 property
+// const instanceVariable = sourceFile.getVariableDeclarationOrThrow(
+// "instanceOfTestPartial"
+// );
+// const propertyBeingAssigned = getPropertyBeingAssigned(
+// instanceVariable,
+// "f1"
+// );
+
+// // Find definition of TestPartial.f1 property
+// const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0];
+// const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind(
+// SyntaxKind.VariableDeclaration
+// );
+
+// // Assert that find definition returned the Zod definition of Test
+// expect(definitionOfProperty?.getText()).toEqual("f1: z.number()");
+// expect(parentOfProperty?.getName()).toEqual("Test");
+// });
+
+// test("works for object properties inferred from z.object().pick()", () => {
+// // Find usage of TestPick.f1 property
+// const instanceVariable =
+// sourceFile.getVariableDeclarationOrThrow("instanceOfTestPick");
+// const propertyBeingAssigned = getPropertyBeingAssigned(
+// instanceVariable,
+// "f1"
+// );
+
+// // Find definition of TestPick.f1 property
+// const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0];
+// const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind(
+// SyntaxKind.VariableDeclaration
+// );
+
+// // Assert that find definition returned the Zod definition of Test
+// expect(definitionOfProperty?.getText()).toEqual("f1: z.number()");
+// expect(parentOfProperty?.getName()).toEqual("Test");
+// });
+
+// test("works for object properties inferred from z.object().omit()", () => {
+// // Find usage of TestOmit.f1 property
+// const instanceVariable =
+// sourceFile.getVariableDeclarationOrThrow("instanceOfTestOmit");
+// const propertyBeingAssigned = getPropertyBeingAssigned(
+// instanceVariable,
+// "f1"
+// );
+
+// // Find definition of TestOmit.f1 property
+// const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0];
+// const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind(
+// SyntaxKind.VariableDeclaration
+// );
+
+// // Assert that find definition returned the Zod definition of Test
+// expect(definitionOfProperty?.getText()).toEqual("f1: z.number()");
+// expect(parentOfProperty?.getName()).toEqual("Test");
+// });
+// });
+
+// const getPropertyBeingAssigned = (node: Node, name: string) => {
+// const propertyAssignment = node.forEachDescendant((descendent) =>
+// Node.isPropertyAssignment(descendent) && descendent.getName() == name
+// ? descendent
+// : undefined
+// );
+
+// if (propertyAssignment == null)
+// fail(`Could not find property assignment with name ${name}`);
+
+// const propertyLiteral = propertyAssignment.getFirstDescendantByKind(
+// SyntaxKind.Identifier
+// );
+
+// if (propertyLiteral == null)
+// fail(`Could not find property literal with name ${name}`);
+
+// return propertyLiteral;
+// };
diff --git a/tools/ui/node_modules/zod/src/v3/tests/literal.test.ts b/tools/ui/node_modules/zod/src/v3/tests/literal.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d166a24f2daccb9b46d90a058398be7ba9c1b2a0
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/literal.test.ts
@@ -0,0 +1,36 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+
+const literalTuna = z.literal("tuna");
+const literalFortyTwo = z.literal(42);
+const literalTrue = z.literal(true);
+
+const terrificSymbol = Symbol("terrific");
+const literalTerrificSymbol = z.literal(terrificSymbol);
+
+test("passing validations", () => {
+ literalTuna.parse("tuna");
+ literalFortyTwo.parse(42);
+ literalTrue.parse(true);
+ literalTerrificSymbol.parse(terrificSymbol);
+});
+
+test("failing validations", () => {
+ expect(() => literalTuna.parse("shark")).toThrow();
+ expect(() => literalFortyTwo.parse(43)).toThrow();
+ expect(() => literalTrue.parse(false)).toThrow();
+ expect(() => literalTerrificSymbol.parse(Symbol("terrific"))).toThrow();
+});
+
+test("invalid_literal should have `received` field with data", () => {
+ const data = "shark";
+ const result = literalTuna.safeParse(data);
+ if (!result.success) {
+ const issue = result.error.issues[0];
+ if (issue.code === "invalid_literal") {
+ expect(issue.received).toBe(data);
+ }
+ }
+});
diff --git a/tools/ui/node_modules/zod/src/v3/tests/map.test.ts b/tools/ui/node_modules/zod/src/v3/tests/map.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..94718190376b4779f786f1f307a67c5a00460581
--- /dev/null
+++ b/tools/ui/node_modules/zod/src/v3/tests/map.test.ts
@@ -0,0 +1,110 @@
+// @ts-ignore TS6133
+import { expect, test } from "vitest";
+
+import * as z from "zod/v3";
+import { ZodIssueCode } from "zod/v3";
+import { util } from "../helpers/util.js";
+
+const stringMap = z.map(z.string(), z.string());
+type stringMap = z.infer