@ekyc_qoobiss/qbs-ect-cmp 1.5.11

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