@everymatrix/lottery-game-page 0.0.6 → 0.0.9

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