@formatjs/intl-pluralrules 6.4.0 → 7.0.1

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.js CHANGED
@@ -1,66 +1,46 @@
1
1
  import { LookupSupportedLocales, ResolveLocale, match } from "@formatjs/intl-localematcher";
2
2
  import { Decimal } from "@formatjs/bigdecimal";
3
- //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-locales@0.0.0/node_modules/@formatjs_generated/cldr.supported-locales/default-content.js
3
+ // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-locales@0.0.0/node_modules/@formatjs_generated/cldr.supported-locales/default-content.js
4
4
  const defaultContent = {
5
- "aa": ["aa-ET"],
6
- "ab": ["ab-GE"],
5
+ "ady": ["ady-RU"],
7
6
  "af": ["af-ZA"],
8
7
  "agq": ["agq-CM"],
9
8
  "ak": ["ak-GH"],
10
9
  "am": ["am-ET"],
11
- "an": ["an-ES"],
12
- "ann": ["ann-NG"],
13
- "apc": ["apc-SY"],
14
10
  "ar": ["ar-001"],
15
- "arn": ["arn-CL"],
16
11
  "as": ["as-IN"],
17
12
  "asa": ["asa-TZ"],
18
13
  "ast": ["ast-ES"],
19
- "az-Arab": ["az-Arab-IR"],
20
14
  "az-Cyrl": ["az-Cyrl-AZ"],
21
15
  "az-Latn": ["az-Latn-AZ"],
22
16
  "ba": ["ba-RU"],
23
- "bal-Arab": ["bal-Arab-PK"],
24
17
  "bal-Latn": ["bal-Latn-PK"],
25
18
  "bas": ["bas-CM"],
26
19
  "be": ["be-BY"],
27
20
  "bem": ["bem-ZM"],
28
- "bew": ["bew-ID"],
29
21
  "bez": ["bez-TZ"],
30
22
  "bg": ["bg-BG"],
31
23
  "bgc": ["bgc-IN"],
32
- "bgn": ["bgn-PK"],
33
24
  "bho": ["bho-IN"],
34
25
  "blo": ["blo-BJ"],
35
- "blt": ["blt-VN"],
36
26
  "bm": ["bm-ML"],
37
- "bm-Nkoo": ["bm-Nkoo-ML"],
38
27
  "bn": ["bn-BD"],
39
28
  "bo": ["bo-CN"],
40
- "bqi": ["bqi-IR"],
41
29
  "br": ["br-FR"],
42
30
  "brx": ["brx-IN"],
43
31
  "bs-Cyrl": ["bs-Cyrl-BA"],
44
32
  "bs-Latn": ["bs-Latn-BA"],
45
- "bss": ["bss-CM"],
46
33
  "bua": ["bua-RU"],
47
- "byn": ["byn-ER"],
48
34
  "ca": ["ca-ES"],
49
- "cad": ["cad-US"],
50
- "cch": ["cch-NG"],
51
35
  "ccp": ["ccp-BD"],
52
36
  "ce": ["ce-RU"],
53
37
  "ceb": ["ceb-PH"],
54
38
  "cgg": ["cgg-UG"],
55
- "cho": ["cho-US"],
56
39
  "chr": ["chr-US"],
57
- "cic": ["cic-US"],
58
40
  "ckb": ["ckb-IQ"],
59
- "co": ["co-FR"],
60
41
  "cop": ["cop-EG"],
61
42
  "cs": ["cs-CZ"],
62
43
  "csw": ["csw-CA"],
63
- "cu": ["cu-RU"],
64
44
  "cv": ["cv-RU"],
65
45
  "cy": ["cy-GB"],
66
46
  "da": ["da-DK"],
@@ -70,14 +50,11 @@ const defaultContent = {
70
50
  "doi": ["doi-IN"],
71
51
  "dsb": ["dsb-DE"],
72
52
  "dua": ["dua-CM"],
73
- "dv": ["dv-MV"],
74
53
  "dyo": ["dyo-SN"],
75
54
  "dz": ["dz-BT"],
76
55
  "ebu": ["ebu-KE"],
77
56
  "ee": ["ee-GH"],
78
57
  "el": ["el-GR"],
79
- "en-Dsrt": ["en-Dsrt-US"],
80
- "en-Shaw": ["en-Shaw-GB"],
81
58
  "en": ["en-US"],
82
59
  "eo": ["eo-001"],
83
60
  "es": ["es-ES"],
@@ -91,29 +68,23 @@ const defaultContent = {
91
68
  "fil": ["fil-PH"],
92
69
  "fo": ["fo-FO"],
93
70
  "fr": ["fr-FR"],
94
- "frr": ["frr-DE"],
95
71
  "fur": ["fur-IT"],
96
72
  "fy": ["fy-NL"],
97
73
  "ga": ["ga-IE"],
98
74
  "gaa": ["gaa-GH"],
99
75
  "gd": ["gd-GB"],
100
- "gez": ["gez-ET"],
101
76
  "gl": ["gl-ES"],
102
- "gn": ["gn-PY"],
103
77
  "gsw": ["gsw-CH"],
104
78
  "gu": ["gu-IN"],
105
79
  "guz": ["guz-KE"],
106
80
  "gv": ["gv-IM"],
107
- "ha-Arab": ["ha-Arab-NG"],
108
81
  "ha": ["ha-NG"],
109
82
  "haw": ["haw-US"],
110
83
  "he": ["he-IL"],
111
84
  "hi": ["hi-IN"],
112
85
  "hi-Latn": ["hi-Latn-IN"],
113
- "hnj-Hmnp": ["hnj-Hmnp-US"],
114
86
  "hr": ["hr-HR"],
115
87
  "hsb": ["hsb-DE"],
116
- "ht": ["ht-HT"],
117
88
  "hu": ["hu-HU"],
118
89
  "hy": ["hy-AM"],
119
90
  "ia": ["ia-001"],
@@ -121,27 +92,19 @@ const defaultContent = {
121
92
  "ie": ["ie-EE"],
122
93
  "ig": ["ig-NG"],
123
94
  "ii": ["ii-CN"],
124
- "io": ["io-001"],
125
95
  "is": ["is-IS"],
126
96
  "it": ["it-IT"],
127
- "iu": ["iu-CA"],
128
- "iu-Latn": ["iu-Latn-CA"],
129
97
  "ja": ["ja-JP"],
130
- "jbo": ["jbo-001"],
131
98
  "jgo": ["jgo-CM"],
132
99
  "jmc": ["jmc-TZ"],
133
100
  "jv": ["jv-ID"],
134
101
  "ka": ["ka-GE"],
135
- "kaa-Cyrl": ["kaa-Cyrl-UZ"],
136
- "kaa-Latn": ["kaa-Latn-UZ"],
137
102
  "kab": ["kab-DZ"],
138
- "kaj": ["kaj-NG"],
139
103
  "kam": ["kam-KE"],
140
- "kcg": ["kcg-NG"],
104
+ "kbd": ["kbd-RU"],
141
105
  "kde": ["kde-TZ"],
142
106
  "kea": ["kea-CV"],
143
107
  "kek": ["kek-GT"],
144
- "ken": ["ken-CM"],
145
108
  "kgp": ["kgp-BR"],
146
109
  "khq": ["khq-ML"],
147
110
  "ki": ["ki-KE"],
@@ -155,13 +118,11 @@ const defaultContent = {
155
118
  "ko": ["ko-KR"],
156
119
  "kok-Deva": ["kok-Deva-IN"],
157
120
  "kok-Latn": ["kok-Latn-IN"],
158
- "kpe": ["kpe-LR"],
159
121
  "ks-Arab": ["ks-Arab-IN"],
160
122
  "ks-Deva": ["ks-Deva-IN"],
161
123
  "ksb": ["ksb-TZ"],
162
124
  "ksf": ["ksf-CM"],
163
125
  "ksh": ["ksh-DE"],
164
- "ku-Arab": ["ku-Arab-IQ"],
165
126
  "ku-Latn": ["ku-Latn-TR"],
166
127
  "kw": ["kw-GB"],
167
128
  "kxv-Deva": ["kxv-Deva-IN"],
@@ -169,7 +130,6 @@ const defaultContent = {
169
130
  "kxv-Orya": ["kxv-Orya-IN"],
170
131
  "kxv-Telu": ["kxv-Telu-IN"],
171
132
  "ky": ["ky-KG"],
172
- "la": ["la-VA"],
173
133
  "lag": ["lag-TZ"],
174
134
  "lb": ["lb-LU"],
175
135
  "lg": ["lg-UG"],
@@ -181,39 +141,27 @@ const defaultContent = {
181
141
  "lo": ["lo-LA"],
182
142
  "lrc": ["lrc-IR"],
183
143
  "lt": ["lt-LT"],
184
- "ltg": ["ltg-LV"],
185
144
  "lu": ["lu-CD"],
186
145
  "luo": ["luo-KE"],
187
146
  "luy": ["luy-KE"],
188
147
  "lv": ["lv-LV"],
189
- "lzz": ["lzz-TR"],
190
148
  "mai": ["mai-IN"],
191
149
  "mas": ["mas-KE"],
192
- "mdf": ["mdf-RU"],
193
150
  "mer": ["mer-KE"],
194
151
  "mfe": ["mfe-MU"],
195
152
  "mg": ["mg-MG"],
196
153
  "mgh": ["mgh-MZ"],
197
154
  "mgo": ["mgo-CM"],
198
- "mhn": ["mhn-IT"],
199
155
  "mi": ["mi-NZ"],
200
- "mic": ["mic-CA"],
201
156
  "mk": ["mk-MK"],
202
157
  "ml": ["ml-IN"],
203
158
  "mn": ["mn-MN"],
204
- "mn-Mong": ["mn-Mong-CN"],
205
159
  "mni-Beng": ["mni-Beng-IN"],
206
- "mni-Mtei": ["mni-Mtei-IN"],
207
- "moh": ["moh-CA"],
208
160
  "mr": ["mr-IN"],
209
- "ms-Arab": ["ms-Arab-MY"],
210
161
  "ms": ["ms-MY"],
211
162
  "mt": ["mt-MT"],
212
163
  "mua": ["mua-CM"],
213
- "mus": ["mus-US"],
214
- "mww-Hmnp": ["mww-Hmnp-US"],
215
164
  "my": ["my-MM"],
216
- "myv": ["myv-RU"],
217
165
  "mzn": ["mzn-IR"],
218
166
  "naq": ["naq-NA"],
219
167
  "nb": ["nb-NO"],
@@ -225,24 +173,16 @@ const defaultContent = {
225
173
  "nn": ["nn-NO"],
226
174
  "nnh": ["nnh-CM"],
227
175
  "nqo": ["nqo-GN"],
228
- "nr": ["nr-ZA"],
229
176
  "nso": ["nso-ZA"],
230
177
  "nus": ["nus-SS"],
231
- "nv": ["nv-US"],
232
- "ny": ["ny-MW"],
233
178
  "nyn": ["nyn-UG"],
234
179
  "oc": ["oc-FR"],
235
- "oka": ["oka-CA"],
236
180
  "om": ["om-ET"],
237
181
  "or": ["or-IN"],
238
182
  "os": ["os-GE"],
239
- "osa": ["osa-US"],
240
183
  "pa-Arab": ["pa-Arab-PK"],
241
184
  "pa-Guru": ["pa-Guru-IN"],
242
- "pap": ["pap-CW"],
243
185
  "pcm": ["pcm-NG"],
244
- "pi-Latn": ["pi-Latn-GB"],
245
- "pis": ["pis-SB"],
246
186
  "pl": ["pl-PL"],
247
187
  "pms": ["pms-IT"],
248
188
  "prg": ["prg-PL"],
@@ -251,8 +191,6 @@ const defaultContent = {
251
191
  "qu": ["qu-PE"],
252
192
  "quc": ["quc-GT"],
253
193
  "raj": ["raj-IN"],
254
- "rhg-Rohg": ["rhg-Rohg-MM"],
255
- "rif": ["rif-MA"],
256
194
  "rm": ["rm-CH"],
257
195
  "rn": ["rn-BI"],
258
196
  "ro": ["ro-RO"],
@@ -263,41 +201,30 @@ const defaultContent = {
263
201
  "sa": ["sa-IN"],
264
202
  "sah": ["sah-RU"],
265
203
  "saq": ["saq-KE"],
266
- "sat-Deva": ["sat-Deva-IN"],
267
204
  "sat-Olck": ["sat-Olck-IN"],
268
205
  "sbp": ["sbp-TZ"],
269
206
  "sc": ["sc-IT"],
270
207
  "scn": ["scn-IT"],
271
208
  "sd-Arab": ["sd-Arab-PK"],
272
209
  "sd-Deva": ["sd-Deva-IN"],
273
- "sdh": ["sdh-IR"],
274
210
  "se": ["se-NO"],
275
211
  "seh": ["seh-MZ"],
276
212
  "ses": ["ses-ML"],
277
213
  "sg": ["sg-CF"],
278
- "sgs": ["sgs-LT"],
279
214
  "shi-Latn": ["shi-Latn-MA"],
280
215
  "shi-Tfng": ["shi-Tfng-MA"],
281
216
  "shn": ["shn-MM"],
282
217
  "si": ["si-LK"],
283
- "sid": ["sid-ET"],
284
218
  "sk": ["sk-SK"],
285
- "skr": ["skr-PK"],
286
219
  "sl": ["sl-SI"],
287
- "sma": ["sma-SE"],
288
- "smj": ["smj-SE"],
289
220
  "smn": ["smn-FI"],
290
- "sms": ["sms-FI"],
291
221
  "sn": ["sn-ZW"],
292
222
  "so": ["so-SO"],
293
223
  "sq": ["sq-AL"],
294
224
  "sr-Cyrl": ["sr-Cyrl-RS"],
295
225
  "sr-Latn": ["sr-Latn-RS"],
296
- "ss": ["ss-ZA"],
297
- "ssy": ["ssy-ER"],
298
226
  "st": ["st-ZA"],
299
227
  "su-Latn": ["su-Latn-ID"],
300
- "suz-Deva": ["suz-Deva-NP"],
301
228
  "suz-Sunu": ["suz-Sunu-NP"],
302
229
  "sv": ["sv-SE"],
303
230
  "sw": ["sw-TZ"],
@@ -309,16 +236,11 @@ const defaultContent = {
309
236
  "tg": ["tg-TJ"],
310
237
  "th": ["th-TH"],
311
238
  "ti": ["ti-ET"],
312
- "tig": ["tig-ER"],
313
239
  "tk": ["tk-TM"],
314
240
  "tn": ["tn-ZA"],
315
241
  "to": ["to-TO"],
316
242
  "tok": ["tok-001"],
317
- "tpi": ["tpi-PG"],
318
243
  "tr": ["tr-TR"],
319
- "trv": ["trv-TW"],
320
- "trw": ["trw-PK"],
321
- "ts": ["ts-ZA"],
322
244
  "tt": ["tt-RU"],
323
245
  "twq": ["twq-NE"],
324
246
  "tyv": ["tyv-RU"],
@@ -331,16 +253,11 @@ const defaultContent = {
331
253
  "uz-Latn": ["uz-Latn-UZ"],
332
254
  "vai-Latn": ["vai-Latn-LR"],
333
255
  "vai-Vaii": ["vai-Vaii-LR"],
334
- "ve": ["ve-ZA"],
335
256
  "vec": ["vec-IT"],
336
257
  "vi": ["vi-VN"],
337
258
  "vmw": ["vmw-MZ"],
338
- "vo": ["vo-001"],
339
259
  "vun": ["vun-TZ"],
340
- "wa": ["wa-BE"],
341
260
  "wae": ["wae-CH"],
342
- "wal": ["wal-ET"],
343
- "wbp": ["wbp-AU"],
344
261
  "wo": ["wo-SN"],
345
262
  "xh": ["xh-ZA"],
346
263
  "xnr": ["xnr-IN"],
@@ -355,11 +272,9 @@ const defaultContent = {
355
272
  "zgh": ["zgh-MA"],
356
273
  "zh-Hans": ["zh-Hans-CN"],
357
274
  "zh-Hant": ["zh-Hant-TW"],
358
- "zh-Latn": ["zh-Latn-CN"],
359
275
  "zu": ["zu-ZA"]
360
276
  };
361
- //#endregion
362
- //#region packages/ecma402-abstract/registerLocaleData.js
277
+ // packages/ecma402-abstract/registerLocaleData.js
363
278
  const explicitLocales = /* @__PURE__ */ new WeakMap();
364
279
  function registerLocaleData(locale, data, localeData, availableLocales) {
365
280
  let loaded = explicitLocales.get(localeData);
@@ -387,8 +302,7 @@ function registerLocaleData(locale, data, localeData, availableLocales) {
387
302
  }
388
303
  }
389
304
  }
390
- //#endregion
391
- //#region packages/ecma402-abstract/CanonicalizeLocaleList.js
305
+ // packages/ecma402-abstract/CanonicalizeLocaleList.js
392
306
  /**
393
307
  * http://ecma-international.org/ecma-402/7.0/index.html#sec-canonicalizelocalelist
394
308
  * @param locales
@@ -396,8 +310,7 @@ function registerLocaleData(locale, data, localeData, availableLocales) {
396
310
  function CanonicalizeLocaleList(locales) {
397
311
  return Intl.getCanonicalLocales(locales);
398
312
  }
399
- //#endregion
400
- //#region packages/ecma262-abstract/ToObject.js
313
+ // packages/ecma262-abstract/ToObject.js
401
314
  /**
402
315
  * https://tc39.es/ecma262/#sec-toobject
403
316
  */
@@ -405,8 +318,7 @@ function ToObject(arg) {
405
318
  if (arg == null) throw new TypeError("undefined/null cannot be converted to object");
406
319
  return Object(arg);
407
320
  }
408
- //#endregion
409
- //#region packages/ecma262-abstract/ToString.js
321
+ // packages/ecma262-abstract/ToString.js
410
322
  /**
411
323
  * https://tc39.es/ecma262/#sec-tostring
412
324
  */
@@ -414,8 +326,7 @@ function ToString(o) {
414
326
  if (typeof o === "symbol") throw TypeError("Cannot convert a Symbol value to a string");
415
327
  return String(o);
416
328
  }
417
- //#endregion
418
- //#region packages/ecma402-abstract/GetOption.js
329
+ // packages/ecma402-abstract/GetOption.js
419
330
  /**
420
331
  * https://tc39.es/ecma402/#sec-getoption
421
332
  * @param opts
@@ -436,8 +347,7 @@ function GetOption(opts, prop, type, values, fallback) {
436
347
  }
437
348
  return fallback;
438
349
  }
439
- //#endregion
440
- //#region packages/ecma402-abstract/SupportedLocales.js
350
+ // packages/ecma402-abstract/SupportedLocales.js
441
351
  /**
442
352
  * https://tc39.es/ecma402/#sec-supportedlocales
443
353
  * @param availableLocales
@@ -453,8 +363,7 @@ function SupportedLocales(availableLocales, requestedLocales, options) {
453
363
  if (matcher === "best fit") return LookupSupportedLocales(Array.from(availableLocales), requestedLocales);
454
364
  return LookupSupportedLocales(Array.from(availableLocales), requestedLocales);
455
365
  }
456
- //#endregion
457
- //#region packages/ecma262-abstract/ToPrimitive.js
366
+ // packages/ecma262-abstract/ToPrimitive.js
458
367
  function invariant$1(condition, message, Err = Error) {
459
368
  if (!condition) throw new Err(message);
460
369
  }
@@ -497,8 +406,7 @@ function ToPrimitive(input, preferredType) {
497
406
  }
498
407
  return input;
499
408
  }
500
- //#endregion
501
- //#region packages/ecma402-abstract/ToIntlMathematicalValue.js
409
+ // packages/ecma402-abstract/ToIntlMathematicalValue.js
502
410
  /**
503
411
  * https://tc39.es/ecma402/#sec-tointlmathematicalvalue
504
412
  * Converts input to a mathematical value, supporting BigInt
@@ -524,8 +432,7 @@ function ToIntlMathematicalValue(input) {
524
432
  return new Decimal(NaN);
525
433
  }
526
434
  }
527
- //#endregion
528
- //#region packages/ecma402-abstract/CoerceOptionsToObject.js
435
+ // packages/ecma402-abstract/CoerceOptionsToObject.js
529
436
  /**
530
437
  * https://tc39.es/ecma402/#sec-coerceoptionstoobject
531
438
  * @param options
@@ -535,8 +442,7 @@ function CoerceOptionsToObject(options) {
535
442
  if (typeof options === "undefined") return Object.create(null);
536
443
  return ToObject(options);
537
444
  }
538
- //#endregion
539
- //#region packages/ecma402-abstract/DefaultNumberOption.js
445
+ // packages/ecma402-abstract/DefaultNumberOption.js
540
446
  /**
541
447
  * ECMA-402 §9.2.13 DefaultNumberOption, step 2.
542
448
  * https://tc39.es/ecma402/#sec-defaultnumberoption
@@ -552,8 +458,7 @@ function DefaultNumberOption(inputVal, min, max, fallback) {
552
458
  if (isNaN(val) || val < min || val > max) throw new RangeError(`${val} is outside of range [${min}, ${max}]`);
553
459
  return Math.floor(val);
554
460
  }
555
- //#endregion
556
- //#region packages/ecma402-abstract/GetNumberOption.js
461
+ // packages/ecma402-abstract/GetNumberOption.js
557
462
  /**
558
463
  * https://tc39.es/ecma402/#sec-getnumberoption
559
464
  * @param options
@@ -566,8 +471,7 @@ function GetNumberOption(options, property, minimum, maximum, fallback) {
566
471
  const val = options[property];
567
472
  return DefaultNumberOption(val, minimum, maximum, fallback);
568
473
  }
569
- //#endregion
570
- //#region node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/index.js
474
+ // node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/index.js
571
475
  function memoize(fn, options) {
572
476
  const cache = options && options.cache ? options.cache : cacheDefault;
573
477
  const serializer = options && options.serializer ? options.serializer : serializerDefault;
@@ -632,8 +536,7 @@ const strategies = {
632
536
  variadic: strategyVariadic,
633
537
  monadic: strategyMonadic
634
538
  };
635
- //#endregion
636
- //#region packages/ecma402-abstract/utils.js
539
+ // packages/ecma402-abstract/utils.js
637
540
  function repeat(s, times) {
638
541
  if (typeof s.repeat === "function") return s.repeat(times);
639
542
  const arr = Array.from({ length: times });
@@ -663,8 +566,7 @@ function invariant(condition, message, Err = Error) {
663
566
  memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
664
567
  memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.variadic });
665
568
  memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
666
- //#endregion
667
- //#region packages/ecma402-abstract/NumberFormat/SetNumberFormatDigitOptions.js
569
+ // packages/ecma402-abstract/NumberFormat/SetNumberFormatDigitOptions.js
668
570
  const VALID_ROUNDING_INCREMENTS = /* @__PURE__ */ new Set([
669
571
  1,
670
572
  2,
@@ -774,8 +676,7 @@ Valid values are ${Array.from(VALID_ROUNDING_INCREMENTS).join(", ")}.`, RangeErr
774
676
  invariant(internalSlots.maximumFractionDigits === internalSlots.minimumFractionDigits, "With roundingIncrement > 1, maximumFractionDigits and minimumFractionDigits must be equal.", RangeError);
775
677
  }
776
678
  }
777
- //#endregion
778
- //#region packages/ecma402-abstract/PluralRules/InitializePluralRules.js
679
+ // packages/ecma402-abstract/PluralRules/InitializePluralRules.js
779
680
  function InitializePluralRules(pl, locales, options, { availableLocales, relevantExtensionKeys, localeData, getDefaultLocale, getInternalSlots }) {
780
681
  const requestedLocales = CanonicalizeLocaleList(locales);
781
682
  const opt = Object.create(null);
@@ -801,8 +702,7 @@ function InitializePluralRules(pl, locales, options, { availableLocales, relevan
801
702
  SetNumberFormatDigitOptions(internalSlots, opts, 0, 3, notation);
802
703
  return pl;
803
704
  }
804
- //#endregion
805
- //#region packages/ecma262-abstract/Type.js
705
+ // packages/ecma262-abstract/Type.js
806
706
  /**
807
707
  * https://www.ecma-international.org/ecma-262/11.0/index.html#sec-type
808
708
  */
@@ -816,12 +716,10 @@ function Type(x) {
816
716
  if (typeof x === "symbol") return "Symbol";
817
717
  if (typeof x === "bigint") return "BigInt";
818
718
  }
819
- //#endregion
820
- //#region packages/ecma402-abstract/constants.js
719
+ // packages/ecma402-abstract/constants.js
821
720
  const ZERO = new Decimal(0);
822
721
  const NEGATIVE_ZERO = new Decimal(-0);
823
- //#endregion
824
- //#region packages/ecma402-abstract/NumberFormat/GetUnsignedRoundingMode.js
722
+ // packages/ecma402-abstract/NumberFormat/GetUnsignedRoundingMode.js
825
723
  const negativeMapping = {
826
724
  ceil: "zero",
827
725
  floor: "infinity",
@@ -848,8 +746,7 @@ function GetUnsignedRoundingMode(roundingMode, isNegative) {
848
746
  if (isNegative) return negativeMapping[roundingMode];
849
747
  return positiveMapping[roundingMode];
850
748
  }
851
- //#endregion
852
- //#region packages/ecma402-abstract/NumberFormat/ApplyUnsignedRoundingMode.js
749
+ // packages/ecma402-abstract/NumberFormat/ApplyUnsignedRoundingMode.js
853
750
  function ApplyUnsignedRoundingMode(x, r1, r2, unsignedRoundingMode) {
854
751
  if (x.eq(r1) || r1.eq(r2)) return r1;
855
752
  if (x.eq(r2)) return r2;
@@ -867,23 +764,17 @@ function ApplyUnsignedRoundingMode(x, r1, r2, unsignedRoundingMode) {
867
764
  if (r1.div(r2.minus(r1)).mod(2).isZero()) return r1;
868
765
  return r2;
869
766
  }
870
- //#endregion
871
- //#region packages/ecma402-abstract/NumberFormat/decimal-cache.js
872
- /**
873
- * Cached function to compute powers of 10 for Decimal.js operations.
874
- * This cache significantly reduces overhead in ComputeExponent and ToRawFixed
875
- * by memoizing expensive Decimal.pow(10, n) calculations.
876
- *
877
- * Common exponents (e.g., -20 to 20) are used repeatedly in number formatting,
878
- * so caching provides substantial performance benefits.
879
- *
880
- * @param exponent - Can be a number or Decimal. If Decimal, it will be converted to string for cache key.
881
- */
882
- const getPowerOf10 = memoize((exponent) => {
883
- return Decimal.pow(10, exponent);
884
- });
885
- //#endregion
886
- //#region packages/ecma402-abstract/NumberFormat/ToRawFixed.js
767
+ // packages/ecma402-abstract/NumberFormat/decimal-cache.js
768
+ const powersOfTen = /* @__PURE__ */ new Map();
769
+ function getPowerOf10(exponent) {
770
+ const n = typeof exponent === "number" ? exponent : exponent.toNumber();
771
+ const cached = powersOfTen.get(n);
772
+ if (cached !== void 0) return cached;
773
+ const power = Decimal.pow(10, n);
774
+ if (Number.isInteger(n) && n >= -324 && n <= 324) powersOfTen.set(n, power);
775
+ return power;
776
+ }
777
+ // packages/ecma402-abstract/NumberFormat/ToRawFixed.js
887
778
  function ToRawFixedFn(n, f) {
888
779
  return n.times(getPowerOf10(-f));
889
780
  }
@@ -904,10 +795,19 @@ function findN2R2(x, f, roundingIncrement) {
904
795
  /**
905
796
  * https://tc39.es/ecma402/#sec-torawfixed
906
797
  * @param x a finite non-negative Number or BigInt
907
- * @param minFraction an integer between 0 and 20
908
- * @param maxFraction an integer between 0 and 20
798
+ * @param minFraction an integer between 0 and 100
799
+ * @param maxFraction an integer between 0 and 100
909
800
  */
910
801
  function ToRawFixed(x, minFraction, maxFraction, roundingIncrement, unsignedRoundingMode) {
802
+ if (roundingIncrement === 1 && x.isInteger()) {
803
+ const integer = x.toString();
804
+ return {
805
+ formattedString: integer + (minFraction === 0 ? "" : "." + repeat("0", minFraction)),
806
+ roundedNumber: x,
807
+ integerDigitsCount: integer.length,
808
+ roundingMagnitude: -maxFraction
809
+ };
810
+ }
911
811
  const f = maxFraction;
912
812
  const { n1, r1 } = findN1R1(x, f, roundingIncrement);
913
813
  const { n2, r2 } = findN2R2(x, f, roundingIncrement);
@@ -948,8 +848,7 @@ function ToRawFixed(x, minFraction, maxFraction, roundingIncrement, unsignedRoun
948
848
  roundingMagnitude: -f
949
849
  };
950
850
  }
951
- //#endregion
952
- //#region packages/ecma402-abstract/NumberFormat/ToRawPrecision.js
851
+ // packages/ecma402-abstract/NumberFormat/ToRawPrecision.js
953
852
  function findN1E1R1(x, p) {
954
853
  const maxN1 = getPowerOf10(p);
955
854
  const minN1 = getPowerOf10(p - 1);
@@ -1084,8 +983,7 @@ function ToRawPrecision(x, minPrecision, maxPrecision, unsignedRoundingMode) {
1084
983
  roundingMagnitude: e - p + 1
1085
984
  };
1086
985
  }
1087
- //#endregion
1088
- //#region packages/ecma402-abstract/NumberFormat/FormatNumericToString.js
986
+ // packages/ecma402-abstract/NumberFormat/FormatNumericToString.js
1089
987
  /**
1090
988
  * https://tc39.es/ecma402/#sec-formatnumberstring
1091
989
  */
@@ -1141,8 +1039,7 @@ function FormatNumericToString(intlObject, _x) {
1141
1039
  formattedString: string
1142
1040
  };
1143
1041
  }
1144
- //#endregion
1145
- //#region packages/ecma402-abstract/PluralRules/ResolvePlural.js
1042
+ // packages/ecma402-abstract/PluralRules/ResolvePlural.js
1146
1043
  /**
1147
1044
  * ResolvePluralInternal ( pluralRules, n )
1148
1045
  *
@@ -1201,8 +1098,7 @@ function ResolvePlural(pl, n, { getInternalSlots, PluralRuleSelect }) {
1201
1098
  PluralRuleSelect
1202
1099
  }).pluralCategory;
1203
1100
  }
1204
- //#endregion
1205
- //#region packages/ecma402-abstract/PluralRules/ResolvePluralRange.js
1101
+ // packages/ecma402-abstract/PluralRules/ResolvePluralRange.js
1206
1102
  /**
1207
1103
  * ResolvePluralRange ( pluralRules, x, y )
1208
1104
  *
@@ -1237,8 +1133,7 @@ function ResolvePluralRange(pluralRules, x, y, { getInternalSlots, PluralRuleSel
1237
1133
  const { locale, type } = internalSlots;
1238
1134
  return PluralRuleSelectRange(locale, type, xp.pluralCategory, yp.pluralCategory);
1239
1135
  }
1240
- //#endregion
1241
- //#region packages/intl-pluralrules/get_internal_slots.ts
1136
+ // packages/intl-pluralrules/get_internal_slots.ts
1242
1137
  const internalSlotMap = /* @__PURE__ */ new WeakMap();
1243
1138
  function getInternalSlots(x) {
1244
1139
  let internalSlots = internalSlotMap.get(x);
@@ -1248,8 +1143,7 @@ function getInternalSlots(x) {
1248
1143
  }
1249
1144
  return internalSlots;
1250
1145
  }
1251
- //#endregion
1252
- //#region packages/intl-pluralrules/index.ts
1146
+ // packages/intl-pluralrules/index.ts
1253
1147
  function validateInstance(instance, method) {
1254
1148
  if (!(instance instanceof PluralRules)) throw new TypeError(`Method Intl.PluralRules.prototype.${method} called on incompatible receiver ${String(instance)}`);
1255
1149
  }
@@ -1451,8 +1345,7 @@ try {
1451
1345
  configurable: true
1452
1346
  });
1453
1347
  } catch {}
1454
- //#endregion
1455
- //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-locales@0.0.0/node_modules/@formatjs_generated/cldr.supported-locales/intl-pluralrules.js
1348
+ // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-locales@0.0.0/node_modules/@formatjs_generated/cldr.supported-locales/intl-pluralrules.js
1456
1349
  const supportedLocales = [
1457
1350
  "af",
1458
1351
  "ak",
@@ -1647,6 +1540,7 @@ const supportedLocales = [
1647
1540
  "ta",
1648
1541
  "te",
1649
1542
  "teo",
1543
+ "tg",
1650
1544
  "th",
1651
1545
  "ti",
1652
1546
  "tig",
@@ -1679,8 +1573,7 @@ const supportedLocales = [
1679
1573
  "zh",
1680
1574
  "zu"
1681
1575
  ];
1682
- //#endregion
1683
- //#region packages/intl-pluralrules/should-polyfill.ts
1576
+ // packages/intl-pluralrules/should-polyfill.ts
1684
1577
  function supportedLocalesOf(locale) {
1685
1578
  if (!locale) return true;
1686
1579
  const locales = Array.isArray(locale) ? locale : [locale];
@@ -1689,8 +1582,7 @@ function supportedLocalesOf(locale) {
1689
1582
  function shouldPolyfill(locale = "en") {
1690
1583
  if (typeof Intl === "undefined" || !("PluralRules" in Intl) || new Intl.PluralRules("en", { minimumFractionDigits: 2 }).select(1) === "one" || !supportedLocalesOf(locale)) return locale ? match([locale], supportedLocales, "en") : void 0;
1691
1584
  }
1692
- //#endregion
1693
- //#region packages/intl-pluralrules/polyfill.ts
1585
+ // packages/intl-pluralrules/polyfill.ts
1694
1586
  const intl = ensureIntl();
1695
1587
  if (shouldPolyfill()) {
1696
1588
  defineProperty(intl, "PluralRules", { value: PluralRules });
@@ -1700,6 +1592,5 @@ if (shouldPolyfill()) {
1700
1592
  delete globalThis.__FORMATJS_PLURALRULES_DATA__;
1701
1593
  }
1702
1594
  }
1703
- //#endregion
1704
1595
 
1705
1596
  //# sourceMappingURL=polyfill.js.map