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