intl-messageformat 10.6.0 → 10.7.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/intl-messageformat.esm.js +217 -173
- package/intl-messageformat.iife.js +384 -382
- package/lib/src/core.d.ts +2 -2
- package/lib/src/core.js +1 -1
- package/package.json +5 -5
- package/src/core.d.ts +2 -2
- package/src/core.js +1 -1
- package/src/formatters.js +3 -3
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => {
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/lib/index.js
|
|
1
|
+
// node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/lib/index.js
|
|
9
2
|
function memoize(fn, options) {
|
|
10
3
|
var cache = options && options.cache ? options.cache : cacheDefault;
|
|
11
4
|
var serializer = options && options.serializer ? options.serializer : serializerDefault;
|
|
@@ -72,7 +65,7 @@ var strategies = {
|
|
|
72
65
|
monadic: strategyMonadic
|
|
73
66
|
};
|
|
74
67
|
|
|
75
|
-
//
|
|
68
|
+
// node_modules/.aspect_rules_js/tslib@2.8.0/node_modules/tslib/tslib.es6.mjs
|
|
76
69
|
var __assign = function() {
|
|
77
70
|
__assign = Object.assign || function __assign2(t) {
|
|
78
71
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -86,7 +79,7 @@ var __assign = function() {
|
|
|
86
79
|
return __assign.apply(this, arguments);
|
|
87
80
|
};
|
|
88
81
|
|
|
89
|
-
//
|
|
82
|
+
// node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/lib/error.js
|
|
90
83
|
var ErrorKind;
|
|
91
84
|
(function(ErrorKind2) {
|
|
92
85
|
ErrorKind2[ErrorKind2["EXPECT_ARGUMENT_CLOSING_BRACE"] = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE";
|
|
@@ -117,7 +110,7 @@ var ErrorKind;
|
|
|
117
110
|
ErrorKind2[ErrorKind2["UNCLOSED_TAG"] = 27] = "UNCLOSED_TAG";
|
|
118
111
|
})(ErrorKind || (ErrorKind = {}));
|
|
119
112
|
|
|
120
|
-
//
|
|
113
|
+
// node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/lib/types.js
|
|
121
114
|
var TYPE;
|
|
122
115
|
(function(TYPE2) {
|
|
123
116
|
TYPE2[TYPE2["literal"] = 0] = "literal";
|
|
@@ -169,10 +162,10 @@ function isDateTimeSkeleton(el) {
|
|
|
169
162
|
return !!(el && typeof el === "object" && el.type === SKELETON_TYPE.dateTime);
|
|
170
163
|
}
|
|
171
164
|
|
|
172
|
-
//
|
|
165
|
+
// node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/lib/regex.generated.js
|
|
173
166
|
var SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/;
|
|
174
167
|
|
|
175
|
-
//
|
|
168
|
+
// node_modules/.aspect_rules_js/@formatjs+icu-skeleton-parser@0.0.0/node_modules/@formatjs/icu-skeleton-parser/lib/date-time.js
|
|
176
169
|
var DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
|
|
177
170
|
function parseDateTimeSkeleton(skeleton) {
|
|
178
171
|
var result = {};
|
|
@@ -273,10 +266,10 @@ function parseDateTimeSkeleton(skeleton) {
|
|
|
273
266
|
return result;
|
|
274
267
|
}
|
|
275
268
|
|
|
276
|
-
//
|
|
269
|
+
// node_modules/.aspect_rules_js/@formatjs+icu-skeleton-parser@0.0.0/node_modules/@formatjs/icu-skeleton-parser/lib/regex.generated.js
|
|
277
270
|
var WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
|
|
278
271
|
|
|
279
|
-
//
|
|
272
|
+
// node_modules/.aspect_rules_js/@formatjs+icu-skeleton-parser@0.0.0/node_modules/@formatjs/icu-skeleton-parser/lib/number.js
|
|
280
273
|
function parseNumberSkeletonFromString(skeleton) {
|
|
281
274
|
if (skeleton.length === 0) {
|
|
282
275
|
throw new Error("Number skeleton cannot be empty");
|
|
@@ -563,12 +556,18 @@ function parseNumberSkeleton(tokens) {
|
|
|
563
556
|
return result;
|
|
564
557
|
}
|
|
565
558
|
|
|
566
|
-
//
|
|
559
|
+
// node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/lib/time-data.generated.js
|
|
567
560
|
var timeData = {
|
|
568
561
|
"001": [
|
|
569
562
|
"H",
|
|
570
563
|
"h"
|
|
571
564
|
],
|
|
565
|
+
"419": [
|
|
566
|
+
"h",
|
|
567
|
+
"H",
|
|
568
|
+
"hB",
|
|
569
|
+
"hb"
|
|
570
|
+
],
|
|
572
571
|
"AC": [
|
|
573
572
|
"H",
|
|
574
573
|
"h",
|
|
@@ -617,8 +616,8 @@ var timeData = {
|
|
|
617
616
|
"hB"
|
|
618
617
|
],
|
|
619
618
|
"AR": [
|
|
620
|
-
"H",
|
|
621
619
|
"h",
|
|
620
|
+
"H",
|
|
622
621
|
"hB",
|
|
623
622
|
"hb"
|
|
624
623
|
],
|
|
@@ -708,9 +707,9 @@ var timeData = {
|
|
|
708
707
|
"H"
|
|
709
708
|
],
|
|
710
709
|
"BO": [
|
|
710
|
+
"h",
|
|
711
711
|
"H",
|
|
712
712
|
"hB",
|
|
713
|
-
"h",
|
|
714
713
|
"hb"
|
|
715
714
|
],
|
|
716
715
|
"BQ": [
|
|
@@ -787,8 +786,8 @@ var timeData = {
|
|
|
787
786
|
"hB"
|
|
788
787
|
],
|
|
789
788
|
"CL": [
|
|
790
|
-
"H",
|
|
791
789
|
"h",
|
|
790
|
+
"H",
|
|
792
791
|
"hB",
|
|
793
792
|
"hb"
|
|
794
793
|
],
|
|
@@ -813,14 +812,14 @@ var timeData = {
|
|
|
813
812
|
"H"
|
|
814
813
|
],
|
|
815
814
|
"CR": [
|
|
816
|
-
"H",
|
|
817
815
|
"h",
|
|
816
|
+
"H",
|
|
818
817
|
"hB",
|
|
819
818
|
"hb"
|
|
820
819
|
],
|
|
821
820
|
"CU": [
|
|
822
|
-
"H",
|
|
823
821
|
"h",
|
|
822
|
+
"H",
|
|
824
823
|
"hB",
|
|
825
824
|
"hb"
|
|
826
825
|
],
|
|
@@ -889,9 +888,9 @@ var timeData = {
|
|
|
889
888
|
"hb"
|
|
890
889
|
],
|
|
891
890
|
"EC": [
|
|
891
|
+
"h",
|
|
892
892
|
"H",
|
|
893
893
|
"hB",
|
|
894
|
-
"h",
|
|
895
894
|
"hb"
|
|
896
895
|
],
|
|
897
896
|
"EE": [
|
|
@@ -1027,8 +1026,8 @@ var timeData = {
|
|
|
1027
1026
|
"hB"
|
|
1028
1027
|
],
|
|
1029
1028
|
"GT": [
|
|
1030
|
-
"H",
|
|
1031
1029
|
"h",
|
|
1030
|
+
"H",
|
|
1032
1031
|
"hB",
|
|
1033
1032
|
"hb"
|
|
1034
1033
|
],
|
|
@@ -1055,8 +1054,8 @@ var timeData = {
|
|
|
1055
1054
|
"H"
|
|
1056
1055
|
],
|
|
1057
1056
|
"HN": [
|
|
1058
|
-
"H",
|
|
1059
1057
|
"h",
|
|
1058
|
+
"H",
|
|
1060
1059
|
"hB",
|
|
1061
1060
|
"hb"
|
|
1062
1061
|
],
|
|
@@ -1370,8 +1369,8 @@ var timeData = {
|
|
|
1370
1369
|
"hB"
|
|
1371
1370
|
],
|
|
1372
1371
|
"MX": [
|
|
1373
|
-
"H",
|
|
1374
1372
|
"h",
|
|
1373
|
+
"H",
|
|
1375
1374
|
"hB",
|
|
1376
1375
|
"hb"
|
|
1377
1376
|
],
|
|
@@ -1411,8 +1410,8 @@ var timeData = {
|
|
|
1411
1410
|
"hB"
|
|
1412
1411
|
],
|
|
1413
1412
|
"NI": [
|
|
1414
|
-
"H",
|
|
1415
1413
|
"h",
|
|
1414
|
+
"H",
|
|
1416
1415
|
"hB",
|
|
1417
1416
|
"hb"
|
|
1418
1417
|
],
|
|
@@ -1460,9 +1459,9 @@ var timeData = {
|
|
|
1460
1459
|
"hb"
|
|
1461
1460
|
],
|
|
1462
1461
|
"PE": [
|
|
1462
|
+
"h",
|
|
1463
1463
|
"H",
|
|
1464
1464
|
"hB",
|
|
1465
|
-
"h",
|
|
1466
1465
|
"hb"
|
|
1467
1466
|
],
|
|
1468
1467
|
"PF": [
|
|
@@ -1520,8 +1519,8 @@ var timeData = {
|
|
|
1520
1519
|
"H"
|
|
1521
1520
|
],
|
|
1522
1521
|
"PY": [
|
|
1523
|
-
"H",
|
|
1524
1522
|
"h",
|
|
1523
|
+
"H",
|
|
1525
1524
|
"hB",
|
|
1526
1525
|
"hb"
|
|
1527
1526
|
],
|
|
@@ -1634,8 +1633,8 @@ var timeData = {
|
|
|
1634
1633
|
"hB"
|
|
1635
1634
|
],
|
|
1636
1635
|
"SV": [
|
|
1637
|
-
"H",
|
|
1638
1636
|
"h",
|
|
1637
|
+
"H",
|
|
1639
1638
|
"hB",
|
|
1640
1639
|
"hb"
|
|
1641
1640
|
],
|
|
@@ -1757,8 +1756,8 @@ var timeData = {
|
|
|
1757
1756
|
"hB"
|
|
1758
1757
|
],
|
|
1759
1758
|
"UY": [
|
|
1760
|
-
"H",
|
|
1761
1759
|
"h",
|
|
1760
|
+
"H",
|
|
1762
1761
|
"hB",
|
|
1763
1762
|
"hb"
|
|
1764
1763
|
],
|
|
@@ -1866,24 +1865,12 @@ var timeData = {
|
|
|
1866
1865
|
"H",
|
|
1867
1866
|
"hB"
|
|
1868
1867
|
],
|
|
1869
|
-
"es-BO": [
|
|
1870
|
-
"H",
|
|
1871
|
-
"h",
|
|
1872
|
-
"hB",
|
|
1873
|
-
"hb"
|
|
1874
|
-
],
|
|
1875
1868
|
"es-BR": [
|
|
1876
1869
|
"H",
|
|
1877
1870
|
"h",
|
|
1878
1871
|
"hB",
|
|
1879
1872
|
"hb"
|
|
1880
1873
|
],
|
|
1881
|
-
"es-EC": [
|
|
1882
|
-
"H",
|
|
1883
|
-
"h",
|
|
1884
|
-
"hB",
|
|
1885
|
-
"hb"
|
|
1886
|
-
],
|
|
1887
1874
|
"es-ES": [
|
|
1888
1875
|
"H",
|
|
1889
1876
|
"h",
|
|
@@ -1896,12 +1883,6 @@ var timeData = {
|
|
|
1896
1883
|
"hB",
|
|
1897
1884
|
"hb"
|
|
1898
1885
|
],
|
|
1899
|
-
"es-PE": [
|
|
1900
|
-
"H",
|
|
1901
|
-
"h",
|
|
1902
|
-
"hB",
|
|
1903
|
-
"hb"
|
|
1904
|
-
],
|
|
1905
1886
|
"fr-CA": [
|
|
1906
1887
|
"H",
|
|
1907
1888
|
"h",
|
|
@@ -1974,7 +1955,7 @@ var timeData = {
|
|
|
1974
1955
|
]
|
|
1975
1956
|
};
|
|
1976
1957
|
|
|
1977
|
-
//
|
|
1958
|
+
// node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/lib/date-time-pattern-generator.js
|
|
1978
1959
|
function getBestPattern(skeleton, locale) {
|
|
1979
1960
|
var skeletonCopy = "";
|
|
1980
1961
|
for (var patternPos = 0; patternPos < skeleton.length; patternPos++) {
|
|
@@ -2036,7 +2017,7 @@ function getDefaultHourSymbolFromLocale(locale) {
|
|
|
2036
2017
|
return hourCycles[0];
|
|
2037
2018
|
}
|
|
2038
2019
|
|
|
2039
|
-
//
|
|
2020
|
+
// node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/lib/parser.js
|
|
2040
2021
|
var _a;
|
|
2041
2022
|
var SPACE_SEPARATOR_START_REGEX = new RegExp("^".concat(SPACE_SEPARATOR_REGEX.source, "*"));
|
|
2042
2023
|
var SPACE_SEPARATOR_END_REGEX = new RegExp("".concat(SPACE_SEPARATOR_REGEX.source, "*$"));
|
|
@@ -2841,7 +2822,7 @@ function _isPatternSyntax(c) {
|
|
|
2841
2822
|
return c >= 33 && c <= 35 || c === 36 || c >= 37 && c <= 39 || c === 40 || c === 41 || c === 42 || c === 43 || c === 44 || c === 45 || c >= 46 && c <= 47 || c >= 58 && c <= 59 || c >= 60 && c <= 62 || c >= 63 && c <= 64 || c === 91 || c === 92 || c === 93 || c === 94 || c === 96 || c === 123 || c === 124 || c === 125 || c === 126 || c === 161 || c >= 162 && c <= 165 || c === 166 || c === 167 || c === 169 || c === 171 || c === 172 || c === 174 || c === 176 || c === 177 || c === 182 || c === 187 || c === 191 || c === 215 || c === 247 || c >= 8208 && c <= 8213 || c >= 8214 && c <= 8215 || c === 8216 || c === 8217 || c === 8218 || c >= 8219 && c <= 8220 || c === 8221 || c === 8222 || c === 8223 || c >= 8224 && c <= 8231 || c >= 8240 && c <= 8248 || c === 8249 || c === 8250 || c >= 8251 && c <= 8254 || c >= 8257 && c <= 8259 || c === 8260 || c === 8261 || c === 8262 || c >= 8263 && c <= 8273 || c === 8274 || c === 8275 || c >= 8277 && c <= 8286 || c >= 8592 && c <= 8596 || c >= 8597 && c <= 8601 || c >= 8602 && c <= 8603 || c >= 8604 && c <= 8607 || c === 8608 || c >= 8609 && c <= 8610 || c === 8611 || c >= 8612 && c <= 8613 || c === 8614 || c >= 8615 && c <= 8621 || c === 8622 || c >= 8623 && c <= 8653 || c >= 8654 && c <= 8655 || c >= 8656 && c <= 8657 || c === 8658 || c === 8659 || c === 8660 || c >= 8661 && c <= 8691 || c >= 8692 && c <= 8959 || c >= 8960 && c <= 8967 || c === 8968 || c === 8969 || c === 8970 || c === 8971 || c >= 8972 && c <= 8991 || c >= 8992 && c <= 8993 || c >= 8994 && c <= 9e3 || c === 9001 || c === 9002 || c >= 9003 && c <= 9083 || c === 9084 || c >= 9085 && c <= 9114 || c >= 9115 && c <= 9139 || c >= 9140 && c <= 9179 || c >= 9180 && c <= 9185 || c >= 9186 && c <= 9254 || c >= 9255 && c <= 9279 || c >= 9280 && c <= 9290 || c >= 9291 && c <= 9311 || c >= 9472 && c <= 9654 || c === 9655 || c >= 9656 && c <= 9664 || c === 9665 || c >= 9666 && c <= 9719 || c >= 9720 && c <= 9727 || c >= 9728 && c <= 9838 || c === 9839 || c >= 9840 && c <= 10087 || c === 10088 || c === 10089 || c === 10090 || c === 10091 || c === 10092 || c === 10093 || c === 10094 || c === 10095 || c === 10096 || c === 10097 || c === 10098 || c === 10099 || c === 10100 || c === 10101 || c >= 10132 && c <= 10175 || c >= 10176 && c <= 10180 || c === 10181 || c === 10182 || c >= 10183 && c <= 10213 || c === 10214 || c === 10215 || c === 10216 || c === 10217 || c === 10218 || c === 10219 || c === 10220 || c === 10221 || c === 10222 || c === 10223 || c >= 10224 && c <= 10239 || c >= 10240 && c <= 10495 || c >= 10496 && c <= 10626 || c === 10627 || c === 10628 || c === 10629 || c === 10630 || c === 10631 || c === 10632 || c === 10633 || c === 10634 || c === 10635 || c === 10636 || c === 10637 || c === 10638 || c === 10639 || c === 10640 || c === 10641 || c === 10642 || c === 10643 || c === 10644 || c === 10645 || c === 10646 || c === 10647 || c === 10648 || c >= 10649 && c <= 10711 || c === 10712 || c === 10713 || c === 10714 || c === 10715 || c >= 10716 && c <= 10747 || c === 10748 || c === 10749 || c >= 10750 && c <= 11007 || c >= 11008 && c <= 11055 || c >= 11056 && c <= 11076 || c >= 11077 && c <= 11078 || c >= 11079 && c <= 11084 || c >= 11085 && c <= 11123 || c >= 11124 && c <= 11125 || c >= 11126 && c <= 11157 || c === 11158 || c >= 11159 && c <= 11263 || c >= 11776 && c <= 11777 || c === 11778 || c === 11779 || c === 11780 || c === 11781 || c >= 11782 && c <= 11784 || c === 11785 || c === 11786 || c === 11787 || c === 11788 || c === 11789 || c >= 11790 && c <= 11798 || c === 11799 || c >= 11800 && c <= 11801 || c === 11802 || c === 11803 || c === 11804 || c === 11805 || c >= 11806 && c <= 11807 || c === 11808 || c === 11809 || c === 11810 || c === 11811 || c === 11812 || c === 11813 || c === 11814 || c === 11815 || c === 11816 || c === 11817 || c >= 11818 && c <= 11822 || c === 11823 || c >= 11824 && c <= 11833 || c >= 11834 && c <= 11835 || c >= 11836 && c <= 11839 || c === 11840 || c === 11841 || c === 11842 || c >= 11843 && c <= 11855 || c >= 11856 && c <= 11857 || c === 11858 || c >= 11859 && c <= 11903 || c >= 12289 && c <= 12291 || c === 12296 || c === 12297 || c === 12298 || c === 12299 || c === 12300 || c === 12301 || c === 12302 || c === 12303 || c === 12304 || c === 12305 || c >= 12306 && c <= 12307 || c === 12308 || c === 12309 || c === 12310 || c === 12311 || c === 12312 || c === 12313 || c === 12314 || c === 12315 || c === 12316 || c === 12317 || c >= 12318 && c <= 12319 || c === 12320 || c === 12336 || c === 64830 || c === 64831 || c >= 65093 && c <= 65094;
|
|
2842
2823
|
}
|
|
2843
2824
|
|
|
2844
|
-
//
|
|
2825
|
+
// node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/lib/index.js
|
|
2845
2826
|
function pruneLocation(els) {
|
|
2846
2827
|
els.forEach(function(el) {
|
|
2847
2828
|
delete el.location;
|
|
@@ -2877,13 +2858,13 @@ function parse(message, opts) {
|
|
|
2877
2858
|
return result.val;
|
|
2878
2859
|
}
|
|
2879
2860
|
|
|
2880
|
-
//
|
|
2881
|
-
var ErrorCode
|
|
2882
|
-
(function(ErrorCode2) {
|
|
2861
|
+
// packages/intl-messageformat/src/error.ts
|
|
2862
|
+
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
2883
2863
|
ErrorCode2["MISSING_VALUE"] = "MISSING_VALUE";
|
|
2884
2864
|
ErrorCode2["INVALID_VALUE"] = "INVALID_VALUE";
|
|
2885
2865
|
ErrorCode2["MISSING_INTL_API"] = "MISSING_INTL_API";
|
|
2886
|
-
|
|
2866
|
+
return ErrorCode2;
|
|
2867
|
+
})(ErrorCode || {});
|
|
2887
2868
|
var FormatError = class extends Error {
|
|
2888
2869
|
code;
|
|
2889
2870
|
/**
|
|
@@ -2905,33 +2886,47 @@ var FormatError = class extends Error {
|
|
|
2905
2886
|
};
|
|
2906
2887
|
var InvalidValueError = class extends FormatError {
|
|
2907
2888
|
constructor(variableId, value, options, originalMessage) {
|
|
2908
|
-
super(
|
|
2889
|
+
super(
|
|
2890
|
+
`Invalid values for "${variableId}": "${value}". Options are "${Object.keys(
|
|
2891
|
+
options
|
|
2892
|
+
).join('", "')}"`,
|
|
2893
|
+
"INVALID_VALUE" /* INVALID_VALUE */,
|
|
2894
|
+
originalMessage
|
|
2895
|
+
);
|
|
2909
2896
|
}
|
|
2910
2897
|
};
|
|
2911
2898
|
var InvalidValueTypeError = class extends FormatError {
|
|
2912
2899
|
constructor(value, type, originalMessage) {
|
|
2913
|
-
super(
|
|
2900
|
+
super(
|
|
2901
|
+
`Value for "${value}" must be of type ${type}`,
|
|
2902
|
+
"INVALID_VALUE" /* INVALID_VALUE */,
|
|
2903
|
+
originalMessage
|
|
2904
|
+
);
|
|
2914
2905
|
}
|
|
2915
2906
|
};
|
|
2916
2907
|
var MissingValueError = class extends FormatError {
|
|
2917
2908
|
constructor(variableId, originalMessage) {
|
|
2918
|
-
super(
|
|
2909
|
+
super(
|
|
2910
|
+
`The intl string context variable "${variableId}" was not provided to the string "${originalMessage}"`,
|
|
2911
|
+
"MISSING_VALUE" /* MISSING_VALUE */,
|
|
2912
|
+
originalMessage
|
|
2913
|
+
);
|
|
2919
2914
|
}
|
|
2920
2915
|
};
|
|
2921
2916
|
|
|
2922
|
-
//
|
|
2923
|
-
var PART_TYPE
|
|
2924
|
-
(function(PART_TYPE2) {
|
|
2917
|
+
// packages/intl-messageformat/src/formatters.ts
|
|
2918
|
+
var PART_TYPE = /* @__PURE__ */ ((PART_TYPE2) => {
|
|
2925
2919
|
PART_TYPE2[PART_TYPE2["literal"] = 0] = "literal";
|
|
2926
2920
|
PART_TYPE2[PART_TYPE2["object"] = 1] = "object";
|
|
2927
|
-
|
|
2921
|
+
return PART_TYPE2;
|
|
2922
|
+
})(PART_TYPE || {});
|
|
2928
2923
|
function mergeLiteral(parts) {
|
|
2929
2924
|
if (parts.length < 2) {
|
|
2930
2925
|
return parts;
|
|
2931
2926
|
}
|
|
2932
2927
|
return parts.reduce((all, part) => {
|
|
2933
2928
|
const lastPart = all[all.length - 1];
|
|
2934
|
-
if (!lastPart || lastPart.type !==
|
|
2929
|
+
if (!lastPart || lastPart.type !== 0 /* literal */ || part.type !== 0 /* literal */) {
|
|
2935
2930
|
all.push(part);
|
|
2936
2931
|
} else {
|
|
2937
2932
|
lastPart.value += part.value;
|
|
@@ -2946,7 +2941,7 @@ function formatToParts(els, locales, formatters, formats, values, currentPluralV
|
|
|
2946
2941
|
if (els.length === 1 && isLiteralElement(els[0])) {
|
|
2947
2942
|
return [
|
|
2948
2943
|
{
|
|
2949
|
-
type:
|
|
2944
|
+
type: 0 /* literal */,
|
|
2950
2945
|
value: els[0].value
|
|
2951
2946
|
}
|
|
2952
2947
|
];
|
|
@@ -2955,7 +2950,7 @@ function formatToParts(els, locales, formatters, formats, values, currentPluralV
|
|
|
2955
2950
|
for (const el of els) {
|
|
2956
2951
|
if (isLiteralElement(el)) {
|
|
2957
2952
|
result.push({
|
|
2958
|
-
type:
|
|
2953
|
+
type: 0 /* literal */,
|
|
2959
2954
|
value: el.value
|
|
2960
2955
|
});
|
|
2961
2956
|
continue;
|
|
@@ -2963,7 +2958,7 @@ function formatToParts(els, locales, formatters, formats, values, currentPluralV
|
|
|
2963
2958
|
if (isPoundElement(el)) {
|
|
2964
2959
|
if (typeof currentPluralValue === "number") {
|
|
2965
2960
|
result.push({
|
|
2966
|
-
type:
|
|
2961
|
+
type: 0 /* literal */,
|
|
2967
2962
|
value: formatters.getNumberFormat(locales).format(currentPluralValue)
|
|
2968
2963
|
});
|
|
2969
2964
|
}
|
|
@@ -2979,7 +2974,7 @@ function formatToParts(els, locales, formatters, formats, values, currentPluralV
|
|
|
2979
2974
|
value = typeof value === "string" || typeof value === "number" ? String(value) : "";
|
|
2980
2975
|
}
|
|
2981
2976
|
result.push({
|
|
2982
|
-
type: typeof value === "string" ?
|
|
2977
|
+
type: typeof value === "string" ? 0 /* literal */ : 1 /* object */,
|
|
2983
2978
|
value
|
|
2984
2979
|
});
|
|
2985
2980
|
continue;
|
|
@@ -2987,7 +2982,7 @@ function formatToParts(els, locales, formatters, formats, values, currentPluralV
|
|
|
2987
2982
|
if (isDateElement(el)) {
|
|
2988
2983
|
const style = typeof el.style === "string" ? formats.date[el.style] : isDateTimeSkeleton(el.style) ? el.style.parsedOptions : void 0;
|
|
2989
2984
|
result.push({
|
|
2990
|
-
type:
|
|
2985
|
+
type: 0 /* literal */,
|
|
2991
2986
|
value: formatters.getDateTimeFormat(locales, style).format(value)
|
|
2992
2987
|
});
|
|
2993
2988
|
continue;
|
|
@@ -2995,7 +2990,7 @@ function formatToParts(els, locales, formatters, formats, values, currentPluralV
|
|
|
2995
2990
|
if (isTimeElement(el)) {
|
|
2996
2991
|
const style = typeof el.style === "string" ? formats.time[el.style] : isDateTimeSkeleton(el.style) ? el.style.parsedOptions : formats.time.medium;
|
|
2997
2992
|
result.push({
|
|
2998
|
-
type:
|
|
2993
|
+
type: 0 /* literal */,
|
|
2999
2994
|
value: formatters.getDateTimeFormat(locales, style).format(value)
|
|
3000
2995
|
});
|
|
3001
2996
|
continue;
|
|
@@ -3006,7 +3001,7 @@ function formatToParts(els, locales, formatters, formats, values, currentPluralV
|
|
|
3006
3001
|
value = value * (style.scale || 1);
|
|
3007
3002
|
}
|
|
3008
3003
|
result.push({
|
|
3009
|
-
type:
|
|
3004
|
+
type: 0 /* literal */,
|
|
3010
3005
|
value: formatters.getNumberFormat(locales, style).format(value)
|
|
3011
3006
|
});
|
|
3012
3007
|
continue;
|
|
@@ -3017,48 +3012,82 @@ function formatToParts(els, locales, formatters, formats, values, currentPluralV
|
|
|
3017
3012
|
if (!isFormatXMLElementFn(formatFn)) {
|
|
3018
3013
|
throw new InvalidValueTypeError(value2, "function", originalMessage);
|
|
3019
3014
|
}
|
|
3020
|
-
const parts = formatToParts(
|
|
3015
|
+
const parts = formatToParts(
|
|
3016
|
+
children,
|
|
3017
|
+
locales,
|
|
3018
|
+
formatters,
|
|
3019
|
+
formats,
|
|
3020
|
+
values,
|
|
3021
|
+
currentPluralValue
|
|
3022
|
+
);
|
|
3021
3023
|
let chunks = formatFn(parts.map((p) => p.value));
|
|
3022
3024
|
if (!Array.isArray(chunks)) {
|
|
3023
3025
|
chunks = [chunks];
|
|
3024
3026
|
}
|
|
3025
|
-
result.push(
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3027
|
+
result.push(
|
|
3028
|
+
...chunks.map((c) => {
|
|
3029
|
+
return {
|
|
3030
|
+
type: typeof c === "string" ? 0 /* literal */ : 1 /* object */,
|
|
3031
|
+
value: c
|
|
3032
|
+
};
|
|
3033
|
+
})
|
|
3034
|
+
);
|
|
3031
3035
|
}
|
|
3032
3036
|
if (isSelectElement(el)) {
|
|
3033
3037
|
const opt = el.options[value] || el.options.other;
|
|
3034
3038
|
if (!opt) {
|
|
3035
|
-
throw new InvalidValueError(
|
|
3039
|
+
throw new InvalidValueError(
|
|
3040
|
+
el.value,
|
|
3041
|
+
value,
|
|
3042
|
+
Object.keys(el.options),
|
|
3043
|
+
originalMessage
|
|
3044
|
+
);
|
|
3036
3045
|
}
|
|
3037
|
-
result.push(
|
|
3046
|
+
result.push(
|
|
3047
|
+
...formatToParts(opt.value, locales, formatters, formats, values)
|
|
3048
|
+
);
|
|
3038
3049
|
continue;
|
|
3039
3050
|
}
|
|
3040
3051
|
if (isPluralElement(el)) {
|
|
3041
3052
|
let opt = el.options[`=${value}`];
|
|
3042
3053
|
if (!opt) {
|
|
3043
3054
|
if (!Intl.PluralRules) {
|
|
3044
|
-
throw new FormatError(
|
|
3055
|
+
throw new FormatError(
|
|
3056
|
+
`Intl.PluralRules is not available in this environment.
|
|
3045
3057
|
Try polyfilling it using "@formatjs/intl-pluralrules"
|
|
3046
|
-
`,
|
|
3058
|
+
`,
|
|
3059
|
+
"MISSING_INTL_API" /* MISSING_INTL_API */,
|
|
3060
|
+
originalMessage
|
|
3061
|
+
);
|
|
3047
3062
|
}
|
|
3048
3063
|
const rule = formatters.getPluralRules(locales, { type: el.pluralType }).select(value - (el.offset || 0));
|
|
3049
3064
|
opt = el.options[rule] || el.options.other;
|
|
3050
3065
|
}
|
|
3051
3066
|
if (!opt) {
|
|
3052
|
-
throw new InvalidValueError(
|
|
3067
|
+
throw new InvalidValueError(
|
|
3068
|
+
el.value,
|
|
3069
|
+
value,
|
|
3070
|
+
Object.keys(el.options),
|
|
3071
|
+
originalMessage
|
|
3072
|
+
);
|
|
3053
3073
|
}
|
|
3054
|
-
result.push(
|
|
3074
|
+
result.push(
|
|
3075
|
+
...formatToParts(
|
|
3076
|
+
opt.value,
|
|
3077
|
+
locales,
|
|
3078
|
+
formatters,
|
|
3079
|
+
formats,
|
|
3080
|
+
values,
|
|
3081
|
+
value - (el.offset || 0)
|
|
3082
|
+
)
|
|
3083
|
+
);
|
|
3055
3084
|
continue;
|
|
3056
3085
|
}
|
|
3057
3086
|
}
|
|
3058
3087
|
return mergeLiteral(result);
|
|
3059
3088
|
}
|
|
3060
3089
|
|
|
3061
|
-
//
|
|
3090
|
+
// packages/intl-messageformat/src/core.ts
|
|
3062
3091
|
function mergeConfig(c1, c2) {
|
|
3063
3092
|
if (!c2) {
|
|
3064
3093
|
return c1;
|
|
@@ -3079,10 +3108,13 @@ function mergeConfigs(defaultConfig, configs) {
|
|
|
3079
3108
|
if (!configs) {
|
|
3080
3109
|
return defaultConfig;
|
|
3081
3110
|
}
|
|
3082
|
-
return Object.keys(defaultConfig).reduce(
|
|
3083
|
-
all
|
|
3084
|
-
|
|
3085
|
-
|
|
3111
|
+
return Object.keys(defaultConfig).reduce(
|
|
3112
|
+
(all, k) => {
|
|
3113
|
+
all[k] = mergeConfig(defaultConfig[k], configs[k]);
|
|
3114
|
+
return all;
|
|
3115
|
+
},
|
|
3116
|
+
{ ...defaultConfig }
|
|
3117
|
+
);
|
|
3086
3118
|
}
|
|
3087
3119
|
function createFastMemoizeCache(store) {
|
|
3088
3120
|
return {
|
|
@@ -3118,7 +3150,7 @@ function createDefaultFormatters(cache = {
|
|
|
3118
3150
|
})
|
|
3119
3151
|
};
|
|
3120
3152
|
}
|
|
3121
|
-
var
|
|
3153
|
+
var IntlMessageFormat = class _IntlMessageFormat {
|
|
3122
3154
|
ast;
|
|
3123
3155
|
locales;
|
|
3124
3156
|
resolvedLocale;
|
|
@@ -3136,7 +3168,9 @@ var _IntlMessageFormat = class {
|
|
|
3136
3168
|
if (typeof message === "string") {
|
|
3137
3169
|
this.message = message;
|
|
3138
3170
|
if (!_IntlMessageFormat.__parse) {
|
|
3139
|
-
throw new TypeError(
|
|
3171
|
+
throw new TypeError(
|
|
3172
|
+
"IntlMessageFormat.__parse must be set to process `message` of type `string`"
|
|
3173
|
+
);
|
|
3140
3174
|
}
|
|
3141
3175
|
const { formatters, ...parseOpts } = opts || {};
|
|
3142
3176
|
this.ast = _IntlMessageFormat.__parse(message, {
|
|
@@ -3157,109 +3191,119 @@ var _IntlMessageFormat = class {
|
|
|
3157
3191
|
if (parts.length === 1) {
|
|
3158
3192
|
return parts[0].value;
|
|
3159
3193
|
}
|
|
3160
|
-
const result = parts.reduce(
|
|
3161
|
-
|
|
3162
|
-
all.
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3194
|
+
const result = parts.reduce(
|
|
3195
|
+
(all, part) => {
|
|
3196
|
+
if (!all.length || part.type !== 0 /* literal */ || typeof all[all.length - 1] !== "string") {
|
|
3197
|
+
all.push(part.value);
|
|
3198
|
+
} else {
|
|
3199
|
+
all[all.length - 1] += part.value;
|
|
3200
|
+
}
|
|
3201
|
+
return all;
|
|
3202
|
+
},
|
|
3203
|
+
[]
|
|
3204
|
+
);
|
|
3168
3205
|
if (result.length <= 1) {
|
|
3169
3206
|
return result[0] || "";
|
|
3170
3207
|
}
|
|
3171
3208
|
return result;
|
|
3172
3209
|
};
|
|
3173
|
-
formatToParts = (values) => formatToParts(
|
|
3210
|
+
formatToParts = (values) => formatToParts(
|
|
3211
|
+
this.ast,
|
|
3212
|
+
this.locales,
|
|
3213
|
+
this.formatters,
|
|
3214
|
+
this.formats,
|
|
3215
|
+
values,
|
|
3216
|
+
void 0,
|
|
3217
|
+
this.message
|
|
3218
|
+
);
|
|
3174
3219
|
resolvedOptions = () => ({
|
|
3175
3220
|
locale: this.resolvedLocale?.toString() || Intl.NumberFormat.supportedLocalesOf(this.locales)[0]
|
|
3176
3221
|
});
|
|
3177
3222
|
getAst = () => this.ast;
|
|
3223
|
+
static memoizedDefaultLocale = null;
|
|
3178
3224
|
static get defaultLocale() {
|
|
3179
3225
|
if (!_IntlMessageFormat.memoizedDefaultLocale) {
|
|
3180
3226
|
_IntlMessageFormat.memoizedDefaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
|
|
3181
3227
|
}
|
|
3182
3228
|
return _IntlMessageFormat.memoizedDefaultLocale;
|
|
3183
3229
|
}
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
__publicField(IntlMessageFormat, "resolveLocale", (locales) => {
|
|
3188
|
-
if (typeof Intl.Locale === "undefined") {
|
|
3189
|
-
return;
|
|
3190
|
-
}
|
|
3191
|
-
const supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales);
|
|
3192
|
-
if (supportedLocales.length > 0) {
|
|
3193
|
-
return new Intl.Locale(supportedLocales[0]);
|
|
3194
|
-
}
|
|
3195
|
-
return new Intl.Locale(typeof locales === "string" ? locales : locales[0]);
|
|
3196
|
-
});
|
|
3197
|
-
__publicField(IntlMessageFormat, "__parse", parse);
|
|
3198
|
-
// Default format options used as the prototype of the `formats` provided to the
|
|
3199
|
-
// constructor. These are used when constructing the internal Intl.NumberFormat
|
|
3200
|
-
// and Intl.DateTimeFormat instances.
|
|
3201
|
-
__publicField(IntlMessageFormat, "formats", {
|
|
3202
|
-
number: {
|
|
3203
|
-
integer: {
|
|
3204
|
-
maximumFractionDigits: 0
|
|
3205
|
-
},
|
|
3206
|
-
currency: {
|
|
3207
|
-
style: "currency"
|
|
3208
|
-
},
|
|
3209
|
-
percent: {
|
|
3210
|
-
style: "percent"
|
|
3230
|
+
static resolveLocale = (locales) => {
|
|
3231
|
+
if (typeof Intl.Locale === "undefined") {
|
|
3232
|
+
return;
|
|
3211
3233
|
}
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
month: "numeric",
|
|
3216
|
-
day: "numeric",
|
|
3217
|
-
year: "2-digit"
|
|
3218
|
-
},
|
|
3219
|
-
medium: {
|
|
3220
|
-
month: "short",
|
|
3221
|
-
day: "numeric",
|
|
3222
|
-
year: "numeric"
|
|
3223
|
-
},
|
|
3224
|
-
long: {
|
|
3225
|
-
month: "long",
|
|
3226
|
-
day: "numeric",
|
|
3227
|
-
year: "numeric"
|
|
3228
|
-
},
|
|
3229
|
-
full: {
|
|
3230
|
-
weekday: "long",
|
|
3231
|
-
month: "long",
|
|
3232
|
-
day: "numeric",
|
|
3233
|
-
year: "numeric"
|
|
3234
|
+
const supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales);
|
|
3235
|
+
if (supportedLocales.length > 0) {
|
|
3236
|
+
return new Intl.Locale(supportedLocales[0]);
|
|
3234
3237
|
}
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3238
|
+
return new Intl.Locale(typeof locales === "string" ? locales : locales[0]);
|
|
3239
|
+
};
|
|
3240
|
+
static __parse = parse;
|
|
3241
|
+
// Default format options used as the prototype of the `formats` provided to the
|
|
3242
|
+
// constructor. These are used when constructing the internal Intl.NumberFormat
|
|
3243
|
+
// and Intl.DateTimeFormat instances.
|
|
3244
|
+
static formats = {
|
|
3245
|
+
number: {
|
|
3246
|
+
integer: {
|
|
3247
|
+
maximumFractionDigits: 0
|
|
3248
|
+
},
|
|
3249
|
+
currency: {
|
|
3250
|
+
style: "currency"
|
|
3251
|
+
},
|
|
3252
|
+
percent: {
|
|
3253
|
+
style: "percent"
|
|
3254
|
+
}
|
|
3245
3255
|
},
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3256
|
+
date: {
|
|
3257
|
+
short: {
|
|
3258
|
+
month: "numeric",
|
|
3259
|
+
day: "numeric",
|
|
3260
|
+
year: "2-digit"
|
|
3261
|
+
},
|
|
3262
|
+
medium: {
|
|
3263
|
+
month: "short",
|
|
3264
|
+
day: "numeric",
|
|
3265
|
+
year: "numeric"
|
|
3266
|
+
},
|
|
3267
|
+
long: {
|
|
3268
|
+
month: "long",
|
|
3269
|
+
day: "numeric",
|
|
3270
|
+
year: "numeric"
|
|
3271
|
+
},
|
|
3272
|
+
full: {
|
|
3273
|
+
weekday: "long",
|
|
3274
|
+
month: "long",
|
|
3275
|
+
day: "numeric",
|
|
3276
|
+
year: "numeric"
|
|
3277
|
+
}
|
|
3251
3278
|
},
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3279
|
+
time: {
|
|
3280
|
+
short: {
|
|
3281
|
+
hour: "numeric",
|
|
3282
|
+
minute: "numeric"
|
|
3283
|
+
},
|
|
3284
|
+
medium: {
|
|
3285
|
+
hour: "numeric",
|
|
3286
|
+
minute: "numeric",
|
|
3287
|
+
second: "numeric"
|
|
3288
|
+
},
|
|
3289
|
+
long: {
|
|
3290
|
+
hour: "numeric",
|
|
3291
|
+
minute: "numeric",
|
|
3292
|
+
second: "numeric",
|
|
3293
|
+
timeZoneName: "short"
|
|
3294
|
+
},
|
|
3295
|
+
full: {
|
|
3296
|
+
hour: "numeric",
|
|
3297
|
+
minute: "numeric",
|
|
3298
|
+
second: "numeric",
|
|
3299
|
+
timeZoneName: "short"
|
|
3300
|
+
}
|
|
3257
3301
|
}
|
|
3258
|
-
}
|
|
3259
|
-
}
|
|
3302
|
+
};
|
|
3303
|
+
};
|
|
3260
3304
|
|
|
3261
|
-
//
|
|
3262
|
-
var
|
|
3305
|
+
// packages/intl-messageformat/index.ts
|
|
3306
|
+
var intl_messageformat_default = IntlMessageFormat;
|
|
3263
3307
|
export {
|
|
3264
3308
|
ErrorCode,
|
|
3265
3309
|
FormatError,
|
|
@@ -3268,7 +3312,7 @@ export {
|
|
|
3268
3312
|
InvalidValueTypeError,
|
|
3269
3313
|
MissingValueError,
|
|
3270
3314
|
PART_TYPE,
|
|
3271
|
-
|
|
3315
|
+
intl_messageformat_default as default,
|
|
3272
3316
|
formatToParts,
|
|
3273
3317
|
isFormatXMLElementFn
|
|
3274
3318
|
};
|