@everymatrix/bonus-elevate-levels 1.31.2

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