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