@content-blocks/js 0.3.2

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