@stencil/core 4.38.3-dev.1764651902.52bdcb8 → 4.38.3-dev.1764738304.c6bb6f1

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 (45) hide show
  1. package/cli/index.cjs +2 -1
  2. package/cli/index.js +2 -1
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +16369 -5558
  6. package/dev-server/client/index.js +1 -1
  7. package/dev-server/client/package.json +1 -1
  8. package/dev-server/connector.html +2 -2
  9. package/dev-server/index.js +1 -1
  10. package/dev-server/package.json +1 -1
  11. package/dev-server/server-process.js +6 -5
  12. package/internal/app-data/index.cjs +1 -0
  13. package/internal/app-data/index.js +1 -0
  14. package/internal/app-data/package.json +1 -1
  15. package/internal/app-globals/package.json +1 -1
  16. package/internal/client/index.js +29 -5
  17. package/internal/client/package.json +1 -1
  18. package/internal/client/patch-browser.js +1 -1
  19. package/internal/hydrate/index.js +35 -5
  20. package/internal/hydrate/package.json +1 -1
  21. package/internal/hydrate/runner.d.ts +12 -0
  22. package/internal/hydrate/runner.js +1357 -1330
  23. package/internal/package.json +1 -1
  24. package/internal/stencil-core/index.d.ts +2 -0
  25. package/internal/stencil-private.d.ts +3 -0
  26. package/internal/stencil-public-compiler.d.ts +13 -0
  27. package/internal/stencil-public-runtime.d.ts +22 -0
  28. package/internal/testing/index.js +30 -4
  29. package/internal/testing/package.json +1 -1
  30. package/mock-doc/index.cjs +226 -226
  31. package/mock-doc/index.js +226 -226
  32. package/mock-doc/package.json +1 -1
  33. package/package.json +5 -2
  34. package/screenshot/index.js +2 -1
  35. package/screenshot/package.json +1 -1
  36. package/screenshot/pixel-match.js +3 -3
  37. package/sys/node/autoprefixer.js +2 -2
  38. package/sys/node/glob.js +1 -1
  39. package/sys/node/index.js +18 -18
  40. package/sys/node/node-fetch.js +1 -1
  41. package/sys/node/package.json +1 -1
  42. package/sys/node/worker.js +1 -1
  43. package/testing/index.js +35 -7
  44. package/testing/package.json +1 -1
  45. package/testing/puppeteer/puppeteer-browser.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Hydrate Runner v4.38.3-dev.1764651902.52bdcb8 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Runner v4.38.3-dev.1764738304.c6bb6f1 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -7,6 +7,63 @@ var __export = (target, all) => {
7
7
  __defProp(target, name, { get: all[name], enumerable: true });
8
8
  };
9
9
 
10
+ // src/client/client-build.ts
11
+ import { BUILD } from "@stencil/core/internal/app-data";
12
+ var Build = {
13
+ isDev: BUILD.isDev ? true : false,
14
+ isBrowser: true,
15
+ isServer: false,
16
+ isTesting: BUILD.isTesting ? true : false
17
+ };
18
+
19
+ // src/client/client-host-ref.ts
20
+ import { BUILD as BUILD3 } from "@stencil/core/internal/app-data";
21
+
22
+ // src/utils/constants.ts
23
+ var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
24
+ PrimitiveType2["Undefined"] = "undefined";
25
+ PrimitiveType2["Null"] = "null";
26
+ PrimitiveType2["String"] = "string";
27
+ PrimitiveType2["Number"] = "number";
28
+ PrimitiveType2["SpecialNumber"] = "number";
29
+ PrimitiveType2["Boolean"] = "boolean";
30
+ PrimitiveType2["BigInt"] = "bigint";
31
+ return PrimitiveType2;
32
+ })(PrimitiveType || {});
33
+ var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
34
+ NonPrimitiveType2["Array"] = "array";
35
+ NonPrimitiveType2["Date"] = "date";
36
+ NonPrimitiveType2["Map"] = "map";
37
+ NonPrimitiveType2["Object"] = "object";
38
+ NonPrimitiveType2["RegularExpression"] = "regexp";
39
+ NonPrimitiveType2["Set"] = "set";
40
+ NonPrimitiveType2["Channel"] = "channel";
41
+ NonPrimitiveType2["Symbol"] = "symbol";
42
+ return NonPrimitiveType2;
43
+ })(NonPrimitiveType || {});
44
+ var TYPE_CONSTANT = "type";
45
+ var VALUE_CONSTANT = "value";
46
+ var SERIALIZED_PREFIX = "serialized:";
47
+
48
+ // src/utils/es2022-rewire-class-members.ts
49
+ import { BUILD as BUILD2 } from "@stencil/core/internal/app-data";
50
+
51
+ // src/client/client-load-module.ts
52
+ import { BUILD as BUILD5 } from "@stencil/core/internal/app-data";
53
+
54
+ // src/client/client-log.ts
55
+ import { BUILD as BUILD4 } from "@stencil/core/internal/app-data";
56
+ var STENCIL_DEV_MODE = BUILD4.isTesting ? ["STENCIL:"] : [
57
+ "%cstencil",
58
+ "color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
59
+ ];
60
+
61
+ // src/client/client-style.ts
62
+ var modeResolutionChain = [];
63
+
64
+ // src/client/client-task-queue.ts
65
+ import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
66
+
10
67
  // src/runtime/runtime-constants.ts
11
68
  var CONTENT_REF_ID = "r";
12
69
  var ORG_LOCATION_ID = "o";
@@ -17,369 +74,958 @@ var HYDRATED_STYLE_ID = "sty-id";
17
74
  var STENCIL_DOC_DATA = "_stencilDocData";
18
75
  var XLINK_NS = "http://www.w3.org/1999/xlink";
19
76
 
20
- // src/mock-doc/attribute.ts
21
- var attrHandler = {
22
- get(obj, prop) {
23
- if (prop in obj) {
24
- return obj[prop];
25
- }
26
- if (typeof prop !== "symbol" && !isNaN(prop)) {
27
- return obj.__items[prop];
28
- }
29
- return void 0;
30
- }
77
+ // src/client/client-window.ts
78
+ import { BUILD as BUILD6 } from "@stencil/core/internal/app-data";
79
+ var win = typeof window !== "undefined" ? window : {};
80
+ var H = win.HTMLElement || class {
31
81
  };
32
- var createAttributeProxy = (caseInsensitive) => new Proxy(new MockAttributeMap(caseInsensitive), attrHandler);
33
- var MockAttributeMap = class {
34
- constructor(caseInsensitive = false) {
35
- this.caseInsensitive = caseInsensitive;
36
- this.__items = [];
82
+ var supportsShadow = BUILD6.shadowDom;
83
+ var supportsConstructableStylesheets = BUILD6.constructableCSS ? /* @__PURE__ */ (() => {
84
+ try {
85
+ new CSSStyleSheet();
86
+ return typeof new CSSStyleSheet().replaceSync === "function";
87
+ } catch (e) {
37
88
  }
38
- get length() {
39
- return this.__items.length;
89
+ return false;
90
+ })() : false;
91
+
92
+ // src/client/index.ts
93
+ import { BUILD as BUILD31, Env, NAMESPACE as NAMESPACE2 } from "@stencil/core/internal/app-data";
94
+
95
+ // src/runtime/bootstrap-custom-element.ts
96
+ import { BUILD as BUILD27 } from "@stencil/core/internal/app-data";
97
+
98
+ // src/utils/helpers.ts
99
+ var isString = (v) => typeof v === "string";
100
+
101
+ // src/utils/local-value.ts
102
+ var LocalValue = class _LocalValue {
103
+ constructor(type, value) {
104
+ if (type === "undefined" /* Undefined */ || type === "null" /* Null */) {
105
+ this.type = type;
106
+ } else {
107
+ this.type = type;
108
+ this.value = value;
109
+ }
40
110
  }
41
- item(index) {
42
- return this.__items[index] || null;
111
+ /**
112
+ * Creates a new LocalValue object with a string value.
113
+ *
114
+ * @param {string} value - The string value to be stored in the LocalValue object.
115
+ * @returns {LocalValue} - The created LocalValue object.
116
+ */
117
+ static createStringValue(value) {
118
+ return new _LocalValue("string" /* String */, value);
43
119
  }
44
- setNamedItem(attr) {
45
- attr.namespaceURI = null;
46
- this.setNamedItemNS(attr);
120
+ /**
121
+ * Creates a new LocalValue object with a number value.
122
+ *
123
+ * @param {number} value - The number value.
124
+ * @returns {LocalValue} - The created LocalValue object.
125
+ */
126
+ static createNumberValue(value) {
127
+ return new _LocalValue("number" /* Number */, value);
47
128
  }
48
- setNamedItemNS(attr) {
49
- if (attr != null && attr.value != null) {
50
- attr.value = String(attr.value);
129
+ /**
130
+ * Creates a new LocalValue object with a special number value.
131
+ *
132
+ * @param {number} value - The value of the special number.
133
+ * @returns {LocalValue} - The created LocalValue object.
134
+ */
135
+ static createSpecialNumberValue(value) {
136
+ if (Number.isNaN(value)) {
137
+ return new _LocalValue("number" /* SpecialNumber */, "NaN");
51
138
  }
52
- const existingAttr = this.__items.find((a) => a.name === attr.name && a.namespaceURI === attr.namespaceURI);
53
- if (existingAttr != null) {
54
- existingAttr.value = attr.value;
55
- } else {
56
- this.__items.push(attr);
139
+ if (Object.is(value, -0)) {
140
+ return new _LocalValue("number" /* SpecialNumber */, "-0");
57
141
  }
58
- }
59
- getNamedItem(attrName) {
60
- if (this.caseInsensitive) {
61
- attrName = attrName.toLowerCase();
142
+ if (value === Infinity) {
143
+ return new _LocalValue("number" /* SpecialNumber */, "Infinity");
62
144
  }
63
- return this.getNamedItemNS(null, attrName);
64
- }
65
- getNamedItemNS(namespaceURI, attrName) {
66
- namespaceURI = getNamespaceURI(namespaceURI);
67
- return this.__items.find((attr) => attr.name === attrName && getNamespaceURI(attr.namespaceURI) === namespaceURI) || null;
68
- }
69
- removeNamedItem(attr) {
70
- this.removeNamedItemNS(attr);
71
- }
72
- removeNamedItemNS(attr) {
73
- for (let i = 0, ii = this.__items.length; i < ii; i++) {
74
- if (this.__items[i].name === attr.name && this.__items[i].namespaceURI === attr.namespaceURI) {
75
- this.__items.splice(i, 1);
76
- break;
77
- }
145
+ if (value === -Infinity) {
146
+ return new _LocalValue("number" /* SpecialNumber */, "-Infinity");
78
147
  }
148
+ return new _LocalValue("number" /* SpecialNumber */, value);
79
149
  }
80
- [Symbol.iterator]() {
81
- let i = 0;
82
- return {
83
- next: () => ({
84
- done: i === this.length,
85
- value: this.item(i++)
86
- })
87
- };
150
+ /**
151
+ * Creates a new LocalValue object with an undefined value.
152
+ * @returns {LocalValue} - The created LocalValue object.
153
+ */
154
+ static createUndefinedValue() {
155
+ return new _LocalValue("undefined" /* Undefined */);
88
156
  }
89
- get [Symbol.toStringTag]() {
90
- return "MockAttributeMap";
157
+ /**
158
+ * Creates a new LocalValue object with a null value.
159
+ * @returns {LocalValue} - The created LocalValue object.
160
+ */
161
+ static createNullValue() {
162
+ return new _LocalValue("null" /* Null */);
91
163
  }
92
- };
93
- function getNamespaceURI(namespaceURI) {
94
- return namespaceURI === XLINK_NS ? null : namespaceURI;
95
- }
96
- function cloneAttributes(srcAttrs, sortByName = false) {
97
- const dstAttrs = new MockAttributeMap(srcAttrs.caseInsensitive);
98
- if (srcAttrs != null) {
99
- const attrLen = srcAttrs.length;
100
- if (sortByName && attrLen > 1) {
101
- const sortedAttrs = [];
102
- for (let i = 0; i < attrLen; i++) {
103
- const srcAttr = srcAttrs.item(i);
104
- const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
105
- sortedAttrs.push(dstAttr);
106
- }
107
- sortedAttrs.sort(sortAttributes).forEach((attr) => {
108
- dstAttrs.setNamedItemNS(attr);
109
- });
110
- } else {
111
- for (let i = 0; i < attrLen; i++) {
112
- const srcAttr = srcAttrs.item(i);
113
- const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
114
- dstAttrs.setNamedItemNS(dstAttr);
115
- }
116
- }
164
+ /**
165
+ * Creates a new LocalValue object with a boolean value.
166
+ *
167
+ * @param {boolean} value - The boolean value.
168
+ * @returns {LocalValue} - The created LocalValue object.
169
+ */
170
+ static createBooleanValue(value) {
171
+ return new _LocalValue("boolean" /* Boolean */, value);
117
172
  }
118
- return dstAttrs;
119
- }
120
- function sortAttributes(a, b) {
121
- if (a.name < b.name) return -1;
122
- if (a.name > b.name) return 1;
123
- return 0;
124
- }
125
- var MockAttr = class {
126
- constructor(attrName, attrValue, namespaceURI = null) {
127
- this._name = attrName;
128
- this._value = String(attrValue);
129
- this._namespaceURI = namespaceURI;
173
+ /**
174
+ * Creates a new LocalValue object with a BigInt value.
175
+ *
176
+ * @param {BigInt} value - The BigInt value.
177
+ * @returns {LocalValue} - The created LocalValue object.
178
+ */
179
+ static createBigIntValue(value) {
180
+ return new _LocalValue("bigint" /* BigInt */, value.toString());
130
181
  }
131
- get name() {
132
- return this._name;
182
+ /**
183
+ * Creates a new LocalValue object with an array.
184
+ *
185
+ * @param {Array} value - The array.
186
+ * @returns {LocalValue} - The created LocalValue object.
187
+ */
188
+ static createArrayValue(value) {
189
+ return new _LocalValue("array" /* Array */, value);
133
190
  }
134
- set name(value) {
135
- this._name = value;
191
+ /**
192
+ * Creates a new LocalValue object with date value.
193
+ *
194
+ * @param {string} value - The date.
195
+ * @returns {LocalValue} - The created LocalValue object.
196
+ */
197
+ static createDateValue(value) {
198
+ return new _LocalValue("date" /* Date */, value);
136
199
  }
137
- get value() {
138
- return this._value;
200
+ /**
201
+ * Creates a new LocalValue object of map value.
202
+ * @param {Map} map - The map.
203
+ * @returns {LocalValue} - The created LocalValue object.
204
+ */
205
+ static createMapValue(map2) {
206
+ const value = [];
207
+ Array.from(map2.entries()).forEach(([key, val]) => {
208
+ value.push([_LocalValue.getArgument(key), _LocalValue.getArgument(val)]);
209
+ });
210
+ return new _LocalValue("map" /* Map */, value);
139
211
  }
140
- set value(value) {
141
- this._value = String(value);
212
+ /**
213
+ * Creates a new LocalValue object from the passed object.
214
+ *
215
+ * @param object the object to create a LocalValue from
216
+ * @returns {LocalValue} - The created LocalValue object.
217
+ */
218
+ static createObjectValue(object) {
219
+ const value = [];
220
+ Object.entries(object).forEach(([key, val]) => {
221
+ value.push([key, _LocalValue.getArgument(val)]);
222
+ });
223
+ return new _LocalValue("object" /* Object */, value);
142
224
  }
143
- get nodeName() {
144
- return this._name;
225
+ /**
226
+ * Creates a new LocalValue object of regular expression value.
227
+ *
228
+ * @param {string} value - The value of the regular expression.
229
+ * @returns {LocalValue} - The created LocalValue object.
230
+ */
231
+ static createRegularExpressionValue(value) {
232
+ return new _LocalValue("regexp" /* RegularExpression */, value);
145
233
  }
146
- set nodeName(value) {
147
- this._name = value;
234
+ /**
235
+ * Creates a new LocalValue object with the specified value.
236
+ * @param {Set} value - The value to be set.
237
+ * @returns {LocalValue} - The created LocalValue object.
238
+ */
239
+ static createSetValue(value) {
240
+ return new _LocalValue("set" /* Set */, value);
148
241
  }
149
- get nodeValue() {
150
- return this._value;
242
+ /**
243
+ * Creates a new LocalValue object with the given channel value
244
+ *
245
+ * @param {ChannelValue} value - The channel value.
246
+ * @returns {LocalValue} - The created LocalValue object.
247
+ */
248
+ static createChannelValue(value) {
249
+ return new _LocalValue("channel" /* Channel */, value);
151
250
  }
152
- set nodeValue(value) {
153
- this._value = String(value);
251
+ /**
252
+ * Creates a new LocalValue object with a Symbol value.
253
+ *
254
+ * @param {Symbol} symbol - The Symbol value
255
+ * @returns {LocalValue} - The created LocalValue object
256
+ */
257
+ static createSymbolValue(symbol) {
258
+ const description = symbol.description || "Symbol()";
259
+ return new _LocalValue("symbol" /* Symbol */, description);
154
260
  }
155
- get namespaceURI() {
156
- return this._namespaceURI;
261
+ static getArgument(argument) {
262
+ const type = typeof argument;
263
+ switch (type) {
264
+ case "string" /* String */:
265
+ return _LocalValue.createStringValue(argument);
266
+ case "number" /* Number */:
267
+ if (Number.isNaN(argument) || Object.is(argument, -0) || !Number.isFinite(argument)) {
268
+ return _LocalValue.createSpecialNumberValue(argument);
269
+ }
270
+ return _LocalValue.createNumberValue(argument);
271
+ case "boolean" /* Boolean */:
272
+ return _LocalValue.createBooleanValue(argument);
273
+ case "bigint" /* BigInt */:
274
+ return _LocalValue.createBigIntValue(argument);
275
+ case "undefined" /* Undefined */:
276
+ return _LocalValue.createUndefinedValue();
277
+ case "symbol" /* Symbol */:
278
+ return _LocalValue.createSymbolValue(argument);
279
+ case "object" /* Object */:
280
+ if (argument === null) {
281
+ return _LocalValue.createNullValue();
282
+ }
283
+ if (argument instanceof Date) {
284
+ return _LocalValue.createDateValue(argument);
285
+ }
286
+ if (argument instanceof Map) {
287
+ const map2 = [];
288
+ argument.forEach((value, key) => {
289
+ const objectKey = typeof key === "string" ? key : _LocalValue.getArgument(key);
290
+ const objectValue = _LocalValue.getArgument(value);
291
+ map2.push([objectKey, objectValue]);
292
+ });
293
+ return _LocalValue.createMapValue(argument);
294
+ }
295
+ if (argument instanceof Set) {
296
+ const set = [];
297
+ argument.forEach((value) => {
298
+ set.push(_LocalValue.getArgument(value));
299
+ });
300
+ return _LocalValue.createSetValue(set);
301
+ }
302
+ if (argument instanceof Array) {
303
+ const arr = [];
304
+ argument.forEach((value) => {
305
+ arr.push(_LocalValue.getArgument(value));
306
+ });
307
+ return _LocalValue.createArrayValue(arr);
308
+ }
309
+ if (argument instanceof RegExp) {
310
+ return _LocalValue.createRegularExpressionValue({
311
+ pattern: argument.source,
312
+ flags: argument.flags
313
+ });
314
+ }
315
+ return _LocalValue.createObjectValue(argument);
316
+ }
317
+ throw new Error(`Unsupported type: ${type}`);
157
318
  }
158
- set namespaceURI(namespaceURI) {
159
- this._namespaceURI = namespaceURI;
319
+ asMap() {
320
+ return {
321
+ [TYPE_CONSTANT]: this.type,
322
+ ...!(this.type === "null" /* Null */ || this.type === "undefined" /* Undefined */) ? { [VALUE_CONSTANT]: this.value } : {}
323
+ };
160
324
  }
161
325
  };
162
326
 
163
- // src/mock-doc/css-style-declaration.ts
164
- var MockCSSStyleDeclaration = class {
165
- constructor() {
166
- this._styles = /* @__PURE__ */ new Map();
167
- }
168
- setProperty(prop, value) {
169
- prop = jsCaseToCssCase(prop);
170
- if (value == null || value === "") {
171
- this._styles.delete(prop);
327
+ // src/utils/message-utils.ts
328
+ var catchError = (diagnostics, err2, msg) => {
329
+ const diagnostic = {
330
+ level: "error",
331
+ type: "build",
332
+ header: "Build Error",
333
+ messageText: "build error",
334
+ lines: []
335
+ };
336
+ if (isString(msg)) {
337
+ diagnostic.messageText = msg.length ? msg : "UNKNOWN ERROR";
338
+ } else if (err2 != null) {
339
+ if (err2.stack != null) {
340
+ diagnostic.messageText = err2.stack.toString();
172
341
  } else {
173
- this._styles.set(prop, String(value));
342
+ if (err2.message != null) {
343
+ diagnostic.messageText = err2.message.length ? err2.message : "UNKNOWN ERROR";
344
+ } else {
345
+ diagnostic.messageText = err2.toString();
346
+ }
174
347
  }
175
348
  }
176
- getPropertyValue(prop) {
177
- prop = jsCaseToCssCase(prop);
178
- return String(this._styles.get(prop) || "");
179
- }
180
- removeProperty(prop) {
181
- prop = jsCaseToCssCase(prop);
182
- this._styles.delete(prop);
183
- }
184
- get length() {
185
- return this._styles.size;
186
- }
187
- get cssText() {
188
- const cssText = [];
189
- this._styles.forEach((value, prop) => {
190
- cssText.push(`${prop}: ${value};`);
191
- });
192
- return cssText.join(" ").trim();
193
- }
194
- set cssText(cssText) {
195
- if (cssText == null || cssText === "") {
196
- this._styles.clear();
197
- return;
198
- }
199
- cssText.split(";").forEach((rule) => {
200
- rule = rule.trim();
201
- if (rule.length > 0) {
202
- const splt = rule.split(":");
203
- if (splt.length > 1) {
204
- const prop = splt[0].trim();
205
- const value = splt.slice(1).join(":").trim();
206
- if (prop !== "" && value !== "") {
207
- this._styles.set(jsCaseToCssCase(prop), value);
208
- }
209
- }
210
- }
211
- });
349
+ if (diagnostics != null && !shouldIgnoreError(diagnostic.messageText)) {
350
+ diagnostics.push(diagnostic);
212
351
  }
352
+ return diagnostic;
213
353
  };
214
- function createCSSStyleDeclaration() {
215
- return new Proxy(new MockCSSStyleDeclaration(), cssProxyHandler);
216
- }
217
- var cssProxyHandler = {
218
- get(cssStyle, prop) {
219
- if (prop in cssStyle) {
220
- return cssStyle[prop];
221
- }
222
- prop = cssCaseToJsCase(prop);
223
- return cssStyle.getPropertyValue(prop);
224
- },
225
- set(cssStyle, prop, value) {
226
- if (prop in cssStyle) {
227
- cssStyle[prop] = value;
228
- } else {
229
- cssStyle.setProperty(prop, value);
230
- }
231
- return true;
354
+ var hasError = (diagnostics) => {
355
+ if (diagnostics == null || diagnostics.length === 0) {
356
+ return false;
232
357
  }
358
+ return diagnostics.some((d) => d.level === "error" && d.type !== "runtime");
233
359
  };
234
- function cssCaseToJsCase(str) {
235
- if (str.length > 1 && str.includes("-") === true) {
236
- str = str.toLowerCase().split("-").map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1)).join("");
237
- str = str.slice(0, 1).toLowerCase() + str.slice(1);
238
- }
239
- return str;
240
- }
241
- function jsCaseToCssCase(str) {
242
- if (str.length > 1 && str.includes("-") === false && /[A-Z]/.test(str) === true) {
243
- str = str.replace(/([A-Z])/g, (g) => " " + g[0]).trim().replace(/ /g, "-").toLowerCase();
244
- }
245
- return str;
246
- }
360
+ var shouldIgnoreError = (msg) => {
361
+ return msg === TASK_CANCELED_MSG;
362
+ };
363
+ var TASK_CANCELED_MSG = `task canceled`;
247
364
 
248
- // src/mock-doc/custom-element-registry.ts
249
- var MockCustomElementRegistry = class {
250
- constructor(win2) {
251
- this.win = win2;
252
- }
253
- define(tagName, cstr, options) {
254
- if (tagName.toLowerCase() !== tagName) {
255
- throw new Error(
256
- `Failed to execute 'define' on 'CustomElementRegistry': "${tagName}" is not a valid custom element name`
257
- );
365
+ // src/utils/regular-expression.ts
366
+ var escapeRegExpSpecialCharacters = (text) => {
367
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
368
+ };
369
+
370
+ // src/utils/remote-value.ts
371
+ var RemoteValue = class _RemoteValue {
372
+ /**
373
+ * Deserializes a LocalValue serialized object back to its original JavaScript representation
374
+ *
375
+ * @param serialized The serialized LocalValue object
376
+ * @returns The original JavaScript value/object
377
+ */
378
+ static fromLocalValue(serialized) {
379
+ const type = serialized[TYPE_CONSTANT];
380
+ const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
381
+ switch (type) {
382
+ case "string" /* String */:
383
+ return value;
384
+ case "boolean" /* Boolean */:
385
+ return value;
386
+ case "bigint" /* BigInt */:
387
+ return BigInt(value);
388
+ case "undefined" /* Undefined */:
389
+ return void 0;
390
+ case "null" /* Null */:
391
+ return null;
392
+ case "number" /* Number */:
393
+ if (value === "NaN") return NaN;
394
+ if (value === "-0") return -0;
395
+ if (value === "Infinity") return Infinity;
396
+ if (value === "-Infinity") return -Infinity;
397
+ return value;
398
+ case "array" /* Array */:
399
+ return value.map((item) => _RemoteValue.fromLocalValue(item));
400
+ case "date" /* Date */:
401
+ return new Date(value);
402
+ case "map" /* Map */:
403
+ const map2 = /* @__PURE__ */ new Map();
404
+ for (const [key, val] of value) {
405
+ const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
406
+ const deserializedValue = _RemoteValue.fromLocalValue(val);
407
+ map2.set(deserializedKey, deserializedValue);
408
+ }
409
+ return map2;
410
+ case "object" /* Object */:
411
+ const obj = {};
412
+ for (const [key, val] of value) {
413
+ obj[key] = _RemoteValue.fromLocalValue(val);
414
+ }
415
+ return obj;
416
+ case "regexp" /* RegularExpression */:
417
+ const { pattern, flags } = value;
418
+ return new RegExp(pattern, flags);
419
+ case "set" /* Set */:
420
+ const set = /* @__PURE__ */ new Set();
421
+ for (const item of value) {
422
+ set.add(_RemoteValue.fromLocalValue(item));
423
+ }
424
+ return set;
425
+ case "symbol" /* Symbol */:
426
+ return Symbol(value);
427
+ default:
428
+ throw new Error(`Unsupported type: ${type}`);
258
429
  }
259
- if (this.__registry == null) {
260
- this.__registry = /* @__PURE__ */ new Map();
430
+ }
431
+ /**
432
+ * Utility method to deserialize multiple LocalValues at once
433
+ *
434
+ * @param serializedValues Array of serialized LocalValue objects
435
+ * @returns Array of deserialized JavaScript values
436
+ */
437
+ static fromLocalValueArray(serializedValues) {
438
+ return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
439
+ }
440
+ /**
441
+ * Verifies if the given object matches the structure of a serialized LocalValue
442
+ *
443
+ * @param obj Object to verify
444
+ * @returns boolean indicating if the object has LocalValue structure
445
+ */
446
+ static isLocalValueObject(obj) {
447
+ if (typeof obj !== "object" || obj === null) {
448
+ return false;
261
449
  }
262
- this.__registry.set(tagName, { cstr, options });
263
- if (this.__whenDefined != null) {
264
- const whenDefinedResolveFns = this.__whenDefined.get(tagName);
265
- if (whenDefinedResolveFns != null) {
266
- whenDefinedResolveFns.forEach((whenDefinedResolveFn) => {
267
- whenDefinedResolveFn();
268
- });
269
- whenDefinedResolveFns.length = 0;
270
- this.__whenDefined.delete(tagName);
271
- }
450
+ if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
451
+ return false;
272
452
  }
273
- const doc = this.win.document;
274
- if (doc != null) {
275
- const hosts = doc.querySelectorAll(tagName);
276
- hosts.forEach((host) => {
277
- if (upgradedElements.has(host) === false) {
278
- tempDisableCallbacks.add(doc);
279
- const upgradedCmp = createCustomElement(this, doc, tagName);
280
- for (let i = 0; i < host.childNodes.length; i++) {
281
- const childNode = host.childNodes[i];
282
- childNode.remove();
283
- upgradedCmp.appendChild(childNode);
284
- }
285
- tempDisableCallbacks.delete(doc);
286
- if (proxyElements.has(host)) {
287
- proxyElements.set(host, upgradedCmp);
288
- }
289
- }
290
- fireConnectedCallback(host);
291
- });
453
+ const type = obj[TYPE_CONSTANT];
454
+ const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
455
+ if (!hasTypeProperty) {
456
+ return false;
292
457
  }
293
- }
294
- get(tagName) {
295
- if (this.__registry != null) {
296
- const def = this.__registry.get(tagName.toLowerCase());
297
- if (def != null) {
298
- return def.cstr;
299
- }
458
+ if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
459
+ return obj.hasOwnProperty(VALUE_CONSTANT);
300
460
  }
301
- return void 0;
461
+ return true;
302
462
  }
303
- getName(cstr) {
304
- for (const [tagName, def] of this.__registry.entries()) {
305
- if (def.cstr === cstr) {
306
- return tagName;
307
- }
463
+ };
464
+
465
+ // src/utils/result.ts
466
+ var result_exports = {};
467
+ __export(result_exports, {
468
+ err: () => err,
469
+ map: () => map,
470
+ ok: () => ok,
471
+ unwrap: () => unwrap,
472
+ unwrapErr: () => unwrapErr
473
+ });
474
+ var ok = (value) => ({
475
+ isOk: true,
476
+ isErr: false,
477
+ value
478
+ });
479
+ var err = (value) => ({
480
+ isOk: false,
481
+ isErr: true,
482
+ value
483
+ });
484
+ function map(result, fn) {
485
+ if (result.isOk) {
486
+ const val = fn(result.value);
487
+ if (val instanceof Promise) {
488
+ return val.then((newVal) => ok(newVal));
489
+ } else {
490
+ return ok(val);
308
491
  }
309
- return void 0;
310
492
  }
311
- upgrade(_rootNode) {
493
+ if (result.isErr) {
494
+ const value = result.value;
495
+ return err(value);
312
496
  }
313
- clear() {
314
- if (this.__registry != null) {
315
- this.__registry.clear();
316
- }
317
- if (this.__whenDefined != null) {
318
- this.__whenDefined.clear();
319
- }
497
+ throw "should never get here";
498
+ }
499
+ var unwrap = (result) => {
500
+ if (result.isOk) {
501
+ return result.value;
502
+ } else {
503
+ throw result.value;
320
504
  }
321
- whenDefined(tagName) {
322
- tagName = tagName.toLowerCase();
323
- if (this.__registry != null && this.__registry.has(tagName) === true) {
324
- return Promise.resolve(this.__registry.get(tagName).cstr);
325
- }
326
- return new Promise((resolve) => {
327
- if (this.__whenDefined == null) {
328
- this.__whenDefined = /* @__PURE__ */ new Map();
329
- }
330
- let whenDefinedResolveFns = this.__whenDefined.get(tagName);
331
- if (whenDefinedResolveFns == null) {
332
- whenDefinedResolveFns = [];
333
- this.__whenDefined.set(tagName, whenDefinedResolveFns);
334
- }
335
- whenDefinedResolveFns.push(resolve);
336
- });
505
+ };
506
+ var unwrapErr = (result) => {
507
+ if (result.isErr) {
508
+ return result.value;
509
+ } else {
510
+ throw result.value;
337
511
  }
338
512
  };
339
- function createCustomElement(customElements2, ownerDocument, tagName) {
340
- const Cstr = customElements2.get(tagName);
341
- if (Cstr != null) {
342
- const cmp = new Cstr(ownerDocument);
343
- cmp.nodeName = tagName.toUpperCase();
344
- upgradedElements.add(cmp);
345
- return cmp;
513
+
514
+ // src/utils/serialize.ts
515
+ function serializeProperty(value) {
516
+ if (["string", "boolean", "undefined"].includes(typeof value) || typeof value === "number" && value !== Infinity && value !== -Infinity && !isNaN(value)) {
517
+ return value;
346
518
  }
347
- const host = new Proxy(
348
- {},
349
- {
350
- get(obj, prop) {
351
- const elm2 = proxyElements.get(host);
352
- if (elm2 != null) {
353
- return elm2[prop];
354
- }
355
- return obj[prop];
356
- },
357
- set(obj, prop, val) {
358
- const elm2 = proxyElements.get(host);
359
- if (elm2 != null) {
360
- elm2[prop] = val;
361
- } else {
362
- obj[prop] = val;
363
- }
364
- return true;
365
- },
366
- has(obj, prop) {
367
- const elm2 = proxyElements.get(host);
368
- if (prop in elm2) {
369
- return true;
370
- }
371
- if (prop in obj) {
372
- return true;
373
- }
374
- return false;
375
- }
376
- }
377
- );
378
- const elm = new MockHTMLElement(ownerDocument, tagName);
379
- proxyElements.set(host, elm);
380
- return host;
519
+ const arg = LocalValue.getArgument(value);
520
+ return SERIALIZED_PREFIX + btoa(JSON.stringify(arg));
381
521
  }
382
- var proxyElements = /* @__PURE__ */ new WeakMap();
522
+ function deserializeProperty(value) {
523
+ if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
524
+ return value;
525
+ }
526
+ return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
527
+ }
528
+
529
+ // src/utils/shadow-root.ts
530
+ import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
531
+
532
+ // src/utils/util.ts
533
+ var lowerPathParam = (fn) => (p) => fn(p.toLowerCase());
534
+ var isDtsFile = lowerPathParam((p) => p.endsWith(".d.ts") || p.endsWith(".d.mts") || p.endsWith(".d.cts"));
535
+ var isTsFile = lowerPathParam(
536
+ (p) => !isDtsFile(p) && (p.endsWith(".ts") || p.endsWith(".mts") || p.endsWith(".cts"))
537
+ );
538
+ var isTsxFile = lowerPathParam(
539
+ (p) => p.endsWith(".tsx") || p.endsWith(".mtsx") || p.endsWith(".ctsx")
540
+ );
541
+ var isJsxFile = lowerPathParam(
542
+ (p) => p.endsWith(".jsx") || p.endsWith(".mjsx") || p.endsWith(".cjsx")
543
+ );
544
+ var isJsFile = lowerPathParam((p) => p.endsWith(".js") || p.endsWith(".mjs") || p.endsWith(".cjs"));
545
+
546
+ // src/runtime/connected-callback.ts
547
+ import { BUILD as BUILD25 } from "@stencil/core/internal/app-data";
548
+
549
+ // src/runtime/client-hydrate.ts
550
+ import { BUILD as BUILD14 } from "@stencil/core/internal/app-data";
551
+
552
+ // src/runtime/dom-extras.ts
553
+ import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
554
+
555
+ // src/runtime/slot-polyfill-utils.ts
556
+ import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
557
+
558
+ // src/runtime/profile.ts
559
+ import { BUILD as BUILD11 } from "@stencil/core/internal/app-data";
560
+
561
+ // src/runtime/styles.ts
562
+ import { BUILD as BUILD12 } from "@stencil/core/internal/app-data";
563
+
564
+ // src/runtime/vdom/h.ts
565
+ import { BUILD as BUILD13 } from "@stencil/core/internal/app-data";
566
+
567
+ // src/runtime/initialize-component.ts
568
+ import { BUILD as BUILD24 } from "@stencil/core/internal/app-data";
569
+
570
+ // src/utils/shadow-css.ts
571
+ /**
572
+ * @license
573
+ * Copyright Google Inc. All Rights Reserved.
574
+ *
575
+ * Use of this source code is governed by an MIT-style license that can be
576
+ * found in the LICENSE file at https://angular.io/license
577
+ *
578
+ * This file is a port of shadowCSS from `webcomponents.js` to TypeScript.
579
+ * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
580
+ * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
581
+ */
582
+ var _polyfillHost = "-shadowcsshost";
583
+ var _polyfillSlotted = "-shadowcssslotted";
584
+ var _polyfillHostContext = "-shadowcsscontext";
585
+ var _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
586
+ var _cssColonHostRe = new RegExp("(" + _polyfillHost + _parenSuffix, "gim");
587
+ var _cssColonHostContextRe = new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim");
588
+ var _cssColonSlottedRe = new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim");
589
+ var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
590
+ var createSupportsRuleRe = (selector) => {
591
+ const safeSelector = escapeRegExpSpecialCharacters(selector);
592
+ return new RegExp(
593
+ // First capture group: match any context before the selector that's not inside @supports selector()
594
+ // Using negative lookahead to avoid matching inside @supports selector(...) condition
595
+ `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector}))(${safeSelector}\\b)`,
596
+ "g"
597
+ );
598
+ };
599
+ var _colonSlottedRe = createSupportsRuleRe("::slotted");
600
+ var _colonHostRe = createSupportsRuleRe(":host");
601
+ var _colonHostContextRe = createSupportsRuleRe(":host-context");
602
+
603
+ // src/runtime/mode.ts
604
+ var setMode = (handler) => modeResolutionChain.push(handler);
605
+
606
+ // src/runtime/proxy-component.ts
607
+ import { BUILD as BUILD23 } from "@stencil/core/internal/app-data";
608
+
609
+ // src/runtime/set-value.ts
610
+ import { BUILD as BUILD22 } from "@stencil/core/internal/app-data";
611
+
612
+ // src/runtime/parse-property-value.ts
613
+ import { BUILD as BUILD15 } from "@stencil/core/internal/app-data";
614
+
615
+ // src/runtime/update-component.ts
616
+ import { BUILD as BUILD21, NAMESPACE } from "@stencil/core/internal/app-data";
617
+
618
+ // src/runtime/event-emitter.ts
619
+ import { BUILD as BUILD17 } from "@stencil/core/internal/app-data";
620
+
621
+ // src/runtime/element.ts
622
+ import { BUILD as BUILD16 } from "@stencil/core/internal/app-data";
623
+
624
+ // src/runtime/vdom/vdom-render.ts
625
+ import { BUILD as BUILD20 } from "@stencil/core/internal/app-data";
626
+
627
+ // src/runtime/vdom/update-element.ts
628
+ import { BUILD as BUILD19 } from "@stencil/core/internal/app-data";
629
+
630
+ // src/runtime/vdom/set-accessor.ts
631
+ import { BUILD as BUILD18 } from "@stencil/core/internal/app-data";
632
+ var CAPTURE_EVENT_SUFFIX = "Capture";
633
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
634
+
635
+ // src/runtime/disconnected-callback.ts
636
+ import { BUILD as BUILD26 } from "@stencil/core/internal/app-data";
637
+
638
+ // src/runtime/bootstrap-lazy.ts
639
+ import { BUILD as BUILD28 } from "@stencil/core/internal/app-data";
640
+
641
+ // src/runtime/host-listener.ts
642
+ import { BUILD as BUILD29 } from "@stencil/core/internal/app-data";
643
+
644
+ // src/runtime/mixin.ts
645
+ import { BUILD as BUILD30 } from "@stencil/core/internal/app-data";
646
+ var baseClass = BUILD30.lazyLoad ? class {
647
+ } : globalThis.HTMLElement || class {
648
+ };
649
+
650
+ // src/runtime/tag-transform.ts
651
+ var tagTransformer = void 0;
652
+ function transformTag(tag) {
653
+ if (!tagTransformer) return tag;
654
+ return tagTransformer(tag);
655
+ }
656
+ function setTagTransformer(transformer) {
657
+ if (tagTransformer) {
658
+ console.warn(`
659
+ A tagTransformer has already been set.
660
+ Overwriting it may lead to error and unexpected results if your components have already been defined.
661
+ `);
662
+ }
663
+ tagTransformer = transformer;
664
+ }
665
+
666
+ // src/mock-doc/attribute.ts
667
+ var attrHandler = {
668
+ get(obj, prop) {
669
+ if (prop in obj) {
670
+ return obj[prop];
671
+ }
672
+ if (typeof prop !== "symbol" && !isNaN(prop)) {
673
+ return obj.__items[prop];
674
+ }
675
+ return void 0;
676
+ }
677
+ };
678
+ var createAttributeProxy = (caseInsensitive) => new Proxy(new MockAttributeMap(caseInsensitive), attrHandler);
679
+ var MockAttributeMap = class {
680
+ constructor(caseInsensitive = false) {
681
+ this.caseInsensitive = caseInsensitive;
682
+ this.__items = [];
683
+ }
684
+ get length() {
685
+ return this.__items.length;
686
+ }
687
+ item(index) {
688
+ return this.__items[index] || null;
689
+ }
690
+ setNamedItem(attr) {
691
+ attr.namespaceURI = null;
692
+ this.setNamedItemNS(attr);
693
+ }
694
+ setNamedItemNS(attr) {
695
+ if (attr != null && attr.value != null) {
696
+ attr.value = String(attr.value);
697
+ }
698
+ const existingAttr = this.__items.find((a) => a.name === attr.name && a.namespaceURI === attr.namespaceURI);
699
+ if (existingAttr != null) {
700
+ existingAttr.value = attr.value;
701
+ } else {
702
+ this.__items.push(attr);
703
+ }
704
+ }
705
+ getNamedItem(attrName) {
706
+ if (this.caseInsensitive) {
707
+ attrName = attrName.toLowerCase();
708
+ }
709
+ return this.getNamedItemNS(null, attrName);
710
+ }
711
+ getNamedItemNS(namespaceURI, attrName) {
712
+ namespaceURI = getNamespaceURI(namespaceURI);
713
+ return this.__items.find((attr) => attr.name === attrName && getNamespaceURI(attr.namespaceURI) === namespaceURI) || null;
714
+ }
715
+ removeNamedItem(attr) {
716
+ this.removeNamedItemNS(attr);
717
+ }
718
+ removeNamedItemNS(attr) {
719
+ for (let i = 0, ii = this.__items.length; i < ii; i++) {
720
+ if (this.__items[i].name === attr.name && this.__items[i].namespaceURI === attr.namespaceURI) {
721
+ this.__items.splice(i, 1);
722
+ break;
723
+ }
724
+ }
725
+ }
726
+ [Symbol.iterator]() {
727
+ let i = 0;
728
+ return {
729
+ next: () => ({
730
+ done: i === this.length,
731
+ value: this.item(i++)
732
+ })
733
+ };
734
+ }
735
+ get [Symbol.toStringTag]() {
736
+ return "MockAttributeMap";
737
+ }
738
+ };
739
+ function getNamespaceURI(namespaceURI) {
740
+ return namespaceURI === XLINK_NS ? null : namespaceURI;
741
+ }
742
+ function cloneAttributes(srcAttrs, sortByName = false) {
743
+ const dstAttrs = new MockAttributeMap(srcAttrs.caseInsensitive);
744
+ if (srcAttrs != null) {
745
+ const attrLen = srcAttrs.length;
746
+ if (sortByName && attrLen > 1) {
747
+ const sortedAttrs = [];
748
+ for (let i = 0; i < attrLen; i++) {
749
+ const srcAttr = srcAttrs.item(i);
750
+ const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
751
+ sortedAttrs.push(dstAttr);
752
+ }
753
+ sortedAttrs.sort(sortAttributes).forEach((attr) => {
754
+ dstAttrs.setNamedItemNS(attr);
755
+ });
756
+ } else {
757
+ for (let i = 0; i < attrLen; i++) {
758
+ const srcAttr = srcAttrs.item(i);
759
+ const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
760
+ dstAttrs.setNamedItemNS(dstAttr);
761
+ }
762
+ }
763
+ }
764
+ return dstAttrs;
765
+ }
766
+ function sortAttributes(a, b) {
767
+ if (a.name < b.name) return -1;
768
+ if (a.name > b.name) return 1;
769
+ return 0;
770
+ }
771
+ var MockAttr = class {
772
+ constructor(attrName, attrValue, namespaceURI = null) {
773
+ this._name = attrName;
774
+ this._value = String(attrValue);
775
+ this._namespaceURI = namespaceURI;
776
+ }
777
+ get name() {
778
+ return this._name;
779
+ }
780
+ set name(value) {
781
+ this._name = value;
782
+ }
783
+ get value() {
784
+ return this._value;
785
+ }
786
+ set value(value) {
787
+ this._value = String(value);
788
+ }
789
+ get nodeName() {
790
+ return this._name;
791
+ }
792
+ set nodeName(value) {
793
+ this._name = value;
794
+ }
795
+ get nodeValue() {
796
+ return this._value;
797
+ }
798
+ set nodeValue(value) {
799
+ this._value = String(value);
800
+ }
801
+ get namespaceURI() {
802
+ return this._namespaceURI;
803
+ }
804
+ set namespaceURI(namespaceURI) {
805
+ this._namespaceURI = namespaceURI;
806
+ }
807
+ };
808
+
809
+ // src/mock-doc/css-style-declaration.ts
810
+ var MockCSSStyleDeclaration = class {
811
+ constructor() {
812
+ this._styles = /* @__PURE__ */ new Map();
813
+ }
814
+ setProperty(prop, value) {
815
+ prop = jsCaseToCssCase(prop);
816
+ if (value == null || value === "") {
817
+ this._styles.delete(prop);
818
+ } else {
819
+ this._styles.set(prop, String(value));
820
+ }
821
+ }
822
+ getPropertyValue(prop) {
823
+ prop = jsCaseToCssCase(prop);
824
+ return String(this._styles.get(prop) || "");
825
+ }
826
+ removeProperty(prop) {
827
+ prop = jsCaseToCssCase(prop);
828
+ this._styles.delete(prop);
829
+ }
830
+ get length() {
831
+ return this._styles.size;
832
+ }
833
+ get cssText() {
834
+ const cssText = [];
835
+ this._styles.forEach((value, prop) => {
836
+ cssText.push(`${prop}: ${value};`);
837
+ });
838
+ return cssText.join(" ").trim();
839
+ }
840
+ set cssText(cssText) {
841
+ if (cssText == null || cssText === "") {
842
+ this._styles.clear();
843
+ return;
844
+ }
845
+ cssText.split(";").forEach((rule) => {
846
+ rule = rule.trim();
847
+ if (rule.length > 0) {
848
+ const splt = rule.split(":");
849
+ if (splt.length > 1) {
850
+ const prop = splt[0].trim();
851
+ const value = splt.slice(1).join(":").trim();
852
+ if (prop !== "" && value !== "") {
853
+ this._styles.set(jsCaseToCssCase(prop), value);
854
+ }
855
+ }
856
+ }
857
+ });
858
+ }
859
+ };
860
+ function createCSSStyleDeclaration() {
861
+ return new Proxy(new MockCSSStyleDeclaration(), cssProxyHandler);
862
+ }
863
+ var cssProxyHandler = {
864
+ get(cssStyle, prop) {
865
+ if (prop in cssStyle) {
866
+ return cssStyle[prop];
867
+ }
868
+ prop = cssCaseToJsCase(prop);
869
+ return cssStyle.getPropertyValue(prop);
870
+ },
871
+ set(cssStyle, prop, value) {
872
+ if (prop in cssStyle) {
873
+ cssStyle[prop] = value;
874
+ } else {
875
+ cssStyle.setProperty(prop, value);
876
+ }
877
+ return true;
878
+ }
879
+ };
880
+ function cssCaseToJsCase(str) {
881
+ if (str.length > 1 && str.includes("-") === true) {
882
+ str = str.toLowerCase().split("-").map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1)).join("");
883
+ str = str.slice(0, 1).toLowerCase() + str.slice(1);
884
+ }
885
+ return str;
886
+ }
887
+ function jsCaseToCssCase(str) {
888
+ if (str.length > 1 && str.includes("-") === false && /[A-Z]/.test(str) === true) {
889
+ str = str.replace(/([A-Z])/g, (g) => " " + g[0]).trim().replace(/ /g, "-").toLowerCase();
890
+ }
891
+ return str;
892
+ }
893
+
894
+ // src/mock-doc/custom-element-registry.ts
895
+ var MockCustomElementRegistry = class {
896
+ constructor(win2) {
897
+ this.win = win2;
898
+ }
899
+ define(tagName, cstr, options) {
900
+ if (tagName.toLowerCase() !== tagName) {
901
+ throw new Error(
902
+ `Failed to execute 'define' on 'CustomElementRegistry': "${tagName}" is not a valid custom element name`
903
+ );
904
+ }
905
+ if (this.__registry == null) {
906
+ this.__registry = /* @__PURE__ */ new Map();
907
+ }
908
+ this.__registry.set(tagName, { cstr, options });
909
+ if (this.__whenDefined != null) {
910
+ const whenDefinedResolveFns = this.__whenDefined.get(tagName);
911
+ if (whenDefinedResolveFns != null) {
912
+ whenDefinedResolveFns.forEach((whenDefinedResolveFn) => {
913
+ whenDefinedResolveFn();
914
+ });
915
+ whenDefinedResolveFns.length = 0;
916
+ this.__whenDefined.delete(tagName);
917
+ }
918
+ }
919
+ const doc = this.win.document;
920
+ if (doc != null) {
921
+ const hosts = doc.querySelectorAll(tagName);
922
+ hosts.forEach((host) => {
923
+ if (upgradedElements.has(host) === false) {
924
+ tempDisableCallbacks.add(doc);
925
+ const upgradedCmp = createCustomElement(this, doc, tagName);
926
+ for (let i = 0; i < host.childNodes.length; i++) {
927
+ const childNode = host.childNodes[i];
928
+ childNode.remove();
929
+ upgradedCmp.appendChild(childNode);
930
+ }
931
+ tempDisableCallbacks.delete(doc);
932
+ if (proxyElements.has(host)) {
933
+ proxyElements.set(host, upgradedCmp);
934
+ }
935
+ }
936
+ fireConnectedCallback2(host);
937
+ });
938
+ }
939
+ }
940
+ get(tagName) {
941
+ if (this.__registry != null) {
942
+ const def = this.__registry.get(tagName.toLowerCase());
943
+ if (def != null) {
944
+ return def.cstr;
945
+ }
946
+ }
947
+ return void 0;
948
+ }
949
+ getName(cstr) {
950
+ for (const [tagName, def] of this.__registry.entries()) {
951
+ if (def.cstr === cstr) {
952
+ return tagName;
953
+ }
954
+ }
955
+ return void 0;
956
+ }
957
+ upgrade(_rootNode) {
958
+ }
959
+ clear() {
960
+ if (this.__registry != null) {
961
+ this.__registry.clear();
962
+ }
963
+ if (this.__whenDefined != null) {
964
+ this.__whenDefined.clear();
965
+ }
966
+ }
967
+ whenDefined(tagName) {
968
+ tagName = tagName.toLowerCase();
969
+ if (this.__registry != null && this.__registry.has(tagName) === true) {
970
+ return Promise.resolve(this.__registry.get(tagName).cstr);
971
+ }
972
+ return new Promise((resolve) => {
973
+ if (this.__whenDefined == null) {
974
+ this.__whenDefined = /* @__PURE__ */ new Map();
975
+ }
976
+ let whenDefinedResolveFns = this.__whenDefined.get(tagName);
977
+ if (whenDefinedResolveFns == null) {
978
+ whenDefinedResolveFns = [];
979
+ this.__whenDefined.set(tagName, whenDefinedResolveFns);
980
+ }
981
+ whenDefinedResolveFns.push(resolve);
982
+ });
983
+ }
984
+ };
985
+ function createCustomElement(customElements2, ownerDocument, tagName) {
986
+ const Cstr = customElements2.get(tagName);
987
+ if (Cstr != null) {
988
+ const cmp = new Cstr(ownerDocument);
989
+ cmp.nodeName = tagName.toUpperCase();
990
+ upgradedElements.add(cmp);
991
+ return cmp;
992
+ }
993
+ const host = new Proxy(
994
+ {},
995
+ {
996
+ get(obj, prop) {
997
+ const elm2 = proxyElements.get(host);
998
+ if (elm2 != null) {
999
+ return elm2[prop];
1000
+ }
1001
+ return obj[prop];
1002
+ },
1003
+ set(obj, prop, val) {
1004
+ const elm2 = proxyElements.get(host);
1005
+ if (elm2 != null) {
1006
+ elm2[prop] = val;
1007
+ } else {
1008
+ obj[prop] = val;
1009
+ }
1010
+ return true;
1011
+ },
1012
+ has(obj, prop) {
1013
+ const elm2 = proxyElements.get(host);
1014
+ if (prop in elm2) {
1015
+ return true;
1016
+ }
1017
+ if (prop in obj) {
1018
+ return true;
1019
+ }
1020
+ return false;
1021
+ }
1022
+ }
1023
+ );
1024
+ const elm = new MockHTMLElement(ownerDocument, tagName);
1025
+ proxyElements.set(host, elm);
1026
+ return host;
1027
+ }
1028
+ var proxyElements = /* @__PURE__ */ new WeakMap();
383
1029
  var upgradedElements = /* @__PURE__ */ new WeakSet();
384
1030
  function connectNode(ownerDocument, node) {
385
1031
  node.ownerDocument = ownerDocument;
@@ -387,7 +1033,7 @@ function connectNode(ownerDocument, node) {
387
1033
  if (ownerDocument != null && node.nodeName.includes("-")) {
388
1034
  const win2 = ownerDocument.defaultView;
389
1035
  if (win2 != null && typeof node.connectedCallback === "function" && node.isConnected) {
390
- fireConnectedCallback(node);
1036
+ fireConnectedCallback2(node);
391
1037
  }
392
1038
  const shadowRoot = node.shadowRoot;
393
1039
  if (shadowRoot != null) {
@@ -405,7 +1051,7 @@ function connectNode(ownerDocument, node) {
405
1051
  });
406
1052
  }
407
1053
  }
408
- function fireConnectedCallback(node) {
1054
+ function fireConnectedCallback2(node) {
409
1055
  if (typeof node.connectedCallback === "function") {
410
1056
  if (tempDisableCallbacks.has(node.ownerDocument) === false) {
411
1057
  try {
@@ -455,7 +1101,7 @@ function dataset(elm) {
455
1101
  const attr = attributes.item(i);
456
1102
  const nodeName = attr.nodeName;
457
1103
  if (nodeName.startsWith("data-")) {
458
- ds[dashToPascalCase(nodeName)] = attr.nodeValue;
1104
+ ds[dashToPascalCase2(nodeName)] = attr.nodeValue;
459
1105
  }
460
1106
  }
461
1107
  return new Proxy(ds, {
@@ -472,7 +1118,7 @@ function dataset(elm) {
472
1118
  function toDataAttribute(str) {
473
1119
  return "data-" + String(str).replace(/([A-Z0-9])/g, (g) => " " + g[0]).trim().replace(/ /g, "-").toLowerCase();
474
1120
  }
475
- function dashToPascalCase(str) {
1121
+ function dashToPascalCase2(str) {
476
1122
  str = String(str).slice(5);
477
1123
  return str.split("-").map((segment, index) => {
478
1124
  if (index === 0) {
@@ -8824,14 +9470,14 @@ var jquery_default = (
8824
9470
  *
8825
9471
  * Date: 2023-12-11T17:55Z
8826
9472
  */
8827
- function(global2, factory) {
9473
+ (function(global2, factory) {
8828
9474
  "use strict";
8829
9475
  if (true) {
8830
9476
  return factory(global2, true);
8831
9477
  } else {
8832
9478
  factory(global2);
8833
9479
  }
8834
- }({
9480
+ })({
8835
9481
  document: {
8836
9482
  createElement() {
8837
9483
  return {};
@@ -10801,10 +11447,10 @@ var MockNode2 = class {
10801
11447
  insertBefore(newNode, referenceNode) {
10802
11448
  if (newNode.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
10803
11449
  for (let i = 0, ii = newNode.childNodes.length; i < ii; i++) {
10804
- insertBefore(this, newNode.childNodes[i], referenceNode);
11450
+ insertBefore2(this, newNode.childNodes[i], referenceNode);
10805
11451
  }
10806
11452
  } else {
10807
- insertBefore(this, newNode, referenceNode);
11453
+ insertBefore2(this, newNode, referenceNode);
10808
11454
  }
10809
11455
  return newNode;
10810
11456
  }
@@ -11149,13 +11795,13 @@ var MockElement = class extends MockNode2 {
11149
11795
  }
11150
11796
  insertAdjacentElement(position, elm) {
11151
11797
  if (position === "beforebegin" && this.parentNode) {
11152
- insertBefore(this.parentNode, elm, this);
11798
+ insertBefore2(this.parentNode, elm, this);
11153
11799
  } else if (position === "afterbegin") {
11154
11800
  this.prepend(elm);
11155
11801
  } else if (position === "beforeend") {
11156
11802
  this.appendChild(elm);
11157
11803
  } else if (position === "afterend" && this.parentNode) {
11158
- insertBefore(this.parentNode, elm, this.nextSibling);
11804
+ insertBefore2(this.parentNode, elm, this.nextSibling);
11159
11805
  }
11160
11806
  return elm;
11161
11807
  }
@@ -11164,7 +11810,7 @@ var MockElement = class extends MockNode2 {
11164
11810
  if (position === "beforebegin") {
11165
11811
  while (frag.childNodes.length > 0) {
11166
11812
  if (this.parentNode) {
11167
- insertBefore(this.parentNode, frag.childNodes[0], this);
11813
+ insertBefore2(this.parentNode, frag.childNodes[0], this);
11168
11814
  }
11169
11815
  }
11170
11816
  } else if (position === "afterbegin") {
@@ -11178,7 +11824,7 @@ var MockElement = class extends MockNode2 {
11178
11824
  } else if (position === "afterend") {
11179
11825
  while (frag.childNodes.length > 0) {
11180
11826
  if (this.parentNode) {
11181
- insertBefore(this.parentNode, frag.childNodes[frag.childNodes.length - 1], this.nextSibling);
11827
+ insertBefore2(this.parentNode, frag.childNodes[frag.childNodes.length - 1], this.nextSibling);
11182
11828
  }
11183
11829
  }
11184
11830
  }
@@ -11186,13 +11832,13 @@ var MockElement = class extends MockNode2 {
11186
11832
  insertAdjacentText(position, text) {
11187
11833
  const elm = this.ownerDocument.createTextNode(text);
11188
11834
  if (position === "beforebegin" && this.parentNode) {
11189
- insertBefore(this.parentNode, elm, this);
11835
+ insertBefore2(this.parentNode, elm, this);
11190
11836
  } else if (position === "afterbegin") {
11191
11837
  this.prepend(elm);
11192
11838
  } else if (position === "beforeend") {
11193
11839
  this.appendChild(elm);
11194
11840
  } else if (position === "afterend" && this.parentNode) {
11195
- insertBefore(this.parentNode, elm, this.nextSibling);
11841
+ insertBefore2(this.parentNode, elm, this.nextSibling);
11196
11842
  }
11197
11843
  }
11198
11844
  hasAttribute(attrName) {
@@ -11607,7 +12253,7 @@ function resetElement(elm) {
11607
12253
  delete elm.__shadowRoot;
11608
12254
  delete elm.__style;
11609
12255
  }
11610
- function insertBefore(parentNode, newNode, referenceNode) {
12256
+ function insertBefore2(parentNode, newNode, referenceNode) {
11611
12257
  if (newNode !== referenceNode) {
11612
12258
  newNode.remove();
11613
12259
  newNode.parentNode = parentNode;
@@ -13691,1096 +14337,466 @@ var MockWindow = class {
13691
14337
  }
13692
14338
  onmousemove() {
13693
14339
  }
13694
- onmouseout() {
13695
- }
13696
- onmouseover() {
13697
- }
13698
- onmouseup() {
13699
- }
13700
- onmousewheel() {
13701
- }
13702
- onpaste() {
13703
- }
13704
- onpause() {
13705
- }
13706
- onplay() {
13707
- }
13708
- onplaying() {
13709
- }
13710
- onpointercancel() {
13711
- }
13712
- onpointerdown() {
13713
- }
13714
- onpointerenter() {
13715
- }
13716
- onpointerleave() {
13717
- }
13718
- onpointermove() {
13719
- }
13720
- onpointerout() {
13721
- }
13722
- onpointerover() {
13723
- }
13724
- onpointerup() {
13725
- }
13726
- onprogress() {
13727
- }
13728
- onratechange() {
13729
- }
13730
- onreset() {
13731
- }
13732
- onresize() {
13733
- }
13734
- onscroll() {
13735
- }
13736
- onsearch() {
13737
- }
13738
- onseeked() {
13739
- }
13740
- onseeking() {
13741
- }
13742
- onselect() {
13743
- }
13744
- onselectstart() {
13745
- }
13746
- onstalled() {
13747
- }
13748
- onsubmit() {
13749
- }
13750
- onsuspend() {
13751
- }
13752
- ontimeupdate() {
13753
- }
13754
- ontoggle() {
13755
- }
13756
- onvolumechange() {
13757
- }
13758
- onwaiting() {
13759
- }
13760
- onwebkitfullscreenchange() {
13761
- }
13762
- onwebkitfullscreenerror() {
13763
- }
13764
- onwheel() {
13765
- }
13766
- };
13767
- addGlobalsToWindowPrototype(MockWindow.prototype);
13768
- function resetWindowDefaults(win2) {
13769
- win2.__clearInterval = nativeClearInterval;
13770
- win2.__clearTimeout = nativeClearTimeout;
13771
- win2.__setInterval = nativeSetInterval;
13772
- win2.__setTimeout = nativeSetTimeout;
13773
- win2.__maxTimeout = 6e4;
13774
- win2.__allowInterval = true;
13775
- win2.URL = nativeURL;
13776
- }
13777
- function cloneWindow(srcWin, opts = {}) {
13778
- if (srcWin == null) {
13779
- return null;
13780
- }
13781
- const clonedWin = new MockWindow(false);
13782
- if (!opts.customElementProxy) {
13783
- srcWin.customElements = null;
14340
+ onmouseout() {
13784
14341
  }
13785
- if (srcWin.document != null) {
13786
- const clonedDoc = new MockDocument(false, clonedWin);
13787
- clonedWin.document = clonedDoc;
13788
- clonedDoc.documentElement = srcWin.document.documentElement.cloneNode(true);
13789
- } else {
13790
- clonedWin.document = new MockDocument(null, clonedWin);
14342
+ onmouseover() {
13791
14343
  }
13792
- return clonedWin;
13793
- }
13794
- function constrainTimeouts(win2) {
13795
- win2.__allowInterval = false;
13796
- win2.__maxTimeout = 0;
13797
- }
13798
- function resetWindow(win2) {
13799
- if (win2 != null) {
13800
- if (win2.__timeouts) {
13801
- win2.__timeouts.forEach((timeoutId) => {
13802
- nativeClearInterval(timeoutId);
13803
- nativeClearTimeout(timeoutId);
13804
- });
13805
- win2.__timeouts.clear();
13806
- }
13807
- if (win2.customElements && win2.customElements.clear) {
13808
- win2.customElements.clear();
13809
- }
13810
- resetDocument(win2.document);
13811
- resetPerformance(win2.performance);
13812
- for (const key in win2) {
13813
- if (win2.hasOwnProperty(key) && key !== "document" && key !== "performance" && key !== "customElements") {
13814
- delete win2[key];
13815
- }
13816
- }
13817
- resetWindowDefaults(win2);
13818
- resetWindowDimensions(win2);
13819
- resetEventListeners(win2);
13820
- if (win2.document != null) {
13821
- try {
13822
- win2.document.defaultView = win2;
13823
- } catch (e) {
13824
- }
13825
- }
13826
- win2.fetch = null;
13827
- win2.Headers = null;
13828
- win2.Request = null;
13829
- win2.Response = null;
13830
- win2.FetchError = null;
14344
+ onmouseup() {
13831
14345
  }
13832
- }
13833
- function resetWindowDimensions(win2) {
13834
- try {
13835
- win2.devicePixelRatio = 1;
13836
- win2.innerHeight = 768;
13837
- win2.innerWidth = 1366;
13838
- win2.pageXOffset = 0;
13839
- win2.pageYOffset = 0;
13840
- win2.screenLeft = 0;
13841
- win2.screenTop = 0;
13842
- win2.screenX = 0;
13843
- win2.screenY = 0;
13844
- win2.scrollX = 0;
13845
- win2.scrollY = 0;
13846
- win2.screen = {
13847
- availHeight: win2.innerHeight,
13848
- availLeft: 0,
13849
- availTop: 0,
13850
- availWidth: win2.innerWidth,
13851
- colorDepth: 24,
13852
- height: win2.innerHeight,
13853
- keepAwake: false,
13854
- orientation: {
13855
- angle: 0,
13856
- type: "portrait-primary"
13857
- },
13858
- pixelDepth: 24,
13859
- width: win2.innerWidth
13860
- };
13861
- } catch (e) {
14346
+ onmousewheel() {
13862
14347
  }
13863
- }
13864
-
13865
- // src/mock-doc/document.ts
13866
- var MockDocument = class _MockDocument extends MockHTMLElement {
13867
- constructor(html = null, win2 = null) {
13868
- super(null, null);
13869
- this.nodeName = "#document" /* DOCUMENT_NODE */;
13870
- this.nodeType = 9 /* DOCUMENT_NODE */;
13871
- this.defaultView = win2;
13872
- this.cookie = "";
13873
- this.referrer = "";
13874
- this.appendChild(this.createDocumentTypeNode());
13875
- if (typeof html === "string") {
13876
- const parsedDoc = parseDocumentUtil(this, html);
13877
- const documentElement = parsedDoc.children.find((elm) => elm.nodeName === "HTML");
13878
- if (documentElement != null) {
13879
- this.appendChild(documentElement);
13880
- setOwnerDocument(documentElement, this);
13881
- }
13882
- } else if (html !== false) {
13883
- const documentElement = new MockHTMLElement(this, "html");
13884
- this.appendChild(documentElement);
13885
- documentElement.appendChild(new MockHTMLElement(this, "head"));
13886
- documentElement.appendChild(new MockHTMLElement(this, "body"));
13887
- }
14348
+ onpaste() {
13888
14349
  }
13889
- get dir() {
13890
- return this.documentElement.dir;
14350
+ onpause() {
13891
14351
  }
13892
- set dir(value) {
13893
- this.documentElement.dir = value;
14352
+ onplay() {
13894
14353
  }
13895
- get localName() {
13896
- throw new Error("Unimplemented");
14354
+ onplaying() {
13897
14355
  }
13898
- get location() {
13899
- if (this.defaultView != null) {
13900
- return this.defaultView.location;
13901
- }
13902
- return null;
14356
+ onpointercancel() {
13903
14357
  }
13904
- set location(val) {
13905
- if (this.defaultView != null) {
13906
- this.defaultView.location.href = val;
13907
- }
14358
+ onpointerdown() {
13908
14359
  }
13909
- get baseURI() {
13910
- const baseNode = this.head.childNodes.find((node) => node.nodeName === "BASE");
13911
- if (baseNode) {
13912
- return baseNode.href;
13913
- }
13914
- return this.URL;
14360
+ onpointerenter() {
13915
14361
  }
13916
- get URL() {
13917
- return this.location.href;
14362
+ onpointerleave() {
13918
14363
  }
13919
- get styleSheets() {
13920
- return this.querySelectorAll("style");
14364
+ onpointermove() {
13921
14365
  }
13922
- get scripts() {
13923
- return this.querySelectorAll("script");
14366
+ onpointerout() {
13924
14367
  }
13925
- get forms() {
13926
- return this.querySelectorAll("form");
14368
+ onpointerover() {
13927
14369
  }
13928
- get images() {
13929
- return this.querySelectorAll("img");
14370
+ onpointerup() {
13930
14371
  }
13931
- get scrollingElement() {
13932
- return this.documentElement;
14372
+ onprogress() {
13933
14373
  }
13934
- get documentElement() {
13935
- for (let i = this.childNodes.length - 1; i >= 0; i--) {
13936
- if (this.childNodes[i].nodeName === "HTML") {
13937
- return this.childNodes[i];
13938
- }
13939
- }
13940
- const documentElement = new MockHTMLElement(this, "html");
13941
- this.appendChild(documentElement);
13942
- return documentElement;
14374
+ onratechange() {
13943
14375
  }
13944
- set documentElement(documentElement) {
13945
- for (let i = this.childNodes.length - 1; i >= 0; i--) {
13946
- if (this.childNodes[i].nodeType !== 10 /* DOCUMENT_TYPE_NODE */) {
13947
- this.childNodes[i].remove();
13948
- }
13949
- }
13950
- if (documentElement != null) {
13951
- this.appendChild(documentElement);
13952
- setOwnerDocument(documentElement, this);
13953
- }
14376
+ onreset() {
13954
14377
  }
13955
- get head() {
13956
- const documentElement = this.documentElement;
13957
- for (let i = 0; i < documentElement.childNodes.length; i++) {
13958
- if (documentElement.childNodes[i].nodeName === "HEAD") {
13959
- return documentElement.childNodes[i];
13960
- }
13961
- }
13962
- const head = new MockHTMLElement(this, "head");
13963
- documentElement.insertBefore(head, documentElement.firstChild);
13964
- return head;
14378
+ onresize() {
13965
14379
  }
13966
- set head(head) {
13967
- const documentElement = this.documentElement;
13968
- for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
13969
- if (documentElement.childNodes[i].nodeName === "HEAD") {
13970
- documentElement.childNodes[i].remove();
13971
- }
13972
- }
13973
- if (head != null) {
13974
- documentElement.insertBefore(head, documentElement.firstChild);
13975
- setOwnerDocument(head, this);
13976
- }
14380
+ onscroll() {
13977
14381
  }
13978
- get body() {
13979
- const documentElement = this.documentElement;
13980
- for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
13981
- if (documentElement.childNodes[i].nodeName === "BODY") {
13982
- return documentElement.childNodes[i];
13983
- }
13984
- }
13985
- const body = new MockHTMLElement(this, "body");
13986
- documentElement.appendChild(body);
13987
- return body;
14382
+ onsearch() {
13988
14383
  }
13989
- set body(body) {
13990
- const documentElement = this.documentElement;
13991
- for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
13992
- if (documentElement.childNodes[i].nodeName === "BODY") {
13993
- documentElement.childNodes[i].remove();
13994
- }
13995
- }
13996
- if (body != null) {
13997
- documentElement.appendChild(body);
13998
- setOwnerDocument(body, this);
13999
- }
14384
+ onseeked() {
14000
14385
  }
14001
- appendChild(newNode) {
14002
- newNode.remove();
14003
- newNode.parentNode = this;
14004
- this.childNodes.push(newNode);
14005
- return newNode;
14386
+ onseeking() {
14006
14387
  }
14007
- createComment(data) {
14008
- return new MockComment(this, data);
14388
+ onselect() {
14009
14389
  }
14010
- createAttribute(attrName) {
14011
- return new MockAttr(attrName.toLowerCase(), "");
14390
+ onselectstart() {
14012
14391
  }
14013
- createAttributeNS(namespaceURI, attrName) {
14014
- return new MockAttr(attrName, "", namespaceURI);
14392
+ onstalled() {
14015
14393
  }
14016
- createElement(tagName) {
14017
- if (tagName === "#document" /* DOCUMENT_NODE */) {
14018
- const doc = new _MockDocument(false);
14019
- doc.nodeName = tagName;
14020
- doc.parentNode = null;
14021
- return doc;
14022
- }
14023
- return createElement(this, tagName);
14394
+ onsubmit() {
14024
14395
  }
14025
- createElementNS(namespaceURI, tagName) {
14026
- const elmNs = createElementNS(this, namespaceURI, tagName);
14027
- return elmNs;
14396
+ onsuspend() {
14028
14397
  }
14029
- createTextNode(text) {
14030
- return new MockTextNode(this, text);
14398
+ ontimeupdate() {
14031
14399
  }
14032
- createDocumentFragment() {
14033
- return new MockDocumentFragment(this);
14400
+ ontoggle() {
14034
14401
  }
14035
- createDocumentTypeNode() {
14036
- return new MockDocumentTypeNode(this);
14402
+ onvolumechange() {
14037
14403
  }
14038
- getElementById(id) {
14039
- return getElementById(this, id);
14404
+ onwaiting() {
14040
14405
  }
14041
- getElementsByName(elmName) {
14042
- return getElementsByName(this, elmName.toLowerCase());
14406
+ onwebkitfullscreenchange() {
14043
14407
  }
14044
- get title() {
14045
- const title = this.head.childNodes.find((elm) => elm.nodeName === "TITLE");
14046
- if (title != null && typeof title.textContent === "string") {
14047
- return title.textContent.trim();
14048
- }
14049
- return "";
14408
+ onwebkitfullscreenerror() {
14050
14409
  }
14051
- set title(value) {
14052
- const head = this.head;
14053
- let title = head.childNodes.find((elm) => elm.nodeName === "TITLE");
14054
- if (title == null) {
14055
- title = this.createElement("title");
14056
- head.appendChild(title);
14057
- }
14058
- title.textContent = value;
14410
+ onwheel() {
14059
14411
  }
14060
14412
  };
14061
- function resetDocument(doc) {
14062
- if (doc != null) {
14063
- resetEventListeners(doc);
14064
- const documentElement = doc.documentElement;
14065
- if (documentElement != null) {
14066
- resetElement(documentElement);
14067
- for (let i = 0, ii = documentElement.childNodes.length; i < ii; i++) {
14068
- const childNode = documentElement.childNodes[i];
14069
- resetElement(childNode);
14070
- childNode.childNodes.length = 0;
14071
- }
14072
- }
14073
- for (const key in doc) {
14074
- if (doc.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
14075
- delete doc[key];
14076
- }
14077
- }
14078
- try {
14079
- doc.nodeName = "#document" /* DOCUMENT_NODE */;
14080
- } catch (e) {
14081
- }
14082
- try {
14083
- doc.nodeType = 9 /* DOCUMENT_NODE */;
14084
- } catch (e) {
14085
- }
14086
- try {
14087
- doc.cookie = "";
14088
- } catch (e) {
14089
- }
14090
- try {
14091
- doc.referrer = "";
14092
- } catch (e) {
14093
- }
14413
+ addGlobalsToWindowPrototype(MockWindow.prototype);
14414
+ function resetWindowDefaults(win2) {
14415
+ win2.__clearInterval = nativeClearInterval;
14416
+ win2.__clearTimeout = nativeClearTimeout;
14417
+ win2.__setInterval = nativeSetInterval;
14418
+ win2.__setTimeout = nativeSetTimeout;
14419
+ win2.__maxTimeout = 6e4;
14420
+ win2.__allowInterval = true;
14421
+ win2.URL = nativeURL;
14422
+ }
14423
+ function cloneWindow(srcWin, opts = {}) {
14424
+ if (srcWin == null) {
14425
+ return null;
14426
+ }
14427
+ const clonedWin = new MockWindow(false);
14428
+ if (!opts.customElementProxy) {
14429
+ srcWin.customElements = null;
14430
+ }
14431
+ if (srcWin.document != null) {
14432
+ const clonedDoc = new MockDocument(false, clonedWin);
14433
+ clonedWin.document = clonedDoc;
14434
+ clonedDoc.documentElement = srcWin.document.documentElement.cloneNode(true);
14435
+ } else {
14436
+ clonedWin.document = new MockDocument(null, clonedWin);
14094
14437
  }
14438
+ return clonedWin;
14095
14439
  }
14096
- var DOC_KEY_KEEPERS = /* @__PURE__ */ new Set([
14097
- "nodeName",
14098
- "nodeType",
14099
- "nodeValue",
14100
- "ownerDocument",
14101
- "parentNode",
14102
- "childNodes",
14103
- "_shadowRoot"
14104
- ]);
14105
- function getElementById(elm, id) {
14106
- const children = elm.children;
14107
- for (let i = 0, ii = children.length; i < ii; i++) {
14108
- const childElm = children[i];
14109
- if (childElm.id === id) {
14110
- return childElm;
14440
+ function constrainTimeouts(win2) {
14441
+ win2.__allowInterval = false;
14442
+ win2.__maxTimeout = 0;
14443
+ }
14444
+ function resetWindow(win2) {
14445
+ if (win2 != null) {
14446
+ if (win2.__timeouts) {
14447
+ win2.__timeouts.forEach((timeoutId) => {
14448
+ nativeClearInterval(timeoutId);
14449
+ nativeClearTimeout(timeoutId);
14450
+ });
14451
+ win2.__timeouts.clear();
14111
14452
  }
14112
- const childElmFound = getElementById(childElm, id);
14113
- if (childElmFound != null) {
14114
- return childElmFound;
14453
+ if (win2.customElements && win2.customElements.clear) {
14454
+ win2.customElements.clear();
14115
14455
  }
14116
- }
14117
- return null;
14118
- }
14119
- function getElementsByName(elm, elmName, foundElms = []) {
14120
- const children = elm.children;
14121
- for (let i = 0, ii = children.length; i < ii; i++) {
14122
- const childElm = children[i];
14123
- if (childElm.name && childElm.name.toLowerCase() === elmName) {
14124
- foundElms.push(childElm);
14456
+ resetDocument(win2.document);
14457
+ resetPerformance(win2.performance);
14458
+ for (const key in win2) {
14459
+ if (win2.hasOwnProperty(key) && key !== "document" && key !== "performance" && key !== "customElements") {
14460
+ delete win2[key];
14461
+ }
14125
14462
  }
14126
- getElementsByName(childElm, elmName, foundElms);
14127
- }
14128
- return foundElms;
14129
- }
14130
- function setOwnerDocument(elm, ownerDocument) {
14131
- for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
14132
- elm.childNodes[i].ownerDocument = ownerDocument;
14133
- if (elm.childNodes[i].nodeType === 1 /* ELEMENT_NODE */) {
14134
- setOwnerDocument(elm.childNodes[i], ownerDocument);
14463
+ resetWindowDefaults(win2);
14464
+ resetWindowDimensions(win2);
14465
+ resetEventListeners(win2);
14466
+ if (win2.document != null) {
14467
+ try {
14468
+ win2.document.defaultView = win2;
14469
+ } catch (e) {
14470
+ }
14135
14471
  }
14472
+ win2.fetch = null;
14473
+ win2.Headers = null;
14474
+ win2.Request = null;
14475
+ win2.Response = null;
14476
+ win2.FetchError = null;
14136
14477
  }
14137
14478
  }
14138
-
14139
- // src/hydrate/runner/create-window.ts
14140
- var templateWindows = /* @__PURE__ */ new Map();
14141
- function createWindowFromHtml(templateHtml, uniqueId) {
14142
- let templateWindow = templateWindows.get(uniqueId);
14143
- if (templateWindow == null) {
14144
- templateWindow = new MockWindow(templateHtml);
14145
- templateWindows.set(uniqueId, templateWindow);
14146
- }
14147
- const win2 = cloneWindow(templateWindow);
14148
- return win2;
14149
- }
14150
-
14151
- // src/hydrate/runner/render.ts
14152
- import { Readable } from "stream";
14153
- import { hydrateFactory } from "@stencil/core/hydrate-factory";
14154
-
14155
- // src/client/client-build.ts
14156
- import { BUILD } from "@stencil/core/internal/app-data";
14157
- var Build = {
14158
- isDev: BUILD.isDev ? true : false,
14159
- isBrowser: true,
14160
- isServer: false,
14161
- isTesting: BUILD.isTesting ? true : false
14162
- };
14163
-
14164
- // src/client/client-host-ref.ts
14165
- import { BUILD as BUILD3 } from "@stencil/core/internal/app-data";
14166
-
14167
- // src/utils/constants.ts
14168
- var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
14169
- PrimitiveType2["Undefined"] = "undefined";
14170
- PrimitiveType2["Null"] = "null";
14171
- PrimitiveType2["String"] = "string";
14172
- PrimitiveType2["Number"] = "number";
14173
- PrimitiveType2["SpecialNumber"] = "number";
14174
- PrimitiveType2["Boolean"] = "boolean";
14175
- PrimitiveType2["BigInt"] = "bigint";
14176
- return PrimitiveType2;
14177
- })(PrimitiveType || {});
14178
- var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
14179
- NonPrimitiveType2["Array"] = "array";
14180
- NonPrimitiveType2["Date"] = "date";
14181
- NonPrimitiveType2["Map"] = "map";
14182
- NonPrimitiveType2["Object"] = "object";
14183
- NonPrimitiveType2["RegularExpression"] = "regexp";
14184
- NonPrimitiveType2["Set"] = "set";
14185
- NonPrimitiveType2["Channel"] = "channel";
14186
- NonPrimitiveType2["Symbol"] = "symbol";
14187
- return NonPrimitiveType2;
14188
- })(NonPrimitiveType || {});
14189
- var TYPE_CONSTANT = "type";
14190
- var VALUE_CONSTANT = "value";
14191
- var SERIALIZED_PREFIX = "serialized:";
14192
-
14193
- // src/utils/es2022-rewire-class-members.ts
14194
- import { BUILD as BUILD2 } from "@stencil/core/internal/app-data";
14195
-
14196
- // src/client/client-load-module.ts
14197
- import { BUILD as BUILD5 } from "@stencil/core/internal/app-data";
14198
-
14199
- // src/client/client-log.ts
14200
- import { BUILD as BUILD4 } from "@stencil/core/internal/app-data";
14201
- var STENCIL_DEV_MODE = BUILD4.isTesting ? ["STENCIL:"] : [
14202
- "%cstencil",
14203
- "color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
14204
- ];
14205
-
14206
- // src/client/client-style.ts
14207
- var modeResolutionChain = [];
14208
-
14209
- // src/client/client-task-queue.ts
14210
- import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
14211
-
14212
- // src/client/client-window.ts
14213
- import { BUILD as BUILD6 } from "@stencil/core/internal/app-data";
14214
- var win = typeof window !== "undefined" ? window : {};
14215
- var H = win.HTMLElement || class {
14216
- };
14217
- var supportsShadow = BUILD6.shadowDom;
14218
- var supportsConstructableStylesheets = BUILD6.constructableCSS ? /* @__PURE__ */ (() => {
14479
+ function resetWindowDimensions(win2) {
14219
14480
  try {
14220
- new CSSStyleSheet();
14221
- return typeof new CSSStyleSheet().replaceSync === "function";
14481
+ win2.devicePixelRatio = 1;
14482
+ win2.innerHeight = 768;
14483
+ win2.innerWidth = 1366;
14484
+ win2.pageXOffset = 0;
14485
+ win2.pageYOffset = 0;
14486
+ win2.screenLeft = 0;
14487
+ win2.screenTop = 0;
14488
+ win2.screenX = 0;
14489
+ win2.screenY = 0;
14490
+ win2.scrollX = 0;
14491
+ win2.scrollY = 0;
14492
+ win2.screen = {
14493
+ availHeight: win2.innerHeight,
14494
+ availLeft: 0,
14495
+ availTop: 0,
14496
+ availWidth: win2.innerWidth,
14497
+ colorDepth: 24,
14498
+ height: win2.innerHeight,
14499
+ keepAwake: false,
14500
+ orientation: {
14501
+ angle: 0,
14502
+ type: "portrait-primary"
14503
+ },
14504
+ pixelDepth: 24,
14505
+ width: win2.innerWidth
14506
+ };
14222
14507
  } catch (e) {
14223
14508
  }
14224
- return false;
14225
- })() : false;
14226
-
14227
- // src/client/index.ts
14228
- import { BUILD as BUILD31, Env, NAMESPACE as NAMESPACE2 } from "@stencil/core/internal/app-data";
14229
-
14230
- // src/runtime/bootstrap-custom-element.ts
14231
- import { BUILD as BUILD27 } from "@stencil/core/internal/app-data";
14232
-
14233
- // src/utils/helpers.ts
14234
- var isString = (v) => typeof v === "string";
14509
+ }
14235
14510
 
14236
- // src/utils/local-value.ts
14237
- var LocalValue = class _LocalValue {
14238
- constructor(type, value) {
14239
- if (type === "undefined" /* Undefined */ || type === "null" /* Null */) {
14240
- this.type = type;
14241
- } else {
14242
- this.type = type;
14243
- this.value = value;
14511
+ // src/mock-doc/document.ts
14512
+ var MockDocument = class _MockDocument extends MockHTMLElement {
14513
+ constructor(html = null, win2 = null) {
14514
+ super(null, null);
14515
+ this.nodeName = "#document" /* DOCUMENT_NODE */;
14516
+ this.nodeType = 9 /* DOCUMENT_NODE */;
14517
+ this.defaultView = win2;
14518
+ this.cookie = "";
14519
+ this.referrer = "";
14520
+ this.appendChild(this.createDocumentTypeNode());
14521
+ if (typeof html === "string") {
14522
+ const parsedDoc = parseDocumentUtil(this, html);
14523
+ const documentElement = parsedDoc.children.find((elm) => elm.nodeName === "HTML");
14524
+ if (documentElement != null) {
14525
+ this.appendChild(documentElement);
14526
+ setOwnerDocument(documentElement, this);
14527
+ }
14528
+ } else if (html !== false) {
14529
+ const documentElement = new MockHTMLElement(this, "html");
14530
+ this.appendChild(documentElement);
14531
+ documentElement.appendChild(new MockHTMLElement(this, "head"));
14532
+ documentElement.appendChild(new MockHTMLElement(this, "body"));
14244
14533
  }
14245
14534
  }
14246
- /**
14247
- * Creates a new LocalValue object with a string value.
14248
- *
14249
- * @param {string} value - The string value to be stored in the LocalValue object.
14250
- * @returns {LocalValue} - The created LocalValue object.
14251
- */
14252
- static createStringValue(value) {
14253
- return new _LocalValue("string" /* String */, value);
14535
+ get dir() {
14536
+ return this.documentElement.dir;
14254
14537
  }
14255
- /**
14256
- * Creates a new LocalValue object with a number value.
14257
- *
14258
- * @param {number} value - The number value.
14259
- * @returns {LocalValue} - The created LocalValue object.
14260
- */
14261
- static createNumberValue(value) {
14262
- return new _LocalValue("number" /* Number */, value);
14538
+ set dir(value) {
14539
+ this.documentElement.dir = value;
14263
14540
  }
14264
- /**
14265
- * Creates a new LocalValue object with a special number value.
14266
- *
14267
- * @param {number} value - The value of the special number.
14268
- * @returns {LocalValue} - The created LocalValue object.
14269
- */
14270
- static createSpecialNumberValue(value) {
14271
- if (Number.isNaN(value)) {
14272
- return new _LocalValue("number" /* SpecialNumber */, "NaN");
14273
- }
14274
- if (Object.is(value, -0)) {
14275
- return new _LocalValue("number" /* SpecialNumber */, "-0");
14541
+ get localName() {
14542
+ throw new Error("Unimplemented");
14543
+ }
14544
+ get location() {
14545
+ if (this.defaultView != null) {
14546
+ return this.defaultView.location;
14276
14547
  }
14277
- if (value === Infinity) {
14278
- return new _LocalValue("number" /* SpecialNumber */, "Infinity");
14548
+ return null;
14549
+ }
14550
+ set location(val) {
14551
+ if (this.defaultView != null) {
14552
+ this.defaultView.location.href = val;
14279
14553
  }
14280
- if (value === -Infinity) {
14281
- return new _LocalValue("number" /* SpecialNumber */, "-Infinity");
14554
+ }
14555
+ get baseURI() {
14556
+ const baseNode = this.head.childNodes.find((node) => node.nodeName === "BASE");
14557
+ if (baseNode) {
14558
+ return baseNode.href;
14282
14559
  }
14283
- return new _LocalValue("number" /* SpecialNumber */, value);
14560
+ return this.URL;
14284
14561
  }
14285
- /**
14286
- * Creates a new LocalValue object with an undefined value.
14287
- * @returns {LocalValue} - The created LocalValue object.
14288
- */
14289
- static createUndefinedValue() {
14290
- return new _LocalValue("undefined" /* Undefined */);
14562
+ get URL() {
14563
+ return this.location.href;
14291
14564
  }
14292
- /**
14293
- * Creates a new LocalValue object with a null value.
14294
- * @returns {LocalValue} - The created LocalValue object.
14295
- */
14296
- static createNullValue() {
14297
- return new _LocalValue("null" /* Null */);
14565
+ get styleSheets() {
14566
+ return this.querySelectorAll("style");
14298
14567
  }
14299
- /**
14300
- * Creates a new LocalValue object with a boolean value.
14301
- *
14302
- * @param {boolean} value - The boolean value.
14303
- * @returns {LocalValue} - The created LocalValue object.
14304
- */
14305
- static createBooleanValue(value) {
14306
- return new _LocalValue("boolean" /* Boolean */, value);
14568
+ get scripts() {
14569
+ return this.querySelectorAll("script");
14307
14570
  }
14308
- /**
14309
- * Creates a new LocalValue object with a BigInt value.
14310
- *
14311
- * @param {BigInt} value - The BigInt value.
14312
- * @returns {LocalValue} - The created LocalValue object.
14313
- */
14314
- static createBigIntValue(value) {
14315
- return new _LocalValue("bigint" /* BigInt */, value.toString());
14571
+ get forms() {
14572
+ return this.querySelectorAll("form");
14316
14573
  }
14317
- /**
14318
- * Creates a new LocalValue object with an array.
14319
- *
14320
- * @param {Array} value - The array.
14321
- * @returns {LocalValue} - The created LocalValue object.
14322
- */
14323
- static createArrayValue(value) {
14324
- return new _LocalValue("array" /* Array */, value);
14574
+ get images() {
14575
+ return this.querySelectorAll("img");
14325
14576
  }
14326
- /**
14327
- * Creates a new LocalValue object with date value.
14328
- *
14329
- * @param {string} value - The date.
14330
- * @returns {LocalValue} - The created LocalValue object.
14331
- */
14332
- static createDateValue(value) {
14333
- return new _LocalValue("date" /* Date */, value);
14577
+ get scrollingElement() {
14578
+ return this.documentElement;
14334
14579
  }
14335
- /**
14336
- * Creates a new LocalValue object of map value.
14337
- * @param {Map} map - The map.
14338
- * @returns {LocalValue} - The created LocalValue object.
14339
- */
14340
- static createMapValue(map2) {
14341
- const value = [];
14342
- Array.from(map2.entries()).forEach(([key, val]) => {
14343
- value.push([_LocalValue.getArgument(key), _LocalValue.getArgument(val)]);
14344
- });
14345
- return new _LocalValue("map" /* Map */, value);
14580
+ get documentElement() {
14581
+ for (let i = this.childNodes.length - 1; i >= 0; i--) {
14582
+ if (this.childNodes[i].nodeName === "HTML") {
14583
+ return this.childNodes[i];
14584
+ }
14585
+ }
14586
+ const documentElement = new MockHTMLElement(this, "html");
14587
+ this.appendChild(documentElement);
14588
+ return documentElement;
14346
14589
  }
14347
- /**
14348
- * Creates a new LocalValue object from the passed object.
14349
- *
14350
- * @param object the object to create a LocalValue from
14351
- * @returns {LocalValue} - The created LocalValue object.
14352
- */
14353
- static createObjectValue(object) {
14354
- const value = [];
14355
- Object.entries(object).forEach(([key, val]) => {
14356
- value.push([key, _LocalValue.getArgument(val)]);
14357
- });
14358
- return new _LocalValue("object" /* Object */, value);
14590
+ set documentElement(documentElement) {
14591
+ for (let i = this.childNodes.length - 1; i >= 0; i--) {
14592
+ if (this.childNodes[i].nodeType !== 10 /* DOCUMENT_TYPE_NODE */) {
14593
+ this.childNodes[i].remove();
14594
+ }
14595
+ }
14596
+ if (documentElement != null) {
14597
+ this.appendChild(documentElement);
14598
+ setOwnerDocument(documentElement, this);
14599
+ }
14359
14600
  }
14360
- /**
14361
- * Creates a new LocalValue object of regular expression value.
14362
- *
14363
- * @param {string} value - The value of the regular expression.
14364
- * @returns {LocalValue} - The created LocalValue object.
14365
- */
14366
- static createRegularExpressionValue(value) {
14367
- return new _LocalValue("regexp" /* RegularExpression */, value);
14601
+ get head() {
14602
+ const documentElement = this.documentElement;
14603
+ for (let i = 0; i < documentElement.childNodes.length; i++) {
14604
+ if (documentElement.childNodes[i].nodeName === "HEAD") {
14605
+ return documentElement.childNodes[i];
14606
+ }
14607
+ }
14608
+ const head = new MockHTMLElement(this, "head");
14609
+ documentElement.insertBefore(head, documentElement.firstChild);
14610
+ return head;
14611
+ }
14612
+ set head(head) {
14613
+ const documentElement = this.documentElement;
14614
+ for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
14615
+ if (documentElement.childNodes[i].nodeName === "HEAD") {
14616
+ documentElement.childNodes[i].remove();
14617
+ }
14618
+ }
14619
+ if (head != null) {
14620
+ documentElement.insertBefore(head, documentElement.firstChild);
14621
+ setOwnerDocument(head, this);
14622
+ }
14623
+ }
14624
+ get body() {
14625
+ const documentElement = this.documentElement;
14626
+ for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
14627
+ if (documentElement.childNodes[i].nodeName === "BODY") {
14628
+ return documentElement.childNodes[i];
14629
+ }
14630
+ }
14631
+ const body = new MockHTMLElement(this, "body");
14632
+ documentElement.appendChild(body);
14633
+ return body;
14634
+ }
14635
+ set body(body) {
14636
+ const documentElement = this.documentElement;
14637
+ for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
14638
+ if (documentElement.childNodes[i].nodeName === "BODY") {
14639
+ documentElement.childNodes[i].remove();
14640
+ }
14641
+ }
14642
+ if (body != null) {
14643
+ documentElement.appendChild(body);
14644
+ setOwnerDocument(body, this);
14645
+ }
14646
+ }
14647
+ appendChild(newNode) {
14648
+ newNode.remove();
14649
+ newNode.parentNode = this;
14650
+ this.childNodes.push(newNode);
14651
+ return newNode;
14368
14652
  }
14369
- /**
14370
- * Creates a new LocalValue object with the specified value.
14371
- * @param {Set} value - The value to be set.
14372
- * @returns {LocalValue} - The created LocalValue object.
14373
- */
14374
- static createSetValue(value) {
14375
- return new _LocalValue("set" /* Set */, value);
14653
+ createComment(data) {
14654
+ return new MockComment(this, data);
14376
14655
  }
14377
- /**
14378
- * Creates a new LocalValue object with the given channel value
14379
- *
14380
- * @param {ChannelValue} value - The channel value.
14381
- * @returns {LocalValue} - The created LocalValue object.
14382
- */
14383
- static createChannelValue(value) {
14384
- return new _LocalValue("channel" /* Channel */, value);
14656
+ createAttribute(attrName) {
14657
+ return new MockAttr(attrName.toLowerCase(), "");
14385
14658
  }
14386
- /**
14387
- * Creates a new LocalValue object with a Symbol value.
14388
- *
14389
- * @param {Symbol} symbol - The Symbol value
14390
- * @returns {LocalValue} - The created LocalValue object
14391
- */
14392
- static createSymbolValue(symbol) {
14393
- const description = symbol.description || "Symbol()";
14394
- return new _LocalValue("symbol" /* Symbol */, description);
14659
+ createAttributeNS(namespaceURI, attrName) {
14660
+ return new MockAttr(attrName, "", namespaceURI);
14395
14661
  }
14396
- static getArgument(argument) {
14397
- const type = typeof argument;
14398
- switch (type) {
14399
- case "string" /* String */:
14400
- return _LocalValue.createStringValue(argument);
14401
- case "number" /* Number */:
14402
- if (Number.isNaN(argument) || Object.is(argument, -0) || !Number.isFinite(argument)) {
14403
- return _LocalValue.createSpecialNumberValue(argument);
14404
- }
14405
- return _LocalValue.createNumberValue(argument);
14406
- case "boolean" /* Boolean */:
14407
- return _LocalValue.createBooleanValue(argument);
14408
- case "bigint" /* BigInt */:
14409
- return _LocalValue.createBigIntValue(argument);
14410
- case "undefined" /* Undefined */:
14411
- return _LocalValue.createUndefinedValue();
14412
- case "symbol" /* Symbol */:
14413
- return _LocalValue.createSymbolValue(argument);
14414
- case "object" /* Object */:
14415
- if (argument === null) {
14416
- return _LocalValue.createNullValue();
14417
- }
14418
- if (argument instanceof Date) {
14419
- return _LocalValue.createDateValue(argument);
14420
- }
14421
- if (argument instanceof Map) {
14422
- const map2 = [];
14423
- argument.forEach((value, key) => {
14424
- const objectKey = typeof key === "string" ? key : _LocalValue.getArgument(key);
14425
- const objectValue = _LocalValue.getArgument(value);
14426
- map2.push([objectKey, objectValue]);
14427
- });
14428
- return _LocalValue.createMapValue(argument);
14429
- }
14430
- if (argument instanceof Set) {
14431
- const set = [];
14432
- argument.forEach((value) => {
14433
- set.push(_LocalValue.getArgument(value));
14434
- });
14435
- return _LocalValue.createSetValue(set);
14436
- }
14437
- if (argument instanceof Array) {
14438
- const arr = [];
14439
- argument.forEach((value) => {
14440
- arr.push(_LocalValue.getArgument(value));
14441
- });
14442
- return _LocalValue.createArrayValue(arr);
14443
- }
14444
- if (argument instanceof RegExp) {
14445
- return _LocalValue.createRegularExpressionValue({
14446
- pattern: argument.source,
14447
- flags: argument.flags
14448
- });
14449
- }
14450
- return _LocalValue.createObjectValue(argument);
14662
+ createElement(tagName) {
14663
+ if (tagName === "#document" /* DOCUMENT_NODE */) {
14664
+ const doc = new _MockDocument(false);
14665
+ doc.nodeName = tagName;
14666
+ doc.parentNode = null;
14667
+ return doc;
14451
14668
  }
14452
- throw new Error(`Unsupported type: ${type}`);
14669
+ return createElement(this, tagName);
14453
14670
  }
14454
- asMap() {
14455
- return {
14456
- [TYPE_CONSTANT]: this.type,
14457
- ...!(this.type === "null" /* Null */ || this.type === "undefined" /* Undefined */) ? { [VALUE_CONSTANT]: this.value } : {}
14458
- };
14671
+ createElementNS(namespaceURI, tagName) {
14672
+ const elmNs = createElementNS(this, namespaceURI, tagName);
14673
+ return elmNs;
14459
14674
  }
14460
- };
14461
-
14462
- // src/utils/message-utils.ts
14463
- var catchError = (diagnostics, err2, msg) => {
14464
- const diagnostic = {
14465
- level: "error",
14466
- type: "build",
14467
- header: "Build Error",
14468
- messageText: "build error",
14469
- lines: []
14470
- };
14471
- if (isString(msg)) {
14472
- diagnostic.messageText = msg.length ? msg : "UNKNOWN ERROR";
14473
- } else if (err2 != null) {
14474
- if (err2.stack != null) {
14475
- diagnostic.messageText = err2.stack.toString();
14476
- } else {
14477
- if (err2.message != null) {
14478
- diagnostic.messageText = err2.message.length ? err2.message : "UNKNOWN ERROR";
14479
- } else {
14480
- diagnostic.messageText = err2.toString();
14481
- }
14482
- }
14675
+ createTextNode(text) {
14676
+ return new MockTextNode(this, text);
14483
14677
  }
14484
- if (diagnostics != null && !shouldIgnoreError(diagnostic.messageText)) {
14485
- diagnostics.push(diagnostic);
14678
+ createDocumentFragment() {
14679
+ return new MockDocumentFragment(this);
14486
14680
  }
14487
- return diagnostic;
14488
- };
14489
- var hasError = (diagnostics) => {
14490
- if (diagnostics == null || diagnostics.length === 0) {
14491
- return false;
14681
+ createDocumentTypeNode() {
14682
+ return new MockDocumentTypeNode(this);
14492
14683
  }
14493
- return diagnostics.some((d) => d.level === "error" && d.type !== "runtime");
14494
- };
14495
- var shouldIgnoreError = (msg) => {
14496
- return msg === TASK_CANCELED_MSG;
14497
- };
14498
- var TASK_CANCELED_MSG = `task canceled`;
14499
-
14500
- // src/utils/regular-expression.ts
14501
- var escapeRegExpSpecialCharacters = (text) => {
14502
- return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
14503
- };
14504
-
14505
- // src/utils/remote-value.ts
14506
- var RemoteValue = class _RemoteValue {
14507
- /**
14508
- * Deserializes a LocalValue serialized object back to its original JavaScript representation
14509
- *
14510
- * @param serialized The serialized LocalValue object
14511
- * @returns The original JavaScript value/object
14512
- */
14513
- static fromLocalValue(serialized) {
14514
- const type = serialized[TYPE_CONSTANT];
14515
- const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
14516
- switch (type) {
14517
- case "string" /* String */:
14518
- return value;
14519
- case "boolean" /* Boolean */:
14520
- return value;
14521
- case "bigint" /* BigInt */:
14522
- return BigInt(value);
14523
- case "undefined" /* Undefined */:
14524
- return void 0;
14525
- case "null" /* Null */:
14526
- return null;
14527
- case "number" /* Number */:
14528
- if (value === "NaN") return NaN;
14529
- if (value === "-0") return -0;
14530
- if (value === "Infinity") return Infinity;
14531
- if (value === "-Infinity") return -Infinity;
14532
- return value;
14533
- case "array" /* Array */:
14534
- return value.map((item) => _RemoteValue.fromLocalValue(item));
14535
- case "date" /* Date */:
14536
- return new Date(value);
14537
- case "map" /* Map */:
14538
- const map2 = /* @__PURE__ */ new Map();
14539
- for (const [key, val] of value) {
14540
- const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
14541
- const deserializedValue = _RemoteValue.fromLocalValue(val);
14542
- map2.set(deserializedKey, deserializedValue);
14543
- }
14544
- return map2;
14545
- case "object" /* Object */:
14546
- const obj = {};
14547
- for (const [key, val] of value) {
14548
- obj[key] = _RemoteValue.fromLocalValue(val);
14549
- }
14550
- return obj;
14551
- case "regexp" /* RegularExpression */:
14552
- const { pattern, flags } = value;
14553
- return new RegExp(pattern, flags);
14554
- case "set" /* Set */:
14555
- const set = /* @__PURE__ */ new Set();
14556
- for (const item of value) {
14557
- set.add(_RemoteValue.fromLocalValue(item));
14558
- }
14559
- return set;
14560
- case "symbol" /* Symbol */:
14561
- return Symbol(value);
14562
- default:
14563
- throw new Error(`Unsupported type: ${type}`);
14684
+ getElementById(id) {
14685
+ return getElementById(this, id);
14686
+ }
14687
+ getElementsByName(elmName) {
14688
+ return getElementsByName(this, elmName.toLowerCase());
14689
+ }
14690
+ get title() {
14691
+ const title = this.head.childNodes.find((elm) => elm.nodeName === "TITLE");
14692
+ if (title != null && typeof title.textContent === "string") {
14693
+ return title.textContent.trim();
14564
14694
  }
14695
+ return "";
14565
14696
  }
14566
- /**
14567
- * Utility method to deserialize multiple LocalValues at once
14568
- *
14569
- * @param serializedValues Array of serialized LocalValue objects
14570
- * @returns Array of deserialized JavaScript values
14571
- */
14572
- static fromLocalValueArray(serializedValues) {
14573
- return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
14697
+ set title(value) {
14698
+ const head = this.head;
14699
+ let title = head.childNodes.find((elm) => elm.nodeName === "TITLE");
14700
+ if (title == null) {
14701
+ title = this.createElement("title");
14702
+ head.appendChild(title);
14703
+ }
14704
+ title.textContent = value;
14574
14705
  }
14575
- /**
14576
- * Verifies if the given object matches the structure of a serialized LocalValue
14577
- *
14578
- * @param obj Object to verify
14579
- * @returns boolean indicating if the object has LocalValue structure
14580
- */
14581
- static isLocalValueObject(obj) {
14582
- if (typeof obj !== "object" || obj === null) {
14583
- return false;
14706
+ };
14707
+ function resetDocument(doc) {
14708
+ if (doc != null) {
14709
+ resetEventListeners(doc);
14710
+ const documentElement = doc.documentElement;
14711
+ if (documentElement != null) {
14712
+ resetElement(documentElement);
14713
+ for (let i = 0, ii = documentElement.childNodes.length; i < ii; i++) {
14714
+ const childNode = documentElement.childNodes[i];
14715
+ resetElement(childNode);
14716
+ childNode.childNodes.length = 0;
14717
+ }
14584
14718
  }
14585
- if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
14586
- return false;
14719
+ for (const key in doc) {
14720
+ if (doc.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
14721
+ delete doc[key];
14722
+ }
14587
14723
  }
14588
- const type = obj[TYPE_CONSTANT];
14589
- const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
14590
- if (!hasTypeProperty) {
14591
- return false;
14724
+ try {
14725
+ doc.nodeName = "#document" /* DOCUMENT_NODE */;
14726
+ } catch (e) {
14592
14727
  }
14593
- if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
14594
- return obj.hasOwnProperty(VALUE_CONSTANT);
14728
+ try {
14729
+ doc.nodeType = 9 /* DOCUMENT_NODE */;
14730
+ } catch (e) {
14595
14731
  }
14596
- return true;
14597
- }
14598
- };
14599
-
14600
- // src/utils/result.ts
14601
- var result_exports = {};
14602
- __export(result_exports, {
14603
- err: () => err,
14604
- map: () => map,
14605
- ok: () => ok,
14606
- unwrap: () => unwrap,
14607
- unwrapErr: () => unwrapErr
14608
- });
14609
- var ok = (value) => ({
14610
- isOk: true,
14611
- isErr: false,
14612
- value
14613
- });
14614
- var err = (value) => ({
14615
- isOk: false,
14616
- isErr: true,
14617
- value
14618
- });
14619
- function map(result, fn) {
14620
- if (result.isOk) {
14621
- const val = fn(result.value);
14622
- if (val instanceof Promise) {
14623
- return val.then((newVal) => ok(newVal));
14624
- } else {
14625
- return ok(val);
14732
+ try {
14733
+ doc.cookie = "";
14734
+ } catch (e) {
14735
+ }
14736
+ try {
14737
+ doc.referrer = "";
14738
+ } catch (e) {
14626
14739
  }
14627
14740
  }
14628
- if (result.isErr) {
14629
- const value = result.value;
14630
- return err(value);
14631
- }
14632
- throw "should never get here";
14633
14741
  }
14634
- var unwrap = (result) => {
14635
- if (result.isOk) {
14636
- return result.value;
14637
- } else {
14638
- throw result.value;
14639
- }
14640
- };
14641
- var unwrapErr = (result) => {
14642
- if (result.isErr) {
14643
- return result.value;
14644
- } else {
14645
- throw result.value;
14742
+ var DOC_KEY_KEEPERS = /* @__PURE__ */ new Set([
14743
+ "nodeName",
14744
+ "nodeType",
14745
+ "nodeValue",
14746
+ "ownerDocument",
14747
+ "parentNode",
14748
+ "childNodes",
14749
+ "_shadowRoot"
14750
+ ]);
14751
+ function getElementById(elm, id) {
14752
+ const children = elm.children;
14753
+ for (let i = 0, ii = children.length; i < ii; i++) {
14754
+ const childElm = children[i];
14755
+ if (childElm.id === id) {
14756
+ return childElm;
14757
+ }
14758
+ const childElmFound = getElementById(childElm, id);
14759
+ if (childElmFound != null) {
14760
+ return childElmFound;
14761
+ }
14646
14762
  }
14647
- };
14648
-
14649
- // src/utils/serialize.ts
14650
- function serializeProperty(value) {
14651
- if (["string", "boolean", "undefined"].includes(typeof value) || typeof value === "number" && value !== Infinity && value !== -Infinity && !isNaN(value)) {
14652
- return value;
14763
+ return null;
14764
+ }
14765
+ function getElementsByName(elm, elmName, foundElms = []) {
14766
+ const children = elm.children;
14767
+ for (let i = 0, ii = children.length; i < ii; i++) {
14768
+ const childElm = children[i];
14769
+ if (childElm.name && childElm.name.toLowerCase() === elmName) {
14770
+ foundElms.push(childElm);
14771
+ }
14772
+ getElementsByName(childElm, elmName, foundElms);
14653
14773
  }
14654
- const arg = LocalValue.getArgument(value);
14655
- return SERIALIZED_PREFIX + btoa(JSON.stringify(arg));
14774
+ return foundElms;
14656
14775
  }
14657
- function deserializeProperty(value) {
14658
- if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
14659
- return value;
14776
+ function setOwnerDocument(elm, ownerDocument) {
14777
+ for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
14778
+ elm.childNodes[i].ownerDocument = ownerDocument;
14779
+ if (elm.childNodes[i].nodeType === 1 /* ELEMENT_NODE */) {
14780
+ setOwnerDocument(elm.childNodes[i], ownerDocument);
14781
+ }
14660
14782
  }
14661
- return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
14662
14783
  }
14663
14784
 
14664
- // src/utils/shadow-root.ts
14665
- import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
14666
-
14667
- // src/utils/util.ts
14668
- var lowerPathParam = (fn) => (p) => fn(p.toLowerCase());
14669
- var isDtsFile = lowerPathParam((p) => p.endsWith(".d.ts") || p.endsWith(".d.mts") || p.endsWith(".d.cts"));
14670
- var isTsFile = lowerPathParam(
14671
- (p) => !isDtsFile(p) && (p.endsWith(".ts") || p.endsWith(".mts") || p.endsWith(".cts"))
14672
- );
14673
- var isTsxFile = lowerPathParam(
14674
- (p) => p.endsWith(".tsx") || p.endsWith(".mtsx") || p.endsWith(".ctsx")
14675
- );
14676
- var isJsxFile = lowerPathParam(
14677
- (p) => p.endsWith(".jsx") || p.endsWith(".mjsx") || p.endsWith(".cjsx")
14678
- );
14679
- var isJsFile = lowerPathParam((p) => p.endsWith(".js") || p.endsWith(".mjs") || p.endsWith(".cjs"));
14680
-
14681
- // src/runtime/connected-callback.ts
14682
- import { BUILD as BUILD25 } from "@stencil/core/internal/app-data";
14683
-
14684
- // src/runtime/client-hydrate.ts
14685
- import { BUILD as BUILD14 } from "@stencil/core/internal/app-data";
14686
-
14687
- // src/runtime/dom-extras.ts
14688
- import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
14689
-
14690
- // src/runtime/slot-polyfill-utils.ts
14691
- import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
14692
-
14693
- // src/runtime/profile.ts
14694
- import { BUILD as BUILD11 } from "@stencil/core/internal/app-data";
14695
-
14696
- // src/runtime/styles.ts
14697
- import { BUILD as BUILD12 } from "@stencil/core/internal/app-data";
14698
-
14699
- // src/runtime/vdom/h.ts
14700
- import { BUILD as BUILD13 } from "@stencil/core/internal/app-data";
14701
-
14702
- // src/runtime/initialize-component.ts
14703
- import { BUILD as BUILD24 } from "@stencil/core/internal/app-data";
14704
-
14705
- // src/utils/shadow-css.ts
14706
- /**
14707
- * @license
14708
- * Copyright Google Inc. All Rights Reserved.
14709
- *
14710
- * Use of this source code is governed by an MIT-style license that can be
14711
- * found in the LICENSE file at https://angular.io/license
14712
- *
14713
- * This file is a port of shadowCSS from `webcomponents.js` to TypeScript.
14714
- * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
14715
- * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
14716
- */
14717
- var _polyfillHost = "-shadowcsshost";
14718
- var _polyfillSlotted = "-shadowcssslotted";
14719
- var _polyfillHostContext = "-shadowcsscontext";
14720
- var _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
14721
- var _cssColonHostRe = new RegExp("(" + _polyfillHost + _parenSuffix, "gim");
14722
- var _cssColonHostContextRe = new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim");
14723
- var _cssColonSlottedRe = new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim");
14724
- var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
14725
- var createSupportsRuleRe = (selector) => {
14726
- const safeSelector = escapeRegExpSpecialCharacters(selector);
14727
- return new RegExp(
14728
- // First capture group: match any context before the selector that's not inside @supports selector()
14729
- // Using negative lookahead to avoid matching inside @supports selector(...) condition
14730
- `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector}))(${safeSelector}\\b)`,
14731
- "g"
14732
- );
14733
- };
14734
- var _colonSlottedRe = createSupportsRuleRe("::slotted");
14735
- var _colonHostRe = createSupportsRuleRe(":host");
14736
- var _colonHostContextRe = createSupportsRuleRe(":host-context");
14737
-
14738
- // src/runtime/mode.ts
14739
- var setMode = (handler) => modeResolutionChain.push(handler);
14740
-
14741
- // src/runtime/proxy-component.ts
14742
- import { BUILD as BUILD23 } from "@stencil/core/internal/app-data";
14743
-
14744
- // src/runtime/set-value.ts
14745
- import { BUILD as BUILD22 } from "@stencil/core/internal/app-data";
14746
-
14747
- // src/runtime/parse-property-value.ts
14748
- import { BUILD as BUILD15 } from "@stencil/core/internal/app-data";
14749
-
14750
- // src/runtime/update-component.ts
14751
- import { BUILD as BUILD21, NAMESPACE } from "@stencil/core/internal/app-data";
14752
-
14753
- // src/runtime/event-emitter.ts
14754
- import { BUILD as BUILD17 } from "@stencil/core/internal/app-data";
14755
-
14756
- // src/runtime/element.ts
14757
- import { BUILD as BUILD16 } from "@stencil/core/internal/app-data";
14758
-
14759
- // src/runtime/vdom/vdom-render.ts
14760
- import { BUILD as BUILD20 } from "@stencil/core/internal/app-data";
14761
-
14762
- // src/runtime/vdom/update-element.ts
14763
- import { BUILD as BUILD19 } from "@stencil/core/internal/app-data";
14764
-
14765
- // src/runtime/vdom/set-accessor.ts
14766
- import { BUILD as BUILD18 } from "@stencil/core/internal/app-data";
14767
- var CAPTURE_EVENT_SUFFIX = "Capture";
14768
- var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
14769
-
14770
- // src/runtime/disconnected-callback.ts
14771
- import { BUILD as BUILD26 } from "@stencil/core/internal/app-data";
14772
-
14773
- // src/runtime/bootstrap-lazy.ts
14774
- import { BUILD as BUILD28 } from "@stencil/core/internal/app-data";
14775
-
14776
- // src/runtime/host-listener.ts
14777
- import { BUILD as BUILD29 } from "@stencil/core/internal/app-data";
14785
+ // src/hydrate/runner/create-window.ts
14786
+ var templateWindows = /* @__PURE__ */ new Map();
14787
+ function createWindowFromHtml(templateHtml, uniqueId) {
14788
+ let templateWindow = templateWindows.get(uniqueId);
14789
+ if (templateWindow == null) {
14790
+ templateWindow = new MockWindow(templateHtml);
14791
+ templateWindows.set(uniqueId, templateWindow);
14792
+ }
14793
+ const win2 = cloneWindow(templateWindow);
14794
+ return win2;
14795
+ }
14778
14796
 
14779
- // src/runtime/mixin.ts
14780
- import { BUILD as BUILD30 } from "@stencil/core/internal/app-data";
14781
- var baseClass = BUILD30.lazyLoad ? class {
14782
- } : globalThis.HTMLElement || class {
14783
- };
14797
+ // src/hydrate/runner/render.ts
14798
+ import { Readable } from "stream";
14799
+ import { hydrateFactory } from "@stencil/core/hydrate-factory";
14784
14800
 
14785
14801
  // src/compiler/html/canonical-link.ts
14786
14802
  var updateCanonicalLink = (doc, href) => {
@@ -16162,6 +16178,15 @@ function removeScripts(elm) {
16162
16178
  }
16163
16179
  }
16164
16180
  }
16181
+
16182
+ // src/hydrate/runner/index.ts
16183
+ var everywhere;
16184
+ try {
16185
+ everywhere = global || globalThis;
16186
+ } catch (e) {
16187
+ everywhere = window || globalThis;
16188
+ }
16189
+ everywhere.tagTransform = transformTag;
16165
16190
  export {
16166
16191
  createWindowFromHtml,
16167
16192
  deserializeProperty,
@@ -16169,5 +16194,7 @@ export {
16169
16194
  renderToString,
16170
16195
  serializeDocumentToString,
16171
16196
  serializeProperty,
16172
- streamToString
16197
+ setTagTransformer,
16198
+ streamToString,
16199
+ transformTag
16173
16200
  };