@everymatrix/helper-accordion 0.0.3

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