open-chat-studio-widget 0.4.6 → 0.4.8

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 (60) hide show
  1. package/dist/cjs/app-globals-V2Kpy_OQ.js +8 -0
  2. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
  3. package/dist/cjs/{index-c9203be6.js → index-AhSI5tER.js} +329 -238
  4. package/dist/cjs/index-AhSI5tER.js.map +1 -0
  5. package/dist/cjs/index.cjs.js +1 -0
  6. package/dist/cjs/index.cjs.js.map +1 -1
  7. package/dist/cjs/loader.cjs.js +4 -5
  8. package/dist/cjs/loader.cjs.js.map +1 -1
  9. package/dist/cjs/open-chat-studio-widget.cjs.entry.js +3941 -3904
  10. package/dist/cjs/open-chat-studio-widget.cjs.entry.js.map +1 -1
  11. package/dist/cjs/open-chat-studio-widget.cjs.js +8 -7
  12. package/dist/cjs/open-chat-studio-widget.cjs.js.map +1 -1
  13. package/dist/cjs/open-chat-studio-widget.entry.cjs.js.map +1 -0
  14. package/dist/collection/collection-manifest.json +1 -1
  15. package/dist/collection/components/ocs-chat/ocs-chat.css +36 -661
  16. package/dist/collection/components/ocs-chat/ocs-chat.js +41 -20
  17. package/dist/collection/components/ocs-chat/ocs-chat.js.map +1 -1
  18. package/dist/components/index.js +2 -1
  19. package/dist/components/open-chat-studio-widget.js +3939 -3900
  20. package/dist/components/open-chat-studio-widget.js.map +1 -1
  21. package/dist/esm/app-globals-DQuL1Twl.js +6 -0
  22. package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
  23. package/dist/esm/{index-0349ca51.js → index-DkJ7OJTS.js} +327 -216
  24. package/dist/esm/index-DkJ7OJTS.js.map +1 -0
  25. package/dist/esm/index.js +1 -0
  26. package/dist/esm/index.js.map +1 -1
  27. package/dist/esm/loader.js +5 -4
  28. package/dist/esm/loader.js.map +1 -1
  29. package/dist/esm/open-chat-studio-widget.entry.js +3942 -3903
  30. package/dist/esm/open-chat-studio-widget.entry.js.map +1 -1
  31. package/dist/esm/open-chat-studio-widget.js +7 -5
  32. package/dist/esm/open-chat-studio-widget.js.map +1 -1
  33. package/dist/open-chat-studio-widget/index.esm.js.map +1 -1
  34. package/dist/open-chat-studio-widget/loader.esm.js.map +1 -0
  35. package/dist/open-chat-studio-widget/open-chat-studio-widget.entry.esm.js.map +1 -0
  36. package/dist/open-chat-studio-widget/open-chat-studio-widget.esm.js +1 -1
  37. package/dist/open-chat-studio-widget/open-chat-studio-widget.esm.js.map +1 -1
  38. package/dist/open-chat-studio-widget/p-DQuL1Twl.js +2 -0
  39. package/dist/open-chat-studio-widget/p-DQuL1Twl.js.map +1 -0
  40. package/dist/open-chat-studio-widget/p-DkJ7OJTS.js +3 -0
  41. package/dist/open-chat-studio-widget/p-DkJ7OJTS.js.map +1 -0
  42. package/dist/open-chat-studio-widget/p-bde68fbd.entry.js +4 -0
  43. package/dist/open-chat-studio-widget/p-bde68fbd.entry.js.map +1 -0
  44. package/dist/types/components/ocs-chat/ocs-chat.d.ts +5 -0
  45. package/dist/types/components.d.ts +20 -0
  46. package/dist/types/stencil-public-runtime.d.ts +35 -6
  47. package/package.json +2 -2
  48. package/dist/cjs/app-globals-3a1e7e63.js +0 -7
  49. package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
  50. package/dist/cjs/index-c9203be6.js.map +0 -1
  51. package/dist/esm/app-globals-0f993ce5.js +0 -5
  52. package/dist/esm/app-globals-0f993ce5.js.map +0 -1
  53. package/dist/esm/index-0349ca51.js.map +0 -1
  54. package/dist/open-chat-studio-widget/p-16df1b20.entry.js +0 -4
  55. package/dist/open-chat-studio-widget/p-16df1b20.entry.js.map +0 -1
  56. package/dist/open-chat-studio-widget/p-3dc66a9a.js +0 -3
  57. package/dist/open-chat-studio-widget/p-3dc66a9a.js.map +0 -1
  58. package/dist/open-chat-studio-widget/p-e1255160.js +0 -2
  59. package/dist/open-chat-studio-widget/p-e1255160.js.map +0 -1
  60. package/loader/package.json +0 -11
@@ -1,30 +1,10 @@
1
1
  'use strict';
2
2
 
3
- function _interopNamespace(e) {
4
- if (e && e.__esModule) return e;
5
- var n = Object.create(null);
6
- if (e) {
7
- Object.keys(e).forEach(function (k) {
8
- if (k !== 'default') {
9
- var d = Object.getOwnPropertyDescriptor(e, k);
10
- Object.defineProperty(n, k, d.get ? d : {
11
- enumerable: true,
12
- get: function () {
13
- return e[k];
14
- }
15
- });
16
- }
17
- });
18
- }
19
- n['default'] = e;
20
- return Object.freeze(n);
21
- }
22
-
23
3
  const NAMESPACE = 'open-chat-studio-widget';
24
- const BUILD = /* open-chat-studio-widget */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: false, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: true };
4
+ const BUILD = /* open-chat-studio-widget */ { hydratedSelectorName: "hydrated", lazyLoad: true, updatable: true};
25
5
 
26
6
  /*
27
- Stencil Client Platform v4.26.0 | MIT Licensed | https://stenciljs.com
7
+ Stencil Client Platform v4.36.3 | MIT Licensed | https://stenciljs.com
28
8
  */
29
9
  var __defProp = Object.defineProperty;
30
10
  var __export = (target, all) => {
@@ -37,10 +17,15 @@ var SVG_NS = "http://www.w3.org/2000/svg";
37
17
  var HTML_NS = "http://www.w3.org/1999/xhtml";
38
18
 
39
19
  // src/client/client-host-ref.ts
40
- var hostRefs = /* @__PURE__ */ new WeakMap();
41
- var getHostRef = (ref) => hostRefs.get(ref);
20
+ var getHostRef = (ref) => {
21
+ if (ref.__stencil__getHostRef) {
22
+ return ref.__stencil__getHostRef();
23
+ }
24
+ return void 0;
25
+ };
42
26
  var registerInstance = (lazyInstance, hostRef) => {
43
- hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
27
+ lazyInstance.__stencil__getHostRef = () => hostRef;
28
+ hostRef.$lazyInstance$ = lazyInstance;
44
29
  };
45
30
  var registerHost = (hostElement, cmpMeta) => {
46
31
  const hostRef = {
@@ -54,7 +39,8 @@ var registerHost = (hostElement, cmpMeta) => {
54
39
  hostElement["s-p"] = [];
55
40
  hostElement["s-rc"] = [];
56
41
  }
57
- const ref = hostRefs.set(hostElement, hostRef);
42
+ const ref = hostRef;
43
+ hostElement.__stencil__getHostRef = () => ref;
58
44
  return ref;
59
45
  };
60
46
  var isMemberInElement = (elm, memberName) => memberName in elm;
@@ -73,13 +59,13 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
73
59
  return module[exportName];
74
60
  }
75
61
  /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
76
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
62
+ return import(
77
63
  /* @vite-ignore */
78
64
  /* webpackInclude: /\.entry\.js$/ */
79
65
  /* webpackExclude: /\.system\.entry\.js$/ */
80
66
  /* webpackMode: "lazy" */
81
67
  `./${bundleId}.entry.js${""}`
82
- )); }).then(
68
+ ).then(
83
69
  (importedModule) => {
84
70
  {
85
71
  cmpModules.set(bundleId, importedModule);
@@ -94,11 +80,9 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
94
80
 
95
81
  // src/client/client-style.ts
96
82
  var styles = /* @__PURE__ */ new Map();
97
- var HYDRATED_STYLE_ID = "sty-id";
98
83
  var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
99
84
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
100
85
  var win = typeof window !== "undefined" ? window : {};
101
- var doc = win.document || { head: {} };
102
86
  var plt = {
103
87
  $flags$: 0,
104
88
  $resourcesUrl$: "",
@@ -117,6 +101,7 @@ var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
117
101
  }
118
102
  return false;
119
103
  })() ;
104
+ var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
120
105
  var queuePending = false;
121
106
  var queueDomReads = [];
122
107
  var queueDomWrites = [];
@@ -158,11 +143,16 @@ var isComplexType = (o) => {
158
143
  };
159
144
 
160
145
  // src/utils/query-nonce-meta-tag-content.ts
161
- function queryNonceMetaTagContent(doc2) {
146
+ function queryNonceMetaTagContent(doc) {
162
147
  var _a, _b, _c;
163
- return (_c = (_b = (_a = doc2.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
148
+ return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
164
149
  }
165
150
 
151
+ // src/utils/regular-expression.ts
152
+ var escapeRegExpSpecialCharacters = (text) => {
153
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
154
+ };
155
+
166
156
  // src/utils/result.ts
167
157
  var result_exports = {};
168
158
  __export(result_exports, {
@@ -211,6 +201,26 @@ var unwrapErr = (result) => {
211
201
  throw result.value;
212
202
  }
213
203
  };
204
+
205
+ // src/utils/style.ts
206
+ function createStyleSheetIfNeededAndSupported(styles2) {
207
+ return void 0;
208
+ }
209
+
210
+ // src/utils/shadow-root.ts
211
+ var globalStyleSheet;
212
+ function createShadowRoot(cmpMeta) {
213
+ var _a;
214
+ const shadowRoot = this.attachShadow({ mode: "open" });
215
+ if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported()) != null ? _a : null;
216
+ if (globalStyleSheet) {
217
+ if (supportsMutableAdoptedStyleSheets) {
218
+ shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
219
+ } else {
220
+ shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
221
+ }
222
+ }
223
+ }
214
224
  var createTime = (fnName, tagName = "") => {
215
225
  {
216
226
  return () => {
@@ -225,6 +235,110 @@ var uniqueTime = (key, measureText) => {
225
235
  };
226
236
  }
227
237
  };
238
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
239
+ var registerStyle = (scopeId2, cssText, allowCS) => {
240
+ let style = styles.get(scopeId2);
241
+ if (supportsConstructableStylesheets && allowCS) {
242
+ style = style || new CSSStyleSheet();
243
+ if (typeof style === "string") {
244
+ style = cssText;
245
+ } else {
246
+ style.replaceSync(cssText);
247
+ }
248
+ } else {
249
+ style = cssText;
250
+ }
251
+ styles.set(scopeId2, style);
252
+ };
253
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
254
+ var _a;
255
+ const scopeId2 = getScopeId(cmpMeta);
256
+ const style = styles.get(scopeId2);
257
+ if (!win.document) {
258
+ return scopeId2;
259
+ }
260
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
261
+ if (style) {
262
+ if (typeof style === "string") {
263
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
264
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
265
+ let styleElm;
266
+ if (!appliedStyles) {
267
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
268
+ }
269
+ if (!appliedStyles.has(scopeId2)) {
270
+ {
271
+ styleElm = win.document.createElement("style");
272
+ styleElm.innerHTML = style;
273
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
274
+ if (nonce != null) {
275
+ styleElm.setAttribute("nonce", nonce);
276
+ }
277
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
278
+ if (styleContainerNode.nodeName === "HEAD") {
279
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
280
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
281
+ styleContainerNode.insertBefore(
282
+ styleElm,
283
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
284
+ );
285
+ } else if ("host" in styleContainerNode) {
286
+ if (supportsConstructableStylesheets) {
287
+ const stylesheet = new CSSStyleSheet();
288
+ stylesheet.replaceSync(style);
289
+ if (supportsMutableAdoptedStyleSheets) {
290
+ styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
291
+ } else {
292
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
293
+ }
294
+ } else {
295
+ const existingStyleContainer = styleContainerNode.querySelector("style");
296
+ if (existingStyleContainer) {
297
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
298
+ } else {
299
+ styleContainerNode.prepend(styleElm);
300
+ }
301
+ }
302
+ } else {
303
+ styleContainerNode.append(styleElm);
304
+ }
305
+ }
306
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
307
+ styleContainerNode.insertBefore(styleElm, null);
308
+ }
309
+ }
310
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
311
+ styleElm.innerHTML += SLOT_FB_CSS;
312
+ }
313
+ if (appliedStyles) {
314
+ appliedStyles.add(scopeId2);
315
+ }
316
+ }
317
+ } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
318
+ if (supportsMutableAdoptedStyleSheets) {
319
+ styleContainerNode.adoptedStyleSheets.push(style);
320
+ } else {
321
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
322
+ }
323
+ }
324
+ }
325
+ return scopeId2;
326
+ };
327
+ var attachStyles = (hostRef) => {
328
+ const cmpMeta = hostRef.$cmpMeta$;
329
+ const elm = hostRef.$hostElement$;
330
+ const flags = cmpMeta.$flags$;
331
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
332
+ const scopeId2 = addStyle(
333
+ elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
334
+ cmpMeta);
335
+ if (flags & 10 /* needsScopedEncapsulation */) {
336
+ elm["s-sc"] = scopeId2;
337
+ elm.classList.add(scopeId2 + "-h");
338
+ }
339
+ endAttachStyles();
340
+ };
341
+ var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
228
342
  var h = (nodeName, vnodeData, ...children) => {
229
343
  let child = null;
230
344
  let key = null;
@@ -326,13 +440,33 @@ var convertToPrivate = (node) => {
326
440
  vnode.$name$ = node.vname;
327
441
  return vnode;
328
442
  };
329
- var parsePropertyValue = (propValue, propType) => {
443
+ var createSupportsRuleRe = (selector) => {
444
+ const safeSelector2 = escapeRegExpSpecialCharacters(selector);
445
+ return new RegExp(
446
+ // First capture group: match any context before the selector that's not inside @supports selector()
447
+ // Using negative lookahead to avoid matching inside @supports selector(...) condition
448
+ `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
449
+ "g"
450
+ );
451
+ };
452
+ createSupportsRuleRe("::slotted");
453
+ createSupportsRuleRe(":host");
454
+ createSupportsRuleRe(":host-context");
455
+ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
456
+ if (typeof propValue === "string" && (propType & 16 /* Unknown */ || propType & 8 /* Any */) && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
457
+ try {
458
+ return JSON.parse(propValue);
459
+ } catch (e) {
460
+ }
461
+ }
330
462
  if (propValue != null && !isComplexType(propValue)) {
331
463
  if (propType & 4 /* Boolean */) {
332
- return propValue === "false" ? false : propValue === "" || !!propValue;
464
+ {
465
+ return propValue === "false" ? false : propValue === "" || !!propValue;
466
+ }
333
467
  }
334
468
  if (propType & 2 /* Number */) {
335
- return parseFloat(propValue);
469
+ return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
336
470
  }
337
471
  if (propType & 1 /* String */) {
338
472
  return String(propValue);
@@ -341,193 +475,104 @@ var parsePropertyValue = (propValue, propType) => {
341
475
  }
342
476
  return propValue;
343
477
  };
344
- var getElement = (ref) => getHostRef(ref).$hostElement$ ;
478
+ var getElement = (ref) => {
479
+ var _a;
480
+ return (_a = getHostRef(ref)) == null ? void 0 : _a.$hostElement$ ;
481
+ };
345
482
  var emitEvent = (elm, name, opts) => {
346
483
  const ev = plt.ce(name, opts);
347
484
  elm.dispatchEvent(ev);
348
485
  return ev;
349
486
  };
350
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
351
- var registerStyle = (scopeId2, cssText, allowCS) => {
352
- let style = styles.get(scopeId2);
353
- if (supportsConstructableStylesheets && allowCS) {
354
- style = style || new CSSStyleSheet();
355
- if (typeof style === "string") {
356
- style = cssText;
357
- } else {
358
- style.replaceSync(cssText);
359
- }
360
- } else {
361
- style = cssText;
487
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
488
+ if (oldValue === newValue) {
489
+ return;
362
490
  }
363
- styles.set(scopeId2, style);
364
- };
365
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
366
- var _a;
367
- const scopeId2 = getScopeId(cmpMeta);
368
- const style = styles.get(scopeId2);
369
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
370
- if (style) {
371
- if (typeof style === "string") {
372
- styleContainerNode = styleContainerNode.head || styleContainerNode;
373
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
374
- let styleElm;
375
- if (!appliedStyles) {
376
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
377
- }
378
- if (!appliedStyles.has(scopeId2)) {
379
- {
380
- styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
381
- styleElm.innerHTML = style;
382
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
383
- if (nonce != null) {
384
- styleElm.setAttribute("nonce", nonce);
385
- }
386
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
387
- if (styleContainerNode.nodeName === "HEAD") {
388
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
389
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
390
- styleContainerNode.insertBefore(
391
- styleElm,
392
- (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
393
- );
394
- } else if ("host" in styleContainerNode) {
395
- if (supportsConstructableStylesheets) {
396
- const stylesheet = new CSSStyleSheet();
397
- stylesheet.replaceSync(style);
398
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
399
- } else {
400
- const existingStyleContainer = styleContainerNode.querySelector("style");
401
- if (existingStyleContainer) {
402
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
403
- } else {
404
- styleContainerNode.prepend(styleElm);
405
- }
406
- }
407
- } else {
408
- styleContainerNode.append(styleElm);
409
- }
410
- }
411
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
412
- styleContainerNode.insertBefore(styleElm, null);
413
- }
414
- }
415
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
416
- styleElm.innerHTML += SLOT_FB_CSS;
417
- }
418
- if (appliedStyles) {
419
- appliedStyles.add(scopeId2);
420
- }
421
- }
422
- } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
423
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
491
+ let isProp = isMemberInElement(elm, memberName);
492
+ let ln = memberName.toLowerCase();
493
+ if (memberName === "class") {
494
+ const classList = elm.classList;
495
+ const oldClasses = parseClassList(oldValue);
496
+ let newClasses = parseClassList(newValue);
497
+ {
498
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
499
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
424
500
  }
425
- }
426
- return scopeId2;
427
- };
428
- var attachStyles = (hostRef) => {
429
- const cmpMeta = hostRef.$cmpMeta$;
430
- const elm = hostRef.$hostElement$;
431
- const flags = cmpMeta.$flags$;
432
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
433
- const scopeId2 = addStyle(
434
- elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
435
- cmpMeta);
436
- if ((flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */ || flags & 128 /* shadowNeedsScopedCss */)) {
437
- elm["s-sc"] = scopeId2;
438
- elm.classList.add(scopeId2 + "-h");
439
- }
440
- endAttachStyles();
441
- };
442
- var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
443
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
444
- if (oldValue !== newValue) {
445
- let isProp = isMemberInElement(elm, memberName);
446
- let ln = memberName.toLowerCase();
447
- if (memberName === "class") {
448
- const classList = elm.classList;
449
- const oldClasses = parseClassList(oldValue);
450
- let newClasses = parseClassList(newValue);
451
- {
452
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
453
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
454
- }
455
- } else if (memberName === "style") {
456
- {
457
- for (const prop in oldValue) {
458
- if (!newValue || newValue[prop] == null) {
459
- if (prop.includes("-")) {
460
- elm.style.removeProperty(prop);
461
- } else {
462
- elm.style[prop] = "";
463
- }
464
- }
465
- }
466
- }
467
- for (const prop in newValue) {
468
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
501
+ } else if (memberName === "style") {
502
+ {
503
+ for (const prop in oldValue) {
504
+ if (!newValue || newValue[prop] == null) {
469
505
  if (prop.includes("-")) {
470
- elm.style.setProperty(prop, newValue[prop]);
506
+ elm.style.removeProperty(prop);
471
507
  } else {
472
- elm.style[prop] = newValue[prop];
508
+ elm.style[prop] = "";
473
509
  }
474
510
  }
475
511
  }
476
- } else if (memberName === "key") ; else if (memberName === "ref") {
477
- if (newValue) {
478
- newValue(elm);
479
- }
480
- } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
481
- if (memberName[2] === "-") {
482
- memberName = memberName.slice(3);
483
- } else if (isMemberInElement(win, ln)) {
484
- memberName = ln.slice(2);
485
- } else {
486
- memberName = ln[2] + memberName.slice(3);
487
- }
488
- if (oldValue || newValue) {
489
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
490
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
491
- if (oldValue) {
492
- plt.rel(elm, memberName, oldValue, capture);
493
- }
494
- if (newValue) {
495
- plt.ael(elm, memberName, newValue, capture);
512
+ }
513
+ for (const prop in newValue) {
514
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
515
+ if (prop.includes("-")) {
516
+ elm.style.setProperty(prop, newValue[prop]);
517
+ } else {
518
+ elm.style[prop] = newValue[prop];
496
519
  }
497
520
  }
521
+ }
522
+ } else if (memberName === "key") ; else if (memberName === "ref") {
523
+ if (newValue) {
524
+ newValue(elm);
525
+ }
526
+ } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
527
+ if (memberName[2] === "-") {
528
+ memberName = memberName.slice(3);
529
+ } else if (isMemberInElement(win, ln)) {
530
+ memberName = ln.slice(2);
498
531
  } else {
499
- const isComplex = isComplexType(newValue);
500
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
501
- try {
502
- if (!elm.tagName.includes("-")) {
503
- const n = newValue == null ? "" : newValue;
504
- if (memberName === "list") {
505
- isProp = false;
506
- } else if (oldValue == null || elm[memberName] != n) {
507
- if (typeof elm.__lookupSetter__(memberName) === "function") {
508
- elm[memberName] = n;
509
- } else {
510
- elm.setAttribute(memberName, n);
511
- }
532
+ memberName = ln[2] + memberName.slice(3);
533
+ }
534
+ if (oldValue || newValue) {
535
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
536
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
537
+ if (oldValue) {
538
+ plt.rel(elm, memberName, oldValue, capture);
539
+ }
540
+ if (newValue) {
541
+ plt.ael(elm, memberName, newValue, capture);
542
+ }
543
+ }
544
+ } else {
545
+ const isComplex = isComplexType(newValue);
546
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
547
+ try {
548
+ if (!elm.tagName.includes("-")) {
549
+ const n = newValue == null ? "" : newValue;
550
+ if (memberName === "list") {
551
+ isProp = false;
552
+ } else if (oldValue == null || elm[memberName] != n) {
553
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
554
+ elm[memberName] = n;
555
+ } else {
556
+ elm.setAttribute(memberName, n);
512
557
  }
513
- } else if (elm[memberName] !== newValue) {
514
- elm[memberName] = newValue;
515
558
  }
516
- } catch (e) {
559
+ } else if (elm[memberName] !== newValue) {
560
+ elm[memberName] = newValue;
517
561
  }
562
+ } catch (e) {
518
563
  }
519
- if (newValue == null || newValue === false) {
520
- if (newValue !== false || elm.getAttribute(memberName) === "") {
521
- {
522
- elm.removeAttribute(memberName);
523
- }
524
- }
525
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
526
- newValue = newValue === true ? "" : newValue;
564
+ }
565
+ if (newValue == null || newValue === false) {
566
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
527
567
  {
528
- elm.setAttribute(memberName, newValue);
568
+ elm.removeAttribute(memberName);
529
569
  }
530
570
  }
571
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
572
+ newValue = newValue === true ? "" : newValue;
573
+ {
574
+ elm.setAttribute(memberName, newValue);
575
+ }
531
576
  }
532
577
  }
533
578
  };
@@ -582,7 +627,6 @@ function sortedAttrNames(attrNames) {
582
627
  );
583
628
  }
584
629
  var hostTagName;
585
- var useNativeShadowDom = false;
586
630
  var isSvgMode = false;
587
631
  var createElm = (oldParentVNode, newParentVNode, childIndex) => {
588
632
  const newVNode2 = newParentVNode.$children$[childIndex];
@@ -590,14 +634,19 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
590
634
  let elm;
591
635
  let childNode;
592
636
  if (newVNode2.$text$ !== null) {
593
- elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
637
+ elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
594
638
  } else {
595
639
  if (!isSvgMode) {
596
640
  isSvgMode = newVNode2.$tag$ === "svg";
597
641
  }
598
- elm = newVNode2.$elm$ = doc.createElementNS(
642
+ if (!win.document) {
643
+ throw new Error(
644
+ "You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
645
+ );
646
+ }
647
+ elm = newVNode2.$elm$ = win.document.createElementNS(
599
648
  isSvgMode ? SVG_NS : HTML_NS,
600
- !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
649
+ newVNode2.$tag$
601
650
  ) ;
602
651
  if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
603
652
  isSvgMode = false;
@@ -759,9 +808,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
759
808
  isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
760
809
  }
761
810
  {
762
- {
763
- updateElement(oldVNode, newVNode2, isSvgMode);
764
- }
811
+ updateElement(oldVNode, newVNode2, isSvgMode);
765
812
  }
766
813
  if (oldChildren !== null && newChildren !== null) {
767
814
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -775,7 +822,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
775
822
  !isInitialRender && BUILD.updatable && oldChildren !== null
776
823
  ) {
777
824
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
778
- }
825
+ } else ;
779
826
  if (isSvgMode && tag === "svg") {
780
827
  isSvgMode = false;
781
828
  }
@@ -796,9 +843,9 @@ var insertBefore = (parent, newNode, reference) => {
796
843
  };
797
844
  var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
798
845
  const hostElm = hostRef.$hostElement$;
799
- const cmpMeta = hostRef.$cmpMeta$;
800
846
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
801
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
847
+ const isHostElement = isHost(renderFnResults);
848
+ const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
802
849
  hostTagName = hostElm.tagName;
803
850
  if (isInitialLoad && rootVnode.$attrs$) {
804
851
  for (const key of Object.keys(rootVnode.$attrs$)) {
@@ -811,7 +858,6 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
811
858
  rootVnode.$flags$ |= 4 /* isHost */;
812
859
  hostRef.$vnode$ = rootVnode;
813
860
  rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
814
- useNativeShadowDom = !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);
815
861
  patch(oldVNode, rootVnode, isInitialLoad);
816
862
  };
817
863
 
@@ -838,6 +884,12 @@ var scheduleUpdate = (hostRef, isInitialLoad) => {
838
884
  }
839
885
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
840
886
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
887
+ if (isInitialLoad) {
888
+ queueMicrotask(() => {
889
+ dispatch();
890
+ });
891
+ return;
892
+ }
841
893
  return writeTask(dispatch) ;
842
894
  };
843
895
  var dispatchHooks = (hostRef, isInitialLoad) => {
@@ -851,10 +903,11 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
851
903
  }
852
904
  let maybePromise;
853
905
  if (isInitialLoad) {
854
- {
855
- maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
856
- }
906
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
907
+ } else {
908
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
857
909
  }
910
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
858
911
  endSchedule();
859
912
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
860
913
  };
@@ -897,7 +950,7 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
897
950
  try {
898
951
  instance = instance.render() ;
899
952
  {
900
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
953
+ hostRef.$flags$ &= -17 /* isQueuedForUpdate */;
901
954
  }
902
955
  {
903
956
  hostRef.$flags$ |= 2 /* hasRendered */;
@@ -920,14 +973,13 @@ var postUpdateComponent = (hostRef) => {
920
973
  const endPostUpdate = createTime("postUpdate", tagName);
921
974
  const instance = hostRef.$lazyInstance$ ;
922
975
  const ancestorComponent = hostRef.$ancestorComponent$;
976
+ safeCall(instance, "componentDidRender", void 0, elm);
923
977
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
924
978
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
925
979
  {
926
980
  addHydratedFlag(elm);
927
981
  }
928
- {
929
- safeCall(instance, "componentDidLoad", void 0, elm);
930
- }
982
+ safeCall(instance, "componentDidLoad", void 0, elm);
931
983
  endPostUpdate();
932
984
  {
933
985
  hostRef.$onReadyResolve$(elm);
@@ -936,6 +988,7 @@ var postUpdateComponent = (hostRef) => {
936
988
  }
937
989
  }
938
990
  } else {
991
+ safeCall(instance, "componentDidUpdate", void 0, elm);
939
992
  endPostUpdate();
940
993
  }
941
994
  {
@@ -946,7 +999,7 @@ var postUpdateComponent = (hostRef) => {
946
999
  if (hostRef.$flags$ & 512 /* needsRerender */) {
947
1000
  nextTick(() => scheduleUpdate(hostRef, false));
948
1001
  }
949
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1002
+ hostRef.$flags$ &= -517;
950
1003
  }
951
1004
  };
952
1005
  var appDidLoad = (who) => {
@@ -971,16 +1024,21 @@ var addHydratedFlag = (elm) => {
971
1024
  var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
972
1025
  var setValue = (ref, propName, newVal, cmpMeta) => {
973
1026
  const hostRef = getHostRef(ref);
1027
+ if (!hostRef) {
1028
+ return;
1029
+ }
974
1030
  if (!hostRef) {
975
1031
  throw new Error(
976
- `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`
1032
+ `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`
977
1033
  );
978
1034
  }
979
1035
  const elm = hostRef.$hostElement$ ;
980
1036
  const oldVal = hostRef.$instanceValues$.get(propName);
981
1037
  const flags = hostRef.$flags$;
982
1038
  const instance = hostRef.$lazyInstance$ ;
983
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1039
+ newVal = parsePropertyValue(
1040
+ newVal,
1041
+ cmpMeta.$members$[propName][0]);
984
1042
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
985
1043
  const didValueChange = newVal !== oldVal && !areBothNaN;
986
1044
  if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
@@ -999,6 +1057,11 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
999
1057
  }
1000
1058
  }
1001
1059
  if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1060
+ if (instance.componentShouldUpdate) {
1061
+ if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
1062
+ return;
1063
+ }
1064
+ }
1002
1065
  scheduleUpdate(hostRef, false);
1003
1066
  }
1004
1067
  }
@@ -1039,6 +1102,9 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1039
1102
  Object.defineProperty(prototype, memberName, {
1040
1103
  set(newValue) {
1041
1104
  const ref = getHostRef(this);
1105
+ if (!ref) {
1106
+ return;
1107
+ }
1042
1108
  if (origSetter) {
1043
1109
  const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1044
1110
  if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
@@ -1046,7 +1112,11 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1046
1112
  } else if (!ref.$instanceValues$.get(memberName) && currentValue) {
1047
1113
  ref.$instanceValues$.set(memberName, currentValue);
1048
1114
  }
1049
- origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
1115
+ origSetter.apply(this, [
1116
+ parsePropertyValue(
1117
+ newValue,
1118
+ memberFlags)
1119
+ ]);
1050
1120
  newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1051
1121
  setValue(this, memberName, newValue, cmpMeta);
1052
1122
  return;
@@ -1068,7 +1138,9 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1068
1138
  if (!ref.$instanceValues$.get(memberName) && currentValue) {
1069
1139
  ref.$instanceValues$.set(memberName, currentValue);
1070
1140
  }
1071
- ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, memberFlags);
1141
+ ref.$lazyInstance$[memberName] = parsePropertyValue(
1142
+ newValue,
1143
+ memberFlags);
1072
1144
  setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
1073
1145
  };
1074
1146
  if (ref.$lazyInstance$) {
@@ -1096,7 +1168,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1096
1168
  } else if (propName == null) {
1097
1169
  const hostRef = getHostRef(this);
1098
1170
  const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
1099
- if (flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
1171
+ if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
1100
1172
  const instance = hostRef.$lazyInstance$ ;
1101
1173
  const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
1102
1174
  entry == null ? void 0 : entry.forEach((callbackName) => {
@@ -1117,7 +1189,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1117
1189
  Cstr.observedAttributes = Array.from(
1118
1190
  /* @__PURE__ */ new Set([
1119
1191
  ...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
1120
- ...members.filter(([_, m]) => m[0] & 15 /* HasAttribute */).map(([propName, m]) => {
1192
+ ...members.filter(([_, m]) => m[0] & 31 /* HasAttribute */).map(([propName, m]) => {
1121
1193
  const attrName = m[1] || propName;
1122
1194
  attrNameToPropName.set(attrName, propName);
1123
1195
  return attrName;
@@ -1164,12 +1236,13 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1164
1236
  consoleError(e, elm);
1165
1237
  }
1166
1238
  {
1167
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1239
+ hostRef.$flags$ &= -9 /* isConstructingInstance */;
1168
1240
  }
1169
1241
  {
1170
1242
  hostRef.$flags$ |= 128 /* isWatchReady */;
1171
1243
  }
1172
1244
  endNewInstance();
1245
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1173
1246
  } else {
1174
1247
  Cstr = elm.constructor;
1175
1248
  const cmpTag = elm.localName;
@@ -1197,12 +1270,18 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1197
1270
  }
1198
1271
  };
1199
1272
  var fireConnectedCallback = (instance, elm) => {
1273
+ {
1274
+ safeCall(instance, "connectedCallback", void 0, elm);
1275
+ }
1200
1276
  };
1201
1277
 
1202
1278
  // src/runtime/connected-callback.ts
1203
1279
  var connectedCallback = (elm) => {
1204
1280
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1205
1281
  const hostRef = getHostRef(elm);
1282
+ if (!hostRef) {
1283
+ return;
1284
+ }
1206
1285
  const cmpMeta = hostRef.$cmpMeta$;
1207
1286
  const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1208
1287
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
@@ -1229,8 +1308,10 @@ var connectedCallback = (elm) => {
1229
1308
  initializeComponent(elm, hostRef, cmpMeta);
1230
1309
  }
1231
1310
  } else {
1232
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1233
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1311
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1312
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1313
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1314
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
1234
1315
  }
1235
1316
  }
1236
1317
  endConnected();
@@ -1261,18 +1342,22 @@ var disconnectedCallback = async (elm) => {
1261
1342
  // src/runtime/bootstrap-lazy.ts
1262
1343
  var bootstrapLazy = (lazyBundles, options = {}) => {
1263
1344
  var _a;
1345
+ if (!win.document) {
1346
+ console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
1347
+ return;
1348
+ }
1264
1349
  const endBootstrap = createTime();
1265
1350
  const cmpTags = [];
1266
1351
  const exclude = options.exclude || [];
1267
1352
  const customElements2 = win.customElements;
1268
- const head = doc.head;
1353
+ const head = win.document.head;
1269
1354
  const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
1270
- const dataStyles = /* @__PURE__ */ doc.createElement("style");
1355
+ const dataStyles = /* @__PURE__ */ win.document.createElement("style");
1271
1356
  const deferredConnectedCallbacks = [];
1272
1357
  let appLoadFallback;
1273
1358
  let isBootstrapping = true;
1274
1359
  Object.assign(plt, options);
1275
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", doc.baseURI).href;
1360
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
1276
1361
  let hasSlotRelocation = false;
1277
1362
  lazyBundles.map((lazyBundle) => {
1278
1363
  lazyBundle[1].map((compactMeta) => {
@@ -1303,9 +1388,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1303
1388
  if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1304
1389
  {
1305
1390
  if (!self.shadowRoot) {
1306
- {
1307
- self.attachShadow({ mode: "open" });
1308
- }
1391
+ createShadowRoot.call(self, cmpMeta);
1309
1392
  } else {
1310
1393
  if (self.shadowRoot.mode !== "open") {
1311
1394
  throw new Error(
@@ -1317,7 +1400,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1317
1400
  }
1318
1401
  }
1319
1402
  connectedCallback() {
1320
- getHostRef(this);
1403
+ const hostRef = getHostRef(this);
1404
+ if (!hostRef) {
1405
+ return;
1406
+ }
1321
1407
  if (!this.hasRegisteredEventListeners) {
1322
1408
  this.hasRegisteredEventListeners = true;
1323
1409
  }
@@ -1336,6 +1422,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1336
1422
  plt.raf(() => {
1337
1423
  var _a3;
1338
1424
  const hostRef = getHostRef(this);
1425
+ if (!hostRef) {
1426
+ return;
1427
+ }
1339
1428
  const i2 = deferredConnectedCallbacks.findIndex((host) => host === this);
1340
1429
  if (i2 > -1) {
1341
1430
  deferredConnectedCallbacks.splice(i2, 1);
@@ -1346,7 +1435,8 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1346
1435
  });
1347
1436
  }
1348
1437
  componentOnReady() {
1349
- return getHostRef(this).$onReadyPromise$;
1438
+ var _a3;
1439
+ return (_a3 = getHostRef(this)) == null ? void 0 : _a3.$onReadyPromise$;
1350
1440
  }
1351
1441
  };
1352
1442
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
@@ -1368,7 +1458,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1368
1458
  }
1369
1459
  if (dataStyles.innerHTML.length) {
1370
1460
  dataStyles.setAttribute("data-styles", "");
1371
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
1461
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1372
1462
  if (nonce != null) {
1373
1463
  dataStyles.setAttribute("nonce", nonce);
1374
1464
  }
@@ -1396,5 +1486,6 @@ exports.h = h;
1396
1486
  exports.promiseResolve = promiseResolve;
1397
1487
  exports.registerInstance = registerInstance;
1398
1488
  exports.setNonce = setNonce;
1489
+ //# sourceMappingURL=index-AhSI5tER.js.map
1399
1490
 
1400
- //# sourceMappingURL=index-c9203be6.js.map
1491
+ //# sourceMappingURL=index-AhSI5tER.js.map