@rijkshuisstijl-community/web-components-stencil 1.0.0-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. package/LICENSE.md +288 -0
  2. package/README.md +25 -0
  3. package/dist/cjs/index-97a16ac9.js +1551 -0
  4. package/dist/cjs/index-97a16ac9.js.map +1 -0
  5. package/dist/cjs/index.cjs.js +4 -0
  6. package/dist/cjs/index.cjs.js.map +1 -0
  7. package/dist/cjs/loader.cjs.js +15 -0
  8. package/dist/cjs/loader.cjs.js.map +1 -0
  9. package/dist/cjs/rhc-icon-arrow-right.cjs.entry.js +18 -0
  10. package/dist/cjs/rhc-icon-arrow-right.cjs.entry.js.map +1 -0
  11. package/dist/cjs/rhc-icon-calendar.cjs.entry.js +18 -0
  12. package/dist/cjs/rhc-icon-calendar.cjs.entry.js.map +1 -0
  13. package/dist/cjs/rhc-icon-error.cjs.entry.js +18 -0
  14. package/dist/cjs/rhc-icon-error.cjs.entry.js.map +1 -0
  15. package/dist/cjs/rhc-icon-info_2.cjs.entry.js +34 -0
  16. package/dist/cjs/rhc-icon-info_2.cjs.entry.js.map +1 -0
  17. package/dist/cjs/rhc-icon-success.cjs.entry.js +18 -0
  18. package/dist/cjs/rhc-icon-success.cjs.entry.js.map +1 -0
  19. package/dist/cjs/rhc-icon-warning.cjs.entry.js +18 -0
  20. package/dist/cjs/rhc-icon-warning.cjs.entry.js.map +1 -0
  21. package/dist/cjs/rhc.cjs.js +25 -0
  22. package/dist/cjs/rhc.cjs.js.map +1 -0
  23. package/dist/collection/collection-manifest.json +18 -0
  24. package/dist/collection/icon-arrow-right/stencil.js +13 -0
  25. package/dist/collection/icon-arrow-right/stencil.js.map +1 -0
  26. package/dist/collection/icon-calendar/stencil.js +13 -0
  27. package/dist/collection/icon-calendar/stencil.js.map +1 -0
  28. package/dist/collection/icon-error/stencil.js +13 -0
  29. package/dist/collection/icon-error/stencil.js.map +1 -0
  30. package/dist/collection/icon-info/stencil.js +13 -0
  31. package/dist/collection/icon-info/stencil.js.map +1 -0
  32. package/dist/collection/icon-success/stencil.js +13 -0
  33. package/dist/collection/icon-success/stencil.js.map +1 -0
  34. package/dist/collection/icon-warning/stencil.js +13 -0
  35. package/dist/collection/icon-warning/stencil.js.map +1 -0
  36. package/dist/collection/icon.svg +0 -0
  37. package/dist/collection/logo.css +45 -0
  38. package/dist/collection/logo.stencil.js +72 -0
  39. package/dist/collection/logo.stencil.js.map +1 -0
  40. package/dist/components/index.d.ts +45 -0
  41. package/dist/components/index.js +30 -0
  42. package/dist/components/index.js.map +1 -0
  43. package/dist/components/rhc-icon-arrow-right.d.ts +11 -0
  44. package/dist/components/rhc-icon-arrow-right.js +32 -0
  45. package/dist/components/rhc-icon-arrow-right.js.map +1 -0
  46. package/dist/components/rhc-icon-calendar.d.ts +11 -0
  47. package/dist/components/rhc-icon-calendar.js +32 -0
  48. package/dist/components/rhc-icon-calendar.js.map +1 -0
  49. package/dist/components/rhc-icon-error.d.ts +11 -0
  50. package/dist/components/rhc-icon-error.js +32 -0
  51. package/dist/components/rhc-icon-error.js.map +1 -0
  52. package/dist/components/rhc-icon-info.d.ts +11 -0
  53. package/dist/components/rhc-icon-info.js +32 -0
  54. package/dist/components/rhc-icon-info.js.map +1 -0
  55. package/dist/components/rhc-icon-success.d.ts +11 -0
  56. package/dist/components/rhc-icon-success.js +32 -0
  57. package/dist/components/rhc-icon-success.js.map +1 -0
  58. package/dist/components/rhc-icon-warning.d.ts +11 -0
  59. package/dist/components/rhc-icon-warning.js +32 -0
  60. package/dist/components/rhc-icon-warning.js.map +1 -0
  61. package/dist/components/rhc-logo.d.ts +11 -0
  62. package/dist/components/rhc-logo.js +41 -0
  63. package/dist/components/rhc-logo.js.map +1 -0
  64. package/dist/esm/index-c2d82fd1.js +1525 -0
  65. package/dist/esm/index-c2d82fd1.js.map +1 -0
  66. package/dist/esm/index.js +3 -0
  67. package/dist/esm/index.js.map +1 -0
  68. package/dist/esm/loader.js +11 -0
  69. package/dist/esm/loader.js.map +1 -0
  70. package/dist/esm/polyfills/core-js.js +11 -0
  71. package/dist/esm/polyfills/dom.js +79 -0
  72. package/dist/esm/polyfills/es5-html-element.js +1 -0
  73. package/dist/esm/polyfills/index.js +34 -0
  74. package/dist/esm/polyfills/system.js +6 -0
  75. package/dist/esm/rhc-icon-arrow-right.entry.js +14 -0
  76. package/dist/esm/rhc-icon-arrow-right.entry.js.map +1 -0
  77. package/dist/esm/rhc-icon-calendar.entry.js +14 -0
  78. package/dist/esm/rhc-icon-calendar.entry.js.map +1 -0
  79. package/dist/esm/rhc-icon-error.entry.js +14 -0
  80. package/dist/esm/rhc-icon-error.entry.js.map +1 -0
  81. package/dist/esm/rhc-icon-info_2.entry.js +29 -0
  82. package/dist/esm/rhc-icon-info_2.entry.js.map +1 -0
  83. package/dist/esm/rhc-icon-success.entry.js +14 -0
  84. package/dist/esm/rhc-icon-success.entry.js.map +1 -0
  85. package/dist/esm/rhc-icon-warning.entry.js +14 -0
  86. package/dist/esm/rhc-icon-warning.entry.js.map +1 -0
  87. package/dist/esm/rhc.js +20 -0
  88. package/dist/esm/rhc.js.map +1 -0
  89. package/dist/index.cjs.js +1 -0
  90. package/dist/index.js +1 -0
  91. package/dist/rhc/index.esm.js +2 -0
  92. package/dist/rhc/index.esm.js.map +1 -0
  93. package/dist/rhc/p-1849850a.entry.js +2 -0
  94. package/dist/rhc/p-1849850a.entry.js.map +1 -0
  95. package/dist/rhc/p-1ddc5ba6.entry.js +2 -0
  96. package/dist/rhc/p-1ddc5ba6.entry.js.map +1 -0
  97. package/dist/rhc/p-1f328841.js +3 -0
  98. package/dist/rhc/p-1f328841.js.map +1 -0
  99. package/dist/rhc/p-3c963064.entry.js +2 -0
  100. package/dist/rhc/p-3c963064.entry.js.map +1 -0
  101. package/dist/rhc/p-4378bb06.entry.js +2 -0
  102. package/dist/rhc/p-4378bb06.entry.js.map +1 -0
  103. package/dist/rhc/p-569d82ec.entry.js +2 -0
  104. package/dist/rhc/p-569d82ec.entry.js.map +1 -0
  105. package/dist/rhc/p-bab6df1d.entry.js +2 -0
  106. package/dist/rhc/p-bab6df1d.entry.js.map +1 -0
  107. package/dist/rhc/rhc.esm.js +2 -0
  108. package/dist/rhc/rhc.esm.js.map +1 -0
  109. package/dist/src/icon-arrow-right/stencil.d.ts +7 -0
  110. package/dist/src/icon-arrow-right/stencil.js +20 -0
  111. package/dist/src/icon-arrow-right/stencil.js.map +1 -0
  112. package/dist/src/icon-calendar/stencil.d.ts +7 -0
  113. package/dist/src/icon-calendar/stencil.js +20 -0
  114. package/dist/src/icon-calendar/stencil.js.map +1 -0
  115. package/dist/src/icon-error/stencil.d.ts +7 -0
  116. package/dist/src/icon-error/stencil.js +26 -0
  117. package/dist/src/icon-error/stencil.js.map +1 -0
  118. package/dist/src/icon-info/stencil.d.ts +7 -0
  119. package/dist/src/icon-info/stencil.js +24 -0
  120. package/dist/src/icon-info/stencil.js.map +1 -0
  121. package/dist/src/icon-success/stencil.d.ts +7 -0
  122. package/dist/src/icon-success/stencil.js +22 -0
  123. package/dist/src/icon-success/stencil.js.map +1 -0
  124. package/dist/src/icon-warning/stencil.d.ts +7 -0
  125. package/dist/src/icon-warning/stencil.js +24 -0
  126. package/dist/src/icon-warning/stencil.js.map +1 -0
  127. package/dist/src/logo.stencil.d.ts +15 -0
  128. package/dist/src/logo.stencil.js +40 -0
  129. package/dist/src/logo.stencil.js.map +1 -0
  130. package/dist/stencil.config.d.ts +2 -0
  131. package/dist/stencil.config.js +27 -0
  132. package/dist/stencil.config.js.map +1 -0
  133. package/dist/types/components.d.ts +119 -0
  134. package/dist/types/home/runner/work/rijkshuisstijl-community/rijkshuisstijl-community/packages/web-components-stencil/.stencil/stencil.config.d.ts +2 -0
  135. package/dist/types/icon-arrow-right/stencil.d.ts +7 -0
  136. package/dist/types/icon-calendar/stencil.d.ts +7 -0
  137. package/dist/types/icon-error/stencil.d.ts +7 -0
  138. package/dist/types/icon-info/stencil.d.ts +7 -0
  139. package/dist/types/icon-success/stencil.d.ts +7 -0
  140. package/dist/types/icon-warning/stencil.d.ts +7 -0
  141. package/dist/types/logo.stencil.d.ts +15 -0
  142. package/dist/types/stencil-public-runtime.d.ts +1652 -0
  143. package/loader/cdn.js +3 -0
  144. package/loader/index.cjs.js +3 -0
  145. package/loader/index.d.ts +21 -0
  146. package/loader/index.es2017.js +3 -0
  147. package/loader/index.js +4 -0
  148. package/loader/package.json +11 -0
  149. package/package.json +58 -0
@@ -0,0 +1,1525 @@
1
+ const NAMESPACE = 'rhc';
2
+
3
+ /**
4
+ * Virtual DOM patching algorithm based on Snabbdom by
5
+ * Simon Friis Vindum (@paldepind)
6
+ * Licensed under the MIT License
7
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
8
+ *
9
+ * Modified for Stencil's renderer and slot projection
10
+ */
11
+ let scopeId;
12
+ let hostTagName;
13
+ let isSvgMode = false;
14
+ let queuePending = false;
15
+ const createTime = (fnName, tagName = '') => {
16
+ {
17
+ return () => {
18
+ return;
19
+ };
20
+ }
21
+ };
22
+ const uniqueTime = (key, measureText) => {
23
+ {
24
+ return () => {
25
+ return;
26
+ };
27
+ }
28
+ };
29
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
30
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
31
+ /**
32
+ * Default style mode id
33
+ */
34
+ /**
35
+ * Reusable empty obj/array
36
+ * Don't add values to these!!
37
+ */
38
+ const EMPTY_OBJ = {};
39
+ /**
40
+ * Namespaces
41
+ */
42
+ const SVG_NS = 'http://www.w3.org/2000/svg';
43
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
44
+ const isDef = (v) => v != null;
45
+ /**
46
+ * Check whether a value is a 'complex type', defined here as an object or a
47
+ * function.
48
+ *
49
+ * @param o the value to check
50
+ * @returns whether it's a complex type or not
51
+ */
52
+ const isComplexType = (o) => {
53
+ // https://jsperf.com/typeof-fn-object/5
54
+ o = typeof o;
55
+ return o === 'object' || o === 'function';
56
+ };
57
+ /**
58
+ * Helper method for querying a `meta` tag that contains a nonce value
59
+ * out of a DOM's head.
60
+ *
61
+ * @param doc The DOM containing the `head` to query against
62
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
63
+ * exists or the tag has no content.
64
+ */
65
+ function queryNonceMetaTagContent(doc) {
66
+ var _a, _b, _c;
67
+ return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
68
+ }
69
+ /**
70
+ * Production h() function based on Preact by
71
+ * Jason Miller (@developit)
72
+ * Licensed under the MIT License
73
+ * https://github.com/developit/preact/blob/master/LICENSE
74
+ *
75
+ * Modified for Stencil's compiler and vdom
76
+ */
77
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
78
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
79
+ const h = (nodeName, vnodeData, ...children) => {
80
+ let child = null;
81
+ let simple = false;
82
+ let lastSimple = false;
83
+ const vNodeChildren = [];
84
+ const walk = (c) => {
85
+ for (let i = 0; i < c.length; i++) {
86
+ child = c[i];
87
+ if (Array.isArray(child)) {
88
+ walk(child);
89
+ }
90
+ else if (child != null && typeof child !== 'boolean') {
91
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
92
+ child = String(child);
93
+ }
94
+ if (simple && lastSimple) {
95
+ // If the previous child was simple (string), we merge both
96
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
97
+ }
98
+ else {
99
+ // Append a new vNode, if it's text, we create a text vNode
100
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
101
+ }
102
+ lastSimple = simple;
103
+ }
104
+ }
105
+ };
106
+ walk(children);
107
+ if (vnodeData) {
108
+ {
109
+ const classData = vnodeData.className || vnodeData.class;
110
+ if (classData) {
111
+ vnodeData.class =
112
+ typeof classData !== 'object'
113
+ ? classData
114
+ : Object.keys(classData)
115
+ .filter((k) => classData[k])
116
+ .join(' ');
117
+ }
118
+ }
119
+ }
120
+ const vnode = newVNode(nodeName, null);
121
+ vnode.$attrs$ = vnodeData;
122
+ if (vNodeChildren.length > 0) {
123
+ vnode.$children$ = vNodeChildren;
124
+ }
125
+ return vnode;
126
+ };
127
+ /**
128
+ * A utility function for creating a virtual DOM node from a tag and some
129
+ * possible text content.
130
+ *
131
+ * @param tag the tag for this element
132
+ * @param text possible text content for the node
133
+ * @returns a newly-minted virtual DOM node
134
+ */
135
+ const newVNode = (tag, text) => {
136
+ const vnode = {
137
+ $flags$: 0,
138
+ $tag$: tag,
139
+ $text$: text,
140
+ $elm$: null,
141
+ $children$: null,
142
+ };
143
+ {
144
+ vnode.$attrs$ = null;
145
+ }
146
+ return vnode;
147
+ };
148
+ const Host = {};
149
+ /**
150
+ * Check whether a given node is a Host node or not
151
+ *
152
+ * @param node the virtual DOM node to check
153
+ * @returns whether it's a Host node or not
154
+ */
155
+ const isHost = (node) => node && node.$tag$ === Host;
156
+ /**
157
+ * Parse a new property value for a given property type.
158
+ *
159
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
160
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
161
+ * 1. `any`, the type given to `propValue` in the function signature
162
+ * 2. the type stored from `propType`.
163
+ *
164
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
165
+ *
166
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
167
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
168
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
169
+ * ```tsx
170
+ * <my-cmp prop-val={0}></my-cmp>
171
+ * ```
172
+ *
173
+ * HTML prop values on the other hand, will always a string
174
+ *
175
+ * @param propValue the new value to coerce to some type
176
+ * @param propType the type of the prop, expressed as a binary number
177
+ * @returns the parsed/coerced value
178
+ */
179
+ const parsePropertyValue = (propValue, propType) => {
180
+ // ensure this value is of the correct prop type
181
+ if (propValue != null && !isComplexType(propValue)) {
182
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
183
+ // could have been passed as a number or boolean
184
+ // but we still want it as a string
185
+ return String(propValue);
186
+ }
187
+ // redundant return here for better minification
188
+ return propValue;
189
+ }
190
+ // not sure exactly what type we want
191
+ // so no need to change to a different type
192
+ return propValue;
193
+ };
194
+ /**
195
+ * Helper function to create & dispatch a custom Event on a provided target
196
+ * @param elm the target of the Event
197
+ * @param name the name to give the custom Event
198
+ * @param opts options for configuring a custom Event
199
+ * @returns the custom Event
200
+ */
201
+ const emitEvent = (elm, name, opts) => {
202
+ const ev = plt.ce(name, opts);
203
+ elm.dispatchEvent(ev);
204
+ return ev;
205
+ };
206
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
207
+ const registerStyle = (scopeId, cssText, allowCS) => {
208
+ let style = styles.get(scopeId);
209
+ if (supportsConstructableStylesheets && allowCS) {
210
+ style = (style || new CSSStyleSheet());
211
+ if (typeof style === 'string') {
212
+ style = cssText;
213
+ }
214
+ else {
215
+ style.replaceSync(cssText);
216
+ }
217
+ }
218
+ else {
219
+ style = cssText;
220
+ }
221
+ styles.set(scopeId, style);
222
+ };
223
+ const addStyle = (styleContainerNode, cmpMeta, mode) => {
224
+ var _a;
225
+ const scopeId = getScopeId(cmpMeta);
226
+ const style = styles.get(scopeId);
227
+ // if an element is NOT connected then getRootNode() will return the wrong root node
228
+ // so the fallback is to always use the document for the root node in those cases
229
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
230
+ if (style) {
231
+ if (typeof style === 'string') {
232
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
233
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
234
+ let styleElm;
235
+ if (!appliedStyles) {
236
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
237
+ }
238
+ if (!appliedStyles.has(scopeId)) {
239
+ {
240
+ styleElm = doc.createElement('style');
241
+ styleElm.innerHTML = style;
242
+ // Apply CSP nonce to the style tag if it exists
243
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
244
+ if (nonce != null) {
245
+ styleElm.setAttribute('nonce', nonce);
246
+ }
247
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
248
+ }
249
+ if (appliedStyles) {
250
+ appliedStyles.add(scopeId);
251
+ }
252
+ }
253
+ }
254
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
255
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
256
+ }
257
+ }
258
+ return scopeId;
259
+ };
260
+ const attachStyles = (hostRef) => {
261
+ const cmpMeta = hostRef.$cmpMeta$;
262
+ const elm = hostRef.$hostElement$;
263
+ const flags = cmpMeta.$flags$;
264
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
265
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
266
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
267
+ // only required when we're NOT using native shadow dom (slot)
268
+ // or this browser doesn't support native shadow dom
269
+ // and this host element was NOT created with SSR
270
+ // let's pick out the inner content for slot projection
271
+ // create a node to represent where the original
272
+ // content was first placed, which is useful later on
273
+ // DOM WRITE!!
274
+ elm['s-sc'] = scopeId;
275
+ elm.classList.add(scopeId + '-h');
276
+ }
277
+ endAttachStyles();
278
+ };
279
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
280
+ /**
281
+ * Production setAccessor() function based on Preact by
282
+ * Jason Miller (@developit)
283
+ * Licensed under the MIT License
284
+ * https://github.com/developit/preact/blob/master/LICENSE
285
+ *
286
+ * Modified for Stencil's compiler and vdom
287
+ */
288
+ /**
289
+ * When running a VDom render set properties present on a VDom node onto the
290
+ * corresponding HTML element.
291
+ *
292
+ * Note that this function has special functionality for the `class`,
293
+ * `style`, `key`, and `ref` attributes, as well as event handlers (like
294
+ * `onClick`, etc). All others are just passed through as-is.
295
+ *
296
+ * @param elm the HTMLElement onto which attributes should be set
297
+ * @param memberName the name of the attribute to set
298
+ * @param oldValue the old value for the attribute
299
+ * @param newValue the new value for the attribute
300
+ * @param isSvg whether we're in an svg context or not
301
+ * @param flags bitflags for Vdom variables
302
+ */
303
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
304
+ if (oldValue !== newValue) {
305
+ let isProp = isMemberInElement(elm, memberName);
306
+ let ln = memberName.toLowerCase();
307
+ if (memberName === 'class') {
308
+ const classList = elm.classList;
309
+ const oldClasses = parseClassList(oldValue);
310
+ const newClasses = parseClassList(newValue);
311
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
312
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
313
+ }
314
+ else {
315
+ // Set property if it exists and it's not a SVG
316
+ const isComplex = isComplexType(newValue);
317
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
318
+ try {
319
+ if (!elm.tagName.includes('-')) {
320
+ const n = newValue == null ? '' : newValue;
321
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
322
+ if (memberName === 'list') {
323
+ isProp = false;
324
+ }
325
+ else if (oldValue == null || elm[memberName] != n) {
326
+ elm[memberName] = n;
327
+ }
328
+ }
329
+ else {
330
+ elm[memberName] = newValue;
331
+ }
332
+ }
333
+ catch (e) { }
334
+ }
335
+ /**
336
+ * Need to manually update attribute if:
337
+ * - memberName is not an attribute
338
+ * - if we are rendering the host element in order to reflect attribute
339
+ * - if it's a SVG, since properties might not work in <svg>
340
+ * - if the newValue is null/undefined or 'false'.
341
+ */
342
+ let xlink = false;
343
+ {
344
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
345
+ memberName = ln;
346
+ xlink = true;
347
+ }
348
+ }
349
+ if (newValue == null || newValue === false) {
350
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
351
+ if (xlink) {
352
+ elm.removeAttributeNS(XLINK_NS, memberName);
353
+ }
354
+ else {
355
+ elm.removeAttribute(memberName);
356
+ }
357
+ }
358
+ }
359
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
360
+ newValue = newValue === true ? '' : newValue;
361
+ if (xlink) {
362
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
363
+ }
364
+ else {
365
+ elm.setAttribute(memberName, newValue);
366
+ }
367
+ }
368
+ }
369
+ }
370
+ };
371
+ const parseClassListRegex = /\s/;
372
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
373
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
374
+ // if the element passed in is a shadow root, which is a document fragment
375
+ // then we want to be adding attrs/props to the shadow root's "host" element
376
+ // if it's not a shadow root, then we add attrs/props to the same element
377
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
378
+ ? newVnode.$elm$.host
379
+ : newVnode.$elm$;
380
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
381
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
382
+ {
383
+ // remove attributes no longer present on the vnode by setting them to undefined
384
+ for (memberName in oldVnodeAttrs) {
385
+ if (!(memberName in newVnodeAttrs)) {
386
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
387
+ }
388
+ }
389
+ }
390
+ // add new & update changed attributes
391
+ for (memberName in newVnodeAttrs) {
392
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
393
+ }
394
+ };
395
+ /**
396
+ * Create a DOM Node corresponding to one of the children of a given VNode.
397
+ *
398
+ * @param oldParentVNode the parent VNode from the previous render
399
+ * @param newParentVNode the parent VNode from the current render
400
+ * @param childIndex the index of the VNode, in the _new_ parent node's
401
+ * children, for which we will create a new DOM node
402
+ * @param parentElm the parent DOM node which our new node will be a child of
403
+ * @returns the newly created node
404
+ */
405
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
406
+ // tslint:disable-next-line: prefer-const
407
+ const newVNode = newParentVNode.$children$[childIndex];
408
+ let i = 0;
409
+ let elm;
410
+ let childNode;
411
+ if (newVNode.$text$ !== null) {
412
+ // create text node
413
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
414
+ }
415
+ else {
416
+ if (!isSvgMode) {
417
+ isSvgMode = newVNode.$tag$ === 'svg';
418
+ }
419
+ // create element
420
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
421
+ );
422
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
423
+ isSvgMode = false;
424
+ }
425
+ // add css classes, attrs, props, listeners, etc.
426
+ {
427
+ updateElement(null, newVNode, isSvgMode);
428
+ }
429
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
430
+ // if there is a scopeId and this is the initial render
431
+ // then let's add the scopeId as a css class
432
+ elm.classList.add((elm['s-si'] = scopeId));
433
+ }
434
+ if (newVNode.$children$) {
435
+ for (i = 0; i < newVNode.$children$.length; ++i) {
436
+ // create the node
437
+ childNode = createElm(oldParentVNode, newVNode, i);
438
+ // return node could have been null
439
+ if (childNode) {
440
+ // append our new node
441
+ elm.appendChild(childNode);
442
+ }
443
+ }
444
+ }
445
+ {
446
+ if (newVNode.$tag$ === 'svg') {
447
+ // Only reset the SVG context when we're exiting <svg> element
448
+ isSvgMode = false;
449
+ }
450
+ else if (elm.tagName === 'foreignObject') {
451
+ // Reenter SVG context when we're exiting <foreignObject> element
452
+ isSvgMode = true;
453
+ }
454
+ }
455
+ }
456
+ return elm;
457
+ };
458
+ /**
459
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
460
+ * add them to the DOM in the appropriate place.
461
+ *
462
+ * @param parentElm the DOM node which should be used as a parent for the new
463
+ * DOM nodes
464
+ * @param before a child of the `parentElm` which the new children should be
465
+ * inserted before (optional)
466
+ * @param parentVNode the parent virtual DOM node
467
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
468
+ * @param startIdx the index in the child virtual DOM nodes at which to start
469
+ * creating DOM nodes (inclusive)
470
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
471
+ * creating DOM nodes (inclusive)
472
+ */
473
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
474
+ let containerElm = (parentElm);
475
+ let childNode;
476
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
477
+ containerElm = containerElm.shadowRoot;
478
+ }
479
+ for (; startIdx <= endIdx; ++startIdx) {
480
+ if (vnodes[startIdx]) {
481
+ childNode = createElm(null, parentVNode, startIdx);
482
+ if (childNode) {
483
+ vnodes[startIdx].$elm$ = childNode;
484
+ containerElm.insertBefore(childNode, before);
485
+ }
486
+ }
487
+ }
488
+ };
489
+ /**
490
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
491
+ * This can be used to, for instance, clean up after a list of children which
492
+ * should no longer be shown.
493
+ *
494
+ * This function also handles some of Stencil's slot relocation logic.
495
+ *
496
+ * @param vnodes a list of virtual DOM nodes to remove
497
+ * @param startIdx the index at which to start removing nodes (inclusive)
498
+ * @param endIdx the index at which to stop removing nodes (inclusive)
499
+ */
500
+ const removeVnodes = (vnodes, startIdx, endIdx) => {
501
+ for (let index = startIdx; index <= endIdx; ++index) {
502
+ const vnode = vnodes[index];
503
+ if (vnode) {
504
+ const elm = vnode.$elm$;
505
+ if (elm) {
506
+ // remove the vnode's element from the dom
507
+ elm.remove();
508
+ }
509
+ }
510
+ }
511
+ };
512
+ /**
513
+ * Reconcile the children of a new VNode with the children of an old VNode by
514
+ * traversing the two collections of children, identifying nodes that are
515
+ * conserved or changed, calling out to `patch` to make any necessary
516
+ * updates to the DOM, and rearranging DOM nodes as needed.
517
+ *
518
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
519
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
520
+ * 'windows' by storing start and end indices and references to the
521
+ * corresponding array entries. Initially the two 'windows' are basically equal
522
+ * to the entire array, but we progressively narrow the windows until there are
523
+ * no children left to update by doing the following:
524
+ *
525
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
526
+ * that if we have an initial array like the following we'll end up dealing
527
+ * only with a window bounded by the highlighted elements:
528
+ *
529
+ * [null, null, VNode1 , ... , VNode2, null, null]
530
+ * ^^^^^^ ^^^^^^
531
+ *
532
+ * 2. Check to see if the elements at the head and tail positions are equal
533
+ * across the windows. This will basically detect elements which haven't
534
+ * been added, removed, or changed position, i.e. if you had the following
535
+ * VNode elements (represented as HTML):
536
+ *
537
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
538
+ * newVNode: `<div><p><span>THERE</span></p></div>`
539
+ *
540
+ * Then when comparing the children of the `<div>` tag we check the equality
541
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
542
+ * same tag in the same position, we'd be able to avoid completely
543
+ * re-rendering the subtree under them with a new DOM element and would just
544
+ * call out to `patch` to handle reconciling their children and so on.
545
+ *
546
+ * 3. Check, for both windows, to see if the element at the beginning of the
547
+ * window corresponds to the element at the end of the other window. This is
548
+ * a heuristic which will let us identify _some_ situations in which
549
+ * elements have changed position, for instance it _should_ detect that the
550
+ * children nodes themselves have not changed but merely moved in the
551
+ * following example:
552
+ *
553
+ * oldVNode: `<div><element-one /><element-two /></div>`
554
+ * newVNode: `<div><element-two /><element-one /></div>`
555
+ *
556
+ * If we find cases like this then we also need to move the concrete DOM
557
+ * elements corresponding to the moved children to write the re-order to the
558
+ * DOM.
559
+ *
560
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
561
+ * nodes in the old children which have the same key as the first element in
562
+ * our window on the new children. If we find such a node we handle calling
563
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
564
+ * what we find.
565
+ *
566
+ * Finally, once we've narrowed our 'windows' to the point that either of them
567
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
568
+ * insertion or deletion that needs to happen to get a DOM state that correctly
569
+ * reflects the new child VNodes. If, for instance, after our window on the old
570
+ * children has collapsed we still have more nodes on the new children that
571
+ * we haven't dealt with yet then we need to add them, or if the new children
572
+ * collapse but we still have unhandled _old_ children then we need to make
573
+ * sure the corresponding DOM nodes are removed.
574
+ *
575
+ * @param parentElm the node into which the parent VNode is rendered
576
+ * @param oldCh the old children of the parent node
577
+ * @param newVNode the new VNode which will replace the parent
578
+ * @param newCh the new children of the parent node
579
+ */
580
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
581
+ let oldStartIdx = 0;
582
+ let newStartIdx = 0;
583
+ let oldEndIdx = oldCh.length - 1;
584
+ let oldStartVnode = oldCh[0];
585
+ let oldEndVnode = oldCh[oldEndIdx];
586
+ let newEndIdx = newCh.length - 1;
587
+ let newStartVnode = newCh[0];
588
+ let newEndVnode = newCh[newEndIdx];
589
+ let node;
590
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
591
+ if (oldStartVnode == null) {
592
+ // VNode might have been moved left
593
+ oldStartVnode = oldCh[++oldStartIdx];
594
+ }
595
+ else if (oldEndVnode == null) {
596
+ oldEndVnode = oldCh[--oldEndIdx];
597
+ }
598
+ else if (newStartVnode == null) {
599
+ newStartVnode = newCh[++newStartIdx];
600
+ }
601
+ else if (newEndVnode == null) {
602
+ newEndVnode = newCh[--newEndIdx];
603
+ }
604
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
605
+ // if the start nodes are the same then we should patch the new VNode
606
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
607
+ // indices to reflect that. We don't need to move any DOM Nodes around
608
+ // since things are matched up in order.
609
+ patch(oldStartVnode, newStartVnode);
610
+ oldStartVnode = oldCh[++oldStartIdx];
611
+ newStartVnode = newCh[++newStartIdx];
612
+ }
613
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
614
+ // likewise, if the end nodes are the same we patch new onto old and
615
+ // decrement our end indices, and also likewise in this case we don't
616
+ // need to move any DOM Nodes.
617
+ patch(oldEndVnode, newEndVnode);
618
+ oldEndVnode = oldCh[--oldEndIdx];
619
+ newEndVnode = newCh[--newEndIdx];
620
+ }
621
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
622
+ patch(oldStartVnode, newEndVnode);
623
+ // We need to move the element for `oldStartVnode` into a position which
624
+ // will be appropriate for `newEndVnode`. For this we can use
625
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
626
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
627
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
628
+ //
629
+ // <old-start-node />
630
+ // <some-intervening-node />
631
+ // <old-end-node />
632
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
633
+ // <next-sibling />
634
+ //
635
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
636
+ // the node for `oldStartVnode` at the end of the children of
637
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
638
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
639
+ // append it to the children of the parent element.
640
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
641
+ oldStartVnode = oldCh[++oldStartIdx];
642
+ newEndVnode = newCh[--newEndIdx];
643
+ }
644
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
645
+ patch(oldEndVnode, newStartVnode);
646
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
647
+ // the same node, so since we're here we know that they are not. Thus we
648
+ // can move the element for `oldEndVnode` _before_ the element for
649
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
650
+ // future.
651
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
652
+ oldEndVnode = oldCh[--oldEndIdx];
653
+ newStartVnode = newCh[++newStartIdx];
654
+ }
655
+ else {
656
+ {
657
+ // We either didn't find an element in the old children that matches
658
+ // the key of the first new child OR the build is not using `key`
659
+ // attributes at all. In either case we need to create a new element
660
+ // for the new node.
661
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
662
+ newStartVnode = newCh[++newStartIdx];
663
+ }
664
+ if (node) {
665
+ // if we created a new node then handle inserting it to the DOM
666
+ {
667
+ oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
668
+ }
669
+ }
670
+ }
671
+ }
672
+ if (oldStartIdx > oldEndIdx) {
673
+ // we have some more new nodes to add which don't match up with old nodes
674
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
675
+ }
676
+ else if (newStartIdx > newEndIdx) {
677
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
678
+ // in the new array, so lets remove them (which entails cleaning up the
679
+ // relevant DOM nodes)
680
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
681
+ }
682
+ };
683
+ /**
684
+ * Compare two VNodes to determine if they are the same
685
+ *
686
+ * **NB**: This function is an equality _heuristic_ based on the available
687
+ * information set on the two VNodes and can be misleading under certain
688
+ * circumstances. In particular, if the two nodes do not have `key` attrs
689
+ * (available under `$key$` on VNodes) then the function falls back on merely
690
+ * checking that they have the same tag.
691
+ *
692
+ * So, in other words, if `key` attrs are not set on VNodes which may be
693
+ * changing order within a `children` array or something along those lines then
694
+ * we could obtain a false negative and then have to do needless re-rendering
695
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
696
+ *
697
+ * @param leftVNode the first VNode to check
698
+ * @param rightVNode the second VNode to check
699
+ * @returns whether they're equal or not
700
+ */
701
+ const isSameVnode = (leftVNode, rightVNode) => {
702
+ // compare if two vnode to see if they're "technically" the same
703
+ // need to have the same element tag, and same key to be the same
704
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
705
+ return true;
706
+ }
707
+ return false;
708
+ };
709
+ /**
710
+ * Handle reconciling an outdated VNode with a new one which corresponds to
711
+ * it. This function handles flushing updates to the DOM and reconciling the
712
+ * children of the two nodes (if any).
713
+ *
714
+ * @param oldVNode an old VNode whose DOM element and children we want to update
715
+ * @param newVNode a new VNode representing an updated version of the old one
716
+ */
717
+ const patch = (oldVNode, newVNode) => {
718
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
719
+ const oldChildren = oldVNode.$children$;
720
+ const newChildren = newVNode.$children$;
721
+ const tag = newVNode.$tag$;
722
+ const text = newVNode.$text$;
723
+ if (text === null) {
724
+ {
725
+ // test if we're rendering an svg element, or still rendering nodes inside of one
726
+ // only add this to the when the compiler sees we're using an svg somewhere
727
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
728
+ }
729
+ {
730
+ {
731
+ // either this is the first render of an element OR it's an update
732
+ // AND we already know it's possible it could have changed
733
+ // this updates the element's css classes, attrs, props, listeners, etc.
734
+ updateElement(oldVNode, newVNode, isSvgMode);
735
+ }
736
+ }
737
+ if (oldChildren !== null && newChildren !== null) {
738
+ // looks like there's child vnodes for both the old and new vnodes
739
+ // so we need to call `updateChildren` to reconcile them
740
+ updateChildren(elm, oldChildren, newVNode, newChildren);
741
+ }
742
+ else if (newChildren !== null) {
743
+ // no old child vnodes, but there are new child vnodes to add
744
+ if (oldVNode.$text$ !== null) {
745
+ // the old vnode was text, so be sure to clear it out
746
+ elm.textContent = '';
747
+ }
748
+ // add the new vnode children
749
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
750
+ }
751
+ else if (oldChildren !== null) {
752
+ // no new child vnodes, but there are old child vnodes to remove
753
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
754
+ }
755
+ if (isSvgMode && tag === 'svg') {
756
+ isSvgMode = false;
757
+ }
758
+ }
759
+ else if (oldVNode.$text$ !== text) {
760
+ // update the text content for the text only vnode
761
+ // and also only if the text is different than before
762
+ elm.data = text;
763
+ }
764
+ };
765
+ /**
766
+ * The main entry point for Stencil's virtual DOM-based rendering engine
767
+ *
768
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
769
+ * function will handle creating a virtual DOM tree with a single root, patching
770
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
771
+ * relocation, and reflecting attributes.
772
+ *
773
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
774
+ * the DOM node into which it should be rendered.
775
+ * @param renderFnResults the virtual DOM nodes to be rendered
776
+ * @param isInitialLoad whether or not this is the first call after page load
777
+ */
778
+ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
779
+ const hostElm = hostRef.$hostElement$;
780
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
781
+ // if `renderFnResults` is a Host node then we can use it directly. If not,
782
+ // we need to call `h` again to wrap the children of our component in a
783
+ // 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
784
+ // implicitly that the top-level vdom node is 1) an only child and 2)
785
+ // contains attrs that need to be set on the host element.
786
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
787
+ hostTagName = hostElm.tagName;
788
+ // On the first render and *only* on the first render we want to check for
789
+ // any attributes set on the host element which are also set on the vdom
790
+ // node. If we find them, we override the value on the VDom node attrs with
791
+ // the value from the host element, which allows developers building apps
792
+ // with Stencil components to override e.g. the `role` attribute on a
793
+ // component even if it's already set on the `Host`.
794
+ if (isInitialLoad && rootVnode.$attrs$) {
795
+ for (const key of Object.keys(rootVnode.$attrs$)) {
796
+ // We have a special implementation in `setAccessor` for `style` and
797
+ // `class` which reconciles values coming from the VDom with values
798
+ // already present on the DOM element, so we don't want to override those
799
+ // attributes on the VDom tree with values from the host element if they
800
+ // are present.
801
+ //
802
+ // Likewise, `ref` and `key` are special internal values for the Stencil
803
+ // runtime and we don't want to override those either.
804
+ if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
805
+ rootVnode.$attrs$[key] = hostElm[key];
806
+ }
807
+ }
808
+ }
809
+ rootVnode.$tag$ = null;
810
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
811
+ hostRef.$vnode$ = rootVnode;
812
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
813
+ {
814
+ scopeId = hostElm['s-sc'];
815
+ }
816
+ // synchronous patch
817
+ patch(oldVNode, rootVnode);
818
+ };
819
+ const attachToAncestor = (hostRef, ancestorComponent) => {
820
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
821
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
822
+ }
823
+ };
824
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
825
+ {
826
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
827
+ }
828
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
829
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
830
+ return;
831
+ }
832
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
833
+ // there is no ancestor component or the ancestor component
834
+ // has already fired off its lifecycle update then
835
+ // fire off the initial update
836
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
837
+ return writeTask(dispatch) ;
838
+ };
839
+ /**
840
+ * Dispatch initial-render and update lifecycle hooks, enqueuing calls to
841
+ * component lifecycle methods like `componentWillLoad` as well as
842
+ * {@link updateComponent}, which will kick off the virtual DOM re-render.
843
+ *
844
+ * @param hostRef a reference to a host DOM node
845
+ * @param isInitialLoad whether we're on the initial load or not
846
+ * @returns an empty Promise which is used to enqueue a series of operations for
847
+ * the component
848
+ */
849
+ const dispatchHooks = (hostRef, isInitialLoad) => {
850
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
851
+ const instance = hostRef.$lazyInstance$ ;
852
+ // We're going to use this variable together with `enqueue` to implement a
853
+ // little promise-based queue. We start out with it `undefined`. When we add
854
+ // the first function to the queue we'll set this variable to be that
855
+ // function's return value. When we attempt to add subsequent values to the
856
+ // queue we'll check that value and, if it was a `Promise`, we'll then chain
857
+ // the new function off of that `Promise` using `.then()`. This will give our
858
+ // queue two nice properties:
859
+ //
860
+ // 1. If all functions added to the queue are synchronous they'll be called
861
+ // synchronously right away.
862
+ // 2. If all functions added to the queue are asynchronous they'll all be
863
+ // called in order after `dispatchHooks` exits.
864
+ let maybePromise;
865
+ endSchedule();
866
+ return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
867
+ };
868
+ /**
869
+ * This function uses a Promise to implement a simple first-in, first-out queue
870
+ * of functions to be called.
871
+ *
872
+ * The queue is ordered on the basis of the first argument. If it's
873
+ * `undefined`, then nothing is on the queue yet, so the provided function can
874
+ * be called synchronously (although note that this function may return a
875
+ * `Promise`). The idea is that then the return value of that enqueueing
876
+ * operation is kept around, so that if it was a `Promise` then subsequent
877
+ * functions can be enqueued by calling this function again with that `Promise`
878
+ * as the first argument.
879
+ *
880
+ * @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
881
+ * @param fn a function to enqueue
882
+ * @returns either a `Promise` or the return value of the provided function
883
+ */
884
+ const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
885
+ /**
886
+ * Check that a value is a `Promise`. To check, we first see if the value is an
887
+ * instance of the `Promise` global. In a few circumstances, in particular if
888
+ * the global has been overwritten, this is could be misleading, so we also do
889
+ * a little 'duck typing' check to see if the `.then` property of the value is
890
+ * defined and a function.
891
+ *
892
+ * @param maybePromise it might be a promise!
893
+ * @returns whether it is or not
894
+ */
895
+ const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
896
+ (maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
897
+ /**
898
+ * Update a component given reference to its host elements and so on.
899
+ *
900
+ * @param hostRef an object containing references to the element's host node,
901
+ * VDom nodes, and other metadata
902
+ * @param instance a reference to the underlying host element where it will be
903
+ * rendered
904
+ * @param isInitialLoad whether or not this function is being called as part of
905
+ * the first render cycle
906
+ */
907
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
908
+ var _a;
909
+ const elm = hostRef.$hostElement$;
910
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
911
+ const rc = elm['s-rc'];
912
+ if (isInitialLoad) {
913
+ // DOM WRITE!
914
+ attachStyles(hostRef);
915
+ }
916
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
917
+ {
918
+ callRender(hostRef, instance, elm, isInitialLoad);
919
+ }
920
+ if (rc) {
921
+ // ok, so turns out there are some child host elements
922
+ // waiting on this parent element to load
923
+ // let's fire off all update callbacks waiting
924
+ rc.map((cb) => cb());
925
+ elm['s-rc'] = undefined;
926
+ }
927
+ endRender();
928
+ endUpdate();
929
+ {
930
+ const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
931
+ const postUpdate = () => postUpdateComponent(hostRef);
932
+ if (childrenPromises.length === 0) {
933
+ postUpdate();
934
+ }
935
+ else {
936
+ Promise.all(childrenPromises).then(postUpdate);
937
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
938
+ childrenPromises.length = 0;
939
+ }
940
+ }
941
+ };
942
+ /**
943
+ * Handle making the call to the VDom renderer with the proper context given
944
+ * various build variables
945
+ *
946
+ * @param hostRef an object containing references to the element's host node,
947
+ * VDom nodes, and other metadata
948
+ * @param instance a reference to the underlying host element where it will be
949
+ * rendered
950
+ * @param elm the Host element for the component
951
+ * @param isInitialLoad whether or not this function is being called as part of
952
+ * @returns an empty promise
953
+ */
954
+ const callRender = (hostRef, instance, elm, isInitialLoad) => {
955
+ try {
956
+ instance = instance.render() ;
957
+ {
958
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
959
+ }
960
+ {
961
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
962
+ }
963
+ {
964
+ {
965
+ // looks like we've got child nodes to render into this host element
966
+ // or we need to update the css class/attrs on the host element
967
+ // DOM WRITE!
968
+ {
969
+ renderVdom(hostRef, instance, isInitialLoad);
970
+ }
971
+ }
972
+ }
973
+ }
974
+ catch (e) {
975
+ consoleError(e, hostRef.$hostElement$);
976
+ }
977
+ return null;
978
+ };
979
+ const postUpdateComponent = (hostRef) => {
980
+ const tagName = hostRef.$cmpMeta$.$tagName$;
981
+ const elm = hostRef.$hostElement$;
982
+ const endPostUpdate = createTime('postUpdate', tagName);
983
+ const ancestorComponent = hostRef.$ancestorComponent$;
984
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
985
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
986
+ {
987
+ // DOM WRITE!
988
+ addHydratedFlag(elm);
989
+ }
990
+ endPostUpdate();
991
+ {
992
+ hostRef.$onReadyResolve$(elm);
993
+ if (!ancestorComponent) {
994
+ appDidLoad();
995
+ }
996
+ }
997
+ }
998
+ else {
999
+ endPostUpdate();
1000
+ }
1001
+ // load events fire from bottom to top
1002
+ // the deepest elements load first then bubbles up
1003
+ {
1004
+ if (hostRef.$onRenderResolve$) {
1005
+ hostRef.$onRenderResolve$();
1006
+ hostRef.$onRenderResolve$ = undefined;
1007
+ }
1008
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1009
+ nextTick(() => scheduleUpdate(hostRef, false));
1010
+ }
1011
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1012
+ }
1013
+ // ( •_•)
1014
+ // ( •_•)>⌐■-■
1015
+ // (⌐■_■)
1016
+ };
1017
+ const appDidLoad = (who) => {
1018
+ // on appload
1019
+ // we have finish the first big initial render
1020
+ {
1021
+ addHydratedFlag(doc.documentElement);
1022
+ }
1023
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1024
+ };
1025
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1026
+ ;
1027
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1028
+ const setValue = (ref, propName, newVal, cmpMeta) => {
1029
+ // check our new property value against our internal value
1030
+ const hostRef = getHostRef(ref);
1031
+ const oldVal = hostRef.$instanceValues$.get(propName);
1032
+ const flags = hostRef.$flags$;
1033
+ const instance = hostRef.$lazyInstance$ ;
1034
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1035
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1036
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1037
+ const didValueChange = newVal !== oldVal && !areBothNaN;
1038
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1039
+ // gadzooks! the property's value has changed!!
1040
+ // set our new value!
1041
+ hostRef.$instanceValues$.set(propName, newVal);
1042
+ if (instance) {
1043
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1044
+ // looks like this value actually changed, so we've got work to do!
1045
+ // but only if we've already rendered, otherwise just chill out
1046
+ // queue that we need to do an update, but don't worry about queuing
1047
+ // up millions cuz this function ensures it only runs once
1048
+ scheduleUpdate(hostRef, false);
1049
+ }
1050
+ }
1051
+ }
1052
+ };
1053
+ /**
1054
+ * Attach a series of runtime constructs to a compiled Stencil component
1055
+ * constructor, including getters and setters for the `@Prop` and `@State`
1056
+ * decorators, callbacks for when attributes change, and so on.
1057
+ *
1058
+ * @param Cstr the constructor for a component that we need to process
1059
+ * @param cmpMeta metadata collected previously about the component
1060
+ * @param flags a number used to store a series of bit flags
1061
+ * @returns a reference to the same constructor passed in (but now mutated)
1062
+ */
1063
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
1064
+ if (cmpMeta.$members$) {
1065
+ // It's better to have a const than two Object.entries()
1066
+ const members = Object.entries(cmpMeta.$members$);
1067
+ const prototype = Cstr.prototype;
1068
+ members.map(([memberName, [memberFlags]]) => {
1069
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1070
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1071
+ // proxyComponent - prop
1072
+ Object.defineProperty(prototype, memberName, {
1073
+ get() {
1074
+ // proxyComponent, get value
1075
+ return getValue(this, memberName);
1076
+ },
1077
+ set(newValue) {
1078
+ // proxyComponent, set value
1079
+ setValue(this, memberName, newValue, cmpMeta);
1080
+ },
1081
+ configurable: true,
1082
+ enumerable: true,
1083
+ });
1084
+ }
1085
+ });
1086
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1087
+ const attrNameToPropName = new Map();
1088
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1089
+ plt.jmp(() => {
1090
+ const propName = attrNameToPropName.get(attrName);
1091
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1092
+ // in the case where an attribute was set inline.
1093
+ // ```html
1094
+ // <my-component some-attribute="some-value"></my-component>
1095
+ // ```
1096
+ //
1097
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
1098
+ // programmatically changes it before it has been upgraded as shown below:
1099
+ //
1100
+ // ```html
1101
+ // <!-- this component has _not_ been upgraded yet -->
1102
+ // <my-component id="test" some-attribute="some-value"></my-component>
1103
+ // <script>
1104
+ // // grab non-upgraded component
1105
+ // el = document.querySelector("#test");
1106
+ // el.someAttribute = "another-value";
1107
+ // // upgrade component
1108
+ // customElements.define('my-component', MyComponent);
1109
+ // </script>
1110
+ // ```
1111
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
1112
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1113
+ // to the value that was set inline i.e. "some-value" from above example. When
1114
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
1115
+ //
1116
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
1117
+ // by connectedCallback as this attributeChangedCallback will not fire.
1118
+ //
1119
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1120
+ //
1121
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1122
+ // properties here given that this goes against best practices outlined here
1123
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1124
+ if (this.hasOwnProperty(propName)) {
1125
+ newValue = this[propName];
1126
+ delete this[propName];
1127
+ }
1128
+ else if (prototype.hasOwnProperty(propName) &&
1129
+ typeof this[propName] === 'number' &&
1130
+ this[propName] == newValue) {
1131
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1132
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1133
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1134
+ return;
1135
+ }
1136
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1137
+ });
1138
+ };
1139
+ // create an array of attributes to observe
1140
+ // and also create a map of html attribute name to js property name
1141
+ Cstr.observedAttributes = members
1142
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1143
+ .map(([propName, m]) => {
1144
+ const attrName = m[1] || propName;
1145
+ attrNameToPropName.set(attrName, propName);
1146
+ return attrName;
1147
+ });
1148
+ }
1149
+ }
1150
+ return Cstr;
1151
+ };
1152
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1153
+ // initializeComponent
1154
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1155
+ // Let the runtime know that the component has been initialized
1156
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1157
+ {
1158
+ // lazy loaded components
1159
+ // request the component's implementation to be
1160
+ // wired up with the host element
1161
+ Cstr = loadModule(cmpMeta);
1162
+ if (Cstr.then) {
1163
+ // Await creates a micro-task avoid if possible
1164
+ const endLoad = uniqueTime();
1165
+ Cstr = await Cstr;
1166
+ endLoad();
1167
+ }
1168
+ if (!Cstr.isProxied) {
1169
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1170
+ Cstr.isProxied = true;
1171
+ }
1172
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1173
+ // ok, time to construct the instance
1174
+ // but let's keep track of when we start and stop
1175
+ // so that the getters/setters don't incorrectly step on data
1176
+ {
1177
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1178
+ }
1179
+ // construct the lazy-loaded component implementation
1180
+ // passing the hostRef is very important during
1181
+ // construction in order to directly wire together the
1182
+ // host element and the lazy-loaded instance
1183
+ try {
1184
+ new Cstr(hostRef);
1185
+ }
1186
+ catch (e) {
1187
+ consoleError(e);
1188
+ }
1189
+ {
1190
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1191
+ }
1192
+ endNewInstance();
1193
+ }
1194
+ if (Cstr.style) {
1195
+ // this component has styles but we haven't registered them yet
1196
+ let style = Cstr.style;
1197
+ const scopeId = getScopeId(cmpMeta);
1198
+ if (!styles.has(scopeId)) {
1199
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1200
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1201
+ endRegisterStyles();
1202
+ }
1203
+ }
1204
+ }
1205
+ // we've successfully created a lazy instance
1206
+ const ancestorComponent = hostRef.$ancestorComponent$;
1207
+ const schedule = () => scheduleUpdate(hostRef, true);
1208
+ if (ancestorComponent && ancestorComponent['s-rc']) {
1209
+ // this is the initial load and this component it has an ancestor component
1210
+ // but the ancestor component has NOT fired its will update lifecycle yet
1211
+ // so let's just cool our jets and wait for the ancestor to continue first
1212
+ // this will get fired off when the ancestor component
1213
+ // finally gets around to rendering its lazy self
1214
+ // fire off the initial update
1215
+ ancestorComponent['s-rc'].push(schedule);
1216
+ }
1217
+ else {
1218
+ schedule();
1219
+ }
1220
+ };
1221
+ const fireConnectedCallback = (instance) => {
1222
+ };
1223
+ const connectedCallback = (elm) => {
1224
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1225
+ const hostRef = getHostRef(elm);
1226
+ const cmpMeta = hostRef.$cmpMeta$;
1227
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1228
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1229
+ // first time this component has connected
1230
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1231
+ {
1232
+ // find the first ancestor component (if there is one) and register
1233
+ // this component as one of the actively loading child components for its ancestor
1234
+ let ancestorComponent = elm;
1235
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1236
+ // climb up the ancestors looking for the first
1237
+ // component that hasn't finished its lifecycle update yet
1238
+ if (ancestorComponent['s-p']) {
1239
+ // we found this components first ancestor component
1240
+ // keep a reference to this component's ancestor component
1241
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1242
+ break;
1243
+ }
1244
+ }
1245
+ }
1246
+ // Lazy properties
1247
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1248
+ if (cmpMeta.$members$) {
1249
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1250
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1251
+ const value = elm[memberName];
1252
+ delete elm[memberName];
1253
+ elm[memberName] = value;
1254
+ }
1255
+ });
1256
+ }
1257
+ {
1258
+ initializeComponent(elm, hostRef, cmpMeta);
1259
+ }
1260
+ }
1261
+ else {
1262
+ // fire off connectedCallback() on component instance
1263
+ if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
1264
+ else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
1265
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1266
+ }
1267
+ }
1268
+ endConnected();
1269
+ }
1270
+ };
1271
+ const disconnectInstance = (instance) => {
1272
+ };
1273
+ const disconnectedCallback = async (elm) => {
1274
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1275
+ const hostRef = getHostRef(elm);
1276
+ if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
1277
+ else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
1278
+ hostRef.$onReadyPromise$.then(() => disconnectInstance());
1279
+ }
1280
+ }
1281
+ };
1282
+ const bootstrapLazy = (lazyBundles, options = {}) => {
1283
+ var _a;
1284
+ const endBootstrap = createTime();
1285
+ const cmpTags = [];
1286
+ const exclude = options.exclude || [];
1287
+ const customElements = win.customElements;
1288
+ const head = doc.head;
1289
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1290
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1291
+ const deferredConnectedCallbacks = [];
1292
+ let appLoadFallback;
1293
+ let isBootstrapping = true;
1294
+ Object.assign(plt, options);
1295
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1296
+ lazyBundles.map((lazyBundle) => {
1297
+ lazyBundle[1].map((compactMeta) => {
1298
+ const cmpMeta = {
1299
+ $flags$: compactMeta[0],
1300
+ $tagName$: compactMeta[1],
1301
+ $members$: compactMeta[2],
1302
+ $listeners$: compactMeta[3],
1303
+ };
1304
+ {
1305
+ cmpMeta.$members$ = compactMeta[2];
1306
+ }
1307
+ const tagName = cmpMeta.$tagName$;
1308
+ const HostElement = class extends HTMLElement {
1309
+ // StencilLazyHost
1310
+ constructor(self) {
1311
+ // @ts-ignore
1312
+ super(self);
1313
+ self = this;
1314
+ registerHost(self, cmpMeta);
1315
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1316
+ // this component is using shadow dom
1317
+ // and this browser supports shadow dom
1318
+ // add the read-only property "shadowRoot" to the host element
1319
+ // adding the shadow root build conditionals to minimize runtime
1320
+ {
1321
+ {
1322
+ self.attachShadow({ mode: 'open' });
1323
+ }
1324
+ }
1325
+ }
1326
+ }
1327
+ connectedCallback() {
1328
+ if (appLoadFallback) {
1329
+ clearTimeout(appLoadFallback);
1330
+ appLoadFallback = null;
1331
+ }
1332
+ if (isBootstrapping) {
1333
+ // connectedCallback will be processed once all components have been registered
1334
+ deferredConnectedCallbacks.push(this);
1335
+ }
1336
+ else {
1337
+ plt.jmp(() => connectedCallback(this));
1338
+ }
1339
+ }
1340
+ disconnectedCallback() {
1341
+ plt.jmp(() => disconnectedCallback(this));
1342
+ }
1343
+ componentOnReady() {
1344
+ return getHostRef(this).$onReadyPromise$;
1345
+ }
1346
+ };
1347
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1348
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1349
+ cmpTags.push(tagName);
1350
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1351
+ }
1352
+ });
1353
+ });
1354
+ {
1355
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1356
+ visibilityStyle.setAttribute('data-styles', '');
1357
+ // Apply CSP nonce to the style tag if it exists
1358
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1359
+ if (nonce != null) {
1360
+ visibilityStyle.setAttribute('nonce', nonce);
1361
+ }
1362
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1363
+ }
1364
+ // Process deferred connectedCallbacks now all components have been registered
1365
+ isBootstrapping = false;
1366
+ if (deferredConnectedCallbacks.length) {
1367
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
1368
+ }
1369
+ else {
1370
+ {
1371
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1372
+ }
1373
+ }
1374
+ // Fallback appLoad event
1375
+ endBootstrap();
1376
+ };
1377
+ /**
1378
+ * Assigns the given value to the nonce property on the runtime platform object.
1379
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1380
+ * @param nonce The value to be assigned to the platform nonce property.
1381
+ * @returns void
1382
+ */
1383
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1384
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1385
+ const getHostRef = (ref) => hostRefs.get(ref);
1386
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1387
+ const registerHost = (elm, cmpMeta) => {
1388
+ const hostRef = {
1389
+ $flags$: 0,
1390
+ $hostElement$: elm,
1391
+ $cmpMeta$: cmpMeta,
1392
+ $instanceValues$: new Map(),
1393
+ };
1394
+ {
1395
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1396
+ elm['s-p'] = [];
1397
+ elm['s-rc'] = [];
1398
+ }
1399
+ return hostRefs.set(elm, hostRef);
1400
+ };
1401
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1402
+ const consoleError = (e, el) => (0, console.error)(e, el);
1403
+ const cmpModules = /*@__PURE__*/ new Map();
1404
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1405
+ // loadModuleImport
1406
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1407
+ const bundleId = cmpMeta.$lazyBundleId$;
1408
+ const module = cmpModules.get(bundleId) ;
1409
+ if (module) {
1410
+ return module[exportName];
1411
+ }
1412
+
1413
+ if (!hmrVersionId || !BUILD.hotModuleReplacement) {
1414
+ const processMod = importedModule => {
1415
+ cmpModules.set(bundleId, importedModule);
1416
+ return importedModule[exportName];
1417
+ }
1418
+ switch(bundleId) {
1419
+
1420
+ case 'rhc-icon-info_2':
1421
+ return import(
1422
+ /* webpackMode: "lazy" */
1423
+ './rhc-icon-info_2.entry.js').then(processMod, consoleError);
1424
+ case 'rhc-icon-arrow-right':
1425
+ return import(
1426
+ /* webpackMode: "lazy" */
1427
+ './rhc-icon-arrow-right.entry.js').then(processMod, consoleError);
1428
+ case 'rhc-icon-calendar':
1429
+ return import(
1430
+ /* webpackMode: "lazy" */
1431
+ './rhc-icon-calendar.entry.js').then(processMod, consoleError);
1432
+ case 'rhc-icon-error':
1433
+ return import(
1434
+ /* webpackMode: "lazy" */
1435
+ './rhc-icon-error.entry.js').then(processMod, consoleError);
1436
+ case 'rhc-icon-success':
1437
+ return import(
1438
+ /* webpackMode: "lazy" */
1439
+ './rhc-icon-success.entry.js').then(processMod, consoleError);
1440
+ case 'rhc-icon-warning':
1441
+ return import(
1442
+ /* webpackMode: "lazy" */
1443
+ './rhc-icon-warning.entry.js').then(processMod, consoleError);
1444
+ }
1445
+ }
1446
+ return import(
1447
+ /* @vite-ignore */
1448
+ /* webpackInclude: /\.entry\.js$/ */
1449
+ /* webpackExclude: /\.system\.entry\.js$/ */
1450
+ /* webpackMode: "lazy" */
1451
+ `./${bundleId}.entry.js${''}`).then((importedModule) => {
1452
+ {
1453
+ cmpModules.set(bundleId, importedModule);
1454
+ }
1455
+ return importedModule[exportName];
1456
+ }, consoleError);
1457
+ };
1458
+ const styles = /*@__PURE__*/ new Map();
1459
+ const win = typeof window !== 'undefined' ? window : {};
1460
+ const doc = win.document || { head: {} };
1461
+ const plt = {
1462
+ $flags$: 0,
1463
+ $resourcesUrl$: '',
1464
+ jmp: (h) => h(),
1465
+ raf: (h) => requestAnimationFrame(h),
1466
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1467
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1468
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1469
+ };
1470
+ const promiseResolve = (v) => Promise.resolve(v);
1471
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1472
+ try {
1473
+ new CSSStyleSheet();
1474
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1475
+ }
1476
+ catch (e) { }
1477
+ return false;
1478
+ })()
1479
+ ;
1480
+ const queueDomReads = [];
1481
+ const queueDomWrites = [];
1482
+ const queueTask = (queue, write) => (cb) => {
1483
+ queue.push(cb);
1484
+ if (!queuePending) {
1485
+ queuePending = true;
1486
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1487
+ nextTick(flush);
1488
+ }
1489
+ else {
1490
+ plt.raf(flush);
1491
+ }
1492
+ }
1493
+ };
1494
+ const consume = (queue) => {
1495
+ for (let i = 0; i < queue.length; i++) {
1496
+ try {
1497
+ queue[i](performance.now());
1498
+ }
1499
+ catch (e) {
1500
+ consoleError(e);
1501
+ }
1502
+ }
1503
+ queue.length = 0;
1504
+ };
1505
+ const flush = () => {
1506
+ // always force a bunch of medium callbacks to run, but still have
1507
+ // a throttle on how many can run in a certain time
1508
+ // DOM READS!!!
1509
+ consume(queueDomReads);
1510
+ // DOM WRITES!!!
1511
+ {
1512
+ consume(queueDomWrites);
1513
+ if ((queuePending = queueDomReads.length > 0)) {
1514
+ // still more to do yet, but we've run out of time
1515
+ // let's let this thing cool off and try again in the next tick
1516
+ plt.raf(flush);
1517
+ }
1518
+ }
1519
+ };
1520
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1521
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1522
+
1523
+ export { bootstrapLazy as b, h, promiseResolve as p, registerInstance as r, setNonce as s };
1524
+
1525
+ //# sourceMappingURL=index-c2d82fd1.js.map