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