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