@xplortech/apollo-core 1.0.0-beta.8 → 1.0.0-beta.9

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 (591) hide show
  1. package/build/style.css +55 -4
  2. package/dist/apollo-core/apollo-core.css +5841 -9
  3. package/dist/apollo-core/apollo-core.esm.js +163 -1
  4. package/dist/apollo-core/apollo-core.esm.js.map +1 -0
  5. package/dist/apollo-core/app-globals-0f993ce5.js +5 -0
  6. package/dist/apollo-core/app-globals-0f993ce5.js.map +1 -0
  7. package/dist/apollo-core/css-shim-6210ce77.js +6 -0
  8. package/dist/apollo-core/css-shim-6210ce77.js.map +1 -0
  9. package/dist/apollo-core/dom-423bdd70.js +75 -0
  10. package/dist/apollo-core/dom-423bdd70.js.map +1 -0
  11. package/dist/apollo-core/index-307c7018.js +3397 -0
  12. package/dist/apollo-core/index-307c7018.js.map +1 -0
  13. package/dist/apollo-core/index-912d1a21.js +586 -0
  14. package/dist/apollo-core/index-912d1a21.js.map +1 -0
  15. package/dist/apollo-core/index.esm.js +3 -0
  16. package/dist/apollo-core/index.esm.js.map +1 -0
  17. package/dist/apollo-core/p-08abab41.entry.js +2 -0
  18. package/dist/apollo-core/p-08abab41.entry.js.map +1 -0
  19. package/dist/apollo-core/p-16654189.entry.js +2 -0
  20. package/dist/apollo-core/p-16654189.entry.js.map +1 -0
  21. package/dist/apollo-core/p-2f90296c.js +3 -3
  22. package/dist/apollo-core/p-2f90296c.js.map +1 -0
  23. package/dist/apollo-core/p-315920cd.entry.js +2 -0
  24. package/dist/apollo-core/p-315920cd.entry.js.map +1 -0
  25. package/dist/apollo-core/p-3c934536.entry.js +2 -0
  26. package/dist/apollo-core/p-3c934536.entry.js.map +1 -0
  27. package/dist/apollo-core/p-47a55fa9.entry.js +2 -0
  28. package/dist/apollo-core/p-47a55fa9.entry.js.map +1 -0
  29. package/dist/apollo-core/p-485d0c40.entry.js +2 -0
  30. package/dist/apollo-core/p-485d0c40.entry.js.map +1 -0
  31. package/dist/apollo-core/p-5a038a8e.entry.js +2 -0
  32. package/dist/apollo-core/p-5a038a8e.entry.js.map +1 -0
  33. package/dist/apollo-core/p-88135928.entry.js +2 -0
  34. package/dist/apollo-core/p-88135928.entry.js.map +1 -0
  35. package/dist/apollo-core/p-91d6572c.entry.js +2 -0
  36. package/dist/apollo-core/p-91d6572c.entry.js.map +1 -0
  37. package/dist/apollo-core/p-ad90fe4d.js +2 -1
  38. package/dist/apollo-core/p-ad90fe4d.js.map +1 -0
  39. package/dist/apollo-core/p-ae99c266.entry.js +2 -0
  40. package/dist/apollo-core/p-ae99c266.entry.js.map +1 -0
  41. package/dist/apollo-core/p-aeef61dd.entry.js +2 -0
  42. package/dist/apollo-core/p-aeef61dd.entry.js.map +1 -0
  43. package/dist/apollo-core/p-c1b28f32.entry.js +2 -0
  44. package/dist/apollo-core/p-c1b28f32.entry.js.map +1 -0
  45. package/dist/apollo-core/p-ce6cb219.entry.js +2 -0
  46. package/dist/apollo-core/p-ce6cb219.entry.js.map +1 -0
  47. package/dist/apollo-core/p-cf2e6132.js +3 -0
  48. package/dist/apollo-core/p-cf2e6132.js.map +1 -0
  49. package/dist/apollo-core/p-e9cd309e.entry.js +2 -0
  50. package/dist/apollo-core/p-e9cd309e.entry.js.map +1 -0
  51. package/dist/apollo-core/p-f5561238.entry.js +2 -0
  52. package/dist/apollo-core/p-f5561238.entry.js.map +1 -0
  53. package/dist/apollo-core/p-ff46d20f.entry.js +2 -0
  54. package/dist/apollo-core/p-ff46d20f.entry.js.map +1 -0
  55. package/dist/{custom-elements/index.js → apollo-core/regular-133c23b5.js} +13 -4312
  56. package/dist/apollo-core/regular-133c23b5.js.map +1 -0
  57. package/dist/apollo-core/shadow-css-f0279020.js +389 -0
  58. package/dist/apollo-core/shadow-css-f0279020.js.map +1 -0
  59. package/dist/apollo-core/xpl-application-shell.entry.js +51 -0
  60. package/dist/apollo-core/xpl-application-shell.entry.js.map +1 -0
  61. package/dist/apollo-core/xpl-avatar.entry.js +28 -0
  62. package/dist/apollo-core/xpl-avatar.entry.js.map +1 -0
  63. package/dist/apollo-core/xpl-backdrop.entry.js +19 -0
  64. package/dist/apollo-core/xpl-backdrop.entry.js.map +1 -0
  65. package/dist/apollo-core/xpl-badge.entry.js +21 -0
  66. package/dist/apollo-core/xpl-badge.entry.js.map +1 -0
  67. package/dist/apollo-core/xpl-breadcrumb-item.entry.js +19 -0
  68. package/dist/apollo-core/xpl-breadcrumb-item.entry.js.map +1 -0
  69. package/dist/apollo-core/xpl-breadcrumbs.entry.js +14 -0
  70. package/dist/apollo-core/xpl-breadcrumbs.entry.js.map +1 -0
  71. package/dist/apollo-core/xpl-button-row.entry.js +23 -0
  72. package/dist/apollo-core/xpl-button-row.entry.js.map +1 -0
  73. package/dist/apollo-core/xpl-button.entry.js +60 -0
  74. package/dist/apollo-core/xpl-button.entry.js.map +1 -0
  75. package/dist/apollo-core/xpl-checkbox.entry.js +35 -0
  76. package/dist/apollo-core/xpl-checkbox.entry.js.map +1 -0
  77. package/dist/apollo-core/xpl-choicelist.entry.js +48 -0
  78. package/dist/apollo-core/xpl-choicelist.entry.js.map +1 -0
  79. package/dist/apollo-core/xpl-content-area.entry.js +15 -0
  80. package/dist/apollo-core/xpl-content-area.entry.js.map +1 -0
  81. package/dist/apollo-core/xpl-divider.entry.js +17 -0
  82. package/dist/apollo-core/xpl-divider.entry.js.map +1 -0
  83. package/dist/apollo-core/xpl-dropdown-group.entry.js +35 -0
  84. package/dist/apollo-core/xpl-dropdown-group.entry.js.map +1 -0
  85. package/dist/apollo-core/xpl-dropdown-heading.entry.js +15 -0
  86. package/dist/apollo-core/xpl-dropdown-heading.entry.js.map +1 -0
  87. package/dist/apollo-core/xpl-dropdown-option.entry.js +70 -0
  88. package/dist/apollo-core/xpl-dropdown-option.entry.js.map +1 -0
  89. package/dist/apollo-core/xpl-dropdown.entry.js +106 -0
  90. package/dist/apollo-core/xpl-dropdown.entry.js.map +1 -0
  91. package/dist/apollo-core/xpl-grid-item.entry.js +23 -0
  92. package/dist/apollo-core/xpl-grid-item.entry.js.map +1 -0
  93. package/dist/apollo-core/xpl-grid.entry.js +33 -0
  94. package/dist/apollo-core/xpl-grid.entry.js.map +1 -0
  95. package/dist/apollo-core/xpl-input.entry.js +2553 -0
  96. package/dist/apollo-core/xpl-input.entry.js.map +1 -0
  97. package/dist/apollo-core/xpl-list.entry.js +37 -0
  98. package/dist/apollo-core/xpl-list.entry.js.map +1 -0
  99. package/dist/apollo-core/xpl-main-nav.entry.js +25 -0
  100. package/dist/apollo-core/xpl-main-nav.entry.js.map +1 -0
  101. package/dist/apollo-core/xpl-nav-item.entry.js +25 -0
  102. package/dist/apollo-core/xpl-nav-item.entry.js.map +1 -0
  103. package/dist/apollo-core/xpl-pagination.entry.js +77 -0
  104. package/dist/apollo-core/xpl-pagination.entry.js.map +1 -0
  105. package/dist/apollo-core/xpl-radio.entry.js +34 -0
  106. package/dist/apollo-core/xpl-radio.entry.js.map +1 -0
  107. package/dist/apollo-core/xpl-secondary-nav.entry.js +14 -0
  108. package/dist/apollo-core/xpl-secondary-nav.entry.js.map +1 -0
  109. package/dist/apollo-core/xpl-select.entry.js +680 -0
  110. package/dist/apollo-core/xpl-select.entry.js.map +1 -0
  111. package/dist/apollo-core/xpl-table.entry.js +109 -0
  112. package/dist/apollo-core/xpl-table.entry.js.map +1 -0
  113. package/dist/apollo-core/xpl-tag.entry.js +19 -0
  114. package/dist/apollo-core/xpl-tag.entry.js.map +1 -0
  115. package/dist/apollo-core/xpl-toggle.entry.js +35 -0
  116. package/dist/apollo-core/xpl-toggle.entry.js.map +1 -0
  117. package/dist/apollo-core/xpl-utility-bar.entry.js +31 -0
  118. package/dist/apollo-core/xpl-utility-bar.entry.js.map +1 -0
  119. package/dist/cjs/apollo-core.cjs.js +150 -5
  120. package/dist/cjs/apollo-core.cjs.js.map +1 -0
  121. package/dist/cjs/app-globals-3a1e7e63.js +7 -0
  122. package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
  123. package/dist/cjs/css-shim-0a6fd78d.js +8 -0
  124. package/dist/cjs/css-shim-0a6fd78d.js.map +1 -0
  125. package/dist/cjs/dom-2c6adc90.js +77 -0
  126. package/dist/cjs/dom-2c6adc90.js.map +1 -0
  127. package/dist/cjs/index-0fdb260e.js +3564 -0
  128. package/dist/cjs/index-0fdb260e.js.map +1 -0
  129. package/dist/cjs/index-318d5fc7.js +588 -0
  130. package/dist/cjs/index-318d5fc7.js.map +1 -0
  131. package/dist/cjs/{index-2ab4832e.js → index-e53b018b.js} +85 -2
  132. package/dist/cjs/index-e53b018b.js.map +1 -0
  133. package/dist/cjs/index.cjs.js +3 -0
  134. package/dist/cjs/index.cjs.js.map +1 -0
  135. package/dist/cjs/loader.cjs.js +23 -3
  136. package/dist/cjs/loader.cjs.js.map +1 -0
  137. package/dist/cjs/regular-503465f4.js +16056 -0
  138. package/dist/cjs/regular-503465f4.js.map +1 -0
  139. package/dist/cjs/regular-872f5226.js +2 -0
  140. package/dist/cjs/regular-872f5226.js.map +1 -0
  141. package/dist/cjs/shadow-css-39dfcfae.js +391 -0
  142. package/dist/cjs/shadow-css-39dfcfae.js.map +1 -0
  143. package/dist/cjs/v4-14140ff3.js +2 -0
  144. package/dist/cjs/v4-14140ff3.js.map +1 -0
  145. package/dist/cjs/xpl-application-shell.cjs.entry.js +3 -1
  146. package/dist/cjs/xpl-application-shell.cjs.entry.js.map +1 -0
  147. package/dist/cjs/xpl-avatar.cjs.entry.js +32 -0
  148. package/dist/cjs/xpl-avatar.cjs.entry.js.map +1 -0
  149. package/dist/cjs/xpl-avatar_12.cjs.entry.js +3 -1
  150. package/dist/cjs/xpl-avatar_12.cjs.entry.js.map +1 -0
  151. package/dist/cjs/xpl-backdrop.cjs.entry.js +3 -1
  152. package/dist/cjs/xpl-backdrop.cjs.entry.js.map +1 -0
  153. package/dist/cjs/xpl-badge.cjs.entry.js +25 -0
  154. package/dist/cjs/xpl-badge.cjs.entry.js.map +1 -0
  155. package/dist/cjs/xpl-breadcrumb-item.cjs.entry.js +23 -0
  156. package/dist/cjs/xpl-breadcrumb-item.cjs.entry.js.map +1 -0
  157. package/dist/cjs/xpl-breadcrumbs.cjs.entry.js +18 -0
  158. package/dist/cjs/xpl-breadcrumbs.cjs.entry.js.map +1 -0
  159. package/dist/cjs/xpl-button-row.cjs.entry.js +3 -1
  160. package/dist/cjs/xpl-button-row.cjs.entry.js.map +1 -0
  161. package/dist/cjs/xpl-button.cjs.entry.js +64 -0
  162. package/dist/cjs/xpl-button.cjs.entry.js.map +1 -0
  163. package/dist/cjs/xpl-checkbox.cjs.entry.js +39 -0
  164. package/dist/cjs/xpl-checkbox.cjs.entry.js.map +1 -0
  165. package/dist/cjs/xpl-choicelist.cjs.entry.js +3 -1
  166. package/dist/cjs/xpl-choicelist.cjs.entry.js.map +1 -0
  167. package/dist/cjs/xpl-content-area.cjs.entry.js +19 -0
  168. package/dist/cjs/xpl-content-area.cjs.entry.js.map +1 -0
  169. package/dist/cjs/xpl-divider.cjs.entry.js +3 -1
  170. package/dist/cjs/xpl-divider.cjs.entry.js.map +1 -0
  171. package/dist/cjs/xpl-dropdown-group.cjs.entry.js +39 -0
  172. package/dist/cjs/xpl-dropdown-group.cjs.entry.js.map +1 -0
  173. package/dist/cjs/xpl-dropdown-group_3.cjs.entry.js +6 -3
  174. package/dist/cjs/xpl-dropdown-group_3.cjs.entry.js.map +1 -0
  175. package/dist/cjs/xpl-dropdown-heading.cjs.entry.js +19 -0
  176. package/dist/cjs/xpl-dropdown-heading.cjs.entry.js.map +1 -0
  177. package/dist/cjs/xpl-dropdown-option.cjs.entry.js +74 -0
  178. package/dist/cjs/xpl-dropdown-option.cjs.entry.js.map +1 -0
  179. package/dist/cjs/xpl-dropdown.cjs.entry.js +110 -0
  180. package/dist/cjs/xpl-dropdown.cjs.entry.js.map +1 -0
  181. package/dist/cjs/xpl-dropdown_2.cjs.entry.js +6 -2
  182. package/dist/cjs/xpl-dropdown_2.cjs.entry.js.map +1 -0
  183. package/dist/cjs/xpl-grid-item.cjs.entry.js +3 -1
  184. package/dist/cjs/xpl-grid-item.cjs.entry.js.map +1 -0
  185. package/dist/cjs/xpl-grid.cjs.entry.js +3 -1
  186. package/dist/cjs/xpl-grid.cjs.entry.js.map +1 -0
  187. package/dist/cjs/xpl-input.cjs.entry.js +509 -600
  188. package/dist/cjs/xpl-input.cjs.entry.js.map +1 -0
  189. package/dist/cjs/xpl-list.cjs.entry.js +4 -2
  190. package/dist/cjs/xpl-list.cjs.entry.js.map +1 -0
  191. package/dist/cjs/xpl-main-nav.cjs.entry.js +3 -1
  192. package/dist/cjs/xpl-main-nav.cjs.entry.js.map +1 -0
  193. package/dist/cjs/xpl-nav-item.cjs.entry.js +29 -0
  194. package/dist/cjs/xpl-nav-item.cjs.entry.js.map +1 -0
  195. package/dist/cjs/xpl-pagination.cjs.entry.js +3 -1
  196. package/dist/cjs/xpl-pagination.cjs.entry.js.map +1 -0
  197. package/dist/cjs/xpl-radio.cjs.entry.js +38 -0
  198. package/dist/cjs/xpl-radio.cjs.entry.js.map +1 -0
  199. package/dist/cjs/xpl-secondary-nav.cjs.entry.js +18 -0
  200. package/dist/cjs/xpl-secondary-nav.cjs.entry.js.map +1 -0
  201. package/dist/cjs/xpl-select.cjs.entry.js +80 -6
  202. package/dist/cjs/xpl-select.cjs.entry.js.map +1 -0
  203. package/dist/cjs/xpl-table.cjs.entry.js +113 -0
  204. package/dist/cjs/xpl-table.cjs.entry.js.map +1 -0
  205. package/dist/cjs/xpl-tag.cjs.entry.js +23 -0
  206. package/dist/cjs/xpl-tag.cjs.entry.js.map +1 -0
  207. package/dist/cjs/xpl-toggle.cjs.entry.js +5 -3
  208. package/dist/cjs/xpl-toggle.cjs.entry.js.map +1 -0
  209. package/dist/cjs/xpl-utility-bar.cjs.entry.js +35 -0
  210. package/dist/cjs/xpl-utility-bar.cjs.entry.js.map +1 -0
  211. package/dist/collection/collection-manifest.json +2 -2
  212. package/dist/collection/components/xpl-application-shell/xpl-application-shell.js +1 -0
  213. package/dist/collection/components/xpl-application-shell/xpl-application-shell.js.map +1 -0
  214. package/dist/collection/components/xpl-avatar/xpl-avatar.js +1 -0
  215. package/dist/collection/components/xpl-avatar/xpl-avatar.js.map +1 -0
  216. package/dist/collection/components/xpl-backdrop/xpl-backdrop.js +1 -0
  217. package/dist/collection/components/xpl-backdrop/xpl-backdrop.js.map +1 -0
  218. package/dist/collection/components/xpl-badge/xpl-badge.js +1 -0
  219. package/dist/collection/components/xpl-badge/xpl-badge.js.map +1 -0
  220. package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumb-item/xpl-breadcrumb-item.js +1 -0
  221. package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumb-item/xpl-breadcrumb-item.js.map +1 -0
  222. package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumbs/xpl-breadcrumbs.js +1 -0
  223. package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumbs/xpl-breadcrumbs.js.map +1 -0
  224. package/dist/collection/components/xpl-button/xpl-button.js +1 -0
  225. package/dist/collection/components/xpl-button/xpl-button.js.map +1 -0
  226. package/dist/collection/components/xpl-button-row/xpl-button-row.js +1 -0
  227. package/dist/collection/components/xpl-button-row/xpl-button-row.js.map +1 -0
  228. package/dist/collection/components/xpl-checkbox/xpl-checkbox.js +1 -0
  229. package/dist/collection/components/xpl-checkbox/xpl-checkbox.js.map +1 -0
  230. package/dist/collection/components/xpl-choicelist/choice.js +1 -0
  231. package/dist/collection/components/xpl-choicelist/choice.js.map +1 -0
  232. package/dist/collection/components/xpl-choicelist/xpl-choicelist.js +1 -0
  233. package/dist/collection/components/xpl-choicelist/xpl-choicelist.js.map +1 -0
  234. package/dist/collection/components/xpl-content-area/xpl-content-area.js +1 -0
  235. package/dist/collection/components/xpl-content-area/xpl-content-area.js.map +1 -0
  236. package/dist/collection/components/xpl-divider/xpl-divider.js +1 -0
  237. package/dist/collection/components/xpl-divider/xpl-divider.js.map +1 -0
  238. package/dist/collection/components/xpl-dropdown/dropdownoption.js +1 -0
  239. package/dist/collection/components/xpl-dropdown/dropdownoption.js.map +1 -0
  240. package/dist/collection/components/xpl-dropdown/xpl-dropdown-group/xpl-dropdown-group.js +1 -0
  241. package/dist/collection/components/xpl-dropdown/xpl-dropdown-group/xpl-dropdown-group.js.map +1 -0
  242. package/dist/collection/components/xpl-dropdown/xpl-dropdown-heading/xpl-dropdown-heading.js +1 -0
  243. package/dist/collection/components/xpl-dropdown/xpl-dropdown-heading/xpl-dropdown-heading.js.map +1 -0
  244. package/dist/collection/components/xpl-dropdown/xpl-dropdown-option/xpl-dropdown-option.js +23 -4
  245. package/dist/collection/components/xpl-dropdown/xpl-dropdown-option/xpl-dropdown-option.js.map +1 -0
  246. package/dist/collection/components/xpl-dropdown/xpl-dropdown.js +8 -11
  247. package/dist/collection/components/xpl-dropdown/xpl-dropdown.js.map +1 -0
  248. package/dist/collection/components/xpl-grid/xpl-grid.js +1 -0
  249. package/dist/collection/components/xpl-grid/xpl-grid.js.map +1 -0
  250. package/dist/collection/components/xpl-grid-item/xpl-grid-item.js +1 -0
  251. package/dist/collection/components/xpl-grid-item/xpl-grid-item.js.map +1 -0
  252. package/dist/collection/components/xpl-input/xpl-input.js +1 -0
  253. package/dist/collection/components/xpl-input/xpl-input.js.map +1 -0
  254. package/dist/collection/components/xpl-list/listitem.js +1 -0
  255. package/dist/collection/components/xpl-list/listitem.js.map +1 -0
  256. package/dist/collection/components/xpl-list/xpl-list.js +1 -0
  257. package/dist/collection/components/xpl-list/xpl-list.js.map +1 -0
  258. package/dist/collection/components/xpl-main-nav/xpl-main-nav.js +1 -0
  259. package/dist/collection/components/xpl-main-nav/xpl-main-nav.js.map +1 -0
  260. package/dist/collection/components/xpl-nav-item/xpl-nav-item.js +1 -0
  261. package/dist/collection/components/xpl-nav-item/xpl-nav-item.js.map +1 -0
  262. package/dist/collection/components/xpl-pagination/xpl-pagination.js +1 -0
  263. package/dist/collection/components/xpl-pagination/xpl-pagination.js.map +1 -0
  264. package/dist/collection/components/xpl-radio/xpl-radio.js +1 -0
  265. package/dist/collection/components/xpl-radio/xpl-radio.js.map +1 -0
  266. package/dist/collection/components/xpl-secondary-nav/xpl-secondary-nav.js +1 -0
  267. package/dist/collection/components/xpl-secondary-nav/xpl-secondary-nav.js.map +1 -0
  268. package/dist/collection/components/xpl-select/xpl-select.js +95 -9
  269. package/dist/collection/components/xpl-select/xpl-select.js.map +1 -0
  270. package/dist/collection/components/xpl-table/xpl-table.js +1 -0
  271. package/dist/collection/components/xpl-table/xpl-table.js.map +1 -0
  272. package/dist/collection/components/xpl-tag/xpl-tag.js +1 -0
  273. package/dist/collection/components/xpl-tag/xpl-tag.js.map +1 -0
  274. package/dist/collection/components/xpl-toggle/xpl-toggle.js +1 -0
  275. package/dist/collection/components/xpl-toggle/xpl-toggle.js.map +1 -0
  276. package/dist/collection/components/xpl-utility-bar/xpl-utility-bar.js +1 -0
  277. package/dist/collection/components/xpl-utility-bar/xpl-utility-bar.js.map +1 -0
  278. package/dist/components/index.d.ts +39 -0
  279. package/dist/components/index.js +81 -0
  280. package/dist/components/index.js.map +1 -0
  281. package/dist/components/index2.js +586 -0
  282. package/dist/components/index2.js.map +1 -0
  283. package/dist/components/regular.js +16054 -0
  284. package/dist/components/regular.js.map +1 -0
  285. package/dist/components/v4.js +77 -0
  286. package/dist/components/v4.js.map +1 -0
  287. package/dist/components/xpl-application-shell.d.ts +11 -0
  288. package/dist/components/xpl-application-shell.js +80 -0
  289. package/dist/components/xpl-application-shell.js.map +1 -0
  290. package/dist/components/xpl-avatar.d.ts +11 -0
  291. package/dist/components/xpl-avatar.js +8 -0
  292. package/dist/components/xpl-avatar.js.map +1 -0
  293. package/dist/components/xpl-avatar2.js +51 -0
  294. package/dist/components/xpl-avatar2.js.map +1 -0
  295. package/dist/components/xpl-backdrop.d.ts +11 -0
  296. package/dist/components/xpl-backdrop.js +8 -0
  297. package/dist/components/xpl-backdrop.js.map +1 -0
  298. package/dist/components/xpl-backdrop2.js +35 -0
  299. package/dist/components/xpl-backdrop2.js.map +1 -0
  300. package/dist/components/xpl-badge.d.ts +11 -0
  301. package/dist/components/xpl-badge.js +8 -0
  302. package/dist/components/xpl-badge.js.map +1 -0
  303. package/dist/components/xpl-badge2.js +38 -0
  304. package/dist/components/xpl-badge2.js.map +1 -0
  305. package/dist/components/xpl-breadcrumb-item.d.ts +11 -0
  306. package/dist/components/xpl-breadcrumb-item.js +36 -0
  307. package/dist/components/xpl-breadcrumb-item.js.map +1 -0
  308. package/dist/components/xpl-breadcrumbs.d.ts +11 -0
  309. package/dist/components/xpl-breadcrumbs.js +31 -0
  310. package/dist/components/xpl-breadcrumbs.js.map +1 -0
  311. package/dist/components/xpl-button-row.d.ts +11 -0
  312. package/dist/components/xpl-button-row.js +50 -0
  313. package/dist/components/xpl-button-row.js.map +1 -0
  314. package/dist/components/xpl-button.d.ts +11 -0
  315. package/dist/components/xpl-button.js +8 -0
  316. package/dist/components/xpl-button.js.map +1 -0
  317. package/dist/components/xpl-button2.js +85 -0
  318. package/dist/components/xpl-button2.js.map +1 -0
  319. package/dist/components/xpl-checkbox.d.ts +11 -0
  320. package/dist/components/xpl-checkbox.js +8 -0
  321. package/dist/components/xpl-checkbox.js.map +1 -0
  322. package/dist/components/xpl-checkbox2.js +59 -0
  323. package/dist/components/xpl-checkbox2.js.map +1 -0
  324. package/dist/components/xpl-choicelist.d.ts +11 -0
  325. package/dist/components/xpl-choicelist.js +85 -0
  326. package/dist/components/xpl-choicelist.js.map +1 -0
  327. package/dist/components/xpl-content-area.d.ts +11 -0
  328. package/dist/components/xpl-content-area.js +34 -0
  329. package/dist/components/xpl-content-area.js.map +1 -0
  330. package/dist/components/xpl-divider.d.ts +11 -0
  331. package/dist/components/xpl-divider.js +36 -0
  332. package/dist/components/xpl-divider.js.map +1 -0
  333. package/dist/components/xpl-dropdown-group.d.ts +11 -0
  334. package/dist/components/xpl-dropdown-group.js +8 -0
  335. package/dist/components/xpl-dropdown-group.js.map +1 -0
  336. package/dist/components/xpl-dropdown-group2.js +69 -0
  337. package/dist/components/xpl-dropdown-group2.js.map +1 -0
  338. package/dist/components/xpl-dropdown-heading.d.ts +11 -0
  339. package/dist/components/xpl-dropdown-heading.js +8 -0
  340. package/dist/components/xpl-dropdown-heading.js.map +1 -0
  341. package/dist/components/xpl-dropdown-heading2.js +31 -0
  342. package/dist/components/xpl-dropdown-heading2.js.map +1 -0
  343. package/dist/components/xpl-dropdown-option.d.ts +11 -0
  344. package/dist/components/xpl-dropdown-option.js +8 -0
  345. package/dist/components/xpl-dropdown-option.js.map +1 -0
  346. package/dist/components/xpl-dropdown-option2.js +89 -0
  347. package/dist/components/xpl-dropdown-option2.js.map +1 -0
  348. package/dist/components/xpl-dropdown.d.ts +11 -0
  349. package/dist/components/xpl-dropdown.js +8 -0
  350. package/dist/components/xpl-dropdown.js.map +1 -0
  351. package/dist/components/xpl-dropdown2.js +147 -0
  352. package/dist/components/xpl-dropdown2.js.map +1 -0
  353. package/dist/components/xpl-grid-item.d.ts +11 -0
  354. package/dist/components/xpl-grid-item.js +45 -0
  355. package/dist/components/xpl-grid-item.js.map +1 -0
  356. package/dist/components/xpl-grid.d.ts +11 -0
  357. package/dist/components/xpl-grid.js +50 -0
  358. package/dist/components/xpl-grid.js.map +1 -0
  359. package/dist/components/xpl-input.d.ts +11 -0
  360. package/dist/components/xpl-input.js +2594 -0
  361. package/dist/components/xpl-input.js.map +1 -0
  362. package/dist/components/xpl-list.d.ts +11 -0
  363. package/dist/components/xpl-list.js +68 -0
  364. package/dist/components/xpl-list.js.map +1 -0
  365. package/dist/components/xpl-main-nav.d.ts +11 -0
  366. package/dist/components/xpl-main-nav.js +44 -0
  367. package/dist/components/xpl-main-nav.js.map +1 -0
  368. package/dist/components/xpl-nav-item.d.ts +11 -0
  369. package/dist/components/xpl-nav-item.js +44 -0
  370. package/dist/components/xpl-nav-item.js.map +1 -0
  371. package/dist/components/xpl-pagination.d.ts +11 -0
  372. package/dist/components/xpl-pagination.js +100 -0
  373. package/dist/components/xpl-pagination.js.map +1 -0
  374. package/dist/components/xpl-radio.d.ts +11 -0
  375. package/dist/components/xpl-radio.js +8 -0
  376. package/dist/components/xpl-radio.js.map +1 -0
  377. package/dist/components/xpl-radio2.js +57 -0
  378. package/dist/components/xpl-radio2.js.map +1 -0
  379. package/dist/components/xpl-secondary-nav.d.ts +11 -0
  380. package/dist/components/xpl-secondary-nav.js +31 -0
  381. package/dist/components/xpl-secondary-nav.js.map +1 -0
  382. package/dist/components/xpl-select.d.ts +11 -0
  383. package/dist/components/xpl-select.js +745 -0
  384. package/dist/components/xpl-select.js.map +1 -0
  385. package/dist/components/xpl-table.d.ts +11 -0
  386. package/dist/components/xpl-table.js +136 -0
  387. package/dist/components/xpl-table.js.map +1 -0
  388. package/dist/components/xpl-tag.d.ts +11 -0
  389. package/dist/components/xpl-tag.js +8 -0
  390. package/dist/components/xpl-tag.js.map +1 -0
  391. package/dist/components/xpl-tag2.js +33 -0
  392. package/dist/components/xpl-tag2.js.map +1 -0
  393. package/dist/components/xpl-toggle.d.ts +11 -0
  394. package/dist/components/xpl-toggle.js +61 -0
  395. package/dist/components/xpl-toggle.js.map +1 -0
  396. package/dist/components/xpl-utility-bar.d.ts +11 -0
  397. package/dist/components/xpl-utility-bar.js +52 -0
  398. package/dist/components/xpl-utility-bar.js.map +1 -0
  399. package/dist/esm/apollo-core.js +151 -6
  400. package/dist/esm/apollo-core.js.map +1 -0
  401. package/dist/esm/app-globals-0f993ce5.js +5 -0
  402. package/dist/esm/app-globals-0f993ce5.js.map +1 -0
  403. package/dist/esm/css-shim-6210ce77.js +6 -0
  404. package/dist/esm/css-shim-6210ce77.js.map +1 -0
  405. package/dist/esm/dom-423bdd70.js +75 -0
  406. package/dist/esm/dom-423bdd70.js.map +1 -0
  407. package/dist/esm/index-307c7018.js +3526 -0
  408. package/dist/esm/index-307c7018.js.map +1 -0
  409. package/dist/esm/index-912d1a21.js +586 -0
  410. package/dist/esm/index-912d1a21.js.map +1 -0
  411. package/dist/esm/{index-392b5b96.js → index-df9b48b4.js} +85 -2
  412. package/dist/esm/index-df9b48b4.js.map +1 -0
  413. package/dist/esm/index.js +2 -0
  414. package/dist/esm/index.js.map +1 -0
  415. package/dist/esm/loader.js +24 -4
  416. package/dist/esm/loader.js.map +1 -0
  417. package/dist/esm/regular-133c23b5.js +16054 -0
  418. package/dist/esm/regular-133c23b5.js.map +1 -0
  419. package/dist/esm/regular-86225e9d.js +2 -0
  420. package/dist/esm/regular-86225e9d.js.map +1 -0
  421. package/dist/esm/shadow-css-f0279020.js +389 -0
  422. package/dist/esm/shadow-css-f0279020.js.map +1 -0
  423. package/dist/esm/v4-929670b7.js +2 -0
  424. package/dist/esm/v4-929670b7.js.map +1 -0
  425. package/dist/esm/xpl-application-shell.entry.js +3 -1
  426. package/dist/esm/xpl-application-shell.entry.js.map +1 -0
  427. package/dist/esm/xpl-avatar.entry.js +28 -0
  428. package/dist/esm/xpl-avatar.entry.js.map +1 -0
  429. package/dist/esm/xpl-avatar_12.entry.js +3 -1
  430. package/dist/esm/xpl-avatar_12.entry.js.map +1 -0
  431. package/dist/esm/xpl-backdrop.entry.js +3 -1
  432. package/dist/esm/xpl-backdrop.entry.js.map +1 -0
  433. package/dist/esm/xpl-badge.entry.js +21 -0
  434. package/dist/esm/xpl-badge.entry.js.map +1 -0
  435. package/dist/esm/xpl-breadcrumb-item.entry.js +19 -0
  436. package/dist/esm/xpl-breadcrumb-item.entry.js.map +1 -0
  437. package/dist/esm/xpl-breadcrumbs.entry.js +14 -0
  438. package/dist/esm/xpl-breadcrumbs.entry.js.map +1 -0
  439. package/dist/esm/xpl-button-row.entry.js +3 -1
  440. package/dist/esm/xpl-button-row.entry.js.map +1 -0
  441. package/dist/esm/xpl-button.entry.js +60 -0
  442. package/dist/esm/xpl-button.entry.js.map +1 -0
  443. package/dist/esm/xpl-checkbox.entry.js +35 -0
  444. package/dist/esm/xpl-checkbox.entry.js.map +1 -0
  445. package/dist/esm/xpl-choicelist.entry.js +3 -1
  446. package/dist/esm/xpl-choicelist.entry.js.map +1 -0
  447. package/dist/esm/xpl-content-area.entry.js +15 -0
  448. package/dist/esm/xpl-content-area.entry.js.map +1 -0
  449. package/dist/esm/xpl-divider.entry.js +3 -1
  450. package/dist/esm/xpl-divider.entry.js.map +1 -0
  451. package/dist/esm/xpl-dropdown-group.entry.js +35 -0
  452. package/dist/esm/xpl-dropdown-group.entry.js.map +1 -0
  453. package/dist/esm/xpl-dropdown-group_3.entry.js +6 -3
  454. package/dist/esm/xpl-dropdown-group_3.entry.js.map +1 -0
  455. package/dist/esm/xpl-dropdown-heading.entry.js +15 -0
  456. package/dist/esm/xpl-dropdown-heading.entry.js.map +1 -0
  457. package/dist/esm/xpl-dropdown-option.entry.js +70 -0
  458. package/dist/esm/xpl-dropdown-option.entry.js.map +1 -0
  459. package/dist/esm/xpl-dropdown.entry.js +106 -0
  460. package/dist/esm/xpl-dropdown.entry.js.map +1 -0
  461. package/dist/esm/xpl-dropdown_2.entry.js +6 -2
  462. package/dist/esm/xpl-dropdown_2.entry.js.map +1 -0
  463. package/dist/esm/xpl-grid-item.entry.js +3 -1
  464. package/dist/esm/xpl-grid-item.entry.js.map +1 -0
  465. package/dist/esm/xpl-grid.entry.js +3 -1
  466. package/dist/esm/xpl-grid.entry.js.map +1 -0
  467. package/dist/esm/xpl-input.entry.js +508 -599
  468. package/dist/esm/xpl-input.entry.js.map +1 -0
  469. package/dist/esm/xpl-list.entry.js +4 -2
  470. package/dist/esm/xpl-list.entry.js.map +1 -0
  471. package/dist/esm/xpl-main-nav.entry.js +3 -1
  472. package/dist/esm/xpl-main-nav.entry.js.map +1 -0
  473. package/dist/esm/xpl-nav-item.entry.js +25 -0
  474. package/dist/esm/xpl-nav-item.entry.js.map +1 -0
  475. package/dist/esm/xpl-pagination.entry.js +3 -1
  476. package/dist/esm/xpl-pagination.entry.js.map +1 -0
  477. package/dist/esm/xpl-radio.entry.js +34 -0
  478. package/dist/esm/xpl-radio.entry.js.map +1 -0
  479. package/dist/esm/xpl-secondary-nav.entry.js +14 -0
  480. package/dist/esm/xpl-secondary-nav.entry.js.map +1 -0
  481. package/dist/esm/xpl-select.entry.js +79 -5
  482. package/dist/esm/xpl-select.entry.js.map +1 -0
  483. package/dist/esm/xpl-table.entry.js +109 -0
  484. package/dist/esm/xpl-table.entry.js.map +1 -0
  485. package/dist/esm/xpl-tag.entry.js +19 -0
  486. package/dist/esm/xpl-tag.entry.js.map +1 -0
  487. package/dist/esm/xpl-toggle.entry.js +4 -2
  488. package/dist/esm/xpl-toggle.entry.js.map +1 -0
  489. package/dist/esm/xpl-utility-bar.entry.js +31 -0
  490. package/dist/esm/xpl-utility-bar.entry.js.map +1 -0
  491. package/dist/stories/application-shell.stories.js +1 -0
  492. package/dist/stories/application-shell.stories.js.map +1 -0
  493. package/dist/stories/avatar.stories.js +1 -0
  494. package/dist/stories/avatar.stories.js.map +1 -0
  495. package/dist/stories/backdrop.stories.js +1 -0
  496. package/dist/stories/backdrop.stories.js.map +1 -0
  497. package/dist/stories/badge.stories.js +1 -0
  498. package/dist/stories/badge.stories.js.map +1 -0
  499. package/dist/stories/breadcrumbs.stories.js +1 -0
  500. package/dist/stories/breadcrumbs.stories.js.map +1 -0
  501. package/dist/stories/button-row.stories.js +1 -0
  502. package/dist/stories/button-row.stories.js.map +1 -0
  503. package/dist/stories/button.stories.js +1 -0
  504. package/dist/stories/button.stories.js.map +1 -0
  505. package/dist/stories/checkbox.stories.js +1 -0
  506. package/dist/stories/checkbox.stories.js.map +1 -0
  507. package/dist/stories/choicelist.stories.js +1 -0
  508. package/dist/stories/choicelist.stories.js.map +1 -0
  509. package/dist/stories/content-area.stories.js +1 -0
  510. package/dist/stories/content-area.stories.js.map +1 -0
  511. package/dist/stories/divider.stories.js +1 -0
  512. package/dist/stories/divider.stories.js.map +1 -0
  513. package/dist/stories/dropdown.stories.js +74 -65
  514. package/dist/stories/dropdown.stories.js.map +1 -0
  515. package/dist/stories/grid.stories.js +1 -0
  516. package/dist/stories/grid.stories.js.map +1 -0
  517. package/dist/stories/input.stories.js +1 -0
  518. package/dist/stories/input.stories.js.map +1 -0
  519. package/dist/stories/list.stories.js +1 -0
  520. package/dist/stories/list.stories.js.map +1 -0
  521. package/dist/stories/main-nav.stories.js +1 -0
  522. package/dist/stories/main-nav.stories.js.map +1 -0
  523. package/dist/stories/pagination.stories.js +1 -0
  524. package/dist/stories/pagination.stories.js.map +1 -0
  525. package/dist/stories/radio.stories.js +1 -0
  526. package/dist/stories/radio.stories.js.map +1 -0
  527. package/dist/stories/secondary-nav.stories.js +1 -0
  528. package/dist/stories/secondary-nav.stories.js.map +1 -0
  529. package/dist/stories/select.stories.js +109 -32
  530. package/dist/stories/select.stories.js.map +1 -0
  531. package/dist/stories/table.stories.js +1 -0
  532. package/dist/stories/table.stories.js.map +1 -0
  533. package/dist/stories/tabs.stories.js +1 -0
  534. package/dist/stories/tabs.stories.js.map +1 -0
  535. package/dist/stories/toggle.stories.js +1 -0
  536. package/dist/stories/toggle.stories.js.map +1 -0
  537. package/dist/stories/utility-bar.stories.js +1 -0
  538. package/dist/stories/utility-bar.stories.js.map +1 -0
  539. package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/dropdown.stories.d.ts +17 -1
  540. package/dist/types/Users/roc/Sites/apollo/.stencil/stories/select.stories.d.ts +134 -0
  541. package/dist/types/components/xpl-dropdown/dropdownoption.d.ts +1 -0
  542. package/dist/types/components/xpl-dropdown/xpl-dropdown-option/xpl-dropdown-option.d.ts +7 -1
  543. package/dist/types/components/xpl-dropdown/xpl-dropdown.d.ts +2 -2
  544. package/dist/types/components/xpl-select/xpl-select.d.ts +16 -2
  545. package/dist/types/components.d.ts +41 -12
  546. package/dist/types/stencil-public-runtime.d.ts +12 -12
  547. package/package.json +7 -6
  548. package/CHANGELOG.md +0 -106
  549. package/dist/apollo-core/p-10f00380.entry.js +0 -1
  550. package/dist/apollo-core/p-26ec64fe.entry.js +0 -1
  551. package/dist/apollo-core/p-31acfdb4.entry.js +0 -1
  552. package/dist/apollo-core/p-4184ac44.entry.js +0 -1
  553. package/dist/apollo-core/p-4fa14839.entry.js +0 -1
  554. package/dist/apollo-core/p-55b87345.js +0 -2
  555. package/dist/apollo-core/p-63a6c98a.entry.js +0 -1
  556. package/dist/apollo-core/p-68c33b77.entry.js +0 -1
  557. package/dist/apollo-core/p-78d07caf.entry.js +0 -1
  558. package/dist/apollo-core/p-796957d3.entry.js +0 -1
  559. package/dist/apollo-core/p-88160d68.entry.js +0 -1
  560. package/dist/apollo-core/p-9ec318bb.entry.js +0 -1
  561. package/dist/apollo-core/p-a2a34e44.entry.js +0 -1
  562. package/dist/apollo-core/p-beea2502.entry.js +0 -1
  563. package/dist/apollo-core/p-d499e43f.entry.js +0 -1
  564. package/dist/apollo-core/p-d8a3d94c.entry.js +0 -1
  565. package/dist/apollo-core/p-e047b446.entry.js +0 -1
  566. package/dist/collection/components/xpl-select/selectchoice.js +0 -1
  567. package/dist/custom-elements/index.d.ts +0 -219
  568. package/dist/types/Users/fernandogelin/Xplor/apollo/.stencil/stories/select.stories.d.ts +0 -74
  569. package/dist/types/components/xpl-select/selectchoice.d.ts +0 -4
  570. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/application-shell.stories.d.ts +0 -0
  571. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/avatar.stories.d.ts +0 -0
  572. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/backdrop.stories.d.ts +0 -0
  573. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/badge.stories.d.ts +0 -0
  574. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/breadcrumbs.stories.d.ts +0 -0
  575. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/button-row.stories.d.ts +0 -0
  576. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/button.stories.d.ts +0 -0
  577. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/checkbox.stories.d.ts +0 -0
  578. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/choicelist.stories.d.ts +0 -0
  579. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/content-area.stories.d.ts +0 -0
  580. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/divider.stories.d.ts +0 -0
  581. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/grid.stories.d.ts +0 -0
  582. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/input.stories.d.ts +0 -0
  583. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/list.stories.d.ts +0 -0
  584. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/main-nav.stories.d.ts +0 -0
  585. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/pagination.stories.d.ts +0 -0
  586. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/radio.stories.d.ts +0 -0
  587. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/secondary-nav.stories.d.ts +0 -0
  588. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/table.stories.d.ts +0 -0
  589. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/tabs.stories.d.ts +0 -0
  590. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/toggle.stories.d.ts +0 -0
  591. /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/utility-bar.stories.d.ts +0 -0
@@ -0,0 +1,3564 @@
1
+ 'use strict';
2
+
3
+ function _interopNamespace(e) {
4
+ if (e && e.__esModule) return e;
5
+ var n = Object.create(null);
6
+ if (e) {
7
+ Object.keys(e).forEach(function (k) {
8
+ if (k !== 'default') {
9
+ var d = Object.getOwnPropertyDescriptor(e, k);
10
+ Object.defineProperty(n, k, d.get ? d : {
11
+ enumerable: true,
12
+ get: function () {
13
+ return e[k];
14
+ }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n['default'] = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ const NAMESPACE = 'apollo-core';
24
+ const BUILD = /* apollo-core */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: true, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: true, constructableCSS: true, cssAnnotations: true, cssVarShim: false, devTools: false, disconnectedCallback: true, dynamicImportShim: false, element: false, event: true, hasRenderFn: true, hostListener: true, hostListenerTarget: true, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: true, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: true, isTesting: true, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: true, member: true, method: true, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, safari10: false, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: false, shadowDomShim: false, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: false, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true, watchCallback: true };
25
+ const Env = /* apollo-core */ {};
26
+
27
+ /**
28
+ * Virtual DOM patching algorithm based on Snabbdom by
29
+ * Simon Friis Vindum (@paldepind)
30
+ * Licensed under the MIT License
31
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
32
+ *
33
+ * Modified for Stencil's renderer and slot projection
34
+ */
35
+ let scopeId;
36
+ let contentRef;
37
+ let hostTagName;
38
+ let customError;
39
+ let i = 0;
40
+ let useNativeShadowDom = false;
41
+ let checkSlotFallbackVisibility = false;
42
+ let checkSlotRelocate = false;
43
+ let isSvgMode = false;
44
+ let renderingRef = null;
45
+ let queueCongestion = 0;
46
+ let queuePending = false;
47
+ const Build = {
48
+ isDev: BUILD.isDev ? true : false,
49
+ isBrowser: true,
50
+ isServer: false,
51
+ isTesting: BUILD.isTesting ? true : false,
52
+ };
53
+ const Context = {};
54
+ const getAssetPath = (path) => {
55
+ const assetUrl = new URL(path, plt.$resourcesUrl$);
56
+ return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
57
+ };
58
+ const setAssetPath = (path) => (plt.$resourcesUrl$ = path);
59
+ const createTime = (fnName, tagName = '') => {
60
+ if (BUILD.profile && performance.mark) {
61
+ const key = `st:${fnName}:${tagName}:${i++}`;
62
+ // Start
63
+ performance.mark(key);
64
+ // End
65
+ return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
66
+ }
67
+ else {
68
+ return () => {
69
+ return;
70
+ };
71
+ }
72
+ };
73
+ const uniqueTime = (key, measureText) => {
74
+ if (BUILD.profile && performance.mark) {
75
+ if (performance.getEntriesByName(key, 'mark').length === 0) {
76
+ performance.mark(key);
77
+ }
78
+ return () => {
79
+ if (performance.getEntriesByName(measureText, 'measure').length === 0) {
80
+ performance.measure(measureText, key);
81
+ }
82
+ };
83
+ }
84
+ else {
85
+ return () => {
86
+ return;
87
+ };
88
+ }
89
+ };
90
+ const inspect = (ref) => {
91
+ const hostRef = getHostRef(ref);
92
+ if (!hostRef) {
93
+ return undefined;
94
+ }
95
+ const flags = hostRef.$flags$;
96
+ const hostElement = hostRef.$hostElement$;
97
+ return {
98
+ renderCount: hostRef.$renderCount$,
99
+ flags: {
100
+ hasRendered: !!(flags & 2 /* HOST_FLAGS.hasRendered */),
101
+ hasConnected: !!(flags & 1 /* HOST_FLAGS.hasConnected */),
102
+ isWaitingForChildren: !!(flags & 4 /* HOST_FLAGS.isWaitingForChildren */),
103
+ isConstructingInstance: !!(flags & 8 /* HOST_FLAGS.isConstructingInstance */),
104
+ isQueuedForUpdate: !!(flags & 16 /* HOST_FLAGS.isQueuedForUpdate */),
105
+ hasInitializedComponent: !!(flags & 32 /* HOST_FLAGS.hasInitializedComponent */),
106
+ hasLoadedComponent: !!(flags & 64 /* HOST_FLAGS.hasLoadedComponent */),
107
+ isWatchReady: !!(flags & 128 /* HOST_FLAGS.isWatchReady */),
108
+ isListenReady: !!(flags & 256 /* HOST_FLAGS.isListenReady */),
109
+ needsRerender: !!(flags & 512 /* HOST_FLAGS.needsRerender */),
110
+ },
111
+ instanceValues: hostRef.$instanceValues$,
112
+ ancestorComponent: hostRef.$ancestorComponent$,
113
+ hostElement,
114
+ lazyInstance: hostRef.$lazyInstance$,
115
+ vnode: hostRef.$vnode$,
116
+ modeName: hostRef.$modeName$,
117
+ onReadyPromise: hostRef.$onReadyPromise$,
118
+ onReadyResolve: hostRef.$onReadyResolve$,
119
+ onInstancePromise: hostRef.$onInstancePromise$,
120
+ onInstanceResolve: hostRef.$onInstanceResolve$,
121
+ onRenderResolve: hostRef.$onRenderResolve$,
122
+ queuedListeners: hostRef.$queuedListeners$,
123
+ rmListeners: hostRef.$rmListeners$,
124
+ ['s-id']: hostElement['s-id'],
125
+ ['s-cr']: hostElement['s-cr'],
126
+ ['s-lr']: hostElement['s-lr'],
127
+ ['s-p']: hostElement['s-p'],
128
+ ['s-rc']: hostElement['s-rc'],
129
+ ['s-sc']: hostElement['s-sc'],
130
+ };
131
+ };
132
+ const installDevTools = () => {
133
+ if (BUILD.devTools) {
134
+ const stencil = (win.stencil = win.stencil || {});
135
+ const originalInspect = stencil.inspect;
136
+ stencil.inspect = (ref) => {
137
+ let result = inspect(ref);
138
+ if (!result && typeof originalInspect === 'function') {
139
+ result = originalInspect(ref);
140
+ }
141
+ return result;
142
+ };
143
+ }
144
+ };
145
+ const CONTENT_REF_ID = 'r';
146
+ const ORG_LOCATION_ID = 'o';
147
+ const SLOT_NODE_ID = 's';
148
+ const TEXT_NODE_ID = 't';
149
+ const HYDRATE_ID = 's-id';
150
+ const HYDRATED_STYLE_ID = 'sty-id';
151
+ const HYDRATE_CHILD_ID = 'c-id';
152
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
153
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
154
+ /**
155
+ * Default style mode id
156
+ */
157
+ /**
158
+ * Reusable empty obj/array
159
+ * Don't add values to these!!
160
+ */
161
+ const EMPTY_OBJ = {};
162
+ /**
163
+ * Namespaces
164
+ */
165
+ const SVG_NS = 'http://www.w3.org/2000/svg';
166
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
167
+ const isDef = (v) => v != null;
168
+ /**
169
+ * Check whether a value is a 'complex type', defined here as an object or a
170
+ * function.
171
+ *
172
+ * @param o the value to check
173
+ * @returns whether it's a complex type or not
174
+ */
175
+ const isComplexType = (o) => {
176
+ // https://jsperf.com/typeof-fn-object/5
177
+ o = typeof o;
178
+ return o === 'object' || o === 'function';
179
+ };
180
+ /**
181
+ * Helper method for querying a `meta` tag that contains a nonce value
182
+ * out of a DOM's head.
183
+ *
184
+ * @param doc The DOM containing the `head` to query against
185
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
186
+ * exists or the tag has no content.
187
+ */
188
+ function queryNonceMetaTagContent(doc) {
189
+ var _a, _b, _c;
190
+ 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;
191
+ }
192
+ /**
193
+ * Production h() function based on Preact by
194
+ * Jason Miller (@developit)
195
+ * Licensed under the MIT License
196
+ * https://github.com/developit/preact/blob/master/LICENSE
197
+ *
198
+ * Modified for Stencil's compiler and vdom
199
+ */
200
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
201
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
202
+ const h = (nodeName, vnodeData, ...children) => {
203
+ let child = null;
204
+ let key = null;
205
+ let slotName = null;
206
+ let simple = false;
207
+ let lastSimple = false;
208
+ const vNodeChildren = [];
209
+ const walk = (c) => {
210
+ for (let i = 0; i < c.length; i++) {
211
+ child = c[i];
212
+ if (Array.isArray(child)) {
213
+ walk(child);
214
+ }
215
+ else if (child != null && typeof child !== 'boolean') {
216
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
217
+ child = String(child);
218
+ }
219
+ else if (BUILD.isDev && typeof nodeName !== 'function' && child.$flags$ === undefined) {
220
+ consoleDevError(`vNode passed as children has unexpected type.
221
+ Make sure it's using the correct h() function.
222
+ Empty objects can also be the cause, look for JSX comments that became objects.`);
223
+ }
224
+ if (simple && lastSimple) {
225
+ // If the previous child was simple (string), we merge both
226
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
227
+ }
228
+ else {
229
+ // Append a new vNode, if it's text, we create a text vNode
230
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
231
+ }
232
+ lastSimple = simple;
233
+ }
234
+ }
235
+ };
236
+ walk(children);
237
+ if (vnodeData) {
238
+ if (BUILD.isDev && nodeName === 'input') {
239
+ validateInputProperties(vnodeData);
240
+ }
241
+ // normalize class / classname attributes
242
+ if (BUILD.vdomKey && vnodeData.key) {
243
+ key = vnodeData.key;
244
+ }
245
+ if (BUILD.slotRelocation && vnodeData.name) {
246
+ slotName = vnodeData.name;
247
+ }
248
+ if (BUILD.vdomClass) {
249
+ const classData = vnodeData.className || vnodeData.class;
250
+ if (classData) {
251
+ vnodeData.class =
252
+ typeof classData !== 'object'
253
+ ? classData
254
+ : Object.keys(classData)
255
+ .filter((k) => classData[k])
256
+ .join(' ');
257
+ }
258
+ }
259
+ }
260
+ if (BUILD.isDev && vNodeChildren.some(isHost)) {
261
+ consoleDevError(`The <Host> must be the single root component. Make sure:
262
+ - You are NOT using hostData() and <Host> in the same component.
263
+ - <Host> is used once, and it's the single root component of the render() function.`);
264
+ }
265
+ if (BUILD.vdomFunctional && typeof nodeName === 'function') {
266
+ // nodeName is a functional component
267
+ return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
268
+ }
269
+ const vnode = newVNode(nodeName, null);
270
+ vnode.$attrs$ = vnodeData;
271
+ if (vNodeChildren.length > 0) {
272
+ vnode.$children$ = vNodeChildren;
273
+ }
274
+ if (BUILD.vdomKey) {
275
+ vnode.$key$ = key;
276
+ }
277
+ if (BUILD.slotRelocation) {
278
+ vnode.$name$ = slotName;
279
+ }
280
+ return vnode;
281
+ };
282
+ /**
283
+ * A utility function for creating a virtual DOM node from a tag and some
284
+ * possible text content.
285
+ *
286
+ * @param tag the tag for this element
287
+ * @param text possible text content for the node
288
+ * @returns a newly-minted virtual DOM node
289
+ */
290
+ const newVNode = (tag, text) => {
291
+ const vnode = {
292
+ $flags$: 0,
293
+ $tag$: tag,
294
+ $text$: text,
295
+ $elm$: null,
296
+ $children$: null,
297
+ };
298
+ if (BUILD.vdomAttribute) {
299
+ vnode.$attrs$ = null;
300
+ }
301
+ if (BUILD.vdomKey) {
302
+ vnode.$key$ = null;
303
+ }
304
+ if (BUILD.slotRelocation) {
305
+ vnode.$name$ = null;
306
+ }
307
+ return vnode;
308
+ };
309
+ const Host = {};
310
+ /**
311
+ * Check whether a given node is a Host node or not
312
+ *
313
+ * @param node the virtual DOM node to check
314
+ * @returns whether it's a Host node or not
315
+ */
316
+ const isHost = (node) => node && node.$tag$ === Host;
317
+ /**
318
+ * Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
319
+ *
320
+ * Note that these functions convert from {@link d.VNode} to
321
+ * {@link d.ChildNode} to give functional component developers a friendly
322
+ * interface.
323
+ */
324
+ const vdomFnUtils = {
325
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
326
+ map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
327
+ };
328
+ /**
329
+ * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
330
+ * friendlier public interface (hence, 'convertToPublic').
331
+ *
332
+ * @param node the virtual DOM node to convert
333
+ * @returns a converted child node
334
+ */
335
+ const convertToPublic = (node) => ({
336
+ vattrs: node.$attrs$,
337
+ vchildren: node.$children$,
338
+ vkey: node.$key$,
339
+ vname: node.$name$,
340
+ vtag: node.$tag$,
341
+ vtext: node.$text$,
342
+ });
343
+ /**
344
+ * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
345
+ * order to use the resulting object in the virtual DOM. The initial object was
346
+ * likely created as part of presenting a public API, so converting it back
347
+ * involved making it 'private' again (hence, `convertToPrivate`).
348
+ *
349
+ * @param node the child node to convert
350
+ * @returns a converted virtual DOM node
351
+ */
352
+ const convertToPrivate = (node) => {
353
+ if (typeof node.vtag === 'function') {
354
+ const vnodeData = Object.assign({}, node.vattrs);
355
+ if (node.vkey) {
356
+ vnodeData.key = node.vkey;
357
+ }
358
+ if (node.vname) {
359
+ vnodeData.name = node.vname;
360
+ }
361
+ return h(node.vtag, vnodeData, ...(node.vchildren || []));
362
+ }
363
+ const vnode = newVNode(node.vtag, node.vtext);
364
+ vnode.$attrs$ = node.vattrs;
365
+ vnode.$children$ = node.vchildren;
366
+ vnode.$key$ = node.vkey;
367
+ vnode.$name$ = node.vname;
368
+ return vnode;
369
+ };
370
+ /**
371
+ * Validates the ordering of attributes on an input element
372
+ *
373
+ * @param inputElm the element to validate
374
+ */
375
+ const validateInputProperties = (inputElm) => {
376
+ const props = Object.keys(inputElm);
377
+ const value = props.indexOf('value');
378
+ if (value === -1) {
379
+ return;
380
+ }
381
+ const typeIndex = props.indexOf('type');
382
+ const minIndex = props.indexOf('min');
383
+ const maxIndex = props.indexOf('max');
384
+ const stepIndex = props.indexOf('step');
385
+ if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
386
+ consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
387
+ }
388
+ };
389
+ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
390
+ const endHydrate = createTime('hydrateClient', tagName);
391
+ const shadowRoot = hostElm.shadowRoot;
392
+ const childRenderNodes = [];
393
+ const slotNodes = [];
394
+ const shadowRootNodes = BUILD.shadowDom && shadowRoot ? [] : null;
395
+ const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
396
+ if (!plt.$orgLocNodes$) {
397
+ initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
398
+ }
399
+ hostElm[HYDRATE_ID] = hostId;
400
+ hostElm.removeAttribute(HYDRATE_ID);
401
+ clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
402
+ childRenderNodes.map((c) => {
403
+ const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
404
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
405
+ const node = c.$elm$;
406
+ if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
407
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
408
+ }
409
+ if (!shadowRoot) {
410
+ node['s-hn'] = tagName;
411
+ if (orgLocationNode) {
412
+ node['s-ol'] = orgLocationNode;
413
+ node['s-ol']['s-nr'] = node;
414
+ }
415
+ }
416
+ plt.$orgLocNodes$.delete(orgLocationId);
417
+ });
418
+ if (BUILD.shadowDom && shadowRoot) {
419
+ shadowRootNodes.map((shadowRootNode) => {
420
+ if (shadowRootNode) {
421
+ shadowRoot.appendChild(shadowRootNode);
422
+ }
423
+ });
424
+ }
425
+ endHydrate();
426
+ };
427
+ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
428
+ let childNodeType;
429
+ let childIdSplt;
430
+ let childVNode;
431
+ let i;
432
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
433
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
434
+ if (childNodeType) {
435
+ // got the node data from the element's attribute
436
+ // `${hostId}.${nodeId}.${depth}.${index}`
437
+ childIdSplt = childNodeType.split('.');
438
+ if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
439
+ childVNode = {
440
+ $flags$: 0,
441
+ $hostId$: childIdSplt[0],
442
+ $nodeId$: childIdSplt[1],
443
+ $depth$: childIdSplt[2],
444
+ $index$: childIdSplt[3],
445
+ $tag$: node.tagName.toLowerCase(),
446
+ $elm$: node,
447
+ $attrs$: null,
448
+ $children$: null,
449
+ $key$: null,
450
+ $name$: null,
451
+ $text$: null,
452
+ };
453
+ childRenderNodes.push(childVNode);
454
+ node.removeAttribute(HYDRATE_CHILD_ID);
455
+ // this is a new child vnode
456
+ // so ensure its parent vnode has the vchildren array
457
+ if (!parentVNode.$children$) {
458
+ parentVNode.$children$ = [];
459
+ }
460
+ // add our child vnode to a specific index of the vnode's children
461
+ parentVNode.$children$[childVNode.$index$] = childVNode;
462
+ // this is now the new parent vnode for all the next child checks
463
+ parentVNode = childVNode;
464
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
465
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
466
+ }
467
+ }
468
+ }
469
+ // recursively drill down, end to start so we can remove nodes
470
+ for (i = node.childNodes.length - 1; i >= 0; i--) {
471
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
472
+ }
473
+ if (node.shadowRoot) {
474
+ // keep drilling down through the shadow root nodes
475
+ for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
476
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
477
+ }
478
+ }
479
+ }
480
+ else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
481
+ // `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
482
+ childIdSplt = node.nodeValue.split('.');
483
+ if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
484
+ // comment node for either the host id or a 0 host id
485
+ childNodeType = childIdSplt[0];
486
+ childVNode = {
487
+ $flags$: 0,
488
+ $hostId$: childIdSplt[1],
489
+ $nodeId$: childIdSplt[2],
490
+ $depth$: childIdSplt[3],
491
+ $index$: childIdSplt[4],
492
+ $elm$: node,
493
+ $attrs$: null,
494
+ $children$: null,
495
+ $key$: null,
496
+ $name$: null,
497
+ $tag$: null,
498
+ $text$: null,
499
+ };
500
+ if (childNodeType === TEXT_NODE_ID) {
501
+ childVNode.$elm$ = node.nextSibling;
502
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* NODE_TYPE.TextNode */) {
503
+ childVNode.$text$ = childVNode.$elm$.textContent;
504
+ childRenderNodes.push(childVNode);
505
+ // remove the text comment since it's no longer needed
506
+ node.remove();
507
+ if (!parentVNode.$children$) {
508
+ parentVNode.$children$ = [];
509
+ }
510
+ parentVNode.$children$[childVNode.$index$] = childVNode;
511
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
512
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
513
+ }
514
+ }
515
+ }
516
+ else if (childVNode.$hostId$ === hostId) {
517
+ // this comment node is specifcally for this host id
518
+ if (childNodeType === SLOT_NODE_ID) {
519
+ // `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
520
+ childVNode.$tag$ = 'slot';
521
+ if (childIdSplt[5]) {
522
+ node['s-sn'] = childVNode.$name$ = childIdSplt[5];
523
+ }
524
+ else {
525
+ node['s-sn'] = '';
526
+ }
527
+ node['s-sr'] = true;
528
+ if (BUILD.shadowDom && shadowRootNodes) {
529
+ // browser support shadowRoot and this is a shadow dom component
530
+ // create an actual slot element
531
+ childVNode.$elm$ = doc.createElement(childVNode.$tag$);
532
+ if (childVNode.$name$) {
533
+ // add the slot name attribute
534
+ childVNode.$elm$.setAttribute('name', childVNode.$name$);
535
+ }
536
+ // insert the new slot element before the slot comment
537
+ node.parentNode.insertBefore(childVNode.$elm$, node);
538
+ // remove the slot comment since it's not needed for shadow
539
+ node.remove();
540
+ if (childVNode.$depth$ === '0') {
541
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
542
+ }
543
+ }
544
+ slotNodes.push(childVNode);
545
+ if (!parentVNode.$children$) {
546
+ parentVNode.$children$ = [];
547
+ }
548
+ parentVNode.$children$[childVNode.$index$] = childVNode;
549
+ }
550
+ else if (childNodeType === CONTENT_REF_ID) {
551
+ // `${CONTENT_REF_ID}.${hostId}`;
552
+ if (BUILD.shadowDom && shadowRootNodes) {
553
+ // remove the content ref comment since it's not needed for shadow
554
+ node.remove();
555
+ }
556
+ else if (BUILD.slotRelocation) {
557
+ hostElm['s-cr'] = node;
558
+ node['s-cn'] = true;
559
+ }
560
+ }
561
+ }
562
+ }
563
+ }
564
+ else if (parentVNode && parentVNode.$tag$ === 'style') {
565
+ const vnode = newVNode(null, node.textContent);
566
+ vnode.$elm$ = node;
567
+ vnode.$index$ = '0';
568
+ parentVNode.$children$ = [vnode];
569
+ }
570
+ };
571
+ const initializeDocumentHydrate = (node, orgLocNodes) => {
572
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
573
+ let i = 0;
574
+ for (; i < node.childNodes.length; i++) {
575
+ initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
576
+ }
577
+ if (node.shadowRoot) {
578
+ for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
579
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
580
+ }
581
+ }
582
+ }
583
+ else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
584
+ const childIdSplt = node.nodeValue.split('.');
585
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
586
+ orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
587
+ node.nodeValue = '';
588
+ // useful to know if the original location is
589
+ // the root light-dom of a shadow dom component
590
+ node['s-en'] = childIdSplt[3];
591
+ }
592
+ }
593
+ };
594
+ // Private
595
+ const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) => !!m);
596
+ // Public
597
+ const setMode = (handler) => modeResolutionChain.push(handler);
598
+ const getMode = (ref) => getHostRef(ref).$modeName$;
599
+ /**
600
+ * Parse a new property value for a given property type.
601
+ *
602
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
603
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
604
+ * 1. `any`, the type given to `propValue` in the function signature
605
+ * 2. the type stored from `propType`.
606
+ *
607
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
608
+ *
609
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
610
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
611
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
612
+ * ```tsx
613
+ * <my-cmp prop-val={0}></my-cmp>
614
+ * ```
615
+ *
616
+ * HTML prop values on the other hand, will always a string
617
+ *
618
+ * @param propValue the new value to coerce to some type
619
+ * @param propType the type of the prop, expressed as a binary number
620
+ * @returns the parsed/coerced value
621
+ */
622
+ const parsePropertyValue = (propValue, propType) => {
623
+ // ensure this value is of the correct prop type
624
+ if (propValue != null && !isComplexType(propValue)) {
625
+ if (BUILD.propBoolean && propType & 4 /* MEMBER_FLAGS.Boolean */) {
626
+ // per the HTML spec, any string value means it is a boolean true value
627
+ // but we'll cheat here and say that the string "false" is the boolean false
628
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
629
+ }
630
+ if (BUILD.propNumber && propType & 2 /* MEMBER_FLAGS.Number */) {
631
+ // force it to be a number
632
+ return parseFloat(propValue);
633
+ }
634
+ if (BUILD.propString && propType & 1 /* MEMBER_FLAGS.String */) {
635
+ // could have been passed as a number or boolean
636
+ // but we still want it as a string
637
+ return String(propValue);
638
+ }
639
+ // redundant return here for better minification
640
+ return propValue;
641
+ }
642
+ // not sure exactly what type we want
643
+ // so no need to change to a different type
644
+ return propValue;
645
+ };
646
+ const getElement = (ref) => (BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref);
647
+ const createEvent = (ref, name, flags) => {
648
+ const elm = getElement(ref);
649
+ return {
650
+ emit: (detail) => {
651
+ if (BUILD.isDev && !elm.isConnected) {
652
+ consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
653
+ }
654
+ return emitEvent(elm, name, {
655
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
656
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
657
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
658
+ detail,
659
+ });
660
+ },
661
+ };
662
+ };
663
+ /**
664
+ * Helper function to create & dispatch a custom Event on a provided target
665
+ * @param elm the target of the Event
666
+ * @param name the name to give the custom Event
667
+ * @param opts options for configuring a custom Event
668
+ * @returns the custom Event
669
+ */
670
+ const emitEvent = (elm, name, opts) => {
671
+ const ev = plt.ce(name, opts);
672
+ elm.dispatchEvent(ev);
673
+ return ev;
674
+ };
675
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
676
+ const registerStyle = (scopeId, cssText, allowCS) => {
677
+ let style = styles.get(scopeId);
678
+ if (supportsConstructableStylesheets && allowCS) {
679
+ style = (style || new CSSStyleSheet());
680
+ if (typeof style === 'string') {
681
+ style = cssText;
682
+ }
683
+ else {
684
+ style.replaceSync(cssText);
685
+ }
686
+ }
687
+ else {
688
+ style = cssText;
689
+ }
690
+ styles.set(scopeId, style);
691
+ };
692
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
693
+ var _a;
694
+ let scopeId = getScopeId(cmpMeta, mode);
695
+ const style = styles.get(scopeId);
696
+ if (!BUILD.attachStyles) {
697
+ return scopeId;
698
+ }
699
+ // if an element is NOT connected then getRootNode() will return the wrong root node
700
+ // so the fallback is to always use the document for the root node in those cases
701
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
702
+ if (style) {
703
+ if (typeof style === 'string') {
704
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
705
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
706
+ let styleElm;
707
+ if (!appliedStyles) {
708
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
709
+ }
710
+ if (!appliedStyles.has(scopeId)) {
711
+ if (BUILD.hydrateClientSide &&
712
+ styleContainerNode.host &&
713
+ (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
714
+ // This is only happening on native shadow-dom, do not needs CSS var shim
715
+ styleElm.innerHTML = style;
716
+ }
717
+ else {
718
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
719
+ if (BUILD.cssVarShim && plt.$cssShim$) {
720
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
721
+ styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style,
722
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
723
+ !!(cmpMeta.$flags$ & 10 /* CMP_FLAGS.needsScopedEncapsulation */));
724
+ const newScopeId = styleElm['s-sc'];
725
+ if (newScopeId) {
726
+ scopeId = newScopeId;
727
+ // we don't want to add this styleID to the appliedStyles Set
728
+ // since the cssVarShim might need to apply several different
729
+ // stylesheets for the same component
730
+ appliedStyles = null;
731
+ }
732
+ }
733
+ else {
734
+ styleElm = doc.createElement('style');
735
+ styleElm.innerHTML = style;
736
+ }
737
+ // Apply CSP nonce to the style tag if it exists
738
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
739
+ if (nonce != null) {
740
+ styleElm.setAttribute('nonce', nonce);
741
+ }
742
+ if (BUILD.hydrateServerSide || BUILD.hotModuleReplacement) {
743
+ styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId);
744
+ }
745
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
746
+ }
747
+ if (appliedStyles) {
748
+ appliedStyles.add(scopeId);
749
+ }
750
+ }
751
+ }
752
+ else if (BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
753
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
754
+ }
755
+ }
756
+ return scopeId;
757
+ };
758
+ const attachStyles = (hostRef) => {
759
+ const cmpMeta = hostRef.$cmpMeta$;
760
+ const elm = hostRef.$hostElement$;
761
+ const flags = cmpMeta.$flags$;
762
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
763
+ const scopeId = addStyle(BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
764
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
765
+ if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
766
+ // only required when we're NOT using native shadow dom (slot)
767
+ // or this browser doesn't support native shadow dom
768
+ // and this host element was NOT created with SSR
769
+ // let's pick out the inner content for slot projection
770
+ // create a node to represent where the original
771
+ // content was first placed, which is useful later on
772
+ // DOM WRITE!!
773
+ elm['s-sc'] = scopeId;
774
+ elm.classList.add(scopeId + '-h');
775
+ if (BUILD.scoped && flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
776
+ elm.classList.add(scopeId + '-s');
777
+ }
778
+ }
779
+ endAttachStyles();
780
+ };
781
+ const getScopeId = (cmp, mode) => 'sc-' + (BUILD.mode && mode && cmp.$flags$ & 32 /* CMP_FLAGS.hasMode */ ? cmp.$tagName$ + '-' + mode : cmp.$tagName$);
782
+ const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
783
+ /**
784
+ * Production setAccessor() function based on Preact by
785
+ * Jason Miller (@developit)
786
+ * Licensed under the MIT License
787
+ * https://github.com/developit/preact/blob/master/LICENSE
788
+ *
789
+ * Modified for Stencil's compiler and vdom
790
+ */
791
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
792
+ if (oldValue !== newValue) {
793
+ let isProp = isMemberInElement(elm, memberName);
794
+ let ln = memberName.toLowerCase();
795
+ if (BUILD.vdomClass && memberName === 'class') {
796
+ const classList = elm.classList;
797
+ const oldClasses = parseClassList(oldValue);
798
+ const newClasses = parseClassList(newValue);
799
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
800
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
801
+ }
802
+ else if (BUILD.vdomStyle && memberName === 'style') {
803
+ // update style attribute, css properties and values
804
+ if (BUILD.updatable) {
805
+ for (const prop in oldValue) {
806
+ if (!newValue || newValue[prop] == null) {
807
+ if (!BUILD.hydrateServerSide && prop.includes('-')) {
808
+ elm.style.removeProperty(prop);
809
+ }
810
+ else {
811
+ elm.style[prop] = '';
812
+ }
813
+ }
814
+ }
815
+ }
816
+ for (const prop in newValue) {
817
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
818
+ if (!BUILD.hydrateServerSide && prop.includes('-')) {
819
+ elm.style.setProperty(prop, newValue[prop]);
820
+ }
821
+ else {
822
+ elm.style[prop] = newValue[prop];
823
+ }
824
+ }
825
+ }
826
+ }
827
+ else if (BUILD.vdomKey && memberName === 'key')
828
+ ;
829
+ else if (BUILD.vdomRef && memberName === 'ref') {
830
+ // minifier will clean this up
831
+ if (newValue) {
832
+ newValue(elm);
833
+ }
834
+ }
835
+ else if (BUILD.vdomListener &&
836
+ (BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) &&
837
+ memberName[0] === 'o' &&
838
+ memberName[1] === 'n') {
839
+ // Event Handlers
840
+ // so if the member name starts with "on" and the 3rd characters is
841
+ // a capital letter, and it's not already a member on the element,
842
+ // then we're assuming it's an event listener
843
+ if (memberName[2] === '-') {
844
+ // on- prefixed events
845
+ // allows to be explicit about the dom event to listen without any magic
846
+ // under the hood:
847
+ // <my-cmp on-click> // listens for "click"
848
+ // <my-cmp on-Click> // listens for "Click"
849
+ // <my-cmp on-ionChange> // listens for "ionChange"
850
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
851
+ memberName = memberName.slice(3);
852
+ }
853
+ else if (isMemberInElement(win, ln)) {
854
+ // standard event
855
+ // the JSX attribute could have been "onMouseOver" and the
856
+ // member name "onmouseover" is on the window's prototype
857
+ // so let's add the listener "mouseover", which is all lowercased
858
+ memberName = ln.slice(2);
859
+ }
860
+ else {
861
+ // custom event
862
+ // the JSX attribute could have been "onMyCustomEvent"
863
+ // so let's trim off the "on" prefix and lowercase the first character
864
+ // and add the listener "myCustomEvent"
865
+ // except for the first character, we keep the event name case
866
+ memberName = ln[2] + memberName.slice(3);
867
+ }
868
+ if (oldValue) {
869
+ plt.rel(elm, memberName, oldValue, false);
870
+ }
871
+ if (newValue) {
872
+ plt.ael(elm, memberName, newValue, false);
873
+ }
874
+ }
875
+ else if (BUILD.vdomPropOrAttr) {
876
+ // Set property if it exists and it's not a SVG
877
+ const isComplex = isComplexType(newValue);
878
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
879
+ try {
880
+ if (!elm.tagName.includes('-')) {
881
+ const n = newValue == null ? '' : newValue;
882
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
883
+ if (memberName === 'list') {
884
+ isProp = false;
885
+ }
886
+ else if (oldValue == null || elm[memberName] != n) {
887
+ elm[memberName] = n;
888
+ }
889
+ }
890
+ else {
891
+ elm[memberName] = newValue;
892
+ }
893
+ }
894
+ catch (e) { }
895
+ }
896
+ /**
897
+ * Need to manually update attribute if:
898
+ * - memberName is not an attribute
899
+ * - if we are rendering the host element in order to reflect attribute
900
+ * - if it's a SVG, since properties might not work in <svg>
901
+ * - if the newValue is null/undefined or 'false'.
902
+ */
903
+ let xlink = false;
904
+ if (BUILD.vdomXlink) {
905
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
906
+ memberName = ln;
907
+ xlink = true;
908
+ }
909
+ }
910
+ if (newValue == null || newValue === false) {
911
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
912
+ if (BUILD.vdomXlink && xlink) {
913
+ elm.removeAttributeNS(XLINK_NS, memberName);
914
+ }
915
+ else {
916
+ elm.removeAttribute(memberName);
917
+ }
918
+ }
919
+ }
920
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
921
+ newValue = newValue === true ? '' : newValue;
922
+ if (BUILD.vdomXlink && xlink) {
923
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
924
+ }
925
+ else {
926
+ elm.setAttribute(memberName, newValue);
927
+ }
928
+ }
929
+ }
930
+ }
931
+ };
932
+ const parseClassListRegex = /\s/;
933
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
934
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
935
+ // if the element passed in is a shadow root, which is a document fragment
936
+ // then we want to be adding attrs/props to the shadow root's "host" element
937
+ // if it's not a shadow root, then we add attrs/props to the same element
938
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
939
+ ? newVnode.$elm$.host
940
+ : newVnode.$elm$;
941
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
942
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
943
+ if (BUILD.updatable) {
944
+ // remove attributes no longer present on the vnode by setting them to undefined
945
+ for (memberName in oldVnodeAttrs) {
946
+ if (!(memberName in newVnodeAttrs)) {
947
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
948
+ }
949
+ }
950
+ }
951
+ // add new & update changed attributes
952
+ for (memberName in newVnodeAttrs) {
953
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
954
+ }
955
+ };
956
+ /**
957
+ * Create a DOM Node corresponding to one of the children of a given VNode.
958
+ *
959
+ * @param oldParentVNode the parent VNode from the previous render
960
+ * @param newParentVNode the parent VNode from the current render
961
+ * @param childIndex the index of the VNode, in the _new_ parent node's
962
+ * children, for which we will create a new DOM node
963
+ * @param parentElm the parent DOM node which our new node will be a child of
964
+ * @returns the newly created node
965
+ */
966
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
967
+ // tslint:disable-next-line: prefer-const
968
+ const newVNode = newParentVNode.$children$[childIndex];
969
+ let i = 0;
970
+ let elm;
971
+ let childNode;
972
+ let oldVNode;
973
+ if (BUILD.slotRelocation && !useNativeShadowDom) {
974
+ // remember for later we need to check to relocate nodes
975
+ checkSlotRelocate = true;
976
+ if (newVNode.$tag$ === 'slot') {
977
+ if (scopeId) {
978
+ // scoped css needs to add its scoped id to the parent element
979
+ parentElm.classList.add(scopeId + '-s');
980
+ }
981
+ newVNode.$flags$ |= newVNode.$children$
982
+ ? // slot element has fallback content
983
+ 2 /* VNODE_FLAGS.isSlotFallback */
984
+ : // slot element does not have fallback content
985
+ 1 /* VNODE_FLAGS.isSlotReference */;
986
+ }
987
+ }
988
+ if (BUILD.isDev && newVNode.$elm$) {
989
+ consoleDevError(`The JSX ${newVNode.$text$ !== null ? `"${newVNode.$text$}" text` : `"${newVNode.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`);
990
+ }
991
+ if (BUILD.vdomText && newVNode.$text$ !== null) {
992
+ // create text node
993
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
994
+ }
995
+ else if (BUILD.slotRelocation && newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
996
+ // create a slot reference node
997
+ elm = newVNode.$elm$ =
998
+ BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode) : doc.createTextNode('');
999
+ }
1000
+ else {
1001
+ if (BUILD.svg && !isSvgMode) {
1002
+ isSvgMode = newVNode.$tag$ === 'svg';
1003
+ }
1004
+ // create element
1005
+ elm = newVNode.$elm$ = (BUILD.svg
1006
+ ? doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, BUILD.slotRelocation && newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
1007
+ ? 'slot-fb'
1008
+ : newVNode.$tag$)
1009
+ : doc.createElement(BUILD.slotRelocation && newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
1010
+ ? 'slot-fb'
1011
+ : newVNode.$tag$));
1012
+ if (BUILD.svg && isSvgMode && newVNode.$tag$ === 'foreignObject') {
1013
+ isSvgMode = false;
1014
+ }
1015
+ // add css classes, attrs, props, listeners, etc.
1016
+ if (BUILD.vdomAttribute) {
1017
+ updateElement(null, newVNode, isSvgMode);
1018
+ }
1019
+ if ((BUILD.shadowDom || BUILD.scoped) && isDef(scopeId) && elm['s-si'] !== scopeId) {
1020
+ // if there is a scopeId and this is the initial render
1021
+ // then let's add the scopeId as a css class
1022
+ elm.classList.add((elm['s-si'] = scopeId));
1023
+ }
1024
+ if (newVNode.$children$) {
1025
+ for (i = 0; i < newVNode.$children$.length; ++i) {
1026
+ // create the node
1027
+ childNode = createElm(oldParentVNode, newVNode, i, elm);
1028
+ // return node could have been null
1029
+ if (childNode) {
1030
+ // append our new node
1031
+ elm.appendChild(childNode);
1032
+ }
1033
+ }
1034
+ }
1035
+ if (BUILD.svg) {
1036
+ if (newVNode.$tag$ === 'svg') {
1037
+ // Only reset the SVG context when we're exiting <svg> element
1038
+ isSvgMode = false;
1039
+ }
1040
+ else if (elm.tagName === 'foreignObject') {
1041
+ // Reenter SVG context when we're exiting <foreignObject> element
1042
+ isSvgMode = true;
1043
+ }
1044
+ }
1045
+ }
1046
+ if (BUILD.slotRelocation) {
1047
+ elm['s-hn'] = hostTagName;
1048
+ if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
1049
+ // remember the content reference comment
1050
+ elm['s-sr'] = true;
1051
+ // remember the content reference comment
1052
+ elm['s-cr'] = contentRef;
1053
+ // remember the slot name, or empty string for default slot
1054
+ elm['s-sn'] = newVNode.$name$ || '';
1055
+ // check if we've got an old vnode for this slot
1056
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
1057
+ if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
1058
+ // we've got an old slot vnode and the wrapper is being replaced
1059
+ // so let's move the old slot content back to it's original location
1060
+ putBackInOriginalLocation(oldParentVNode.$elm$, false);
1061
+ }
1062
+ }
1063
+ }
1064
+ return elm;
1065
+ };
1066
+ const putBackInOriginalLocation = (parentElm, recursive) => {
1067
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1068
+ const oldSlotChildNodes = parentElm.childNodes;
1069
+ for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
1070
+ const childNode = oldSlotChildNodes[i];
1071
+ if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
1072
+ // // this child node in the old element is from another component
1073
+ // // remove this node from the old slot's parent
1074
+ // childNode.remove();
1075
+ // and relocate it back to it's original location
1076
+ parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
1077
+ // remove the old original location comment entirely
1078
+ // later on the patch function will know what to do
1079
+ // and move this to the correct spot in need be
1080
+ childNode['s-ol'].remove();
1081
+ childNode['s-ol'] = undefined;
1082
+ checkSlotRelocate = true;
1083
+ }
1084
+ if (recursive) {
1085
+ putBackInOriginalLocation(childNode, recursive);
1086
+ }
1087
+ }
1088
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1089
+ };
1090
+ /**
1091
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
1092
+ * add them to the DOM in the appropriate place.
1093
+ *
1094
+ * @param parentElm the DOM node which should be used as a parent for the new
1095
+ * DOM nodes
1096
+ * @param before a child of the `parentElm` which the new children should be
1097
+ * inserted before (optional)
1098
+ * @param parentVNode the parent virtual DOM node
1099
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
1100
+ * @param startIdx the index in the child virtual DOM nodes at which to start
1101
+ * creating DOM nodes (inclusive)
1102
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
1103
+ * creating DOM nodes (inclusive)
1104
+ */
1105
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
1106
+ let containerElm = ((BUILD.slotRelocation && parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
1107
+ let childNode;
1108
+ if (BUILD.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
1109
+ containerElm = containerElm.shadowRoot;
1110
+ }
1111
+ for (; startIdx <= endIdx; ++startIdx) {
1112
+ if (vnodes[startIdx]) {
1113
+ childNode = createElm(null, parentVNode, startIdx, parentElm);
1114
+ if (childNode) {
1115
+ vnodes[startIdx].$elm$ = childNode;
1116
+ containerElm.insertBefore(childNode, BUILD.slotRelocation ? referenceNode(before) : before);
1117
+ }
1118
+ }
1119
+ }
1120
+ };
1121
+ /**
1122
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
1123
+ * This can be used to, for instance, clean up after a list of children which
1124
+ * should no longer be shown.
1125
+ *
1126
+ * This function also handles some of Stencil's slot relocation logic.
1127
+ *
1128
+ * @param vnodes a list of virtual DOM nodes to remove
1129
+ * @param startIdx the index at which to start removing nodes (inclusive)
1130
+ * @param endIdx the index at which to stop removing nodes (inclusive)
1131
+ * @param vnode a VNode
1132
+ * @param elm an element
1133
+ */
1134
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
1135
+ for (; startIdx <= endIdx; ++startIdx) {
1136
+ if ((vnode = vnodes[startIdx])) {
1137
+ elm = vnode.$elm$;
1138
+ callNodeRefs(vnode);
1139
+ if (BUILD.slotRelocation) {
1140
+ // we're removing this element
1141
+ // so it's possible we need to show slot fallback content now
1142
+ checkSlotFallbackVisibility = true;
1143
+ if (elm['s-ol']) {
1144
+ // remove the original location comment
1145
+ elm['s-ol'].remove();
1146
+ }
1147
+ else {
1148
+ // it's possible that child nodes of the node
1149
+ // that's being removed are slot nodes
1150
+ putBackInOriginalLocation(elm, true);
1151
+ }
1152
+ }
1153
+ // remove the vnode's element from the dom
1154
+ elm.remove();
1155
+ }
1156
+ }
1157
+ };
1158
+ /**
1159
+ * Reconcile the children of a new VNode with the children of an old VNode by
1160
+ * traversing the two collections of children, identifying nodes that are
1161
+ * conserved or changed, calling out to `patch` to make any necessary
1162
+ * updates to the DOM, and rearranging DOM nodes as needed.
1163
+ *
1164
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
1165
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
1166
+ * 'windows' by storing start and end indices and references to the
1167
+ * corresponding array entries. Initially the two 'windows' are basically equal
1168
+ * to the entire array, but we progressively narrow the windows until there are
1169
+ * no children left to update by doing the following:
1170
+ *
1171
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
1172
+ * that if we have an initial array like the following we'll end up dealing
1173
+ * only with a window bounded by the highlighted elements:
1174
+ *
1175
+ * [null, null, VNode1 , ... , VNode2, null, null]
1176
+ * ^^^^^^ ^^^^^^
1177
+ *
1178
+ * 2. Check to see if the elements at the head and tail positions are equal
1179
+ * across the windows. This will basically detect elements which haven't
1180
+ * been added, removed, or changed position, i.e. if you had the following
1181
+ * VNode elements (represented as HTML):
1182
+ *
1183
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
1184
+ * newVNode: `<div><p><span>THERE</span></p></div>`
1185
+ *
1186
+ * Then when comparing the children of the `<div>` tag we check the equality
1187
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
1188
+ * same tag in the same position, we'd be able to avoid completely
1189
+ * re-rendering the subtree under them with a new DOM element and would just
1190
+ * call out to `patch` to handle reconciling their children and so on.
1191
+ *
1192
+ * 3. Check, for both windows, to see if the element at the beginning of the
1193
+ * window corresponds to the element at the end of the other window. This is
1194
+ * a heuristic which will let us identify _some_ situations in which
1195
+ * elements have changed position, for instance it _should_ detect that the
1196
+ * children nodes themselves have not changed but merely moved in the
1197
+ * following example:
1198
+ *
1199
+ * oldVNode: `<div><element-one /><element-two /></div>`
1200
+ * newVNode: `<div><element-two /><element-one /></div>`
1201
+ *
1202
+ * If we find cases like this then we also need to move the concrete DOM
1203
+ * elements corresponding to the moved children to write the re-order to the
1204
+ * DOM.
1205
+ *
1206
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
1207
+ * nodes in the old children which have the same key as the first element in
1208
+ * our window on the new children. If we find such a node we handle calling
1209
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
1210
+ * what we find.
1211
+ *
1212
+ * Finally, once we've narrowed our 'windows' to the point that either of them
1213
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
1214
+ * insertion or deletion that needs to happen to get a DOM state that correctly
1215
+ * reflects the new child VNodes. If, for instance, after our window on the old
1216
+ * children has collapsed we still have more nodes on the new children that
1217
+ * we haven't dealt with yet then we need to add them, or if the new children
1218
+ * collapse but we still have unhandled _old_ children then we need to make
1219
+ * sure the corresponding DOM nodes are removed.
1220
+ *
1221
+ * @param parentElm the node into which the parent VNode is rendered
1222
+ * @param oldCh the old children of the parent node
1223
+ * @param newVNode the new VNode which will replace the parent
1224
+ * @param newCh the new children of the parent node
1225
+ */
1226
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
1227
+ let oldStartIdx = 0;
1228
+ let newStartIdx = 0;
1229
+ let idxInOld = 0;
1230
+ let i = 0;
1231
+ let oldEndIdx = oldCh.length - 1;
1232
+ let oldStartVnode = oldCh[0];
1233
+ let oldEndVnode = oldCh[oldEndIdx];
1234
+ let newEndIdx = newCh.length - 1;
1235
+ let newStartVnode = newCh[0];
1236
+ let newEndVnode = newCh[newEndIdx];
1237
+ let node;
1238
+ let elmToMove;
1239
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
1240
+ if (oldStartVnode == null) {
1241
+ // VNode might have been moved left
1242
+ oldStartVnode = oldCh[++oldStartIdx];
1243
+ }
1244
+ else if (oldEndVnode == null) {
1245
+ oldEndVnode = oldCh[--oldEndIdx];
1246
+ }
1247
+ else if (newStartVnode == null) {
1248
+ newStartVnode = newCh[++newStartIdx];
1249
+ }
1250
+ else if (newEndVnode == null) {
1251
+ newEndVnode = newCh[--newEndIdx];
1252
+ }
1253
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
1254
+ // if the start nodes are the same then we should patch the new VNode
1255
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
1256
+ // indices to reflect that. We don't need to move any DOM Nodes around
1257
+ // since things are matched up in order.
1258
+ patch(oldStartVnode, newStartVnode);
1259
+ oldStartVnode = oldCh[++oldStartIdx];
1260
+ newStartVnode = newCh[++newStartIdx];
1261
+ }
1262
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
1263
+ // likewise, if the end nodes are the same we patch new onto old and
1264
+ // decrement our end indices, and also likewise in this case we don't
1265
+ // need to move any DOM Nodes.
1266
+ patch(oldEndVnode, newEndVnode);
1267
+ oldEndVnode = oldCh[--oldEndIdx];
1268
+ newEndVnode = newCh[--newEndIdx];
1269
+ }
1270
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
1271
+ // case: "Vnode moved right"
1272
+ //
1273
+ // We've found that the last node in our window on the new children is
1274
+ // the same VNode as the _first_ node in our window on the old children
1275
+ // we're dealing with now. Visually, this is the layout of these two
1276
+ // nodes:
1277
+ //
1278
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
1279
+ // ^^^^^^^^^^^
1280
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
1281
+ // ^^^^^^^^^^^^^
1282
+ //
1283
+ // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
1284
+ // and move the DOM element for `oldStartVnode`.
1285
+ if (BUILD.slotRelocation && (oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1286
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
1287
+ }
1288
+ patch(oldStartVnode, newEndVnode);
1289
+ // We need to move the element for `oldStartVnode` into a position which
1290
+ // will be appropriate for `newEndVnode`. For this we can use
1291
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
1292
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
1293
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
1294
+ //
1295
+ // <old-start-node />
1296
+ // <some-intervening-node />
1297
+ // <old-end-node />
1298
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
1299
+ // <next-sibling />
1300
+ //
1301
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
1302
+ // the node for `oldStartVnode` at the end of the children of
1303
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
1304
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
1305
+ // append it to the children of the parent element.
1306
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1307
+ oldStartVnode = oldCh[++oldStartIdx];
1308
+ newEndVnode = newCh[--newEndIdx];
1309
+ }
1310
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
1311
+ // case: "Vnode moved left"
1312
+ //
1313
+ // We've found that the first node in our window on the new children is
1314
+ // the same VNode as the _last_ node in our window on the old children.
1315
+ // Visually, this is the layout of these two nodes:
1316
+ //
1317
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
1318
+ // ^^^^^^^^^^^^^
1319
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
1320
+ // ^^^^^^^^^^^
1321
+ //
1322
+ // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
1323
+ // (which will handle updating any changed attributes, reconciling their
1324
+ // children etc) but we also need to move the DOM node to which
1325
+ // `oldEndVnode` corresponds.
1326
+ if (BUILD.slotRelocation && (oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1327
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
1328
+ }
1329
+ patch(oldEndVnode, newStartVnode);
1330
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
1331
+ // the same node, so since we're here we know that they are not. Thus we
1332
+ // can move the element for `oldEndVnode` _before_ the element for
1333
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
1334
+ // future.
1335
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
1336
+ oldEndVnode = oldCh[--oldEndIdx];
1337
+ newStartVnode = newCh[++newStartIdx];
1338
+ }
1339
+ else {
1340
+ // Here we do some checks to match up old and new nodes based on the
1341
+ // `$key$` attribute, which is set by putting a `key="my-key"` attribute
1342
+ // in the JSX for a DOM element in the implementation of a Stencil
1343
+ // component.
1344
+ //
1345
+ // First we check to see if there are any nodes in the array of old
1346
+ // children which have the same key as the first node in the new
1347
+ // children.
1348
+ idxInOld = -1;
1349
+ if (BUILD.vdomKey) {
1350
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
1351
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
1352
+ idxInOld = i;
1353
+ break;
1354
+ }
1355
+ }
1356
+ }
1357
+ if (BUILD.vdomKey && idxInOld >= 0) {
1358
+ // We found a node in the old children which matches up with the first
1359
+ // node in the new children! So let's deal with that
1360
+ elmToMove = oldCh[idxInOld];
1361
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
1362
+ // the tag doesn't match so we'll need a new DOM element
1363
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
1364
+ }
1365
+ else {
1366
+ patch(elmToMove, newStartVnode);
1367
+ // invalidate the matching old node so that we won't try to update it
1368
+ // again later on
1369
+ oldCh[idxInOld] = undefined;
1370
+ node = elmToMove.$elm$;
1371
+ }
1372
+ newStartVnode = newCh[++newStartIdx];
1373
+ }
1374
+ else {
1375
+ // We either didn't find an element in the old children that matches
1376
+ // the key of the first new child OR the build is not using `key`
1377
+ // attributes at all. In either case we need to create a new element
1378
+ // for the new node.
1379
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
1380
+ newStartVnode = newCh[++newStartIdx];
1381
+ }
1382
+ if (node) {
1383
+ // if we created a new node then handle inserting it to the DOM
1384
+ if (BUILD.slotRelocation) {
1385
+ parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
1386
+ }
1387
+ else {
1388
+ oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
1389
+ }
1390
+ }
1391
+ }
1392
+ }
1393
+ if (oldStartIdx > oldEndIdx) {
1394
+ // we have some more new nodes to add which don't match up with old nodes
1395
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
1396
+ }
1397
+ else if (BUILD.updatable && newStartIdx > newEndIdx) {
1398
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
1399
+ // in the new array, so lets remove them (which entails cleaning up the
1400
+ // relevant DOM nodes)
1401
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1402
+ }
1403
+ };
1404
+ /**
1405
+ * Compare two VNodes to determine if they are the same
1406
+ *
1407
+ * **NB**: This function is an equality _heuristic_ based on the available
1408
+ * information set on the two VNodes and can be misleading under certain
1409
+ * circumstances. In particular, if the two nodes do not have `key` attrs
1410
+ * (available under `$key$` on VNodes) then the function falls back on merely
1411
+ * checking that they have the same tag.
1412
+ *
1413
+ * So, in other words, if `key` attrs are not set on VNodes which may be
1414
+ * changing order within a `children` array or something along those lines then
1415
+ * we could obtain a false negative and then have to do needless re-rendering
1416
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
1417
+ *
1418
+ * @param leftVNode the first VNode to check
1419
+ * @param rightVNode the second VNode to check
1420
+ * @returns whether they're equal or not
1421
+ */
1422
+ const isSameVnode = (leftVNode, rightVNode) => {
1423
+ // compare if two vnode to see if they're "technically" the same
1424
+ // need to have the same element tag, and same key to be the same
1425
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
1426
+ if (BUILD.slotRelocation && leftVNode.$tag$ === 'slot') {
1427
+ return leftVNode.$name$ === rightVNode.$name$;
1428
+ }
1429
+ // this will be set if components in the build have `key` attrs set on them
1430
+ if (BUILD.vdomKey) {
1431
+ return leftVNode.$key$ === rightVNode.$key$;
1432
+ }
1433
+ return true;
1434
+ }
1435
+ return false;
1436
+ };
1437
+ const referenceNode = (node) => {
1438
+ // this node was relocated to a new location in the dom
1439
+ // because of some other component's slot
1440
+ // but we still have an html comment in place of where
1441
+ // it's original location was according to it's original vdom
1442
+ return (node && node['s-ol']) || node;
1443
+ };
1444
+ const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
1445
+ /**
1446
+ * Handle reconciling an outdated VNode with a new one which corresponds to
1447
+ * it. This function handles flushing updates to the DOM and reconciling the
1448
+ * children of the two nodes (if any).
1449
+ *
1450
+ * @param oldVNode an old VNode whose DOM element and children we want to update
1451
+ * @param newVNode a new VNode representing an updated version of the old one
1452
+ */
1453
+ const patch = (oldVNode, newVNode) => {
1454
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
1455
+ const oldChildren = oldVNode.$children$;
1456
+ const newChildren = newVNode.$children$;
1457
+ const tag = newVNode.$tag$;
1458
+ const text = newVNode.$text$;
1459
+ let defaultHolder;
1460
+ if (!BUILD.vdomText || text === null) {
1461
+ if (BUILD.svg) {
1462
+ // test if we're rendering an svg element, or still rendering nodes inside of one
1463
+ // only add this to the when the compiler sees we're using an svg somewhere
1464
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
1465
+ }
1466
+ if (BUILD.vdomAttribute || BUILD.reflect) {
1467
+ if (BUILD.slot && tag === 'slot')
1468
+ ;
1469
+ else {
1470
+ // either this is the first render of an element OR it's an update
1471
+ // AND we already know it's possible it could have changed
1472
+ // this updates the element's css classes, attrs, props, listeners, etc.
1473
+ updateElement(oldVNode, newVNode, isSvgMode);
1474
+ }
1475
+ }
1476
+ if (BUILD.updatable && oldChildren !== null && newChildren !== null) {
1477
+ // looks like there's child vnodes for both the old and new vnodes
1478
+ // so we need to call `updateChildren` to reconcile them
1479
+ updateChildren(elm, oldChildren, newVNode, newChildren);
1480
+ }
1481
+ else if (newChildren !== null) {
1482
+ // no old child vnodes, but there are new child vnodes to add
1483
+ if (BUILD.updatable && BUILD.vdomText && oldVNode.$text$ !== null) {
1484
+ // the old vnode was text, so be sure to clear it out
1485
+ elm.textContent = '';
1486
+ }
1487
+ // add the new vnode children
1488
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
1489
+ }
1490
+ else if (BUILD.updatable && oldChildren !== null) {
1491
+ // no new child vnodes, but there are old child vnodes to remove
1492
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
1493
+ }
1494
+ if (BUILD.svg && isSvgMode && tag === 'svg') {
1495
+ isSvgMode = false;
1496
+ }
1497
+ }
1498
+ else if (BUILD.vdomText && BUILD.slotRelocation && (defaultHolder = elm['s-cr'])) {
1499
+ // this element has slotted content
1500
+ defaultHolder.parentNode.textContent = text;
1501
+ }
1502
+ else if (BUILD.vdomText && oldVNode.$text$ !== text) {
1503
+ // update the text content for the text only vnode
1504
+ // and also only if the text is different than before
1505
+ elm.data = text;
1506
+ }
1507
+ };
1508
+ const updateFallbackSlotVisibility = (elm) => {
1509
+ // tslint:disable-next-line: prefer-const
1510
+ const childNodes = elm.childNodes;
1511
+ let childNode;
1512
+ let i;
1513
+ let ilen;
1514
+ let j;
1515
+ let slotNameAttr;
1516
+ let nodeType;
1517
+ for (i = 0, ilen = childNodes.length; i < ilen; i++) {
1518
+ childNode = childNodes[i];
1519
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1520
+ if (childNode['s-sr']) {
1521
+ // this is a slot fallback node
1522
+ // get the slot name for this slot reference node
1523
+ slotNameAttr = childNode['s-sn'];
1524
+ // by default always show a fallback slot node
1525
+ // then hide it if there are other slots in the light dom
1526
+ childNode.hidden = false;
1527
+ for (j = 0; j < ilen; j++) {
1528
+ nodeType = childNodes[j].nodeType;
1529
+ if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
1530
+ // this sibling node is from a different component OR is a named fallback slot node
1531
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
1532
+ childNode.hidden = true;
1533
+ break;
1534
+ }
1535
+ }
1536
+ else {
1537
+ // this is a default fallback slot node
1538
+ // any element or text node (with content)
1539
+ // should hide the default fallback slot node
1540
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
1541
+ (nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
1542
+ childNode.hidden = true;
1543
+ break;
1544
+ }
1545
+ }
1546
+ }
1547
+ }
1548
+ // keep drilling down
1549
+ updateFallbackSlotVisibility(childNode);
1550
+ }
1551
+ }
1552
+ };
1553
+ const relocateNodes = [];
1554
+ const relocateSlotContent = (elm) => {
1555
+ // tslint:disable-next-line: prefer-const
1556
+ let childNode;
1557
+ let node;
1558
+ let hostContentNodes;
1559
+ let slotNameAttr;
1560
+ let relocateNodeData;
1561
+ let j;
1562
+ let i = 0;
1563
+ const childNodes = elm.childNodes;
1564
+ const ilen = childNodes.length;
1565
+ for (; i < ilen; i++) {
1566
+ childNode = childNodes[i];
1567
+ if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
1568
+ // first got the content reference comment node
1569
+ // then we got it's parent, which is where all the host content is in now
1570
+ hostContentNodes = node.parentNode.childNodes;
1571
+ slotNameAttr = childNode['s-sn'];
1572
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
1573
+ node = hostContentNodes[j];
1574
+ if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
1575
+ // let's do some relocating to its new home
1576
+ // but never relocate a content reference node
1577
+ // that is suppose to always represent the original content location
1578
+ if (isNodeLocatedInSlot(node, slotNameAttr)) {
1579
+ // it's possible we've already decided to relocate this node
1580
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1581
+ // made some changes to slots
1582
+ // let's make sure we also double check
1583
+ // fallbacks are correctly hidden or shown
1584
+ checkSlotFallbackVisibility = true;
1585
+ node['s-sn'] = node['s-sn'] || slotNameAttr;
1586
+ if (relocateNodeData) {
1587
+ // previously we never found a slot home for this node
1588
+ // but turns out we did, so let's remember it now
1589
+ relocateNodeData.$slotRefNode$ = childNode;
1590
+ }
1591
+ else {
1592
+ // add to our list of nodes to relocate
1593
+ relocateNodes.push({
1594
+ $slotRefNode$: childNode,
1595
+ $nodeToRelocate$: node,
1596
+ });
1597
+ }
1598
+ if (node['s-sr']) {
1599
+ relocateNodes.map((relocateNode) => {
1600
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
1601
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1602
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
1603
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1604
+ }
1605
+ }
1606
+ });
1607
+ }
1608
+ }
1609
+ else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
1610
+ // so far this element does not have a slot home, not setting slotRefNode on purpose
1611
+ // if we never find a home for this element then we'll need to hide it
1612
+ relocateNodes.push({
1613
+ $nodeToRelocate$: node,
1614
+ });
1615
+ }
1616
+ }
1617
+ }
1618
+ }
1619
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1620
+ relocateSlotContent(childNode);
1621
+ }
1622
+ }
1623
+ };
1624
+ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
1625
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1626
+ if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
1627
+ return true;
1628
+ }
1629
+ if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
1630
+ return true;
1631
+ }
1632
+ return false;
1633
+ }
1634
+ if (nodeToRelocate['s-sn'] === slotNameAttr) {
1635
+ return true;
1636
+ }
1637
+ return slotNameAttr === '';
1638
+ };
1639
+ const callNodeRefs = (vNode) => {
1640
+ if (BUILD.vdomRef) {
1641
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1642
+ vNode.$children$ && vNode.$children$.map(callNodeRefs);
1643
+ }
1644
+ };
1645
+ /**
1646
+ * The main entry point for Stencil's virtual DOM-based rendering engine
1647
+ *
1648
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
1649
+ * function will handle creating a virtual DOM tree with a single root, patching
1650
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
1651
+ * relocation, and reflecting attributes.
1652
+ *
1653
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
1654
+ * the DOM node into which it should be rendered.
1655
+ * @param renderFnResults the virtual DOM nodes to be rendered
1656
+ */
1657
+ const renderVdom = (hostRef, renderFnResults) => {
1658
+ const hostElm = hostRef.$hostElement$;
1659
+ const cmpMeta = hostRef.$cmpMeta$;
1660
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1661
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1662
+ hostTagName = hostElm.tagName;
1663
+ // <Host> runtime check
1664
+ if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
1665
+ throw new Error(`The <Host> must be the single root component.
1666
+ Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
1667
+
1668
+ The render() function should look like this instead:
1669
+
1670
+ render() {
1671
+ // Do not return an array
1672
+ return (
1673
+ <Host>{content}</Host>
1674
+ );
1675
+ }
1676
+ `);
1677
+ }
1678
+ if (BUILD.reflect && cmpMeta.$attrsToReflect$) {
1679
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1680
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
1681
+ }
1682
+ rootVnode.$tag$ = null;
1683
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
1684
+ hostRef.$vnode$ = rootVnode;
1685
+ rootVnode.$elm$ = oldVNode.$elm$ = (BUILD.shadowDom ? hostElm.shadowRoot || hostElm : hostElm);
1686
+ if (BUILD.scoped || BUILD.shadowDom) {
1687
+ scopeId = hostElm['s-sc'];
1688
+ }
1689
+ if (BUILD.slotRelocation) {
1690
+ contentRef = hostElm['s-cr'];
1691
+ useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
1692
+ // always reset
1693
+ checkSlotFallbackVisibility = false;
1694
+ }
1695
+ // synchronous patch
1696
+ patch(oldVNode, rootVnode);
1697
+ if (BUILD.slotRelocation) {
1698
+ // while we're moving nodes around existing nodes, temporarily disable
1699
+ // the disconnectCallback from working
1700
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1701
+ if (checkSlotRelocate) {
1702
+ relocateSlotContent(rootVnode.$elm$);
1703
+ let relocateData;
1704
+ let nodeToRelocate;
1705
+ let orgLocationNode;
1706
+ let parentNodeRef;
1707
+ let insertBeforeNode;
1708
+ let refNode;
1709
+ let i = 0;
1710
+ for (; i < relocateNodes.length; i++) {
1711
+ relocateData = relocateNodes[i];
1712
+ nodeToRelocate = relocateData.$nodeToRelocate$;
1713
+ if (!nodeToRelocate['s-ol']) {
1714
+ // add a reference node marking this node's original location
1715
+ // keep a reference to this node for later lookups
1716
+ orgLocationNode =
1717
+ BUILD.isDebug || BUILD.hydrateServerSide
1718
+ ? originalLocationDebugNode(nodeToRelocate)
1719
+ : doc.createTextNode('');
1720
+ orgLocationNode['s-nr'] = nodeToRelocate;
1721
+ nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
1722
+ }
1723
+ }
1724
+ for (i = 0; i < relocateNodes.length; i++) {
1725
+ relocateData = relocateNodes[i];
1726
+ nodeToRelocate = relocateData.$nodeToRelocate$;
1727
+ if (relocateData.$slotRefNode$) {
1728
+ // by default we're just going to insert it directly
1729
+ // after the slot reference node
1730
+ parentNodeRef = relocateData.$slotRefNode$.parentNode;
1731
+ insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
1732
+ orgLocationNode = nodeToRelocate['s-ol'];
1733
+ while ((orgLocationNode = orgLocationNode.previousSibling)) {
1734
+ refNode = orgLocationNode['s-nr'];
1735
+ if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
1736
+ refNode = refNode.nextSibling;
1737
+ if (!refNode || !refNode['s-nr']) {
1738
+ insertBeforeNode = refNode;
1739
+ break;
1740
+ }
1741
+ }
1742
+ }
1743
+ if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
1744
+ nodeToRelocate.nextSibling !== insertBeforeNode) {
1745
+ // we've checked that it's worth while to relocate
1746
+ // since that the node to relocate
1747
+ // has a different next sibling or parent relocated
1748
+ if (nodeToRelocate !== insertBeforeNode) {
1749
+ if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
1750
+ // probably a component in the index.html that doesn't have it's hostname set
1751
+ nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
1752
+ }
1753
+ // add it back to the dom but in its new home
1754
+ parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1755
+ }
1756
+ }
1757
+ }
1758
+ else {
1759
+ // this node doesn't have a slot home to go to, so let's hide it
1760
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1761
+ nodeToRelocate.hidden = true;
1762
+ }
1763
+ }
1764
+ }
1765
+ }
1766
+ if (checkSlotFallbackVisibility) {
1767
+ updateFallbackSlotVisibility(rootVnode.$elm$);
1768
+ }
1769
+ // done moving nodes around
1770
+ // allow the disconnect callback to work again
1771
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1772
+ // always reset
1773
+ relocateNodes.length = 0;
1774
+ }
1775
+ };
1776
+ // slot comment debug nodes only created with the `--debug` flag
1777
+ // otherwise these nodes are text nodes w/out content
1778
+ const slotReferenceDebugNode = (slotVNode) => doc.createComment(`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ''}> (host=${hostTagName.toLowerCase()})`);
1779
+ const originalLocationDebugNode = (nodeToRelocate) => doc.createComment(`org-location for ` +
1780
+ (nodeToRelocate.localName
1781
+ ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate['s-hn']})`
1782
+ : `[${nodeToRelocate.textContent}]`));
1783
+ const attachToAncestor = (hostRef, ancestorComponent) => {
1784
+ if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1785
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
1786
+ }
1787
+ };
1788
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
1789
+ if (BUILD.taskQueue && BUILD.updatable) {
1790
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1791
+ }
1792
+ if (BUILD.asyncLoading && hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1793
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1794
+ return;
1795
+ }
1796
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1797
+ // there is no ancestor component or the ancestor component
1798
+ // has already fired off its lifecycle update then
1799
+ // fire off the initial update
1800
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1801
+ return BUILD.taskQueue ? writeTask(dispatch) : dispatch();
1802
+ };
1803
+ const dispatchHooks = (hostRef, isInitialLoad) => {
1804
+ const elm = hostRef.$hostElement$;
1805
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1806
+ const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
1807
+ let promise;
1808
+ if (isInitialLoad) {
1809
+ if (BUILD.lazyLoad && BUILD.hostListener) {
1810
+ hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1811
+ if (hostRef.$queuedListeners$) {
1812
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1813
+ hostRef.$queuedListeners$ = null;
1814
+ }
1815
+ }
1816
+ emitLifecycleEvent(elm, 'componentWillLoad');
1817
+ if (BUILD.cmpWillLoad) {
1818
+ promise = safeCall(instance, 'componentWillLoad');
1819
+ }
1820
+ }
1821
+ else {
1822
+ emitLifecycleEvent(elm, 'componentWillUpdate');
1823
+ if (BUILD.cmpWillUpdate) {
1824
+ promise = safeCall(instance, 'componentWillUpdate');
1825
+ }
1826
+ }
1827
+ emitLifecycleEvent(elm, 'componentWillRender');
1828
+ if (BUILD.cmpWillRender) {
1829
+ promise = then(promise, () => safeCall(instance, 'componentWillRender'));
1830
+ }
1831
+ endSchedule();
1832
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1833
+ };
1834
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1835
+ // updateComponent
1836
+ const elm = hostRef.$hostElement$;
1837
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1838
+ const rc = elm['s-rc'];
1839
+ if (BUILD.style && isInitialLoad) {
1840
+ // DOM WRITE!
1841
+ attachStyles(hostRef);
1842
+ }
1843
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1844
+ if (BUILD.isDev) {
1845
+ hostRef.$flags$ |= 1024 /* HOST_FLAGS.devOnRender */;
1846
+ }
1847
+ if (BUILD.hydrateServerSide) {
1848
+ await callRender(hostRef, instance, elm);
1849
+ }
1850
+ else {
1851
+ callRender(hostRef, instance, elm);
1852
+ }
1853
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
1854
+ if (BUILD.cssVarShim && plt.$cssShim$) {
1855
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
1856
+ plt.$cssShim$.updateHost(elm);
1857
+ }
1858
+ if (BUILD.isDev) {
1859
+ hostRef.$renderCount$++;
1860
+ hostRef.$flags$ &= ~1024 /* HOST_FLAGS.devOnRender */;
1861
+ }
1862
+ if (BUILD.hydrateServerSide) {
1863
+ try {
1864
+ // manually connected child components during server-side hydrate
1865
+ serverSideConnected(elm);
1866
+ if (isInitialLoad) {
1867
+ // using only during server-side hydrate
1868
+ if (hostRef.$cmpMeta$.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1869
+ elm['s-en'] = '';
1870
+ }
1871
+ else if (hostRef.$cmpMeta$.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
1872
+ elm['s-en'] = 'c';
1873
+ }
1874
+ }
1875
+ }
1876
+ catch (e) {
1877
+ consoleError(e, elm);
1878
+ }
1879
+ }
1880
+ if (BUILD.asyncLoading && rc) {
1881
+ // ok, so turns out there are some child host elements
1882
+ // waiting on this parent element to load
1883
+ // let's fire off all update callbacks waiting
1884
+ rc.map((cb) => cb());
1885
+ elm['s-rc'] = undefined;
1886
+ }
1887
+ endRender();
1888
+ endUpdate();
1889
+ if (BUILD.asyncLoading) {
1890
+ const childrenPromises = elm['s-p'];
1891
+ const postUpdate = () => postUpdateComponent(hostRef);
1892
+ if (childrenPromises.length === 0) {
1893
+ postUpdate();
1894
+ }
1895
+ else {
1896
+ Promise.all(childrenPromises).then(postUpdate);
1897
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1898
+ childrenPromises.length = 0;
1899
+ }
1900
+ }
1901
+ else {
1902
+ postUpdateComponent(hostRef);
1903
+ }
1904
+ };
1905
+ const callRender = (hostRef, instance, elm) => {
1906
+ // in order for bundlers to correctly treeshake the BUILD object
1907
+ // we need to ensure BUILD is not deoptimized within a try/catch
1908
+ // https://rollupjs.org/guide/en/#treeshake tryCatchDeoptimization
1909
+ const allRenderFn = BUILD.allRenderFn ? true : false;
1910
+ const lazyLoad = BUILD.lazyLoad ? true : false;
1911
+ const taskQueue = BUILD.taskQueue ? true : false;
1912
+ const updatable = BUILD.updatable ? true : false;
1913
+ try {
1914
+ renderingRef = instance;
1915
+ instance = allRenderFn ? instance.render() : instance.render && instance.render();
1916
+ if (updatable && taskQueue) {
1917
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1918
+ }
1919
+ if (updatable || lazyLoad) {
1920
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1921
+ }
1922
+ if (BUILD.hasRenderFn || BUILD.reflect) {
1923
+ if (BUILD.vdomRender || BUILD.reflect) {
1924
+ // looks like we've got child nodes to render into this host element
1925
+ // or we need to update the css class/attrs on the host element
1926
+ // DOM WRITE!
1927
+ if (BUILD.hydrateServerSide) {
1928
+ return Promise.resolve(instance).then((value) => renderVdom(hostRef, value));
1929
+ }
1930
+ else {
1931
+ renderVdom(hostRef, instance);
1932
+ }
1933
+ }
1934
+ else {
1935
+ elm.textContent = instance;
1936
+ }
1937
+ }
1938
+ }
1939
+ catch (e) {
1940
+ consoleError(e, hostRef.$hostElement$);
1941
+ }
1942
+ renderingRef = null;
1943
+ return null;
1944
+ };
1945
+ const getRenderingRef = () => renderingRef;
1946
+ const postUpdateComponent = (hostRef) => {
1947
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1948
+ const elm = hostRef.$hostElement$;
1949
+ const endPostUpdate = createTime('postUpdate', tagName);
1950
+ const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
1951
+ const ancestorComponent = hostRef.$ancestorComponent$;
1952
+ if (BUILD.cmpDidRender) {
1953
+ if (BUILD.isDev) {
1954
+ hostRef.$flags$ |= 1024 /* HOST_FLAGS.devOnRender */;
1955
+ }
1956
+ safeCall(instance, 'componentDidRender');
1957
+ if (BUILD.isDev) {
1958
+ hostRef.$flags$ &= ~1024 /* HOST_FLAGS.devOnRender */;
1959
+ }
1960
+ }
1961
+ emitLifecycleEvent(elm, 'componentDidRender');
1962
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1963
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1964
+ if (BUILD.asyncLoading && BUILD.cssAnnotations) {
1965
+ // DOM WRITE!
1966
+ addHydratedFlag(elm);
1967
+ }
1968
+ if (BUILD.cmpDidLoad) {
1969
+ if (BUILD.isDev) {
1970
+ hostRef.$flags$ |= 2048 /* HOST_FLAGS.devOnDidLoad */;
1971
+ }
1972
+ safeCall(instance, 'componentDidLoad');
1973
+ if (BUILD.isDev) {
1974
+ hostRef.$flags$ &= ~2048 /* HOST_FLAGS.devOnDidLoad */;
1975
+ }
1976
+ }
1977
+ emitLifecycleEvent(elm, 'componentDidLoad');
1978
+ endPostUpdate();
1979
+ if (BUILD.asyncLoading) {
1980
+ hostRef.$onReadyResolve$(elm);
1981
+ if (!ancestorComponent) {
1982
+ appDidLoad(tagName);
1983
+ }
1984
+ }
1985
+ }
1986
+ else {
1987
+ if (BUILD.cmpDidUpdate) {
1988
+ // we've already loaded this component
1989
+ // fire off the user's componentDidUpdate method (if one was provided)
1990
+ // componentDidUpdate runs AFTER render() has been called
1991
+ // and all child components have finished updating
1992
+ if (BUILD.isDev) {
1993
+ hostRef.$flags$ |= 1024 /* HOST_FLAGS.devOnRender */;
1994
+ }
1995
+ safeCall(instance, 'componentDidUpdate');
1996
+ if (BUILD.isDev) {
1997
+ hostRef.$flags$ &= ~1024 /* HOST_FLAGS.devOnRender */;
1998
+ }
1999
+ }
2000
+ emitLifecycleEvent(elm, 'componentDidUpdate');
2001
+ endPostUpdate();
2002
+ }
2003
+ if (BUILD.hotModuleReplacement) {
2004
+ elm['s-hmr-load'] && elm['s-hmr-load']();
2005
+ }
2006
+ if (BUILD.method && BUILD.lazyLoad) {
2007
+ hostRef.$onInstanceResolve$(elm);
2008
+ }
2009
+ // load events fire from bottom to top
2010
+ // the deepest elements load first then bubbles up
2011
+ if (BUILD.asyncLoading) {
2012
+ if (hostRef.$onRenderResolve$) {
2013
+ hostRef.$onRenderResolve$();
2014
+ hostRef.$onRenderResolve$ = undefined;
2015
+ }
2016
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
2017
+ nextTick(() => scheduleUpdate(hostRef, false));
2018
+ }
2019
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
2020
+ }
2021
+ // ( •_•)
2022
+ // ( •_•)>⌐■-■
2023
+ // (⌐■_■)
2024
+ };
2025
+ const forceUpdate = (ref) => {
2026
+ if (BUILD.updatable) {
2027
+ const hostRef = getHostRef(ref);
2028
+ const isConnected = hostRef.$hostElement$.isConnected;
2029
+ if (isConnected &&
2030
+ (hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
2031
+ scheduleUpdate(hostRef, false);
2032
+ }
2033
+ // Returns "true" when the forced update was successfully scheduled
2034
+ return isConnected;
2035
+ }
2036
+ return false;
2037
+ };
2038
+ const appDidLoad = (who) => {
2039
+ // on appload
2040
+ // we have finish the first big initial render
2041
+ if (BUILD.cssAnnotations) {
2042
+ addHydratedFlag(doc.documentElement);
2043
+ }
2044
+ if (BUILD.asyncQueue) {
2045
+ plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
2046
+ }
2047
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
2048
+ if (BUILD.profile && performance.measure) {
2049
+ performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, 'st:app:start');
2050
+ }
2051
+ };
2052
+ const safeCall = (instance, method, arg) => {
2053
+ if (instance && instance[method]) {
2054
+ try {
2055
+ return instance[method](arg);
2056
+ }
2057
+ catch (e) {
2058
+ consoleError(e);
2059
+ }
2060
+ }
2061
+ return undefined;
2062
+ };
2063
+ const then = (promise, thenFn) => {
2064
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
2065
+ };
2066
+ const emitLifecycleEvent = (elm, lifecycleName) => {
2067
+ if (BUILD.lifecycleDOMEvents) {
2068
+ emitEvent(elm, 'stencil_' + lifecycleName, {
2069
+ bubbles: true,
2070
+ composed: true,
2071
+ detail: {
2072
+ namespace: NAMESPACE,
2073
+ },
2074
+ });
2075
+ }
2076
+ };
2077
+ const addHydratedFlag = (elm) => BUILD.hydratedClass
2078
+ ? elm.classList.add('hydrated')
2079
+ : BUILD.hydratedAttribute
2080
+ ? elm.setAttribute('hydrated', '')
2081
+ : undefined;
2082
+ const serverSideConnected = (elm) => {
2083
+ const children = elm.children;
2084
+ if (children != null) {
2085
+ for (let i = 0, ii = children.length; i < ii; i++) {
2086
+ const childElm = children[i];
2087
+ if (typeof childElm.connectedCallback === 'function') {
2088
+ childElm.connectedCallback();
2089
+ }
2090
+ serverSideConnected(childElm);
2091
+ }
2092
+ }
2093
+ };
2094
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
2095
+ const setValue = (ref, propName, newVal, cmpMeta) => {
2096
+ // check our new property value against our internal value
2097
+ const hostRef = getHostRef(ref);
2098
+ const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
2099
+ const oldVal = hostRef.$instanceValues$.get(propName);
2100
+ const flags = hostRef.$flags$;
2101
+ const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2102
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
2103
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
2104
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
2105
+ const didValueChange = newVal !== oldVal && !areBothNaN;
2106
+ if ((!BUILD.lazyLoad || !(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
2107
+ // gadzooks! the property's value has changed!!
2108
+ // set our new value!
2109
+ hostRef.$instanceValues$.set(propName, newVal);
2110
+ if (BUILD.isDev) {
2111
+ if (hostRef.$flags$ & 1024 /* HOST_FLAGS.devOnRender */) {
2112
+ consoleDevWarn(`The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`, '\nElement', elm, '\nNew value', newVal, '\nOld value', oldVal);
2113
+ }
2114
+ else if (hostRef.$flags$ & 2048 /* HOST_FLAGS.devOnDidLoad */) {
2115
+ consoleDevWarn(`The state/prop "${propName}" changed during "componentDidLoad()", this triggers extra re-renders, try to setup on "componentWillLoad()"`, '\nElement', elm, '\nNew value', newVal, '\nOld value', oldVal);
2116
+ }
2117
+ }
2118
+ if (!BUILD.lazyLoad || instance) {
2119
+ // get an array of method names of watch functions to call
2120
+ if (BUILD.watchCallback && cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
2121
+ const watchMethods = cmpMeta.$watchers$[propName];
2122
+ if (watchMethods) {
2123
+ // this instance is watching for when this property changed
2124
+ watchMethods.map((watchMethodName) => {
2125
+ try {
2126
+ // fire off each of the watch methods that are watching this property
2127
+ instance[watchMethodName](newVal, oldVal, propName);
2128
+ }
2129
+ catch (e) {
2130
+ consoleError(e, elm);
2131
+ }
2132
+ });
2133
+ }
2134
+ }
2135
+ if (BUILD.updatable &&
2136
+ (flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
2137
+ if (BUILD.cmpShouldUpdate && instance.componentShouldUpdate) {
2138
+ if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
2139
+ return;
2140
+ }
2141
+ }
2142
+ // looks like this value actually changed, so we've got work to do!
2143
+ // but only if we've already rendered, otherwise just chill out
2144
+ // queue that we need to do an update, but don't worry about queuing
2145
+ // up millions cuz this function ensures it only runs once
2146
+ scheduleUpdate(hostRef, false);
2147
+ }
2148
+ }
2149
+ }
2150
+ };
2151
+ /**
2152
+ * Attach a series of runtime constructs to a compiled Stencil component
2153
+ * constructor, including getters and setters for the `@Prop` and `@State`
2154
+ * decorators, callbacks for when attributes change, and so on.
2155
+ *
2156
+ * @param Cstr the constructor for a component that we need to process
2157
+ * @param cmpMeta metadata collected previously about the component
2158
+ * @param flags a number used to store a series of bit flags
2159
+ * @returns a reference to the same constructor passed in (but now mutated)
2160
+ */
2161
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
2162
+ if (BUILD.member && cmpMeta.$members$) {
2163
+ if (BUILD.watchCallback && Cstr.watchers) {
2164
+ cmpMeta.$watchers$ = Cstr.watchers;
2165
+ }
2166
+ // It's better to have a const than two Object.entries()
2167
+ const members = Object.entries(cmpMeta.$members$);
2168
+ const prototype = Cstr.prototype;
2169
+ members.map(([memberName, [memberFlags]]) => {
2170
+ if ((BUILD.prop || BUILD.state) &&
2171
+ (memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
2172
+ ((!BUILD.lazyLoad || flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
2173
+ // proxyComponent - prop
2174
+ Object.defineProperty(prototype, memberName, {
2175
+ get() {
2176
+ // proxyComponent, get value
2177
+ return getValue(this, memberName);
2178
+ },
2179
+ set(newValue) {
2180
+ // only during dev time
2181
+ if (BUILD.isDev) {
2182
+ const ref = getHostRef(this);
2183
+ if (
2184
+ // we are proxying the instance (not element)
2185
+ (flags & 1 /* PROXY_FLAGS.isElementConstructor */) === 0 &&
2186
+ // the element is not constructing
2187
+ (ref.$flags$ & 8 /* HOST_FLAGS.isConstructingInstance */) === 0 &&
2188
+ // the member is a prop
2189
+ (memberFlags & 31 /* MEMBER_FLAGS.Prop */) !== 0 &&
2190
+ // the member is not mutable
2191
+ (memberFlags & 1024 /* MEMBER_FLAGS.Mutable */) === 0) {
2192
+ consoleDevWarn(`@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.\nMore information: https://stenciljs.com/docs/properties#prop-mutability`);
2193
+ }
2194
+ }
2195
+ // proxyComponent, set value
2196
+ setValue(this, memberName, newValue, cmpMeta);
2197
+ },
2198
+ configurable: true,
2199
+ enumerable: true,
2200
+ });
2201
+ }
2202
+ else if (BUILD.lazyLoad &&
2203
+ BUILD.method &&
2204
+ flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
2205
+ memberFlags & 64 /* MEMBER_FLAGS.Method */) {
2206
+ // proxyComponent - method
2207
+ Object.defineProperty(prototype, memberName, {
2208
+ value(...args) {
2209
+ const ref = getHostRef(this);
2210
+ return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
2211
+ },
2212
+ });
2213
+ }
2214
+ });
2215
+ if (BUILD.observeAttribute && (!BUILD.lazyLoad || flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
2216
+ const attrNameToPropName = new Map();
2217
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
2218
+ plt.jmp(() => {
2219
+ const propName = attrNameToPropName.get(attrName);
2220
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
2221
+ // in the case where an attribute was set inline.
2222
+ // ```html
2223
+ // <my-component some-attribute="some-value"></my-component>
2224
+ // ```
2225
+ //
2226
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
2227
+ // programmatically changes it before it has been upgraded as shown below:
2228
+ //
2229
+ // ```html
2230
+ // <!-- this component has _not_ been upgraded yet -->
2231
+ // <my-component id="test" some-attribute="some-value"></my-component>
2232
+ // <script>
2233
+ // // grab non-upgraded component
2234
+ // el = document.querySelector("#test");
2235
+ // el.someAttribute = "another-value";
2236
+ // // upgrade component
2237
+ // customElements.define('my-component', MyComponent);
2238
+ // </script>
2239
+ // ```
2240
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
2241
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
2242
+ // to the value that was set inline i.e. "some-value" from above example. When
2243
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
2244
+ //
2245
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
2246
+ // by connectedCallback as this attributeChangedCallback will not fire.
2247
+ //
2248
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
2249
+ //
2250
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
2251
+ // properties here given that this goes against best practices outlined here
2252
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
2253
+ if (this.hasOwnProperty(propName)) {
2254
+ newValue = this[propName];
2255
+ delete this[propName];
2256
+ }
2257
+ else if (prototype.hasOwnProperty(propName) &&
2258
+ typeof this[propName] === 'number' &&
2259
+ this[propName] == newValue) {
2260
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
2261
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
2262
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
2263
+ return;
2264
+ }
2265
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
2266
+ });
2267
+ };
2268
+ // create an array of attributes to observe
2269
+ // and also create a map of html attribute name to js property name
2270
+ Cstr.observedAttributes = members
2271
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
2272
+ .map(([propName, m]) => {
2273
+ const attrName = m[1] || propName;
2274
+ attrNameToPropName.set(attrName, propName);
2275
+ if (BUILD.reflect && m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
2276
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
2277
+ }
2278
+ return attrName;
2279
+ });
2280
+ }
2281
+ }
2282
+ return Cstr;
2283
+ };
2284
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
2285
+ // initializeComponent
2286
+ if ((BUILD.lazyLoad || BUILD.hydrateServerSide || BUILD.style) &&
2287
+ (hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
2288
+ if (BUILD.lazyLoad || BUILD.hydrateClientSide) {
2289
+ // we haven't initialized this element yet
2290
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
2291
+ // lazy loaded components
2292
+ // request the component's implementation to be
2293
+ // wired up with the host element
2294
+ Cstr = loadModule(cmpMeta, hostRef, hmrVersionId);
2295
+ if (Cstr.then) {
2296
+ // Await creates a micro-task avoid if possible
2297
+ const endLoad = uniqueTime(`st:load:${cmpMeta.$tagName$}:${hostRef.$modeName$}`, `[Stencil] Load module for <${cmpMeta.$tagName$}>`);
2298
+ Cstr = await Cstr;
2299
+ endLoad();
2300
+ }
2301
+ if ((BUILD.isDev || BUILD.isDebug) && !Cstr) {
2302
+ throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
2303
+ }
2304
+ if (BUILD.member && !Cstr.isProxied) {
2305
+ // we've never proxied this Constructor before
2306
+ // let's add the getters/setters to its prototype before
2307
+ // the first time we create an instance of the implementation
2308
+ if (BUILD.watchCallback) {
2309
+ cmpMeta.$watchers$ = Cstr.watchers;
2310
+ }
2311
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
2312
+ Cstr.isProxied = true;
2313
+ }
2314
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
2315
+ // ok, time to construct the instance
2316
+ // but let's keep track of when we start and stop
2317
+ // so that the getters/setters don't incorrectly step on data
2318
+ if (BUILD.member) {
2319
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
2320
+ }
2321
+ // construct the lazy-loaded component implementation
2322
+ // passing the hostRef is very important during
2323
+ // construction in order to directly wire together the
2324
+ // host element and the lazy-loaded instance
2325
+ try {
2326
+ new Cstr(hostRef);
2327
+ }
2328
+ catch (e) {
2329
+ consoleError(e);
2330
+ }
2331
+ if (BUILD.member) {
2332
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
2333
+ }
2334
+ if (BUILD.watchCallback) {
2335
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
2336
+ }
2337
+ endNewInstance();
2338
+ fireConnectedCallback(hostRef.$lazyInstance$);
2339
+ }
2340
+ else {
2341
+ // sync constructor component
2342
+ Cstr = elm.constructor;
2343
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
2344
+ // wait for the CustomElementRegistry to mark the component as ready before setting `isWatchReady`. Otherwise,
2345
+ // watchers may fire prematurely if `customElements.get()`/`customElements.whenDefined()` resolves _before_
2346
+ // Stencil has completed instantiating the component.
2347
+ customElements.whenDefined(cmpMeta.$tagName$).then(() => (hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */));
2348
+ }
2349
+ if (BUILD.style && Cstr.style) {
2350
+ // this component has styles but we haven't registered them yet
2351
+ let style = Cstr.style;
2352
+ if (BUILD.mode && typeof style !== 'string') {
2353
+ style = style[(hostRef.$modeName$ = computeMode(elm))];
2354
+ if (BUILD.hydrateServerSide && hostRef.$modeName$) {
2355
+ elm.setAttribute('s-mode', hostRef.$modeName$);
2356
+ }
2357
+ }
2358
+ const scopeId = getScopeId(cmpMeta, hostRef.$modeName$);
2359
+ if (!styles.has(scopeId)) {
2360
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
2361
+ if (!BUILD.hydrateServerSide &&
2362
+ BUILD.shadowDom &&
2363
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
2364
+ BUILD.shadowDomShim &&
2365
+ cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
2366
+ style = await Promise.resolve().then(function () { return require('./shadow-css-39dfcfae.js'); }).then((m) => m.scopeCss(style, scopeId, false));
2367
+ }
2368
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
2369
+ endRegisterStyles();
2370
+ }
2371
+ }
2372
+ }
2373
+ // we've successfully created a lazy instance
2374
+ const ancestorComponent = hostRef.$ancestorComponent$;
2375
+ const schedule = () => scheduleUpdate(hostRef, true);
2376
+ if (BUILD.asyncLoading && ancestorComponent && ancestorComponent['s-rc']) {
2377
+ // this is the initial load and this component it has an ancestor component
2378
+ // but the ancestor component has NOT fired its will update lifecycle yet
2379
+ // so let's just cool our jets and wait for the ancestor to continue first
2380
+ // this will get fired off when the ancestor component
2381
+ // finally gets around to rendering its lazy self
2382
+ // fire off the initial update
2383
+ ancestorComponent['s-rc'].push(schedule);
2384
+ }
2385
+ else {
2386
+ schedule();
2387
+ }
2388
+ };
2389
+ const fireConnectedCallback = (instance) => {
2390
+ if (BUILD.lazyLoad && BUILD.connectedCallback) {
2391
+ safeCall(instance, 'connectedCallback');
2392
+ }
2393
+ };
2394
+ const connectedCallback = (elm) => {
2395
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
2396
+ const hostRef = getHostRef(elm);
2397
+ const cmpMeta = hostRef.$cmpMeta$;
2398
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
2399
+ if (BUILD.hostListenerTargetParent) {
2400
+ // only run if we have listeners being attached to a parent
2401
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
2402
+ }
2403
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
2404
+ // first time this component has connected
2405
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
2406
+ let hostId;
2407
+ if (BUILD.hydrateClientSide) {
2408
+ hostId = elm.getAttribute(HYDRATE_ID);
2409
+ if (hostId) {
2410
+ if (BUILD.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2411
+ const scopeId = BUILD.mode
2412
+ ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute('s-mode'))
2413
+ : addStyle(elm.shadowRoot, cmpMeta);
2414
+ elm.classList.remove(scopeId + '-h', scopeId + '-s');
2415
+ }
2416
+ initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
2417
+ }
2418
+ }
2419
+ if (BUILD.slotRelocation && !hostId) {
2420
+ // initUpdate
2421
+ // if the slot polyfill is required we'll need to put some nodes
2422
+ // in here to act as original content anchors as we move nodes around
2423
+ // host element has been connected to the DOM
2424
+ if (BUILD.hydrateServerSide ||
2425
+ ((BUILD.slot || BUILD.shadowDom) &&
2426
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
2427
+ cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
2428
+ setContentReference(elm);
2429
+ }
2430
+ }
2431
+ if (BUILD.asyncLoading) {
2432
+ // find the first ancestor component (if there is one) and register
2433
+ // this component as one of the actively loading child components for its ancestor
2434
+ let ancestorComponent = elm;
2435
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
2436
+ // climb up the ancestors looking for the first
2437
+ // component that hasn't finished its lifecycle update yet
2438
+ if ((BUILD.hydrateClientSide &&
2439
+ ancestorComponent.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
2440
+ ancestorComponent.hasAttribute('s-id') &&
2441
+ ancestorComponent['s-p']) ||
2442
+ ancestorComponent['s-p']) {
2443
+ // we found this components first ancestor component
2444
+ // keep a reference to this component's ancestor component
2445
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
2446
+ break;
2447
+ }
2448
+ }
2449
+ }
2450
+ // Lazy properties
2451
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
2452
+ if (BUILD.prop && !BUILD.hydrateServerSide && cmpMeta.$members$) {
2453
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
2454
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
2455
+ const value = elm[memberName];
2456
+ delete elm[memberName];
2457
+ elm[memberName] = value;
2458
+ }
2459
+ });
2460
+ }
2461
+ if (BUILD.initializeNextTick) {
2462
+ // connectedCallback, taskQueue, initialLoad
2463
+ // angular sets attribute AFTER connectCallback
2464
+ // https://github.com/angular/angular/issues/18909
2465
+ // https://github.com/angular/angular/issues/19940
2466
+ nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
2467
+ }
2468
+ else {
2469
+ initializeComponent(elm, hostRef, cmpMeta);
2470
+ }
2471
+ }
2472
+ else {
2473
+ // not the first time this has connected
2474
+ // reattach any event listeners to the host
2475
+ // since they would have been removed when disconnected
2476
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
2477
+ // fire off connectedCallback() on component instance
2478
+ fireConnectedCallback(hostRef.$lazyInstance$);
2479
+ }
2480
+ endConnected();
2481
+ }
2482
+ };
2483
+ const setContentReference = (elm) => {
2484
+ // only required when we're NOT using native shadow dom (slot)
2485
+ // or this browser doesn't support native shadow dom
2486
+ // and this host element was NOT created with SSR
2487
+ // let's pick out the inner content for slot projection
2488
+ // create a node to represent where the original
2489
+ // content was first placed, which is useful later on
2490
+ const contentRefElm = (elm['s-cr'] = doc.createComment(BUILD.isDebug ? `content-ref (host=${elm.localName})` : ''));
2491
+ contentRefElm['s-cn'] = true;
2492
+ elm.insertBefore(contentRefElm, elm.firstChild);
2493
+ };
2494
+ const disconnectedCallback = (elm) => {
2495
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
2496
+ const hostRef = getHostRef(elm);
2497
+ const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2498
+ if (BUILD.hostListener) {
2499
+ if (hostRef.$rmListeners$) {
2500
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
2501
+ hostRef.$rmListeners$ = undefined;
2502
+ }
2503
+ }
2504
+ // clear CSS var-shim tracking
2505
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
2506
+ if (BUILD.cssVarShim && plt.$cssShim$) {
2507
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
2508
+ plt.$cssShim$.removeHost(elm);
2509
+ }
2510
+ if (BUILD.lazyLoad && BUILD.disconnectedCallback) {
2511
+ safeCall(instance, 'disconnectedCallback');
2512
+ }
2513
+ if (BUILD.cmpDidUnload) {
2514
+ safeCall(instance, 'componentDidUnload');
2515
+ }
2516
+ }
2517
+ };
2518
+ const defineCustomElement = (Cstr, compactMeta) => {
2519
+ customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
2520
+ };
2521
+ const proxyCustomElement = (Cstr, compactMeta) => {
2522
+ const cmpMeta = {
2523
+ $flags$: compactMeta[0],
2524
+ $tagName$: compactMeta[1],
2525
+ };
2526
+ if (BUILD.member) {
2527
+ cmpMeta.$members$ = compactMeta[2];
2528
+ }
2529
+ if (BUILD.hostListener) {
2530
+ cmpMeta.$listeners$ = compactMeta[3];
2531
+ }
2532
+ if (BUILD.watchCallback) {
2533
+ cmpMeta.$watchers$ = Cstr.$watchers$;
2534
+ }
2535
+ if (BUILD.reflect) {
2536
+ cmpMeta.$attrsToReflect$ = [];
2537
+ }
2538
+ if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2539
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
2540
+ cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
2541
+ }
2542
+ const originalConnectedCallback = Cstr.prototype.connectedCallback;
2543
+ const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
2544
+ Object.assign(Cstr.prototype, {
2545
+ __registerHost() {
2546
+ registerHost(this, cmpMeta);
2547
+ },
2548
+ connectedCallback() {
2549
+ connectedCallback(this);
2550
+ if (BUILD.connectedCallback && originalConnectedCallback) {
2551
+ originalConnectedCallback.call(this);
2552
+ }
2553
+ },
2554
+ disconnectedCallback() {
2555
+ disconnectedCallback(this);
2556
+ if (BUILD.disconnectedCallback && originalDisconnectedCallback) {
2557
+ originalDisconnectedCallback.call(this);
2558
+ }
2559
+ },
2560
+ __attachShadow() {
2561
+ if (supportsShadow) {
2562
+ if (BUILD.shadowDelegatesFocus) {
2563
+ this.attachShadow({
2564
+ mode: 'open',
2565
+ delegatesFocus: !!(cmpMeta.$flags$ & 16 /* CMP_FLAGS.shadowDelegatesFocus */),
2566
+ });
2567
+ }
2568
+ else {
2569
+ this.attachShadow({ mode: 'open' });
2570
+ }
2571
+ }
2572
+ else {
2573
+ this.shadowRoot = this;
2574
+ }
2575
+ },
2576
+ });
2577
+ Cstr.is = cmpMeta.$tagName$;
2578
+ return proxyComponent(Cstr, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */ | 2 /* PROXY_FLAGS.proxyState */);
2579
+ };
2580
+ const forceModeUpdate = (elm) => {
2581
+ if (BUILD.style && BUILD.mode && !BUILD.lazyLoad) {
2582
+ const mode = computeMode(elm);
2583
+ const hostRef = getHostRef(elm);
2584
+ if (hostRef.$modeName$ !== mode) {
2585
+ const cmpMeta = hostRef.$cmpMeta$;
2586
+ const oldScopeId = elm['s-sc'];
2587
+ const scopeId = getScopeId(cmpMeta, mode);
2588
+ const style = elm.constructor.style[mode];
2589
+ const flags = cmpMeta.$flags$;
2590
+ if (style) {
2591
+ if (!styles.has(scopeId)) {
2592
+ registerStyle(scopeId, style, !!(flags & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
2593
+ }
2594
+ hostRef.$modeName$ = mode;
2595
+ elm.classList.remove(oldScopeId + '-h', oldScopeId + '-s');
2596
+ attachStyles(hostRef);
2597
+ forceUpdate(elm);
2598
+ }
2599
+ }
2600
+ }
2601
+ };
2602
+ const patchCloneNode = (HostElementPrototype) => {
2603
+ const orgCloneNode = HostElementPrototype.cloneNode;
2604
+ HostElementPrototype.cloneNode = function (deep) {
2605
+ const srcNode = this;
2606
+ const isShadowDom = BUILD.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
2607
+ const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
2608
+ if (BUILD.slot && !isShadowDom && deep) {
2609
+ let i = 0;
2610
+ let slotted, nonStencilNode;
2611
+ const stencilPrivates = [
2612
+ 's-id',
2613
+ 's-cr',
2614
+ 's-lr',
2615
+ 's-rc',
2616
+ 's-sc',
2617
+ 's-p',
2618
+ 's-cn',
2619
+ 's-sr',
2620
+ 's-sn',
2621
+ 's-hn',
2622
+ 's-ol',
2623
+ 's-nr',
2624
+ 's-si',
2625
+ ];
2626
+ for (; i < srcNode.childNodes.length; i++) {
2627
+ slotted = srcNode.childNodes[i]['s-nr'];
2628
+ nonStencilNode = stencilPrivates.every((privateField) => !srcNode.childNodes[i][privateField]);
2629
+ if (slotted) {
2630
+ if (BUILD.appendChildSlotFix && clonedNode.__appendChild) {
2631
+ clonedNode.__appendChild(slotted.cloneNode(true));
2632
+ }
2633
+ else {
2634
+ clonedNode.appendChild(slotted.cloneNode(true));
2635
+ }
2636
+ }
2637
+ if (nonStencilNode) {
2638
+ clonedNode.appendChild(srcNode.childNodes[i].cloneNode(true));
2639
+ }
2640
+ }
2641
+ }
2642
+ return clonedNode;
2643
+ };
2644
+ };
2645
+ const patchSlotAppendChild = (HostElementPrototype) => {
2646
+ HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
2647
+ HostElementPrototype.appendChild = function (newChild) {
2648
+ const slotName = (newChild['s-sn'] = getSlotName(newChild));
2649
+ const slotNode = getHostSlotNode(this.childNodes, slotName);
2650
+ if (slotNode) {
2651
+ const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2652
+ const appendAfter = slotChildNodes[slotChildNodes.length - 1];
2653
+ return appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
2654
+ }
2655
+ return this.__appendChild(newChild);
2656
+ };
2657
+ };
2658
+ /**
2659
+ * Patches the text content of an unnamed slotted node inside a scoped component
2660
+ * @param hostElementPrototype the `Element` to be patched
2661
+ * @param cmpMeta component runtime metadata used to determine if the component should be patched or not
2662
+ */
2663
+ const patchTextContent = (hostElementPrototype, cmpMeta) => {
2664
+ if (BUILD.scoped && cmpMeta.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
2665
+ const descriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'textContent');
2666
+ Object.defineProperty(hostElementPrototype, '__textContent', descriptor);
2667
+ Object.defineProperty(hostElementPrototype, 'textContent', {
2668
+ get() {
2669
+ var _a;
2670
+ // get the 'default slot', which would be the first slot in a shadow tree (if we were using one), whose name is
2671
+ // the empty string
2672
+ const slotNode = getHostSlotNode(this.childNodes, '');
2673
+ // when a slot node is found, the textContent _may_ be found in the next sibling (text) node, depending on how
2674
+ // nodes were reordered during the vdom render. first try to get the text content from the sibling.
2675
+ if (((_a = slotNode === null || slotNode === void 0 ? void 0 : slotNode.nextSibling) === null || _a === void 0 ? void 0 : _a.nodeType) === 3 /* NODE_TYPES.TEXT_NODE */) {
2676
+ return slotNode.nextSibling.textContent;
2677
+ }
2678
+ else if (slotNode) {
2679
+ return slotNode.textContent;
2680
+ }
2681
+ else {
2682
+ // fallback to the original implementation
2683
+ return this.__textContent;
2684
+ }
2685
+ },
2686
+ set(value) {
2687
+ var _a;
2688
+ // get the 'default slot', which would be the first slot in a shadow tree (if we were using one), whose name is
2689
+ // the empty string
2690
+ const slotNode = getHostSlotNode(this.childNodes, '');
2691
+ // when a slot node is found, the textContent _may_ need to be placed in the next sibling (text) node,
2692
+ // depending on how nodes were reordered during the vdom render. first try to set the text content on the
2693
+ // sibling.
2694
+ if (((_a = slotNode === null || slotNode === void 0 ? void 0 : slotNode.nextSibling) === null || _a === void 0 ? void 0 : _a.nodeType) === 3 /* NODE_TYPES.TEXT_NODE */) {
2695
+ slotNode.nextSibling.textContent = value;
2696
+ }
2697
+ else if (slotNode) {
2698
+ slotNode.textContent = value;
2699
+ }
2700
+ else {
2701
+ // we couldn't find a slot, but that doesn't mean that there isn't one. if this check ran before the DOM
2702
+ // loaded, we could have missed it. check for a content reference element on the scoped component and insert
2703
+ // it there
2704
+ this.__textContent = value;
2705
+ const contentRefElm = this['s-cr'];
2706
+ if (contentRefElm) {
2707
+ this.insertBefore(contentRefElm, this.firstChild);
2708
+ }
2709
+ }
2710
+ },
2711
+ });
2712
+ }
2713
+ };
2714
+ const patchChildSlotNodes = (elm, cmpMeta) => {
2715
+ class FakeNodeList extends Array {
2716
+ item(n) {
2717
+ return this[n];
2718
+ }
2719
+ }
2720
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
2721
+ if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
2722
+ const childNodesFn = elm.__lookupGetter__('childNodes');
2723
+ Object.defineProperty(elm, 'children', {
2724
+ get() {
2725
+ return this.childNodes.map((n) => n.nodeType === 1);
2726
+ },
2727
+ });
2728
+ Object.defineProperty(elm, 'childElementCount', {
2729
+ get() {
2730
+ return elm.children.length;
2731
+ },
2732
+ });
2733
+ Object.defineProperty(elm, 'childNodes', {
2734
+ get() {
2735
+ const childNodes = childNodesFn.call(this);
2736
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0 &&
2737
+ getHostRef(this).$flags$ & 2 /* HOST_FLAGS.hasRendered */) {
2738
+ const result = new FakeNodeList();
2739
+ for (let i = 0; i < childNodes.length; i++) {
2740
+ const slot = childNodes[i]['s-nr'];
2741
+ if (slot) {
2742
+ result.push(slot);
2743
+ }
2744
+ }
2745
+ return result;
2746
+ }
2747
+ return FakeNodeList.from(childNodes);
2748
+ },
2749
+ });
2750
+ }
2751
+ };
2752
+ const getSlotName = (node) => node['s-sn'] || (node.nodeType === 1 && node.getAttribute('slot')) || '';
2753
+ /**
2754
+ * Recursively searches a series of child nodes for a slot with the provided name.
2755
+ * @param childNodes the nodes to search for a slot with a specific name.
2756
+ * @param slotName the name of the slot to match on.
2757
+ * @returns a reference to the slot node that matches the provided name, `null` otherwise
2758
+ */
2759
+ const getHostSlotNode = (childNodes, slotName) => {
2760
+ let i = 0;
2761
+ let childNode;
2762
+ for (; i < childNodes.length; i++) {
2763
+ childNode = childNodes[i];
2764
+ if (childNode['s-sr'] && childNode['s-sn'] === slotName) {
2765
+ return childNode;
2766
+ }
2767
+ childNode = getHostSlotNode(childNode.childNodes, slotName);
2768
+ if (childNode) {
2769
+ return childNode;
2770
+ }
2771
+ }
2772
+ return null;
2773
+ };
2774
+ const getHostSlotChildNodes = (n, slotName) => {
2775
+ const childNodes = [n];
2776
+ while ((n = n.nextSibling) && n['s-sn'] === slotName) {
2777
+ childNodes.push(n);
2778
+ }
2779
+ return childNodes;
2780
+ };
2781
+ const hmrStart = (elm, cmpMeta, hmrVersionId) => {
2782
+ // ¯\_(ツ)_/¯
2783
+ const hostRef = getHostRef(elm);
2784
+ // reset state flags to only have been connected
2785
+ hostRef.$flags$ = 1 /* HOST_FLAGS.hasConnected */;
2786
+ // TODO
2787
+ // detatch any event listeners that may have been added
2788
+ // because we're not passing an exact event name it'll
2789
+ // remove all of this element's event, which is good
2790
+ // create a callback for when this component finishes hmr
2791
+ elm['s-hmr-load'] = () => {
2792
+ // finished hmr for this element
2793
+ delete elm['s-hmr-load'];
2794
+ };
2795
+ // re-initialize the component
2796
+ initializeComponent(elm, hostRef, cmpMeta, hmrVersionId);
2797
+ };
2798
+ const bootstrapLazy = (lazyBundles, options = {}) => {
2799
+ var _a;
2800
+ if (BUILD.profile && performance.mark) {
2801
+ performance.mark('st:app:start');
2802
+ }
2803
+ installDevTools();
2804
+ const endBootstrap = createTime('bootstrapLazy');
2805
+ const cmpTags = [];
2806
+ const exclude = options.exclude || [];
2807
+ const customElements = win.customElements;
2808
+ const head = doc.head;
2809
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
2810
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
2811
+ const deferredConnectedCallbacks = [];
2812
+ const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2813
+ let appLoadFallback;
2814
+ let isBootstrapping = true;
2815
+ let i = 0;
2816
+ Object.assign(plt, options);
2817
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
2818
+ if (BUILD.asyncQueue) {
2819
+ if (options.syncQueue) {
2820
+ plt.$flags$ |= 4 /* PLATFORM_FLAGS.queueSync */;
2821
+ }
2822
+ }
2823
+ if (BUILD.hydrateClientSide) {
2824
+ // If the app is already hydrated there is not point to disable the
2825
+ // async queue. This will improve the first input delay
2826
+ plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
2827
+ }
2828
+ if (BUILD.hydrateClientSide && BUILD.shadowDom) {
2829
+ for (; i < styles.length; i++) {
2830
+ registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
2831
+ }
2832
+ }
2833
+ lazyBundles.map((lazyBundle) => {
2834
+ lazyBundle[1].map((compactMeta) => {
2835
+ const cmpMeta = {
2836
+ $flags$: compactMeta[0],
2837
+ $tagName$: compactMeta[1],
2838
+ $members$: compactMeta[2],
2839
+ $listeners$: compactMeta[3],
2840
+ };
2841
+ if (BUILD.member) {
2842
+ cmpMeta.$members$ = compactMeta[2];
2843
+ }
2844
+ if (BUILD.hostListener) {
2845
+ cmpMeta.$listeners$ = compactMeta[3];
2846
+ }
2847
+ if (BUILD.reflect) {
2848
+ cmpMeta.$attrsToReflect$ = [];
2849
+ }
2850
+ if (BUILD.watchCallback) {
2851
+ cmpMeta.$watchers$ = {};
2852
+ }
2853
+ if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2854
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
2855
+ cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
2856
+ }
2857
+ const tagName = BUILD.transformTagName && options.transformTagName
2858
+ ? options.transformTagName(cmpMeta.$tagName$)
2859
+ : cmpMeta.$tagName$;
2860
+ const HostElement = class extends HTMLElement {
2861
+ // StencilLazyHost
2862
+ constructor(self) {
2863
+ // @ts-ignore
2864
+ super(self);
2865
+ self = this;
2866
+ registerHost(self, cmpMeta);
2867
+ if (BUILD.shadowDom && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2868
+ // this component is using shadow dom
2869
+ // and this browser supports shadow dom
2870
+ // add the read-only property "shadowRoot" to the host element
2871
+ // adding the shadow root build conditionals to minimize runtime
2872
+ if (supportsShadow) {
2873
+ if (BUILD.shadowDelegatesFocus) {
2874
+ self.attachShadow({
2875
+ mode: 'open',
2876
+ delegatesFocus: !!(cmpMeta.$flags$ & 16 /* CMP_FLAGS.shadowDelegatesFocus */),
2877
+ });
2878
+ }
2879
+ else {
2880
+ self.attachShadow({ mode: 'open' });
2881
+ }
2882
+ }
2883
+ else if (!BUILD.hydrateServerSide && !('shadowRoot' in self)) {
2884
+ self.shadowRoot = self;
2885
+ }
2886
+ }
2887
+ if (BUILD.slotChildNodesFix) {
2888
+ patchChildSlotNodes(self, cmpMeta);
2889
+ }
2890
+ }
2891
+ connectedCallback() {
2892
+ if (appLoadFallback) {
2893
+ clearTimeout(appLoadFallback);
2894
+ appLoadFallback = null;
2895
+ }
2896
+ if (isBootstrapping) {
2897
+ // connectedCallback will be processed once all components have been registered
2898
+ deferredConnectedCallbacks.push(this);
2899
+ }
2900
+ else {
2901
+ plt.jmp(() => connectedCallback(this));
2902
+ }
2903
+ }
2904
+ disconnectedCallback() {
2905
+ plt.jmp(() => disconnectedCallback(this));
2906
+ }
2907
+ componentOnReady() {
2908
+ return getHostRef(this).$onReadyPromise$;
2909
+ }
2910
+ };
2911
+ if (BUILD.cloneNodeFix) {
2912
+ patchCloneNode(HostElement.prototype);
2913
+ }
2914
+ if (BUILD.appendChildSlotFix) {
2915
+ patchSlotAppendChild(HostElement.prototype);
2916
+ }
2917
+ if (BUILD.hotModuleReplacement) {
2918
+ HostElement.prototype['s-hmr'] = function (hmrVersionId) {
2919
+ hmrStart(this, cmpMeta, hmrVersionId);
2920
+ };
2921
+ }
2922
+ if (BUILD.scopedSlotTextContentFix) {
2923
+ patchTextContent(HostElement.prototype, cmpMeta);
2924
+ }
2925
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
2926
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
2927
+ cmpTags.push(tagName);
2928
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
2929
+ }
2930
+ });
2931
+ });
2932
+ if (BUILD.invisiblePrehydration && (BUILD.hydratedClass || BUILD.hydratedAttribute)) {
2933
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
2934
+ visibilityStyle.setAttribute('data-styles', '');
2935
+ // Apply CSP nonce to the style tag if it exists
2936
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
2937
+ if (nonce != null) {
2938
+ visibilityStyle.setAttribute('nonce', nonce);
2939
+ }
2940
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
2941
+ }
2942
+ // Process deferred connectedCallbacks now all components have been registered
2943
+ isBootstrapping = false;
2944
+ if (deferredConnectedCallbacks.length) {
2945
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
2946
+ }
2947
+ else {
2948
+ if (BUILD.profile) {
2949
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30, 'timeout')));
2950
+ }
2951
+ else {
2952
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
2953
+ }
2954
+ }
2955
+ // Fallback appLoad event
2956
+ endBootstrap();
2957
+ };
2958
+ const getConnect = (_ref, tagName) => {
2959
+ const componentOnReady = () => {
2960
+ let elm = doc.querySelector(tagName);
2961
+ if (!elm) {
2962
+ elm = doc.createElement(tagName);
2963
+ doc.body.appendChild(elm);
2964
+ }
2965
+ return typeof elm.componentOnReady === 'function' ? elm.componentOnReady() : Promise.resolve(elm);
2966
+ };
2967
+ const create = (...args) => {
2968
+ return componentOnReady().then((el) => el.create(...args));
2969
+ };
2970
+ return {
2971
+ create,
2972
+ componentOnReady,
2973
+ };
2974
+ };
2975
+ const getContext = (_elm, context) => {
2976
+ if (context in Context) {
2977
+ return Context[context];
2978
+ }
2979
+ else if (context === 'window') {
2980
+ return win;
2981
+ }
2982
+ else if (context === 'document') {
2983
+ return doc;
2984
+ }
2985
+ else if (context === 'isServer' || context === 'isPrerender') {
2986
+ return BUILD.hydrateServerSide ? true : false;
2987
+ }
2988
+ else if (context === 'isClient') {
2989
+ return BUILD.hydrateServerSide ? false : true;
2990
+ }
2991
+ else if (context === 'resourcesUrl' || context === 'publicPath') {
2992
+ return getAssetPath('.');
2993
+ }
2994
+ else if (context === 'queue') {
2995
+ return {
2996
+ write: writeTask,
2997
+ read: readTask,
2998
+ tick: {
2999
+ then(cb) {
3000
+ return nextTick(cb);
3001
+ },
3002
+ },
3003
+ };
3004
+ }
3005
+ return undefined;
3006
+ };
3007
+ const Fragment = (_, children) => children;
3008
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
3009
+ if (BUILD.hostListener && listeners) {
3010
+ // this is called immediately within the element's constructor
3011
+ // initialize our event listeners on the host element
3012
+ // we do this now so that we can listen to events that may
3013
+ // have fired even before the instance is ready
3014
+ if (BUILD.hostListenerTargetParent) {
3015
+ // this component may have event listeners that should be attached to the parent
3016
+ if (attachParentListeners) {
3017
+ // this is being ran from within the connectedCallback
3018
+ // which is important so that we know the host element actually has a parent element
3019
+ // filter out the listeners to only have the ones that ARE being attached to the parent
3020
+ listeners = listeners.filter(([flags]) => flags & 32 /* LISTENER_FLAGS.TargetParent */);
3021
+ }
3022
+ else {
3023
+ // this is being ran from within the component constructor
3024
+ // everything BUT the parent element listeners should be attached at this time
3025
+ // filter out the listeners that are NOT being attached to the parent
3026
+ listeners = listeners.filter(([flags]) => !(flags & 32 /* LISTENER_FLAGS.TargetParent */));
3027
+ }
3028
+ }
3029
+ listeners.map(([flags, name, method]) => {
3030
+ const target = BUILD.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
3031
+ const handler = hostListenerProxy(hostRef, method);
3032
+ const opts = hostListenerOpts(flags);
3033
+ plt.ael(target, name, handler, opts);
3034
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
3035
+ });
3036
+ }
3037
+ };
3038
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
3039
+ try {
3040
+ if (BUILD.lazyLoad) {
3041
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
3042
+ // instance is ready, let's call it's member method for this event
3043
+ hostRef.$lazyInstance$[methodName](ev);
3044
+ }
3045
+ else {
3046
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
3047
+ }
3048
+ }
3049
+ else {
3050
+ hostRef.$hostElement$[methodName](ev);
3051
+ }
3052
+ }
3053
+ catch (e) {
3054
+ consoleError(e);
3055
+ }
3056
+ };
3057
+ const getHostListenerTarget = (elm, flags) => {
3058
+ if (BUILD.hostListenerTargetDocument && flags & 4 /* LISTENER_FLAGS.TargetDocument */)
3059
+ return doc;
3060
+ if (BUILD.hostListenerTargetWindow && flags & 8 /* LISTENER_FLAGS.TargetWindow */)
3061
+ return win;
3062
+ if (BUILD.hostListenerTargetBody && flags & 16 /* LISTENER_FLAGS.TargetBody */)
3063
+ return doc.body;
3064
+ if (BUILD.hostListenerTargetParent && flags & 32 /* LISTENER_FLAGS.TargetParent */)
3065
+ return elm.parentElement;
3066
+ return elm;
3067
+ };
3068
+ // prettier-ignore
3069
+ const hostListenerOpts = (flags) => supportsListenerOptions
3070
+ ? ({
3071
+ passive: (flags & 1 /* LISTENER_FLAGS.Passive */) !== 0,
3072
+ capture: (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0,
3073
+ })
3074
+ : (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
3075
+ /**
3076
+ * Assigns the given value to the nonce property on the runtime platform object.
3077
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
3078
+ * @param nonce The value to be assigned to the platform nonce property.
3079
+ * @returns void
3080
+ */
3081
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
3082
+ const setPlatformOptions = (opts) => Object.assign(plt, opts);
3083
+ const insertVdomAnnotations = (doc, staticComponents) => {
3084
+ if (doc != null) {
3085
+ const docData = {
3086
+ hostIds: 0,
3087
+ rootLevelIds: 0,
3088
+ staticComponents: new Set(staticComponents),
3089
+ };
3090
+ const orgLocationNodes = [];
3091
+ parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
3092
+ orgLocationNodes.forEach((orgLocationNode) => {
3093
+ if (orgLocationNode != null) {
3094
+ const nodeRef = orgLocationNode['s-nr'];
3095
+ let hostId = nodeRef['s-host-id'];
3096
+ let nodeId = nodeRef['s-node-id'];
3097
+ let childId = `${hostId}.${nodeId}`;
3098
+ if (hostId == null) {
3099
+ hostId = 0;
3100
+ docData.rootLevelIds++;
3101
+ nodeId = docData.rootLevelIds;
3102
+ childId = `${hostId}.${nodeId}`;
3103
+ if (nodeRef.nodeType === 1 /* NODE_TYPE.ElementNode */) {
3104
+ nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
3105
+ }
3106
+ else if (nodeRef.nodeType === 3 /* NODE_TYPE.TextNode */) {
3107
+ if (hostId === 0) {
3108
+ const textContent = nodeRef.nodeValue.trim();
3109
+ if (textContent === '') {
3110
+ // useless whitespace node at the document root
3111
+ orgLocationNode.remove();
3112
+ return;
3113
+ }
3114
+ }
3115
+ const commentBeforeTextNode = doc.createComment(childId);
3116
+ commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
3117
+ nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
3118
+ }
3119
+ }
3120
+ let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
3121
+ const orgLocationParentNode = orgLocationNode.parentElement;
3122
+ if (orgLocationParentNode) {
3123
+ if (orgLocationParentNode['s-en'] === '') {
3124
+ // ending with a "." means that the parent element
3125
+ // of this node's original location is a SHADOW dom element
3126
+ // and this node is apart of the root level light dom
3127
+ orgLocationNodeId += `.`;
3128
+ }
3129
+ else if (orgLocationParentNode['s-en'] === 'c') {
3130
+ // ending with a ".c" means that the parent element
3131
+ // of this node's original location is a SCOPED element
3132
+ // and this node is apart of the root level light dom
3133
+ orgLocationNodeId += `.c`;
3134
+ }
3135
+ }
3136
+ orgLocationNode.nodeValue = orgLocationNodeId;
3137
+ }
3138
+ });
3139
+ }
3140
+ };
3141
+ const parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
3142
+ if (node == null) {
3143
+ return;
3144
+ }
3145
+ if (node['s-nr'] != null) {
3146
+ orgLocationNodes.push(node);
3147
+ }
3148
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
3149
+ node.childNodes.forEach((childNode) => {
3150
+ const hostRef = getHostRef(childNode);
3151
+ if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) {
3152
+ const cmpData = {
3153
+ nodeIds: 0,
3154
+ };
3155
+ insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData);
3156
+ }
3157
+ parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
3158
+ });
3159
+ }
3160
+ };
3161
+ const insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
3162
+ if (vnode != null) {
3163
+ const hostId = ++docData.hostIds;
3164
+ hostElm.setAttribute(HYDRATE_ID, hostId);
3165
+ if (hostElm['s-cr'] != null) {
3166
+ hostElm['s-cr'].nodeValue = `${CONTENT_REF_ID}.${hostId}`;
3167
+ }
3168
+ if (vnode.$children$ != null) {
3169
+ const depth = 0;
3170
+ vnode.$children$.forEach((vnodeChild, index) => {
3171
+ insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
3172
+ });
3173
+ }
3174
+ if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute('c-id')) {
3175
+ const parent = hostElm.parentElement;
3176
+ if (parent && parent.childNodes) {
3177
+ const parentChildNodes = Array.from(parent.childNodes);
3178
+ const comment = parentChildNodes.find((node) => node.nodeType === 8 /* NODE_TYPE.CommentNode */ && node['s-sr']);
3179
+ if (comment) {
3180
+ const index = parentChildNodes.indexOf(hostElm) - 1;
3181
+ vnode.$elm$.setAttribute(HYDRATE_CHILD_ID, `${comment['s-host-id']}.${comment['s-node-id']}.0.${index}`);
3182
+ }
3183
+ }
3184
+ }
3185
+ }
3186
+ };
3187
+ const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
3188
+ const childElm = vnodeChild.$elm$;
3189
+ if (childElm == null) {
3190
+ return;
3191
+ }
3192
+ const nodeId = cmpData.nodeIds++;
3193
+ const childId = `${hostId}.${nodeId}.${depth}.${index}`;
3194
+ childElm['s-host-id'] = hostId;
3195
+ childElm['s-node-id'] = nodeId;
3196
+ if (childElm.nodeType === 1 /* NODE_TYPE.ElementNode */) {
3197
+ childElm.setAttribute(HYDRATE_CHILD_ID, childId);
3198
+ }
3199
+ else if (childElm.nodeType === 3 /* NODE_TYPE.TextNode */) {
3200
+ const parentNode = childElm.parentNode;
3201
+ const nodeName = parentNode.nodeName;
3202
+ if (nodeName !== 'STYLE' && nodeName !== 'SCRIPT') {
3203
+ const textNodeId = `${TEXT_NODE_ID}.${childId}`;
3204
+ const commentBeforeTextNode = doc.createComment(textNodeId);
3205
+ parentNode.insertBefore(commentBeforeTextNode, childElm);
3206
+ }
3207
+ }
3208
+ else if (childElm.nodeType === 8 /* NODE_TYPE.CommentNode */) {
3209
+ if (childElm['s-sr']) {
3210
+ const slotName = childElm['s-sn'] || '';
3211
+ const slotNodeId = `${SLOT_NODE_ID}.${childId}.${slotName}`;
3212
+ childElm.nodeValue = slotNodeId;
3213
+ }
3214
+ }
3215
+ if (vnodeChild.$children$ != null) {
3216
+ const childDepth = depth + 1;
3217
+ vnodeChild.$children$.forEach((vnode, index) => {
3218
+ insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, index);
3219
+ });
3220
+ }
3221
+ };
3222
+ const hostRefs = /*@__PURE__*/ new WeakMap();
3223
+ const getHostRef = (ref) => hostRefs.get(ref);
3224
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
3225
+ const registerHost = (elm, cmpMeta) => {
3226
+ const hostRef = {
3227
+ $flags$: 0,
3228
+ $hostElement$: elm,
3229
+ $cmpMeta$: cmpMeta,
3230
+ $instanceValues$: new Map(),
3231
+ };
3232
+ if (BUILD.isDev) {
3233
+ hostRef.$renderCount$ = 0;
3234
+ }
3235
+ if (BUILD.method && BUILD.lazyLoad) {
3236
+ hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
3237
+ }
3238
+ if (BUILD.asyncLoading) {
3239
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
3240
+ elm['s-p'] = [];
3241
+ elm['s-rc'] = [];
3242
+ }
3243
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
3244
+ return hostRefs.set(elm, hostRef);
3245
+ };
3246
+ const isMemberInElement = (elm, memberName) => memberName in elm;
3247
+ const consoleError = (e, el) => (customError || console.error)(e, el);
3248
+ const STENCIL_DEV_MODE = BUILD.isTesting
3249
+ ? ['STENCIL:'] // E2E testing
3250
+ : [
3251
+ '%cstencil',
3252
+ 'color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px',
3253
+ ];
3254
+ const consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
3255
+ const consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
3256
+ const consoleDevInfo = (...m) => console.info(...STENCIL_DEV_MODE, ...m);
3257
+ const setErrorHandler = (handler) => (customError = handler);
3258
+ const cmpModules = /*@__PURE__*/ new Map();
3259
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
3260
+ // loadModuleImport
3261
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
3262
+ const bundleId = cmpMeta.$lazyBundleId$;
3263
+ if (BUILD.isDev && typeof bundleId !== 'string') {
3264
+ consoleDevError(`Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`);
3265
+ return undefined;
3266
+ }
3267
+ const module = !BUILD.hotModuleReplacement ? cmpModules.get(bundleId) : false;
3268
+ if (module) {
3269
+ return module[exportName];
3270
+ }
3271
+
3272
+ if (!hmrVersionId || !BUILD.hotModuleReplacement) {
3273
+ const processMod = importedModule => {
3274
+ cmpModules.set(bundleId, importedModule);
3275
+ return importedModule[exportName];
3276
+ }
3277
+ switch(bundleId) {
3278
+
3279
+ case 'xpl-application-shell.cjs':
3280
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3281
+ /* webpackMode: "lazy" */
3282
+ './xpl-application-shell.cjs.entry.js')); }).then(processMod, consoleError);
3283
+ case 'xpl-breadcrumb-item.cjs':
3284
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3285
+ /* webpackMode: "lazy" */
3286
+ './xpl-breadcrumb-item.cjs.entry.js')); }).then(processMod, consoleError);
3287
+ case 'xpl-breadcrumbs.cjs':
3288
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3289
+ /* webpackMode: "lazy" */
3290
+ './xpl-breadcrumbs.cjs.entry.js')); }).then(processMod, consoleError);
3291
+ case 'xpl-button-row.cjs':
3292
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3293
+ /* webpackMode: "lazy" */
3294
+ './xpl-button-row.cjs.entry.js')); }).then(processMod, consoleError);
3295
+ case 'xpl-choicelist.cjs':
3296
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3297
+ /* webpackMode: "lazy" */
3298
+ './xpl-choicelist.cjs.entry.js')); }).then(processMod, consoleError);
3299
+ case 'xpl-content-area.cjs':
3300
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3301
+ /* webpackMode: "lazy" */
3302
+ './xpl-content-area.cjs.entry.js')); }).then(processMod, consoleError);
3303
+ case 'xpl-divider.cjs':
3304
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3305
+ /* webpackMode: "lazy" */
3306
+ './xpl-divider.cjs.entry.js')); }).then(processMod, consoleError);
3307
+ case 'xpl-grid.cjs':
3308
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3309
+ /* webpackMode: "lazy" */
3310
+ './xpl-grid.cjs.entry.js')); }).then(processMod, consoleError);
3311
+ case 'xpl-grid-item.cjs':
3312
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3313
+ /* webpackMode: "lazy" */
3314
+ './xpl-grid-item.cjs.entry.js')); }).then(processMod, consoleError);
3315
+ case 'xpl-input.cjs':
3316
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3317
+ /* webpackMode: "lazy" */
3318
+ './xpl-input.cjs.entry.js')); }).then(processMod, consoleError);
3319
+ case 'xpl-list.cjs':
3320
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3321
+ /* webpackMode: "lazy" */
3322
+ './xpl-list.cjs.entry.js')); }).then(processMod, consoleError);
3323
+ case 'xpl-main-nav.cjs':
3324
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3325
+ /* webpackMode: "lazy" */
3326
+ './xpl-main-nav.cjs.entry.js')); }).then(processMod, consoleError);
3327
+ case 'xpl-nav-item.cjs':
3328
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3329
+ /* webpackMode: "lazy" */
3330
+ './xpl-nav-item.cjs.entry.js')); }).then(processMod, consoleError);
3331
+ case 'xpl-pagination.cjs':
3332
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3333
+ /* webpackMode: "lazy" */
3334
+ './xpl-pagination.cjs.entry.js')); }).then(processMod, consoleError);
3335
+ case 'xpl-secondary-nav.cjs':
3336
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3337
+ /* webpackMode: "lazy" */
3338
+ './xpl-secondary-nav.cjs.entry.js')); }).then(processMod, consoleError);
3339
+ case 'xpl-select.cjs':
3340
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3341
+ /* webpackMode: "lazy" */
3342
+ './xpl-select.cjs.entry.js')); }).then(processMod, consoleError);
3343
+ case 'xpl-table.cjs':
3344
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3345
+ /* webpackMode: "lazy" */
3346
+ './xpl-table.cjs.entry.js')); }).then(processMod, consoleError);
3347
+ case 'xpl-toggle.cjs':
3348
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3349
+ /* webpackMode: "lazy" */
3350
+ './xpl-toggle.cjs.entry.js')); }).then(processMod, consoleError);
3351
+ case 'xpl-utility-bar.cjs':
3352
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3353
+ /* webpackMode: "lazy" */
3354
+ './xpl-utility-bar.cjs.entry.js')); }).then(processMod, consoleError);
3355
+ case 'xpl-avatar.cjs':
3356
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3357
+ /* webpackMode: "lazy" */
3358
+ './xpl-avatar.cjs.entry.js')); }).then(processMod, consoleError);
3359
+ case 'xpl-backdrop.cjs':
3360
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3361
+ /* webpackMode: "lazy" */
3362
+ './xpl-backdrop.cjs.entry.js')); }).then(processMod, consoleError);
3363
+ case 'xpl-badge.cjs':
3364
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3365
+ /* webpackMode: "lazy" */
3366
+ './xpl-badge.cjs.entry.js')); }).then(processMod, consoleError);
3367
+ case 'xpl-button.cjs':
3368
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3369
+ /* webpackMode: "lazy" */
3370
+ './xpl-button.cjs.entry.js')); }).then(processMod, consoleError);
3371
+ case 'xpl-checkbox.cjs':
3372
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3373
+ /* webpackMode: "lazy" */
3374
+ './xpl-checkbox.cjs.entry.js')); }).then(processMod, consoleError);
3375
+ case 'xpl-dropdown.cjs':
3376
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3377
+ /* webpackMode: "lazy" */
3378
+ './xpl-dropdown.cjs.entry.js')); }).then(processMod, consoleError);
3379
+ case 'xpl-radio.cjs':
3380
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3381
+ /* webpackMode: "lazy" */
3382
+ './xpl-radio.cjs.entry.js')); }).then(processMod, consoleError);
3383
+ case 'xpl-tag.cjs':
3384
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3385
+ /* webpackMode: "lazy" */
3386
+ './xpl-tag.cjs.entry.js')); }).then(processMod, consoleError);
3387
+ case 'xpl-dropdown-group.cjs':
3388
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3389
+ /* webpackMode: "lazy" */
3390
+ './xpl-dropdown-group.cjs.entry.js')); }).then(processMod, consoleError);
3391
+ case 'xpl-dropdown-heading.cjs':
3392
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3393
+ /* webpackMode: "lazy" */
3394
+ './xpl-dropdown-heading.cjs.entry.js')); }).then(processMod, consoleError);
3395
+ case 'xpl-dropdown-option.cjs':
3396
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3397
+ /* webpackMode: "lazy" */
3398
+ './xpl-dropdown-option.cjs.entry.js')); }).then(processMod, consoleError);
3399
+ }
3400
+ }
3401
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
3402
+ /* @vite-ignore */
3403
+ /* webpackInclude: /\.entry\.js$/ */
3404
+ /* webpackExclude: /\.system\.entry\.js$/ */
3405
+ /* webpackMode: "lazy" */
3406
+ `./${bundleId}.entry.js${BUILD.hotModuleReplacement && hmrVersionId ? '?s-hmr=' + hmrVersionId : ''}`)); }).then((importedModule) => {
3407
+ if (!BUILD.hotModuleReplacement) {
3408
+ cmpModules.set(bundleId, importedModule);
3409
+ }
3410
+ return importedModule[exportName];
3411
+ }, consoleError);
3412
+ };
3413
+ const styles = /*@__PURE__*/ new Map();
3414
+ const modeResolutionChain = [];
3415
+ const win = typeof window !== 'undefined' ? window : {};
3416
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
3417
+ const CSS = BUILD.cssVarShim ? win.CSS : null;
3418
+ const doc = win.document || { head: {} };
3419
+ const H = (win.HTMLElement || class {
3420
+ });
3421
+ const plt = {
3422
+ $flags$: 0,
3423
+ $resourcesUrl$: '',
3424
+ jmp: (h) => h(),
3425
+ raf: (h) => requestAnimationFrame(h),
3426
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
3427
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
3428
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
3429
+ };
3430
+ const setPlatformHelpers = (helpers) => {
3431
+ Object.assign(plt, helpers);
3432
+ };
3433
+ const supportsShadow =
3434
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
3435
+ BUILD.shadowDomShim && BUILD.shadowDom
3436
+ ? /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
3437
+ : true;
3438
+ const supportsListenerOptions = /*@__PURE__*/ (() => {
3439
+ let supportsListenerOptions = false;
3440
+ try {
3441
+ doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
3442
+ get() {
3443
+ supportsListenerOptions = true;
3444
+ },
3445
+ }));
3446
+ }
3447
+ catch (e) { }
3448
+ return supportsListenerOptions;
3449
+ })();
3450
+ const promiseResolve = (v) => Promise.resolve(v);
3451
+ const supportsConstructableStylesheets = BUILD.constructableCSS
3452
+ ? /*@__PURE__*/ (() => {
3453
+ try {
3454
+ new CSSStyleSheet();
3455
+ return typeof new CSSStyleSheet().replaceSync === 'function';
3456
+ }
3457
+ catch (e) { }
3458
+ return false;
3459
+ })()
3460
+ : false;
3461
+ const queueDomReads = [];
3462
+ const queueDomWrites = [];
3463
+ const queueDomWritesLow = [];
3464
+ const queueTask = (queue, write) => (cb) => {
3465
+ queue.push(cb);
3466
+ if (!queuePending) {
3467
+ queuePending = true;
3468
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
3469
+ nextTick(flush);
3470
+ }
3471
+ else {
3472
+ plt.raf(flush);
3473
+ }
3474
+ }
3475
+ };
3476
+ const consume = (queue) => {
3477
+ for (let i = 0; i < queue.length; i++) {
3478
+ try {
3479
+ queue[i](performance.now());
3480
+ }
3481
+ catch (e) {
3482
+ consoleError(e);
3483
+ }
3484
+ }
3485
+ queue.length = 0;
3486
+ };
3487
+ const consumeTimeout = (queue, timeout) => {
3488
+ let i = 0;
3489
+ let ts = 0;
3490
+ while (i < queue.length && (ts = performance.now()) < timeout) {
3491
+ try {
3492
+ queue[i++](ts);
3493
+ }
3494
+ catch (e) {
3495
+ consoleError(e);
3496
+ }
3497
+ }
3498
+ if (i === queue.length) {
3499
+ queue.length = 0;
3500
+ }
3501
+ else if (i !== 0) {
3502
+ queue.splice(0, i);
3503
+ }
3504
+ };
3505
+ const flush = () => {
3506
+ if (BUILD.asyncQueue) {
3507
+ queueCongestion++;
3508
+ }
3509
+ // always force a bunch of medium callbacks to run, but still have
3510
+ // a throttle on how many can run in a certain time
3511
+ // DOM READS!!!
3512
+ consume(queueDomReads);
3513
+ // DOM WRITES!!!
3514
+ if (BUILD.asyncQueue) {
3515
+ const timeout = (plt.$flags$ & 6 /* PLATFORM_FLAGS.queueMask */) === 2 /* PLATFORM_FLAGS.appLoaded */
3516
+ ? performance.now() + 14 * Math.ceil(queueCongestion * (1.0 / 10.0))
3517
+ : Infinity;
3518
+ consumeTimeout(queueDomWrites, timeout);
3519
+ consumeTimeout(queueDomWritesLow, timeout);
3520
+ if (queueDomWrites.length > 0) {
3521
+ queueDomWritesLow.push(...queueDomWrites);
3522
+ queueDomWrites.length = 0;
3523
+ }
3524
+ if ((queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0)) {
3525
+ // still more to do yet, but we've run out of time
3526
+ // let's let this thing cool off and try again in the next tick
3527
+ plt.raf(flush);
3528
+ }
3529
+ else {
3530
+ queueCongestion = 0;
3531
+ }
3532
+ }
3533
+ else {
3534
+ consume(queueDomWrites);
3535
+ if ((queuePending = queueDomReads.length > 0)) {
3536
+ // still more to do yet, but we've run out of time
3537
+ // let's let this thing cool off and try again in the next tick
3538
+ plt.raf(flush);
3539
+ }
3540
+ }
3541
+ };
3542
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
3543
+ const readTask = /*@__PURE__*/ queueTask(queueDomReads, false);
3544
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
3545
+
3546
+ exports.BUILD = BUILD;
3547
+ exports.CSS = CSS;
3548
+ exports.Fragment = Fragment;
3549
+ exports.H = H;
3550
+ exports.Host = Host;
3551
+ exports.NAMESPACE = NAMESPACE;
3552
+ exports.bootstrapLazy = bootstrapLazy;
3553
+ exports.consoleDevInfo = consoleDevInfo;
3554
+ exports.createEvent = createEvent;
3555
+ exports.doc = doc;
3556
+ exports.getElement = getElement;
3557
+ exports.h = h;
3558
+ exports.plt = plt;
3559
+ exports.promiseResolve = promiseResolve;
3560
+ exports.registerInstance = registerInstance;
3561
+ exports.setNonce = setNonce;
3562
+ exports.win = win;
3563
+
3564
+ //# sourceMappingURL=index-0fdb260e.js.map