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