@everymatrix/bonus-elevate-levels 1.31.2

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