@formatjs/intl-pluralrules 6.1.2 → 6.2.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.
- package/abstract/GetOperands.d.ts +37 -10
- package/abstract/GetOperands.js +11 -5
- package/abstract/InitializePluralRules.js +15 -0
- package/abstract/ResolvePlural.d.ts +31 -1
- package/abstract/ResolvePlural.js +64 -10
- package/abstract/ResolvePluralRange.d.ts +23 -0
- package/abstract/ResolvePluralRange.js +59 -0
- package/get_internal_slots.d.ts +0 -2
- package/index.d.ts +60 -2
- package/index.js +98 -4
- package/locale-data/af.js +14 -4
- package/locale-data/ak.js +14 -4
- package/locale-data/am.js +15 -4
- package/locale-data/an.js +14 -4
- package/locale-data/ar.js +22 -10
- package/locale-data/ars.js +21 -9
- package/locale-data/as.js +23 -8
- package/locale-data/asa.js +13 -3
- package/locale-data/ast.js +14 -4
- package/locale-data/az.js +21 -8
- package/locale-data/bal.js +15 -2
- package/locale-data/be.js +20 -8
- package/locale-data/bem.js +13 -3
- package/locale-data/bez.js +13 -3
- package/locale-data/bg.js +14 -4
- package/locale-data/bho.js +13 -3
- package/locale-data/bm.js +2 -2
- package/locale-data/bn.js +23 -8
- package/locale-data/bo.js +2 -2
- package/locale-data/br.js +19 -8
- package/locale-data/brx.js +13 -3
- package/locale-data/bs.js +18 -7
- package/locale-data/ca.js +25 -10
- package/locale-data/ce.js +13 -3
- package/locale-data/ceb.js +15 -4
- package/locale-data/cgg.js +13 -3
- package/locale-data/chr.js +13 -3
- package/locale-data/ckb.js +13 -3
- package/locale-data/cs.js +19 -8
- package/locale-data/cy.js +32 -14
- package/locale-data/da.js +17 -5
- package/locale-data/de.js +15 -5
- package/locale-data/doi.js +14 -3
- package/locale-data/dsb.js +19 -7
- package/locale-data/dv.js +13 -3
- package/locale-data/dz.js +2 -2
- package/locale-data/ee.js +13 -3
- package/locale-data/el.js +14 -4
- package/locale-data/en.js +22 -8
- package/locale-data/eo.js +13 -3
- package/locale-data/es.js +19 -7
- package/locale-data/et.js +15 -5
- package/locale-data/eu.js +14 -4
- package/locale-data/fa.js +15 -4
- package/locale-data/ff.js +13 -3
- package/locale-data/fi.js +15 -5
- package/locale-data/fil.js +19 -5
- package/locale-data/fo.js +13 -3
- package/locale-data/fr.js +21 -7
- package/locale-data/fur.js +13 -3
- package/locale-data/fy.js +14 -4
- package/locale-data/ga.js +22 -9
- package/locale-data/gd.js +23 -10
- package/locale-data/gl.js +15 -5
- package/locale-data/gsw.js +14 -4
- package/locale-data/gu.js +23 -8
- package/locale-data/guw.js +13 -3
- package/locale-data/gv.js +20 -8
- package/locale-data/ha.js +13 -3
- package/locale-data/haw.js +13 -3
- package/locale-data/he.js +17 -7
- package/locale-data/hi.js +23 -8
- package/locale-data/hnj.js +2 -2
- package/locale-data/hr.js +18 -7
- package/locale-data/hsb.js +19 -7
- package/locale-data/hu.js +16 -4
- package/locale-data/hy.js +17 -4
- package/locale-data/ia.js +15 -5
- package/locale-data/id.js +3 -3
- package/locale-data/ig.js +2 -2
- package/locale-data/ii.js +2 -2
- package/locale-data/io.js +15 -5
- package/locale-data/is.js +16 -5
- package/locale-data/it.js +21 -7
- package/locale-data/iu.js +15 -5
- package/locale-data/ja.js +3 -3
- package/locale-data/jbo.js +2 -2
- package/locale-data/jgo.js +13 -3
- package/locale-data/jmc.js +13 -3
- package/locale-data/jv.js +2 -2
- package/locale-data/jw.js +2 -2
- package/locale-data/ka.js +19 -7
- package/locale-data/kab.js +13 -3
- package/locale-data/kaj.js +13 -3
- package/locale-data/kcg.js +13 -3
- package/locale-data/kde.js +2 -2
- package/locale-data/kea.js +2 -2
- package/locale-data/kk.js +16 -5
- package/locale-data/kkj.js +13 -3
- package/locale-data/kl.js +13 -3
- package/locale-data/km.js +3 -3
- package/locale-data/kn.js +15 -4
- package/locale-data/ko.js +3 -3
- package/locale-data/ks.js +13 -3
- package/locale-data/ksb.js +13 -3
- package/locale-data/ksh.js +15 -5
- package/locale-data/ku.js +13 -3
- package/locale-data/kw.js +25 -11
- package/locale-data/ky.js +14 -4
- package/locale-data/lag.js +16 -6
- package/locale-data/lb.js +13 -3
- package/locale-data/lg.js +13 -3
- package/locale-data/lij.js +18 -5
- package/locale-data/lkt.js +2 -2
- package/locale-data/ln.js +13 -3
- package/locale-data/lo.js +14 -4
- package/locale-data/lt.js +20 -8
- package/locale-data/lv.js +18 -7
- package/locale-data/mas.js +13 -3
- package/locale-data/mg.js +13 -3
- package/locale-data/mgo.js +13 -3
- package/locale-data/mk.js +22 -8
- package/locale-data/ml.js +14 -4
- package/locale-data/mn.js +14 -4
- package/locale-data/mo.js +19 -6
- package/locale-data/mr.js +20 -7
- package/locale-data/ms.js +14 -4
- package/locale-data/mt.js +19 -8
- package/locale-data/my.js +3 -3
- package/locale-data/nah.js +13 -3
- package/locale-data/naq.js +15 -5
- package/locale-data/nb.js +14 -4
- package/locale-data/nd.js +13 -3
- package/locale-data/ne.js +16 -5
- package/locale-data/nl.js +15 -5
- package/locale-data/nn.js +13 -3
- package/locale-data/nnh.js +13 -3
- package/locale-data/no.js +14 -4
- package/locale-data/nqo.js +2 -2
- package/locale-data/nr.js +13 -3
- package/locale-data/nso.js +13 -3
- package/locale-data/ny.js +13 -3
- package/locale-data/nyn.js +13 -3
- package/locale-data/om.js +13 -3
- package/locale-data/or.js +22 -9
- package/locale-data/os.js +13 -3
- package/locale-data/osa.js +2 -2
- package/locale-data/pa.js +14 -4
- package/locale-data/pap.js +13 -3
- package/locale-data/pcm.js +15 -4
- package/locale-data/pl.js +19 -8
- package/locale-data/prg.js +17 -6
- package/locale-data/ps.js +14 -4
- package/locale-data/pt-PT.js +17 -6
- package/locale-data/pt.js +18 -7
- package/locale-data/rm.js +13 -3
- package/locale-data/ro.js +20 -7
- package/locale-data/rof.js +13 -3
- package/locale-data/ru.js +19 -8
- package/locale-data/rwk.js +13 -3
- package/locale-data/sah.js +2 -2
- package/locale-data/saq.js +13 -3
- package/locale-data/sat.js +15 -5
- package/locale-data/sc.js +18 -5
- package/locale-data/scn.js +21 -7
- package/locale-data/sd.js +14 -4
- package/locale-data/sdh.js +13 -3
- package/locale-data/se.js +15 -5
- package/locale-data/seh.js +13 -3
- package/locale-data/ses.js +2 -2
- package/locale-data/sg.js +2 -2
- package/locale-data/sh.js +17 -6
- package/locale-data/shi.js +16 -6
- package/locale-data/si.js +17 -5
- package/locale-data/sk.js +19 -8
- package/locale-data/sl.js +19 -8
- package/locale-data/sma.js +15 -5
- package/locale-data/smi.js +15 -5
- package/locale-data/smj.js +15 -5
- package/locale-data/smn.js +15 -5
- package/locale-data/sms.js +15 -5
- package/locale-data/sn.js +13 -3
- package/locale-data/so.js +13 -3
- package/locale-data/sq.js +18 -7
- package/locale-data/sr.js +18 -7
- package/locale-data/ss.js +13 -3
- package/locale-data/ssy.js +13 -3
- package/locale-data/st.js +13 -3
- package/locale-data/su.js +2 -2
- package/locale-data/sv.js +18 -5
- package/locale-data/sw.js +15 -5
- package/locale-data/syr.js +13 -3
- package/locale-data/ta.js +14 -4
- package/locale-data/te.js +14 -4
- package/locale-data/teo.js +13 -3
- package/locale-data/th.js +3 -3
- package/locale-data/ti.js +13 -3
- package/locale-data/tig.js +13 -3
- package/locale-data/tk.js +16 -5
- package/locale-data/tl.js +18 -4
- package/locale-data/tn.js +13 -3
- package/locale-data/to.js +2 -2
- package/locale-data/tpi.js +2 -2
- package/locale-data/tr.js +14 -4
- package/locale-data/ts.js +13 -3
- package/locale-data/tzm.js +13 -4
- package/locale-data/ug.js +14 -4
- package/locale-data/uk.js +22 -8
- package/locale-data/und.js +2 -2
- package/locale-data/ur.js +15 -5
- package/locale-data/uz.js +14 -4
- package/locale-data/ve.js +13 -3
- package/locale-data/vi.js +14 -4
- package/locale-data/vo.js +13 -3
- package/locale-data/vun.js +13 -3
- package/locale-data/wa.js +13 -3
- package/locale-data/wae.js +13 -3
- package/locale-data/wo.js +2 -2
- package/locale-data/xh.js +13 -3
- package/locale-data/xog.js +13 -3
- package/locale-data/yi.js +14 -4
- package/locale-data/yo.js +2 -2
- package/locale-data/yue.js +3 -3
- package/locale-data/zh.js +3 -3
- package/locale-data/zu.js +15 -4
- package/package.json +7 -7
- package/polyfill.iife.js +238 -16
package/polyfill.iife.js
CHANGED
|
@@ -2371,6 +2371,7 @@
|
|
|
2371
2371
|
var Decimal = P.constructor = clone(DEFAULTS);
|
|
2372
2372
|
LN10 = new Decimal(LN10);
|
|
2373
2373
|
PI = new Decimal(PI);
|
|
2374
|
+
var decimal_default = Decimal;
|
|
2374
2375
|
|
|
2375
2376
|
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/constants.js
|
|
2376
2377
|
var TEN = new Decimal(10);
|
|
@@ -2462,7 +2463,6 @@
|
|
|
2462
2463
|
}
|
|
2463
2464
|
}
|
|
2464
2465
|
var createMemoizedNumberFormat = memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
|
|
2465
|
-
var createMemoizedDateTimeFormat = memoize((...args) => new Intl.DateTimeFormat(...args), { strategy: strategies.variadic });
|
|
2466
2466
|
var createMemoizedPluralRules = memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.variadic });
|
|
2467
2467
|
var createMemoizedLocale = memoize((...args) => new Intl.Locale(...args), { strategy: strategies.variadic });
|
|
2468
2468
|
var createMemoizedListFormat = memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
|
|
@@ -2478,7 +2478,10 @@
|
|
|
2478
2478
|
if (typeof arg === "number") {
|
|
2479
2479
|
return new Decimal(arg);
|
|
2480
2480
|
}
|
|
2481
|
-
|
|
2481
|
+
if (typeof arg === "bigint") {
|
|
2482
|
+
return new Decimal(arg.toString());
|
|
2483
|
+
}
|
|
2484
|
+
invariant(typeof arg !== "symbol", "Symbol is not supported", TypeError);
|
|
2482
2485
|
if (arg === void 0) {
|
|
2483
2486
|
return new Decimal(NaN);
|
|
2484
2487
|
}
|
|
@@ -2688,8 +2691,10 @@
|
|
|
2688
2691
|
|
|
2689
2692
|
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/NumberFormat/ApplyUnsignedRoundingMode.js
|
|
2690
2693
|
function ApplyUnsignedRoundingMode(x, r1, r2, unsignedRoundingMode) {
|
|
2691
|
-
if (x.eq(r1))
|
|
2694
|
+
if (x.eq(r1) || r1.eq(r2))
|
|
2692
2695
|
return r1;
|
|
2696
|
+
if (x.eq(r2))
|
|
2697
|
+
return r2;
|
|
2693
2698
|
invariant(r1.lessThan(x) && x.lessThan(r2), `x should be between r1 and r2 but x=${x}, r1=${r1}, r2=${r2}`);
|
|
2694
2699
|
if (unsignedRoundingMode === "zero") {
|
|
2695
2700
|
return r1;
|
|
@@ -2727,6 +2732,56 @@
|
|
|
2727
2732
|
|
|
2728
2733
|
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/NumberFormat/ComputeExponentForMagnitude.js
|
|
2729
2734
|
Decimal.set({ toExpPos: 100 });
|
|
2735
|
+
function ComputeExponentForMagnitude(internalSlots, magnitude) {
|
|
2736
|
+
const { notation, dataLocaleData, numberingSystem } = internalSlots;
|
|
2737
|
+
switch (notation) {
|
|
2738
|
+
case "standard":
|
|
2739
|
+
return 0;
|
|
2740
|
+
case "scientific":
|
|
2741
|
+
return magnitude.toNumber();
|
|
2742
|
+
case "engineering":
|
|
2743
|
+
const thousands = magnitude.div(3).floor();
|
|
2744
|
+
return thousands.times(3).toNumber();
|
|
2745
|
+
default: {
|
|
2746
|
+
invariant(notation === "compact", "Invalid notation");
|
|
2747
|
+
const { compactDisplay, style, currencyDisplay } = internalSlots;
|
|
2748
|
+
let thresholdMap;
|
|
2749
|
+
if (style === "currency" && currencyDisplay !== "name") {
|
|
2750
|
+
const currency = dataLocaleData.numbers.currency[numberingSystem] || dataLocaleData.numbers.currency[dataLocaleData.numbers.nu[0]];
|
|
2751
|
+
thresholdMap = currency.short;
|
|
2752
|
+
} else {
|
|
2753
|
+
const decimal = dataLocaleData.numbers.decimal[numberingSystem] || dataLocaleData.numbers.decimal[dataLocaleData.numbers.nu[0]];
|
|
2754
|
+
thresholdMap = compactDisplay === "long" ? decimal.long : decimal.short;
|
|
2755
|
+
}
|
|
2756
|
+
if (!thresholdMap) {
|
|
2757
|
+
return 0;
|
|
2758
|
+
}
|
|
2759
|
+
const num = getPowerOf10(magnitude).toString();
|
|
2760
|
+
const thresholds = Object.keys(thresholdMap);
|
|
2761
|
+
if (num < thresholds[0]) {
|
|
2762
|
+
return 0;
|
|
2763
|
+
}
|
|
2764
|
+
if (num > thresholds[thresholds.length - 1]) {
|
|
2765
|
+
const magnitudeKey2 = thresholds[thresholds.length - 1];
|
|
2766
|
+
const compactPattern2 = thresholdMap[magnitudeKey2].other;
|
|
2767
|
+
if (compactPattern2 === "0") {
|
|
2768
|
+
return 0;
|
|
2769
|
+
}
|
|
2770
|
+
return magnitudeKey2.length - thresholdMap[magnitudeKey2].other.match(/0+/)[0].length;
|
|
2771
|
+
}
|
|
2772
|
+
const i = thresholds.indexOf(num);
|
|
2773
|
+
if (i === -1) {
|
|
2774
|
+
return 0;
|
|
2775
|
+
}
|
|
2776
|
+
const magnitudeKey = thresholds[i];
|
|
2777
|
+
const compactPattern = thresholdMap[magnitudeKey].other;
|
|
2778
|
+
if (compactPattern === "0") {
|
|
2779
|
+
return 0;
|
|
2780
|
+
}
|
|
2781
|
+
return magnitudeKey.length - thresholdMap[magnitudeKey].other.match(/0+/)[0].length;
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2730
2785
|
|
|
2731
2786
|
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/NumberFormat/GetUnsignedRoundingMode.js
|
|
2732
2787
|
var negativeMapping = {
|
|
@@ -3050,7 +3105,7 @@
|
|
|
3050
3105
|
}
|
|
3051
3106
|
|
|
3052
3107
|
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/regex.generated.js
|
|
3053
|
-
var S_UNICODE_REGEX = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\
|
|
3108
|
+
var S_UNICODE_REGEX = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C1\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2429\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E5\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD803[\uDD8E\uDD8F\uDED1-\uDED8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDC00-\uDCEF\uDCFA-\uDCFC\uDD00-\uDEB3\uDEBA-\uDED0\uDEE0-\uDEF0\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED8\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0-\uDCBB\uDCC0\uDCC1\uDCD0-\uDCD8\uDD00-\uDE57\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8\uDF00-\uDF92\uDF94-\uDFEF\uDFFA]/;
|
|
3054
3109
|
|
|
3055
3110
|
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/NumberFormat/format_to_parts.js
|
|
3056
3111
|
var CARET_S_UNICODE_REGEX = new RegExp(`^${S_UNICODE_REGEX.source}`);
|
|
@@ -6861,6 +6916,31 @@ Valid values are ${Array.from(VALID_ROUNDING_INCREMENTS).join(", ")}.`);
|
|
|
6861
6916
|
return RangePatternType2;
|
|
6862
6917
|
}({});
|
|
6863
6918
|
|
|
6919
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/ToIntlMathematicalValue.js
|
|
6920
|
+
function ToIntlMathematicalValue(input) {
|
|
6921
|
+
if (typeof input === "bigint") {
|
|
6922
|
+
return new Decimal(input.toString());
|
|
6923
|
+
}
|
|
6924
|
+
let primValue = ToPrimitive(input, "number");
|
|
6925
|
+
if (primValue === void 0) {
|
|
6926
|
+
return new Decimal(NaN);
|
|
6927
|
+
}
|
|
6928
|
+
if (primValue === true) {
|
|
6929
|
+
return new Decimal(1);
|
|
6930
|
+
}
|
|
6931
|
+
if (primValue === false) {
|
|
6932
|
+
return new Decimal(0);
|
|
6933
|
+
}
|
|
6934
|
+
if (primValue === null) {
|
|
6935
|
+
return new Decimal(0);
|
|
6936
|
+
}
|
|
6937
|
+
try {
|
|
6938
|
+
return new Decimal(primValue);
|
|
6939
|
+
} catch (e) {
|
|
6940
|
+
return new Decimal(NaN);
|
|
6941
|
+
}
|
|
6942
|
+
}
|
|
6943
|
+
|
|
6864
6944
|
// packages/intl-pluralrules/abstract/InitializePluralRules.ts
|
|
6865
6945
|
function InitializePluralRules(pl, locales, options, {
|
|
6866
6946
|
availableLocales,
|
|
@@ -6898,12 +6978,32 @@ Valid values are ${Array.from(VALID_ROUNDING_INCREMENTS).join(", ")}.`);
|
|
|
6898
6978
|
["cardinal", "ordinal"],
|
|
6899
6979
|
"cardinal"
|
|
6900
6980
|
);
|
|
6981
|
+
const notation = GetOption(
|
|
6982
|
+
opts,
|
|
6983
|
+
"notation",
|
|
6984
|
+
"string",
|
|
6985
|
+
["standard", "compact"],
|
|
6986
|
+
"standard"
|
|
6987
|
+
);
|
|
6988
|
+
internalSlots.notation = notation;
|
|
6989
|
+
if (notation === "compact") {
|
|
6990
|
+
internalSlots.compactDisplay = GetOption(
|
|
6991
|
+
opts,
|
|
6992
|
+
"compactDisplay",
|
|
6993
|
+
"string",
|
|
6994
|
+
["short", "long"],
|
|
6995
|
+
"short"
|
|
6996
|
+
);
|
|
6997
|
+
if (typeof Intl !== "undefined" && Intl.NumberFormat && Intl.NumberFormat.localeData) {
|
|
6998
|
+
internalSlots.dataLocaleData = Intl.NumberFormat.localeData[r.locale];
|
|
6999
|
+
}
|
|
7000
|
+
}
|
|
6901
7001
|
SetNumberFormatDigitOptions(internalSlots, opts, 0, 3, "standard");
|
|
6902
7002
|
return pl;
|
|
6903
7003
|
}
|
|
6904
7004
|
|
|
6905
7005
|
// packages/intl-pluralrules/abstract/GetOperands.ts
|
|
6906
|
-
function GetOperands(s) {
|
|
7006
|
+
function GetOperands(s, exponent = 0) {
|
|
6907
7007
|
invariant(
|
|
6908
7008
|
typeof s === "string",
|
|
6909
7009
|
`GetOperands should have been called with a string`
|
|
@@ -6938,19 +7038,22 @@ Valid values are ${Array.from(VALID_ROUNDING_INCREMENTS).join(", ")}.`);
|
|
|
6938
7038
|
}
|
|
6939
7039
|
return {
|
|
6940
7040
|
Number: n,
|
|
6941
|
-
|
|
7041
|
+
// Keep as string if too large for JavaScript number to preserve precision
|
|
7042
|
+
IntegerDigits: i.lessThanOrEqualTo(Number.MAX_SAFE_INTEGER) && i.greaterThanOrEqualTo(-Number.MAX_SAFE_INTEGER) ? i.toNumber() : i.toString(),
|
|
6942
7043
|
NumberOfFractionDigits: v,
|
|
6943
7044
|
NumberOfFractionDigitsWithoutTrailing: w,
|
|
6944
7045
|
FractionDigits: f.toNumber(),
|
|
6945
|
-
FractionDigitsWithoutTrailing: t.toNumber()
|
|
7046
|
+
FractionDigitsWithoutTrailing: t.toNumber(),
|
|
7047
|
+
CompactExponent: exponent
|
|
6946
7048
|
};
|
|
6947
7049
|
}
|
|
6948
7050
|
|
|
6949
7051
|
// packages/intl-pluralrules/abstract/ResolvePlural.ts
|
|
6950
|
-
function
|
|
7052
|
+
function ResolvePluralInternal(pl, n, {
|
|
6951
7053
|
getInternalSlots: getInternalSlots2,
|
|
6952
7054
|
PluralRuleSelect: PluralRuleSelect2
|
|
6953
7055
|
}) {
|
|
7056
|
+
var _a;
|
|
6954
7057
|
const internalSlots = getInternalSlots2(pl);
|
|
6955
7058
|
invariant(Type(internalSlots) === "Object", "pl has to be an object");
|
|
6956
7059
|
invariant(
|
|
@@ -6958,13 +7061,69 @@ Valid values are ${Array.from(VALID_ROUNDING_INCREMENTS).join(", ")}.`);
|
|
|
6958
7061
|
"pluralrules must be initialized"
|
|
6959
7062
|
);
|
|
6960
7063
|
if (!n.isFinite()) {
|
|
6961
|
-
return "other";
|
|
7064
|
+
return { formattedString: String(n), pluralCategory: "other" };
|
|
6962
7065
|
}
|
|
6963
|
-
const { locale, type } = internalSlots;
|
|
7066
|
+
const { locale, type, notation } = internalSlots;
|
|
6964
7067
|
const res = FormatNumericToString(internalSlots, n);
|
|
6965
7068
|
const s = res.formattedString;
|
|
6966
|
-
|
|
6967
|
-
|
|
7069
|
+
let exponent = 0;
|
|
7070
|
+
if (notation === "compact" && !n.isZero()) {
|
|
7071
|
+
if ((_a = internalSlots.dataLocaleData) == null ? void 0 : _a.numbers) {
|
|
7072
|
+
try {
|
|
7073
|
+
const magnitudeNum = Math.floor(Math.log10(Math.abs(n.toNumber())));
|
|
7074
|
+
const magnitude = new decimal_default(magnitudeNum);
|
|
7075
|
+
exponent = ComputeExponentForMagnitude(internalSlots, magnitude);
|
|
7076
|
+
} catch (e) {
|
|
7077
|
+
exponent = 0;
|
|
7078
|
+
}
|
|
7079
|
+
}
|
|
7080
|
+
}
|
|
7081
|
+
const operands = GetOperands(s, exponent);
|
|
7082
|
+
const pluralCategory = PluralRuleSelect2(locale, type, n, operands);
|
|
7083
|
+
return { formattedString: s, pluralCategory };
|
|
7084
|
+
}
|
|
7085
|
+
function ResolvePlural(pl, n, {
|
|
7086
|
+
getInternalSlots: getInternalSlots2,
|
|
7087
|
+
PluralRuleSelect: PluralRuleSelect2
|
|
7088
|
+
}) {
|
|
7089
|
+
return ResolvePluralInternal(pl, n, { getInternalSlots: getInternalSlots2, PluralRuleSelect: PluralRuleSelect2 }).pluralCategory;
|
|
7090
|
+
}
|
|
7091
|
+
|
|
7092
|
+
// packages/intl-pluralrules/abstract/ResolvePluralRange.ts
|
|
7093
|
+
function ResolvePluralRange(pluralRules, x, y, {
|
|
7094
|
+
getInternalSlots: getInternalSlots2,
|
|
7095
|
+
PluralRuleSelect: PluralRuleSelect2,
|
|
7096
|
+
PluralRuleSelectRange: PluralRuleSelectRange2
|
|
7097
|
+
}) {
|
|
7098
|
+
if (!x.isFinite() || !y.isFinite()) {
|
|
7099
|
+
throw new RangeError(
|
|
7100
|
+
"selectRange requires start and end values to be finite numbers"
|
|
7101
|
+
);
|
|
7102
|
+
}
|
|
7103
|
+
const internalSlots = getInternalSlots2(pluralRules);
|
|
7104
|
+
invariant(Type(internalSlots) === "Object", "pluralRules has to be an object");
|
|
7105
|
+
invariant(
|
|
7106
|
+
"initializedPluralRules" in internalSlots,
|
|
7107
|
+
"pluralrules must be initialized"
|
|
7108
|
+
);
|
|
7109
|
+
const xp = ResolvePluralInternal(pluralRules, x, {
|
|
7110
|
+
getInternalSlots: getInternalSlots2,
|
|
7111
|
+
PluralRuleSelect: PluralRuleSelect2
|
|
7112
|
+
});
|
|
7113
|
+
const yp = ResolvePluralInternal(pluralRules, y, {
|
|
7114
|
+
getInternalSlots: getInternalSlots2,
|
|
7115
|
+
PluralRuleSelect: PluralRuleSelect2
|
|
7116
|
+
});
|
|
7117
|
+
if (xp.formattedString === yp.formattedString) {
|
|
7118
|
+
return xp.pluralCategory;
|
|
7119
|
+
}
|
|
7120
|
+
const { locale, type } = internalSlots;
|
|
7121
|
+
return PluralRuleSelectRange2(
|
|
7122
|
+
locale,
|
|
7123
|
+
type,
|
|
7124
|
+
xp.pluralCategory,
|
|
7125
|
+
yp.pluralCategory
|
|
7126
|
+
);
|
|
6968
7127
|
}
|
|
6969
7128
|
|
|
6970
7129
|
// packages/intl-pluralrules/get_internal_slots.ts
|
|
@@ -6988,12 +7147,28 @@ Valid values are ${Array.from(VALID_ROUNDING_INCREMENTS).join(", ")}.`);
|
|
|
6988
7147
|
);
|
|
6989
7148
|
}
|
|
6990
7149
|
}
|
|
6991
|
-
function PluralRuleSelect(locale, type, _n, {
|
|
7150
|
+
function PluralRuleSelect(locale, type, _n, {
|
|
7151
|
+
IntegerDigits,
|
|
7152
|
+
NumberOfFractionDigits,
|
|
7153
|
+
FractionDigits,
|
|
7154
|
+
CompactExponent
|
|
7155
|
+
}) {
|
|
6992
7156
|
return PluralRules.localeData[locale].fn(
|
|
6993
|
-
NumberOfFractionDigits ? `${IntegerDigits}.${FractionDigits}` : IntegerDigits,
|
|
6994
|
-
type === "ordinal"
|
|
7157
|
+
NumberOfFractionDigits ? `${IntegerDigits}.${FractionDigits}` : String(IntegerDigits),
|
|
7158
|
+
type === "ordinal",
|
|
7159
|
+
CompactExponent
|
|
6995
7160
|
);
|
|
6996
7161
|
}
|
|
7162
|
+
function PluralRuleSelectRange(locale, type, xp, yp) {
|
|
7163
|
+
var _a;
|
|
7164
|
+
const localeData = PluralRules.localeData[locale];
|
|
7165
|
+
if (!localeData || !localeData.pluralRanges) {
|
|
7166
|
+
return yp;
|
|
7167
|
+
}
|
|
7168
|
+
const key = `${xp}_${yp}`;
|
|
7169
|
+
const rangeData = type === "ordinal" ? localeData.pluralRanges.ordinal : localeData.pluralRanges.cardinal;
|
|
7170
|
+
return (_a = rangeData == null ? void 0 : rangeData[key]) != null ? _a : yp;
|
|
7171
|
+
}
|
|
6997
7172
|
var _PluralRules = class _PluralRules {
|
|
6998
7173
|
constructor(locales, options) {
|
|
6999
7174
|
const newTarget = this && this instanceof _PluralRules ? this.constructor : void 0;
|
|
@@ -7033,9 +7208,56 @@ Valid values are ${Array.from(VALID_ROUNDING_INCREMENTS).join(", ")}.`);
|
|
|
7033
7208
|
}
|
|
7034
7209
|
select(val) {
|
|
7035
7210
|
validateInstance(this, "select");
|
|
7036
|
-
const n =
|
|
7211
|
+
const n = ToIntlMathematicalValue(val);
|
|
7037
7212
|
return ResolvePlural(this, n, { getInternalSlots, PluralRuleSelect });
|
|
7038
7213
|
}
|
|
7214
|
+
/**
|
|
7215
|
+
* Intl.PluralRules.prototype.selectRange ( start, end )
|
|
7216
|
+
*
|
|
7217
|
+
* Returns a string indicating which plural rule applies to a range of numbers.
|
|
7218
|
+
* This is useful for formatting ranges like "1-2 items" vs "2-3 items" where
|
|
7219
|
+
* different languages have different plural rules for ranges.
|
|
7220
|
+
*
|
|
7221
|
+
* Specification: https://tc39.es/ecma402/#sec-intl.pluralrules.prototype.selectrange
|
|
7222
|
+
*
|
|
7223
|
+
* @param start - The start value of the range (number or bigint)
|
|
7224
|
+
* @param end - The end value of the range (number or bigint)
|
|
7225
|
+
* @returns The plural category for the range (zero, one, two, few, many, or other)
|
|
7226
|
+
*
|
|
7227
|
+
* @example
|
|
7228
|
+
* const pr = new Intl.PluralRules('en');
|
|
7229
|
+
* pr.selectRange(1, 2); // "other" (English: "1-2 items")
|
|
7230
|
+
* pr.selectRange(1, 1); // "one" (same value: "1 item")
|
|
7231
|
+
*
|
|
7232
|
+
* @example
|
|
7233
|
+
* const prFr = new Intl.PluralRules('fr');
|
|
7234
|
+
* prFr.selectRange(0, 1); // "one" (French: "0-1 vue")
|
|
7235
|
+
* prFr.selectRange(1, 2); // "other" (French: "1-2 vues")
|
|
7236
|
+
*
|
|
7237
|
+
* @example
|
|
7238
|
+
* // BigInt support (spec-compliant, but Chrome has a bug as of early 2025)
|
|
7239
|
+
* pr.selectRange(BigInt(1), BigInt(2)); // "other"
|
|
7240
|
+
*
|
|
7241
|
+
* @throws {TypeError} If start or end is undefined
|
|
7242
|
+
* @throws {RangeError} If start or end is not a finite number (Infinity, NaN)
|
|
7243
|
+
*
|
|
7244
|
+
* @note Chrome's native implementation (as of early 2025) has a bug where it throws
|
|
7245
|
+
* "Cannot convert a BigInt value to a number" when using BigInt arguments. This is
|
|
7246
|
+
* a browser bug - the spec requires BigInt support. This polyfill handles BigInt correctly.
|
|
7247
|
+
*/
|
|
7248
|
+
selectRange(start, end) {
|
|
7249
|
+
validateInstance(this, "selectRange");
|
|
7250
|
+
if (start === void 0 || end === void 0) {
|
|
7251
|
+
throw new TypeError("selectRange requires both start and end arguments");
|
|
7252
|
+
}
|
|
7253
|
+
const x = ToIntlMathematicalValue(start);
|
|
7254
|
+
const y = ToIntlMathematicalValue(end);
|
|
7255
|
+
return ResolvePluralRange(this, x, y, {
|
|
7256
|
+
getInternalSlots,
|
|
7257
|
+
PluralRuleSelect,
|
|
7258
|
+
PluralRuleSelectRange
|
|
7259
|
+
});
|
|
7260
|
+
}
|
|
7039
7261
|
toString() {
|
|
7040
7262
|
return "[object Intl.PluralRules]";
|
|
7041
7263
|
}
|