@stencil/core 4.21.0 → 4.22.0

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Hydrate Runner v4.21.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Runner v4.22.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -12,6 +12,7 @@ var CONTENT_REF_ID = "r";
12
12
  var ORG_LOCATION_ID = "o";
13
13
  var SLOT_NODE_ID = "s";
14
14
  var TEXT_NODE_ID = "t";
15
+ var HYDRATE_ID = "s-id";
15
16
  var XLINK_NS = "http://www.w3.org/1999/xlink";
16
17
 
17
18
  // src/mock-doc/attribute.ts
@@ -320,8 +321,8 @@ function jsCaseToCssCase(str) {
320
321
 
321
322
  // src/mock-doc/custom-element-registry.ts
322
323
  var MockCustomElementRegistry = class {
323
- constructor(win) {
324
- this.win = win;
324
+ constructor(win2) {
325
+ this.win = win2;
325
326
  }
326
327
  define(tagName, cstr, options) {
327
328
  if (tagName.toLowerCase() !== tagName) {
@@ -343,19 +344,19 @@ var MockCustomElementRegistry = class {
343
344
  this.__whenDefined.delete(tagName);
344
345
  }
345
346
  }
346
- const doc = this.win.document;
347
- if (doc != null) {
348
- const hosts = doc.querySelectorAll(tagName);
347
+ const doc2 = this.win.document;
348
+ if (doc2 != null) {
349
+ const hosts = doc2.querySelectorAll(tagName);
349
350
  hosts.forEach((host) => {
350
351
  if (upgradedElements.has(host) === false) {
351
- tempDisableCallbacks.add(doc);
352
- const upgradedCmp = createCustomElement(this, doc, tagName);
352
+ tempDisableCallbacks.add(doc2);
353
+ const upgradedCmp = createCustomElement(this, doc2, tagName);
353
354
  for (let i = 0; i < host.childNodes.length; i++) {
354
355
  const childNode = host.childNodes[i];
355
356
  childNode.remove();
356
357
  upgradedCmp.appendChild(childNode);
357
358
  }
358
- tempDisableCallbacks.delete(doc);
359
+ tempDisableCallbacks.delete(doc2);
359
360
  if (proxyElements.has(host)) {
360
361
  proxyElements.set(host, upgradedCmp);
361
362
  }
@@ -409,8 +410,8 @@ var MockCustomElementRegistry = class {
409
410
  });
410
411
  }
411
412
  };
412
- function createCustomElement(customElements, ownerDocument, tagName) {
413
- const Cstr = customElements.get(tagName);
413
+ function createCustomElement(customElements2, ownerDocument, tagName) {
414
+ const Cstr = customElements2.get(tagName);
414
415
  if (Cstr != null) {
415
416
  const cmp = new Cstr(ownerDocument);
416
417
  cmp.nodeName = tagName.toUpperCase();
@@ -458,8 +459,8 @@ function connectNode(ownerDocument, node) {
458
459
  node.ownerDocument = ownerDocument;
459
460
  if (node.nodeType === 1 /* ELEMENT_NODE */) {
460
461
  if (ownerDocument != null && node.nodeName.includes("-")) {
461
- const win = ownerDocument.defaultView;
462
- if (win != null && typeof node.connectedCallback === "function" && node.isConnected) {
462
+ const win2 = ownerDocument.defaultView;
463
+ if (win2 != null && typeof node.connectedCallback === "function" && node.isConnected) {
463
464
  fireConnectedCallback(node);
464
465
  }
465
466
  const shadowRoot = node.shadowRoot;
@@ -4867,7 +4868,7 @@ var OpenElementStack = class {
4867
4868
  get currentTmplContentOrNode() {
4868
4869
  return this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : this.current;
4869
4870
  }
4870
- constructor(document, treeAdapter, handler) {
4871
+ constructor(document2, treeAdapter, handler) {
4871
4872
  this.treeAdapter = treeAdapter;
4872
4873
  this.handler = handler;
4873
4874
  this.items = [];
@@ -4875,7 +4876,7 @@ var OpenElementStack = class {
4875
4876
  this.stackTop = -1;
4876
4877
  this.tmplCount = 0;
4877
4878
  this.currentTagId = TAG_ID.UNKNOWN;
4878
- this.current = document;
4879
+ this.current = document2;
4879
4880
  }
4880
4881
  //Index of element
4881
4882
  _indexOf(element) {
@@ -5292,8 +5293,8 @@ var defaultTreeAdapter = {
5292
5293
  getTemplateContent(templateElement) {
5293
5294
  return templateElement.content;
5294
5295
  },
5295
- setDocumentType(document, name, publicId, systemId) {
5296
- const doctypeNode = document.childNodes.find((node) => node.nodeName === "#documentType");
5296
+ setDocumentType(document2, name, publicId, systemId) {
5297
+ const doctypeNode = document2.childNodes.find((node) => node.nodeName === "#documentType");
5297
5298
  if (doctypeNode) {
5298
5299
  doctypeNode.name = name;
5299
5300
  doctypeNode.publicId = publicId;
@@ -5306,14 +5307,14 @@ var defaultTreeAdapter = {
5306
5307
  systemId,
5307
5308
  parentNode: null
5308
5309
  };
5309
- defaultTreeAdapter.appendChild(document, node);
5310
+ defaultTreeAdapter.appendChild(document2, node);
5310
5311
  }
5311
5312
  },
5312
- setDocumentMode(document, mode) {
5313
- document.mode = mode;
5313
+ setDocumentMode(document2, mode) {
5314
+ document2.mode = mode;
5314
5315
  },
5315
- getDocumentMode(document) {
5316
- return document.mode;
5316
+ getDocumentMode(document2) {
5317
+ return document2.mode;
5317
5318
  },
5318
5319
  detachNode(node) {
5319
5320
  if (node.parentNode) {
@@ -5794,7 +5795,7 @@ var defaultParserOptions = {
5794
5795
  onParseError: null
5795
5796
  };
5796
5797
  var Parser = class {
5797
- constructor(options, document, fragmentContext = null, scriptHandler = null) {
5798
+ constructor(options, document2, fragmentContext = null, scriptHandler = null) {
5798
5799
  this.fragmentContext = fragmentContext;
5799
5800
  this.scriptHandler = scriptHandler;
5800
5801
  this.currentToken = null;
@@ -5819,7 +5820,7 @@ var Parser = class {
5819
5820
  if (this.onParseError) {
5820
5821
  this.options.sourceCodeLocationInfo = true;
5821
5822
  }
5822
- this.document = document !== null && document !== void 0 ? document : this.treeAdapter.createDocument();
5823
+ this.document = document2 !== null && document2 !== void 0 ? document2 : this.treeAdapter.createDocument();
5823
5824
  this.tokenizer = new Tokenizer(this.options, this);
5824
5825
  this.activeFormattingElements = new FormattingElementList(this.treeAdapter);
5825
5826
  this.fragmentContextID = fragmentContext ? getTagID(this.treeAdapter.getTagName(fragmentContext)) : TAG_ID.UNKNOWN;
@@ -8796,11 +8797,11 @@ function parseFragment(fragmentContext, html, options) {
8796
8797
  // src/mock-doc/parse-util.ts
8797
8798
  var docParser = /* @__PURE__ */ new WeakMap();
8798
8799
  function parseDocumentUtil(ownerDocument, html) {
8799
- const doc = parse(html.trim(), getParser(ownerDocument));
8800
- doc.documentElement = doc.firstElementChild;
8801
- doc.head = doc.documentElement.firstElementChild;
8802
- doc.body = doc.head.nextElementSibling;
8803
- return doc;
8800
+ const doc2 = parse(html.trim(), getParser(ownerDocument));
8801
+ doc2.documentElement = doc2.firstElementChild;
8802
+ doc2.head = doc2.documentElement.firstElementChild;
8803
+ doc2.body = doc2.head.nextElementSibling;
8804
+ return doc2;
8804
8805
  }
8805
8806
  function parseFragmentUtil(ownerDocument, html) {
8806
8807
  if (typeof html === "string") {
@@ -8818,9 +8819,9 @@ function getParser(ownerDocument) {
8818
8819
  }
8819
8820
  const treeAdapter = {
8820
8821
  createDocument() {
8821
- const doc = ownerDocument.createElement("#document" /* DOCUMENT_NODE */);
8822
- doc["x-mode"] = "no-quirks";
8823
- return doc;
8822
+ const doc2 = ownerDocument.createElement("#document" /* DOCUMENT_NODE */);
8823
+ doc2["x-mode"] = "no-quirks";
8824
+ return doc2;
8824
8825
  },
8825
8826
  setNodeSourceCodeLocation(node, location2) {
8826
8827
  node.sourceCodeLocation = location2;
@@ -8858,22 +8859,22 @@ function getParser(ownerDocument) {
8858
8859
  getTemplateContent(templateElement) {
8859
8860
  return templateElement.content;
8860
8861
  },
8861
- setDocumentType(doc, name, publicId, systemId) {
8862
- let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* DOCUMENT_TYPE_NODE */);
8862
+ setDocumentType(doc2, name, publicId, systemId) {
8863
+ let doctypeNode = doc2.childNodes.find((n) => n.nodeType === 10 /* DOCUMENT_TYPE_NODE */);
8863
8864
  if (doctypeNode == null) {
8864
8865
  doctypeNode = ownerDocument.createDocumentTypeNode();
8865
- doc.insertBefore(doctypeNode, doc.firstChild);
8866
+ doc2.insertBefore(doctypeNode, doc2.firstChild);
8866
8867
  }
8867
8868
  doctypeNode.nodeValue = "!DOCTYPE";
8868
8869
  doctypeNode["x-name"] = name;
8869
8870
  doctypeNode["x-publicId"] = publicId;
8870
8871
  doctypeNode["x-systemId"] = systemId;
8871
8872
  },
8872
- setDocumentMode(doc, mode) {
8873
- doc["x-mode"] = mode;
8873
+ setDocumentMode(doc2, mode) {
8874
+ doc2["x-mode"] = mode;
8874
8875
  },
8875
- getDocumentMode(doc) {
8876
- return doc["x-mode"];
8876
+ getDocumentMode(doc2) {
8877
+ return doc2["x-mode"];
8877
8878
  },
8878
8879
  detachNode(node) {
8879
8880
  node.remove();
@@ -9005,9 +9006,9 @@ var jquery_default = (
9005
9006
  nodeName: "HTML"
9006
9007
  }
9007
9008
  }
9008
- }, function(window, noGlobal) {
9009
+ }, function(window2, noGlobal) {
9009
9010
  "use strict";
9010
- if (!window.document) {
9011
+ if (!window2.document) {
9011
9012
  throw new Error("jQuery requires a window with a document");
9012
9013
  }
9013
9014
  var arr = [];
@@ -9042,16 +9043,16 @@ var jquery_default = (
9042
9043
  }
9043
9044
  return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
9044
9045
  }
9045
- var document = window.document;
9046
+ var document2 = window2.document;
9046
9047
  var preservedScriptAttributes = {
9047
9048
  type: true,
9048
9049
  src: true,
9049
9050
  nonce: true,
9050
9051
  noModule: true
9051
9052
  };
9052
- function DOMEval(code, node, doc) {
9053
- doc = doc || document;
9054
- var i2, script = doc.createElement("script");
9053
+ function DOMEval(code, node, doc2) {
9054
+ doc2 = doc2 || document2;
9055
+ var i2, script = doc2.createElement("script");
9055
9056
  script.text = code;
9056
9057
  if (node) {
9057
9058
  for (i2 in preservedScriptAttributes) {
@@ -9060,7 +9061,7 @@ var jquery_default = (
9060
9061
  }
9061
9062
  }
9062
9063
  }
9063
- doc.head.appendChild(script).parentNode.removeChild(script);
9064
+ doc2.head.appendChild(script).parentNode.removeChild(script);
9064
9065
  }
9065
9066
  const jQuery = {};
9066
9067
  var version = "4.0.0-pre+9352011a7.dirty +selector", rhtmlSuffix = /HTML$/i, jQueryOrig = function(selector, context) {
@@ -9197,8 +9198,8 @@ var jquery_default = (
9197
9198
  },
9198
9199
  // Evaluates a script in a provided context; falls back to the global one
9199
9200
  // if not specified.
9200
- globalEval: function(code, options, doc) {
9201
- DOMEval(code, { nonce: options && options.nonce }, doc);
9201
+ globalEval: function(code, options, doc2) {
9202
+ DOMEval(code, { nonce: options && options.nonce }, doc2);
9202
9203
  },
9203
9204
  each: function(obj, callback) {
9204
9205
  var length, i2 = 0;
@@ -9325,9 +9326,9 @@ var jquery_default = (
9325
9326
  }
9326
9327
  var pop = arr.pop;
9327
9328
  var whitespace = "[\\x20\\t\\r\\n\\f]";
9328
- var isIE = document.documentMode;
9329
+ var isIE = document2.documentMode;
9329
9330
  try {
9330
- document.querySelector(":has(*,:jqfake)");
9331
+ document2.querySelector(":has(*,:jqfake)");
9331
9332
  support.cssHas = false;
9332
9333
  } catch (e) {
9333
9334
  support.cssHas = true;
@@ -9359,7 +9360,7 @@ var jquery_default = (
9359
9360
  var rleadingCombinator = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*");
9360
9361
  var rdescend = new RegExp(whitespace + "|>");
9361
9362
  var rsibling = /[+~]/;
9362
- var documentElement = document.documentElement;
9363
+ var documentElement = document2.documentElement;
9363
9364
  var matches2 = documentElement.matches || documentElement.msMatchesSelector;
9364
9365
  function createCache() {
9365
9366
  var keys = [];
@@ -9528,10 +9529,10 @@ var jquery_default = (
9528
9529
  1
9529
9530
  );
9530
9531
  if (compare & 1) {
9531
- if (a == document || a.ownerDocument == document && jQuery.contains(document, a)) {
9532
+ if (a == document2 || a.ownerDocument == document2 && jQuery.contains(document2, a)) {
9532
9533
  return -1;
9533
9534
  }
9534
- if (b == document || b.ownerDocument == document && jQuery.contains(document, b)) {
9535
+ if (b == document2 || b.ownerDocument == document2 && jQuery.contains(document2, b)) {
9535
9536
  return 1;
9536
9537
  }
9537
9538
  return 0;
@@ -9687,14 +9688,14 @@ var jquery_default = (
9687
9688
  });
9688
9689
  }
9689
9690
  function setDocument(node) {
9690
- var subWindow, doc = node ? node.ownerDocument || node : document;
9691
- if (doc == document$1 || doc.nodeType !== 9) {
9691
+ var subWindow, doc2 = node ? node.ownerDocument || node : document2;
9692
+ if (doc2 == document$1 || doc2.nodeType !== 9) {
9692
9693
  return;
9693
9694
  }
9694
- document$1 = doc;
9695
+ document$1 = doc2;
9695
9696
  documentElement$1 = document$1.documentElement;
9696
9697
  documentIsHTML = !jQuery.isXMLDoc(document$1);
9697
- if (isIE && document != document$1 && (subWindow = document$1.defaultView) && subWindow.top !== subWindow) {
9698
+ if (isIE && document2 != document$1 && (subWindow = document$1.defaultView) && subWindow.top !== subWindow) {
9698
9699
  subWindow.addEventListener("unload", unloadHandler);
9699
9700
  }
9700
9701
  }
@@ -9925,7 +9926,7 @@ var jquery_default = (
9925
9926
  }),
9926
9927
  // Miscellaneous
9927
9928
  target: function(elem) {
9928
- var hash = window.location && window.location.hash;
9929
+ var hash = window2.location && window2.location.hash;
9929
9930
  return hash && hash.slice(1) === elem.id;
9930
9931
  },
9931
9932
  root: function(elem) {
@@ -10565,6 +10566,13 @@ style="${cssText}">`;
10565
10566
  output.indent = output.indent + ((_h = opts.indentSpaces) != null ? _h : 0);
10566
10567
  }
10567
10568
  for (let i = 0; i < childNodeLength; i++) {
10569
+ const sId = node.attributes.getNamedItem(HYDRATE_ID);
10570
+ const isStencilDeclarativeShadowDOM = childNodes[i].nodeName.toLowerCase() === "template" && sId;
10571
+ if (isStencilDeclarativeShadowDOM) {
10572
+ yield `
10573
+ ${" ".repeat(output.indent)}<!--r.${sId.value}-->`;
10574
+ continue;
10575
+ }
10568
10576
  yield* streamToHtml(childNodes[i], opts, output);
10569
10577
  }
10570
10578
  if (ignoreTag === false) {
@@ -11915,9 +11923,9 @@ function createElement(ownerDocument, tagName) {
11915
11923
  return new MockUListElement(ownerDocument);
11916
11924
  }
11917
11925
  if (ownerDocument != null && tagName.includes("-")) {
11918
- const win = ownerDocument.defaultView;
11919
- if (win != null && win.customElements != null) {
11920
- return createCustomElement(win.customElements, ownerDocument, tagName);
11926
+ const win2 = ownerDocument.defaultView;
11927
+ if (win2 != null && win2.customElements != null) {
11928
+ return createCustomElement(win2.customElements, ownerDocument, tagName);
11921
11929
  }
11922
11930
  }
11923
11931
  return new MockHTMLElement(ownerDocument, tagName);
@@ -12339,9 +12347,9 @@ var CanvasRenderingContext = class {
12339
12347
  }
12340
12348
  clearRect() {
12341
12349
  }
12342
- getImageData(_, __, w, h) {
12350
+ getImageData(_, __, w, h2) {
12343
12351
  return {
12344
- data: new Array(w * h * 4)
12352
+ data: new Array(w * h2 * 4)
12345
12353
  };
12346
12354
  }
12347
12355
  toDataURL() {
@@ -12403,9 +12411,9 @@ var MockCanvasElement = class extends MockHTMLElement {
12403
12411
  function fullUrl(elm, attrName) {
12404
12412
  const val = elm.getAttribute(attrName) || "";
12405
12413
  if (elm.ownerDocument != null) {
12406
- const win = elm.ownerDocument.defaultView;
12407
- if (win != null) {
12408
- const loc = win.location;
12414
+ const win2 = elm.ownerDocument.defaultView;
12415
+ if (win2 != null) {
12416
+ const loc = win2.location;
12409
12417
  if (loc != null) {
12410
12418
  try {
12411
12419
  const url = new URL(val, loc.href);
@@ -13010,6 +13018,21 @@ function resetPerformance(perf) {
13010
13018
  }
13011
13019
  }
13012
13020
 
13021
+ // src/mock-doc/resize-observer.ts
13022
+ var MockResizeObserver = class {
13023
+ constructor() {
13024
+ }
13025
+ disconnect() {
13026
+ }
13027
+ observe() {
13028
+ }
13029
+ takeRecords() {
13030
+ return [];
13031
+ }
13032
+ unobserve() {
13033
+ }
13034
+ };
13035
+
13013
13036
  // src/mock-doc/storage.ts
13014
13037
  var MockStorage = class {
13015
13038
  constructor() {
@@ -13110,10 +13133,10 @@ var MockWindow = class {
13110
13133
  }
13111
13134
  get Document() {
13112
13135
  if (this.__docCstr == null) {
13113
- const win = this;
13136
+ const win2 = this;
13114
13137
  this.__docCstr = class extends MockDocument {
13115
13138
  constructor() {
13116
- super(false, win);
13139
+ super(false, win2);
13117
13140
  throw new Error("Illegal constructor: cannot construct Document");
13118
13141
  }
13119
13142
  };
@@ -13249,6 +13272,9 @@ var MockWindow = class {
13249
13272
  get IntersectionObserver() {
13250
13273
  return MockIntersectionObserver;
13251
13274
  }
13275
+ get ResizeObserver() {
13276
+ return MockResizeObserver;
13277
+ }
13252
13278
  get localStorage() {
13253
13279
  if (this.__localStorage == null) {
13254
13280
  this.__localStorage = new MockStorage();
@@ -13630,14 +13656,14 @@ var MockWindow = class {
13630
13656
  }
13631
13657
  };
13632
13658
  addGlobalsToWindowPrototype(MockWindow.prototype);
13633
- function resetWindowDefaults(win) {
13634
- win.__clearInterval = nativeClearInterval;
13635
- win.__clearTimeout = nativeClearTimeout;
13636
- win.__setInterval = nativeSetInterval;
13637
- win.__setTimeout = nativeSetTimeout;
13638
- win.__maxTimeout = 3e4;
13639
- win.__allowInterval = true;
13640
- win.URL = nativeURL;
13659
+ function resetWindowDefaults(win2) {
13660
+ win2.__clearInterval = nativeClearInterval;
13661
+ win2.__clearTimeout = nativeClearTimeout;
13662
+ win2.__setInterval = nativeSetInterval;
13663
+ win2.__setTimeout = nativeSetTimeout;
13664
+ win2.__maxTimeout = 3e4;
13665
+ win2.__allowInterval = true;
13666
+ win2.URL = nativeURL;
13641
13667
  }
13642
13668
  function cloneWindow(srcWin, opts = {}) {
13643
13669
  if (srcWin == null) {
@@ -13656,72 +13682,72 @@ function cloneWindow(srcWin, opts = {}) {
13656
13682
  }
13657
13683
  return clonedWin;
13658
13684
  }
13659
- function constrainTimeouts(win) {
13660
- win.__allowInterval = false;
13661
- win.__maxTimeout = 0;
13685
+ function constrainTimeouts(win2) {
13686
+ win2.__allowInterval = false;
13687
+ win2.__maxTimeout = 0;
13662
13688
  }
13663
- function resetWindow(win) {
13664
- if (win != null) {
13665
- if (win.__timeouts) {
13666
- win.__timeouts.forEach((timeoutId) => {
13689
+ function resetWindow(win2) {
13690
+ if (win2 != null) {
13691
+ if (win2.__timeouts) {
13692
+ win2.__timeouts.forEach((timeoutId) => {
13667
13693
  nativeClearInterval(timeoutId);
13668
13694
  nativeClearTimeout(timeoutId);
13669
13695
  });
13670
- win.__timeouts.clear();
13696
+ win2.__timeouts.clear();
13671
13697
  }
13672
- if (win.customElements && win.customElements.clear) {
13673
- win.customElements.clear();
13698
+ if (win2.customElements && win2.customElements.clear) {
13699
+ win2.customElements.clear();
13674
13700
  }
13675
- resetDocument(win.document);
13676
- resetPerformance(win.performance);
13677
- for (const key in win) {
13678
- if (win.hasOwnProperty(key) && key !== "document" && key !== "performance" && key !== "customElements") {
13679
- delete win[key];
13701
+ resetDocument(win2.document);
13702
+ resetPerformance(win2.performance);
13703
+ for (const key in win2) {
13704
+ if (win2.hasOwnProperty(key) && key !== "document" && key !== "performance" && key !== "customElements") {
13705
+ delete win2[key];
13680
13706
  }
13681
13707
  }
13682
- resetWindowDefaults(win);
13683
- resetWindowDimensions(win);
13684
- resetEventListeners(win);
13685
- if (win.document != null) {
13708
+ resetWindowDefaults(win2);
13709
+ resetWindowDimensions(win2);
13710
+ resetEventListeners(win2);
13711
+ if (win2.document != null) {
13686
13712
  try {
13687
- win.document.defaultView = win;
13713
+ win2.document.defaultView = win2;
13688
13714
  } catch (e) {
13689
13715
  }
13690
13716
  }
13691
- win.fetch = null;
13692
- win.Headers = null;
13693
- win.Request = null;
13694
- win.Response = null;
13695
- win.FetchError = null;
13717
+ win2.fetch = null;
13718
+ win2.Headers = null;
13719
+ win2.Request = null;
13720
+ win2.Response = null;
13721
+ win2.FetchError = null;
13696
13722
  }
13697
13723
  }
13698
- function resetWindowDimensions(win) {
13724
+ function resetWindowDimensions(win2) {
13699
13725
  try {
13700
- win.devicePixelRatio = 1;
13701
- win.innerHeight = 768;
13702
- win.innerWidth = 1366;
13703
- win.pageXOffset = 0;
13704
- win.pageYOffset = 0;
13705
- win.screenLeft = 0;
13706
- win.screenTop = 0;
13707
- win.screenX = 0;
13708
- win.screenY = 0;
13709
- win.scrollX = 0;
13710
- win.scrollY = 0;
13711
- win.screen = {
13712
- availHeight: win.innerHeight,
13726
+ win2.devicePixelRatio = 1;
13727
+ win2.innerHeight = 768;
13728
+ win2.innerWidth = 1366;
13729
+ win2.pageXOffset = 0;
13730
+ win2.pageYOffset = 0;
13731
+ win2.screenLeft = 0;
13732
+ win2.screenTop = 0;
13733
+ win2.screenX = 0;
13734
+ win2.screenY = 0;
13735
+ win2.scrollX = 0;
13736
+ win2.scrollY = 0;
13737
+ win2.screen = {
13738
+ availHeight: win2.innerHeight,
13713
13739
  availLeft: 0,
13714
13740
  availTop: 0,
13715
- availWidth: win.innerWidth,
13741
+ availWidth: win2.innerWidth,
13716
13742
  colorDepth: 24,
13717
- height: win.innerHeight,
13743
+ height: win2.innerHeight,
13718
13744
  keepAwake: false,
13719
13745
  orientation: {
13720
13746
  angle: 0,
13721
13747
  type: "portrait-primary"
13722
13748
  },
13723
13749
  pixelDepth: 24,
13724
- width: win.innerWidth
13750
+ width: win2.innerWidth
13725
13751
  };
13726
13752
  } catch (e) {
13727
13753
  }
@@ -13729,11 +13755,11 @@ function resetWindowDimensions(win) {
13729
13755
 
13730
13756
  // src/mock-doc/document.ts
13731
13757
  var MockDocument = class _MockDocument extends MockHTMLElement {
13732
- constructor(html = null, win = null) {
13758
+ constructor(html = null, win2 = null) {
13733
13759
  super(null, null);
13734
13760
  this.nodeName = "#document" /* DOCUMENT_NODE */;
13735
13761
  this.nodeType = 9 /* DOCUMENT_NODE */;
13736
- this.defaultView = win;
13762
+ this.defaultView = win2;
13737
13763
  this.cookie = "";
13738
13764
  this.referrer = "";
13739
13765
  this.appendChild(this.createDocumentTypeNode());
@@ -13880,10 +13906,10 @@ var MockDocument = class _MockDocument extends MockHTMLElement {
13880
13906
  }
13881
13907
  createElement(tagName) {
13882
13908
  if (tagName === "#document" /* DOCUMENT_NODE */) {
13883
- const doc = new _MockDocument(false);
13884
- doc.nodeName = tagName;
13885
- doc.parentNode = null;
13886
- return doc;
13909
+ const doc2 = new _MockDocument(false);
13910
+ doc2.nodeName = tagName;
13911
+ doc2.parentNode = null;
13912
+ return doc2;
13887
13913
  }
13888
13914
  return createElement(this, tagName);
13889
13915
  }
@@ -13923,10 +13949,10 @@ var MockDocument = class _MockDocument extends MockHTMLElement {
13923
13949
  title.textContent = value;
13924
13950
  }
13925
13951
  };
13926
- function resetDocument(doc) {
13927
- if (doc != null) {
13928
- resetEventListeners(doc);
13929
- const documentElement = doc.documentElement;
13952
+ function resetDocument(doc2) {
13953
+ if (doc2 != null) {
13954
+ resetEventListeners(doc2);
13955
+ const documentElement = doc2.documentElement;
13930
13956
  if (documentElement != null) {
13931
13957
  resetElement(documentElement);
13932
13958
  for (let i = 0, ii = documentElement.childNodes.length; i < ii; i++) {
@@ -13935,25 +13961,25 @@ function resetDocument(doc) {
13935
13961
  childNode.childNodes.length = 0;
13936
13962
  }
13937
13963
  }
13938
- for (const key in doc) {
13939
- if (doc.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
13940
- delete doc[key];
13964
+ for (const key in doc2) {
13965
+ if (doc2.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
13966
+ delete doc2[key];
13941
13967
  }
13942
13968
  }
13943
13969
  try {
13944
- doc.nodeName = "#document" /* DOCUMENT_NODE */;
13970
+ doc2.nodeName = "#document" /* DOCUMENT_NODE */;
13945
13971
  } catch (e) {
13946
13972
  }
13947
13973
  try {
13948
- doc.nodeType = 9 /* DOCUMENT_NODE */;
13974
+ doc2.nodeType = 9 /* DOCUMENT_NODE */;
13949
13975
  } catch (e) {
13950
13976
  }
13951
13977
  try {
13952
- doc.cookie = "";
13978
+ doc2.cookie = "";
13953
13979
  } catch (e) {
13954
13980
  }
13955
13981
  try {
13956
- doc.referrer = "";
13982
+ doc2.referrer = "";
13957
13983
  } catch (e) {
13958
13984
  }
13959
13985
  }
@@ -14009,14 +14035,65 @@ function createWindowFromHtml(templateHtml, uniqueId) {
14009
14035
  templateWindow = new MockWindow(templateHtml);
14010
14036
  templateWindows.set(uniqueId, templateWindow);
14011
14037
  }
14012
- const win = cloneWindow(templateWindow);
14013
- return win;
14038
+ const win2 = cloneWindow(templateWindow);
14039
+ return win2;
14014
14040
  }
14015
14041
 
14016
14042
  // src/hydrate/runner/render.ts
14017
14043
  import { Readable } from "stream";
14018
14044
  import { hydrateFactory } from "@stencil/core/hydrate-factory";
14019
14045
 
14046
+ // src/client/client-build.ts
14047
+ import { BUILD } from "@stencil/core/internal/app-data";
14048
+ var Build = {
14049
+ isDev: BUILD.isDev ? true : false,
14050
+ isBrowser: true,
14051
+ isServer: false,
14052
+ isTesting: BUILD.isTesting ? true : false
14053
+ };
14054
+
14055
+ // src/client/client-host-ref.ts
14056
+ import { BUILD as BUILD2 } from "@stencil/core/internal/app-data";
14057
+ var hostRefs = BUILD2.hotModuleReplacement ? window.__STENCIL_HOSTREFS__ || (window.__STENCIL_HOSTREFS__ = /* @__PURE__ */ new WeakMap()) : /* @__PURE__ */ new WeakMap();
14058
+
14059
+ // src/client/client-load-module.ts
14060
+ import { BUILD as BUILD4 } from "@stencil/core/internal/app-data";
14061
+
14062
+ // src/client/client-log.ts
14063
+ import { BUILD as BUILD3 } from "@stencil/core/internal/app-data";
14064
+ var STENCIL_DEV_MODE = BUILD3.isTesting ? ["STENCIL:"] : [
14065
+ "%cstencil",
14066
+ "color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
14067
+ ];
14068
+
14069
+ // src/client/client-style.ts
14070
+ var modeResolutionChain = [];
14071
+
14072
+ // src/client/client-task-queue.ts
14073
+ import { BUILD as BUILD6 } from "@stencil/core/internal/app-data";
14074
+
14075
+ // src/client/client-window.ts
14076
+ import { BUILD as BUILD5 } from "@stencil/core/internal/app-data";
14077
+ var win = typeof window !== "undefined" ? window : {};
14078
+ var doc = win.document || { head: {} };
14079
+ var H = win.HTMLElement || class {
14080
+ };
14081
+ var supportsShadow = BUILD5.shadowDom;
14082
+ var supportsConstructableStylesheets = BUILD5.constructableCSS ? /* @__PURE__ */ (() => {
14083
+ try {
14084
+ new CSSStyleSheet();
14085
+ return typeof new CSSStyleSheet().replaceSync === "function";
14086
+ } catch (e) {
14087
+ }
14088
+ return false;
14089
+ })() : false;
14090
+
14091
+ // src/client/index.ts
14092
+ import { BUILD as BUILD27, Env, NAMESPACE as NAMESPACE2 } from "@stencil/core/internal/app-data";
14093
+
14094
+ // src/runtime/bootstrap-custom-element.ts
14095
+ import { BUILD as BUILD24 } from "@stencil/core/internal/app-data";
14096
+
14020
14097
  // src/utils/helpers.ts
14021
14098
  var isString = (v) => typeof v === "string";
14022
14099
 
@@ -14107,15 +14184,77 @@ var unwrapErr = (result) => {
14107
14184
  }
14108
14185
  };
14109
14186
 
14187
+ // src/runtime/connected-callback.ts
14188
+ import { BUILD as BUILD21 } from "@stencil/core/internal/app-data";
14189
+
14190
+ // src/runtime/client-hydrate.ts
14191
+ import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
14192
+
14193
+ // src/runtime/profile.ts
14194
+ import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
14195
+
14196
+ // src/runtime/vdom/h.ts
14197
+ import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
14198
+
14199
+ // src/runtime/initialize-component.ts
14200
+ import { BUILD as BUILD20 } from "@stencil/core/internal/app-data";
14201
+
14202
+ // src/runtime/mode.ts
14203
+ var setMode = (handler) => modeResolutionChain.push(handler);
14204
+
14205
+ // src/runtime/proxy-component.ts
14206
+ import { BUILD as BUILD19 } from "@stencil/core/internal/app-data";
14207
+
14208
+ // src/runtime/set-value.ts
14209
+ import { BUILD as BUILD18 } from "@stencil/core/internal/app-data";
14210
+
14211
+ // src/runtime/parse-property-value.ts
14212
+ import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
14213
+
14214
+ // src/runtime/update-component.ts
14215
+ import { BUILD as BUILD17, NAMESPACE } from "@stencil/core/internal/app-data";
14216
+
14217
+ // src/runtime/event-emitter.ts
14218
+ import { BUILD as BUILD12 } from "@stencil/core/internal/app-data";
14219
+
14220
+ // src/runtime/element.ts
14221
+ import { BUILD as BUILD11 } from "@stencil/core/internal/app-data";
14222
+
14223
+ // src/runtime/styles.ts
14224
+ import { BUILD as BUILD13 } from "@stencil/core/internal/app-data";
14225
+
14226
+ // src/runtime/vdom/vdom-render.ts
14227
+ import { BUILD as BUILD16 } from "@stencil/core/internal/app-data";
14228
+
14229
+ // src/runtime/vdom/update-element.ts
14230
+ import { BUILD as BUILD15 } from "@stencil/core/internal/app-data";
14231
+
14232
+ // src/runtime/vdom/set-accessor.ts
14233
+ import { BUILD as BUILD14 } from "@stencil/core/internal/app-data";
14234
+ var CAPTURE_EVENT_SUFFIX = "Capture";
14235
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
14236
+
14237
+ // src/runtime/disconnected-callback.ts
14238
+ import { BUILD as BUILD22 } from "@stencil/core/internal/app-data";
14239
+
14240
+ // src/runtime/dom-extras.ts
14241
+ import { BUILD as BUILD23 } from "@stencil/core/internal/app-data";
14242
+
14243
+ // src/runtime/bootstrap-lazy.ts
14244
+ import { BUILD as BUILD25 } from "@stencil/core/internal/app-data";
14245
+
14246
+ // src/runtime/host-listener.ts
14247
+ import { BUILD as BUILD26 } from "@stencil/core/internal/app-data";
14248
+
14110
14249
  // src/compiler/html/canonical-link.ts
14111
- var updateCanonicalLink = (doc, href) => {
14250
+ var updateCanonicalLink = (doc2, href) => {
14112
14251
  var _a2;
14113
- let canonicalLinkElm = doc.head.querySelector('link[rel="canonical"]');
14252
+ let canonicalLinkElm = doc2.head.querySelector('link[rel="canonical"]');
14114
14253
  if (typeof href === "string") {
14115
14254
  if (canonicalLinkElm == null) {
14116
- canonicalLinkElm = doc.createElement("link");
14255
+ canonicalLinkElm = doc2.createElement("link");
14117
14256
  canonicalLinkElm.setAttribute("rel", "canonical");
14118
- doc.head.appendChild(canonicalLinkElm);
14257
+ doc2.head.appendChild(canonicalLinkElm);
14119
14258
  }
14120
14259
  canonicalLinkElm.setAttribute("href", href);
14121
14260
  } else {
@@ -14129,11 +14268,11 @@ var updateCanonicalLink = (doc, href) => {
14129
14268
  };
14130
14269
 
14131
14270
  // src/compiler/html/relocate-meta-charset.ts
14132
- var relocateMetaCharset = (doc) => {
14133
- const head = doc.head;
14271
+ var relocateMetaCharset = (doc2) => {
14272
+ const head = doc2.head;
14134
14273
  let charsetElm = head.querySelector("meta[charset]");
14135
14274
  if (charsetElm == null) {
14136
- charsetElm = doc.createElement("meta");
14275
+ charsetElm = doc2.createElement("meta");
14137
14276
  charsetElm.setAttribute("charset", "utf-8");
14138
14277
  } else {
14139
14278
  charsetElm.remove();
@@ -14408,13 +14547,13 @@ var parseCss = (css, filePath) => {
14408
14547
  const m = match(/^@([-\w]+)?document *([^{]+)/);
14409
14548
  if (!m) return null;
14410
14549
  const vendor = trim(m[1]);
14411
- const doc = trim(m[2]);
14550
+ const doc2 = trim(m[2]);
14412
14551
  if (!open()) return error(`@document missing '{'`);
14413
14552
  const style = comments().concat(rules());
14414
14553
  if (!close()) return error(`@document missing '}'`);
14415
14554
  return pos({
14416
14555
  type: 3 /* Document */,
14417
- document: doc,
14556
+ document: doc2,
14418
14557
  vendor,
14419
14558
  rules: style
14420
14559
  });
@@ -14740,11 +14879,11 @@ var serializeCssPage = (opts, node) => {
14740
14879
  };
14741
14880
  var serializeCssDocument = (opts, node) => {
14742
14881
  const documentCss = serializeCssMapVisit(opts, node.rules);
14743
- const doc = "@" + (node.vendor || "") + "document " + node.document;
14882
+ const doc2 = "@" + (node.vendor || "") + "document " + node.document;
14744
14883
  if (documentCss === "") {
14745
14884
  return "";
14746
14885
  }
14747
- return doc + "{" + documentCss + "}";
14886
+ return doc2 + "{" + documentCss + "}";
14748
14887
  };
14749
14888
  var serializeCssMapVisit = (opts, nodes) => {
14750
14889
  let rtn = "";
@@ -14842,12 +14981,12 @@ var collectUsedSelectors = (usedSelectors, elm) => {
14842
14981
  };
14843
14982
 
14844
14983
  // src/compiler/html/remove-unused-styles.ts
14845
- var removeUnusedStyles = (doc, diagnostics) => {
14984
+ var removeUnusedStyles = (doc2, diagnostics) => {
14846
14985
  try {
14847
- const styleElms = doc.head.querySelectorAll(`style[data-styles]`);
14986
+ const styleElms = doc2.head.querySelectorAll(`style[data-styles]`);
14848
14987
  const styleLen = styleElms.length;
14849
14988
  if (styleLen > 0) {
14850
- const usedSelectors = getUsedSelectors(doc.documentElement);
14989
+ const usedSelectors = getUsedSelectors(doc2.documentElement);
14851
14990
  for (let i = 0; i < styleLen; i++) {
14852
14991
  removeUnusedStyleText(usedSelectors, diagnostics, styleElms[i]);
14853
14992
  }
@@ -14980,49 +15119,49 @@ function collectAttributes(node) {
14980
15119
  var SKIP_ATTRS = /* @__PURE__ */ new Set(["s-id", "c-id"]);
14981
15120
 
14982
15121
  // src/hydrate/runner/patch-dom-implementation.ts
14983
- function patchDomImplementation(doc, opts) {
14984
- let win;
14985
- if (doc.defaultView != null) {
15122
+ function patchDomImplementation(doc2, opts) {
15123
+ let win2;
15124
+ if (doc2.defaultView != null) {
14986
15125
  opts.destroyWindow = true;
14987
- patchWindow(doc.defaultView);
14988
- win = doc.defaultView;
15126
+ patchWindow(doc2.defaultView);
15127
+ win2 = doc2.defaultView;
14989
15128
  } else {
14990
15129
  opts.destroyWindow = true;
14991
15130
  opts.destroyDocument = false;
14992
- win = new MockWindow(false);
15131
+ win2 = new MockWindow(false);
14993
15132
  }
14994
- if (win.document !== doc) {
14995
- win.document = doc;
15133
+ if (win2.document !== doc2) {
15134
+ win2.document = doc2;
14996
15135
  }
14997
- if (doc.defaultView !== win) {
14998
- doc.defaultView = win;
15136
+ if (doc2.defaultView !== win2) {
15137
+ doc2.defaultView = win2;
14999
15138
  }
15000
- const HTMLElement = doc.documentElement.constructor.prototype;
15001
- if (typeof HTMLElement.getRootNode !== "function") {
15002
- const elm = doc.createElement("unknown-element");
15139
+ const HTMLElement2 = doc2.documentElement.constructor.prototype;
15140
+ if (typeof HTMLElement2.getRootNode !== "function") {
15141
+ const elm = doc2.createElement("unknown-element");
15003
15142
  const HTMLUnknownElement = elm.constructor.prototype;
15004
15143
  HTMLUnknownElement.getRootNode = getRootNode;
15005
15144
  }
15006
- if (typeof doc.createEvent === "function") {
15007
- const CustomEvent = doc.createEvent("CustomEvent").constructor;
15008
- if (win.CustomEvent !== CustomEvent) {
15009
- win.CustomEvent = CustomEvent;
15145
+ if (typeof doc2.createEvent === "function") {
15146
+ const CustomEvent2 = doc2.createEvent("CustomEvent").constructor;
15147
+ if (win2.CustomEvent !== CustomEvent2) {
15148
+ win2.CustomEvent = CustomEvent2;
15010
15149
  }
15011
15150
  }
15012
15151
  try {
15013
- win.__stencil_baseURI = doc.baseURI;
15152
+ win2.__stencil_baseURI = doc2.baseURI;
15014
15153
  } catch (e) {
15015
- Object.defineProperty(doc, "baseURI", {
15154
+ Object.defineProperty(doc2, "baseURI", {
15016
15155
  get() {
15017
- const baseElm = doc.querySelector("base[href]");
15156
+ const baseElm = doc2.querySelector("base[href]");
15018
15157
  if (baseElm) {
15019
- return new URL(baseElm.getAttribute("href"), win.location.href).href;
15158
+ return new URL(baseElm.getAttribute("href"), win2.location.href).href;
15020
15159
  }
15021
- return win.location.href;
15160
+ return win2.location.href;
15022
15161
  }
15023
15162
  });
15024
15163
  }
15025
- return win;
15164
+ return win2;
15026
15165
  }
15027
15166
  function getRootNode(opts) {
15028
15167
  const isComposed = opts != null && opts.composed === true;
@@ -15175,10 +15314,10 @@ function renderCatchError(results, err2) {
15175
15314
  }
15176
15315
 
15177
15316
  // src/hydrate/runner/runtime-log.ts
15178
- function runtimeLogging(win, opts, results) {
15317
+ function runtimeLogging(win2, opts, results) {
15179
15318
  try {
15180
- const pathname = win.location.pathname;
15181
- win.console.error = (...msgs) => {
15319
+ const pathname = win2.location.pathname;
15320
+ win2.console.error = (...msgs) => {
15182
15321
  const errMsg = msgs.reduce((errMsg2, m) => {
15183
15322
  if (m) {
15184
15323
  if (m.stack != null) {
@@ -15198,7 +15337,7 @@ function runtimeLogging(win, opts, results) {
15198
15337
  }
15199
15338
  }
15200
15339
  };
15201
- win.console.debug = (...msgs) => {
15340
+ win2.console.debug = (...msgs) => {
15202
15341
  renderBuildDiagnostic(results, "debug", "Hydrate Debug", [...msgs].join(", "));
15203
15342
  if (opts.runtimeLogging) {
15204
15343
  runtimeLog(pathname, "debug", msgs);
@@ -15206,7 +15345,7 @@ function runtimeLogging(win, opts, results) {
15206
15345
  };
15207
15346
  if (opts.runtimeLogging) {
15208
15347
  ["log", "warn", "assert", "info", "trace"].forEach((type) => {
15209
- win.console[type] = (...msgs) => {
15348
+ win2.console[type] = (...msgs) => {
15210
15349
  runtimeLog(pathname, type, msgs);
15211
15350
  };
15212
15351
  });
@@ -15220,58 +15359,58 @@ function runtimeLog(pathname, type, msgs) {
15220
15359
  }
15221
15360
 
15222
15361
  // src/hydrate/runner/window-initialize.ts
15223
- function initializeWindow(win, doc, opts, results) {
15362
+ function initializeWindow(win2, doc2, opts, results) {
15224
15363
  if (typeof opts.url === "string") {
15225
15364
  try {
15226
- win.location.href = opts.url;
15365
+ win2.location.href = opts.url;
15227
15366
  } catch (e) {
15228
15367
  }
15229
15368
  }
15230
15369
  if (typeof opts.userAgent === "string") {
15231
15370
  try {
15232
- win.navigator.userAgent = opts.userAgent;
15371
+ win2.navigator.userAgent = opts.userAgent;
15233
15372
  } catch (e) {
15234
15373
  }
15235
15374
  }
15236
15375
  if (typeof opts.cookie === "string") {
15237
15376
  try {
15238
- doc.cookie = opts.cookie;
15377
+ doc2.cookie = opts.cookie;
15239
15378
  } catch (e) {
15240
15379
  }
15241
15380
  }
15242
15381
  if (typeof opts.referrer === "string") {
15243
15382
  try {
15244
- doc.referrer = opts.referrer;
15383
+ doc2.referrer = opts.referrer;
15245
15384
  } catch (e) {
15246
15385
  }
15247
15386
  }
15248
15387
  if (typeof opts.direction === "string") {
15249
15388
  try {
15250
- doc.documentElement.setAttribute("dir", opts.direction);
15389
+ doc2.documentElement.setAttribute("dir", opts.direction);
15251
15390
  } catch (e) {
15252
15391
  }
15253
15392
  }
15254
15393
  if (typeof opts.language === "string") {
15255
15394
  try {
15256
- doc.documentElement.setAttribute("lang", opts.language);
15395
+ doc2.documentElement.setAttribute("lang", opts.language);
15257
15396
  } catch (e) {
15258
15397
  }
15259
15398
  }
15260
15399
  if (typeof opts.buildId === "string") {
15261
15400
  try {
15262
- doc.documentElement.setAttribute("data-stencil-build", opts.buildId);
15401
+ doc2.documentElement.setAttribute("data-stencil-build", opts.buildId);
15263
15402
  } catch (e) {
15264
15403
  }
15265
15404
  }
15266
15405
  try {
15267
- win.customElements = null;
15406
+ win2.customElements = null;
15268
15407
  } catch (e) {
15269
15408
  }
15270
15409
  if (opts.constrainTimeouts) {
15271
- constrainTimeouts(win);
15410
+ constrainTimeouts(win2);
15272
15411
  }
15273
- runtimeLogging(win, opts, results);
15274
- return win;
15412
+ runtimeLogging(win2, opts, results);
15413
+ return win2;
15275
15414
  }
15276
15415
 
15277
15416
  // src/hydrate/runner/render.ts
@@ -15288,44 +15427,44 @@ function renderToString(html, options, asStream) {
15288
15427
  opts.constrainTimeouts = false;
15289
15428
  return hydrateDocument(html, opts, asStream);
15290
15429
  }
15291
- function hydrateDocument(doc, options, asStream) {
15430
+ function hydrateDocument(doc2, options, asStream) {
15292
15431
  const opts = normalizeHydrateOptions(options);
15293
- let win = null;
15432
+ let win2 = null;
15294
15433
  const results = generateHydrateResults(opts);
15295
15434
  if (hasError(results.diagnostics)) {
15296
15435
  return Promise.resolve(results);
15297
15436
  }
15298
- if (typeof doc === "string") {
15437
+ if (typeof doc2 === "string") {
15299
15438
  try {
15300
15439
  opts.destroyWindow = true;
15301
15440
  opts.destroyDocument = true;
15302
- win = new MockWindow(doc);
15441
+ win2 = new MockWindow(doc2);
15303
15442
  if (!asStream) {
15304
- return render(win, opts, results).then(() => results);
15443
+ return render(win2, opts, results).then(() => results);
15305
15444
  }
15306
- return renderStream(win, opts, results);
15445
+ return renderStream(win2, opts, results);
15307
15446
  } catch (e) {
15308
- if (win && win.close) {
15309
- win.close();
15447
+ if (win2 && win2.close) {
15448
+ win2.close();
15310
15449
  }
15311
- win = null;
15450
+ win2 = null;
15312
15451
  renderCatchError(results, e);
15313
15452
  return Promise.resolve(results);
15314
15453
  }
15315
15454
  }
15316
- if (isValidDocument(doc)) {
15455
+ if (isValidDocument(doc2)) {
15317
15456
  try {
15318
15457
  opts.destroyDocument = false;
15319
- win = patchDomImplementation(doc, opts);
15458
+ win2 = patchDomImplementation(doc2, opts);
15320
15459
  if (!asStream) {
15321
- return render(win, opts, results).then(() => results);
15460
+ return render(win2, opts, results).then(() => results);
15322
15461
  }
15323
- return renderStream(win, opts, results);
15462
+ return renderStream(win2, opts, results);
15324
15463
  } catch (e) {
15325
- if (win && win.close) {
15326
- win.close();
15464
+ if (win2 && win2.close) {
15465
+ win2.close();
15327
15466
  }
15328
- win = null;
15467
+ win2 = null;
15329
15468
  renderCatchError(results, e);
15330
15469
  return Promise.resolve(results);
15331
15470
  }
@@ -15333,75 +15472,81 @@ function hydrateDocument(doc, options, asStream) {
15333
15472
  renderBuildError(results, `Invalid html or document. Must be either a valid "html" string, or DOM "document".`);
15334
15473
  return Promise.resolve(results);
15335
15474
  }
15336
- async function render(win, opts, results) {
15475
+ async function render(win2, opts, results) {
15337
15476
  if ("process" in globalThis && typeof process.on === "function" && !process.__stencilErrors) {
15338
15477
  process.__stencilErrors = true;
15339
15478
  process.on("unhandledRejection", (e) => {
15340
15479
  console.log("unhandledRejection", e);
15341
15480
  });
15342
15481
  }
15343
- initializeWindow(win, win.document, opts, results);
15482
+ initializeWindow(win2, win2.document, opts, results);
15344
15483
  const beforeHydrateFn = typeof opts.beforeHydrate === "function" ? opts.beforeHydrate : NOOP;
15345
15484
  try {
15346
- await Promise.resolve(beforeHydrateFn(win.document));
15347
- return new Promise((resolve) => hydrateFactory(win, opts, results, afterHydrate, resolve));
15485
+ await Promise.resolve(beforeHydrateFn(win2.document));
15486
+ return new Promise((resolve) => {
15487
+ if (Array.isArray(opts.modes)) {
15488
+ modeResolutionChain.length = 0;
15489
+ opts.modes.forEach((mode) => setMode(mode));
15490
+ }
15491
+ return hydrateFactory(win2, opts, results, afterHydrate, resolve);
15492
+ });
15348
15493
  } catch (e) {
15349
15494
  renderCatchError(results, e);
15350
- return finalizeHydrate(win, win.document, opts, results);
15495
+ return finalizeHydrate(win2, win2.document, opts, results);
15351
15496
  }
15352
15497
  }
15353
- function renderStream(win, opts, results) {
15498
+ function renderStream(win2, opts, results) {
15354
15499
  async function* processRender() {
15355
- const renderResult = await render(win, opts, results);
15500
+ const renderResult = await render(win2, opts, results);
15356
15501
  yield renderResult.html;
15357
15502
  }
15358
15503
  return Readable.from(processRender());
15359
15504
  }
15360
- async function afterHydrate(win, opts, results, resolve) {
15505
+ async function afterHydrate(win2, opts, results, resolve) {
15361
15506
  const afterHydrateFn = typeof opts.afterHydrate === "function" ? opts.afterHydrate : NOOP;
15362
15507
  try {
15363
- await Promise.resolve(afterHydrateFn(win.document));
15364
- return resolve(finalizeHydrate(win, win.document, opts, results));
15508
+ await Promise.resolve(afterHydrateFn(win2.document));
15509
+ return resolve(finalizeHydrate(win2, win2.document, opts, results));
15365
15510
  } catch (e) {
15366
15511
  renderCatchError(results, e);
15367
- return resolve(finalizeHydrate(win, win.document, opts, results));
15512
+ return resolve(finalizeHydrate(win2, win2.document, opts, results));
15368
15513
  }
15369
15514
  }
15370
- function finalizeHydrate(win, doc, opts, results) {
15515
+ function finalizeHydrate(win2, doc2, opts, results) {
15371
15516
  try {
15372
- inspectElement(results, doc.documentElement, 0);
15517
+ inspectElement(results, doc2.documentElement, 0);
15373
15518
  if (opts.removeUnusedStyles !== false) {
15374
15519
  try {
15375
- removeUnusedStyles(doc, results.diagnostics);
15520
+ removeUnusedStyles(doc2, results.diagnostics);
15376
15521
  } catch (e) {
15377
15522
  renderCatchError(results, e);
15378
15523
  }
15379
15524
  }
15380
15525
  if (typeof opts.title === "string") {
15381
15526
  try {
15382
- doc.title = opts.title;
15527
+ doc2.title = opts.title;
15383
15528
  } catch (e) {
15384
15529
  renderCatchError(results, e);
15385
15530
  }
15386
15531
  }
15387
- results.title = doc.title;
15532
+ results.title = doc2.title;
15388
15533
  if (opts.removeScripts) {
15389
- removeScripts(doc.documentElement);
15534
+ removeScripts(doc2.documentElement);
15390
15535
  }
15391
15536
  try {
15392
- updateCanonicalLink(doc, opts.canonicalUrl);
15537
+ updateCanonicalLink(doc2, opts.canonicalUrl);
15393
15538
  } catch (e) {
15394
15539
  renderCatchError(results, e);
15395
15540
  }
15396
15541
  try {
15397
- relocateMetaCharset(doc);
15542
+ relocateMetaCharset(doc2);
15398
15543
  } catch (e) {
15399
15544
  }
15400
15545
  if (!hasError(results.diagnostics)) {
15401
15546
  results.httpStatus = 200;
15402
15547
  }
15403
15548
  try {
15404
- const metaStatus = doc.head.querySelector('meta[http-equiv="status"]');
15549
+ const metaStatus = doc2.head.querySelector('meta[http-equiv="status"]');
15405
15550
  if (metaStatus != null) {
15406
15551
  const metaStatusContent = metaStatus.getAttribute("content");
15407
15552
  if (metaStatusContent && metaStatusContent.length > 0) {
@@ -15411,35 +15556,35 @@ function finalizeHydrate(win, doc, opts, results) {
15411
15556
  } catch (e) {
15412
15557
  }
15413
15558
  if (opts.clientHydrateAnnotations) {
15414
- doc.documentElement.classList.add("hydrated");
15559
+ doc2.documentElement.classList.add("hydrated");
15415
15560
  }
15416
15561
  if (opts.serializeToHtml) {
15417
- results.html = serializeDocumentToString(doc, opts);
15562
+ results.html = serializeDocumentToString(doc2, opts);
15418
15563
  }
15419
15564
  } catch (e) {
15420
15565
  renderCatchError(results, e);
15421
15566
  }
15422
- destroyWindow(win, doc, opts, results);
15567
+ destroyWindow(win2, doc2, opts, results);
15423
15568
  return results;
15424
15569
  }
15425
- function destroyWindow(win, doc, opts, results) {
15570
+ function destroyWindow(win2, doc2, opts, results) {
15426
15571
  if (!opts.destroyWindow) {
15427
15572
  return;
15428
15573
  }
15429
15574
  try {
15430
15575
  if (!opts.destroyDocument) {
15431
- win.document = null;
15432
- doc.defaultView = null;
15576
+ win2.document = null;
15577
+ doc2.defaultView = null;
15433
15578
  }
15434
- if (win.close) {
15435
- win.close();
15579
+ if (win2.close) {
15580
+ win2.close();
15436
15581
  }
15437
15582
  } catch (e) {
15438
15583
  renderCatchError(results, e);
15439
15584
  }
15440
15585
  }
15441
- function serializeDocumentToString(doc, opts) {
15442
- return serializeNodeToHtml(doc, {
15586
+ function serializeDocumentToString(doc2, opts) {
15587
+ return serializeNodeToHtml(doc2, {
15443
15588
  approximateLineWidth: opts.approximateLineWidth,
15444
15589
  outerHtml: false,
15445
15590
  prettyHtml: opts.prettyHtml,
@@ -15451,8 +15596,8 @@ function serializeDocumentToString(doc, opts) {
15451
15596
  fullDocument: opts.fullDocument
15452
15597
  });
15453
15598
  }
15454
- function isValidDocument(doc) {
15455
- return doc != null && doc.nodeType === 9 && doc.documentElement != null && doc.documentElement.nodeType === 1 && doc.body != null && doc.body.nodeType === 1;
15599
+ function isValidDocument(doc2) {
15600
+ return doc2 != null && doc2.nodeType === 9 && doc2.documentElement != null && doc2.documentElement.nodeType === 1 && doc2.body != null && doc2.body.nodeType === 1;
15456
15601
  }
15457
15602
  function removeScripts(elm) {
15458
15603
  const children = elm.children;