cloudcommerce 0.26.3 → 0.26.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
  3. package/ecomplus-stores/barra-doce/functions/ssr/package.json +6 -6
  4. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
  5. package/ecomplus-stores/barra-doce/package.json +2 -2
  6. package/ecomplus-stores/iluminim/functions/many/package.json +3 -3
  7. package/ecomplus-stores/iluminim/functions/ssr/package.json +6 -6
  8. package/ecomplus-stores/iluminim/functions/with-apps/package.json +3 -3
  9. package/ecomplus-stores/iluminim/package.json +2 -2
  10. package/package.json +2 -2
  11. package/packages/api/package.json +1 -1
  12. package/packages/apps/affilate-program/package.json +1 -1
  13. package/packages/apps/correios/package.json +1 -1
  14. package/packages/apps/custom-payment/package.json +1 -1
  15. package/packages/apps/custom-shipping/package.json +1 -1
  16. package/packages/apps/datafrete/package.json +1 -1
  17. package/packages/apps/discounts/package.json +1 -1
  18. package/packages/apps/emails/package.json +1 -1
  19. package/packages/apps/fb-conversions/package.json +1 -1
  20. package/packages/apps/flash-courier/package.json +1 -1
  21. package/packages/apps/frenet/package.json +1 -1
  22. package/packages/apps/galaxpay/package.json +1 -1
  23. package/packages/apps/google-analytics/package.json +1 -1
  24. package/packages/apps/jadlog/package.json +1 -1
  25. package/packages/apps/loyalty-points/package.json +1 -1
  26. package/packages/apps/melhor-envio/package.json +1 -1
  27. package/packages/apps/mercadopago/package.json +1 -1
  28. package/packages/apps/pagarme/package.json +1 -1
  29. package/packages/apps/paghiper/package.json +1 -1
  30. package/packages/apps/pix/package.json +1 -1
  31. package/packages/apps/tiny-erp/package.json +1 -1
  32. package/packages/apps/webhooks/package.json +1 -1
  33. package/packages/cli/package.json +1 -1
  34. package/packages/config/package.json +1 -1
  35. package/packages/emails/package.json +1 -1
  36. package/packages/eslint/package.json +1 -1
  37. package/packages/events/package.json +1 -1
  38. package/packages/feeds/package.json +1 -1
  39. package/packages/firebase/package.json +1 -1
  40. package/packages/i18n/package.json +1 -1
  41. package/packages/modules/package.json +1 -1
  42. package/packages/passport/package.json +1 -1
  43. package/packages/ssr/package.json +1 -1
  44. package/packages/storefront/astro.config.mjs +33 -23
  45. package/packages/storefront/dist/client/_astro/{Carousel.0b24e2cb.js → Carousel.9ad2e1dc.js} +1 -1
  46. package/packages/storefront/dist/client/_astro/{CartSidebar.2731d333.js → CartSidebar.a6c6a885.js} +1 -1
  47. package/packages/storefront/dist/client/_astro/{HeroSlider.a70b2582.js → HeroSlider.ee1e6200.js} +1 -1
  48. package/packages/storefront/dist/client/_astro/{PitchBar.13991988.js → PitchBar.6111676e.js} +1 -1
  49. package/packages/storefront/dist/client/_astro/{Prices.cdfa346a.js → Prices.04ff8fce.js} +1 -1
  50. package/packages/storefront/dist/client/_astro/{ProductShelf.619c56a5.js → ProductShelf.085721d6.js} +1 -1
  51. package/packages/storefront/dist/client/_astro/SearchModal.cffd4c2d.js +1 -0
  52. package/packages/storefront/dist/client/_astro/{ShopHeader.2c2fded7.js → ShopHeader.7e485e35.js} +2 -2
  53. package/packages/storefront/dist/client/_astro/{_plugin-vue_export-helper.fc5e2f5b.js → _plugin-vue_export-helper.ee681fa8.js} +1 -1
  54. package/packages/storefront/dist/client/_astro/{api.39f40cd8.js → api.a2eda23e.js} +1 -1
  55. package/packages/storefront/dist/client/_astro/client.e6d9439a.js +1 -0
  56. package/packages/storefront/dist/client/_astro/{format-money.86f14860.js → format-money.923559cc.js} +1 -1
  57. package/packages/storefront/dist/client/_astro/hoisted.85fdcf03.js +1 -0
  58. package/packages/storefront/dist/client/_astro/{img.d4891d80.js → img.ec6ba316.js} +1 -1
  59. package/packages/storefront/dist/client/_astro/{index.33801818.js → index.ea57babe.js} +1 -1
  60. package/packages/storefront/dist/client/_astro/{modules-info.ec412b24.js → modules-info.e5d77bf3.js} +1 -1
  61. package/packages/storefront/dist/client/sw.js +1 -1
  62. package/packages/storefront/dist/server/chunks/{CartSidebar.cca9fdd3.mjs → CartSidebar.41b20543.mjs} +20 -9
  63. package/packages/storefront/dist/server/chunks/{SearchModal.a680efae.mjs → SearchModal.5f5e6a15.mjs} +19 -8
  64. package/packages/storefront/dist/server/chunks/_...4a2548d2.mjs +35 -0
  65. package/packages/storefront/dist/server/chunks/account@_@astro.204fba92.mjs +35 -0
  66. package/packages/storefront/dist/server/chunks/{astro.440a2e08.mjs → astro.708269c6.mjs} +1859 -149
  67. package/packages/storefront/dist/server/chunks/endpoint@_@js.11be892a.mjs +35 -0
  68. package/packages/storefront/dist/server/chunks/index@_@astro.19e0f502.mjs +35 -0
  69. package/packages/storefront/dist/server/chunks/index@_@astro.b37a6ac9.mjs +35 -0
  70. package/packages/storefront/dist/{client/chunks/pages/_...slug_.astro.ec6517ba.mjs → server/chunks/pages/_...slug_.astro.36e8882b.mjs} +273 -331
  71. package/packages/storefront/dist/{client/chunks/pages/account.astro.3d2605e6.mjs → server/chunks/pages/account.astro.32e7e6ef.mjs} +10 -2
  72. package/packages/storefront/dist/server/chunks/pages/endpoint.js.f7a896a1.mjs +119 -0
  73. package/packages/storefront/dist/server/chunks/pages/{index.astro.079f316a.mjs → index.astro.3145bd93.mjs} +2 -3
  74. package/packages/storefront/dist/server/chunks/pages/{~fallback.astro.01594623.mjs → ~fallback.astro.ba4c2475.mjs} +20 -9
  75. package/packages/storefront/dist/server/chunks/~fallback@_@astro.6bb4c4b4.mjs +35 -0
  76. package/packages/storefront/dist/server/entry.mjs +2359 -1166
  77. package/packages/storefront/dist/server/renderers.mjs +21 -10
  78. package/packages/storefront/package.json +1 -1
  79. package/packages/storefront/src/lib/layouts/BaseHead.astro +3 -0
  80. package/packages/test-base/package.json +1 -1
  81. package/packages/types/package.json +1 -1
  82. package/pnpm-workspace.yaml +0 -2
  83. package/packages/storefront/dist/client/_astro/SearchModal.117a477d.js +0 -1
  84. package/packages/storefront/dist/client/_astro/client.a5d2898b.js +0 -1
  85. package/packages/storefront/dist/client/_astro/hoisted.d90361ee.js +0 -1
  86. package/packages/storefront/dist/client/_empty-middleware.mjs +0 -3
  87. package/packages/storefront/dist/client/chunks/CartSidebar.0ce1e999.mjs +0 -382
  88. package/packages/storefront/dist/client/chunks/SearchModal.f603145b.mjs +0 -32
  89. package/packages/storefront/dist/client/chunks/astro.11be33ee.mjs +0 -1424
  90. package/packages/storefront/dist/client/chunks/pages/index.astro.8ad03206.mjs +0 -1650
  91. package/packages/storefront/dist/client/chunks/pages/~fallback.astro.d31d20b4.mjs +0 -54
  92. package/packages/storefront/dist/client/chunks/sharp.3f154e38.mjs +0 -74
  93. package/packages/storefront/dist/client/manifest.e39eb543.mjs +0 -79
  94. package/packages/storefront/dist/client/pages/_---slug_.astro.mjs +0 -23
  95. package/packages/storefront/dist/client/pages/app/account.astro.mjs +0 -23
  96. package/packages/storefront/dist/client/pages/app.astro.mjs +0 -23
  97. package/packages/storefront/dist/client/pages/index.astro.mjs +0 -23
  98. package/packages/storefront/dist/client/pages/~fallback.astro.mjs +0 -23
  99. package/packages/storefront/dist/client/registerSW.js +0 -1
  100. package/packages/storefront/dist/client/renderers.mjs +0 -369
  101. package/packages/storefront/dist/server/chunks/_...f7cdc954.mjs +0 -24
  102. package/packages/storefront/dist/server/chunks/account@_@astro.fa8b921b.mjs +0 -24
  103. package/packages/storefront/dist/server/chunks/image-endpoint@_@js.802bf648.mjs +0 -24
  104. package/packages/storefront/dist/server/chunks/index@_@astro.a122f091.mjs +0 -24
  105. package/packages/storefront/dist/server/chunks/index@_@astro.da98dcbe.mjs +0 -24
  106. package/packages/storefront/dist/server/chunks/pages/_...slug_.astro.08ba5973.mjs +0 -3930
  107. package/packages/storefront/dist/server/chunks/pages/account.astro.f11f26f3.mjs +0 -15
  108. package/packages/storefront/dist/server/chunks/pages/image-endpoint.js.a9374d3e.mjs +0 -238
  109. package/packages/storefront/dist/server/chunks/sharp.52841bb4.mjs +0 -75
  110. package/packages/storefront/dist/server/chunks/~fallback@_@astro.876a97c5.mjs +0 -24
  111. package/packages/storefront/dist/server/manifest.12e7a10c.mjs +0 -561
  112. /package/packages/storefront/dist/client/{workbox-5e0bf4e4.js → workbox-1b331600.js} +0 -0
@@ -1,1244 +1,2438 @@
1
- import fs from 'node:fs';
2
- import http from 'node:http';
3
- import { TLSSocket } from 'node:tls';
4
- import 'cookie';
5
- import { l as levels, d as dateTimeFormat, A as AstroCookies, a as attachCookiesToResponse, c as createAPIContext, b as callEndpoint, e as callMiddleware, L as Logger, f as AstroIntegrationLogger, g as getSetCookiesFromResponse, manifest } from './manifest.12e7a10c.mjs';
6
- import { yellow, dim, bold, cyan, red, reset } from 'kleur/colors';
7
- import { joinPaths, slash, prependForwardSlash, removeTrailingForwardSlash, collapseDuplicateSlashes } from '@astrojs/internal-helpers/path';
8
- import { A as AstroError, G as GetStaticPathsRequired, j as InvalidGetStaticPathsReturn, k as InvalidGetStaticPathsEntry, l as GetStaticPathsExpectedParams, n as GetStaticPathsInvalidRouteParam, P as PageNumberParamNotFound, o as GetStaticPathsRemovedRSSHelper, N as NoMatchingStaticPathFound, p as PrerenderDynamicEndpointPathCollide, q as LocalsNotAnObject, R as ReservedSlotName, g as renderSlotToString, t as renderJSX, v as chunkToString, C as ClientAddressNotAvailable, S as StaticClientAddressNotAvailable, w as ResponseSentError, x as renderPage$1, y as AstroUserError } from './chunks/astro.440a2e08.mjs';
9
- import 'clsx';
10
- import crypto from 'node:crypto';
1
+ import { performance } from 'node:perf_hooks';
2
+ import { webcrypto } from 'node:crypto';
11
3
  import { ByteLengthQueuingStrategy, CountQueuingStrategy, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, TransformStream, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter } from 'node:stream/web';
12
- import { File, FormData, Headers as Headers$1, Request as Request$1, Response as Response$1, fetch as fetch$1 } from 'undici';
4
+ import { File, FormData, Headers, Request, Response, fetch } from 'undici';
5
+ import { setTimeout as setTimeout$1, clearTimeout as clearTimeout$1 } from 'node:timers';
6
+ import { N as NodeApp, h as deserializeManifest } from './chunks/astro.708269c6.mjs';
13
7
  import { Readable } from 'stream';
14
8
  import https from 'https';
15
9
  import path from 'node:path';
16
10
  import { fileURLToPath } from 'node:url';
17
11
  import os from 'os';
12
+ import fs from 'node:fs';
13
+ import http from 'node:http';
18
14
  import send from 'send';
19
15
  import enableDestroy from 'server-destroy';
20
16
  import { renderers } from './renderers.mjs';
21
- import 'string-width';
22
17
  import 'mime';
18
+ import 'cookie';
19
+ import 'kleur/colors';
20
+ import '@astrojs/internal-helpers/path';
23
21
  import 'path-to-regexp';
22
+ import 'node:tls';
23
+ import 'string-width';
24
24
  import 'html-escaper';
25
25
  import 'vue';
26
26
  import 'vue/server-renderer';
27
27
  import '@ecomplus/utils';
28
- import './chunks/pages/_...slug_.astro.08ba5973.mjs';
28
+ import './chunks/pages/_...slug_.astro.36e8882b.mjs';
29
+ import 'node:fs/promises';
30
+ import 'http-cache-semantics';
31
+ import 'node:os';
32
+ import 'image-size';
33
+ import 'magic-string';
34
+ import 'node:stream';
29
35
  import '@cloudcommerce/api';
30
36
  import 'node:events';
31
37
  import '@cloudcommerce/config';
32
38
  import 'ultrahtml';
33
- /* empty css */import 'image-size';
34
- import '@vueuse/core';
39
+ /* empty css */import '@vueuse/core';
35
40
  import '@headlessui/vue';
36
41
 
37
- let lastMessage;
38
- let lastMessageCount = 1;
39
- const consoleLogDestination = {
40
- write(event) {
41
- let dest = console.error;
42
- if (levels[event.level] < levels["error"]) {
43
- dest = console.log;
44
- }
45
- function getPrefix() {
46
- let prefix = "";
47
- let type = event.label;
48
- if (type) {
49
- prefix += dim(dateTimeFormat.format(/* @__PURE__ */ new Date()) + " ");
50
- if (event.level === "info") {
51
- type = bold(cyan(`[${type}]`));
52
- } else if (event.level === "warn") {
53
- type = bold(yellow(`[${type}]`));
54
- } else if (event.level === "error") {
55
- type = bold(red(`[${type}]`));
42
+ /** Returns the function bound to the given object. */
43
+ const __function_bind = Function.bind.bind(Function.call);
44
+ /** Returns whether the object prototype exists in another object. */
45
+ const __object_isPrototypeOf = Function.call.bind(Object.prototype.isPrototypeOf);
46
+ /** Current high resolution millisecond timestamp. */
47
+ const __performance_now = performance.now;
48
+ // @ts-expect-error
49
+ const INTERNALS = new WeakMap();
50
+ const internalsOf = (target, className, propName) => {
51
+ const internals = INTERNALS.get(target);
52
+ if (!internals)
53
+ throw new TypeError(`${className}.${propName} can only be used on instances of ${className}`);
54
+ return internals;
55
+ };
56
+ const allowStringTag = (value) => (value.prototype[Symbol.toStringTag] = value.name);
57
+
58
+ class DOMException extends Error {
59
+ constructor(message = '', name = 'Error') {
60
+ super(message);
61
+ this.code = 0;
62
+ this.name = name;
63
+ }
64
+ }
65
+ DOMException.INDEX_SIZE_ERR = 1;
66
+ DOMException.DOMSTRING_SIZE_ERR = 2;
67
+ DOMException.HIERARCHY_REQUEST_ERR = 3;
68
+ DOMException.WRONG_DOCUMENT_ERR = 4;
69
+ DOMException.INVALID_CHARACTER_ERR = 5;
70
+ DOMException.NO_DATA_ALLOWED_ERR = 6;
71
+ DOMException.NO_MODIFICATION_ALLOWED_ERR = 7;
72
+ DOMException.NOT_FOUND_ERR = 8;
73
+ DOMException.NOT_SUPPORTED_ERR = 9;
74
+ DOMException.INUSE_ATTRIBUTE_ERR = 10;
75
+ DOMException.INVALID_STATE_ERR = 11;
76
+ DOMException.SYNTAX_ERR = 12;
77
+ DOMException.INVALID_MODIFICATION_ERR = 13;
78
+ DOMException.NAMESPACE_ERR = 14;
79
+ DOMException.INVALID_ACCESS_ERR = 15;
80
+ DOMException.VALIDATION_ERR = 16;
81
+ DOMException.TYPE_MISMATCH_ERR = 17;
82
+ DOMException.SECURITY_ERR = 18;
83
+ DOMException.NETWORK_ERR = 19;
84
+ DOMException.ABORT_ERR = 20;
85
+ DOMException.URL_MISMATCH_ERR = 21;
86
+ DOMException.QUOTA_EXCEEDED_ERR = 22;
87
+ DOMException.TIMEOUT_ERR = 23;
88
+ DOMException.INVALID_NODE_TYPE_ERR = 24;
89
+ DOMException.DATA_CLONE_ERR = 25;
90
+ allowStringTag(DOMException);
91
+
92
+ /**
93
+ * Assert a condition.
94
+ * @param condition The condition that it should satisfy.
95
+ * @param message The error message.
96
+ * @param args The arguments for replacing placeholders in the message.
97
+ */
98
+ function assertType(condition, message, ...args) {
99
+ if (!condition) {
100
+ throw new TypeError(format(message, args));
101
+ }
102
+ }
103
+ /**
104
+ * Convert a text and arguments to one string.
105
+ * @param message The formating text
106
+ * @param args The arguments.
107
+ */
108
+ function format(message, args) {
109
+ let i = 0;
110
+ return message.replace(/%[os]/gu, () => anyToString(args[i++]));
111
+ }
112
+ /**
113
+ * Convert a value to a string representation.
114
+ * @param x The value to get the string representation.
115
+ */
116
+ function anyToString(x) {
117
+ if (typeof x !== "object" || x === null) {
118
+ return String(x);
119
+ }
120
+ return Object.prototype.toString.call(x);
121
+ }
122
+
123
+ let currentErrorHandler;
124
+ /**
125
+ * Print a error message.
126
+ * @param maybeError The error object.
127
+ */
128
+ function reportError(maybeError) {
129
+ try {
130
+ const error = maybeError instanceof Error
131
+ ? maybeError
132
+ : new Error(anyToString(maybeError));
133
+ // Call the user-defined error handler if exists.
134
+ if (currentErrorHandler) ;
135
+ // Dispatch an `error` event if this is on a browser.
136
+ if (typeof dispatchEvent === "function" &&
137
+ typeof ErrorEvent === "function") {
138
+ dispatchEvent(new ErrorEvent("error", { error, message: error.message }));
56
139
  }
57
- prefix += `${type} `;
58
- }
59
- return reset(prefix);
140
+ // Emit an `uncaughtException` event if this is on Node.js.
141
+ //istanbul ignore else
142
+ else if (typeof process !== "undefined" &&
143
+ typeof process.emit === "function") {
144
+ process.emit("uncaughtException", error);
145
+ return;
146
+ }
147
+ // Otherwise, print the error.
148
+ console.error(error);
60
149
  }
61
- let message = event.message;
62
- if (message === lastMessage) {
63
- lastMessageCount++;
64
- message = `${message} ${yellow(`(x${lastMessageCount})`)}`;
65
- } else {
66
- lastMessage = message;
67
- lastMessageCount = 1;
150
+ catch (_a) {
151
+ // ignore.
152
+ }
153
+ }
154
+
155
+ let currentWarnHandler;
156
+ /**
157
+ * The warning information.
158
+ */
159
+ class Warning {
160
+ constructor(code, message) {
161
+ this.code = code;
162
+ this.message = message;
163
+ }
164
+ /**
165
+ * Report this warning.
166
+ * @param args The arguments of the warning.
167
+ */
168
+ warn(...args) {
169
+ var _a;
170
+ try {
171
+ // Call the user-defined warning handler if exists.
172
+ if (currentWarnHandler) ;
173
+ // Otherwise, print the warning.
174
+ const stack = ((_a = new Error().stack) !== null && _a !== void 0 ? _a : "").replace(/^(?:.+?\n){2}/gu, "\n");
175
+ console.warn(this.message, ...args, stack);
176
+ }
177
+ catch (_b) {
178
+ // Ignore.
179
+ }
180
+ }
181
+ }
182
+
183
+ const InitEventWasCalledWhileDispatching = new Warning("W01", "Unable to initialize event under dispatching.");
184
+ const FalsyWasAssignedToCancelBubble = new Warning("W02", "Assigning any falsy value to 'cancelBubble' property has no effect.");
185
+ const TruthyWasAssignedToReturnValue = new Warning("W03", "Assigning any truthy value to 'returnValue' property has no effect.");
186
+ const NonCancelableEventWasCanceled = new Warning("W04", "Unable to preventDefault on non-cancelable events.");
187
+ const CanceledInPassiveListener = new Warning("W05", "Unable to preventDefault inside passive event listener invocation.");
188
+ const EventListenerWasDuplicated = new Warning("W06", "An event listener wasn't added because it has been added already: %o, %o");
189
+ const OptionWasIgnored = new Warning("W07", "The %o option value was abandoned because the event listener wasn't added as duplicated.");
190
+ const InvalidEventListener = new Warning("W08", "The 'callback' argument must be a function or an object that has 'handleEvent' method: %o");
191
+
192
+ /*eslint-disable class-methods-use-this */
193
+ /**
194
+ * An implementation of `Event` interface, that wraps a given event object.
195
+ * `EventTarget` shim can control the internal state of this `Event` objects.
196
+ * @see https://dom.spec.whatwg.org/#event
197
+ */
198
+ class Event {
199
+ /**
200
+ * @see https://dom.spec.whatwg.org/#dom-event-none
201
+ */
202
+ static get NONE() {
203
+ return NONE;
204
+ }
205
+ /**
206
+ * @see https://dom.spec.whatwg.org/#dom-event-capturing_phase
207
+ */
208
+ static get CAPTURING_PHASE() {
209
+ return CAPTURING_PHASE;
210
+ }
211
+ /**
212
+ * @see https://dom.spec.whatwg.org/#dom-event-at_target
213
+ */
214
+ static get AT_TARGET() {
215
+ return AT_TARGET;
216
+ }
217
+ /**
218
+ * @see https://dom.spec.whatwg.org/#dom-event-bubbling_phase
219
+ */
220
+ static get BUBBLING_PHASE() {
221
+ return BUBBLING_PHASE;
222
+ }
223
+ /**
224
+ * Initialize this event instance.
225
+ * @param type The type of this event.
226
+ * @param eventInitDict Options to initialize.
227
+ * @see https://dom.spec.whatwg.org/#dom-event-event
228
+ */
229
+ constructor(type, eventInitDict) {
230
+ Object.defineProperty(this, "isTrusted", {
231
+ value: false,
232
+ enumerable: true,
233
+ });
234
+ const opts = eventInitDict !== null && eventInitDict !== void 0 ? eventInitDict : {};
235
+ internalDataMap.set(this, {
236
+ type: String(type),
237
+ bubbles: Boolean(opts.bubbles),
238
+ cancelable: Boolean(opts.cancelable),
239
+ composed: Boolean(opts.composed),
240
+ target: null,
241
+ currentTarget: null,
242
+ stopPropagationFlag: false,
243
+ stopImmediatePropagationFlag: false,
244
+ canceledFlag: false,
245
+ inPassiveListenerFlag: false,
246
+ dispatchFlag: false,
247
+ timeStamp: Date.now(),
248
+ });
249
+ }
250
+ /**
251
+ * The type of this event.
252
+ * @see https://dom.spec.whatwg.org/#dom-event-type
253
+ */
254
+ get type() {
255
+ return $(this).type;
256
+ }
257
+ /**
258
+ * The event target of the current dispatching.
259
+ * @see https://dom.spec.whatwg.org/#dom-event-target
260
+ */
261
+ get target() {
262
+ return $(this).target;
263
+ }
264
+ /**
265
+ * The event target of the current dispatching.
266
+ * @deprecated Use the `target` property instead.
267
+ * @see https://dom.spec.whatwg.org/#dom-event-srcelement
268
+ */
269
+ get srcElement() {
270
+ return $(this).target;
271
+ }
272
+ /**
273
+ * The event target of the current dispatching.
274
+ * @see https://dom.spec.whatwg.org/#dom-event-currenttarget
275
+ */
276
+ get currentTarget() {
277
+ return $(this).currentTarget;
278
+ }
279
+ /**
280
+ * The event target of the current dispatching.
281
+ * This doesn't support node tree.
282
+ * @see https://dom.spec.whatwg.org/#dom-event-composedpath
283
+ */
284
+ composedPath() {
285
+ const currentTarget = $(this).currentTarget;
286
+ if (currentTarget) {
287
+ return [currentTarget];
288
+ }
289
+ return [];
290
+ }
291
+ /**
292
+ * @see https://dom.spec.whatwg.org/#dom-event-none
293
+ */
294
+ get NONE() {
295
+ return NONE;
296
+ }
297
+ /**
298
+ * @see https://dom.spec.whatwg.org/#dom-event-capturing_phase
299
+ */
300
+ get CAPTURING_PHASE() {
301
+ return CAPTURING_PHASE;
302
+ }
303
+ /**
304
+ * @see https://dom.spec.whatwg.org/#dom-event-at_target
305
+ */
306
+ get AT_TARGET() {
307
+ return AT_TARGET;
308
+ }
309
+ /**
310
+ * @see https://dom.spec.whatwg.org/#dom-event-bubbling_phase
311
+ */
312
+ get BUBBLING_PHASE() {
313
+ return BUBBLING_PHASE;
314
+ }
315
+ /**
316
+ * The current event phase.
317
+ * @see https://dom.spec.whatwg.org/#dom-event-eventphase
318
+ */
319
+ get eventPhase() {
320
+ return $(this).dispatchFlag ? 2 : 0;
321
+ }
322
+ /**
323
+ * Stop event bubbling.
324
+ * Because this shim doesn't support node tree, this merely changes the `cancelBubble` property value.
325
+ * @see https://dom.spec.whatwg.org/#dom-event-stoppropagation
326
+ */
327
+ stopPropagation() {
328
+ $(this).stopPropagationFlag = true;
329
+ }
330
+ /**
331
+ * `true` if event bubbling was stopped.
332
+ * @deprecated
333
+ * @see https://dom.spec.whatwg.org/#dom-event-cancelbubble
334
+ */
335
+ get cancelBubble() {
336
+ return $(this).stopPropagationFlag;
337
+ }
338
+ /**
339
+ * Stop event bubbling if `true` is set.
340
+ * @deprecated Use the `stopPropagation()` method instead.
341
+ * @see https://dom.spec.whatwg.org/#dom-event-cancelbubble
342
+ */
343
+ set cancelBubble(value) {
344
+ if (value) {
345
+ $(this).stopPropagationFlag = true;
346
+ }
347
+ else {
348
+ FalsyWasAssignedToCancelBubble.warn();
349
+ }
350
+ }
351
+ /**
352
+ * Stop event bubbling and subsequent event listener callings.
353
+ * @see https://dom.spec.whatwg.org/#dom-event-stopimmediatepropagation
354
+ */
355
+ stopImmediatePropagation() {
356
+ const data = $(this);
357
+ data.stopPropagationFlag = data.stopImmediatePropagationFlag = true;
358
+ }
359
+ /**
360
+ * `true` if this event will bubble.
361
+ * @see https://dom.spec.whatwg.org/#dom-event-bubbles
362
+ */
363
+ get bubbles() {
364
+ return $(this).bubbles;
365
+ }
366
+ /**
367
+ * `true` if this event can be canceled by the `preventDefault()` method.
368
+ * @see https://dom.spec.whatwg.org/#dom-event-cancelable
369
+ */
370
+ get cancelable() {
371
+ return $(this).cancelable;
372
+ }
373
+ /**
374
+ * `true` if the default behavior will act.
375
+ * @deprecated Use the `defaultPrevented` proeprty instead.
376
+ * @see https://dom.spec.whatwg.org/#dom-event-returnvalue
377
+ */
378
+ get returnValue() {
379
+ return !$(this).canceledFlag;
380
+ }
381
+ /**
382
+ * Cancel the default behavior if `false` is set.
383
+ * @deprecated Use the `preventDefault()` method instead.
384
+ * @see https://dom.spec.whatwg.org/#dom-event-returnvalue
385
+ */
386
+ set returnValue(value) {
387
+ if (!value) {
388
+ setCancelFlag($(this));
389
+ }
390
+ else {
391
+ TruthyWasAssignedToReturnValue.warn();
392
+ }
393
+ }
394
+ /**
395
+ * Cancel the default behavior.
396
+ * @see https://dom.spec.whatwg.org/#dom-event-preventdefault
397
+ */
398
+ preventDefault() {
399
+ setCancelFlag($(this));
400
+ }
401
+ /**
402
+ * `true` if the default behavior was canceled.
403
+ * @see https://dom.spec.whatwg.org/#dom-event-defaultprevented
404
+ */
405
+ get defaultPrevented() {
406
+ return $(this).canceledFlag;
407
+ }
408
+ /**
409
+ * @see https://dom.spec.whatwg.org/#dom-event-composed
410
+ */
411
+ get composed() {
412
+ return $(this).composed;
413
+ }
414
+ /**
415
+ * @see https://dom.spec.whatwg.org/#dom-event-istrusted
416
+ */
417
+ //istanbul ignore next
418
+ get isTrusted() {
419
+ return false;
420
+ }
421
+ /**
422
+ * @see https://dom.spec.whatwg.org/#dom-event-timestamp
423
+ */
424
+ get timeStamp() {
425
+ return $(this).timeStamp;
426
+ }
427
+ /**
428
+ * @deprecated Don't use this method. The constructor did initialization.
429
+ */
430
+ initEvent(type, bubbles = false, cancelable = false) {
431
+ const data = $(this);
432
+ if (data.dispatchFlag) {
433
+ InitEventWasCalledWhileDispatching.warn();
434
+ return;
435
+ }
436
+ internalDataMap.set(this, {
437
+ ...data,
438
+ type: String(type),
439
+ bubbles: Boolean(bubbles),
440
+ cancelable: Boolean(cancelable),
441
+ target: null,
442
+ currentTarget: null,
443
+ stopPropagationFlag: false,
444
+ stopImmediatePropagationFlag: false,
445
+ canceledFlag: false,
446
+ });
447
+ }
448
+ }
449
+ //------------------------------------------------------------------------------
450
+ // Helpers
451
+ //------------------------------------------------------------------------------
452
+ const NONE = 0;
453
+ const CAPTURING_PHASE = 1;
454
+ const AT_TARGET = 2;
455
+ const BUBBLING_PHASE = 3;
456
+ /**
457
+ * Private data for event wrappers.
458
+ */
459
+ const internalDataMap = new WeakMap();
460
+ /**
461
+ * Get private data.
462
+ * @param event The event object to get private data.
463
+ * @param name The variable name to report.
464
+ * @returns The private data of the event.
465
+ */
466
+ function $(event, name = "this") {
467
+ const retv = internalDataMap.get(event);
468
+ assertType(retv != null, "'%s' must be an object that Event constructor created, but got another one: %o", name, event);
469
+ return retv;
470
+ }
471
+ /**
472
+ * https://dom.spec.whatwg.org/#set-the-canceled-flag
473
+ * @param data private data.
474
+ */
475
+ function setCancelFlag(data) {
476
+ if (data.inPassiveListenerFlag) {
477
+ CanceledInPassiveListener.warn();
478
+ return;
479
+ }
480
+ if (!data.cancelable) {
481
+ NonCancelableEventWasCanceled.warn();
482
+ return;
483
+ }
484
+ data.canceledFlag = true;
485
+ }
486
+ // Set enumerable
487
+ Object.defineProperty(Event, "NONE", { enumerable: true });
488
+ Object.defineProperty(Event, "CAPTURING_PHASE", { enumerable: true });
489
+ Object.defineProperty(Event, "AT_TARGET", { enumerable: true });
490
+ Object.defineProperty(Event, "BUBBLING_PHASE", { enumerable: true });
491
+ const keys$1 = Object.getOwnPropertyNames(Event.prototype);
492
+ for (let i = 0; i < keys$1.length; ++i) {
493
+ if (keys$1[i] === "constructor") {
494
+ continue;
495
+ }
496
+ Object.defineProperty(Event.prototype, keys$1[i], { enumerable: true });
497
+ }
498
+
499
+ /**
500
+ * An implementation of `Event` interface, that wraps a given event object.
501
+ * This class controls the internal state of `Event`.
502
+ * @see https://dom.spec.whatwg.org/#interface-event
503
+ */
504
+ class EventWrapper extends Event {
505
+ /**
506
+ * Wrap a given event object to control states.
507
+ * @param event The event-like object to wrap.
508
+ */
509
+ static wrap(event) {
510
+ return new (getWrapperClassOf(event))(event);
511
+ }
512
+ constructor(event) {
513
+ super(event.type, {
514
+ bubbles: event.bubbles,
515
+ cancelable: event.cancelable,
516
+ composed: event.composed,
517
+ });
518
+ if (event.cancelBubble) {
519
+ super.stopPropagation();
520
+ }
521
+ if (event.defaultPrevented) {
522
+ super.preventDefault();
523
+ }
524
+ internalDataMap$1.set(this, { original: event });
525
+ // Define accessors
526
+ const keys = Object.keys(event);
527
+ for (let i = 0; i < keys.length; ++i) {
528
+ const key = keys[i];
529
+ if (!(key in this)) {
530
+ Object.defineProperty(this, key, defineRedirectDescriptor(event, key));
531
+ }
532
+ }
533
+ }
534
+ stopPropagation() {
535
+ super.stopPropagation();
536
+ const { original } = $$1(this);
537
+ if ("stopPropagation" in original) {
538
+ original.stopPropagation();
539
+ }
540
+ }
541
+ get cancelBubble() {
542
+ return super.cancelBubble;
543
+ }
544
+ set cancelBubble(value) {
545
+ super.cancelBubble = value;
546
+ const { original } = $$1(this);
547
+ if ("cancelBubble" in original) {
548
+ original.cancelBubble = value;
549
+ }
550
+ }
551
+ stopImmediatePropagation() {
552
+ super.stopImmediatePropagation();
553
+ const { original } = $$1(this);
554
+ if ("stopImmediatePropagation" in original) {
555
+ original.stopImmediatePropagation();
556
+ }
557
+ }
558
+ get returnValue() {
559
+ return super.returnValue;
560
+ }
561
+ set returnValue(value) {
562
+ super.returnValue = value;
563
+ const { original } = $$1(this);
564
+ if ("returnValue" in original) {
565
+ original.returnValue = value;
566
+ }
567
+ }
568
+ preventDefault() {
569
+ super.preventDefault();
570
+ const { original } = $$1(this);
571
+ if ("preventDefault" in original) {
572
+ original.preventDefault();
573
+ }
574
+ }
575
+ get timeStamp() {
576
+ const { original } = $$1(this);
577
+ if ("timeStamp" in original) {
578
+ return original.timeStamp;
579
+ }
580
+ return super.timeStamp;
581
+ }
582
+ }
583
+ /**
584
+ * Private data for event wrappers.
585
+ */
586
+ const internalDataMap$1 = new WeakMap();
587
+ /**
588
+ * Get private data.
589
+ * @param event The event object to get private data.
590
+ * @returns The private data of the event.
591
+ */
592
+ function $$1(event) {
593
+ const retv = internalDataMap$1.get(event);
594
+ assertType(retv != null, "'this' is expected an Event object, but got", event);
595
+ return retv;
596
+ }
597
+ /**
598
+ * Cache for wrapper classes.
599
+ * @type {WeakMap<Object, Function>}
600
+ * @private
601
+ */
602
+ const wrapperClassCache = new WeakMap();
603
+ // Make association for wrappers.
604
+ wrapperClassCache.set(Object.prototype, EventWrapper);
605
+ /**
606
+ * Get the wrapper class of a given prototype.
607
+ * @param originalEvent The event object to wrap.
608
+ */
609
+ function getWrapperClassOf(originalEvent) {
610
+ const prototype = Object.getPrototypeOf(originalEvent);
611
+ if (prototype == null) {
612
+ return EventWrapper;
613
+ }
614
+ let wrapper = wrapperClassCache.get(prototype);
615
+ if (wrapper == null) {
616
+ wrapper = defineWrapper(getWrapperClassOf(prototype), prototype);
617
+ wrapperClassCache.set(prototype, wrapper);
618
+ }
619
+ return wrapper;
620
+ }
621
+ /**
622
+ * Define new wrapper class.
623
+ * @param BaseEventWrapper The base wrapper class.
624
+ * @param originalPrototype The prototype of the original event.
625
+ */
626
+ function defineWrapper(BaseEventWrapper, originalPrototype) {
627
+ class CustomEventWrapper extends BaseEventWrapper {
628
+ }
629
+ const keys = Object.keys(originalPrototype);
630
+ for (let i = 0; i < keys.length; ++i) {
631
+ Object.defineProperty(CustomEventWrapper.prototype, keys[i], defineRedirectDescriptor(originalPrototype, keys[i]));
632
+ }
633
+ return CustomEventWrapper;
634
+ }
635
+ /**
636
+ * Get the property descriptor to redirect a given property.
637
+ */
638
+ function defineRedirectDescriptor(obj, key) {
639
+ const d = Object.getOwnPropertyDescriptor(obj, key);
640
+ return {
641
+ get() {
642
+ const original = $$1(this).original;
643
+ const value = original[key];
644
+ if (typeof value === "function") {
645
+ return value.bind(original);
646
+ }
647
+ return value;
648
+ },
649
+ set(value) {
650
+ const original = $$1(this).original;
651
+ original[key] = value;
652
+ },
653
+ configurable: d.configurable,
654
+ enumerable: d.enumerable,
655
+ };
656
+ }
657
+
658
+ /**
659
+ * Create a new listener.
660
+ * @param callback The callback function.
661
+ * @param capture The capture flag.
662
+ * @param passive The passive flag.
663
+ * @param once The once flag.
664
+ * @param signal The abort signal.
665
+ * @param signalListener The abort event listener for the abort signal.
666
+ */
667
+ function createListener(callback, capture, passive, once, signal, signalListener) {
668
+ return {
669
+ callback,
670
+ flags: (capture ? 1 /* Capture */ : 0) |
671
+ (passive ? 2 /* Passive */ : 0) |
672
+ (once ? 4 /* Once */ : 0),
673
+ signal,
674
+ signalListener,
675
+ };
676
+ }
677
+ /**
678
+ * Set the `removed` flag to the given listener.
679
+ * @param listener The listener to check.
680
+ */
681
+ function setRemoved(listener) {
682
+ listener.flags |= 8 /* Removed */;
683
+ }
684
+ /**
685
+ * Check if the given listener has the `capture` flag or not.
686
+ * @param listener The listener to check.
687
+ */
688
+ function isCapture(listener) {
689
+ return (listener.flags & 1 /* Capture */) === 1 /* Capture */;
690
+ }
691
+ /**
692
+ * Check if the given listener has the `passive` flag or not.
693
+ * @param listener The listener to check.
694
+ */
695
+ function isPassive(listener) {
696
+ return (listener.flags & 2 /* Passive */) === 2 /* Passive */;
697
+ }
698
+ /**
699
+ * Check if the given listener has the `once` flag or not.
700
+ * @param listener The listener to check.
701
+ */
702
+ function isOnce(listener) {
703
+ return (listener.flags & 4 /* Once */) === 4 /* Once */;
704
+ }
705
+ /**
706
+ * Check if the given listener has the `removed` flag or not.
707
+ * @param listener The listener to check.
708
+ */
709
+ function isRemoved(listener) {
710
+ return (listener.flags & 8 /* Removed */) === 8 /* Removed */;
711
+ }
712
+ /**
713
+ * Call an event listener.
714
+ * @param listener The listener to call.
715
+ * @param target The event target object for `thisArg`.
716
+ * @param event The event object for the first argument.
717
+ * @param attribute `true` if this callback is an event attribute handler.
718
+ */
719
+ function invokeCallback({ callback }, target, event) {
720
+ try {
721
+ if (typeof callback === "function") {
722
+ callback.call(target, event);
723
+ }
724
+ else if (typeof callback.handleEvent === "function") {
725
+ callback.handleEvent(event);
726
+ }
727
+ }
728
+ catch (thrownError) {
729
+ reportError(thrownError);
730
+ }
731
+ }
732
+
733
+ /**
734
+ * Find the index of given listener.
735
+ * This returns `-1` if not found.
736
+ * @param list The listener list.
737
+ * @param callback The callback function to find.
738
+ * @param capture The capture flag to find.
739
+ */
740
+ function findIndexOfListener({ listeners }, callback, capture) {
741
+ for (let i = 0; i < listeners.length; ++i) {
742
+ if (listeners[i].callback === callback &&
743
+ isCapture(listeners[i]) === capture) {
744
+ return i;
745
+ }
746
+ }
747
+ return -1;
748
+ }
749
+ /**
750
+ * Add the given listener.
751
+ * Does copy-on-write if needed.
752
+ * @param list The listener list.
753
+ * @param callback The callback function.
754
+ * @param capture The capture flag.
755
+ * @param passive The passive flag.
756
+ * @param once The once flag.
757
+ * @param signal The abort signal.
758
+ */
759
+ function addListener(list, callback, capture, passive, once, signal) {
760
+ let signalListener;
761
+ if (signal) {
762
+ signalListener = removeListener.bind(null, list, callback, capture);
763
+ signal.addEventListener("abort", signalListener);
764
+ }
765
+ const listener = createListener(callback, capture, passive, once, signal, signalListener);
766
+ if (list.cow) {
767
+ list.cow = false;
768
+ list.listeners = [...list.listeners, listener];
769
+ }
770
+ else {
771
+ list.listeners.push(listener);
68
772
  }
69
- const outMessage = getPrefix() + message;
70
- dest(outMessage);
773
+ return listener;
774
+ }
775
+ /**
776
+ * Remove a listener.
777
+ * @param list The listener list.
778
+ * @param callback The callback function to find.
779
+ * @param capture The capture flag to find.
780
+ * @returns `true` if it mutated the list directly.
781
+ */
782
+ function removeListener(list, callback, capture) {
783
+ const index = findIndexOfListener(list, callback, capture);
784
+ if (index !== -1) {
785
+ return removeListenerAt(list, index);
786
+ }
787
+ return false;
788
+ }
789
+ /**
790
+ * Remove a listener.
791
+ * @param list The listener list.
792
+ * @param index The index of the target listener.
793
+ * @param disableCow Disable copy-on-write if true.
794
+ * @returns `true` if it mutated the `listeners` array directly.
795
+ */
796
+ function removeListenerAt(list, index, disableCow = false) {
797
+ const listener = list.listeners[index];
798
+ // Set the removed flag.
799
+ setRemoved(listener);
800
+ // Dispose the abort signal listener if exists.
801
+ if (listener.signal) {
802
+ listener.signal.removeEventListener("abort", listener.signalListener);
803
+ }
804
+ // Remove it from the array.
805
+ if (list.cow && !disableCow) {
806
+ list.cow = false;
807
+ list.listeners = list.listeners.filter((_, i) => i !== index);
808
+ return false;
809
+ }
810
+ list.listeners.splice(index, 1);
71
811
  return true;
72
- }
812
+ }
813
+
814
+ /**
815
+ * Create a new `ListenerListMap` object.
816
+ */
817
+ function createListenerListMap() {
818
+ return Object.create(null);
819
+ }
820
+ /**
821
+ * Get the listener list of the given type.
822
+ * If the listener list has not been initialized, initialize and return it.
823
+ * @param listenerMap The listener list map.
824
+ * @param type The event type to get.
825
+ */
826
+ function ensureListenerList(listenerMap, type) {
827
+ var _a;
828
+ return ((_a = listenerMap[type]) !== null && _a !== void 0 ? _a : (listenerMap[type] = {
829
+ attrCallback: undefined,
830
+ attrListener: undefined,
831
+ cow: false,
832
+ listeners: [],
833
+ }));
834
+ }
835
+
836
+ /**
837
+ * An implementation of the `EventTarget` interface.
838
+ * @see https://dom.spec.whatwg.org/#eventtarget
839
+ */
840
+ class EventTarget {
841
+ /**
842
+ * Initialize this instance.
843
+ */
844
+ constructor() {
845
+ internalDataMap$2.set(this, createListenerListMap());
846
+ }
847
+ // Implementation
848
+ addEventListener(type0, callback0, options0) {
849
+ const listenerMap = $$2(this);
850
+ const { callback, capture, once, passive, signal, type, } = normalizeAddOptions(type0, callback0, options0);
851
+ if (callback == null || (signal === null || signal === void 0 ? void 0 : signal.aborted)) {
852
+ return;
853
+ }
854
+ const list = ensureListenerList(listenerMap, type);
855
+ // Find existing listener.
856
+ const i = findIndexOfListener(list, callback, capture);
857
+ if (i !== -1) {
858
+ warnDuplicate(list.listeners[i], passive, once, signal);
859
+ return;
860
+ }
861
+ // Add the new listener.
862
+ addListener(list, callback, capture, passive, once, signal);
863
+ }
864
+ // Implementation
865
+ removeEventListener(type0, callback0, options0) {
866
+ const listenerMap = $$2(this);
867
+ const { callback, capture, type } = normalizeOptions(type0, callback0, options0);
868
+ const list = listenerMap[type];
869
+ if (callback != null && list) {
870
+ removeListener(list, callback, capture);
871
+ }
872
+ }
873
+ // Implementation
874
+ dispatchEvent(e) {
875
+ const list = $$2(this)[String(e.type)];
876
+ if (list == null) {
877
+ return true;
878
+ }
879
+ const event = e instanceof Event ? e : EventWrapper.wrap(e);
880
+ const eventData = $(event, "event");
881
+ if (eventData.dispatchFlag) {
882
+ throw new DOMException("This event has been in dispatching.");
883
+ }
884
+ eventData.dispatchFlag = true;
885
+ eventData.target = eventData.currentTarget = this;
886
+ if (!eventData.stopPropagationFlag) {
887
+ const { cow, listeners } = list;
888
+ // Set copy-on-write flag.
889
+ list.cow = true;
890
+ // Call listeners.
891
+ for (let i = 0; i < listeners.length; ++i) {
892
+ const listener = listeners[i];
893
+ // Skip if removed.
894
+ if (isRemoved(listener)) {
895
+ continue;
896
+ }
897
+ // Remove this listener if has the `once` flag.
898
+ if (isOnce(listener) && removeListenerAt(list, i, !cow)) {
899
+ // Because this listener was removed, the next index is the
900
+ // same as the current value.
901
+ i -= 1;
902
+ }
903
+ // Call this listener with the `passive` flag.
904
+ eventData.inPassiveListenerFlag = isPassive(listener);
905
+ invokeCallback(listener, this, event);
906
+ eventData.inPassiveListenerFlag = false;
907
+ // Stop if the `event.stopImmediatePropagation()` method was called.
908
+ if (eventData.stopImmediatePropagationFlag) {
909
+ break;
910
+ }
911
+ }
912
+ // Restore copy-on-write flag.
913
+ if (!cow) {
914
+ list.cow = false;
915
+ }
916
+ }
917
+ eventData.target = null;
918
+ eventData.currentTarget = null;
919
+ eventData.stopImmediatePropagationFlag = false;
920
+ eventData.stopPropagationFlag = false;
921
+ eventData.dispatchFlag = false;
922
+ return !eventData.canceledFlag;
923
+ }
924
+ }
925
+ /**
926
+ * Internal data.
927
+ */
928
+ const internalDataMap$2 = new WeakMap();
929
+ /**
930
+ * Get private data.
931
+ * @param target The event target object to get private data.
932
+ * @param name The variable name to report.
933
+ * @returns The private data of the event.
934
+ */
935
+ function $$2(target, name = "this") {
936
+ const retv = internalDataMap$2.get(target);
937
+ assertType(retv != null, "'%s' must be an object that EventTarget constructor created, but got another one: %o", name, target);
938
+ return retv;
939
+ }
940
+ /**
941
+ * Normalize options.
942
+ * @param options The options to normalize.
943
+ */
944
+ function normalizeAddOptions(type, callback, options) {
945
+ var _a;
946
+ assertCallback(callback);
947
+ if (typeof options === "object" && options !== null) {
948
+ return {
949
+ type: String(type),
950
+ callback: callback !== null && callback !== void 0 ? callback : undefined,
951
+ capture: Boolean(options.capture),
952
+ passive: Boolean(options.passive),
953
+ once: Boolean(options.once),
954
+ signal: (_a = options.signal) !== null && _a !== void 0 ? _a : undefined,
955
+ };
956
+ }
957
+ return {
958
+ type: String(type),
959
+ callback: callback !== null && callback !== void 0 ? callback : undefined,
960
+ capture: Boolean(options),
961
+ passive: false,
962
+ once: false,
963
+ signal: undefined,
964
+ };
965
+ }
966
+ /**
967
+ * Normalize options.
968
+ * @param options The options to normalize.
969
+ */
970
+ function normalizeOptions(type, callback, options) {
971
+ assertCallback(callback);
972
+ if (typeof options === "object" && options !== null) {
973
+ return {
974
+ type: String(type),
975
+ callback: callback !== null && callback !== void 0 ? callback : undefined,
976
+ capture: Boolean(options.capture),
977
+ };
978
+ }
979
+ return {
980
+ type: String(type),
981
+ callback: callback !== null && callback !== void 0 ? callback : undefined,
982
+ capture: Boolean(options),
983
+ };
984
+ }
985
+ /**
986
+ * Assert the type of 'callback' argument.
987
+ * @param callback The callback to check.
988
+ */
989
+ function assertCallback(callback) {
990
+ if (typeof callback === "function" ||
991
+ (typeof callback === "object" &&
992
+ callback !== null &&
993
+ typeof callback.handleEvent === "function")) {
994
+ return;
995
+ }
996
+ if (callback == null || typeof callback === "object") {
997
+ InvalidEventListener.warn(callback);
998
+ return;
999
+ }
1000
+ throw new TypeError(format(InvalidEventListener.message, [callback]));
1001
+ }
1002
+ /**
1003
+ * Print warning for duplicated.
1004
+ * @param listener The current listener that is duplicated.
1005
+ * @param passive The passive flag of the new duplicated listener.
1006
+ * @param once The once flag of the new duplicated listener.
1007
+ * @param signal The signal object of the new duplicated listener.
1008
+ */
1009
+ function warnDuplicate(listener, passive, once, signal) {
1010
+ EventListenerWasDuplicated.warn(isCapture(listener) ? "capture" : "bubble", listener.callback);
1011
+ if (isPassive(listener) !== passive) {
1012
+ OptionWasIgnored.warn("passive");
1013
+ }
1014
+ if (isOnce(listener) !== once) {
1015
+ OptionWasIgnored.warn("once");
1016
+ }
1017
+ if (listener.signal !== signal) {
1018
+ OptionWasIgnored.warn("signal");
1019
+ }
1020
+ }
1021
+ // Set enumerable
1022
+ const keys$1$1 = Object.getOwnPropertyNames(EventTarget.prototype);
1023
+ for (let i = 0; i < keys$1$1.length; ++i) {
1024
+ if (keys$1$1[i] === "constructor") {
1025
+ continue;
1026
+ }
1027
+ Object.defineProperty(EventTarget.prototype, keys$1$1[i], { enumerable: true });
1028
+ }
1029
+
1030
+ function u(u,D){for(var t=0;t<D.length;t++){var F=D[t];F.enumerable=F.enumerable||!1,F.configurable=!0,"value"in F&&(F.writable=!0),Object.defineProperty(u,F.key,F);}}function D(D,t,F){return t&&u(D.prototype,t),F&&u(D,F),D}function t(u,D){(null==D||D>u.length)&&(D=u.length);for(var t=0,F=new Array(D);t<D;t++)F[t]=u[t];return F}function F(u,D){var F="undefined"!=typeof Symbol&&u[Symbol.iterator]||u["@@iterator"];if(F)return (F=F.call(u)).next.bind(F);if(Array.isArray(u)||(F=function(u,D){if(u){if("string"==typeof u)return t(u,D);var F=Object.prototype.toString.call(u).slice(8,-1);return "Object"===F&&u.constructor&&(F=u.constructor.name),"Map"===F||"Set"===F?Array.from(u):"Arguments"===F||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(F)?t(u,D):void 0}}(u))||D&&u&&"number"==typeof u.length){F&&(u=F);var e=0;return function(){return e>=u.length?{done:!0}:{done:!1,value:u[e++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e=/(?:[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDEC0-\uDEEB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/,C=/(?:[\$0-9A-Z_a-z\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u08D3-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1ABF\u1AC0\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA827\uA82C\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDD30-\uDD39\uDE80-\uDEA9\uDEAB\uDEAC\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF50\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD47\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDCE-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E-\uDC61\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCE9\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD35\uDD37\uDD38\uDD3B-\uDD43\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3\uDFE4\uDFF0\uDFF1]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]|\uDB40[\uDD00-\uDDEF])/;function A(u,D){return (D?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(u)}function E(u,D){void 0===D&&(D=!1);for(var t=[],F=0;F<u.length;){var E=u[F],n=function(e){if(!D)throw new TypeError(e);t.push({type:"INVALID_CHAR",index:F,value:u[F++]});};if("*"!==E)if("+"!==E&&"?"!==E)if("\\"!==E)if("{"!==E)if("}"!==E)if(":"!==E)if("("!==E)t.push({type:"CHAR",index:F,value:u[F++]});else {var r=1,i="",s=F+1,a=!1;if("?"===u[s]){n('Pattern cannot start with "?" at '+s);continue}for(;s<u.length;){if(!A(u[s],!1)){n("Invalid character '"+u[s]+"' at "+s+"."),a=!0;break}if("\\"!==u[s]){if(")"===u[s]){if(0==--r){s++;break}}else if("("===u[s]&&(r++,"?"!==u[s+1])){n("Capturing groups are not allowed at "+s),a=!0;break}i+=u[s++];}else i+=u[s++]+u[s++];}if(a)continue;if(r){n("Unbalanced pattern at "+F);continue}if(!i){n("Missing pattern at "+F);continue}t.push({type:"PATTERN",index:F,value:i}),F=s;}else {for(var B="",o=F+1;o<u.length;){var h=u.substr(o,1);if(!(o===F+1&&e.test(h)||o!==F+1&&C.test(h)))break;B+=u[o++];}if(!B){n("Missing parameter name at "+F);continue}t.push({type:"NAME",index:F,value:B}),F=o;}else t.push({type:"CLOSE",index:F,value:u[F++]});else t.push({type:"OPEN",index:F,value:u[F++]});else t.push({type:"ESCAPED_CHAR",index:F++,value:u[F++]});else t.push({type:"MODIFIER",index:F,value:u[F++]});else t.push({type:"ASTERISK",index:F,value:u[F++]});}return t.push({type:"END",index:F,value:""}),t}function n(u,D){void 0===D&&(D={});for(var t=E(u),F=D.prefixes,e=void 0===F?"./":F,C="[^"+r(D.delimiter||"/#?")+"]+?",A=[],n=0,i=0,s="",a=new Set,B=function(u){if(i<t.length&&t[i].type===u)return t[i++].value},o=function(){return B("MODIFIER")||B("ASTERISK")},h=function(u){var D=B(u);if(void 0!==D)return D;var F=t[i];throw new TypeError("Unexpected "+F.type+" at "+F.index+", expected "+u)},p=function(){for(var u,D="";u=B("CHAR")||B("ESCAPED_CHAR");)D+=u;return D},c=D.encodePart||function(u){return u};i<t.length;){var f=B("CHAR"),l=B("NAME"),m=B("PATTERN");if(l||m||!B("ASTERISK")||(m=".*"),l||m){var d=f||"";-1===e.indexOf(d)&&(s+=d,d=""),s&&(A.push(c(s)),s="");var g=l||n++;if(a.has(g))throw new TypeError("Duplicate name '"+g+"'.");a.add(g),A.push({name:g,prefix:c(d),suffix:"",pattern:m||C,modifier:o()||""});}else {var x=f||B("ESCAPED_CHAR");if(x)s+=x;else if(B("OPEN")){var S=p(),v=B("NAME")||"",y=B("PATTERN")||"";v||y||!B("ASTERISK")||(y=".*");var R=p();h("CLOSE");var k=o()||"";if(!v&&!y&&!k){s+=S;continue}if(!v&&!y&&!S)continue;s&&(A.push(c(s)),s=""),A.push({name:v||(y?n++:""),pattern:v&&!y?C:y,prefix:c(S),suffix:c(R),modifier:k});}else s&&(A.push(c(s)),s=""),h("END");}}return A}function r(u){return u.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function i(u){return u&&u.sensitive?"u":"ui"}function s(u,D,t){void 0===t&&(t={});for(var e,C=t.strict,A=void 0!==C&&C,E=t.start,n=void 0===E||E,s=t.end,a=void 0===s||s,B=t.encode,o=void 0===B?function(u){return u}:B,h="["+r(t.endsWith||"")+"]|$",p="["+r(t.delimiter||"/#?")+"]",c=n?"^":"",f=F(u);!(e=f()).done;){var l=e.value;if("string"==typeof l)c+=r(o(l));else {var m=r(o(l.prefix)),d=r(o(l.suffix));l.pattern?(D&&D.push(l),c+=m||d?"+"===l.modifier||"*"===l.modifier?"(?:"+m+"((?:"+l.pattern+")(?:"+d+m+"(?:"+l.pattern+"))*)"+d+")"+("*"===l.modifier?"?":""):"(?:"+m+"("+l.pattern+")"+d+")"+l.modifier:"+"===l.modifier||"*"===l.modifier?"((?:"+l.pattern+")"+l.modifier+")":"("+l.pattern+")"+l.modifier):c+="(?:"+m+d+")"+l.modifier;}}if(a)A||(c+=p+"?"),c+=t.endsWith?"(?="+h+")":"$";else {var g=u[u.length-1],x="string"==typeof g?p.indexOf(g[g.length-1])>-1:void 0===g;A||(c+="(?:"+p+"(?="+h+"))?"),x||(c+="(?="+p+"|"+h+")");}return new RegExp(c,i(t))}function a(u,D,t){return u instanceof RegExp?function(u,D){if(!D)return u;for(var t=/\((?:\?<(.*?)>)?(?!\?)/g,F=0,e=t.exec(u.source);e;)D.push({name:e[1]||F++,prefix:"",suffix:"",modifier:"",pattern:""}),e=t.exec(u.source);return u}(u,D):Array.isArray(u)?function(u,D,t){var F=u.map(function(u){return a(u,D,t).source});return new RegExp("(?:"+F.join("|")+")",i(t))}(u,D,t):function(u,D,t){return s(n(u,t),D,t)}(u,D,t)}var B={delimiter:"",prefixes:"",sensitive:!0,strict:!0},o={delimiter:".",prefixes:"",sensitive:!0,strict:!0},h={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function p(u,D){return u.startsWith(D)?u.substring(D.length,u.length):u}function c(u){return !(!u||u.length<2||"["!==u[0]&&("\\"!==u[0]&&"{"!==u[0]||"["!==u[1]))}var f,l=["ftp","file","http","https","ws","wss"];function m(u){if(!u)return !0;for(var D,t=F(l);!(D=t()).done;)if(u.test(D.value))return !0;return !1}function d(u){switch(u){case"ws":case"http":return "80";case"wws":case"https":return "443";case"ftp":return "21";default:return ""}}function g(u){if(""===u)return u;if(/^[-+.A-Za-z0-9]*$/.test(u))return u.toLowerCase();throw new TypeError("Invalid protocol '"+u+"'.")}function x(u){if(""===u)return u;var D=new URL("https://example.com");return D.username=u,D.username}function S(u){if(""===u)return u;var D=new URL("https://example.com");return D.password=u,D.password}function v(u){if(""===u)return u;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(u))throw new TypeError("Invalid hostname '"+u+"'");var D=new URL("https://example.com");return D.hostname=u,D.hostname}function y(u){if(""===u)return u;if(/[^0-9a-fA-F[\]:]/g.test(u))throw new TypeError("Invalid IPv6 hostname '"+u+"'");return u.toLowerCase()}function R(u){if(""===u)return u;if(/^[0-9]*$/.test(u)&&parseInt(u)<=65535)return u;throw new TypeError("Invalid port '"+u+"'.")}function k(u){if(""===u)return u;var D=new URL("https://example.com");return D.pathname="/"!==u[0]?"/-"+u:u,"/"!==u[0]?D.pathname.substring(2,D.pathname.length):D.pathname}function w(u){return ""===u?u:new URL("data:"+u).pathname}function P(u){if(""===u)return u;var D=new URL("https://example.com");return D.search=u,D.search.substring(1,D.search.length)}function T(u){if(""===u)return u;var D=new URL("https://example.com");return D.hash=u,D.hash.substring(1,D.hash.length)}!function(u){u[u.INIT=0]="INIT",u[u.PROTOCOL=1]="PROTOCOL",u[u.AUTHORITY=2]="AUTHORITY",u[u.USERNAME=3]="USERNAME",u[u.PASSWORD=4]="PASSWORD",u[u.HOSTNAME=5]="HOSTNAME",u[u.PORT=6]="PORT",u[u.PATHNAME=7]="PATHNAME",u[u.SEARCH=8]="SEARCH",u[u.HASH=9]="HASH",u[u.DONE=10]="DONE";}(f||(f={}));var b=function(){function u(u){this.input=void 0,this.tokenList=[],this.internalResult={},this.tokenIndex=0,this.tokenIncrement=1,this.componentStart=0,this.state=f.INIT,this.groupDepth=0,this.hostnameIPv6BracketDepth=0,this.shouldTreatAsStandardURL=!1,this.input=u;}var t=u.prototype;return t.parse=function(){for(this.tokenList=E(this.input,!0);this.tokenIndex<this.tokenList.length;this.tokenIndex+=this.tokenIncrement){if(this.tokenIncrement=1,"END"===this.tokenList[this.tokenIndex].type){if(this.state===f.INIT){this.rewind(),this.isHashPrefix()?this.changeState(f.HASH,1):this.isSearchPrefix()?(this.changeState(f.SEARCH,1),this.internalResult.hash=""):(this.changeState(f.PATHNAME,0),this.internalResult.search="",this.internalResult.hash="");continue}if(this.state===f.AUTHORITY){this.rewindAndSetState(f.HOSTNAME);continue}this.changeState(f.DONE,0);break}if(this.groupDepth>0){if(!this.isGroupClose())continue;this.groupDepth-=1;}if(this.isGroupOpen())this.groupDepth+=1;else switch(this.state){case f.INIT:this.isProtocolSuffix()&&(this.internalResult.username="",this.internalResult.password="",this.internalResult.hostname="",this.internalResult.port="",this.internalResult.pathname="",this.internalResult.search="",this.internalResult.hash="",this.rewindAndSetState(f.PROTOCOL));break;case f.PROTOCOL:if(this.isProtocolSuffix()){this.computeShouldTreatAsStandardURL();var u=f.PATHNAME,D=1;this.shouldTreatAsStandardURL&&(this.internalResult.pathname="/"),this.nextIsAuthoritySlashes()?(u=f.AUTHORITY,D=3):this.shouldTreatAsStandardURL&&(u=f.AUTHORITY),this.changeState(u,D);}break;case f.AUTHORITY:this.isIdentityTerminator()?this.rewindAndSetState(f.USERNAME):(this.isPathnameStart()||this.isSearchPrefix()||this.isHashPrefix())&&this.rewindAndSetState(f.HOSTNAME);break;case f.USERNAME:this.isPasswordPrefix()?this.changeState(f.PASSWORD,1):this.isIdentityTerminator()&&this.changeState(f.HOSTNAME,1);break;case f.PASSWORD:this.isIdentityTerminator()&&this.changeState(f.HOSTNAME,1);break;case f.HOSTNAME:this.isIPv6Open()?this.hostnameIPv6BracketDepth+=1:this.isIPv6Close()&&(this.hostnameIPv6BracketDepth-=1),this.isPortPrefix()&&!this.hostnameIPv6BracketDepth?this.changeState(f.PORT,1):this.isPathnameStart()?this.changeState(f.PATHNAME,0):this.isSearchPrefix()?this.changeState(f.SEARCH,1):this.isHashPrefix()&&this.changeState(f.HASH,1);break;case f.PORT:this.isPathnameStart()?this.changeState(f.PATHNAME,0):this.isSearchPrefix()?this.changeState(f.SEARCH,1):this.isHashPrefix()&&this.changeState(f.HASH,1);break;case f.PATHNAME:this.isSearchPrefix()?this.changeState(f.SEARCH,1):this.isHashPrefix()&&this.changeState(f.HASH,1);break;case f.SEARCH:this.isHashPrefix()&&this.changeState(f.HASH,1);}}},t.changeState=function(u,D){switch(this.state){case f.INIT:break;case f.PROTOCOL:this.internalResult.protocol=this.makeComponentString();break;case f.AUTHORITY:break;case f.USERNAME:this.internalResult.username=this.makeComponentString();break;case f.PASSWORD:this.internalResult.password=this.makeComponentString();break;case f.HOSTNAME:this.internalResult.hostname=this.makeComponentString();break;case f.PORT:this.internalResult.port=this.makeComponentString();break;case f.PATHNAME:this.internalResult.pathname=this.makeComponentString();break;case f.SEARCH:this.internalResult.search=this.makeComponentString();break;case f.HASH:this.internalResult.hash=this.makeComponentString();}this.changeStateWithoutSettingComponent(u,D);},t.changeStateWithoutSettingComponent=function(u,D){this.state=u,this.componentStart=this.tokenIndex+D,this.tokenIndex+=D,this.tokenIncrement=0;},t.rewind=function(){this.tokenIndex=this.componentStart,this.tokenIncrement=0;},t.rewindAndSetState=function(u){this.rewind(),this.state=u;},t.safeToken=function(u){return u<0&&(u=this.tokenList.length-u),u<this.tokenList.length?this.tokenList[u]:this.tokenList[this.tokenList.length-1]},t.isNonSpecialPatternChar=function(u,D){var t=this.safeToken(u);return t.value===D&&("CHAR"===t.type||"ESCAPED_CHAR"===t.type||"INVALID_CHAR"===t.type)},t.isProtocolSuffix=function(){return this.isNonSpecialPatternChar(this.tokenIndex,":")},t.nextIsAuthoritySlashes=function(){return this.isNonSpecialPatternChar(this.tokenIndex+1,"/")&&this.isNonSpecialPatternChar(this.tokenIndex+2,"/")},t.isIdentityTerminator=function(){return this.isNonSpecialPatternChar(this.tokenIndex,"@")},t.isPasswordPrefix=function(){return this.isNonSpecialPatternChar(this.tokenIndex,":")},t.isPortPrefix=function(){return this.isNonSpecialPatternChar(this.tokenIndex,":")},t.isPathnameStart=function(){return this.isNonSpecialPatternChar(this.tokenIndex,"/")},t.isSearchPrefix=function(){if(this.isNonSpecialPatternChar(this.tokenIndex,"?"))return !0;if("?"!==this.tokenList[this.tokenIndex].value)return !1;var u=this.safeToken(this.tokenIndex-1);return "NAME"!==u.type&&"PATTERN"!==u.type&&"CLOSE"!==u.type&&"ASTERISK"!==u.type},t.isHashPrefix=function(){return this.isNonSpecialPatternChar(this.tokenIndex,"#")},t.isGroupOpen=function(){return "OPEN"==this.tokenList[this.tokenIndex].type},t.isGroupClose=function(){return "CLOSE"==this.tokenList[this.tokenIndex].type},t.isIPv6Open=function(){return this.isNonSpecialPatternChar(this.tokenIndex,"[")},t.isIPv6Close=function(){return this.isNonSpecialPatternChar(this.tokenIndex,"]")},t.makeComponentString=function(){var u=this.tokenList[this.tokenIndex],D=this.safeToken(this.componentStart).index;return this.input.substring(D,u.index)},t.computeShouldTreatAsStandardURL=function(){var u={};Object.assign(u,B),u.encodePart=g;var D=a(this.makeComponentString(),void 0,u);this.shouldTreatAsStandardURL=m(D);},D(u,[{key:"result",get:function(){return this.internalResult}}]),u}(),I=["protocol","username","password","hostname","port","pathname","search","hash"];function O(u,D){if("string"!=typeof u)throw new TypeError("parameter 1 is not of type 'string'.");var t=new URL(u,D);return {protocol:t.protocol.substring(0,t.protocol.length-1),username:t.username,password:t.password,hostname:t.hostname,port:t.port,pathname:t.pathname,search:""!=t.search?t.search.substring(1,t.search.length):void 0,hash:""!=t.hash?t.hash.substring(1,t.hash.length):void 0}}function H(u,D,t){var F;if("string"==typeof D.baseURL)try{F=new URL(D.baseURL),u.protocol=F.protocol?F.protocol.substring(0,F.protocol.length-1):"",u.username=F.username,u.password=F.password,u.hostname=F.hostname,u.port=F.port,u.pathname=F.pathname,u.search=F.search?F.search.substring(1,F.search.length):"",u.hash=F.hash?F.hash.substring(1,F.hash.length):"";}catch(u){throw new TypeError("invalid baseURL '"+D.baseURL+"'.")}if("string"==typeof D.protocol&&(u.protocol=function(u,D){var t;return u=(t=u).endsWith(":")?t.substr(0,t.length-":".length):t,D||""===u?u:g(u)}(D.protocol,t)),"string"==typeof D.username&&(u.username=function(u,D){if(D||""===u)return u;var t=new URL("https://example.com");return t.username=u,t.username}(D.username,t)),"string"==typeof D.password&&(u.password=function(u,D){if(D||""===u)return u;var t=new URL("https://example.com");return t.password=u,t.password}(D.password,t)),"string"==typeof D.hostname&&(u.hostname=function(u,D){return D||""===u?u:c(u)?y(u):v(u)}(D.hostname,t)),"string"==typeof D.port&&(u.port=function(u,D,t){return d(D)===u&&(u=""),t||""===u?u:R(u)}(D.port,u.protocol,t)),"string"==typeof D.pathname){if(u.pathname=D.pathname,F&&!function(u,D){return !(!u.length||"/"!==u[0]&&(!D||u.length<2||"\\"!=u[0]&&"{"!=u[0]||"/"!=u[1]))}(u.pathname,t)){var e=F.pathname.lastIndexOf("/");e>=0&&(u.pathname=F.pathname.substring(0,e+1)+u.pathname);}u.pathname=function(u,D,t){if(t||""===u)return u;if(D&&!l.includes(D))return new URL(D+":"+u).pathname;var F="/"==u[0];return u=new URL(F?u:"/-"+u,"https://example.com").pathname,F||(u=u.substring(2,u.length)),u}(u.pathname,u.protocol,t);}return "string"==typeof D.search&&(u.search=function(u,D){if(u=p(u,"?"),D||""===u)return u;var t=new URL("https://example.com");return t.search=u,t.search?t.search.substring(1,t.search.length):""}(D.search,t)),"string"==typeof D.hash&&(u.hash=function(u,D){if(u=p(u,"#"),D||""===u)return u;var t=new URL("https://example.com");return t.hash=u,t.hash?t.hash.substring(1,t.hash.length):""}(D.hash,t)),u}function N(u){return u.replace(/([+*?:{}()\\])/g,"\\$1")}function L(u,D){for(var t="[^"+(D.delimiter||"/#?").replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")+"]+?",F=/(?:[\$0-9A-Z_a-z\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u08D3-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1ABF\u1AC0\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA827\uA82C\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDD30-\uDD39\uDE80-\uDEA9\uDEAB\uDEAC\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF50\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD47\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDCE-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E-\uDC61\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCE9\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD35\uDD37\uDD38\uDD3B-\uDD43\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3\uDFE4\uDFF0\uDFF1]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]|\uDB40[\uDD00-\uDDEF])/,e="",C=0;C<u.length;++C){var A=u[C],E=C>0?u[C-1]:null,n=C<u.length-1?u[C+1]:null;if("string"!=typeof A)if(""!==A.pattern){var r="number"!=typeof A.name,i=void 0!==D.prefixes?D.prefixes:"./",s=""!==A.suffix||""!==A.prefix&&(1!==A.prefix.length||!i.includes(A.prefix));s||!r||A.pattern!==t||""!==A.modifier||!n||n.prefix||n.suffix||(s="string"==typeof n?F.test(n.length>0?n[0]:""):"number"==typeof n.name),!s&&""===A.prefix&&E&&"string"==typeof E&&E.length>0&&(s=i.includes(E[E.length-1])),s&&(e+="{"),e+=N(A.prefix),r&&(e+=":"+A.name),".*"===A.pattern?e+=r||E&&"string"!=typeof E&&!E.modifier&&!s&&""===A.prefix?"(.*)":"*":A.pattern===t?r||(e+="("+t+")"):e+="("+A.pattern+")",A.pattern===t&&r&&""!==A.suffix&&F.test(A.suffix[0])&&(e+="\\"),e+=N(A.suffix),s&&(e+="}"),e+=A.modifier;}else {if(""===A.modifier){e+=N(A.prefix);continue}e+="{"+N(A.prefix)+"}"+A.modifier;}else e+=N(A);}return e}var U=function(){function u(u,D){void 0===u&&(u={}),this.pattern=void 0,this.regexp={},this.keys={},this.component_pattern={};try{if("string"==typeof u){var t=new b(u);if(t.parse(),u=t.result,D){if("string"!=typeof D)throw new TypeError("'baseURL' parameter is not of type 'string'.");u.baseURL=D;}else if("string"!=typeof u.protocol)throw new TypeError("A base URL must be provided for a relative constructor string.")}else if(D)throw new TypeError("parameter 1 is not of type 'string'.");if(!u||"object"!=typeof u)throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");var e;this.pattern=H({pathname:"*",protocol:"*",username:"*",password:"*",hostname:"*",port:"*",search:"*",hash:"*"},u,!0),d(this.pattern.protocol)===this.pattern.port&&(this.pattern.port="");for(var C,A=F(I);!(C=A()).done;)if((e=C.value)in this.pattern){var E={},r=this.pattern[e];switch(this.keys[e]=[],e){case"protocol":Object.assign(E,B),E.encodePart=g;break;case"username":Object.assign(E,B),E.encodePart=x;break;case"password":Object.assign(E,B),E.encodePart=S;break;case"hostname":Object.assign(E,o),E.encodePart=c(r)?y:v;break;case"port":Object.assign(E,B),E.encodePart=R;break;case"pathname":m(this.regexp.protocol)?(Object.assign(E,h),E.encodePart=k):(Object.assign(E,B),E.encodePart=w);break;case"search":Object.assign(E,B),E.encodePart=P;break;case"hash":Object.assign(E,B),E.encodePart=T;}try{var i=n(r,E);this.regexp[e]=s(i,this.keys[e],E),this.component_pattern[e]=L(i,E);}catch(u){throw new TypeError("invalid "+e+" pattern '"+this.pattern[e]+"'.")}}}catch(u){throw new TypeError("Failed to construct 'URLPattern': "+u.message)}}var t=u.prototype;return t.test=function(u,D){void 0===u&&(u={});var t,F={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if("string"!=typeof u&&D)throw new TypeError("parameter 1 is not of type 'string'.");if(void 0===u)return !1;try{F=H(F,"object"==typeof u?u:O(u,D),!1);}catch(u){return !1}for(t in this.pattern)if(!this.regexp[t].exec(F[t]))return !1;return !0},t.exec=function(u,D){void 0===u&&(u={});var t={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if("string"!=typeof u&&D)throw new TypeError("parameter 1 is not of type 'string'.");if(void 0!==u){try{t=H(t,"object"==typeof u?u:O(u,D),!1);}catch(u){return null}var e,C={};for(e in C.inputs=D?[u,D]:[u],this.pattern){var A=this.regexp[e].exec(t[e]);if(!A)return null;for(var E,n={},r=F(this.keys[e].entries());!(E=r()).done;){var i=E.value,s=i[1];"string"!=typeof s.name&&"number"!=typeof s.name||(n[s.name]=A[i[0]+1]||"");}C[e]={input:t[e]||"",groups:n};}return C}},D(u,[{key:"protocol",get:function(){return this.component_pattern.protocol}},{key:"username",get:function(){return this.component_pattern.username}},{key:"password",get:function(){return this.component_pattern.password}},{key:"hostname",get:function(){return this.component_pattern.hostname}},{key:"port",get:function(){return this.component_pattern.port}},{key:"pathname",get:function(){return this.component_pattern.pathname}},{key:"search",get:function(){return this.component_pattern.search}},{key:"hash",get:function(){return this.component_pattern.hash}}]),u}();
1031
+
1032
+ const INTERNAL$2 = { tick: 0, pool: new Map() };
1033
+ function requestAnimationFrame(callback) {
1034
+ if (!INTERNAL$2.pool.size) {
1035
+ setTimeout$1(() => {
1036
+ const next = __performance_now();
1037
+ for (const func of INTERNAL$2.pool.values()) {
1038
+ func(next);
1039
+ }
1040
+ INTERNAL$2.pool.clear();
1041
+ }, 1000 / 16);
1042
+ }
1043
+ const func = __function_bind(callback, undefined);
1044
+ const tick = ++INTERNAL$2.tick;
1045
+ INTERNAL$2.pool.set(tick, func);
1046
+ return tick;
1047
+ }
1048
+ function cancelAnimationFrame(requestId) {
1049
+ const timeout = INTERNAL$2.pool.get(requestId);
1050
+ if (timeout) {
1051
+ clearTimeout$1(timeout);
1052
+ INTERNAL$2.pool.delete(requestId);
1053
+ }
1054
+ }
1055
+
1056
+ class Node extends EventTarget {
1057
+ append(...nodesOrDOMStrings) {
1058
+ }
1059
+ appendChild(childNode) {
1060
+ return childNode;
1061
+ }
1062
+ after(...nodesOrDOMStrings) {
1063
+ }
1064
+ before(...nodesOrDOMStrings) {
1065
+ }
1066
+ prepend(...nodesOrDOMStrings) {
1067
+ }
1068
+ replaceChild(newChild, oldChild) {
1069
+ return oldChild;
1070
+ }
1071
+ removeChild(childNode) {
1072
+ return childNode;
1073
+ }
1074
+ get attributes() {
1075
+ return {};
1076
+ }
1077
+ get childNodes() {
1078
+ return [];
1079
+ }
1080
+ get children() {
1081
+ return [];
1082
+ }
1083
+ get ownerDocument() {
1084
+ return null;
1085
+ }
1086
+ get nodeValue() {
1087
+ return '';
1088
+ }
1089
+ set nodeValue(value) {
1090
+ }
1091
+ get textContent() {
1092
+ return '';
1093
+ }
1094
+ set textContent(value) {
1095
+ }
1096
+ get previousElementSibling() {
1097
+ return null;
1098
+ }
1099
+ get nextElementSibling() {
1100
+ return null;
1101
+ }
1102
+ [Symbol.for('nodejs.util.inspect.custom')](depth, options) {
1103
+ return `${this.constructor.name}`;
1104
+ }
1105
+ }
1106
+ class DocumentFragment extends Node {
1107
+ }
1108
+ class ShadowRoot extends DocumentFragment {
1109
+ get innerHTML() {
1110
+ return '';
1111
+ }
1112
+ set innerHTML(value) {
1113
+ }
1114
+ }
1115
+ const NodeFilter$1 = Object.assign({
1116
+ NodeFilter() {
1117
+ throw new TypeError('Illegal constructor');
1118
+ },
1119
+ }.NodeFilter, {
1120
+ FILTER_ACCEPT: 1,
1121
+ FILTER_REJECT: 2,
1122
+ FILTER_SKIP: 3,
1123
+ SHOW_ALL: 4294967295,
1124
+ SHOW_ELEMENT: 1,
1125
+ SHOW_ATTRIBUTE: 2,
1126
+ SHOW_TEXT: 4,
1127
+ SHOW_CDATA_SECTION: 8,
1128
+ SHOW_ENTITY_REFERENCE: 16,
1129
+ SHOW_ENTITY: 32,
1130
+ SHOW_PROCESSING_INSTRUCTION: 64,
1131
+ SHOW_COMMENT: 128,
1132
+ SHOW_DOCUMENT: 256,
1133
+ SHOW_DOCUMENT_TYPE: 512,
1134
+ SHOW_DOCUMENT_FRAGMENT: 1024,
1135
+ SHOW_NOTATION: 2048,
1136
+ });
1137
+ class NodeIterator$1 {
1138
+ nextNode() {
1139
+ return null;
1140
+ }
1141
+ previousNode() {
1142
+ return null;
1143
+ }
1144
+ get filter() {
1145
+ const internals = internalsOf(this, 'NodeIterator', 'filter');
1146
+ return internals.filter;
1147
+ }
1148
+ get pointerBeforeReferenceNode() {
1149
+ const internals = internalsOf(this, 'NodeIterator', 'pointerBeforeReferenceNode');
1150
+ return internals.pointerBeforeReferenceNode;
1151
+ }
1152
+ get referenceNode() {
1153
+ const internals = internalsOf(this, 'NodeIterator', 'referenceNode');
1154
+ return internals.referenceNode;
1155
+ }
1156
+ get root() {
1157
+ const internals = internalsOf(this, 'NodeIterator', 'root');
1158
+ return internals.root;
1159
+ }
1160
+ get whatToShow() {
1161
+ const internals = internalsOf(this, 'NodeIterator', 'whatToShow');
1162
+ return internals.whatToShow;
1163
+ }
1164
+ }
1165
+ allowStringTag(Node);
1166
+ allowStringTag(NodeIterator$1);
1167
+ allowStringTag(DocumentFragment);
1168
+ allowStringTag(ShadowRoot);
1169
+
1170
+ class CharacterData extends Node {
1171
+ constructor(data) {
1172
+ INTERNALS.set(super(), {
1173
+ data: String(data),
1174
+ });
1175
+ }
1176
+ get data() {
1177
+ return internalsOf(this, 'CharacterData', 'data')
1178
+ .data;
1179
+ }
1180
+ get textContent() {
1181
+ return internalsOf(this, 'CharacterData', 'textContent').data;
1182
+ }
1183
+ }
1184
+ class Comment extends CharacterData {
1185
+ }
1186
+ class Text extends CharacterData {
1187
+ get assignedSlot() {
1188
+ return null;
1189
+ }
1190
+ get wholeText() {
1191
+ return internalsOf(this, 'CharacterData', 'textContent').data;
1192
+ }
1193
+ }
1194
+ allowStringTag(CharacterData);
1195
+ allowStringTag(Text);
1196
+ allowStringTag(Comment);
1197
+
1198
+ class CustomEvent extends Event {
1199
+ constructor(type, params) {
1200
+ params = Object(params);
1201
+ super(type, params);
1202
+ if ('detail' in params)
1203
+ this.detail = params.detail;
1204
+ }
1205
+ }
1206
+ allowStringTag(CustomEvent);
1207
+
1208
+ const INTERNAL$1 = { tick: 0, pool: new Map() };
1209
+ function requestIdleCallback(callback) {
1210
+ if (!INTERNAL$1.pool.size) {
1211
+ setTimeout$1(() => {
1212
+ const next = __performance_now();
1213
+ for (const func of INTERNAL$1.pool.values()) {
1214
+ func(next);
1215
+ }
1216
+ INTERNAL$1.pool.clear();
1217
+ }, 1000 / 16);
1218
+ }
1219
+ const func = __function_bind(callback, undefined);
1220
+ const tick = ++INTERNAL$1.tick;
1221
+ INTERNAL$1.pool.set(tick, func);
1222
+ return tick;
1223
+ }
1224
+ function cancelIdleCallback(requestId) {
1225
+ const timeout = INTERNAL$1.pool.get(requestId);
1226
+ if (timeout) {
1227
+ clearTimeout$1(timeout);
1228
+ INTERNAL$1.pool.delete(requestId);
1229
+ }
1230
+ }
1231
+
1232
+ const PRIMITIVE = 0;
1233
+ const ARRAY = 1;
1234
+ const OBJECT = 2;
1235
+ const DATE = 3;
1236
+ const REGEXP = 4;
1237
+ const MAP = 5;
1238
+ const SET = 6;
1239
+ const ERROR = 7;
1240
+ const BIGINT = 8;
1241
+ // export const SYMBOL = 9;
1242
+
1243
+ const env = typeof self === 'object' ? self : globalThis;
1244
+
1245
+ const deserializer = ($, _) => {
1246
+ const as = (out, index) => {
1247
+ $.set(index, out);
1248
+ return out;
1249
+ };
1250
+
1251
+ const unpair = index => {
1252
+ if ($.has(index))
1253
+ return $.get(index);
1254
+
1255
+ const [type, value] = _[index];
1256
+ switch (type) {
1257
+ case PRIMITIVE:
1258
+ return as(value, index);
1259
+ case ARRAY: {
1260
+ const arr = as([], index);
1261
+ for (const index of value)
1262
+ arr.push(unpair(index));
1263
+ return arr;
1264
+ }
1265
+ case OBJECT: {
1266
+ const object = as({}, index);
1267
+ for (const [key, index] of value)
1268
+ object[unpair(key)] = unpair(index);
1269
+ return object;
1270
+ }
1271
+ case DATE:
1272
+ return as(new Date(value), index);
1273
+ case REGEXP: {
1274
+ const {source, flags} = value;
1275
+ return as(new RegExp(source, flags), index);
1276
+ }
1277
+ case MAP: {
1278
+ const map = as(new Map, index);
1279
+ for (const [key, index] of value)
1280
+ map.set(unpair(key), unpair(index));
1281
+ return map;
1282
+ }
1283
+ case SET: {
1284
+ const set = as(new Set, index);
1285
+ for (const index of value)
1286
+ set.add(unpair(index));
1287
+ return set;
1288
+ }
1289
+ case ERROR: {
1290
+ const {name, message} = value;
1291
+ return as(new env[name](message), index);
1292
+ }
1293
+ case BIGINT:
1294
+ return as(BigInt(value), index);
1295
+ case 'BigInt':
1296
+ return as(Object(BigInt(value)), index);
1297
+ }
1298
+ return as(new env[type](value), index);
1299
+ };
1300
+
1301
+ return unpair;
73
1302
  };
74
1303
 
75
- const RedirectComponentInstance = {
76
- default() {
77
- return new Response(null, {
78
- status: 301
79
- });
1304
+ /**
1305
+ * @typedef {Array<string,any>} Record a type representation
1306
+ */
1307
+
1308
+ /**
1309
+ * Returns a deserialized value from a serialized array of Records.
1310
+ * @param {Record[]} serialized a previously serialized value.
1311
+ * @returns {any}
1312
+ */
1313
+ const deserialize = serialized => deserializer(new Map, serialized)(0);
1314
+
1315
+ const EMPTY = '';
1316
+
1317
+ const {toString} = {};
1318
+ const {keys} = Object;
1319
+
1320
+ const typeOf = value => {
1321
+ const type = typeof value;
1322
+ if (type !== 'object' || !value)
1323
+ return [PRIMITIVE, type];
1324
+
1325
+ const asString = toString.call(value).slice(8, -1);
1326
+ switch (asString) {
1327
+ case 'Array':
1328
+ return [ARRAY, EMPTY];
1329
+ case 'Object':
1330
+ return [OBJECT, EMPTY];
1331
+ case 'Date':
1332
+ return [DATE, EMPTY];
1333
+ case 'RegExp':
1334
+ return [REGEXP, EMPTY];
1335
+ case 'Map':
1336
+ return [MAP, EMPTY];
1337
+ case 'Set':
1338
+ return [SET, EMPTY];
80
1339
  }
1340
+
1341
+ if (asString.includes('Array'))
1342
+ return [ARRAY, asString];
1343
+
1344
+ if (asString.includes('Error'))
1345
+ return [ERROR, asString];
1346
+
1347
+ return [OBJECT, asString];
81
1348
  };
82
- const RedirectSinglePageBuiltModule = {
83
- page: () => Promise.resolve(RedirectComponentInstance),
84
- onRequest: (_, next) => next(),
85
- renderers: []
1349
+
1350
+ const shouldSkip = ([TYPE, type]) => (
1351
+ TYPE === PRIMITIVE &&
1352
+ (type === 'function' || type === 'symbol')
1353
+ );
1354
+
1355
+ const serializer = (strict, json, $, _) => {
1356
+
1357
+ const as = (out, value) => {
1358
+ const index = _.push(out) - 1;
1359
+ $.set(value, index);
1360
+ return index;
1361
+ };
1362
+
1363
+ const pair = value => {
1364
+ if ($.has(value))
1365
+ return $.get(value);
1366
+
1367
+ let [TYPE, type] = typeOf(value);
1368
+ switch (TYPE) {
1369
+ case PRIMITIVE: {
1370
+ let entry = value;
1371
+ switch (type) {
1372
+ case 'bigint':
1373
+ TYPE = BIGINT;
1374
+ entry = value.toString();
1375
+ break;
1376
+ case 'function':
1377
+ case 'symbol':
1378
+ if (strict)
1379
+ throw new TypeError('unable to serialize ' + type);
1380
+ entry = null;
1381
+ break;
1382
+ }
1383
+ return as([TYPE, entry], value);
1384
+ }
1385
+ case ARRAY: {
1386
+ if (type)
1387
+ return as([type, [...value]], value);
1388
+
1389
+ const arr = [];
1390
+ const index = as([TYPE, arr], value);
1391
+ for (const entry of value)
1392
+ arr.push(pair(entry));
1393
+ return index;
1394
+ }
1395
+ case OBJECT: {
1396
+ if (type) {
1397
+ switch (type) {
1398
+ case 'BigInt':
1399
+ return as([type, value.toString()], value);
1400
+ case 'Boolean':
1401
+ case 'Number':
1402
+ case 'String':
1403
+ return as([type, value.valueOf()], value);
1404
+ }
1405
+ }
1406
+
1407
+ if (json && ('toJSON' in value))
1408
+ return pair(value.toJSON());
1409
+
1410
+ const entries = [];
1411
+ const index = as([TYPE, entries], value);
1412
+ for (const key of keys(value)) {
1413
+ if (strict || !shouldSkip(typeOf(value[key])))
1414
+ entries.push([pair(key), pair(value[key])]);
1415
+ }
1416
+ return index;
1417
+ }
1418
+ case DATE:
1419
+ return as([TYPE, value.toISOString()], value);
1420
+ case REGEXP: {
1421
+ const {source, flags} = value;
1422
+ return as([TYPE, {source, flags}], value);
1423
+ }
1424
+ case MAP: {
1425
+ const entries = [];
1426
+ const index = as([TYPE, entries], value);
1427
+ for (const [key, entry] of value) {
1428
+ if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry))))
1429
+ entries.push([pair(key), pair(entry)]);
1430
+ }
1431
+ return index;
1432
+ }
1433
+ case SET: {
1434
+ const entries = [];
1435
+ const index = as([TYPE, entries], value);
1436
+ for (const entry of value) {
1437
+ if (strict || !shouldSkip(typeOf(entry)))
1438
+ entries.push(pair(entry));
1439
+ }
1440
+ return index;
1441
+ }
1442
+ }
1443
+
1444
+ const {message} = value;
1445
+ return as([TYPE, {name: type, message}], value);
1446
+ };
1447
+
1448
+ return pair;
86
1449
  };
87
1450
 
88
- function routeIsRedirect(route) {
89
- return route?.type === "redirect";
90
- }
91
- function redirectRouteGenerate(redirectRoute, data) {
92
- const routeData = redirectRoute.redirectRoute;
93
- const route = redirectRoute.redirect;
94
- if (typeof routeData !== "undefined") {
95
- return routeData?.generate(data) || routeData?.pathname || "/";
96
- } else if (typeof route === "string") {
97
- return route;
98
- } else if (typeof route === "undefined") {
99
- return "/";
100
- }
101
- return route.destination;
102
- }
103
- function redirectRouteStatus(redirectRoute, method = "GET") {
104
- const routeData = redirectRoute.redirectRoute;
105
- if (typeof routeData?.redirect === "object") {
106
- return routeData.redirect.status;
107
- } else if (method !== "GET") {
108
- return 308;
109
- }
110
- return 301;
1451
+ /**
1452
+ * @typedef {Array<string,any>} Record a type representation
1453
+ */
1454
+
1455
+ /**
1456
+ * Returns an array of serialized Records.
1457
+ * @param {any} value a serializable value.
1458
+ * @param {{lossy?: boolean}?} options an object with a `lossy` property that,
1459
+ * if `true`, will not throw errors on incompatible types, and behave more
1460
+ * like JSON stringify would behave. Symbol and Function will be discarded.
1461
+ * @returns {Record[]}
1462
+ */
1463
+ const serialize = (value, {json, lossy} = {}) => {
1464
+ const _ = [];
1465
+ return serializer(!(json || lossy), !!json, new Map, _)(value), _;
1466
+ };
1467
+
1468
+ var structuredClone = (any, options) => deserialize(serialize(any, options));
1469
+
1470
+ const INTERNAL = { tick: 0, pool: new Map() };
1471
+ function setTimeout(callback, delay = 0, ...args) {
1472
+ const func = __function_bind(callback, globalThis);
1473
+ const tick = ++INTERNAL.tick;
1474
+ const timeout = setTimeout$1(func, delay, ...args);
1475
+ INTERNAL.pool.set(tick, timeout);
1476
+ return tick;
1477
+ }
1478
+ function clearTimeout(timeoutId) {
1479
+ const timeout = INTERNAL.pool.get(timeoutId);
1480
+ if (timeout) {
1481
+ clearTimeout$1(timeout);
1482
+ INTERNAL.pool.delete(timeoutId);
1483
+ }
111
1484
  }
112
1485
 
113
- const VALID_PARAM_TYPES = ["string", "number", "undefined"];
114
- function validateGetStaticPathsParameter([key, value], route) {
115
- if (!VALID_PARAM_TYPES.includes(typeof value)) {
116
- throw new AstroError({
117
- ...GetStaticPathsInvalidRouteParam,
118
- message: GetStaticPathsInvalidRouteParam.message(key, value, typeof value),
119
- location: {
120
- file: route
121
- }
122
- });
123
- }
1486
+ class TreeWalker {
1487
+ parentNode() {
1488
+ return null;
1489
+ }
1490
+ firstChild() {
1491
+ return null;
1492
+ }
1493
+ lastChild() {
1494
+ return null;
1495
+ }
1496
+ previousSibling() {
1497
+ return null;
1498
+ }
1499
+ nextSibling() {
1500
+ return null;
1501
+ }
1502
+ previousNode() {
1503
+ return null;
1504
+ }
1505
+ nextNode() {
1506
+ return null;
1507
+ }
1508
+ get currentNode() {
1509
+ const internals = internalsOf(this, 'TreeWalker', 'currentNode');
1510
+ return internals.currentNode;
1511
+ }
1512
+ get root() {
1513
+ const internals = internalsOf(this, 'TreeWalker', 'root');
1514
+ return internals.root;
1515
+ }
1516
+ get whatToShow() {
1517
+ const internals = internalsOf(this, 'TreeWalker', 'whatToShow');
1518
+ return internals.whatToShow;
1519
+ }
1520
+ }
1521
+ allowStringTag(TreeWalker);
1522
+
1523
+ class ImageData {
1524
+ constructor(arg0, arg1, ...args) {
1525
+ if (arguments.length < 2)
1526
+ throw new TypeError(`Failed to construct 'ImageData': 2 arguments required.`);
1527
+ /** Whether Uint8ClampedArray data is provided. */
1528
+ const hasData = __object_isPrototypeOf(Uint8ClampedArray.prototype, arg0);
1529
+ /** Image data, either provided or calculated. */
1530
+ const d = hasData
1531
+ ? arg0
1532
+ : new Uint8ClampedArray(asNumber(arg0, 'width') * asNumber(arg1, 'height') * 4);
1533
+ /** Image width. */
1534
+ const w = asNumber(hasData ? arg1 : arg0, 'width');
1535
+ /** Image height. */
1536
+ const h = d.length / w / 4;
1537
+ /** Image color space. */
1538
+ const c = String(Object(hasData ? args[1] : args[0]).colorSpace || 'srgb');
1539
+ // throw if a provided height does not match the calculated height
1540
+ if (args.length && asNumber(args[0], 'height') !== h)
1541
+ throw new DOMException('height is not equal to (4 * width * height)', 'IndexSizeError');
1542
+ // throw if a provided colorspace does not match a known colorspace
1543
+ if (c !== 'srgb' && c !== 'rec2020' && c !== 'display-p3')
1544
+ throw new TypeError('colorSpace is not known value');
1545
+ Object.defineProperty(this, 'data', {
1546
+ configurable: true,
1547
+ enumerable: true,
1548
+ value: d,
1549
+ });
1550
+ INTERNALS.set(this, {
1551
+ width: w,
1552
+ height: h,
1553
+ colorSpace: c,
1554
+ });
1555
+ }
1556
+ get data() {
1557
+ internalsOf(this, 'ImageData', 'data');
1558
+ return Object.getOwnPropertyDescriptor(this, 'data').value;
1559
+ }
1560
+ get width() {
1561
+ return internalsOf(this, 'ImageData', 'width').width;
1562
+ }
1563
+ get height() {
1564
+ return internalsOf(this, 'ImageData', 'height').height;
1565
+ }
124
1566
  }
125
- function validateDynamicRouteModule(mod, {
126
- ssr,
127
- route
128
- }) {
129
- if ((!ssr || route.prerender) && !mod.getStaticPaths) {
130
- throw new AstroError({
131
- ...GetStaticPathsRequired,
132
- location: { file: route.component }
1567
+ allowStringTag(ImageData);
1568
+ /** Returns a coerced number, optionally throwing if the number is zero-ish. */
1569
+ const asNumber = (value, axis) => {
1570
+ value = Number(value) || 0;
1571
+ if (value === 0)
1572
+ throw new TypeError(`The source ${axis} is zero or not a number.`);
1573
+ return value;
1574
+ };
1575
+
1576
+ class CanvasRenderingContext2D {
1577
+ get canvas() {
1578
+ return internalsOf(this, 'CanvasRenderingContext2D', 'canvas').canvas;
1579
+ }
1580
+ get direction() {
1581
+ return internalsOf(this, 'CanvasRenderingContext2D', 'direction')
1582
+ .direction;
1583
+ }
1584
+ get fillStyle() {
1585
+ return internalsOf(this, 'CanvasRenderingContext2D', 'fillStyle')
1586
+ .fillStyle;
1587
+ }
1588
+ get filter() {
1589
+ return internalsOf(this, 'CanvasRenderingContext2D', 'filter').filter;
1590
+ }
1591
+ get globalAlpha() {
1592
+ return internalsOf(this, 'CanvasRenderingContext2D', 'globalAlpha')
1593
+ .globalAlpha;
1594
+ }
1595
+ get globalCompositeOperation() {
1596
+ return internalsOf(this, 'CanvasRenderingContext2D', 'globalCompositeOperation').globalCompositeOperation;
1597
+ }
1598
+ get font() {
1599
+ return internalsOf(this, 'CanvasRenderingContext2D', 'font').font;
1600
+ }
1601
+ get imageSmoothingEnabled() {
1602
+ return internalsOf(this, 'CanvasRenderingContext2D', 'imageSmoothingEnabled').imageSmoothingEnabled;
1603
+ }
1604
+ get imageSmoothingQuality() {
1605
+ return internalsOf(this, 'CanvasRenderingContext2D', 'imageSmoothingQuality').imageSmoothingQuality;
1606
+ }
1607
+ get lineCap() {
1608
+ return internalsOf(this, 'CanvasRenderingContext2D', 'lineCap').lineCap;
1609
+ }
1610
+ get lineDashOffset() {
1611
+ return internalsOf(this, 'CanvasRenderingContext2D', 'lineDashOffset')
1612
+ .lineDashOffset;
1613
+ }
1614
+ get lineJoin() {
1615
+ return internalsOf(this, 'CanvasRenderingContext2D', 'lineJoin').lineJoin;
1616
+ }
1617
+ get lineWidth() {
1618
+ return internalsOf(this, 'CanvasRenderingContext2D', 'lineWidth')
1619
+ .lineWidth;
1620
+ }
1621
+ get miterLimit() {
1622
+ return internalsOf(this, 'CanvasRenderingContext2D', 'miterLimit')
1623
+ .miterLimit;
1624
+ }
1625
+ get strokeStyle() {
1626
+ return internalsOf(this, 'CanvasRenderingContext2D', 'strokeStyle')
1627
+ .strokeStyle;
1628
+ }
1629
+ get shadowOffsetX() {
1630
+ return internalsOf(this, 'CanvasRenderingContext2D', 'shadowOffsetX')
1631
+ .shadowOffsetX;
1632
+ }
1633
+ get shadowOffsetY() {
1634
+ return internalsOf(this, 'CanvasRenderingContext2D', 'shadowOffsetY')
1635
+ .shadowOffsetY;
1636
+ }
1637
+ get shadowBlur() {
1638
+ return internalsOf(this, 'CanvasRenderingContext2D', 'shadowBlur')
1639
+ .shadowBlur;
1640
+ }
1641
+ get shadowColor() {
1642
+ return internalsOf(this, 'CanvasRenderingContext2D', 'shadowColor')
1643
+ .shadowColor;
1644
+ }
1645
+ get textAlign() {
1646
+ return internalsOf(this, 'CanvasRenderingContext2D', 'textAlign')
1647
+ .textAlign;
1648
+ }
1649
+ get textBaseline() {
1650
+ return internalsOf(this, 'CanvasRenderingContext2D', 'textBaseline')
1651
+ .textBaseline;
1652
+ }
1653
+ arc() { }
1654
+ arcTo() { }
1655
+ beginPath() { }
1656
+ bezierCurveTo() { }
1657
+ clearRect() { }
1658
+ clip() { }
1659
+ closePath() { }
1660
+ createImageData(arg0, arg1) {
1661
+ /** Whether ImageData is provided. */
1662
+ const hasData = __object_isPrototypeOf(ImageData.prototype, arg0);
1663
+ const w = hasData ? arg0.width : arg0;
1664
+ const h = hasData ? arg0.height : arg1;
1665
+ const d = hasData
1666
+ ? arg0.data
1667
+ : new Uint8ClampedArray(w * h * 4);
1668
+ return new ImageData(d, w, h);
1669
+ }
1670
+ createLinearGradient() { }
1671
+ createPattern() { }
1672
+ createRadialGradient() { }
1673
+ drawFocusIfNeeded() { }
1674
+ drawImage() { }
1675
+ ellipse() { }
1676
+ fill() { }
1677
+ fillRect() { }
1678
+ fillText() { }
1679
+ getContextAttributes() { }
1680
+ getImageData() { }
1681
+ getLineDash() { }
1682
+ getTransform() { }
1683
+ isPointInPath() { }
1684
+ isPointInStroke() { }
1685
+ lineTo() { }
1686
+ measureText() { }
1687
+ moveTo() { }
1688
+ putImageData() { }
1689
+ quadraticCurveTo() { }
1690
+ rect() { }
1691
+ resetTransform() { }
1692
+ restore() { }
1693
+ rotate() { }
1694
+ save() { }
1695
+ scale() { }
1696
+ setLineDash() { }
1697
+ setTransform() { }
1698
+ stroke() { }
1699
+ strokeRect() { }
1700
+ strokeText() { }
1701
+ transform() { }
1702
+ translate() { }
1703
+ }
1704
+ allowStringTag(CanvasRenderingContext2D);
1705
+ const __createCanvasRenderingContext2D = (canvas) => {
1706
+ const renderingContext2D = Object.create(CanvasRenderingContext2D.prototype);
1707
+ INTERNALS.set(renderingContext2D, {
1708
+ canvas,
1709
+ direction: 'inherit',
1710
+ fillStyle: '#000',
1711
+ filter: 'none',
1712
+ font: '10px sans-serif',
1713
+ globalAlpha: 0,
1714
+ globalCompositeOperation: 'source-over',
1715
+ imageSmoothingEnabled: false,
1716
+ imageSmoothingQuality: 'high',
1717
+ lineCap: 'butt',
1718
+ lineDashOffset: 0.0,
1719
+ lineJoin: 'miter',
1720
+ lineWidth: 1.0,
1721
+ miterLimit: 10.0,
1722
+ shadowBlur: 0,
1723
+ shadowColor: '#000',
1724
+ shadowOffsetX: 0,
1725
+ shadowOffsetY: 0,
1726
+ strokeStyle: '#000',
1727
+ textAlign: 'start',
1728
+ textBaseline: 'alphabetic',
133
1729
  });
134
- }
1730
+ return renderingContext2D;
1731
+ };
1732
+
1733
+ class CustomElementRegistry {
1734
+ /** Defines a new custom element using the given tag name and HTMLElement constructor. */
1735
+ define(name, constructor, options) {
1736
+ const internals = internalsOf(this, 'CustomElementRegistry', 'define');
1737
+ name = String(name);
1738
+ if (/[A-Z]/.test(name))
1739
+ throw new SyntaxError('Custom element name cannot contain an uppercase ASCII letter');
1740
+ if (!/^[a-z]/.test(name))
1741
+ throw new SyntaxError('Custom element name must have a lowercase ASCII letter as its first character');
1742
+ if (!/-/.test(name))
1743
+ throw new SyntaxError('Custom element name must contain a hyphen');
1744
+ INTERNALS.set(constructor, {
1745
+ attributes: {},
1746
+ localName: name,
1747
+ });
1748
+ internals.constructorByName.set(name, constructor);
1749
+ internals.nameByConstructor.set(constructor, name);
1750
+ }
1751
+ /** Returns the constructor associated with the given tag name. */
1752
+ get(name) {
1753
+ const internals = internalsOf(this, 'CustomElementRegistry', 'get');
1754
+ name = String(name).toLowerCase();
1755
+ return internals.constructorByName.get(name);
1756
+ }
1757
+ getName(constructor) {
1758
+ const internals = internalsOf(this, 'CustomElementRegistry', 'getName');
1759
+ return internals.nameByConstructor.get(constructor);
1760
+ }
135
1761
  }
136
- function validateGetStaticPathsResult(result, logger, route) {
137
- if (!Array.isArray(result)) {
138
- throw new AstroError({
139
- ...InvalidGetStaticPathsReturn,
140
- message: InvalidGetStaticPathsReturn.message(typeof result),
141
- location: {
142
- file: route.component
143
- }
1762
+ allowStringTag(CustomElementRegistry);
1763
+ const initCustomElementRegistry = (target, exclude) => {
1764
+ if (exclude.has('customElements'))
1765
+ return;
1766
+ const CustomElementRegistry = target.CustomElementRegistry || globalThis.CustomElementRegistry;
1767
+ const customElements = target.customElements ||
1768
+ (target.customElements = new CustomElementRegistry());
1769
+ INTERNALS.set(customElements, {
1770
+ constructorByName: new Map(),
1771
+ nameByConstructor: new Map(),
144
1772
  });
145
- }
146
- result.forEach((pathObject) => {
147
- if (typeof pathObject === "object" && Array.isArray(pathObject) || pathObject === null) {
148
- throw new AstroError({
149
- ...InvalidGetStaticPathsEntry,
150
- message: InvalidGetStaticPathsEntry.message(
151
- Array.isArray(pathObject) ? "array" : typeof pathObject
152
- )
153
- });
1773
+ };
1774
+
1775
+ class Element extends Node {
1776
+ constructor() {
1777
+ super();
1778
+ if (INTERNALS.has(new.target)) {
1779
+ const internals = internalsOf(new.target, 'Element', 'localName');
1780
+ INTERNALS.set(this, {
1781
+ attributes: {},
1782
+ localName: internals.localName,
1783
+ ownerDocument: this.ownerDocument,
1784
+ shadowInit: null,
1785
+ shadowRoot: null,
1786
+ });
1787
+ }
1788
+ }
1789
+ hasAttribute(name) {
1790
+ return false;
1791
+ }
1792
+ getAttribute(name) {
1793
+ return null;
1794
+ }
1795
+ setAttribute(name, value) {
1796
+ }
1797
+ removeAttribute(name) {
1798
+ }
1799
+ attachShadow(init) {
1800
+ if (arguments.length < 1)
1801
+ throw new TypeError(`Failed to execute 'attachShadow' on 'Element': 1 argument required, but only 0 present.`);
1802
+ if (init !== Object(init))
1803
+ throw new TypeError(`Failed to execute 'attachShadow' on 'Element': The provided value is not of type 'ShadowRootInit'.`);
1804
+ if (init.mode !== 'open' && init.mode !== 'closed')
1805
+ throw new TypeError(`Failed to execute 'attachShadow' on 'Element': Failed to read the 'mode' property from 'ShadowRootInit': The provided value '${init.mode}' is not a valid enum value of type ShadowRootMode.`);
1806
+ const internals = internalsOf(this, 'Element', 'attachShadow');
1807
+ if (internals.shadowRoot)
1808
+ throw new Error('The operation is not supported.');
1809
+ internals.shadowInit = internals.shadowInit || {
1810
+ mode: init.mode,
1811
+ delegatesFocus: Boolean(init.delegatesFocus),
1812
+ };
1813
+ internals.shadowRoot =
1814
+ internals.shadowRoot ||
1815
+ (/^open$/.test(internals.shadowInit.mode)
1816
+ ? Object.setPrototypeOf(new EventTarget(), ShadowRoot.prototype)
1817
+ : null);
1818
+ return internals.shadowRoot;
1819
+ }
1820
+ get assignedSlot() {
1821
+ return null;
154
1822
  }
155
- if (pathObject.params === void 0 || pathObject.params === null || pathObject.params && Object.keys(pathObject.params).length === 0) {
156
- throw new AstroError({
157
- ...GetStaticPathsExpectedParams,
158
- location: {
159
- file: route.component
160
- }
161
- });
1823
+ get innerHTML() {
1824
+ internalsOf(this, 'Element', 'innerHTML');
1825
+ return '';
162
1826
  }
163
- for (const [key, val] of Object.entries(pathObject.params)) {
164
- if (!(typeof val === "undefined" || typeof val === "string" || typeof val === "number")) {
165
- logger.warn(
166
- "getStaticPaths",
167
- `invalid path param: ${key}. A string, number or undefined value was expected, but got \`${JSON.stringify(
168
- val
169
- )}\`.`
170
- );
171
- }
172
- if (typeof val === "string" && val === "") {
173
- logger.warn(
174
- "getStaticPaths",
175
- `invalid path param: ${key}. \`undefined\` expected for an optional param, but got empty string.`
176
- );
177
- }
1827
+ set innerHTML(value) {
1828
+ internalsOf(this, 'Element', 'innerHTML');
178
1829
  }
179
- });
180
- }
181
-
182
- function getParams(array) {
183
- const fn = (match) => {
184
- const params = {};
185
- array.forEach((key, i) => {
186
- if (key.startsWith("...")) {
187
- params[key.slice(3)] = match[i + 1] ? decodeURIComponent(match[i + 1]) : void 0;
188
- } else {
189
- params[key] = decodeURIComponent(match[i + 1]);
190
- }
191
- });
192
- return params;
193
- };
194
- return fn;
195
- }
196
- function stringifyParams(params, route) {
197
- const validatedParams = Object.entries(params).reduce((acc, next) => {
198
- validateGetStaticPathsParameter(next, route.component);
199
- const [key, value] = next;
200
- acc[key] = value?.toString();
201
- return acc;
202
- }, {});
203
- return JSON.stringify(route.generate(validatedParams));
204
- }
205
-
206
- function generatePaginateFunction(routeMatch) {
207
- return function paginateUtility(data, args = {}) {
208
- let { pageSize: _pageSize, params: _params, props: _props } = args;
209
- const pageSize = _pageSize || 10;
210
- const paramName = "page";
211
- const additionalParams = _params || {};
212
- const additionalProps = _props || {};
213
- let includesFirstPageNumber;
214
- if (routeMatch.params.includes(`...${paramName}`)) {
215
- includesFirstPageNumber = false;
216
- } else if (routeMatch.params.includes(`${paramName}`)) {
217
- includesFirstPageNumber = true;
218
- } else {
219
- throw new AstroError({
220
- ...PageNumberParamNotFound,
221
- message: PageNumberParamNotFound.message(paramName)
222
- });
1830
+ get shadowRoot() {
1831
+ const internals = internalsOf(this, 'Element', 'shadowRoot');
1832
+ return Object(internals.shadowInit).mode === 'open'
1833
+ ? internals.shadowRoot
1834
+ : null;
223
1835
  }
224
- const lastPage = Math.max(1, Math.ceil(data.length / pageSize));
225
- const result = [...Array(lastPage).keys()].map((num) => {
226
- const pageNum = num + 1;
227
- const start = pageSize === Infinity ? 0 : (pageNum - 1) * pageSize;
228
- const end = Math.min(start + pageSize, data.length);
229
- const params = {
230
- ...additionalParams,
231
- [paramName]: includesFirstPageNumber || pageNum > 1 ? String(pageNum) : void 0
232
- };
233
- const current = correctIndexRoute(routeMatch.generate({ ...params }));
234
- const next = pageNum === lastPage ? void 0 : correctIndexRoute(routeMatch.generate({ ...params, page: String(pageNum + 1) }));
235
- const prev = pageNum === 1 ? void 0 : correctIndexRoute(
236
- routeMatch.generate({
237
- ...params,
238
- page: !includesFirstPageNumber && pageNum - 1 === 1 ? void 0 : String(pageNum - 1)
239
- })
240
- );
241
- return {
242
- params,
243
- props: {
244
- ...additionalProps,
245
- page: {
246
- data: data.slice(start, end),
247
- start,
248
- end: end - 1,
249
- size: pageSize,
250
- total: data.length,
251
- currentPage: pageNum,
252
- lastPage,
253
- url: { current, next, prev }
254
- }
255
- }
256
- };
257
- });
258
- return result;
259
- };
260
- }
261
- function correctIndexRoute(route) {
262
- if (route === "") {
263
- return "/";
264
- }
265
- return route;
266
- }
267
-
268
- async function callGetStaticPaths({
269
- mod,
270
- route,
271
- routeCache,
272
- logger,
273
- ssr
274
- }) {
275
- const cached = routeCache.get(route);
276
- if (cached?.staticPaths)
277
- return cached.staticPaths;
278
- validateDynamicRouteModule(mod, { ssr, route });
279
- if (ssr && !route.prerender) {
280
- const entry = Object.assign([], { keyed: /* @__PURE__ */ new Map() });
281
- routeCache.set(route, { ...cached, staticPaths: entry });
282
- return entry;
283
- }
284
- if (!mod.getStaticPaths) {
285
- throw new Error("Unexpected Error.");
286
- }
287
- let staticPaths = [];
288
- staticPaths = await mod.getStaticPaths({
289
- // Q: Why the cast?
290
- // A: So users downstream can have nicer typings, we have to make some sacrifice in our internal typings, which necessitate a cast here
291
- paginate: generatePaginateFunction(route),
292
- rss() {
293
- throw new AstroError(GetStaticPathsRemovedRSSHelper);
1836
+ get localName() {
1837
+ return internalsOf(this, 'Element', 'localName')
1838
+ .localName;
1839
+ }
1840
+ get nodeName() {
1841
+ return internalsOf(this, 'Element', 'nodeName')
1842
+ .localName.toUpperCase();
1843
+ }
1844
+ get tagName() {
1845
+ return internalsOf(this, 'Element', 'tagName')
1846
+ .localName.toUpperCase();
294
1847
  }
295
- });
296
- validateGetStaticPathsResult(staticPaths, logger, route);
297
- const keyedStaticPaths = staticPaths;
298
- keyedStaticPaths.keyed = /* @__PURE__ */ new Map();
299
- for (const sp of keyedStaticPaths) {
300
- const paramsKey = stringifyParams(sp.params, route);
301
- keyedStaticPaths.keyed.set(paramsKey, sp);
302
- }
303
- routeCache.set(route, { ...cached, staticPaths: keyedStaticPaths });
304
- return keyedStaticPaths;
305
- }
306
- class RouteCache {
307
- logger;
308
- cache = {};
309
- mode;
310
- constructor(logger, mode = "production") {
311
- this.logger = logger;
312
- this.mode = mode;
313
- }
314
- /** Clear the cache. */
315
- clearAll() {
316
- this.cache = {};
317
- }
318
- set(route, entry) {
319
- if (this.mode === "production" && this.cache[route.component]?.staticPaths) {
320
- this.logger.warn(
321
- "routeCache",
322
- `Internal Warning: route cache overwritten. (${route.component})`
323
- );
324
- }
325
- this.cache[route.component] = entry;
326
- }
327
- get(route) {
328
- return this.cache[route.component];
329
- }
330
1848
  }
331
- function findPathItemByKey(staticPaths, params, route, logger) {
332
- const paramsKey = stringifyParams(params, route);
333
- const matchedStaticPath = staticPaths.keyed.get(paramsKey);
334
- if (matchedStaticPath) {
335
- return matchedStaticPath;
336
- }
337
- logger.debug("findPathItemByKey", `Unexpected cache miss looking for ${paramsKey}`);
1849
+ class HTMLElement extends Element {
338
1850
  }
339
-
340
- async function getParamsAndProps(opts) {
341
- const { logger, mod, route, routeCache, pathname, ssr } = opts;
342
- if (!route || route.pathname) {
343
- return [{}, {}];
344
- }
345
- const params = getRouteParams(route, pathname) ?? {};
346
- validatePrerenderEndpointCollision(route, mod, params);
347
- const staticPaths = await callGetStaticPaths({
348
- mod,
349
- route,
350
- routeCache,
351
- logger,
352
- ssr
353
- });
354
- const matchedStaticPath = findPathItemByKey(staticPaths, params, route, logger);
355
- if (!matchedStaticPath && (ssr ? route.prerender : true)) {
356
- throw new AstroError({
357
- ...NoMatchingStaticPathFound,
358
- message: NoMatchingStaticPathFound.message(pathname),
359
- hint: NoMatchingStaticPathFound.hint([route.component])
360
- });
361
- }
362
- const props = matchedStaticPath?.props ? { ...matchedStaticPath.props } : {};
363
- return [params, props];
1851
+ class HTMLBodyElement extends HTMLElement {
364
1852
  }
365
- function getRouteParams(route, pathname) {
366
- if (route.params.length) {
367
- const paramsMatch = route.pattern.exec(decodeURIComponent(pathname));
368
- if (paramsMatch) {
369
- return getParams(route.params)(paramsMatch);
370
- }
371
- }
1853
+ class HTMLDivElement extends HTMLElement {
372
1854
  }
373
- function validatePrerenderEndpointCollision(route, mod, params) {
374
- if (route.type === "endpoint" && mod.getStaticPaths) {
375
- const lastSegment = route.segments[route.segments.length - 1];
376
- const paramValues = Object.values(params);
377
- const lastParam = paramValues[paramValues.length - 1];
378
- if (lastSegment.length === 1 && lastSegment[0].dynamic && lastParam === void 0) {
379
- throw new AstroError({
380
- ...PrerenderDynamicEndpointPathCollide,
381
- message: PrerenderDynamicEndpointPathCollide.message(route.route),
382
- hint: PrerenderDynamicEndpointPathCollide.hint(route.component),
383
- location: {
384
- file: route.component
385
- }
386
- });
387
- }
388
- }
1855
+ class HTMLHeadElement extends HTMLElement {
389
1856
  }
390
-
391
- const clientLocalsSymbol$1 = Symbol.for("astro.locals");
392
- async function createRenderContext(options) {
393
- const request = options.request;
394
- const pathname = options.pathname ?? new URL(request.url).pathname;
395
- const [params, props] = await getParamsAndProps({
396
- mod: options.mod,
397
- route: options.route,
398
- routeCache: options.env.routeCache,
399
- pathname,
400
- logger: options.env.logger,
401
- ssr: options.env.ssr
402
- });
403
- const context = {
404
- ...options,
405
- pathname,
406
- params,
407
- props
408
- };
409
- Object.defineProperty(context, "locals", {
410
- enumerable: true,
411
- get() {
412
- return Reflect.get(request, clientLocalsSymbol$1);
413
- },
414
- set(val) {
415
- if (typeof val !== "object") {
416
- throw new AstroError(LocalsNotAnObject);
417
- } else {
418
- Reflect.set(request, clientLocalsSymbol$1, val);
419
- }
420
- }
421
- });
422
- return context;
1857
+ class HTMLHtmlElement extends HTMLElement {
1858
+ }
1859
+ class HTMLSpanElement extends HTMLElement {
1860
+ }
1861
+ class HTMLStyleElement extends HTMLElement {
1862
+ }
1863
+ class HTMLTemplateElement extends HTMLElement {
423
1864
  }
1865
+ class HTMLUnknownElement extends HTMLElement {
1866
+ }
1867
+ allowStringTag(Element);
1868
+ allowStringTag(HTMLElement);
1869
+ allowStringTag(HTMLBodyElement);
1870
+ allowStringTag(HTMLDivElement);
1871
+ allowStringTag(HTMLHeadElement);
1872
+ allowStringTag(HTMLHtmlElement);
1873
+ allowStringTag(HTMLSpanElement);
1874
+ allowStringTag(HTMLStyleElement);
1875
+ allowStringTag(HTMLTemplateElement);
1876
+ allowStringTag(HTMLUnknownElement);
424
1877
 
425
- const clientAddressSymbol$1 = Symbol.for("astro.clientAddress");
426
- const responseSentSymbol$1 = Symbol.for("astro.responseSent");
427
- function getFunctionExpression(slot) {
428
- if (!slot)
429
- return;
430
- if (slot.expressions?.length !== 1)
431
- return;
432
- return slot.expressions[0];
433
- }
434
- class Slots {
435
- #result;
436
- #slots;
437
- #logger;
438
- constructor(result, slots, logger) {
439
- this.#result = result;
440
- this.#slots = slots;
441
- this.#logger = logger;
442
- if (slots) {
443
- for (const key of Object.keys(slots)) {
444
- if (this[key] !== void 0) {
445
- throw new AstroError({
446
- ...ReservedSlotName,
447
- message: ReservedSlotName.message(key)
448
- });
449
- }
450
- Object.defineProperty(this, key, {
451
- get() {
452
- return true;
453
- },
454
- enumerable: true
1878
+ class Document extends Node {
1879
+ createElement(name) {
1880
+ const internals = internalsOf(this, 'Document', 'createElement');
1881
+ const customElementInternals = INTERNALS.get(internals.target.customElements);
1882
+ name = String(name).toLowerCase();
1883
+ const TypeOfHTMLElement = internals.constructorByName.get(name) ||
1884
+ (customElementInternals &&
1885
+ customElementInternals.constructorByName.get(name)) ||
1886
+ HTMLUnknownElement;
1887
+ const element = Object.setPrototypeOf(new EventTarget(), TypeOfHTMLElement.prototype);
1888
+ INTERNALS.set(element, {
1889
+ attributes: {},
1890
+ localName: name,
1891
+ ownerDocument: this,
1892
+ shadowInit: null,
1893
+ shadowRoot: null,
455
1894
  });
456
- }
1895
+ return element;
457
1896
  }
458
- }
459
- has(name) {
460
- if (!this.#slots)
461
- return false;
462
- return Boolean(this.#slots[name]);
463
- }
464
- async render(name, args = []) {
465
- if (!this.#slots || !this.has(name))
466
- return;
467
- const result = this.#result;
468
- if (!Array.isArray(args)) {
469
- this.#logger.warn(
470
- "Astro.slots.render",
471
- `Expected second parameter to be an array, received a ${typeof args}. If you're trying to pass an array as a single argument and getting unexpected results, make sure you're passing your array as a item of an array. Ex: Astro.slots.render('default', [["Hello", "World"]])`
472
- );
473
- } else if (args.length > 0) {
474
- const slotValue = this.#slots[name];
475
- const component = typeof slotValue === "function" ? await slotValue(result) : await slotValue;
476
- const expression = getFunctionExpression(component);
477
- if (expression) {
478
- const slot = async () => typeof expression === "function" ? expression(...args) : expression;
479
- return await renderSlotToString(result, slot).then((res) => {
480
- return res != null ? String(res) : res;
1897
+ createNodeIterator(root, whatToShow = NodeFilter.SHOW_ALL, filter) {
1898
+ const target = Object.create(NodeIterator.prototype);
1899
+ INTERNALS.set(target, {
1900
+ filter,
1901
+ pointerBeforeReferenceNode: false,
1902
+ referenceNode: root,
1903
+ root,
1904
+ whatToShow,
481
1905
  });
482
- }
483
- if (typeof component === "function") {
484
- return await renderJSX(result, component(...args)).then(
485
- (res) => res != null ? String(res) : res
486
- );
487
- }
1906
+ return target;
488
1907
  }
489
- const content = await renderSlotToString(result, this.#slots[name]);
490
- const outHTML = chunkToString(result, content);
491
- return outHTML;
492
- }
493
- }
494
- function createResult(args) {
495
- const { params, request, resolve, locals } = args;
496
- const url = new URL(request.url);
497
- const headers = new Headers();
498
- headers.set("Content-Type", "text/html");
499
- const response = {
500
- status: args.status,
501
- statusText: "OK",
502
- headers
503
- };
504
- Object.defineProperty(response, "headers", {
505
- value: response.headers,
506
- enumerable: true,
507
- writable: false
508
- });
509
- let cookies = args.cookies;
510
- const result = {
511
- styles: args.styles ?? /* @__PURE__ */ new Set(),
512
- scripts: args.scripts ?? /* @__PURE__ */ new Set(),
513
- links: args.links ?? /* @__PURE__ */ new Set(),
514
- componentMetadata: args.componentMetadata ?? /* @__PURE__ */ new Map(),
515
- renderers: args.renderers,
516
- clientDirectives: args.clientDirectives,
517
- compressHTML: args.compressHTML,
518
- pathname: args.pathname,
519
- cookies,
520
- /** This function returns the `Astro` faux-global */
521
- createAstro(astroGlobal, props, slots) {
522
- const astroSlots = new Slots(result, slots, args.logger);
523
- const Astro = {
524
- // @ts-expect-error
525
- __proto__: astroGlobal,
526
- get clientAddress() {
527
- if (!(clientAddressSymbol$1 in request)) {
528
- if (args.adapterName) {
529
- throw new AstroError({
530
- ...ClientAddressNotAvailable,
531
- message: ClientAddressNotAvailable.message(args.adapterName)
532
- });
533
- } else {
534
- throw new AstroError(StaticClientAddressNotAvailable);
535
- }
536
- }
537
- return Reflect.get(request, clientAddressSymbol$1);
538
- },
539
- get cookies() {
540
- if (cookies) {
541
- return cookies;
542
- }
543
- cookies = new AstroCookies(request);
544
- result.cookies = cookies;
545
- return cookies;
546
- },
547
- params,
548
- props,
549
- locals,
550
- request,
551
- url,
552
- redirect(path, status) {
553
- if (request[responseSentSymbol$1]) {
554
- throw new AstroError({
555
- ...ResponseSentError
556
- });
557
- }
558
- return new Response(null, {
559
- status: status || 302,
560
- headers: {
561
- Location: path
562
- }
563
- });
564
- },
565
- response,
566
- slots: astroSlots
567
- };
568
- return Astro;
569
- },
570
- resolve,
571
- response,
572
- _metadata: {
573
- hasHydrationScript: false,
574
- hasRenderedHead: false,
575
- hasDirectives: /* @__PURE__ */ new Set(),
576
- headInTree: false,
577
- extraHead: [],
578
- propagators: /* @__PURE__ */ new Map()
1908
+ createTextNode(data) {
1909
+ return new Text(data);
1910
+ }
1911
+ createTreeWalker(root, whatToShow = NodeFilter.SHOW_ALL, filter, expandEntityReferences) {
1912
+ const target = Object.create(TreeWalker.prototype);
1913
+ INTERNALS.set(target, {
1914
+ filter,
1915
+ currentNode: root,
1916
+ root,
1917
+ whatToShow,
1918
+ });
1919
+ return target;
1920
+ }
1921
+ get adoptedStyleSheets() {
1922
+ return [];
1923
+ }
1924
+ get styleSheets() {
1925
+ return [];
579
1926
  }
580
- };
581
- return result;
582
1927
  }
583
-
584
- async function renderPage({ mod, renderContext, env, cookies }) {
585
- if (routeIsRedirect(renderContext.route)) {
586
- return new Response(null, {
587
- status: redirectRouteStatus(renderContext.route, renderContext.request.method),
588
- headers: {
589
- location: redirectRouteGenerate(renderContext.route, renderContext.params)
590
- }
591
- });
592
- }
593
- const Component = mod.default;
594
- if (!Component)
595
- throw new Error(`Expected an exported Astro component but received typeof ${typeof Component}`);
596
- const result = createResult({
597
- adapterName: env.adapterName,
598
- links: renderContext.links,
599
- styles: renderContext.styles,
600
- logger: env.logger,
601
- params: renderContext.params,
602
- pathname: renderContext.pathname,
603
- componentMetadata: renderContext.componentMetadata,
604
- resolve: env.resolve,
605
- renderers: env.renderers,
606
- clientDirectives: env.clientDirectives,
607
- compressHTML: env.compressHTML,
608
- request: renderContext.request,
609
- site: env.site,
610
- scripts: renderContext.scripts,
611
- ssr: env.ssr,
612
- status: renderContext.status ?? 200,
613
- cookies,
614
- locals: renderContext.locals ?? {}
615
- });
616
- if (mod.frontmatter && typeof mod.frontmatter === "object" && "draft" in mod.frontmatter) {
617
- env.logger.warn(
618
- "astro",
619
- `The drafts feature is deprecated and used in ${renderContext.route.component}. You should migrate to content collections instead. See https://docs.astro.build/en/guides/content-collections/#filtering-collection-queries for more information.`
620
- );
621
- }
622
- const response = await renderPage$1(
623
- result,
624
- Component,
625
- renderContext.props,
626
- null,
627
- env.streaming,
628
- renderContext.route
629
- );
630
- if (result.cookies) {
631
- attachCookiesToResponse(response, result.cookies);
632
- }
633
- return response;
1928
+ class HTMLDocument extends Document {
634
1929
  }
1930
+ allowStringTag(Document);
1931
+ allowStringTag(HTMLDocument);
1932
+ const initDocument = (target, exclude) => {
1933
+ if (exclude.has('document'))
1934
+ return;
1935
+ const EventTarget = target.EventTarget || globalThis.EventTarget;
1936
+ const HTMLDocument = target.HTMLDocument || globalThis.HTMLDocument;
1937
+ const document = (target.document = Object.setPrototypeOf(new EventTarget(), HTMLDocument.prototype));
1938
+ INTERNALS.set(document, {
1939
+ target,
1940
+ constructorByName: new Map([
1941
+ ['body', target.HTMLBodyElement],
1942
+ ['canvas', target.HTMLCanvasElement],
1943
+ ['div', target.HTMLDivElement],
1944
+ ['head', target.HTMLHeadElement],
1945
+ ['html', target.HTMLHtmlElement],
1946
+ ['img', target.HTMLImageElement],
1947
+ ['span', target.HTMLSpanElement],
1948
+ ['style', target.HTMLStyleElement],
1949
+ ]),
1950
+ nameByConstructor: new Map(),
1951
+ });
1952
+ const initElement = (name, Class) => {
1953
+ const target = Object.setPrototypeOf(new EventTarget(), Class.prototype);
1954
+ INTERNALS.set(target, {
1955
+ attributes: {},
1956
+ localName: name,
1957
+ ownerDocument: document,
1958
+ shadowRoot: null,
1959
+ shadowInit: null,
1960
+ });
1961
+ return target;
1962
+ };
1963
+ document.body = initElement('body', target.HTMLBodyElement);
1964
+ document.head = initElement('head', target.HTMLHeadElement);
1965
+ document.documentElement = initElement('html', target.HTMLHtmlElement);
1966
+ };
635
1967
 
636
- function createEnvironment(options) {
637
- return options;
1968
+ class HTMLCanvasElement extends HTMLElement {
1969
+ get height() {
1970
+ return internalsOf(this, 'HTMLCanvasElement', 'height').height;
1971
+ }
1972
+ set height(value) {
1973
+ internalsOf(this, 'HTMLCanvasElement', 'height').height =
1974
+ Number(value) || 0;
1975
+ }
1976
+ get width() {
1977
+ return internalsOf(this, 'HTMLCanvasElement', 'width').width;
1978
+ }
1979
+ set width(value) {
1980
+ internalsOf(this, 'HTMLCanvasElement', 'width').width = Number(value) || 0;
1981
+ }
1982
+ captureStream() {
1983
+ return null;
1984
+ }
1985
+ getContext(contextType) {
1986
+ const internals = internalsOf(this, 'HTMLCanvasElement', 'getContext');
1987
+ switch (contextType) {
1988
+ case '2d':
1989
+ if (internals.renderingContext2D)
1990
+ return internals.renderingContext2D;
1991
+ internals.renderingContext2D = __createCanvasRenderingContext2D(this);
1992
+ return internals.renderingContext2D;
1993
+ default:
1994
+ return null;
1995
+ }
1996
+ }
1997
+ toBlob() { }
1998
+ toDataURL() { }
1999
+ transferControlToOffscreen() { }
638
2000
  }
2001
+ allowStringTag(HTMLCanvasElement);
639
2002
 
640
- function createAssetLink(href, base, assetsPrefix) {
641
- if (assetsPrefix) {
642
- return joinPaths(assetsPrefix, slash(href));
643
- } else if (base) {
644
- return prependForwardSlash(joinPaths(base, slash(href)));
645
- } else {
646
- return href;
647
- }
648
- }
649
- function createStylesheetElement(stylesheet, base, assetsPrefix) {
650
- if (stylesheet.type === "inline") {
651
- return {
652
- props: {
653
- type: "text/css"
654
- },
655
- children: stylesheet.content
656
- };
657
- } else {
658
- return {
659
- props: {
660
- rel: "stylesheet",
661
- href: createAssetLink(stylesheet.src, base, assetsPrefix)
662
- },
663
- children: ""
664
- };
665
- }
666
- }
667
- function createStylesheetElementSet(stylesheets, base, assetsPrefix) {
668
- return new Set(stylesheets.map((s) => createStylesheetElement(s, base, assetsPrefix)));
669
- }
670
- function createModuleScriptElement(script, base, assetsPrefix) {
671
- if (script.type === "external") {
672
- return createModuleScriptElementWithSrc(script.value, base, assetsPrefix);
673
- } else {
674
- return {
675
- props: {
676
- type: "module"
677
- },
678
- children: script.value
679
- };
680
- }
2003
+ class HTMLImageElement extends HTMLElement {
2004
+ get src() {
2005
+ return internalsOf(this, 'HTMLImageElement', 'src').src;
2006
+ }
2007
+ set src(value) {
2008
+ const internals = internalsOf(this, 'HTMLImageElement', 'src');
2009
+ internals.src = String(value);
2010
+ }
681
2011
  }
682
- function createModuleScriptElementWithSrc(src, base, assetsPrefix) {
683
- return {
684
- props: {
685
- type: "module",
686
- src: createAssetLink(src, base, assetsPrefix)
687
- },
688
- children: ""
689
- };
2012
+ allowStringTag(HTMLImageElement);
2013
+
2014
+ function Image() {
2015
+ // @ts-expect-error
2016
+ INTERNALS.set(this, {
2017
+ attributes: {},
2018
+ localName: 'img',
2019
+ innerHTML: '',
2020
+ shadowRoot: null,
2021
+ shadowInit: null,
2022
+ });
690
2023
  }
2024
+ Image.prototype = HTMLImageElement.prototype;
691
2025
 
692
- function matchRoute(pathname, manifest) {
693
- return manifest.routes.find((route) => route.pattern.test(decodeURI(pathname)));
694
- }
695
-
696
- class Pipeline {
697
- env;
698
- #onRequest;
699
- /**
700
- * The handler accepts the *original* `Request` and result returned by the endpoint.
701
- * It must return a `Response`.
702
- */
703
- #endpointHandler;
704
- /**
705
- * When creating a pipeline, an environment is mandatory.
706
- * The environment won't change for the whole lifetime of the pipeline.
707
- */
708
- constructor(env) {
709
- this.env = env;
710
- }
711
- setEnvironment() {
712
- }
713
- /**
714
- * When rendering a route, an "endpoint" will a type that needs to be handled and transformed into a `Response`.
715
- *
716
- * Each consumer might have different needs; use this function to set up the handler.
717
- */
718
- setEndpointHandler(handler) {
719
- this.#endpointHandler = handler;
720
- }
721
- /**
722
- * A middleware function that will be called before each request.
723
- */
724
- setMiddlewareFunction(onRequest) {
725
- this.#onRequest = onRequest;
726
- }
727
- /**
728
- * Returns the current environment
729
- */
730
- getEnvironment() {
731
- return this.env;
732
- }
733
- /**
734
- * The main function of the pipeline. Use this function to render any route known to Astro;
735
- */
736
- async renderRoute(renderContext, componentInstance) {
737
- const result = await this.#tryRenderRoute(
738
- renderContext,
739
- this.env,
740
- componentInstance,
741
- this.#onRequest
742
- );
743
- if (renderContext.route.type === "endpoint") {
744
- if (!this.#endpointHandler) {
745
- throw new Error(
746
- "You created a pipeline that does not know how to handle the result coming from an endpoint."
747
- );
748
- }
749
- return this.#endpointHandler(renderContext.request, result);
750
- } else {
751
- return result;
2026
+ class MediaQueryList extends EventTarget {
2027
+ get matches() {
2028
+ return internalsOf(this, 'MediaQueryList', 'matches').matches;
752
2029
  }
753
- }
754
- /**
755
- * It attempts to render a route. A route can be a:
756
- * - page
757
- * - redirect
758
- * - endpoint
759
- *
760
- * ## Errors
761
- *
762
- * It throws an error if the page can't be rendered.
763
- */
764
- async #tryRenderRoute(renderContext, env, mod, onRequest) {
765
- const apiContext = createAPIContext({
766
- request: renderContext.request,
767
- params: renderContext.params,
768
- props: renderContext.props,
769
- site: env.site,
770
- adapterName: env.adapterName
771
- });
772
- switch (renderContext.route.type) {
773
- case "page":
774
- case "redirect": {
775
- if (onRequest) {
776
- return await callMiddleware(
777
- env.logger,
778
- onRequest,
779
- apiContext,
780
- () => {
781
- return renderPage({
782
- mod,
783
- renderContext,
784
- env,
785
- cookies: apiContext.cookies
786
- });
787
- }
788
- );
789
- } else {
790
- return await renderPage({
791
- mod,
792
- renderContext,
793
- env,
794
- cookies: apiContext.cookies
795
- });
796
- }
797
- }
798
- case "endpoint": {
799
- const result = await callEndpoint(
800
- mod,
801
- env,
802
- renderContext,
803
- onRequest
804
- );
805
- return result;
806
- }
807
- default:
808
- throw new Error(`Couldn't find route of type [${renderContext.route.type}]`);
2030
+ get media() {
2031
+ return internalsOf(this, 'MediaQueryList', 'media').media;
809
2032
  }
810
- }
811
2033
  }
2034
+ allowStringTag(MediaQueryList);
2035
+ const initMediaQueryList = (target, exclude) => {
2036
+ if (exclude.has('MediaQueryList') || exclude.has('matchMedia'))
2037
+ return;
2038
+ const EventTarget = target.EventTarget || globalThis.EventTarget;
2039
+ const MediaQueryList = target.MediaQueryList || globalThis.MediaQueryList;
2040
+ target.matchMedia = function matchMedia(media) {
2041
+ const mql = Object.setPrototypeOf(new EventTarget(), MediaQueryList.prototype);
2042
+ INTERNALS.set(mql, {
2043
+ matches: false,
2044
+ media,
2045
+ });
2046
+ return mql;
2047
+ };
2048
+ };
812
2049
 
813
- class EndpointNotFoundError extends Error {
814
- originalResponse;
815
- constructor(originalResponse) {
816
- super();
817
- this.originalResponse = originalResponse;
818
- }
2050
+ class IntersectionObserver {
2051
+ disconnect() { }
2052
+ observe() { }
2053
+ takeRecords() {
2054
+ return [];
2055
+ }
2056
+ unobserve() { }
819
2057
  }
820
- class SSRRoutePipeline extends Pipeline {
821
- constructor(env) {
822
- super(env);
823
- this.setEndpointHandler(this.#ssrEndpointHandler);
824
- }
825
- // This function is responsible for handling the result coming from an endpoint.
826
- async #ssrEndpointHandler(request, response) {
827
- if (response.headers.get("X-Astro-Response") === "Not-Found") {
828
- throw new EndpointNotFoundError(response);
2058
+ class MutationObserver {
2059
+ disconnect() { }
2060
+ observe() { }
2061
+ takeRecords() {
2062
+ return [];
829
2063
  }
830
- return response;
831
- }
2064
+ unobserve() { }
2065
+ }
2066
+ class ResizeObserver {
2067
+ disconnect() { }
2068
+ observe() { }
2069
+ takeRecords() {
2070
+ return [];
2071
+ }
2072
+ unobserve() { }
832
2073
  }
2074
+ allowStringTag(MutationObserver);
2075
+ allowStringTag(IntersectionObserver);
2076
+ allowStringTag(ResizeObserver);
833
2077
 
834
- const clientLocalsSymbol = Symbol.for("astro.locals");
835
- const responseSentSymbol = Symbol.for("astro.responseSent");
836
- const STATUS_CODES = /* @__PURE__ */ new Set([404, 500]);
837
- class App {
838
- /**
839
- * The current environment of the application
840
- */
841
- #manifest;
842
- #manifestData;
843
- #routeDataToRouteInfo;
844
- #logger = new Logger({
845
- dest: consoleLogDestination,
846
- level: "info"
847
- });
848
- #baseWithoutTrailingSlash;
849
- #pipeline;
850
- #adapterLogger;
851
- constructor(manifest, streaming = true) {
852
- this.#manifest = manifest;
853
- this.#manifestData = {
854
- routes: manifest.routes.map((route) => route.routeData)
855
- };
856
- this.#routeDataToRouteInfo = new Map(manifest.routes.map((route) => [route.routeData, route]));
857
- this.#baseWithoutTrailingSlash = removeTrailingForwardSlash(this.#manifest.base);
858
- this.#pipeline = new SSRRoutePipeline(this.#createEnvironment(streaming));
859
- this.#adapterLogger = new AstroIntegrationLogger(
860
- this.#logger.options,
861
- this.#manifest.adapterName
862
- );
863
- }
864
- getAdapterLogger() {
865
- return this.#adapterLogger;
866
- }
867
- /**
868
- * Creates an environment by reading the stored manifest
869
- *
870
- * @param streaming
871
- * @private
872
- */
873
- #createEnvironment(streaming = false) {
874
- return createEnvironment({
875
- adapterName: this.#manifest.adapterName,
876
- logger: this.#logger,
877
- mode: "production",
878
- compressHTML: this.#manifest.compressHTML,
879
- renderers: this.#manifest.renderers,
880
- clientDirectives: this.#manifest.clientDirectives,
881
- resolve: async (specifier) => {
882
- if (!(specifier in this.#manifest.entryModules)) {
883
- throw new Error(`Unable to resolve [${specifier}]`);
884
- }
885
- const bundlePath = this.#manifest.entryModules[specifier];
886
- switch (true) {
887
- case bundlePath.startsWith("data:"):
888
- case bundlePath.length === 0: {
889
- return bundlePath;
890
- }
891
- default: {
892
- return createAssetLink(bundlePath, this.#manifest.base, this.#manifest.assetsPrefix);
893
- }
894
- }
895
- },
896
- routeCache: new RouteCache(this.#logger),
897
- site: this.#manifest.site,
898
- ssr: true,
899
- streaming
900
- });
901
- }
902
- set setManifestData(newManifestData) {
903
- this.#manifestData = newManifestData;
904
- }
905
- removeBase(pathname) {
906
- if (pathname.startsWith(this.#manifest.base)) {
907
- return pathname.slice(this.#baseWithoutTrailingSlash.length + 1);
2078
+ class OffscreenCanvas extends EventTarget {
2079
+ constructor(width, height) {
2080
+ super();
2081
+ if (arguments.length < 2)
2082
+ throw new TypeError(`Failed to construct 'OffscreenCanvas': 2 arguments required.`);
2083
+ width = Number(width) || 0;
2084
+ height = Number(height) || 0;
2085
+ INTERNALS.set(this, { width, height });
908
2086
  }
909
- return pathname;
910
- }
911
- // Disable no-unused-vars to avoid breaking signature change
912
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
913
- match(request, _opts = {}) {
914
- const url = new URL(request.url);
915
- if (this.#manifest.assets.has(url.pathname))
916
- return void 0;
917
- const pathname = prependForwardSlash(this.removeBase(url.pathname));
918
- const routeData = matchRoute(pathname, this.#manifestData);
919
- if (!routeData || routeData.prerender)
920
- return void 0;
921
- return routeData;
922
- }
923
- async render(request, routeData, locals) {
924
- if (request.url !== collapseDuplicateSlashes(request.url)) {
925
- request = new Request(collapseDuplicateSlashes(request.url), request);
926
- }
927
- if (!routeData) {
928
- routeData = this.match(request);
929
- }
930
- if (!routeData) {
931
- return this.#renderError(request, { status: 404 });
932
- }
933
- Reflect.set(request, clientLocalsSymbol, locals ?? {});
934
- const defaultStatus = this.#getDefaultStatusCode(routeData.route);
935
- const mod = await this.#getModuleForRoute(routeData);
936
- const pageModule = await mod.page();
937
- const url = new URL(request.url);
938
- const renderContext = await this.#createRenderContext(
939
- url,
940
- request,
941
- routeData,
942
- mod,
943
- defaultStatus
944
- );
945
- let response;
946
- try {
947
- if (mod.onRequest) {
948
- this.#pipeline.setMiddlewareFunction(mod.onRequest);
949
- }
950
- response = await this.#pipeline.renderRoute(renderContext, pageModule);
951
- } catch (err) {
952
- if (err instanceof EndpointNotFoundError) {
953
- return this.#renderError(request, { status: 404, response: err.originalResponse });
954
- } else {
955
- this.#logger.error("ssr", err.stack || err.message || String(err));
956
- return this.#renderError(request, { status: 500 });
957
- }
2087
+ get height() {
2088
+ return internalsOf(this, 'OffscreenCanvas', 'height').height;
958
2089
  }
959
- if (routeData.type === "page" || routeData.type === "redirect") {
960
- if (STATUS_CODES.has(response.status)) {
961
- return this.#renderError(request, {
962
- response,
963
- status: response.status
964
- });
965
- }
966
- Reflect.set(response, responseSentSymbol, true);
967
- return response;
2090
+ set height(value) {
2091
+ internalsOf(this, 'OffscreenCanvas', 'height').height = Number(value) || 0;
968
2092
  }
969
- return response;
970
- }
971
- setCookieHeaders(response) {
972
- return getSetCookiesFromResponse(response);
973
- }
974
- /**
975
- * Creates the render context of the current route
976
- */
977
- async #createRenderContext(url, request, routeData, page, status = 200) {
978
- if (routeData.type === "endpoint") {
979
- const pathname = "/" + this.removeBase(url.pathname);
980
- const mod = await page.page();
981
- const handler = mod;
982
- return await createRenderContext({
983
- request,
984
- pathname,
985
- route: routeData,
986
- status,
987
- env: this.#pipeline.env,
988
- mod: handler
989
- });
990
- } else {
991
- const pathname = prependForwardSlash(this.removeBase(url.pathname));
992
- const info = this.#routeDataToRouteInfo.get(routeData);
993
- const links = /* @__PURE__ */ new Set();
994
- const styles = createStylesheetElementSet(info.styles);
995
- let scripts = /* @__PURE__ */ new Set();
996
- for (const script of info.scripts) {
997
- if ("stage" in script) {
998
- if (script.stage === "head-inline") {
999
- scripts.add({
1000
- props: {},
1001
- children: script.children
1002
- });
1003
- }
1004
- } else {
1005
- scripts.add(createModuleScriptElement(script));
1006
- }
1007
- }
1008
- const mod = await page.page();
1009
- return await createRenderContext({
1010
- request,
1011
- pathname,
1012
- componentMetadata: this.#manifest.componentMetadata,
1013
- scripts,
1014
- styles,
1015
- links,
1016
- route: routeData,
1017
- status,
1018
- mod,
1019
- env: this.#pipeline.env
1020
- });
2093
+ get width() {
2094
+ return internalsOf(this, 'OffscreenCanvas', 'width').width;
1021
2095
  }
1022
- }
1023
- /**
1024
- * If it is a known error code, try sending the according page (e.g. 404.astro / 500.astro).
1025
- * This also handles pre-rendered /404 or /500 routes
1026
- */
1027
- async #renderError(request, { status, response: originalResponse }) {
1028
- const errorRouteData = matchRoute("/" + status, this.#manifestData);
1029
- const url = new URL(request.url);
1030
- if (errorRouteData) {
1031
- if (errorRouteData.prerender) {
1032
- const maybeDotHtml = errorRouteData.route.endsWith(`/${status}`) ? ".html" : "";
1033
- const statusURL = new URL(
1034
- `${this.#baseWithoutTrailingSlash}/${status}${maybeDotHtml}`,
1035
- url
1036
- );
1037
- const response2 = await fetch(statusURL.toString());
1038
- const override = { status };
1039
- return this.#mergeResponses(response2, originalResponse, override);
1040
- }
1041
- const mod = await this.#getModuleForRoute(errorRouteData);
1042
- try {
1043
- const newRenderContext = await this.#createRenderContext(
1044
- url,
1045
- request,
1046
- errorRouteData,
1047
- mod,
1048
- status
1049
- );
1050
- const page = await mod.page();
1051
- if (mod.onRequest) {
1052
- this.#pipeline.setMiddlewareFunction(mod.onRequest);
1053
- }
1054
- const response2 = await this.#pipeline.renderRoute(newRenderContext, page);
1055
- return this.#mergeResponses(response2, originalResponse);
1056
- } catch {
1057
- }
2096
+ set width(value) {
2097
+ internalsOf(this, 'OffscreenCanvas', 'width').width = Number(value) || 0;
1058
2098
  }
1059
- const response = this.#mergeResponses(new Response(null, { status }), originalResponse);
1060
- Reflect.set(response, responseSentSymbol, true);
1061
- return response;
1062
- }
1063
- #mergeResponses(newResponse, oldResponse, override) {
1064
- if (!oldResponse) {
1065
- if (override !== void 0) {
1066
- return new Response(newResponse.body, {
1067
- status: override.status,
1068
- statusText: newResponse.statusText,
1069
- headers: newResponse.headers
1070
- });
1071
- }
1072
- return newResponse;
1073
- }
1074
- const { statusText, headers } = oldResponse;
1075
- const status = override?.status ? override.status : oldResponse.status === 200 ? newResponse.status : oldResponse.status;
1076
- return new Response(newResponse.body, {
1077
- status,
1078
- statusText: status === 200 ? newResponse.statusText : statusText,
1079
- headers: new Headers(Array.from(headers))
1080
- });
1081
- }
1082
- #getDefaultStatusCode(route) {
1083
- route = removeTrailingForwardSlash(route);
1084
- if (route.endsWith("/404"))
1085
- return 404;
1086
- if (route.endsWith("/500"))
1087
- return 500;
1088
- return 200;
1089
- }
1090
- async #getModuleForRoute(route) {
1091
- if (route.type === "redirect") {
1092
- return RedirectSinglePageBuiltModule;
1093
- } else {
1094
- if (this.#manifest.pageMap) {
1095
- const importComponentInstance = this.#manifest.pageMap.get(route.component);
1096
- if (!importComponentInstance) {
1097
- throw new Error(
1098
- `Unexpectedly unable to find a component instance for route ${route.route}`
1099
- );
2099
+ getContext(contextType) {
2100
+ const internals = internalsOf(this, 'HTMLCanvasElement', 'getContext');
2101
+ switch (contextType) {
2102
+ case '2d':
2103
+ if (internals.renderingContext2D)
2104
+ return internals.renderingContext2D;
2105
+ internals.renderingContext2D = __createCanvasRenderingContext2D(this);
2106
+ return internals.renderingContext2D;
2107
+ default:
2108
+ return null;
1100
2109
  }
1101
- const pageModule = await importComponentInstance();
1102
- return pageModule;
1103
- } else if (this.#manifest.pageModule) {
1104
- const importComponentInstance = this.#manifest.pageModule;
1105
- return importComponentInstance;
1106
- } else {
1107
- throw new Error(
1108
- "Astro couldn't find the correct page to render, probably because it wasn't correctly mapped for SSR usage. This is an internal error, please file an issue."
1109
- );
1110
- }
1111
2110
  }
1112
- }
2111
+ convertToBlob(options) {
2112
+ options = Object(options);
2113
+ Number(options.quality) || 0;
2114
+ const type = getImageType(String(options.type).trim().toLowerCase());
2115
+ return Promise.resolve(new Blob([], { type }));
2116
+ }
1113
2117
  }
2118
+ allowStringTag(OffscreenCanvas);
2119
+ const getImageType = (type) => type === 'image/avif' ||
2120
+ type === 'image/jpeg' ||
2121
+ type === 'image/png' ||
2122
+ type === 'image/webp'
2123
+ ? type
2124
+ : 'image/png';
1114
2125
 
1115
- const isStackblitz = process.env.SHELL === "/bin/jsh" && process.versions.webcontainer != null;
1116
- function apply() {
1117
- if (isStackblitz) {
1118
- const neededPolyfills = {
1119
- ByteLengthQueuingStrategy,
1120
- CountQueuingStrategy,
1121
- ReadableByteStreamController,
1122
- ReadableStream,
1123
- ReadableStreamBYOBReader,
1124
- ReadableStreamBYOBRequest,
1125
- ReadableStreamDefaultController,
1126
- ReadableStreamDefaultReader,
1127
- TransformStream,
1128
- WritableStream,
1129
- WritableStreamDefaultController,
1130
- WritableStreamDefaultWriter,
1131
- File,
1132
- FormData,
1133
- Headers: Headers$1,
1134
- Request: Request$1,
1135
- Response: Response$1,
1136
- fetch: fetch$1
1137
- };
1138
- for (let polyfillName of Object.keys(neededPolyfills)) {
1139
- if (Object.hasOwnProperty.call(globalThis, polyfillName))
1140
- continue;
1141
- Object.defineProperty(globalThis, polyfillName, {
1142
- configurable: true,
1143
- enumerable: true,
1144
- writable: true,
1145
- value: neededPolyfills[polyfillName]
1146
- });
2126
+ class Storage {
2127
+ clear() {
2128
+ internalsOf(this, 'Storage', 'clear').storage.clear();
2129
+ }
2130
+ getItem(key) {
2131
+ return getStringOrNull(internalsOf(this, 'Storage', 'getItem').storage.get(String(key)));
2132
+ }
2133
+ key(index) {
2134
+ return getStringOrNull([
2135
+ ...internalsOf(this, 'Storage', 'key').storage.keys(),
2136
+ ][Number(index) || 0]);
2137
+ }
2138
+ removeItem(key) {
2139
+ internalsOf(this, 'Storage', 'getItem').storage.delete(String(key));
2140
+ }
2141
+ setItem(key, value) {
2142
+ internalsOf(this, 'Storage', 'getItem').storage.set(String(key), String(value));
2143
+ }
2144
+ get length() {
2145
+ return internalsOf(this, 'Storage', 'size').storage.size;
1147
2146
  }
1148
- }
1149
- if (!globalThis.crypto) {
1150
- Object.defineProperty(globalThis, "crypto", {
1151
- value: crypto.webcrypto
1152
- });
1153
- }
1154
- if (!globalThis.File) {
1155
- Object.defineProperty(globalThis, "File", {
1156
- value: File
1157
- });
1158
- }
1159
2147
  }
2148
+ const getStringOrNull = (value) => typeof value === 'string' ? value : null;
2149
+ const initStorage = (target, exclude) => {
2150
+ if (exclude.has('Storage') || exclude.has('localStorage'))
2151
+ return;
2152
+ target.localStorage = Object.create(Storage.prototype);
2153
+ const storageInternals = new Map();
2154
+ INTERNALS.set(target.localStorage, {
2155
+ storage: storageInternals,
2156
+ });
2157
+ };
1160
2158
 
1161
- const clientAddressSymbol = Symbol.for("astro.clientAddress");
1162
- function createRequestFromNodeRequest(req, options) {
1163
- const protocol = req.socket instanceof TLSSocket || req.headers["x-forwarded-proto"] === "https" ? "https" : "http";
1164
- const hostname = req.headers.host || req.headers[":authority"];
1165
- const url = `${protocol}://${hostname}${req.url}`;
1166
- const headers = makeRequestHeaders(req);
1167
- const method = req.method || "GET";
1168
- let bodyProps = {};
1169
- const bodyAllowed = method !== "HEAD" && method !== "GET" && !options?.emptyBody;
1170
- if (bodyAllowed) {
1171
- bodyProps = makeRequestBody(req);
1172
- }
1173
- const request = new Request(url, {
1174
- method,
1175
- headers,
1176
- ...bodyProps
1177
- });
1178
- if (req.socket?.remoteAddress) {
1179
- Reflect.set(request, clientAddressSymbol, req.socket.remoteAddress);
1180
- }
1181
- return request;
2159
+ class StyleSheet {
1182
2160
  }
1183
- function makeRequestHeaders(req) {
1184
- const headers = new Headers();
1185
- for (const [name, value] of Object.entries(req.headers)) {
1186
- if (value === void 0) {
1187
- continue;
2161
+ class CSSStyleSheet extends StyleSheet {
2162
+ async replace(text) {
2163
+ return new CSSStyleSheet();
1188
2164
  }
1189
- if (Array.isArray(value)) {
1190
- for (const item of value) {
1191
- headers.append(name, item);
1192
- }
1193
- } else {
1194
- headers.append(name, value);
2165
+ replaceSync(text) {
2166
+ return new CSSStyleSheet();
2167
+ }
2168
+ get cssRules() {
2169
+ return [];
1195
2170
  }
1196
- }
1197
- return headers;
1198
2171
  }
1199
- function makeRequestBody(req) {
1200
- if (req.body !== void 0) {
1201
- if (typeof req.body === "string" && req.body.length > 0) {
1202
- return { body: Buffer.from(req.body) };
2172
+ allowStringTag(StyleSheet);
2173
+ allowStringTag(CSSStyleSheet);
2174
+
2175
+ class Window extends EventTarget {
2176
+ get self() {
2177
+ return this;
1203
2178
  }
1204
- if (typeof req.body === "object" && req.body !== null && Object.keys(req.body).length > 0) {
1205
- return { body: Buffer.from(JSON.stringify(req.body)) };
2179
+ get top() {
2180
+ return this;
1206
2181
  }
1207
- if (typeof req.body === "object" && req.body !== null && typeof req.body[Symbol.asyncIterator] !== "undefined") {
1208
- return asyncIterableToBodyProps(req.body);
2182
+ get window() {
2183
+ return this;
2184
+ }
2185
+ get innerHeight() {
2186
+ return 0;
2187
+ }
2188
+ get innerWidth() {
2189
+ return 0;
2190
+ }
2191
+ get scrollX() {
2192
+ return 0;
2193
+ }
2194
+ get scrollY() {
2195
+ return 0;
1209
2196
  }
1210
- }
1211
- return asyncIterableToBodyProps(req);
1212
2197
  }
1213
- function asyncIterableToBodyProps(iterable) {
1214
- return {
1215
- // Node uses undici for the Request implementation. Undici accepts
1216
- // a non-standard async iterable for the body.
1217
- // @ts-expect-error
1218
- body: iterable,
1219
- // The duplex property is required when using a ReadableStream or async
1220
- // iterable for the body. The type definitions do not include the duplex
1221
- // property because they are not up-to-date.
1222
- // @ts-expect-error
1223
- duplex: "half"
1224
- };
2198
+ allowStringTag(Window);
2199
+ const initWindow = (target, exclude) => {
2200
+ if (exclude.has('Window') || exclude.has('window'))
2201
+ return;
2202
+ target.window = target;
2203
+ };
2204
+
2205
+ function alert(...messages) {
2206
+ console.log(...messages);
1225
2207
  }
1226
- class NodeApp extends App {
1227
- match(req, opts = {}) {
1228
- if (!(req instanceof Request)) {
1229
- req = createRequestFromNodeRequest(req, {
1230
- emptyBody: true
1231
- });
2208
+
2209
+ const exclusionsForHTMLElement = [
2210
+ 'CustomElementsRegistry',
2211
+ 'HTMLElement',
2212
+ 'HTMLBodyElement',
2213
+ 'HTMLCanvasElement',
2214
+ 'HTMLDivElement',
2215
+ 'HTMLHeadElement',
2216
+ 'HTMLHtmlElement',
2217
+ 'HTMLImageElement',
2218
+ 'HTMLStyleElement',
2219
+ 'HTMLTemplateElement',
2220
+ 'HTMLUnknownElement',
2221
+ 'Image',
2222
+ ];
2223
+ const exclusionsForElement = ['Element', ...exclusionsForHTMLElement];
2224
+ const exclusionsForDocument = [
2225
+ 'CustomElementsRegistry',
2226
+ 'Document',
2227
+ 'HTMLDocument',
2228
+ 'document',
2229
+ 'customElements',
2230
+ ];
2231
+ const exclusionsForNode = [
2232
+ 'Node',
2233
+ 'DocumentFragment',
2234
+ 'ShadowRoot',
2235
+ ...exclusionsForDocument,
2236
+ ...exclusionsForElement,
2237
+ ];
2238
+ const exclusionsForEventTarget = [
2239
+ 'Event',
2240
+ 'CustomEvent',
2241
+ 'EventTarget',
2242
+ 'OffscreenCanvas',
2243
+ 'MediaQueryList',
2244
+ 'Window',
2245
+ ...exclusionsForNode,
2246
+ ];
2247
+ const exclusionsForEvent = [
2248
+ 'Event',
2249
+ 'CustomEvent',
2250
+ 'EventTarget',
2251
+ 'MediaQueryList',
2252
+ 'OffscreenCanvas',
2253
+ 'Window',
2254
+ ...exclusionsForNode,
2255
+ ];
2256
+ const exclusions = {
2257
+ 'Document+': exclusionsForDocument,
2258
+ 'Element+': exclusionsForElement,
2259
+ 'Event+': exclusionsForEvent,
2260
+ 'EventTarget+': exclusionsForEventTarget,
2261
+ 'HTMLElement+': exclusionsForHTMLElement,
2262
+ 'Node+': exclusionsForNode,
2263
+ 'StyleSheet+': ['StyleSheet', 'CSSStyleSheet'],
2264
+ };
2265
+
2266
+ const inheritance = {
2267
+ CSSStyleSheet: 'StyleSheet',
2268
+ CustomEvent: 'Event',
2269
+ DOMException: 'Error',
2270
+ Document: 'Node',
2271
+ DocumentFragment: 'Node',
2272
+ Element: 'Node',
2273
+ HTMLDocument: 'Document',
2274
+ HTMLElement: 'Element',
2275
+ HTMLBodyElement: 'HTMLElement',
2276
+ HTMLCanvasElement: 'HTMLElement',
2277
+ HTMLDivElement: 'HTMLElement',
2278
+ HTMLHeadElement: 'HTMLElement',
2279
+ HTMLHtmlElement: 'HTMLElement',
2280
+ HTMLImageElement: 'HTMLElement',
2281
+ HTMLSpanElement: 'HTMLElement',
2282
+ HTMLStyleElement: 'HTMLElement',
2283
+ HTMLTemplateElement: 'HTMLElement',
2284
+ HTMLUnknownElement: 'HTMLElement',
2285
+ Image: 'HTMLElement',
2286
+ MediaQueryList: 'EventTarget',
2287
+ Node: 'EventTarget',
2288
+ OffscreenCanvas: 'EventTarget',
2289
+ ShadowRoot: 'DocumentFragment',
2290
+ Window: 'EventTarget',
2291
+ };
2292
+
2293
+ const polyfill = (target, options) => {
2294
+ const webAPIs = {
2295
+ ByteLengthQueuingStrategy,
2296
+ CanvasRenderingContext2D,
2297
+ CharacterData,
2298
+ Comment,
2299
+ CountQueuingStrategy,
2300
+ CSSStyleSheet,
2301
+ CustomElementRegistry,
2302
+ CustomEvent,
2303
+ Document,
2304
+ DocumentFragment,
2305
+ DOMException,
2306
+ Element,
2307
+ Event,
2308
+ EventTarget,
2309
+ File,
2310
+ FormData,
2311
+ HTMLDocument,
2312
+ HTMLElement,
2313
+ HTMLBodyElement,
2314
+ HTMLCanvasElement,
2315
+ HTMLDivElement,
2316
+ HTMLHeadElement,
2317
+ HTMLHtmlElement,
2318
+ HTMLImageElement,
2319
+ HTMLSpanElement,
2320
+ HTMLStyleElement,
2321
+ HTMLTemplateElement,
2322
+ HTMLUnknownElement,
2323
+ Headers,
2324
+ IntersectionObserver,
2325
+ Image,
2326
+ ImageData,
2327
+ MediaQueryList,
2328
+ MutationObserver,
2329
+ Node,
2330
+ NodeFilter: NodeFilter$1,
2331
+ NodeIterator: NodeIterator$1,
2332
+ OffscreenCanvas,
2333
+ ReadableByteStreamController,
2334
+ ReadableStream,
2335
+ ReadableStreamBYOBReader,
2336
+ ReadableStreamBYOBRequest,
2337
+ ReadableStreamDefaultController,
2338
+ ReadableStreamDefaultReader,
2339
+ Request,
2340
+ ResizeObserver,
2341
+ Response,
2342
+ ShadowRoot,
2343
+ Storage,
2344
+ StyleSheet,
2345
+ Text,
2346
+ TransformStream,
2347
+ TreeWalker,
2348
+ URLPattern: U,
2349
+ WritableStream,
2350
+ WritableStreamDefaultController,
2351
+ WritableStreamDefaultWriter,
2352
+ Window,
2353
+ alert,
2354
+ cancelAnimationFrame,
2355
+ cancelIdleCallback,
2356
+ clearTimeout,
2357
+ crypto: webcrypto,
2358
+ fetch,
2359
+ requestAnimationFrame,
2360
+ requestIdleCallback,
2361
+ setTimeout,
2362
+ structuredClone,
2363
+ };
2364
+ // initialize exclude options
2365
+ const excludeOptions = new Set(typeof Object(options).exclude === 'string'
2366
+ ? String(Object(options).exclude).trim().split(/\s+/)
2367
+ : Array.isArray(Object(options).exclude)
2368
+ ? Object(options).exclude.reduce((array, entry) => array.splice(array.length, 0, ...(typeof entry === 'string' ? entry.trim().split(/\s+/) : [])) && array, [])
2369
+ : []);
2370
+ // expand exclude options using exclusion shorthands
2371
+ for (const excludeOption of excludeOptions) {
2372
+ if (excludeOption in exclusions) {
2373
+ for (const exclusion of exclusions[excludeOption]) {
2374
+ excludeOptions.add(exclusion);
2375
+ }
2376
+ }
1232
2377
  }
1233
- return super.match(req, opts);
1234
- }
1235
- render(req, routeData, locals) {
1236
- if (!(req instanceof Request)) {
1237
- req = createRequestFromNodeRequest(req);
2378
+ // apply each WebAPI
2379
+ for (const name of Object.keys(webAPIs)) {
2380
+ // skip WebAPIs that are excluded
2381
+ if (excludeOptions.has(name))
2382
+ continue;
2383
+ // skip WebAPIs that are built-in
2384
+ if (Object.hasOwnProperty.call(target, name))
2385
+ continue;
2386
+ // define WebAPIs on the target
2387
+ Object.defineProperty(target, name, {
2388
+ configurable: true,
2389
+ enumerable: true,
2390
+ writable: true,
2391
+ value: webAPIs[name],
2392
+ });
1238
2393
  }
1239
- return super.render(req, routeData, locals);
1240
- }
1241
- }
2394
+ // ensure WebAPIs correctly inherit other WebAPIs
2395
+ for (const name of Object.keys(webAPIs)) {
2396
+ // skip WebAPIs that are excluded
2397
+ if (excludeOptions.has(name))
2398
+ continue;
2399
+ // skip WebAPIs that do not extend other WebAPIs
2400
+ if (!Object.hasOwnProperty.call(inheritance, name))
2401
+ continue;
2402
+ const Class = target[name];
2403
+ const Super = target[inheritance[name]];
2404
+ // skip WebAPIs that are not available
2405
+ if (!Class || !Super)
2406
+ continue;
2407
+ // skip WebAPIs that are already inherited correctly
2408
+ if (Object.getPrototypeOf(Class.prototype) === Super.prototype)
2409
+ continue;
2410
+ // define WebAPIs inheritance
2411
+ Object.setPrototypeOf(Class.prototype, Super.prototype);
2412
+ }
2413
+ if (!excludeOptions.has('HTMLDocument') &&
2414
+ !excludeOptions.has('HTMLElement')) {
2415
+ initDocument(target, excludeOptions);
2416
+ if (!excludeOptions.has('CustomElementRegistry')) {
2417
+ initCustomElementRegistry(target, excludeOptions);
2418
+ }
2419
+ }
2420
+ initMediaQueryList(target, excludeOptions);
2421
+ initStorage(target, excludeOptions);
2422
+ initWindow(target, excludeOptions);
2423
+ return target;
2424
+ };
2425
+ polyfill.internals = (target, name) => {
2426
+ const init = {
2427
+ CustomElementRegistry: initCustomElementRegistry,
2428
+ Document: initDocument,
2429
+ MediaQueryList: initMediaQueryList,
2430
+ Storage: initStorage,
2431
+ Window: initWindow,
2432
+ };
2433
+ init[name](target, new Set());
2434
+ return target;
2435
+ };
1242
2436
 
1243
2437
  const createOutgoingHttpHeaders = (webHeaders) => {
1244
2438
  if (!webHeaders) {
@@ -1261,7 +2455,7 @@ const createOutgoingHttpHeaders = (webHeaders) => {
1261
2455
  const canUseSymbol = typeof Symbol === "function" && typeof Symbol.for === "function";
1262
2456
  const canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator;
1263
2457
  function isBuffer(value) {
1264
- return value?.constructor != null && typeof value.constructor.isBuffer === "function" && value.constructor.isBuffer(value);
2458
+ return (value == null ? void 0 : value.constructor) != null && typeof value.constructor.isBuffer === "function" && value.constructor.isBuffer(value);
1265
2459
  }
1266
2460
  function isNodeResponse(value) {
1267
2461
  return !!value.body;
@@ -1416,9 +2610,7 @@ function responseIterator(response) {
1416
2610
  return promiseIterator(body.arrayBuffer());
1417
2611
  if (isNodeReadableStream(body))
1418
2612
  return nodeStreamIterator(body);
1419
- throw new AstroUserError(
1420
- "Unknown body type for responseIterator. Please pass a streamable response."
1421
- );
2613
+ throw new Error("Unknown body type for responseIterator. Please pass a streamable response.");
1422
2614
  }
1423
2615
 
1424
2616
  function nodeMiddleware_default(app, mode) {
@@ -1489,7 +2681,7 @@ async function writeWebResponse(app, res, webResponse) {
1489
2681
  res.write(chunk);
1490
2682
  }
1491
2683
  } catch (err) {
1492
- console.error(err?.stack || err?.message || String(err));
2684
+ console.error((err == null ? void 0 : err.stack) || (err == null ? void 0 : err.message) || String(err));
1493
2685
  res.write("Internal server error");
1494
2686
  }
1495
2687
  }
@@ -1632,7 +2824,6 @@ function getResolvedHostForHttpServer(host) {
1632
2824
  }
1633
2825
  }
1634
2826
  function startServer$1(app, options) {
1635
- const logger = app.getAdapterLogger();
1636
2827
  const port = process.env.PORT ? Number(process.env.PORT) : options.port ?? 8080;
1637
2828
  const { client } = resolvePaths(options);
1638
2829
  const handler = nodeMiddleware_default(app, options.mode);
@@ -1651,14 +2842,14 @@ function startServer$1(app, options) {
1651
2842
  const protocol = server.server instanceof https.Server ? "https" : "http";
1652
2843
  const address = getNetworkAddress(protocol, host, port);
1653
2844
  if (host === void 0) {
1654
- logger.info(
1655
- `Server listening on
2845
+ console.log(
2846
+ `Preview server listening on
1656
2847
  local: ${address.local[0]}
1657
2848
  network: ${address.network[0]}
1658
2849
  `
1659
2850
  );
1660
2851
  } else {
1661
- logger.info(`Server listening on ${address.local[0]}`);
2852
+ console.log(`Preview server listening on ${address.local[0]}`);
1662
2853
  }
1663
2854
  return {
1664
2855
  server,
@@ -1666,7 +2857,9 @@ function startServer$1(app, options) {
1666
2857
  };
1667
2858
  }
1668
2859
 
1669
- apply();
2860
+ polyfill(globalThis, {
2861
+ exclude: "window document"
2862
+ });
1670
2863
  function createExports(manifest, options) {
1671
2864
  const app = new NodeApp(manifest);
1672
2865
  return {
@@ -1688,17 +2881,17 @@ const adapter = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
1688
2881
  start
1689
2882
  }, Symbol.toStringTag, { value: 'Module' }));
1690
2883
 
1691
- const _page0 = () => import('./chunks/image-endpoint@_@js.802bf648.mjs');
1692
- const _page1 = () => import('./chunks/index@_@astro.a122f091.mjs');
1693
- const _page2 = () => import('./chunks/~fallback@_@astro.876a97c5.mjs');
1694
- const _page3 = () => import('./chunks/index@_@astro.da98dcbe.mjs');
1695
- const _page4 = () => import('./chunks/account@_@astro.fa8b921b.mjs');
1696
- const _page5 = () => import('./chunks/_...f7cdc954.mjs');const pageMap = new Map([["../../node_modules/.pnpm/astro@3.0.5/node_modules/astro/dist/assets/image-endpoint.js", _page0],["src/pages/index.astro", _page1],["src/pages/~fallback.astro", _page2],["src/pages/app/index.astro", _page3],["src/pages/app/account.astro", _page4],["src/pages/[...slug].astro", _page5]]);
1697
- const _manifest = Object.assign(manifest, {
2884
+ const _page0 = () => import('./chunks/endpoint@_@js.11be892a.mjs');
2885
+ const _page1 = () => import('./chunks/index@_@astro.b37a6ac9.mjs');
2886
+ const _page2 = () => import('./chunks/~fallback@_@astro.6bb4c4b4.mjs');
2887
+ const _page3 = () => import('./chunks/index@_@astro.19e0f502.mjs');
2888
+ const _page4 = () => import('./chunks/account@_@astro.204fba92.mjs');
2889
+ const _page5 = () => import('./chunks/_...4a2548d2.mjs');const pageMap = new Map([["../../node_modules/.pnpm/@astrojs+image@0.17.3_astro@2.10.15_sharp@0.32.5/node_modules/@astrojs/image/dist/endpoint.js", _page0],["src/pages/index.astro", _page1],["src/pages/~fallback.astro", _page2],["src/pages/app/index.astro", _page3],["src/pages/app/account.astro", _page4],["src/pages/[...slug].astro", _page5]]);
2890
+ const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.17.3_astro@2.10.15_sharp@0.32.5/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.85fdcf03.js"}],"styles":[{"type":"external","src":"/_astro/_...slug_.b693913e.css"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.85fdcf03.js"}],"styles":[{"type":"external","src":"/_astro/_...slug_.b693913e.css"}],"routeData":{"route":"/~fallback","type":"page","pattern":"^\\/~fallback\\/?$","segments":[[{"content":"~fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/~fallback.astro","pathname":"/~fallback","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"route":"/app","type":"page","pattern":"^\\/app\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/index.astro","pathname":"/app","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"route":"/app/account","type":"page","pattern":"^\\/app\\/account\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}],[{"content":"account","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/account.astro","pathname":"/app/account","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.85fdcf03.js"}],"styles":[{"type":"external","src":"/_astro/_...slug_.b693913e.css"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","prerender":false,"_meta":{"trailingSlash":"ignore"}}}],"site":"https://ecom2-demo.web.app","base":"/","compressHTML":false,"markdown":{"drafts":false,"syntaxHighlight":"shiki","shikiConfig":{"langs":[],"theme":"github-dark","wrap":false},"remarkPlugins":[],"rehypePlugins":[],"remarkRehype":{},"gfm":true,"smartypants":true},"componentMetadata":[],"renderers":[],"clientDirectives":[["idle","(()=>{var i=t=>{let e=async()=>{await(await t())()};\"requestIdleCallback\"in window?window.requestIdleCallback(e):setTimeout(e,200)};(self.Astro||(self.Astro={})).idle=i;window.dispatchEvent(new Event(\"astro:idle\"));})();"],["load","(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).load=e;window.dispatchEvent(new Event(\"astro:load\"));})();"],["media","(()=>{var s=(i,t)=>{let a=async()=>{await(await i())()};if(t.value){let e=matchMedia(t.value);e.matches?a():e.addEventListener(\"change\",a,{once:!0})}};(self.Astro||(self.Astro={})).media=s;window.dispatchEvent(new Event(\"astro:media\"));})();"],["only","(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).only=e;window.dispatchEvent(new Event(\"astro:only\"));})();"],["visible","(()=>{var r=(i,c,n)=>{let s=async()=>{await(await i())()},t=new IntersectionObserver(e=>{for(let o of e)if(o.isIntersecting){t.disconnect(),s();break}});for(let e of n.children)t.observe(e)};(self.Astro||(self.Astro={})).visible=r;window.dispatchEvent(new Event(\"astro:visible\"));})();"]],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"_@astrojs-ssr-virtual-entry.mjs","\u0000@astro-renderers":"renderers.mjs","\u0000empty-middleware":"_empty-middleware.mjs","/src/pages/app/account.astro":"chunks/pages/account.astro.32e7e6ef.mjs","/src/pages/~fallback.astro":"chunks/pages/~fallback.astro.ba4c2475.mjs","\u0000@astro-page:../../node_modules/.pnpm/@astrojs+image@0.17.3_astro@2.10.15_sharp@0.32.5/node_modules/@astrojs/image/dist/endpoint@_@js":"chunks/endpoint@_@js.11be892a.mjs","\u0000@astro-page:src/pages/index@_@astro":"chunks/index@_@astro.b37a6ac9.mjs","\u0000@astro-page:src/pages/~fallback@_@astro":"chunks/~fallback@_@astro.6bb4c4b4.mjs","\u0000@astro-page:src/pages/app/index@_@astro":"chunks/index@_@astro.19e0f502.mjs","\u0000@astro-page:src/pages/app/account@_@astro":"chunks/account@_@astro.204fba92.mjs","\u0000@astro-page:src/pages/[...slug]@_@astro":"chunks/_...4a2548d2.mjs","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/components/SearchModal.vue":"_astro/SearchModal.cffd4c2d.js","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/components/CartSidebar.vue":"_astro/CartSidebar.a6c6a885.js","~/components/HeroSlider.vue":"_astro/HeroSlider.ee1e6200.js","~/components/ProductShelf.vue":"_astro/ProductShelf.085721d6.js","~/components/PitchBar.vue":"_astro/PitchBar.6111676e.js","@astrojs/vue/client.js":"_astro/client.e6d9439a.js","/astro/hoisted.js?q=0":"_astro/hoisted.85fdcf03.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/workbox-window/build/workbox-window.prod.es5.mjs":"_astro/workbox-window.prod.es5.a7b12eab.js","~/components/ShopHeader.vue":"_astro/ShopHeader.7e485e35.js","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/scripts/firebase-app.ts":"_astro/firebase-app.8c541cce.js","astro:scripts/before-hydration.js":""},"assets":["/_astro/_...slug_.b693913e.css","/manifest.webmanifest","/robots.txt","/sw.js","/workbox-1b331600.js","/_astro/Carousel.9ad2e1dc.js","/_astro/CartSidebar.a6c6a885.js","/_astro/HeroSlider.ee1e6200.js","/_astro/PitchBar.6111676e.js","/_astro/Prices.04ff8fce.js","/_astro/ProductShelf.085721d6.js","/_astro/SearchModal.cffd4c2d.js","/_astro/ShopHeader.7e485e35.js","/_astro/_plugin-vue_export-helper.ee681fa8.js","/_astro/api.a2eda23e.js","/_astro/client.e6d9439a.js","/_astro/firebase-app.8c541cce.js","/_astro/format-money.923559cc.js","/_astro/hoisted.85fdcf03.js","/_astro/img.ec6ba316.js","/_astro/index.ea57babe.js","/_astro/modules-info.e5d77bf3.js","/_astro/preload-helper.cf010ec4.js","/_astro/session-utm.744b0db3.js","/_astro/workbox-window.prod.es5.a7b12eab.js","/img/icon.png","/img/large-icon.png","/img/uploads/banner2.webp","/img/uploads/ecom-icon.png","/img/uploads/headphone.webp","/img/uploads/logo.png","/img/uploads/og-image.png","/img/uploads/passion.webp","/img/uploads/rect8589.png","/img/uploads/rect859.png","/img/uploads/rect89.webp"]}), {
1698
2891
  pageMap,
1699
2892
  renderers,
1700
2893
  });
1701
- const _args = {"mode":"middleware","client":"file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/dist/client/","server":"file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/dist/server/","host":false,"port":4321};
2894
+ const _args = {"mode":"middleware","client":"file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/dist/client/","server":"file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/dist/server/","host":false,"port":3000};
1702
2895
 
1703
2896
  const _exports = createExports(_manifest, _args);
1704
2897
  const handler = _exports['handler'];