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