@formatjs/intl-pluralrules 6.3.13 → 6.3.14

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.
package/polyfill.iife.js CHANGED
@@ -1,4 +1,391 @@
1
- import { supportedLocales } from "@formatjs_generated/cldr.supported-locales/intl-pluralrules.js";
1
+ //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-locales@0.0.0/node_modules/@formatjs_generated/cldr.supported-locales/default-content.js
2
+ const defaultContent = {
3
+ "aa": ["aa-ET"],
4
+ "ab": ["ab-GE"],
5
+ "af": ["af-ZA"],
6
+ "agq": ["agq-CM"],
7
+ "ak": ["ak-GH"],
8
+ "am": ["am-ET"],
9
+ "an": ["an-ES"],
10
+ "ann": ["ann-NG"],
11
+ "apc": ["apc-SY"],
12
+ "ar": ["ar-001"],
13
+ "arn": ["arn-CL"],
14
+ "as": ["as-IN"],
15
+ "asa": ["asa-TZ"],
16
+ "ast": ["ast-ES"],
17
+ "az-Arab": ["az-Arab-IR"],
18
+ "az-Cyrl": ["az-Cyrl-AZ"],
19
+ "az-Latn": ["az-Latn-AZ"],
20
+ "ba": ["ba-RU"],
21
+ "bal-Arab": ["bal-Arab-PK"],
22
+ "bal-Latn": ["bal-Latn-PK"],
23
+ "bas": ["bas-CM"],
24
+ "be": ["be-BY"],
25
+ "bem": ["bem-ZM"],
26
+ "bew": ["bew-ID"],
27
+ "bez": ["bez-TZ"],
28
+ "bg": ["bg-BG"],
29
+ "bgc": ["bgc-IN"],
30
+ "bgn": ["bgn-PK"],
31
+ "bho": ["bho-IN"],
32
+ "blo": ["blo-BJ"],
33
+ "blt": ["blt-VN"],
34
+ "bm": ["bm-ML"],
35
+ "bm-Nkoo": ["bm-Nkoo-ML"],
36
+ "bn": ["bn-BD"],
37
+ "bo": ["bo-CN"],
38
+ "bqi": ["bqi-IR"],
39
+ "br": ["br-FR"],
40
+ "brx": ["brx-IN"],
41
+ "bs-Cyrl": ["bs-Cyrl-BA"],
42
+ "bs-Latn": ["bs-Latn-BA"],
43
+ "bss": ["bss-CM"],
44
+ "bua": ["bua-RU"],
45
+ "byn": ["byn-ER"],
46
+ "ca": ["ca-ES"],
47
+ "cad": ["cad-US"],
48
+ "cch": ["cch-NG"],
49
+ "ccp": ["ccp-BD"],
50
+ "ce": ["ce-RU"],
51
+ "ceb": ["ceb-PH"],
52
+ "cgg": ["cgg-UG"],
53
+ "cho": ["cho-US"],
54
+ "chr": ["chr-US"],
55
+ "cic": ["cic-US"],
56
+ "ckb": ["ckb-IQ"],
57
+ "co": ["co-FR"],
58
+ "cop": ["cop-EG"],
59
+ "cs": ["cs-CZ"],
60
+ "csw": ["csw-CA"],
61
+ "cu": ["cu-RU"],
62
+ "cv": ["cv-RU"],
63
+ "cy": ["cy-GB"],
64
+ "da": ["da-DK"],
65
+ "dav": ["dav-KE"],
66
+ "de": ["de-DE"],
67
+ "dje": ["dje-NE"],
68
+ "doi": ["doi-IN"],
69
+ "dsb": ["dsb-DE"],
70
+ "dua": ["dua-CM"],
71
+ "dv": ["dv-MV"],
72
+ "dyo": ["dyo-SN"],
73
+ "dz": ["dz-BT"],
74
+ "ebu": ["ebu-KE"],
75
+ "ee": ["ee-GH"],
76
+ "el": ["el-GR"],
77
+ "en-Dsrt": ["en-Dsrt-US"],
78
+ "en-Shaw": ["en-Shaw-GB"],
79
+ "en": ["en-US"],
80
+ "eo": ["eo-001"],
81
+ "es": ["es-ES"],
82
+ "et": ["et-EE"],
83
+ "eu": ["eu-ES"],
84
+ "ewo": ["ewo-CM"],
85
+ "fa": ["fa-IR"],
86
+ "ff-Adlm": ["ff-Adlm-GN"],
87
+ "ff-Latn": ["ff-Latn-SN"],
88
+ "fi": ["fi-FI"],
89
+ "fil": ["fil-PH"],
90
+ "fo": ["fo-FO"],
91
+ "fr": ["fr-FR"],
92
+ "frr": ["frr-DE"],
93
+ "fur": ["fur-IT"],
94
+ "fy": ["fy-NL"],
95
+ "ga": ["ga-IE"],
96
+ "gaa": ["gaa-GH"],
97
+ "gd": ["gd-GB"],
98
+ "gez": ["gez-ET"],
99
+ "gl": ["gl-ES"],
100
+ "gn": ["gn-PY"],
101
+ "gsw": ["gsw-CH"],
102
+ "gu": ["gu-IN"],
103
+ "guz": ["guz-KE"],
104
+ "gv": ["gv-IM"],
105
+ "ha-Arab": ["ha-Arab-NG"],
106
+ "ha": ["ha-NG"],
107
+ "haw": ["haw-US"],
108
+ "he": ["he-IL"],
109
+ "hi": ["hi-IN"],
110
+ "hi-Latn": ["hi-Latn-IN"],
111
+ "hnj-Hmnp": ["hnj-Hmnp-US"],
112
+ "hr": ["hr-HR"],
113
+ "hsb": ["hsb-DE"],
114
+ "ht": ["ht-HT"],
115
+ "hu": ["hu-HU"],
116
+ "hy": ["hy-AM"],
117
+ "ia": ["ia-001"],
118
+ "id": ["id-ID"],
119
+ "ie": ["ie-EE"],
120
+ "ig": ["ig-NG"],
121
+ "ii": ["ii-CN"],
122
+ "io": ["io-001"],
123
+ "is": ["is-IS"],
124
+ "it": ["it-IT"],
125
+ "iu": ["iu-CA"],
126
+ "iu-Latn": ["iu-Latn-CA"],
127
+ "ja": ["ja-JP"],
128
+ "jbo": ["jbo-001"],
129
+ "jgo": ["jgo-CM"],
130
+ "jmc": ["jmc-TZ"],
131
+ "jv": ["jv-ID"],
132
+ "ka": ["ka-GE"],
133
+ "kaa-Cyrl": ["kaa-Cyrl-UZ"],
134
+ "kaa-Latn": ["kaa-Latn-UZ"],
135
+ "kab": ["kab-DZ"],
136
+ "kaj": ["kaj-NG"],
137
+ "kam": ["kam-KE"],
138
+ "kcg": ["kcg-NG"],
139
+ "kde": ["kde-TZ"],
140
+ "kea": ["kea-CV"],
141
+ "kek": ["kek-GT"],
142
+ "ken": ["ken-CM"],
143
+ "kgp": ["kgp-BR"],
144
+ "khq": ["khq-ML"],
145
+ "ki": ["ki-KE"],
146
+ "kk-Arab": ["kk-Arab-CN"],
147
+ "kk-Cyrl": ["kk-Cyrl-KZ"],
148
+ "kkj": ["kkj-CM"],
149
+ "kl": ["kl-GL"],
150
+ "kln": ["kln-KE"],
151
+ "km": ["km-KH"],
152
+ "kn": ["kn-IN"],
153
+ "ko": ["ko-KR"],
154
+ "kok-Deva": ["kok-Deva-IN"],
155
+ "kok-Latn": ["kok-Latn-IN"],
156
+ "kpe": ["kpe-LR"],
157
+ "ks-Arab": ["ks-Arab-IN"],
158
+ "ks-Deva": ["ks-Deva-IN"],
159
+ "ksb": ["ksb-TZ"],
160
+ "ksf": ["ksf-CM"],
161
+ "ksh": ["ksh-DE"],
162
+ "ku-Arab": ["ku-Arab-IQ"],
163
+ "ku-Latn": ["ku-Latn-TR"],
164
+ "kw": ["kw-GB"],
165
+ "kxv-Deva": ["kxv-Deva-IN"],
166
+ "kxv-Latn": ["kxv-Latn-IN"],
167
+ "kxv-Orya": ["kxv-Orya-IN"],
168
+ "kxv-Telu": ["kxv-Telu-IN"],
169
+ "ky": ["ky-KG"],
170
+ "la": ["la-VA"],
171
+ "lag": ["lag-TZ"],
172
+ "lb": ["lb-LU"],
173
+ "lg": ["lg-UG"],
174
+ "lij": ["lij-IT"],
175
+ "lkt": ["lkt-US"],
176
+ "lld": ["lld-IT"],
177
+ "lmo": ["lmo-IT"],
178
+ "ln": ["ln-CD"],
179
+ "lo": ["lo-LA"],
180
+ "lrc": ["lrc-IR"],
181
+ "lt": ["lt-LT"],
182
+ "ltg": ["ltg-LV"],
183
+ "lu": ["lu-CD"],
184
+ "luo": ["luo-KE"],
185
+ "luy": ["luy-KE"],
186
+ "lv": ["lv-LV"],
187
+ "lzz": ["lzz-TR"],
188
+ "mai": ["mai-IN"],
189
+ "mas": ["mas-KE"],
190
+ "mdf": ["mdf-RU"],
191
+ "mer": ["mer-KE"],
192
+ "mfe": ["mfe-MU"],
193
+ "mg": ["mg-MG"],
194
+ "mgh": ["mgh-MZ"],
195
+ "mgo": ["mgo-CM"],
196
+ "mhn": ["mhn-IT"],
197
+ "mi": ["mi-NZ"],
198
+ "mic": ["mic-CA"],
199
+ "mk": ["mk-MK"],
200
+ "ml": ["ml-IN"],
201
+ "mn": ["mn-MN"],
202
+ "mn-Mong": ["mn-Mong-CN"],
203
+ "mni-Beng": ["mni-Beng-IN"],
204
+ "mni-Mtei": ["mni-Mtei-IN"],
205
+ "moh": ["moh-CA"],
206
+ "mr": ["mr-IN"],
207
+ "ms-Arab": ["ms-Arab-MY"],
208
+ "ms": ["ms-MY"],
209
+ "mt": ["mt-MT"],
210
+ "mua": ["mua-CM"],
211
+ "mus": ["mus-US"],
212
+ "mww-Hmnp": ["mww-Hmnp-US"],
213
+ "my": ["my-MM"],
214
+ "myv": ["myv-RU"],
215
+ "mzn": ["mzn-IR"],
216
+ "naq": ["naq-NA"],
217
+ "nb": ["nb-NO"],
218
+ "nd": ["nd-ZW"],
219
+ "nds": ["nds-DE"],
220
+ "ne": ["ne-NP"],
221
+ "nl": ["nl-NL"],
222
+ "nmg": ["nmg-CM"],
223
+ "nn": ["nn-NO"],
224
+ "nnh": ["nnh-CM"],
225
+ "nqo": ["nqo-GN"],
226
+ "nr": ["nr-ZA"],
227
+ "nso": ["nso-ZA"],
228
+ "nus": ["nus-SS"],
229
+ "nv": ["nv-US"],
230
+ "ny": ["ny-MW"],
231
+ "nyn": ["nyn-UG"],
232
+ "oc": ["oc-FR"],
233
+ "oka": ["oka-CA"],
234
+ "om": ["om-ET"],
235
+ "or": ["or-IN"],
236
+ "os": ["os-GE"],
237
+ "osa": ["osa-US"],
238
+ "pa-Arab": ["pa-Arab-PK"],
239
+ "pa-Guru": ["pa-Guru-IN"],
240
+ "pap": ["pap-CW"],
241
+ "pcm": ["pcm-NG"],
242
+ "pi-Latn": ["pi-Latn-GB"],
243
+ "pis": ["pis-SB"],
244
+ "pl": ["pl-PL"],
245
+ "pms": ["pms-IT"],
246
+ "prg": ["prg-PL"],
247
+ "ps": ["ps-AF"],
248
+ "pt": ["pt-BR"],
249
+ "qu": ["qu-PE"],
250
+ "quc": ["quc-GT"],
251
+ "raj": ["raj-IN"],
252
+ "rhg-Rohg": ["rhg-Rohg-MM"],
253
+ "rif": ["rif-MA"],
254
+ "rm": ["rm-CH"],
255
+ "rn": ["rn-BI"],
256
+ "ro": ["ro-RO"],
257
+ "rof": ["rof-TZ"],
258
+ "ru": ["ru-RU"],
259
+ "rw": ["rw-RW"],
260
+ "rwk": ["rwk-TZ"],
261
+ "sa": ["sa-IN"],
262
+ "sah": ["sah-RU"],
263
+ "saq": ["saq-KE"],
264
+ "sat-Deva": ["sat-Deva-IN"],
265
+ "sat-Olck": ["sat-Olck-IN"],
266
+ "sbp": ["sbp-TZ"],
267
+ "sc": ["sc-IT"],
268
+ "scn": ["scn-IT"],
269
+ "sd-Arab": ["sd-Arab-PK"],
270
+ "sd-Deva": ["sd-Deva-IN"],
271
+ "sdh": ["sdh-IR"],
272
+ "se": ["se-NO"],
273
+ "seh": ["seh-MZ"],
274
+ "ses": ["ses-ML"],
275
+ "sg": ["sg-CF"],
276
+ "sgs": ["sgs-LT"],
277
+ "shi-Latn": ["shi-Latn-MA"],
278
+ "shi-Tfng": ["shi-Tfng-MA"],
279
+ "shn": ["shn-MM"],
280
+ "si": ["si-LK"],
281
+ "sid": ["sid-ET"],
282
+ "sk": ["sk-SK"],
283
+ "skr": ["skr-PK"],
284
+ "sl": ["sl-SI"],
285
+ "sma": ["sma-SE"],
286
+ "smj": ["smj-SE"],
287
+ "smn": ["smn-FI"],
288
+ "sms": ["sms-FI"],
289
+ "sn": ["sn-ZW"],
290
+ "so": ["so-SO"],
291
+ "sq": ["sq-AL"],
292
+ "sr-Cyrl": ["sr-Cyrl-RS"],
293
+ "sr-Latn": ["sr-Latn-RS"],
294
+ "ss": ["ss-ZA"],
295
+ "ssy": ["ssy-ER"],
296
+ "st": ["st-ZA"],
297
+ "su-Latn": ["su-Latn-ID"],
298
+ "suz-Deva": ["suz-Deva-NP"],
299
+ "suz-Sunu": ["suz-Sunu-NP"],
300
+ "sv": ["sv-SE"],
301
+ "sw": ["sw-TZ"],
302
+ "syr": ["syr-IQ"],
303
+ "szl": ["szl-PL"],
304
+ "ta": ["ta-IN"],
305
+ "te": ["te-IN"],
306
+ "teo": ["teo-UG"],
307
+ "tg": ["tg-TJ"],
308
+ "th": ["th-TH"],
309
+ "ti": ["ti-ET"],
310
+ "tig": ["tig-ER"],
311
+ "tk": ["tk-TM"],
312
+ "tn": ["tn-ZA"],
313
+ "to": ["to-TO"],
314
+ "tok": ["tok-001"],
315
+ "tpi": ["tpi-PG"],
316
+ "tr": ["tr-TR"],
317
+ "trv": ["trv-TW"],
318
+ "trw": ["trw-PK"],
319
+ "ts": ["ts-ZA"],
320
+ "tt": ["tt-RU"],
321
+ "twq": ["twq-NE"],
322
+ "tyv": ["tyv-RU"],
323
+ "tzm": ["tzm-MA"],
324
+ "ug": ["ug-CN"],
325
+ "uk": ["uk-UA"],
326
+ "ur": ["ur-PK"],
327
+ "uz-Arab": ["uz-Arab-AF"],
328
+ "uz-Cyrl": ["uz-Cyrl-UZ"],
329
+ "uz-Latn": ["uz-Latn-UZ"],
330
+ "vai-Latn": ["vai-Latn-LR"],
331
+ "vai-Vaii": ["vai-Vaii-LR"],
332
+ "ve": ["ve-ZA"],
333
+ "vec": ["vec-IT"],
334
+ "vi": ["vi-VN"],
335
+ "vmw": ["vmw-MZ"],
336
+ "vo": ["vo-001"],
337
+ "vun": ["vun-TZ"],
338
+ "wa": ["wa-BE"],
339
+ "wae": ["wae-CH"],
340
+ "wal": ["wal-ET"],
341
+ "wbp": ["wbp-AU"],
342
+ "wo": ["wo-SN"],
343
+ "xh": ["xh-ZA"],
344
+ "xnr": ["xnr-IN"],
345
+ "xog": ["xog-UG"],
346
+ "yav": ["yav-CM"],
347
+ "yi": ["yi-UA"],
348
+ "yo": ["yo-NG"],
349
+ "yrl": ["yrl-BR"],
350
+ "yue-Hans": ["yue-Hans-CN"],
351
+ "yue-Hant": ["yue-Hant-HK"],
352
+ "za": ["za-CN"],
353
+ "zgh": ["zgh-MA"],
354
+ "zh-Hans": ["zh-Hans-CN"],
355
+ "zh-Hant": ["zh-Hant-TW"],
356
+ "zh-Latn": ["zh-Latn-CN"],
357
+ "zu": ["zu-ZA"]
358
+ };
359
+ //#endregion
360
+ //#region packages/ecma402-abstract/registerLocaleData.js
361
+ const explicitLocales = /* @__PURE__ */ new WeakMap();
362
+ function registerLocaleData(locale, data, localeData, availableLocales) {
363
+ let loaded = explicitLocales.get(localeData);
364
+ if (!loaded) {
365
+ loaded = /* @__PURE__ */ new Set();
366
+ explicitLocales.set(localeData, loaded);
367
+ }
368
+ loaded.add(locale);
369
+ const locales = [locale, ...defaultContent[locale] || []];
370
+ for (const tag of locales) {
371
+ if (tag === locale || !loaded.has(tag) || localeData[tag] === void 0) localeData[tag] = data;
372
+ availableLocales.add(tag);
373
+ }
374
+ for (const tag of locales) {
375
+ const parts = tag.split("-");
376
+ const fallbacks = [];
377
+ while (parts.length > 1) {
378
+ if (parts.length > 2 && parts[1].length === 4) fallbacks.push([parts[0], ...parts.slice(2)].join("-"));
379
+ parts.pop();
380
+ fallbacks.push(parts.join("-"));
381
+ }
382
+ for (const fallback of fallbacks) {
383
+ if (localeData[fallback] === void 0) localeData[fallback] = localeData[tag];
384
+ availableLocales.add(fallback);
385
+ }
386
+ }
387
+ }
388
+ //#endregion
2
389
  //#region packages/ecma402-abstract/CanonicalizeLocaleList.js
3
390
  /**
4
391
  * http://ecma-international.org/ecma-402/7.0/index.html#sec-canonicalizelocalelist
@@ -3261,7 +3648,20 @@ const regions = {
3261
3648
  "ZW"
3262
3649
  ]
3263
3650
  };
3264
- const UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
3651
+ function splitUnicodeExtension(locale) {
3652
+ const subtags = locale.split("-");
3653
+ for (let i = 1; i < subtags.length; i++) {
3654
+ if (subtags[i] === "x") break;
3655
+ if (subtags[i] !== "u") continue;
3656
+ let end = i + 1;
3657
+ while (end < subtags.length && subtags[end].length > 1) end++;
3658
+ return {
3659
+ locale: [...subtags.slice(0, i), ...subtags.slice(end)].join("-"),
3660
+ extension: "-" + subtags.slice(i, end).join("-")
3661
+ };
3662
+ }
3663
+ return { locale };
3664
+ }
3265
3665
  /**
3266
3666
  * Asserts that a condition is true, throwing an error if it is not.
3267
3667
  * Used for runtime validation and type narrowing.
@@ -3277,7 +3677,7 @@ const UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
3277
3677
  * // locale is now narrowed to non-undefined type
3278
3678
  * ```
3279
3679
  */
3280
- function invariant$3(condition, message, Err = Error) {
3680
+ function invariant$2(condition, message, Err = Error) {
3281
3681
  if (!condition) throw new Err(message);
3282
3682
  }
3283
3683
  const DEFAULT_MATCHING_THRESHOLD = 838;
@@ -3561,7 +3961,7 @@ function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
3561
3961
  let extension;
3562
3962
  const noExtensionLocales = [];
3563
3963
  const noExtensionLocaleMap = requestedLocales.reduce((all, l) => {
3564
- const noExtensionLocale = l.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, "");
3964
+ const { locale: noExtensionLocale } = splitUnicodeExtension(l);
3565
3965
  noExtensionLocales.push(noExtensionLocale);
3566
3966
  all[noExtensionLocale] = l;
3567
3967
  return all;
@@ -3569,7 +3969,7 @@ function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
3569
3969
  const result = findBestMatch(noExtensionLocales, availableLocales);
3570
3970
  if (result.matchedSupportedLocale && result.matchedDesiredLocale) {
3571
3971
  foundLocale = result.matchedSupportedLocale;
3572
- extension = noExtensionLocaleMap[result.matchedDesiredLocale].slice(result.matchedDesiredLocale.length) || void 0;
3972
+ extension = splitUnicodeExtension(noExtensionLocaleMap[result.matchedDesiredLocale]).extension;
3573
3973
  }
3574
3974
  if (!foundLocale) return { locale: getDefaultLocale() };
3575
3975
  return {
@@ -3579,14 +3979,14 @@ function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
3579
3979
  }
3580
3980
  function CanonicalizeUValue(ukey, uvalue) {
3581
3981
  let lowerValue = uvalue.toLowerCase();
3582
- invariant$3(ukey !== void 0, `ukey must be defined`);
3982
+ invariant$2(ukey !== void 0, `ukey must be defined`);
3583
3983
  return lowerValue;
3584
3984
  }
3585
3985
  function CanonicalizeUnicodeLocaleId(locale) {
3586
3986
  return Intl.getCanonicalLocales(locale)[0];
3587
3987
  }
3588
3988
  function InsertUnicodeExtensionAndCanonicalize(locale, attributes, keywords) {
3589
- invariant$3(locale.indexOf("-u-") === -1, "Expected locale to not have a Unicode locale extension");
3989
+ invariant$2(splitUnicodeExtension(locale).extension === void 0, "Expected locale to not have a Unicode locale extension");
3590
3990
  let extension = "-u";
3591
3991
  for (const attr of attributes) extension += `-${attr}`;
3592
3992
  for (const kw of keywords) {
@@ -3635,11 +4035,11 @@ function BestAvailableLocale(availableLocales, locale) {
3635
4035
  function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
3636
4036
  const result = { locale: "" };
3637
4037
  for (const locale of requestedLocales) {
3638
- const noExtensionLocale = locale.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, "");
4038
+ const { locale: noExtensionLocale, extension } = splitUnicodeExtension(locale);
3639
4039
  const availableLocale = BestAvailableLocale(availableLocales, noExtensionLocale);
3640
4040
  if (availableLocale) {
3641
4041
  result.locale = availableLocale;
3642
- if (locale !== noExtensionLocale) result.extension = locale.slice(noExtensionLocale.length, locale.length);
4042
+ if (extension) result.extension = extension;
3643
4043
  return result;
3644
4044
  }
3645
4045
  }
@@ -3647,8 +4047,8 @@ function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
3647
4047
  return result;
3648
4048
  }
3649
4049
  function UnicodeExtensionComponents(extension) {
3650
- invariant$3(extension === extension.toLowerCase(), "Expected extension to be lowercase");
3651
- invariant$3(extension.slice(0, 3) === "-u-", "Expected extension to be a Unicode locale extension");
4050
+ invariant$2(extension === extension.toLowerCase(), "Expected extension to be lowercase");
4051
+ invariant$2(extension.slice(0, 3) === "-u-", "Expected extension to be a Unicode locale extension");
3652
4052
  const attributes = [];
3653
4053
  const keywords = [];
3654
4054
  let keyword;
@@ -3660,7 +4060,7 @@ function UnicodeExtensionComponents(extension) {
3660
4060
  if (e === -1) len = size - k;
3661
4061
  else len = e - k;
3662
4062
  let subtag = extension.slice(k, k + len);
3663
- invariant$3(len >= 2, "Expected a subtag to have at least 2 characters");
4063
+ invariant$2(len >= 2, "Expected a subtag to have at least 2 characters");
3664
4064
  if (keyword === void 0 && len != 2) {
3665
4065
  if (attributes.indexOf(subtag) === -1) attributes.push(subtag);
3666
4066
  } else if (len === 2) {
@@ -3671,7 +4071,7 @@ function UnicodeExtensionComponents(extension) {
3671
4071
  if (keywords.find((k) => k.key === keyword?.key) === void 0) keywords.push(keyword);
3672
4072
  } else if (keyword?.value === "") keyword.value = subtag;
3673
4073
  else {
3674
- invariant$3(keyword !== void 0, "Expected keyword to be defined");
4074
+ invariant$2(keyword !== void 0, "Expected keyword to be defined");
3675
4075
  keyword.value += "-" + subtag;
3676
4076
  }
3677
4077
  k += len + 1;
@@ -3695,10 +4095,9 @@ function ResolveLocale(availableLocales, requestedLocales, options, relevantExte
3695
4095
  };
3696
4096
  let foundLocale = r.locale;
3697
4097
  let foundLocaleData = localeData[foundLocale];
3698
- const result = {
3699
- locale: "en",
3700
- dataLocale: foundLocale
3701
- };
4098
+ const result = Object.create(null);
4099
+ result.locale = "en";
4100
+ result.dataLocale = foundLocale;
3702
4101
  let components;
3703
4102
  let keywords;
3704
4103
  if (r.extension) {
@@ -3708,9 +4107,9 @@ function ResolveLocale(availableLocales, requestedLocales, options, relevantExte
3708
4107
  let supportedKeywords = [];
3709
4108
  for (const key of relevantExtensionKeys) {
3710
4109
  let keyLocaleData = foundLocaleData?.[key] ?? [];
3711
- invariant$3(Array.isArray(keyLocaleData), `keyLocaleData for ${key} must be an array`);
4110
+ invariant$2(Array.isArray(keyLocaleData), `keyLocaleData for ${key} must be an array`);
3712
4111
  let value = keyLocaleData[0];
3713
- invariant$3(value === void 0 || typeof value === "string", `value must be a string or undefined`);
4112
+ invariant$2(value == null || typeof value === "string", `value must be a string, null, or undefined`);
3714
4113
  let supportedKeyword;
3715
4114
  let entry = keywords.find((k) => k.key === key);
3716
4115
  if (entry) {
@@ -3732,12 +4131,12 @@ function ResolveLocale(availableLocales, requestedLocales, options, relevantExte
3732
4131
  }
3733
4132
  }
3734
4133
  let optionsValue = options[key];
3735
- invariant$3(optionsValue == null || typeof optionsValue === "string", `optionsValue must be a string or undefined`);
4134
+ invariant$2(optionsValue == null || typeof optionsValue === "string", `optionsValue must be a string or undefined`);
3736
4135
  if (typeof optionsValue === "string") {
3737
4136
  optionsValue = CanonicalizeUValue(key.toLowerCase(), optionsValue);
3738
4137
  if (optionsValue === "") optionsValue = "true";
3739
4138
  }
3740
- if (optionsValue !== value && keyLocaleData.indexOf(optionsValue) > -1) {
4139
+ if (optionsValue !== void 0 && optionsValue !== value && keyLocaleData.indexOf(optionsValue) > -1) {
3741
4140
  value = optionsValue;
3742
4141
  supportedKeyword = void 0;
3743
4142
  }
@@ -3760,8 +4159,8 @@ function ResolveLocale(availableLocales, requestedLocales, options, relevantExte
3760
4159
  function LookupSupportedLocales(availableLocales, requestedLocales) {
3761
4160
  const subset = [];
3762
4161
  for (const locale of requestedLocales) {
3763
- const availableLocale = BestAvailableLocale(availableLocales, locale.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, ""));
3764
- if (availableLocale) subset.push(availableLocale);
4162
+ const { locale: noExtensionLocale } = splitUnicodeExtension(locale);
4163
+ if (BestAvailableLocale(availableLocales, noExtensionLocale)) subset.push(locale);
3765
4164
  }
3766
4165
  return subset;
3767
4166
  }
@@ -3797,7 +4196,7 @@ function ToString(o) {
3797
4196
  * @param fallback
3798
4197
  */
3799
4198
  function GetOption(opts, prop, type, values, fallback) {
3800
- if (typeof opts !== "object") throw new TypeError("Options must be an object");
4199
+ if (opts === null || typeof opts !== "object" && typeof opts !== "function") throw new TypeError("Options must be an object");
3801
4200
  let value = opts[prop];
3802
4201
  if (value !== void 0) {
3803
4202
  if (type !== "boolean" && type !== "string") throw new TypeError("invalid type");
@@ -4286,7 +4685,7 @@ var BigDecimal = class BigDecimal {
4286
4685
  };
4287
4686
  //#endregion
4288
4687
  //#region packages/ecma262-abstract/ToPrimitive.js
4289
- function invariant$2(condition, message, Err = Error) {
4688
+ function invariant$1(condition, message, Err = Error) {
4290
4689
  if (!condition) throw new Err(message);
4291
4690
  }
4292
4691
  function IsCallable(fn) {
@@ -4316,7 +4715,7 @@ function ToPrimitive(input, preferredType) {
4316
4715
  if (preferredType === void 0) hint = "default";
4317
4716
  else if (preferredType === "string") hint = "string";
4318
4717
  else {
4319
- invariant$2(preferredType === "number", "preferredType must be \"string\" or \"number\"");
4718
+ invariant$1(preferredType === "number", "preferredType must be \"string\" or \"number\"");
4320
4719
  hint = "number";
4321
4720
  }
4322
4721
  let result = exoticToPrim.call(input, hint);
@@ -4337,6 +4736,7 @@ function ToPrimitive(input, preferredType) {
4337
4736
  function ToIntlMathematicalValue(input) {
4338
4737
  if (typeof input === "bigint") return new BigDecimal(input.toString());
4339
4738
  let primValue = ToPrimitive(input, "number");
4739
+ if (typeof primValue === "symbol") throw new TypeError("Cannot convert a Symbol value to a number");
4340
4740
  if (primValue === void 0) return new BigDecimal(NaN);
4341
4741
  if (primValue === true) return new BigDecimal(1);
4342
4742
  if (primValue === false) return new BigDecimal(0);
@@ -4361,7 +4761,9 @@ function CoerceOptionsToObject(options) {
4361
4761
  //#endregion
4362
4762
  //#region packages/ecma402-abstract/DefaultNumberOption.js
4363
4763
  /**
4764
+ * ECMA-402 §9.2.13 DefaultNumberOption, step 2.
4364
4765
  * https://tc39.es/ecma402/#sec-defaultnumberoption
4766
+ * https://github.com/tc39/ecma402/blob/b1c961988b9a07894b1dc3dc2b5626ea48387d61/spec/negotiation.html#L437
4365
4767
  * @param val
4366
4768
  * @param min
4367
4769
  * @param max
@@ -4369,7 +4771,7 @@ function CoerceOptionsToObject(options) {
4369
4771
  */
4370
4772
  function DefaultNumberOption(inputVal, min, max, fallback) {
4371
4773
  if (inputVal === void 0) return fallback;
4372
- const val = Number(inputVal);
4774
+ const val = +inputVal;
4373
4775
  if (isNaN(val) || val < min || val > max) throw new RangeError(`${val} is outside of range [${min}, ${max}]`);
4374
4776
  return Math.floor(val);
4375
4777
  }
@@ -4412,7 +4814,7 @@ function ensureIntl() {
4412
4814
  });
4413
4815
  return Intl;
4414
4816
  }
4415
- function invariant$1(condition, message, Err = Error) {
4817
+ function invariant(condition, message, Err = Error) {
4416
4818
  if (!condition) throw new Err(message);
4417
4819
  }
4418
4820
  memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
@@ -4448,8 +4850,8 @@ function SetNumberFormatDigitOptions(internalSlots, opts, mnfdDefault, mxfdDefau
4448
4850
  let mxsd = opts.maximumSignificantDigits;
4449
4851
  internalSlots.minimumIntegerDigits = mnid;
4450
4852
  const roundingIncrement = GetNumberOption(opts, "roundingIncrement", 1, 5e3, 1);
4451
- invariant$1(VALID_ROUNDING_INCREMENTS.has(roundingIncrement), `Invalid rounding increment value: ${roundingIncrement}.
4452
- Valid values are ${Array.from(VALID_ROUNDING_INCREMENTS).join(", ")}.`);
4853
+ invariant(VALID_ROUNDING_INCREMENTS.has(roundingIncrement), `Invalid rounding increment value: ${roundingIncrement}.
4854
+ Valid values are ${Array.from(VALID_ROUNDING_INCREMENTS).join(", ")}.`, RangeError);
4453
4855
  const roundingMode = GetOption(opts, "roundingMode", "string", [
4454
4856
  "ceil",
4455
4857
  "floor",
@@ -4479,26 +4881,30 @@ Valid values are ${Array.from(VALID_ROUNDING_INCREMENTS).join(", ")}.`);
4479
4881
  needSd = hasSd;
4480
4882
  if (hasSd || !hasFd && notation === "compact") needFd = false;
4481
4883
  }
4482
- if (needSd) if (hasSd) {
4483
- internalSlots.minimumSignificantDigits = DefaultNumberOption(mnsd, 1, 21, 1);
4484
- internalSlots.maximumSignificantDigits = DefaultNumberOption(mxsd, internalSlots.minimumSignificantDigits, 21, 21);
4485
- } else {
4486
- internalSlots.minimumSignificantDigits = 1;
4487
- internalSlots.maximumSignificantDigits = 21;
4884
+ if (needSd) {
4885
+ if (hasSd) {
4886
+ internalSlots.minimumSignificantDigits = DefaultNumberOption(mnsd, 1, 21, 1);
4887
+ internalSlots.maximumSignificantDigits = DefaultNumberOption(mxsd, internalSlots.minimumSignificantDigits, 21, 21);
4888
+ } else {
4889
+ internalSlots.minimumSignificantDigits = 1;
4890
+ internalSlots.maximumSignificantDigits = 21;
4891
+ }
4488
4892
  }
4489
- if (needFd) if (hasFd) {
4490
- mnfd = DefaultNumberOption(mnfd, 0, 100, void 0);
4491
- mxfd = DefaultNumberOption(mxfd, 0, 100, void 0);
4492
- if (mnfd === void 0) {
4493
- invariant$1(mxfd !== void 0, "maximumFractionDigits must be defined");
4494
- mnfd = Math.min(mnfdDefault, mxfd);
4495
- } else if (mxfd === void 0) mxfd = Math.max(mxfdDefault, mnfd);
4496
- else if (mnfd > mxfd) throw new RangeError(`Invalid range, ${mnfd} > ${mxfd}`);
4497
- internalSlots.minimumFractionDigits = mnfd;
4498
- internalSlots.maximumFractionDigits = mxfd;
4499
- } else {
4500
- internalSlots.minimumFractionDigits = mnfdDefault;
4501
- internalSlots.maximumFractionDigits = mxfdDefault;
4893
+ if (needFd) {
4894
+ if (hasFd) {
4895
+ mnfd = DefaultNumberOption(mnfd, 0, 100, void 0);
4896
+ mxfd = DefaultNumberOption(mxfd, 0, 100, void 0);
4897
+ if (mnfd === void 0) {
4898
+ invariant(mxfd !== void 0, "maximumFractionDigits must be defined");
4899
+ mnfd = Math.min(mnfdDefault, mxfd);
4900
+ } else if (mxfd === void 0) mxfd = Math.max(mxfdDefault, mnfd);
4901
+ else if (mnfd > mxfd) throw new RangeError(`Invalid range, ${mnfd} > ${mxfd}`);
4902
+ internalSlots.minimumFractionDigits = mnfd;
4903
+ internalSlots.maximumFractionDigits = mxfd;
4904
+ } else {
4905
+ internalSlots.minimumFractionDigits = mnfdDefault;
4906
+ internalSlots.maximumFractionDigits = mxfdDefault;
4907
+ }
4502
4908
  }
4503
4909
  if (!needSd && !needFd) {
4504
4910
  internalSlots.minimumFractionDigits = 0;
@@ -4521,8 +4927,8 @@ Valid values are ${Array.from(VALID_ROUNDING_INCREMENTS).join(", ")}.`);
4521
4927
  internalSlots.roundingPriority = "auto";
4522
4928
  }
4523
4929
  if (roundingIncrement !== 1) {
4524
- invariant$1(internalSlots.roundingType === "fractionDigits", "Invalid roundingType", TypeError);
4525
- invariant$1(internalSlots.maximumFractionDigits === internalSlots.minimumFractionDigits, "With roundingIncrement > 1, maximumFractionDigits and minimumFractionDigits must be equal.", RangeError);
4930
+ invariant(internalSlots.roundingType === "fractionDigits", "Invalid roundingType", TypeError);
4931
+ invariant(internalSlots.maximumFractionDigits === internalSlots.minimumFractionDigits, "With roundingIncrement > 1, maximumFractionDigits and minimumFractionDigits must be equal.", RangeError);
4526
4932
  }
4527
4933
  }
4528
4934
  //#endregion
@@ -4537,13 +4943,19 @@ function InitializePluralRules(pl, locales, options, { availableLocales, relevan
4537
4943
  const r = ResolveLocale(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
4538
4944
  internalSlots.locale = r.locale;
4539
4945
  internalSlots.type = GetOption(opts, "type", "string", ["cardinal", "ordinal"], "cardinal");
4540
- const notation = GetOption(opts, "notation", "string", ["standard", "compact"], "standard");
4946
+ const notation = GetOption(opts, "notation", "string", [
4947
+ "standard",
4948
+ "scientific",
4949
+ "engineering",
4950
+ "compact"
4951
+ ], "standard");
4541
4952
  internalSlots.notation = notation;
4953
+ const compactDisplay = GetOption(opts, "compactDisplay", "string", ["short", "long"], "short");
4542
4954
  if (notation === "compact") {
4543
- internalSlots.compactDisplay = GetOption(opts, "compactDisplay", "string", ["short", "long"], "short");
4544
- if (typeof Intl !== "undefined" && Intl.NumberFormat && Intl.NumberFormat.localeData) internalSlots.dataLocaleData = Intl.NumberFormat.localeData[r.locale];
4955
+ internalSlots.compactDisplay = compactDisplay;
4956
+ internalSlots.compactExponents = localeData[r.dataLocale]?.compactExponents;
4545
4957
  }
4546
- SetNumberFormatDigitOptions(internalSlots, opts, 0, 3, "standard");
4958
+ SetNumberFormatDigitOptions(internalSlots, opts, 0, 3, notation);
4547
4959
  return pl;
4548
4960
  }
4549
4961
  //#endregion
@@ -4562,62 +4974,8 @@ function Type(x) {
4562
4974
  if (typeof x === "bigint") return "BigInt";
4563
4975
  }
4564
4976
  //#endregion
4565
- //#region packages/ecma402-abstract/NumberFormat/decimal-cache.js
4566
- /**
4567
- * Cached function to compute powers of 10 for Decimal.js operations.
4568
- * This cache significantly reduces overhead in ComputeExponent and ToRawFixed
4569
- * by memoizing expensive Decimal.pow(10, n) calculations.
4570
- *
4571
- * Common exponents (e.g., -20 to 20) are used repeatedly in number formatting,
4572
- * so caching provides substantial performance benefits.
4573
- *
4574
- * @param exponent - Can be a number or Decimal. If Decimal, it will be converted to string for cache key.
4575
- */
4576
- const getPowerOf10 = memoize((exponent) => {
4577
- return BigDecimal.pow(10, exponent);
4578
- });
4579
- //#endregion
4580
- //#region packages/ecma402-abstract/NumberFormat/ComputeExponentForMagnitude.js
4581
- /**
4582
- * The abstract operation ComputeExponentForMagnitude computes an exponent by which to scale a
4583
- * number of the given magnitude (power of ten of the most significant digit) according to the
4584
- * locale and the desired notation (scientific, engineering, or compact).
4585
- */
4586
- function ComputeExponentForMagnitude(internalSlots, magnitude) {
4587
- const { notation, dataLocaleData, numberingSystem } = internalSlots;
4588
- switch (notation) {
4589
- case "standard": return 0;
4590
- case "scientific": return magnitude.toNumber();
4591
- case "engineering": return magnitude.div(3).floor().times(3).toNumber();
4592
- default: {
4593
- invariant$1(notation === "compact", "Invalid notation");
4594
- const { compactDisplay, style, currencyDisplay } = internalSlots;
4595
- let thresholdMap;
4596
- if (style === "currency" && currencyDisplay !== "name") thresholdMap = (dataLocaleData.numbers.currency[numberingSystem] || dataLocaleData.numbers.currency[dataLocaleData.numbers.nu[0]]).short;
4597
- else {
4598
- const decimal = dataLocaleData.numbers.decimal[numberingSystem] || dataLocaleData.numbers.decimal[dataLocaleData.numbers.nu[0]];
4599
- thresholdMap = compactDisplay === "long" ? decimal.long : decimal.short;
4600
- }
4601
- if (!thresholdMap) return 0;
4602
- const num = getPowerOf10(magnitude).toString();
4603
- const thresholds = Object.keys(thresholdMap);
4604
- if (num < thresholds[0]) return 0;
4605
- if (num > thresholds[thresholds.length - 1]) {
4606
- const magnitudeKey = thresholds[thresholds.length - 1];
4607
- if (thresholdMap[magnitudeKey].other === "0") return 0;
4608
- return magnitudeKey.length - thresholdMap[magnitudeKey].other.match(/0+/)[0].length;
4609
- }
4610
- const i = thresholds.indexOf(num);
4611
- if (i === -1) return 0;
4612
- const magnitudeKey = thresholds[i];
4613
- if (thresholdMap[magnitudeKey].other === "0") return 0;
4614
- return magnitudeKey.length - thresholdMap[magnitudeKey].other.match(/0+/)[0].length;
4615
- }
4616
- }
4617
- }
4618
- //#endregion
4619
4977
  //#region packages/ecma402-abstract/constants.js
4620
- const ZERO$1 = new BigDecimal(0);
4978
+ const ZERO = new BigDecimal(0);
4621
4979
  const NEGATIVE_ZERO = new BigDecimal(-0);
4622
4980
  //#endregion
4623
4981
  //#region packages/ecma402-abstract/NumberFormat/GetUnsignedRoundingMode.js
@@ -4652,21 +5010,36 @@ function GetUnsignedRoundingMode(roundingMode, isNegative) {
4652
5010
  function ApplyUnsignedRoundingMode(x, r1, r2, unsignedRoundingMode) {
4653
5011
  if (x.eq(r1) || r1.eq(r2)) return r1;
4654
5012
  if (x.eq(r2)) return r2;
4655
- invariant$1(r1.lessThan(x) && x.lessThan(r2), `x should be between r1 and r2 but x=${x}, r1=${r1}, r2=${r2}`);
5013
+ invariant(r1.lessThan(x) && x.lessThan(r2), `x should be between r1 and r2 but x=${x}, r1=${r1}, r2=${r2}`);
4656
5014
  if (unsignedRoundingMode === "zero") return r1;
4657
5015
  if (unsignedRoundingMode === "infinity") return r2;
4658
5016
  const d1 = x.minus(r1);
4659
5017
  const d2 = r2.minus(x);
4660
5018
  if (d1.lessThan(d2)) return r1;
4661
5019
  if (d2.lessThan(d1)) return r2;
4662
- invariant$1(d1.eq(d2), "d1 should be equal to d2");
5020
+ invariant(d1.eq(d2), "d1 should be equal to d2");
4663
5021
  if (unsignedRoundingMode === "half-zero") return r1;
4664
5022
  if (unsignedRoundingMode === "half-infinity") return r2;
4665
- invariant$1(unsignedRoundingMode === "half-even", "unsignedRoundingMode should be half-even");
5023
+ invariant(unsignedRoundingMode === "half-even", "unsignedRoundingMode should be half-even");
4666
5024
  if (r1.div(r2.minus(r1)).mod(2).isZero()) return r1;
4667
5025
  return r2;
4668
5026
  }
4669
5027
  //#endregion
5028
+ //#region packages/ecma402-abstract/NumberFormat/decimal-cache.js
5029
+ /**
5030
+ * Cached function to compute powers of 10 for Decimal.js operations.
5031
+ * This cache significantly reduces overhead in ComputeExponent and ToRawFixed
5032
+ * by memoizing expensive Decimal.pow(10, n) calculations.
5033
+ *
5034
+ * Common exponents (e.g., -20 to 20) are used repeatedly in number formatting,
5035
+ * so caching provides substantial performance benefits.
5036
+ *
5037
+ * @param exponent - Can be a number or Decimal. If Decimal, it will be converted to string for cache key.
5038
+ */
5039
+ const getPowerOf10 = memoize((exponent) => {
5040
+ return BigDecimal.pow(10, exponent);
5041
+ });
5042
+ //#endregion
4670
5043
  //#region packages/ecma402-abstract/NumberFormat/ToRawFixed.js
4671
5044
  function ToRawFixedFn(n, f) {
4672
5045
  return n.times(getPowerOf10(-f));
@@ -4824,7 +5197,7 @@ function ToRawPrecision(x, minPrecision, maxPrecision, unsignedRoundingMode) {
4824
5197
  if (x.isZero()) {
4825
5198
  m = repeat("0", p);
4826
5199
  e = 0;
4827
- xFinal = ZERO$1;
5200
+ xFinal = ZERO;
4828
5201
  } else {
4829
5202
  const { n1, e1, r1 } = findN1E1R1(x, p);
4830
5203
  const { n2, e2, r2 } = findN2E2R2(x, p);
@@ -4849,7 +5222,7 @@ function ToRawPrecision(x, minPrecision, maxPrecision, unsignedRoundingMode) {
4849
5222
  m = m.slice(0, e + 1) + "." + m.slice(m.length - (p - (e + 1)));
4850
5223
  int = e + 1;
4851
5224
  } else {
4852
- invariant$1(e < 0, "e should be less than 0");
5225
+ invariant(e < 0, "e should be less than 0");
4853
5226
  m = "0." + repeat("0", -e - 1) + m;
4854
5227
  int = 1;
4855
5228
  }
@@ -4865,7 +5238,7 @@ function ToRawPrecision(x, minPrecision, maxPrecision, unsignedRoundingMode) {
4865
5238
  formattedString: m,
4866
5239
  roundedNumber: xFinal,
4867
5240
  integerDigitsCount: int,
4868
- roundingMagnitude: e
5241
+ roundingMagnitude: e - p + 1
4869
5242
  };
4870
5243
  }
4871
5244
  //#endregion
@@ -4878,9 +5251,9 @@ function FormatNumericToString(intlObject, _x) {
4878
5251
  let sign;
4879
5252
  if (x.isZero() && x.isNegative()) {
4880
5253
  sign = "negative";
4881
- x = ZERO$1;
5254
+ x = ZERO;
4882
5255
  } else {
4883
- invariant$1(x.isFinite(), "NumberFormatDigitInternalSlots value is not finite");
5256
+ invariant(x.isFinite(), "NumberFormatDigitInternalSlots value is not finite");
4884
5257
  if (x.lessThan(0)) sign = "negative";
4885
5258
  else sign = "positive";
4886
5259
  if (sign === "negative") x = x.negated();
@@ -4898,14 +5271,14 @@ function FormatNumericToString(intlObject, _x) {
4898
5271
  default:
4899
5272
  let sResult = ToRawPrecision(x, intlObject.minimumSignificantDigits, intlObject.maximumSignificantDigits, unsignedRoundingMode);
4900
5273
  let fResult = ToRawFixed(x, intlObject.minimumFractionDigits, intlObject.maximumFractionDigits, intlObject.roundingIncrement, unsignedRoundingMode);
4901
- if (intlObject.roundingType === "morePrecision") if (sResult.roundingMagnitude <= fResult.roundingMagnitude) result = sResult;
4902
- else result = fResult;
4903
- else {
4904
- invariant$1(intlObject.roundingType === "lessPrecision", "Invalid roundingType");
5274
+ if (intlObject.roundingType === "morePrecision") {
5275
+ if (sResult.roundingMagnitude <= fResult.roundingMagnitude) result = sResult;
5276
+ else result = fResult;
5277
+ } else {
5278
+ invariant(intlObject.roundingType === "lessPrecision", "Invalid roundingType");
4905
5279
  if (sResult.roundingMagnitude <= fResult.roundingMagnitude) result = fResult;
4906
5280
  else result = sResult;
4907
5281
  }
4908
- break;
4909
5282
  }
4910
5283
  x = result.roundedNumber;
4911
5284
  let string = result.formattedString;
@@ -4916,44 +5289,22 @@ function FormatNumericToString(intlObject, _x) {
4916
5289
  const int = result.integerDigitsCount;
4917
5290
  const minInteger = intlObject.minimumIntegerDigits;
4918
5291
  if (int < minInteger) string = repeat("0", minInteger - int) + string;
4919
- if (sign === "negative") if (x.isZero()) x = NEGATIVE_ZERO;
4920
- else x = x.negated();
5292
+ if (sign === "negative") {
5293
+ if (x.isZero()) x = NEGATIVE_ZERO;
5294
+ else x = x.negated();
5295
+ }
4921
5296
  return {
4922
5297
  roundedNumber: x,
4923
5298
  formattedString: string
4924
5299
  };
4925
5300
  }
4926
5301
  //#endregion
4927
- //#region packages/ecma262-abstract/ToNumber.js
4928
- const ZERO = new BigDecimal(0);
4929
- function invariant(condition, message, Err = Error) {
4930
- if (!condition) throw new Err(message);
4931
- }
4932
- /**
4933
- * https://tc39.es/ecma262/#sec-tonumber
4934
- */
4935
- function ToNumber(arg) {
4936
- if (typeof arg === "number") return new BigDecimal(arg);
4937
- if (typeof arg === "bigint") return new BigDecimal(arg.toString());
4938
- invariant(typeof arg !== "symbol", "Symbol is not supported", TypeError);
4939
- if (arg === void 0) return new BigDecimal(NaN);
4940
- if (arg === null || arg === 0) return ZERO;
4941
- if (arg === true) return new BigDecimal(1);
4942
- if (typeof arg === "string") try {
4943
- return new BigDecimal(arg);
4944
- } catch {
4945
- return new BigDecimal(NaN);
4946
- }
4947
- invariant(typeof arg === "object", "object expected", TypeError);
4948
- let primValue = ToPrimitive(arg, "number");
4949
- invariant(typeof primValue !== "object", "object expected", TypeError);
4950
- return ToNumber(primValue);
4951
- }
4952
- //#endregion
4953
5302
  //#region packages/ecma402-abstract/PluralRules/GetOperands.js
4954
5303
  /**
4955
- * ECMA-402 Spec: GetOperands abstract operation
4956
- * https://tc39.es/ecma402/#sec-getoperands
5304
+ * CLDR operands for the implementation-defined PluralRuleSelect
5305
+ * ECMA-402 §17.5.1 PluralRuleSelect, decimalString parameter and return definition.
5306
+ * https://tc39.es/ecma402/#sec-pluralruleselect
5307
+ * https://github.com/tc39/ecma402/blob/b1c961988b9a07894b1dc3dc2b5626ea48387d61/spec/pluralrules.html#L285-L290
4957
5308
  *
4958
5309
  * Implementation: Extended to support compact exponent (c/e operands)
4959
5310
  *
@@ -4961,34 +5312,34 @@ function ToNumber(arg) {
4961
5312
  * @param exponent Compact decimal exponent (c/e operand), defaults to 0
4962
5313
  */
4963
5314
  function GetOperands(s, exponent = 0) {
4964
- invariant$1(typeof s === "string", `GetOperands should have been called with a string`);
4965
- const n = ToNumber(s);
4966
- invariant$1(n.isFinite(), "n should be finite");
5315
+ invariant(typeof s === "string", `GetOperands should have been called with a string`);
5316
+ const n = new BigDecimal(s);
5317
+ invariant(n.isFinite(), "n should be finite");
4967
5318
  let dp = s.indexOf(".");
4968
5319
  let iv;
4969
5320
  let f;
4970
5321
  let v;
4971
5322
  let fv = "";
4972
5323
  if (dp === -1) {
4973
- iv = n;
4974
- f = ZERO$1;
5324
+ iv = s;
5325
+ f = ZERO;
4975
5326
  v = 0;
4976
5327
  } else {
4977
5328
  iv = s.slice(0, dp);
4978
5329
  fv = s.slice(dp, s.length);
4979
- f = ToNumber(fv);
5330
+ f = new BigDecimal(fv);
4980
5331
  v = fv.length;
4981
5332
  }
4982
- const i = ToNumber(iv).abs();
5333
+ const i = new BigDecimal(iv).abs();
4983
5334
  let w;
4984
5335
  let t;
4985
5336
  if (!f.isZero()) {
4986
5337
  const ft = fv.replace(/0+$/, "");
4987
5338
  w = ft.length;
4988
- t = ToNumber(ft);
5339
+ t = new BigDecimal(ft);
4989
5340
  } else {
4990
5341
  w = 0;
4991
- t = ZERO$1;
5342
+ t = ZERO;
4992
5343
  }
4993
5344
  return {
4994
5345
  Number: n,
@@ -5019,8 +5370,8 @@ function GetOperands(s, exponent = 0) {
5019
5370
  */
5020
5371
  function ResolvePluralInternal(pl, n, { getInternalSlots, PluralRuleSelect }) {
5021
5372
  const internalSlots = getInternalSlots(pl);
5022
- invariant$1(Type(internalSlots) === "Object", "pl has to be an object");
5023
- invariant$1("initializedPluralRules" in internalSlots, "pluralrules must be initialized");
5373
+ invariant(Type(internalSlots) === "Object", "pl has to be an object");
5374
+ invariant("initializedPluralRules" in internalSlots, "pluralrules must be initialized");
5024
5375
  if (!n.isFinite()) return {
5025
5376
  formattedString: String(n),
5026
5377
  pluralCategory: "other"
@@ -5028,11 +5379,19 @@ function ResolvePluralInternal(pl, n, { getInternalSlots, PluralRuleSelect }) {
5028
5379
  const { locale, type, notation } = internalSlots;
5029
5380
  const s = FormatNumericToString(internalSlots, n).formattedString;
5030
5381
  let exponent = 0;
5031
- if (notation === "compact" && !n.isZero()) {
5032
- if (internalSlots.dataLocaleData?.numbers) try {
5033
- exponent = ComputeExponentForMagnitude(internalSlots, new BigDecimal(Math.floor(Math.log10(Math.abs(n.toNumber())))));
5034
- } catch {
5035
- exponent = 0;
5382
+ if (notation === "compact") {
5383
+ const patterns = internalSlots.compactExponents?.[internalSlots.compactDisplay || "short"];
5384
+ const integer = (s[0] === "-" ? s.slice(1) : s).split(".")[0];
5385
+ let first = 0;
5386
+ while (first < integer.length && integer[first] === "0") first++;
5387
+ const magnitude = integer.length - first - 1;
5388
+ let selectedMagnitude = -1;
5389
+ if (patterns) for (const key in patterns) {
5390
+ const threshold = Number(key);
5391
+ if (threshold <= magnitude && threshold > selectedMagnitude) {
5392
+ selectedMagnitude = threshold;
5393
+ exponent = patterns[threshold];
5394
+ }
5036
5395
  }
5037
5396
  }
5038
5397
  return {
@@ -5062,7 +5421,9 @@ function ResolvePlural(pl, n, { getInternalSlots, PluralRuleSelect }) {
5062
5421
  * It resolves the appropriate plural form for a range by determining the plural forms of both the
5063
5422
  * start and end values, then consulting locale-specific range data.
5064
5423
  *
5424
+ * ECMA-402 §17.5.4 ResolvePluralRange, steps 1–3.
5065
5425
  * Specification: https://tc39.es/ecma402/#sec-resolvepluralrange
5426
+ * https://github.com/tc39/ecma402/blob/b1c961988b9a07894b1dc3dc2b5626ea48387d61/spec/pluralrules.html#L356-L358
5066
5427
  *
5067
5428
  * @param pluralRules - An initialized PluralRules object
5068
5429
  * @param x - Mathematical value for the range start
@@ -5070,10 +5431,10 @@ function ResolvePlural(pl, n, { getInternalSlots, PluralRuleSelect }) {
5070
5431
  * @returns The plural category for the range (zero, one, two, few, many, or other)
5071
5432
  */
5072
5433
  function ResolvePluralRange(pluralRules, x, y, { getInternalSlots, PluralRuleSelect, PluralRuleSelectRange }) {
5073
- if (!x.isFinite() || !y.isFinite()) throw new RangeError("selectRange requires start and end values to be finite numbers");
5434
+ if (x.isNaN() || y.isNaN()) throw new RangeError("selectRange requires start and end values not to be NaN");
5074
5435
  const internalSlots = getInternalSlots(pluralRules);
5075
- invariant$1(Type(internalSlots) === "Object", "pluralRules has to be an object");
5076
- invariant$1("initializedPluralRules" in internalSlots, "pluralrules must be initialized");
5436
+ invariant(Type(internalSlots) === "Object", "pluralRules has to be an object");
5437
+ invariant("initializedPluralRules" in internalSlots, "pluralrules must be initialized");
5077
5438
  const xp = ResolvePluralInternal(pluralRules, x, {
5078
5439
  getInternalSlots,
5079
5440
  PluralRuleSelect
@@ -5152,11 +5513,13 @@ var PluralRules = class PluralRules {
5152
5513
  }
5153
5514
  resolvedOptions() {
5154
5515
  validateInstance(this, "resolvedOptions");
5155
- const opts = Object.create(null);
5516
+ const opts = {};
5156
5517
  const internalSlots = getInternalSlots(this);
5157
5518
  opts.locale = internalSlots.locale;
5158
5519
  opts.type = internalSlots.type;
5159
5520
  [
5521
+ "notation",
5522
+ "compactDisplay",
5160
5523
  "minimumIntegerDigits",
5161
5524
  "minimumFractionDigits",
5162
5525
  "maximumFractionDigits",
@@ -5166,7 +5529,21 @@ var PluralRules = class PluralRules {
5166
5529
  const val = internalSlots[field];
5167
5530
  if (val !== void 0) opts[field] = val;
5168
5531
  });
5169
- opts.pluralCategories = [...PluralRules.localeData[opts.locale].categories[opts.type]];
5532
+ const categories = PluralRules.localeData[internalSlots.locale].categories[internalSlots.type];
5533
+ opts.pluralCategories = [
5534
+ "zero",
5535
+ "one",
5536
+ "two",
5537
+ "few",
5538
+ "many",
5539
+ "other"
5540
+ ].filter((category) => categories.includes(category));
5541
+ for (const field of [
5542
+ "roundingIncrement",
5543
+ "roundingMode",
5544
+ "roundingPriority",
5545
+ "trailingZeroDisplay"
5546
+ ]) opts[field] = internalSlots[field];
5170
5547
  return opts;
5171
5548
  }
5172
5549
  select(val) {
@@ -5205,7 +5582,7 @@ var PluralRules = class PluralRules {
5205
5582
  * pr.selectRange(BigInt(1), BigInt(2)); // "other"
5206
5583
  *
5207
5584
  * @throws {TypeError} If start or end is undefined
5208
- * @throws {RangeError} If start or end is not a finite number (Infinity, NaN)
5585
+ * @throws {RangeError} If start or end converts to NaN
5209
5586
  *
5210
5587
  * @note Chrome's native implementation (as of early 2025) has a bug where it throws
5211
5588
  * "Cannot convert a BigInt value to a number" when using BigInt arguments. This is
@@ -5230,8 +5607,7 @@ var PluralRules = class PluralRules {
5230
5607
  }
5231
5608
  static __addLocaleData(...data) {
5232
5609
  for (const { data: d, locale } of data) {
5233
- PluralRules.localeData[locale] = d;
5234
- PluralRules.availableLocales.add(locale);
5610
+ registerLocaleData(locale, d, PluralRules.localeData, PluralRules.availableLocales);
5235
5611
  if (!PluralRules.__defaultLocale) PluralRules.__defaultLocale = locale;
5236
5612
  }
5237
5613
  }
@@ -5289,6 +5665,234 @@ try {
5289
5665
  });
5290
5666
  } catch {}
5291
5667
  //#endregion
5668
+ //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-locales@0.0.0/node_modules/@formatjs_generated/cldr.supported-locales/intl-pluralrules.js
5669
+ const supportedLocales = [
5670
+ "af",
5671
+ "ak",
5672
+ "am",
5673
+ "an",
5674
+ "ar",
5675
+ "ars",
5676
+ "as",
5677
+ "asa",
5678
+ "ast",
5679
+ "az",
5680
+ "bal",
5681
+ "be",
5682
+ "bem",
5683
+ "bez",
5684
+ "bg",
5685
+ "bho",
5686
+ "blo",
5687
+ "bm",
5688
+ "bn",
5689
+ "bo",
5690
+ "br",
5691
+ "brx",
5692
+ "bs",
5693
+ "ca",
5694
+ "ce",
5695
+ "ceb",
5696
+ "cgg",
5697
+ "chr",
5698
+ "ckb",
5699
+ "cs",
5700
+ "csw",
5701
+ "cv",
5702
+ "cy",
5703
+ "da",
5704
+ "de",
5705
+ "doi",
5706
+ "dsb",
5707
+ "dv",
5708
+ "dz",
5709
+ "ee",
5710
+ "el",
5711
+ "en",
5712
+ "eo",
5713
+ "es",
5714
+ "et",
5715
+ "eu",
5716
+ "fa",
5717
+ "ff",
5718
+ "fi",
5719
+ "fil",
5720
+ "fo",
5721
+ "fr",
5722
+ "fur",
5723
+ "fy",
5724
+ "ga",
5725
+ "gd",
5726
+ "gl",
5727
+ "gsw",
5728
+ "gu",
5729
+ "guw",
5730
+ "gv",
5731
+ "ha",
5732
+ "haw",
5733
+ "he",
5734
+ "hi",
5735
+ "hnj",
5736
+ "hr",
5737
+ "hsb",
5738
+ "hu",
5739
+ "hy",
5740
+ "ia",
5741
+ "id",
5742
+ "ie",
5743
+ "ig",
5744
+ "ii",
5745
+ "io",
5746
+ "is",
5747
+ "it",
5748
+ "iu",
5749
+ "ja",
5750
+ "jbo",
5751
+ "jgo",
5752
+ "jmc",
5753
+ "jv",
5754
+ "jw",
5755
+ "ka",
5756
+ "kab",
5757
+ "kaj",
5758
+ "kcg",
5759
+ "kde",
5760
+ "kea",
5761
+ "kk",
5762
+ "kkj",
5763
+ "kl",
5764
+ "km",
5765
+ "kn",
5766
+ "ko",
5767
+ "kok",
5768
+ "kok-Latn",
5769
+ "ks",
5770
+ "ksb",
5771
+ "ksh",
5772
+ "ku",
5773
+ "kw",
5774
+ "ky",
5775
+ "lag",
5776
+ "lb",
5777
+ "lg",
5778
+ "lij",
5779
+ "lkt",
5780
+ "lld",
5781
+ "ln",
5782
+ "lo",
5783
+ "lt",
5784
+ "lv",
5785
+ "mas",
5786
+ "mg",
5787
+ "mgo",
5788
+ "mk",
5789
+ "ml",
5790
+ "mn",
5791
+ "mo",
5792
+ "mr",
5793
+ "ms",
5794
+ "mt",
5795
+ "my",
5796
+ "nah",
5797
+ "naq",
5798
+ "nb",
5799
+ "nd",
5800
+ "ne",
5801
+ "nl",
5802
+ "nn",
5803
+ "nnh",
5804
+ "no",
5805
+ "nqo",
5806
+ "nr",
5807
+ "nso",
5808
+ "ny",
5809
+ "nyn",
5810
+ "om",
5811
+ "or",
5812
+ "os",
5813
+ "osa",
5814
+ "pa",
5815
+ "pap",
5816
+ "pcm",
5817
+ "pl",
5818
+ "prg",
5819
+ "ps",
5820
+ "pt",
5821
+ "pt-PT",
5822
+ "rm",
5823
+ "ro",
5824
+ "rof",
5825
+ "ru",
5826
+ "rwk",
5827
+ "sah",
5828
+ "saq",
5829
+ "sat",
5830
+ "sc",
5831
+ "scn",
5832
+ "sd",
5833
+ "sdh",
5834
+ "se",
5835
+ "seh",
5836
+ "ses",
5837
+ "sg",
5838
+ "sgs",
5839
+ "sh",
5840
+ "shi",
5841
+ "si",
5842
+ "sk",
5843
+ "sl",
5844
+ "sma",
5845
+ "smi",
5846
+ "smj",
5847
+ "smn",
5848
+ "sms",
5849
+ "sn",
5850
+ "so",
5851
+ "sq",
5852
+ "sr",
5853
+ "ss",
5854
+ "ssy",
5855
+ "st",
5856
+ "su",
5857
+ "sv",
5858
+ "sw",
5859
+ "syr",
5860
+ "ta",
5861
+ "te",
5862
+ "teo",
5863
+ "th",
5864
+ "ti",
5865
+ "tig",
5866
+ "tk",
5867
+ "tl",
5868
+ "tn",
5869
+ "to",
5870
+ "tpi",
5871
+ "tr",
5872
+ "ts",
5873
+ "tzm",
5874
+ "ug",
5875
+ "uk",
5876
+ "und",
5877
+ "ur",
5878
+ "uz",
5879
+ "ve",
5880
+ "vec",
5881
+ "vi",
5882
+ "vo",
5883
+ "vun",
5884
+ "wa",
5885
+ "wae",
5886
+ "wo",
5887
+ "xh",
5888
+ "xog",
5889
+ "yi",
5890
+ "yo",
5891
+ "yue",
5892
+ "zh",
5893
+ "zu"
5894
+ ];
5895
+ //#endregion
5292
5896
  //#region packages/intl-pluralrules/should-polyfill.ts
5293
5897
  function supportedLocalesOf(locale) {
5294
5898
  if (!locale) return true;