@everymatrix/gamification-dropdown 1.40.0

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