@everymatrix/user-transaction-history 1.32.4 → 1.33.0

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