genesys-spark-components 4.203.0 → 4.204.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 (482) hide show
  1. package/dist/cjs/{get-valid-timezone-B5cZ0d-f.js → get-valid-timezone-Dr_-VXi7.js} +1 -1
  2. package/dist/cjs/gux-accordion.cjs.entry.js +1 -1
  3. package/dist/cjs/gux-action-button.cjs.entry.js +2 -2
  4. package/dist/cjs/gux-action-toast-legacy.cjs.entry.js +1 -1
  5. package/dist/cjs/gux-actionable-inline-alert-beta.cjs.entry.js +1 -1
  6. package/dist/cjs/gux-advanced-dropdown-legacy.cjs.entry.js +2 -2
  7. package/dist/cjs/gux-ai-powered-badge-beta.cjs.entry.js +2 -2
  8. package/dist/cjs/gux-all-row-select.cjs.entry.js +1 -1
  9. package/dist/cjs/gux-announce-beta.cjs.entry.js +1 -1
  10. package/dist/cjs/gux-avatar-beta.cjs.entry.js +2 -2
  11. package/dist/cjs/gux-avatar-change-photo-beta.cjs.entry.js +2 -2
  12. package/dist/cjs/gux-avatar-group-add-item-beta_3.cjs.entry.js +2 -2
  13. package/dist/cjs/gux-avatar-group-beta.cjs.entry.js +1 -1
  14. package/dist/cjs/gux-avatar-group-item-beta.cjs.entry.js +1 -1
  15. package/dist/cjs/gux-badge.cjs.entry.js +2 -2
  16. package/dist/cjs/gux-blank-state-beta.cjs.entry.js +1 -1
  17. package/dist/cjs/gux-blank-state.cjs.entry.js +1 -1
  18. package/dist/cjs/gux-breadcrumbs.cjs.entry.js +2 -2
  19. package/dist/cjs/gux-button-multi.cjs.entry.js +1 -1
  20. package/dist/cjs/gux-button-slot.cjs.entry.js +1 -1
  21. package/dist/cjs/gux-button_2.cjs.entry.js +1 -1
  22. package/dist/cjs/gux-calendar-beta.cjs.entry.js +1 -1
  23. package/dist/cjs/gux-calendar.cjs.entry.js +3 -3
  24. package/dist/cjs/gux-card.cjs.entry.js +1 -1
  25. package/dist/cjs/gux-cloud-logo-beta.cjs.entry.js +2 -2
  26. package/dist/cjs/gux-cloud-logomark-beta.cjs.entry.js +2 -2
  27. package/dist/cjs/gux-column-manager-item.cjs.entry.js +1 -1
  28. package/dist/cjs/gux-column-manager.cjs.entry.js +2 -2
  29. package/dist/cjs/gux-content-search.cjs.entry.js +2 -2
  30. package/dist/cjs/gux-context-menu.cjs.entry.js +2 -2
  31. package/dist/cjs/gux-copy-to-clipboard.cjs.entry.js +2 -2
  32. package/dist/cjs/gux-create-option.cjs.entry.js +1 -1
  33. package/dist/cjs/gux-date-beta.cjs.entry.js +3 -3
  34. package/dist/cjs/gux-date-time-beta.cjs.entry.js +3 -3
  35. package/dist/cjs/gux-datepicker.cjs.entry.js +15 -12
  36. package/dist/cjs/gux-day-beta.cjs.entry.js +1 -1
  37. package/dist/cjs/gux-disclosure-button-legacy.cjs.entry.js +2 -2
  38. package/dist/cjs/gux-dismiss-button.cjs.entry.js +2 -2
  39. package/dist/cjs/gux-dropdown-multi-tag.cjs.entry.js +1 -1
  40. package/dist/cjs/gux-dropdown-multi.cjs.entry.js +2 -2
  41. package/dist/cjs/gux-dropdown_3.cjs.entry.js +2 -2
  42. package/dist/cjs/gux-file-list-item.cjs.entry.js +2 -2
  43. package/dist/cjs/gux-flag-icon-beta.cjs.entry.js +2 -2
  44. package/dist/cjs/gux-flyout-menu.cjs.entry.js +2 -2
  45. package/dist/cjs/gux-form-field-checkbox-group-beta.cjs.entry.js +2 -2
  46. package/dist/cjs/gux-form-field-checkbox.cjs.entry.js +1 -1
  47. package/dist/cjs/gux-form-field-color.cjs.entry.js +1 -1
  48. package/dist/cjs/gux-form-field-dropdown.cjs.entry.js +2 -2
  49. package/dist/cjs/gux-form-field-file-beta.cjs.entry.js +2 -2
  50. package/dist/cjs/gux-form-field-file.cjs.entry.js +1 -1
  51. package/dist/cjs/gux-form-field-input-clear-button.cjs.entry.js +2 -2
  52. package/dist/cjs/gux-form-field-label-indicator.cjs.entry.js +2 -2
  53. package/dist/cjs/gux-form-field-number_2.cjs.entry.js +2 -2
  54. package/dist/cjs/gux-form-field-phone.cjs.entry.js +2 -2
  55. package/dist/cjs/gux-form-field-radio-group-beta.cjs.entry.js +2 -2
  56. package/dist/cjs/gux-form-field-radio.cjs.entry.js +1 -1
  57. package/dist/cjs/gux-form-field-range.cjs.entry.js +1 -1
  58. package/dist/cjs/gux-form-field-search.cjs.entry.js +1 -1
  59. package/dist/cjs/gux-form-field-select.cjs.entry.js +1 -1
  60. package/dist/cjs/gux-form-field-text-like.cjs.entry.js +2 -2
  61. package/dist/cjs/gux-form-field-textarea.cjs.entry.js +1 -1
  62. package/dist/cjs/gux-form-field-time-picker.cjs.entry.js +2 -2
  63. package/dist/cjs/gux-form-field-time-zone-picker.cjs.entry.js +2 -2
  64. package/dist/cjs/gux-form-footer.cjs.entry.js +1 -1
  65. package/dist/cjs/gux-icon-tooltip-beta.cjs.entry.js +1 -1
  66. package/dist/cjs/gux-icon.cjs.entry.js +2 -2
  67. package/dist/cjs/gux-illustration-beta.cjs.entry.js +1 -1
  68. package/dist/cjs/gux-inline-alert.cjs.entry.js +2 -2
  69. package/dist/cjs/gux-inline-dropdown-beta.cjs.entry.js +2 -2
  70. package/dist/cjs/gux-label-info-beta.cjs.entry.js +1 -1
  71. package/dist/cjs/gux-link-beta.cjs.entry.js +1 -1
  72. package/dist/cjs/gux-list.cjs.entry.js +1 -1
  73. package/dist/cjs/gux-listbox-multi.cjs.entry.js +2 -2
  74. package/dist/cjs/gux-loading-message.cjs.entry.js +1 -1
  75. package/dist/cjs/gux-logo-beta.cjs.entry.js +2 -2
  76. package/dist/cjs/gux-logomark-beta.cjs.entry.js +2 -2
  77. package/dist/cjs/gux-modal-legacy.cjs.entry.js +1 -1
  78. package/dist/cjs/gux-modal-side-panel-beta.cjs.entry.js +1 -1
  79. package/dist/cjs/gux-modal.cjs.entry.js +1 -1
  80. package/dist/cjs/gux-month-calendar.cjs.entry.js +1 -1
  81. package/dist/cjs/gux-month-picker-beta.cjs.entry.js +2 -2
  82. package/dist/cjs/gux-notification-toast-legacy.cjs.entry.js +1 -1
  83. package/dist/cjs/gux-option-multi.cjs.entry.js +1 -1
  84. package/dist/cjs/gux-page-loading-spinner.cjs.entry.js +1 -1
  85. package/dist/cjs/gux-pagination-buttons-legacy_3.cjs.entry.js +1 -1
  86. package/dist/cjs/gux-pagination-buttons_2.cjs.entry.js +1 -1
  87. package/dist/cjs/gux-pagination-cursor.cjs.entry.js +2 -2
  88. package/dist/cjs/gux-pagination-items-per-page.cjs.entry.js +1 -1
  89. package/dist/cjs/gux-pagination-legacy.cjs.entry.js +1 -1
  90. package/dist/cjs/gux-pagination.cjs.entry.js +1 -1
  91. package/dist/cjs/gux-phone-input-beta.cjs.entry.js +173 -171
  92. package/dist/cjs/gux-popover-beta.cjs.entry.js +1 -1
  93. package/dist/cjs/gux-popover-list-beta.cjs.entry.js +1 -1
  94. package/dist/cjs/gux-popover-list.cjs.entry.js +1 -1
  95. package/dist/cjs/gux-prompt-input-beta.cjs.entry.js +2 -2
  96. package/dist/cjs/gux-radial-loading.cjs.entry.js +2 -2
  97. package/dist/cjs/gux-radial-progress.cjs.entry.js +1 -1
  98. package/dist/cjs/gux-rating.cjs.entry.js +2 -2
  99. package/dist/cjs/gux-rich-highlight-list-item.cjs.entry.js +2 -2
  100. package/dist/cjs/gux-rich-style-list-item_3.cjs.entry.js +2 -2
  101. package/dist/cjs/gux-rich-text-editor-action-link.cjs.entry.js +2 -2
  102. package/dist/cjs/gux-rich-text-editor-action-rich-style.cjs.entry.js +2 -2
  103. package/dist/cjs/gux-rich-text-editor-action-text-highlight.cjs.entry.js +2 -2
  104. package/dist/cjs/gux-rich-text-editor-action.cjs.entry.js +2 -2
  105. package/dist/cjs/gux-rich-text-editor-beta.cjs.entry.js +2 -2
  106. package/dist/cjs/gux-rich-text-editor-list.cjs.entry.js +1 -1
  107. package/dist/cjs/gux-row-select.cjs.entry.js +1 -1
  108. package/dist/cjs/gux-screen-reader-beta.cjs.entry.js +1 -1
  109. package/dist/cjs/gux-segmented-control-beta.cjs.entry.js +1 -1
  110. package/dist/cjs/gux-select-all.cjs.entry.js +1 -1
  111. package/dist/cjs/gux-selector-card-beta.cjs.entry.js +1 -1
  112. package/dist/cjs/gux-selector-cards-beta.cjs.entry.js +1 -1
  113. package/dist/cjs/gux-side-panel-beta.cjs.entry.js +1 -1
  114. package/dist/cjs/gux-side-panel-header.cjs.entry.js +1 -1
  115. package/dist/cjs/gux-side-panel-heading.cjs.entry.js +1 -1
  116. package/dist/cjs/gux-simple-toast-legacy.cjs.entry.js +1 -1
  117. package/dist/cjs/gux-skip-navigation-list.cjs.entry.js +2 -2
  118. package/dist/cjs/gux-sort-control.cjs.entry.js +2 -2
  119. package/dist/cjs/gux-status-indicator-beta.cjs.entry.js +1 -1
  120. package/dist/cjs/gux-step-title.cjs.entry.js +1 -1
  121. package/dist/cjs/gux-step.cjs.entry.js +1 -1
  122. package/dist/cjs/gux-stepper-beta.cjs.entry.js +1 -1
  123. package/dist/cjs/gux-switch-legacy.cjs.entry.js +1 -1
  124. package/dist/cjs/gux-tab-advanced-list.cjs.entry.js +1 -1
  125. package/dist/cjs/gux-tab-advanced.cjs.entry.js +1 -1
  126. package/dist/cjs/gux-tab-list.cjs.entry.js +1 -1
  127. package/dist/cjs/gux-table-select-menu.cjs.entry.js +1 -1
  128. package/dist/cjs/gux-table-toolbar-action.cjs.entry.js +2 -2
  129. package/dist/cjs/gux-table-toolbar-custom-action.cjs.entry.js +1 -1
  130. package/dist/cjs/gux-table-toolbar-menu-button.cjs.entry.js +2 -2
  131. package/dist/cjs/gux-table-toolbar.cjs.entry.js +1 -1
  132. package/dist/cjs/gux-table.cjs.entry.js +2 -2
  133. package/dist/cjs/gux-tabs-advanced.cjs.entry.js +1 -1
  134. package/dist/cjs/gux-tabs.cjs.entry.js +1 -1
  135. package/dist/cjs/gux-tag.cjs.entry.js +2 -2
  136. package/dist/cjs/gux-text-highlight.cjs.entry.js +1 -1
  137. package/dist/cjs/gux-time-beta.cjs.entry.js +3 -3
  138. package/dist/cjs/gux-time-picker.cjs.entry.js +2 -2
  139. package/dist/cjs/gux-time-zone-beta.cjs.entry.js +2 -2
  140. package/dist/cjs/gux-time-zone-picker-beta.cjs.entry.js +2 -2
  141. package/dist/cjs/gux-toast.cjs.entry.js +1 -1
  142. package/dist/cjs/gux-toggle.cjs.entry.js +2 -2
  143. package/dist/cjs/gux-tooltip-base-beta_2.cjs.entry.js +1 -1
  144. package/dist/cjs/gux-tooltip-pointer-beta.cjs.entry.js +1 -1
  145. package/dist/cjs/gux-tooltip_2.cjs.entry.js +1 -1
  146. package/dist/cjs/gux-tree-beta.cjs.entry.js +1 -1
  147. package/dist/cjs/gux-tree-multi-beta.cjs.entry.js +1 -1
  148. package/dist/cjs/index-DRg53_B7.js +3372 -0
  149. package/dist/cjs/{iso-dates-B-hZmvim.js → iso-dates-BOFf_iIt.js} +3 -0
  150. package/dist/cjs/{usage-GrpazmBt.js → usage-D4P0WJ6v.js} +1 -1
  151. package/dist/collection/components/beta/gux-calendar-beta/tests/tests.service.playwright.js +1 -1
  152. package/dist/collection/components/stable/gux-datepicker/gux-datepicker.js +12 -9
  153. package/dist/collection/components/stable/gux-icon/gux-icon.css +1 -2
  154. package/dist/collection/utils/date/iso-dates.js +3 -0
  155. package/dist/esm/{get-valid-timezone-rh51yAZx.js → get-valid-timezone-DIdb7fir.js} +1 -1
  156. package/dist/esm/gux-accordion.entry.js +1 -1
  157. package/dist/esm/gux-action-button.entry.js +2 -2
  158. package/dist/esm/gux-action-toast-legacy.entry.js +1 -1
  159. package/dist/esm/gux-actionable-inline-alert-beta.entry.js +1 -1
  160. package/dist/esm/gux-advanced-dropdown-legacy.entry.js +2 -2
  161. package/dist/esm/gux-ai-powered-badge-beta.entry.js +2 -2
  162. package/dist/esm/gux-all-row-select.entry.js +1 -1
  163. package/dist/esm/gux-announce-beta.entry.js +1 -1
  164. package/dist/esm/gux-avatar-beta.entry.js +2 -2
  165. package/dist/esm/gux-avatar-change-photo-beta.entry.js +2 -2
  166. package/dist/esm/gux-avatar-group-add-item-beta_3.entry.js +2 -2
  167. package/dist/esm/gux-avatar-group-beta.entry.js +1 -1
  168. package/dist/esm/gux-avatar-group-item-beta.entry.js +1 -1
  169. package/dist/esm/gux-badge.entry.js +2 -2
  170. package/dist/esm/gux-blank-state-beta.entry.js +1 -1
  171. package/dist/esm/gux-blank-state.entry.js +1 -1
  172. package/dist/esm/gux-breadcrumbs.entry.js +2 -2
  173. package/dist/esm/gux-button-multi.entry.js +1 -1
  174. package/dist/esm/gux-button-slot.entry.js +1 -1
  175. package/dist/esm/gux-button_2.entry.js +1 -1
  176. package/dist/esm/gux-calendar-beta.entry.js +1 -1
  177. package/dist/esm/gux-calendar.entry.js +3 -3
  178. package/dist/esm/gux-card.entry.js +1 -1
  179. package/dist/esm/gux-cloud-logo-beta.entry.js +2 -2
  180. package/dist/esm/gux-cloud-logomark-beta.entry.js +2 -2
  181. package/dist/esm/gux-column-manager-item.entry.js +1 -1
  182. package/dist/esm/gux-column-manager.entry.js +2 -2
  183. package/dist/esm/gux-content-search.entry.js +2 -2
  184. package/dist/esm/gux-context-menu.entry.js +2 -2
  185. package/dist/esm/gux-copy-to-clipboard.entry.js +2 -2
  186. package/dist/esm/gux-create-option.entry.js +1 -1
  187. package/dist/esm/gux-date-beta.entry.js +3 -3
  188. package/dist/esm/gux-date-time-beta.entry.js +3 -3
  189. package/dist/esm/gux-datepicker.entry.js +15 -12
  190. package/dist/esm/gux-day-beta.entry.js +1 -1
  191. package/dist/esm/gux-disclosure-button-legacy.entry.js +2 -2
  192. package/dist/esm/gux-dismiss-button.entry.js +2 -2
  193. package/dist/esm/gux-dropdown-multi-tag.entry.js +1 -1
  194. package/dist/esm/gux-dropdown-multi.entry.js +2 -2
  195. package/dist/esm/gux-dropdown_3.entry.js +2 -2
  196. package/dist/esm/gux-file-list-item.entry.js +2 -2
  197. package/dist/esm/gux-flag-icon-beta.entry.js +2 -2
  198. package/dist/esm/gux-flyout-menu.entry.js +2 -2
  199. package/dist/esm/gux-form-field-checkbox-group-beta.entry.js +2 -2
  200. package/dist/esm/gux-form-field-checkbox.entry.js +1 -1
  201. package/dist/esm/gux-form-field-color.entry.js +1 -1
  202. package/dist/esm/gux-form-field-dropdown.entry.js +2 -2
  203. package/dist/esm/gux-form-field-file-beta.entry.js +2 -2
  204. package/dist/esm/gux-form-field-file.entry.js +1 -1
  205. package/dist/esm/gux-form-field-input-clear-button.entry.js +2 -2
  206. package/dist/esm/gux-form-field-label-indicator.entry.js +2 -2
  207. package/dist/esm/gux-form-field-number_2.entry.js +2 -2
  208. package/dist/esm/gux-form-field-phone.entry.js +2 -2
  209. package/dist/esm/gux-form-field-radio-group-beta.entry.js +2 -2
  210. package/dist/esm/gux-form-field-radio.entry.js +1 -1
  211. package/dist/esm/gux-form-field-range.entry.js +1 -1
  212. package/dist/esm/gux-form-field-search.entry.js +1 -1
  213. package/dist/esm/gux-form-field-select.entry.js +1 -1
  214. package/dist/esm/gux-form-field-text-like.entry.js +2 -2
  215. package/dist/esm/gux-form-field-textarea.entry.js +1 -1
  216. package/dist/esm/gux-form-field-time-picker.entry.js +2 -2
  217. package/dist/esm/gux-form-field-time-zone-picker.entry.js +2 -2
  218. package/dist/esm/gux-form-footer.entry.js +1 -1
  219. package/dist/esm/gux-icon-tooltip-beta.entry.js +1 -1
  220. package/dist/esm/gux-icon.entry.js +2 -2
  221. package/dist/esm/gux-illustration-beta.entry.js +1 -1
  222. package/dist/esm/gux-inline-alert.entry.js +2 -2
  223. package/dist/esm/gux-inline-dropdown-beta.entry.js +2 -2
  224. package/dist/esm/gux-label-info-beta.entry.js +1 -1
  225. package/dist/esm/gux-link-beta.entry.js +1 -1
  226. package/dist/esm/gux-list.entry.js +1 -1
  227. package/dist/esm/gux-listbox-multi.entry.js +2 -2
  228. package/dist/esm/gux-loading-message.entry.js +1 -1
  229. package/dist/esm/gux-logo-beta.entry.js +2 -2
  230. package/dist/esm/gux-logomark-beta.entry.js +2 -2
  231. package/dist/esm/gux-modal-legacy.entry.js +1 -1
  232. package/dist/esm/gux-modal-side-panel-beta.entry.js +1 -1
  233. package/dist/esm/gux-modal.entry.js +1 -1
  234. package/dist/esm/gux-month-calendar.entry.js +1 -1
  235. package/dist/esm/gux-month-picker-beta.entry.js +2 -2
  236. package/dist/esm/gux-notification-toast-legacy.entry.js +1 -1
  237. package/dist/esm/gux-option-multi.entry.js +1 -1
  238. package/dist/esm/gux-page-loading-spinner.entry.js +1 -1
  239. package/dist/esm/gux-pagination-buttons-legacy_3.entry.js +1 -1
  240. package/dist/esm/gux-pagination-buttons_2.entry.js +1 -1
  241. package/dist/esm/gux-pagination-cursor.entry.js +2 -2
  242. package/dist/esm/gux-pagination-items-per-page.entry.js +1 -1
  243. package/dist/esm/gux-pagination-legacy.entry.js +1 -1
  244. package/dist/esm/gux-pagination.entry.js +1 -1
  245. package/dist/esm/gux-phone-input-beta.entry.js +173 -171
  246. package/dist/esm/gux-popover-beta.entry.js +1 -1
  247. package/dist/esm/gux-popover-list-beta.entry.js +1 -1
  248. package/dist/esm/gux-popover-list.entry.js +1 -1
  249. package/dist/esm/gux-prompt-input-beta.entry.js +2 -2
  250. package/dist/esm/gux-radial-loading.entry.js +2 -2
  251. package/dist/esm/gux-radial-progress.entry.js +1 -1
  252. package/dist/esm/gux-rating.entry.js +2 -2
  253. package/dist/esm/gux-rich-highlight-list-item.entry.js +2 -2
  254. package/dist/esm/gux-rich-style-list-item_3.entry.js +2 -2
  255. package/dist/esm/gux-rich-text-editor-action-link.entry.js +2 -2
  256. package/dist/esm/gux-rich-text-editor-action-rich-style.entry.js +2 -2
  257. package/dist/esm/gux-rich-text-editor-action-text-highlight.entry.js +2 -2
  258. package/dist/esm/gux-rich-text-editor-action.entry.js +2 -2
  259. package/dist/esm/gux-rich-text-editor-beta.entry.js +2 -2
  260. package/dist/esm/gux-rich-text-editor-list.entry.js +1 -1
  261. package/dist/esm/gux-row-select.entry.js +1 -1
  262. package/dist/esm/gux-screen-reader-beta.entry.js +1 -1
  263. package/dist/esm/gux-segmented-control-beta.entry.js +1 -1
  264. package/dist/esm/gux-select-all.entry.js +1 -1
  265. package/dist/esm/gux-selector-card-beta.entry.js +1 -1
  266. package/dist/esm/gux-selector-cards-beta.entry.js +1 -1
  267. package/dist/esm/gux-side-panel-beta.entry.js +1 -1
  268. package/dist/esm/gux-side-panel-header.entry.js +1 -1
  269. package/dist/esm/gux-side-panel-heading.entry.js +1 -1
  270. package/dist/esm/gux-simple-toast-legacy.entry.js +1 -1
  271. package/dist/esm/gux-skip-navigation-list.entry.js +2 -2
  272. package/dist/esm/gux-sort-control.entry.js +2 -2
  273. package/dist/esm/gux-status-indicator-beta.entry.js +1 -1
  274. package/dist/esm/gux-step-title.entry.js +1 -1
  275. package/dist/esm/gux-step.entry.js +1 -1
  276. package/dist/esm/gux-stepper-beta.entry.js +1 -1
  277. package/dist/esm/gux-switch-legacy.entry.js +1 -1
  278. package/dist/esm/gux-tab-advanced-list.entry.js +1 -1
  279. package/dist/esm/gux-tab-advanced.entry.js +1 -1
  280. package/dist/esm/gux-tab-list.entry.js +1 -1
  281. package/dist/esm/gux-table-select-menu.entry.js +1 -1
  282. package/dist/esm/gux-table-toolbar-action.entry.js +2 -2
  283. package/dist/esm/gux-table-toolbar-custom-action.entry.js +1 -1
  284. package/dist/esm/gux-table-toolbar-menu-button.entry.js +2 -2
  285. package/dist/esm/gux-table-toolbar.entry.js +1 -1
  286. package/dist/esm/gux-table.entry.js +2 -2
  287. package/dist/esm/gux-tabs-advanced.entry.js +1 -1
  288. package/dist/esm/gux-tabs.entry.js +1 -1
  289. package/dist/esm/gux-tag.entry.js +2 -2
  290. package/dist/esm/gux-text-highlight.entry.js +1 -1
  291. package/dist/esm/gux-time-beta.entry.js +3 -3
  292. package/dist/esm/gux-time-picker.entry.js +2 -2
  293. package/dist/esm/gux-time-zone-beta.entry.js +2 -2
  294. package/dist/esm/gux-time-zone-picker-beta.entry.js +2 -2
  295. package/dist/esm/gux-toast.entry.js +1 -1
  296. package/dist/esm/gux-toggle.entry.js +2 -2
  297. package/dist/esm/gux-tooltip-base-beta_2.entry.js +1 -1
  298. package/dist/esm/gux-tooltip-pointer-beta.entry.js +1 -1
  299. package/dist/esm/gux-tooltip_2.entry.js +1 -1
  300. package/dist/esm/gux-tree-beta.entry.js +1 -1
  301. package/dist/esm/gux-tree-multi-beta.entry.js +1 -1
  302. package/dist/esm/index-ChoMleW_.js +3366 -0
  303. package/dist/esm/{iso-dates-aKaDsw_5.js → iso-dates-BFybQmZw.js} +3 -0
  304. package/dist/esm/{usage-CYZSsQYc.js → usage-BJX1jP8P.js} +1 -1
  305. package/dist/genesys-webcomponents/genesys-webcomponents.esm.js +1 -1
  306. package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.ar.json +1 -1
  307. package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.da.json +1 -1
  308. package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.es-es.json +1 -1
  309. package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.es.json +1 -1
  310. package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.fi.json +1 -1
  311. package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.ja.json +1 -1
  312. package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.ko.json +1 -1
  313. package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.nl.json +1 -1
  314. package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.pt-br.json +1 -1
  315. package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.ru.json +1 -1
  316. package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.sv.json +1 -1
  317. package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.th.json +1 -1
  318. package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.uk.json +1 -1
  319. package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.zh-cn.json +1 -1
  320. package/dist/genesys-webcomponents/{p-eda82225.entry.js → p-00b6b549.entry.js} +1 -1
  321. package/dist/genesys-webcomponents/{p-8595df72.entry.js → p-015756d9.entry.js} +1 -1
  322. package/dist/genesys-webcomponents/{p-d8d1b6db.entry.js → p-029ceda7.entry.js} +1 -1
  323. package/dist/genesys-webcomponents/{p-8f29fb00.entry.js → p-02cdb13e.entry.js} +1 -1
  324. package/dist/genesys-webcomponents/{p-e24b725f.entry.js → p-05157b56.entry.js} +1 -1
  325. package/dist/genesys-webcomponents/{p-931b24c4.entry.js → p-052c800a.entry.js} +1 -1
  326. package/dist/genesys-webcomponents/p-087ec88e.entry.js +1 -0
  327. package/dist/genesys-webcomponents/{p-ddd7362d.entry.js → p-09220774.entry.js} +1 -1
  328. package/dist/genesys-webcomponents/p-0a094594.entry.js +1 -0
  329. package/dist/genesys-webcomponents/{p-01acdf70.entry.js → p-0fb11edf.entry.js} +1 -1
  330. package/dist/genesys-webcomponents/{p-4c966844.entry.js → p-13c99e2f.entry.js} +1 -1
  331. package/dist/genesys-webcomponents/{p-66c9b0d0.entry.js → p-15ca8693.entry.js} +1 -1
  332. package/dist/genesys-webcomponents/{p-fe5a1f14.entry.js → p-17014484.entry.js} +1 -1
  333. package/dist/genesys-webcomponents/{p-17a45dbe.entry.js → p-1814ba1a.entry.js} +1 -1
  334. package/dist/genesys-webcomponents/{p-150dda1b.entry.js → p-18e166ec.entry.js} +1 -1
  335. package/dist/genesys-webcomponents/{p-32991d30.entry.js → p-1bf6a162.entry.js} +1 -1
  336. package/dist/genesys-webcomponents/{p-e4208622.entry.js → p-1c01fba6.entry.js} +1 -1
  337. package/dist/genesys-webcomponents/{p-3de4faad.entry.js → p-1faaddc6.entry.js} +1 -1
  338. package/dist/genesys-webcomponents/{p-16940c56.entry.js → p-208a7b8c.entry.js} +1 -1
  339. package/dist/genesys-webcomponents/{p-1cd43bcd.entry.js → p-24a8060c.entry.js} +1 -1
  340. package/dist/genesys-webcomponents/{p-8b1ec4b4.entry.js → p-24da0e5e.entry.js} +1 -1
  341. package/dist/genesys-webcomponents/{p-592f2225.entry.js → p-24fec568.entry.js} +1 -1
  342. package/dist/genesys-webcomponents/{p-f9e43e59.entry.js → p-2596e74c.entry.js} +1 -1
  343. package/dist/genesys-webcomponents/{p-55bb8071.entry.js → p-29801d89.entry.js} +1 -1
  344. package/dist/genesys-webcomponents/{p-67f7bdf0.entry.js → p-2a1e81bc.entry.js} +1 -1
  345. package/dist/genesys-webcomponents/{p-b9d36907.entry.js → p-2d219353.entry.js} +1 -1
  346. package/dist/genesys-webcomponents/{p-4b1a4e58.entry.js → p-305f1f65.entry.js} +1 -1
  347. package/dist/genesys-webcomponents/{p-d057a751.entry.js → p-308b7568.entry.js} +1 -1
  348. package/dist/genesys-webcomponents/{p-2a801ea9.entry.js → p-3098f337.entry.js} +1 -1
  349. package/dist/genesys-webcomponents/{p-77265307.entry.js → p-30d43160.entry.js} +1 -1
  350. package/dist/genesys-webcomponents/{p-dcd1882b.entry.js → p-3142356f.entry.js} +1 -1
  351. package/dist/genesys-webcomponents/{p-ed4d78bc.entry.js → p-323abf43.entry.js} +1 -1
  352. package/dist/genesys-webcomponents/{p-801d79b5.entry.js → p-33ecf7bd.entry.js} +1 -1
  353. package/dist/genesys-webcomponents/{p-67ffdd06.entry.js → p-35acfa86.entry.js} +1 -1
  354. package/dist/genesys-webcomponents/{p-11a4a6ef.entry.js → p-36996781.entry.js} +1 -1
  355. package/dist/genesys-webcomponents/{p-4f62813b.entry.js → p-38d44fd2.entry.js} +1 -1
  356. package/dist/genesys-webcomponents/{p-99299d25.entry.js → p-395329cf.entry.js} +1 -1
  357. package/dist/genesys-webcomponents/{p-83014c33.entry.js → p-3a826875.entry.js} +1 -1
  358. package/dist/genesys-webcomponents/{p-40068451.entry.js → p-3ab52659.entry.js} +1 -1
  359. package/dist/genesys-webcomponents/{p-573cb83a.entry.js → p-3d638b05.entry.js} +1 -1
  360. package/dist/genesys-webcomponents/p-3e37ff1f.entry.js +1 -0
  361. package/dist/genesys-webcomponents/{p-ae7b7bda.entry.js → p-3f6e1f1c.entry.js} +1 -1
  362. package/dist/genesys-webcomponents/{p-00531df5.entry.js → p-3fdf0607.entry.js} +1 -1
  363. package/dist/genesys-webcomponents/{p-e2a8084e.entry.js → p-45656682.entry.js} +1 -1
  364. package/dist/genesys-webcomponents/{p-ed78de36.entry.js → p-471bfa55.entry.js} +1 -1
  365. package/dist/genesys-webcomponents/{p-8aeb2c01.entry.js → p-476b2052.entry.js} +1 -1
  366. package/dist/genesys-webcomponents/{p-ac558ad8.entry.js → p-47f84787.entry.js} +1 -1
  367. package/dist/genesys-webcomponents/{p-8a533da1.entry.js → p-4ce8fbc8.entry.js} +1 -1
  368. package/dist/genesys-webcomponents/{p-84c99152.entry.js → p-4d202156.entry.js} +1 -1
  369. package/dist/genesys-webcomponents/{p-f44e0aaf.entry.js → p-52541fce.entry.js} +1 -1
  370. package/dist/genesys-webcomponents/{p-7e122f43.entry.js → p-532f5101.entry.js} +1 -1
  371. package/dist/genesys-webcomponents/{p-a8fb48d5.entry.js → p-538798e4.entry.js} +1 -1
  372. package/dist/genesys-webcomponents/{p-d771bfca.entry.js → p-54c664c9.entry.js} +1 -1
  373. package/dist/genesys-webcomponents/{p-7ef51b7d.entry.js → p-5932e0c1.entry.js} +1 -1
  374. package/dist/genesys-webcomponents/{p-a69cce2b.entry.js → p-5965a868.entry.js} +1 -1
  375. package/dist/genesys-webcomponents/{p-56c66f0d.entry.js → p-5ac20467.entry.js} +1 -1
  376. package/dist/genesys-webcomponents/{p-9cce8f5a.entry.js → p-5f544839.entry.js} +1 -1
  377. package/dist/genesys-webcomponents/{p-85c4cd01.entry.js → p-674c7d0c.entry.js} +1 -1
  378. package/dist/genesys-webcomponents/{p-0f0d8d5d.entry.js → p-69412348.entry.js} +1 -1
  379. package/dist/genesys-webcomponents/{p-6ff72393.entry.js → p-6bdceed9.entry.js} +1 -1
  380. package/dist/genesys-webcomponents/{p-9a79b58d.entry.js → p-6cca4881.entry.js} +1 -1
  381. package/dist/genesys-webcomponents/{p-71a63e54.entry.js → p-6fa72a72.entry.js} +1 -1
  382. package/dist/genesys-webcomponents/{p-2e742607.entry.js → p-6fe0db93.entry.js} +1 -1
  383. package/dist/genesys-webcomponents/{p-bab515b9.entry.js → p-70fb9b3c.entry.js} +1 -1
  384. package/dist/genesys-webcomponents/{p-d1a7f402.entry.js → p-71a9054c.entry.js} +1 -1
  385. package/dist/genesys-webcomponents/{p-dfe507e8.entry.js → p-72b6fa90.entry.js} +1 -1
  386. package/dist/genesys-webcomponents/{p-7df39689.entry.js → p-74d74b0a.entry.js} +1 -1
  387. package/dist/genesys-webcomponents/{p-48926e3d.entry.js → p-751d9ed3.entry.js} +2 -2
  388. package/dist/genesys-webcomponents/{p-a7c37eab.entry.js → p-7537d923.entry.js} +1 -1
  389. package/dist/genesys-webcomponents/{p-f0478e6e.entry.js → p-75aa126c.entry.js} +1 -1
  390. package/dist/genesys-webcomponents/{p-23d2d73b.entry.js → p-82bd4b31.entry.js} +1 -1
  391. package/dist/genesys-webcomponents/{p-10f9ef52.entry.js → p-84d1c531.entry.js} +1 -1
  392. package/dist/genesys-webcomponents/{p-7ccc09fb.entry.js → p-86d8a706.entry.js} +1 -1
  393. package/dist/genesys-webcomponents/{p-58f9da5c.entry.js → p-87717cac.entry.js} +1 -1
  394. package/dist/genesys-webcomponents/{p-e1e30fcb.entry.js → p-879ee390.entry.js} +1 -1
  395. package/dist/genesys-webcomponents/{p-24b6f102.entry.js → p-87f84d44.entry.js} +1 -1
  396. package/dist/genesys-webcomponents/{p-e321e392.entry.js → p-89e226e8.entry.js} +1 -1
  397. package/dist/genesys-webcomponents/{p-e67865a1.entry.js → p-8aae6e1b.entry.js} +1 -1
  398. package/dist/genesys-webcomponents/{p-19ae0df0.entry.js → p-8cd048c5.entry.js} +1 -1
  399. package/dist/genesys-webcomponents/{p-40e8150c.entry.js → p-8d6fe6e1.entry.js} +1 -1
  400. package/dist/genesys-webcomponents/{p-9f9e1e6f.entry.js → p-8edabc20.entry.js} +1 -1
  401. package/dist/genesys-webcomponents/{p-cf9a2833.entry.js → p-93249f0f.entry.js} +1 -1
  402. package/dist/genesys-webcomponents/{p-bafe648a.entry.js → p-95c9469b.entry.js} +1 -1
  403. package/dist/genesys-webcomponents/{p-913ab88b.entry.js → p-9744bbcd.entry.js} +1 -1
  404. package/dist/genesys-webcomponents/{p-64bdfffa.entry.js → p-98109a06.entry.js} +1 -1
  405. package/dist/genesys-webcomponents/{p-2c0169ec.entry.js → p-9867f5b0.entry.js} +1 -1
  406. package/dist/genesys-webcomponents/p-9a8cf271.entry.js +1 -0
  407. package/dist/genesys-webcomponents/{p-37a4d70d.entry.js → p-9cfa2e74.entry.js} +1 -1
  408. package/dist/genesys-webcomponents/{p-f9fa3200.entry.js → p-9d76b7d4.entry.js} +1 -1
  409. package/dist/genesys-webcomponents/{p-8afc5a3d.entry.js → p-9e7d3ee9.entry.js} +1 -1
  410. package/dist/genesys-webcomponents/{p-603bcd25.entry.js → p-9eee14c9.entry.js} +1 -1
  411. package/dist/genesys-webcomponents/{p-554dbbe1.entry.js → p-9f43092a.entry.js} +1 -1
  412. package/dist/genesys-webcomponents/p-BFybQmZw.js +1 -0
  413. package/dist/genesys-webcomponents/{p-CYZSsQYc.js → p-BJX1jP8P.js} +1 -1
  414. package/dist/genesys-webcomponents/{p-BvsD2Jrx.js → p-C1OLX65e.js} +1 -1
  415. package/dist/genesys-webcomponents/p-DyLWs74h.js +1 -0
  416. package/dist/genesys-webcomponents/{p-9dbbdaa6.entry.js → p-a1f4ee28.entry.js} +1 -1
  417. package/dist/genesys-webcomponents/{p-6ac8394d.entry.js → p-a3b6a5f4.entry.js} +1 -1
  418. package/dist/genesys-webcomponents/p-a3e570b0.entry.js +1 -0
  419. package/dist/genesys-webcomponents/{p-1db598fc.entry.js → p-a4788c1d.entry.js} +1 -1
  420. package/dist/genesys-webcomponents/{p-8653db1a.entry.js → p-a5385c5f.entry.js} +1 -1
  421. package/dist/genesys-webcomponents/{p-77528c82.entry.js → p-a65b14f2.entry.js} +1 -1
  422. package/dist/genesys-webcomponents/{p-8ac99306.entry.js → p-a9e0a048.entry.js} +1 -1
  423. package/dist/genesys-webcomponents/{p-77fa550d.entry.js → p-ab0bd3aa.entry.js} +1 -1
  424. package/dist/genesys-webcomponents/{p-4b496a5e.entry.js → p-ac82162e.entry.js} +1 -1
  425. package/dist/genesys-webcomponents/{p-36e360c1.entry.js → p-b20b9779.entry.js} +1 -1
  426. package/dist/genesys-webcomponents/{p-13b0d7d1.entry.js → p-b25eb49f.entry.js} +1 -1
  427. package/dist/genesys-webcomponents/{p-ed33d483.entry.js → p-b4b76262.entry.js} +1 -1
  428. package/dist/genesys-webcomponents/{p-25b01b19.entry.js → p-b5fb334b.entry.js} +1 -1
  429. package/dist/genesys-webcomponents/{p-a8a46b95.entry.js → p-b749688d.entry.js} +1 -1
  430. package/dist/genesys-webcomponents/{p-8b620273.entry.js → p-b77918a0.entry.js} +1 -1
  431. package/dist/genesys-webcomponents/{p-d1b6b001.entry.js → p-b77b650c.entry.js} +1 -1
  432. package/dist/genesys-webcomponents/{p-a5a8e89a.entry.js → p-ba41e5d2.entry.js} +1 -1
  433. package/dist/genesys-webcomponents/{p-4a5d7c92.entry.js → p-bd35bf72.entry.js} +1 -1
  434. package/dist/genesys-webcomponents/{p-f0dfc482.entry.js → p-c07ab9eb.entry.js} +1 -1
  435. package/dist/genesys-webcomponents/{p-40bdc6cf.entry.js → p-c083c960.entry.js} +1 -1
  436. package/dist/genesys-webcomponents/{p-5edbab02.entry.js → p-c0a79e8d.entry.js} +1 -1
  437. package/dist/genesys-webcomponents/{p-40e67591.entry.js → p-c4896269.entry.js} +1 -1
  438. package/dist/genesys-webcomponents/{p-f9ba7265.entry.js → p-c60a0743.entry.js} +1 -1
  439. package/dist/genesys-webcomponents/{p-7e943541.entry.js → p-c629b283.entry.js} +1 -1
  440. package/dist/genesys-webcomponents/{p-56367f4c.entry.js → p-c91c7adc.entry.js} +1 -1
  441. package/dist/genesys-webcomponents/{p-edbe4ba0.entry.js → p-ca3bfaac.entry.js} +1 -1
  442. package/dist/genesys-webcomponents/{p-b463bdd3.entry.js → p-cb31dea7.entry.js} +1 -1
  443. package/dist/genesys-webcomponents/{p-2cc4e28d.entry.js → p-d5de16e1.entry.js} +1 -1
  444. package/dist/genesys-webcomponents/{p-ad9a18c7.entry.js → p-d868dbb5.entry.js} +1 -1
  445. package/dist/genesys-webcomponents/{p-dad46386.entry.js → p-d87799ad.entry.js} +1 -1
  446. package/dist/genesys-webcomponents/{p-500841cb.entry.js → p-d97c6402.entry.js} +1 -1
  447. package/dist/genesys-webcomponents/{p-0ac44e50.entry.js → p-da89d324.entry.js} +1 -1
  448. package/dist/genesys-webcomponents/{p-e908936f.entry.js → p-db52a0eb.entry.js} +1 -1
  449. package/dist/genesys-webcomponents/{p-f38d7610.entry.js → p-defa1a7d.entry.js} +1 -1
  450. package/dist/genesys-webcomponents/{p-f66adf01.entry.js → p-e0696252.entry.js} +1 -1
  451. package/dist/genesys-webcomponents/{p-485629ba.entry.js → p-e2c1853d.entry.js} +1 -1
  452. package/dist/genesys-webcomponents/{p-9e7fe47a.entry.js → p-e52833b2.entry.js} +1 -1
  453. package/dist/genesys-webcomponents/{p-984cbfe9.entry.js → p-e6a0b0a6.entry.js} +1 -1
  454. package/dist/genesys-webcomponents/{p-dd7741ca.entry.js → p-e9a2985b.entry.js} +1 -1
  455. package/dist/genesys-webcomponents/{p-b78c93da.entry.js → p-f15957e2.entry.js} +1 -1
  456. package/dist/genesys-webcomponents/{p-29222289.entry.js → p-f2bb6dac.entry.js} +1 -1
  457. package/dist/genesys-webcomponents/{p-81ddab63.entry.js → p-f475a40b.entry.js} +1 -1
  458. package/dist/genesys-webcomponents/{p-4fc4f932.entry.js → p-f4b919f5.entry.js} +1 -1
  459. package/dist/genesys-webcomponents/{p-4af7ac28.entry.js → p-f52f163b.entry.js} +1 -1
  460. package/dist/genesys-webcomponents/{p-d7aa420d.entry.js → p-f7e612aa.entry.js} +1 -1
  461. package/dist/genesys-webcomponents/{p-86a3bdd6.entry.js → p-f9d537a3.entry.js} +1 -1
  462. package/dist/genesys-webcomponents/{p-b091152c.entry.js → p-fa6bd708.entry.js} +1 -1
  463. package/dist/genesys-webcomponents/{p-feedb61e.entry.js → p-faaf93da.entry.js} +1 -1
  464. package/dist/genesys-webcomponents/{p-4e05cb3a.entry.js → p-fbbce3cb.entry.js} +1 -1
  465. package/dist/genesys-webcomponents/{p-e2fc68a6.entry.js → p-fbed7ee9.entry.js} +1 -1
  466. package/dist/genesys-webcomponents/{p-5155b824.entry.js → p-fd44ee1b.entry.js} +1 -1
  467. package/dist/genesys-webcomponents/{p-4f402fad.entry.js → p-fd7a9f36.entry.js} +1 -1
  468. package/dist/genesys-webcomponents/{p-b1fb20d7.entry.js → p-fde2d393.entry.js} +1 -1
  469. package/dist/genesys-webcomponents/{p-a658bc21.entry.js → p-fe915258.entry.js} +1 -1
  470. package/dist/stencil-wrapper.js +1 -1
  471. package/dist/types/components/stable/gux-datepicker/gux-datepicker.d.ts +1 -0
  472. package/dist/types/stencil-wrapper.d.ts +1 -1
  473. package/package.json +5 -5
  474. package/dist/cjs/index-D7ufkS4M.js +0 -4194
  475. package/dist/esm/index-HMDSHwTB.js +0 -4188
  476. package/dist/genesys-webcomponents/p-08aa9a17.entry.js +0 -1
  477. package/dist/genesys-webcomponents/p-0f9b2e05.entry.js +0 -1
  478. package/dist/genesys-webcomponents/p-11c7b49a.entry.js +0 -1
  479. package/dist/genesys-webcomponents/p-DnzIYzsz.js +0 -1
  480. package/dist/genesys-webcomponents/p-aKaDsw_5.js +0 -1
  481. package/dist/genesys-webcomponents/p-d061b1f4.entry.js +0 -1
  482. package/dist/genesys-webcomponents/p-deb3b990.entry.js +0 -1
@@ -0,0 +1,3366 @@
1
+ import { e as getAssetPath } from './index-8p-S7f9X.js';
2
+ import { g as getClosestElement } from './get-closest-element-Cd4R0amv.js';
3
+
4
+ function memoize(fn, options) {
5
+ const cache = options && options.cache ? options.cache : cacheDefault;
6
+ const serializer = options && options.serializer ? options.serializer : serializerDefault;
7
+ const strategy = options && options.strategy ? options.strategy : strategyDefault;
8
+ return strategy(fn, {
9
+ cache,
10
+ serializer
11
+ });
12
+ }
13
+ //
14
+ // Strategy
15
+ //
16
+ function isPrimitive(value) {
17
+ return value == null || typeof value === "number" || typeof value === "boolean";
18
+ }
19
+ function monadic(fn, cache, serializer, arg) {
20
+ const cacheKey = isPrimitive(arg) ? arg : serializer(arg);
21
+ let computedValue = cache.get(cacheKey);
22
+ if (typeof computedValue === "undefined") {
23
+ computedValue = fn.call(this, arg);
24
+ cache.set(cacheKey, computedValue);
25
+ }
26
+ return computedValue;
27
+ }
28
+ function variadic(fn, cache, serializer) {
29
+ const args = Array.prototype.slice.call(arguments, 3);
30
+ const cacheKey = serializer(args);
31
+ let computedValue = cache.get(cacheKey);
32
+ if (typeof computedValue === "undefined") {
33
+ computedValue = fn.apply(this, args);
34
+ cache.set(cacheKey, computedValue);
35
+ }
36
+ return computedValue;
37
+ }
38
+ function assemble(fn, context, strategy, cache, serialize) {
39
+ return strategy.bind(context, fn, cache, serialize);
40
+ }
41
+ function strategyDefault(fn, options) {
42
+ const strategy = fn.length === 1 ? monadic : variadic;
43
+ return assemble(fn, this, strategy, options.cache.create(), options.serializer);
44
+ }
45
+ function strategyVariadic(fn, options) {
46
+ return assemble(fn, this, variadic, options.cache.create(), options.serializer);
47
+ }
48
+ //
49
+ // Serializer
50
+ //
51
+ const serializerDefault = function() {
52
+ return JSON.stringify(arguments);
53
+ };
54
+ //
55
+ // Cache
56
+ //
57
+ class ObjectWithoutPrototypeCache {
58
+ cache;
59
+ constructor() {
60
+ this.cache = Object.create(null);
61
+ }
62
+ get(key) {
63
+ return this.cache[key];
64
+ }
65
+ set(key, value) {
66
+ this.cache[key] = value;
67
+ }
68
+ }
69
+ const cacheDefault = { create: function create() {
70
+ return new ObjectWithoutPrototypeCache();
71
+ } };
72
+ const strategies = {
73
+ variadic: strategyVariadic};
74
+
75
+ /**
76
+ * https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
77
+ * Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js
78
+ * with some tweaks
79
+ */
80
+ const DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
81
+ /**
82
+ * Parse Date time skeleton into Intl.DateTimeFormatOptions
83
+ * Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
84
+ * @public
85
+ * @param skeleton skeleton string
86
+ */
87
+ function parseDateTimeSkeleton(skeleton) {
88
+ const result = {};
89
+ skeleton.replace(DATE_TIME_REGEX, (match) => {
90
+ const len = match.length;
91
+ switch (match[0]) {
92
+ case "G":
93
+ result.era = len === 4 ? "long" : len === 5 ? "narrow" : "short";
94
+ break;
95
+ case "y":
96
+ result.year = len === 2 ? "2-digit" : "numeric";
97
+ break;
98
+ case "Y":
99
+ case "u":
100
+ case "U":
101
+ case "r": throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");
102
+ case "q":
103
+ case "Q": throw new RangeError("`q/Q` (quarter) patterns are not supported");
104
+ case "M":
105
+ case "L":
106
+ result.month = [
107
+ "numeric",
108
+ "2-digit",
109
+ "short",
110
+ "long",
111
+ "narrow"
112
+ ][len - 1];
113
+ break;
114
+ case "w":
115
+ case "W": throw new RangeError("`w/W` (week) patterns are not supported");
116
+ case "d":
117
+ result.day = ["numeric", "2-digit"][len - 1];
118
+ break;
119
+ case "D":
120
+ case "F":
121
+ case "g": throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");
122
+ case "E":
123
+ result.weekday = len === 4 ? "long" : len === 5 ? "narrow" : "short";
124
+ break;
125
+ case "e":
126
+ if (len < 4) {
127
+ throw new RangeError("`e..eee` (weekday) patterns are not supported");
128
+ }
129
+ result.weekday = [
130
+ "short",
131
+ "long",
132
+ "narrow",
133
+ "short"
134
+ ][len - 4];
135
+ break;
136
+ case "c":
137
+ if (len < 4) {
138
+ throw new RangeError("`c..ccc` (weekday) patterns are not supported");
139
+ }
140
+ result.weekday = [
141
+ "short",
142
+ "long",
143
+ "narrow",
144
+ "short"
145
+ ][len - 4];
146
+ break;
147
+ case "a":
148
+ result.hour12 = true;
149
+ break;
150
+ case "b":
151
+ case "B": throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");
152
+ case "h":
153
+ result.hourCycle = "h12";
154
+ result.hour = ["numeric", "2-digit"][len - 1];
155
+ break;
156
+ case "H":
157
+ result.hourCycle = "h23";
158
+ result.hour = ["numeric", "2-digit"][len - 1];
159
+ break;
160
+ case "K":
161
+ result.hourCycle = "h11";
162
+ result.hour = ["numeric", "2-digit"][len - 1];
163
+ break;
164
+ case "k":
165
+ result.hourCycle = "h24";
166
+ result.hour = ["numeric", "2-digit"][len - 1];
167
+ break;
168
+ case "j":
169
+ case "J":
170
+ case "C": throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");
171
+ case "m":
172
+ result.minute = ["numeric", "2-digit"][len - 1];
173
+ break;
174
+ case "s":
175
+ result.second = ["numeric", "2-digit"][len - 1];
176
+ break;
177
+ case "S":
178
+ case "A": throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");
179
+ case "z":
180
+ result.timeZoneName = len < 4 ? "short" : "long";
181
+ break;
182
+ case "Z":
183
+ case "O":
184
+ case "v":
185
+ case "V":
186
+ case "X":
187
+ case "x": throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead");
188
+ }
189
+ return "";
190
+ });
191
+ return result;
192
+ }
193
+
194
+ // @generated from regex-gen.ts
195
+ const WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
196
+
197
+ function parseNumberSkeletonFromString(skeleton) {
198
+ if (skeleton.length === 0) {
199
+ throw new Error("Number skeleton cannot be empty");
200
+ }
201
+ // Parse the skeleton
202
+ const stringTokens = skeleton.split(WHITE_SPACE_REGEX).filter((x) => x.length > 0);
203
+ const tokens = [];
204
+ for (const stringToken of stringTokens) {
205
+ let stemAndOptions = stringToken.split("/");
206
+ if (stemAndOptions.length === 0) {
207
+ throw new Error("Invalid number skeleton");
208
+ }
209
+ const [stem, ...options] = stemAndOptions;
210
+ for (const option of options) {
211
+ if (option.length === 0) {
212
+ throw new Error("Invalid number skeleton");
213
+ }
214
+ }
215
+ tokens.push({
216
+ stem,
217
+ options
218
+ });
219
+ }
220
+ return tokens;
221
+ }
222
+ function icuUnitToEcma(unit) {
223
+ return unit.replace(/^(.*?)-/, "");
224
+ }
225
+ const FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g;
226
+ const SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g;
227
+ const INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g;
228
+ const CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;
229
+ function parseSignificantPrecision(str) {
230
+ const result = {};
231
+ if (str[str.length - 1] === "r") {
232
+ result.roundingPriority = "morePrecision";
233
+ } else if (str[str.length - 1] === "s") {
234
+ result.roundingPriority = "lessPrecision";
235
+ }
236
+ str.replace(SIGNIFICANT_PRECISION_REGEX, function(_, g1, g2) {
237
+ // @@@ case
238
+ if (typeof g2 !== "string") {
239
+ result.minimumSignificantDigits = g1.length;
240
+ result.maximumSignificantDigits = g1.length;
241
+ } else if (g2 === "+") {
242
+ result.minimumSignificantDigits = g1.length;
243
+ } else if (g1[0] === "#") {
244
+ result.maximumSignificantDigits = g1.length;
245
+ } else {
246
+ result.minimumSignificantDigits = g1.length;
247
+ result.maximumSignificantDigits = g1.length + (typeof g2 === "string" ? g2.length : 0);
248
+ }
249
+ return "";
250
+ });
251
+ return result;
252
+ }
253
+ function parseSign(str) {
254
+ switch (str) {
255
+ case "sign-auto": return { signDisplay: "auto" };
256
+ case "sign-accounting":
257
+ case "()": return { currencySign: "accounting" };
258
+ case "sign-always":
259
+ case "+!": return { signDisplay: "always" };
260
+ case "sign-accounting-always":
261
+ case "()!": return {
262
+ signDisplay: "always",
263
+ currencySign: "accounting"
264
+ };
265
+ case "sign-except-zero":
266
+ case "+?": return { signDisplay: "exceptZero" };
267
+ case "sign-accounting-except-zero":
268
+ case "()?": return {
269
+ signDisplay: "exceptZero",
270
+ currencySign: "accounting"
271
+ };
272
+ case "sign-never":
273
+ case "+_": return { signDisplay: "never" };
274
+ }
275
+ }
276
+ function parseConciseScientificAndEngineeringStem(stem) {
277
+ // Engineering
278
+ let result;
279
+ if (stem[0] === "E" && stem[1] === "E") {
280
+ result = { notation: "engineering" };
281
+ stem = stem.slice(2);
282
+ } else if (stem[0] === "E") {
283
+ result = { notation: "scientific" };
284
+ stem = stem.slice(1);
285
+ }
286
+ if (result) {
287
+ const signDisplay = stem.slice(0, 2);
288
+ if (signDisplay === "+!") {
289
+ result.signDisplay = "always";
290
+ stem = stem.slice(2);
291
+ } else if (signDisplay === "+?") {
292
+ result.signDisplay = "exceptZero";
293
+ stem = stem.slice(2);
294
+ }
295
+ if (!CONCISE_INTEGER_WIDTH_REGEX.test(stem)) {
296
+ throw new Error("Malformed concise eng/scientific notation");
297
+ }
298
+ result.minimumIntegerDigits = stem.length;
299
+ }
300
+ return result;
301
+ }
302
+ function parseNotationOptions(opt) {
303
+ const result = {};
304
+ const signOpts = parseSign(opt);
305
+ if (signOpts) {
306
+ return signOpts;
307
+ }
308
+ return result;
309
+ }
310
+ /**
311
+ * https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#skeleton-stems-and-options
312
+ */
313
+ function parseNumberSkeleton(tokens) {
314
+ let result = {};
315
+ for (const token of tokens) {
316
+ switch (token.stem) {
317
+ case "percent":
318
+ case "%":
319
+ result.style = "percent";
320
+ continue;
321
+ case "%x100":
322
+ result.style = "percent";
323
+ result.scale = 100;
324
+ continue;
325
+ case "currency":
326
+ result.style = "currency";
327
+ result.currency = token.options[0];
328
+ continue;
329
+ case "group-off":
330
+ case ",_":
331
+ result.useGrouping = false;
332
+ continue;
333
+ case "precision-integer":
334
+ case ".":
335
+ result.maximumFractionDigits = 0;
336
+ continue;
337
+ case "measure-unit":
338
+ case "unit":
339
+ result.style = "unit";
340
+ result.unit = icuUnitToEcma(token.options[0]);
341
+ continue;
342
+ case "compact-short":
343
+ case "K":
344
+ result.notation = "compact";
345
+ result.compactDisplay = "short";
346
+ continue;
347
+ case "compact-long":
348
+ case "KK":
349
+ result.notation = "compact";
350
+ result.compactDisplay = "long";
351
+ continue;
352
+ case "scientific":
353
+ result = {
354
+ ...result,
355
+ notation: "scientific",
356
+ ...token.options.reduce((all, opt) => ({
357
+ ...all,
358
+ ...parseNotationOptions(opt)
359
+ }), {})
360
+ };
361
+ continue;
362
+ case "engineering":
363
+ result = {
364
+ ...result,
365
+ notation: "engineering",
366
+ ...token.options.reduce((all, opt) => ({
367
+ ...all,
368
+ ...parseNotationOptions(opt)
369
+ }), {})
370
+ };
371
+ continue;
372
+ case "notation-simple":
373
+ result.notation = "standard";
374
+ continue;
375
+ case "unit-width-narrow":
376
+ result.currencyDisplay = "narrowSymbol";
377
+ result.unitDisplay = "narrow";
378
+ continue;
379
+ case "unit-width-short":
380
+ result.currencyDisplay = "code";
381
+ result.unitDisplay = "short";
382
+ continue;
383
+ case "unit-width-full-name":
384
+ result.currencyDisplay = "name";
385
+ result.unitDisplay = "long";
386
+ continue;
387
+ case "unit-width-iso-code":
388
+ result.currencyDisplay = "symbol";
389
+ continue;
390
+ case "scale":
391
+ result.scale = parseFloat(token.options[0]);
392
+ continue;
393
+ case "rounding-mode-floor":
394
+ result.roundingMode = "floor";
395
+ continue;
396
+ case "rounding-mode-ceiling":
397
+ result.roundingMode = "ceil";
398
+ continue;
399
+ case "rounding-mode-down":
400
+ result.roundingMode = "trunc";
401
+ continue;
402
+ case "rounding-mode-up":
403
+ result.roundingMode = "expand";
404
+ continue;
405
+ case "rounding-mode-half-even":
406
+ result.roundingMode = "halfEven";
407
+ continue;
408
+ case "rounding-mode-half-down":
409
+ result.roundingMode = "halfTrunc";
410
+ continue;
411
+ case "rounding-mode-half-up":
412
+ result.roundingMode = "halfExpand";
413
+ continue;
414
+ case "integer-width":
415
+ if (token.options.length > 1) {
416
+ throw new RangeError("integer-width stems only accept a single optional option");
417
+ }
418
+ token.options[0].replace(INTEGER_WIDTH_REGEX, function(_, g1, g2, g3, g4, g5) {
419
+ if (g1) {
420
+ result.minimumIntegerDigits = g2.length;
421
+ } else if (g3 && g4) {
422
+ throw new Error("We currently do not support maximum integer digits");
423
+ } else if (g5) {
424
+ throw new Error("We currently do not support exact integer digits");
425
+ }
426
+ return "";
427
+ });
428
+ continue;
429
+ }
430
+ // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width
431
+ if (CONCISE_INTEGER_WIDTH_REGEX.test(token.stem)) {
432
+ result.minimumIntegerDigits = token.stem.length;
433
+ continue;
434
+ }
435
+ if (FRACTION_PRECISION_REGEX.test(token.stem)) {
436
+ // Precision
437
+ // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#fraction-precision
438
+ // precision-integer case
439
+ if (token.options.length > 1) {
440
+ throw new RangeError("Fraction-precision stems only accept a single optional option");
441
+ }
442
+ token.stem.replace(FRACTION_PRECISION_REGEX, function(_, g1, g2, g3, g4, g5) {
443
+ // .000* case (before ICU67 it was .000+)
444
+ if (g2 === "*") {
445
+ result.minimumFractionDigits = g1.length;
446
+ } else if (g3 && g3[0] === "#") {
447
+ result.maximumFractionDigits = g3.length;
448
+ } else if (g4 && g5) {
449
+ result.minimumFractionDigits = g4.length;
450
+ result.maximumFractionDigits = g4.length + g5.length;
451
+ } else {
452
+ result.minimumFractionDigits = g1.length;
453
+ result.maximumFractionDigits = g1.length;
454
+ }
455
+ return "";
456
+ });
457
+ const opt = token.options[0];
458
+ // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#trailing-zero-display
459
+ if (opt === "w") {
460
+ result = {
461
+ ...result,
462
+ trailingZeroDisplay: "stripIfInteger"
463
+ };
464
+ } else if (opt) {
465
+ result = {
466
+ ...result,
467
+ ...parseSignificantPrecision(opt)
468
+ };
469
+ }
470
+ continue;
471
+ }
472
+ // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#significant-digits-precision
473
+ if (SIGNIFICANT_PRECISION_REGEX.test(token.stem)) {
474
+ result = {
475
+ ...result,
476
+ ...parseSignificantPrecision(token.stem)
477
+ };
478
+ continue;
479
+ }
480
+ const signOpts = parseSign(token.stem);
481
+ if (signOpts) {
482
+ result = {
483
+ ...result,
484
+ ...signOpts
485
+ };
486
+ }
487
+ const conciseScientificAndEngineeringOpts = parseConciseScientificAndEngineeringStem(token.stem);
488
+ if (conciseScientificAndEngineeringOpts) {
489
+ result = {
490
+ ...result,
491
+ ...conciseScientificAndEngineeringOpts
492
+ };
493
+ }
494
+ }
495
+ return result;
496
+ }
497
+
498
+ let TYPE = /* @__PURE__ */ function(TYPE) {
499
+ /**
500
+ * Raw text
501
+ */
502
+ TYPE[TYPE["literal"] = 0] = "literal";
503
+ /**
504
+ * Variable w/o any format, e.g `var` in `this is a {var}`
505
+ */
506
+ TYPE[TYPE["argument"] = 1] = "argument";
507
+ /**
508
+ * Variable w/ number format
509
+ */
510
+ TYPE[TYPE["number"] = 2] = "number";
511
+ /**
512
+ * Variable w/ date format
513
+ */
514
+ TYPE[TYPE["date"] = 3] = "date";
515
+ /**
516
+ * Variable w/ time format
517
+ */
518
+ TYPE[TYPE["time"] = 4] = "time";
519
+ /**
520
+ * Variable w/ select format
521
+ */
522
+ TYPE[TYPE["select"] = 5] = "select";
523
+ /**
524
+ * Variable w/ plural format
525
+ */
526
+ TYPE[TYPE["plural"] = 6] = "plural";
527
+ /**
528
+ * Only possible within plural argument.
529
+ * This is the `#` symbol that will be substituted with the count.
530
+ */
531
+ TYPE[TYPE["pound"] = 7] = "pound";
532
+ /**
533
+ * XML-like tag
534
+ */
535
+ TYPE[TYPE["tag"] = 8] = "tag";
536
+ return TYPE;
537
+ }({});
538
+ let SKELETON_TYPE = /* @__PURE__ */ function(SKELETON_TYPE) {
539
+ SKELETON_TYPE[SKELETON_TYPE["number"] = 0] = "number";
540
+ SKELETON_TYPE[SKELETON_TYPE["dateTime"] = 1] = "dateTime";
541
+ return SKELETON_TYPE;
542
+ }({});
543
+ /**
544
+ * Type Guards
545
+ */
546
+ function isLiteralElement(el) {
547
+ return el.type === TYPE.literal;
548
+ }
549
+ function isArgumentElement(el) {
550
+ return el.type === TYPE.argument;
551
+ }
552
+ function isNumberElement(el) {
553
+ return el.type === TYPE.number;
554
+ }
555
+ function isDateElement(el) {
556
+ return el.type === TYPE.date;
557
+ }
558
+ function isTimeElement(el) {
559
+ return el.type === TYPE.time;
560
+ }
561
+ function isSelectElement(el) {
562
+ return el.type === TYPE.select;
563
+ }
564
+ function isPluralElement(el) {
565
+ return el.type === TYPE.plural;
566
+ }
567
+ function isPoundElement(el) {
568
+ return el.type === TYPE.pound;
569
+ }
570
+ function isTagElement(el) {
571
+ return el.type === TYPE.tag;
572
+ }
573
+ function isNumberSkeleton(el) {
574
+ return !!(el && typeof el === "object" && el.type === SKELETON_TYPE.number);
575
+ }
576
+ function isDateTimeSkeleton(el) {
577
+ return !!(el && typeof el === "object" && el.type === SKELETON_TYPE.dateTime);
578
+ }
579
+
580
+ let ErrorKind = /* @__PURE__ */ function(ErrorKind) {
581
+ /** Argument is unclosed (e.g. `{0`) */
582
+ ErrorKind[ErrorKind["EXPECT_ARGUMENT_CLOSING_BRACE"] = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE";
583
+ /** Argument is empty (e.g. `{}`). */
584
+ ErrorKind[ErrorKind["EMPTY_ARGUMENT"] = 2] = "EMPTY_ARGUMENT";
585
+ /** Argument is malformed (e.g. `{foo!}``) */
586
+ ErrorKind[ErrorKind["MALFORMED_ARGUMENT"] = 3] = "MALFORMED_ARGUMENT";
587
+ /** Expect an argument type (e.g. `{foo,}`) */
588
+ ErrorKind[ErrorKind["EXPECT_ARGUMENT_TYPE"] = 4] = "EXPECT_ARGUMENT_TYPE";
589
+ /** Unsupported argument type (e.g. `{foo,foo}`) */
590
+ ErrorKind[ErrorKind["INVALID_ARGUMENT_TYPE"] = 5] = "INVALID_ARGUMENT_TYPE";
591
+ /** Expect an argument style (e.g. `{foo, number, }`) */
592
+ ErrorKind[ErrorKind["EXPECT_ARGUMENT_STYLE"] = 6] = "EXPECT_ARGUMENT_STYLE";
593
+ /** The number skeleton is invalid. */
594
+ ErrorKind[ErrorKind["INVALID_NUMBER_SKELETON"] = 7] = "INVALID_NUMBER_SKELETON";
595
+ /** The date time skeleton is invalid. */
596
+ ErrorKind[ErrorKind["INVALID_DATE_TIME_SKELETON"] = 8] = "INVALID_DATE_TIME_SKELETON";
597
+ /** Exepct a number skeleton following the `::` (e.g. `{foo, number, ::}`) */
598
+ ErrorKind[ErrorKind["EXPECT_NUMBER_SKELETON"] = 9] = "EXPECT_NUMBER_SKELETON";
599
+ /** Exepct a date time skeleton following the `::` (e.g. `{foo, date, ::}`) */
600
+ ErrorKind[ErrorKind["EXPECT_DATE_TIME_SKELETON"] = 10] = "EXPECT_DATE_TIME_SKELETON";
601
+ /** Unmatched apostrophes in the argument style (e.g. `{foo, number, 'test`) */
602
+ ErrorKind[ErrorKind["UNCLOSED_QUOTE_IN_ARGUMENT_STYLE"] = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE";
603
+ /** Missing select argument options (e.g. `{foo, select}`) */
604
+ ErrorKind[ErrorKind["EXPECT_SELECT_ARGUMENT_OPTIONS"] = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS";
605
+ /** Expecting an offset value in `plural` or `selectordinal` argument (e.g `{foo, plural, offset}`) */
606
+ ErrorKind[ErrorKind["EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE"] = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE";
607
+ /** Offset value in `plural` or `selectordinal` is invalid (e.g. `{foo, plural, offset: x}`) */
608
+ ErrorKind[ErrorKind["INVALID_PLURAL_ARGUMENT_OFFSET_VALUE"] = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE";
609
+ /** Expecting a selector in `select` argument (e.g `{foo, select}`) */
610
+ ErrorKind[ErrorKind["EXPECT_SELECT_ARGUMENT_SELECTOR"] = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR";
611
+ /** Expecting a selector in `plural` or `selectordinal` argument (e.g `{foo, plural}`) */
612
+ ErrorKind[ErrorKind["EXPECT_PLURAL_ARGUMENT_SELECTOR"] = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR";
613
+ /** Expecting a message fragment after the `select` selector (e.g. `{foo, select, apple}`) */
614
+ ErrorKind[ErrorKind["EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT"] = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT";
615
+ /**
616
+ * Expecting a message fragment after the `plural` or `selectordinal` selector
617
+ * (e.g. `{foo, plural, one}`)
618
+ */
619
+ ErrorKind[ErrorKind["EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT"] = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT";
620
+ /** Selector in `plural` or `selectordinal` is malformed (e.g. `{foo, plural, =x {#}}`) */
621
+ ErrorKind[ErrorKind["INVALID_PLURAL_ARGUMENT_SELECTOR"] = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR";
622
+ /**
623
+ * Duplicate selectors in `plural` or `selectordinal` argument.
624
+ * (e.g. {foo, plural, one {#} one {#}})
625
+ */
626
+ ErrorKind[ErrorKind["DUPLICATE_PLURAL_ARGUMENT_SELECTOR"] = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR";
627
+ /** Duplicate selectors in `select` argument.
628
+ * (e.g. {foo, select, apple {apple} apple {apple}})
629
+ */
630
+ ErrorKind[ErrorKind["DUPLICATE_SELECT_ARGUMENT_SELECTOR"] = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR";
631
+ /** Plural or select argument option must have `other` clause. */
632
+ ErrorKind[ErrorKind["MISSING_OTHER_CLAUSE"] = 22] = "MISSING_OTHER_CLAUSE";
633
+ /** The tag is malformed. (e.g. `<bold!>foo</bold!>) */
634
+ ErrorKind[ErrorKind["INVALID_TAG"] = 23] = "INVALID_TAG";
635
+ /** The tag name is invalid. (e.g. `<123>foo</123>`) */
636
+ ErrorKind[ErrorKind["INVALID_TAG_NAME"] = 25] = "INVALID_TAG_NAME";
637
+ /** The closing tag does not match the opening tag. (e.g. `<bold>foo</italic>`) */
638
+ ErrorKind[ErrorKind["UNMATCHED_CLOSING_TAG"] = 26] = "UNMATCHED_CLOSING_TAG";
639
+ /** The opening tag has unmatched closing tag. (e.g. `<bold>foo`) */
640
+ ErrorKind[ErrorKind["UNCLOSED_TAG"] = 27] = "UNCLOSED_TAG";
641
+ return ErrorKind;
642
+ }({});
643
+
644
+ // @generated from regex-gen.ts
645
+ const SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/;
646
+
647
+ // @generated from time-data-gen.ts
648
+ // prettier-ignore
649
+ const timeData = {
650
+ "001": ["H", "h"],
651
+ "419": [
652
+ "h",
653
+ "H",
654
+ "hB",
655
+ "hb"
656
+ ],
657
+ "AC": [
658
+ "H",
659
+ "h",
660
+ "hb",
661
+ "hB"
662
+ ],
663
+ "AD": ["H", "hB"],
664
+ "AE": [
665
+ "h",
666
+ "hB",
667
+ "hb",
668
+ "H"
669
+ ],
670
+ "AF": [
671
+ "H",
672
+ "hb",
673
+ "hB",
674
+ "h"
675
+ ],
676
+ "AG": [
677
+ "h",
678
+ "hb",
679
+ "H",
680
+ "hB"
681
+ ],
682
+ "AI": [
683
+ "H",
684
+ "h",
685
+ "hb",
686
+ "hB"
687
+ ],
688
+ "AL": [
689
+ "h",
690
+ "H",
691
+ "hB"
692
+ ],
693
+ "AM": ["H", "hB"],
694
+ "AO": ["H", "hB"],
695
+ "AR": [
696
+ "h",
697
+ "H",
698
+ "hB",
699
+ "hb"
700
+ ],
701
+ "AS": ["h", "H"],
702
+ "AT": ["H", "hB"],
703
+ "AU": [
704
+ "h",
705
+ "hb",
706
+ "H",
707
+ "hB"
708
+ ],
709
+ "AW": ["H", "hB"],
710
+ "AX": ["H"],
711
+ "AZ": [
712
+ "H",
713
+ "hB",
714
+ "h"
715
+ ],
716
+ "BA": [
717
+ "H",
718
+ "hB",
719
+ "h"
720
+ ],
721
+ "BB": [
722
+ "h",
723
+ "hb",
724
+ "H",
725
+ "hB"
726
+ ],
727
+ "BD": [
728
+ "h",
729
+ "hB",
730
+ "H"
731
+ ],
732
+ "BE": ["H", "hB"],
733
+ "BF": ["H", "hB"],
734
+ "BG": [
735
+ "H",
736
+ "hB",
737
+ "h"
738
+ ],
739
+ "BH": [
740
+ "h",
741
+ "hB",
742
+ "hb",
743
+ "H"
744
+ ],
745
+ "BI": ["H", "h"],
746
+ "BJ": ["H", "hB"],
747
+ "BL": ["H", "hB"],
748
+ "BM": [
749
+ "h",
750
+ "hb",
751
+ "H",
752
+ "hB"
753
+ ],
754
+ "BN": [
755
+ "hb",
756
+ "hB",
757
+ "h",
758
+ "H"
759
+ ],
760
+ "BO": [
761
+ "h",
762
+ "H",
763
+ "hB",
764
+ "hb"
765
+ ],
766
+ "BQ": ["H"],
767
+ "BR": ["H", "hB"],
768
+ "BS": [
769
+ "h",
770
+ "hb",
771
+ "H",
772
+ "hB"
773
+ ],
774
+ "BT": ["h", "H"],
775
+ "BW": [
776
+ "H",
777
+ "h",
778
+ "hb",
779
+ "hB"
780
+ ],
781
+ "BY": ["H", "h"],
782
+ "BZ": [
783
+ "H",
784
+ "h",
785
+ "hb",
786
+ "hB"
787
+ ],
788
+ "CA": [
789
+ "h",
790
+ "hb",
791
+ "H",
792
+ "hB"
793
+ ],
794
+ "CC": [
795
+ "H",
796
+ "h",
797
+ "hb",
798
+ "hB"
799
+ ],
800
+ "CD": ["hB", "H"],
801
+ "CF": [
802
+ "H",
803
+ "h",
804
+ "hB"
805
+ ],
806
+ "CG": ["H", "hB"],
807
+ "CH": [
808
+ "H",
809
+ "hB",
810
+ "h"
811
+ ],
812
+ "CI": ["H", "hB"],
813
+ "CK": [
814
+ "H",
815
+ "h",
816
+ "hb",
817
+ "hB"
818
+ ],
819
+ "CL": [
820
+ "h",
821
+ "H",
822
+ "hB",
823
+ "hb"
824
+ ],
825
+ "CM": [
826
+ "H",
827
+ "h",
828
+ "hB"
829
+ ],
830
+ "CN": [
831
+ "H",
832
+ "hB",
833
+ "hb",
834
+ "h"
835
+ ],
836
+ "CO": [
837
+ "h",
838
+ "H",
839
+ "hB",
840
+ "hb"
841
+ ],
842
+ "CP": ["H"],
843
+ "CR": [
844
+ "h",
845
+ "H",
846
+ "hB",
847
+ "hb"
848
+ ],
849
+ "CU": [
850
+ "h",
851
+ "H",
852
+ "hB",
853
+ "hb"
854
+ ],
855
+ "CV": ["H", "hB"],
856
+ "CW": ["H", "hB"],
857
+ "CX": [
858
+ "H",
859
+ "h",
860
+ "hb",
861
+ "hB"
862
+ ],
863
+ "CY": [
864
+ "h",
865
+ "H",
866
+ "hb",
867
+ "hB"
868
+ ],
869
+ "CZ": ["H"],
870
+ "DE": ["H", "hB"],
871
+ "DG": [
872
+ "H",
873
+ "h",
874
+ "hb",
875
+ "hB"
876
+ ],
877
+ "DJ": ["h", "H"],
878
+ "DK": ["H"],
879
+ "DM": [
880
+ "h",
881
+ "hb",
882
+ "H",
883
+ "hB"
884
+ ],
885
+ "DO": [
886
+ "h",
887
+ "H",
888
+ "hB",
889
+ "hb"
890
+ ],
891
+ "DZ": [
892
+ "h",
893
+ "hB",
894
+ "hb",
895
+ "H"
896
+ ],
897
+ "EA": [
898
+ "H",
899
+ "h",
900
+ "hB",
901
+ "hb"
902
+ ],
903
+ "EC": [
904
+ "h",
905
+ "H",
906
+ "hB",
907
+ "hb"
908
+ ],
909
+ "EE": ["H", "hB"],
910
+ "EG": [
911
+ "h",
912
+ "hB",
913
+ "hb",
914
+ "H"
915
+ ],
916
+ "EH": [
917
+ "h",
918
+ "hB",
919
+ "hb",
920
+ "H"
921
+ ],
922
+ "ER": ["h", "H"],
923
+ "ES": [
924
+ "H",
925
+ "hB",
926
+ "h",
927
+ "hb"
928
+ ],
929
+ "ET": [
930
+ "hB",
931
+ "hb",
932
+ "h",
933
+ "H"
934
+ ],
935
+ "FI": ["H"],
936
+ "FJ": [
937
+ "h",
938
+ "hb",
939
+ "H",
940
+ "hB"
941
+ ],
942
+ "FK": [
943
+ "H",
944
+ "h",
945
+ "hb",
946
+ "hB"
947
+ ],
948
+ "FM": [
949
+ "h",
950
+ "hb",
951
+ "H",
952
+ "hB"
953
+ ],
954
+ "FO": ["H", "h"],
955
+ "FR": ["H", "hB"],
956
+ "GA": ["H", "hB"],
957
+ "GB": [
958
+ "H",
959
+ "h",
960
+ "hb",
961
+ "hB"
962
+ ],
963
+ "GD": [
964
+ "h",
965
+ "hb",
966
+ "H",
967
+ "hB"
968
+ ],
969
+ "GE": [
970
+ "H",
971
+ "hB",
972
+ "h"
973
+ ],
974
+ "GF": ["H", "hB"],
975
+ "GG": [
976
+ "H",
977
+ "h",
978
+ "hb",
979
+ "hB"
980
+ ],
981
+ "GH": ["h", "H"],
982
+ "GI": [
983
+ "H",
984
+ "h",
985
+ "hb",
986
+ "hB"
987
+ ],
988
+ "GL": ["H", "h"],
989
+ "GM": [
990
+ "h",
991
+ "hb",
992
+ "H",
993
+ "hB"
994
+ ],
995
+ "GN": ["H", "hB"],
996
+ "GP": ["H", "hB"],
997
+ "GQ": [
998
+ "H",
999
+ "hB",
1000
+ "h",
1001
+ "hb"
1002
+ ],
1003
+ "GR": [
1004
+ "h",
1005
+ "H",
1006
+ "hb",
1007
+ "hB"
1008
+ ],
1009
+ "GS": [
1010
+ "H",
1011
+ "h",
1012
+ "hb",
1013
+ "hB"
1014
+ ],
1015
+ "GT": [
1016
+ "h",
1017
+ "H",
1018
+ "hB",
1019
+ "hb"
1020
+ ],
1021
+ "GU": [
1022
+ "h",
1023
+ "hb",
1024
+ "H",
1025
+ "hB"
1026
+ ],
1027
+ "GW": ["H", "hB"],
1028
+ "GY": [
1029
+ "h",
1030
+ "hb",
1031
+ "H",
1032
+ "hB"
1033
+ ],
1034
+ "HK": [
1035
+ "h",
1036
+ "hB",
1037
+ "hb",
1038
+ "H"
1039
+ ],
1040
+ "HN": [
1041
+ "h",
1042
+ "H",
1043
+ "hB",
1044
+ "hb"
1045
+ ],
1046
+ "HR": ["H", "hB"],
1047
+ "HU": ["H", "h"],
1048
+ "IC": [
1049
+ "H",
1050
+ "h",
1051
+ "hB",
1052
+ "hb"
1053
+ ],
1054
+ "ID": ["H"],
1055
+ "IE": [
1056
+ "H",
1057
+ "h",
1058
+ "hb",
1059
+ "hB"
1060
+ ],
1061
+ "IL": ["H", "hB"],
1062
+ "IM": [
1063
+ "H",
1064
+ "h",
1065
+ "hb",
1066
+ "hB"
1067
+ ],
1068
+ "IN": ["h", "H"],
1069
+ "IO": [
1070
+ "H",
1071
+ "h",
1072
+ "hb",
1073
+ "hB"
1074
+ ],
1075
+ "IQ": [
1076
+ "h",
1077
+ "hB",
1078
+ "hb",
1079
+ "H"
1080
+ ],
1081
+ "IR": ["hB", "H"],
1082
+ "IS": ["H"],
1083
+ "IT": ["H", "hB"],
1084
+ "JE": [
1085
+ "H",
1086
+ "h",
1087
+ "hb",
1088
+ "hB"
1089
+ ],
1090
+ "JM": [
1091
+ "h",
1092
+ "hb",
1093
+ "H",
1094
+ "hB"
1095
+ ],
1096
+ "JO": [
1097
+ "h",
1098
+ "hB",
1099
+ "hb",
1100
+ "H"
1101
+ ],
1102
+ "JP": [
1103
+ "H",
1104
+ "K",
1105
+ "h"
1106
+ ],
1107
+ "KE": [
1108
+ "hB",
1109
+ "hb",
1110
+ "H",
1111
+ "h"
1112
+ ],
1113
+ "KG": [
1114
+ "H",
1115
+ "h",
1116
+ "hB",
1117
+ "hb"
1118
+ ],
1119
+ "KH": [
1120
+ "hB",
1121
+ "h",
1122
+ "H",
1123
+ "hb"
1124
+ ],
1125
+ "KI": [
1126
+ "h",
1127
+ "hb",
1128
+ "H",
1129
+ "hB"
1130
+ ],
1131
+ "KM": [
1132
+ "H",
1133
+ "h",
1134
+ "hB",
1135
+ "hb"
1136
+ ],
1137
+ "KN": [
1138
+ "h",
1139
+ "hb",
1140
+ "H",
1141
+ "hB"
1142
+ ],
1143
+ "KP": [
1144
+ "h",
1145
+ "H",
1146
+ "hB",
1147
+ "hb"
1148
+ ],
1149
+ "KR": [
1150
+ "h",
1151
+ "H",
1152
+ "hB",
1153
+ "hb"
1154
+ ],
1155
+ "KW": [
1156
+ "h",
1157
+ "hB",
1158
+ "hb",
1159
+ "H"
1160
+ ],
1161
+ "KY": [
1162
+ "h",
1163
+ "hb",
1164
+ "H",
1165
+ "hB"
1166
+ ],
1167
+ "KZ": ["H", "hB"],
1168
+ "LA": [
1169
+ "H",
1170
+ "hb",
1171
+ "hB",
1172
+ "h"
1173
+ ],
1174
+ "LB": [
1175
+ "h",
1176
+ "hB",
1177
+ "hb",
1178
+ "H"
1179
+ ],
1180
+ "LC": [
1181
+ "h",
1182
+ "hb",
1183
+ "H",
1184
+ "hB"
1185
+ ],
1186
+ "LI": [
1187
+ "H",
1188
+ "hB",
1189
+ "h"
1190
+ ],
1191
+ "LK": [
1192
+ "H",
1193
+ "h",
1194
+ "hB",
1195
+ "hb"
1196
+ ],
1197
+ "LR": [
1198
+ "h",
1199
+ "hb",
1200
+ "H",
1201
+ "hB"
1202
+ ],
1203
+ "LS": ["h", "H"],
1204
+ "LT": [
1205
+ "H",
1206
+ "h",
1207
+ "hb",
1208
+ "hB"
1209
+ ],
1210
+ "LU": [
1211
+ "H",
1212
+ "h",
1213
+ "hB"
1214
+ ],
1215
+ "LV": [
1216
+ "H",
1217
+ "hB",
1218
+ "hb",
1219
+ "h"
1220
+ ],
1221
+ "LY": [
1222
+ "h",
1223
+ "hB",
1224
+ "hb",
1225
+ "H"
1226
+ ],
1227
+ "MA": [
1228
+ "H",
1229
+ "h",
1230
+ "hB",
1231
+ "hb"
1232
+ ],
1233
+ "MC": ["H", "hB"],
1234
+ "MD": ["H", "hB"],
1235
+ "ME": [
1236
+ "H",
1237
+ "hB",
1238
+ "h"
1239
+ ],
1240
+ "MF": ["H", "hB"],
1241
+ "MG": ["H", "h"],
1242
+ "MH": [
1243
+ "h",
1244
+ "hb",
1245
+ "H",
1246
+ "hB"
1247
+ ],
1248
+ "MK": [
1249
+ "H",
1250
+ "h",
1251
+ "hb",
1252
+ "hB"
1253
+ ],
1254
+ "ML": ["H"],
1255
+ "MM": [
1256
+ "hB",
1257
+ "hb",
1258
+ "H",
1259
+ "h"
1260
+ ],
1261
+ "MN": [
1262
+ "H",
1263
+ "h",
1264
+ "hb",
1265
+ "hB"
1266
+ ],
1267
+ "MO": [
1268
+ "h",
1269
+ "hB",
1270
+ "hb",
1271
+ "H"
1272
+ ],
1273
+ "MP": [
1274
+ "h",
1275
+ "hb",
1276
+ "H",
1277
+ "hB"
1278
+ ],
1279
+ "MQ": ["H", "hB"],
1280
+ "MR": [
1281
+ "h",
1282
+ "hB",
1283
+ "hb",
1284
+ "H"
1285
+ ],
1286
+ "MS": [
1287
+ "H",
1288
+ "h",
1289
+ "hb",
1290
+ "hB"
1291
+ ],
1292
+ "MT": ["H", "h"],
1293
+ "MU": ["H", "h"],
1294
+ "MV": ["H", "h"],
1295
+ "MW": [
1296
+ "h",
1297
+ "hb",
1298
+ "H",
1299
+ "hB"
1300
+ ],
1301
+ "MX": [
1302
+ "h",
1303
+ "H",
1304
+ "hB",
1305
+ "hb"
1306
+ ],
1307
+ "MY": [
1308
+ "hb",
1309
+ "hB",
1310
+ "h",
1311
+ "H"
1312
+ ],
1313
+ "MZ": ["H", "hB"],
1314
+ "NA": [
1315
+ "h",
1316
+ "H",
1317
+ "hB",
1318
+ "hb"
1319
+ ],
1320
+ "NC": ["H", "hB"],
1321
+ "NE": ["H"],
1322
+ "NF": [
1323
+ "H",
1324
+ "h",
1325
+ "hb",
1326
+ "hB"
1327
+ ],
1328
+ "NG": [
1329
+ "H",
1330
+ "h",
1331
+ "hb",
1332
+ "hB"
1333
+ ],
1334
+ "NI": [
1335
+ "h",
1336
+ "H",
1337
+ "hB",
1338
+ "hb"
1339
+ ],
1340
+ "NL": ["H", "hB"],
1341
+ "NO": ["H", "h"],
1342
+ "NP": [
1343
+ "H",
1344
+ "h",
1345
+ "hB"
1346
+ ],
1347
+ "NR": [
1348
+ "H",
1349
+ "h",
1350
+ "hb",
1351
+ "hB"
1352
+ ],
1353
+ "NU": [
1354
+ "H",
1355
+ "h",
1356
+ "hb",
1357
+ "hB"
1358
+ ],
1359
+ "NZ": [
1360
+ "h",
1361
+ "hb",
1362
+ "H",
1363
+ "hB"
1364
+ ],
1365
+ "OM": [
1366
+ "h",
1367
+ "hB",
1368
+ "hb",
1369
+ "H"
1370
+ ],
1371
+ "PA": [
1372
+ "h",
1373
+ "H",
1374
+ "hB",
1375
+ "hb"
1376
+ ],
1377
+ "PE": [
1378
+ "h",
1379
+ "H",
1380
+ "hB",
1381
+ "hb"
1382
+ ],
1383
+ "PF": [
1384
+ "H",
1385
+ "h",
1386
+ "hB"
1387
+ ],
1388
+ "PG": ["h", "H"],
1389
+ "PH": [
1390
+ "h",
1391
+ "hB",
1392
+ "hb",
1393
+ "H"
1394
+ ],
1395
+ "PK": [
1396
+ "h",
1397
+ "hB",
1398
+ "H"
1399
+ ],
1400
+ "PL": ["H", "h"],
1401
+ "PM": ["H", "hB"],
1402
+ "PN": [
1403
+ "H",
1404
+ "h",
1405
+ "hb",
1406
+ "hB"
1407
+ ],
1408
+ "PR": [
1409
+ "h",
1410
+ "H",
1411
+ "hB",
1412
+ "hb"
1413
+ ],
1414
+ "PS": [
1415
+ "h",
1416
+ "hB",
1417
+ "hb",
1418
+ "H"
1419
+ ],
1420
+ "PT": ["H", "hB"],
1421
+ "PW": ["h", "H"],
1422
+ "PY": [
1423
+ "h",
1424
+ "H",
1425
+ "hB",
1426
+ "hb"
1427
+ ],
1428
+ "QA": [
1429
+ "h",
1430
+ "hB",
1431
+ "hb",
1432
+ "H"
1433
+ ],
1434
+ "RE": ["H", "hB"],
1435
+ "RO": ["H", "hB"],
1436
+ "RS": [
1437
+ "H",
1438
+ "hB",
1439
+ "h"
1440
+ ],
1441
+ "RU": ["H"],
1442
+ "RW": ["H", "h"],
1443
+ "SA": [
1444
+ "h",
1445
+ "hB",
1446
+ "hb",
1447
+ "H"
1448
+ ],
1449
+ "SB": [
1450
+ "h",
1451
+ "hb",
1452
+ "H",
1453
+ "hB"
1454
+ ],
1455
+ "SC": [
1456
+ "H",
1457
+ "h",
1458
+ "hB"
1459
+ ],
1460
+ "SD": [
1461
+ "h",
1462
+ "hB",
1463
+ "hb",
1464
+ "H"
1465
+ ],
1466
+ "SE": ["H"],
1467
+ "SG": [
1468
+ "h",
1469
+ "hb",
1470
+ "H",
1471
+ "hB"
1472
+ ],
1473
+ "SH": [
1474
+ "H",
1475
+ "h",
1476
+ "hb",
1477
+ "hB"
1478
+ ],
1479
+ "SI": ["H", "hB"],
1480
+ "SJ": ["H"],
1481
+ "SK": ["H"],
1482
+ "SL": [
1483
+ "h",
1484
+ "hb",
1485
+ "H",
1486
+ "hB"
1487
+ ],
1488
+ "SM": [
1489
+ "H",
1490
+ "h",
1491
+ "hB"
1492
+ ],
1493
+ "SN": [
1494
+ "H",
1495
+ "h",
1496
+ "hB"
1497
+ ],
1498
+ "SO": ["h", "H"],
1499
+ "SR": ["H", "hB"],
1500
+ "SS": [
1501
+ "h",
1502
+ "hb",
1503
+ "H",
1504
+ "hB"
1505
+ ],
1506
+ "ST": ["H", "hB"],
1507
+ "SV": [
1508
+ "h",
1509
+ "H",
1510
+ "hB",
1511
+ "hb"
1512
+ ],
1513
+ "SX": [
1514
+ "H",
1515
+ "h",
1516
+ "hb",
1517
+ "hB"
1518
+ ],
1519
+ "SY": [
1520
+ "h",
1521
+ "hB",
1522
+ "hb",
1523
+ "H"
1524
+ ],
1525
+ "SZ": [
1526
+ "h",
1527
+ "hb",
1528
+ "H",
1529
+ "hB"
1530
+ ],
1531
+ "TA": [
1532
+ "H",
1533
+ "h",
1534
+ "hb",
1535
+ "hB"
1536
+ ],
1537
+ "TC": [
1538
+ "h",
1539
+ "hb",
1540
+ "H",
1541
+ "hB"
1542
+ ],
1543
+ "TD": [
1544
+ "h",
1545
+ "H",
1546
+ "hB"
1547
+ ],
1548
+ "TF": [
1549
+ "H",
1550
+ "h",
1551
+ "hB"
1552
+ ],
1553
+ "TG": ["H", "hB"],
1554
+ "TH": ["H", "h"],
1555
+ "TJ": ["H", "h"],
1556
+ "TL": [
1557
+ "H",
1558
+ "hB",
1559
+ "hb",
1560
+ "h"
1561
+ ],
1562
+ "TM": ["H", "h"],
1563
+ "TN": [
1564
+ "h",
1565
+ "hB",
1566
+ "hb",
1567
+ "H"
1568
+ ],
1569
+ "TO": ["h", "H"],
1570
+ "TR": ["H", "hB"],
1571
+ "TT": [
1572
+ "h",
1573
+ "hb",
1574
+ "H",
1575
+ "hB"
1576
+ ],
1577
+ "TW": [
1578
+ "hB",
1579
+ "hb",
1580
+ "h",
1581
+ "H"
1582
+ ],
1583
+ "TZ": [
1584
+ "hB",
1585
+ "hb",
1586
+ "H",
1587
+ "h"
1588
+ ],
1589
+ "UA": [
1590
+ "H",
1591
+ "hB",
1592
+ "h"
1593
+ ],
1594
+ "UG": [
1595
+ "hB",
1596
+ "hb",
1597
+ "H",
1598
+ "h"
1599
+ ],
1600
+ "UM": [
1601
+ "h",
1602
+ "hb",
1603
+ "H",
1604
+ "hB"
1605
+ ],
1606
+ "US": [
1607
+ "h",
1608
+ "hb",
1609
+ "H",
1610
+ "hB"
1611
+ ],
1612
+ "UY": [
1613
+ "h",
1614
+ "H",
1615
+ "hB",
1616
+ "hb"
1617
+ ],
1618
+ "UZ": [
1619
+ "H",
1620
+ "hB",
1621
+ "h"
1622
+ ],
1623
+ "VA": [
1624
+ "H",
1625
+ "h",
1626
+ "hB"
1627
+ ],
1628
+ "VC": [
1629
+ "h",
1630
+ "hb",
1631
+ "H",
1632
+ "hB"
1633
+ ],
1634
+ "VE": [
1635
+ "h",
1636
+ "H",
1637
+ "hB",
1638
+ "hb"
1639
+ ],
1640
+ "VG": [
1641
+ "h",
1642
+ "hb",
1643
+ "H",
1644
+ "hB"
1645
+ ],
1646
+ "VI": [
1647
+ "h",
1648
+ "hb",
1649
+ "H",
1650
+ "hB"
1651
+ ],
1652
+ "VN": ["H", "h"],
1653
+ "VU": ["h", "H"],
1654
+ "WF": ["H", "hB"],
1655
+ "WS": ["h", "H"],
1656
+ "XK": [
1657
+ "H",
1658
+ "hB",
1659
+ "h"
1660
+ ],
1661
+ "YE": [
1662
+ "h",
1663
+ "hB",
1664
+ "hb",
1665
+ "H"
1666
+ ],
1667
+ "YT": ["H", "hB"],
1668
+ "ZA": [
1669
+ "H",
1670
+ "h",
1671
+ "hb",
1672
+ "hB"
1673
+ ],
1674
+ "ZM": [
1675
+ "h",
1676
+ "hb",
1677
+ "H",
1678
+ "hB"
1679
+ ],
1680
+ "ZW": ["H", "h"],
1681
+ "af-ZA": [
1682
+ "H",
1683
+ "h",
1684
+ "hB",
1685
+ "hb"
1686
+ ],
1687
+ "ar-001": [
1688
+ "h",
1689
+ "hB",
1690
+ "hb",
1691
+ "H"
1692
+ ],
1693
+ "ca-ES": [
1694
+ "H",
1695
+ "h",
1696
+ "hB"
1697
+ ],
1698
+ "en-001": [
1699
+ "h",
1700
+ "hb",
1701
+ "H",
1702
+ "hB"
1703
+ ],
1704
+ "en-HK": [
1705
+ "h",
1706
+ "hb",
1707
+ "H",
1708
+ "hB"
1709
+ ],
1710
+ "en-IL": [
1711
+ "H",
1712
+ "h",
1713
+ "hb",
1714
+ "hB"
1715
+ ],
1716
+ "en-MY": [
1717
+ "h",
1718
+ "hb",
1719
+ "H",
1720
+ "hB"
1721
+ ],
1722
+ "es-BR": [
1723
+ "H",
1724
+ "h",
1725
+ "hB",
1726
+ "hb"
1727
+ ],
1728
+ "es-ES": [
1729
+ "H",
1730
+ "h",
1731
+ "hB",
1732
+ "hb"
1733
+ ],
1734
+ "es-GQ": [
1735
+ "H",
1736
+ "h",
1737
+ "hB",
1738
+ "hb"
1739
+ ],
1740
+ "fr-CA": [
1741
+ "H",
1742
+ "h",
1743
+ "hB"
1744
+ ],
1745
+ "gl-ES": [
1746
+ "H",
1747
+ "h",
1748
+ "hB"
1749
+ ],
1750
+ "gu-IN": [
1751
+ "hB",
1752
+ "hb",
1753
+ "h",
1754
+ "H"
1755
+ ],
1756
+ "hi-IN": [
1757
+ "hB",
1758
+ "h",
1759
+ "H"
1760
+ ],
1761
+ "it-CH": [
1762
+ "H",
1763
+ "h",
1764
+ "hB"
1765
+ ],
1766
+ "it-IT": [
1767
+ "H",
1768
+ "h",
1769
+ "hB"
1770
+ ],
1771
+ "kn-IN": [
1772
+ "hB",
1773
+ "h",
1774
+ "H"
1775
+ ],
1776
+ "ku-SY": ["H", "hB"],
1777
+ "ml-IN": [
1778
+ "hB",
1779
+ "h",
1780
+ "H"
1781
+ ],
1782
+ "mr-IN": [
1783
+ "hB",
1784
+ "hb",
1785
+ "h",
1786
+ "H"
1787
+ ],
1788
+ "pa-IN": [
1789
+ "hB",
1790
+ "hb",
1791
+ "h",
1792
+ "H"
1793
+ ],
1794
+ "ta-IN": [
1795
+ "hB",
1796
+ "h",
1797
+ "hb",
1798
+ "H"
1799
+ ],
1800
+ "te-IN": [
1801
+ "hB",
1802
+ "h",
1803
+ "H"
1804
+ ],
1805
+ "zu-ZA": [
1806
+ "H",
1807
+ "hB",
1808
+ "hb",
1809
+ "h"
1810
+ ]
1811
+ };
1812
+
1813
+ /**
1814
+ * Returns the best matching date time pattern if a date time skeleton
1815
+ * pattern is provided with a locale. Follows the Unicode specification:
1816
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#table-mapping-requested-time-skeletons-to-patterns
1817
+ * @param skeleton date time skeleton pattern that possibly includes j, J or C
1818
+ * @param locale
1819
+ */
1820
+ function getBestPattern(skeleton, locale) {
1821
+ let skeletonCopy = "";
1822
+ for (let patternPos = 0; patternPos < skeleton.length; patternPos++) {
1823
+ const patternChar = skeleton.charAt(patternPos);
1824
+ if (patternChar === "j") {
1825
+ let extraLength = 0;
1826
+ while (patternPos + 1 < skeleton.length && skeleton.charAt(patternPos + 1) === patternChar) {
1827
+ extraLength++;
1828
+ patternPos++;
1829
+ }
1830
+ let hourLen = 1 + (extraLength & 1);
1831
+ let dayPeriodLen = extraLength < 2 ? 1 : 3 + (extraLength >> 1);
1832
+ let dayPeriodChar = "a";
1833
+ let hourChar = getDefaultHourSymbolFromLocale(locale);
1834
+ if (hourChar == "H" || hourChar == "k") {
1835
+ dayPeriodLen = 0;
1836
+ }
1837
+ while (dayPeriodLen-- > 0) {
1838
+ skeletonCopy += dayPeriodChar;
1839
+ }
1840
+ while (hourLen-- > 0) {
1841
+ skeletonCopy = hourChar + skeletonCopy;
1842
+ }
1843
+ } else if (patternChar === "J") {
1844
+ skeletonCopy += "H";
1845
+ } else {
1846
+ skeletonCopy += patternChar;
1847
+ }
1848
+ }
1849
+ return skeletonCopy;
1850
+ }
1851
+ /**
1852
+ * Maps the [hour cycle type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle)
1853
+ * of the given `locale` to the corresponding time pattern.
1854
+ * @param locale
1855
+ */
1856
+ function getDefaultHourSymbolFromLocale(locale) {
1857
+ let hourCycle = locale.hourCycle;
1858
+ if (hourCycle === undefined && locale.hourCycles && locale.hourCycles.length) {
1859
+ // @ts-ignore
1860
+ hourCycle = locale.hourCycles[0];
1861
+ }
1862
+ if (hourCycle) {
1863
+ switch (hourCycle) {
1864
+ case "h24": return "k";
1865
+ case "h23": return "H";
1866
+ case "h12": return "h";
1867
+ case "h11": return "K";
1868
+ default: throw new Error("Invalid hourCycle");
1869
+ }
1870
+ }
1871
+ // TODO: Once hourCycle is fully supported remove the following with data generation
1872
+ const languageTag = locale.language;
1873
+ let regionTag;
1874
+ if (languageTag !== "root") {
1875
+ regionTag = locale.maximize().region;
1876
+ }
1877
+ const hourCycles = timeData[regionTag || ""] || timeData[languageTag || ""] || timeData[`${languageTag}-001`] || timeData["001"];
1878
+ return hourCycles[0];
1879
+ }
1880
+
1881
+ const SPACE_SEPARATOR_START_REGEX = new RegExp(`^${SPACE_SEPARATOR_REGEX.source}*`);
1882
+ const SPACE_SEPARATOR_END_REGEX = new RegExp(`${SPACE_SEPARATOR_REGEX.source}*$`);
1883
+ function createLocation(start, end) {
1884
+ return {
1885
+ start,
1886
+ end
1887
+ };
1888
+ }
1889
+ // #region Ponyfills
1890
+ // Consolidate these variables up top for easier toggling during debugging
1891
+ const hasNativeFromEntries = !!Object.fromEntries;
1892
+ const hasTrimStart = !!String.prototype.trimStart;
1893
+ const hasTrimEnd = !!String.prototype.trimEnd;
1894
+ const fromEntries = hasNativeFromEntries ? Object.fromEntries : function fromEntries(entries) {
1895
+ const obj = {};
1896
+ for (const [k, v] of entries) {
1897
+ obj[k] = v;
1898
+ }
1899
+ return obj;
1900
+ };
1901
+ const trimStart = hasTrimStart ? function trimStart(s) {
1902
+ return s.trimStart();
1903
+ } : function trimStart(s) {
1904
+ return s.replace(SPACE_SEPARATOR_START_REGEX, "");
1905
+ };
1906
+ const trimEnd = hasTrimEnd ? function trimEnd(s) {
1907
+ return s.trimEnd();
1908
+ } : function trimEnd(s) {
1909
+ return s.replace(SPACE_SEPARATOR_END_REGEX, "");
1910
+ };
1911
+ // #endregion
1912
+ const IDENTIFIER_PREFIX_RE = new RegExp("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
1913
+ function matchIdentifierAtIndex(s, index) {
1914
+ IDENTIFIER_PREFIX_RE.lastIndex = index;
1915
+ const match = IDENTIFIER_PREFIX_RE.exec(s);
1916
+ return match[1] ?? "";
1917
+ }
1918
+ class Parser {
1919
+ message;
1920
+ position;
1921
+ locale;
1922
+ ignoreTag;
1923
+ requiresOtherClause;
1924
+ shouldParseSkeletons;
1925
+ constructor(message, options = {}) {
1926
+ this.message = message;
1927
+ this.position = {
1928
+ offset: 0,
1929
+ line: 1,
1930
+ column: 1
1931
+ };
1932
+ this.ignoreTag = !!options.ignoreTag;
1933
+ this.locale = options.locale;
1934
+ this.requiresOtherClause = !!options.requiresOtherClause;
1935
+ this.shouldParseSkeletons = !!options.shouldParseSkeletons;
1936
+ }
1937
+ parse() {
1938
+ if (this.offset() !== 0) {
1939
+ throw Error("parser can only be used once");
1940
+ }
1941
+ return this.parseMessage(0, "", false);
1942
+ }
1943
+ parseMessage(nestingLevel, parentArgType, expectingCloseTag) {
1944
+ let elements = [];
1945
+ while (!this.isEOF()) {
1946
+ const char = this.char();
1947
+ if (char === 123) {
1948
+ const result = this.parseArgument(nestingLevel, expectingCloseTag);
1949
+ if (result.err) {
1950
+ return result;
1951
+ }
1952
+ elements.push(result.val);
1953
+ } else if (char === 125 && nestingLevel > 0) {
1954
+ break;
1955
+ } else if (char === 35 && (parentArgType === "plural" || parentArgType === "selectordinal")) {
1956
+ const position = this.clonePosition();
1957
+ this.bump();
1958
+ elements.push({
1959
+ type: TYPE.pound,
1960
+ location: createLocation(position, this.clonePosition())
1961
+ });
1962
+ } else if (char === 60 && !this.ignoreTag && this.peek() === 47) {
1963
+ if (expectingCloseTag) {
1964
+ break;
1965
+ } else {
1966
+ return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition()));
1967
+ }
1968
+ } else if (char === 60 && !this.ignoreTag && _isAlpha(this.peek() || 0)) {
1969
+ const result = this.parseTag(nestingLevel, parentArgType);
1970
+ if (result.err) {
1971
+ return result;
1972
+ }
1973
+ elements.push(result.val);
1974
+ } else {
1975
+ const result = this.parseLiteral(nestingLevel, parentArgType);
1976
+ if (result.err) {
1977
+ return result;
1978
+ }
1979
+ elements.push(result.val);
1980
+ }
1981
+ }
1982
+ return {
1983
+ val: elements,
1984
+ err: null
1985
+ };
1986
+ }
1987
+ /**
1988
+ * A tag name must start with an ASCII lower/upper case letter. The grammar is based on the
1989
+ * [custom element name][] except that a dash is NOT always mandatory and uppercase letters
1990
+ * are accepted:
1991
+ *
1992
+ * ```
1993
+ * tag ::= "<" tagName (whitespace)* "/>" | "<" tagName (whitespace)* ">" message "</" tagName (whitespace)* ">"
1994
+ * tagName ::= [a-z] (PENChar)*
1995
+ * PENChar ::=
1996
+ * "-" | "." | [0-9] | "_" | [a-z] | [A-Z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] |
1997
+ * [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] |
1998
+ * [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
1999
+ * ```
2000
+ *
2001
+ * [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
2002
+ * NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do
2003
+ * since other tag-based engines like React allow it
2004
+ */
2005
+ parseTag(nestingLevel, parentArgType) {
2006
+ const startPosition = this.clonePosition();
2007
+ this.bump();
2008
+ const tagName = this.parseTagName();
2009
+ this.bumpSpace();
2010
+ if (this.bumpIf("/>")) {
2011
+ // Self closing tag
2012
+ return {
2013
+ val: {
2014
+ type: TYPE.literal,
2015
+ value: `<${tagName}/>`,
2016
+ location: createLocation(startPosition, this.clonePosition())
2017
+ },
2018
+ err: null
2019
+ };
2020
+ } else if (this.bumpIf(">")) {
2021
+ const childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true);
2022
+ if (childrenResult.err) {
2023
+ return childrenResult;
2024
+ }
2025
+ const children = childrenResult.val;
2026
+ // Expecting a close tag
2027
+ const endTagStartPosition = this.clonePosition();
2028
+ if (this.bumpIf("</")) {
2029
+ if (this.isEOF() || !_isAlpha(this.char())) {
2030
+ return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));
2031
+ }
2032
+ const closingTagNameStartPosition = this.clonePosition();
2033
+ const closingTagName = this.parseTagName();
2034
+ if (tagName !== closingTagName) {
2035
+ return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(closingTagNameStartPosition, this.clonePosition()));
2036
+ }
2037
+ this.bumpSpace();
2038
+ if (!this.bumpIf(">")) {
2039
+ return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));
2040
+ }
2041
+ return {
2042
+ val: {
2043
+ type: TYPE.tag,
2044
+ value: tagName,
2045
+ children,
2046
+ location: createLocation(startPosition, this.clonePosition())
2047
+ },
2048
+ err: null
2049
+ };
2050
+ } else {
2051
+ return this.error(ErrorKind.UNCLOSED_TAG, createLocation(startPosition, this.clonePosition()));
2052
+ }
2053
+ } else {
2054
+ return this.error(ErrorKind.INVALID_TAG, createLocation(startPosition, this.clonePosition()));
2055
+ }
2056
+ }
2057
+ /**
2058
+ * This method assumes that the caller has peeked ahead for the first tag character.
2059
+ */
2060
+ parseTagName() {
2061
+ const startOffset = this.offset();
2062
+ this.bump();
2063
+ while (!this.isEOF() && _isPotentialElementNameChar(this.char())) {
2064
+ this.bump();
2065
+ }
2066
+ return this.message.slice(startOffset, this.offset());
2067
+ }
2068
+ parseLiteral(nestingLevel, parentArgType) {
2069
+ const start = this.clonePosition();
2070
+ let value = "";
2071
+ while (true) {
2072
+ const parseQuoteResult = this.tryParseQuote(parentArgType);
2073
+ if (parseQuoteResult) {
2074
+ value += parseQuoteResult;
2075
+ continue;
2076
+ }
2077
+ const parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType);
2078
+ if (parseUnquotedResult) {
2079
+ value += parseUnquotedResult;
2080
+ continue;
2081
+ }
2082
+ const parseLeftAngleResult = this.tryParseLeftAngleBracket();
2083
+ if (parseLeftAngleResult) {
2084
+ value += parseLeftAngleResult;
2085
+ continue;
2086
+ }
2087
+ break;
2088
+ }
2089
+ const location = createLocation(start, this.clonePosition());
2090
+ return {
2091
+ val: {
2092
+ type: TYPE.literal,
2093
+ value,
2094
+ location
2095
+ },
2096
+ err: null
2097
+ };
2098
+ }
2099
+ tryParseLeftAngleBracket() {
2100
+ if (!this.isEOF() && this.char() === 60 && (this.ignoreTag || !_isAlphaOrSlash(this.peek() || 0))) {
2101
+ this.bump();
2102
+ return "<";
2103
+ }
2104
+ return null;
2105
+ }
2106
+ /**
2107
+ * Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes
2108
+ * a character that requires quoting (that is, "only where needed"), and works the same in
2109
+ * nested messages as on the top level of the pattern. The new behavior is otherwise compatible.
2110
+ */
2111
+ tryParseQuote(parentArgType) {
2112
+ if (this.isEOF() || this.char() !== 39) {
2113
+ return null;
2114
+ }
2115
+ // Parse escaped char following the apostrophe, or early return if there is no escaped char.
2116
+ // Check if is valid escaped character
2117
+ switch (this.peek()) {
2118
+ case 39:
2119
+ // double quote, should return as a single quote.
2120
+ this.bump();
2121
+ this.bump();
2122
+ return "'";
2123
+ case 123:
2124
+ case 60:
2125
+ case 62:
2126
+ case 125: break;
2127
+ case 35:
2128
+ if (parentArgType === "plural" || parentArgType === "selectordinal") {
2129
+ break;
2130
+ }
2131
+ return null;
2132
+ default: return null;
2133
+ }
2134
+ this.bump();
2135
+ const codePoints = [this.char()];
2136
+ this.bump();
2137
+ // read chars until the optional closing apostrophe is found
2138
+ while (!this.isEOF()) {
2139
+ const ch = this.char();
2140
+ if (ch === 39) {
2141
+ if (this.peek() === 39) {
2142
+ codePoints.push(39);
2143
+ // Bump one more time because we need to skip 2 characters.
2144
+ this.bump();
2145
+ } else {
2146
+ // Optional closing apostrophe.
2147
+ this.bump();
2148
+ break;
2149
+ }
2150
+ } else {
2151
+ codePoints.push(ch);
2152
+ }
2153
+ this.bump();
2154
+ }
2155
+ return String.fromCodePoint(...codePoints);
2156
+ }
2157
+ tryParseUnquoted(nestingLevel, parentArgType) {
2158
+ if (this.isEOF()) {
2159
+ return null;
2160
+ }
2161
+ const ch = this.char();
2162
+ if (ch === 60 || ch === 123 || ch === 35 && (parentArgType === "plural" || parentArgType === "selectordinal") || ch === 125 && nestingLevel > 0) {
2163
+ return null;
2164
+ } else {
2165
+ this.bump();
2166
+ return String.fromCodePoint(ch);
2167
+ }
2168
+ }
2169
+ parseArgument(nestingLevel, expectingCloseTag) {
2170
+ const openingBracePosition = this.clonePosition();
2171
+ this.bump();
2172
+ this.bumpSpace();
2173
+ if (this.isEOF()) {
2174
+ return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
2175
+ }
2176
+ if (this.char() === 125) {
2177
+ this.bump();
2178
+ return this.error(ErrorKind.EMPTY_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
2179
+ }
2180
+ // argument name
2181
+ let value = this.parseIdentifierIfPossible().value;
2182
+ if (!value) {
2183
+ return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
2184
+ }
2185
+ this.bumpSpace();
2186
+ if (this.isEOF()) {
2187
+ return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
2188
+ }
2189
+ switch (this.char()) {
2190
+ case 125: {
2191
+ this.bump();
2192
+ return {
2193
+ val: {
2194
+ type: TYPE.argument,
2195
+ value,
2196
+ location: createLocation(openingBracePosition, this.clonePosition())
2197
+ },
2198
+ err: null
2199
+ };
2200
+ }
2201
+ case 44: {
2202
+ this.bump();
2203
+ this.bumpSpace();
2204
+ if (this.isEOF()) {
2205
+ return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
2206
+ }
2207
+ return this.parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition);
2208
+ }
2209
+ default: return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
2210
+ }
2211
+ }
2212
+ /**
2213
+ * Advance the parser until the end of the identifier, if it is currently on
2214
+ * an identifier character. Return an empty string otherwise.
2215
+ */
2216
+ parseIdentifierIfPossible() {
2217
+ const startingPosition = this.clonePosition();
2218
+ const startOffset = this.offset();
2219
+ const value = matchIdentifierAtIndex(this.message, startOffset);
2220
+ const endOffset = startOffset + value.length;
2221
+ this.bumpTo(endOffset);
2222
+ const endPosition = this.clonePosition();
2223
+ const location = createLocation(startingPosition, endPosition);
2224
+ return {
2225
+ value,
2226
+ location
2227
+ };
2228
+ }
2229
+ parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition) {
2230
+ // Parse this range:
2231
+ // {name, type, style}
2232
+ // ^---^
2233
+ let typeStartPosition = this.clonePosition();
2234
+ let argType = this.parseIdentifierIfPossible().value;
2235
+ let typeEndPosition = this.clonePosition();
2236
+ switch (argType) {
2237
+ case "":
2238
+ // Expecting a style string number, date, time, plural, selectordinal, or select.
2239
+ return this.error(ErrorKind.EXPECT_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));
2240
+ case "number":
2241
+ case "date":
2242
+ case "time": {
2243
+ // Parse this range:
2244
+ // {name, number, style}
2245
+ // ^-------^
2246
+ this.bumpSpace();
2247
+ let styleAndLocation = null;
2248
+ if (this.bumpIf(",")) {
2249
+ this.bumpSpace();
2250
+ const styleStartPosition = this.clonePosition();
2251
+ const result = this.parseSimpleArgStyleIfPossible();
2252
+ if (result.err) {
2253
+ return result;
2254
+ }
2255
+ const style = trimEnd(result.val);
2256
+ if (style.length === 0) {
2257
+ return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));
2258
+ }
2259
+ const styleLocation = createLocation(styleStartPosition, this.clonePosition());
2260
+ styleAndLocation = {
2261
+ style,
2262
+ styleLocation
2263
+ };
2264
+ }
2265
+ const argCloseResult = this.tryParseArgumentClose(openingBracePosition);
2266
+ if (argCloseResult.err) {
2267
+ return argCloseResult;
2268
+ }
2269
+ const location = createLocation(openingBracePosition, this.clonePosition());
2270
+ // Extract style or skeleton
2271
+ if (styleAndLocation && styleAndLocation.style.startsWith("::")) {
2272
+ // Skeleton starts with `::`.
2273
+ let skeleton = trimStart(styleAndLocation.style.slice(2));
2274
+ if (argType === "number") {
2275
+ const result = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation);
2276
+ if (result.err) {
2277
+ return result;
2278
+ }
2279
+ return {
2280
+ val: {
2281
+ type: TYPE.number,
2282
+ value,
2283
+ location,
2284
+ style: result.val
2285
+ },
2286
+ err: null
2287
+ };
2288
+ } else {
2289
+ if (skeleton.length === 0) {
2290
+ return this.error(ErrorKind.EXPECT_DATE_TIME_SKELETON, location);
2291
+ }
2292
+ let dateTimePattern = skeleton;
2293
+ // Get "best match" pattern only if locale is passed, if not, let it
2294
+ // pass as-is where `parseDateTimeSkeleton()` will throw an error
2295
+ // for unsupported patterns.
2296
+ if (this.locale) {
2297
+ dateTimePattern = getBestPattern(skeleton, this.locale);
2298
+ }
2299
+ const style = {
2300
+ type: SKELETON_TYPE.dateTime,
2301
+ pattern: dateTimePattern,
2302
+ location: styleAndLocation.styleLocation,
2303
+ parsedOptions: this.shouldParseSkeletons ? parseDateTimeSkeleton(dateTimePattern) : {}
2304
+ };
2305
+ const type = argType === "date" ? TYPE.date : TYPE.time;
2306
+ return {
2307
+ val: {
2308
+ type,
2309
+ value,
2310
+ location,
2311
+ style
2312
+ },
2313
+ err: null
2314
+ };
2315
+ }
2316
+ }
2317
+ // Regular style or no style.
2318
+ return {
2319
+ val: {
2320
+ type: argType === "number" ? TYPE.number : argType === "date" ? TYPE.date : TYPE.time,
2321
+ value,
2322
+ location,
2323
+ style: styleAndLocation?.style ?? null
2324
+ },
2325
+ err: null
2326
+ };
2327
+ }
2328
+ case "plural":
2329
+ case "selectordinal":
2330
+ case "select": {
2331
+ // Parse this range:
2332
+ // {name, plural, options}
2333
+ // ^---------^
2334
+ const typeEndPosition = this.clonePosition();
2335
+ this.bumpSpace();
2336
+ if (!this.bumpIf(",")) {
2337
+ return this.error(ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(typeEndPosition, { ...typeEndPosition }));
2338
+ }
2339
+ this.bumpSpace();
2340
+ // Parse offset:
2341
+ // {name, plural, offset:1, options}
2342
+ // ^-----^
2343
+ //
2344
+ // or the first option:
2345
+ //
2346
+ // {name, plural, one {...} other {...}}
2347
+ // ^--^
2348
+ let identifierAndLocation = this.parseIdentifierIfPossible();
2349
+ let pluralOffset = 0;
2350
+ if (argType !== "select" && identifierAndLocation.value === "offset") {
2351
+ if (!this.bumpIf(":")) {
2352
+ return this.error(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, createLocation(this.clonePosition(), this.clonePosition()));
2353
+ }
2354
+ this.bumpSpace();
2355
+ const result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
2356
+ if (result.err) {
2357
+ return result;
2358
+ }
2359
+ // Parse another identifier for option parsing
2360
+ this.bumpSpace();
2361
+ identifierAndLocation = this.parseIdentifierIfPossible();
2362
+ pluralOffset = result.val;
2363
+ }
2364
+ const optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation);
2365
+ if (optionsResult.err) {
2366
+ return optionsResult;
2367
+ }
2368
+ const argCloseResult = this.tryParseArgumentClose(openingBracePosition);
2369
+ if (argCloseResult.err) {
2370
+ return argCloseResult;
2371
+ }
2372
+ const location = createLocation(openingBracePosition, this.clonePosition());
2373
+ if (argType === "select") {
2374
+ return {
2375
+ val: {
2376
+ type: TYPE.select,
2377
+ value,
2378
+ options: fromEntries(optionsResult.val),
2379
+ location
2380
+ },
2381
+ err: null
2382
+ };
2383
+ } else {
2384
+ return {
2385
+ val: {
2386
+ type: TYPE.plural,
2387
+ value,
2388
+ options: fromEntries(optionsResult.val),
2389
+ offset: pluralOffset,
2390
+ pluralType: argType === "plural" ? "cardinal" : "ordinal",
2391
+ location
2392
+ },
2393
+ err: null
2394
+ };
2395
+ }
2396
+ }
2397
+ default: return this.error(ErrorKind.INVALID_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));
2398
+ }
2399
+ }
2400
+ tryParseArgumentClose(openingBracePosition) {
2401
+ // Parse: {value, number, ::currency/GBP }
2402
+ //
2403
+ if (this.isEOF() || this.char() !== 125) {
2404
+ return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
2405
+ }
2406
+ this.bump();
2407
+ return {
2408
+ val: true,
2409
+ err: null
2410
+ };
2411
+ }
2412
+ /**
2413
+ * See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659
2414
+ */
2415
+ parseSimpleArgStyleIfPossible() {
2416
+ let nestedBraces = 0;
2417
+ const startPosition = this.clonePosition();
2418
+ while (!this.isEOF()) {
2419
+ const ch = this.char();
2420
+ switch (ch) {
2421
+ case 39: {
2422
+ // Treat apostrophe as quoting but include it in the style part.
2423
+ // Find the end of the quoted literal text.
2424
+ this.bump();
2425
+ let apostrophePosition = this.clonePosition();
2426
+ if (!this.bumpUntil("'")) {
2427
+ return this.error(ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, createLocation(apostrophePosition, this.clonePosition()));
2428
+ }
2429
+ this.bump();
2430
+ break;
2431
+ }
2432
+ case 123: {
2433
+ nestedBraces += 1;
2434
+ this.bump();
2435
+ break;
2436
+ }
2437
+ case 125: {
2438
+ if (nestedBraces > 0) {
2439
+ nestedBraces -= 1;
2440
+ } else {
2441
+ return {
2442
+ val: this.message.slice(startPosition.offset, this.offset()),
2443
+ err: null
2444
+ };
2445
+ }
2446
+ break;
2447
+ }
2448
+ default:
2449
+ this.bump();
2450
+ break;
2451
+ }
2452
+ }
2453
+ return {
2454
+ val: this.message.slice(startPosition.offset, this.offset()),
2455
+ err: null
2456
+ };
2457
+ }
2458
+ parseNumberSkeletonFromString(skeleton, location) {
2459
+ let tokens = [];
2460
+ try {
2461
+ tokens = parseNumberSkeletonFromString(skeleton);
2462
+ } catch {
2463
+ return this.error(ErrorKind.INVALID_NUMBER_SKELETON, location);
2464
+ }
2465
+ return {
2466
+ val: {
2467
+ type: SKELETON_TYPE.number,
2468
+ tokens,
2469
+ location,
2470
+ parsedOptions: this.shouldParseSkeletons ? parseNumberSkeleton(tokens) : {}
2471
+ },
2472
+ err: null
2473
+ };
2474
+ }
2475
+ /**
2476
+ * @param nesting_level The current nesting level of messages.
2477
+ * This can be positive when parsing message fragment in select or plural argument options.
2478
+ * @param parent_arg_type The parent argument's type.
2479
+ * @param parsed_first_identifier If provided, this is the first identifier-like selector of
2480
+ * the argument. It is a by-product of a previous parsing attempt.
2481
+ * @param expecting_close_tag If true, this message is directly or indirectly nested inside
2482
+ * between a pair of opening and closing tags. The nested message will not parse beyond
2483
+ * the closing tag boundary.
2484
+ */
2485
+ tryParsePluralOrSelectOptions(nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) {
2486
+ let hasOtherClause = false;
2487
+ const options = [];
2488
+ const parsedSelectors = new Set();
2489
+ let { value: selector, location: selectorLocation } = parsedFirstIdentifier;
2490
+ // Parse:
2491
+ // one {one apple}
2492
+ // ^--^
2493
+ while (true) {
2494
+ if (selector.length === 0) {
2495
+ const startPosition = this.clonePosition();
2496
+ if (parentArgType !== "select" && this.bumpIf("=")) {
2497
+ // Try parse `={number}` selector
2498
+ const result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR);
2499
+ if (result.err) {
2500
+ return result;
2501
+ }
2502
+ selectorLocation = createLocation(startPosition, this.clonePosition());
2503
+ selector = this.message.slice(startPosition.offset, this.offset());
2504
+ } else {
2505
+ break;
2506
+ }
2507
+ }
2508
+ // Duplicate selector clauses
2509
+ if (parsedSelectors.has(selector)) {
2510
+ return this.error(parentArgType === "select" ? ErrorKind.DUPLICATE_SELECT_ARGUMENT_SELECTOR : ErrorKind.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, selectorLocation);
2511
+ }
2512
+ if (selector === "other") {
2513
+ hasOtherClause = true;
2514
+ }
2515
+ // Parse:
2516
+ // one {one apple}
2517
+ // ^----------^
2518
+ this.bumpSpace();
2519
+ const openingBracePosition = this.clonePosition();
2520
+ if (!this.bumpIf("{")) {
2521
+ return this.error(parentArgType === "select" ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, createLocation(this.clonePosition(), this.clonePosition()));
2522
+ }
2523
+ const fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag);
2524
+ if (fragmentResult.err) {
2525
+ return fragmentResult;
2526
+ }
2527
+ const argCloseResult = this.tryParseArgumentClose(openingBracePosition);
2528
+ if (argCloseResult.err) {
2529
+ return argCloseResult;
2530
+ }
2531
+ options.push([selector, {
2532
+ value: fragmentResult.val,
2533
+ location: createLocation(openingBracePosition, this.clonePosition())
2534
+ }]);
2535
+ // Keep track of the existing selectors
2536
+ parsedSelectors.add(selector);
2537
+ // Prep next selector clause.
2538
+ this.bumpSpace();
2539
+ ({value: selector, location: selectorLocation} = this.parseIdentifierIfPossible());
2540
+ }
2541
+ if (options.length === 0) {
2542
+ return this.error(parentArgType === "select" ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, createLocation(this.clonePosition(), this.clonePosition()));
2543
+ }
2544
+ if (this.requiresOtherClause && !hasOtherClause) {
2545
+ return this.error(ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition()));
2546
+ }
2547
+ return {
2548
+ val: options,
2549
+ err: null
2550
+ };
2551
+ }
2552
+ tryParseDecimalInteger(expectNumberError, invalidNumberError) {
2553
+ let sign = 1;
2554
+ const startingPosition = this.clonePosition();
2555
+ if (this.bumpIf("+")) ; else if (this.bumpIf("-")) {
2556
+ sign = -1;
2557
+ }
2558
+ let hasDigits = false;
2559
+ let decimal = 0;
2560
+ while (!this.isEOF()) {
2561
+ const ch = this.char();
2562
+ if (ch >= 48 && ch <= 57) {
2563
+ hasDigits = true;
2564
+ decimal = decimal * 10 + (ch - 48);
2565
+ this.bump();
2566
+ } else {
2567
+ break;
2568
+ }
2569
+ }
2570
+ const location = createLocation(startingPosition, this.clonePosition());
2571
+ if (!hasDigits) {
2572
+ return this.error(expectNumberError, location);
2573
+ }
2574
+ decimal *= sign;
2575
+ if (!Number.isSafeInteger(decimal)) {
2576
+ return this.error(invalidNumberError, location);
2577
+ }
2578
+ return {
2579
+ val: decimal,
2580
+ err: null
2581
+ };
2582
+ }
2583
+ offset() {
2584
+ return this.position.offset;
2585
+ }
2586
+ isEOF() {
2587
+ return this.offset() === this.message.length;
2588
+ }
2589
+ clonePosition() {
2590
+ // This is much faster than `Object.assign` or spread.
2591
+ return {
2592
+ offset: this.position.offset,
2593
+ line: this.position.line,
2594
+ column: this.position.column
2595
+ };
2596
+ }
2597
+ /**
2598
+ * Return the code point at the current position of the parser.
2599
+ * Throws if the index is out of bound.
2600
+ */
2601
+ char() {
2602
+ const offset = this.position.offset;
2603
+ if (offset >= this.message.length) {
2604
+ throw Error("out of bound");
2605
+ }
2606
+ const code = this.message.codePointAt(offset);
2607
+ if (code === undefined) {
2608
+ throw Error(`Offset ${offset} is at invalid UTF-16 code unit boundary`);
2609
+ }
2610
+ return code;
2611
+ }
2612
+ error(kind, location) {
2613
+ return {
2614
+ val: null,
2615
+ err: {
2616
+ kind,
2617
+ message: this.message,
2618
+ location
2619
+ }
2620
+ };
2621
+ }
2622
+ /** Bump the parser to the next UTF-16 code unit. */
2623
+ bump() {
2624
+ if (this.isEOF()) {
2625
+ return;
2626
+ }
2627
+ const code = this.char();
2628
+ if (code === 10) {
2629
+ this.position.line += 1;
2630
+ this.position.column = 1;
2631
+ this.position.offset += 1;
2632
+ } else {
2633
+ this.position.column += 1;
2634
+ // 0 ~ 0x10000 -> unicode BMP, otherwise skip the surrogate pair.
2635
+ this.position.offset += code < 65536 ? 1 : 2;
2636
+ }
2637
+ }
2638
+ /**
2639
+ * If the substring starting at the current position of the parser has
2640
+ * the given prefix, then bump the parser to the character immediately
2641
+ * following the prefix and return true. Otherwise, don't bump the parser
2642
+ * and return false.
2643
+ */
2644
+ bumpIf(prefix) {
2645
+ if (this.message.startsWith(prefix, this.offset())) {
2646
+ for (let i = 0; i < prefix.length; i++) {
2647
+ this.bump();
2648
+ }
2649
+ return true;
2650
+ }
2651
+ return false;
2652
+ }
2653
+ /**
2654
+ * Bump the parser until the pattern character is found and return `true`.
2655
+ * Otherwise bump to the end of the file and return `false`.
2656
+ */
2657
+ bumpUntil(pattern) {
2658
+ const currentOffset = this.offset();
2659
+ const index = this.message.indexOf(pattern, currentOffset);
2660
+ if (index >= 0) {
2661
+ this.bumpTo(index);
2662
+ return true;
2663
+ } else {
2664
+ this.bumpTo(this.message.length);
2665
+ return false;
2666
+ }
2667
+ }
2668
+ /**
2669
+ * Bump the parser to the target offset.
2670
+ * If target offset is beyond the end of the input, bump the parser to the end of the input.
2671
+ */
2672
+ bumpTo(targetOffset) {
2673
+ if (this.offset() > targetOffset) {
2674
+ throw Error(`targetOffset ${targetOffset} must be greater than or equal to the current offset ${this.offset()}`);
2675
+ }
2676
+ targetOffset = Math.min(targetOffset, this.message.length);
2677
+ while (true) {
2678
+ const offset = this.offset();
2679
+ if (offset === targetOffset) {
2680
+ break;
2681
+ }
2682
+ if (offset > targetOffset) {
2683
+ throw Error(`targetOffset ${targetOffset} is at invalid UTF-16 code unit boundary`);
2684
+ }
2685
+ this.bump();
2686
+ if (this.isEOF()) {
2687
+ break;
2688
+ }
2689
+ }
2690
+ }
2691
+ /** advance the parser through all whitespace to the next non-whitespace code unit. */
2692
+ bumpSpace() {
2693
+ while (!this.isEOF() && _isWhiteSpace(this.char())) {
2694
+ this.bump();
2695
+ }
2696
+ }
2697
+ /**
2698
+ * Peek at the *next* Unicode codepoint in the input without advancing the parser.
2699
+ * If the input has been exhausted, then this returns null.
2700
+ */
2701
+ peek() {
2702
+ if (this.isEOF()) {
2703
+ return null;
2704
+ }
2705
+ const code = this.char();
2706
+ const offset = this.offset();
2707
+ const nextCode = this.message.charCodeAt(offset + (code >= 65536 ? 2 : 1));
2708
+ return nextCode ?? null;
2709
+ }
2710
+ }
2711
+ /**
2712
+ * This check if codepoint is alphabet (lower & uppercase)
2713
+ * @param codepoint
2714
+ * @returns
2715
+ */
2716
+ function _isAlpha(codepoint) {
2717
+ return codepoint >= 97 && codepoint <= 122 || codepoint >= 65 && codepoint <= 90;
2718
+ }
2719
+ function _isAlphaOrSlash(codepoint) {
2720
+ return _isAlpha(codepoint) || codepoint === 47;
2721
+ }
2722
+ /** See `parseTag` function docs. */
2723
+ function _isPotentialElementNameChar(c) {
2724
+ return c === 45 || c === 46 || c >= 48 && c <= 57 || c === 95 || c >= 97 && c <= 122 || c >= 65 && c <= 90 || c == 183 || c >= 192 && c <= 214 || c >= 216 && c <= 246 || c >= 248 && c <= 893 || c >= 895 && c <= 8191 || c >= 8204 && c <= 8205 || c >= 8255 && c <= 8256 || c >= 8304 && c <= 8591 || c >= 11264 && c <= 12271 || c >= 12289 && c <= 55295 || c >= 63744 && c <= 64975 || c >= 65008 && c <= 65533 || c >= 65536 && c <= 983039;
2725
+ }
2726
+ /**
2727
+ * Code point equivalent of regex `\p{White_Space}`.
2728
+ * From: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt
2729
+ */
2730
+ function _isWhiteSpace(c) {
2731
+ return c >= 9 && c <= 13 || c === 32 || c === 133 || c >= 8206 && c <= 8207 || c === 8232 || c === 8233;
2732
+ }
2733
+
2734
+ function pruneLocation(els) {
2735
+ els.forEach((el) => {
2736
+ delete el.location;
2737
+ if (isSelectElement(el) || isPluralElement(el)) {
2738
+ for (const k in el.options) {
2739
+ delete el.options[k].location;
2740
+ pruneLocation(el.options[k].value);
2741
+ }
2742
+ } else if (isNumberElement(el) && isNumberSkeleton(el.style)) {
2743
+ delete el.style.location;
2744
+ } else if ((isDateElement(el) || isTimeElement(el)) && isDateTimeSkeleton(el.style)) {
2745
+ delete el.style.location;
2746
+ } else if (isTagElement(el)) {
2747
+ pruneLocation(el.children);
2748
+ }
2749
+ });
2750
+ }
2751
+ function parse(message, opts = {}) {
2752
+ opts = {
2753
+ shouldParseSkeletons: true,
2754
+ requiresOtherClause: true,
2755
+ ...opts
2756
+ };
2757
+ const result = new Parser(message, opts).parse();
2758
+ if (result.err) {
2759
+ const error = SyntaxError(ErrorKind[result.err.kind]);
2760
+ // @ts-expect-error Assign to error object
2761
+ error.location = result.err.location;
2762
+ // @ts-expect-error Assign to error object
2763
+ error.originalMessage = result.err.message;
2764
+ throw error;
2765
+ }
2766
+ if (!opts?.captureLocation) {
2767
+ pruneLocation(result.val);
2768
+ }
2769
+ return result.val;
2770
+ }
2771
+
2772
+ let ErrorCode = /* @__PURE__ */ function(ErrorCode) {
2773
+ // When we have a placeholder but no value to format
2774
+ ErrorCode["MISSING_VALUE"] = "MISSING_VALUE";
2775
+ // When value supplied is invalid
2776
+ ErrorCode["INVALID_VALUE"] = "INVALID_VALUE";
2777
+ // When we need specific Intl API but it's not available
2778
+ ErrorCode["MISSING_INTL_API"] = "MISSING_INTL_API";
2779
+ return ErrorCode;
2780
+ }({});
2781
+ class FormatError extends Error {
2782
+ code;
2783
+ /**
2784
+ * Original message we're trying to format
2785
+ * `undefined` if we're only dealing w/ AST
2786
+ *
2787
+ * @type {(string | undefined)}
2788
+ * @memberof FormatError
2789
+ */
2790
+ originalMessage;
2791
+ constructor(msg, code, originalMessage) {
2792
+ super(msg);
2793
+ this.code = code;
2794
+ this.originalMessage = originalMessage;
2795
+ }
2796
+ toString() {
2797
+ return `[formatjs Error: ${this.code}] ${this.message}`;
2798
+ }
2799
+ }
2800
+ class InvalidValueError extends FormatError {
2801
+ constructor(variableId, value, options, originalMessage) {
2802
+ super(`Invalid values for "${variableId}": "${value}". Options are "${Object.keys(options).join("\", \"")}"`, ErrorCode.INVALID_VALUE, originalMessage);
2803
+ }
2804
+ }
2805
+ class InvalidValueTypeError extends FormatError {
2806
+ constructor(value, type, originalMessage) {
2807
+ super(`Value for "${value}" must be of type ${type}`, ErrorCode.INVALID_VALUE, originalMessage);
2808
+ }
2809
+ }
2810
+ class MissingValueError extends FormatError {
2811
+ constructor(variableId, originalMessage) {
2812
+ super(`The intl string context variable "${variableId}" was not provided to the string "${originalMessage}"`, ErrorCode.MISSING_VALUE, originalMessage);
2813
+ }
2814
+ }
2815
+
2816
+ let PART_TYPE = /* @__PURE__ */ function(PART_TYPE) {
2817
+ PART_TYPE[PART_TYPE["literal"] = 0] = "literal";
2818
+ PART_TYPE[PART_TYPE["object"] = 1] = "object";
2819
+ return PART_TYPE;
2820
+ }({});
2821
+ function mergeLiteral(parts) {
2822
+ if (parts.length < 2) {
2823
+ return parts;
2824
+ }
2825
+ return parts.reduce((all, part) => {
2826
+ const lastPart = all[all.length - 1];
2827
+ if (!lastPart || lastPart.type !== PART_TYPE.literal || part.type !== PART_TYPE.literal) {
2828
+ all.push(part);
2829
+ } else {
2830
+ lastPart.value += part.value;
2831
+ }
2832
+ return all;
2833
+ }, []);
2834
+ }
2835
+ function isFormatXMLElementFn(el) {
2836
+ return typeof el === "function";
2837
+ }
2838
+ // TODO(skeleton): add skeleton support
2839
+ function formatToParts(els, locales, formatters, formats, values, currentPluralValue, originalMessage) {
2840
+ // Hot path for straight simple msg translations
2841
+ if (els.length === 1 && isLiteralElement(els[0])) {
2842
+ return [{
2843
+ type: PART_TYPE.literal,
2844
+ value: els[0].value
2845
+ }];
2846
+ }
2847
+ const result = [];
2848
+ for (const el of els) {
2849
+ // Exit early for string parts.
2850
+ if (isLiteralElement(el)) {
2851
+ result.push({
2852
+ type: PART_TYPE.literal,
2853
+ value: el.value
2854
+ });
2855
+ continue;
2856
+ }
2857
+ // TODO: should this part be literal type?
2858
+ // Replace `#` in plural rules with the actual numeric value.
2859
+ if (isPoundElement(el)) {
2860
+ if (typeof currentPluralValue === "number") {
2861
+ result.push({
2862
+ type: PART_TYPE.literal,
2863
+ value: formatters.getNumberFormat(locales).format(currentPluralValue)
2864
+ });
2865
+ }
2866
+ continue;
2867
+ }
2868
+ const { value: varName } = el;
2869
+ // Enforce that all required values are provided by the caller.
2870
+ if (!(values && varName in values)) {
2871
+ throw new MissingValueError(varName, originalMessage);
2872
+ }
2873
+ let value = values[varName];
2874
+ if (isArgumentElement(el)) {
2875
+ if (!value || typeof value === "string" || typeof value === "number" || typeof value === "bigint") {
2876
+ value = typeof value === "string" || typeof value === "number" || typeof value === "bigint" ? String(value) : "";
2877
+ }
2878
+ result.push({
2879
+ type: typeof value === "string" ? PART_TYPE.literal : PART_TYPE.object,
2880
+ value
2881
+ });
2882
+ continue;
2883
+ }
2884
+ // Recursively format plural and select parts' option — which can be a
2885
+ // nested pattern structure. The choosing of the option to use is
2886
+ // abstracted-by and delegated-to the part helper object.
2887
+ if (isDateElement(el)) {
2888
+ const style = typeof el.style === "string" ? formats.date[el.style] : isDateTimeSkeleton(el.style) ? el.style.parsedOptions : undefined;
2889
+ result.push({
2890
+ type: PART_TYPE.literal,
2891
+ value: formatters.getDateTimeFormat(locales, style).format(value)
2892
+ });
2893
+ continue;
2894
+ }
2895
+ if (isTimeElement(el)) {
2896
+ const style = typeof el.style === "string" ? formats.time[el.style] : isDateTimeSkeleton(el.style) ? el.style.parsedOptions : formats.time.medium;
2897
+ result.push({
2898
+ type: PART_TYPE.literal,
2899
+ value: formatters.getDateTimeFormat(locales, style).format(value)
2900
+ });
2901
+ continue;
2902
+ }
2903
+ if (isNumberElement(el)) {
2904
+ const style = typeof el.style === "string" ? formats.number[el.style] : isNumberSkeleton(el.style) ? el.style.parsedOptions : undefined;
2905
+ if (style && style.scale) {
2906
+ const scale = style.scale || 1;
2907
+ // Handle bigint scale multiplication
2908
+ // BigInt can only be multiplied by BigInt
2909
+ if (typeof value === "bigint") {
2910
+ // Check if scale is a safe integer that can be converted to BigInt
2911
+ if (!Number.isInteger(scale)) {
2912
+ throw new TypeError(`Cannot apply fractional scale ${scale} to bigint value. Scale must be an integer when formatting bigint.`);
2913
+ }
2914
+ value = value * BigInt(scale);
2915
+ } else {
2916
+ value = value * scale;
2917
+ }
2918
+ }
2919
+ result.push({
2920
+ type: PART_TYPE.literal,
2921
+ value: formatters.getNumberFormat(locales, style).format(value)
2922
+ });
2923
+ continue;
2924
+ }
2925
+ if (isTagElement(el)) {
2926
+ const { children, value } = el;
2927
+ const formatFn = values[value];
2928
+ if (!isFormatXMLElementFn(formatFn)) {
2929
+ throw new InvalidValueTypeError(value, "function", originalMessage);
2930
+ }
2931
+ const parts = formatToParts(children, locales, formatters, formats, values, currentPluralValue);
2932
+ let chunks = formatFn(parts.map((p) => p.value));
2933
+ if (!Array.isArray(chunks)) {
2934
+ chunks = [chunks];
2935
+ }
2936
+ result.push(...chunks.map((c) => {
2937
+ return {
2938
+ type: typeof c === "string" ? PART_TYPE.literal : PART_TYPE.object,
2939
+ value: c
2940
+ };
2941
+ }));
2942
+ }
2943
+ if (isSelectElement(el)) {
2944
+ // GH #4490: Use hasOwnProperty to avoid prototype chain issues with keys like "constructor"
2945
+ const key = value;
2946
+ const opt = (Object.prototype.hasOwnProperty.call(el.options, key) ? el.options[key] : undefined) || el.options.other;
2947
+ if (!opt) {
2948
+ throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);
2949
+ }
2950
+ result.push(...formatToParts(opt.value, locales, formatters, formats, values));
2951
+ continue;
2952
+ }
2953
+ if (isPluralElement(el)) {
2954
+ // GH #4490: Use hasOwnProperty to avoid prototype chain issues
2955
+ const exactKey = `=${value}`;
2956
+ let opt = Object.prototype.hasOwnProperty.call(el.options, exactKey) ? el.options[exactKey] : undefined;
2957
+ if (!opt) {
2958
+ if (!Intl.PluralRules) {
2959
+ throw new FormatError(`Intl.PluralRules is not available in this environment.
2960
+ Try polyfilling it using "@formatjs/intl-pluralrules"
2961
+ `, ErrorCode.MISSING_INTL_API, originalMessage);
2962
+ }
2963
+ // Convert bigint to number for PluralRules (which only accepts number)
2964
+ const numericValue = typeof value === "bigint" ? Number(value) : value;
2965
+ const rule = formatters.getPluralRules(locales, { type: el.pluralType }).select(numericValue - (el.offset || 0));
2966
+ opt = (Object.prototype.hasOwnProperty.call(el.options, rule) ? el.options[rule] : undefined) || el.options.other;
2967
+ }
2968
+ if (!opt) {
2969
+ throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);
2970
+ }
2971
+ // Convert bigint to number for currentPluralValue
2972
+ const numericValue = typeof value === "bigint" ? Number(value) : value;
2973
+ result.push(...formatToParts(opt.value, locales, formatters, formats, values, numericValue - (el.offset || 0)));
2974
+ continue;
2975
+ }
2976
+ }
2977
+ return mergeLiteral(result);
2978
+ }
2979
+
2980
+ /*
2981
+ Copyright (c) 2014, Yahoo! Inc. All rights reserved.
2982
+ Copyrights licensed under the New BSD License.
2983
+ See the accompanying LICENSE file for terms.
2984
+ */
2985
+ // -- MessageFormat --------------------------------------------------------
2986
+ function mergeConfig(c1, c2) {
2987
+ if (!c2) {
2988
+ return c1;
2989
+ }
2990
+ return {
2991
+ ...c1,
2992
+ ...c2,
2993
+ ...Object.keys(c1).reduce((all, k) => {
2994
+ all[k] = {
2995
+ ...c1[k],
2996
+ ...c2[k]
2997
+ };
2998
+ return all;
2999
+ }, {})
3000
+ };
3001
+ }
3002
+ function mergeConfigs(defaultConfig, configs) {
3003
+ if (!configs) {
3004
+ return defaultConfig;
3005
+ }
3006
+ return Object.keys(defaultConfig).reduce((all, k) => {
3007
+ all[k] = mergeConfig(defaultConfig[k], configs[k]);
3008
+ return all;
3009
+ }, { ...defaultConfig });
3010
+ }
3011
+ function createFastMemoizeCache(store) {
3012
+ return { create() {
3013
+ return {
3014
+ get(key) {
3015
+ return store[key];
3016
+ },
3017
+ set(key, value) {
3018
+ store[key] = value;
3019
+ }
3020
+ };
3021
+ } };
3022
+ }
3023
+ function createDefaultFormatters(cache = {
3024
+ number: {},
3025
+ dateTime: {},
3026
+ pluralRules: {}
3027
+ }) {
3028
+ return {
3029
+ getNumberFormat: memoize((...args) => new Intl.NumberFormat(...args), {
3030
+ cache: createFastMemoizeCache(cache.number),
3031
+ strategy: strategies.variadic
3032
+ }),
3033
+ getDateTimeFormat: memoize((...args) => new Intl.DateTimeFormat(...args), {
3034
+ cache: createFastMemoizeCache(cache.dateTime),
3035
+ strategy: strategies.variadic
3036
+ }),
3037
+ getPluralRules: memoize((...args) => new Intl.PluralRules(...args), {
3038
+ cache: createFastMemoizeCache(cache.pluralRules),
3039
+ strategy: strategies.variadic
3040
+ })
3041
+ };
3042
+ }
3043
+ class IntlMessageFormat {
3044
+ ast;
3045
+ locales;
3046
+ resolvedLocale;
3047
+ formatters;
3048
+ formats;
3049
+ message;
3050
+ formatterCache = {
3051
+ number: {},
3052
+ dateTime: {},
3053
+ pluralRules: {}
3054
+ };
3055
+ constructor(message, locales = IntlMessageFormat.defaultLocale, overrideFormats, opts) {
3056
+ // Defined first because it's used to build the format pattern.
3057
+ this.locales = locales;
3058
+ this.resolvedLocale = IntlMessageFormat.resolveLocale(locales);
3059
+ if (typeof message === "string") {
3060
+ this.message = message;
3061
+ if (!IntlMessageFormat.__parse) {
3062
+ throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");
3063
+ }
3064
+ const { ...parseOpts } = opts || {};
3065
+ // Parse string messages into an AST.
3066
+ this.ast = IntlMessageFormat.__parse(message, {
3067
+ ...parseOpts,
3068
+ locale: this.resolvedLocale
3069
+ });
3070
+ } else {
3071
+ this.ast = message;
3072
+ }
3073
+ if (!Array.isArray(this.ast)) {
3074
+ throw new TypeError("A message must be provided as a String or AST.");
3075
+ }
3076
+ // Creates a new object with the specified `formats` merged with the default
3077
+ // formats.
3078
+ this.formats = mergeConfigs(IntlMessageFormat.formats, overrideFormats);
3079
+ this.formatters = opts && opts.formatters || createDefaultFormatters(this.formatterCache);
3080
+ }
3081
+ format = (values) => {
3082
+ const parts = this.formatToParts(values);
3083
+ // Hot path for straight simple msg translations
3084
+ if (parts.length === 1) {
3085
+ return parts[0].value;
3086
+ }
3087
+ const result = parts.reduce((all, part) => {
3088
+ if (!all.length || part.type !== PART_TYPE.literal || typeof all[all.length - 1] !== "string") {
3089
+ all.push(part.value);
3090
+ } else {
3091
+ all[all.length - 1] += part.value;
3092
+ }
3093
+ return all;
3094
+ }, []);
3095
+ if (result.length <= 1) {
3096
+ return result[0] || "";
3097
+ }
3098
+ return result;
3099
+ };
3100
+ formatToParts = (values) => formatToParts(this.ast, this.locales, this.formatters, this.formats, values, undefined, this.message);
3101
+ resolvedOptions = () => ({ locale: this.resolvedLocale?.toString() || Intl.NumberFormat.supportedLocalesOf(this.locales)[0] });
3102
+ getAst = () => this.ast;
3103
+ static memoizedDefaultLocale = null;
3104
+ static get defaultLocale() {
3105
+ if (!IntlMessageFormat.memoizedDefaultLocale) {
3106
+ IntlMessageFormat.memoizedDefaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
3107
+ }
3108
+ return IntlMessageFormat.memoizedDefaultLocale;
3109
+ }
3110
+ static resolveLocale = (locales) => {
3111
+ if (typeof Intl.Locale === "undefined") {
3112
+ return;
3113
+ }
3114
+ const supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales);
3115
+ if (supportedLocales.length > 0) {
3116
+ return new Intl.Locale(supportedLocales[0]);
3117
+ }
3118
+ return new Intl.Locale(typeof locales === "string" ? locales : locales[0]);
3119
+ };
3120
+ static __parse = parse;
3121
+ // Default format options used as the prototype of the `formats` provided to the
3122
+ // constructor. These are used when constructing the internal Intl.NumberFormat
3123
+ // and Intl.DateTimeFormat instances.
3124
+ static formats = {
3125
+ number: {
3126
+ integer: { maximumFractionDigits: 0 },
3127
+ currency: { style: "currency" },
3128
+ percent: { style: "percent" }
3129
+ },
3130
+ date: {
3131
+ short: {
3132
+ month: "numeric",
3133
+ day: "numeric",
3134
+ year: "2-digit"
3135
+ },
3136
+ medium: {
3137
+ month: "short",
3138
+ day: "numeric",
3139
+ year: "numeric"
3140
+ },
3141
+ long: {
3142
+ month: "long",
3143
+ day: "numeric",
3144
+ year: "numeric"
3145
+ },
3146
+ full: {
3147
+ weekday: "long",
3148
+ month: "long",
3149
+ day: "numeric",
3150
+ year: "numeric"
3151
+ }
3152
+ },
3153
+ time: {
3154
+ short: {
3155
+ hour: "numeric",
3156
+ minute: "numeric"
3157
+ },
3158
+ medium: {
3159
+ hour: "numeric",
3160
+ minute: "numeric",
3161
+ second: "numeric"
3162
+ },
3163
+ long: {
3164
+ hour: "numeric",
3165
+ minute: "numeric",
3166
+ second: "numeric",
3167
+ timeZoneName: "short"
3168
+ },
3169
+ full: {
3170
+ hour: "numeric",
3171
+ minute: "numeric",
3172
+ second: "numeric",
3173
+ timeZoneName: "short"
3174
+ }
3175
+ }
3176
+ };
3177
+ }
3178
+
3179
+ const resourceCache = {};
3180
+ const determineFetchUrl = (locale = 'en') => getAssetPath(`i18n/genesys-webcomponents.i18n.${locale}.json`);
3181
+ const fetchResources = async (componentName, locale) => {
3182
+ if (!resourceCache[locale]) {
3183
+ const url = determineFetchUrl(locale);
3184
+ const response = await fetch(url);
3185
+ const resources = await response.json();
3186
+ resourceCache[locale] = resources;
3187
+ }
3188
+ return resourceCache[locale][componentName];
3189
+ };
3190
+
3191
+ var locales = [
3192
+ "ar",
3193
+ "cs",
3194
+ "da",
3195
+ "de",
3196
+ "en",
3197
+ "es-es",
3198
+ "es",
3199
+ "fi",
3200
+ "fr-ca",
3201
+ "fr",
3202
+ "he",
3203
+ "hi",
3204
+ "it",
3205
+ "ja",
3206
+ "ko",
3207
+ "nl",
3208
+ "no",
3209
+ "pl",
3210
+ "pt-br",
3211
+ "pt-pt",
3212
+ "ru",
3213
+ "sv",
3214
+ "th",
3215
+ "tr",
3216
+ "uk",
3217
+ "zh-cn",
3218
+ "zh-tw"
3219
+ ];
3220
+
3221
+ const ar = 6;
3222
+ const cs = 1;
3223
+ const da = 1;
3224
+ const de = 1;
3225
+ const en = 0;
3226
+ const es = 1;
3227
+ const fi = 1;
3228
+ const fr = 1;
3229
+ const he = 0;
3230
+ const hi = 0;
3231
+ const it = 1;
3232
+ const ja = 0;
3233
+ const ko = 0;
3234
+ const nl = 1;
3235
+ const no = 1;
3236
+ const pl = 1;
3237
+ const ru = 1;
3238
+ const sv = 1;
3239
+ const th = 0;
3240
+ const tr = 1;
3241
+ const uk = 1;
3242
+ var startOfWeekDataUntyped = {
3243
+ ar: ar,
3244
+ cs: cs,
3245
+ da: da,
3246
+ de: de,
3247
+ en: en,
3248
+ "es-es": 1,
3249
+ es: es,
3250
+ fi: fi,
3251
+ "fr-ca": 0,
3252
+ fr: fr,
3253
+ he: he,
3254
+ hi: hi,
3255
+ it: it,
3256
+ ja: ja,
3257
+ ko: ko,
3258
+ nl: nl,
3259
+ no: no,
3260
+ pl: pl,
3261
+ "pt-br": 0,
3262
+ "pt-pt": 0,
3263
+ ru: ru,
3264
+ sv: sv,
3265
+ th: th,
3266
+ tr: tr,
3267
+ uk: uk,
3268
+ "zh-cn": 1,
3269
+ "zh-tw": 0
3270
+ };
3271
+
3272
+ const DEFAULT_LOCALE = 'en';
3273
+ async function buildI18nForComponent(component, defaultResources, parentComponent) {
3274
+ let resources = defaultResources;
3275
+ let locale = 'en';
3276
+ if (component !== undefined) {
3277
+ locale = getDesiredLocale(component);
3278
+ resources = await getComponentI18nResources(component, defaultResources, locale, parentComponent);
3279
+ }
3280
+ const intlFormats = Object.entries(resources).reduce((map, [key, val]) => {
3281
+ map.set(key, new IntlMessageFormat(val, locale));
3282
+ return map;
3283
+ }, new Map());
3284
+ const defaultFormats = Object.entries(defaultResources).reduce((map, [key, val]) => {
3285
+ map.set(key, new IntlMessageFormat(val, DEFAULT_LOCALE));
3286
+ return map;
3287
+ }, new Map());
3288
+ return (resourceKey, context) => {
3289
+ var _a, _b;
3290
+ let i18nString = (_a = intlFormats.get(resourceKey)) === null || _a === void 0 ? void 0 : _a.format(context);
3291
+ if (!i18nString) {
3292
+ i18nString = (_b = defaultFormats.get(resourceKey)) === null || _b === void 0 ? void 0 : _b.format(context);
3293
+ console.warn(`No localized string available for "${resourceKey}-${i18nString}" for "${locale}" locale. Falling back to English translation.`);
3294
+ }
3295
+ return i18nString;
3296
+ };
3297
+ }
3298
+ async function getComponentI18nResources(component, defaultResources, locale, parentComponent) {
3299
+ const componentName = parentComponent ||
3300
+ component.tagName.toLocaleLowerCase().replace(/-beta$/, '');
3301
+ let resources;
3302
+ if (component['i18n-resources']) {
3303
+ resources = component['i18n-resources'];
3304
+ }
3305
+ else if (locale !== DEFAULT_LOCALE) {
3306
+ try {
3307
+ resources = await fetchResources(componentName, locale);
3308
+ }
3309
+ catch (_a) {
3310
+ resources = null;
3311
+ }
3312
+ }
3313
+ if (!resources) {
3314
+ resources = defaultResources;
3315
+ }
3316
+ return resources;
3317
+ }
3318
+ function getDesiredLocale(element) {
3319
+ const locale = findLocaleInDom(element);
3320
+ const lang = locale.split(/[_-]/)[0];
3321
+ if (locales.indexOf(locale) >= 0) {
3322
+ return locale;
3323
+ }
3324
+ else if (locales.indexOf(lang) >= 0) {
3325
+ return lang;
3326
+ }
3327
+ else {
3328
+ return DEFAULT_LOCALE;
3329
+ }
3330
+ }
3331
+ function findLocaleInDom(element) {
3332
+ const closestElement = getClosestElement('[lang]', element);
3333
+ if (closestElement && closestElement.lang) {
3334
+ return closestElement.lang.toLowerCase();
3335
+ }
3336
+ else {
3337
+ return DEFAULT_LOCALE;
3338
+ }
3339
+ }
3340
+ /**
3341
+ * Get the 0-indexed first day of the week for a given locale, where 0 represents
3342
+ * Sunday. This should be considered deprecated, as newer browser APIs use
3343
+ * a different day-of-week indexing scheme, provided by `getFirstDayOfWeek`
3344
+ * @param locale
3345
+ * @returns A number representing the first day of the week where 0 is Sunday
3346
+ */
3347
+ function getStartOfWeek(locale = DEFAULT_LOCALE) {
3348
+ const startOfWeekData = startOfWeekDataUntyped;
3349
+ return (startOfWeekData[locale]
3350
+ ? startOfWeekData[locale]
3351
+ : startOfWeekData[DEFAULT_LOCALE]);
3352
+ }
3353
+ function getFirstDayOfWeek(locale = DEFAULT_LOCALE) {
3354
+ // Eventually, we can hopefully convert all of this to:
3355
+ // `new Locale(locale).getWeekInfo().firstDay`
3356
+ // Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo
3357
+ const legacyFirstDay = getStartOfWeek(locale);
3358
+ // This looks crazy, but it's the following:
3359
+ // - Shift legacy days "left" 1 place: `legacyFirstDay - 1`
3360
+ // - Take a true mathematical modulo: `((n % d) + d) % d` (where d is 7)
3361
+ // to get back to the correct range
3362
+ // - Add 1 to make the list 1-indexed.
3363
+ return (((((legacyFirstDay - 1) % 7) + 7) % 7) + 1);
3364
+ }
3365
+
3366
+ export { getFirstDayOfWeek as a, buildI18nForComponent as b, getStartOfWeek as c, getDesiredLocale as g, locales as l };