@basic-ui-components-stc/basic-ui-components 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/LICENSE +21 -0
  2. package/dist/assets/fonts/symbol-defs.svg +939 -0
  3. package/dist/assets/images/404.svg +104 -0
  4. package/dist/assets/images/no-cards.svg +5 -0
  5. package/dist/assets/images/no-connection.svg +56 -0
  6. package/dist/assets/images/no-data.svg +38 -0
  7. package/dist/assets/images/no-lists.svg +10 -0
  8. package/dist/assets/images/not-authorized.svg +6 -0
  9. package/dist/assets/images/user.svg +4 -0
  10. package/dist/assets/js/svgxuse.min.js +12 -0
  11. package/dist/assets/scss/_bootstrap.scss +16 -0
  12. package/dist/assets/scss/_colors.scss +5 -0
  13. package/dist/assets/scss/_fonts.scss +278 -0
  14. package/dist/assets/scss/_general.scss +401 -0
  15. package/dist/assets/scss/_reset.scss +67 -0
  16. package/dist/assets/scss/_variables.scss +18 -0
  17. package/dist/assets/scss/angular-material/_accordion.scss +131 -0
  18. package/dist/assets/scss/angular-material/_checkbox.scss +59 -0
  19. package/dist/assets/scss/angular-material/_chip-list.scss +33 -0
  20. package/dist/assets/scss/angular-material/_chips.scss +46 -0
  21. package/dist/assets/scss/angular-material/_datepicker.scss +192 -0
  22. package/dist/assets/scss/angular-material/_form-field.scss +383 -0
  23. package/dist/assets/scss/angular-material/_popover.scss +384 -0
  24. package/dist/assets/scss/angular-material/_popups.scss +127 -0
  25. package/dist/assets/scss/angular-material/_radiobox.scss +67 -0
  26. package/dist/assets/scss/angular-material/_sidenav.scss +46 -0
  27. package/dist/assets/scss/angular-material/_slider.scss +131 -0
  28. package/dist/assets/scss/angular-material/_stepper.scss +162 -0
  29. package/dist/assets/scss/angular-material/_tab.scss +87 -0
  30. package/dist/assets/scss/angular-material/_table.scss +108 -0
  31. package/dist/assets/scss/angular-material/_toggle-slide.scss +108 -0
  32. package/dist/assets/scss/angular-material/_toggle.scss +112 -0
  33. package/dist/assets/scss/angular-material/_tooltip.scss +74 -0
  34. package/dist/assets/scss/angular-material/material.scss +16 -0
  35. package/dist/assets/scss/base.scss +66 -0
  36. package/dist/assets/scss/components/_breadcrumb.scss +63 -0
  37. package/dist/assets/scss/components/_card.scss +24 -0
  38. package/dist/assets/scss/components/_charts.scss +190 -0
  39. package/dist/assets/scss/components/_components.scss +19 -0
  40. package/dist/assets/scss/components/_full-calendar.scss +391 -0
  41. package/dist/assets/scss/components/_helper.scss +444 -0
  42. package/dist/assets/scss/components/_images.scss +67 -0
  43. package/dist/assets/scss/components/_info-section.scss +112 -0
  44. package/dist/assets/scss/components/_introJs.scss +109 -0
  45. package/dist/assets/scss/components/_lists.scss +171 -0
  46. package/dist/assets/scss/components/_loading.scss +38 -0
  47. package/dist/assets/scss/components/_ngx-pagination.scss +66 -0
  48. package/dist/assets/scss/components/_page-title.scss +18 -0
  49. package/dist/assets/scss/components/_progress.scss +70 -0
  50. package/dist/assets/scss/components/_repeated-list.scss +38 -0
  51. package/dist/assets/scss/components/_scrollbar.scss +32 -0
  52. package/dist/assets/scss/components/_status.scss +119 -0
  53. package/dist/assets/scss/components/_stc-icons.scss +1051 -0
  54. package/dist/assets/scss/components/_toaster.scss +109 -0
  55. package/dist/assets/scss/components/_user-list.scss +40 -0
  56. package/dist/assets/scss/hub/_hub.scss +756 -0
  57. package/dist/assets/scss/hub/_new-hub.scss +115 -0
  58. package/dist/assets/scss/mixins/_button-mixin.scss +98 -0
  59. package/dist/assets/scss/mixins/_colors-mixin.scss +58 -0
  60. package/dist/assets/scss/mixins/_fonts-mixin.scss +39 -0
  61. package/dist/assets/scss/mixins/_radius-mixin.scss +12 -0
  62. package/dist/assets/scss/mixins/mixins.scss +4 -0
  63. package/dist/assets/scss/web-components/_alert.scss +32 -0
  64. package/dist/assets/scss/web-components/_buttons.scss +94 -0
  65. package/dist/assets/scss/web-components/_status.scss +66 -0
  66. package/dist/assets/scss/web-components/web-components.scss +3 -0
  67. package/dist/assets/scss-old/_bootstrap.scss +16 -0
  68. package/dist/assets/scss-old/_colors.scss +5 -0
  69. package/dist/assets/scss-old/_fonts.scss +273 -0
  70. package/dist/assets/scss-old/_general.scss +401 -0
  71. package/dist/assets/scss-old/_reset.scss +60 -0
  72. package/dist/assets/scss-old/_variables.scss +18 -0
  73. package/dist/assets/scss-old/angular-material/_accordion.scss +130 -0
  74. package/dist/assets/scss-old/angular-material/_checkbox.scss +48 -0
  75. package/dist/assets/scss-old/angular-material/_chip-list.scss +32 -0
  76. package/dist/assets/scss-old/angular-material/_chips.scss +42 -0
  77. package/dist/assets/scss-old/angular-material/_datepicker.scss +191 -0
  78. package/dist/assets/scss-old/angular-material/_form-field.scss +665 -0
  79. package/dist/assets/scss-old/angular-material/_popover.scss +352 -0
  80. package/dist/assets/scss-old/angular-material/_popups.scss +125 -0
  81. package/dist/assets/scss-old/angular-material/_radiobox.scss +40 -0
  82. package/dist/assets/scss-old/angular-material/_sidenav.scss +46 -0
  83. package/dist/assets/scss-old/angular-material/_slider.scss +94 -0
  84. package/dist/assets/scss-old/angular-material/_stepper.scss +162 -0
  85. package/dist/assets/scss-old/angular-material/_tab.scss +68 -0
  86. package/dist/assets/scss-old/angular-material/_table.scss +101 -0
  87. package/dist/assets/scss-old/angular-material/_toggle-slide.scss +59 -0
  88. package/dist/assets/scss-old/angular-material/_toggle.scss +115 -0
  89. package/dist/assets/scss-old/angular-material/_tooltip.scss +46 -0
  90. package/dist/assets/scss-old/angular-material/material.scss +16 -0
  91. package/dist/assets/scss-old/base.scss +63 -0
  92. package/dist/assets/scss-old/components/_breadcrumb.scss +63 -0
  93. package/dist/assets/scss-old/components/_card.scss +24 -0
  94. package/dist/assets/scss-old/components/_components.scss +16 -0
  95. package/dist/assets/scss-old/components/_full-calendar.scss +391 -0
  96. package/dist/assets/scss-old/components/_helper.scss +427 -0
  97. package/dist/assets/scss-old/components/_images.scss +67 -0
  98. package/dist/assets/scss-old/components/_info-section.scss +112 -0
  99. package/dist/assets/scss-old/components/_introJs.scss +109 -0
  100. package/dist/assets/scss-old/components/_lists.scss +105 -0
  101. package/dist/assets/scss-old/components/_loading.scss +38 -0
  102. package/dist/assets/scss-old/components/_ngx-pagination.scss +66 -0
  103. package/dist/assets/scss-old/components/_page-title.scss +18 -0
  104. package/dist/assets/scss-old/components/_progress.scss +70 -0
  105. package/dist/assets/scss-old/components/_scrollbar.scss +32 -0
  106. package/dist/assets/scss-old/components/_status.scss +119 -0
  107. package/dist/assets/scss-old/components/_stc-icons.scss +955 -0
  108. package/dist/assets/scss-old/components/_toaster.scss +125 -0
  109. package/dist/assets/scss-old/hub/_hub.scss +756 -0
  110. package/dist/assets/scss-old/hub/_new-hub.scss +115 -0
  111. package/dist/assets/scss-old/mixins/_button-mixin.scss +98 -0
  112. package/dist/assets/scss-old/mixins/_colors-mixin.scss +56 -0
  113. package/dist/assets/scss-old/mixins/_fonts-mixin.scss +38 -0
  114. package/dist/assets/scss-old/mixins/_radius-mixin.scss +11 -0
  115. package/dist/assets/scss-old/mixins/mixins.scss +4 -0
  116. package/dist/assets/scss-old/web-components/_alert.scss +32 -0
  117. package/dist/assets/scss-old/web-components/_buttons.scss +92 -0
  118. package/dist/assets/scss-old/web-components/_status.scss +66 -0
  119. package/dist/assets/scss-old/web-components/web-components.scss +3 -0
  120. package/dist/cjs/ds-activity-log_16.cjs.entry.js +767 -0
  121. package/dist/cjs/ds-components.cjs.js +23 -0
  122. package/dist/cjs/ds-loading-page.cjs.entry.js +19 -0
  123. package/dist/cjs/ds-splash.cjs.entry.js +20 -0
  124. package/dist/cjs/index-67056d48.js +2391 -0
  125. package/dist/cjs/index.cjs.js +2 -0
  126. package/dist/cjs/loader.cjs.js +22 -0
  127. package/dist/collection/assets/fonts/symbol-defs.svg +939 -0
  128. package/dist/collection/assets/images/404.svg +104 -0
  129. package/dist/collection/assets/images/no-cards.svg +5 -0
  130. package/dist/collection/assets/images/no-connection.svg +56 -0
  131. package/dist/collection/assets/images/no-data.svg +38 -0
  132. package/dist/collection/assets/images/no-lists.svg +10 -0
  133. package/dist/collection/assets/images/not-authorized.svg +6 -0
  134. package/dist/collection/assets/images/user.svg +4 -0
  135. package/dist/collection/assets/js/svgxuse.min.js +12 -0
  136. package/dist/collection/collection-manifest.json +29 -0
  137. package/dist/collection/components/ds-activity-log/ds-activity-log.css +91 -0
  138. package/dist/collection/components/ds-activity-log/ds-activity-log.js +105 -0
  139. package/dist/collection/components/ds-alert/ds-alert.css +34 -0
  140. package/dist/collection/components/ds-alert/ds-alert.js +61 -0
  141. package/dist/collection/components/ds-approvals/ds-approvals.css +60 -0
  142. package/dist/collection/components/ds-approvals/ds-approvals.js +71 -0
  143. package/dist/collection/components/ds-attachments/ds-attachments.css +84 -0
  144. package/dist/collection/components/ds-attachments/ds-attachments.js +229 -0
  145. package/dist/collection/components/ds-avatar/ds-avatar.css +84 -0
  146. package/dist/collection/components/ds-avatar/ds-avatar.js +138 -0
  147. package/dist/collection/components/ds-button/ds-button.css +196 -0
  148. package/dist/collection/components/ds-button/ds-button.js +313 -0
  149. package/dist/collection/components/ds-card/ds-card.css +53 -0
  150. package/dist/collection/components/ds-card/ds-card.js +64 -0
  151. package/dist/collection/components/ds-file-picker/ds-file-picker.css +79 -0
  152. package/dist/collection/components/ds-file-picker/ds-file-picker.js +67 -0
  153. package/dist/collection/components/ds-icon/ds-icon.js +55 -0
  154. package/dist/collection/components/ds-icon/stc-icon.css +1403 -0
  155. package/dist/collection/components/ds-loading-chart/ds-loading-chart.css +80 -0
  156. package/dist/collection/components/ds-loading-chart/ds-loading-chart.js +70 -0
  157. package/dist/collection/components/ds-loading-page/ds-loading-page.css +116 -0
  158. package/dist/collection/components/ds-loading-page/ds-loading-page.js +18 -0
  159. package/dist/collection/components/ds-loading-table/ds-loading-table.css +3 -0
  160. package/dist/collection/components/ds-loading-table/ds-loading-table.js +90 -0
  161. package/dist/collection/components/ds-message/ds-message.css +28 -0
  162. package/dist/collection/components/ds-message/ds-message.js +95 -0
  163. package/dist/collection/components/ds-sla/ds-sla.css +6 -0
  164. package/dist/collection/components/ds-sla/ds-sla.js +196 -0
  165. package/dist/collection/components/ds-slider/ds-slider.css +111 -0
  166. package/dist/collection/components/ds-slider/ds-slider.js +329 -0
  167. package/dist/collection/components/ds-splash/ds-splash.css +62 -0
  168. package/dist/collection/components/ds-splash/ds-splash.js +42 -0
  169. package/dist/collection/components/ds-status/ds-status.css +47 -0
  170. package/dist/collection/components/ds-status/ds-status.js +106 -0
  171. package/dist/collection/components/ds-user-card/ds-user-card.css +54 -0
  172. package/dist/collection/components/ds-user-card/ds-user-card.js +102 -0
  173. package/dist/collection/index.js +1 -0
  174. package/dist/collection/utils/ej2.min.js +10 -0
  175. package/dist/collection/utils/generate-icons.js +72 -0
  176. package/dist/collection/utils/myScripts.js +0 -0
  177. package/dist/collection/utils/rollup-utils.js +41 -0
  178. package/dist/collection/utils/svgxuse.min.js +12 -0
  179. package/dist/collection/utils/utils.js +1 -0
  180. package/dist/components/ds-activity-log.d.ts +11 -0
  181. package/dist/components/ds-activity-log.js +105 -0
  182. package/dist/components/ds-alert.d.ts +11 -0
  183. package/dist/components/ds-alert.js +44 -0
  184. package/dist/components/ds-approvals.d.ts +11 -0
  185. package/dist/components/ds-approvals.js +76 -0
  186. package/dist/components/ds-attachments.d.ts +11 -0
  187. package/dist/components/ds-attachments.js +6 -0
  188. package/dist/components/ds-attachments2.js +103 -0
  189. package/dist/components/ds-avatar.d.ts +11 -0
  190. package/dist/components/ds-avatar.js +6 -0
  191. package/dist/components/ds-avatar2.js +72 -0
  192. package/dist/components/ds-button.d.ts +11 -0
  193. package/dist/components/ds-button.js +6 -0
  194. package/dist/components/ds-button2.js +99 -0
  195. package/dist/components/ds-card.d.ts +11 -0
  196. package/dist/components/ds-card.js +58 -0
  197. package/dist/components/ds-file-picker.d.ts +11 -0
  198. package/dist/components/ds-file-picker.js +43 -0
  199. package/dist/components/ds-icon.d.ts +11 -0
  200. package/dist/components/ds-icon.js +6 -0
  201. package/dist/components/ds-icon2.js +44 -0
  202. package/dist/components/ds-loading-chart.d.ts +11 -0
  203. package/dist/components/ds-loading-chart.js +60 -0
  204. package/dist/components/ds-loading-page.d.ts +11 -0
  205. package/dist/components/ds-loading-page.js +33 -0
  206. package/dist/components/ds-loading-table.d.ts +11 -0
  207. package/dist/components/ds-loading-table.js +49 -0
  208. package/dist/components/ds-message.d.ts +11 -0
  209. package/dist/components/ds-message.js +61 -0
  210. package/dist/components/ds-sla.d.ts +11 -0
  211. package/dist/components/ds-sla.js +71 -0
  212. package/dist/components/ds-slider.d.ts +11 -0
  213. package/dist/components/ds-slider.js +235 -0
  214. package/dist/components/ds-splash.d.ts +11 -0
  215. package/dist/components/ds-splash.js +36 -0
  216. package/dist/components/ds-status.d.ts +11 -0
  217. package/dist/components/ds-status.js +6 -0
  218. package/dist/components/ds-status2.js +48 -0
  219. package/dist/components/ds-user-card.d.ts +11 -0
  220. package/dist/components/ds-user-card.js +6 -0
  221. package/dist/components/ds-user-card2.js +58 -0
  222. package/dist/components/index.d.ts +48 -0
  223. package/dist/components/index.js +19 -0
  224. package/dist/ds-components/ds-components.css +5780 -0
  225. package/dist/ds-components/ds-components.esm.js +1 -0
  226. package/dist/ds-components/index.esm.js +0 -0
  227. package/dist/ds-components/p-2bf203e1.entry.js +1 -0
  228. package/dist/ds-components/p-60a24d37.entry.js +1 -0
  229. package/dist/ds-components/p-a4922f25.entry.js +1 -0
  230. package/dist/ds-components/p-f85fbdb4.js +2 -0
  231. package/dist/esm/ds-activity-log_16.entry.js +748 -0
  232. package/dist/esm/ds-components.js +18 -0
  233. package/dist/esm/ds-loading-page.entry.js +15 -0
  234. package/dist/esm/ds-splash.entry.js +16 -0
  235. package/dist/esm/index-b257ae8c.js +2362 -0
  236. package/dist/esm/index.js +1 -0
  237. package/dist/esm/loader.js +18 -0
  238. package/dist/esm/polyfills/core-js.js +11 -0
  239. package/dist/esm/polyfills/css-shim.js +1 -0
  240. package/dist/esm/polyfills/dom.js +79 -0
  241. package/dist/esm/polyfills/es5-html-element.js +1 -0
  242. package/dist/esm/polyfills/index.js +34 -0
  243. package/dist/esm/polyfills/system.js +6 -0
  244. package/dist/index.cjs.js +1 -0
  245. package/dist/index.js +1 -0
  246. package/dist/types/components/ds-activity-log/ds-activity-log.d.ts +22 -0
  247. package/dist/types/components/ds-alert/ds-alert.d.ts +5 -0
  248. package/dist/types/components/ds-approvals/ds-approvals.d.ts +18 -0
  249. package/dist/types/components/ds-attachments/ds-attachments.d.ts +26 -0
  250. package/dist/types/components/ds-avatar/ds-avatar.d.ts +14 -0
  251. package/dist/types/components/ds-button/ds-button.d.ts +23 -0
  252. package/dist/types/components/ds-card/ds-card.d.ts +20 -0
  253. package/dist/types/components/ds-file-picker/ds-file-picker.d.ts +9 -0
  254. package/dist/types/components/ds-icon/ds-icon.d.ts +4 -0
  255. package/dist/types/components/ds-loading-chart/ds-loading-chart.d.ts +9 -0
  256. package/dist/types/components/ds-loading-page/ds-loading-page.d.ts +3 -0
  257. package/dist/types/components/ds-loading-table/ds-loading-table.d.ts +8 -0
  258. package/dist/types/components/ds-message/ds-message.d.ts +8 -0
  259. package/dist/types/components/ds-sla/ds-sla.d.ts +18 -0
  260. package/dist/types/components/ds-slider/ds-slider.d.ts +50 -0
  261. package/dist/types/components/ds-splash/ds-splash.d.ts +4 -0
  262. package/dist/types/components/ds-status/ds-status.d.ts +8 -0
  263. package/dist/types/components/ds-user-card/ds-user-card.d.ts +15 -0
  264. package/dist/types/components.d.ts +389 -0
  265. package/dist/types/index.d.ts +1 -0
  266. package/dist/types/stencil-public-runtime.d.ts +1637 -0
  267. package/dist/types/utils/utils.d.ts +3 -0
  268. package/hydrate/index.d.ts +217 -0
  269. package/hydrate/index.js +7561 -0
  270. package/hydrate/package.json +6 -0
  271. package/loader/cdn.js +3 -0
  272. package/loader/index.cjs.js +3 -0
  273. package/loader/index.d.ts +21 -0
  274. package/loader/index.es2017.js +3 -0
  275. package/loader/index.js +4 -0
  276. package/loader/package.json +11 -0
  277. package/package.json +40 -0
  278. package/readme.md +75 -0
@@ -0,0 +1,2362 @@
1
+ const NAMESPACE = 'ds-components';
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 contentRef;
13
+ let hostTagName;
14
+ let useNativeShadowDom = false;
15
+ let checkSlotFallbackVisibility = false;
16
+ let checkSlotRelocate = false;
17
+ let isSvgMode = false;
18
+ let queuePending = false;
19
+ const createTime = (fnName, tagName = '') => {
20
+ {
21
+ return () => {
22
+ return;
23
+ };
24
+ }
25
+ };
26
+ const uniqueTime = (key, measureText) => {
27
+ {
28
+ return () => {
29
+ return;
30
+ };
31
+ }
32
+ };
33
+ const CONTENT_REF_ID = 'r';
34
+ const ORG_LOCATION_ID = 'o';
35
+ const SLOT_NODE_ID = 's';
36
+ const TEXT_NODE_ID = 't';
37
+ const HYDRATE_ID = 's-id';
38
+ const HYDRATED_STYLE_ID = 'sty-id';
39
+ const HYDRATE_CHILD_ID = 'c-id';
40
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
41
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
42
+ /**
43
+ * Default style mode id
44
+ */
45
+ /**
46
+ * Reusable empty obj/array
47
+ * Don't add values to these!!
48
+ */
49
+ const EMPTY_OBJ = {};
50
+ /**
51
+ * Namespaces
52
+ */
53
+ const SVG_NS = 'http://www.w3.org/2000/svg';
54
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
55
+ const isDef = (v) => v != null;
56
+ const isComplexType = (o) => {
57
+ // https://jsperf.com/typeof-fn-object/5
58
+ o = typeof o;
59
+ return o === 'object' || o === 'function';
60
+ };
61
+ /**
62
+ * Helper method for querying a `meta` tag that contains a nonce value
63
+ * out of a DOM's head.
64
+ *
65
+ * @param doc The DOM containing the `head` to query against
66
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
67
+ * exists or the tag has no content.
68
+ */
69
+ function queryNonceMetaTagContent(doc) {
70
+ var _a, _b, _c;
71
+ return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
72
+ }
73
+ /**
74
+ * Production h() function based on Preact by
75
+ * Jason Miller (@developit)
76
+ * Licensed under the MIT License
77
+ * https://github.com/developit/preact/blob/master/LICENSE
78
+ *
79
+ * Modified for Stencil's compiler and vdom
80
+ */
81
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
82
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
83
+ const h = (nodeName, vnodeData, ...children) => {
84
+ let child = null;
85
+ let key = null;
86
+ let slotName = null;
87
+ let simple = false;
88
+ let lastSimple = false;
89
+ const vNodeChildren = [];
90
+ const walk = (c) => {
91
+ for (let i = 0; i < c.length; i++) {
92
+ child = c[i];
93
+ if (Array.isArray(child)) {
94
+ walk(child);
95
+ }
96
+ else if (child != null && typeof child !== 'boolean') {
97
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
98
+ child = String(child);
99
+ }
100
+ if (simple && lastSimple) {
101
+ // If the previous child was simple (string), we merge both
102
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
103
+ }
104
+ else {
105
+ // Append a new vNode, if it's text, we create a text vNode
106
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
107
+ }
108
+ lastSimple = simple;
109
+ }
110
+ }
111
+ };
112
+ walk(children);
113
+ if (vnodeData) {
114
+ // normalize class / classname attributes
115
+ if (vnodeData.key) {
116
+ key = vnodeData.key;
117
+ }
118
+ if (vnodeData.name) {
119
+ slotName = vnodeData.name;
120
+ }
121
+ {
122
+ const classData = vnodeData.className || vnodeData.class;
123
+ if (classData) {
124
+ vnodeData.class =
125
+ typeof classData !== 'object'
126
+ ? classData
127
+ : Object.keys(classData)
128
+ .filter((k) => classData[k])
129
+ .join(' ');
130
+ }
131
+ }
132
+ }
133
+ if (typeof nodeName === 'function') {
134
+ // nodeName is a functional component
135
+ return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
136
+ }
137
+ const vnode = newVNode(nodeName, null);
138
+ vnode.$attrs$ = vnodeData;
139
+ if (vNodeChildren.length > 0) {
140
+ vnode.$children$ = vNodeChildren;
141
+ }
142
+ {
143
+ vnode.$key$ = key;
144
+ }
145
+ {
146
+ vnode.$name$ = slotName;
147
+ }
148
+ return vnode;
149
+ };
150
+ /**
151
+ * A utility function for creating a virtual DOM node from a tag and some
152
+ * possible text content.
153
+ *
154
+ * @param tag the tag for this element
155
+ * @param text possible text content for the node
156
+ * @returns a newly-minted virtual DOM node
157
+ */
158
+ const newVNode = (tag, text) => {
159
+ const vnode = {
160
+ $flags$: 0,
161
+ $tag$: tag,
162
+ $text$: text,
163
+ $elm$: null,
164
+ $children$: null,
165
+ };
166
+ {
167
+ vnode.$attrs$ = null;
168
+ }
169
+ {
170
+ vnode.$key$ = null;
171
+ }
172
+ {
173
+ vnode.$name$ = null;
174
+ }
175
+ return vnode;
176
+ };
177
+ const Host = {};
178
+ /**
179
+ * Check whether a given node is a Host node or not
180
+ *
181
+ * @param node the virtual DOM node to check
182
+ * @returns whether it's a Host node or not
183
+ */
184
+ const isHost = (node) => node && node.$tag$ === Host;
185
+ /**
186
+ * Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
187
+ *
188
+ * Note that these functions convert from {@link d.VNode} to
189
+ * {@link d.ChildNode} to give functional component developers a friendly
190
+ * interface.
191
+ */
192
+ const vdomFnUtils = {
193
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
194
+ map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
195
+ };
196
+ /**
197
+ * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
198
+ * friendlier public interface (hence, 'convertToPublic').
199
+ *
200
+ * @param node the virtual DOM node to convert
201
+ * @returns a converted child node
202
+ */
203
+ const convertToPublic = (node) => ({
204
+ vattrs: node.$attrs$,
205
+ vchildren: node.$children$,
206
+ vkey: node.$key$,
207
+ vname: node.$name$,
208
+ vtag: node.$tag$,
209
+ vtext: node.$text$,
210
+ });
211
+ /**
212
+ * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
213
+ * order to use the resulting object in the virtual DOM. The initial object was
214
+ * likely created as part of presenting a public API, so converting it back
215
+ * involved making it 'private' again (hence, `convertToPrivate`).
216
+ *
217
+ * @param node the child node to convert
218
+ * @returns a converted virtual DOM node
219
+ */
220
+ const convertToPrivate = (node) => {
221
+ if (typeof node.vtag === 'function') {
222
+ const vnodeData = Object.assign({}, node.vattrs);
223
+ if (node.vkey) {
224
+ vnodeData.key = node.vkey;
225
+ }
226
+ if (node.vname) {
227
+ vnodeData.name = node.vname;
228
+ }
229
+ return h(node.vtag, vnodeData, ...(node.vchildren || []));
230
+ }
231
+ const vnode = newVNode(node.vtag, node.vtext);
232
+ vnode.$attrs$ = node.vattrs;
233
+ vnode.$children$ = node.vchildren;
234
+ vnode.$key$ = node.vkey;
235
+ vnode.$name$ = node.vname;
236
+ return vnode;
237
+ };
238
+ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
239
+ const endHydrate = createTime('hydrateClient', tagName);
240
+ const shadowRoot = hostElm.shadowRoot;
241
+ const childRenderNodes = [];
242
+ const slotNodes = [];
243
+ const shadowRootNodes = shadowRoot ? [] : null;
244
+ const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
245
+ if (!plt.$orgLocNodes$) {
246
+ initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
247
+ }
248
+ hostElm[HYDRATE_ID] = hostId;
249
+ hostElm.removeAttribute(HYDRATE_ID);
250
+ clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
251
+ childRenderNodes.map((c) => {
252
+ const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
253
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
254
+ const node = c.$elm$;
255
+ if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
256
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
257
+ }
258
+ if (!shadowRoot) {
259
+ node['s-hn'] = tagName;
260
+ if (orgLocationNode) {
261
+ node['s-ol'] = orgLocationNode;
262
+ node['s-ol']['s-nr'] = node;
263
+ }
264
+ }
265
+ plt.$orgLocNodes$.delete(orgLocationId);
266
+ });
267
+ if (shadowRoot) {
268
+ shadowRootNodes.map((shadowRootNode) => {
269
+ if (shadowRootNode) {
270
+ shadowRoot.appendChild(shadowRootNode);
271
+ }
272
+ });
273
+ }
274
+ endHydrate();
275
+ };
276
+ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
277
+ let childNodeType;
278
+ let childIdSplt;
279
+ let childVNode;
280
+ let i;
281
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
282
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
283
+ if (childNodeType) {
284
+ // got the node data from the element's attribute
285
+ // `${hostId}.${nodeId}.${depth}.${index}`
286
+ childIdSplt = childNodeType.split('.');
287
+ if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
288
+ childVNode = {
289
+ $flags$: 0,
290
+ $hostId$: childIdSplt[0],
291
+ $nodeId$: childIdSplt[1],
292
+ $depth$: childIdSplt[2],
293
+ $index$: childIdSplt[3],
294
+ $tag$: node.tagName.toLowerCase(),
295
+ $elm$: node,
296
+ $attrs$: null,
297
+ $children$: null,
298
+ $key$: null,
299
+ $name$: null,
300
+ $text$: null,
301
+ };
302
+ childRenderNodes.push(childVNode);
303
+ node.removeAttribute(HYDRATE_CHILD_ID);
304
+ // this is a new child vnode
305
+ // so ensure its parent vnode has the vchildren array
306
+ if (!parentVNode.$children$) {
307
+ parentVNode.$children$ = [];
308
+ }
309
+ // add our child vnode to a specific index of the vnode's children
310
+ parentVNode.$children$[childVNode.$index$] = childVNode;
311
+ // this is now the new parent vnode for all the next child checks
312
+ parentVNode = childVNode;
313
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
314
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
315
+ }
316
+ }
317
+ }
318
+ // recursively drill down, end to start so we can remove nodes
319
+ for (i = node.childNodes.length - 1; i >= 0; i--) {
320
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
321
+ }
322
+ if (node.shadowRoot) {
323
+ // keep drilling down through the shadow root nodes
324
+ for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
325
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
326
+ }
327
+ }
328
+ }
329
+ else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
330
+ // `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
331
+ childIdSplt = node.nodeValue.split('.');
332
+ if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
333
+ // comment node for either the host id or a 0 host id
334
+ childNodeType = childIdSplt[0];
335
+ childVNode = {
336
+ $flags$: 0,
337
+ $hostId$: childIdSplt[1],
338
+ $nodeId$: childIdSplt[2],
339
+ $depth$: childIdSplt[3],
340
+ $index$: childIdSplt[4],
341
+ $elm$: node,
342
+ $attrs$: null,
343
+ $children$: null,
344
+ $key$: null,
345
+ $name$: null,
346
+ $tag$: null,
347
+ $text$: null,
348
+ };
349
+ if (childNodeType === TEXT_NODE_ID) {
350
+ childVNode.$elm$ = node.nextSibling;
351
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* NODE_TYPE.TextNode */) {
352
+ childVNode.$text$ = childVNode.$elm$.textContent;
353
+ childRenderNodes.push(childVNode);
354
+ // remove the text comment since it's no longer needed
355
+ node.remove();
356
+ if (!parentVNode.$children$) {
357
+ parentVNode.$children$ = [];
358
+ }
359
+ parentVNode.$children$[childVNode.$index$] = childVNode;
360
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
361
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
362
+ }
363
+ }
364
+ }
365
+ else if (childVNode.$hostId$ === hostId) {
366
+ // this comment node is specifcally for this host id
367
+ if (childNodeType === SLOT_NODE_ID) {
368
+ // `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
369
+ childVNode.$tag$ = 'slot';
370
+ if (childIdSplt[5]) {
371
+ node['s-sn'] = childVNode.$name$ = childIdSplt[5];
372
+ }
373
+ else {
374
+ node['s-sn'] = '';
375
+ }
376
+ node['s-sr'] = true;
377
+ if (shadowRootNodes) {
378
+ // browser support shadowRoot and this is a shadow dom component
379
+ // create an actual slot element
380
+ childVNode.$elm$ = doc.createElement(childVNode.$tag$);
381
+ if (childVNode.$name$) {
382
+ // add the slot name attribute
383
+ childVNode.$elm$.setAttribute('name', childVNode.$name$);
384
+ }
385
+ // insert the new slot element before the slot comment
386
+ node.parentNode.insertBefore(childVNode.$elm$, node);
387
+ // remove the slot comment since it's not needed for shadow
388
+ node.remove();
389
+ if (childVNode.$depth$ === '0') {
390
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
391
+ }
392
+ }
393
+ slotNodes.push(childVNode);
394
+ if (!parentVNode.$children$) {
395
+ parentVNode.$children$ = [];
396
+ }
397
+ parentVNode.$children$[childVNode.$index$] = childVNode;
398
+ }
399
+ else if (childNodeType === CONTENT_REF_ID) {
400
+ // `${CONTENT_REF_ID}.${hostId}`;
401
+ if (shadowRootNodes) {
402
+ // remove the content ref comment since it's not needed for shadow
403
+ node.remove();
404
+ }
405
+ else {
406
+ hostElm['s-cr'] = node;
407
+ node['s-cn'] = true;
408
+ }
409
+ }
410
+ }
411
+ }
412
+ }
413
+ else if (parentVNode && parentVNode.$tag$ === 'style') {
414
+ const vnode = newVNode(null, node.textContent);
415
+ vnode.$elm$ = node;
416
+ vnode.$index$ = '0';
417
+ parentVNode.$children$ = [vnode];
418
+ }
419
+ };
420
+ const initializeDocumentHydrate = (node, orgLocNodes) => {
421
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
422
+ let i = 0;
423
+ for (; i < node.childNodes.length; i++) {
424
+ initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
425
+ }
426
+ if (node.shadowRoot) {
427
+ for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
428
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
429
+ }
430
+ }
431
+ }
432
+ else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
433
+ const childIdSplt = node.nodeValue.split('.');
434
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
435
+ orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
436
+ node.nodeValue = '';
437
+ // useful to know if the original location is
438
+ // the root light-dom of a shadow dom component
439
+ node['s-en'] = childIdSplt[3];
440
+ }
441
+ }
442
+ };
443
+ /**
444
+ * Parse a new property value for a given property type.
445
+ *
446
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
447
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
448
+ * 1. `any`, the type given to `propValue` in the function signature
449
+ * 2. the type stored from `propType`.
450
+ *
451
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
452
+ *
453
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
454
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
455
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
456
+ * ```tsx
457
+ * <my-cmp prop-val={0}></my-cmp>
458
+ * ```
459
+ *
460
+ * HTML prop values on the other hand, will always a string
461
+ *
462
+ * @param propValue the new value to coerce to some type
463
+ * @param propType the type of the prop, expressed as a binary number
464
+ * @returns the parsed/coerced value
465
+ */
466
+ const parsePropertyValue = (propValue, propType) => {
467
+ // ensure this value is of the correct prop type
468
+ if (propValue != null && !isComplexType(propValue)) {
469
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
470
+ // per the HTML spec, any string value means it is a boolean true value
471
+ // but we'll cheat here and say that the string "false" is the boolean false
472
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
473
+ }
474
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
475
+ // force it to be a number
476
+ return parseFloat(propValue);
477
+ }
478
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
479
+ // could have been passed as a number or boolean
480
+ // but we still want it as a string
481
+ return String(propValue);
482
+ }
483
+ // redundant return here for better minification
484
+ return propValue;
485
+ }
486
+ // not sure exactly what type we want
487
+ // so no need to change to a different type
488
+ return propValue;
489
+ };
490
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
491
+ const createEvent = (ref, name, flags) => {
492
+ const elm = getElement(ref);
493
+ return {
494
+ emit: (detail) => {
495
+ return emitEvent(elm, name, {
496
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
497
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
498
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
499
+ detail,
500
+ });
501
+ },
502
+ };
503
+ };
504
+ /**
505
+ * Helper function to create & dispatch a custom Event on a provided target
506
+ * @param elm the target of the Event
507
+ * @param name the name to give the custom Event
508
+ * @param opts options for configuring a custom Event
509
+ * @returns the custom Event
510
+ */
511
+ const emitEvent = (elm, name, opts) => {
512
+ const ev = plt.ce(name, opts);
513
+ elm.dispatchEvent(ev);
514
+ return ev;
515
+ };
516
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
517
+ const registerStyle = (scopeId, cssText, allowCS) => {
518
+ let style = styles.get(scopeId);
519
+ if (supportsConstructableStylesheets && allowCS) {
520
+ style = (style || new CSSStyleSheet());
521
+ if (typeof style === 'string') {
522
+ style = cssText;
523
+ }
524
+ else {
525
+ style.replaceSync(cssText);
526
+ }
527
+ }
528
+ else {
529
+ style = cssText;
530
+ }
531
+ styles.set(scopeId, style);
532
+ };
533
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
534
+ var _a;
535
+ let scopeId = getScopeId(cmpMeta);
536
+ const style = styles.get(scopeId);
537
+ // if an element is NOT connected then getRootNode() will return the wrong root node
538
+ // so the fallback is to always use the document for the root node in those cases
539
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
540
+ if (style) {
541
+ if (typeof style === 'string') {
542
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
543
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
544
+ let styleElm;
545
+ if (!appliedStyles) {
546
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
547
+ }
548
+ if (!appliedStyles.has(scopeId)) {
549
+ if (styleContainerNode.host &&
550
+ (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
551
+ // This is only happening on native shadow-dom, do not needs CSS var shim
552
+ styleElm.innerHTML = style;
553
+ }
554
+ else {
555
+ {
556
+ styleElm = doc.createElement('style');
557
+ styleElm.innerHTML = style;
558
+ }
559
+ // Apply CSP nonce to the style tag if it exists
560
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
561
+ if (nonce != null) {
562
+ styleElm.setAttribute('nonce', nonce);
563
+ }
564
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
565
+ }
566
+ if (appliedStyles) {
567
+ appliedStyles.add(scopeId);
568
+ }
569
+ }
570
+ }
571
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
572
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
573
+ }
574
+ }
575
+ return scopeId;
576
+ };
577
+ const attachStyles = (hostRef) => {
578
+ const cmpMeta = hostRef.$cmpMeta$;
579
+ const elm = hostRef.$hostElement$;
580
+ const flags = cmpMeta.$flags$;
581
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
582
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
583
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
584
+ // only required when we're NOT using native shadow dom (slot)
585
+ // or this browser doesn't support native shadow dom
586
+ // and this host element was NOT created with SSR
587
+ // let's pick out the inner content for slot projection
588
+ // create a node to represent where the original
589
+ // content was first placed, which is useful later on
590
+ // DOM WRITE!!
591
+ elm['s-sc'] = scopeId;
592
+ elm.classList.add(scopeId + '-h');
593
+ }
594
+ endAttachStyles();
595
+ };
596
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
597
+ const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
598
+ /**
599
+ * Production setAccessor() function based on Preact by
600
+ * Jason Miller (@developit)
601
+ * Licensed under the MIT License
602
+ * https://github.com/developit/preact/blob/master/LICENSE
603
+ *
604
+ * Modified for Stencil's compiler and vdom
605
+ */
606
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
607
+ if (oldValue !== newValue) {
608
+ let isProp = isMemberInElement(elm, memberName);
609
+ let ln = memberName.toLowerCase();
610
+ if (memberName === 'class') {
611
+ const classList = elm.classList;
612
+ const oldClasses = parseClassList(oldValue);
613
+ const newClasses = parseClassList(newValue);
614
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
615
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
616
+ }
617
+ else if (memberName === 'style') {
618
+ // update style attribute, css properties and values
619
+ {
620
+ for (const prop in oldValue) {
621
+ if (!newValue || newValue[prop] == null) {
622
+ if (prop.includes('-')) {
623
+ elm.style.removeProperty(prop);
624
+ }
625
+ else {
626
+ elm.style[prop] = '';
627
+ }
628
+ }
629
+ }
630
+ }
631
+ for (const prop in newValue) {
632
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
633
+ if (prop.includes('-')) {
634
+ elm.style.setProperty(prop, newValue[prop]);
635
+ }
636
+ else {
637
+ elm.style[prop] = newValue[prop];
638
+ }
639
+ }
640
+ }
641
+ }
642
+ else if (memberName === 'key')
643
+ ;
644
+ else if (memberName === 'ref') {
645
+ // minifier will clean this up
646
+ if (newValue) {
647
+ newValue(elm);
648
+ }
649
+ }
650
+ else if ((!isProp ) &&
651
+ memberName[0] === 'o' &&
652
+ memberName[1] === 'n') {
653
+ // Event Handlers
654
+ // so if the member name starts with "on" and the 3rd characters is
655
+ // a capital letter, and it's not already a member on the element,
656
+ // then we're assuming it's an event listener
657
+ if (memberName[2] === '-') {
658
+ // on- prefixed events
659
+ // allows to be explicit about the dom event to listen without any magic
660
+ // under the hood:
661
+ // <my-cmp on-click> // listens for "click"
662
+ // <my-cmp on-Click> // listens for "Click"
663
+ // <my-cmp on-ionChange> // listens for "ionChange"
664
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
665
+ memberName = memberName.slice(3);
666
+ }
667
+ else if (isMemberInElement(win, ln)) {
668
+ // standard event
669
+ // the JSX attribute could have been "onMouseOver" and the
670
+ // member name "onmouseover" is on the window's prototype
671
+ // so let's add the listener "mouseover", which is all lowercased
672
+ memberName = ln.slice(2);
673
+ }
674
+ else {
675
+ // custom event
676
+ // the JSX attribute could have been "onMyCustomEvent"
677
+ // so let's trim off the "on" prefix and lowercase the first character
678
+ // and add the listener "myCustomEvent"
679
+ // except for the first character, we keep the event name case
680
+ memberName = ln[2] + memberName.slice(3);
681
+ }
682
+ if (oldValue) {
683
+ plt.rel(elm, memberName, oldValue, false);
684
+ }
685
+ if (newValue) {
686
+ plt.ael(elm, memberName, newValue, false);
687
+ }
688
+ }
689
+ else {
690
+ // Set property if it exists and it's not a SVG
691
+ const isComplex = isComplexType(newValue);
692
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
693
+ try {
694
+ if (!elm.tagName.includes('-')) {
695
+ const n = newValue == null ? '' : newValue;
696
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
697
+ if (memberName === 'list') {
698
+ isProp = false;
699
+ }
700
+ else if (oldValue == null || elm[memberName] != n) {
701
+ elm[memberName] = n;
702
+ }
703
+ }
704
+ else {
705
+ elm[memberName] = newValue;
706
+ }
707
+ }
708
+ catch (e) { }
709
+ }
710
+ /**
711
+ * Need to manually update attribute if:
712
+ * - memberName is not an attribute
713
+ * - if we are rendering the host element in order to reflect attribute
714
+ * - if it's a SVG, since properties might not work in <svg>
715
+ * - if the newValue is null/undefined or 'false'.
716
+ */
717
+ let xlink = false;
718
+ {
719
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
720
+ memberName = ln;
721
+ xlink = true;
722
+ }
723
+ }
724
+ if (newValue == null || newValue === false) {
725
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
726
+ if (xlink) {
727
+ elm.removeAttributeNS(XLINK_NS, memberName);
728
+ }
729
+ else {
730
+ elm.removeAttribute(memberName);
731
+ }
732
+ }
733
+ }
734
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
735
+ newValue = newValue === true ? '' : newValue;
736
+ if (xlink) {
737
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
738
+ }
739
+ else {
740
+ elm.setAttribute(memberName, newValue);
741
+ }
742
+ }
743
+ }
744
+ }
745
+ };
746
+ const parseClassListRegex = /\s/;
747
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
748
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
749
+ // if the element passed in is a shadow root, which is a document fragment
750
+ // then we want to be adding attrs/props to the shadow root's "host" element
751
+ // if it's not a shadow root, then we add attrs/props to the same element
752
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
753
+ ? newVnode.$elm$.host
754
+ : newVnode.$elm$;
755
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
756
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
757
+ {
758
+ // remove attributes no longer present on the vnode by setting them to undefined
759
+ for (memberName in oldVnodeAttrs) {
760
+ if (!(memberName in newVnodeAttrs)) {
761
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
762
+ }
763
+ }
764
+ }
765
+ // add new & update changed attributes
766
+ for (memberName in newVnodeAttrs) {
767
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
768
+ }
769
+ };
770
+ /**
771
+ * Create a DOM Node corresponding to one of the children of a given VNode.
772
+ *
773
+ * @param oldParentVNode the parent VNode from the previous render
774
+ * @param newParentVNode the parent VNode from the current render
775
+ * @param childIndex the index of the VNode, in the _new_ parent node's
776
+ * children, for which we will create a new DOM node
777
+ * @param parentElm the parent DOM node which our new node will be a child of
778
+ * @returns the newly created node
779
+ */
780
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
781
+ // tslint:disable-next-line: prefer-const
782
+ const newVNode = newParentVNode.$children$[childIndex];
783
+ let i = 0;
784
+ let elm;
785
+ let childNode;
786
+ let oldVNode;
787
+ if (!useNativeShadowDom) {
788
+ // remember for later we need to check to relocate nodes
789
+ checkSlotRelocate = true;
790
+ if (newVNode.$tag$ === 'slot') {
791
+ if (scopeId) {
792
+ // scoped css needs to add its scoped id to the parent element
793
+ parentElm.classList.add(scopeId + '-s');
794
+ }
795
+ newVNode.$flags$ |= newVNode.$children$
796
+ ? // slot element has fallback content
797
+ 2 /* VNODE_FLAGS.isSlotFallback */
798
+ : // slot element does not have fallback content
799
+ 1 /* VNODE_FLAGS.isSlotReference */;
800
+ }
801
+ }
802
+ if (newVNode.$text$ !== null) {
803
+ // create text node
804
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
805
+ }
806
+ else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
807
+ // create a slot reference node
808
+ elm = newVNode.$elm$ =
809
+ doc.createTextNode('');
810
+ }
811
+ else {
812
+ if (!isSvgMode) {
813
+ isSvgMode = newVNode.$tag$ === 'svg';
814
+ }
815
+ // create element
816
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
817
+ ? 'slot-fb'
818
+ : newVNode.$tag$)
819
+ );
820
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
821
+ isSvgMode = false;
822
+ }
823
+ // add css classes, attrs, props, listeners, etc.
824
+ {
825
+ updateElement(null, newVNode, isSvgMode);
826
+ }
827
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
828
+ // if there is a scopeId and this is the initial render
829
+ // then let's add the scopeId as a css class
830
+ elm.classList.add((elm['s-si'] = scopeId));
831
+ }
832
+ if (newVNode.$children$) {
833
+ for (i = 0; i < newVNode.$children$.length; ++i) {
834
+ // create the node
835
+ childNode = createElm(oldParentVNode, newVNode, i, elm);
836
+ // return node could have been null
837
+ if (childNode) {
838
+ // append our new node
839
+ elm.appendChild(childNode);
840
+ }
841
+ }
842
+ }
843
+ {
844
+ if (newVNode.$tag$ === 'svg') {
845
+ // Only reset the SVG context when we're exiting <svg> element
846
+ isSvgMode = false;
847
+ }
848
+ else if (elm.tagName === 'foreignObject') {
849
+ // Reenter SVG context when we're exiting <foreignObject> element
850
+ isSvgMode = true;
851
+ }
852
+ }
853
+ }
854
+ {
855
+ elm['s-hn'] = hostTagName;
856
+ if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
857
+ // remember the content reference comment
858
+ elm['s-sr'] = true;
859
+ // remember the content reference comment
860
+ elm['s-cr'] = contentRef;
861
+ // remember the slot name, or empty string for default slot
862
+ elm['s-sn'] = newVNode.$name$ || '';
863
+ // check if we've got an old vnode for this slot
864
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
865
+ if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
866
+ // we've got an old slot vnode and the wrapper is being replaced
867
+ // so let's move the old slot content back to it's original location
868
+ putBackInOriginalLocation(oldParentVNode.$elm$, false);
869
+ }
870
+ }
871
+ }
872
+ return elm;
873
+ };
874
+ const putBackInOriginalLocation = (parentElm, recursive) => {
875
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
876
+ const oldSlotChildNodes = parentElm.childNodes;
877
+ for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
878
+ const childNode = oldSlotChildNodes[i];
879
+ if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
880
+ // // this child node in the old element is from another component
881
+ // // remove this node from the old slot's parent
882
+ // childNode.remove();
883
+ // and relocate it back to it's original location
884
+ parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
885
+ // remove the old original location comment entirely
886
+ // later on the patch function will know what to do
887
+ // and move this to the correct spot in need be
888
+ childNode['s-ol'].remove();
889
+ childNode['s-ol'] = undefined;
890
+ checkSlotRelocate = true;
891
+ }
892
+ if (recursive) {
893
+ putBackInOriginalLocation(childNode, recursive);
894
+ }
895
+ }
896
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
897
+ };
898
+ /**
899
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
900
+ * add them to the DOM in the appropriate place.
901
+ *
902
+ * @param parentElm the DOM node which should be used as a parent for the new
903
+ * DOM nodes
904
+ * @param before a child of the `parentElm` which the new children should be
905
+ * inserted before (optional)
906
+ * @param parentVNode the parent virtual DOM node
907
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
908
+ * @param startIdx the index in the child virtual DOM nodes at which to start
909
+ * creating DOM nodes (inclusive)
910
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
911
+ * creating DOM nodes (inclusive)
912
+ */
913
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
914
+ let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
915
+ let childNode;
916
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
917
+ containerElm = containerElm.shadowRoot;
918
+ }
919
+ for (; startIdx <= endIdx; ++startIdx) {
920
+ if (vnodes[startIdx]) {
921
+ childNode = createElm(null, parentVNode, startIdx, parentElm);
922
+ if (childNode) {
923
+ vnodes[startIdx].$elm$ = childNode;
924
+ containerElm.insertBefore(childNode, referenceNode(before) );
925
+ }
926
+ }
927
+ }
928
+ };
929
+ /**
930
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
931
+ * This can be used to, for instance, clean up after a list of children which
932
+ * should no longer be shown.
933
+ *
934
+ * This function also handles some of Stencil's slot relocation logic.
935
+ *
936
+ * @param vnodes a list of virtual DOM nodes to remove
937
+ * @param startIdx the index at which to start removing nodes (inclusive)
938
+ * @param endIdx the index at which to stop removing nodes (inclusive)
939
+ * @param vnode a VNode
940
+ * @param elm an element
941
+ */
942
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
943
+ for (; startIdx <= endIdx; ++startIdx) {
944
+ if ((vnode = vnodes[startIdx])) {
945
+ elm = vnode.$elm$;
946
+ callNodeRefs(vnode);
947
+ {
948
+ // we're removing this element
949
+ // so it's possible we need to show slot fallback content now
950
+ checkSlotFallbackVisibility = true;
951
+ if (elm['s-ol']) {
952
+ // remove the original location comment
953
+ elm['s-ol'].remove();
954
+ }
955
+ else {
956
+ // it's possible that child nodes of the node
957
+ // that's being removed are slot nodes
958
+ putBackInOriginalLocation(elm, true);
959
+ }
960
+ }
961
+ // remove the vnode's element from the dom
962
+ elm.remove();
963
+ }
964
+ }
965
+ };
966
+ /**
967
+ * Reconcile the children of a new VNode with the children of an old VNode by
968
+ * traversing the two collections of children, identifying nodes that are
969
+ * conserved or changed, calling out to `patch` to make any necessary
970
+ * updates to the DOM, and rearranging DOM nodes as needed.
971
+ *
972
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
973
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
974
+ * 'windows' by storing start and end indices and references to the
975
+ * corresponding array entries. Initially the two 'windows' are basically equal
976
+ * to the entire array, but we progressively narrow the windows until there are
977
+ * no children left to update by doing the following:
978
+ *
979
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
980
+ * that if we have an initial array like the following we'll end up dealing
981
+ * only with a window bounded by the highlighted elements:
982
+ *
983
+ * [null, null, VNode1 , ... , VNode2, null, null]
984
+ * ^^^^^^ ^^^^^^
985
+ *
986
+ * 2. Check to see if the elements at the head and tail positions are equal
987
+ * across the windows. This will basically detect elements which haven't
988
+ * been added, removed, or changed position, i.e. if you had the following
989
+ * VNode elements (represented as HTML):
990
+ *
991
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
992
+ * newVNode: `<div><p><span>THERE</span></p></div>`
993
+ *
994
+ * Then when comparing the children of the `<div>` tag we check the equality
995
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
996
+ * same tag in the same position, we'd be able to avoid completely
997
+ * re-rendering the subtree under them with a new DOM element and would just
998
+ * call out to `patch` to handle reconciling their children and so on.
999
+ *
1000
+ * 3. Check, for both windows, to see if the element at the beginning of the
1001
+ * window corresponds to the element at the end of the other window. This is
1002
+ * a heuristic which will let us identify _some_ situations in which
1003
+ * elements have changed position, for instance it _should_ detect that the
1004
+ * children nodes themselves have not changed but merely moved in the
1005
+ * following example:
1006
+ *
1007
+ * oldVNode: `<div><element-one /><element-two /></div>`
1008
+ * newVNode: `<div><element-two /><element-one /></div>`
1009
+ *
1010
+ * If we find cases like this then we also need to move the concrete DOM
1011
+ * elements corresponding to the moved children to write the re-order to the
1012
+ * DOM.
1013
+ *
1014
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
1015
+ * nodes in the old children which have the same key as the first element in
1016
+ * our window on the new children. If we find such a node we handle calling
1017
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
1018
+ * what we find.
1019
+ *
1020
+ * Finally, once we've narrowed our 'windows' to the point that either of them
1021
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
1022
+ * insertion or deletion that needs to happen to get a DOM state that correctly
1023
+ * reflects the new child VNodes. If, for instance, after our window on the old
1024
+ * children has collapsed we still have more nodes on the new children that
1025
+ * we haven't dealt with yet then we need to add them, or if the new children
1026
+ * collapse but we still have unhandled _old_ children then we need to make
1027
+ * sure the corresponding DOM nodes are removed.
1028
+ *
1029
+ * @param parentElm the node into which the parent VNode is rendered
1030
+ * @param oldCh the old children of the parent node
1031
+ * @param newVNode the new VNode which will replace the parent
1032
+ * @param newCh the new children of the parent node
1033
+ */
1034
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
1035
+ let oldStartIdx = 0;
1036
+ let newStartIdx = 0;
1037
+ let idxInOld = 0;
1038
+ let i = 0;
1039
+ let oldEndIdx = oldCh.length - 1;
1040
+ let oldStartVnode = oldCh[0];
1041
+ let oldEndVnode = oldCh[oldEndIdx];
1042
+ let newEndIdx = newCh.length - 1;
1043
+ let newStartVnode = newCh[0];
1044
+ let newEndVnode = newCh[newEndIdx];
1045
+ let node;
1046
+ let elmToMove;
1047
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
1048
+ if (oldStartVnode == null) {
1049
+ // VNode might have been moved left
1050
+ oldStartVnode = oldCh[++oldStartIdx];
1051
+ }
1052
+ else if (oldEndVnode == null) {
1053
+ oldEndVnode = oldCh[--oldEndIdx];
1054
+ }
1055
+ else if (newStartVnode == null) {
1056
+ newStartVnode = newCh[++newStartIdx];
1057
+ }
1058
+ else if (newEndVnode == null) {
1059
+ newEndVnode = newCh[--newEndIdx];
1060
+ }
1061
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
1062
+ // if the start nodes are the same then we should patch the new VNode
1063
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
1064
+ // indices to reflect that. We don't need to move any DOM Nodes around
1065
+ // since things are matched up in order.
1066
+ patch(oldStartVnode, newStartVnode);
1067
+ oldStartVnode = oldCh[++oldStartIdx];
1068
+ newStartVnode = newCh[++newStartIdx];
1069
+ }
1070
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
1071
+ // likewise, if the end nodes are the same we patch new onto old and
1072
+ // decrement our end indices, and also likewise in this case we don't
1073
+ // need to move any DOM Nodes.
1074
+ patch(oldEndVnode, newEndVnode);
1075
+ oldEndVnode = oldCh[--oldEndIdx];
1076
+ newEndVnode = newCh[--newEndIdx];
1077
+ }
1078
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
1079
+ // case: "Vnode moved right"
1080
+ //
1081
+ // We've found that the last node in our window on the new children is
1082
+ // the same VNode as the _first_ node in our window on the old children
1083
+ // we're dealing with now. Visually, this is the layout of these two
1084
+ // nodes:
1085
+ //
1086
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
1087
+ // ^^^^^^^^^^^
1088
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
1089
+ // ^^^^^^^^^^^^^
1090
+ //
1091
+ // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
1092
+ // and move the DOM element for `oldStartVnode`.
1093
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1094
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
1095
+ }
1096
+ patch(oldStartVnode, newEndVnode);
1097
+ // We need to move the element for `oldStartVnode` into a position which
1098
+ // will be appropriate for `newEndVnode`. For this we can use
1099
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
1100
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
1101
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
1102
+ //
1103
+ // <old-start-node />
1104
+ // <some-intervening-node />
1105
+ // <old-end-node />
1106
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
1107
+ // <next-sibling />
1108
+ //
1109
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
1110
+ // the node for `oldStartVnode` at the end of the children of
1111
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
1112
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
1113
+ // append it to the children of the parent element.
1114
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1115
+ oldStartVnode = oldCh[++oldStartIdx];
1116
+ newEndVnode = newCh[--newEndIdx];
1117
+ }
1118
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
1119
+ // case: "Vnode moved left"
1120
+ //
1121
+ // We've found that the first node in our window on the new children is
1122
+ // the same VNode as the _last_ node in our window on the old children.
1123
+ // Visually, this is the layout of these two nodes:
1124
+ //
1125
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
1126
+ // ^^^^^^^^^^^^^
1127
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
1128
+ // ^^^^^^^^^^^
1129
+ //
1130
+ // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
1131
+ // (which will handle updating any changed attributes, reconciling their
1132
+ // children etc) but we also need to move the DOM node to which
1133
+ // `oldEndVnode` corresponds.
1134
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1135
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
1136
+ }
1137
+ patch(oldEndVnode, newStartVnode);
1138
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
1139
+ // the same node, so since we're here we know that they are not. Thus we
1140
+ // can move the element for `oldEndVnode` _before_ the element for
1141
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
1142
+ // future.
1143
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
1144
+ oldEndVnode = oldCh[--oldEndIdx];
1145
+ newStartVnode = newCh[++newStartIdx];
1146
+ }
1147
+ else {
1148
+ // Here we do some checks to match up old and new nodes based on the
1149
+ // `$key$` attribute, which is set by putting a `key="my-key"` attribute
1150
+ // in the JSX for a DOM element in the implementation of a Stencil
1151
+ // component.
1152
+ //
1153
+ // First we check to see if there are any nodes in the array of old
1154
+ // children which have the same key as the first node in the new
1155
+ // children.
1156
+ idxInOld = -1;
1157
+ {
1158
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
1159
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
1160
+ idxInOld = i;
1161
+ break;
1162
+ }
1163
+ }
1164
+ }
1165
+ if (idxInOld >= 0) {
1166
+ // We found a node in the old children which matches up with the first
1167
+ // node in the new children! So let's deal with that
1168
+ elmToMove = oldCh[idxInOld];
1169
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
1170
+ // the tag doesn't match so we'll need a new DOM element
1171
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
1172
+ }
1173
+ else {
1174
+ patch(elmToMove, newStartVnode);
1175
+ // invalidate the matching old node so that we won't try to update it
1176
+ // again later on
1177
+ oldCh[idxInOld] = undefined;
1178
+ node = elmToMove.$elm$;
1179
+ }
1180
+ newStartVnode = newCh[++newStartIdx];
1181
+ }
1182
+ else {
1183
+ // We either didn't find an element in the old children that matches
1184
+ // the key of the first new child OR the build is not using `key`
1185
+ // attributes at all. In either case we need to create a new element
1186
+ // for the new node.
1187
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
1188
+ newStartVnode = newCh[++newStartIdx];
1189
+ }
1190
+ if (node) {
1191
+ // if we created a new node then handle inserting it to the DOM
1192
+ {
1193
+ parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
1194
+ }
1195
+ }
1196
+ }
1197
+ }
1198
+ if (oldStartIdx > oldEndIdx) {
1199
+ // we have some more new nodes to add which don't match up with old nodes
1200
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
1201
+ }
1202
+ else if (newStartIdx > newEndIdx) {
1203
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
1204
+ // in the new array, so lets remove them (which entails cleaning up the
1205
+ // relevant DOM nodes)
1206
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1207
+ }
1208
+ };
1209
+ /**
1210
+ * Compare two VNodes to determine if they are the same
1211
+ *
1212
+ * **NB**: This function is an equality _heuristic_ based on the available
1213
+ * information set on the two VNodes and can be misleading under certain
1214
+ * circumstances. In particular, if the two nodes do not have `key` attrs
1215
+ * (available under `$key$` on VNodes) then the function falls back on merely
1216
+ * checking that they have the same tag.
1217
+ *
1218
+ * So, in other words, if `key` attrs are not set on VNodes which may be
1219
+ * changing order within a `children` array or something along those lines then
1220
+ * we could obtain a false negative and then have to do needless re-rendering
1221
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
1222
+ *
1223
+ * @param leftVNode the first VNode to check
1224
+ * @param rightVNode the second VNode to check
1225
+ * @returns whether they're equal or not
1226
+ */
1227
+ const isSameVnode = (leftVNode, rightVNode) => {
1228
+ // compare if two vnode to see if they're "technically" the same
1229
+ // need to have the same element tag, and same key to be the same
1230
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
1231
+ if (leftVNode.$tag$ === 'slot') {
1232
+ return leftVNode.$name$ === rightVNode.$name$;
1233
+ }
1234
+ // this will be set if components in the build have `key` attrs set on them
1235
+ {
1236
+ return leftVNode.$key$ === rightVNode.$key$;
1237
+ }
1238
+ }
1239
+ return false;
1240
+ };
1241
+ const referenceNode = (node) => {
1242
+ // this node was relocated to a new location in the dom
1243
+ // because of some other component's slot
1244
+ // but we still have an html comment in place of where
1245
+ // it's original location was according to it's original vdom
1246
+ return (node && node['s-ol']) || node;
1247
+ };
1248
+ const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
1249
+ /**
1250
+ * Handle reconciling an outdated VNode with a new one which corresponds to
1251
+ * it. This function handles flushing updates to the DOM and reconciling the
1252
+ * children of the two nodes (if any).
1253
+ *
1254
+ * @param oldVNode an old VNode whose DOM element and children we want to update
1255
+ * @param newVNode a new VNode representing an updated version of the old one
1256
+ */
1257
+ const patch = (oldVNode, newVNode) => {
1258
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
1259
+ const oldChildren = oldVNode.$children$;
1260
+ const newChildren = newVNode.$children$;
1261
+ const tag = newVNode.$tag$;
1262
+ const text = newVNode.$text$;
1263
+ let defaultHolder;
1264
+ if (text === null) {
1265
+ {
1266
+ // test if we're rendering an svg element, or still rendering nodes inside of one
1267
+ // only add this to the when the compiler sees we're using an svg somewhere
1268
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
1269
+ }
1270
+ {
1271
+ if (tag === 'slot')
1272
+ ;
1273
+ else {
1274
+ // either this is the first render of an element OR it's an update
1275
+ // AND we already know it's possible it could have changed
1276
+ // this updates the element's css classes, attrs, props, listeners, etc.
1277
+ updateElement(oldVNode, newVNode, isSvgMode);
1278
+ }
1279
+ }
1280
+ if (oldChildren !== null && newChildren !== null) {
1281
+ // looks like there's child vnodes for both the old and new vnodes
1282
+ // so we need to call `updateChildren` to reconcile them
1283
+ updateChildren(elm, oldChildren, newVNode, newChildren);
1284
+ }
1285
+ else if (newChildren !== null) {
1286
+ // no old child vnodes, but there are new child vnodes to add
1287
+ if (oldVNode.$text$ !== null) {
1288
+ // the old vnode was text, so be sure to clear it out
1289
+ elm.textContent = '';
1290
+ }
1291
+ // add the new vnode children
1292
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
1293
+ }
1294
+ else if (oldChildren !== null) {
1295
+ // no new child vnodes, but there are old child vnodes to remove
1296
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
1297
+ }
1298
+ if (isSvgMode && tag === 'svg') {
1299
+ isSvgMode = false;
1300
+ }
1301
+ }
1302
+ else if ((defaultHolder = elm['s-cr'])) {
1303
+ // this element has slotted content
1304
+ defaultHolder.parentNode.textContent = text;
1305
+ }
1306
+ else if (oldVNode.$text$ !== text) {
1307
+ // update the text content for the text only vnode
1308
+ // and also only if the text is different than before
1309
+ elm.data = text;
1310
+ }
1311
+ };
1312
+ const updateFallbackSlotVisibility = (elm) => {
1313
+ // tslint:disable-next-line: prefer-const
1314
+ const childNodes = elm.childNodes;
1315
+ let childNode;
1316
+ let i;
1317
+ let ilen;
1318
+ let j;
1319
+ let slotNameAttr;
1320
+ let nodeType;
1321
+ for (i = 0, ilen = childNodes.length; i < ilen; i++) {
1322
+ childNode = childNodes[i];
1323
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1324
+ if (childNode['s-sr']) {
1325
+ // this is a slot fallback node
1326
+ // get the slot name for this slot reference node
1327
+ slotNameAttr = childNode['s-sn'];
1328
+ // by default always show a fallback slot node
1329
+ // then hide it if there are other slots in the light dom
1330
+ childNode.hidden = false;
1331
+ for (j = 0; j < ilen; j++) {
1332
+ nodeType = childNodes[j].nodeType;
1333
+ if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
1334
+ // this sibling node is from a different component OR is a named fallback slot node
1335
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
1336
+ childNode.hidden = true;
1337
+ break;
1338
+ }
1339
+ }
1340
+ else {
1341
+ // this is a default fallback slot node
1342
+ // any element or text node (with content)
1343
+ // should hide the default fallback slot node
1344
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
1345
+ (nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
1346
+ childNode.hidden = true;
1347
+ break;
1348
+ }
1349
+ }
1350
+ }
1351
+ }
1352
+ // keep drilling down
1353
+ updateFallbackSlotVisibility(childNode);
1354
+ }
1355
+ }
1356
+ };
1357
+ const relocateNodes = [];
1358
+ const relocateSlotContent = (elm) => {
1359
+ // tslint:disable-next-line: prefer-const
1360
+ let childNode;
1361
+ let node;
1362
+ let hostContentNodes;
1363
+ let slotNameAttr;
1364
+ let relocateNodeData;
1365
+ let j;
1366
+ let i = 0;
1367
+ const childNodes = elm.childNodes;
1368
+ const ilen = childNodes.length;
1369
+ for (; i < ilen; i++) {
1370
+ childNode = childNodes[i];
1371
+ if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
1372
+ // first got the content reference comment node
1373
+ // then we got it's parent, which is where all the host content is in now
1374
+ hostContentNodes = node.parentNode.childNodes;
1375
+ slotNameAttr = childNode['s-sn'];
1376
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
1377
+ node = hostContentNodes[j];
1378
+ if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
1379
+ // let's do some relocating to its new home
1380
+ // but never relocate a content reference node
1381
+ // that is suppose to always represent the original content location
1382
+ if (isNodeLocatedInSlot(node, slotNameAttr)) {
1383
+ // it's possible we've already decided to relocate this node
1384
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1385
+ // made some changes to slots
1386
+ // let's make sure we also double check
1387
+ // fallbacks are correctly hidden or shown
1388
+ checkSlotFallbackVisibility = true;
1389
+ node['s-sn'] = node['s-sn'] || slotNameAttr;
1390
+ if (relocateNodeData) {
1391
+ // previously we never found a slot home for this node
1392
+ // but turns out we did, so let's remember it now
1393
+ relocateNodeData.$slotRefNode$ = childNode;
1394
+ }
1395
+ else {
1396
+ // add to our list of nodes to relocate
1397
+ relocateNodes.push({
1398
+ $slotRefNode$: childNode,
1399
+ $nodeToRelocate$: node,
1400
+ });
1401
+ }
1402
+ if (node['s-sr']) {
1403
+ relocateNodes.map((relocateNode) => {
1404
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
1405
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1406
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
1407
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1408
+ }
1409
+ }
1410
+ });
1411
+ }
1412
+ }
1413
+ else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
1414
+ // so far this element does not have a slot home, not setting slotRefNode on purpose
1415
+ // if we never find a home for this element then we'll need to hide it
1416
+ relocateNodes.push({
1417
+ $nodeToRelocate$: node,
1418
+ });
1419
+ }
1420
+ }
1421
+ }
1422
+ }
1423
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1424
+ relocateSlotContent(childNode);
1425
+ }
1426
+ }
1427
+ };
1428
+ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
1429
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1430
+ if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
1431
+ return true;
1432
+ }
1433
+ if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
1434
+ return true;
1435
+ }
1436
+ return false;
1437
+ }
1438
+ if (nodeToRelocate['s-sn'] === slotNameAttr) {
1439
+ return true;
1440
+ }
1441
+ return slotNameAttr === '';
1442
+ };
1443
+ const callNodeRefs = (vNode) => {
1444
+ {
1445
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1446
+ vNode.$children$ && vNode.$children$.map(callNodeRefs);
1447
+ }
1448
+ };
1449
+ /**
1450
+ * The main entry point for Stencil's virtual DOM-based rendering engine
1451
+ *
1452
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
1453
+ * function will handle creating a virtual DOM tree with a single root, patching
1454
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
1455
+ * relocation, and reflecting attributes.
1456
+ *
1457
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
1458
+ * the DOM node into which it should be rendered.
1459
+ * @param renderFnResults the virtual DOM nodes to be rendered
1460
+ */
1461
+ const renderVdom = (hostRef, renderFnResults) => {
1462
+ const hostElm = hostRef.$hostElement$;
1463
+ const cmpMeta = hostRef.$cmpMeta$;
1464
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1465
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1466
+ hostTagName = hostElm.tagName;
1467
+ if (cmpMeta.$attrsToReflect$) {
1468
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1469
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
1470
+ }
1471
+ rootVnode.$tag$ = null;
1472
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
1473
+ hostRef.$vnode$ = rootVnode;
1474
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
1475
+ {
1476
+ scopeId = hostElm['s-sc'];
1477
+ }
1478
+ {
1479
+ contentRef = hostElm['s-cr'];
1480
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
1481
+ // always reset
1482
+ checkSlotFallbackVisibility = false;
1483
+ }
1484
+ // synchronous patch
1485
+ patch(oldVNode, rootVnode);
1486
+ {
1487
+ // while we're moving nodes around existing nodes, temporarily disable
1488
+ // the disconnectCallback from working
1489
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1490
+ if (checkSlotRelocate) {
1491
+ relocateSlotContent(rootVnode.$elm$);
1492
+ let relocateData;
1493
+ let nodeToRelocate;
1494
+ let orgLocationNode;
1495
+ let parentNodeRef;
1496
+ let insertBeforeNode;
1497
+ let refNode;
1498
+ let i = 0;
1499
+ for (; i < relocateNodes.length; i++) {
1500
+ relocateData = relocateNodes[i];
1501
+ nodeToRelocate = relocateData.$nodeToRelocate$;
1502
+ if (!nodeToRelocate['s-ol']) {
1503
+ // add a reference node marking this node's original location
1504
+ // keep a reference to this node for later lookups
1505
+ orgLocationNode =
1506
+ doc.createTextNode('');
1507
+ orgLocationNode['s-nr'] = nodeToRelocate;
1508
+ nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
1509
+ }
1510
+ }
1511
+ for (i = 0; i < relocateNodes.length; i++) {
1512
+ relocateData = relocateNodes[i];
1513
+ nodeToRelocate = relocateData.$nodeToRelocate$;
1514
+ if (relocateData.$slotRefNode$) {
1515
+ // by default we're just going to insert it directly
1516
+ // after the slot reference node
1517
+ parentNodeRef = relocateData.$slotRefNode$.parentNode;
1518
+ insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
1519
+ orgLocationNode = nodeToRelocate['s-ol'];
1520
+ while ((orgLocationNode = orgLocationNode.previousSibling)) {
1521
+ refNode = orgLocationNode['s-nr'];
1522
+ if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
1523
+ refNode = refNode.nextSibling;
1524
+ if (!refNode || !refNode['s-nr']) {
1525
+ insertBeforeNode = refNode;
1526
+ break;
1527
+ }
1528
+ }
1529
+ }
1530
+ if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
1531
+ nodeToRelocate.nextSibling !== insertBeforeNode) {
1532
+ // we've checked that it's worth while to relocate
1533
+ // since that the node to relocate
1534
+ // has a different next sibling or parent relocated
1535
+ if (nodeToRelocate !== insertBeforeNode) {
1536
+ if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
1537
+ // probably a component in the index.html that doesn't have it's hostname set
1538
+ nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
1539
+ }
1540
+ // add it back to the dom but in its new home
1541
+ parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1542
+ }
1543
+ }
1544
+ }
1545
+ else {
1546
+ // this node doesn't have a slot home to go to, so let's hide it
1547
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1548
+ nodeToRelocate.hidden = true;
1549
+ }
1550
+ }
1551
+ }
1552
+ }
1553
+ if (checkSlotFallbackVisibility) {
1554
+ updateFallbackSlotVisibility(rootVnode.$elm$);
1555
+ }
1556
+ // done moving nodes around
1557
+ // allow the disconnect callback to work again
1558
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1559
+ // always reset
1560
+ relocateNodes.length = 0;
1561
+ }
1562
+ };
1563
+ const attachToAncestor = (hostRef, ancestorComponent) => {
1564
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1565
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
1566
+ }
1567
+ };
1568
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
1569
+ {
1570
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1571
+ }
1572
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1573
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1574
+ return;
1575
+ }
1576
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1577
+ // there is no ancestor component or the ancestor component
1578
+ // has already fired off its lifecycle update then
1579
+ // fire off the initial update
1580
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1581
+ return writeTask(dispatch) ;
1582
+ };
1583
+ const dispatchHooks = (hostRef, isInitialLoad) => {
1584
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1585
+ const instance = hostRef.$lazyInstance$ ;
1586
+ let promise;
1587
+ if (isInitialLoad) {
1588
+ {
1589
+ hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1590
+ if (hostRef.$queuedListeners$) {
1591
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1592
+ hostRef.$queuedListeners$ = null;
1593
+ }
1594
+ }
1595
+ {
1596
+ promise = safeCall(instance, 'componentWillLoad');
1597
+ }
1598
+ }
1599
+ else {
1600
+ {
1601
+ promise = safeCall(instance, 'componentWillUpdate');
1602
+ }
1603
+ }
1604
+ {
1605
+ promise = then(promise, () => safeCall(instance, 'componentWillRender'));
1606
+ }
1607
+ endSchedule();
1608
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1609
+ };
1610
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1611
+ // updateComponent
1612
+ const elm = hostRef.$hostElement$;
1613
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1614
+ const rc = elm['s-rc'];
1615
+ if (isInitialLoad) {
1616
+ // DOM WRITE!
1617
+ attachStyles(hostRef);
1618
+ }
1619
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1620
+ {
1621
+ callRender(hostRef, instance);
1622
+ }
1623
+ if (rc) {
1624
+ // ok, so turns out there are some child host elements
1625
+ // waiting on this parent element to load
1626
+ // let's fire off all update callbacks waiting
1627
+ rc.map((cb) => cb());
1628
+ elm['s-rc'] = undefined;
1629
+ }
1630
+ endRender();
1631
+ endUpdate();
1632
+ {
1633
+ const childrenPromises = elm['s-p'];
1634
+ const postUpdate = () => postUpdateComponent(hostRef);
1635
+ if (childrenPromises.length === 0) {
1636
+ postUpdate();
1637
+ }
1638
+ else {
1639
+ Promise.all(childrenPromises).then(postUpdate);
1640
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1641
+ childrenPromises.length = 0;
1642
+ }
1643
+ }
1644
+ };
1645
+ const callRender = (hostRef, instance, elm) => {
1646
+ try {
1647
+ instance = instance.render() ;
1648
+ {
1649
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1650
+ }
1651
+ {
1652
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1653
+ }
1654
+ {
1655
+ {
1656
+ // looks like we've got child nodes to render into this host element
1657
+ // or we need to update the css class/attrs on the host element
1658
+ // DOM WRITE!
1659
+ {
1660
+ renderVdom(hostRef, instance);
1661
+ }
1662
+ }
1663
+ }
1664
+ }
1665
+ catch (e) {
1666
+ consoleError(e, hostRef.$hostElement$);
1667
+ }
1668
+ return null;
1669
+ };
1670
+ const postUpdateComponent = (hostRef) => {
1671
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1672
+ const elm = hostRef.$hostElement$;
1673
+ const endPostUpdate = createTime('postUpdate', tagName);
1674
+ const instance = hostRef.$lazyInstance$ ;
1675
+ const ancestorComponent = hostRef.$ancestorComponent$;
1676
+ {
1677
+ safeCall(instance, 'componentDidRender');
1678
+ }
1679
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1680
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1681
+ {
1682
+ // DOM WRITE!
1683
+ addHydratedFlag(elm);
1684
+ }
1685
+ {
1686
+ safeCall(instance, 'componentDidLoad');
1687
+ }
1688
+ endPostUpdate();
1689
+ {
1690
+ hostRef.$onReadyResolve$(elm);
1691
+ if (!ancestorComponent) {
1692
+ appDidLoad();
1693
+ }
1694
+ }
1695
+ }
1696
+ else {
1697
+ {
1698
+ safeCall(instance, 'componentDidUpdate');
1699
+ }
1700
+ endPostUpdate();
1701
+ }
1702
+ {
1703
+ hostRef.$onInstanceResolve$(elm);
1704
+ }
1705
+ // load events fire from bottom to top
1706
+ // the deepest elements load first then bubbles up
1707
+ {
1708
+ if (hostRef.$onRenderResolve$) {
1709
+ hostRef.$onRenderResolve$();
1710
+ hostRef.$onRenderResolve$ = undefined;
1711
+ }
1712
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1713
+ nextTick(() => scheduleUpdate(hostRef, false));
1714
+ }
1715
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1716
+ }
1717
+ // ( •_•)
1718
+ // ( •_•)>⌐■-■
1719
+ // (⌐■_■)
1720
+ };
1721
+ const appDidLoad = (who) => {
1722
+ // on appload
1723
+ // we have finish the first big initial render
1724
+ {
1725
+ addHydratedFlag(doc.documentElement);
1726
+ }
1727
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1728
+ };
1729
+ const safeCall = (instance, method, arg) => {
1730
+ if (instance && instance[method]) {
1731
+ try {
1732
+ return instance[method](arg);
1733
+ }
1734
+ catch (e) {
1735
+ consoleError(e);
1736
+ }
1737
+ }
1738
+ return undefined;
1739
+ };
1740
+ const then = (promise, thenFn) => {
1741
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
1742
+ };
1743
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1744
+ ;
1745
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1746
+ const setValue = (ref, propName, newVal, cmpMeta) => {
1747
+ // check our new property value against our internal value
1748
+ const hostRef = getHostRef(ref);
1749
+ const elm = hostRef.$hostElement$ ;
1750
+ const oldVal = hostRef.$instanceValues$.get(propName);
1751
+ const flags = hostRef.$flags$;
1752
+ const instance = hostRef.$lazyInstance$ ;
1753
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1754
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1755
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1756
+ const didValueChange = newVal !== oldVal && !areBothNaN;
1757
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1758
+ // gadzooks! the property's value has changed!!
1759
+ // set our new value!
1760
+ hostRef.$instanceValues$.set(propName, newVal);
1761
+ if (instance) {
1762
+ // get an array of method names of watch functions to call
1763
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1764
+ const watchMethods = cmpMeta.$watchers$[propName];
1765
+ if (watchMethods) {
1766
+ // this instance is watching for when this property changed
1767
+ watchMethods.map((watchMethodName) => {
1768
+ try {
1769
+ // fire off each of the watch methods that are watching this property
1770
+ instance[watchMethodName](newVal, oldVal, propName);
1771
+ }
1772
+ catch (e) {
1773
+ consoleError(e, elm);
1774
+ }
1775
+ });
1776
+ }
1777
+ }
1778
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1779
+ // looks like this value actually changed, so we've got work to do!
1780
+ // but only if we've already rendered, otherwise just chill out
1781
+ // queue that we need to do an update, but don't worry about queuing
1782
+ // up millions cuz this function ensures it only runs once
1783
+ scheduleUpdate(hostRef, false);
1784
+ }
1785
+ }
1786
+ }
1787
+ };
1788
+ /**
1789
+ * Attach a series of runtime constructs to a compiled Stencil component
1790
+ * constructor, including getters and setters for the `@Prop` and `@State`
1791
+ * decorators, callbacks for when attributes change, and so on.
1792
+ *
1793
+ * @param Cstr the constructor for a component that we need to process
1794
+ * @param cmpMeta metadata collected previously about the component
1795
+ * @param flags a number used to store a series of bit flags
1796
+ * @returns a reference to the same constructor passed in (but now mutated)
1797
+ */
1798
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
1799
+ if (cmpMeta.$members$) {
1800
+ if (Cstr.watchers) {
1801
+ cmpMeta.$watchers$ = Cstr.watchers;
1802
+ }
1803
+ // It's better to have a const than two Object.entries()
1804
+ const members = Object.entries(cmpMeta.$members$);
1805
+ const prototype = Cstr.prototype;
1806
+ members.map(([memberName, [memberFlags]]) => {
1807
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1808
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1809
+ // proxyComponent - prop
1810
+ Object.defineProperty(prototype, memberName, {
1811
+ get() {
1812
+ // proxyComponent, get value
1813
+ return getValue(this, memberName);
1814
+ },
1815
+ set(newValue) {
1816
+ // proxyComponent, set value
1817
+ setValue(this, memberName, newValue, cmpMeta);
1818
+ },
1819
+ configurable: true,
1820
+ enumerable: true,
1821
+ });
1822
+ }
1823
+ else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1824
+ memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1825
+ // proxyComponent - method
1826
+ Object.defineProperty(prototype, memberName, {
1827
+ value(...args) {
1828
+ const ref = getHostRef(this);
1829
+ return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
1830
+ },
1831
+ });
1832
+ }
1833
+ });
1834
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1835
+ const attrNameToPropName = new Map();
1836
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1837
+ plt.jmp(() => {
1838
+ const propName = attrNameToPropName.get(attrName);
1839
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1840
+ // in the case where an attribute was set inline.
1841
+ // ```html
1842
+ // <my-component some-attribute="some-value"></my-component>
1843
+ // ```
1844
+ //
1845
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
1846
+ // programmatically changes it before it has been upgraded as shown below:
1847
+ //
1848
+ // ```html
1849
+ // <!-- this component has _not_ been upgraded yet -->
1850
+ // <my-component id="test" some-attribute="some-value"></my-component>
1851
+ // <script>
1852
+ // // grab non-upgraded component
1853
+ // el = document.querySelector("#test");
1854
+ // el.someAttribute = "another-value";
1855
+ // // upgrade component
1856
+ // customElements.define('my-component', MyComponent);
1857
+ // </script>
1858
+ // ```
1859
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
1860
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1861
+ // to the value that was set inline i.e. "some-value" from above example. When
1862
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
1863
+ //
1864
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
1865
+ // by connectedCallback as this attributeChangedCallback will not fire.
1866
+ //
1867
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1868
+ //
1869
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1870
+ // properties here given that this goes against best practices outlined here
1871
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1872
+ if (this.hasOwnProperty(propName)) {
1873
+ newValue = this[propName];
1874
+ delete this[propName];
1875
+ }
1876
+ else if (prototype.hasOwnProperty(propName) &&
1877
+ typeof this[propName] === 'number' &&
1878
+ this[propName] == newValue) {
1879
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1880
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1881
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1882
+ return;
1883
+ }
1884
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1885
+ });
1886
+ };
1887
+ // create an array of attributes to observe
1888
+ // and also create a map of html attribute name to js property name
1889
+ Cstr.observedAttributes = members
1890
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1891
+ .map(([propName, m]) => {
1892
+ const attrName = m[1] || propName;
1893
+ attrNameToPropName.set(attrName, propName);
1894
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1895
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
1896
+ }
1897
+ return attrName;
1898
+ });
1899
+ }
1900
+ }
1901
+ return Cstr;
1902
+ };
1903
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1904
+ // initializeComponent
1905
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1906
+ {
1907
+ // we haven't initialized this element yet
1908
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1909
+ // lazy loaded components
1910
+ // request the component's implementation to be
1911
+ // wired up with the host element
1912
+ Cstr = loadModule(cmpMeta);
1913
+ if (Cstr.then) {
1914
+ // Await creates a micro-task avoid if possible
1915
+ const endLoad = uniqueTime();
1916
+ Cstr = await Cstr;
1917
+ endLoad();
1918
+ }
1919
+ if (!Cstr.isProxied) {
1920
+ // we've never proxied this Constructor before
1921
+ // let's add the getters/setters to its prototype before
1922
+ // the first time we create an instance of the implementation
1923
+ {
1924
+ cmpMeta.$watchers$ = Cstr.watchers;
1925
+ }
1926
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1927
+ Cstr.isProxied = true;
1928
+ }
1929
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1930
+ // ok, time to construct the instance
1931
+ // but let's keep track of when we start and stop
1932
+ // so that the getters/setters don't incorrectly step on data
1933
+ {
1934
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1935
+ }
1936
+ // construct the lazy-loaded component implementation
1937
+ // passing the hostRef is very important during
1938
+ // construction in order to directly wire together the
1939
+ // host element and the lazy-loaded instance
1940
+ try {
1941
+ new Cstr(hostRef);
1942
+ }
1943
+ catch (e) {
1944
+ consoleError(e);
1945
+ }
1946
+ {
1947
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1948
+ }
1949
+ {
1950
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1951
+ }
1952
+ endNewInstance();
1953
+ }
1954
+ if (Cstr.style) {
1955
+ // this component has styles but we haven't registered them yet
1956
+ let style = Cstr.style;
1957
+ const scopeId = getScopeId(cmpMeta);
1958
+ if (!styles.has(scopeId)) {
1959
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1960
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1961
+ endRegisterStyles();
1962
+ }
1963
+ }
1964
+ }
1965
+ // we've successfully created a lazy instance
1966
+ const ancestorComponent = hostRef.$ancestorComponent$;
1967
+ const schedule = () => scheduleUpdate(hostRef, true);
1968
+ if (ancestorComponent && ancestorComponent['s-rc']) {
1969
+ // this is the initial load and this component it has an ancestor component
1970
+ // but the ancestor component has NOT fired its will update lifecycle yet
1971
+ // so let's just cool our jets and wait for the ancestor to continue first
1972
+ // this will get fired off when the ancestor component
1973
+ // finally gets around to rendering its lazy self
1974
+ // fire off the initial update
1975
+ ancestorComponent['s-rc'].push(schedule);
1976
+ }
1977
+ else {
1978
+ schedule();
1979
+ }
1980
+ };
1981
+ const connectedCallback = (elm) => {
1982
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1983
+ const hostRef = getHostRef(elm);
1984
+ const cmpMeta = hostRef.$cmpMeta$;
1985
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1986
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1987
+ // first time this component has connected
1988
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1989
+ let hostId;
1990
+ {
1991
+ hostId = elm.getAttribute(HYDRATE_ID);
1992
+ if (hostId) {
1993
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1994
+ const scopeId = addStyle(elm.shadowRoot, cmpMeta);
1995
+ elm.classList.remove(scopeId + '-h', scopeId + '-s');
1996
+ }
1997
+ initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
1998
+ }
1999
+ }
2000
+ if (!hostId) {
2001
+ // initUpdate
2002
+ // if the slot polyfill is required we'll need to put some nodes
2003
+ // in here to act as original content anchors as we move nodes around
2004
+ // host element has been connected to the DOM
2005
+ if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
2006
+ setContentReference(elm);
2007
+ }
2008
+ }
2009
+ {
2010
+ // find the first ancestor component (if there is one) and register
2011
+ // this component as one of the actively loading child components for its ancestor
2012
+ let ancestorComponent = elm;
2013
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
2014
+ // climb up the ancestors looking for the first
2015
+ // component that hasn't finished its lifecycle update yet
2016
+ if ((ancestorComponent.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
2017
+ ancestorComponent.hasAttribute('s-id') &&
2018
+ ancestorComponent['s-p']) ||
2019
+ ancestorComponent['s-p']) {
2020
+ // we found this components first ancestor component
2021
+ // keep a reference to this component's ancestor component
2022
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
2023
+ break;
2024
+ }
2025
+ }
2026
+ }
2027
+ // Lazy properties
2028
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
2029
+ if (cmpMeta.$members$) {
2030
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
2031
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
2032
+ const value = elm[memberName];
2033
+ delete elm[memberName];
2034
+ elm[memberName] = value;
2035
+ }
2036
+ });
2037
+ }
2038
+ {
2039
+ initializeComponent(elm, hostRef, cmpMeta);
2040
+ }
2041
+ }
2042
+ else {
2043
+ // not the first time this has connected
2044
+ // reattach any event listeners to the host
2045
+ // since they would have been removed when disconnected
2046
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
2047
+ }
2048
+ endConnected();
2049
+ }
2050
+ };
2051
+ const setContentReference = (elm) => {
2052
+ // only required when we're NOT using native shadow dom (slot)
2053
+ // or this browser doesn't support native shadow dom
2054
+ // and this host element was NOT created with SSR
2055
+ // let's pick out the inner content for slot projection
2056
+ // create a node to represent where the original
2057
+ // content was first placed, which is useful later on
2058
+ const contentRefElm = (elm['s-cr'] = doc.createComment(''));
2059
+ contentRefElm['s-cn'] = true;
2060
+ elm.insertBefore(contentRefElm, elm.firstChild);
2061
+ };
2062
+ const disconnectedCallback = (elm) => {
2063
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
2064
+ const hostRef = getHostRef(elm);
2065
+ {
2066
+ if (hostRef.$rmListeners$) {
2067
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
2068
+ hostRef.$rmListeners$ = undefined;
2069
+ }
2070
+ }
2071
+ }
2072
+ };
2073
+ const bootstrapLazy = (lazyBundles, options = {}) => {
2074
+ var _a;
2075
+ const endBootstrap = createTime();
2076
+ const cmpTags = [];
2077
+ const exclude = options.exclude || [];
2078
+ const customElements = win.customElements;
2079
+ const head = doc.head;
2080
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
2081
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
2082
+ const deferredConnectedCallbacks = [];
2083
+ const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2084
+ let appLoadFallback;
2085
+ let isBootstrapping = true;
2086
+ let i = 0;
2087
+ Object.assign(plt, options);
2088
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
2089
+ {
2090
+ // If the app is already hydrated there is not point to disable the
2091
+ // async queue. This will improve the first input delay
2092
+ plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
2093
+ }
2094
+ {
2095
+ for (; i < styles.length; i++) {
2096
+ registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
2097
+ }
2098
+ }
2099
+ lazyBundles.map((lazyBundle) => {
2100
+ lazyBundle[1].map((compactMeta) => {
2101
+ const cmpMeta = {
2102
+ $flags$: compactMeta[0],
2103
+ $tagName$: compactMeta[1],
2104
+ $members$: compactMeta[2],
2105
+ $listeners$: compactMeta[3],
2106
+ };
2107
+ {
2108
+ cmpMeta.$members$ = compactMeta[2];
2109
+ }
2110
+ {
2111
+ cmpMeta.$listeners$ = compactMeta[3];
2112
+ }
2113
+ {
2114
+ cmpMeta.$attrsToReflect$ = [];
2115
+ }
2116
+ {
2117
+ cmpMeta.$watchers$ = {};
2118
+ }
2119
+ const tagName = cmpMeta.$tagName$;
2120
+ const HostElement = class extends HTMLElement {
2121
+ // StencilLazyHost
2122
+ constructor(self) {
2123
+ // @ts-ignore
2124
+ super(self);
2125
+ self = this;
2126
+ registerHost(self, cmpMeta);
2127
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2128
+ // this component is using shadow dom
2129
+ // and this browser supports shadow dom
2130
+ // add the read-only property "shadowRoot" to the host element
2131
+ // adding the shadow root build conditionals to minimize runtime
2132
+ {
2133
+ {
2134
+ self.attachShadow({ mode: 'open' });
2135
+ }
2136
+ }
2137
+ }
2138
+ }
2139
+ connectedCallback() {
2140
+ if (appLoadFallback) {
2141
+ clearTimeout(appLoadFallback);
2142
+ appLoadFallback = null;
2143
+ }
2144
+ if (isBootstrapping) {
2145
+ // connectedCallback will be processed once all components have been registered
2146
+ deferredConnectedCallbacks.push(this);
2147
+ }
2148
+ else {
2149
+ plt.jmp(() => connectedCallback(this));
2150
+ }
2151
+ }
2152
+ disconnectedCallback() {
2153
+ plt.jmp(() => disconnectedCallback(this));
2154
+ }
2155
+ componentOnReady() {
2156
+ return getHostRef(this).$onReadyPromise$;
2157
+ }
2158
+ };
2159
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
2160
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
2161
+ cmpTags.push(tagName);
2162
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
2163
+ }
2164
+ });
2165
+ });
2166
+ {
2167
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
2168
+ visibilityStyle.setAttribute('data-styles', '');
2169
+ // Apply CSP nonce to the style tag if it exists
2170
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
2171
+ if (nonce != null) {
2172
+ visibilityStyle.setAttribute('nonce', nonce);
2173
+ }
2174
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
2175
+ }
2176
+ // Process deferred connectedCallbacks now all components have been registered
2177
+ isBootstrapping = false;
2178
+ if (deferredConnectedCallbacks.length) {
2179
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
2180
+ }
2181
+ else {
2182
+ {
2183
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
2184
+ }
2185
+ }
2186
+ // Fallback appLoad event
2187
+ endBootstrap();
2188
+ };
2189
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
2190
+ if (listeners) {
2191
+ listeners.map(([flags, name, method]) => {
2192
+ const target = getHostListenerTarget(elm, flags) ;
2193
+ const handler = hostListenerProxy(hostRef, method);
2194
+ const opts = hostListenerOpts(flags);
2195
+ plt.ael(target, name, handler, opts);
2196
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
2197
+ });
2198
+ }
2199
+ };
2200
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
2201
+ try {
2202
+ {
2203
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
2204
+ // instance is ready, let's call it's member method for this event
2205
+ hostRef.$lazyInstance$[methodName](ev);
2206
+ }
2207
+ else {
2208
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
2209
+ }
2210
+ }
2211
+ }
2212
+ catch (e) {
2213
+ consoleError(e);
2214
+ }
2215
+ };
2216
+ const getHostListenerTarget = (elm, flags) => {
2217
+ if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
2218
+ return win;
2219
+ return elm;
2220
+ };
2221
+ // prettier-ignore
2222
+ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
2223
+ /**
2224
+ * Assigns the given value to the nonce property on the runtime platform object.
2225
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
2226
+ * @param nonce The value to be assigned to the platform nonce property.
2227
+ * @returns void
2228
+ */
2229
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
2230
+ const hostRefs = /*@__PURE__*/ new WeakMap();
2231
+ const getHostRef = (ref) => hostRefs.get(ref);
2232
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
2233
+ const registerHost = (elm, cmpMeta) => {
2234
+ const hostRef = {
2235
+ $flags$: 0,
2236
+ $hostElement$: elm,
2237
+ $cmpMeta$: cmpMeta,
2238
+ $instanceValues$: new Map(),
2239
+ };
2240
+ {
2241
+ hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
2242
+ }
2243
+ {
2244
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
2245
+ elm['s-p'] = [];
2246
+ elm['s-rc'] = [];
2247
+ }
2248
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
2249
+ return hostRefs.set(elm, hostRef);
2250
+ };
2251
+ const isMemberInElement = (elm, memberName) => memberName in elm;
2252
+ const consoleError = (e, el) => (0, console.error)(e, el);
2253
+ const cmpModules = /*@__PURE__*/ new Map();
2254
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2255
+ // loadModuleImport
2256
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
2257
+ const bundleId = cmpMeta.$lazyBundleId$;
2258
+ const module = cmpModules.get(bundleId) ;
2259
+ if (module) {
2260
+ return module[exportName];
2261
+ }
2262
+
2263
+ if (!hmrVersionId || !BUILD.hotModuleReplacement) {
2264
+ const processMod = importedModule => {
2265
+ cmpModules.set(bundleId, importedModule);
2266
+ return importedModule[exportName];
2267
+ }
2268
+ switch(bundleId) {
2269
+
2270
+ case 'ds-activity-log_16':
2271
+ return import(
2272
+ /* webpackMode: "lazy" */
2273
+ './ds-activity-log_16.entry.js').then(processMod, consoleError);
2274
+ case 'ds-loading-page':
2275
+ return import(
2276
+ /* webpackMode: "lazy" */
2277
+ './ds-loading-page.entry.js').then(processMod, consoleError);
2278
+ case 'ds-splash':
2279
+ return import(
2280
+ /* webpackMode: "lazy" */
2281
+ './ds-splash.entry.js').then(processMod, consoleError);
2282
+ }
2283
+ }
2284
+ return import(
2285
+ /* @vite-ignore */
2286
+ /* webpackInclude: /\.entry\.js$/ */
2287
+ /* webpackExclude: /\.system\.entry\.js$/ */
2288
+ /* webpackMode: "lazy" */
2289
+ `./${bundleId}.entry.js${''}`).then((importedModule) => {
2290
+ {
2291
+ cmpModules.set(bundleId, importedModule);
2292
+ }
2293
+ return importedModule[exportName];
2294
+ }, consoleError);
2295
+ };
2296
+ const styles = /*@__PURE__*/ new Map();
2297
+ const win = typeof window !== 'undefined' ? window : {};
2298
+ const doc = win.document || { head: {} };
2299
+ const plt = {
2300
+ $flags$: 0,
2301
+ $resourcesUrl$: '',
2302
+ jmp: (h) => h(),
2303
+ raf: (h) => requestAnimationFrame(h),
2304
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
2305
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
2306
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
2307
+ };
2308
+ const supportsShadow = true;
2309
+ const promiseResolve = (v) => Promise.resolve(v);
2310
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
2311
+ try {
2312
+ new CSSStyleSheet();
2313
+ return typeof new CSSStyleSheet().replaceSync === 'function';
2314
+ }
2315
+ catch (e) { }
2316
+ return false;
2317
+ })()
2318
+ ;
2319
+ const queueDomReads = [];
2320
+ const queueDomWrites = [];
2321
+ const queueTask = (queue, write) => (cb) => {
2322
+ queue.push(cb);
2323
+ if (!queuePending) {
2324
+ queuePending = true;
2325
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
2326
+ nextTick(flush);
2327
+ }
2328
+ else {
2329
+ plt.raf(flush);
2330
+ }
2331
+ }
2332
+ };
2333
+ const consume = (queue) => {
2334
+ for (let i = 0; i < queue.length; i++) {
2335
+ try {
2336
+ queue[i](performance.now());
2337
+ }
2338
+ catch (e) {
2339
+ consoleError(e);
2340
+ }
2341
+ }
2342
+ queue.length = 0;
2343
+ };
2344
+ const flush = () => {
2345
+ // always force a bunch of medium callbacks to run, but still have
2346
+ // a throttle on how many can run in a certain time
2347
+ // DOM READS!!!
2348
+ consume(queueDomReads);
2349
+ // DOM WRITES!!!
2350
+ {
2351
+ consume(queueDomWrites);
2352
+ if ((queuePending = queueDomReads.length > 0)) {
2353
+ // still more to do yet, but we've run out of time
2354
+ // let's let this thing cool off and try again in the next tick
2355
+ plt.raf(flush);
2356
+ }
2357
+ }
2358
+ };
2359
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
2360
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
2361
+
2362
+ export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };