@searchcraft/javascript-sdk 0.13.1 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/components/{p-D0j0UFpV.js → CoreInstanceRegistry.js} +2 -2
  2. package/dist/components/CoreInstanceRegistry.js.map +1 -0
  3. package/dist/components/defineCustomElements.js +23 -23
  4. package/dist/components/{p-_aHgRsRD.js → html.js} +3 -3
  5. package/dist/components/html.js.map +1 -0
  6. package/dist/components/index.js +28 -28
  7. package/dist/components/{p-DO5g2x-l.js → index2.js} +11 -5
  8. package/dist/components/index2.js.map +1 -0
  9. package/dist/components/{p-BfTCfPZ1.js → index3.js} +2 -2
  10. package/dist/components/index3.js.map +1 -0
  11. package/dist/components/{p-BlYgaV0q.js → purify.es.js} +10 -4
  12. package/dist/components/purify.es.js.map +1 -0
  13. package/dist/components/searchcraft-ad.js +1 -1
  14. package/dist/components/{p-C1S92_N8.js → searchcraft-ad2.js} +8 -8
  15. package/dist/components/searchcraft-ad2.js.map +1 -0
  16. package/dist/components/searchcraft-button.js +1 -1
  17. package/dist/components/{p-C681KruS.js → searchcraft-button2.js} +6 -6
  18. package/dist/components/searchcraft-button2.js.map +1 -0
  19. package/dist/components/searchcraft-error-message.js +1 -1
  20. package/dist/components/{p-DjPZkCLP.js → searchcraft-error-message2.js} +5 -5
  21. package/dist/components/searchcraft-error-message2.js.map +1 -0
  22. package/dist/components/searchcraft-facet-list.js +1 -1
  23. package/dist/components/{p-BV4HUriZ.js → searchcraft-facet-list2.js} +7 -7
  24. package/dist/components/searchcraft-facet-list2.js.map +1 -0
  25. package/dist/components/searchcraft-filter-panel.js +10 -10
  26. package/dist/components/searchcraft-input-form.js +1 -1
  27. package/dist/components/{p-C-wcIch1.js → searchcraft-input-form2.js} +13 -13
  28. package/dist/components/searchcraft-input-form2.js.map +1 -0
  29. package/dist/components/searchcraft-input-label.js +1 -1
  30. package/dist/components/{p-L4PwHqQC.js → searchcraft-input-label2.js} +6 -6
  31. package/dist/components/searchcraft-input-label2.js.map +1 -0
  32. package/dist/components/searchcraft-loading.js +1 -1
  33. package/dist/components/{p-B_415D4A.js → searchcraft-loading2.js} +5 -5
  34. package/dist/components/searchcraft-loading2.js.map +1 -0
  35. package/dist/components/searchcraft-pagination.js +7 -7
  36. package/dist/components/searchcraft-popover-button.js +5 -5
  37. package/dist/components/searchcraft-popover-footer.js +1 -1
  38. package/dist/components/{p-C7ZK8CYu.js → searchcraft-popover-footer2.js} +8 -8
  39. package/dist/components/searchcraft-popover-footer2.js.map +1 -0
  40. package/dist/components/searchcraft-popover-form.js +22 -22
  41. package/dist/components/searchcraft-popover-list-item.js +1 -1
  42. package/dist/components/{p-Cju73I1E.js → searchcraft-popover-list-item2.js} +8 -8
  43. package/dist/components/searchcraft-popover-list-item2.js.map +1 -0
  44. package/dist/components/searchcraft-popover-list-view.js +1 -1
  45. package/dist/components/{p-Dr9rPC9v.js → searchcraft-popover-list-view2.js} +10 -10
  46. package/dist/components/searchcraft-popover-list-view2.js.map +1 -0
  47. package/dist/components/searchcraft-results-info.js +6 -6
  48. package/dist/components/searchcraft-search-result.js +1 -1
  49. package/dist/components/{p-DotXR-Gz.js → searchcraft-search-result2.js} +7 -7
  50. package/dist/components/searchcraft-search-result2.js.map +1 -0
  51. package/dist/components/searchcraft-search-results-per-page.js +6 -6
  52. package/dist/components/searchcraft-search-results.js +10 -10
  53. package/dist/components/searchcraft-select.js +1 -1
  54. package/dist/components/{p-Dc7S4y3b.js → searchcraft-select2.js} +5 -5
  55. package/dist/components/searchcraft-select2.js.map +1 -0
  56. package/dist/components/searchcraft-slider.js +1 -1
  57. package/dist/components/{p-BbSxfaD7.js → searchcraft-slider2.js} +8 -8
  58. package/dist/components/searchcraft-slider2.js.map +1 -0
  59. package/dist/components/searchcraft-summary-box.js +7 -7
  60. package/dist/components/searchcraft-theme.js +3 -3
  61. package/dist/components/searchcraft-toggle-button.js +1 -1
  62. package/dist/components/{p-D5p2scT9.js → searchcraft-toggle-button2.js} +7 -7
  63. package/dist/components/searchcraft-toggle-button2.js.map +1 -0
  64. package/dist/components/{p-i8oXh7db.js → units.js} +2 -2
  65. package/dist/components/units.js.map +1 -0
  66. package/dist/hydrate/index.d.ts +12 -0
  67. package/dist/hydrate/index.js +1186 -1136
  68. package/dist/hydrate/index.mjs +1185 -1137
  69. package/dist/types/stencil-public-runtime.d.ts +43 -0
  70. package/package.json +3 -3
  71. package/dist/components/p-BV4HUriZ.js.map +0 -1
  72. package/dist/components/p-B_415D4A.js.map +0 -1
  73. package/dist/components/p-BbSxfaD7.js.map +0 -1
  74. package/dist/components/p-BfTCfPZ1.js.map +0 -1
  75. package/dist/components/p-BlYgaV0q.js.map +0 -1
  76. package/dist/components/p-C-wcIch1.js.map +0 -1
  77. package/dist/components/p-C1S92_N8.js.map +0 -1
  78. package/dist/components/p-C681KruS.js.map +0 -1
  79. package/dist/components/p-C7ZK8CYu.js.map +0 -1
  80. package/dist/components/p-Cju73I1E.js.map +0 -1
  81. package/dist/components/p-D0j0UFpV.js.map +0 -1
  82. package/dist/components/p-D5p2scT9.js.map +0 -1
  83. package/dist/components/p-DO5g2x-l.js.map +0 -1
  84. package/dist/components/p-Dc7S4y3b.js.map +0 -1
  85. package/dist/components/p-DjPZkCLP.js.map +0 -1
  86. package/dist/components/p-DotXR-Gz.js.map +0 -1
  87. package/dist/components/p-Dr9rPC9v.js.map +0 -1
  88. package/dist/components/p-L4PwHqQC.js.map +0 -1
  89. package/dist/components/p-_aHgRsRD.js.map +0 -1
  90. package/dist/components/p-i8oXh7db.js.map +0 -1
@@ -1,8 +1,99 @@
1
1
  import { Readable } from 'stream';
2
2
 
3
+ // src/app-data/index.ts
4
+ var BUILD = {
5
+ allRenderFn: false,
6
+ element: true,
7
+ event: true,
8
+ hasRenderFn: true,
9
+ hostListener: true,
10
+ hostListenerTargetWindow: true,
11
+ hostListenerTargetDocument: true,
12
+ hostListenerTargetBody: true,
13
+ hostListenerTargetParent: false,
14
+ hostListenerTarget: true,
15
+ member: true,
16
+ method: true,
17
+ mode: true,
18
+ observeAttribute: true,
19
+ prop: true,
20
+ propMutable: true,
21
+ reflect: true,
22
+ scoped: true,
23
+ shadowDom: true,
24
+ slot: true,
25
+ cssAnnotations: true,
26
+ state: true,
27
+ style: true,
28
+ formAssociated: false,
29
+ svg: true,
30
+ updatable: true,
31
+ vdomAttribute: true,
32
+ vdomXlink: true,
33
+ vdomClass: true,
34
+ vdomFunctional: true,
35
+ vdomKey: true,
36
+ vdomListener: true,
37
+ vdomRef: true,
38
+ vdomPropOrAttr: true,
39
+ vdomRender: true,
40
+ vdomStyle: true,
41
+ vdomText: true,
42
+ propChangeCallback: true,
43
+ taskQueue: true,
44
+ hotModuleReplacement: false,
45
+ isDebug: false,
46
+ isDev: false,
47
+ isTesting: false,
48
+ hydrateServerSide: false,
49
+ hydrateClientSide: false,
50
+ lifecycleDOMEvents: false,
51
+ lazyLoad: false,
52
+ profile: false,
53
+ slotRelocation: true,
54
+ // TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
55
+ appendChildSlotFix: false,
56
+ // TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
57
+ cloneNodeFix: false,
58
+ hydratedAttribute: false,
59
+ hydratedClass: true,
60
+ // TODO(STENCIL-1305): remove this option
61
+ scriptDataOpts: false,
62
+ // TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
63
+ scopedSlotTextContentFix: false,
64
+ // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
65
+ shadowDomShim: false,
66
+ // TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
67
+ slotChildNodesFix: false,
68
+ invisiblePrehydration: true,
69
+ propBoolean: true,
70
+ propNumber: true,
71
+ propString: true,
72
+ constructableCSS: true,
73
+ devTools: false,
74
+ shadowDelegatesFocus: true,
75
+ initializeNextTick: false,
76
+ asyncLoading: true,
77
+ asyncQueue: false,
78
+ // TODO: deprecated in favour of `setTagTransformer` and `transformTag`. Remove in 5.0
79
+ transformTagName: false,
80
+ attachStyles: true,
81
+ // TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
82
+ experimentalSlotFixes: false
83
+ };
84
+ var Env = {};
85
+ var NAMESPACE = (
86
+ /* default */
87
+ "app"
88
+ );
89
+
3
90
  const modeResolutionChain = [];
4
91
 
5
92
  function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydrateResults, $stencilAfterHydrate, $stencilHydrateResolve) {
93
+ var everywhere;
94
+ try { everywhere = global || globalThis; }
95
+ catch (e) { everywhere = window || globalThis; }
96
+
6
97
  var globalThis = $stencilWindow;
7
98
  var self = $stencilWindow;
8
99
  var top = $stencilWindow;
@@ -130,7 +221,7 @@ const NAMESPACE = 'searchcraft-javascript-sdk';
130
221
  const BUILD = /* searchcraft-javascript-sdk */ { hydratedSelectorName: "hydrated", shadowDom: false, slotRelocation: true, state: true, updatable: true};
131
222
 
132
223
  /*
133
- Stencil Hydrate Platform v4.38.3 | MIT Licensed | https://stenciljs.com
224
+ Stencil Hydrate Platform v4.39.0 | MIT Licensed | https://stenciljs.com
134
225
  */
135
226
  var __defProp = Object.defineProperty;
136
227
  var __export = (target, all) => {
@@ -545,6 +636,9 @@ var uniqueTime = (key, measureText) => {
545
636
  };
546
637
  var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
547
638
  var h = (nodeName, vnodeData, ...children) => {
639
+ if (typeof nodeName === "string") {
640
+ nodeName = transformTag(nodeName);
641
+ }
548
642
  let child = null;
549
643
  let key = null;
550
644
  let slotName = null;
@@ -691,7 +785,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
691
785
  const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
692
786
  const node = childRenderNode.$elm$;
693
787
  if (!shadowRoot) {
694
- node["s-hn"] = tagName.toUpperCase();
788
+ node["s-hn"] = transformTag(tagName).toUpperCase();
695
789
  if (childRenderNode.$tag$ === "slot") {
696
790
  node["s-cr"] = hostElm["s-cr"];
697
791
  }
@@ -2100,6 +2194,9 @@ var setContentReference = (elm) => {
2100
2194
 
2101
2195
  // src/runtime/fragment.ts
2102
2196
  var Fragment = (_, children) => children;
2197
+ function transformTag(tag) {
2198
+ return tag;
2199
+ }
2103
2200
 
2104
2201
  // src/runtime/vdom/vdom-annotations.ts
2105
2202
  var insertVdomAnnotations = (doc, staticComponents) => {
@@ -2655,9 +2752,15 @@ var isMemberInElement = (elm, memberName) => {
2655
2752
  var registerComponents = (Cstrs) => {
2656
2753
  for (const Cstr of Cstrs) {
2657
2754
  const exportName = Cstr.cmpMeta.$tagName$;
2755
+ const transformedTagName = everywhere.tagTransform(exportName);
2658
2756
  cmpModules.set(exportName, {
2659
2757
  [exportName]: Cstr
2660
2758
  });
2759
+ if (transformedTagName !== exportName) {
2760
+ cmpModules.set(transformedTagName, {
2761
+ [transformedTagName]: Cstr
2762
+ });
2763
+ }
2661
2764
  }
2662
2765
  };
2663
2766
  var win = window;
@@ -3296,7 +3399,7 @@ function getFormattedDateString(granularity, date) {
3296
3399
  }
3297
3400
  }
3298
3401
 
3299
- /*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
3402
+ /*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
3300
3403
 
3301
3404
  const {
3302
3405
  entries,
@@ -3594,7 +3697,7 @@ const _createHooksMap = function _createHooksMap() {
3594
3697
  function createDOMPurify() {
3595
3698
  let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
3596
3699
  const DOMPurify = root => createDOMPurify(root);
3597
- DOMPurify.version = '3.3.0';
3700
+ DOMPurify.version = '3.3.1';
3598
3701
  DOMPurify.removed = [];
3599
3702
  if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
3600
3703
  // Not running in a browser, provide a factory function
@@ -3940,6 +4043,12 @@ function createDOMPurify() {
3940
4043
  }
3941
4044
  addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
3942
4045
  }
4046
+ if (cfg.ADD_FORBID_CONTENTS) {
4047
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
4048
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
4049
+ }
4050
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
4051
+ }
3943
4052
  /* Add #text in case KEEP_CONTENT is set to true */
3944
4053
  if (KEEP_CONTENT) {
3945
4054
  ALLOWED_TAGS['#text'] = true;
@@ -10028,100 +10137,50 @@ exports.hydrateApp = hydrateApp;
10028
10137
  hydrateAppClosure($stencilWindow);
10029
10138
  }
10030
10139
 
10031
- // src/app-data/index.ts
10032
- var BUILD = {
10033
- allRenderFn: false,
10034
- element: true,
10035
- event: true,
10036
- hasRenderFn: true,
10037
- hostListener: true,
10038
- hostListenerTargetWindow: true,
10039
- hostListenerTargetDocument: true,
10040
- hostListenerTargetBody: true,
10041
- hostListenerTargetParent: false,
10042
- hostListenerTarget: true,
10043
- member: true,
10044
- method: true,
10045
- mode: true,
10046
- observeAttribute: true,
10047
- prop: true,
10048
- propMutable: true,
10049
- reflect: true,
10050
- scoped: true,
10051
- shadowDom: true,
10052
- slot: true,
10053
- cssAnnotations: true,
10054
- state: true,
10055
- style: true,
10056
- formAssociated: false,
10057
- svg: true,
10058
- updatable: true,
10059
- vdomAttribute: true,
10060
- vdomXlink: true,
10061
- vdomClass: true,
10062
- vdomFunctional: true,
10063
- vdomKey: true,
10064
- vdomListener: true,
10065
- vdomRef: true,
10066
- vdomPropOrAttr: true,
10067
- vdomRender: true,
10068
- vdomStyle: true,
10069
- vdomText: true,
10070
- propChangeCallback: true,
10071
- taskQueue: true,
10072
- hotModuleReplacement: false,
10073
- isDebug: false,
10074
- isDev: false,
10075
- isTesting: false,
10076
- hydrateServerSide: false,
10077
- hydrateClientSide: false,
10078
- lifecycleDOMEvents: false,
10079
- lazyLoad: false,
10080
- profile: false,
10081
- slotRelocation: true,
10082
- // TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
10083
- appendChildSlotFix: false,
10084
- // TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
10085
- cloneNodeFix: false,
10086
- hydratedAttribute: false,
10087
- hydratedClass: true,
10088
- // TODO(STENCIL-1305): remove this option
10089
- scriptDataOpts: false,
10090
- // TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
10091
- scopedSlotTextContentFix: false,
10092
- // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
10093
- shadowDomShim: false,
10094
- // TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
10095
- slotChildNodesFix: false,
10096
- invisiblePrehydration: true,
10097
- propBoolean: true,
10098
- propNumber: true,
10099
- propString: true,
10100
- constructableCSS: true,
10101
- devTools: false,
10102
- shadowDelegatesFocus: true,
10103
- initializeNextTick: false,
10104
- asyncLoading: true,
10105
- asyncQueue: false,
10106
- transformTagName: false,
10107
- attachStyles: true,
10108
- // TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
10109
- experimentalSlotFixes: false
10110
- };
10111
- var Env = {};
10112
- var NAMESPACE = (
10113
- /* default */
10114
- "app"
10115
- );
10116
-
10117
10140
  /*
10118
- Stencil Hydrate Runner v4.38.3 | MIT Licensed | https://stenciljs.com
10141
+ Stencil Hydrate Runner v4.39.0 | MIT Licensed | https://stenciljs.com
10119
10142
  */
10120
10143
  var __defProp = Object.defineProperty;
10121
10144
  var __export = (target, all) => {
10122
10145
  for (var name in all)
10123
10146
  __defProp(target, name, { get: all[name], enumerable: true });
10124
10147
  };
10148
+ var Build = {
10149
+ isDev: BUILD.isDev ? true : false,
10150
+ isBrowser: true,
10151
+ isServer: false,
10152
+ isTesting: BUILD.isTesting ? true : false
10153
+ };
10154
+
10155
+ // src/utils/constants.ts
10156
+ var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
10157
+ PrimitiveType2["Undefined"] = "undefined";
10158
+ PrimitiveType2["Null"] = "null";
10159
+ PrimitiveType2["String"] = "string";
10160
+ PrimitiveType2["Number"] = "number";
10161
+ PrimitiveType2["SpecialNumber"] = "number";
10162
+ PrimitiveType2["Boolean"] = "boolean";
10163
+ PrimitiveType2["BigInt"] = "bigint";
10164
+ return PrimitiveType2;
10165
+ })(PrimitiveType || {});
10166
+ var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
10167
+ NonPrimitiveType2["Array"] = "array";
10168
+ NonPrimitiveType2["Date"] = "date";
10169
+ NonPrimitiveType2["Map"] = "map";
10170
+ NonPrimitiveType2["Object"] = "object";
10171
+ NonPrimitiveType2["RegularExpression"] = "regexp";
10172
+ NonPrimitiveType2["Set"] = "set";
10173
+ NonPrimitiveType2["Channel"] = "channel";
10174
+ NonPrimitiveType2["Symbol"] = "symbol";
10175
+ return NonPrimitiveType2;
10176
+ })(NonPrimitiveType || {});
10177
+ var TYPE_CONSTANT = "type";
10178
+ var VALUE_CONSTANT = "value";
10179
+ var SERIALIZED_PREFIX = "serialized:";
10180
+ var STENCIL_DEV_MODE = BUILD.isTesting ? ["STENCIL:"] : [
10181
+ "%cstencil",
10182
+ "color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
10183
+ ];
10125
10184
 
10126
10185
  // src/runtime/runtime-constants.ts
10127
10186
  var CONTENT_REF_ID = "r";
@@ -10132,168 +10191,682 @@ var HYDRATE_ID = "s-id";
10132
10191
  var HYDRATED_STYLE_ID = "sty-id";
10133
10192
  var STENCIL_DOC_DATA = "_stencilDocData";
10134
10193
  var XLINK_NS = "http://www.w3.org/1999/xlink";
10194
+ var win = typeof window !== "undefined" ? window : {};
10195
+ var H = win.HTMLElement || class {
10196
+ };
10197
+ var supportsShadow = BUILD.shadowDom;
10198
+ var supportsConstructableStylesheets = BUILD.constructableCSS ? /* @__PURE__ */ (() => {
10199
+ try {
10200
+ new CSSStyleSheet();
10201
+ return typeof new CSSStyleSheet().replaceSync === "function";
10202
+ } catch (e) {
10203
+ }
10204
+ return false;
10205
+ })() : false;
10135
10206
 
10136
- // src/mock-doc/attribute.ts
10137
- var attrHandler = {
10138
- get(obj, prop) {
10139
- if (prop in obj) {
10140
- return obj[prop];
10141
- }
10142
- if (typeof prop !== "symbol" && !isNaN(prop)) {
10143
- return obj.__items[prop];
10207
+ // src/utils/helpers.ts
10208
+ var isString = (v) => typeof v === "string";
10209
+
10210
+ // src/utils/local-value.ts
10211
+ var LocalValue = class _LocalValue {
10212
+ constructor(type, value) {
10213
+ if (type === "undefined" /* Undefined */ || type === "null" /* Null */) {
10214
+ this.type = type;
10215
+ } else {
10216
+ this.type = type;
10217
+ this.value = value;
10144
10218
  }
10145
- return void 0;
10146
10219
  }
10147
- };
10148
- var createAttributeProxy = (caseInsensitive) => new Proxy(new MockAttributeMap(caseInsensitive), attrHandler);
10149
- var MockAttributeMap = class {
10150
- constructor(caseInsensitive = false) {
10151
- this.caseInsensitive = caseInsensitive;
10152
- this.__items = [];
10153
- }
10154
- get length() {
10155
- return this.__items.length;
10156
- }
10157
- item(index) {
10158
- return this.__items[index] || null;
10220
+ /**
10221
+ * Creates a new LocalValue object with a string value.
10222
+ *
10223
+ * @param {string} value - The string value to be stored in the LocalValue object.
10224
+ * @returns {LocalValue} - The created LocalValue object.
10225
+ */
10226
+ static createStringValue(value) {
10227
+ return new _LocalValue("string" /* String */, value);
10159
10228
  }
10160
- setNamedItem(attr) {
10161
- attr.namespaceURI = null;
10162
- this.setNamedItemNS(attr);
10229
+ /**
10230
+ * Creates a new LocalValue object with a number value.
10231
+ *
10232
+ * @param {number} value - The number value.
10233
+ * @returns {LocalValue} - The created LocalValue object.
10234
+ */
10235
+ static createNumberValue(value) {
10236
+ return new _LocalValue("number" /* Number */, value);
10163
10237
  }
10164
- setNamedItemNS(attr) {
10165
- if (attr != null && attr.value != null) {
10166
- attr.value = String(attr.value);
10167
- }
10168
- const existingAttr = this.__items.find((a) => a.name === attr.name && a.namespaceURI === attr.namespaceURI);
10169
- if (existingAttr != null) {
10170
- existingAttr.value = attr.value;
10171
- } else {
10172
- this.__items.push(attr);
10238
+ /**
10239
+ * Creates a new LocalValue object with a special number value.
10240
+ *
10241
+ * @param {number} value - The value of the special number.
10242
+ * @returns {LocalValue} - The created LocalValue object.
10243
+ */
10244
+ static createSpecialNumberValue(value) {
10245
+ if (Number.isNaN(value)) {
10246
+ return new _LocalValue("number" /* SpecialNumber */, "NaN");
10173
10247
  }
10174
- }
10175
- getNamedItem(attrName) {
10176
- if (this.caseInsensitive) {
10177
- attrName = attrName.toLowerCase();
10248
+ if (Object.is(value, -0)) {
10249
+ return new _LocalValue("number" /* SpecialNumber */, "-0");
10178
10250
  }
10179
- return this.getNamedItemNS(null, attrName);
10180
- }
10181
- getNamedItemNS(namespaceURI, attrName) {
10182
- namespaceURI = getNamespaceURI(namespaceURI);
10183
- return this.__items.find((attr) => attr.name === attrName && getNamespaceURI(attr.namespaceURI) === namespaceURI) || null;
10184
- }
10185
- removeNamedItem(attr) {
10186
- this.removeNamedItemNS(attr);
10187
- }
10188
- removeNamedItemNS(attr) {
10189
- for (let i = 0, ii = this.__items.length; i < ii; i++) {
10190
- if (this.__items[i].name === attr.name && this.__items[i].namespaceURI === attr.namespaceURI) {
10191
- this.__items.splice(i, 1);
10192
- break;
10193
- }
10251
+ if (value === Infinity) {
10252
+ return new _LocalValue("number" /* SpecialNumber */, "Infinity");
10194
10253
  }
10195
- }
10196
- [Symbol.iterator]() {
10197
- let i = 0;
10198
- return {
10199
- next: () => ({
10200
- done: i === this.length,
10201
- value: this.item(i++)
10202
- })
10203
- };
10204
- }
10205
- get [Symbol.toStringTag]() {
10206
- return "MockAttributeMap";
10207
- }
10208
- };
10209
- function getNamespaceURI(namespaceURI) {
10210
- return namespaceURI === XLINK_NS ? null : namespaceURI;
10211
- }
10212
- function cloneAttributes(srcAttrs, sortByName = false) {
10213
- const dstAttrs = new MockAttributeMap(srcAttrs.caseInsensitive);
10214
- if (srcAttrs != null) {
10215
- const attrLen = srcAttrs.length;
10216
- if (sortByName && attrLen > 1) {
10217
- const sortedAttrs = [];
10218
- for (let i = 0; i < attrLen; i++) {
10219
- const srcAttr = srcAttrs.item(i);
10220
- const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
10221
- sortedAttrs.push(dstAttr);
10222
- }
10223
- sortedAttrs.sort(sortAttributes).forEach((attr) => {
10224
- dstAttrs.setNamedItemNS(attr);
10225
- });
10226
- } else {
10227
- for (let i = 0; i < attrLen; i++) {
10228
- const srcAttr = srcAttrs.item(i);
10229
- const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
10230
- dstAttrs.setNamedItemNS(dstAttr);
10231
- }
10254
+ if (value === -Infinity) {
10255
+ return new _LocalValue("number" /* SpecialNumber */, "-Infinity");
10232
10256
  }
10257
+ return new _LocalValue("number" /* SpecialNumber */, value);
10233
10258
  }
10234
- return dstAttrs;
10235
- }
10236
- function sortAttributes(a, b) {
10237
- if (a.name < b.name) return -1;
10238
- if (a.name > b.name) return 1;
10239
- return 0;
10240
- }
10241
- var MockAttr = class {
10242
- constructor(attrName, attrValue, namespaceURI = null) {
10243
- this._name = attrName;
10244
- this._value = String(attrValue);
10245
- this._namespaceURI = namespaceURI;
10246
- }
10247
- get name() {
10248
- return this._name;
10249
- }
10250
- set name(value) {
10251
- this._name = value;
10259
+ /**
10260
+ * Creates a new LocalValue object with an undefined value.
10261
+ * @returns {LocalValue} - The created LocalValue object.
10262
+ */
10263
+ static createUndefinedValue() {
10264
+ return new _LocalValue("undefined" /* Undefined */);
10252
10265
  }
10253
- get value() {
10254
- return this._value;
10266
+ /**
10267
+ * Creates a new LocalValue object with a null value.
10268
+ * @returns {LocalValue} - The created LocalValue object.
10269
+ */
10270
+ static createNullValue() {
10271
+ return new _LocalValue("null" /* Null */);
10255
10272
  }
10256
- set value(value) {
10257
- this._value = String(value);
10273
+ /**
10274
+ * Creates a new LocalValue object with a boolean value.
10275
+ *
10276
+ * @param {boolean} value - The boolean value.
10277
+ * @returns {LocalValue} - The created LocalValue object.
10278
+ */
10279
+ static createBooleanValue(value) {
10280
+ return new _LocalValue("boolean" /* Boolean */, value);
10258
10281
  }
10259
- get nodeName() {
10260
- return this._name;
10282
+ /**
10283
+ * Creates a new LocalValue object with a BigInt value.
10284
+ *
10285
+ * @param {BigInt} value - The BigInt value.
10286
+ * @returns {LocalValue} - The created LocalValue object.
10287
+ */
10288
+ static createBigIntValue(value) {
10289
+ return new _LocalValue("bigint" /* BigInt */, value.toString());
10261
10290
  }
10262
- set nodeName(value) {
10263
- this._name = value;
10291
+ /**
10292
+ * Creates a new LocalValue object with an array.
10293
+ *
10294
+ * @param {Array} value - The array.
10295
+ * @returns {LocalValue} - The created LocalValue object.
10296
+ */
10297
+ static createArrayValue(value) {
10298
+ return new _LocalValue("array" /* Array */, value);
10264
10299
  }
10265
- get nodeValue() {
10266
- return this._value;
10300
+ /**
10301
+ * Creates a new LocalValue object with date value.
10302
+ *
10303
+ * @param {string} value - The date.
10304
+ * @returns {LocalValue} - The created LocalValue object.
10305
+ */
10306
+ static createDateValue(value) {
10307
+ return new _LocalValue("date" /* Date */, value);
10267
10308
  }
10268
- set nodeValue(value) {
10269
- this._value = String(value);
10309
+ /**
10310
+ * Creates a new LocalValue object of map value.
10311
+ * @param {Map} map - The map.
10312
+ * @returns {LocalValue} - The created LocalValue object.
10313
+ */
10314
+ static createMapValue(map2) {
10315
+ const value = [];
10316
+ Array.from(map2.entries()).forEach(([key, val]) => {
10317
+ value.push([_LocalValue.getArgument(key), _LocalValue.getArgument(val)]);
10318
+ });
10319
+ return new _LocalValue("map" /* Map */, value);
10270
10320
  }
10271
- get namespaceURI() {
10272
- return this._namespaceURI;
10321
+ /**
10322
+ * Creates a new LocalValue object from the passed object.
10323
+ *
10324
+ * @param object the object to create a LocalValue from
10325
+ * @returns {LocalValue} - The created LocalValue object.
10326
+ */
10327
+ static createObjectValue(object) {
10328
+ const value = [];
10329
+ Object.entries(object).forEach(([key, val]) => {
10330
+ value.push([key, _LocalValue.getArgument(val)]);
10331
+ });
10332
+ return new _LocalValue("object" /* Object */, value);
10273
10333
  }
10274
- set namespaceURI(namespaceURI) {
10275
- this._namespaceURI = namespaceURI;
10334
+ /**
10335
+ * Creates a new LocalValue object of regular expression value.
10336
+ *
10337
+ * @param {string} value - The value of the regular expression.
10338
+ * @returns {LocalValue} - The created LocalValue object.
10339
+ */
10340
+ static createRegularExpressionValue(value) {
10341
+ return new _LocalValue("regexp" /* RegularExpression */, value);
10276
10342
  }
10277
- };
10278
-
10279
- // src/mock-doc/css-style-declaration.ts
10280
- var MockCSSStyleDeclaration = class {
10281
- constructor() {
10282
- this._styles = /* @__PURE__ */ new Map();
10343
+ /**
10344
+ * Creates a new LocalValue object with the specified value.
10345
+ * @param {Set} value - The value to be set.
10346
+ * @returns {LocalValue} - The created LocalValue object.
10347
+ */
10348
+ static createSetValue(value) {
10349
+ return new _LocalValue("set" /* Set */, value);
10283
10350
  }
10284
- setProperty(prop, value) {
10285
- prop = jsCaseToCssCase(prop);
10286
- if (value == null || value === "") {
10287
- this._styles.delete(prop);
10288
- } else {
10289
- this._styles.set(prop, String(value));
10290
- }
10351
+ /**
10352
+ * Creates a new LocalValue object with the given channel value
10353
+ *
10354
+ * @param {ChannelValue} value - The channel value.
10355
+ * @returns {LocalValue} - The created LocalValue object.
10356
+ */
10357
+ static createChannelValue(value) {
10358
+ return new _LocalValue("channel" /* Channel */, value);
10291
10359
  }
10292
- getPropertyValue(prop) {
10293
- prop = jsCaseToCssCase(prop);
10294
- return String(this._styles.get(prop) || "");
10360
+ /**
10361
+ * Creates a new LocalValue object with a Symbol value.
10362
+ *
10363
+ * @param {Symbol} symbol - The Symbol value
10364
+ * @returns {LocalValue} - The created LocalValue object
10365
+ */
10366
+ static createSymbolValue(symbol) {
10367
+ const description = symbol.description || "Symbol()";
10368
+ return new _LocalValue("symbol" /* Symbol */, description);
10295
10369
  }
10296
- removeProperty(prop) {
10370
+ static getArgument(argument) {
10371
+ const type = typeof argument;
10372
+ switch (type) {
10373
+ case "string" /* String */:
10374
+ return _LocalValue.createStringValue(argument);
10375
+ case "number" /* Number */:
10376
+ if (Number.isNaN(argument) || Object.is(argument, -0) || !Number.isFinite(argument)) {
10377
+ return _LocalValue.createSpecialNumberValue(argument);
10378
+ }
10379
+ return _LocalValue.createNumberValue(argument);
10380
+ case "boolean" /* Boolean */:
10381
+ return _LocalValue.createBooleanValue(argument);
10382
+ case "bigint" /* BigInt */:
10383
+ return _LocalValue.createBigIntValue(argument);
10384
+ case "undefined" /* Undefined */:
10385
+ return _LocalValue.createUndefinedValue();
10386
+ case "symbol" /* Symbol */:
10387
+ return _LocalValue.createSymbolValue(argument);
10388
+ case "object" /* Object */:
10389
+ if (argument === null) {
10390
+ return _LocalValue.createNullValue();
10391
+ }
10392
+ if (argument instanceof Date) {
10393
+ return _LocalValue.createDateValue(argument);
10394
+ }
10395
+ if (argument instanceof Map) {
10396
+ const map2 = [];
10397
+ argument.forEach((value, key) => {
10398
+ const objectKey = typeof key === "string" ? key : _LocalValue.getArgument(key);
10399
+ const objectValue = _LocalValue.getArgument(value);
10400
+ map2.push([objectKey, objectValue]);
10401
+ });
10402
+ return _LocalValue.createMapValue(argument);
10403
+ }
10404
+ if (argument instanceof Set) {
10405
+ const set = [];
10406
+ argument.forEach((value) => {
10407
+ set.push(_LocalValue.getArgument(value));
10408
+ });
10409
+ return _LocalValue.createSetValue(set);
10410
+ }
10411
+ if (argument instanceof Array) {
10412
+ const arr = [];
10413
+ argument.forEach((value) => {
10414
+ arr.push(_LocalValue.getArgument(value));
10415
+ });
10416
+ return _LocalValue.createArrayValue(arr);
10417
+ }
10418
+ if (argument instanceof RegExp) {
10419
+ return _LocalValue.createRegularExpressionValue({
10420
+ pattern: argument.source,
10421
+ flags: argument.flags
10422
+ });
10423
+ }
10424
+ return _LocalValue.createObjectValue(argument);
10425
+ }
10426
+ throw new Error(`Unsupported type: ${type}`);
10427
+ }
10428
+ asMap() {
10429
+ return {
10430
+ [TYPE_CONSTANT]: this.type,
10431
+ ...!(this.type === "null" /* Null */ || this.type === "undefined" /* Undefined */) ? { [VALUE_CONSTANT]: this.value } : {}
10432
+ };
10433
+ }
10434
+ };
10435
+
10436
+ // src/utils/message-utils.ts
10437
+ var catchError = (diagnostics, err2, msg) => {
10438
+ const diagnostic = {
10439
+ level: "error",
10440
+ type: "build",
10441
+ header: "Build Error",
10442
+ messageText: "build error",
10443
+ lines: []
10444
+ };
10445
+ if (isString(msg)) {
10446
+ diagnostic.messageText = msg.length ? msg : "UNKNOWN ERROR";
10447
+ } else if (err2 != null) {
10448
+ if (err2.stack != null) {
10449
+ diagnostic.messageText = err2.stack.toString();
10450
+ } else {
10451
+ if (err2.message != null) {
10452
+ diagnostic.messageText = err2.message.length ? err2.message : "UNKNOWN ERROR";
10453
+ } else {
10454
+ diagnostic.messageText = err2.toString();
10455
+ }
10456
+ }
10457
+ }
10458
+ if (diagnostics != null && !shouldIgnoreError(diagnostic.messageText)) {
10459
+ diagnostics.push(diagnostic);
10460
+ }
10461
+ return diagnostic;
10462
+ };
10463
+ var hasError = (diagnostics) => {
10464
+ if (diagnostics == null || diagnostics.length === 0) {
10465
+ return false;
10466
+ }
10467
+ return diagnostics.some((d) => d.level === "error" && d.type !== "runtime");
10468
+ };
10469
+ var shouldIgnoreError = (msg) => {
10470
+ return msg === TASK_CANCELED_MSG;
10471
+ };
10472
+ var TASK_CANCELED_MSG = `task canceled`;
10473
+
10474
+ // src/utils/regular-expression.ts
10475
+ var escapeRegExpSpecialCharacters = (text) => {
10476
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
10477
+ };
10478
+
10479
+ // src/utils/remote-value.ts
10480
+ var RemoteValue = class _RemoteValue {
10481
+ /**
10482
+ * Deserializes a LocalValue serialized object back to its original JavaScript representation
10483
+ *
10484
+ * @param serialized The serialized LocalValue object
10485
+ * @returns The original JavaScript value/object
10486
+ */
10487
+ static fromLocalValue(serialized) {
10488
+ const type = serialized[TYPE_CONSTANT];
10489
+ const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
10490
+ switch (type) {
10491
+ case "string" /* String */:
10492
+ return value;
10493
+ case "boolean" /* Boolean */:
10494
+ return value;
10495
+ case "bigint" /* BigInt */:
10496
+ return BigInt(value);
10497
+ case "undefined" /* Undefined */:
10498
+ return void 0;
10499
+ case "null" /* Null */:
10500
+ return null;
10501
+ case "number" /* Number */:
10502
+ if (value === "NaN") return NaN;
10503
+ if (value === "-0") return -0;
10504
+ if (value === "Infinity") return Infinity;
10505
+ if (value === "-Infinity") return -Infinity;
10506
+ return value;
10507
+ case "array" /* Array */:
10508
+ return value.map((item) => _RemoteValue.fromLocalValue(item));
10509
+ case "date" /* Date */:
10510
+ return new Date(value);
10511
+ case "map" /* Map */:
10512
+ const map2 = /* @__PURE__ */ new Map();
10513
+ for (const [key, val] of value) {
10514
+ const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
10515
+ const deserializedValue = _RemoteValue.fromLocalValue(val);
10516
+ map2.set(deserializedKey, deserializedValue);
10517
+ }
10518
+ return map2;
10519
+ case "object" /* Object */:
10520
+ const obj = {};
10521
+ for (const [key, val] of value) {
10522
+ obj[key] = _RemoteValue.fromLocalValue(val);
10523
+ }
10524
+ return obj;
10525
+ case "regexp" /* RegularExpression */:
10526
+ const { pattern, flags } = value;
10527
+ return new RegExp(pattern, flags);
10528
+ case "set" /* Set */:
10529
+ const set = /* @__PURE__ */ new Set();
10530
+ for (const item of value) {
10531
+ set.add(_RemoteValue.fromLocalValue(item));
10532
+ }
10533
+ return set;
10534
+ case "symbol" /* Symbol */:
10535
+ return Symbol(value);
10536
+ default:
10537
+ throw new Error(`Unsupported type: ${type}`);
10538
+ }
10539
+ }
10540
+ /**
10541
+ * Utility method to deserialize multiple LocalValues at once
10542
+ *
10543
+ * @param serializedValues Array of serialized LocalValue objects
10544
+ * @returns Array of deserialized JavaScript values
10545
+ */
10546
+ static fromLocalValueArray(serializedValues) {
10547
+ return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
10548
+ }
10549
+ /**
10550
+ * Verifies if the given object matches the structure of a serialized LocalValue
10551
+ *
10552
+ * @param obj Object to verify
10553
+ * @returns boolean indicating if the object has LocalValue structure
10554
+ */
10555
+ static isLocalValueObject(obj) {
10556
+ if (typeof obj !== "object" || obj === null) {
10557
+ return false;
10558
+ }
10559
+ if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
10560
+ return false;
10561
+ }
10562
+ const type = obj[TYPE_CONSTANT];
10563
+ const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
10564
+ if (!hasTypeProperty) {
10565
+ return false;
10566
+ }
10567
+ if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
10568
+ return obj.hasOwnProperty(VALUE_CONSTANT);
10569
+ }
10570
+ return true;
10571
+ }
10572
+ };
10573
+
10574
+ // src/utils/result.ts
10575
+ var result_exports = {};
10576
+ __export(result_exports, {
10577
+ err: () => err,
10578
+ map: () => map,
10579
+ ok: () => ok,
10580
+ unwrap: () => unwrap,
10581
+ unwrapErr: () => unwrapErr
10582
+ });
10583
+ var ok = (value) => ({
10584
+ isOk: true,
10585
+ isErr: false,
10586
+ value
10587
+ });
10588
+ var err = (value) => ({
10589
+ isOk: false,
10590
+ isErr: true,
10591
+ value
10592
+ });
10593
+ function map(result, fn) {
10594
+ if (result.isOk) {
10595
+ const val = fn(result.value);
10596
+ if (val instanceof Promise) {
10597
+ return val.then((newVal) => ok(newVal));
10598
+ } else {
10599
+ return ok(val);
10600
+ }
10601
+ }
10602
+ if (result.isErr) {
10603
+ const value = result.value;
10604
+ return err(value);
10605
+ }
10606
+ throw "should never get here";
10607
+ }
10608
+ var unwrap = (result) => {
10609
+ if (result.isOk) {
10610
+ return result.value;
10611
+ } else {
10612
+ throw result.value;
10613
+ }
10614
+ };
10615
+ var unwrapErr = (result) => {
10616
+ if (result.isErr) {
10617
+ return result.value;
10618
+ } else {
10619
+ throw result.value;
10620
+ }
10621
+ };
10622
+
10623
+ // src/utils/serialize.ts
10624
+ function serializeProperty(value) {
10625
+ if (["string", "boolean", "undefined"].includes(typeof value) || typeof value === "number" && value !== Infinity && value !== -Infinity && !isNaN(value)) {
10626
+ return value;
10627
+ }
10628
+ const arg = LocalValue.getArgument(value);
10629
+ return SERIALIZED_PREFIX + btoa(JSON.stringify(arg));
10630
+ }
10631
+ function deserializeProperty(value) {
10632
+ if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
10633
+ return value;
10634
+ }
10635
+ return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
10636
+ }
10637
+
10638
+ // src/utils/util.ts
10639
+ var lowerPathParam = (fn) => (p) => fn(p.toLowerCase());
10640
+ var isDtsFile = lowerPathParam((p) => p.endsWith(".d.ts") || p.endsWith(".d.mts") || p.endsWith(".d.cts"));
10641
+ var isTsFile = lowerPathParam(
10642
+ (p) => !isDtsFile(p) && (p.endsWith(".ts") || p.endsWith(".mts") || p.endsWith(".cts"))
10643
+ );
10644
+ var isTsxFile = lowerPathParam(
10645
+ (p) => p.endsWith(".tsx") || p.endsWith(".mtsx") || p.endsWith(".ctsx")
10646
+ );
10647
+ var isJsxFile = lowerPathParam(
10648
+ (p) => p.endsWith(".jsx") || p.endsWith(".mjsx") || p.endsWith(".cjsx")
10649
+ );
10650
+ var isJsFile = lowerPathParam((p) => p.endsWith(".js") || p.endsWith(".mjs") || p.endsWith(".cjs"));
10651
+
10652
+ // src/utils/shadow-css.ts
10653
+ /**
10654
+ * @license
10655
+ * Copyright Google Inc. All Rights Reserved.
10656
+ *
10657
+ * Use of this source code is governed by an MIT-style license that can be
10658
+ * found in the LICENSE file at https://angular.io/license
10659
+ *
10660
+ * This file is a port of shadowCSS from `webcomponents.js` to TypeScript.
10661
+ * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
10662
+ * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
10663
+ */
10664
+ var _polyfillHost = "-shadowcsshost";
10665
+ var _polyfillSlotted = "-shadowcssslotted";
10666
+ var _polyfillHostContext = "-shadowcsscontext";
10667
+ var _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
10668
+ var _cssColonHostRe = new RegExp("(" + _polyfillHost + _parenSuffix, "gim");
10669
+ var _cssColonHostContextRe = new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim");
10670
+ var _cssColonSlottedRe = new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim");
10671
+ var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
10672
+ var createSupportsRuleRe = (selector) => {
10673
+ const safeSelector = escapeRegExpSpecialCharacters(selector);
10674
+ return new RegExp(
10675
+ // First capture group: match any context before the selector that's not inside @supports selector()
10676
+ // Using negative lookahead to avoid matching inside @supports selector(...) condition
10677
+ `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector}))(${safeSelector}\\b)`,
10678
+ "g"
10679
+ );
10680
+ };
10681
+ var _colonSlottedRe = createSupportsRuleRe("::slotted");
10682
+ var _colonHostRe = createSupportsRuleRe(":host");
10683
+ var _colonHostContextRe = createSupportsRuleRe(":host-context");
10684
+
10685
+ // src/runtime/mode.ts
10686
+ var setMode = (handler) => modeResolutionChain.push(handler);
10687
+ var CAPTURE_EVENT_SUFFIX = "Capture";
10688
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
10689
+ var baseClass = BUILD.lazyLoad ? class {
10690
+ } : globalThis.HTMLElement || class {
10691
+ };
10692
+
10693
+ // src/runtime/tag-transform.ts
10694
+ var tagTransformer = void 0;
10695
+ function transformTag(tag) {
10696
+ if (!tagTransformer) return tag;
10697
+ return tagTransformer(tag);
10698
+ }
10699
+ function setTagTransformer(transformer) {
10700
+ if (tagTransformer) {
10701
+ console.warn(`
10702
+ A tagTransformer has already been set.
10703
+ Overwriting it may lead to error and unexpected results if your components have already been defined.
10704
+ `);
10705
+ }
10706
+ tagTransformer = transformer;
10707
+ }
10708
+
10709
+ // src/mock-doc/attribute.ts
10710
+ var attrHandler = {
10711
+ get(obj, prop) {
10712
+ if (prop in obj) {
10713
+ return obj[prop];
10714
+ }
10715
+ if (typeof prop !== "symbol" && !isNaN(prop)) {
10716
+ return obj.__items[prop];
10717
+ }
10718
+ return void 0;
10719
+ }
10720
+ };
10721
+ var createAttributeProxy = (caseInsensitive) => new Proxy(new MockAttributeMap(caseInsensitive), attrHandler);
10722
+ var MockAttributeMap = class {
10723
+ constructor(caseInsensitive = false) {
10724
+ this.caseInsensitive = caseInsensitive;
10725
+ this.__items = [];
10726
+ }
10727
+ get length() {
10728
+ return this.__items.length;
10729
+ }
10730
+ item(index) {
10731
+ return this.__items[index] || null;
10732
+ }
10733
+ setNamedItem(attr) {
10734
+ attr.namespaceURI = null;
10735
+ this.setNamedItemNS(attr);
10736
+ }
10737
+ setNamedItemNS(attr) {
10738
+ if (attr != null && attr.value != null) {
10739
+ attr.value = String(attr.value);
10740
+ }
10741
+ const existingAttr = this.__items.find((a) => a.name === attr.name && a.namespaceURI === attr.namespaceURI);
10742
+ if (existingAttr != null) {
10743
+ existingAttr.value = attr.value;
10744
+ } else {
10745
+ this.__items.push(attr);
10746
+ }
10747
+ }
10748
+ getNamedItem(attrName) {
10749
+ if (this.caseInsensitive) {
10750
+ attrName = attrName.toLowerCase();
10751
+ }
10752
+ return this.getNamedItemNS(null, attrName);
10753
+ }
10754
+ getNamedItemNS(namespaceURI, attrName) {
10755
+ namespaceURI = getNamespaceURI(namespaceURI);
10756
+ return this.__items.find((attr) => attr.name === attrName && getNamespaceURI(attr.namespaceURI) === namespaceURI) || null;
10757
+ }
10758
+ removeNamedItem(attr) {
10759
+ this.removeNamedItemNS(attr);
10760
+ }
10761
+ removeNamedItemNS(attr) {
10762
+ for (let i = 0, ii = this.__items.length; i < ii; i++) {
10763
+ if (this.__items[i].name === attr.name && this.__items[i].namespaceURI === attr.namespaceURI) {
10764
+ this.__items.splice(i, 1);
10765
+ break;
10766
+ }
10767
+ }
10768
+ }
10769
+ [Symbol.iterator]() {
10770
+ let i = 0;
10771
+ return {
10772
+ next: () => ({
10773
+ done: i === this.length,
10774
+ value: this.item(i++)
10775
+ })
10776
+ };
10777
+ }
10778
+ get [Symbol.toStringTag]() {
10779
+ return "MockAttributeMap";
10780
+ }
10781
+ };
10782
+ function getNamespaceURI(namespaceURI) {
10783
+ return namespaceURI === XLINK_NS ? null : namespaceURI;
10784
+ }
10785
+ function cloneAttributes(srcAttrs, sortByName = false) {
10786
+ const dstAttrs = new MockAttributeMap(srcAttrs.caseInsensitive);
10787
+ if (srcAttrs != null) {
10788
+ const attrLen = srcAttrs.length;
10789
+ if (sortByName && attrLen > 1) {
10790
+ const sortedAttrs = [];
10791
+ for (let i = 0; i < attrLen; i++) {
10792
+ const srcAttr = srcAttrs.item(i);
10793
+ const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
10794
+ sortedAttrs.push(dstAttr);
10795
+ }
10796
+ sortedAttrs.sort(sortAttributes).forEach((attr) => {
10797
+ dstAttrs.setNamedItemNS(attr);
10798
+ });
10799
+ } else {
10800
+ for (let i = 0; i < attrLen; i++) {
10801
+ const srcAttr = srcAttrs.item(i);
10802
+ const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
10803
+ dstAttrs.setNamedItemNS(dstAttr);
10804
+ }
10805
+ }
10806
+ }
10807
+ return dstAttrs;
10808
+ }
10809
+ function sortAttributes(a, b) {
10810
+ if (a.name < b.name) return -1;
10811
+ if (a.name > b.name) return 1;
10812
+ return 0;
10813
+ }
10814
+ var MockAttr = class {
10815
+ constructor(attrName, attrValue, namespaceURI = null) {
10816
+ this._name = attrName;
10817
+ this._value = String(attrValue);
10818
+ this._namespaceURI = namespaceURI;
10819
+ }
10820
+ get name() {
10821
+ return this._name;
10822
+ }
10823
+ set name(value) {
10824
+ this._name = value;
10825
+ }
10826
+ get value() {
10827
+ return this._value;
10828
+ }
10829
+ set value(value) {
10830
+ this._value = String(value);
10831
+ }
10832
+ get nodeName() {
10833
+ return this._name;
10834
+ }
10835
+ set nodeName(value) {
10836
+ this._name = value;
10837
+ }
10838
+ get nodeValue() {
10839
+ return this._value;
10840
+ }
10841
+ set nodeValue(value) {
10842
+ this._value = String(value);
10843
+ }
10844
+ get namespaceURI() {
10845
+ return this._namespaceURI;
10846
+ }
10847
+ set namespaceURI(namespaceURI) {
10848
+ this._namespaceURI = namespaceURI;
10849
+ }
10850
+ };
10851
+
10852
+ // src/mock-doc/css-style-declaration.ts
10853
+ var MockCSSStyleDeclaration = class {
10854
+ constructor() {
10855
+ this._styles = /* @__PURE__ */ new Map();
10856
+ }
10857
+ setProperty(prop, value) {
10858
+ prop = jsCaseToCssCase(prop);
10859
+ if (value == null || value === "") {
10860
+ this._styles.delete(prop);
10861
+ } else {
10862
+ this._styles.set(prop, String(value));
10863
+ }
10864
+ }
10865
+ getPropertyValue(prop) {
10866
+ prop = jsCaseToCssCase(prop);
10867
+ return String(this._styles.get(prop) || "");
10868
+ }
10869
+ removeProperty(prop) {
10297
10870
  prop = jsCaseToCssCase(prop);
10298
10871
  this._styles.delete(prop);
10299
10872
  }
@@ -10403,7 +10976,7 @@ var MockCustomElementRegistry = class {
10403
10976
  proxyElements.set(host, upgradedCmp);
10404
10977
  }
10405
10978
  }
10406
- fireConnectedCallback(host);
10979
+ fireConnectedCallback2(host);
10407
10980
  });
10408
10981
  }
10409
10982
  }
@@ -10503,7 +11076,7 @@ function connectNode(ownerDocument, node) {
10503
11076
  if (ownerDocument != null && node.nodeName.includes("-")) {
10504
11077
  const win2 = ownerDocument.defaultView;
10505
11078
  if (win2 != null && typeof node.connectedCallback === "function" && node.isConnected) {
10506
- fireConnectedCallback(node);
11079
+ fireConnectedCallback2(node);
10507
11080
  }
10508
11081
  const shadowRoot = node.shadowRoot;
10509
11082
  if (shadowRoot != null) {
@@ -10521,7 +11094,7 @@ function connectNode(ownerDocument, node) {
10521
11094
  });
10522
11095
  }
10523
11096
  }
10524
- function fireConnectedCallback(node) {
11097
+ function fireConnectedCallback2(node) {
10525
11098
  if (typeof node.connectedCallback === "function") {
10526
11099
  if (tempDisableCallbacks.has(node.ownerDocument) === false) {
10527
11100
  try {
@@ -10571,7 +11144,7 @@ function dataset(elm) {
10571
11144
  const attr = attributes.item(i);
10572
11145
  const nodeName = attr.nodeName;
10573
11146
  if (nodeName.startsWith("data-")) {
10574
- ds[dashToPascalCase(nodeName)] = attr.nodeValue;
11147
+ ds[dashToPascalCase2(nodeName)] = attr.nodeValue;
10575
11148
  }
10576
11149
  }
10577
11150
  return new Proxy(ds, {
@@ -10588,7 +11161,7 @@ function dataset(elm) {
10588
11161
  function toDataAttribute(str) {
10589
11162
  return "data-" + String(str).replace(/([A-Z0-9])/g, (g) => " " + g[0]).trim().replace(/ /g, "-").toLowerCase();
10590
11163
  }
10591
- function dashToPascalCase(str) {
11164
+ function dashToPascalCase2(str) {
10592
11165
  str = String(str).slice(5);
10593
11166
  return str.split("-").map((segment, index) => {
10594
11167
  if (index === 0) {
@@ -18940,14 +19513,14 @@ var jquery_default = (
18940
19513
  *
18941
19514
  * Date: 2023-12-11T17:55Z
18942
19515
  */
18943
- function(global2, factory) {
19516
+ (function(global2, factory) {
18944
19517
  "use strict";
18945
19518
  if (true) {
18946
19519
  return factory(global2, true);
18947
19520
  } else {
18948
19521
  factory(global2);
18949
19522
  }
18950
- }({
19523
+ })({
18951
19524
  document: {
18952
19525
  createElement() {
18953
19526
  return {};
@@ -20917,10 +21490,10 @@ var MockNode2 = class {
20917
21490
  insertBefore(newNode, referenceNode) {
20918
21491
  if (newNode.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
20919
21492
  for (let i = 0, ii = newNode.childNodes.length; i < ii; i++) {
20920
- insertBefore(this, newNode.childNodes[i], referenceNode);
21493
+ insertBefore2(this, newNode.childNodes[i], referenceNode);
20921
21494
  }
20922
21495
  } else {
20923
- insertBefore(this, newNode, referenceNode);
21496
+ insertBefore2(this, newNode, referenceNode);
20924
21497
  }
20925
21498
  return newNode;
20926
21499
  }
@@ -21265,13 +21838,13 @@ var MockElement = class extends MockNode2 {
21265
21838
  }
21266
21839
  insertAdjacentElement(position, elm) {
21267
21840
  if (position === "beforebegin" && this.parentNode) {
21268
- insertBefore(this.parentNode, elm, this);
21841
+ insertBefore2(this.parentNode, elm, this);
21269
21842
  } else if (position === "afterbegin") {
21270
21843
  this.prepend(elm);
21271
21844
  } else if (position === "beforeend") {
21272
21845
  this.appendChild(elm);
21273
21846
  } else if (position === "afterend" && this.parentNode) {
21274
- insertBefore(this.parentNode, elm, this.nextSibling);
21847
+ insertBefore2(this.parentNode, elm, this.nextSibling);
21275
21848
  }
21276
21849
  return elm;
21277
21850
  }
@@ -21280,7 +21853,7 @@ var MockElement = class extends MockNode2 {
21280
21853
  if (position === "beforebegin") {
21281
21854
  while (frag.childNodes.length > 0) {
21282
21855
  if (this.parentNode) {
21283
- insertBefore(this.parentNode, frag.childNodes[0], this);
21856
+ insertBefore2(this.parentNode, frag.childNodes[0], this);
21284
21857
  }
21285
21858
  }
21286
21859
  } else if (position === "afterbegin") {
@@ -21294,7 +21867,7 @@ var MockElement = class extends MockNode2 {
21294
21867
  } else if (position === "afterend") {
21295
21868
  while (frag.childNodes.length > 0) {
21296
21869
  if (this.parentNode) {
21297
- insertBefore(this.parentNode, frag.childNodes[frag.childNodes.length - 1], this.nextSibling);
21870
+ insertBefore2(this.parentNode, frag.childNodes[frag.childNodes.length - 1], this.nextSibling);
21298
21871
  }
21299
21872
  }
21300
21873
  }
@@ -21302,13 +21875,13 @@ var MockElement = class extends MockNode2 {
21302
21875
  insertAdjacentText(position, text) {
21303
21876
  const elm = this.ownerDocument.createTextNode(text);
21304
21877
  if (position === "beforebegin" && this.parentNode) {
21305
- insertBefore(this.parentNode, elm, this);
21878
+ insertBefore2(this.parentNode, elm, this);
21306
21879
  } else if (position === "afterbegin") {
21307
21880
  this.prepend(elm);
21308
21881
  } else if (position === "beforeend") {
21309
21882
  this.appendChild(elm);
21310
21883
  } else if (position === "afterend" && this.parentNode) {
21311
- insertBefore(this.parentNode, elm, this.nextSibling);
21884
+ insertBefore2(this.parentNode, elm, this.nextSibling);
21312
21885
  }
21313
21886
  }
21314
21887
  hasAttribute(attrName) {
@@ -21723,7 +22296,7 @@ function resetElement(elm) {
21723
22296
  delete elm.__shadowRoot;
21724
22297
  delete elm.__style;
21725
22298
  }
21726
- function insertBefore(parentNode, newNode, referenceNode) {
22299
+ function insertBefore2(parentNode, newNode, referenceNode) {
21727
22300
  if (newNode !== referenceNode) {
21728
22301
  newNode.remove();
21729
22302
  newNode.parentNode = parentNode;
@@ -23835,968 +24408,434 @@ var MockWindow = class {
23835
24408
  }
23836
24409
  onpointerout() {
23837
24410
  }
23838
- onpointerover() {
23839
- }
23840
- onpointerup() {
23841
- }
23842
- onprogress() {
23843
- }
23844
- onratechange() {
23845
- }
23846
- onreset() {
23847
- }
23848
- onresize() {
23849
- }
23850
- onscroll() {
23851
- }
23852
- onsearch() {
23853
- }
23854
- onseeked() {
23855
- }
23856
- onseeking() {
23857
- }
23858
- onselect() {
23859
- }
23860
- onselectstart() {
23861
- }
23862
- onstalled() {
23863
- }
23864
- onsubmit() {
23865
- }
23866
- onsuspend() {
23867
- }
23868
- ontimeupdate() {
23869
- }
23870
- ontoggle() {
23871
- }
23872
- onvolumechange() {
23873
- }
23874
- onwaiting() {
23875
- }
23876
- onwebkitfullscreenchange() {
23877
- }
23878
- onwebkitfullscreenerror() {
23879
- }
23880
- onwheel() {
23881
- }
23882
- };
23883
- addGlobalsToWindowPrototype(MockWindow.prototype);
23884
- function resetWindowDefaults(win2) {
23885
- win2.__clearInterval = nativeClearInterval;
23886
- win2.__clearTimeout = nativeClearTimeout;
23887
- win2.__setInterval = nativeSetInterval;
23888
- win2.__setTimeout = nativeSetTimeout;
23889
- win2.__maxTimeout = 6e4;
23890
- win2.__allowInterval = true;
23891
- win2.URL = nativeURL;
23892
- }
23893
- function cloneWindow(srcWin, opts = {}) {
23894
- if (srcWin == null) {
23895
- return null;
23896
- }
23897
- const clonedWin = new MockWindow(false);
23898
- if (!opts.customElementProxy) {
23899
- srcWin.customElements = null;
23900
- }
23901
- if (srcWin.document != null) {
23902
- const clonedDoc = new MockDocument(false, clonedWin);
23903
- clonedWin.document = clonedDoc;
23904
- clonedDoc.documentElement = srcWin.document.documentElement.cloneNode(true);
23905
- } else {
23906
- clonedWin.document = new MockDocument(null, clonedWin);
23907
- }
23908
- return clonedWin;
23909
- }
23910
- function constrainTimeouts(win2) {
23911
- win2.__allowInterval = false;
23912
- win2.__maxTimeout = 0;
23913
- }
23914
- function resetWindow(win2) {
23915
- if (win2 != null) {
23916
- if (win2.__timeouts) {
23917
- win2.__timeouts.forEach((timeoutId) => {
23918
- nativeClearInterval(timeoutId);
23919
- nativeClearTimeout(timeoutId);
23920
- });
23921
- win2.__timeouts.clear();
23922
- }
23923
- if (win2.customElements && win2.customElements.clear) {
23924
- win2.customElements.clear();
23925
- }
23926
- resetDocument(win2.document);
23927
- resetPerformance(win2.performance);
23928
- for (const key in win2) {
23929
- if (win2.hasOwnProperty(key) && key !== "document" && key !== "performance" && key !== "customElements") {
23930
- delete win2[key];
23931
- }
23932
- }
23933
- resetWindowDefaults(win2);
23934
- resetWindowDimensions(win2);
23935
- resetEventListeners(win2);
23936
- if (win2.document != null) {
23937
- try {
23938
- win2.document.defaultView = win2;
23939
- } catch (e) {
23940
- }
23941
- }
23942
- win2.fetch = null;
23943
- win2.Headers = null;
23944
- win2.Request = null;
23945
- win2.Response = null;
23946
- win2.FetchError = null;
23947
- }
23948
- }
23949
- function resetWindowDimensions(win2) {
23950
- try {
23951
- win2.devicePixelRatio = 1;
23952
- win2.innerHeight = 768;
23953
- win2.innerWidth = 1366;
23954
- win2.pageXOffset = 0;
23955
- win2.pageYOffset = 0;
23956
- win2.screenLeft = 0;
23957
- win2.screenTop = 0;
23958
- win2.screenX = 0;
23959
- win2.screenY = 0;
23960
- win2.scrollX = 0;
23961
- win2.scrollY = 0;
23962
- win2.screen = {
23963
- availHeight: win2.innerHeight,
23964
- availLeft: 0,
23965
- availTop: 0,
23966
- availWidth: win2.innerWidth,
23967
- colorDepth: 24,
23968
- height: win2.innerHeight,
23969
- keepAwake: false,
23970
- orientation: {
23971
- angle: 0,
23972
- type: "portrait-primary"
23973
- },
23974
- pixelDepth: 24,
23975
- width: win2.innerWidth
23976
- };
23977
- } catch (e) {
23978
- }
23979
- }
23980
-
23981
- // src/mock-doc/document.ts
23982
- var MockDocument = class _MockDocument extends MockHTMLElement {
23983
- constructor(html = null, win2 = null) {
23984
- super(null, null);
23985
- this.nodeName = "#document" /* DOCUMENT_NODE */;
23986
- this.nodeType = 9 /* DOCUMENT_NODE */;
23987
- this.defaultView = win2;
23988
- this.cookie = "";
23989
- this.referrer = "";
23990
- this.appendChild(this.createDocumentTypeNode());
23991
- if (typeof html === "string") {
23992
- const parsedDoc = parseDocumentUtil(this, html);
23993
- const documentElement = parsedDoc.children.find((elm) => elm.nodeName === "HTML");
23994
- if (documentElement != null) {
23995
- this.appendChild(documentElement);
23996
- setOwnerDocument(documentElement, this);
23997
- }
23998
- } else if (html !== false) {
23999
- const documentElement = new MockHTMLElement(this, "html");
24000
- this.appendChild(documentElement);
24001
- documentElement.appendChild(new MockHTMLElement(this, "head"));
24002
- documentElement.appendChild(new MockHTMLElement(this, "body"));
24003
- }
24004
- }
24005
- get dir() {
24006
- return this.documentElement.dir;
24007
- }
24008
- set dir(value) {
24009
- this.documentElement.dir = value;
24010
- }
24011
- get localName() {
24012
- throw new Error("Unimplemented");
24013
- }
24014
- get location() {
24015
- if (this.defaultView != null) {
24016
- return this.defaultView.location;
24017
- }
24018
- return null;
24019
- }
24020
- set location(val) {
24021
- if (this.defaultView != null) {
24022
- this.defaultView.location.href = val;
24023
- }
24024
- }
24025
- get baseURI() {
24026
- const baseNode = this.head.childNodes.find((node) => node.nodeName === "BASE");
24027
- if (baseNode) {
24028
- return baseNode.href;
24029
- }
24030
- return this.URL;
24031
- }
24032
- get URL() {
24033
- return this.location.href;
24034
- }
24035
- get styleSheets() {
24036
- return this.querySelectorAll("style");
24037
- }
24038
- get scripts() {
24039
- return this.querySelectorAll("script");
24040
- }
24041
- get forms() {
24042
- return this.querySelectorAll("form");
24043
- }
24044
- get images() {
24045
- return this.querySelectorAll("img");
24046
- }
24047
- get scrollingElement() {
24048
- return this.documentElement;
24049
- }
24050
- get documentElement() {
24051
- for (let i = this.childNodes.length - 1; i >= 0; i--) {
24052
- if (this.childNodes[i].nodeName === "HTML") {
24053
- return this.childNodes[i];
24054
- }
24055
- }
24056
- const documentElement = new MockHTMLElement(this, "html");
24057
- this.appendChild(documentElement);
24058
- return documentElement;
24411
+ onpointerover() {
24059
24412
  }
24060
- set documentElement(documentElement) {
24061
- for (let i = this.childNodes.length - 1; i >= 0; i--) {
24062
- if (this.childNodes[i].nodeType !== 10 /* DOCUMENT_TYPE_NODE */) {
24063
- this.childNodes[i].remove();
24064
- }
24065
- }
24066
- if (documentElement != null) {
24067
- this.appendChild(documentElement);
24068
- setOwnerDocument(documentElement, this);
24069
- }
24413
+ onpointerup() {
24070
24414
  }
24071
- get head() {
24072
- const documentElement = this.documentElement;
24073
- for (let i = 0; i < documentElement.childNodes.length; i++) {
24074
- if (documentElement.childNodes[i].nodeName === "HEAD") {
24075
- return documentElement.childNodes[i];
24076
- }
24077
- }
24078
- const head = new MockHTMLElement(this, "head");
24079
- documentElement.insertBefore(head, documentElement.firstChild);
24080
- return head;
24415
+ onprogress() {
24081
24416
  }
24082
- set head(head) {
24083
- const documentElement = this.documentElement;
24084
- for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
24085
- if (documentElement.childNodes[i].nodeName === "HEAD") {
24086
- documentElement.childNodes[i].remove();
24087
- }
24088
- }
24089
- if (head != null) {
24090
- documentElement.insertBefore(head, documentElement.firstChild);
24091
- setOwnerDocument(head, this);
24092
- }
24417
+ onratechange() {
24093
24418
  }
24094
- get body() {
24095
- const documentElement = this.documentElement;
24096
- for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
24097
- if (documentElement.childNodes[i].nodeName === "BODY") {
24098
- return documentElement.childNodes[i];
24099
- }
24100
- }
24101
- const body = new MockHTMLElement(this, "body");
24102
- documentElement.appendChild(body);
24103
- return body;
24419
+ onreset() {
24104
24420
  }
24105
- set body(body) {
24106
- const documentElement = this.documentElement;
24107
- for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
24108
- if (documentElement.childNodes[i].nodeName === "BODY") {
24109
- documentElement.childNodes[i].remove();
24110
- }
24111
- }
24112
- if (body != null) {
24113
- documentElement.appendChild(body);
24114
- setOwnerDocument(body, this);
24115
- }
24421
+ onresize() {
24116
24422
  }
24117
- appendChild(newNode) {
24118
- newNode.remove();
24119
- newNode.parentNode = this;
24120
- this.childNodes.push(newNode);
24121
- return newNode;
24423
+ onscroll() {
24122
24424
  }
24123
- createComment(data) {
24124
- return new MockComment(this, data);
24425
+ onsearch() {
24125
24426
  }
24126
- createAttribute(attrName) {
24127
- return new MockAttr(attrName.toLowerCase(), "");
24427
+ onseeked() {
24128
24428
  }
24129
- createAttributeNS(namespaceURI, attrName) {
24130
- return new MockAttr(attrName, "", namespaceURI);
24429
+ onseeking() {
24131
24430
  }
24132
- createElement(tagName) {
24133
- if (tagName === "#document" /* DOCUMENT_NODE */) {
24134
- const doc = new _MockDocument(false);
24135
- doc.nodeName = tagName;
24136
- doc.parentNode = null;
24137
- return doc;
24138
- }
24139
- return createElement(this, tagName);
24431
+ onselect() {
24140
24432
  }
24141
- createElementNS(namespaceURI, tagName) {
24142
- const elmNs = createElementNS(this, namespaceURI, tagName);
24143
- return elmNs;
24433
+ onselectstart() {
24144
24434
  }
24145
- createTextNode(text) {
24146
- return new MockTextNode(this, text);
24435
+ onstalled() {
24147
24436
  }
24148
- createDocumentFragment() {
24149
- return new MockDocumentFragment(this);
24437
+ onsubmit() {
24150
24438
  }
24151
- createDocumentTypeNode() {
24152
- return new MockDocumentTypeNode(this);
24439
+ onsuspend() {
24153
24440
  }
24154
- getElementById(id) {
24155
- return getElementById(this, id);
24441
+ ontimeupdate() {
24156
24442
  }
24157
- getElementsByName(elmName) {
24158
- return getElementsByName(this, elmName.toLowerCase());
24443
+ ontoggle() {
24159
24444
  }
24160
- get title() {
24161
- const title = this.head.childNodes.find((elm) => elm.nodeName === "TITLE");
24162
- if (title != null && typeof title.textContent === "string") {
24163
- return title.textContent.trim();
24164
- }
24165
- return "";
24445
+ onvolumechange() {
24166
24446
  }
24167
- set title(value) {
24168
- const head = this.head;
24169
- let title = head.childNodes.find((elm) => elm.nodeName === "TITLE");
24170
- if (title == null) {
24171
- title = this.createElement("title");
24172
- head.appendChild(title);
24173
- }
24174
- title.textContent = value;
24447
+ onwaiting() {
24448
+ }
24449
+ onwebkitfullscreenchange() {
24450
+ }
24451
+ onwebkitfullscreenerror() {
24452
+ }
24453
+ onwheel() {
24175
24454
  }
24176
24455
  };
24177
- function resetDocument(doc) {
24178
- if (doc != null) {
24179
- resetEventListeners(doc);
24180
- const documentElement = doc.documentElement;
24181
- if (documentElement != null) {
24182
- resetElement(documentElement);
24183
- for (let i = 0, ii = documentElement.childNodes.length; i < ii; i++) {
24184
- const childNode = documentElement.childNodes[i];
24185
- resetElement(childNode);
24186
- childNode.childNodes.length = 0;
24187
- }
24188
- }
24189
- for (const key in doc) {
24190
- if (doc.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
24191
- delete doc[key];
24192
- }
24193
- }
24194
- try {
24195
- doc.nodeName = "#document" /* DOCUMENT_NODE */;
24196
- } catch (e) {
24197
- }
24198
- try {
24199
- doc.nodeType = 9 /* DOCUMENT_NODE */;
24200
- } catch (e) {
24201
- }
24202
- try {
24203
- doc.cookie = "";
24204
- } catch (e) {
24205
- }
24206
- try {
24207
- doc.referrer = "";
24208
- } catch (e) {
24209
- }
24456
+ addGlobalsToWindowPrototype(MockWindow.prototype);
24457
+ function resetWindowDefaults(win2) {
24458
+ win2.__clearInterval = nativeClearInterval;
24459
+ win2.__clearTimeout = nativeClearTimeout;
24460
+ win2.__setInterval = nativeSetInterval;
24461
+ win2.__setTimeout = nativeSetTimeout;
24462
+ win2.__maxTimeout = 6e4;
24463
+ win2.__allowInterval = true;
24464
+ win2.URL = nativeURL;
24465
+ }
24466
+ function cloneWindow(srcWin, opts = {}) {
24467
+ if (srcWin == null) {
24468
+ return null;
24469
+ }
24470
+ const clonedWin = new MockWindow(false);
24471
+ if (!opts.customElementProxy) {
24472
+ srcWin.customElements = null;
24473
+ }
24474
+ if (srcWin.document != null) {
24475
+ const clonedDoc = new MockDocument(false, clonedWin);
24476
+ clonedWin.document = clonedDoc;
24477
+ clonedDoc.documentElement = srcWin.document.documentElement.cloneNode(true);
24478
+ } else {
24479
+ clonedWin.document = new MockDocument(null, clonedWin);
24210
24480
  }
24481
+ return clonedWin;
24211
24482
  }
24212
- var DOC_KEY_KEEPERS = /* @__PURE__ */ new Set([
24213
- "nodeName",
24214
- "nodeType",
24215
- "nodeValue",
24216
- "ownerDocument",
24217
- "parentNode",
24218
- "childNodes",
24219
- "_shadowRoot"
24220
- ]);
24221
- function getElementById(elm, id) {
24222
- const children = elm.children;
24223
- for (let i = 0, ii = children.length; i < ii; i++) {
24224
- const childElm = children[i];
24225
- if (childElm.id === id) {
24226
- return childElm;
24483
+ function constrainTimeouts(win2) {
24484
+ win2.__allowInterval = false;
24485
+ win2.__maxTimeout = 0;
24486
+ }
24487
+ function resetWindow(win2) {
24488
+ if (win2 != null) {
24489
+ if (win2.__timeouts) {
24490
+ win2.__timeouts.forEach((timeoutId) => {
24491
+ nativeClearInterval(timeoutId);
24492
+ nativeClearTimeout(timeoutId);
24493
+ });
24494
+ win2.__timeouts.clear();
24227
24495
  }
24228
- const childElmFound = getElementById(childElm, id);
24229
- if (childElmFound != null) {
24230
- return childElmFound;
24496
+ if (win2.customElements && win2.customElements.clear) {
24497
+ win2.customElements.clear();
24231
24498
  }
24232
- }
24233
- return null;
24234
- }
24235
- function getElementsByName(elm, elmName, foundElms = []) {
24236
- const children = elm.children;
24237
- for (let i = 0, ii = children.length; i < ii; i++) {
24238
- const childElm = children[i];
24239
- if (childElm.name && childElm.name.toLowerCase() === elmName) {
24240
- foundElms.push(childElm);
24499
+ resetDocument(win2.document);
24500
+ resetPerformance(win2.performance);
24501
+ for (const key in win2) {
24502
+ if (win2.hasOwnProperty(key) && key !== "document" && key !== "performance" && key !== "customElements") {
24503
+ delete win2[key];
24504
+ }
24241
24505
  }
24242
- getElementsByName(childElm, elmName, foundElms);
24243
- }
24244
- return foundElms;
24245
- }
24246
- function setOwnerDocument(elm, ownerDocument) {
24247
- for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
24248
- elm.childNodes[i].ownerDocument = ownerDocument;
24249
- if (elm.childNodes[i].nodeType === 1 /* ELEMENT_NODE */) {
24250
- setOwnerDocument(elm.childNodes[i], ownerDocument);
24506
+ resetWindowDefaults(win2);
24507
+ resetWindowDimensions(win2);
24508
+ resetEventListeners(win2);
24509
+ if (win2.document != null) {
24510
+ try {
24511
+ win2.document.defaultView = win2;
24512
+ } catch (e) {
24513
+ }
24251
24514
  }
24515
+ win2.fetch = null;
24516
+ win2.Headers = null;
24517
+ win2.Request = null;
24518
+ win2.Response = null;
24519
+ win2.FetchError = null;
24252
24520
  }
24253
24521
  }
24254
-
24255
- // src/hydrate/runner/create-window.ts
24256
- var templateWindows = /* @__PURE__ */ new Map();
24257
- function createWindowFromHtml(templateHtml, uniqueId) {
24258
- let templateWindow = templateWindows.get(uniqueId);
24259
- if (templateWindow == null) {
24260
- templateWindow = new MockWindow(templateHtml);
24261
- templateWindows.set(uniqueId, templateWindow);
24262
- }
24263
- const win2 = cloneWindow(templateWindow);
24264
- return win2;
24265
- }
24266
- var Build = {
24267
- isDev: BUILD.isDev ? true : false,
24268
- isBrowser: true,
24269
- isServer: false,
24270
- isTesting: BUILD.isTesting ? true : false
24271
- };
24272
-
24273
- // src/utils/constants.ts
24274
- var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
24275
- PrimitiveType2["Undefined"] = "undefined";
24276
- PrimitiveType2["Null"] = "null";
24277
- PrimitiveType2["String"] = "string";
24278
- PrimitiveType2["Number"] = "number";
24279
- PrimitiveType2["SpecialNumber"] = "number";
24280
- PrimitiveType2["Boolean"] = "boolean";
24281
- PrimitiveType2["BigInt"] = "bigint";
24282
- return PrimitiveType2;
24283
- })(PrimitiveType || {});
24284
- var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
24285
- NonPrimitiveType2["Array"] = "array";
24286
- NonPrimitiveType2["Date"] = "date";
24287
- NonPrimitiveType2["Map"] = "map";
24288
- NonPrimitiveType2["Object"] = "object";
24289
- NonPrimitiveType2["RegularExpression"] = "regexp";
24290
- NonPrimitiveType2["Set"] = "set";
24291
- NonPrimitiveType2["Channel"] = "channel";
24292
- NonPrimitiveType2["Symbol"] = "symbol";
24293
- return NonPrimitiveType2;
24294
- })(NonPrimitiveType || {});
24295
- var TYPE_CONSTANT = "type";
24296
- var VALUE_CONSTANT = "value";
24297
- var SERIALIZED_PREFIX = "serialized:";
24298
- var STENCIL_DEV_MODE = BUILD.isTesting ? ["STENCIL:"] : [
24299
- "%cstencil",
24300
- "color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
24301
- ];
24302
- var win = typeof window !== "undefined" ? window : {};
24303
- var H = win.HTMLElement || class {
24304
- };
24305
- var supportsShadow = BUILD.shadowDom;
24306
- var supportsConstructableStylesheets = BUILD.constructableCSS ? /* @__PURE__ */ (() => {
24522
+ function resetWindowDimensions(win2) {
24307
24523
  try {
24308
- new CSSStyleSheet();
24309
- return typeof new CSSStyleSheet().replaceSync === "function";
24524
+ win2.devicePixelRatio = 1;
24525
+ win2.innerHeight = 768;
24526
+ win2.innerWidth = 1366;
24527
+ win2.pageXOffset = 0;
24528
+ win2.pageYOffset = 0;
24529
+ win2.screenLeft = 0;
24530
+ win2.screenTop = 0;
24531
+ win2.screenX = 0;
24532
+ win2.screenY = 0;
24533
+ win2.scrollX = 0;
24534
+ win2.scrollY = 0;
24535
+ win2.screen = {
24536
+ availHeight: win2.innerHeight,
24537
+ availLeft: 0,
24538
+ availTop: 0,
24539
+ availWidth: win2.innerWidth,
24540
+ colorDepth: 24,
24541
+ height: win2.innerHeight,
24542
+ keepAwake: false,
24543
+ orientation: {
24544
+ angle: 0,
24545
+ type: "portrait-primary"
24546
+ },
24547
+ pixelDepth: 24,
24548
+ width: win2.innerWidth
24549
+ };
24310
24550
  } catch (e) {
24311
24551
  }
24312
- return false;
24313
- })() : false;
24314
-
24315
- // src/utils/helpers.ts
24316
- var isString = (v) => typeof v === "string";
24552
+ }
24317
24553
 
24318
- // src/utils/local-value.ts
24319
- var LocalValue = class _LocalValue {
24320
- constructor(type, value) {
24321
- if (type === "undefined" /* Undefined */ || type === "null" /* Null */) {
24322
- this.type = type;
24323
- } else {
24324
- this.type = type;
24325
- this.value = value;
24554
+ // src/mock-doc/document.ts
24555
+ var MockDocument = class _MockDocument extends MockHTMLElement {
24556
+ constructor(html = null, win2 = null) {
24557
+ super(null, null);
24558
+ this.nodeName = "#document" /* DOCUMENT_NODE */;
24559
+ this.nodeType = 9 /* DOCUMENT_NODE */;
24560
+ this.defaultView = win2;
24561
+ this.cookie = "";
24562
+ this.referrer = "";
24563
+ this.appendChild(this.createDocumentTypeNode());
24564
+ if (typeof html === "string") {
24565
+ const parsedDoc = parseDocumentUtil(this, html);
24566
+ const documentElement = parsedDoc.children.find((elm) => elm.nodeName === "HTML");
24567
+ if (documentElement != null) {
24568
+ this.appendChild(documentElement);
24569
+ setOwnerDocument(documentElement, this);
24570
+ }
24571
+ } else if (html !== false) {
24572
+ const documentElement = new MockHTMLElement(this, "html");
24573
+ this.appendChild(documentElement);
24574
+ documentElement.appendChild(new MockHTMLElement(this, "head"));
24575
+ documentElement.appendChild(new MockHTMLElement(this, "body"));
24326
24576
  }
24327
24577
  }
24328
- /**
24329
- * Creates a new LocalValue object with a string value.
24330
- *
24331
- * @param {string} value - The string value to be stored in the LocalValue object.
24332
- * @returns {LocalValue} - The created LocalValue object.
24333
- */
24334
- static createStringValue(value) {
24335
- return new _LocalValue("string" /* String */, value);
24578
+ get dir() {
24579
+ return this.documentElement.dir;
24336
24580
  }
24337
- /**
24338
- * Creates a new LocalValue object with a number value.
24339
- *
24340
- * @param {number} value - The number value.
24341
- * @returns {LocalValue} - The created LocalValue object.
24342
- */
24343
- static createNumberValue(value) {
24344
- return new _LocalValue("number" /* Number */, value);
24581
+ set dir(value) {
24582
+ this.documentElement.dir = value;
24345
24583
  }
24346
- /**
24347
- * Creates a new LocalValue object with a special number value.
24348
- *
24349
- * @param {number} value - The value of the special number.
24350
- * @returns {LocalValue} - The created LocalValue object.
24351
- */
24352
- static createSpecialNumberValue(value) {
24353
- if (Number.isNaN(value)) {
24354
- return new _LocalValue("number" /* SpecialNumber */, "NaN");
24355
- }
24356
- if (Object.is(value, -0)) {
24357
- return new _LocalValue("number" /* SpecialNumber */, "-0");
24358
- }
24359
- if (value === Infinity) {
24360
- return new _LocalValue("number" /* SpecialNumber */, "Infinity");
24361
- }
24362
- if (value === -Infinity) {
24363
- return new _LocalValue("number" /* SpecialNumber */, "-Infinity");
24364
- }
24365
- return new _LocalValue("number" /* SpecialNumber */, value);
24584
+ get localName() {
24585
+ throw new Error("Unimplemented");
24366
24586
  }
24367
- /**
24368
- * Creates a new LocalValue object with an undefined value.
24369
- * @returns {LocalValue} - The created LocalValue object.
24370
- */
24371
- static createUndefinedValue() {
24372
- return new _LocalValue("undefined" /* Undefined */);
24587
+ get location() {
24588
+ if (this.defaultView != null) {
24589
+ return this.defaultView.location;
24590
+ }
24591
+ return null;
24373
24592
  }
24374
- /**
24375
- * Creates a new LocalValue object with a null value.
24376
- * @returns {LocalValue} - The created LocalValue object.
24377
- */
24378
- static createNullValue() {
24379
- return new _LocalValue("null" /* Null */);
24593
+ set location(val) {
24594
+ if (this.defaultView != null) {
24595
+ this.defaultView.location.href = val;
24596
+ }
24380
24597
  }
24381
- /**
24382
- * Creates a new LocalValue object with a boolean value.
24383
- *
24384
- * @param {boolean} value - The boolean value.
24385
- * @returns {LocalValue} - The created LocalValue object.
24386
- */
24387
- static createBooleanValue(value) {
24388
- return new _LocalValue("boolean" /* Boolean */, value);
24598
+ get baseURI() {
24599
+ const baseNode = this.head.childNodes.find((node) => node.nodeName === "BASE");
24600
+ if (baseNode) {
24601
+ return baseNode.href;
24602
+ }
24603
+ return this.URL;
24389
24604
  }
24390
- /**
24391
- * Creates a new LocalValue object with a BigInt value.
24392
- *
24393
- * @param {BigInt} value - The BigInt value.
24394
- * @returns {LocalValue} - The created LocalValue object.
24395
- */
24396
- static createBigIntValue(value) {
24397
- return new _LocalValue("bigint" /* BigInt */, value.toString());
24605
+ get URL() {
24606
+ return this.location.href;
24398
24607
  }
24399
- /**
24400
- * Creates a new LocalValue object with an array.
24401
- *
24402
- * @param {Array} value - The array.
24403
- * @returns {LocalValue} - The created LocalValue object.
24404
- */
24405
- static createArrayValue(value) {
24406
- return new _LocalValue("array" /* Array */, value);
24608
+ get styleSheets() {
24609
+ return this.querySelectorAll("style");
24407
24610
  }
24408
- /**
24409
- * Creates a new LocalValue object with date value.
24410
- *
24411
- * @param {string} value - The date.
24412
- * @returns {LocalValue} - The created LocalValue object.
24413
- */
24414
- static createDateValue(value) {
24415
- return new _LocalValue("date" /* Date */, value);
24611
+ get scripts() {
24612
+ return this.querySelectorAll("script");
24416
24613
  }
24417
- /**
24418
- * Creates a new LocalValue object of map value.
24419
- * @param {Map} map - The map.
24420
- * @returns {LocalValue} - The created LocalValue object.
24421
- */
24422
- static createMapValue(map2) {
24423
- const value = [];
24424
- Array.from(map2.entries()).forEach(([key, val]) => {
24425
- value.push([_LocalValue.getArgument(key), _LocalValue.getArgument(val)]);
24426
- });
24427
- return new _LocalValue("map" /* Map */, value);
24614
+ get forms() {
24615
+ return this.querySelectorAll("form");
24428
24616
  }
24429
- /**
24430
- * Creates a new LocalValue object from the passed object.
24431
- *
24432
- * @param object the object to create a LocalValue from
24433
- * @returns {LocalValue} - The created LocalValue object.
24434
- */
24435
- static createObjectValue(object) {
24436
- const value = [];
24437
- Object.entries(object).forEach(([key, val]) => {
24438
- value.push([key, _LocalValue.getArgument(val)]);
24439
- });
24440
- return new _LocalValue("object" /* Object */, value);
24617
+ get images() {
24618
+ return this.querySelectorAll("img");
24441
24619
  }
24442
- /**
24443
- * Creates a new LocalValue object of regular expression value.
24444
- *
24445
- * @param {string} value - The value of the regular expression.
24446
- * @returns {LocalValue} - The created LocalValue object.
24447
- */
24448
- static createRegularExpressionValue(value) {
24449
- return new _LocalValue("regexp" /* RegularExpression */, value);
24620
+ get scrollingElement() {
24621
+ return this.documentElement;
24450
24622
  }
24451
- /**
24452
- * Creates a new LocalValue object with the specified value.
24453
- * @param {Set} value - The value to be set.
24454
- * @returns {LocalValue} - The created LocalValue object.
24455
- */
24456
- static createSetValue(value) {
24457
- return new _LocalValue("set" /* Set */, value);
24623
+ get documentElement() {
24624
+ for (let i = this.childNodes.length - 1; i >= 0; i--) {
24625
+ if (this.childNodes[i].nodeName === "HTML") {
24626
+ return this.childNodes[i];
24627
+ }
24628
+ }
24629
+ const documentElement = new MockHTMLElement(this, "html");
24630
+ this.appendChild(documentElement);
24631
+ return documentElement;
24458
24632
  }
24459
- /**
24460
- * Creates a new LocalValue object with the given channel value
24461
- *
24462
- * @param {ChannelValue} value - The channel value.
24463
- * @returns {LocalValue} - The created LocalValue object.
24464
- */
24465
- static createChannelValue(value) {
24466
- return new _LocalValue("channel" /* Channel */, value);
24633
+ set documentElement(documentElement) {
24634
+ for (let i = this.childNodes.length - 1; i >= 0; i--) {
24635
+ if (this.childNodes[i].nodeType !== 10 /* DOCUMENT_TYPE_NODE */) {
24636
+ this.childNodes[i].remove();
24637
+ }
24638
+ }
24639
+ if (documentElement != null) {
24640
+ this.appendChild(documentElement);
24641
+ setOwnerDocument(documentElement, this);
24642
+ }
24467
24643
  }
24468
- /**
24469
- * Creates a new LocalValue object with a Symbol value.
24470
- *
24471
- * @param {Symbol} symbol - The Symbol value
24472
- * @returns {LocalValue} - The created LocalValue object
24473
- */
24474
- static createSymbolValue(symbol) {
24475
- const description = symbol.description || "Symbol()";
24476
- return new _LocalValue("symbol" /* Symbol */, description);
24644
+ get head() {
24645
+ const documentElement = this.documentElement;
24646
+ for (let i = 0; i < documentElement.childNodes.length; i++) {
24647
+ if (documentElement.childNodes[i].nodeName === "HEAD") {
24648
+ return documentElement.childNodes[i];
24649
+ }
24650
+ }
24651
+ const head = new MockHTMLElement(this, "head");
24652
+ documentElement.insertBefore(head, documentElement.firstChild);
24653
+ return head;
24477
24654
  }
24478
- static getArgument(argument) {
24479
- const type = typeof argument;
24480
- switch (type) {
24481
- case "string" /* String */:
24482
- return _LocalValue.createStringValue(argument);
24483
- case "number" /* Number */:
24484
- if (Number.isNaN(argument) || Object.is(argument, -0) || !Number.isFinite(argument)) {
24485
- return _LocalValue.createSpecialNumberValue(argument);
24486
- }
24487
- return _LocalValue.createNumberValue(argument);
24488
- case "boolean" /* Boolean */:
24489
- return _LocalValue.createBooleanValue(argument);
24490
- case "bigint" /* BigInt */:
24491
- return _LocalValue.createBigIntValue(argument);
24492
- case "undefined" /* Undefined */:
24493
- return _LocalValue.createUndefinedValue();
24494
- case "symbol" /* Symbol */:
24495
- return _LocalValue.createSymbolValue(argument);
24496
- case "object" /* Object */:
24497
- if (argument === null) {
24498
- return _LocalValue.createNullValue();
24499
- }
24500
- if (argument instanceof Date) {
24501
- return _LocalValue.createDateValue(argument);
24502
- }
24503
- if (argument instanceof Map) {
24504
- const map2 = [];
24505
- argument.forEach((value, key) => {
24506
- const objectKey = typeof key === "string" ? key : _LocalValue.getArgument(key);
24507
- const objectValue = _LocalValue.getArgument(value);
24508
- map2.push([objectKey, objectValue]);
24509
- });
24510
- return _LocalValue.createMapValue(argument);
24511
- }
24512
- if (argument instanceof Set) {
24513
- const set = [];
24514
- argument.forEach((value) => {
24515
- set.push(_LocalValue.getArgument(value));
24516
- });
24517
- return _LocalValue.createSetValue(set);
24518
- }
24519
- if (argument instanceof Array) {
24520
- const arr = [];
24521
- argument.forEach((value) => {
24522
- arr.push(_LocalValue.getArgument(value));
24523
- });
24524
- return _LocalValue.createArrayValue(arr);
24525
- }
24526
- if (argument instanceof RegExp) {
24527
- return _LocalValue.createRegularExpressionValue({
24528
- pattern: argument.source,
24529
- flags: argument.flags
24530
- });
24531
- }
24532
- return _LocalValue.createObjectValue(argument);
24655
+ set head(head) {
24656
+ const documentElement = this.documentElement;
24657
+ for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
24658
+ if (documentElement.childNodes[i].nodeName === "HEAD") {
24659
+ documentElement.childNodes[i].remove();
24660
+ }
24661
+ }
24662
+ if (head != null) {
24663
+ documentElement.insertBefore(head, documentElement.firstChild);
24664
+ setOwnerDocument(head, this);
24533
24665
  }
24534
- throw new Error(`Unsupported type: ${type}`);
24535
24666
  }
24536
- asMap() {
24537
- return {
24538
- [TYPE_CONSTANT]: this.type,
24539
- ...!(this.type === "null" /* Null */ || this.type === "undefined" /* Undefined */) ? { [VALUE_CONSTANT]: this.value } : {}
24540
- };
24667
+ get body() {
24668
+ const documentElement = this.documentElement;
24669
+ for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
24670
+ if (documentElement.childNodes[i].nodeName === "BODY") {
24671
+ return documentElement.childNodes[i];
24672
+ }
24673
+ }
24674
+ const body = new MockHTMLElement(this, "body");
24675
+ documentElement.appendChild(body);
24676
+ return body;
24541
24677
  }
24542
- };
24543
-
24544
- // src/utils/message-utils.ts
24545
- var catchError = (diagnostics, err2, msg) => {
24546
- const diagnostic = {
24547
- level: "error",
24548
- type: "build",
24549
- header: "Build Error",
24550
- messageText: "build error",
24551
- lines: []
24552
- };
24553
- if (isString(msg)) {
24554
- diagnostic.messageText = msg.length ? msg : "UNKNOWN ERROR";
24555
- } else if (err2 != null) {
24556
- if (err2.stack != null) {
24557
- diagnostic.messageText = err2.stack.toString();
24558
- } else {
24559
- if (err2.message != null) {
24560
- diagnostic.messageText = err2.message.length ? err2.message : "UNKNOWN ERROR";
24561
- } else {
24562
- diagnostic.messageText = err2.toString();
24678
+ set body(body) {
24679
+ const documentElement = this.documentElement;
24680
+ for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
24681
+ if (documentElement.childNodes[i].nodeName === "BODY") {
24682
+ documentElement.childNodes[i].remove();
24563
24683
  }
24564
24684
  }
24685
+ if (body != null) {
24686
+ documentElement.appendChild(body);
24687
+ setOwnerDocument(body, this);
24688
+ }
24565
24689
  }
24566
- if (diagnostics != null && !shouldIgnoreError(diagnostic.messageText)) {
24567
- diagnostics.push(diagnostic);
24690
+ appendChild(newNode) {
24691
+ newNode.remove();
24692
+ newNode.parentNode = this;
24693
+ this.childNodes.push(newNode);
24694
+ return newNode;
24568
24695
  }
24569
- return diagnostic;
24570
- };
24571
- var hasError = (diagnostics) => {
24572
- if (diagnostics == null || diagnostics.length === 0) {
24573
- return false;
24696
+ createComment(data) {
24697
+ return new MockComment(this, data);
24574
24698
  }
24575
- return diagnostics.some((d) => d.level === "error" && d.type !== "runtime");
24576
- };
24577
- var shouldIgnoreError = (msg) => {
24578
- return msg === TASK_CANCELED_MSG;
24579
- };
24580
- var TASK_CANCELED_MSG = `task canceled`;
24581
-
24582
- // src/utils/regular-expression.ts
24583
- var escapeRegExpSpecialCharacters = (text) => {
24584
- return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
24585
- };
24586
-
24587
- // src/utils/remote-value.ts
24588
- var RemoteValue = class _RemoteValue {
24589
- /**
24590
- * Deserializes a LocalValue serialized object back to its original JavaScript representation
24591
- *
24592
- * @param serialized The serialized LocalValue object
24593
- * @returns The original JavaScript value/object
24594
- */
24595
- static fromLocalValue(serialized) {
24596
- const type = serialized[TYPE_CONSTANT];
24597
- const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
24598
- switch (type) {
24599
- case "string" /* String */:
24600
- return value;
24601
- case "boolean" /* Boolean */:
24602
- return value;
24603
- case "bigint" /* BigInt */:
24604
- return BigInt(value);
24605
- case "undefined" /* Undefined */:
24606
- return void 0;
24607
- case "null" /* Null */:
24608
- return null;
24609
- case "number" /* Number */:
24610
- if (value === "NaN") return NaN;
24611
- if (value === "-0") return -0;
24612
- if (value === "Infinity") return Infinity;
24613
- if (value === "-Infinity") return -Infinity;
24614
- return value;
24615
- case "array" /* Array */:
24616
- return value.map((item) => _RemoteValue.fromLocalValue(item));
24617
- case "date" /* Date */:
24618
- return new Date(value);
24619
- case "map" /* Map */:
24620
- const map2 = /* @__PURE__ */ new Map();
24621
- for (const [key, val] of value) {
24622
- const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
24623
- const deserializedValue = _RemoteValue.fromLocalValue(val);
24624
- map2.set(deserializedKey, deserializedValue);
24625
- }
24626
- return map2;
24627
- case "object" /* Object */:
24628
- const obj = {};
24629
- for (const [key, val] of value) {
24630
- obj[key] = _RemoteValue.fromLocalValue(val);
24631
- }
24632
- return obj;
24633
- case "regexp" /* RegularExpression */:
24634
- const { pattern, flags } = value;
24635
- return new RegExp(pattern, flags);
24636
- case "set" /* Set */:
24637
- const set = /* @__PURE__ */ new Set();
24638
- for (const item of value) {
24639
- set.add(_RemoteValue.fromLocalValue(item));
24640
- }
24641
- return set;
24642
- case "symbol" /* Symbol */:
24643
- return Symbol(value);
24644
- default:
24645
- throw new Error(`Unsupported type: ${type}`);
24699
+ createAttribute(attrName) {
24700
+ return new MockAttr(attrName.toLowerCase(), "");
24701
+ }
24702
+ createAttributeNS(namespaceURI, attrName) {
24703
+ return new MockAttr(attrName, "", namespaceURI);
24704
+ }
24705
+ createElement(tagName) {
24706
+ if (tagName === "#document" /* DOCUMENT_NODE */) {
24707
+ const doc = new _MockDocument(false);
24708
+ doc.nodeName = tagName;
24709
+ doc.parentNode = null;
24710
+ return doc;
24646
24711
  }
24712
+ return createElement(this, tagName);
24647
24713
  }
24648
- /**
24649
- * Utility method to deserialize multiple LocalValues at once
24650
- *
24651
- * @param serializedValues Array of serialized LocalValue objects
24652
- * @returns Array of deserialized JavaScript values
24653
- */
24654
- static fromLocalValueArray(serializedValues) {
24655
- return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
24714
+ createElementNS(namespaceURI, tagName) {
24715
+ const elmNs = createElementNS(this, namespaceURI, tagName);
24716
+ return elmNs;
24656
24717
  }
24657
- /**
24658
- * Verifies if the given object matches the structure of a serialized LocalValue
24659
- *
24660
- * @param obj Object to verify
24661
- * @returns boolean indicating if the object has LocalValue structure
24662
- */
24663
- static isLocalValueObject(obj) {
24664
- if (typeof obj !== "object" || obj === null) {
24665
- return false;
24666
- }
24667
- if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
24668
- return false;
24669
- }
24670
- const type = obj[TYPE_CONSTANT];
24671
- const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
24672
- if (!hasTypeProperty) {
24673
- return false;
24718
+ createTextNode(text) {
24719
+ return new MockTextNode(this, text);
24720
+ }
24721
+ createDocumentFragment() {
24722
+ return new MockDocumentFragment(this);
24723
+ }
24724
+ createDocumentTypeNode() {
24725
+ return new MockDocumentTypeNode(this);
24726
+ }
24727
+ getElementById(id) {
24728
+ return getElementById(this, id);
24729
+ }
24730
+ getElementsByName(elmName) {
24731
+ return getElementsByName(this, elmName.toLowerCase());
24732
+ }
24733
+ get title() {
24734
+ const title = this.head.childNodes.find((elm) => elm.nodeName === "TITLE");
24735
+ if (title != null && typeof title.textContent === "string") {
24736
+ return title.textContent.trim();
24674
24737
  }
24675
- if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
24676
- return obj.hasOwnProperty(VALUE_CONSTANT);
24738
+ return "";
24739
+ }
24740
+ set title(value) {
24741
+ const head = this.head;
24742
+ let title = head.childNodes.find((elm) => elm.nodeName === "TITLE");
24743
+ if (title == null) {
24744
+ title = this.createElement("title");
24745
+ head.appendChild(title);
24677
24746
  }
24678
- return true;
24747
+ title.textContent = value;
24679
24748
  }
24680
24749
  };
24681
-
24682
- // src/utils/result.ts
24683
- var result_exports = {};
24684
- __export(result_exports, {
24685
- err: () => err,
24686
- map: () => map,
24687
- ok: () => ok,
24688
- unwrap: () => unwrap,
24689
- unwrapErr: () => unwrapErr
24690
- });
24691
- var ok = (value) => ({
24692
- isOk: true,
24693
- isErr: false,
24694
- value
24695
- });
24696
- var err = (value) => ({
24697
- isOk: false,
24698
- isErr: true,
24699
- value
24700
- });
24701
- function map(result, fn) {
24702
- if (result.isOk) {
24703
- const val = fn(result.value);
24704
- if (val instanceof Promise) {
24705
- return val.then((newVal) => ok(newVal));
24706
- } else {
24707
- return ok(val);
24750
+ function resetDocument(doc) {
24751
+ if (doc != null) {
24752
+ resetEventListeners(doc);
24753
+ const documentElement = doc.documentElement;
24754
+ if (documentElement != null) {
24755
+ resetElement(documentElement);
24756
+ for (let i = 0, ii = documentElement.childNodes.length; i < ii; i++) {
24757
+ const childNode = documentElement.childNodes[i];
24758
+ resetElement(childNode);
24759
+ childNode.childNodes.length = 0;
24760
+ }
24761
+ }
24762
+ for (const key in doc) {
24763
+ if (doc.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
24764
+ delete doc[key];
24765
+ }
24766
+ }
24767
+ try {
24768
+ doc.nodeName = "#document" /* DOCUMENT_NODE */;
24769
+ } catch (e) {
24770
+ }
24771
+ try {
24772
+ doc.nodeType = 9 /* DOCUMENT_NODE */;
24773
+ } catch (e) {
24774
+ }
24775
+ try {
24776
+ doc.cookie = "";
24777
+ } catch (e) {
24778
+ }
24779
+ try {
24780
+ doc.referrer = "";
24781
+ } catch (e) {
24708
24782
  }
24709
24783
  }
24710
- if (result.isErr) {
24711
- const value = result.value;
24712
- return err(value);
24713
- }
24714
- throw "should never get here";
24715
24784
  }
24716
- var unwrap = (result) => {
24717
- if (result.isOk) {
24718
- return result.value;
24719
- } else {
24720
- throw result.value;
24721
- }
24722
- };
24723
- var unwrapErr = (result) => {
24724
- if (result.isErr) {
24725
- return result.value;
24726
- } else {
24727
- throw result.value;
24785
+ var DOC_KEY_KEEPERS = /* @__PURE__ */ new Set([
24786
+ "nodeName",
24787
+ "nodeType",
24788
+ "nodeValue",
24789
+ "ownerDocument",
24790
+ "parentNode",
24791
+ "childNodes",
24792
+ "_shadowRoot"
24793
+ ]);
24794
+ function getElementById(elm, id) {
24795
+ const children = elm.children;
24796
+ for (let i = 0, ii = children.length; i < ii; i++) {
24797
+ const childElm = children[i];
24798
+ if (childElm.id === id) {
24799
+ return childElm;
24800
+ }
24801
+ const childElmFound = getElementById(childElm, id);
24802
+ if (childElmFound != null) {
24803
+ return childElmFound;
24804
+ }
24728
24805
  }
24729
- };
24730
-
24731
- // src/utils/serialize.ts
24732
- function serializeProperty(value) {
24733
- if (["string", "boolean", "undefined"].includes(typeof value) || typeof value === "number" && value !== Infinity && value !== -Infinity && !isNaN(value)) {
24734
- return value;
24806
+ return null;
24807
+ }
24808
+ function getElementsByName(elm, elmName, foundElms = []) {
24809
+ const children = elm.children;
24810
+ for (let i = 0, ii = children.length; i < ii; i++) {
24811
+ const childElm = children[i];
24812
+ if (childElm.name && childElm.name.toLowerCase() === elmName) {
24813
+ foundElms.push(childElm);
24814
+ }
24815
+ getElementsByName(childElm, elmName, foundElms);
24735
24816
  }
24736
- const arg = LocalValue.getArgument(value);
24737
- return SERIALIZED_PREFIX + btoa(JSON.stringify(arg));
24817
+ return foundElms;
24738
24818
  }
24739
- function deserializeProperty(value) {
24740
- if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
24741
- return value;
24819
+ function setOwnerDocument(elm, ownerDocument) {
24820
+ for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
24821
+ elm.childNodes[i].ownerDocument = ownerDocument;
24822
+ if (elm.childNodes[i].nodeType === 1 /* ELEMENT_NODE */) {
24823
+ setOwnerDocument(elm.childNodes[i], ownerDocument);
24824
+ }
24742
24825
  }
24743
- return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
24744
24826
  }
24745
24827
 
24746
- // src/utils/util.ts
24747
- var lowerPathParam = (fn) => (p) => fn(p.toLowerCase());
24748
- var isDtsFile = lowerPathParam((p) => p.endsWith(".d.ts") || p.endsWith(".d.mts") || p.endsWith(".d.cts"));
24749
- var isTsFile = lowerPathParam(
24750
- (p) => !isDtsFile(p) && (p.endsWith(".ts") || p.endsWith(".mts") || p.endsWith(".cts"))
24751
- );
24752
- var isTsxFile = lowerPathParam(
24753
- (p) => p.endsWith(".tsx") || p.endsWith(".mtsx") || p.endsWith(".ctsx")
24754
- );
24755
- var isJsxFile = lowerPathParam(
24756
- (p) => p.endsWith(".jsx") || p.endsWith(".mjsx") || p.endsWith(".cjsx")
24757
- );
24758
- var isJsFile = lowerPathParam((p) => p.endsWith(".js") || p.endsWith(".mjs") || p.endsWith(".cjs"));
24759
-
24760
- // src/utils/shadow-css.ts
24761
- /**
24762
- * @license
24763
- * Copyright Google Inc. All Rights Reserved.
24764
- *
24765
- * Use of this source code is governed by an MIT-style license that can be
24766
- * found in the LICENSE file at https://angular.io/license
24767
- *
24768
- * This file is a port of shadowCSS from `webcomponents.js` to TypeScript.
24769
- * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
24770
- * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
24771
- */
24772
- var _polyfillHost = "-shadowcsshost";
24773
- var _polyfillSlotted = "-shadowcssslotted";
24774
- var _polyfillHostContext = "-shadowcsscontext";
24775
- var _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
24776
- var _cssColonHostRe = new RegExp("(" + _polyfillHost + _parenSuffix, "gim");
24777
- var _cssColonHostContextRe = new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim");
24778
- var _cssColonSlottedRe = new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim");
24779
- var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
24780
- var createSupportsRuleRe = (selector) => {
24781
- const safeSelector = escapeRegExpSpecialCharacters(selector);
24782
- return new RegExp(
24783
- // First capture group: match any context before the selector that's not inside @supports selector()
24784
- // Using negative lookahead to avoid matching inside @supports selector(...) condition
24785
- `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector}))(${safeSelector}\\b)`,
24786
- "g"
24787
- );
24788
- };
24789
- var _colonSlottedRe = createSupportsRuleRe("::slotted");
24790
- var _colonHostRe = createSupportsRuleRe(":host");
24791
- var _colonHostContextRe = createSupportsRuleRe(":host-context");
24792
-
24793
- // src/runtime/mode.ts
24794
- var setMode = (handler) => modeResolutionChain.push(handler);
24795
- var CAPTURE_EVENT_SUFFIX = "Capture";
24796
- var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
24797
- var baseClass = BUILD.lazyLoad ? class {
24798
- } : globalThis.HTMLElement || class {
24799
- };
24828
+ // src/hydrate/runner/create-window.ts
24829
+ var templateWindows = /* @__PURE__ */ new Map();
24830
+ function createWindowFromHtml(templateHtml, uniqueId) {
24831
+ let templateWindow = templateWindows.get(uniqueId);
24832
+ if (templateWindow == null) {
24833
+ templateWindow = new MockWindow(templateHtml);
24834
+ templateWindows.set(uniqueId, templateWindow);
24835
+ }
24836
+ const win2 = cloneWindow(templateWindow);
24837
+ return win2;
24838
+ }
24800
24839
 
24801
24840
  // src/compiler/html/canonical-link.ts
24802
24841
  var updateCanonicalLink = (doc, href) => {
@@ -26179,4 +26218,13 @@ function removeScripts(elm) {
26179
26218
  }
26180
26219
  }
26181
26220
 
26182
- export { createWindowFromHtml, deserializeProperty, hydrateDocument, renderToString, serializeDocumentToString, serializeProperty, streamToString };
26221
+ // src/hydrate/runner/index.ts
26222
+ var everywhere;
26223
+ try {
26224
+ everywhere = global || globalThis;
26225
+ } catch (e) {
26226
+ everywhere = window || globalThis;
26227
+ }
26228
+ everywhere.tagTransform = transformTag;
26229
+
26230
+ export { createWindowFromHtml, deserializeProperty, hydrateDocument, renderToString, serializeDocumentToString, serializeProperty, setTagTransformer, streamToString, transformTag };