@vonage/vivid 5.1.0 → 5.3.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 (386) hide show
  1. package/accordion-item/definition.cjs +2 -1
  2. package/accordion-item/definition.js +2 -1
  3. package/alert/index.cjs +1 -1
  4. package/alert/index.js +1 -1
  5. package/audio-player/definition.cjs +41 -6
  6. package/audio-player/definition.js +41 -6
  7. package/audio-player/index.cjs +27 -25
  8. package/audio-player/index.js +88 -62
  9. package/badge/index.cjs +2 -2
  10. package/badge/index.js +4 -4
  11. package/banner/index.cjs +3 -3
  12. package/banner/index.js +6 -6
  13. package/breadcrumb-item/index.cjs +1 -1
  14. package/breadcrumb-item/index.js +1 -1
  15. package/bundled/affix.cjs +7 -7
  16. package/bundled/affix.js +5 -5
  17. package/bundled/anchored.cjs +1 -1
  18. package/bundled/anchored.js +6 -6
  19. package/bundled/attribute-binding-behaviour.cjs +1 -1
  20. package/bundled/attribute-binding-behaviour.js +15 -13
  21. package/bundled/base-color-picker.cjs +13 -0
  22. package/bundled/base-color-picker.js +194 -0
  23. package/bundled/button.cjs +1 -1
  24. package/bundled/button.js +2 -2
  25. package/bundled/calendar-picker.template.cjs +1 -1
  26. package/bundled/calendar-picker.template.js +21 -21
  27. package/bundled/char-count.cjs +1 -1
  28. package/bundled/char-count.js +1 -1
  29. package/bundled/children.cjs +1 -1
  30. package/bundled/children.js +28 -20
  31. package/bundled/definition.cjs +3 -3
  32. package/bundled/definition.js +38 -38
  33. package/bundled/definition10.cjs +72 -18
  34. package/bundled/definition10.js +351 -65
  35. package/bundled/definition11.cjs +19 -10
  36. package/bundled/definition11.js +66 -37
  37. package/bundled/definition12.cjs +10 -1
  38. package/bundled/definition12.js +38 -14
  39. package/bundled/definition13.cjs +1 -73
  40. package/bundled/definition13.js +15 -354
  41. package/bundled/definition15.cjs +1 -1
  42. package/bundled/definition15.js +1 -1
  43. package/bundled/definition16.cjs +2 -2
  44. package/bundled/definition16.js +8 -8
  45. package/bundled/definition17.cjs +7 -7
  46. package/bundled/definition17.js +17 -17
  47. package/bundled/definition19.cjs +17 -14
  48. package/bundled/definition19.js +85 -77
  49. package/bundled/definition2.cjs +9 -5
  50. package/bundled/definition2.js +21 -17
  51. package/bundled/definition22.cjs +9 -9
  52. package/bundled/definition22.js +31 -31
  53. package/bundled/definition3.cjs +1 -1
  54. package/bundled/definition3.js +1 -1
  55. package/bundled/definition6.cjs +6 -6
  56. package/bundled/definition6.js +34 -31
  57. package/bundled/definition7.cjs +1 -1
  58. package/bundled/definition7.js +6 -6
  59. package/bundled/definition8.cjs +2 -2
  60. package/bundled/definition8.js +4 -4
  61. package/bundled/definition9.cjs +1 -1
  62. package/bundled/definition9.js +1 -1
  63. package/bundled/delegates-aria.cjs +1 -1
  64. package/bundled/delegates-aria.js +59 -46
  65. package/bundled/form-associated.cjs +1 -1
  66. package/bundled/form-associated.js +3 -3
  67. package/bundled/host-semantics.cjs +1 -1
  68. package/bundled/host-semantics.js +48 -34
  69. package/bundled/localized.cjs +1 -1
  70. package/bundled/localized.js +43 -31
  71. package/bundled/mixins.cjs +18 -18
  72. package/bundled/mixins.js +99 -93
  73. package/bundled/normalize.cjs +1 -0
  74. package/bundled/normalize.js +7 -0
  75. package/bundled/picker-field.template.cjs +18 -13
  76. package/bundled/picker-field.template.js +45 -37
  77. package/bundled/ref.cjs +1 -1
  78. package/bundled/ref.js +8 -25
  79. package/bundled/repeat.cjs +1 -1
  80. package/bundled/repeat.js +459 -233
  81. package/bundled/slider.template.cjs +1 -1
  82. package/bundled/slider.template.js +2 -2
  83. package/bundled/slotted.cjs +1 -1
  84. package/bundled/slotted.js +62 -45
  85. package/bundled/text-field.cjs +1 -1
  86. package/bundled/text-field.js +1 -1
  87. package/bundled/time-selection-picker.template.cjs +1 -1
  88. package/bundled/time-selection-picker.template.js +5 -5
  89. package/bundled/vivid-element.cjs +1 -1
  90. package/bundled/vivid-element.js +2126 -1172
  91. package/bundled/when.cjs +1 -1
  92. package/bundled/when.js +8 -7
  93. package/bundled/with-contextual-help.cjs +1 -1
  94. package/bundled/with-contextual-help.js +17 -7
  95. package/calendar/definition.cjs +1 -1
  96. package/calendar/definition.js +2 -2
  97. package/calendar/index.cjs +1 -1
  98. package/calendar/index.js +6 -6
  99. package/calendar-event/index.cjs +1 -1
  100. package/calendar-event/index.js +1 -1
  101. package/card/definition.cjs +10 -2
  102. package/card/definition.js +10 -2
  103. package/card/index.cjs +19 -11
  104. package/card/index.js +35 -27
  105. package/color-picker/definition.cjs +1079 -0
  106. package/color-picker/definition.js +1073 -0
  107. package/color-picker/index.cjs +127 -0
  108. package/color-picker/index.js +726 -0
  109. package/combobox/definition.cjs +13 -6
  110. package/combobox/definition.js +14 -7
  111. package/combobox/index.cjs +15 -11
  112. package/combobox/index.js +82 -75
  113. package/contextual-help/index.cjs +1 -1
  114. package/contextual-help/index.js +1 -1
  115. package/custom-elements.json +1621 -325
  116. package/data-grid/definition.cjs +862 -27
  117. package/data-grid/definition.js +863 -28
  118. package/data-grid/index.cjs +25 -25
  119. package/data-grid/index.js +175 -168
  120. package/date-picker/index.cjs +1 -1
  121. package/date-picker/index.js +2 -2
  122. package/date-range-picker/index.cjs +1 -1
  123. package/date-range-picker/index.js +2 -2
  124. package/date-time-picker/index.cjs +1 -1
  125. package/date-time-picker/index.js +2 -2
  126. package/dial-pad/definition.cjs +55 -1
  127. package/dial-pad/definition.js +56 -2
  128. package/dial-pad/index.cjs +21 -18
  129. package/dial-pad/index.js +138 -104
  130. package/dialog/definition.cjs +4 -1
  131. package/dialog/definition.js +4 -1
  132. package/dialog/index.cjs +21 -18
  133. package/dialog/index.js +43 -40
  134. package/empty-state/definition.cjs +7 -2
  135. package/empty-state/definition.js +7 -2
  136. package/empty-state/index.cjs +10 -5
  137. package/empty-state/index.js +18 -13
  138. package/fab/index.cjs +2 -2
  139. package/fab/index.js +4 -4
  140. package/file-picker/definition.cjs +16 -7
  141. package/file-picker/definition.js +17 -8
  142. package/file-picker/index.cjs +12 -9
  143. package/file-picker/index.js +103 -93
  144. package/icon/definition.cjs +10 -6
  145. package/icon/definition.js +10 -6
  146. package/index.cjs +4 -0
  147. package/index.js +1 -0
  148. package/lib/accordion-item/accordion-item.d.ts +2 -2
  149. package/lib/action-group/action-group.d.ts +2 -2
  150. package/lib/alert/alert.d.ts +4 -4
  151. package/lib/audio-player/audio-player.d.ts +6 -2
  152. package/lib/avatar/avatar.d.ts +2 -2
  153. package/lib/badge/badge.d.ts +2 -2
  154. package/lib/banner/banner.d.ts +6 -6
  155. package/lib/breadcrumb/breadcrumb.d.ts +2 -2
  156. package/lib/breadcrumb-item/breadcrumb-item.d.ts +2 -2
  157. package/lib/button/button.d.ts +6 -6
  158. package/lib/button/button.template.d.ts +2 -1
  159. package/lib/calendar/calendar.d.ts +1 -1
  160. package/lib/calendar-event/calendar-event.d.ts +2 -2
  161. package/lib/card/card.d.ts +2 -2
  162. package/lib/checkbox/checkbox.d.ts +12 -12
  163. package/lib/color-picker/color-picker.d.ts +2420 -0
  164. package/lib/color-picker/color-picker.template.d.ts +3 -0
  165. package/lib/color-picker/definition.d.ts +4 -0
  166. package/lib/color-picker/locale.d.ts +9 -0
  167. package/lib/combobox/combobox.d.ts +495 -78
  168. package/lib/components.d.ts +1 -0
  169. package/lib/data-grid/data-grid-cell.d.ts +4 -4
  170. package/lib/data-grid/data-grid-row.d.ts +3 -4
  171. package/lib/data-grid/data-grid.d.ts +1 -2
  172. package/lib/date-picker/date-picker.d.ts +906 -894
  173. package/lib/date-range-picker/date-range-picker.d.ts +596 -590
  174. package/lib/date-time-picker/date-time-picker.d.ts +907 -895
  175. package/lib/dial-pad/dial-pad.d.ts +3 -2
  176. package/lib/dial-pad/dial-pad.template.d.ts +1 -1
  177. package/lib/dial-pad/locale.d.ts +1 -0
  178. package/lib/dialog/dialog.d.ts +4 -4
  179. package/lib/divider/divider.d.ts +2 -2
  180. package/lib/fab/fab.d.ts +2 -2
  181. package/lib/file-picker/file-picker.d.ts +495 -78
  182. package/lib/header/header.d.ts +2 -2
  183. package/lib/menu/menu.d.ts +5 -4
  184. package/lib/menu-item/menu-item.d.ts +4 -4
  185. package/lib/nav/nav.d.ts +2 -2
  186. package/lib/nav-disclosure/nav-disclosure.d.ts +4 -4
  187. package/lib/nav-item/nav-item.d.ts +4 -4
  188. package/lib/note/note.d.ts +2 -2
  189. package/lib/number-field/number-field.d.ts +19 -18
  190. package/lib/option/option.d.ts +4 -4
  191. package/lib/pagination/pagination.d.ts +2 -2
  192. package/lib/progress/progress.d.ts +2 -2
  193. package/lib/progress-ring/progress-ring.d.ts +2 -2
  194. package/lib/radio/radio.d.ts +6 -6
  195. package/lib/radio-group/radio-group.d.ts +2 -2
  196. package/lib/range-slider/range-slider.d.ts +6 -6
  197. package/lib/rich-text-editor/menubar/menubar.d.ts +2 -2
  198. package/lib/rich-text-editor/rich-text-editor.d.ts +2 -2
  199. package/lib/searchable-select/option-tag.d.ts +2 -2
  200. package/lib/searchable-select/searchable-select.d.ts +521 -104
  201. package/lib/select/select.d.ts +484 -67
  202. package/lib/selectable-box/selectable-box.d.ts +2 -2
  203. package/lib/simple-color-picker/locale.d.ts +0 -1
  204. package/lib/simple-color-picker/simple-color-picker.d.ts +47 -821
  205. package/lib/slider/slider.d.ts +6 -6
  206. package/lib/split-button/split-button.d.ts +6 -6
  207. package/lib/switch/switch.d.ts +4 -4
  208. package/lib/tab/tab.d.ts +6 -6
  209. package/lib/tab-panel/tab-panel.d.ts +2 -2
  210. package/lib/tag/tag.d.ts +6 -6
  211. package/lib/tag-group/tag-group.d.ts +2 -2
  212. package/lib/tag-name-map.d.ts +2 -1
  213. package/lib/text-area/text-area.d.ts +17 -16
  214. package/lib/text-field/text-field.d.ts +19 -18
  215. package/lib/time-picker/time-picker.d.ts +579 -573
  216. package/lib/toggletip/toggletip.d.ts +4 -4
  217. package/lib/tooltip/tooltip.d.ts +2 -2
  218. package/lib/tree-item/tree-item.d.ts +4 -4
  219. package/lib/tree-view/tree-view.d.ts +2 -2
  220. package/lib/video-player/video-player.d.ts +2 -2
  221. package/locales/de-DE.cjs +15 -3
  222. package/locales/de-DE.js +15 -3
  223. package/locales/en-GB.cjs +15 -3
  224. package/locales/en-GB.js +15 -3
  225. package/locales/en-US.cjs +15 -3
  226. package/locales/en-US.js +15 -3
  227. package/locales/ja-JP.cjs +15 -3
  228. package/locales/ja-JP.js +15 -3
  229. package/locales/zh-CN.cjs +15 -3
  230. package/locales/zh-CN.js +15 -3
  231. package/menu/definition.cjs +8 -4
  232. package/menu/definition.js +9 -5
  233. package/note/index.cjs +2 -2
  234. package/note/index.js +4 -4
  235. package/number-field/definition.cjs +3 -3
  236. package/number-field/definition.js +4 -4
  237. package/number-field/index.cjs +8 -8
  238. package/number-field/index.js +41 -40
  239. package/option/index.cjs +1 -1
  240. package/option/index.js +1 -1
  241. package/package.json +5 -5
  242. package/pagination/definition.cjs +2 -1
  243. package/pagination/definition.js +2 -1
  244. package/pagination/index.cjs +12 -12
  245. package/pagination/index.js +59 -59
  246. package/progress/index.cjs +1 -1
  247. package/progress/index.js +1 -1
  248. package/radio/definition.cjs +9 -9
  249. package/radio/definition.js +10 -10
  250. package/radio-group/definition.cjs +2 -1
  251. package/radio-group/definition.js +2 -1
  252. package/radio-group/index.cjs +5 -5
  253. package/radio-group/index.js +80 -77
  254. package/range-slider/index.cjs +1 -1
  255. package/range-slider/index.js +1 -1
  256. package/rich-text-editor/definition.cjs +1 -1
  257. package/rich-text-editor/definition.js +2 -2
  258. package/rich-text-editor/index.cjs +2 -2
  259. package/rich-text-editor/index.js +3 -3
  260. package/searchable-select/definition.cjs +30 -21
  261. package/searchable-select/definition.js +31 -22
  262. package/searchable-select/index.cjs +28 -25
  263. package/searchable-select/index.js +149 -140
  264. package/select/definition.cjs +15 -7
  265. package/select/definition.js +16 -8
  266. package/selectable-box/definition.cjs +1 -1
  267. package/selectable-box/definition.js +1 -1
  268. package/selectable-box/index.cjs +3 -3
  269. package/selectable-box/index.js +20 -20
  270. package/shared/aria/aria-change-subscription.d.ts +0 -1
  271. package/shared/aria/aria-mixin.d.ts +2 -2
  272. package/shared/aria/delegate-aria-behavior.d.ts +5 -10
  273. package/shared/aria/delegates-aria.d.ts +3 -3
  274. package/shared/aria/host-semantics-behavior.d.ts +5 -8
  275. package/shared/aria/host-semantics.d.ts +3 -3
  276. package/shared/color-picker/base-color-picker.d.ts +436 -0
  277. package/shared/color-picker/index.d.ts +1 -0
  278. package/shared/color-picker/locale.d.ts +3 -0
  279. package/shared/color-picker/utils.d.ts +1 -0
  280. package/shared/deprecation/replaced-props.d.ts +317 -2
  281. package/shared/design-system/defineVividComponent.d.ts +2 -2
  282. package/shared/feedback/feedback-message.d.ts +2 -2
  283. package/shared/feedback/mixins.d.ts +4 -4
  284. package/shared/foundation/button/button.d.ts +4 -4
  285. package/shared/foundation/form-associated/form-associated.d.ts +4 -4
  286. package/shared/foundation/vivid-element/vivid-element.d.ts +335 -8
  287. package/shared/localization/Locale.d.ts +4 -0
  288. package/shared/patterns/affix.d.ts +4 -4
  289. package/shared/patterns/anchored.d.ts +4 -4
  290. package/shared/patterns/char-count/char-count.d.ts +2 -2
  291. package/shared/patterns/form-elements/form-element.d.ts +4 -4
  292. package/shared/patterns/form-elements/index.d.ts +1 -0
  293. package/shared/patterns/form-elements/with-contextual-help.d.ts +7 -6
  294. package/shared/patterns/form-elements/with-error-text.d.ts +6 -6
  295. package/shared/patterns/form-elements/with-success-text.d.ts +2 -2
  296. package/shared/patterns/linkable.d.ts +2 -2
  297. package/shared/patterns/localized.d.ts +2 -2
  298. package/shared/patterns/trapped-focus.d.ts +2 -2
  299. package/shared/picker-field/mixins/calendar-picker.d.ts +454 -451
  300. package/shared/picker-field/mixins/calendar-picker.template.d.ts +454 -451
  301. package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +2 -2
  302. package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +600 -594
  303. package/shared/picker-field/mixins/single-date-picker.d.ts +746 -737
  304. package/shared/picker-field/mixins/single-value-picker.d.ts +451 -448
  305. package/shared/picker-field/mixins/time-selection-picker.d.ts +580 -574
  306. package/shared/picker-field/mixins/time-selection-picker.template.d.ts +579 -573
  307. package/shared/picker-field/picker-field.d.ts +495 -78
  308. package/shared/templating/attribute-binding-behaviour.d.ts +3 -4
  309. package/shared/templating/render-in-light-dom.d.ts +13 -12
  310. package/side-drawer/index.cjs +1 -1
  311. package/side-drawer/index.js +1 -1
  312. package/simple-color-picker/definition.cjs +28 -215
  313. package/simple-color-picker/definition.js +29 -216
  314. package/simple-color-picker/index.cjs +9 -21
  315. package/simple-color-picker/index.js +71 -185
  316. package/styles/core/all.css +1 -1
  317. package/styles/core/theme.css +1 -1
  318. package/styles/core/typography.css +1 -1
  319. package/styles/tokens/theme-dark.css +4 -4
  320. package/styles/tokens/theme-light.css +4 -4
  321. package/styles/tokens/vivid-2-compat.css +1 -1
  322. package/switch/index.cjs +2 -2
  323. package/switch/index.js +4 -4
  324. package/tabs/definition.cjs +1 -1
  325. package/tabs/definition.js +2 -2
  326. package/tabs/index.cjs +2 -2
  327. package/tabs/index.js +16 -16
  328. package/tag/index.cjs +1 -1
  329. package/tag/index.js +1 -1
  330. package/text-area/definition.cjs +1 -1
  331. package/text-area/definition.js +1 -1
  332. package/text-area/index.cjs +3 -3
  333. package/text-area/index.js +9 -9
  334. package/text-field/definition.cjs +3 -3
  335. package/text-field/definition.js +4 -4
  336. package/text-field/index.cjs +1 -1
  337. package/text-field/index.js +1 -1
  338. package/time-picker/index.cjs +1 -1
  339. package/time-picker/index.js +2 -2
  340. package/toggletip/definition.cjs +1 -1
  341. package/toggletip/definition.js +2 -2
  342. package/tree-view/definition.cjs +1 -1
  343. package/tree-view/definition.js +2 -2
  344. package/tree-view/index.cjs +2 -2
  345. package/tree-view/index.js +6 -6
  346. package/unbundled/_commonjsHelpers.cjs +36 -0
  347. package/unbundled/_commonjsHelpers.js +32 -0
  348. package/unbundled/affix.cjs +1 -1
  349. package/unbundled/affix.js +1 -1
  350. package/unbundled/attribute-binding-behaviour.cjs +11 -10
  351. package/unbundled/attribute-binding-behaviour.js +11 -10
  352. package/unbundled/base-color-picker.cjs +278 -0
  353. package/unbundled/base-color-picker.js +275 -0
  354. package/unbundled/button.cjs +1 -1
  355. package/unbundled/button.js +2 -2
  356. package/unbundled/calendar-picker.template.cjs +3 -3
  357. package/unbundled/calendar-picker.template.js +4 -4
  358. package/unbundled/definition2.cjs +1 -1
  359. package/unbundled/definition2.js +2 -2
  360. package/unbundled/definition3.cjs +2 -1
  361. package/unbundled/definition3.js +2 -1
  362. package/unbundled/delegates-aria.cjs +67 -33
  363. package/unbundled/delegates-aria.js +69 -35
  364. package/unbundled/form-associated.cjs +2 -2
  365. package/unbundled/form-associated.js +3 -3
  366. package/unbundled/host-semantics.cjs +47 -22
  367. package/unbundled/host-semantics.js +48 -23
  368. package/unbundled/mixins.cjs +34 -27
  369. package/unbundled/mixins.js +35 -28
  370. package/unbundled/picker-field.template.cjs +13 -5
  371. package/unbundled/picker-field.template.js +14 -6
  372. package/unbundled/text-field.cjs +1 -1
  373. package/unbundled/text-field.js +1 -1
  374. package/unbundled/time-selection-picker.template.cjs +4 -4
  375. package/unbundled/time-selection-picker.template.js +5 -5
  376. package/unbundled/vivid-element.cjs +22 -15
  377. package/unbundled/vivid-element.js +23 -15
  378. package/unbundled/with-contextual-help.cjs +11 -0
  379. package/unbundled/with-contextual-help.js +11 -0
  380. package/video-player/definition.cjs +69007 -1
  381. package/video-player/definition.js +69007 -1
  382. package/video-player/index.cjs +35 -35
  383. package/video-player/index.js +1358 -1384
  384. package/visually-hidden/index.cjs +1 -1
  385. package/visually-hidden/index.js +1 -1
  386. package/vivid.api.json +347 -69
package/bundled/repeat.js CHANGED
@@ -1,341 +1,567 @@
1
- import { e as $, O as b, S as k, D as y, H as M, i as _ } from "./vivid-element.js";
2
- function p(i, e, t) {
3
- return {
4
- index: i,
5
- removed: e,
6
- addedCount: t
7
- };
1
+ import { O as y, l as $, U as H, e as O, M as E, m as S, p as q, q as D, t as x, H as P } from "./vivid-element.js";
2
+ import { n as B } from "./normalize.js";
3
+ class p {
4
+ /**
5
+ * Creates a splice.
6
+ * @param index - The index that the splice occurs at.
7
+ * @param removed - The items that were removed.
8
+ * @param addedCount - The number of items that were added.
9
+ */
10
+ constructor(e, t, s) {
11
+ this.index = e, this.removed = t, this.addedCount = s;
12
+ }
13
+ /**
14
+ * Adjusts the splice index based on the provided array.
15
+ * @param array - The array to adjust to.
16
+ * @returns The same splice, mutated based on the reference array.
17
+ */
18
+ adjustTo(e) {
19
+ let t = this.index;
20
+ const s = e.length;
21
+ return t > s ? t = s - this.addedCount : t < 0 && (t = s + this.removed.length + t - this.addedCount), this.index = t < 0 ? 0 : t, this;
22
+ }
8
23
  }
9
- const j = 0, P = 1, O = 2, V = 3;
10
- function E(i, e, t, o, s, d) {
11
- const c = d - s + 1, f = t - e + 1, n = new Array(c);
12
- let r, h;
13
- for (let l = 0; l < c; ++l)
14
- n[l] = new Array(f), n[l][0] = l;
15
- for (let l = 0; l < f; ++l)
16
- n[0][l] = l;
17
- for (let l = 1; l < c; ++l)
18
- for (let u = 1; u < f; ++u)
19
- i[e + u - 1] === o[s + l - 1] ? n[l][u] = n[l - 1][u - 1] : (r = n[l - 1][u] + 1, h = n[l][u - 1] + 1, n[l][u] = r < h ? r : h);
20
- return n;
24
+ class N {
25
+ /**
26
+ * Creates a sort update.
27
+ * @param sorted - The updated index of sorted items.
28
+ */
29
+ constructor(e) {
30
+ this.sorted = e;
31
+ }
21
32
  }
22
- function H(i) {
23
- let e = i.length - 1, t = i[0].length - 1, o = i[e][t];
24
- const s = [];
33
+ const Q = Object.freeze({
34
+ /**
35
+ * Only supports resets.
36
+ */
37
+ reset: 1,
38
+ /**
39
+ * Supports tracking splices and resets.
40
+ */
41
+ splice: 2,
42
+ /**
43
+ * Supports tracking splices and resets, while applying some form
44
+ * of optimization, such as merging, to the splices.
45
+ */
46
+ optimized: 3
47
+ }), z = new p(0, O, 0);
48
+ z.reset = !0;
49
+ const U = [z];
50
+ function W(i, e, t, s, o, n) {
51
+ const l = n - o + 1, h = t - e + 1, d = new Array(l);
52
+ let a, c;
53
+ for (let r = 0; r < l; ++r)
54
+ d[r] = new Array(h), d[r][0] = r;
55
+ for (let r = 0; r < h; ++r)
56
+ d[0][r] = r;
57
+ for (let r = 1; r < l; ++r)
58
+ for (let u = 1; u < h; ++u)
59
+ i[e + u - 1] === s[o + r - 1] ? d[r][u] = d[r - 1][u - 1] : (a = d[r - 1][u] + 1, c = d[r][u - 1] + 1, d[r][u] = a < c ? a : c);
60
+ return d;
61
+ }
62
+ function F(i) {
63
+ let e = i.length - 1, t = i[0].length - 1, s = i[e][t];
64
+ const o = [];
25
65
  for (; e > 0 || t > 0; ) {
26
66
  if (e === 0) {
27
- s.push(O), t--;
67
+ o.push(
68
+ 2
69
+ /* Edit.add */
70
+ ), t--;
28
71
  continue;
29
72
  }
30
73
  if (t === 0) {
31
- s.push(V), e--;
74
+ o.push(
75
+ 3
76
+ /* Edit.delete */
77
+ ), e--;
32
78
  continue;
33
79
  }
34
- const d = i[e - 1][t - 1], c = i[e - 1][t], f = i[e][t - 1];
35
- let n;
36
- c < f ? n = c < d ? c : d : n = f < d ? f : d, n === d ? (d === o ? s.push(j) : (s.push(P), o = d), e--, t--) : n === c ? (s.push(V), e--, o = c) : (s.push(O), t--, o = f);
80
+ const n = i[e - 1][t - 1], l = i[e - 1][t], h = i[e][t - 1];
81
+ let d;
82
+ l < h ? d = l < n ? l : n : d = h < n ? h : n, d === n ? (n === s ? o.push(
83
+ 0
84
+ /* Edit.leave */
85
+ ) : (o.push(
86
+ 1
87
+ /* Edit.update */
88
+ ), s = n), e--, t--) : d === l ? (o.push(
89
+ 3
90
+ /* Edit.delete */
91
+ ), e--, s = l) : (o.push(
92
+ 2
93
+ /* Edit.add */
94
+ ), t--, s = h);
37
95
  }
38
- return s.reverse(), s;
96
+ return o.reverse();
39
97
  }
40
- function U(i, e, t) {
41
- for (let o = 0; o < t; ++o)
42
- if (i[o] !== e[o])
43
- return o;
98
+ function X(i, e, t) {
99
+ for (let s = 0; s < t; ++s)
100
+ if (i[s] !== e[s])
101
+ return s;
44
102
  return t;
45
103
  }
46
- function W(i, e, t) {
47
- let o = i.length, s = e.length, d = 0;
48
- for (; d < t && i[--o] === e[--s]; )
49
- d++;
50
- return d;
104
+ function G(i, e, t) {
105
+ let s = i.length, o = e.length, n = 0;
106
+ for (; n < t && i[--s] === e[--o]; )
107
+ n++;
108
+ return n;
51
109
  }
52
- function q(i, e, t, o) {
53
- return e < t || o < i ? -1 : e === t || o === i ? 0 : i < t ? e < o ? e - t : o - t : o < e ? o - i : e - i;
110
+ function J(i, e, t, s) {
111
+ return e < t || s < i ? -1 : e === t || s === i ? 0 : i < t ? e < s ? e - t : s - t : s < e ? s - i : e - i;
54
112
  }
55
- function R(i, e, t, o, s, d) {
56
- let c = 0, f = 0;
57
- const n = Math.min(t - e, d - s);
58
- if (e === 0 && s === 0 && (c = U(i, o, n)), t === i.length && d === o.length && (f = W(i, o, n - c)), e += c, s += c, t -= f, d -= f, t - e === 0 && d - s === 0)
59
- return $;
113
+ function K(i, e, t, s, o, n) {
114
+ let l = 0, h = 0;
115
+ const d = Math.min(t - e, n - o);
116
+ if (e === 0 && o === 0 && (l = X(i, s, d)), t === i.length && n === s.length && (h = G(i, s, d - l)), e += l, o += l, t -= h, n -= h, t - e === 0 && n - o === 0)
117
+ return O;
60
118
  if (e === t) {
61
- const v = p(e, [], 0);
62
- for (; s < d; )
63
- v.removed.push(o[s++]);
119
+ const v = new p(e, [], 0);
120
+ for (; o < n; )
121
+ v.removed.push(s[o++]);
64
122
  return [v];
65
- } else if (s === d)
66
- return [p(e, [], t - e)];
67
- const r = H(E(i, e, t, o, s, d)), h = [];
68
- let l, u = e, a = s;
69
- for (let v = 0; v < r.length; ++v)
70
- switch (r[v]) {
71
- case j:
72
- l !== void 0 && (h.push(l), l = void 0), u++, a++;
123
+ } else if (o === n)
124
+ return [new p(e, [], t - e)];
125
+ const a = F(W(i, e, t, s, o, n)), c = [];
126
+ let r, u = e, f = o;
127
+ for (let v = 0; v < a.length; ++v)
128
+ switch (a[v]) {
129
+ case 0:
130
+ r !== void 0 && (c.push(r), r = void 0), u++, f++;
73
131
  break;
74
- case P:
75
- l === void 0 && (l = p(u, [], 0)), l.addedCount++, u++, l.removed.push(o[a]), a++;
132
+ case 1:
133
+ r === void 0 && (r = new p(u, [], 0)), r.addedCount++, u++, r.removed.push(s[f]), f++;
76
134
  break;
77
- case O:
78
- l === void 0 && (l = p(u, [], 0)), l.addedCount++, u++;
135
+ case 2:
136
+ r === void 0 && (r = new p(u, [], 0)), r.addedCount++, u++;
79
137
  break;
80
- case V:
81
- l === void 0 && (l = p(u, [], 0)), l.removed.push(o[a]), a++;
138
+ case 3:
139
+ r === void 0 && (r = new p(u, [], 0)), r.removed.push(s[f]), f++;
82
140
  break;
83
141
  }
84
- return l !== void 0 && h.push(l), h;
142
+ return r !== void 0 && c.push(r), c;
85
143
  }
86
- const A = Array.prototype.push;
87
- function F(i, e, t, o) {
88
- const s = p(e, t, o);
89
- let d = !1, c = 0;
90
- for (let f = 0; f < i.length; f++) {
91
- const n = i[f];
92
- if (n.index += c, d)
144
+ function Y(i, e) {
145
+ let t = !1, s = 0;
146
+ for (let o = 0; o < e.length; o++) {
147
+ const n = e[o];
148
+ if (n.index += s, t)
93
149
  continue;
94
- const r = q(s.index, s.index + s.removed.length, n.index, n.index + n.addedCount);
95
- if (r >= 0) {
96
- i.splice(f, 1), f--, c -= n.addedCount - n.removed.length, s.addedCount += n.addedCount - r;
97
- const h = s.removed.length + n.removed.length - r;
98
- if (!s.addedCount && !h)
99
- d = !0;
150
+ const l = J(i.index, i.index + i.removed.length, n.index, n.index + n.addedCount);
151
+ if (l >= 0) {
152
+ e.splice(o, 1), o--, s -= n.addedCount - n.removed.length, i.addedCount += n.addedCount - l;
153
+ const h = i.removed.length + n.removed.length - l;
154
+ if (!i.addedCount && !h)
155
+ t = !0;
100
156
  else {
101
- let l = n.removed;
102
- if (s.index < n.index) {
103
- const u = s.removed.slice(0, n.index - s.index);
104
- A.apply(u, l), l = u;
157
+ let d = n.removed;
158
+ if (i.index < n.index) {
159
+ const a = i.removed.slice(0, n.index - i.index);
160
+ a.push(...d), d = a;
105
161
  }
106
- if (s.index + s.removed.length > n.index + n.addedCount) {
107
- const u = s.removed.slice(n.index + n.addedCount - s.index);
108
- A.apply(l, u);
162
+ if (i.index + i.removed.length > n.index + n.addedCount) {
163
+ const a = i.removed.slice(n.index + n.addedCount - i.index);
164
+ d.push(...a);
109
165
  }
110
- s.removed = l, n.index < s.index && (s.index = n.index);
166
+ i.removed = d, n.index < i.index && (i.index = n.index);
111
167
  }
112
- } else if (s.index < n.index) {
113
- d = !0, i.splice(f, 0, s), f++;
114
- const h = s.addedCount - s.removed.length;
115
- n.index += h, c += h;
168
+ } else if (i.index < n.index) {
169
+ t = !0, e.splice(o, 0, i), o++;
170
+ const h = i.addedCount - i.removed.length;
171
+ n.index += h, s += h;
116
172
  }
117
173
  }
118
- d || i.push(s);
174
+ t || e.push(i);
119
175
  }
120
- function N(i) {
121
- const e = [];
122
- for (let t = 0, o = i.length; t < o; t++) {
123
- const s = i[t];
124
- F(e, s.index, s.removed, s.addedCount);
125
- }
126
- return e;
127
- }
128
- function z(i, e) {
176
+ function Z(i, e) {
129
177
  let t = [];
130
- const o = N(e);
131
- for (let s = 0, d = o.length; s < d; ++s) {
132
- const c = o[s];
133
- if (c.addedCount === 1 && c.removed.length === 1) {
134
- c.removed[0] !== i[c.index] && t.push(c);
178
+ const s = [];
179
+ for (let o = 0, n = e.length; o < n; o++)
180
+ Y(e[o], s);
181
+ for (let o = 0, n = s.length; o < n; ++o) {
182
+ const l = s[o];
183
+ if (l.addedCount === 1 && l.removed.length === 1) {
184
+ l.removed[0] !== i[l.index] && t.push(l);
135
185
  continue;
136
186
  }
137
- t = t.concat(R(i, c.index, c.index + c.addedCount, c.removed, 0, c.removed.length));
187
+ t = t.concat(K(i, l.index, l.index + l.addedCount, l.removed, 0, l.removed.length));
138
188
  }
139
189
  return t;
140
190
  }
141
- let I = !1;
142
- function w(i, e) {
143
- let t = i.index;
144
- const o = e.length;
145
- return t > o ? t = o - i.addedCount : t < 0 && (t = o + i.removed.length + t - i.addedCount), t < 0 && (t = 0), i.index = t, i;
191
+ let I = Object.freeze({
192
+ support: Q.optimized,
193
+ normalize(i, e, t) {
194
+ return i === void 0 ? t === void 0 ? O : Z(e, t) : U;
195
+ },
196
+ pop(i, e, t, s) {
197
+ const o = i.length > 0, n = t.apply(i, s);
198
+ return o && e.addSplice(new p(i.length, [n], 0)), n;
199
+ },
200
+ push(i, e, t, s) {
201
+ const o = t.apply(i, s);
202
+ return e.addSplice(new p(i.length - s.length, [], s.length).adjustTo(i)), o;
203
+ },
204
+ reverse(i, e, t, s) {
205
+ const o = t.apply(i, s);
206
+ i.sorted++;
207
+ const n = [];
208
+ for (let l = i.length - 1; l >= 0; l--)
209
+ n.push(l);
210
+ return e.addSort(new N(n)), o;
211
+ },
212
+ shift(i, e, t, s) {
213
+ const o = i.length > 0, n = t.apply(i, s);
214
+ return o && e.addSplice(new p(0, [n], 0)), n;
215
+ },
216
+ sort(i, e, t, s) {
217
+ const o = /* @__PURE__ */ new Map();
218
+ for (let h = 0, d = i.length; h < d; ++h) {
219
+ const a = o.get(i[h]) || [];
220
+ o.set(i[h], [...a, h]);
221
+ }
222
+ const n = t.apply(i, s);
223
+ i.sorted++;
224
+ const l = [];
225
+ for (let h = 0, d = i.length; h < d; ++h) {
226
+ const a = o.get(i[h]);
227
+ l.push(a[0]), o.set(i[h], a.splice(1));
228
+ }
229
+ return e.addSort(new N(l)), n;
230
+ },
231
+ splice(i, e, t, s) {
232
+ const o = t.apply(i, s);
233
+ return e.addSplice(new p(+s[0], o, s.length > 2 ? s.length - 2 : 0).adjustTo(i)), o;
234
+ },
235
+ unshift(i, e, t, s) {
236
+ const o = t.apply(i, s);
237
+ return e.addSplice(new p(0, [], s.length).adjustTo(i)), o;
238
+ }
239
+ });
240
+ function C(i, e, t, s = !0) {
241
+ Reflect.defineProperty(i, e, {
242
+ value: t,
243
+ enumerable: !1,
244
+ writable: s
245
+ });
146
246
  }
147
- class G extends k {
247
+ class ee extends $ {
148
248
  constructor(e) {
149
- super(e), this.oldCollection = void 0, this.splices = void 0, this.needsQueue = !0, this.call = this.flush, Reflect.defineProperty(e, "$fastController", {
150
- value: this,
151
- enumerable: !1
152
- });
249
+ super(e), this.oldCollection = void 0, this.splices = void 0, this.sorts = void 0, this.needsQueue = !0, this._strategy = null, this._lengthObserver = void 0, this._sortObserver = void 0, this.call = this.flush, C(e, "$fastController", this);
250
+ }
251
+ get strategy() {
252
+ return this._strategy;
253
+ }
254
+ set strategy(e) {
255
+ this._strategy = e;
256
+ }
257
+ get lengthObserver() {
258
+ let e = this._lengthObserver;
259
+ if (e === void 0) {
260
+ const t = this.subject;
261
+ this._lengthObserver = e = {
262
+ length: t.length,
263
+ handleChange() {
264
+ this.length !== t.length && (this.length = t.length, y.notify(e, "length"));
265
+ }
266
+ }, this.subscribe(e);
267
+ }
268
+ return e;
269
+ }
270
+ get sortObserver() {
271
+ let e = this._sortObserver;
272
+ if (e === void 0) {
273
+ const t = this.subject;
274
+ this._sortObserver = e = {
275
+ sorted: t.sorted,
276
+ handleChange() {
277
+ this.sorted !== t.sorted && (this.sorted = t.sorted, y.notify(e, "sorted"));
278
+ }
279
+ }, this.subscribe(e);
280
+ }
281
+ return e;
153
282
  }
154
283
  subscribe(e) {
155
284
  this.flush(), super.subscribe(e);
156
285
  }
157
286
  addSplice(e) {
158
- this.splices === void 0 ? this.splices = [e] : this.splices.push(e), this.needsQueue && (this.needsQueue = !1, y.queueUpdate(this));
287
+ this.splices === void 0 ? this.splices = [e] : this.splices.push(e), this.enqueue();
288
+ }
289
+ addSort(e) {
290
+ this.sorts === void 0 ? this.sorts = [e] : this.sorts.push(e), this.enqueue();
159
291
  }
160
292
  reset(e) {
161
- this.oldCollection = e, this.needsQueue && (this.needsQueue = !1, y.queueUpdate(this));
293
+ this.oldCollection = e, this.enqueue();
162
294
  }
163
295
  flush() {
164
- const e = this.splices, t = this.oldCollection;
165
- if (e === void 0 && t === void 0)
166
- return;
167
- this.needsQueue = !0, this.splices = void 0, this.oldCollection = void 0;
168
- const o = t === void 0 ? z(this.source, e) : R(this.source, 0, this.source.length, t, 0, t.length);
169
- this.notify(o);
296
+ var e;
297
+ const t = this.splices, s = this.sorts, o = this.oldCollection;
298
+ t === void 0 && o === void 0 && s === void 0 || (this.needsQueue = !0, this.splices = void 0, this.sorts = void 0, this.oldCollection = void 0, s !== void 0 ? this.notify(s) : this.notify(((e = this._strategy) !== null && e !== void 0 ? e : I).normalize(o, this.subject, t)));
299
+ }
300
+ enqueue() {
301
+ this.needsQueue && (this.needsQueue = !1, H.enqueue(this));
170
302
  }
171
303
  }
172
- function J() {
173
- if (I)
174
- return;
175
- I = !0, b.setArrayObserverFactory((n) => new G(n));
176
- const i = Array.prototype;
177
- if (i.$fastPatch)
178
- return;
179
- Reflect.defineProperty(i, "$fastPatch", {
180
- value: 1,
181
- enumerable: !1
182
- });
183
- const e = i.pop, t = i.push, o = i.reverse, s = i.shift, d = i.sort, c = i.splice, f = i.unshift;
184
- i.pop = function() {
185
- const n = this.length > 0, r = e.apply(this, arguments), h = this.$fastController;
186
- return h !== void 0 && n && h.addSplice(p(this.length, [r], 0)), r;
187
- }, i.push = function() {
188
- const n = t.apply(this, arguments), r = this.$fastController;
189
- return r !== void 0 && r.addSplice(w(p(this.length - arguments.length, [], arguments.length), this)), n;
190
- }, i.reverse = function() {
191
- let n;
192
- const r = this.$fastController;
193
- r !== void 0 && (r.flush(), n = this.slice());
194
- const h = o.apply(this, arguments);
195
- return r !== void 0 && r.reset(n), h;
196
- }, i.shift = function() {
197
- const n = this.length > 0, r = s.apply(this, arguments), h = this.$fastController;
198
- return h !== void 0 && n && h.addSplice(p(0, [r], 0)), r;
199
- }, i.sort = function() {
200
- let n;
201
- const r = this.$fastController;
202
- r !== void 0 && (r.flush(), n = this.slice());
203
- const h = d.apply(this, arguments);
204
- return r !== void 0 && r.reset(n), h;
205
- }, i.splice = function() {
206
- const n = c.apply(this, arguments), r = this.$fastController;
207
- return r !== void 0 && r.addSplice(w(p(+arguments[0], n, arguments.length > 2 ? arguments.length - 2 : 0), this)), n;
208
- }, i.unshift = function() {
209
- const n = f.apply(this, arguments), r = this.$fastController;
210
- return r !== void 0 && r.addSplice(w(p(0, [], arguments.length), this)), n;
211
- };
212
- }
213
- const D = Object.freeze({
304
+ let j = !1;
305
+ const te = Object.freeze({
306
+ sorted: 0,
307
+ /**
308
+ * Enables the array observation mechanism.
309
+ * @remarks
310
+ * Array observation is enabled automatically when using the
311
+ * {@link RepeatDirective}, so calling this API manually is
312
+ * not typically necessary.
313
+ */
314
+ enable() {
315
+ if (j)
316
+ return;
317
+ j = !0, y.setArrayObserverFactory((e) => new ee(e));
318
+ const i = Array.prototype;
319
+ i.$fastPatch || (C(i, "$fastPatch", 1), C(i, "sorted", 0), [
320
+ i.pop,
321
+ i.push,
322
+ i.reverse,
323
+ i.shift,
324
+ i.sort,
325
+ i.splice,
326
+ i.unshift
327
+ ].forEach((e) => {
328
+ i[e.name] = function(...t) {
329
+ var s;
330
+ const o = this.$fastController;
331
+ return o === void 0 ? e.apply(this, t) : ((s = o.strategy) !== null && s !== void 0 ? s : I)[e.name](this, o, e, t);
332
+ };
333
+ }));
334
+ }
335
+ }), M = Object.freeze({
214
336
  positioning: !1,
215
337
  recycle: !0
216
338
  });
217
- function K(i, e, t, o) {
218
- i.bind(e[t], o);
339
+ function ie(i, e, t, s) {
340
+ i.context.parent = s.source, i.context.parentContext = s.context, i.bind(e[t]);
219
341
  }
220
- function X(i, e, t, o) {
221
- const s = Object.create(o);
222
- s.index = t, s.length = e.length, i.bind(e[t], s);
342
+ function se(i, e, t, s) {
343
+ i.context.parent = s.source, i.context.parentContext = s.context, i.context.length = e.length, i.context.index = t, i.bind(e[t]);
223
344
  }
224
- class Y {
345
+ function R(i) {
346
+ return i.nodeType === Node.COMMENT_NODE;
347
+ }
348
+ class A extends Error {
349
+ constructor(e, t) {
350
+ super(e), this.propertyBag = t;
351
+ }
352
+ }
353
+ class ne {
225
354
  /**
226
355
  * Creates an instance of RepeatBehavior.
227
356
  * @param location - The location in the DOM to render the repeat.
228
- * @param itemsBinding - The array to render.
357
+ * @param dataBinding - The array to render.
229
358
  * @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
230
359
  * @param templateBinding - The template to render for each item.
231
360
  * @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
232
361
  * @param options - Options used to turn on special repeat features.
233
362
  */
234
- constructor(e, t, o, s, d, c) {
235
- this.location = e, this.itemsBinding = t, this.templateBinding = s, this.options = c, this.source = null, this.views = [], this.items = null, this.itemsObserver = null, this.originalContext = void 0, this.childContext = void 0, this.bindView = K, this.itemsBindingObserver = b.binding(t, this, o), this.templateBindingObserver = b.binding(s, this, d), c.positioning && (this.bindView = X);
363
+ constructor(e) {
364
+ this.directive = e, this.items = null, this.itemsObserver = null, this.bindView = ie, this.views = [], this.itemsBindingObserver = e.dataBinding.createObserver(this, e), this.templateBindingObserver = e.templateBinding.createObserver(this, e), e.options.positioning && (this.bindView = se);
236
365
  }
237
366
  /**
238
- * Bind this behavior to the source.
239
- * @param source - The source to bind to.
240
- * @param context - The execution context that the binding is operating within.
367
+ * Bind this behavior.
368
+ * @param controller - The view controller that manages the lifecycle of this behavior.
241
369
  */
242
- bind(e, t) {
243
- this.source = e, this.originalContext = t, this.childContext = Object.create(t), this.childContext.parent = e, this.childContext.parentContext = this.originalContext, this.items = this.itemsBindingObserver.observe(e, this.originalContext), this.template = this.templateBindingObserver.observe(e, this.originalContext), this.observeItems(!0), this.refreshAllViews();
370
+ bind(e) {
371
+ this.location = e.targets[this.directive.targetNodeId], this.controller = e, this.items = this.itemsBindingObserver.bind(e), this.template = this.templateBindingObserver.bind(e), this.observeItems(!0), S(this.template) && S(e) && e.hydrationStage !== q.hydrated ? this.hydrateViews(this.template) : this.refreshAllViews(), e.onUnbind(this);
244
372
  }
245
373
  /**
246
- * Unbinds this behavior from the source.
247
- * @param source - The source to unbind from.
374
+ * Unbinds this behavior.
248
375
  */
249
376
  unbind() {
250
- this.source = null, this.items = null, this.itemsObserver !== null && this.itemsObserver.unsubscribe(this), this.unbindAllViews(), this.itemsBindingObserver.disconnect(), this.templateBindingObserver.disconnect();
377
+ this.itemsObserver !== null && this.itemsObserver.unsubscribe(this), this.unbindAllViews();
251
378
  }
252
- /** @internal */
379
+ /**
380
+ * Handles changes in the array, its items, and the repeat template.
381
+ * @param source - The source of the change.
382
+ * @param args - The details about what was changed.
383
+ */
253
384
  handleChange(e, t) {
254
- e === this.itemsBinding ? (this.items = this.itemsBindingObserver.observe(this.source, this.originalContext), this.observeItems(), this.refreshAllViews()) : e === this.templateBinding ? (this.template = this.templateBindingObserver.observe(this.source, this.originalContext), this.refreshAllViews(!0)) : this.updateViews(t);
385
+ if (t === this.itemsBindingObserver)
386
+ this.items = this.itemsBindingObserver.bind(this.controller), this.observeItems(), this.refreshAllViews();
387
+ else if (t === this.templateBindingObserver)
388
+ this.template = this.templateBindingObserver.bind(this.controller), this.refreshAllViews(!0);
389
+ else if (t[0])
390
+ t[0].reset ? this.refreshAllViews() : t[0].sorted ? this.updateSortedViews(t) : this.updateSplicedViews(t);
391
+ else return;
255
392
  }
256
393
  observeItems(e = !1) {
257
394
  if (!this.items) {
258
- this.items = $;
395
+ this.items = O;
259
396
  return;
260
397
  }
261
- const t = this.itemsObserver, o = this.itemsObserver = b.getNotifier(this.items), s = t !== o;
262
- s && t !== null && t.unsubscribe(this), (s || e) && o.subscribe(this);
263
- }
264
- updateViews(e) {
265
- const t = this.childContext, o = this.views, s = this.bindView, d = this.items, c = this.template, f = this.options.recycle, n = [];
266
- let r = 0, h = 0;
267
- for (let l = 0, u = e.length; l < u; ++l) {
268
- const a = e[l], v = a.removed;
269
- let x = 0, m = a.index;
270
- const T = m + a.addedCount, C = o.splice(a.index, v.length), L = h = n.length + C.length;
271
- for (; m < T; ++m) {
272
- const B = o[m], Q = B ? B.firstChild : this.location;
273
- let g;
274
- f && h > 0 ? (x <= L && C.length > 0 ? (g = C[x], x++) : (g = n[r], r++), h--) : g = c.create(), o.splice(m, 0, g), s(g, d, m, t), g.insertBefore(Q);
398
+ const t = this.itemsObserver, s = this.itemsObserver = y.getNotifier(this.items), o = t !== s;
399
+ o && t !== null && t.unsubscribe(this), (o || e) && s.subscribe(this);
400
+ }
401
+ updateSortedViews(e) {
402
+ const t = this.views;
403
+ for (let s = 0, o = e.length; s < o; ++s) {
404
+ const n = e[s].sorted.slice(), l = n.slice().sort();
405
+ for (let h = 0, d = n.length; h < d; ++h) {
406
+ const a = n.find((c) => n[h] === l[c]);
407
+ if (a !== h) {
408
+ const c = l.splice(a, 1);
409
+ l.splice(h, 0, ...c);
410
+ const r = t[h], u = r ? r.firstChild : this.location;
411
+ t[a].remove(), t[a].insertBefore(u);
412
+ const f = t.splice(a, 1);
413
+ t.splice(h, 0, ...f);
414
+ }
415
+ }
416
+ }
417
+ }
418
+ updateSplicedViews(e) {
419
+ const t = this.views, s = this.bindView, o = this.items, n = this.template, l = this.controller, h = this.directive.options.recycle, d = [];
420
+ let a = 0, c = 0;
421
+ for (let r = 0, u = e.length; r < u; ++r) {
422
+ const f = e[r], v = f.removed;
423
+ let b = 0, g = f.index;
424
+ const T = g + f.addedCount, w = t.splice(f.index, v.length), _ = c = d.length + w.length;
425
+ for (; g < T; ++g) {
426
+ const V = t[g], L = V ? V.firstChild : this.location;
427
+ let m;
428
+ h && c > 0 ? (b <= _ && w.length > 0 ? (m = w[b], b++) : (m = d[a], a++), c--) : m = n.create(), t.splice(g, 0, m), s(m, o, g, l), m.insertBefore(L);
275
429
  }
276
- C[x] && n.push(...C.slice(x));
430
+ w[b] && d.push(...w.slice(b));
277
431
  }
278
- for (let l = r, u = n.length; l < u; ++l)
279
- n[l].dispose();
280
- if (this.options.positioning)
281
- for (let l = 0, u = o.length; l < u; ++l) {
282
- const a = o[l].context;
283
- a.length = u, a.index = l;
432
+ for (let r = a, u = d.length; r < u; ++r)
433
+ d[r].dispose();
434
+ if (this.directive.options.positioning)
435
+ for (let r = 0, u = t.length; r < u; ++r) {
436
+ const f = t[r].context;
437
+ f.length = u, f.index = r;
284
438
  }
285
439
  }
286
440
  refreshAllViews(e = !1) {
287
- const t = this.items, o = this.childContext, s = this.template, d = this.location, c = this.bindView;
288
- let f = t.length, n = this.views, r = n.length;
289
- if ((f === 0 || e || !this.options.recycle) && (_.disposeContiguousBatch(n), r = 0), r === 0) {
290
- this.views = n = new Array(f);
291
- for (let h = 0; h < f; ++h) {
292
- const l = s.create();
293
- c(l, t, h, o), n[h] = l, l.insertBefore(d);
441
+ const t = this.items, s = this.template, o = this.location, n = this.bindView, l = this.controller;
442
+ let h = t.length, d = this.views, a = d.length;
443
+ if ((h === 0 || e || !this.directive.options.recycle) && (D.disposeContiguousBatch(d), a = 0), a === 0) {
444
+ this.views = d = new Array(h);
445
+ for (let c = 0; c < h; ++c) {
446
+ const r = s.create();
447
+ n(r, t, c, l), d[c] = r, r.insertBefore(o);
294
448
  }
295
449
  } else {
296
- let h = 0;
297
- for (; h < f; ++h)
298
- if (h < r) {
299
- const u = n[h];
300
- c(u, t, h, o);
450
+ let c = 0;
451
+ for (; c < h; ++c)
452
+ if (c < a) {
453
+ const u = d[c];
454
+ if (!u) {
455
+ const f = new XMLSerializer();
456
+ throw new A(`View is null or undefined inside "${this.location.getRootNode().host.nodeName}".`, {
457
+ index: c,
458
+ hydrationStage: this.controller.hydrationStage,
459
+ itemsLength: h,
460
+ viewsState: d.map((v) => v ? "hydrated" : "empty"),
461
+ viewTemplateString: f.serializeToString(s.create().fragment),
462
+ rootNodeContent: f.serializeToString(this.location.getRootNode())
463
+ });
464
+ }
465
+ n(u, t, c, l);
301
466
  } else {
302
467
  const u = s.create();
303
- c(u, t, h, o), n.push(u), u.insertBefore(d);
468
+ n(u, t, c, l), d.push(u), u.insertBefore(o);
304
469
  }
305
- const l = n.splice(h, r - h);
306
- for (h = 0, f = l.length; h < f; ++h)
307
- l[h].dispose();
470
+ const r = d.splice(c, a - c);
471
+ for (c = 0, h = r.length; c < h; ++c)
472
+ r[c].dispose();
308
473
  }
309
474
  }
310
475
  unbindAllViews() {
311
476
  const e = this.views;
312
- for (let t = 0, o = e.length; t < o; ++t)
313
- e[t].unbind();
477
+ for (let t = 0, s = e.length; t < s; ++t) {
478
+ const o = e[t];
479
+ if (!o) {
480
+ const n = new XMLSerializer();
481
+ throw new A(`View is null or undefined inside "${this.location.getRootNode().host.nodeName}".`, {
482
+ index: t,
483
+ hydrationStage: this.controller.hydrationStage,
484
+ viewsState: e.map((l) => l ? "hydrated" : "empty"),
485
+ rootNodeContent: n.serializeToString(this.location.getRootNode())
486
+ });
487
+ }
488
+ o.unbind();
489
+ }
490
+ }
491
+ hydrateViews(e) {
492
+ if (!this.items)
493
+ return;
494
+ this.views = new Array(this.items.length);
495
+ let t = this.location.previousSibling;
496
+ for (; t !== null; ) {
497
+ if (!R(t)) {
498
+ t = t.previousSibling;
499
+ continue;
500
+ }
501
+ const s = x.parseRepeatEndMarker(t.data);
502
+ if (s === null) {
503
+ t = t.previousSibling;
504
+ continue;
505
+ }
506
+ t.data = "";
507
+ const o = t.previousSibling;
508
+ if (!o)
509
+ throw new Error(`Error when hydrating inside "${this.location.getRootNode().host.nodeName}": end should never be null.`);
510
+ let n = o, l = 0;
511
+ for (; n !== null; ) {
512
+ if (R(n)) {
513
+ if (x.isRepeatViewEndMarker(n.data))
514
+ l++;
515
+ else if (x.isRepeatViewStartMarker(n.data))
516
+ if (l)
517
+ l--;
518
+ else {
519
+ if (x.parseRepeatStartMarker(n.data) !== s)
520
+ throw new Error(`Error when hydrating inside "${this.location.getRootNode().host.nodeName}": Mismatched start and end markers.`);
521
+ n.data = "", t = n.previousSibling, n = n.nextSibling;
522
+ const h = e.hydrate(n, o);
523
+ this.views[s] = h, this.bindView(h, this.items, s, this.controller);
524
+ break;
525
+ }
526
+ }
527
+ n = n.previousSibling;
528
+ }
529
+ if (!n)
530
+ throw new Error(`Error when hydrating inside "${this.location.getRootNode().host.nodeName}": start should never be null.`);
531
+ }
314
532
  }
315
533
  }
316
- class Z extends M {
534
+ class k {
317
535
  /**
318
536
  * Creates an instance of RepeatDirective.
319
- * @param itemsBinding - The binding that provides the array to render.
537
+ * @param dataBinding - The binding that provides the array to render.
320
538
  * @param templateBinding - The template binding used to obtain a template to render for each item in the array.
321
539
  * @param options - Options used to turn on special repeat features.
322
540
  */
323
- constructor(e, t, o) {
324
- super(), this.itemsBinding = e, this.templateBinding = t, this.options = o, this.createPlaceholder = y.createBlockPlaceholder, J(), this.isItemsBindingVolatile = b.isVolatileBinding(e), this.isTemplateBindingVolatile = b.isVolatileBinding(t);
541
+ constructor(e, t, s) {
542
+ this.dataBinding = e, this.templateBinding = t, this.options = s, te.enable();
543
+ }
544
+ /**
545
+ * Creates a placeholder string based on the directive's index within the template.
546
+ * @param index - The index of the directive within the template.
547
+ */
548
+ createHTML(e) {
549
+ return E.comment(e(this));
325
550
  }
326
551
  /**
327
552
  * Creates a behavior for the provided target node.
328
553
  * @param target - The node instance to create the behavior for.
329
554
  */
330
- createBehavior(e) {
331
- return new Y(e, this.itemsBinding, this.isItemsBindingVolatile, this.templateBinding, this.isTemplateBindingVolatile, this.options);
555
+ createBehavior() {
556
+ return new ne(this);
332
557
  }
333
558
  }
334
- function ee(i, e, t = D) {
335
- const o = typeof e == "function" ? e : () => e;
336
- return new Z(i, o, Object.assign(Object.assign({}, D), t));
559
+ P.define(k);
560
+ function le(i, e, t = M) {
561
+ const s = B(i), o = B(e);
562
+ return new k(s, o, Object.assign(Object.assign({}, M), t));
337
563
  }
338
564
  export {
339
- Z as R,
340
- ee as r
565
+ k as R,
566
+ le as r
341
567
  };