@everymatrix/casino-engagement-suite-jackpots-list 1.36.1

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 (49) hide show
  1. package/dist/casino-engagement-suite-jackpots-list/casino-engagement-suite-jackpots-list.esm.js +1 -0
  2. package/dist/casino-engagement-suite-jackpots-list/index.esm.js +0 -0
  3. package/dist/casino-engagement-suite-jackpots-list/p-a34aa41f.js +1 -0
  4. package/dist/casino-engagement-suite-jackpots-list/p-f5813d14.entry.js +1 -0
  5. package/dist/cjs/casino-engagement-suite-jackpots-list.cjs.entry.js +362 -0
  6. package/dist/cjs/casino-engagement-suite-jackpots-list.cjs.js +19 -0
  7. package/dist/cjs/index-9e718c74.js +1296 -0
  8. package/dist/cjs/index.cjs.js +2 -0
  9. package/dist/cjs/loader.cjs.js +21 -0
  10. package/dist/collection/collection-manifest.json +12 -0
  11. package/dist/collection/components/casino-engagement-suite-jackpots-list/casino-engagement-suite-jackpots-list.css +294 -0
  12. package/dist/collection/components/casino-engagement-suite-jackpots-list/casino-engagement-suite-jackpots-list.js +414 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/models/jackpot.js +1 -0
  15. package/dist/collection/utils/locale.utils.js +25 -0
  16. package/dist/collection/utils/utils.js +5 -0
  17. package/dist/components/casino-engagement-suite-jackpots-list.d.ts +11 -0
  18. package/dist/components/casino-engagement-suite-jackpots-list.js +386 -0
  19. package/dist/components/index.d.ts +26 -0
  20. package/dist/components/index.js +1 -0
  21. package/dist/esm/casino-engagement-suite-jackpots-list.entry.js +358 -0
  22. package/dist/esm/casino-engagement-suite-jackpots-list.js +17 -0
  23. package/dist/esm/index-f2db217f.js +1269 -0
  24. package/dist/esm/index.js +1 -0
  25. package/dist/esm/loader.js +17 -0
  26. package/dist/esm/polyfills/core-js.js +11 -0
  27. package/dist/esm/polyfills/css-shim.js +1 -0
  28. package/dist/esm/polyfills/dom.js +79 -0
  29. package/dist/esm/polyfills/es5-html-element.js +1 -0
  30. package/dist/esm/polyfills/index.js +34 -0
  31. package/dist/esm/polyfills/system.js +6 -0
  32. package/dist/index.cjs.js +1 -0
  33. package/dist/index.js +1 -0
  34. package/dist/stencil.config.js +22 -0
  35. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-engagement-suite-jackpots-list/.stencil/packages/casino-engagement-suite-jackpots-list/stencil.config.d.ts +2 -0
  36. package/dist/types/components/casino-engagement-suite-jackpots-list/casino-engagement-suite-jackpots-list.d.ts +62 -0
  37. package/dist/types/components.d.ts +87 -0
  38. package/dist/types/index.d.ts +1 -0
  39. package/dist/types/models/jackpot.d.ts +52 -0
  40. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  41. package/dist/types/utils/locale.utils.d.ts +1 -0
  42. package/dist/types/utils/utils.d.ts +1 -0
  43. package/loader/cdn.js +3 -0
  44. package/loader/index.cjs.js +3 -0
  45. package/loader/index.d.ts +12 -0
  46. package/loader/index.es2017.js +3 -0
  47. package/loader/index.js +4 -0
  48. package/loader/package.json +10 -0
  49. package/package.json +19 -0
@@ -0,0 +1,1296 @@
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 = 'casino-engagement-suite-jackpots-list';
24
+
25
+ let scopeId;
26
+ let hostTagName;
27
+ let isSvgMode = false;
28
+ let queuePending = false;
29
+ const win = typeof window !== 'undefined' ? window : {};
30
+ const doc = win.document || { head: {} };
31
+ const plt = {
32
+ $flags$: 0,
33
+ $resourcesUrl$: '',
34
+ jmp: (h) => h(),
35
+ raf: (h) => requestAnimationFrame(h),
36
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
37
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
38
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
39
+ };
40
+ const promiseResolve = (v) => Promise.resolve(v);
41
+ const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
42
+ try {
43
+ new CSSStyleSheet();
44
+ return typeof new CSSStyleSheet().replace === 'function';
45
+ }
46
+ catch (e) { }
47
+ return false;
48
+ })()
49
+ ;
50
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
51
+ if (listeners) {
52
+ listeners.map(([flags, name, method]) => {
53
+ const target = getHostListenerTarget(elm, flags) ;
54
+ const handler = hostListenerProxy(hostRef, method);
55
+ const opts = hostListenerOpts(flags);
56
+ plt.ael(target, name, handler, opts);
57
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
58
+ });
59
+ }
60
+ };
61
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
62
+ try {
63
+ {
64
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
65
+ // instance is ready, let's call it's member method for this event
66
+ hostRef.$lazyInstance$[methodName](ev);
67
+ }
68
+ else {
69
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
70
+ }
71
+ }
72
+ }
73
+ catch (e) {
74
+ consoleError(e);
75
+ }
76
+ };
77
+ const getHostListenerTarget = (elm, flags) => {
78
+ if (flags & 8 /* TargetWindow */)
79
+ return win;
80
+ return elm;
81
+ };
82
+ // prettier-ignore
83
+ const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
84
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
85
+ const createTime = (fnName, tagName = '') => {
86
+ {
87
+ return () => {
88
+ return;
89
+ };
90
+ }
91
+ };
92
+ const uniqueTime = (key, measureText) => {
93
+ {
94
+ return () => {
95
+ return;
96
+ };
97
+ }
98
+ };
99
+ const rootAppliedStyles = new WeakMap();
100
+ const registerStyle = (scopeId, cssText, allowCS) => {
101
+ let style = styles.get(scopeId);
102
+ if (supportsConstructibleStylesheets && allowCS) {
103
+ style = (style || new CSSStyleSheet());
104
+ style.replace(cssText);
105
+ }
106
+ else {
107
+ style = cssText;
108
+ }
109
+ styles.set(scopeId, style);
110
+ };
111
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
112
+ let scopeId = getScopeId(cmpMeta);
113
+ let style = styles.get(scopeId);
114
+ // if an element is NOT connected then getRootNode() will return the wrong root node
115
+ // so the fallback is to always use the document for the root node in those cases
116
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
117
+ if (style) {
118
+ if (typeof style === 'string') {
119
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
120
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
121
+ let styleElm;
122
+ if (!appliedStyles) {
123
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
124
+ }
125
+ if (!appliedStyles.has(scopeId)) {
126
+ {
127
+ {
128
+ styleElm = doc.createElement('style');
129
+ styleElm.innerHTML = style;
130
+ }
131
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
132
+ }
133
+ if (appliedStyles) {
134
+ appliedStyles.add(scopeId);
135
+ }
136
+ }
137
+ }
138
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
139
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
140
+ }
141
+ }
142
+ return scopeId;
143
+ };
144
+ const attachStyles = (hostRef) => {
145
+ const cmpMeta = hostRef.$cmpMeta$;
146
+ const elm = hostRef.$hostElement$;
147
+ const flags = cmpMeta.$flags$;
148
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
149
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
150
+ if (flags & 10 /* needsScopedEncapsulation */) {
151
+ // only required when we're NOT using native shadow dom (slot)
152
+ // or this browser doesn't support native shadow dom
153
+ // and this host element was NOT created with SSR
154
+ // let's pick out the inner content for slot projection
155
+ // create a node to represent where the original
156
+ // content was first placed, which is useful later on
157
+ // DOM WRITE!!
158
+ elm['s-sc'] = scopeId;
159
+ elm.classList.add(scopeId + '-h');
160
+ }
161
+ endAttachStyles();
162
+ };
163
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
164
+ /**
165
+ * Default style mode id
166
+ */
167
+ /**
168
+ * Reusable empty obj/array
169
+ * Don't add values to these!!
170
+ */
171
+ const EMPTY_OBJ = {};
172
+ const isDef = (v) => v != null;
173
+ const isComplexType = (o) => {
174
+ // https://jsperf.com/typeof-fn-object/5
175
+ o = typeof o;
176
+ return o === 'object' || o === 'function';
177
+ };
178
+ /**
179
+ * Production h() function based on Preact by
180
+ * Jason Miller (@developit)
181
+ * Licensed under the MIT License
182
+ * https://github.com/developit/preact/blob/master/LICENSE
183
+ *
184
+ * Modified for Stencil's compiler and vdom
185
+ */
186
+ // const stack: any[] = [];
187
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
188
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
189
+ const h = (nodeName, vnodeData, ...children) => {
190
+ let child = null;
191
+ let key = null;
192
+ let simple = false;
193
+ let lastSimple = false;
194
+ let vNodeChildren = [];
195
+ const walk = (c) => {
196
+ for (let i = 0; i < c.length; i++) {
197
+ child = c[i];
198
+ if (Array.isArray(child)) {
199
+ walk(child);
200
+ }
201
+ else if (child != null && typeof child !== 'boolean') {
202
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
203
+ child = String(child);
204
+ }
205
+ if (simple && lastSimple) {
206
+ // If the previous child was simple (string), we merge both
207
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
208
+ }
209
+ else {
210
+ // Append a new vNode, if it's text, we create a text vNode
211
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
212
+ }
213
+ lastSimple = simple;
214
+ }
215
+ }
216
+ };
217
+ walk(children);
218
+ if (vnodeData) {
219
+ // normalize class / classname attributes
220
+ if (vnodeData.key) {
221
+ key = vnodeData.key;
222
+ }
223
+ {
224
+ const classData = vnodeData.className || vnodeData.class;
225
+ if (classData) {
226
+ vnodeData.class =
227
+ typeof classData !== 'object'
228
+ ? classData
229
+ : Object.keys(classData)
230
+ .filter((k) => classData[k])
231
+ .join(' ');
232
+ }
233
+ }
234
+ }
235
+ const vnode = newVNode(nodeName, null);
236
+ vnode.$attrs$ = vnodeData;
237
+ if (vNodeChildren.length > 0) {
238
+ vnode.$children$ = vNodeChildren;
239
+ }
240
+ {
241
+ vnode.$key$ = key;
242
+ }
243
+ return vnode;
244
+ };
245
+ const newVNode = (tag, text) => {
246
+ const vnode = {
247
+ $flags$: 0,
248
+ $tag$: tag,
249
+ $text$: text,
250
+ $elm$: null,
251
+ $children$: null,
252
+ };
253
+ {
254
+ vnode.$attrs$ = null;
255
+ }
256
+ {
257
+ vnode.$key$ = null;
258
+ }
259
+ return vnode;
260
+ };
261
+ const Host = {};
262
+ const isHost = (node) => node && node.$tag$ === Host;
263
+ /**
264
+ * Production setAccessor() function based on Preact by
265
+ * Jason Miller (@developit)
266
+ * Licensed under the MIT License
267
+ * https://github.com/developit/preact/blob/master/LICENSE
268
+ *
269
+ * Modified for Stencil's compiler and vdom
270
+ */
271
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
272
+ if (oldValue !== newValue) {
273
+ let isProp = isMemberInElement(elm, memberName);
274
+ let ln = memberName.toLowerCase();
275
+ if (memberName === 'class') {
276
+ const classList = elm.classList;
277
+ const oldClasses = parseClassList(oldValue);
278
+ const newClasses = parseClassList(newValue);
279
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
280
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
281
+ }
282
+ else if (memberName === 'key')
283
+ ;
284
+ else if ((!isProp ) &&
285
+ memberName[0] === 'o' &&
286
+ memberName[1] === 'n') {
287
+ // Event Handlers
288
+ // so if the member name starts with "on" and the 3rd characters is
289
+ // a capital letter, and it's not already a member on the element,
290
+ // then we're assuming it's an event listener
291
+ if (memberName[2] === '-') {
292
+ // on- prefixed events
293
+ // allows to be explicit about the dom event to listen without any magic
294
+ // under the hood:
295
+ // <my-cmp on-click> // listens for "click"
296
+ // <my-cmp on-Click> // listens for "Click"
297
+ // <my-cmp on-ionChange> // listens for "ionChange"
298
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
299
+ memberName = memberName.slice(3);
300
+ }
301
+ else if (isMemberInElement(win, ln)) {
302
+ // standard event
303
+ // the JSX attribute could have been "onMouseOver" and the
304
+ // member name "onmouseover" is on the window's prototype
305
+ // so let's add the listener "mouseover", which is all lowercased
306
+ memberName = ln.slice(2);
307
+ }
308
+ else {
309
+ // custom event
310
+ // the JSX attribute could have been "onMyCustomEvent"
311
+ // so let's trim off the "on" prefix and lowercase the first character
312
+ // and add the listener "myCustomEvent"
313
+ // except for the first character, we keep the event name case
314
+ memberName = ln[2] + memberName.slice(3);
315
+ }
316
+ if (oldValue) {
317
+ plt.rel(elm, memberName, oldValue, false);
318
+ }
319
+ if (newValue) {
320
+ plt.ael(elm, memberName, newValue, false);
321
+ }
322
+ }
323
+ else {
324
+ // Set property if it exists and it's not a SVG
325
+ const isComplex = isComplexType(newValue);
326
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
327
+ try {
328
+ if (!elm.tagName.includes('-')) {
329
+ let n = newValue == null ? '' : newValue;
330
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
331
+ if (memberName === 'list') {
332
+ isProp = false;
333
+ }
334
+ else if (oldValue == null || elm[memberName] != n) {
335
+ elm[memberName] = n;
336
+ }
337
+ }
338
+ else {
339
+ elm[memberName] = newValue;
340
+ }
341
+ }
342
+ catch (e) { }
343
+ }
344
+ if (newValue == null || newValue === false) {
345
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
346
+ {
347
+ elm.removeAttribute(memberName);
348
+ }
349
+ }
350
+ }
351
+ else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
352
+ newValue = newValue === true ? '' : newValue;
353
+ {
354
+ elm.setAttribute(memberName, newValue);
355
+ }
356
+ }
357
+ }
358
+ }
359
+ };
360
+ const parseClassListRegex = /\s/;
361
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
362
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
363
+ // if the element passed in is a shadow root, which is a document fragment
364
+ // then we want to be adding attrs/props to the shadow root's "host" element
365
+ // if it's not a shadow root, then we add attrs/props to the same element
366
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
367
+ ? newVnode.$elm$.host
368
+ : newVnode.$elm$;
369
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
370
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
371
+ {
372
+ // remove attributes no longer present on the vnode by setting them to undefined
373
+ for (memberName in oldVnodeAttrs) {
374
+ if (!(memberName in newVnodeAttrs)) {
375
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
376
+ }
377
+ }
378
+ }
379
+ // add new & update changed attributes
380
+ for (memberName in newVnodeAttrs) {
381
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
382
+ }
383
+ };
384
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
385
+ // tslint:disable-next-line: prefer-const
386
+ let newVNode = newParentVNode.$children$[childIndex];
387
+ let i = 0;
388
+ let elm;
389
+ let childNode;
390
+ if (newVNode.$text$ !== null) {
391
+ // create text node
392
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
393
+ }
394
+ else {
395
+ // create element
396
+ elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
397
+ // add css classes, attrs, props, listeners, etc.
398
+ {
399
+ updateElement(null, newVNode, isSvgMode);
400
+ }
401
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
402
+ // if there is a scopeId and this is the initial render
403
+ // then let's add the scopeId as a css class
404
+ elm.classList.add((elm['s-si'] = scopeId));
405
+ }
406
+ if (newVNode.$children$) {
407
+ for (i = 0; i < newVNode.$children$.length; ++i) {
408
+ // create the node
409
+ childNode = createElm(oldParentVNode, newVNode, i);
410
+ // return node could have been null
411
+ if (childNode) {
412
+ // append our new node
413
+ elm.appendChild(childNode);
414
+ }
415
+ }
416
+ }
417
+ }
418
+ return elm;
419
+ };
420
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
421
+ let containerElm = (parentElm);
422
+ let childNode;
423
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
424
+ containerElm = containerElm.shadowRoot;
425
+ }
426
+ for (; startIdx <= endIdx; ++startIdx) {
427
+ if (vnodes[startIdx]) {
428
+ childNode = createElm(null, parentVNode, startIdx);
429
+ if (childNode) {
430
+ vnodes[startIdx].$elm$ = childNode;
431
+ containerElm.insertBefore(childNode, before);
432
+ }
433
+ }
434
+ }
435
+ };
436
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
437
+ for (; startIdx <= endIdx; ++startIdx) {
438
+ if ((vnode = vnodes[startIdx])) {
439
+ elm = vnode.$elm$;
440
+ // remove the vnode's element from the dom
441
+ elm.remove();
442
+ }
443
+ }
444
+ };
445
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
446
+ let oldStartIdx = 0;
447
+ let newStartIdx = 0;
448
+ let idxInOld = 0;
449
+ let i = 0;
450
+ let oldEndIdx = oldCh.length - 1;
451
+ let oldStartVnode = oldCh[0];
452
+ let oldEndVnode = oldCh[oldEndIdx];
453
+ let newEndIdx = newCh.length - 1;
454
+ let newStartVnode = newCh[0];
455
+ let newEndVnode = newCh[newEndIdx];
456
+ let node;
457
+ let elmToMove;
458
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
459
+ if (oldStartVnode == null) {
460
+ // Vnode might have been moved left
461
+ oldStartVnode = oldCh[++oldStartIdx];
462
+ }
463
+ else if (oldEndVnode == null) {
464
+ oldEndVnode = oldCh[--oldEndIdx];
465
+ }
466
+ else if (newStartVnode == null) {
467
+ newStartVnode = newCh[++newStartIdx];
468
+ }
469
+ else if (newEndVnode == null) {
470
+ newEndVnode = newCh[--newEndIdx];
471
+ }
472
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
473
+ patch(oldStartVnode, newStartVnode);
474
+ oldStartVnode = oldCh[++oldStartIdx];
475
+ newStartVnode = newCh[++newStartIdx];
476
+ }
477
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
478
+ patch(oldEndVnode, newEndVnode);
479
+ oldEndVnode = oldCh[--oldEndIdx];
480
+ newEndVnode = newCh[--newEndIdx];
481
+ }
482
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
483
+ patch(oldStartVnode, newEndVnode);
484
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
485
+ oldStartVnode = oldCh[++oldStartIdx];
486
+ newEndVnode = newCh[--newEndIdx];
487
+ }
488
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
489
+ patch(oldEndVnode, newStartVnode);
490
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
491
+ oldEndVnode = oldCh[--oldEndIdx];
492
+ newStartVnode = newCh[++newStartIdx];
493
+ }
494
+ else {
495
+ // createKeyToOldIdx
496
+ idxInOld = -1;
497
+ {
498
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
499
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
500
+ idxInOld = i;
501
+ break;
502
+ }
503
+ }
504
+ }
505
+ if (idxInOld >= 0) {
506
+ elmToMove = oldCh[idxInOld];
507
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
508
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
509
+ }
510
+ else {
511
+ patch(elmToMove, newStartVnode);
512
+ oldCh[idxInOld] = undefined;
513
+ node = elmToMove.$elm$;
514
+ }
515
+ newStartVnode = newCh[++newStartIdx];
516
+ }
517
+ else {
518
+ // new element
519
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
520
+ newStartVnode = newCh[++newStartIdx];
521
+ }
522
+ if (node) {
523
+ {
524
+ oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
525
+ }
526
+ }
527
+ }
528
+ }
529
+ if (oldStartIdx > oldEndIdx) {
530
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
531
+ }
532
+ else if (newStartIdx > newEndIdx) {
533
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
534
+ }
535
+ };
536
+ const isSameVnode = (vnode1, vnode2) => {
537
+ // compare if two vnode to see if they're "technically" the same
538
+ // need to have the same element tag, and same key to be the same
539
+ if (vnode1.$tag$ === vnode2.$tag$) {
540
+ {
541
+ return vnode1.$key$ === vnode2.$key$;
542
+ }
543
+ }
544
+ return false;
545
+ };
546
+ const patch = (oldVNode, newVNode) => {
547
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
548
+ const oldChildren = oldVNode.$children$;
549
+ const newChildren = newVNode.$children$;
550
+ const text = newVNode.$text$;
551
+ if (text === null) {
552
+ // element node
553
+ {
554
+ {
555
+ // either this is the first render of an element OR it's an update
556
+ // AND we already know it's possible it could have changed
557
+ // this updates the element's css classes, attrs, props, listeners, etc.
558
+ updateElement(oldVNode, newVNode, isSvgMode);
559
+ }
560
+ }
561
+ if (oldChildren !== null && newChildren !== null) {
562
+ // looks like there's child vnodes for both the old and new vnodes
563
+ updateChildren(elm, oldChildren, newVNode, newChildren);
564
+ }
565
+ else if (newChildren !== null) {
566
+ // no old child vnodes, but there are new child vnodes to add
567
+ if (oldVNode.$text$ !== null) {
568
+ // the old vnode was text, so be sure to clear it out
569
+ elm.textContent = '';
570
+ }
571
+ // add the new vnode children
572
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
573
+ }
574
+ else if (oldChildren !== null) {
575
+ // no new child vnodes, but there are old child vnodes to remove
576
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
577
+ }
578
+ }
579
+ else if (oldVNode.$text$ !== text) {
580
+ // update the text content for the text only vnode
581
+ // and also only if the text is different than before
582
+ elm.data = text;
583
+ }
584
+ };
585
+ const renderVdom = (hostRef, renderFnResults) => {
586
+ const hostElm = hostRef.$hostElement$;
587
+ const cmpMeta = hostRef.$cmpMeta$;
588
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
589
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
590
+ hostTagName = hostElm.tagName;
591
+ if (cmpMeta.$attrsToReflect$) {
592
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
593
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
594
+ }
595
+ rootVnode.$tag$ = null;
596
+ rootVnode.$flags$ |= 4 /* isHost */;
597
+ hostRef.$vnode$ = rootVnode;
598
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
599
+ {
600
+ scopeId = hostElm['s-sc'];
601
+ }
602
+ // synchronous patch
603
+ patch(oldVNode, rootVnode);
604
+ };
605
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
606
+ const createEvent = (ref, name, flags) => {
607
+ const elm = getElement(ref);
608
+ return {
609
+ emit: (detail) => {
610
+ return emitEvent(elm, name, {
611
+ bubbles: !!(flags & 4 /* Bubbles */),
612
+ composed: !!(flags & 2 /* Composed */),
613
+ cancelable: !!(flags & 1 /* Cancellable */),
614
+ detail,
615
+ });
616
+ },
617
+ };
618
+ };
619
+ /**
620
+ * Helper function to create & dispatch a custom Event on a provided target
621
+ * @param elm the target of the Event
622
+ * @param name the name to give the custom Event
623
+ * @param opts options for configuring a custom Event
624
+ * @returns the custom Event
625
+ */
626
+ const emitEvent = (elm, name, opts) => {
627
+ const ev = plt.ce(name, opts);
628
+ elm.dispatchEvent(ev);
629
+ return ev;
630
+ };
631
+ const attachToAncestor = (hostRef, ancestorComponent) => {
632
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
633
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
634
+ }
635
+ };
636
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
637
+ {
638
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
639
+ }
640
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
641
+ hostRef.$flags$ |= 512 /* needsRerender */;
642
+ return;
643
+ }
644
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
645
+ // there is no ancestor component or the ancestor component
646
+ // has already fired off its lifecycle update then
647
+ // fire off the initial update
648
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
649
+ return writeTask(dispatch) ;
650
+ };
651
+ const dispatchHooks = (hostRef, isInitialLoad) => {
652
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
653
+ const instance = hostRef.$lazyInstance$ ;
654
+ let promise;
655
+ if (isInitialLoad) {
656
+ {
657
+ hostRef.$flags$ |= 256 /* isListenReady */;
658
+ if (hostRef.$queuedListeners$) {
659
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
660
+ hostRef.$queuedListeners$ = null;
661
+ }
662
+ }
663
+ }
664
+ endSchedule();
665
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
666
+ };
667
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
668
+ // updateComponent
669
+ const elm = hostRef.$hostElement$;
670
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
671
+ const rc = elm['s-rc'];
672
+ if (isInitialLoad) {
673
+ // DOM WRITE!
674
+ attachStyles(hostRef);
675
+ }
676
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
677
+ {
678
+ callRender(hostRef, instance);
679
+ }
680
+ if (rc) {
681
+ // ok, so turns out there are some child host elements
682
+ // waiting on this parent element to load
683
+ // let's fire off all update callbacks waiting
684
+ rc.map((cb) => cb());
685
+ elm['s-rc'] = undefined;
686
+ }
687
+ endRender();
688
+ endUpdate();
689
+ {
690
+ const childrenPromises = elm['s-p'];
691
+ const postUpdate = () => postUpdateComponent(hostRef);
692
+ if (childrenPromises.length === 0) {
693
+ postUpdate();
694
+ }
695
+ else {
696
+ Promise.all(childrenPromises).then(postUpdate);
697
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
698
+ childrenPromises.length = 0;
699
+ }
700
+ }
701
+ };
702
+ const callRender = (hostRef, instance, elm) => {
703
+ try {
704
+ instance = instance.render() ;
705
+ {
706
+ hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
707
+ }
708
+ {
709
+ hostRef.$flags$ |= 2 /* hasRendered */;
710
+ }
711
+ {
712
+ {
713
+ // looks like we've got child nodes to render into this host element
714
+ // or we need to update the css class/attrs on the host element
715
+ // DOM WRITE!
716
+ {
717
+ renderVdom(hostRef, instance);
718
+ }
719
+ }
720
+ }
721
+ }
722
+ catch (e) {
723
+ consoleError(e, hostRef.$hostElement$);
724
+ }
725
+ return null;
726
+ };
727
+ const postUpdateComponent = (hostRef) => {
728
+ const tagName = hostRef.$cmpMeta$.$tagName$;
729
+ const elm = hostRef.$hostElement$;
730
+ const endPostUpdate = createTime('postUpdate', tagName);
731
+ const instance = hostRef.$lazyInstance$ ;
732
+ const ancestorComponent = hostRef.$ancestorComponent$;
733
+ {
734
+ safeCall(instance, 'componentDidRender');
735
+ }
736
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
737
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
738
+ {
739
+ // DOM WRITE!
740
+ addHydratedFlag(elm);
741
+ }
742
+ endPostUpdate();
743
+ {
744
+ hostRef.$onReadyResolve$(elm);
745
+ if (!ancestorComponent) {
746
+ appDidLoad();
747
+ }
748
+ }
749
+ }
750
+ else {
751
+ endPostUpdate();
752
+ }
753
+ // load events fire from bottom to top
754
+ // the deepest elements load first then bubbles up
755
+ {
756
+ if (hostRef.$onRenderResolve$) {
757
+ hostRef.$onRenderResolve$();
758
+ hostRef.$onRenderResolve$ = undefined;
759
+ }
760
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
761
+ nextTick(() => scheduleUpdate(hostRef, false));
762
+ }
763
+ hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
764
+ }
765
+ // ( •_•)
766
+ // ( •_•)>⌐■-■
767
+ // (⌐■_■)
768
+ };
769
+ const appDidLoad = (who) => {
770
+ // on appload
771
+ // we have finish the first big initial render
772
+ {
773
+ addHydratedFlag(doc.documentElement);
774
+ }
775
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
776
+ };
777
+ const safeCall = (instance, method, arg) => {
778
+ if (instance && instance[method]) {
779
+ try {
780
+ return instance[method](arg);
781
+ }
782
+ catch (e) {
783
+ consoleError(e);
784
+ }
785
+ }
786
+ return undefined;
787
+ };
788
+ const then = (promise, thenFn) => {
789
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
790
+ };
791
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
792
+ ;
793
+ /**
794
+ * Parse a new property value for a given property type.
795
+ *
796
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
797
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
798
+ * 1. `any`, the type given to `propValue` in the function signature
799
+ * 2. the type stored from `propType`.
800
+ *
801
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
802
+ *
803
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
804
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
805
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
806
+ * ```tsx
807
+ * <my-cmp prop-val={0}></my-cmp>
808
+ * ```
809
+ *
810
+ * HTML prop values on the other hand, will always a string
811
+ *
812
+ * @param propValue the new value to coerce to some type
813
+ * @param propType the type of the prop, expressed as a binary number
814
+ * @returns the parsed/coerced value
815
+ */
816
+ const parsePropertyValue = (propValue, propType) => {
817
+ // ensure this value is of the correct prop type
818
+ if (propValue != null && !isComplexType(propValue)) {
819
+ if (propType & 1 /* String */) {
820
+ // could have been passed as a number or boolean
821
+ // but we still want it as a string
822
+ return String(propValue);
823
+ }
824
+ // redundant return here for better minification
825
+ return propValue;
826
+ }
827
+ // not sure exactly what type we want
828
+ // so no need to change to a different type
829
+ return propValue;
830
+ };
831
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
832
+ const setValue = (ref, propName, newVal, cmpMeta) => {
833
+ // check our new property value against our internal value
834
+ const hostRef = getHostRef(ref);
835
+ const elm = hostRef.$hostElement$ ;
836
+ const oldVal = hostRef.$instanceValues$.get(propName);
837
+ const flags = hostRef.$flags$;
838
+ const instance = hostRef.$lazyInstance$ ;
839
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
840
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
841
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
842
+ const didValueChange = newVal !== oldVal && !areBothNaN;
843
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
844
+ // gadzooks! the property's value has changed!!
845
+ // set our new value!
846
+ hostRef.$instanceValues$.set(propName, newVal);
847
+ if (instance) {
848
+ // get an array of method names of watch functions to call
849
+ if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
850
+ const watchMethods = cmpMeta.$watchers$[propName];
851
+ if (watchMethods) {
852
+ // this instance is watching for when this property changed
853
+ watchMethods.map((watchMethodName) => {
854
+ try {
855
+ // fire off each of the watch methods that are watching this property
856
+ instance[watchMethodName](newVal, oldVal, propName);
857
+ }
858
+ catch (e) {
859
+ consoleError(e, elm);
860
+ }
861
+ });
862
+ }
863
+ }
864
+ if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
865
+ // looks like this value actually changed, so we've got work to do!
866
+ // but only if we've already rendered, otherwise just chill out
867
+ // queue that we need to do an update, but don't worry about queuing
868
+ // up millions cuz this function ensures it only runs once
869
+ scheduleUpdate(hostRef, false);
870
+ }
871
+ }
872
+ }
873
+ };
874
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
875
+ if (cmpMeta.$members$) {
876
+ if (Cstr.watchers) {
877
+ cmpMeta.$watchers$ = Cstr.watchers;
878
+ }
879
+ // It's better to have a const than two Object.entries()
880
+ const members = Object.entries(cmpMeta.$members$);
881
+ const prototype = Cstr.prototype;
882
+ members.map(([memberName, [memberFlags]]) => {
883
+ if ((memberFlags & 31 /* Prop */ ||
884
+ ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
885
+ // proxyComponent - prop
886
+ Object.defineProperty(prototype, memberName, {
887
+ get() {
888
+ // proxyComponent, get value
889
+ return getValue(this, memberName);
890
+ },
891
+ set(newValue) {
892
+ // proxyComponent, set value
893
+ setValue(this, memberName, newValue, cmpMeta);
894
+ },
895
+ configurable: true,
896
+ enumerable: true,
897
+ });
898
+ }
899
+ });
900
+ if ((flags & 1 /* isElementConstructor */)) {
901
+ const attrNameToPropName = new Map();
902
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
903
+ plt.jmp(() => {
904
+ const propName = attrNameToPropName.get(attrName);
905
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
906
+ // in the case where an attribute was set inline.
907
+ // ```html
908
+ // <my-component some-attribute="some-value"></my-component>
909
+ // ```
910
+ //
911
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
912
+ // programmatically changes it before it has been upgraded as shown below:
913
+ //
914
+ // ```html
915
+ // <!-- this component has _not_ been upgraded yet -->
916
+ // <my-component id="test" some-attribute="some-value"></my-component>
917
+ // <script>
918
+ // // grab non-upgraded component
919
+ // el = document.querySelector("#test");
920
+ // el.someAttribute = "another-value";
921
+ // // upgrade component
922
+ // customElements.define('my-component', MyComponent);
923
+ // </script>
924
+ // ```
925
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
926
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
927
+ // to the value that was set inline i.e. "some-value" from above example. When
928
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
929
+ //
930
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
931
+ // by connectedCallback as this attributeChangedCallback will not fire.
932
+ //
933
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
934
+ //
935
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
936
+ // properties here given that this goes against best practices outlined here
937
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
938
+ if (this.hasOwnProperty(propName)) {
939
+ newValue = this[propName];
940
+ delete this[propName];
941
+ }
942
+ else if (prototype.hasOwnProperty(propName) &&
943
+ typeof this[propName] === 'number' &&
944
+ this[propName] == newValue) {
945
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
946
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
947
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
948
+ return;
949
+ }
950
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
951
+ });
952
+ };
953
+ // create an array of attributes to observe
954
+ // and also create a map of html attribute name to js property name
955
+ Cstr.observedAttributes = members
956
+ .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
957
+ .map(([propName, m]) => {
958
+ const attrName = m[1] || propName;
959
+ attrNameToPropName.set(attrName, propName);
960
+ if (m[0] & 512 /* ReflectAttr */) {
961
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
962
+ }
963
+ return attrName;
964
+ });
965
+ }
966
+ }
967
+ return Cstr;
968
+ };
969
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
970
+ // initializeComponent
971
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
972
+ {
973
+ // we haven't initialized this element yet
974
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
975
+ // lazy loaded components
976
+ // request the component's implementation to be
977
+ // wired up with the host element
978
+ Cstr = loadModule(cmpMeta);
979
+ if (Cstr.then) {
980
+ // Await creates a micro-task avoid if possible
981
+ const endLoad = uniqueTime();
982
+ Cstr = await Cstr;
983
+ endLoad();
984
+ }
985
+ if (!Cstr.isProxied) {
986
+ // we've never proxied this Constructor before
987
+ // let's add the getters/setters to its prototype before
988
+ // the first time we create an instance of the implementation
989
+ {
990
+ cmpMeta.$watchers$ = Cstr.watchers;
991
+ }
992
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
993
+ Cstr.isProxied = true;
994
+ }
995
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
996
+ // ok, time to construct the instance
997
+ // but let's keep track of when we start and stop
998
+ // so that the getters/setters don't incorrectly step on data
999
+ {
1000
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
1001
+ }
1002
+ // construct the lazy-loaded component implementation
1003
+ // passing the hostRef is very important during
1004
+ // construction in order to directly wire together the
1005
+ // host element and the lazy-loaded instance
1006
+ try {
1007
+ new Cstr(hostRef);
1008
+ }
1009
+ catch (e) {
1010
+ consoleError(e);
1011
+ }
1012
+ {
1013
+ hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1014
+ }
1015
+ {
1016
+ hostRef.$flags$ |= 128 /* isWatchReady */;
1017
+ }
1018
+ endNewInstance();
1019
+ }
1020
+ if (Cstr.style) {
1021
+ // this component has styles but we haven't registered them yet
1022
+ let style = Cstr.style;
1023
+ const scopeId = getScopeId(cmpMeta);
1024
+ if (!styles.has(scopeId)) {
1025
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1026
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1027
+ endRegisterStyles();
1028
+ }
1029
+ }
1030
+ }
1031
+ // we've successfully created a lazy instance
1032
+ const ancestorComponent = hostRef.$ancestorComponent$;
1033
+ const schedule = () => scheduleUpdate(hostRef, true);
1034
+ if (ancestorComponent && ancestorComponent['s-rc']) {
1035
+ // this is the initial load and this component it has an ancestor component
1036
+ // but the ancestor component has NOT fired its will update lifecycle yet
1037
+ // so let's just cool our jets and wait for the ancestor to continue first
1038
+ // this will get fired off when the ancestor component
1039
+ // finally gets around to rendering its lazy self
1040
+ // fire off the initial update
1041
+ ancestorComponent['s-rc'].push(schedule);
1042
+ }
1043
+ else {
1044
+ schedule();
1045
+ }
1046
+ };
1047
+ const connectedCallback = (elm) => {
1048
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1049
+ const hostRef = getHostRef(elm);
1050
+ const cmpMeta = hostRef.$cmpMeta$;
1051
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1052
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1053
+ // first time this component has connected
1054
+ hostRef.$flags$ |= 1 /* hasConnected */;
1055
+ {
1056
+ // find the first ancestor component (if there is one) and register
1057
+ // this component as one of the actively loading child components for its ancestor
1058
+ let ancestorComponent = elm;
1059
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1060
+ // climb up the ancestors looking for the first
1061
+ // component that hasn't finished its lifecycle update yet
1062
+ if (ancestorComponent['s-p']) {
1063
+ // we found this components first ancestor component
1064
+ // keep a reference to this component's ancestor component
1065
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1066
+ break;
1067
+ }
1068
+ }
1069
+ }
1070
+ // Lazy properties
1071
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1072
+ if (cmpMeta.$members$) {
1073
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1074
+ if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1075
+ const value = elm[memberName];
1076
+ delete elm[memberName];
1077
+ elm[memberName] = value;
1078
+ }
1079
+ });
1080
+ }
1081
+ {
1082
+ initializeComponent(elm, hostRef, cmpMeta);
1083
+ }
1084
+ }
1085
+ else {
1086
+ // not the first time this has connected
1087
+ // reattach any event listeners to the host
1088
+ // since they would have been removed when disconnected
1089
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1090
+ }
1091
+ endConnected();
1092
+ }
1093
+ };
1094
+ const disconnectedCallback = (elm) => {
1095
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1096
+ const hostRef = getHostRef(elm);
1097
+ const instance = hostRef.$lazyInstance$ ;
1098
+ {
1099
+ if (hostRef.$rmListeners$) {
1100
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
1101
+ hostRef.$rmListeners$ = undefined;
1102
+ }
1103
+ }
1104
+ {
1105
+ safeCall(instance, 'disconnectedCallback');
1106
+ }
1107
+ }
1108
+ };
1109
+ const bootstrapLazy = (lazyBundles, options = {}) => {
1110
+ const endBootstrap = createTime();
1111
+ const cmpTags = [];
1112
+ const exclude = options.exclude || [];
1113
+ const customElements = win.customElements;
1114
+ const head = doc.head;
1115
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1116
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1117
+ const deferredConnectedCallbacks = [];
1118
+ let appLoadFallback;
1119
+ let isBootstrapping = true;
1120
+ Object.assign(plt, options);
1121
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1122
+ lazyBundles.map((lazyBundle) => {
1123
+ lazyBundle[1].map((compactMeta) => {
1124
+ const cmpMeta = {
1125
+ $flags$: compactMeta[0],
1126
+ $tagName$: compactMeta[1],
1127
+ $members$: compactMeta[2],
1128
+ $listeners$: compactMeta[3],
1129
+ };
1130
+ {
1131
+ cmpMeta.$members$ = compactMeta[2];
1132
+ }
1133
+ {
1134
+ cmpMeta.$listeners$ = compactMeta[3];
1135
+ }
1136
+ {
1137
+ cmpMeta.$attrsToReflect$ = [];
1138
+ }
1139
+ {
1140
+ cmpMeta.$watchers$ = {};
1141
+ }
1142
+ const tagName = cmpMeta.$tagName$;
1143
+ const HostElement = class extends HTMLElement {
1144
+ // StencilLazyHost
1145
+ constructor(self) {
1146
+ // @ts-ignore
1147
+ super(self);
1148
+ self = this;
1149
+ registerHost(self, cmpMeta);
1150
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1151
+ // this component is using shadow dom
1152
+ // and this browser supports shadow dom
1153
+ // add the read-only property "shadowRoot" to the host element
1154
+ // adding the shadow root build conditionals to minimize runtime
1155
+ {
1156
+ {
1157
+ self.attachShadow({ mode: 'open' });
1158
+ }
1159
+ }
1160
+ }
1161
+ }
1162
+ connectedCallback() {
1163
+ if (appLoadFallback) {
1164
+ clearTimeout(appLoadFallback);
1165
+ appLoadFallback = null;
1166
+ }
1167
+ if (isBootstrapping) {
1168
+ // connectedCallback will be processed once all components have been registered
1169
+ deferredConnectedCallbacks.push(this);
1170
+ }
1171
+ else {
1172
+ plt.jmp(() => connectedCallback(this));
1173
+ }
1174
+ }
1175
+ disconnectedCallback() {
1176
+ plt.jmp(() => disconnectedCallback(this));
1177
+ }
1178
+ componentOnReady() {
1179
+ return getHostRef(this).$onReadyPromise$;
1180
+ }
1181
+ };
1182
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1183
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1184
+ cmpTags.push(tagName);
1185
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1186
+ }
1187
+ });
1188
+ });
1189
+ {
1190
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1191
+ visibilityStyle.setAttribute('data-styles', '');
1192
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1193
+ }
1194
+ // Process deferred connectedCallbacks now all components have been registered
1195
+ isBootstrapping = false;
1196
+ if (deferredConnectedCallbacks.length) {
1197
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
1198
+ }
1199
+ else {
1200
+ {
1201
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1202
+ }
1203
+ }
1204
+ // Fallback appLoad event
1205
+ endBootstrap();
1206
+ };
1207
+ const hostRefs = new WeakMap();
1208
+ const getHostRef = (ref) => hostRefs.get(ref);
1209
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1210
+ const registerHost = (elm, cmpMeta) => {
1211
+ const hostRef = {
1212
+ $flags$: 0,
1213
+ $hostElement$: elm,
1214
+ $cmpMeta$: cmpMeta,
1215
+ $instanceValues$: new Map(),
1216
+ };
1217
+ {
1218
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1219
+ elm['s-p'] = [];
1220
+ elm['s-rc'] = [];
1221
+ }
1222
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1223
+ return hostRefs.set(elm, hostRef);
1224
+ };
1225
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1226
+ const consoleError = (e, el) => (0, console.error)(e, el);
1227
+ const cmpModules = /*@__PURE__*/ new Map();
1228
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1229
+ // loadModuleImport
1230
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1231
+ const bundleId = cmpMeta.$lazyBundleId$;
1232
+ const module = cmpModules.get(bundleId) ;
1233
+ if (module) {
1234
+ return module[exportName];
1235
+ }
1236
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1237
+ /* webpackInclude: /\.entry\.js$/ */
1238
+ /* webpackExclude: /\.system\.entry\.js$/ */
1239
+ /* webpackMode: "lazy" */
1240
+ `./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
1241
+ {
1242
+ cmpModules.set(bundleId, importedModule);
1243
+ }
1244
+ return importedModule[exportName];
1245
+ }, consoleError);
1246
+ };
1247
+ const styles = new Map();
1248
+ const queueDomReads = [];
1249
+ const queueDomWrites = [];
1250
+ const queueTask = (queue, write) => (cb) => {
1251
+ queue.push(cb);
1252
+ if (!queuePending) {
1253
+ queuePending = true;
1254
+ if (write && plt.$flags$ & 4 /* queueSync */) {
1255
+ nextTick(flush);
1256
+ }
1257
+ else {
1258
+ plt.raf(flush);
1259
+ }
1260
+ }
1261
+ };
1262
+ const consume = (queue) => {
1263
+ for (let i = 0; i < queue.length; i++) {
1264
+ try {
1265
+ queue[i](performance.now());
1266
+ }
1267
+ catch (e) {
1268
+ consoleError(e);
1269
+ }
1270
+ }
1271
+ queue.length = 0;
1272
+ };
1273
+ const flush = () => {
1274
+ // always force a bunch of medium callbacks to run, but still have
1275
+ // a throttle on how many can run in a certain time
1276
+ // DOM READS!!!
1277
+ consume(queueDomReads);
1278
+ // DOM WRITES!!!
1279
+ {
1280
+ consume(queueDomWrites);
1281
+ if ((queuePending = queueDomReads.length > 0)) {
1282
+ // still more to do yet, but we've run out of time
1283
+ // let's let this thing cool off and try again in the next tick
1284
+ plt.raf(flush);
1285
+ }
1286
+ }
1287
+ };
1288
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1289
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1290
+
1291
+ exports.bootstrapLazy = bootstrapLazy;
1292
+ exports.createEvent = createEvent;
1293
+ exports.getElement = getElement;
1294
+ exports.h = h;
1295
+ exports.promiseResolve = promiseResolve;
1296
+ exports.registerInstance = registerInstance;