@vonage/vivid 5.2.0 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (433) hide show
  1. package/accordion-item/definition.cjs +2 -1
  2. package/accordion-item/definition.js +3 -2
  3. package/alert/definition.cjs +1 -1
  4. package/alert/definition.js +2 -2
  5. package/alert/index.cjs +1 -1
  6. package/alert/index.js +1 -1
  7. package/audio-player/definition.cjs +4 -2
  8. package/audio-player/definition.js +4 -2
  9. package/audio-player/index.cjs +5 -3
  10. package/audio-player/index.js +5 -3
  11. package/badge/definition.js +1 -1
  12. package/badge/index.cjs +2 -2
  13. package/badge/index.js +4 -4
  14. package/banner/definition.js +1 -1
  15. package/banner/index.cjs +3 -3
  16. package/banner/index.js +6 -6
  17. package/breadcrumb-item/index.cjs +1 -1
  18. package/breadcrumb-item/index.js +1 -1
  19. package/bundled/affix.cjs +7 -7
  20. package/bundled/affix.js +5 -5
  21. package/bundled/anchored.cjs +1 -1
  22. package/bundled/anchored.js +6 -6
  23. package/bundled/attribute-binding-behaviour.cjs +1 -1
  24. package/bundled/attribute-binding-behaviour.js +15 -13
  25. package/bundled/base-color-picker.cjs +13 -0
  26. package/bundled/base-color-picker.js +194 -0
  27. package/bundled/button.cjs +1 -1
  28. package/bundled/button.js +2 -2
  29. package/bundled/calendar-picker.template.cjs +7 -7
  30. package/bundled/calendar-picker.template.js +118 -118
  31. package/bundled/char-count.cjs +1 -1
  32. package/bundled/char-count.js +1 -1
  33. package/bundled/children.cjs +1 -1
  34. package/bundled/children.js +28 -20
  35. package/bundled/definition.cjs +3 -3
  36. package/bundled/definition.js +38 -38
  37. package/bundled/definition10.cjs +72 -18
  38. package/bundled/definition10.js +351 -65
  39. package/bundled/definition11.cjs +19 -10
  40. package/bundled/definition11.js +217 -36
  41. package/bundled/definition12.cjs +10 -1
  42. package/bundled/definition12.js +38 -14
  43. package/bundled/definition13.cjs +1 -73
  44. package/bundled/definition13.js +15 -354
  45. package/bundled/definition15.cjs +1 -1
  46. package/bundled/definition15.js +1 -1
  47. package/bundled/definition16.cjs +2 -2
  48. package/bundled/definition16.js +8 -8
  49. package/bundled/definition17.cjs +7 -7
  50. package/bundled/definition17.js +17 -17
  51. package/bundled/definition19.cjs +23 -24
  52. package/bundled/definition19.js +151 -163
  53. package/bundled/definition2.cjs +9 -5
  54. package/bundled/definition2.js +21 -17
  55. package/bundled/definition22.cjs +9 -9
  56. package/bundled/definition22.js +31 -31
  57. package/bundled/definition3.cjs +1 -1
  58. package/bundled/definition3.js +1 -1
  59. package/bundled/definition6.cjs +3 -3
  60. package/bundled/definition6.js +28 -28
  61. package/bundled/definition7.cjs +1 -1
  62. package/bundled/definition7.js +6 -6
  63. package/bundled/definition8.cjs +2 -2
  64. package/bundled/definition8.js +4 -4
  65. package/bundled/definition9.cjs +5 -5
  66. package/bundled/definition9.js +394 -392
  67. package/bundled/delegates-aria.cjs +1 -1
  68. package/bundled/delegates-aria.js +59 -46
  69. package/bundled/form-associated.cjs +1 -1
  70. package/bundled/form-associated.js +3 -3
  71. package/bundled/host-semantics.cjs +1 -1
  72. package/bundled/host-semantics.js +48 -34
  73. package/bundled/listbox.cjs +1 -1
  74. package/bundled/listbox.js +82 -102
  75. package/bundled/localized.cjs +1 -1
  76. package/bundled/localized.js +51 -36
  77. package/bundled/mixins.cjs +18 -18
  78. package/bundled/mixins.js +99 -93
  79. package/bundled/normalize.cjs +1 -0
  80. package/bundled/normalize.js +7 -0
  81. package/bundled/picker-field.template.cjs +1 -1
  82. package/bundled/picker-field.template.js +4 -4
  83. package/bundled/ref.cjs +1 -1
  84. package/bundled/ref.js +8 -25
  85. package/bundled/repeat.cjs +1 -1
  86. package/bundled/repeat.js +459 -233
  87. package/bundled/slider.template.cjs +1 -1
  88. package/bundled/slider.template.js +2 -2
  89. package/bundled/slotted.cjs +1 -1
  90. package/bundled/slotted.js +62 -45
  91. package/bundled/time-selection-picker.template.cjs +1 -1
  92. package/bundled/time-selection-picker.template.js +5 -5
  93. package/bundled/vivid-element.cjs +5 -1
  94. package/bundled/vivid-element.js +2159 -1162
  95. package/bundled/when.cjs +1 -1
  96. package/bundled/when.js +8 -7
  97. package/calendar/definition.cjs +1 -1
  98. package/calendar/definition.js +2 -2
  99. package/calendar/index.cjs +1 -1
  100. package/calendar/index.js +15 -15
  101. package/calendar-event/index.cjs +1 -1
  102. package/calendar-event/index.js +1 -1
  103. package/card/definition.cjs +11 -3
  104. package/card/definition.js +11 -3
  105. package/card/index.cjs +19 -11
  106. package/card/index.js +35 -27
  107. package/color-picker/definition.cjs +1079 -0
  108. package/color-picker/definition.js +1073 -0
  109. package/color-picker/index.cjs +127 -0
  110. package/color-picker/index.js +726 -0
  111. package/combobox/definition.cjs +8 -28
  112. package/combobox/definition.js +10 -30
  113. package/combobox/index.cjs +7 -7
  114. package/combobox/index.js +60 -74
  115. package/contextual-help/index.cjs +1 -1
  116. package/contextual-help/index.js +1 -1
  117. package/custom-elements.json +1670 -163
  118. package/data-grid/definition.cjs +862 -27
  119. package/data-grid/definition.js +863 -28
  120. package/data-grid/index.cjs +25 -25
  121. package/data-grid/index.js +175 -168
  122. package/date-picker/definition.cjs +1 -1
  123. package/date-picker/definition.js +1 -1
  124. package/date-picker/index.cjs +1 -1
  125. package/date-picker/index.js +2 -2
  126. package/date-range-picker/definition.cjs +1 -1
  127. package/date-range-picker/definition.js +1 -1
  128. package/date-range-picker/index.cjs +1 -1
  129. package/date-range-picker/index.js +2 -2
  130. package/date-time-picker/definition.cjs +1 -1
  131. package/date-time-picker/definition.js +1 -1
  132. package/date-time-picker/index.cjs +1 -1
  133. package/date-time-picker/index.js +2 -2
  134. package/dial-pad/definition.cjs +4 -0
  135. package/dial-pad/definition.js +4 -0
  136. package/dial-pad/index.cjs +3 -3
  137. package/dial-pad/index.js +42 -39
  138. package/dialog/definition.cjs +6 -3
  139. package/dialog/definition.js +6 -3
  140. package/dialog/index.cjs +22 -19
  141. package/dialog/index.js +48 -45
  142. package/elevation/definition.cjs +1 -1
  143. package/elevation/definition.js +1 -1
  144. package/empty-state/definition.cjs +7 -2
  145. package/empty-state/definition.js +7 -2
  146. package/empty-state/index.cjs +10 -5
  147. package/empty-state/index.js +18 -13
  148. package/fab/definition.js +1 -1
  149. package/fab/index.cjs +2 -2
  150. package/fab/index.js +4 -4
  151. package/file-picker/definition.cjs +2 -2
  152. package/file-picker/definition.js +3 -3
  153. package/file-picker/index.cjs +1 -1
  154. package/file-picker/index.js +4 -4
  155. package/header/definition.cjs +1 -1
  156. package/header/definition.js +1 -1
  157. package/icon/definition.cjs +10 -6
  158. package/icon/definition.js +10 -6
  159. package/index.cjs +7 -4
  160. package/index.js +3 -3
  161. package/lib/accordion/accordion.d.ts +1 -1
  162. package/lib/accordion/definition.d.ts +1 -1
  163. package/lib/accordion-item/accordion-item.d.ts +2 -2
  164. package/lib/action-group/action-group.d.ts +2 -2
  165. package/lib/alert/alert.d.ts +4 -4
  166. package/lib/audio-player/audio-player.d.ts +3 -3
  167. package/lib/avatar/avatar.d.ts +2 -2
  168. package/lib/badge/badge.d.ts +2 -2
  169. package/lib/banner/banner.d.ts +6 -6
  170. package/lib/breadcrumb/breadcrumb.d.ts +2 -2
  171. package/lib/breadcrumb-item/breadcrumb-item.d.ts +2 -2
  172. package/lib/button/button.d.ts +6 -6
  173. package/lib/button/button.template.d.ts +2 -1
  174. package/lib/calendar/calendar.d.ts +1 -1
  175. package/lib/calendar-event/calendar-event.d.ts +2 -2
  176. package/lib/card/card.d.ts +2 -2
  177. package/lib/checkbox/checkbox.d.ts +12 -12
  178. package/lib/color-picker/color-picker.d.ts +2420 -0
  179. package/lib/color-picker/color-picker.template.d.ts +3 -0
  180. package/lib/color-picker/definition.d.ts +4 -0
  181. package/lib/color-picker/locale.d.ts +9 -0
  182. package/lib/combobox/combobox.d.ts +15 -14
  183. package/lib/combobox/combobox.options.d.ts +1 -1
  184. package/lib/components.d.ts +1 -0
  185. package/lib/data-grid/data-grid-cell.d.ts +4 -4
  186. package/lib/data-grid/data-grid-row.d.ts +3 -4
  187. package/lib/data-grid/data-grid.d.ts +1 -2
  188. package/lib/date-picker/date-picker.d.ts +54 -54
  189. package/lib/date-range-picker/date-range-picker.d.ts +28 -28
  190. package/lib/date-time-picker/date-time-picker.d.ts +56 -56
  191. package/lib/dial-pad/dial-pad.d.ts +3 -2
  192. package/lib/dialog/dialog.d.ts +4 -4
  193. package/lib/divider/divider.d.ts +3 -3
  194. package/lib/fab/fab.d.ts +2 -2
  195. package/lib/file-picker/file-picker.d.ts +14 -14
  196. package/lib/header/header.d.ts +2 -2
  197. package/lib/menu/menu.d.ts +4 -4
  198. package/lib/menu-item/menu-item-role.d.ts +1 -1
  199. package/lib/menu-item/menu-item.d.ts +4 -4
  200. package/lib/nav/nav.d.ts +2 -2
  201. package/lib/nav-disclosure/nav-disclosure.d.ts +4 -4
  202. package/lib/nav-item/nav-item.d.ts +4 -4
  203. package/lib/note/note.d.ts +2 -2
  204. package/lib/number-field/number-field.d.ts +18 -18
  205. package/lib/option/option.d.ts +4 -4
  206. package/lib/pagination/pagination.d.ts +2 -2
  207. package/lib/popup/popup.d.ts +1 -1
  208. package/lib/progress/progress.d.ts +2 -2
  209. package/lib/progress-ring/progress-ring.d.ts +2 -2
  210. package/lib/radio/radio.d.ts +6 -6
  211. package/lib/radio-group/radio-group.d.ts +2 -2
  212. package/lib/range-slider/range-slider.d.ts +6 -6
  213. package/lib/rich-text-editor/menubar/menubar.d.ts +2 -2
  214. package/lib/rich-text-editor/rich-text-editor.d.ts +2 -2
  215. package/lib/searchable-select/locale.d.ts +4 -0
  216. package/lib/searchable-select/option-tag.d.ts +2 -2
  217. package/lib/searchable-select/searchable-select.d.ts +21 -18
  218. package/lib/select/select.d.ts +19 -17
  219. package/lib/selectable-box/selectable-box.d.ts +2 -2
  220. package/lib/simple-color-picker/locale.d.ts +0 -1
  221. package/lib/simple-color-picker/simple-color-picker.d.ts +47 -821
  222. package/lib/slider/slider.d.ts +7 -7
  223. package/lib/split-button/split-button.d.ts +6 -6
  224. package/lib/switch/switch.d.ts +4 -4
  225. package/lib/tab/tab.d.ts +6 -6
  226. package/lib/tab-panel/tab-panel.d.ts +2 -2
  227. package/lib/tabs/tabs.d.ts +2 -2
  228. package/lib/tag/tag.d.ts +6 -6
  229. package/lib/tag-group/tag-group.d.ts +2 -2
  230. package/lib/tag-name-map.d.ts +2 -1
  231. package/lib/text-area/text-area.d.ts +17 -17
  232. package/lib/text-field/text-field.d.ts +19 -19
  233. package/lib/time-picker/time-picker.d.ts +28 -28
  234. package/lib/toggletip/toggletip.d.ts +4 -4
  235. package/lib/tooltip/tooltip.d.ts +2 -2
  236. package/lib/tree-item/tree-item.d.ts +4 -4
  237. package/lib/tree-view/tree-view.d.ts +2 -2
  238. package/lib/video-player/video-player.d.ts +2 -2
  239. package/locales/de-DE.cjs +17 -2
  240. package/locales/de-DE.js +17 -2
  241. package/locales/en-GB.cjs +17 -2
  242. package/locales/en-GB.js +17 -2
  243. package/locales/en-US.cjs +17 -2
  244. package/locales/en-US.js +17 -2
  245. package/locales/ja-JP.cjs +17 -2
  246. package/locales/ja-JP.js +17 -2
  247. package/locales/zh-CN.cjs +17 -2
  248. package/locales/zh-CN.js +17 -2
  249. package/menu/definition.cjs +6 -6
  250. package/menu/definition.js +7 -7
  251. package/nav-disclosure/definition.js +1 -1
  252. package/nav-item/definition.js +1 -1
  253. package/note/definition.js +1 -1
  254. package/note/index.cjs +2 -2
  255. package/note/index.js +4 -4
  256. package/number-field/definition.cjs +1 -1
  257. package/number-field/definition.js +3 -3
  258. package/number-field/index.cjs +5 -5
  259. package/number-field/index.js +21 -21
  260. package/option/definition.cjs +6 -77
  261. package/option/definition.js +3 -78
  262. package/option/index.cjs +1 -1
  263. package/option/index.js +1 -1
  264. package/package.json +34 -8
  265. package/pagination/definition.cjs +2 -1
  266. package/pagination/definition.js +2 -1
  267. package/pagination/index.cjs +12 -12
  268. package/pagination/index.js +59 -59
  269. package/popup/definition.cjs +2 -2
  270. package/popup/definition.js +2 -2
  271. package/progress/index.cjs +1 -1
  272. package/progress/index.js +1 -1
  273. package/radio/definition.cjs +9 -9
  274. package/radio/definition.js +10 -10
  275. package/radio-group/definition.cjs +2 -1
  276. package/radio-group/definition.js +2 -1
  277. package/radio-group/index.cjs +5 -5
  278. package/radio-group/index.js +80 -77
  279. package/range-slider/definition.cjs +1 -1
  280. package/range-slider/definition.js +1 -1
  281. package/range-slider/index.cjs +1 -1
  282. package/range-slider/index.js +1 -1
  283. package/rich-text-editor/definition.cjs +3 -4
  284. package/rich-text-editor/definition.js +3 -4
  285. package/rich-text-editor/index.cjs +27 -27
  286. package/rich-text-editor/index.js +1208 -1198
  287. package/searchable-select/definition.cjs +106 -14
  288. package/searchable-select/definition.js +107 -15
  289. package/searchable-select/index.cjs +81 -69
  290. package/searchable-select/index.js +362 -276
  291. package/select/definition.cjs +25 -42
  292. package/select/definition.js +26 -43
  293. package/selectable-box/definition.cjs +1 -1
  294. package/selectable-box/definition.js +1 -1
  295. package/selectable-box/index.cjs +3 -3
  296. package/selectable-box/index.js +20 -20
  297. package/shared/aria/aria-change-subscription.d.ts +0 -1
  298. package/shared/aria/aria-mixin.d.ts +3 -3
  299. package/shared/aria/delegate-aria-behavior.d.ts +5 -10
  300. package/shared/aria/delegates-aria.d.ts +3 -3
  301. package/shared/aria/host-semantics-behavior.d.ts +5 -8
  302. package/shared/aria/host-semantics.d.ts +3 -3
  303. package/shared/color-picker/base-color-picker.d.ts +436 -0
  304. package/shared/color-picker/index.d.ts +1 -0
  305. package/shared/color-picker/locale.d.ts +3 -0
  306. package/shared/color-picker/utils.d.ts +1 -0
  307. package/shared/deprecation/replaced-props.d.ts +317 -2
  308. package/shared/design-system/defineVividComponent.d.ts +2 -2
  309. package/shared/feedback/feedback-message.d.ts +2 -2
  310. package/shared/feedback/mixins.d.ts +4 -4
  311. package/shared/foundation/button/button.d.ts +4 -4
  312. package/shared/foundation/form-associated/form-associated.d.ts +4 -4
  313. package/shared/foundation/listbox/listbox.d.ts +4 -0
  314. package/shared/foundation/vivid-element/vivid-element.d.ts +335 -8
  315. package/shared/localization/Locale.d.ts +4 -0
  316. package/shared/patterns/affix.d.ts +4 -4
  317. package/shared/patterns/anchored.d.ts +4 -4
  318. package/shared/patterns/char-count/char-count.d.ts +2 -2
  319. package/shared/patterns/form-elements/form-element.d.ts +4 -4
  320. package/shared/patterns/form-elements/with-contextual-help.d.ts +6 -6
  321. package/shared/patterns/form-elements/with-error-text.d.ts +6 -6
  322. package/shared/patterns/form-elements/with-success-text.d.ts +2 -2
  323. package/shared/patterns/linkable.d.ts +2 -2
  324. package/shared/patterns/localized.d.ts +2 -2
  325. package/shared/patterns/trapped-focus.d.ts +2 -2
  326. package/shared/picker-field/mixins/calendar-picker.d.ts +14 -14
  327. package/shared/picker-field/mixins/calendar-picker.template.d.ts +14 -14
  328. package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +2 -2
  329. package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +28 -28
  330. package/shared/picker-field/mixins/single-date-picker.d.ts +40 -40
  331. package/shared/picker-field/mixins/single-value-picker.d.ts +12 -12
  332. package/shared/picker-field/mixins/time-selection-picker.d.ts +29 -29
  333. package/shared/picker-field/mixins/time-selection-picker.template.d.ts +28 -28
  334. package/shared/picker-field/picker-field.d.ts +14 -14
  335. package/shared/templating/attribute-binding-behaviour.d.ts +3 -4
  336. package/shared/templating/render-in-light-dom.d.ts +13 -12
  337. package/side-drawer/index.cjs +1 -1
  338. package/side-drawer/index.js +1 -1
  339. package/simple-color-picker/definition.cjs +29 -216
  340. package/simple-color-picker/definition.js +30 -217
  341. package/simple-color-picker/index.cjs +9 -21
  342. package/simple-color-picker/index.js +71 -185
  343. package/slider/definition.cjs +1 -1
  344. package/slider/definition.js +1 -1
  345. package/split-button/definition.js +1 -1
  346. package/styles/core/all.css +1 -1
  347. package/styles/core/theme.css +1 -1
  348. package/styles/core/typography.css +1 -1
  349. package/styles/tokens/theme-dark.css +4 -4
  350. package/styles/tokens/theme-light.css +4 -4
  351. package/styles/tokens/vivid-2-compat.css +1 -1
  352. package/switch/index.cjs +2 -2
  353. package/switch/index.js +4 -4
  354. package/tab/definition.js +1 -1
  355. package/tabs/definition.cjs +1 -1
  356. package/tabs/definition.js +2 -2
  357. package/tabs/index.cjs +2 -2
  358. package/tabs/index.js +16 -16
  359. package/tag/definition.js +1 -1
  360. package/tag/index.cjs +1 -1
  361. package/tag/index.js +1 -1
  362. package/text-area/index.cjs +3 -3
  363. package/text-area/index.js +8 -8
  364. package/text-field/definition.cjs +2 -2
  365. package/text-field/definition.js +4 -4
  366. package/text-field/index.cjs +1 -1
  367. package/text-field/index.js +1 -1
  368. package/time-picker/definition.cjs +1 -1
  369. package/time-picker/definition.js +1 -1
  370. package/time-picker/index.cjs +1 -1
  371. package/time-picker/index.js +2 -2
  372. package/toggletip/definition.cjs +2 -2
  373. package/toggletip/definition.js +3 -3
  374. package/tooltip/definition.cjs +1 -1
  375. package/tooltip/definition.js +1 -1
  376. package/tree-item/definition.cjs +1 -1
  377. package/tree-item/definition.js +1 -1
  378. package/tree-view/definition.cjs +2 -2
  379. package/tree-view/definition.js +3 -3
  380. package/tree-view/index.cjs +2 -2
  381. package/tree-view/index.js +6 -6
  382. package/unbundled/_commonjsHelpers.cjs +36 -0
  383. package/unbundled/_commonjsHelpers.js +32 -0
  384. package/unbundled/affix.cjs +1 -1
  385. package/unbundled/affix.js +2 -2
  386. package/unbundled/attribute-binding-behaviour.cjs +11 -10
  387. package/unbundled/attribute-binding-behaviour.js +11 -10
  388. package/unbundled/base-color-picker.cjs +278 -0
  389. package/unbundled/base-color-picker.js +275 -0
  390. package/unbundled/button.cjs +1 -1
  391. package/unbundled/button.js +2 -2
  392. package/unbundled/calendar-picker.template.cjs +4 -4
  393. package/unbundled/calendar-picker.template.js +5 -5
  394. package/unbundled/definition.js +1 -1
  395. package/unbundled/definition2.cjs +1 -1
  396. package/unbundled/definition2.js +3 -3
  397. package/unbundled/definition3.cjs +222 -140
  398. package/unbundled/definition3.js +220 -138
  399. package/unbundled/definition4.cjs +145 -235
  400. package/unbundled/definition4.js +143 -233
  401. package/unbundled/definition5.cjs +269 -27
  402. package/unbundled/definition5.js +267 -26
  403. package/unbundled/definition6.cjs +56 -0
  404. package/unbundled/definition6.js +52 -0
  405. package/unbundled/delegates-aria.cjs +67 -33
  406. package/unbundled/delegates-aria.js +69 -35
  407. package/unbundled/form-associated.cjs +2 -2
  408. package/unbundled/form-associated.js +3 -3
  409. package/unbundled/host-semantics.cjs +47 -22
  410. package/unbundled/host-semantics.js +48 -23
  411. package/unbundled/listbox.cjs +41 -63
  412. package/unbundled/listbox.js +39 -61
  413. package/unbundled/mixins.cjs +34 -27
  414. package/unbundled/mixins.js +35 -28
  415. package/unbundled/picker-field.template.cjs +3 -3
  416. package/unbundled/picker-field.template.js +4 -4
  417. package/unbundled/slider.template.cjs +1 -1
  418. package/unbundled/slider.template.js +1 -1
  419. package/unbundled/time-selection-picker.template.cjs +4 -4
  420. package/unbundled/time-selection-picker.template.js +5 -5
  421. package/unbundled/vivid-element.cjs +22 -15
  422. package/unbundled/vivid-element.js +23 -15
  423. package/video-player/definition.cjs +69047 -1
  424. package/video-player/definition.js +69047 -1
  425. package/video-player/index.cjs +36 -36
  426. package/video-player/index.js +1895 -1905
  427. package/visually-hidden/index.cjs +1 -1
  428. package/visually-hidden/index.js +1 -1
  429. package/vivid.api.json +719 -224
  430. package/bundled/option.cjs +0 -1
  431. package/bundled/option.js +0 -158
  432. package/unbundled/option.cjs +0 -217
  433. package/unbundled/option.js +0 -214
@@ -1,170 +1,195 @@
1
- const v = function() {
2
- if (typeof globalThis < "u")
3
- return globalThis;
4
- if (typeof global < "u")
5
- return global;
6
- if (typeof self < "u")
7
- return self;
8
- if (typeof window < "u")
9
- return window;
10
- try {
11
- return new Function("return this")();
12
- } catch {
13
- return {};
14
- }
15
- }();
16
- v.trustedTypes === void 0 && (v.trustedTypes = { createPolicy: (s, e) => e });
17
- const ee = {
1
+ let I;
2
+ const ft = "fast-kernel";
3
+ try {
4
+ if (document.currentScript)
5
+ I = document.currentScript.getAttribute(ft);
6
+ else {
7
+ const i = document.getElementsByTagName("script");
8
+ I = i[i.length - 1].getAttribute(ft);
9
+ }
10
+ } catch {
11
+ I = "isolate";
12
+ }
13
+ let N;
14
+ switch (I) {
15
+ case "share":
16
+ N = Object.freeze({
17
+ updateQueue: 1,
18
+ observable: 2,
19
+ contextEvent: 3,
20
+ elementRegistry: 4
21
+ });
22
+ break;
23
+ case "share-v2":
24
+ N = Object.freeze({
25
+ updateQueue: 1.2,
26
+ observable: 2.2,
27
+ contextEvent: 3.2,
28
+ elementRegistry: 4.2
29
+ });
30
+ break;
31
+ default:
32
+ const i = `-${Math.random().toString(36).substring(2, 8)}`;
33
+ N = Object.freeze({
34
+ updateQueue: `1.2${i}`,
35
+ observable: `2.2${i}`,
36
+ contextEvent: `3.2${i}`,
37
+ elementRegistry: `4.2${i}`
38
+ });
39
+ break;
40
+ }
41
+ const O = (i) => typeof i == "function", B = (i) => typeof i == "string", pe = () => {
42
+ };
43
+ var tt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
44
+ function di(i) {
45
+ return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
46
+ }
47
+ function hi(i) {
48
+ if (i.__esModule) return i;
49
+ var t = i.default;
50
+ if (typeof t == "function") {
51
+ var e = function s() {
52
+ return this instanceof s ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments);
53
+ };
54
+ e.prototype = t.prototype;
55
+ } else e = {};
56
+ return Object.defineProperty(e, "__esModule", { value: !0 }), Object.keys(i).forEach(function(s) {
57
+ var n = Object.getOwnPropertyDescriptor(i, s);
58
+ Object.defineProperty(e, s, n.get ? n : {
59
+ enumerable: !0,
60
+ get: function() {
61
+ return i[s];
62
+ }
63
+ });
64
+ }), e;
65
+ }
66
+ (function() {
67
+ if (!(typeof globalThis < "u"))
68
+ if (typeof tt < "u")
69
+ tt.globalThis = tt;
70
+ else if (typeof self < "u")
71
+ self.globalThis = self;
72
+ else if (typeof window < "u")
73
+ window.globalThis = window;
74
+ else {
75
+ const t = new Function("return this")();
76
+ t.globalThis = t;
77
+ }
78
+ })();
79
+ const Dt = {
18
80
  configurable: !1,
19
81
  enumerable: !1,
20
82
  writable: !1
21
83
  };
22
- v.FAST === void 0 && Reflect.defineProperty(v, "FAST", Object.assign({ value: /* @__PURE__ */ Object.create(null) }, ee));
23
- const S = v.FAST;
24
- if (S.getById === void 0) {
25
- const s = /* @__PURE__ */ Object.create(null);
26
- Reflect.defineProperty(S, "getById", Object.assign({ value(e, t) {
27
- let i = s[e];
28
- return i === void 0 && (i = t ? s[e] = t() : null), i;
29
- } }, ee));
30
- }
31
- const Ke = Object.freeze([]);
32
- function _() {
33
- const s = /* @__PURE__ */ new WeakMap();
34
- return function(e) {
35
- let t = s.get(e);
36
- if (t === void 0) {
37
- let i = Reflect.getPrototypeOf(e);
38
- for (; t === void 0 && i !== null; )
39
- t = s.get(i), i = Reflect.getPrototypeOf(i);
40
- t = t === void 0 ? [] : t.slice(0), s.set(e, t);
41
- }
42
- return t;
43
- };
84
+ globalThis.FAST === void 0 && Reflect.defineProperty(globalThis, "FAST", Object.assign({ value: /* @__PURE__ */ Object.create(null) }, Dt));
85
+ const y = globalThis.FAST;
86
+ if (y.getById === void 0) {
87
+ const i = /* @__PURE__ */ Object.create(null);
88
+ Reflect.defineProperty(y, "getById", Object.assign({ value(t, e) {
89
+ let s = i[t];
90
+ return s === void 0 && (s = e ? i[t] = e() : null), s;
91
+ } }, Dt));
44
92
  }
45
- const N = v.FAST.getById(1, () => {
46
- const s = [], e = [];
47
- function t() {
48
- if (e.length)
49
- throw e.shift();
50
- }
51
- function i(o) {
52
- try {
53
- o.call();
54
- } catch (a) {
55
- e.push(a), setTimeout(t, 0);
56
- }
57
- }
58
- function n() {
59
- let a = 0;
60
- for (; a < s.length; )
61
- if (i(s[a]), a++, a > 1024) {
62
- for (let c = 0, l = s.length - a; c < l; c++)
63
- s[c] = s[c + a];
64
- s.length -= a, a = 0;
65
- }
66
- s.length = 0;
67
- }
68
- function r(o) {
69
- s.length < 1 && v.requestAnimationFrame(n), s.push(o);
93
+ y.error === void 0 && Object.assign(y, {
94
+ warn() {
95
+ },
96
+ error(i) {
97
+ return new Error(`Error ${i}`);
98
+ },
99
+ addMessages() {
70
100
  }
101
+ });
102
+ const ui = Object.freeze([]);
103
+ function Pt() {
104
+ const i = /* @__PURE__ */ new Map();
71
105
  return Object.freeze({
72
- enqueue: r,
73
- process: n
106
+ register(t) {
107
+ return i.has(t.type) ? !1 : (i.set(t.type, t), !0);
108
+ },
109
+ getByType(t) {
110
+ return i.get(t);
111
+ },
112
+ getForInstance(t) {
113
+ if (t != null)
114
+ return i.get(t.constructor);
115
+ }
74
116
  });
75
- }), te = v.trustedTypes.createPolicy("fast-html", {
76
- createHTML: (s) => s
77
- });
78
- let k = te;
79
- const m = `fast-${Math.random().toString(36).substring(2, 8)}`, se = `${m}{`, R = `}${m}`, u = Object.freeze({
117
+ }
118
+ function zt() {
119
+ const i = /* @__PURE__ */ new WeakMap();
120
+ return function(t) {
121
+ let e = i.get(t);
122
+ if (e === void 0) {
123
+ let s = Reflect.getPrototypeOf(t);
124
+ for (; e === void 0 && s !== null; )
125
+ e = i.get(s), s = Reflect.getPrototypeOf(s);
126
+ e = e === void 0 ? [] : e.slice(0), i.set(t, e);
127
+ }
128
+ return e;
129
+ };
130
+ }
131
+ function x(i) {
132
+ i.prototype.toJSON = pe;
133
+ }
134
+ const g = Object.freeze({
80
135
  /**
81
- * Indicates whether the DOM supports the adoptedStyleSheets feature.
136
+ * Not aspected.
82
137
  */
83
- supportsAdoptedStyleSheets: Array.isArray(document.adoptedStyleSheets) && "replace" in CSSStyleSheet.prototype,
138
+ none: 0,
84
139
  /**
85
- * Sets the HTML trusted types policy used by the templating engine.
86
- * @param policy - The policy to set for HTML.
87
- * @remarks
88
- * This API can only be called once, for security reasons. It should be
89
- * called by the application developer at the start of their program.
140
+ * An attribute.
90
141
  */
91
- setHTMLPolicy(s) {
92
- if (k !== te)
93
- throw new Error("The HTML policy can only be set once.");
94
- k = s;
95
- },
142
+ attribute: 1,
96
143
  /**
97
- * Turns a string into trusted HTML using the configured trusted types policy.
98
- * @param html - The string to turn into trusted HTML.
99
- * @remarks
100
- * Used internally by the template engine when creating templates
101
- * and setting innerHTML.
144
+ * A boolean attribute.
102
145
  */
103
- createHTML(s) {
104
- return k.createHTML(s);
105
- },
146
+ booleanAttribute: 2,
106
147
  /**
107
- * Determines if the provided node is a template marker used by the runtime.
108
- * @param node - The node to test.
148
+ * A property.
109
149
  */
110
- isMarker(s) {
111
- return s && s.nodeType === 8 && s.data.startsWith(m);
112
- },
150
+ property: 3,
113
151
  /**
114
- * Given a marker node, extract the {@link HTMLDirective} index from the placeholder.
115
- * @param node - The marker node to extract the index from.
152
+ * Content
116
153
  */
117
- extractDirectiveIndexFromMarker(s) {
118
- return parseInt(s.data.replace(`${m}:`, ""));
119
- },
154
+ content: 4,
120
155
  /**
121
- * Creates a placeholder string suitable for marking out a location *within*
122
- * an attribute value or HTML content.
123
- * @param index - The directive index to create the placeholder for.
124
- * @remarks
125
- * Used internally by binding directives.
156
+ * A token list.
126
157
  */
127
- createInterpolationPlaceholder(s) {
128
- return `${se}${s}${R}`;
129
- },
158
+ tokenList: 5,
130
159
  /**
131
- * Creates a placeholder that manifests itself as an attribute on an
132
- * element.
133
- * @param attributeName - The name of the custom attribute.
134
- * @param index - The directive index to create the placeholder for.
135
- * @remarks
136
- * Used internally by attribute directives such as `ref`, `slotted`, and `children`.
160
+ * An event.
137
161
  */
138
- createCustomAttributePlaceholder(s, e) {
139
- return `${s}="${this.createInterpolationPlaceholder(e)}"`;
162
+ event: 6
163
+ }), pt = (i) => i, be = globalThis.trustedTypes ? globalThis.trustedTypes.createPolicy("fast-html", { createHTML: pt }) : { createHTML: pt };
164
+ let H = Object.freeze({
165
+ createHTML(i) {
166
+ return be.createHTML(i);
140
167
  },
168
+ protect(i, t, e, s) {
169
+ return s;
170
+ }
171
+ });
172
+ const ge = H, T = Object.freeze({
141
173
  /**
142
- * Creates a placeholder that manifests itself as a marker within the DOM structure.
143
- * @param index - The directive index to create the placeholder for.
144
- * @remarks
145
- * Used internally by structural directives such as `repeat`.
174
+ * Gets the dom policy used by the templating system.
146
175
  */
147
- createBlockPlaceholder(s) {
148
- return `<!--${m}:${s}-->`;
176
+ get policy() {
177
+ return H;
149
178
  },
150
179
  /**
151
- * Schedules DOM update work in the next async batch.
152
- * @param callable - The callable function or object to queue.
153
- */
154
- queueUpdate: N.enqueue,
155
- /**
156
- * Immediately processes all work previously scheduled
157
- * through queueUpdate.
180
+ * Sets the dom policy used by the templating system.
181
+ * @param policy - The policy to set.
158
182
  * @remarks
159
- * This also forces nextUpdate promises
160
- * to resolve.
161
- */
162
- processUpdates: N.process,
163
- /**
164
- * Resolves with the next DOM update.
183
+ * This API can only be called once, for security reasons. It should be
184
+ * called by the application developer at the start of their program.
165
185
  */
166
- nextUpdate() {
167
- return new Promise(N.enqueue);
186
+ setPolicy(i) {
187
+ if (H !== ge)
188
+ throw y.error(
189
+ 1201
190
+ /* Message.onlySetDOMPolicyOnce */
191
+ );
192
+ H = i;
168
193
  },
169
194
  /**
170
195
  * Sets an attribute value on an element.
@@ -175,8 +200,8 @@ const m = `fast-${Math.random().toString(36).substring(2, 8)}`, se = `${m}{`, R
175
200
  * If the value is `null` or `undefined`, the attribute is removed, otherwise
176
201
  * it is set to the provided value using the standard `setAttribute` API.
177
202
  */
178
- setAttribute(s, e, t) {
179
- t == null ? s.removeAttribute(e) : s.setAttribute(e, t);
203
+ setAttribute(i, t, e) {
204
+ e == null ? i.removeAttribute(t) : i.setAttribute(t, e);
180
205
  },
181
206
  /**
182
207
  * Sets a boolean attribute value.
@@ -186,218 +211,252 @@ const m = `fast-${Math.random().toString(36).substring(2, 8)}`, se = `${m}{`, R
186
211
  * @remarks
187
212
  * If the value is true, the attribute is added; otherwise it is removed.
188
213
  */
189
- setBooleanAttribute(s, e, t) {
190
- t ? s.setAttribute(e, "") : s.removeAttribute(e);
191
- },
192
- /**
193
- * Removes all the child nodes of the provided parent node.
194
- * @param parent - The node to remove the children from.
195
- */
196
- removeChildNodes(s) {
197
- for (let e = s.firstChild; e !== null; e = s.firstChild)
198
- s.removeChild(e);
199
- },
200
- /**
201
- * Creates a TreeWalker configured to walk a template fragment.
202
- * @param fragment - The fragment to walk.
203
- */
204
- createTemplateWalker(s) {
205
- return document.createTreeWalker(
206
- s,
207
- 133,
208
- // element, text, comment
209
- null,
210
- !1
211
- );
214
+ setBooleanAttribute(i, t, e) {
215
+ e ? i.setAttribute(t, "") : i.removeAttribute(t);
216
+ }
217
+ }), Ut = y.getById(N.updateQueue, () => {
218
+ const i = [], t = [], e = globalThis.requestAnimationFrame;
219
+ let s = !0;
220
+ function n() {
221
+ if (t.length)
222
+ throw t.shift();
212
223
  }
224
+ function r(d) {
225
+ try {
226
+ d.call();
227
+ } catch (l) {
228
+ if (s)
229
+ t.push(l), setTimeout(n, 0);
230
+ else
231
+ throw i.length = 0, l;
232
+ }
233
+ }
234
+ function a() {
235
+ let l = 0;
236
+ for (; l < i.length; )
237
+ if (r(i[l]), l++, l > 1024) {
238
+ for (let o = 0, h = i.length - l; o < h; o++)
239
+ i[o] = i[o + l];
240
+ i.length -= l, l = 0;
241
+ }
242
+ i.length = 0;
243
+ }
244
+ function c(d) {
245
+ i.push(d), i.length < 2 && (s ? e(a) : a());
246
+ }
247
+ return Object.freeze({
248
+ enqueue: c,
249
+ next: () => new Promise(c),
250
+ process: a,
251
+ setMode: (d) => s = d
252
+ });
213
253
  });
214
- class I {
254
+ class rt {
215
255
  /**
216
- * Creates an instance of SubscriberSet for the specified source.
217
- * @param source - The object source that subscribers will receive notifications from.
256
+ * Creates an instance of SubscriberSet for the specified subject.
257
+ * @param subject - The subject that subscribers will receive notifications from.
218
258
  * @param initialSubscriber - An initial subscriber to changes.
219
259
  */
220
- constructor(e, t) {
221
- this.sub1 = void 0, this.sub2 = void 0, this.spillover = void 0, this.source = e, this.sub1 = t;
260
+ constructor(t, e) {
261
+ this.sub1 = void 0, this.sub2 = void 0, this.spillover = void 0, this.subject = t, this.sub1 = e;
222
262
  }
223
263
  /**
224
264
  * Checks whether the provided subscriber has been added to this set.
225
265
  * @param subscriber - The subscriber to test for inclusion in this set.
226
266
  */
227
- has(e) {
228
- return this.spillover === void 0 ? this.sub1 === e || this.sub2 === e : this.spillover.indexOf(e) !== -1;
267
+ has(t) {
268
+ return this.spillover === void 0 ? this.sub1 === t || this.sub2 === t : this.spillover.indexOf(t) !== -1;
229
269
  }
230
270
  /**
231
271
  * Subscribes to notification of changes in an object's state.
232
272
  * @param subscriber - The object that is subscribing for change notification.
233
273
  */
234
- subscribe(e) {
235
- const t = this.spillover;
236
- if (t === void 0) {
237
- if (this.has(e))
274
+ subscribe(t) {
275
+ const e = this.spillover;
276
+ if (e === void 0) {
277
+ if (this.has(t))
238
278
  return;
239
279
  if (this.sub1 === void 0) {
240
- this.sub1 = e;
280
+ this.sub1 = t;
241
281
  return;
242
282
  }
243
283
  if (this.sub2 === void 0) {
244
- this.sub2 = e;
284
+ this.sub2 = t;
245
285
  return;
246
286
  }
247
- this.spillover = [this.sub1, this.sub2, e], this.sub1 = void 0, this.sub2 = void 0;
287
+ this.spillover = [this.sub1, this.sub2, t], this.sub1 = void 0, this.sub2 = void 0;
248
288
  } else
249
- t.indexOf(e) === -1 && t.push(e);
289
+ e.indexOf(t) === -1 && e.push(t);
250
290
  }
251
291
  /**
252
292
  * Unsubscribes from notification of changes in an object's state.
253
293
  * @param subscriber - The object that is unsubscribing from change notification.
254
294
  */
255
- unsubscribe(e) {
256
- const t = this.spillover;
257
- if (t === void 0)
258
- this.sub1 === e ? this.sub1 = void 0 : this.sub2 === e && (this.sub2 = void 0);
295
+ unsubscribe(t) {
296
+ const e = this.spillover;
297
+ if (e === void 0)
298
+ this.sub1 === t ? this.sub1 = void 0 : this.sub2 === t && (this.sub2 = void 0);
259
299
  else {
260
- const i = t.indexOf(e);
261
- i !== -1 && t.splice(i, 1);
300
+ const s = e.indexOf(t);
301
+ s !== -1 && e.splice(s, 1);
262
302
  }
263
303
  }
264
304
  /**
265
305
  * Notifies all subscribers.
266
306
  * @param args - Data passed along to subscribers during notification.
267
307
  */
268
- notify(e) {
269
- const t = this.spillover, i = this.source;
270
- if (t === void 0) {
308
+ notify(t) {
309
+ const e = this.spillover, s = this.subject;
310
+ if (e === void 0) {
271
311
  const n = this.sub1, r = this.sub2;
272
- n !== void 0 && n.handleChange(i, e), r !== void 0 && r.handleChange(i, e);
312
+ n !== void 0 && n.handleChange(s, t), r !== void 0 && r.handleChange(s, t);
273
313
  } else
274
- for (let n = 0, r = t.length; n < r; ++n)
275
- t[n].handleChange(i, e);
314
+ for (let n = 0, r = e.length; n < r; ++n)
315
+ e[n].handleChange(s, t);
276
316
  }
277
317
  }
278
- class ie {
318
+ class Wt {
279
319
  /**
280
- * Creates an instance of PropertyChangeNotifier for the specified source.
281
- * @param source - The object source that subscribers will receive notifications from.
320
+ * Creates an instance of PropertyChangeNotifier for the specified subject.
321
+ * @param subject - The object that subscribers will receive notifications for.
282
322
  */
283
- constructor(e) {
284
- this.subscribers = {}, this.sourceSubscribers = null, this.source = e;
323
+ constructor(t) {
324
+ this.subscribers = {}, this.subjectSubscribers = null, this.subject = t;
285
325
  }
286
326
  /**
287
327
  * Notifies all subscribers, based on the specified property.
288
328
  * @param propertyName - The property name, passed along to subscribers during notification.
289
329
  */
290
- notify(e) {
291
- var t;
292
- const i = this.subscribers[e];
293
- i !== void 0 && i.notify(e), (t = this.sourceSubscribers) === null || t === void 0 || t.notify(e);
330
+ notify(t) {
331
+ var e, s;
332
+ (e = this.subscribers[t]) === null || e === void 0 || e.notify(t), (s = this.subjectSubscribers) === null || s === void 0 || s.notify(t);
294
333
  }
295
334
  /**
296
335
  * Subscribes to notification of changes in an object's state.
297
336
  * @param subscriber - The object that is subscribing for change notification.
298
337
  * @param propertyToWatch - The name of the property that the subscriber is interested in watching for changes.
299
338
  */
300
- subscribe(e, t) {
301
- var i;
302
- if (t) {
303
- let n = this.subscribers[t];
304
- n === void 0 && (this.subscribers[t] = n = new I(this.source)), n.subscribe(e);
305
- } else
306
- this.sourceSubscribers = (i = this.sourceSubscribers) !== null && i !== void 0 ? i : new I(this.source), this.sourceSubscribers.subscribe(e);
339
+ subscribe(t, e) {
340
+ var s, n;
341
+ let r;
342
+ e ? r = (s = this.subscribers[e]) !== null && s !== void 0 ? s : this.subscribers[e] = new rt(this.subject) : r = (n = this.subjectSubscribers) !== null && n !== void 0 ? n : this.subjectSubscribers = new rt(this.subject), r.subscribe(t);
307
343
  }
308
344
  /**
309
345
  * Unsubscribes from notification of changes in an object's state.
310
346
  * @param subscriber - The object that is unsubscribing from change notification.
311
347
  * @param propertyToUnwatch - The name of the property that the subscriber is no longer interested in watching.
312
348
  */
313
- unsubscribe(e, t) {
314
- var i;
315
- if (t) {
316
- const n = this.subscribers[t];
317
- n !== void 0 && n.unsubscribe(e);
318
- } else
319
- (i = this.sourceSubscribers) === null || i === void 0 || i.unsubscribe(e);
349
+ unsubscribe(t, e) {
350
+ var s, n;
351
+ e ? (s = this.subscribers[e]) === null || s === void 0 || s.unsubscribe(t) : (n = this.subjectSubscribers) === null || n === void 0 || n.unsubscribe(t);
320
352
  }
321
353
  }
322
- const b = S.getById(2, () => {
323
- const s = /(:|&&|\|\||if)/, e = /* @__PURE__ */ new WeakMap(), t = u.queueUpdate;
324
- let i, n = (l) => {
325
- throw new Error("Must call enableArrayObservation before observing arrays.");
354
+ const J = Object.freeze({
355
+ /**
356
+ * The source to controller lifetime relationship is unknown.
357
+ */
358
+ unknown: void 0,
359
+ /**
360
+ * The source and controller lifetimes are coupled to one another.
361
+ * They can/will be GC'd together.
362
+ */
363
+ coupled: 1
364
+ }), b = y.getById(N.observable, () => {
365
+ const i = Ut.enqueue, t = /(:|&&|\|\||if|\?\.)/, e = /* @__PURE__ */ new WeakMap();
366
+ let s, n = (l) => {
367
+ throw y.error(
368
+ 1101
369
+ /* Message.needsArrayObservation */
370
+ );
326
371
  };
327
372
  function r(l) {
328
- let h = l.$fastController || e.get(l);
329
- return h === void 0 && (Array.isArray(l) ? h = n(l) : e.set(l, h = new ie(l))), h;
330
- }
331
- const o = _();
332
- class a {
333
- constructor(h) {
334
- this.name = h, this.field = `_${h}`, this.callback = `${h}Changed`;
335
- }
336
- getValue(h) {
337
- return i !== void 0 && i.watch(h, this.name), h[this.field];
338
- }
339
- setValue(h, d) {
340
- const f = this.field, y = h[f];
341
- if (y !== d) {
342
- h[f] = d;
343
- const p = h[this.callback];
344
- typeof p == "function" && p.call(h, y, d), r(h).notify(this.name);
373
+ var o;
374
+ let h = (o = l.$fastController) !== null && o !== void 0 ? o : e.get(l);
375
+ return h === void 0 && (Array.isArray(l) ? h = n(l) : e.set(l, h = new Wt(l))), h;
376
+ }
377
+ const a = zt();
378
+ class c {
379
+ constructor(o) {
380
+ this.name = o, this.field = `_${o}`, this.callback = `${o}Changed`;
381
+ }
382
+ getValue(o) {
383
+ return s !== void 0 && s.watch(o, this.name), o[this.field];
384
+ }
385
+ setValue(o, h) {
386
+ const u = this.field, p = o[u];
387
+ if (p !== h) {
388
+ o[u] = h;
389
+ const $ = o[this.callback];
390
+ O($) && $.call(o, p, h), r(o).notify(this.name);
345
391
  }
346
392
  }
347
393
  }
348
- class c extends I {
349
- constructor(h, d, f = !1) {
350
- super(h, d), this.binding = h, this.isVolatileBinding = f, this.needsRefresh = !0, this.needsQueue = !0, this.first = this, this.last = null, this.propertySource = void 0, this.propertyName = void 0, this.notifier = void 0, this.next = void 0;
394
+ class d extends rt {
395
+ constructor(o, h, u = !1) {
396
+ super(o, h), this.expression = o, this.isVolatileBinding = u, this.needsRefresh = !0, this.needsQueue = !0, this.isAsync = !0, this.first = this, this.last = null, this.propertySource = void 0, this.propertyName = void 0, this.notifier = void 0, this.next = void 0;
397
+ }
398
+ setMode(o) {
399
+ this.isAsync = this.needsQueue = o;
351
400
  }
352
- observe(h, d) {
353
- this.needsRefresh && this.last !== null && this.disconnect();
354
- const f = i;
355
- i = this.needsRefresh ? this : void 0, this.needsRefresh = this.isVolatileBinding;
356
- const y = this.binding(h, d);
357
- return i = f, y;
401
+ bind(o) {
402
+ this.controller = o;
403
+ const h = this.observe(o.source, o.context);
404
+ return !o.isBound && this.requiresUnbind(o) && o.onUnbind(this), h;
358
405
  }
406
+ requiresUnbind(o) {
407
+ return o.sourceLifetime !== J.coupled || this.first !== this.last || this.first.propertySource !== o.source;
408
+ }
409
+ unbind(o) {
410
+ this.dispose();
411
+ }
412
+ observe(o, h) {
413
+ this.needsRefresh && this.last !== null && this.dispose();
414
+ const u = s;
415
+ s = this.needsRefresh ? this : void 0, this.needsRefresh = this.isVolatileBinding;
416
+ let p;
417
+ try {
418
+ p = this.expression(o, h);
419
+ } finally {
420
+ s = u;
421
+ }
422
+ return p;
423
+ }
424
+ // backwards compat with v1 kernel
359
425
  disconnect() {
426
+ this.dispose();
427
+ }
428
+ dispose() {
360
429
  if (this.last !== null) {
361
- let h = this.first;
362
- for (; h !== void 0; )
363
- h.notifier.unsubscribe(this, h.propertyName), h = h.next;
364
- this.last = null, this.needsRefresh = this.needsQueue = !0;
430
+ let o = this.first;
431
+ for (; o !== void 0; )
432
+ o.notifier.unsubscribe(this, o.propertyName), o = o.next;
433
+ this.last = null, this.needsRefresh = this.needsQueue = this.isAsync;
365
434
  }
366
435
  }
367
- watch(h, d) {
368
- const f = this.last, y = r(h), p = f === null ? this.first : {};
369
- if (p.propertySource = h, p.propertyName = d, p.notifier = y, y.subscribe(this, d), f !== null) {
436
+ watch(o, h) {
437
+ const u = this.last, p = r(o), $ = u === null ? this.first : {};
438
+ if ($.propertySource = o, $.propertyName = h, $.notifier = p, p.subscribe(this, h), u !== null) {
370
439
  if (!this.needsRefresh) {
371
- let z;
372
- i = void 0, z = f.propertySource[f.propertyName], i = this, h === z && (this.needsRefresh = !0);
440
+ let ut;
441
+ s = void 0, ut = u.propertySource[u.propertyName], s = this, o === ut && (this.needsRefresh = !0);
373
442
  }
374
- f.next = p;
443
+ u.next = $;
375
444
  }
376
- this.last = p;
445
+ this.last = $;
377
446
  }
378
447
  handleChange() {
379
- this.needsQueue && (this.needsQueue = !1, t(this));
448
+ this.needsQueue ? (this.needsQueue = !1, i(this)) : this.isAsync || this.call();
380
449
  }
381
450
  call() {
382
- this.last !== null && (this.needsQueue = !0, this.notify(this));
383
- }
384
- records() {
385
- let h = this.first;
386
- return {
387
- next: () => {
388
- const d = h;
389
- return d === void 0 ? { value: void 0, done: !0 } : (h = h.next, {
390
- value: d,
391
- done: !1
392
- });
393
- },
394
- [Symbol.iterator]: function() {
395
- return this;
396
- }
397
- };
451
+ this.last !== null && (this.needsQueue = this.isAsync, this.notify(this));
452
+ }
453
+ *records() {
454
+ let o = this.first;
455
+ for (; o !== void 0; )
456
+ yield o, o = o.next;
398
457
  }
399
458
  }
400
- return Object.freeze({
459
+ return x(d), Object.freeze({
401
460
  /**
402
461
  * @internal
403
462
  * @param factory - The factory used to create array observers.
@@ -415,23 +474,23 @@ const b = S.getById(2, () => {
415
474
  * @param source - The object to record the change against.
416
475
  * @param propertyName - The property to track as changed.
417
476
  */
418
- track(l, h) {
419
- i !== void 0 && i.watch(l, h);
477
+ track(l, o) {
478
+ s && s.watch(l, o);
420
479
  },
421
480
  /**
422
481
  * Notifies watchers that the currently executing property getter or function is volatile
423
482
  * with respect to its observable dependencies.
424
483
  */
425
484
  trackVolatile() {
426
- i !== void 0 && (i.needsRefresh = !0);
485
+ s && (s.needsRefresh = !0);
427
486
  },
428
487
  /**
429
488
  * Notifies subscribers of a source object of changes.
430
489
  * @param source - the object to notify of changes.
431
490
  * @param args - The change args to pass to subscribers.
432
491
  */
433
- notify(l, h) {
434
- r(l).notify(h);
492
+ notify(l, o) {
493
+ r(l).notify(o);
435
494
  },
436
495
  /**
437
496
  * Defines an observable property on an object or prototype.
@@ -439,14 +498,14 @@ const b = S.getById(2, () => {
439
498
  * @param nameOrAccessor - The name of the property to define as observable;
440
499
  * or a custom accessor that specifies the property name and accessor implementation.
441
500
  */
442
- defineProperty(l, h) {
443
- typeof h == "string" && (h = new a(h)), o(l).push(h), Reflect.defineProperty(l, h.name, {
501
+ defineProperty(l, o) {
502
+ B(o) && (o = new c(o)), a(l).push(o), Reflect.defineProperty(l, o.name, {
444
503
  enumerable: !0,
445
- get: function() {
446
- return h.getValue(this);
504
+ get() {
505
+ return o.getValue(this);
447
506
  },
448
- set: function(d) {
449
- h.setValue(this, d);
507
+ set(h) {
508
+ o.setValue(this, h);
450
509
  }
451
510
  });
452
511
  },
@@ -455,124 +514,387 @@ const b = S.getById(2, () => {
455
514
  * including its prototype chain.
456
515
  * @param target - The target object to search for accessor on.
457
516
  */
458
- getAccessors: o,
517
+ getAccessors: a,
459
518
  /**
460
- * Creates a {@link BindingObserver} that can watch the
461
- * provided {@link Binding} for changes.
462
- * @param binding - The binding to observe.
519
+ * Creates a {@link ExpressionNotifier} that can watch the
520
+ * provided {@link Expression} for changes.
521
+ * @param expression - The binding to observe.
463
522
  * @param initialSubscriber - An initial subscriber to changes in the binding value.
464
523
  * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
465
524
  */
466
- binding(l, h, d = this.isVolatileBinding(l)) {
467
- return new c(l, h, d);
525
+ binding(l, o, h = this.isVolatileBinding(l)) {
526
+ return new d(l, o, h);
468
527
  },
469
528
  /**
470
529
  * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
471
530
  * on every evaluation of the value.
472
- * @param binding - The binding to inspect.
531
+ * @param expression - The binding to inspect.
473
532
  */
474
533
  isVolatileBinding(l) {
475
- return s.test(l.toString());
534
+ return t.test(l.toString());
476
535
  }
477
536
  });
478
537
  });
479
- function Ge(s, e) {
480
- b.defineProperty(s, e);
538
+ function fi(i, t) {
539
+ b.defineProperty(i, t);
481
540
  }
482
- function Je(s, e, t) {
483
- return Object.assign({}, t, {
484
- get: function() {
485
- return b.trackVolatile(), t.get.apply(this);
541
+ function pi(i, t, e) {
542
+ return Object.assign({}, e, {
543
+ get() {
544
+ return b.trackVolatile(), e.get.apply(this);
486
545
  }
487
546
  });
488
547
  }
489
- const q = S.getById(3, () => {
490
- let s = null;
548
+ const bt = y.getById(N.contextEvent, () => {
549
+ let i = null;
491
550
  return {
492
551
  get() {
493
- return s;
552
+ return i;
494
553
  },
495
- set(e) {
496
- s = e;
554
+ set(t) {
555
+ i = t;
497
556
  }
498
557
  };
499
- });
500
- class C {
501
- constructor() {
502
- this.index = 0, this.length = 0, this.parent = null, this.parentContext = null;
558
+ }), E = Object.freeze({
559
+ /**
560
+ * A default execution context.
561
+ */
562
+ default: {
563
+ index: 0,
564
+ length: 0,
565
+ get event() {
566
+ return E.getEvent();
567
+ },
568
+ eventDetail() {
569
+ return this.event.detail;
570
+ },
571
+ eventTarget() {
572
+ return this.event.target;
573
+ }
574
+ },
575
+ /**
576
+ * Gets the current event.
577
+ * @returns An event object.
578
+ */
579
+ getEvent() {
580
+ return bt.get();
581
+ },
582
+ /**
583
+ * Sets the current event.
584
+ * @param event - An event object.
585
+ */
586
+ setEvent(i) {
587
+ bt.set(i);
503
588
  }
589
+ });
590
+ class lt {
504
591
  /**
505
- * The current event within an event handler.
592
+ * Creates a binding.
593
+ * @param evaluate - Evaluates the binding.
594
+ * @param policy - The security policy to associate with this binding.
595
+ * @param isVolatile - Indicates whether the binding is volatile.
506
596
  */
507
- get event() {
508
- return q.get();
597
+ constructor(t, e, s = !1) {
598
+ this.evaluate = t, this.policy = e, this.isVolatile = s;
599
+ }
600
+ }
601
+ class ye extends lt {
602
+ createObserver(t) {
603
+ return b.binding(this.evaluate, t, this.isVolatile);
509
604
  }
605
+ }
606
+ function qt(i, t, e = b.isVolatileBinding(i)) {
607
+ return new ye(i, t, e);
608
+ }
609
+ class Qt extends lt {
610
+ createObserver() {
611
+ return this;
612
+ }
613
+ bind(t) {
614
+ return this.evaluate(t.source, t.context);
615
+ }
616
+ }
617
+ x(Qt);
618
+ function Gt(i, t) {
619
+ return new Qt(i, t);
620
+ }
621
+ let gt;
622
+ function Jt(i) {
623
+ return i.map((t) => t instanceof m ? Jt(t.styles) : [t]).reduce((t, e) => t.concat(e), []);
624
+ }
625
+ class m {
510
626
  /**
511
- * Indicates whether the current item within a repeat context
512
- * has an even index.
627
+ * Creates an instance of ElementStyles.
628
+ * @param styles - The styles that will be associated with elements.
513
629
  */
514
- get isEven() {
515
- return this.index % 2 === 0;
630
+ constructor(t) {
631
+ this.styles = t, this.targets = /* @__PURE__ */ new WeakSet(), this._strategy = null, this.behaviors = t.map((e) => e instanceof m ? e.behaviors : null).reduce((e, s) => s === null ? e : e === null ? s : e.concat(s), null);
516
632
  }
517
633
  /**
518
- * Indicates whether the current item within a repeat context
519
- * has an odd index.
634
+ * Gets the StyleStrategy associated with these element styles.
520
635
  */
521
- get isOdd() {
522
- return this.index % 2 !== 0;
636
+ get strategy() {
637
+ return this._strategy === null && this.withStrategy(gt), this._strategy;
638
+ }
639
+ /** @internal */
640
+ addStylesTo(t) {
641
+ this.strategy.addStylesTo(t), this.targets.add(t);
642
+ }
643
+ /** @internal */
644
+ removeStylesFrom(t) {
645
+ this.strategy.removeStylesFrom(t), this.targets.delete(t);
646
+ }
647
+ /** @internal */
648
+ isAttachedTo(t) {
649
+ return this.targets.has(t);
523
650
  }
524
651
  /**
525
- * Indicates whether the current item within a repeat context
526
- * is the first item in the collection.
652
+ * Associates behaviors with this set of styles.
653
+ * @param behaviors - The behaviors to associate.
527
654
  */
528
- get isFirst() {
529
- return this.index === 0;
655
+ withBehaviors(...t) {
656
+ return this.behaviors = this.behaviors === null ? t : this.behaviors.concat(t), this;
530
657
  }
531
658
  /**
532
- * Indicates whether the current item within a repeat context
533
- * is somewhere in the middle of the collection.
659
+ * Sets the strategy that handles adding/removing these styles for an element.
660
+ * @param strategy - The strategy to use.
534
661
  */
535
- get isInMiddle() {
536
- return !this.isFirst && !this.isLast;
662
+ withStrategy(t) {
663
+ return this._strategy = new t(Jt(this.styles)), this;
537
664
  }
538
665
  /**
539
- * Indicates whether the current item within a repeat context
540
- * is the last item in the collection.
666
+ * Sets the default strategy type to use when creating style strategies.
667
+ * @param Strategy - The strategy type to construct.
541
668
  */
542
- get isLast() {
543
- return this.index === this.length - 1;
669
+ static setDefaultStrategy(t) {
670
+ gt = t;
544
671
  }
545
672
  /**
546
- * Sets the event for the current execution context.
547
- * @param event - The event to set.
548
- * @internal
673
+ * Normalizes a set of composable style options.
674
+ * @param styles - The style options to normalize.
675
+ * @returns A singular ElementStyles instance or undefined.
549
676
  */
550
- static setEvent(e) {
551
- q.set(e);
677
+ static normalize(t) {
678
+ return t === void 0 ? void 0 : Array.isArray(t) ? new m(t) : t instanceof m ? t : new m([t]);
552
679
  }
553
680
  }
554
- b.defineProperty(C.prototype, "index");
555
- b.defineProperty(C.prototype, "length");
556
- const w = Object.seal(new C());
557
- class P {
558
- constructor() {
559
- this.targetIndex = 0;
560
- }
681
+ m.supportsAdoptedStyleSheets = Array.isArray(document.adoptedStyleSheets) && "replace" in CSSStyleSheet.prototype;
682
+ const yt = /fe-b\$\$start\$\$(\d+)\$\$(.+)\$\$fe-b/, vt = /fe-b\$\$end\$\$(\d+)\$\$(.+)\$\$fe-b/, mt = /fe-repeat\$\$start\$\$(\d+)\$\$fe-repeat/, wt = /fe-repeat\$\$end\$\$(\d+)\$\$fe-repeat/, St = /^(?:.{0,1000})fe-eb\$\$start\$\$(.+?)\$\$fe-eb/, Ct = /fe-eb\$\$end\$\$(.{0,1000})\$\$fe-eb(?:.{0,1000})$/;
683
+ function $t(i) {
684
+ return i && i.nodeType === Node.COMMENT_NODE;
561
685
  }
562
- class ne extends P {
563
- constructor() {
564
- super(...arguments), this.createPlaceholder = u.createInterpolationPlaceholder;
686
+ const w = Object.freeze({
687
+ attributeMarkerName: "data-fe-b",
688
+ attributeBindingSeparator: " ",
689
+ contentBindingStartMarker(i, t) {
690
+ return `fe-b$$start$$${i}$$${t}$$fe-b`;
691
+ },
692
+ contentBindingEndMarker(i, t) {
693
+ return `fe-b$$end$$${i}$$${t}$$fe-b`;
694
+ },
695
+ repeatStartMarker(i) {
696
+ return `fe-repeat$$start$$${i}$$fe-repeat`;
697
+ },
698
+ repeatEndMarker(i) {
699
+ return `fe-repeat$$end$$${i}$$fe-repeat`;
700
+ },
701
+ isContentBindingStartMarker(i) {
702
+ return yt.test(i);
703
+ },
704
+ isContentBindingEndMarker(i) {
705
+ return vt.test(i);
706
+ },
707
+ isRepeatViewStartMarker(i) {
708
+ return mt.test(i);
709
+ },
710
+ isRepeatViewEndMarker(i) {
711
+ return wt.test(i);
712
+ },
713
+ isElementBoundaryStartMarker(i) {
714
+ return $t(i) && St.test(i.data.trim());
715
+ },
716
+ isElementBoundaryEndMarker(i) {
717
+ return $t(i) && Ct.test(i.data);
718
+ },
719
+ /**
720
+ * Returns the indexes of the ViewBehaviorFactories affecting
721
+ * attributes for the element, or null if no factories were found.
722
+ */
723
+ parseAttributeBinding(i) {
724
+ const t = i.getAttribute(this.attributeMarkerName);
725
+ return t === null ? t : t.split(this.attributeBindingSeparator).map((e) => parseInt(e));
726
+ },
727
+ /**
728
+ * Returns the indexes of the ViewBehaviorFactories affecting
729
+ * attributes for the element, or null if no factories were found.
730
+ *
731
+ * Uses the alternative syntax of data-fe-b-<number>
732
+ */
733
+ parseEnumeratedAttributeBinding(i) {
734
+ const t = [], e = this.attributeMarkerName.length + 1, s = `${this.attributeMarkerName}-`;
735
+ for (const n of i.getAttributeNames())
736
+ if (n.startsWith(s)) {
737
+ const r = Number(n.slice(e));
738
+ if (!Number.isNaN(r))
739
+ t.push(r);
740
+ else
741
+ throw new Error(`Invalid attribute marker name: ${n}. Expected format is ${s}<number>.`);
742
+ }
743
+ return t.length === 0 ? null : t;
744
+ },
745
+ /**
746
+ * Parses the ViewBehaviorFactory index from string data. Returns
747
+ * the binding index or null if the index cannot be retrieved.
748
+ */
749
+ parseContentBindingStartMarker(i) {
750
+ return Nt(yt, i);
751
+ },
752
+ parseContentBindingEndMarker(i) {
753
+ return Nt(vt, i);
754
+ },
755
+ /**
756
+ * Parses the index of a repeat directive from a content string.
757
+ */
758
+ parseRepeatStartMarker(i) {
759
+ return Tt(mt, i);
760
+ },
761
+ parseRepeatEndMarker(i) {
762
+ return Tt(wt, i);
763
+ },
764
+ /**
765
+ * Parses element Id from element boundary markers
766
+ */
767
+ parseElementBoundaryStartMarker(i) {
768
+ return kt(St, i.trim());
769
+ },
770
+ parseElementBoundaryEndMarker(i) {
771
+ return kt(Ct, i);
565
772
  }
773
+ });
774
+ function Tt(i, t) {
775
+ const e = i.exec(t);
776
+ return e === null ? e : parseInt(e[1]);
777
+ }
778
+ function kt(i, t) {
779
+ const e = i.exec(t);
780
+ return e === null ? e : e[1];
781
+ }
782
+ function Nt(i, t) {
783
+ const e = i.exec(t);
784
+ return e === null ? e : [parseInt(e[1]), e[2]];
566
785
  }
567
- class Xe extends P {
786
+ const z = Symbol.for("fe-hydration");
787
+ function U(i) {
788
+ return i[z] === z;
789
+ }
790
+ const ct = `fast-${Math.random().toString(36).substring(2, 8)}`, D = `${ct}{`, _ = `}${ct}`, ve = _.length;
791
+ let me = 0;
792
+ const L = () => `${ct}-${++me}`, Kt = Object.freeze({
793
+ /**
794
+ * Creates a placeholder string suitable for marking out a location *within*
795
+ * an attribute value or HTML content.
796
+ * @param index - The directive index to create the placeholder for.
797
+ * @remarks
798
+ * Used internally by binding directives.
799
+ */
800
+ interpolation: (i) => `${D}${i}${_}`,
801
+ /**
802
+ * Creates a placeholder that manifests itself as an attribute on an
803
+ * element.
804
+ * @param attributeName - The name of the custom attribute.
805
+ * @param index - The directive index to create the placeholder for.
806
+ * @remarks
807
+ * Used internally by attribute directives such as `ref`, `slotted`, and `children`.
808
+ */
809
+ attribute: (i) => `${L()}="${D}${i}${_}"`,
810
+ /**
811
+ * Creates a placeholder that manifests itself as a marker within the DOM structure.
812
+ * @param index - The directive index to create the placeholder for.
813
+ * @remarks
814
+ * Used internally by structural directives such as `repeat`.
815
+ */
816
+ comment: (i) => `<!--${D}${i}${_}-->`
817
+ }), K = Object.freeze({
818
+ /**
819
+ * Parses text content or HTML attribute content, separating out the static strings
820
+ * from the directives.
821
+ * @param value - The content or attribute string to parse.
822
+ * @param factories - A list of directives to search for in the string.
823
+ * @returns A heterogeneous array of static strings interspersed with
824
+ * directives or null if no directives are found in the string.
825
+ */
826
+ parse(i, t) {
827
+ const e = i.split(D);
828
+ if (e.length === 1)
829
+ return null;
830
+ const s = [];
831
+ for (let n = 0, r = e.length; n < r; ++n) {
832
+ const a = e[n], c = a.indexOf(_);
833
+ let d;
834
+ if (c === -1)
835
+ d = a;
836
+ else {
837
+ const l = a.substring(0, c);
838
+ s.push(t[l]), d = a.substring(c + ve);
839
+ }
840
+ d !== "" && s.push(d);
841
+ }
842
+ return s;
843
+ }
844
+ }), et = Pt(), k = Object.freeze({
845
+ /**
846
+ * Gets the directive definition associated with the instance.
847
+ * @param instance - The directive instance to retrieve the definition for.
848
+ */
849
+ getForInstance: et.getForInstance,
850
+ /**
851
+ * Gets the directive definition associated with the specified type.
852
+ * @param type - The directive type to retrieve the definition for.
853
+ */
854
+ getByType: et.getByType,
855
+ /**
856
+ * Defines an HTMLDirective based on the options.
857
+ * @param type - The type to define as a directive.
858
+ * @param options - Options that specify the directive's application.
859
+ */
860
+ define(i, t) {
861
+ return t = t || {}, t.type = i, et.register(t), i;
862
+ },
568
863
  /**
569
864
  *
570
- * @param name - The name of the behavior; used as a custom attribute on the element.
571
- * @param behavior - The behavior to instantiate and attach to the element.
572
- * @param options - Options to pass to the behavior during creation.
865
+ * @param directive - The directive to assign the aspect to.
866
+ * @param value - The value to base the aspect determination on.
867
+ * @remarks
868
+ * If a falsy value is provided, then the content aspect will be assigned.
869
+ */
870
+ assignAspect(i, t) {
871
+ if (!t) {
872
+ i.aspectType = g.content;
873
+ return;
874
+ }
875
+ switch (i.sourceAspect = t, t[0]) {
876
+ case ":":
877
+ i.targetAspect = t.substring(1), i.aspectType = i.targetAspect === "classList" ? g.tokenList : g.property;
878
+ break;
879
+ case "?":
880
+ i.targetAspect = t.substring(1), i.aspectType = g.booleanAttribute;
881
+ break;
882
+ case "@":
883
+ i.targetAspect = t.substring(1), i.aspectType = g.event;
884
+ break;
885
+ default:
886
+ i.targetAspect = t, i.aspectType = g.attribute;
887
+ break;
888
+ }
889
+ }
890
+ });
891
+ class we {
892
+ /**
893
+ * Creates an instance of RefDirective.
894
+ * @param options - The options to use in configuring the directive.
573
895
  */
574
- constructor(e, t, i) {
575
- super(), this.name = e, this.behavior = t, this.options = i;
896
+ constructor(t) {
897
+ this.options = t;
576
898
  }
577
899
  /**
578
900
  * Creates a placeholder string based on the directive's index within the template.
@@ -580,287 +902,225 @@ class Xe extends P {
580
902
  * @remarks
581
903
  * Creates a custom attribute placeholder.
582
904
  */
583
- createPlaceholder(e) {
584
- return u.createCustomAttributePlaceholder(this.name, e);
905
+ createHTML(t) {
906
+ return Kt.attribute(t(this));
585
907
  }
586
908
  /**
587
- * Creates a behavior for the provided target node.
588
- * @param target - The node instance to create the behavior for.
589
- * @remarks
590
- * Creates an instance of the `behavior` type this directive was constructed with
591
- * and passes the target and options to that `behavior`'s constructor.
909
+ * Creates a behavior.
910
+ * @param targets - The targets available for behaviors to be attached to.
592
911
  */
593
- createBehavior(e) {
594
- return new this.behavior(e, this.options);
912
+ createBehavior() {
913
+ return this;
595
914
  }
596
915
  }
597
- function be(s, e) {
598
- this.source = s, this.context = e, this.bindingObserver === null && (this.bindingObserver = b.binding(this.binding, this, this.isBindingVolatile)), this.updateTarget(this.bindingObserver.observe(s, e));
599
- }
600
- function pe(s, e) {
601
- this.source = s, this.context = e, this.target.addEventListener(this.targetName, this);
602
- }
603
- function ge() {
604
- this.bindingObserver.disconnect(), this.source = null, this.context = null;
916
+ x(we);
917
+ class Xt extends Error {
918
+ constructor(t, e, s) {
919
+ super(t), this.factories = e, this.node = s;
920
+ }
605
921
  }
606
- function ve() {
607
- this.bindingObserver.disconnect(), this.source = null, this.context = null;
608
- const s = this.target.$fastView;
609
- s !== void 0 && s.isComposed && (s.unbind(), s.needsBindOnly = !0);
922
+ function dt(i) {
923
+ return i.nodeType === Node.COMMENT_NODE;
610
924
  }
611
- function ye() {
612
- this.target.removeEventListener(this.targetName, this), this.source = null, this.context = null;
925
+ function Yt(i) {
926
+ return i.nodeType === Node.TEXT_NODE;
613
927
  }
614
- function me(s) {
615
- u.setAttribute(this.target, this.targetName, s);
928
+ function Zt(i, t) {
929
+ const e = document.createRange();
930
+ return e.setStart(i, 0), e.setEnd(t, dt(t) || Yt(t) ? t.data.length : t.childNodes.length), e;
616
931
  }
617
- function Se(s) {
618
- u.setBooleanAttribute(this.target, this.targetName, s);
932
+ function Se(i) {
933
+ return i instanceof DocumentFragment && "mode" in i;
619
934
  }
620
- function Ce(s) {
621
- if (s == null && (s = ""), s.create) {
622
- this.target.textContent = "";
623
- let e = this.target.$fastView;
624
- e === void 0 ? e = s.create() : this.target.$fastTemplate !== s && (e.isComposed && (e.remove(), e.unbind()), e = s.create()), e.isComposed ? e.needsBindOnly && (e.needsBindOnly = !1, e.bind(this.source, this.context)) : (e.isComposed = !0, e.bind(this.source, this.context), e.insertBefore(this.target), this.target.$fastView = e, this.target.$fastTemplate = s);
625
- } else {
626
- const e = this.target.$fastView;
627
- e !== void 0 && e.isComposed && (e.isComposed = !1, e.remove(), e.needsBindOnly ? e.needsBindOnly = !1 : e.unbind()), this.target.textContent = s;
935
+ function Ce(i, t, e) {
936
+ const s = Zt(i, t), n = s.commonAncestorContainer, r = document.createTreeWalker(n, NodeFilter.SHOW_ELEMENT + NodeFilter.SHOW_COMMENT + NodeFilter.SHOW_TEXT, {
937
+ acceptNode(l) {
938
+ return s.comparePoint(l, 0) === 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
939
+ }
940
+ }), a = {}, c = {};
941
+ let d = r.currentNode = i;
942
+ for (; d !== null; ) {
943
+ switch (d.nodeType) {
944
+ case Node.ELEMENT_NODE: {
945
+ $e(d, e, a);
946
+ break;
947
+ }
948
+ case Node.COMMENT_NODE: {
949
+ Te(d, r, e, a, c);
950
+ break;
951
+ }
952
+ }
953
+ d = r.nextNode();
628
954
  }
955
+ return s.detach(), { targets: a, boundaries: c };
629
956
  }
630
- function we(s) {
631
- this.target[this.targetName] = s;
957
+ function $e(i, t, e) {
958
+ var s;
959
+ const n = (s = w.parseAttributeBinding(i)) !== null && s !== void 0 ? s : w.parseEnumeratedAttributeBinding(i);
960
+ if (n !== null) {
961
+ for (const r of n) {
962
+ if (!t[r])
963
+ throw new Xt(`HydrationView was unable to successfully target factory on ${i.nodeName} inside ${i.getRootNode().host.nodeName}. This likely indicates a template mismatch between SSR rendering and hydration.`, t, i);
964
+ W(t[r], i, e);
965
+ }
966
+ i.removeAttribute(w.attributeMarkerName);
967
+ }
632
968
  }
633
- function xe(s) {
634
- const e = this.classVersions || /* @__PURE__ */ Object.create(null), t = this.target;
635
- let i = this.version || 0;
636
- if (s != null && s.length) {
637
- const n = s.split(/\s+/);
638
- for (let r = 0, o = n.length; r < o; ++r) {
639
- const a = n[r];
640
- a !== "" && (e[a] = i, t.classList.add(a));
969
+ function Te(i, t, e, s, n) {
970
+ if (w.isElementBoundaryStartMarker(i)) {
971
+ ke(i, t);
972
+ return;
973
+ }
974
+ if (w.isContentBindingStartMarker(i.data)) {
975
+ const r = w.parseContentBindingStartMarker(i.data);
976
+ if (r === null)
977
+ return;
978
+ const [a, c] = r, d = e[a], l = [];
979
+ let o = t.nextSibling();
980
+ i.data = "";
981
+ const h = o;
982
+ for (; o !== null; ) {
983
+ if (dt(o)) {
984
+ const u = w.parseContentBindingEndMarker(o.data);
985
+ if (u && u[1] === c)
986
+ break;
987
+ }
988
+ l.push(o), o = t.nextSibling();
989
+ }
990
+ if (o === null) {
991
+ const u = i.getRootNode();
992
+ throw new Error(`Error hydrating Comment node inside "${Se(u) ? u.host.nodeName : u.nodeName}".`);
993
+ }
994
+ if (o.data = "", l.length === 1 && Yt(l[0]))
995
+ W(d, l[0], s);
996
+ else {
997
+ o !== h && o.previousSibling !== null && (n[d.targetNodeId] = {
998
+ first: h,
999
+ last: o.previousSibling
1000
+ });
1001
+ const u = o.parentNode.insertBefore(document.createTextNode(""), o);
1002
+ W(d, u, s);
641
1003
  }
642
1004
  }
643
- if (this.classVersions = e, this.version = i + 1, i !== 0) {
644
- i -= 1;
645
- for (const n in e)
646
- e[n] === i && t.classList.remove(n);
1005
+ }
1006
+ function ke(i, t) {
1007
+ const e = w.parseElementBoundaryStartMarker(i.data);
1008
+ let s = t.nextSibling();
1009
+ for (; s !== null; ) {
1010
+ if (dt(s)) {
1011
+ const n = w.parseElementBoundaryEndMarker(s.data);
1012
+ if (n && n === e)
1013
+ break;
1014
+ }
1015
+ s = t.nextSibling();
647
1016
  }
648
1017
  }
649
- class L extends ne {
1018
+ function W(i, t, e) {
1019
+ if (i.targetNodeId === void 0)
1020
+ throw new Error("Factory could not be target to the node");
1021
+ e[i.targetNodeId] = t;
1022
+ }
1023
+ var te;
1024
+ function ot(i, t) {
1025
+ const e = i.parentNode;
1026
+ let s = i, n;
1027
+ for (; s !== t; ) {
1028
+ if (n = s.nextSibling, !n)
1029
+ throw new Error(`Unmatched first/last child inside "${t.getRootNode().host.nodeName}".`);
1030
+ e.removeChild(s), s = n;
1031
+ }
1032
+ e.removeChild(t);
1033
+ }
1034
+ class ee {
1035
+ constructor() {
1036
+ this.index = 0, this.length = 0;
1037
+ }
650
1038
  /**
651
- * Creates an instance of BindingDirective.
652
- * @param binding - A binding that returns the data used to update the DOM.
1039
+ * The current event within an event handler.
653
1040
  */
654
- constructor(e) {
655
- super(), this.binding = e, this.bind = be, this.unbind = ge, this.updateTarget = me, this.isBindingVolatile = b.isVolatileBinding(this.binding);
1041
+ get event() {
1042
+ return E.getEvent();
656
1043
  }
657
1044
  /**
658
- * Gets/sets the name of the attribute or property that this
659
- * binding is targeting.
1045
+ * Indicates whether the current item within a repeat context
1046
+ * has an even index.
660
1047
  */
661
- get targetName() {
662
- return this.originalTargetName;
663
- }
664
- set targetName(e) {
665
- if (this.originalTargetName = e, e !== void 0)
666
- switch (e[0]) {
667
- case ":":
668
- if (this.cleanedTargetName = e.substr(1), this.updateTarget = we, this.cleanedTargetName === "innerHTML") {
669
- const t = this.binding;
670
- this.binding = (i, n) => u.createHTML(t(i, n));
671
- }
672
- break;
673
- case "?":
674
- this.cleanedTargetName = e.substr(1), this.updateTarget = Se;
675
- break;
676
- case "@":
677
- this.cleanedTargetName = e.substr(1), this.bind = pe, this.unbind = ye;
678
- break;
679
- default:
680
- this.cleanedTargetName = e, e === "class" && (this.updateTarget = xe);
681
- break;
682
- }
1048
+ get isEven() {
1049
+ return this.index % 2 === 0;
683
1050
  }
684
1051
  /**
685
- * Makes this binding target the content of an element rather than
686
- * a particular attribute or property.
1052
+ * Indicates whether the current item within a repeat context
1053
+ * has an odd index.
687
1054
  */
688
- targetAtContent() {
689
- this.updateTarget = Ce, this.unbind = ve;
1055
+ get isOdd() {
1056
+ return this.index % 2 !== 0;
690
1057
  }
691
1058
  /**
692
- * Creates the runtime BindingBehavior instance based on the configuration
693
- * information stored in the BindingDirective.
694
- * @param target - The target node that the binding behavior should attach to.
1059
+ * Indicates whether the current item within a repeat context
1060
+ * is the first item in the collection.
695
1061
  */
696
- createBehavior(e) {
697
- return new Te(e, this.binding, this.isBindingVolatile, this.bind, this.unbind, this.updateTarget, this.cleanedTargetName);
1062
+ get isFirst() {
1063
+ return this.index === 0;
698
1064
  }
699
- }
700
- class Te {
701
1065
  /**
702
- * Creates an instance of BindingBehavior.
703
- * @param target - The target of the data updates.
704
- * @param binding - The binding that returns the latest value for an update.
705
- * @param isBindingVolatile - Indicates whether the binding has volatile dependencies.
706
- * @param bind - The operation to perform during binding.
707
- * @param unbind - The operation to perform during unbinding.
708
- * @param updateTarget - The operation to perform when updating.
709
- * @param targetName - The name of the target attribute or property to update.
1066
+ * Indicates whether the current item within a repeat context
1067
+ * is somewhere in the middle of the collection.
710
1068
  */
711
- constructor(e, t, i, n, r, o, a) {
712
- this.source = null, this.context = null, this.bindingObserver = null, this.target = e, this.binding = t, this.isBindingVolatile = i, this.bind = n, this.unbind = r, this.updateTarget = o, this.targetName = a;
713
- }
714
- /** @internal */
715
- handleChange() {
716
- this.updateTarget(this.bindingObserver.observe(this.source, this.context));
717
- }
718
- /** @internal */
719
- handleEvent(e) {
720
- C.setEvent(e);
721
- const t = this.binding(this.source, this.context);
722
- C.setEvent(null), t !== !0 && e.preventDefault();
723
- }
724
- }
725
- let F = null;
726
- class j {
727
- addFactory(e) {
728
- e.targetIndex = this.targetIndex, this.behaviorFactories.push(e);
729
- }
730
- captureContentBinding(e) {
731
- e.targetAtContent(), this.addFactory(e);
1069
+ get isInMiddle() {
1070
+ return !this.isFirst && !this.isLast;
732
1071
  }
733
- reset() {
734
- this.behaviorFactories = [], this.targetIndex = -1;
1072
+ /**
1073
+ * Indicates whether the current item within a repeat context
1074
+ * is the last item in the collection.
1075
+ */
1076
+ get isLast() {
1077
+ return this.index === this.length - 1;
735
1078
  }
736
- release() {
737
- F = this;
1079
+ /**
1080
+ * Returns the typed event detail of a custom event.
1081
+ */
1082
+ eventDetail() {
1083
+ return this.event.detail;
738
1084
  }
739
- static borrow(e) {
740
- const t = F || new j();
741
- return t.directives = e, t.reset(), F = null, t;
1085
+ /**
1086
+ * Returns the typed event target of the event.
1087
+ */
1088
+ eventTarget() {
1089
+ return this.event.target;
742
1090
  }
743
1091
  }
744
- function Ae(s) {
745
- if (s.length === 1)
746
- return s[0];
747
- let e;
748
- const t = s.length, i = s.map((o) => typeof o == "string" ? () => o : (e = o.targetName || e, o.binding)), n = (o, a) => {
749
- let c = "";
750
- for (let l = 0; l < t; ++l)
751
- c += i[l](o, a);
752
- return c;
753
- }, r = new L(n);
754
- return r.targetName = e, r;
755
- }
756
- const Be = R.length;
757
- function re(s, e) {
758
- const t = e.split(se);
759
- if (t.length === 1)
760
- return null;
761
- const i = [];
762
- for (let n = 0, r = t.length; n < r; ++n) {
763
- const o = t[n], a = o.indexOf(R);
764
- let c;
765
- if (a === -1)
766
- c = o;
767
- else {
768
- const l = parseInt(o.substring(0, a));
769
- i.push(s.directives[l]), c = o.substring(a + Be);
770
- }
771
- c !== "" && i.push(c);
772
- }
773
- return i;
774
- }
775
- function U(s, e, t = !1) {
776
- const i = e.attributes;
777
- for (let n = 0, r = i.length; n < r; ++n) {
778
- const o = i[n], a = o.value, c = re(s, a);
779
- let l = null;
780
- c === null ? t && (l = new L(() => a), l.targetName = o.name) : l = Ae(c), l !== null && (e.removeAttributeNode(o), n--, r--, s.addFactory(l));
781
- }
782
- }
783
- function Ne(s, e, t) {
784
- const i = re(s, e.textContent);
785
- if (i !== null) {
786
- let n = e;
787
- for (let r = 0, o = i.length; r < o; ++r) {
788
- const a = i[r], c = r === 0 ? e : n.parentNode.insertBefore(document.createTextNode(""), n.nextSibling);
789
- typeof a == "string" ? c.textContent = a : (c.textContent = " ", s.captureContentBinding(a)), n = c, s.targetIndex++, c !== e && t.nextNode();
790
- }
791
- s.targetIndex--;
792
- }
793
- }
794
- function ke(s, e) {
795
- const t = s.content;
796
- document.adoptNode(t);
797
- const i = j.borrow(e);
798
- U(i, s, !0);
799
- const n = i.behaviorFactories;
800
- i.reset();
801
- const r = u.createTemplateWalker(t);
802
- let o;
803
- for (; o = r.nextNode(); )
804
- switch (i.targetIndex++, o.nodeType) {
805
- case 1:
806
- U(i, o);
807
- break;
808
- case 3:
809
- Ne(i, o, r);
810
- break;
811
- case 8:
812
- u.isMarker(o) && i.addFactory(e[u.extractDirectiveIndexFromMarker(o)]);
813
- }
814
- let a = 0;
815
- // If the first node in a fragment is a marker, that means it's an unstable first node,
816
- // because something like a when, repeat, etc. could add nodes before the marker.
817
- // To mitigate this, we insert a stable first node. However, if we insert a node,
818
- // that will alter the result of the TreeWalker. So, we also need to offset the target index.
819
- (u.isMarker(t.firstChild) || // Or if there is only one node and a directive, it means the template's content
820
- // is *only* the directive. In that case, HTMLView.dispose() misses any nodes inserted by
821
- // the directive. Inserting a new node ensures proper disposal of nodes added by the directive.
822
- t.childNodes.length === 1 && e.length) && (t.insertBefore(document.createComment(""), t.firstChild), a = -1);
823
- const c = i.behaviorFactories;
824
- return i.release(), {
825
- fragment: t,
826
- viewBehaviorFactories: c,
827
- hostBehaviorFactories: n,
828
- targetOffset: a
829
- };
830
- }
831
- const O = document.createRange();
832
- class Fe {
1092
+ class X extends ee {
833
1093
  /**
834
1094
  * Constructs an instance of HTMLView.
835
1095
  * @param fragment - The html fragment that contains the nodes for this view.
836
1096
  * @param behaviors - The behaviors to be applied to this view.
837
1097
  */
838
- constructor(e, t) {
839
- this.fragment = e, this.behaviors = t, this.source = null, this.context = null, this.firstChild = e.firstChild, this.lastChild = e.lastChild;
1098
+ constructor(t, e, s) {
1099
+ super(), this.fragment = t, this.factories = e, this.targets = s, this.behaviors = null, this.unbindables = [], this.source = null, this.isBound = !1, this.sourceLifetime = J.unknown, this.context = this, this.firstChild = t.firstChild, this.lastChild = t.lastChild;
840
1100
  }
841
1101
  /**
842
1102
  * Appends the view's DOM nodes to the referenced node.
843
1103
  * @param node - The parent node to append the view's DOM nodes to.
844
1104
  */
845
- appendTo(e) {
846
- e.appendChild(this.fragment);
1105
+ appendTo(t) {
1106
+ t.appendChild(this.fragment);
847
1107
  }
848
1108
  /**
849
1109
  * Inserts the view's DOM nodes before the referenced node.
850
1110
  * @param node - The node to insert the view's DOM before.
851
1111
  */
852
- insertBefore(e) {
1112
+ insertBefore(t) {
853
1113
  if (this.fragment.hasChildNodes())
854
- e.parentNode.insertBefore(this.fragment, e);
1114
+ t.parentNode.insertBefore(this.fragment, t);
855
1115
  else {
856
- const t = this.lastChild;
857
- if (e.previousSibling === t)
1116
+ const e = this.lastChild;
1117
+ if (t.previousSibling === e)
858
1118
  return;
859
- const i = e.parentNode;
1119
+ const s = t.parentNode;
860
1120
  let n = this.firstChild, r;
861
- for (; n !== t; )
862
- r = n.nextSibling, i.insertBefore(n, e), n = r;
863
- i.insertBefore(t, e);
1121
+ for (; n !== e; )
1122
+ r = n.nextSibling, s.insertBefore(n, t), n = r;
1123
+ s.insertBefore(e, t);
864
1124
  }
865
1125
  }
866
1126
  /**
@@ -868,116 +1128,583 @@ class Fe {
868
1128
  * The nodes are not disposed and the view can later be re-inserted.
869
1129
  */
870
1130
  remove() {
871
- const e = this.fragment, t = this.lastChild;
872
- let i = this.firstChild, n;
873
- for (; i !== t; )
874
- n = i.nextSibling, e.appendChild(i), i = n;
875
- e.appendChild(t);
1131
+ const t = this.fragment, e = this.lastChild;
1132
+ let s = this.firstChild, n;
1133
+ for (; s !== e; )
1134
+ n = s.nextSibling, t.appendChild(s), s = n;
1135
+ t.appendChild(e);
876
1136
  }
877
1137
  /**
878
1138
  * Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
879
1139
  * Once a view has been disposed, it cannot be inserted or bound again.
880
1140
  */
881
1141
  dispose() {
882
- const e = this.firstChild.parentNode, t = this.lastChild;
883
- let i = this.firstChild, n;
884
- for (; i !== t; )
885
- n = i.nextSibling, e.removeChild(i), i = n;
886
- e.removeChild(t);
887
- const r = this.behaviors, o = this.source;
888
- for (let a = 0, c = r.length; a < c; ++a)
889
- r[a].unbind(o);
1142
+ ot(this.firstChild, this.lastChild), this.unbind();
1143
+ }
1144
+ onUnbind(t) {
1145
+ this.unbindables.push(t);
1146
+ }
1147
+ /**
1148
+ * Binds a view's behaviors to its binding source.
1149
+ * @param source - The binding source for the view's binding behaviors.
1150
+ * @param context - The execution context to run the behaviors within.
1151
+ */
1152
+ bind(t, e = this) {
1153
+ if (this.source === t)
1154
+ return;
1155
+ let s = this.behaviors;
1156
+ if (s === null) {
1157
+ this.source = t, this.context = e, this.behaviors = s = new Array(this.factories.length);
1158
+ const n = this.factories;
1159
+ for (let r = 0, a = n.length; r < a; ++r) {
1160
+ const c = n[r].createBehavior();
1161
+ c.bind(this), s[r] = c;
1162
+ }
1163
+ } else {
1164
+ this.source !== null && this.evaluateUnbindables(), this.isBound = !1, this.source = t, this.context = e;
1165
+ for (let n = 0, r = s.length; n < r; ++n)
1166
+ s[n].bind(this);
1167
+ }
1168
+ this.isBound = !0;
1169
+ }
1170
+ /**
1171
+ * Unbinds a view's behaviors from its binding source.
1172
+ */
1173
+ unbind() {
1174
+ !this.isBound || this.source === null || (this.evaluateUnbindables(), this.source = null, this.context = this, this.isBound = !1);
1175
+ }
1176
+ evaluateUnbindables() {
1177
+ const t = this.unbindables;
1178
+ for (let e = 0, s = t.length; e < s; ++e)
1179
+ t[e].unbind(this);
1180
+ t.length = 0;
1181
+ }
1182
+ /**
1183
+ * Efficiently disposes of a contiguous range of synthetic view instances.
1184
+ * @param views - A contiguous range of views to be disposed.
1185
+ */
1186
+ static disposeContiguousBatch(t) {
1187
+ if (t.length !== 0) {
1188
+ ot(t[0].firstChild, t[t.length - 1].lastChild);
1189
+ for (let e = 0, s = t.length; e < s; ++e)
1190
+ t[e].unbind();
1191
+ }
1192
+ }
1193
+ }
1194
+ x(X);
1195
+ b.defineProperty(X.prototype, "index");
1196
+ b.defineProperty(X.prototype, "length");
1197
+ const A = {
1198
+ unhydrated: "unhydrated",
1199
+ hydrating: "hydrating",
1200
+ hydrated: "hydrated"
1201
+ };
1202
+ class Ne extends Error {
1203
+ constructor(t, e, s, n) {
1204
+ super(t), this.factory = e, this.fragment = s, this.templateString = n;
1205
+ }
1206
+ }
1207
+ class Be extends ee {
1208
+ constructor(t, e, s, n) {
1209
+ super(), this.firstChild = t, this.lastChild = e, this.sourceTemplate = s, this.hostBindingTarget = n, this[te] = z, this.context = this, this.source = null, this.isBound = !1, this.sourceLifetime = J.unknown, this.unbindables = [], this.fragment = null, this.behaviors = null, this._hydrationStage = A.unhydrated, this._bindingViewBoundaries = {}, this._targets = {}, this.factories = s.compile().factories;
1210
+ }
1211
+ get hydrationStage() {
1212
+ return this._hydrationStage;
1213
+ }
1214
+ get targets() {
1215
+ return this._targets;
1216
+ }
1217
+ get bindingViewBoundaries() {
1218
+ return this._bindingViewBoundaries;
1219
+ }
1220
+ /**
1221
+ * no-op. Hydrated views are don't need to be moved from a documentFragment
1222
+ * to the target node.
1223
+ */
1224
+ insertBefore(t) {
1225
+ if (this.fragment !== null)
1226
+ if (this.fragment.hasChildNodes())
1227
+ t.parentNode.insertBefore(this.fragment, t);
1228
+ else {
1229
+ const e = this.lastChild;
1230
+ if (t.previousSibling === e)
1231
+ return;
1232
+ const s = t.parentNode;
1233
+ let n = this.firstChild, r;
1234
+ for (; n !== e; )
1235
+ r = n.nextSibling, s.insertBefore(n, t), n = r;
1236
+ s.insertBefore(e, t);
1237
+ }
1238
+ }
1239
+ /**
1240
+ * Appends the view to a node. In cases where this is called before the
1241
+ * view has been removed, the method will no-op.
1242
+ * @param node - the node to append the view to.
1243
+ */
1244
+ appendTo(t) {
1245
+ this.fragment !== null && t.appendChild(this.fragment);
1246
+ }
1247
+ remove() {
1248
+ const t = this.fragment || (this.fragment = document.createDocumentFragment()), e = this.lastChild;
1249
+ let s = this.firstChild, n;
1250
+ for (; s !== e; ) {
1251
+ if (n = s.nextSibling, !n)
1252
+ throw new Error(`Unmatched first/last child inside "${e.getRootNode().host.nodeName}".`);
1253
+ t.appendChild(s), s = n;
1254
+ }
1255
+ t.appendChild(e);
1256
+ }
1257
+ bind(t, e = this) {
1258
+ var s;
1259
+ if (this.hydrationStage !== A.hydrated && (this._hydrationStage = A.hydrating), this.source === t)
1260
+ return;
1261
+ let n = this.behaviors;
1262
+ if (n === null) {
1263
+ this.source = t, this.context = e;
1264
+ try {
1265
+ const { targets: a, boundaries: c } = Ce(this.firstChild, this.lastChild, this.factories);
1266
+ this._targets = a, this._bindingViewBoundaries = c;
1267
+ } catch (a) {
1268
+ if (a instanceof Xt) {
1269
+ let c = this.sourceTemplate.html;
1270
+ typeof c != "string" && (c = c.innerHTML), a.templateString = c;
1271
+ }
1272
+ throw a;
1273
+ }
1274
+ this.behaviors = n = new Array(this.factories.length);
1275
+ const r = this.factories;
1276
+ for (let a = 0, c = r.length; a < c; ++a) {
1277
+ const d = r[a];
1278
+ if (d.targetNodeId === "h" && this.hostBindingTarget && W(d, this.hostBindingTarget, this._targets), d.targetNodeId in this.targets) {
1279
+ const l = d.createBehavior();
1280
+ l.bind(this), n[a] = l;
1281
+ } else {
1282
+ let l = this.sourceTemplate.html;
1283
+ typeof l != "string" && (l = l.innerHTML);
1284
+ const o = ((s = this.firstChild) === null || s === void 0 ? void 0 : s.getRootNode()).host, h = o?.nodeName || "unknown", u = d, p = [
1285
+ `HydrationView was unable to successfully target bindings inside "<${h.toLowerCase()}>".`,
1286
+ `
1287
+ Mismatch Details:`,
1288
+ ` - Expected target node ID: "${d.targetNodeId}"`,
1289
+ ` - Available target IDs: [${Object.keys(this.targets).join(", ") || "none"}]`
1290
+ ];
1291
+ throw d.targetTagName && p.push(` - Expected tag name: "${d.targetTagName}"`), u.sourceAspect && p.push(` - Source aspect: "${u.sourceAspect}"`), u.aspectType !== void 0 && p.push(` - Aspect type: ${u.aspectType}`), p.push(`
1292
+ This usually means:`, " 1. The server-rendered HTML doesn't match the client template", " 2. The hydration markers are missing or corrupted", " 3. The DOM structure was modified before hydration", `
1293
+ Template: ${l.slice(0, 200)}${l.length > 200 ? "..." : ""}`), new Ne(p.join(`
1294
+ `), d, Zt(this.firstChild, this.lastChild).cloneContents(), l);
1295
+ }
1296
+ }
1297
+ } else {
1298
+ this.source !== null && this.evaluateUnbindables(), this.isBound = !1, this.source = t, this.context = e;
1299
+ for (let r = 0, a = n.length; r < a; ++r)
1300
+ n[r].bind(this);
1301
+ }
1302
+ this.isBound = !0, this._hydrationStage = A.hydrated;
1303
+ }
1304
+ unbind() {
1305
+ !this.isBound || this.source === null || (this.evaluateUnbindables(), this.source = null, this.context = this, this.isBound = !1);
1306
+ }
1307
+ /**
1308
+ * Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
1309
+ * Once a view has been disposed, it cannot be inserted or bound again.
1310
+ */
1311
+ dispose() {
1312
+ ot(this.firstChild, this.lastChild), this.unbind();
1313
+ }
1314
+ onUnbind(t) {
1315
+ this.unbindables.push(t);
1316
+ }
1317
+ evaluateUnbindables() {
1318
+ const t = this.unbindables;
1319
+ for (let e = 0, s = t.length; e < s; ++e)
1320
+ t[e].unbind(this);
1321
+ t.length = 0;
1322
+ }
1323
+ }
1324
+ te = z;
1325
+ x(Be);
1326
+ function xe(i) {
1327
+ return i.create !== void 0;
1328
+ }
1329
+ function Ae(i, t, e, s) {
1330
+ if (e == null && (e = ""), xe(e)) {
1331
+ i.textContent = "";
1332
+ let n = i.$fastView;
1333
+ if (n === void 0)
1334
+ if (U(s) && U(e) && s.bindingViewBoundaries[this.targetNodeId] !== void 0 && s.hydrationStage !== A.hydrated) {
1335
+ const r = s.bindingViewBoundaries[this.targetNodeId];
1336
+ n = e.hydrate(r.first, r.last);
1337
+ } else
1338
+ n = e.create();
1339
+ else
1340
+ i.$fastTemplate !== e && (n.isComposed && (n.remove(), n.unbind()), n = e.create());
1341
+ n.isComposed ? n.needsBindOnly && (n.needsBindOnly = !1, n.bind(s.source, s.context)) : (n.isComposed = !0, n.bind(s.source, s.context), n.insertBefore(i), i.$fastView = n, i.$fastTemplate = e);
1342
+ } else {
1343
+ const n = i.$fastView;
1344
+ n !== void 0 && n.isComposed && (n.isComposed = !1, n.remove(), n.needsBindOnly ? n.needsBindOnly = !1 : n.unbind()), i.textContent = e;
1345
+ }
1346
+ }
1347
+ function Me(i, t, e) {
1348
+ var s;
1349
+ const n = `${this.id}-t`, r = (s = i[n]) !== null && s !== void 0 ? s : i[n] = { v: 0, cv: /* @__PURE__ */ Object.create(null) }, a = r.cv;
1350
+ let c = r.v;
1351
+ const d = i[t];
1352
+ if (e != null && e.length) {
1353
+ const l = e.split(/\s+/);
1354
+ for (let o = 0, h = l.length; o < h; ++o) {
1355
+ const u = l[o];
1356
+ u !== "" && (a[u] = c, d.add(u));
1357
+ }
1358
+ }
1359
+ if (r.v = c + 1, c !== 0) {
1360
+ c -= 1;
1361
+ for (const l in a)
1362
+ a[l] === c && d.remove(l);
1363
+ }
1364
+ }
1365
+ const Ee = {
1366
+ [g.attribute]: T.setAttribute,
1367
+ [g.booleanAttribute]: T.setBooleanAttribute,
1368
+ [g.property]: (i, t, e) => i[t] = e,
1369
+ [g.content]: Ae,
1370
+ [g.tokenList]: Me,
1371
+ [g.event]: () => {
1372
+ }
1373
+ };
1374
+ class M {
1375
+ /**
1376
+ * Creates an instance of HTMLBindingDirective.
1377
+ * @param dataBinding - The binding configuration to apply.
1378
+ */
1379
+ constructor(t) {
1380
+ this.dataBinding = t, this.updateTarget = null, this.aspectType = g.content;
1381
+ }
1382
+ /**
1383
+ * Creates HTML to be used within a template.
1384
+ * @param add - Can be used to add behavior factories to a template.
1385
+ */
1386
+ createHTML(t) {
1387
+ return Kt.interpolation(t(this));
1388
+ }
1389
+ /**
1390
+ * Creates a behavior.
1391
+ */
1392
+ createBehavior() {
1393
+ var t;
1394
+ if (this.updateTarget === null) {
1395
+ const e = Ee[this.aspectType], s = (t = this.dataBinding.policy) !== null && t !== void 0 ? t : this.policy;
1396
+ if (!e)
1397
+ throw y.error(
1398
+ 1205
1399
+ /* Message.unsupportedBindingBehavior */
1400
+ );
1401
+ this.data = `${this.id}-d`, this.updateTarget = s.protect(this.targetTagName, this.aspectType, this.targetAspect, e);
1402
+ }
1403
+ return this;
1404
+ }
1405
+ /** @internal */
1406
+ bind(t) {
1407
+ var e;
1408
+ const s = t.targets[this.targetNodeId], n = U(t) && t.hydrationStage && t.hydrationStage !== A.hydrated;
1409
+ switch (this.aspectType) {
1410
+ case g.event:
1411
+ s[this.data] = t, s.addEventListener(this.targetAspect, this, this.dataBinding.options);
1412
+ break;
1413
+ case g.content:
1414
+ t.onUnbind(this);
1415
+ default:
1416
+ const r = (e = s[this.data]) !== null && e !== void 0 ? e : s[this.data] = this.dataBinding.createObserver(this, this);
1417
+ if (r.target = s, r.controller = t, n && (this.aspectType === g.attribute || this.aspectType === g.booleanAttribute)) {
1418
+ r.bind(t);
1419
+ break;
1420
+ }
1421
+ this.updateTarget(s, this.targetAspect, r.bind(t), t);
1422
+ break;
1423
+ }
1424
+ }
1425
+ /** @internal */
1426
+ unbind(t) {
1427
+ const s = t.targets[this.targetNodeId].$fastView;
1428
+ s !== void 0 && s.isComposed && (s.unbind(), s.needsBindOnly = !0);
1429
+ }
1430
+ /** @internal */
1431
+ handleEvent(t) {
1432
+ const e = t.currentTarget[this.data];
1433
+ if (e.isBound) {
1434
+ E.setEvent(t);
1435
+ const s = this.dataBinding.evaluate(e.source, e.context);
1436
+ E.setEvent(null), s !== !0 && t.preventDefault();
1437
+ }
1438
+ }
1439
+ /** @internal */
1440
+ handleChange(t, e) {
1441
+ const s = e.target, n = e.controller;
1442
+ this.updateTarget(s, this.targetAspect, e.bind(n), n);
1443
+ }
1444
+ }
1445
+ k.define(M, { aspected: !0 });
1446
+ const ie = (i, t) => `${i}.${t}`, Bt = {}, S = {
1447
+ index: 0,
1448
+ node: null
1449
+ };
1450
+ function xt(i) {
1451
+ i.startsWith("fast-") || y.warn(1204, { name: i });
1452
+ }
1453
+ const Oe = new Proxy(document.createElement("div"), {
1454
+ get(i, t) {
1455
+ xt(t);
1456
+ const e = Reflect.get(i, t);
1457
+ return O(e) ? e.bind(i) : e;
1458
+ },
1459
+ set(i, t, e) {
1460
+ return xt(t), Reflect.set(i, t, e);
1461
+ }
1462
+ });
1463
+ class _e {
1464
+ constructor(t, e, s) {
1465
+ this.fragment = t, this.directives = e, this.policy = s, this.proto = null, this.nodeIds = /* @__PURE__ */ new Set(), this.descriptors = {}, this.factories = [];
1466
+ }
1467
+ addFactory(t, e, s, n, r) {
1468
+ var a, c;
1469
+ this.nodeIds.has(s) || (this.nodeIds.add(s), this.addTargetDescriptor(e, s, n)), t.id = (a = t.id) !== null && a !== void 0 ? a : L(), t.targetNodeId = s, t.targetTagName = r, t.policy = (c = t.policy) !== null && c !== void 0 ? c : this.policy, this.factories.push(t);
1470
+ }
1471
+ freeze() {
1472
+ return this.proto = Object.create(null, this.descriptors), this;
1473
+ }
1474
+ addTargetDescriptor(t, e, s) {
1475
+ const n = this.descriptors;
1476
+ if (e === "r" || // root
1477
+ e === "h" || // host
1478
+ n[e])
1479
+ return;
1480
+ if (!n[t]) {
1481
+ const a = t.lastIndexOf("."), c = t.substring(0, a), d = parseInt(t.substring(a + 1));
1482
+ this.addTargetDescriptor(c, t, d);
1483
+ }
1484
+ let r = Bt[e];
1485
+ if (!r) {
1486
+ const a = `_${e}`;
1487
+ Bt[e] = r = {
1488
+ get() {
1489
+ var c;
1490
+ return (c = this[a]) !== null && c !== void 0 ? c : this[a] = this[t].childNodes[s];
1491
+ }
1492
+ };
1493
+ }
1494
+ n[e] = r;
1495
+ }
1496
+ createView(t) {
1497
+ const e = this.fragment.cloneNode(!0), s = Object.create(this.proto);
1498
+ s.r = e, s.h = t ?? Oe;
1499
+ for (const n of this.nodeIds)
1500
+ s[n];
1501
+ return new X(e, this.factories, s);
1502
+ }
1503
+ }
1504
+ function se(i, t, e, s, n, r = !1) {
1505
+ const a = e.attributes, c = i.directives;
1506
+ for (let d = 0, l = a.length; d < l; ++d) {
1507
+ const o = a[d], h = o.value, u = K.parse(h, c);
1508
+ let p = null;
1509
+ u === null ? r && (p = new M(Gt(() => h, i.policy)), k.assignAspect(p, o.name)) : p = ht.aggregate(u, i.policy), p !== null && (e.removeAttributeNode(o), d--, l--, i.addFactory(p, t, s, n, e.tagName));
890
1510
  }
1511
+ }
1512
+ function Re(i, t, e, s, n) {
1513
+ const r = K.parse(t.textContent, i.directives);
1514
+ if (r === null)
1515
+ return S.node = t.nextSibling, S.index = n + 1, S;
1516
+ let a, c = a = t;
1517
+ for (let d = 0, l = r.length; d < l; ++d) {
1518
+ const o = r[d];
1519
+ d !== 0 && (n++, s = ie(e, n), a = c.parentNode.insertBefore(document.createTextNode(""), c.nextSibling)), B(o) ? a.textContent = o : (a.textContent = " ", k.assignAspect(o), i.addFactory(o, e, s, n, null)), c = a;
1520
+ }
1521
+ return S.index = n + 1, S.node = c.nextSibling, S;
1522
+ }
1523
+ function ne(i, t, e) {
1524
+ let s = 0, n = t.firstChild;
1525
+ for (; n; ) {
1526
+ const r = je(i, e, n, s);
1527
+ n = r.node, s = r.index;
1528
+ }
1529
+ }
1530
+ function je(i, t, e, s) {
1531
+ const n = ie(t, s);
1532
+ switch (e.nodeType) {
1533
+ case 1:
1534
+ se(i, t, e, n, s), ne(i, e, n);
1535
+ break;
1536
+ case 3:
1537
+ return Re(i, e, t, n, s);
1538
+ case 8:
1539
+ const r = K.parse(e.data, i.directives);
1540
+ r !== null && i.addFactory(
1541
+ /* eslint-disable-next-line @typescript-eslint/no-use-before-define */
1542
+ ht.aggregate(r),
1543
+ t,
1544
+ n,
1545
+ s,
1546
+ null
1547
+ );
1548
+ break;
1549
+ }
1550
+ return S.index = s + 1, S.node = e.nextSibling, S;
1551
+ }
1552
+ function Le(i, t) {
1553
+ return i && i.nodeType == 8 && K.parse(i.data, t) !== null;
1554
+ }
1555
+ const At = "TEMPLATE", ht = {
891
1556
  /**
892
- * Binds a view's behaviors to its binding source.
893
- * @param source - The binding source for the view's binding behaviors.
894
- * @param context - The execution context to run the behaviors within.
1557
+ * Compiles a template and associated directives into a compilation
1558
+ * result which can be used to create views.
1559
+ * @param html - The html string or template element to compile.
1560
+ * @param factories - The behavior factories referenced by the template.
1561
+ * @param policy - The security policy to compile the html with.
1562
+ * @remarks
1563
+ * The template that is provided for compilation is altered in-place
1564
+ * and cannot be compiled again. If the original template must be preserved,
1565
+ * it is recommended that you clone the original and pass the clone to this API.
1566
+ * @public
1567
+ */
1568
+ compile(i, t, e = T.policy) {
1569
+ let s;
1570
+ if (B(i)) {
1571
+ s = document.createElement(At), s.innerHTML = e.createHTML(i);
1572
+ const a = s.content.firstElementChild;
1573
+ a !== null && a.tagName === At && (s = a);
1574
+ } else
1575
+ s = i;
1576
+ !s.content.firstChild && !s.content.lastChild && s.content.appendChild(document.createComment(""));
1577
+ const n = document.adoptNode(s.content), r = new _e(n, t, e);
1578
+ return se(
1579
+ r,
1580
+ "",
1581
+ s,
1582
+ /* host */
1583
+ "h",
1584
+ 0,
1585
+ !0
1586
+ ), // If the first node in a fragment is a marker, that means it's an unstable first node,
1587
+ // because something like a when, repeat, etc. could add nodes before the marker.
1588
+ // To mitigate this, we insert a stable first node. However, if we insert a node,
1589
+ // that will alter the result of the TreeWalker. So, we also need to offset the target index.
1590
+ (Le(n.firstChild, t) || // Or if there is only one node and a directive, it means the template's content
1591
+ // is *only* the directive. In that case, HTMLView.dispose() misses any nodes inserted by
1592
+ // the directive. Inserting a new node ensures proper disposal of nodes added by the directive.
1593
+ n.childNodes.length === 1 && Object.keys(t).length > 0) && n.insertBefore(document.createComment(""), n.firstChild), ne(
1594
+ r,
1595
+ n,
1596
+ /* root */
1597
+ "r"
1598
+ ), S.node = null, r.freeze();
1599
+ },
1600
+ /**
1601
+ * Sets the default compilation strategy that will be used by the ViewTemplate whenever
1602
+ * it needs to compile a view preprocessed with the html template function.
1603
+ * @param strategy - The compilation strategy to use when compiling templates.
895
1604
  */
896
- bind(e, t) {
897
- const i = this.behaviors;
898
- if (this.source !== e)
899
- if (this.source !== null) {
900
- const n = this.source;
901
- this.source = e, this.context = t;
902
- for (let r = 0, o = i.length; r < o; ++r) {
903
- const a = i[r];
904
- a.unbind(n), a.bind(e, t);
905
- }
906
- } else {
907
- this.source = e, this.context = t;
908
- for (let n = 0, r = i.length; n < r; ++n)
909
- i[n].bind(e, t);
910
- }
911
- }
1605
+ setDefaultStrategy(i) {
1606
+ this.compile = i;
1607
+ },
912
1608
  /**
913
- * Unbinds a view's behaviors from its binding source.
1609
+ * Aggregates an array of strings and directives into a single directive.
1610
+ * @param parts - A heterogeneous array of static strings interspersed with
1611
+ * directives.
1612
+ * @param policy - The security policy to use with the aggregated bindings.
1613
+ * @returns A single inline directive that aggregates the behavior of all the parts.
1614
+ */
1615
+ aggregate(i, t = T.policy) {
1616
+ if (i.length === 1)
1617
+ return i[0];
1618
+ let e, s = !1, n;
1619
+ const r = i.length, a = i.map((l) => B(l) ? () => l : (e = l.sourceAspect || e, s = s || l.dataBinding.isVolatile, n = n || l.dataBinding.policy, l.dataBinding.evaluate)), c = (l, o) => {
1620
+ let h = "";
1621
+ for (let u = 0; u < r; ++u)
1622
+ h += a[u](l, o);
1623
+ return h;
1624
+ }, d = new M(qt(c, n ?? t, s));
1625
+ return k.assignAspect(d, e), d;
1626
+ }
1627
+ }, Ve = (
1628
+ /* eslint-disable-next-line no-control-regex, max-len */
1629
+ /([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/
1630
+ ), Fe = /* @__PURE__ */ Object.create(null);
1631
+ class V {
1632
+ /**
1633
+ * Creates an instance of InlineTemplateDirective.
1634
+ * @param template - The template to inline.
914
1635
  */
915
- unbind() {
916
- if (this.source === null)
917
- return;
918
- const e = this.behaviors, t = this.source;
919
- for (let i = 0, n = e.length; i < n; ++i)
920
- e[i].unbind(t);
921
- this.source = null;
1636
+ constructor(t, e = Fe) {
1637
+ this.html = t, this.factories = e;
922
1638
  }
923
1639
  /**
924
- * Efficiently disposes of a contiguous range of synthetic view instances.
925
- * @param views - A contiguous range of views to be disposed.
1640
+ * Creates HTML to be used within a template.
1641
+ * @param add - Can be used to add behavior factories to a template.
926
1642
  */
927
- static disposeContiguousBatch(e) {
928
- if (e.length !== 0) {
929
- O.setStartBefore(e[0].firstChild), O.setEndAfter(e[e.length - 1].lastChild), O.deleteContents();
930
- for (let t = 0, i = e.length; t < i; ++t) {
931
- const n = e[t], r = n.behaviors, o = n.source;
932
- for (let a = 0, c = r.length; a < c; ++a)
933
- r[a].unbind(o);
934
- }
935
- }
1643
+ createHTML(t) {
1644
+ const e = this.factories;
1645
+ for (const s in e)
1646
+ t(e[s]);
1647
+ return this.html;
936
1648
  }
937
1649
  }
938
- class W {
1650
+ V.empty = new V("");
1651
+ k.define(V);
1652
+ function Ie(i, t, e, s = k.getForInstance(i)) {
1653
+ if (s.aspected) {
1654
+ const n = Ve.exec(t);
1655
+ n !== null && k.assignAspect(i, n[2]);
1656
+ }
1657
+ return i.createHTML(e);
1658
+ }
1659
+ class Y {
939
1660
  /**
940
1661
  * Creates an instance of ViewTemplate.
941
1662
  * @param html - The html representing what this template will instantiate, including placeholders for directives.
942
- * @param directives - The directives that will be connected to placeholders in the html.
1663
+ * @param factories - The directives that will be connected to placeholders in the html.
1664
+ * @param policy - The security policy to use when compiling this template.
1665
+ */
1666
+ constructor(t, e = {}, s) {
1667
+ this.policy = s, this.result = null, this.html = t, this.factories = e;
1668
+ }
1669
+ /**
1670
+ * @internal
943
1671
  */
944
- constructor(e, t) {
945
- this.behaviorCount = 0, this.hasHostBehaviors = !1, this.fragment = null, this.targetOffset = 0, this.viewBehaviorFactories = null, this.hostBehaviorFactories = null, this.html = e, this.directives = t;
1672
+ compile() {
1673
+ return this.result === null && (this.result = ht.compile(this.html, this.factories, this.policy)), this.result;
946
1674
  }
947
1675
  /**
948
1676
  * Creates an HTMLView instance based on this template definition.
949
1677
  * @param hostBindingTarget - The element that host behaviors will be bound to.
950
1678
  */
951
- create(e) {
952
- if (this.fragment === null) {
953
- let l;
954
- const h = this.html;
955
- if (typeof h == "string") {
956
- l = document.createElement("template"), l.innerHTML = u.createHTML(h);
957
- const f = l.content.firstElementChild;
958
- f !== null && f.tagName === "TEMPLATE" && (l = f);
959
- } else
960
- l = h;
961
- const d = ke(l, this.directives);
962
- this.fragment = d.fragment, this.viewBehaviorFactories = d.viewBehaviorFactories, this.hostBehaviorFactories = d.hostBehaviorFactories, this.targetOffset = d.targetOffset, this.behaviorCount = this.viewBehaviorFactories.length + this.hostBehaviorFactories.length, this.hasHostBehaviors = this.hostBehaviorFactories.length > 0;
963
- }
964
- const t = this.fragment.cloneNode(!0), i = this.viewBehaviorFactories, n = new Array(this.behaviorCount), r = u.createTemplateWalker(t);
965
- let o = 0, a = this.targetOffset, c = r.nextNode();
966
- for (let l = i.length; o < l; ++o) {
967
- const h = i[o], d = h.targetIndex;
968
- for (; c !== null; )
969
- if (a === d) {
970
- n[o] = h.createBehavior(c);
971
- break;
972
- } else
973
- c = r.nextNode(), a++;
974
- }
975
- if (this.hasHostBehaviors) {
976
- const l = this.hostBehaviorFactories;
977
- for (let h = 0, d = l.length; h < d; ++h, ++o)
978
- n[o] = l[h].createBehavior(e);
979
- }
980
- return new Fe(t, n);
1679
+ create(t) {
1680
+ return this.compile().createView(t);
1681
+ }
1682
+ /**
1683
+ * Returns a directive that can inline the template.
1684
+ */
1685
+ inline() {
1686
+ return new V(B(this.html) ? this.html : this.html.innerHTML, this.factories);
1687
+ }
1688
+ /**
1689
+ * Sets the DOMPolicy for this template.
1690
+ * @param policy - The policy to associated with this template.
1691
+ * @returns The modified template instance.
1692
+ * @remarks
1693
+ * The DOMPolicy can only be set once for a template and cannot be
1694
+ * set after the template is compiled.
1695
+ */
1696
+ withPolicy(t) {
1697
+ if (this.result)
1698
+ throw y.error(
1699
+ 1208
1700
+ /* Message.cannotSetTemplatePolicyAfterCompilation */
1701
+ );
1702
+ if (this.policy)
1703
+ throw y.error(
1704
+ 1207
1705
+ /* Message.onlySetTemplatePolicyOnce */
1706
+ );
1707
+ return this.policy = t, this;
981
1708
  }
982
1709
  /**
983
1710
  * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
@@ -986,179 +1713,83 @@ class W {
986
1713
  * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
987
1714
  * host that the template is being attached to.
988
1715
  */
989
- render(e, t, i) {
990
- typeof t == "string" && (t = document.getElementById(t)), i === void 0 && (i = t);
991
- const n = this.create(i);
992
- return n.bind(e, w), n.appendTo(t), n;
993
- }
994
- }
995
- const Oe = (
996
- /* eslint-disable-next-line no-control-regex */
997
- /([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/
998
- );
999
- function Ye(s, ...e) {
1000
- const t = [];
1001
- let i = "";
1002
- for (let n = 0, r = s.length - 1; n < r; ++n) {
1003
- const o = s[n];
1004
- let a = e[n];
1005
- if (i += o, a instanceof W) {
1006
- const c = a;
1007
- a = () => c;
1008
- }
1009
- if (typeof a == "function" && (a = new L(a)), a instanceof ne) {
1010
- const c = Oe.exec(o);
1011
- c !== null && (a.targetName = c[2]);
1012
- }
1013
- a instanceof P ? (i += a.createPlaceholder(t.length), t.push(a)) : i += a;
1014
- }
1015
- return i += s[s.length - 1], new W(i, t);
1016
- }
1017
- class g {
1018
- constructor() {
1019
- this.targets = /* @__PURE__ */ new WeakSet();
1020
- }
1021
- /** @internal */
1022
- addStylesTo(e) {
1023
- this.targets.add(e);
1024
- }
1025
- /** @internal */
1026
- removeStylesFrom(e) {
1027
- this.targets.delete(e);
1028
- }
1029
- /** @internal */
1030
- isAttachedTo(e) {
1031
- return this.targets.has(e);
1716
+ render(t, e, s) {
1717
+ const n = this.create(s);
1718
+ return n.bind(t), n.appendTo(e), n;
1032
1719
  }
1033
1720
  /**
1034
- * Associates behaviors with this set of styles.
1035
- * @param behaviors - The behaviors to associate.
1036
- */
1037
- withBehaviors(...e) {
1038
- return this.behaviors = this.behaviors === null ? e : this.behaviors.concat(e), this;
1039
- }
1040
- }
1041
- g.create = (() => {
1042
- if (u.supportsAdoptedStyleSheets) {
1043
- const s = /* @__PURE__ */ new Map();
1044
- return (e) => (
1045
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
1046
- new Me(e, s)
1047
- );
1048
- }
1049
- return (s) => new Ve(s);
1050
- })();
1051
- function H(s) {
1052
- return s.map((e) => e instanceof g ? H(e.styles) : [e]).reduce((e, t) => e.concat(t), []);
1053
- }
1054
- function oe(s) {
1055
- return s.map((e) => e instanceof g ? e.behaviors : null).reduce((e, t) => t === null ? e : (e === null && (e = []), e.concat(t)), null);
1056
- }
1057
- const Ee = Symbol("prependToAdoptedStyleSheets");
1058
- function ae(s) {
1059
- const e = [], t = [];
1060
- return s.forEach((i) => (i[Ee] ? e : t).push(i)), { prepend: e, append: t };
1061
- }
1062
- let le = (s, e) => {
1063
- const { prepend: t, append: i } = ae(e);
1064
- s.adoptedStyleSheets = [...t, ...s.adoptedStyleSheets, ...i];
1065
- }, he = (s, e) => {
1066
- s.adoptedStyleSheets = s.adoptedStyleSheets.filter((t) => e.indexOf(t) === -1);
1067
- };
1068
- if (u.supportsAdoptedStyleSheets)
1069
- try {
1070
- document.adoptedStyleSheets.push(), document.adoptedStyleSheets.splice(), le = (s, e) => {
1071
- const { prepend: t, append: i } = ae(e);
1072
- s.adoptedStyleSheets.splice(0, 0, ...t), s.adoptedStyleSheets.push(...i);
1073
- }, he = (s, e) => {
1074
- for (const t of e) {
1075
- const i = s.adoptedStyleSheets.indexOf(t);
1076
- i !== -1 && s.adoptedStyleSheets.splice(i, 1);
1077
- }
1721
+ * Creates a template based on a set of static strings and dynamic values.
1722
+ * @param strings - The static strings to create the template with.
1723
+ * @param values - The dynamic values to create the template with.
1724
+ * @param policy - The DOMPolicy to associated with the template.
1725
+ * @returns A ViewTemplate.
1726
+ * @remarks
1727
+ * This API should not be used directly under normal circumstances because constructing
1728
+ * a template in this way, if not done properly, can open up the application to XSS
1729
+ * attacks. When using this API, provide a strong DOMPolicy that can properly sanitize
1730
+ * and also be sure to manually sanitize all static strings particularly if they can
1731
+ * come from user input.
1732
+ */
1733
+ static create(t, e, s) {
1734
+ let n = "";
1735
+ const r = /* @__PURE__ */ Object.create(null), a = (c) => {
1736
+ var d;
1737
+ const l = (d = c.id) !== null && d !== void 0 ? d : c.id = L();
1738
+ return r[l] = c, l;
1078
1739
  };
1079
- } catch {
1080
- }
1081
- class Me extends g {
1082
- constructor(e, t) {
1083
- super(), this.styles = e, this.styleSheetCache = t, this._styleSheets = void 0, this.behaviors = oe(e);
1084
- }
1085
- get styleSheets() {
1086
- if (this._styleSheets === void 0) {
1087
- const e = this.styles, t = this.styleSheetCache;
1088
- this._styleSheets = H(e).map((i) => {
1089
- if (i instanceof CSSStyleSheet)
1090
- return i;
1091
- let n = t.get(i);
1092
- return n === void 0 && (n = new CSSStyleSheet(), n.replaceSync(i), t.set(i, n)), n;
1093
- });
1094
- }
1095
- return this._styleSheets;
1096
- }
1097
- addStylesTo(e) {
1098
- le(e, this.styleSheets), super.addStylesTo(e);
1099
- }
1100
- removeStylesFrom(e) {
1101
- he(e, this.styleSheets), super.removeStylesFrom(e);
1102
- }
1103
- }
1104
- let Ie = 0;
1105
- function $e() {
1106
- return `fast-style-class-${++Ie}`;
1107
- }
1108
- class Ve extends g {
1109
- constructor(e) {
1110
- super(), this.styles = e, this.behaviors = null, this.behaviors = oe(e), this.styleSheets = H(e), this.styleClass = $e();
1111
- }
1112
- addStylesTo(e) {
1113
- const t = this.styleSheets, i = this.styleClass;
1114
- e = this.normalizeTarget(e);
1115
- for (let n = 0; n < t.length; n++) {
1116
- const r = document.createElement("style");
1117
- r.innerHTML = t[n], r.className = i, e.append(r);
1740
+ for (let c = 0, d = t.length - 1; c < d; ++c) {
1741
+ const l = t[c];
1742
+ let o = e[c], h;
1743
+ if (n += l, O(o))
1744
+ o = new M(qt(o));
1745
+ else if (o instanceof lt)
1746
+ o = new M(o);
1747
+ else if (!(h = k.getForInstance(o))) {
1748
+ const u = o;
1749
+ o = new M(Gt(() => u));
1750
+ }
1751
+ n += Ie(o, l, a, h);
1118
1752
  }
1119
- super.addStylesTo(e);
1120
- }
1121
- removeStylesFrom(e) {
1122
- e = this.normalizeTarget(e);
1123
- const t = e.querySelectorAll(`.${this.styleClass}`);
1124
- for (let i = 0, n = t.length; i < n; ++i)
1125
- e.removeChild(t[i]);
1126
- super.removeStylesFrom(e);
1127
- }
1128
- isAttachedTo(e) {
1129
- return super.isAttachedTo(this.normalizeTarget(e));
1130
- }
1131
- normalizeTarget(e) {
1132
- return e === document ? document.body : e;
1753
+ return new Y(n + t[t.length - 1], r, s);
1133
1754
  }
1134
1755
  }
1135
- const ce = Object.freeze({
1756
+ x(Y);
1757
+ const re = (i, ...t) => {
1758
+ if (Array.isArray(i) && Array.isArray(i.raw))
1759
+ return Y.create(i, t);
1760
+ throw y.error(
1761
+ 1206
1762
+ /* Message.directCallToHTMLTagNotAllowed */
1763
+ );
1764
+ };
1765
+ re.partial = (i) => new V(i);
1766
+ const Mt = "boolean", Et = "reflect", oe = Object.freeze({
1136
1767
  /**
1137
1768
  * Locates all attribute configurations associated with a type.
1138
1769
  */
1139
- locate: _()
1140
- }), _e = {
1141
- toView(s) {
1142
- return s ? "true" : "false";
1770
+ locate: zt()
1771
+ }), He = {
1772
+ toView(i) {
1773
+ return i ? "true" : "false";
1143
1774
  },
1144
- fromView(s) {
1145
- return !(s == null || s === "false" || s === !1 || s === 0);
1775
+ fromView(i) {
1776
+ return !(i == null || i === "false" || i === !1 || i === 0);
1146
1777
  }
1147
- }, Ze = {
1148
- toView(s) {
1149
- if (s == null)
1150
- return null;
1151
- const e = s * 1;
1152
- return isNaN(e) ? null : e.toString();
1778
+ };
1779
+ function Ot(i) {
1780
+ if (i == null)
1781
+ return null;
1782
+ const t = i * 1;
1783
+ return isNaN(t) ? null : t;
1784
+ }
1785
+ const bi = {
1786
+ toView(i) {
1787
+ const t = Ot(i);
1788
+ return t && t.toString();
1153
1789
  },
1154
- fromView(s) {
1155
- if (s == null)
1156
- return null;
1157
- const e = s * 1;
1158
- return isNaN(e) ? null : e;
1159
- }
1790
+ fromView: Ot
1160
1791
  };
1161
- class x {
1792
+ class q {
1162
1793
  /**
1163
1794
  * Creates an instance of AttributeDefinition.
1164
1795
  * @param Owner - The class constructor that owns this attribute.
@@ -1168,44 +1799,44 @@ class x {
1168
1799
  * @param converter - A {@link ValueConverter} that integrates with the property getter/setter
1169
1800
  * to convert values to and from a DOM string.
1170
1801
  */
1171
- constructor(e, t, i = t.toLowerCase(), n = "reflect", r) {
1172
- this.guards = /* @__PURE__ */ new Set(), this.Owner = e, this.name = t, this.attribute = i, this.mode = n, this.converter = r, this.fieldName = `_${t}`, this.callbackName = `${t}Changed`, this.hasCallback = this.callbackName in e.prototype, n === "boolean" && r === void 0 && (this.converter = _e);
1802
+ constructor(t, e, s = e.toLowerCase(), n = Et, r) {
1803
+ this.guards = /* @__PURE__ */ new Set(), this.Owner = t, this.name = e, this.attribute = s, this.mode = n, this.converter = r, this.fieldName = `_${e}`, this.callbackName = `${e}Changed`, this.hasCallback = this.callbackName in t.prototype, n === Mt && r === void 0 && (this.converter = He);
1173
1804
  }
1174
1805
  /**
1175
1806
  * Sets the value of the attribute/property on the source element.
1176
1807
  * @param source - The source element to access.
1177
- * @param value - The value to set the attribute/property to.
1808
+ * @param newValue - The value to set the attribute/property to.
1178
1809
  */
1179
- setValue(e, t) {
1180
- const i = e[this.fieldName], n = this.converter;
1181
- n !== void 0 && (t = n.fromView(t)), i !== t && (e[this.fieldName] = t, this.tryReflectToAttribute(e), this.hasCallback && e[this.callbackName](i, t), e.$fastController.notify(this.name));
1810
+ setValue(t, e) {
1811
+ const s = t[this.fieldName], n = this.converter;
1812
+ n !== void 0 && (e = n.fromView(e)), s !== e && (t[this.fieldName] = e, this.tryReflectToAttribute(t), this.hasCallback && t[this.callbackName](s, e), t.$fastController.notify(this.name));
1182
1813
  }
1183
1814
  /**
1184
1815
  * Gets the value of the attribute/property on the source element.
1185
1816
  * @param source - The source element to access.
1186
1817
  */
1187
- getValue(e) {
1188
- return b.track(e, this.name), e[this.fieldName];
1818
+ getValue(t) {
1819
+ return b.track(t, this.name), t[this.fieldName];
1189
1820
  }
1190
1821
  /** @internal */
1191
- onAttributeChangedCallback(e, t) {
1192
- this.guards.has(e) || (this.guards.add(e), this.setValue(e, t), this.guards.delete(e));
1193
- }
1194
- tryReflectToAttribute(e) {
1195
- const t = this.mode, i = this.guards;
1196
- i.has(e) || t === "fromView" || u.queueUpdate(() => {
1197
- i.add(e);
1198
- const n = e[this.fieldName];
1199
- switch (t) {
1200
- case "reflect":
1822
+ onAttributeChangedCallback(t, e) {
1823
+ this.guards.has(t) || (this.guards.add(t), this.setValue(t, e), this.guards.delete(t));
1824
+ }
1825
+ tryReflectToAttribute(t) {
1826
+ const e = this.mode, s = this.guards;
1827
+ s.has(t) || e === "fromView" || Ut.enqueue(() => {
1828
+ s.add(t);
1829
+ const n = t[this.fieldName];
1830
+ switch (e) {
1831
+ case Et:
1201
1832
  const r = this.converter;
1202
- u.setAttribute(e, this.attribute, r !== void 0 ? r.toView(n) : n);
1833
+ T.setAttribute(t, this.attribute, r !== void 0 ? r.toView(n) : n);
1203
1834
  break;
1204
- case "boolean":
1205
- u.setBooleanAttribute(e, this.attribute, n);
1835
+ case Mt:
1836
+ T.setBooleanAttribute(t, this.attribute, n);
1206
1837
  break;
1207
1838
  }
1208
- i.delete(e);
1839
+ s.delete(t);
1209
1840
  });
1210
1841
  }
1211
1842
  /**
@@ -1214,92 +1845,209 @@ class x {
1214
1845
  * @param attributeLists - Any existing attributes to collect and merge with those associated with the owner.
1215
1846
  * @internal
1216
1847
  */
1217
- static collect(e, ...t) {
1218
- const i = [];
1219
- t.push(ce.locate(e));
1220
- for (let n = 0, r = t.length; n < r; ++n) {
1221
- const o = t[n];
1222
- if (o !== void 0)
1223
- for (let a = 0, c = o.length; a < c; ++a) {
1224
- const l = o[a];
1225
- typeof l == "string" ? i.push(new x(e, l)) : i.push(new x(e, l.property, l.attribute, l.mode, l.converter));
1848
+ static collect(t, ...e) {
1849
+ const s = [];
1850
+ e.push(oe.locate(t));
1851
+ for (let n = 0, r = e.length; n < r; ++n) {
1852
+ const a = e[n];
1853
+ if (a !== void 0)
1854
+ for (let c = 0, d = a.length; c < d; ++c) {
1855
+ const l = a[c];
1856
+ B(l) ? s.push(new q(t, l)) : s.push(new q(t, l.property, l.attribute, l.mode, l.converter));
1226
1857
  }
1227
1858
  }
1228
- return i;
1859
+ return s;
1229
1860
  }
1230
1861
  }
1231
- function Re(s, e) {
1232
- let t;
1233
- function i(n, r) {
1234
- arguments.length > 1 && (t.property = r), ce.locate(n.constructor).push(t);
1862
+ function De(i, t) {
1863
+ let e;
1864
+ function s(n, r) {
1865
+ arguments.length > 1 && (e.property = r), oe.locate(n.constructor).push(e);
1235
1866
  }
1236
1867
  if (arguments.length > 1) {
1237
- t = {}, i(s, e);
1868
+ e = {}, s(i, t);
1238
1869
  return;
1239
1870
  }
1240
- return t = s === void 0 ? {} : s, i;
1871
+ return e = i === void 0 ? {} : i, s;
1241
1872
  }
1242
- const Q = { mode: "open" }, K = {}, $ = S.getById(4, () => {
1243
- const s = /* @__PURE__ */ new Map();
1244
- return Object.freeze({
1245
- register(e) {
1246
- return s.has(e.type) ? !1 : (s.set(e.type, e), !0);
1247
- },
1248
- getByType(e) {
1249
- return s.get(e);
1873
+ var Pe = function(i, t, e, s) {
1874
+ function n(r) {
1875
+ return r instanceof e ? r : new e(function(a) {
1876
+ a(r);
1877
+ });
1878
+ }
1879
+ return new (e || (e = Promise))(function(r, a) {
1880
+ function c(o) {
1881
+ try {
1882
+ l(s.next(o));
1883
+ } catch (h) {
1884
+ a(h);
1885
+ }
1250
1886
  }
1887
+ function d(o) {
1888
+ try {
1889
+ l(s.throw(o));
1890
+ } catch (h) {
1891
+ a(h);
1892
+ }
1893
+ }
1894
+ function l(o) {
1895
+ o.done ? r(o.value) : n(o.value).then(c, d);
1896
+ }
1897
+ l((s = s.apply(i, t || [])).next());
1251
1898
  });
1252
- });
1253
- class B {
1254
- /**
1255
- * Creates an instance of FASTElementDefinition.
1256
- * @param type - The type this definition is being created for.
1257
- * @param nameOrConfig - The name of the element to define or a config object
1258
- * that describes the element to define.
1259
- */
1260
- constructor(e, t = e.definition) {
1261
- typeof t == "string" && (t = { name: t }), this.type = e, this.name = t.name, this.template = t.template;
1262
- const i = x.collect(e, t.attributes), n = new Array(i.length), r = {}, o = {};
1263
- for (let a = 0, c = i.length; a < c; ++a) {
1264
- const l = i[a];
1265
- n[a] = l.attribute, r[l.name] = l, o[l.attribute] = l;
1899
+ };
1900
+ const _t = { mode: "open" }, Rt = {}, it = /* @__PURE__ */ new Set(), R = y.getById(N.elementRegistry, () => Pt()), ze = {
1901
+ deferAndHydrate: "defer-and-hydrate"
1902
+ };
1903
+ class f {
1904
+ constructor(t, e = t.definition) {
1905
+ var s;
1906
+ this.platformDefined = !1, B(e) && (e = { name: e }), this.type = t, this.name = e.name, this.template = e.template, this.templateOptions = e.templateOptions, this.registry = (s = e.registry) !== null && s !== void 0 ? s : customElements;
1907
+ const n = t.prototype, r = q.collect(t, e.attributes), a = new Array(r.length), c = {}, d = {};
1908
+ for (let l = 0, o = r.length; l < o; ++l) {
1909
+ const h = r[l];
1910
+ a[l] = h.attribute, c[h.name] = h, d[h.attribute] = h, b.defineProperty(n, h);
1266
1911
  }
1267
- this.attributes = i, this.observedAttributes = n, this.propertyLookup = r, this.attributeLookup = o, this.shadowOptions = t.shadowOptions === void 0 ? Q : t.shadowOptions === null ? void 0 : Object.assign(Object.assign({}, Q), t.shadowOptions), this.elementOptions = t.elementOptions === void 0 ? K : Object.assign(Object.assign({}, K), t.elementOptions), this.styles = t.styles === void 0 ? void 0 : Array.isArray(t.styles) ? g.create(t.styles) : t.styles instanceof g ? t.styles : g.create([t.styles]);
1912
+ Reflect.defineProperty(t, "observedAttributes", {
1913
+ value: a,
1914
+ enumerable: !0
1915
+ }), this.attributes = r, this.propertyLookup = c, this.attributeLookup = d, this.shadowOptions = e.shadowOptions === void 0 ? _t : e.shadowOptions === null ? void 0 : Object.assign(Object.assign({}, _t), e.shadowOptions), this.elementOptions = e.elementOptions === void 0 ? Rt : Object.assign(Object.assign({}, Rt), e.elementOptions), this.styles = m.normalize(e.styles), R.register(this), b.defineProperty(f.isRegistered, this.name), f.isRegistered[this.name] = this.type;
1268
1916
  }
1269
1917
  /**
1270
1918
  * Indicates if this element has been defined in at least one registry.
1271
1919
  */
1272
1920
  get isDefined() {
1273
- return !!$.getByType(this.type);
1921
+ return this.platformDefined;
1274
1922
  }
1275
1923
  /**
1276
1924
  * Defines a custom element based on this definition.
1277
1925
  * @param registry - The element registry to define the element in.
1926
+ * @remarks
1927
+ * This operation is idempotent per registry.
1278
1928
  */
1279
- define(e = customElements) {
1280
- const t = this.type;
1281
- if ($.register(this)) {
1282
- const i = this.attributes, n = t.prototype;
1283
- for (let r = 0, o = i.length; r < o; ++r)
1284
- b.defineProperty(n, i[r]);
1285
- Reflect.defineProperty(t, "observedAttributes", {
1286
- value: this.observedAttributes,
1287
- enumerable: !0
1288
- });
1929
+ define(t = this.registry) {
1930
+ var e, s;
1931
+ const n = this.type;
1932
+ return t.get(this.name) || (this.platformDefined = !0, t.define(this.name, n, this.elementOptions), (s = (e = this.lifecycleCallbacks) === null || e === void 0 ? void 0 : e.elementDidDefine) === null || s === void 0 || s.call(e, this.name)), this;
1933
+ }
1934
+ /**
1935
+ * Creates an instance of FASTElementDefinition.
1936
+ * @param type - The type this definition is being created for.
1937
+ * @param nameOrDef - The name of the element to define or a config object
1938
+ * that describes the element to define.
1939
+ */
1940
+ static compose(t, e) {
1941
+ return it.has(t) || R.getByType(t) ? new f(class extends t {
1942
+ }, e) : new f(t, e);
1943
+ }
1944
+ /**
1945
+ * Registers a FASTElement base type.
1946
+ * @param type - The type to register as a base type.
1947
+ * @internal
1948
+ */
1949
+ static registerBaseType(t) {
1950
+ it.add(t);
1951
+ }
1952
+ /**
1953
+ * Creates an instance of FASTElementDefinition asynchronously. This option assumes
1954
+ * that a template and shadowOptions will be provided and completes when those requirements
1955
+ * are met.
1956
+ * @param type - The type this definition is being created for.
1957
+ * @param nameOrDef - The name of the element to define or a config object
1958
+ * that describes the element to define.
1959
+ * @alpha
1960
+ */
1961
+ static composeAsync(t, e) {
1962
+ return new Promise((s) => {
1963
+ (it.has(t) || R.getByType(t)) && s(new f(class extends t {
1964
+ }, e));
1965
+ const n = new f(t, e);
1966
+ b.getNotifier(n).subscribe({
1967
+ handleChange: () => {
1968
+ var r, a;
1969
+ (a = (r = n.lifecycleCallbacks) === null || r === void 0 ? void 0 : r.templateDidUpdate) === null || a === void 0 || a.call(r, n.name), s(n);
1970
+ }
1971
+ }, "template");
1972
+ });
1973
+ }
1974
+ }
1975
+ f.isRegistered = {};
1976
+ f.getByType = R.getByType;
1977
+ f.getForInstance = R.getForInstance;
1978
+ f.registerAsync = (i) => Pe(void 0, void 0, void 0, function* () {
1979
+ return new Promise((t) => {
1980
+ f.isRegistered[i] && t(f.isRegistered[i]), b.getNotifier(f.isRegistered).subscribe({ handleChange: () => t(f.isRegistered[i]) }, i);
1981
+ });
1982
+ });
1983
+ b.defineProperty(f.prototype, "template");
1984
+ class Ue extends MutationObserver {
1985
+ /**
1986
+ * Creates an instance of UnobservableMutationObserver.
1987
+ * @param callback - The callback to invoke when observed nodes are changed.
1988
+ */
1989
+ constructor(t) {
1990
+ function e(s) {
1991
+ this.callback.call(null, s.filter((n) => this.observedNodes.has(n.target)));
1289
1992
  }
1290
- return e.get(this.name) || e.define(this.name, t, this.elementOptions), this;
1993
+ super(e), this.callback = t, this.observedNodes = /* @__PURE__ */ new Set();
1994
+ }
1995
+ observe(t, e) {
1996
+ this.observedNodes.add(t), super.observe(t, e);
1997
+ }
1998
+ unobserve(t) {
1999
+ this.observedNodes.delete(t), this.observedNodes.size < 1 && this.disconnect();
1291
2000
  }
1292
2001
  }
1293
- B.forType = $.getByType;
1294
- const de = /* @__PURE__ */ new WeakMap(), Pe = {
2002
+ const gi = Object.freeze({
2003
+ /**
2004
+ * Creates a ViewBehaviorOrchestrator.
2005
+ * @param source - The source to to associate behaviors with.
2006
+ * @returns A ViewBehaviorOrchestrator.
2007
+ */
2008
+ create(i) {
2009
+ const t = [], e = {};
2010
+ let s = null, n = !1;
2011
+ return {
2012
+ source: i,
2013
+ context: E.default,
2014
+ targets: e,
2015
+ get isBound() {
2016
+ return n;
2017
+ },
2018
+ addBehaviorFactory(r, a) {
2019
+ var c, d, l, o;
2020
+ const h = r;
2021
+ h.id = (c = h.id) !== null && c !== void 0 ? c : L(), h.targetNodeId = (d = h.targetNodeId) !== null && d !== void 0 ? d : L(), h.targetTagName = (l = a.tagName) !== null && l !== void 0 ? l : null, h.policy = (o = h.policy) !== null && o !== void 0 ? o : T.policy, this.addTarget(h.targetNodeId, a), this.addBehavior(h.createBehavior());
2022
+ },
2023
+ addTarget(r, a) {
2024
+ e[r] = a;
2025
+ },
2026
+ addBehavior(r) {
2027
+ t.push(r), n && r.bind(this);
2028
+ },
2029
+ onUnbind(r) {
2030
+ s === null && (s = []), s.push(r);
2031
+ },
2032
+ connectedCallback(r) {
2033
+ n || (n = !0, t.forEach((a) => a.bind(this)));
2034
+ },
2035
+ disconnectedCallback(r) {
2036
+ n && (n = !1, s !== null && s.forEach((a) => a.unbind(this)));
2037
+ }
2038
+ };
2039
+ }
2040
+ }), We = {
1295
2041
  bubbles: !0,
1296
2042
  composed: !0,
1297
2043
  cancelable: !0
1298
- };
1299
- function E(s) {
1300
- return s.shadowRoot || de.get(s) || null;
2044
+ }, P = "isConnected", ae = /* @__PURE__ */ new WeakMap();
2045
+ function j(i) {
2046
+ var t, e;
2047
+ return (e = (t = i.shadowRoot) !== null && t !== void 0 ? t : ae.get(i)) !== null && e !== void 0 ? e : null;
1301
2048
  }
1302
- class D extends ie {
2049
+ let jt;
2050
+ class C extends Wt {
1303
2051
  /**
1304
2052
  * Creates a Controller to control the specified element.
1305
2053
  * @param element - The element to be controlled by this controller.
@@ -1307,19 +2055,14 @@ class D extends ie {
1307
2055
  * controller in how to handle rendering and other platform integrations.
1308
2056
  * @internal
1309
2057
  */
1310
- constructor(e, t) {
1311
- super(e), this.boundObservables = null, this.behaviors = null, this.needsInitialization = !0, this._template = null, this._styles = null, this._isConnected = !1, this.$fastController = this, this.view = null, this.element = e, this.definition = t;
1312
- const i = t.shadowOptions;
1313
- if (i !== void 0) {
1314
- const r = e.attachShadow(i);
1315
- i.mode === "closed" && de.set(e, r);
1316
- }
1317
- const n = b.getAccessors(e);
1318
- if (n.length > 0) {
1319
- const r = this.boundObservables = /* @__PURE__ */ Object.create(null);
1320
- for (let o = 0, a = n.length; o < a; ++o) {
1321
- const c = n[o].name, l = e[c];
1322
- l !== void 0 && (delete e[c], r[c] = l);
2058
+ constructor(t, e) {
2059
+ super(t), this.boundObservables = null, this.needsInitialization = !0, this.hasExistingShadowRoot = !1, this._template = null, this.stage = 3, this.guardBehaviorConnection = !1, this.behaviors = null, this.behaviorsConnected = !1, this._mainStyles = null, this.$fastController = this, this.view = null, this.source = t, this.definition = e, this.shadowOptions = e.shadowOptions;
2060
+ const s = b.getAccessors(t);
2061
+ if (s.length > 0) {
2062
+ const n = this.boundObservables = /* @__PURE__ */ Object.create(null);
2063
+ for (let r = 0, a = s.length; r < a; ++r) {
2064
+ const c = s[r].name, d = t[c];
2065
+ d !== void 0 && (delete t[c], n[c] = d);
1323
2066
  }
1324
2067
  }
1325
2068
  }
@@ -1328,10 +2071,28 @@ class D extends ie {
1328
2071
  * connected to the document.
1329
2072
  */
1330
2073
  get isConnected() {
1331
- return b.track(this, "isConnected"), this._isConnected;
2074
+ return b.track(this, P), this.stage === 1;
2075
+ }
2076
+ /**
2077
+ * The context the expression is evaluated against.
2078
+ */
2079
+ get context() {
2080
+ var t, e;
2081
+ return (e = (t = this.view) === null || t === void 0 ? void 0 : t.context) !== null && e !== void 0 ? e : E.default;
2082
+ }
2083
+ /**
2084
+ * Indicates whether the controller is bound.
2085
+ */
2086
+ get isBound() {
2087
+ var t, e;
2088
+ return (e = (t = this.view) === null || t === void 0 ? void 0 : t.isBound) !== null && e !== void 0 ? e : !1;
1332
2089
  }
1333
- setIsConnected(e) {
1334
- this._isConnected = e, b.notify(this, "isConnected");
2090
+ /**
2091
+ * Indicates how the source's lifetime relates to the controller's lifetime.
2092
+ */
2093
+ get sourceLifetime() {
2094
+ var t;
2095
+ return (t = this.view) === null || t === void 0 ? void 0 : t.sourceLifetime;
1335
2096
  }
1336
2097
  /**
1337
2098
  * Gets/sets the template used to render the component.
@@ -1339,116 +2100,148 @@ class D extends ie {
1339
2100
  * This value can only be accurately read after connect but can be set at any time.
1340
2101
  */
1341
2102
  get template() {
2103
+ var t;
2104
+ if (this._template === null) {
2105
+ const e = this.definition;
2106
+ this.source.resolveTemplate ? this._template = this.source.resolveTemplate() : e.template && (this._template = (t = e.template) !== null && t !== void 0 ? t : null);
2107
+ }
1342
2108
  return this._template;
1343
2109
  }
1344
- set template(e) {
1345
- this._template !== e && (this._template = e, this.needsInitialization || this.renderTemplate(e));
2110
+ set template(t) {
2111
+ this._template !== t && (this._template = t, this.needsInitialization || this.renderTemplate(t));
2112
+ }
2113
+ get shadowOptions() {
2114
+ return this._shadowRootOptions;
2115
+ }
2116
+ set shadowOptions(t) {
2117
+ if (this._shadowRootOptions === void 0 && t !== void 0) {
2118
+ this._shadowRootOptions = t;
2119
+ let e = this.source.shadowRoot;
2120
+ e ? this.hasExistingShadowRoot = !0 : (e = this.source.attachShadow(t), t.mode === "closed" && ae.set(this.source, e));
2121
+ }
1346
2122
  }
1347
2123
  /**
1348
- * Gets/sets the primary styles used for the component.
1349
- * @remarks
1350
- * This value can only be accurately read after connect but can be set at any time.
2124
+ * The main set of styles used for the component, independent
2125
+ * of any dynamically added styles.
2126
+ */
2127
+ get mainStyles() {
2128
+ var t;
2129
+ if (this._mainStyles === null) {
2130
+ const e = this.definition;
2131
+ this.source.resolveStyles ? this._mainStyles = this.source.resolveStyles() : e.styles && (this._mainStyles = (t = e.styles) !== null && t !== void 0 ? t : null);
2132
+ }
2133
+ return this._mainStyles;
2134
+ }
2135
+ set mainStyles(t) {
2136
+ this._mainStyles !== t && (this._mainStyles !== null && this.removeStyles(this._mainStyles), this._mainStyles = t, this.needsInitialization || this.addStyles(t));
2137
+ }
2138
+ /**
2139
+ * Registers an unbind handler with the controller.
2140
+ * @param behavior - An object to call when the controller unbinds.
2141
+ */
2142
+ onUnbind(t) {
2143
+ var e;
2144
+ (e = this.view) === null || e === void 0 || e.onUnbind(t);
2145
+ }
2146
+ /**
2147
+ * Adds the behavior to the component.
2148
+ * @param behavior - The behavior to add.
1351
2149
  */
1352
- get styles() {
1353
- return this._styles;
2150
+ addBehavior(t) {
2151
+ var e, s;
2152
+ const n = (e = this.behaviors) !== null && e !== void 0 ? e : this.behaviors = /* @__PURE__ */ new Map(), r = (s = n.get(t)) !== null && s !== void 0 ? s : 0;
2153
+ r === 0 ? (n.set(t, 1), t.addedCallback && t.addedCallback(this), t.connectedCallback && !this.guardBehaviorConnection && (this.stage === 1 || this.stage === 0) && t.connectedCallback(this)) : n.set(t, r + 1);
1354
2154
  }
1355
- set styles(e) {
1356
- this._styles !== e && (this._styles !== null && this.removeStyles(this._styles), this._styles = e, !this.needsInitialization && e !== null && this.addStyles(e));
2155
+ /**
2156
+ * Removes the behavior from the component.
2157
+ * @param behavior - The behavior to remove.
2158
+ * @param force - Forces removal even if this behavior was added more than once.
2159
+ */
2160
+ removeBehavior(t, e = !1) {
2161
+ const s = this.behaviors;
2162
+ if (s === null)
2163
+ return;
2164
+ const n = s.get(t);
2165
+ n !== void 0 && (n === 1 || e ? (s.delete(t), t.disconnectedCallback && this.stage !== 3 && t.disconnectedCallback(this), t.removedCallback && t.removedCallback(this)) : s.set(t, n - 1));
1357
2166
  }
1358
2167
  /**
1359
2168
  * Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
1360
2169
  * @param styles - The styles to add.
1361
2170
  */
1362
- addStyles(e) {
1363
- const t = E(this.element) || this.element.getRootNode();
1364
- if (e instanceof HTMLStyleElement)
1365
- t.append(e);
1366
- else if (!e.isAttachedTo(t)) {
1367
- const i = e.behaviors;
1368
- e.addStylesTo(t), i !== null && this.addBehaviors(i);
2171
+ addStyles(t) {
2172
+ var e;
2173
+ if (!t)
2174
+ return;
2175
+ const s = this.source;
2176
+ if (t instanceof HTMLElement)
2177
+ ((e = j(s)) !== null && e !== void 0 ? e : this.source).append(t);
2178
+ else if (!t.isAttachedTo(s)) {
2179
+ const n = t.behaviors;
2180
+ if (t.addStylesTo(s), n !== null)
2181
+ for (let r = 0, a = n.length; r < a; ++r)
2182
+ this.addBehavior(n[r]);
1369
2183
  }
1370
2184
  }
1371
2185
  /**
1372
2186
  * Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
1373
2187
  * @param styles - the styles to remove.
1374
2188
  */
1375
- removeStyles(e) {
1376
- const t = E(this.element) || this.element.getRootNode();
1377
- if (e instanceof HTMLStyleElement)
1378
- t.removeChild(e);
1379
- else if (e.isAttachedTo(t)) {
1380
- const i = e.behaviors;
1381
- e.removeStylesFrom(t), i !== null && this.removeBehaviors(i);
2189
+ removeStyles(t) {
2190
+ var e;
2191
+ if (!t)
2192
+ return;
2193
+ const s = this.source;
2194
+ if (t instanceof HTMLElement)
2195
+ ((e = j(s)) !== null && e !== void 0 ? e : s).removeChild(t);
2196
+ else if (t.isAttachedTo(s)) {
2197
+ const n = t.behaviors;
2198
+ if (t.removeStylesFrom(s), n !== null)
2199
+ for (let r = 0, a = n.length; r < a; ++r)
2200
+ this.removeBehavior(n[r]);
1382
2201
  }
1383
2202
  }
1384
2203
  /**
1385
- * Adds behaviors to this element.
1386
- * @param behaviors - The behaviors to add.
2204
+ * Runs connected lifecycle behavior on the associated element.
1387
2205
  */
1388
- addBehaviors(e) {
1389
- const t = this.behaviors || (this.behaviors = /* @__PURE__ */ new Map()), i = e.length, n = [];
1390
- for (let r = 0; r < i; ++r) {
1391
- const o = e[r];
1392
- t.has(o) ? t.set(o, t.get(o) + 1) : (t.set(o, 1), n.push(o));
1393
- }
1394
- if (this._isConnected) {
1395
- const r = this.element;
1396
- for (let o = 0; o < n.length; ++o)
1397
- n[o].bind(r, w);
1398
- }
2206
+ connect() {
2207
+ this.stage === 3 && (this.stage = 0, this.bindObservables(), this.connectBehaviors(), this.needsInitialization ? (this.renderTemplate(this.template), this.addStyles(this.mainStyles), this.needsInitialization = !1) : this.view !== null && this.view.bind(this.source), this.stage = 1, b.notify(this, P));
1399
2208
  }
1400
- /**
1401
- * Removes behaviors from this element.
1402
- * @param behaviors - The behaviors to remove.
1403
- * @param force - Forces unbinding of behaviors.
1404
- */
1405
- removeBehaviors(e, t = !1) {
1406
- const i = this.behaviors;
1407
- if (i === null)
1408
- return;
1409
- const n = e.length, r = [];
1410
- for (let o = 0; o < n; ++o) {
1411
- const a = e[o];
1412
- if (i.has(a)) {
1413
- const c = i.get(a) - 1;
1414
- c === 0 || t ? i.delete(a) && r.push(a) : i.set(a, c);
2209
+ bindObservables() {
2210
+ if (this.boundObservables !== null) {
2211
+ const t = this.source, e = this.boundObservables, s = Object.keys(e);
2212
+ for (let n = 0, r = s.length; n < r; ++n) {
2213
+ const a = s[n];
2214
+ t[a] = e[a];
1415
2215
  }
2216
+ this.boundObservables = null;
1416
2217
  }
1417
- if (this._isConnected) {
1418
- const o = this.element;
1419
- for (let a = 0; a < r.length; ++a)
1420
- r[a].unbind(o);
2218
+ }
2219
+ connectBehaviors() {
2220
+ if (this.behaviorsConnected === !1) {
2221
+ const t = this.behaviors;
2222
+ if (t !== null) {
2223
+ this.guardBehaviorConnection = !0;
2224
+ for (const e of t.keys())
2225
+ e.connectedCallback && e.connectedCallback(this);
2226
+ this.guardBehaviorConnection = !1;
2227
+ }
2228
+ this.behaviorsConnected = !0;
1421
2229
  }
1422
2230
  }
1423
- /**
1424
- * Runs connected lifecycle behavior on the associated element.
1425
- */
1426
- onConnectedCallback() {
1427
- if (this._isConnected)
1428
- return;
1429
- const e = this.element;
1430
- this.needsInitialization ? this.finishInitialization() : this.view !== null && this.view.bind(e, w);
1431
- const t = this.behaviors;
1432
- if (t !== null)
1433
- for (const [i] of t)
1434
- i.bind(e, w);
1435
- this.setIsConnected(!0);
2231
+ disconnectBehaviors() {
2232
+ if (this.behaviorsConnected === !0) {
2233
+ const t = this.behaviors;
2234
+ if (t !== null)
2235
+ for (const e of t.keys())
2236
+ e.disconnectedCallback && e.disconnectedCallback(this);
2237
+ this.behaviorsConnected = !1;
2238
+ }
1436
2239
  }
1437
2240
  /**
1438
2241
  * Runs disconnected lifecycle behavior on the associated element.
1439
2242
  */
1440
- onDisconnectedCallback() {
1441
- if (!this._isConnected)
1442
- return;
1443
- this.setIsConnected(!1);
1444
- const e = this.view;
1445
- e !== null && e.unbind();
1446
- const t = this.behaviors;
1447
- if (t !== null) {
1448
- const i = this.element;
1449
- for (const [n] of t)
1450
- n.unbind(i);
1451
- }
2243
+ disconnect() {
2244
+ this.stage === 1 && (this.stage = 2, b.notify(this, P), this.view !== null && this.view.unbind(), this.disconnectBehaviors(), this.stage = 3);
1452
2245
  }
1453
2246
  /**
1454
2247
  * Runs the attribute changed callback for the associated element.
@@ -1456,9 +2249,9 @@ class D extends ie {
1456
2249
  * @param oldValue - The previous value of the attribute.
1457
2250
  * @param newValue - The new value of the attribute.
1458
2251
  */
1459
- onAttributeChangedCallback(e, t, i) {
1460
- const n = this.definition.attributeLookup[e];
1461
- n !== void 0 && n.onAttributeChangedCallback(this.element, i);
2252
+ onAttributeChangedCallback(t, e, s) {
2253
+ const n = this.definition.attributeLookup[t];
2254
+ n !== void 0 && n.onAttributeChangedCallback(this.source, s);
1462
2255
  }
1463
2256
  /**
1464
2257
  * Emits a custom HTML event.
@@ -1468,160 +2261,345 @@ class D extends ie {
1468
2261
  * @remarks
1469
2262
  * Only emits events if connected.
1470
2263
  */
1471
- emit(e, t, i) {
1472
- return this._isConnected ? this.element.dispatchEvent(new CustomEvent(e, Object.assign(Object.assign({ detail: t }, Pe), i))) : !1;
1473
- }
1474
- finishInitialization() {
1475
- const e = this.element, t = this.boundObservables;
1476
- if (t !== null) {
1477
- const n = Object.keys(t);
1478
- for (let r = 0, o = n.length; r < o; ++r) {
1479
- const a = n[r];
1480
- e[a] = t[a];
1481
- }
1482
- this.boundObservables = null;
2264
+ emit(t, e, s) {
2265
+ return this.stage === 1 ? this.source.dispatchEvent(new CustomEvent(t, Object.assign(Object.assign({ detail: e }, We), s))) : !1;
2266
+ }
2267
+ renderTemplate(t) {
2268
+ var e;
2269
+ const s = this.source, n = (e = j(s)) !== null && e !== void 0 ? e : s;
2270
+ if (this.view !== null)
2271
+ this.view.dispose(), this.view = null;
2272
+ else if (!this.needsInitialization || this.hasExistingShadowRoot) {
2273
+ this.hasExistingShadowRoot = !1;
2274
+ for (let r = n.firstChild; r !== null; r = n.firstChild)
2275
+ n.removeChild(r);
1483
2276
  }
1484
- const i = this.definition;
1485
- this._template === null && (this.element.resolveTemplate ? this._template = this.element.resolveTemplate() : i.template && (this._template = i.template || null)), this._template !== null && this.renderTemplate(this._template), this._styles === null && (this.element.resolveStyles ? this._styles = this.element.resolveStyles() : i.styles && (this._styles = i.styles || null)), this._styles !== null && this.addStyles(this._styles), this.needsInitialization = !1;
1486
- }
1487
- renderTemplate(e) {
1488
- const t = this.element, i = E(t) || t;
1489
- this.view !== null ? (this.view.dispose(), this.view = null) : this.needsInitialization || u.removeChildNodes(i), e && (this.view = e.render(t, i, t));
2277
+ t && (this.view = t.render(s, n, s), this.view.sourceLifetime = J.coupled);
1490
2278
  }
1491
2279
  /**
1492
2280
  * Locates or creates a controller for the specified element.
1493
2281
  * @param element - The element to return the controller for.
2282
+ * @param override - Reset the controller even if one has been defined.
1494
2283
  * @remarks
1495
2284
  * The specified element must have a {@link FASTElementDefinition}
1496
2285
  * registered either through the use of the {@link customElement}
1497
2286
  * decorator or a call to `FASTElement.define`.
1498
2287
  */
1499
- static forCustomElement(e) {
1500
- const t = e.$fastController;
1501
- if (t !== void 0)
1502
- return t;
1503
- const i = B.forType(e.constructor);
1504
- if (i === void 0)
1505
- throw new Error("Missing FASTElement definition.");
1506
- return e.$fastController = new D(e, i);
2288
+ static forCustomElement(t, e = !1) {
2289
+ const s = t.$fastController;
2290
+ if (s !== void 0 && !e)
2291
+ return s;
2292
+ const n = f.getForInstance(t);
2293
+ if (n === void 0)
2294
+ throw y.error(
2295
+ 1401
2296
+ /* Message.missingElementDefinition */
2297
+ );
2298
+ return b.getNotifier(n).subscribe({
2299
+ handleChange: () => {
2300
+ C.forCustomElement(t, !0), t.$fastController.connect();
2301
+ }
2302
+ }, "template"), b.getNotifier(n).subscribe({
2303
+ handleChange: () => {
2304
+ C.forCustomElement(t, !0), t.$fastController.connect();
2305
+ }
2306
+ }, "shadowOptions"), t.$fastController = new jt(t, n);
2307
+ }
2308
+ /**
2309
+ * Sets the strategy that ElementController.forCustomElement uses to construct
2310
+ * ElementController instances for an element.
2311
+ * @param strategy - The strategy to use.
2312
+ */
2313
+ static setStrategy(t) {
2314
+ jt = t;
2315
+ }
2316
+ }
2317
+ x(C);
2318
+ C.setStrategy(C);
2319
+ function Q(i) {
2320
+ var t;
2321
+ return "adoptedStyleSheets" in i ? i : (t = j(i)) !== null && t !== void 0 ? t : i.getRootNode();
2322
+ }
2323
+ class Z {
2324
+ constructor(t) {
2325
+ const e = Z.styleSheetCache;
2326
+ this.sheets = t.map((s) => {
2327
+ if (s instanceof CSSStyleSheet)
2328
+ return s;
2329
+ let n = e.get(s);
2330
+ return n === void 0 && (n = new CSSStyleSheet(), n.replaceSync(s), e.set(s, n)), n;
2331
+ });
2332
+ }
2333
+ addStylesTo(t) {
2334
+ le(Q(t), this.sheets);
2335
+ }
2336
+ removeStylesFrom(t) {
2337
+ ce(Q(t), this.sheets);
2338
+ }
2339
+ }
2340
+ Z.styleSheetCache = /* @__PURE__ */ new Map();
2341
+ let qe = 0;
2342
+ const Qe = () => `fast-${++qe}`;
2343
+ function Lt(i) {
2344
+ return i === document ? document.body : i;
2345
+ }
2346
+ class Ge {
2347
+ constructor(t) {
2348
+ this.styles = t, this.styleClass = Qe();
2349
+ }
2350
+ addStylesTo(t) {
2351
+ t = Lt(Q(t));
2352
+ const e = this.styles, s = this.styleClass;
2353
+ for (let n = 0; n < e.length; n++) {
2354
+ const r = document.createElement("style");
2355
+ r.innerHTML = e[n], r.className = s, t.append(r);
2356
+ }
2357
+ }
2358
+ removeStylesFrom(t) {
2359
+ t = Lt(Q(t));
2360
+ const e = t.querySelectorAll(`.${this.styleClass}`);
2361
+ for (let s = 0, n = e.length; s < n; ++s)
2362
+ t.removeChild(e[s]);
2363
+ }
2364
+ }
2365
+ let le = (i, t) => {
2366
+ i.adoptedStyleSheets = [...i.adoptedStyleSheets, ...t];
2367
+ }, ce = (i, t) => {
2368
+ i.adoptedStyleSheets = i.adoptedStyleSheets.filter((e) => t.indexOf(e) === -1);
2369
+ };
2370
+ if (m.supportsAdoptedStyleSheets) {
2371
+ try {
2372
+ document.adoptedStyleSheets.push(), document.adoptedStyleSheets.splice(), le = (i, t) => {
2373
+ i.adoptedStyleSheets.push(...t);
2374
+ }, ce = (i, t) => {
2375
+ for (const e of t) {
2376
+ const s = i.adoptedStyleSheets.indexOf(e);
2377
+ s !== -1 && i.adoptedStyleSheets.splice(s, 1);
2378
+ }
2379
+ };
2380
+ } catch {
2381
+ }
2382
+ m.setDefaultStrategy(Z);
2383
+ } else
2384
+ m.setDefaultStrategy(Ge);
2385
+ const st = "defer-hydration", F = "needs-hydration";
2386
+ class v extends C {
2387
+ /**
2388
+ * Configure lifecycle callbacks for hydration events
2389
+ */
2390
+ static config(t) {
2391
+ return v.lifecycleCallbacks = t, this;
2392
+ }
2393
+ static hydrationObserverHandler(t) {
2394
+ for (const e of t)
2395
+ v.hydrationObserver.unobserve(e.target), e.target.$fastController.connect();
2396
+ }
2397
+ /**
2398
+ * Checks if all elements have completed hydration and dispatches event if complete
2399
+ */
2400
+ static checkHydrationComplete() {
2401
+ var t, e;
2402
+ document.querySelector(`[${F}]`) || (e = (t = v.lifecycleCallbacks) === null || t === void 0 ? void 0 : t.hydrationComplete) === null || e === void 0 || e.call(t);
2403
+ }
2404
+ static forCustomElement(t, e) {
2405
+ const s = f.getForInstance(t);
2406
+ return s?.templateOptions === ze.deferAndHydrate && !s.template && (t.toggleAttribute(st, !0), t.toggleAttribute(F, !0)), super.forCustomElement(t, e);
2407
+ }
2408
+ connect() {
2409
+ var t, e, s, n, r, a;
2410
+ if (this.needsHydration === void 0 && (this.needsHydration = this.source.getAttribute(F) !== null), this.source.hasAttribute(st)) {
2411
+ v.hydrationObserver.observe(this.source, {
2412
+ attributeFilter: [st]
2413
+ });
2414
+ return;
2415
+ }
2416
+ if (!this.needsHydration) {
2417
+ super.connect();
2418
+ return;
2419
+ }
2420
+ if (this.stage !== 3)
2421
+ return;
2422
+ (e = (t = v.lifecycleCallbacks) === null || t === void 0 ? void 0 : t.elementWillHydrate) === null || e === void 0 || e.call(t, this.definition.name), this.stage = 0, this.bindObservables(), this.connectBehaviors();
2423
+ const c = this.source, d = (s = j(c)) !== null && s !== void 0 ? s : c;
2424
+ if (this.template)
2425
+ if (U(this.template)) {
2426
+ let l = d.firstChild, o = d.lastChild;
2427
+ c.shadowRoot === null && (w.isElementBoundaryStartMarker(l) && (l.data = "", l = l.nextSibling), w.isElementBoundaryEndMarker(o) && (o.data = "", o = o.previousSibling)), this.view = this.template.hydrate(l, o, c), (n = this.view) === null || n === void 0 || n.bind(this.source);
2428
+ } else
2429
+ this.renderTemplate(this.template);
2430
+ this.addStyles(this.mainStyles), this.stage = 1, this.source.removeAttribute(F), this.needsInitialization = this.needsHydration = !1, b.notify(this, P), (a = (r = v.lifecycleCallbacks) === null || r === void 0 ? void 0 : r.elementDidHydrate) === null || a === void 0 || a.call(r, this.definition.name), v.checkHydrationComplete();
2431
+ }
2432
+ disconnect() {
2433
+ super.disconnect(), v.hydrationObserver.unobserve(this.source);
2434
+ }
2435
+ static install() {
2436
+ C.setStrategy(v);
1507
2437
  }
1508
2438
  }
1509
- function G(s) {
1510
- return class extends s {
2439
+ v.hydrationObserver = new Ue(v.hydrationObserverHandler);
2440
+ var Je = function(i, t, e, s) {
2441
+ function n(r) {
2442
+ return r instanceof e ? r : new e(function(a) {
2443
+ a(r);
2444
+ });
2445
+ }
2446
+ return new (e || (e = Promise))(function(r, a) {
2447
+ function c(o) {
2448
+ try {
2449
+ l(s.next(o));
2450
+ } catch (h) {
2451
+ a(h);
2452
+ }
2453
+ }
2454
+ function d(o) {
2455
+ try {
2456
+ l(s.throw(o));
2457
+ } catch (h) {
2458
+ a(h);
2459
+ }
2460
+ }
2461
+ function l(o) {
2462
+ o.done ? r(o.value) : n(o.value).then(c, d);
2463
+ }
2464
+ l((s = s.apply(i, t || [])).next());
2465
+ });
2466
+ };
2467
+ function de(i) {
2468
+ const t = class extends i {
1511
2469
  constructor() {
1512
- super(), D.forCustomElement(this);
2470
+ super(), C.forCustomElement(this);
1513
2471
  }
1514
- $emit(e, t, i) {
1515
- return this.$fastController.emit(e, t, i);
2472
+ $emit(e, s, n) {
2473
+ return this.$fastController.emit(e, s, n);
1516
2474
  }
1517
2475
  connectedCallback() {
1518
- this.$fastController.onConnectedCallback();
2476
+ this.$fastController.connect();
1519
2477
  }
1520
2478
  disconnectedCallback() {
1521
- this.$fastController.onDisconnectedCallback();
2479
+ this.$fastController.disconnect();
1522
2480
  }
1523
- attributeChangedCallback(e, t, i) {
1524
- this.$fastController.onAttributeChangedCallback(e, t, i);
2481
+ attributeChangedCallback(e, s, n) {
2482
+ this.$fastController.onAttributeChangedCallback(e, s, n);
1525
2483
  }
1526
2484
  };
2485
+ return f.registerBaseType(t), t;
2486
+ }
2487
+ function Ke(i, t) {
2488
+ return O(i) ? f.compose(i, t) : f.compose(this, i);
2489
+ }
2490
+ function Xe(i, t) {
2491
+ return Je(this, void 0, void 0, function* () {
2492
+ return O(i) ? (yield f.composeAsync(i, t)).define().type : (yield f.composeAsync(this, i)).define().type;
2493
+ });
1527
2494
  }
1528
- const Le = Object.assign(G(HTMLElement), {
2495
+ function Ye(i, t) {
2496
+ return O(i) ? f.compose(i, t).define().type : f.compose(this, i).define().type;
2497
+ }
2498
+ function Ze(i) {
2499
+ return de(i);
2500
+ }
2501
+ const ti = Object.assign(de(HTMLElement), {
1529
2502
  /**
1530
2503
  * Creates a new FASTElement base class inherited from the
1531
2504
  * provided base type.
1532
2505
  * @param BaseType - The base element type to inherit from.
1533
2506
  */
1534
- from(s) {
1535
- return G(s);
1536
- },
2507
+ from: Ze,
1537
2508
  /**
1538
2509
  * Defines a platform custom element based on the provided type and definition.
1539
2510
  * @param type - The custom element type to define.
1540
2511
  * @param nameOrDef - The name of the element to define or a definition object
1541
2512
  * that describes the element to define.
1542
2513
  */
1543
- define(s, e) {
1544
- return new B(s, e).define().type;
1545
- }
2514
+ define: Ye,
2515
+ /**
2516
+ * Defines metadata for a FASTElement which can be used to later define the element.
2517
+ * @public
2518
+ */
2519
+ compose: Ke,
2520
+ /**
2521
+ * Defines metadata for a FASTElement which can be used after it has been resolved to define the element.
2522
+ * @alpha
2523
+ */
2524
+ defineAsync: Xe
1546
2525
  });
1547
- function je(s, e) {
1548
- return s instanceof Function ? s(e) : s;
1549
- }
1550
- const J = /* @__PURE__ */ new Set(), M = /* @__PURE__ */ new Map(), et = (s) => (e = "vwc") => {
1551
- const t = (n) => `${e}-${n}`, i = (n) => {
1552
- const r = t(n.name);
1553
- let o = n.type;
1554
- if (o.componentName = n.name, J.has(r))
2526
+ function ei(i, t) {
2527
+ return i instanceof Function ? i(t) : i;
2528
+ }
2529
+ const Vt = /* @__PURE__ */ new Set(), nt = /* @__PURE__ */ new Map(), yi = (i) => (t = "vwc") => {
2530
+ const e = (n) => `${t}-${n}`, s = (n) => {
2531
+ const r = e(n.name);
2532
+ let a = n.type;
2533
+ if (a.componentName = n.name, Vt.has(r))
1555
2534
  return;
1556
- M.has(o) && M.get(o) !== r && (o = class extends o {
1557
- }), J.add(r), M.set(o, r);
1558
- for (const l of n.dependencies)
1559
- i(l);
1560
- const a = new Map([
2535
+ nt.has(a) && nt.get(a) !== r && (a = class extends a {
2536
+ }), Vt.add(r), nt.set(a, r);
2537
+ for (const o of n.dependencies)
2538
+ s(o);
2539
+ const c = new Map([
1561
2540
  [n.type, r],
1562
2541
  ...n.dependencies.map(
1563
- (l) => [l.type, t(l.name)]
2542
+ (o) => [o.type, e(o.name)]
1564
2543
  )
1565
- ]), c = {
1566
- tagFor(l) {
1567
- if (!a.has(l))
2544
+ ]), l = {
2545
+ tagFor: (o, h) => {
2546
+ if (!c.has(o))
1568
2547
  throw new Error(
1569
- `Could not get tag for ${l.name} as it is not a dependency of ${n.name}.`
2548
+ `Could not get tag for ${o.name} as it is not a dependency of ${n.name}.`
1570
2549
  );
1571
- return a.get(l);
2550
+ const u = c.get(o);
2551
+ return h ? u : re.partial(u);
1572
2552
  },
1573
- tagForNonDependency(l) {
1574
- return t(l);
2553
+ tagForNonDependency(o) {
2554
+ return e(o);
1575
2555
  }
1576
2556
  };
1577
- new B(o, {
2557
+ f.compose(a, {
1578
2558
  ...n.options,
1579
- template: je(
2559
+ template: ei(
1580
2560
  n.template,
1581
- c
2561
+ l
1582
2562
  ),
1583
- name: `${e}-${n.name}`
2563
+ name: `${t}-${n.name}`
1584
2564
  }).define();
1585
2565
  };
1586
- i(s);
1587
- }, tt = (s, e, t, i, n) => ({
1588
- name: s,
1589
- type: e,
1590
- template: t,
1591
- dependencies: i,
2566
+ s(i);
2567
+ }, vi = (i, t, e, s, n) => ({
2568
+ name: i,
2569
+ type: t,
2570
+ template: e,
2571
+ dependencies: s,
1592
2572
  options: n
1593
- }), X = /* @__PURE__ */ new WeakMap(), T = (s) => {
1594
- let e = X.get(s);
1595
- return e || (e = [], X.set(s, e)), e;
1596
- }, st = (s, e) => {
1597
- T(s).push(e);
1598
- }, it = (s, e) => {
1599
- T(s).splice(T(s).indexOf(e), 1);
1600
- }, He = (s, e) => {
1601
- T(s).forEach((t) => t(s, e));
1602
- }, De = (s) => s === "delegate", Y = (s) => `vvd${s.charAt(0).toUpperCase()}${s.slice(1)}`, ue = (s, e) => {
1603
- if (De(s._vividAriaBehaviour)) {
1604
- const t = s[e];
1605
- s[`_${e}`] = null, s.removeAttribute(V(e)), s[`_${e}`] = t, s[e] !== null ? s.dataset[Y(e)] = s[e] : delete s.dataset[Y(e)];
2573
+ }), Ft = /* @__PURE__ */ new WeakMap(), he = (i) => {
2574
+ let t = Ft.get(i);
2575
+ return t || (t = [], Ft.set(i, t)), t;
2576
+ }, mi = (i, t) => {
2577
+ he(i).push(t);
2578
+ }, ii = (i, t) => {
2579
+ he(i).forEach((e) => e(i, t));
2580
+ }, si = (i) => i === "delegate", It = (i) => `vvd${i.charAt(0).toUpperCase()}${i.slice(1)}`, ue = (i, t) => {
2581
+ if (si(i._vividAriaBehaviour)) {
2582
+ const e = i[t];
2583
+ i[`_${t}`] = null, i.removeAttribute(at(t)), i[`_${t}`] = e, i[t] !== null ? i.dataset[It(t)] = i[t] : delete i.dataset[It(t)];
1606
2584
  } else
1607
- u.setAttribute(
1608
- s,
1609
- V(e),
1610
- s[e]
2585
+ T.setAttribute(
2586
+ i,
2587
+ at(t),
2588
+ i[t]
1611
2589
  );
1612
- }, A = /* @__PURE__ */ new WeakMap(), ze = (s, e) => {
1613
- const t = A.get(s);
1614
- t ? t.add(e) : A.set(s, /* @__PURE__ */ new Set([e]));
1615
- }, qe = (s, e) => {
1616
- s.isConnected ? ue(s, e) : ze(s, e);
1617
- }, Ue = (s) => {
1618
- const e = A.get(s);
1619
- if (e) {
1620
- for (const t of e)
1621
- ue(s, t);
1622
- A.delete(s);
1623
- }
1624
- }, Z = [
2590
+ }, G = /* @__PURE__ */ new WeakMap(), ni = (i, t) => {
2591
+ const e = G.get(i);
2592
+ e ? e.add(t) : G.set(i, /* @__PURE__ */ new Set([t]));
2593
+ }, ri = (i, t) => {
2594
+ i.isConnected ? ue(i, t) : ni(i, t);
2595
+ }, oi = (i) => {
2596
+ const t = G.get(i);
2597
+ if (t) {
2598
+ for (const e of t)
2599
+ ue(i, e);
2600
+ G.delete(i);
2601
+ }
2602
+ }, Ht = [
1625
2603
  "role",
1626
2604
  "ariaAtomic",
1627
2605
  "ariaAutoComplete",
@@ -1665,65 +2643,70 @@ const J = /* @__PURE__ */ new Set(), M = /* @__PURE__ */ new Map(), et = (s) =>
1665
2643
  "ariaValueText",
1666
2644
  "ariaRelevant"
1667
2645
  // Non-standard
1668
- ], V = (s) => s.replace("aria", "aria-").toLowerCase(), We = (s) => {
1669
- class e extends s {
1670
- constructor(...i) {
1671
- super(...i), this._vividAriaBehaviour = "default";
1672
- for (const n of Z)
2646
+ ], at = (i) => i.replace("aria", "aria-").toLowerCase(), ai = (i) => {
2647
+ class t extends i {
2648
+ constructor(...s) {
2649
+ super(...s), this._vividAriaBehaviour = "default";
2650
+ for (const n of Ht)
1673
2651
  this[`_${n}`] = null;
1674
2652
  }
1675
2653
  connectedCallback() {
1676
- super.connectedCallback(), Ue(this);
2654
+ super.connectedCallback(), oi(this);
1677
2655
  }
1678
2656
  }
1679
- for (const t of Z)
1680
- Re({
1681
- attribute: V(t),
2657
+ for (const e of Ht)
2658
+ De({
2659
+ attribute: at(e),
1682
2660
  mode: "fromView"
1683
- })(e.prototype, t), e.prototype[`${t}Changed`] = function() {
1684
- qe(this, t), this._vividAriaBehaviour !== "default" && He(this, t);
2661
+ })(t.prototype, e), t.prototype[`${e}Changed`] = function() {
2662
+ ri(this, e), this._vividAriaBehaviour !== "default" && ii(this, e);
1685
2663
  };
1686
- return e;
1687
- }, fe = _(), nt = (s) => (e, t) => {
1688
- fe(e.constructor).push({
1689
- newPropertyName: t,
1690
- ...s
2664
+ return t;
2665
+ };
2666
+ function li() {
2667
+ const i = /* @__PURE__ */ new WeakMap();
2668
+ return (t) => (i.has(t) || i.set(t, []), i.get(t));
2669
+ }
2670
+ const fe = li(), wi = (i) => (t, e) => {
2671
+ fe(t.constructor).push({
2672
+ newPropertyName: e,
2673
+ ...i
1691
2674
  });
1692
- }, Qe = (s) => {
1693
- class e extends s {
1694
- #e(i) {
2675
+ }, ci = (i) => {
2676
+ class t extends i {
2677
+ #t(s) {
1695
2678
  let n = !1, r = !1;
1696
- const o = (h) => r && i.fromDeprecated(
1697
- h[i.deprecatedPropertyName]
1698
- ) === h[i.newPropertyName], a = (h) => n && i.toDeprecated && i.toDeprecated(h[i.newPropertyName]) === h[i.deprecatedPropertyName], c = {
1699
- handleChange(h, d) {
1700
- if (d === i.newPropertyName) {
1701
- if (n = !0, !i.toDeprecated || o(h))
2679
+ const a = (o) => r && s.fromDeprecated(
2680
+ o[s.deprecatedPropertyName]
2681
+ ) === o[s.newPropertyName], c = (o) => n && s.toDeprecated && s.toDeprecated(o[s.newPropertyName]) === o[s.deprecatedPropertyName], d = {
2682
+ handleChange(o, h) {
2683
+ if (h === s.newPropertyName) {
2684
+ if (n = !0, !s.toDeprecated || a(o))
1702
2685
  return;
1703
- h[i.deprecatedPropertyName] = i.toDeprecated(h[i.newPropertyName]);
2686
+ o[s.deprecatedPropertyName] = s.toDeprecated(o[s.newPropertyName]);
1704
2687
  }
1705
- if (d === i.deprecatedPropertyName) {
1706
- if (r = !0, a(h))
2688
+ if (h === s.deprecatedPropertyName) {
2689
+ if (r = !0, c(o))
1707
2690
  return;
1708
- h[i.newPropertyName] = i.fromDeprecated(
1709
- h[i.deprecatedPropertyName]
2691
+ o[s.newPropertyName] = s.fromDeprecated(
2692
+ o[s.deprecatedPropertyName]
1710
2693
  );
1711
2694
  }
1712
2695
  }
1713
2696
  }, l = b.getNotifier(this);
1714
- l.subscribe(c, i.newPropertyName), l.subscribe(c, i.deprecatedPropertyName);
2697
+ l.subscribe(d, s.newPropertyName), l.subscribe(d, s.deprecatedPropertyName);
1715
2698
  }
1716
- constructor(...i) {
1717
- super(...i);
2699
+ constructor(...s) {
2700
+ super(...s);
1718
2701
  for (const n of fe(this.constructor))
1719
- this.#e(n);
2702
+ this.#t(n);
1720
2703
  }
1721
2704
  }
1722
- return e;
2705
+ return t;
1723
2706
  };
1724
- class rt extends We(Qe(Le)) {
2707
+ class Si extends ai(ci(ti)) {
1725
2708
  static {
1726
- this.VIVID_VERSION = "5.2.0";
2709
+ this.VIVID_VERSION = "5.4.0";
1727
2710
  }
1728
2711
  /**
1729
2712
  * Add data-vvd-component attribute with component name globally,
@@ -1731,31 +2714,45 @@ class rt extends We(Qe(Le)) {
1731
2714
  */
1732
2715
  connectedCallback() {
1733
2716
  super.connectedCallback();
1734
- const e = this.constructor.componentName;
1735
- this.setAttribute("data-vvd-component", e);
2717
+ const t = this.constructor.componentName;
2718
+ this.setAttribute("data-vvd-component", t);
1736
2719
  }
1737
2720
  }
1738
2721
  export {
1739
- Xe as A,
1740
- u as D,
1741
- g as E,
1742
- P as H,
2722
+ hi as A,
2723
+ lt as B,
2724
+ T as D,
2725
+ E,
2726
+ k as H,
2727
+ Kt as M,
1743
2728
  b as O,
1744
- I as S,
1745
- rt as V,
1746
- Re as a,
1747
- w as b,
1748
- et as c,
1749
- tt as d,
1750
- Ke as e,
1751
- V as f,
1752
- Z as g,
1753
- Ye as h,
1754
- Fe as i,
1755
- Ze as n,
1756
- Ge as o,
1757
- nt as r,
1758
- st as s,
1759
- it as u,
1760
- Je as v
2729
+ we as S,
2730
+ Ut as U,
2731
+ Si as V,
2732
+ De as a,
2733
+ gi as b,
2734
+ yi as c,
2735
+ vi as d,
2736
+ ui as e,
2737
+ O as f,
2738
+ qt as g,
2739
+ re as h,
2740
+ B as i,
2741
+ at as j,
2742
+ Ht as k,
2743
+ rt as l,
2744
+ U as m,
2745
+ bi as n,
2746
+ fi as o,
2747
+ A as p,
2748
+ X as q,
2749
+ wi as r,
2750
+ mi as s,
2751
+ w as t,
2752
+ Gt as u,
2753
+ pi as v,
2754
+ m as w,
2755
+ pe as x,
2756
+ di as y,
2757
+ tt as z
1761
2758
  };