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