@ppg_pl/pallete 0.0.4 → 0.0.6

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