@formatjs/intl-relativetimeformat 11.2.14 → 11.2.16
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/FormatRelativeTime.js +1 -2
- package/abstract/FormatRelativeTimeToParts.js +1 -2
- package/abstract/InitializeRelativeTimeFormat.d.ts +1 -1
- package/abstract/InitializeRelativeTimeFormat.js +3 -4
- package/abstract/MakePartsList.js +1 -2
- package/abstract/PartitionRelativeTimePattern.js +1 -2
- package/abstract/SingularRelativeTimeUnit.js +1 -2
- package/get_internal_slots.js +1 -1
- package/lib/abstract/InitializeRelativeTimeFormat.d.ts +1 -1
- package/lib/abstract/InitializeRelativeTimeFormat.js +3 -3
- package/package.json +7 -7
- package/polyfill.iife.js +340 -179
- package/should-polyfill.js +1 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FormatRelativeTime =
|
|
3
|
+
exports.FormatRelativeTime = FormatRelativeTime;
|
|
4
4
|
var PartitionRelativeTimePattern_1 = require("./PartitionRelativeTimePattern");
|
|
5
5
|
function FormatRelativeTime(rtf, value, unit, implDetails) {
|
|
6
6
|
var parts = (0, PartitionRelativeTimePattern_1.PartitionRelativeTimePattern)(rtf, value, unit, implDetails);
|
|
@@ -11,4 +11,3 @@ function FormatRelativeTime(rtf, value, unit, implDetails) {
|
|
|
11
11
|
}
|
|
12
12
|
return result;
|
|
13
13
|
}
|
|
14
|
-
exports.FormatRelativeTime = FormatRelativeTime;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FormatRelativeTimeToParts =
|
|
3
|
+
exports.FormatRelativeTimeToParts = FormatRelativeTimeToParts;
|
|
4
4
|
var PartitionRelativeTimePattern_1 = require("./PartitionRelativeTimePattern");
|
|
5
5
|
function FormatRelativeTimeToParts(rtf, value, unit, implDetails) {
|
|
6
6
|
return (0, PartitionRelativeTimePattern_1.PartitionRelativeTimePattern)(rtf, value, unit, implDetails);
|
|
7
7
|
}
|
|
8
|
-
exports.FormatRelativeTimeToParts = FormatRelativeTimeToParts;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LocaleFieldsData, RelativeTimeFormatInternal } from '@formatjs/ecma402-abstract';
|
|
2
2
|
export declare function InitializeRelativeTimeFormat(rtf: Intl.RelativeTimeFormat, locales: string | string[] | undefined, options: Intl.RelativeTimeFormatOptions | undefined, { getInternalSlots, availableLocales, relevantExtensionKeys, localeData, getDefaultLocale, }: {
|
|
3
3
|
getInternalSlots(rtf: Intl.RelativeTimeFormat): RelativeTimeFormatInternal;
|
|
4
4
|
availableLocales: Set<string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InitializeRelativeTimeFormat =
|
|
3
|
+
exports.InitializeRelativeTimeFormat = InitializeRelativeTimeFormat;
|
|
4
4
|
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
5
5
|
var intl_localematcher_1 = require("@formatjs/intl-localematcher");
|
|
6
6
|
var NUMBERING_SYSTEM_REGEX = /^[a-z0-9]{3,8}(-[a-z0-9]{3,8})*$/i;
|
|
@@ -30,9 +30,8 @@ function InitializeRelativeTimeFormat(rtf, locales, options, _a) {
|
|
|
30
30
|
var fields = localeData[r.dataLocale];
|
|
31
31
|
(0, ecma402_abstract_1.invariant)(!!fields, "Missing locale data for ".concat(r.dataLocale));
|
|
32
32
|
internalSlots.fields = fields;
|
|
33
|
-
internalSlots.numberFormat =
|
|
34
|
-
internalSlots.pluralRules =
|
|
33
|
+
internalSlots.numberFormat = (0, ecma402_abstract_1.createMemoizedNumberFormat)(locales);
|
|
34
|
+
internalSlots.pluralRules = (0, ecma402_abstract_1.createMemoizedPluralRules)(locales);
|
|
35
35
|
internalSlots.numberingSystem = nu;
|
|
36
36
|
return rtf;
|
|
37
37
|
}
|
|
38
|
-
exports.InitializeRelativeTimeFormat = InitializeRelativeTimeFormat;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MakePartsList =
|
|
3
|
+
exports.MakePartsList = MakePartsList;
|
|
4
4
|
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
5
5
|
function MakePartsList(pattern, unit, parts) {
|
|
6
6
|
var patternParts = (0, ecma402_abstract_1.PartitionPattern)(pattern);
|
|
@@ -27,4 +27,3 @@ function MakePartsList(pattern, unit, parts) {
|
|
|
27
27
|
}
|
|
28
28
|
return result;
|
|
29
29
|
}
|
|
30
|
-
exports.MakePartsList = MakePartsList;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PartitionRelativeTimePattern =
|
|
3
|
+
exports.PartitionRelativeTimePattern = PartitionRelativeTimePattern;
|
|
4
4
|
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
5
5
|
var SingularRelativeTimeUnit_1 = require("./SingularRelativeTimeUnit");
|
|
6
6
|
var MakePartsList_1 = require("./MakePartsList");
|
|
@@ -54,4 +54,3 @@ function PartitionRelativeTimePattern(rtf, value, unit, _a) {
|
|
|
54
54
|
var pattern = po[pr];
|
|
55
55
|
return (0, MakePartsList_1.MakePartsList)(pattern, resolvedUnit, fv);
|
|
56
56
|
}
|
|
57
|
-
exports.PartitionRelativeTimePattern = PartitionRelativeTimePattern;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SingularRelativeTimeUnit =
|
|
3
|
+
exports.SingularRelativeTimeUnit = SingularRelativeTimeUnit;
|
|
4
4
|
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
5
5
|
/**
|
|
6
6
|
* https://tc39.es/proposal-intl-relative-time/#sec-singularrelativetimeunit
|
|
@@ -36,4 +36,3 @@ function SingularRelativeTimeUnit(unit) {
|
|
|
36
36
|
}
|
|
37
37
|
return unit;
|
|
38
38
|
}
|
|
39
|
-
exports.SingularRelativeTimeUnit = SingularRelativeTimeUnit;
|
package/get_internal_slots.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Type-only circular import
|
|
3
3
|
// eslint-disable-next-line import/no-cycle
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.default = getInternalSlots;
|
|
5
6
|
var internalSlotMap = new WeakMap();
|
|
6
7
|
function getInternalSlots(x) {
|
|
7
8
|
var internalSlots = internalSlotMap.get(x);
|
|
@@ -11,4 +12,3 @@ function getInternalSlots(x) {
|
|
|
11
12
|
}
|
|
12
13
|
return internalSlots;
|
|
13
14
|
}
|
|
14
|
-
exports.default = getInternalSlots;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LocaleFieldsData, RelativeTimeFormatInternal } from '@formatjs/ecma402-abstract';
|
|
2
2
|
export declare function InitializeRelativeTimeFormat(rtf: Intl.RelativeTimeFormat, locales: string | string[] | undefined, options: Intl.RelativeTimeFormatOptions | undefined, { getInternalSlots, availableLocales, relevantExtensionKeys, localeData, getDefaultLocale, }: {
|
|
3
3
|
getInternalSlots(rtf: Intl.RelativeTimeFormat): RelativeTimeFormatInternal;
|
|
4
4
|
availableLocales: Set<string>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CanonicalizeLocaleList, CoerceOptionsToObject, GetOption, invariant, } from '@formatjs/ecma402-abstract';
|
|
1
|
+
import { CanonicalizeLocaleList, CoerceOptionsToObject, createMemoizedNumberFormat, createMemoizedPluralRules, GetOption, invariant, } from '@formatjs/ecma402-abstract';
|
|
2
2
|
import { ResolveLocale } from '@formatjs/intl-localematcher';
|
|
3
3
|
var NUMBERING_SYSTEM_REGEX = /^[a-z0-9]{3,8}(-[a-z0-9]{3,8})*$/i;
|
|
4
4
|
export function InitializeRelativeTimeFormat(rtf, locales, options, _a) {
|
|
@@ -27,8 +27,8 @@ export function InitializeRelativeTimeFormat(rtf, locales, options, _a) {
|
|
|
27
27
|
var fields = localeData[r.dataLocale];
|
|
28
28
|
invariant(!!fields, "Missing locale data for ".concat(r.dataLocale));
|
|
29
29
|
internalSlots.fields = fields;
|
|
30
|
-
internalSlots.numberFormat =
|
|
31
|
-
internalSlots.pluralRules =
|
|
30
|
+
internalSlots.numberFormat = createMemoizedNumberFormat(locales);
|
|
31
|
+
internalSlots.pluralRules = createMemoizedPluralRules(locales);
|
|
32
32
|
internalSlots.numberingSystem = nu;
|
|
33
33
|
return rtf;
|
|
34
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-relativetimeformat",
|
|
3
|
-
"version": "11.2.
|
|
3
|
+
"version": "11.2.16",
|
|
4
4
|
"description": "Formats JavaScript dates to relative time strings.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intl",
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
"url": "git@github.com:formatjs/formatjs.git"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"tslib": "^2.
|
|
24
|
-
"@formatjs/ecma402-abstract": "2.
|
|
25
|
-
"@formatjs/intl-localematcher": "0.5.
|
|
23
|
+
"tslib": "^2.7.0",
|
|
24
|
+
"@formatjs/ecma402-abstract": "2.2.0",
|
|
25
|
+
"@formatjs/intl-localematcher": "0.5.5"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@formatjs/intl-
|
|
29
|
-
"@formatjs/intl-
|
|
30
|
-
"@formatjs/intl-pluralrules": "5.2.
|
|
28
|
+
"@formatjs/intl-locale": "4.0.2",
|
|
29
|
+
"@formatjs/intl-getcanonicallocales": "2.3.1",
|
|
30
|
+
"@formatjs/intl-pluralrules": "5.2.16"
|
|
31
31
|
},
|
|
32
32
|
"main": "index.js",
|
|
33
33
|
"types": "index.d.ts",
|
package/polyfill.iife.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
(() => {
|
|
2
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __publicField = (obj, key, value) => {
|
|
5
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
+
return value;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/CanonicalizeLocaleList.js
|
|
3
10
|
function CanonicalizeLocaleList(locales) {
|
|
4
11
|
return Intl.getCanonicalLocales(locales);
|
|
5
12
|
}
|
|
6
13
|
|
|
7
|
-
//
|
|
14
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/262.js
|
|
8
15
|
function ToString(o) {
|
|
9
16
|
if (typeof o === "symbol") {
|
|
10
17
|
throw TypeError("Cannot convert a Symbol value to a string");
|
|
@@ -58,7 +65,7 @@
|
|
|
58
65
|
var MS_PER_MINUTE = MS_PER_SECOND * SECONDS_PER_MINUTE;
|
|
59
66
|
var MS_PER_HOUR = MS_PER_MINUTE * MINUTES_PER_HOUR;
|
|
60
67
|
|
|
61
|
-
//
|
|
68
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/CoerceOptionsToObject.js
|
|
62
69
|
function CoerceOptionsToObject(options) {
|
|
63
70
|
if (typeof options === "undefined") {
|
|
64
71
|
return /* @__PURE__ */ Object.create(null);
|
|
@@ -66,7 +73,7 @@
|
|
|
66
73
|
return ToObject(options);
|
|
67
74
|
}
|
|
68
75
|
|
|
69
|
-
//
|
|
76
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/GetOption.js
|
|
70
77
|
function GetOption(opts, prop, type, values, fallback) {
|
|
71
78
|
if (typeof opts !== "object") {
|
|
72
79
|
throw new TypeError("Options must be an object");
|
|
@@ -92,7 +99,7 @@
|
|
|
92
99
|
return fallback;
|
|
93
100
|
}
|
|
94
101
|
|
|
95
|
-
//
|
|
102
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/IsSanctionedSimpleUnitIdentifier.js
|
|
96
103
|
var SANCTIONED_UNITS = [
|
|
97
104
|
"angle-degree",
|
|
98
105
|
"area-acre",
|
|
@@ -143,29 +150,7 @@
|
|
|
143
150
|
}
|
|
144
151
|
var SIMPLE_UNITS = SANCTIONED_UNITS.map(removeUnitNamespace);
|
|
145
152
|
|
|
146
|
-
//
|
|
147
|
-
function invariant(condition, message, Err) {
|
|
148
|
-
if (Err === void 0) {
|
|
149
|
-
Err = Error;
|
|
150
|
-
}
|
|
151
|
-
if (!condition) {
|
|
152
|
-
throw new Err(message);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/regex.generated.js
|
|
157
|
-
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-\u20BF\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-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\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-\uFBC1\uFDFC\uFDFD\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]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\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-\uDED7\uDEE0-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDD78\uDD7A-\uDDCB\uDDCD-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6\uDF00-\uDF92\uDF94-\uDFCA]/;
|
|
158
|
-
|
|
159
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/NumberFormat/format_to_parts.js
|
|
160
|
-
var CARET_S_UNICODE_REGEX = new RegExp("^".concat(S_UNICODE_REGEX.source));
|
|
161
|
-
var S_DOLLAR_UNICODE_REGEX = new RegExp("".concat(S_UNICODE_REGEX.source, "$"));
|
|
162
|
-
|
|
163
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/lib/abstract/CanonicalizeLocaleList.js
|
|
164
|
-
function CanonicalizeLocaleList2(locales) {
|
|
165
|
-
return Intl.getCanonicalLocales(locales);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// ../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/tslib@2.4.0/node_modules/tslib/tslib.es6.js
|
|
153
|
+
// node_modules/.aspect_rules_js/tslib@2.7.0/node_modules/tslib/tslib.es6.mjs
|
|
169
154
|
var extendStatics = function(d, b) {
|
|
170
155
|
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
171
156
|
d2.__proto__ = b2;
|
|
@@ -197,7 +182,146 @@
|
|
|
197
182
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
198
183
|
}
|
|
199
184
|
|
|
200
|
-
//
|
|
185
|
+
// node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/lib/index.js
|
|
186
|
+
function memoize(fn, options) {
|
|
187
|
+
var cache = options && options.cache ? options.cache : cacheDefault;
|
|
188
|
+
var serializer = options && options.serializer ? options.serializer : serializerDefault;
|
|
189
|
+
var strategy = options && options.strategy ? options.strategy : strategyDefault;
|
|
190
|
+
return strategy(fn, {
|
|
191
|
+
cache,
|
|
192
|
+
serializer
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
function isPrimitive(value) {
|
|
196
|
+
return value == null || typeof value === "number" || typeof value === "boolean";
|
|
197
|
+
}
|
|
198
|
+
function monadic(fn, cache, serializer, arg) {
|
|
199
|
+
var cacheKey = isPrimitive(arg) ? arg : serializer(arg);
|
|
200
|
+
var computedValue = cache.get(cacheKey);
|
|
201
|
+
if (typeof computedValue === "undefined") {
|
|
202
|
+
computedValue = fn.call(this, arg);
|
|
203
|
+
cache.set(cacheKey, computedValue);
|
|
204
|
+
}
|
|
205
|
+
return computedValue;
|
|
206
|
+
}
|
|
207
|
+
function variadic(fn, cache, serializer) {
|
|
208
|
+
var args = Array.prototype.slice.call(arguments, 3);
|
|
209
|
+
var cacheKey = serializer(args);
|
|
210
|
+
var computedValue = cache.get(cacheKey);
|
|
211
|
+
if (typeof computedValue === "undefined") {
|
|
212
|
+
computedValue = fn.apply(this, args);
|
|
213
|
+
cache.set(cacheKey, computedValue);
|
|
214
|
+
}
|
|
215
|
+
return computedValue;
|
|
216
|
+
}
|
|
217
|
+
function assemble(fn, context, strategy, cache, serialize) {
|
|
218
|
+
return strategy.bind(context, fn, cache, serialize);
|
|
219
|
+
}
|
|
220
|
+
function strategyDefault(fn, options) {
|
|
221
|
+
var strategy = fn.length === 1 ? monadic : variadic;
|
|
222
|
+
return assemble(fn, this, strategy, options.cache.create(), options.serializer);
|
|
223
|
+
}
|
|
224
|
+
function strategyVariadic(fn, options) {
|
|
225
|
+
return assemble(fn, this, variadic, options.cache.create(), options.serializer);
|
|
226
|
+
}
|
|
227
|
+
function strategyMonadic(fn, options) {
|
|
228
|
+
return assemble(fn, this, monadic, options.cache.create(), options.serializer);
|
|
229
|
+
}
|
|
230
|
+
var serializerDefault = function() {
|
|
231
|
+
return JSON.stringify(arguments);
|
|
232
|
+
};
|
|
233
|
+
function ObjectWithoutPrototypeCache() {
|
|
234
|
+
this.cache = /* @__PURE__ */ Object.create(null);
|
|
235
|
+
}
|
|
236
|
+
ObjectWithoutPrototypeCache.prototype.get = function(key) {
|
|
237
|
+
return this.cache[key];
|
|
238
|
+
};
|
|
239
|
+
ObjectWithoutPrototypeCache.prototype.set = function(key, value) {
|
|
240
|
+
this.cache[key] = value;
|
|
241
|
+
};
|
|
242
|
+
var cacheDefault = {
|
|
243
|
+
create: function create() {
|
|
244
|
+
return new ObjectWithoutPrototypeCache();
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
var strategies = {
|
|
248
|
+
variadic: strategyVariadic,
|
|
249
|
+
monadic: strategyMonadic
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/utils.js
|
|
253
|
+
function invariant(condition, message, Err) {
|
|
254
|
+
if (Err === void 0) {
|
|
255
|
+
Err = Error;
|
|
256
|
+
}
|
|
257
|
+
if (!condition) {
|
|
258
|
+
throw new Err(message);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
var createMemoizedNumberFormat = memoize(function() {
|
|
262
|
+
var _a;
|
|
263
|
+
var args = [];
|
|
264
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
265
|
+
args[_i] = arguments[_i];
|
|
266
|
+
}
|
|
267
|
+
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
268
|
+
}, {
|
|
269
|
+
strategy: strategies.variadic
|
|
270
|
+
});
|
|
271
|
+
var createMemoizedDateTimeFormat = memoize(function() {
|
|
272
|
+
var _a;
|
|
273
|
+
var args = [];
|
|
274
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
275
|
+
args[_i] = arguments[_i];
|
|
276
|
+
}
|
|
277
|
+
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
278
|
+
}, {
|
|
279
|
+
strategy: strategies.variadic
|
|
280
|
+
});
|
|
281
|
+
var createMemoizedPluralRules = memoize(function() {
|
|
282
|
+
var _a;
|
|
283
|
+
var args = [];
|
|
284
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
285
|
+
args[_i] = arguments[_i];
|
|
286
|
+
}
|
|
287
|
+
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
288
|
+
}, {
|
|
289
|
+
strategy: strategies.variadic
|
|
290
|
+
});
|
|
291
|
+
var createMemoizedLocale = memoize(function() {
|
|
292
|
+
var _a;
|
|
293
|
+
var args = [];
|
|
294
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
295
|
+
args[_i] = arguments[_i];
|
|
296
|
+
}
|
|
297
|
+
return new ((_a = Intl.Locale).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
298
|
+
}, {
|
|
299
|
+
strategy: strategies.variadic
|
|
300
|
+
});
|
|
301
|
+
var createMemoizedListFormat = memoize(function() {
|
|
302
|
+
var _a;
|
|
303
|
+
var args = [];
|
|
304
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
305
|
+
args[_i] = arguments[_i];
|
|
306
|
+
}
|
|
307
|
+
return new ((_a = Intl.ListFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
308
|
+
}, {
|
|
309
|
+
strategy: strategies.variadic
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/regex.generated.js
|
|
313
|
+
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-\u20BF\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-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\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-\uFBC1\uFDFC\uFDFD\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]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\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-\uDED7\uDEE0-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDD78\uDD7A-\uDDCB\uDDCD-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6\uDF00-\uDF92\uDF94-\uDFCA]/;
|
|
314
|
+
|
|
315
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/NumberFormat/format_to_parts.js
|
|
316
|
+
var CARET_S_UNICODE_REGEX = new RegExp("^".concat(S_UNICODE_REGEX.source));
|
|
317
|
+
var S_DOLLAR_UNICODE_REGEX = new RegExp("".concat(S_UNICODE_REGEX.source, "$"));
|
|
318
|
+
|
|
319
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/lib/abstract/CanonicalizeLocaleList.js
|
|
320
|
+
function CanonicalizeLocaleList2(locales) {
|
|
321
|
+
return Intl.getCanonicalLocales(locales);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/lib/abstract/languageMatching.js
|
|
201
325
|
var data = {
|
|
202
326
|
supplemental: {
|
|
203
327
|
languageMatching: {
|
|
@@ -2819,7 +2943,7 @@
|
|
|
2819
2943
|
}
|
|
2820
2944
|
};
|
|
2821
2945
|
|
|
2822
|
-
//
|
|
2946
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/lib/abstract/regions.generated.js
|
|
2823
2947
|
var regions = {
|
|
2824
2948
|
"001": [
|
|
2825
2949
|
"001",
|
|
@@ -4154,7 +4278,7 @@
|
|
|
4154
4278
|
]
|
|
4155
4279
|
};
|
|
4156
4280
|
|
|
4157
|
-
//
|
|
4281
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/lib/abstract/utils.js
|
|
4158
4282
|
var UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
|
|
4159
4283
|
function invariant2(condition, message, Err) {
|
|
4160
4284
|
if (Err === void 0) {
|
|
@@ -4308,7 +4432,7 @@
|
|
|
4308
4432
|
return result;
|
|
4309
4433
|
}
|
|
4310
4434
|
|
|
4311
|
-
//
|
|
4435
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/lib/abstract/BestFitMatcher.js
|
|
4312
4436
|
function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
4313
4437
|
var foundLocale;
|
|
4314
4438
|
var extension;
|
|
@@ -4333,7 +4457,7 @@
|
|
|
4333
4457
|
};
|
|
4334
4458
|
}
|
|
4335
4459
|
|
|
4336
|
-
//
|
|
4460
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/lib/abstract/BestAvailableLocale.js
|
|
4337
4461
|
function BestAvailableLocale(availableLocales, locale) {
|
|
4338
4462
|
var candidate = locale;
|
|
4339
4463
|
while (true) {
|
|
@@ -4351,7 +4475,7 @@
|
|
|
4351
4475
|
}
|
|
4352
4476
|
}
|
|
4353
4477
|
|
|
4354
|
-
//
|
|
4478
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/lib/abstract/LookupMatcher.js
|
|
4355
4479
|
function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
4356
4480
|
var result = { locale: "" };
|
|
4357
4481
|
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
@@ -4370,7 +4494,7 @@
|
|
|
4370
4494
|
return result;
|
|
4371
4495
|
}
|
|
4372
4496
|
|
|
4373
|
-
//
|
|
4497
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/lib/abstract/UnicodeExtensionValue.js
|
|
4374
4498
|
function UnicodeExtensionValue(extension, key) {
|
|
4375
4499
|
invariant2(key.length === 2, "key must have 2 elements");
|
|
4376
4500
|
var size = extension.length;
|
|
@@ -4409,7 +4533,7 @@
|
|
|
4409
4533
|
return void 0;
|
|
4410
4534
|
}
|
|
4411
4535
|
|
|
4412
|
-
//
|
|
4536
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/lib/abstract/ResolveLocale.js
|
|
4413
4537
|
function ResolveLocale(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData, getDefaultLocale) {
|
|
4414
4538
|
var matcher = options.localeMatcher;
|
|
4415
4539
|
var r;
|
|
@@ -4473,7 +4597,7 @@
|
|
|
4473
4597
|
return result;
|
|
4474
4598
|
}
|
|
4475
4599
|
|
|
4476
|
-
//
|
|
4600
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/lib/abstract/LookupSupportedLocales.js
|
|
4477
4601
|
function LookupSupportedLocales(availableLocales, requestedLocales) {
|
|
4478
4602
|
var subset = [];
|
|
4479
4603
|
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
@@ -4487,7 +4611,7 @@
|
|
|
4487
4611
|
return subset;
|
|
4488
4612
|
}
|
|
4489
4613
|
|
|
4490
|
-
//
|
|
4614
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/lib/index.js
|
|
4491
4615
|
function match(requestedLocales, availableLocales, defaultLocale, opts) {
|
|
4492
4616
|
return ResolveLocale(availableLocales, CanonicalizeLocaleList2(requestedLocales), {
|
|
4493
4617
|
localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || "best fit"
|
|
@@ -4496,7 +4620,7 @@
|
|
|
4496
4620
|
}).locale;
|
|
4497
4621
|
}
|
|
4498
4622
|
|
|
4499
|
-
//
|
|
4623
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/PartitionPattern.js
|
|
4500
4624
|
function PartitionPattern(pattern) {
|
|
4501
4625
|
var result = [];
|
|
4502
4626
|
var beginIndex = pattern.indexOf("{");
|
|
@@ -4528,7 +4652,7 @@
|
|
|
4528
4652
|
return result;
|
|
4529
4653
|
}
|
|
4530
4654
|
|
|
4531
|
-
//
|
|
4655
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/SupportedLocales.js
|
|
4532
4656
|
function SupportedLocales(availableLocales, requestedLocales, options) {
|
|
4533
4657
|
var matcher = "best fit";
|
|
4534
4658
|
if (options !== void 0) {
|
|
@@ -4541,7 +4665,7 @@
|
|
|
4541
4665
|
return LookupSupportedLocales(Array.from(availableLocales), requestedLocales);
|
|
4542
4666
|
}
|
|
4543
4667
|
|
|
4544
|
-
//
|
|
4668
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/data.js
|
|
4545
4669
|
var MissingLocaleDataError = (
|
|
4546
4670
|
/** @class */
|
|
4547
4671
|
function(_super) {
|
|
@@ -4555,7 +4679,7 @@
|
|
|
4555
4679
|
}(Error)
|
|
4556
4680
|
);
|
|
4557
4681
|
|
|
4558
|
-
//
|
|
4682
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/types/date-time.js
|
|
4559
4683
|
var RangePatternType;
|
|
4560
4684
|
(function(RangePatternType2) {
|
|
4561
4685
|
RangePatternType2["startRange"] = "startRange";
|
|
@@ -4563,18 +4687,29 @@
|
|
|
4563
4687
|
RangePatternType2["endRange"] = "endRange";
|
|
4564
4688
|
})(RangePatternType || (RangePatternType = {}));
|
|
4565
4689
|
|
|
4566
|
-
//
|
|
4690
|
+
// packages/intl-relativetimeformat/abstract/InitializeRelativeTimeFormat.ts
|
|
4567
4691
|
var NUMBERING_SYSTEM_REGEX = /^[a-z0-9]{3,8}(-[a-z0-9]{3,8})*$/i;
|
|
4568
|
-
function InitializeRelativeTimeFormat(rtf, locales, options,
|
|
4569
|
-
|
|
4570
|
-
|
|
4692
|
+
function InitializeRelativeTimeFormat(rtf, locales, options, {
|
|
4693
|
+
getInternalSlots: getInternalSlots2,
|
|
4694
|
+
availableLocales,
|
|
4695
|
+
relevantExtensionKeys,
|
|
4696
|
+
localeData,
|
|
4697
|
+
getDefaultLocale
|
|
4698
|
+
}) {
|
|
4699
|
+
const internalSlots = getInternalSlots2(rtf);
|
|
4571
4700
|
internalSlots.initializedRelativeTimeFormat = true;
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4701
|
+
const requestedLocales = CanonicalizeLocaleList(locales);
|
|
4702
|
+
const opt = /* @__PURE__ */ Object.create(null);
|
|
4703
|
+
const opts = CoerceOptionsToObject(options);
|
|
4704
|
+
const matcher = GetOption(
|
|
4705
|
+
opts,
|
|
4706
|
+
"localeMatcher",
|
|
4707
|
+
"string",
|
|
4708
|
+
["best fit", "lookup"],
|
|
4709
|
+
"best fit"
|
|
4710
|
+
);
|
|
4576
4711
|
opt.localeMatcher = matcher;
|
|
4577
|
-
|
|
4712
|
+
const numberingSystem = GetOption(
|
|
4578
4713
|
opts,
|
|
4579
4714
|
// @ts-expect-error TS option is wack
|
|
4580
4715
|
"numberingSystem",
|
|
@@ -4584,25 +4719,44 @@
|
|
|
4584
4719
|
);
|
|
4585
4720
|
if (numberingSystem !== void 0) {
|
|
4586
4721
|
if (!NUMBERING_SYSTEM_REGEX.test(numberingSystem)) {
|
|
4587
|
-
throw new RangeError(
|
|
4722
|
+
throw new RangeError(`Invalid numbering system ${numberingSystem}`);
|
|
4588
4723
|
}
|
|
4589
4724
|
}
|
|
4590
4725
|
opt.nu = numberingSystem;
|
|
4591
|
-
|
|
4592
|
-
|
|
4726
|
+
const r = ResolveLocale(
|
|
4727
|
+
availableLocales,
|
|
4728
|
+
requestedLocales,
|
|
4729
|
+
opt,
|
|
4730
|
+
relevantExtensionKeys,
|
|
4731
|
+
localeData,
|
|
4732
|
+
getDefaultLocale
|
|
4733
|
+
);
|
|
4734
|
+
const { locale, nu } = r;
|
|
4593
4735
|
internalSlots.locale = locale;
|
|
4594
|
-
internalSlots.style = GetOption(
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4736
|
+
internalSlots.style = GetOption(
|
|
4737
|
+
opts,
|
|
4738
|
+
"style",
|
|
4739
|
+
"string",
|
|
4740
|
+
["long", "narrow", "short"],
|
|
4741
|
+
"long"
|
|
4742
|
+
);
|
|
4743
|
+
internalSlots.numeric = GetOption(
|
|
4744
|
+
opts,
|
|
4745
|
+
"numeric",
|
|
4746
|
+
"string",
|
|
4747
|
+
["always", "auto"],
|
|
4748
|
+
"always"
|
|
4749
|
+
);
|
|
4750
|
+
const fields = localeData[r.dataLocale];
|
|
4751
|
+
invariant(!!fields, `Missing locale data for ${r.dataLocale}`);
|
|
4598
4752
|
internalSlots.fields = fields;
|
|
4599
|
-
internalSlots.numberFormat =
|
|
4600
|
-
internalSlots.pluralRules =
|
|
4753
|
+
internalSlots.numberFormat = createMemoizedNumberFormat(locales);
|
|
4754
|
+
internalSlots.pluralRules = createMemoizedPluralRules(locales);
|
|
4601
4755
|
internalSlots.numberingSystem = nu;
|
|
4602
4756
|
return rtf;
|
|
4603
4757
|
}
|
|
4604
4758
|
|
|
4605
|
-
//
|
|
4759
|
+
// packages/intl-relativetimeformat/abstract/SingularRelativeTimeUnit.ts
|
|
4606
4760
|
function SingularRelativeTimeUnit(unit) {
|
|
4607
4761
|
invariant(Type(unit) === "String", "unit must be a string");
|
|
4608
4762
|
if (unit === "seconds")
|
|
@@ -4627,21 +4781,19 @@
|
|
|
4627
4781
|
return unit;
|
|
4628
4782
|
}
|
|
4629
4783
|
|
|
4630
|
-
//
|
|
4784
|
+
// packages/intl-relativetimeformat/abstract/MakePartsList.ts
|
|
4631
4785
|
function MakePartsList(pattern, unit, parts) {
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
for (
|
|
4635
|
-
var patternPart = patternParts_1[_i];
|
|
4786
|
+
const patternParts = PartitionPattern(pattern);
|
|
4787
|
+
const result = [];
|
|
4788
|
+
for (const patternPart of patternParts) {
|
|
4636
4789
|
if (patternPart.type === "literal") {
|
|
4637
4790
|
result.push({
|
|
4638
4791
|
type: "literal",
|
|
4639
4792
|
value: patternPart.value
|
|
4640
4793
|
});
|
|
4641
4794
|
} else {
|
|
4642
|
-
invariant(patternPart.type === "0",
|
|
4643
|
-
for (
|
|
4644
|
-
var part = parts_1[_a];
|
|
4795
|
+
invariant(patternPart.type === "0", `Malformed pattern ${pattern}`);
|
|
4796
|
+
for (const part of parts) {
|
|
4645
4797
|
result.push({
|
|
4646
4798
|
type: part.type,
|
|
4647
4799
|
value: part.value,
|
|
@@ -4653,26 +4805,35 @@
|
|
|
4653
4805
|
return result;
|
|
4654
4806
|
}
|
|
4655
4807
|
|
|
4656
|
-
//
|
|
4657
|
-
function PartitionRelativeTimePattern(rtf, value, unit,
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
invariant(
|
|
4808
|
+
// packages/intl-relativetimeformat/abstract/PartitionRelativeTimePattern.ts
|
|
4809
|
+
function PartitionRelativeTimePattern(rtf, value, unit, {
|
|
4810
|
+
getInternalSlots: getInternalSlots2
|
|
4811
|
+
}) {
|
|
4812
|
+
invariant(
|
|
4813
|
+
Type(value) === "Number",
|
|
4814
|
+
`value must be number, instead got ${typeof value}`,
|
|
4815
|
+
TypeError
|
|
4816
|
+
);
|
|
4817
|
+
invariant(
|
|
4818
|
+
Type(unit) === "String",
|
|
4819
|
+
`unit must be number, instead got ${typeof value}`,
|
|
4820
|
+
TypeError
|
|
4821
|
+
);
|
|
4661
4822
|
if (isNaN(value) || !isFinite(value)) {
|
|
4662
|
-
throw new RangeError(
|
|
4823
|
+
throw new RangeError(`Invalid value ${value}`);
|
|
4663
4824
|
}
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4825
|
+
const resolvedUnit = SingularRelativeTimeUnit(unit);
|
|
4826
|
+
const { fields, style, numeric, pluralRules, numberFormat } = getInternalSlots2(rtf);
|
|
4827
|
+
let entry = resolvedUnit;
|
|
4667
4828
|
if (style === "short") {
|
|
4668
|
-
entry =
|
|
4829
|
+
entry = `${resolvedUnit}-short`;
|
|
4669
4830
|
} else if (style === "narrow") {
|
|
4670
|
-
entry =
|
|
4831
|
+
entry = `${resolvedUnit}-narrow`;
|
|
4671
4832
|
}
|
|
4672
4833
|
if (!(entry in fields)) {
|
|
4673
4834
|
entry = resolvedUnit;
|
|
4674
4835
|
}
|
|
4675
|
-
|
|
4836
|
+
const patterns = fields[entry];
|
|
4676
4837
|
if (numeric === "auto") {
|
|
4677
4838
|
if (ToString(value) in patterns) {
|
|
4678
4839
|
return [
|
|
@@ -4683,12 +4844,12 @@
|
|
|
4683
4844
|
];
|
|
4684
4845
|
}
|
|
4685
4846
|
}
|
|
4686
|
-
|
|
4847
|
+
let tl = "future";
|
|
4687
4848
|
if (SameValue(value, -0) || value < 0) {
|
|
4688
4849
|
tl = "past";
|
|
4689
4850
|
}
|
|
4690
|
-
|
|
4691
|
-
|
|
4851
|
+
const po = patterns[tl];
|
|
4852
|
+
const fv = typeof numberFormat.formatToParts === "function" ? numberFormat.formatToParts(Math.abs(value)) : (
|
|
4692
4853
|
// TODO: If formatToParts is not supported, we assume the whole formatted
|
|
4693
4854
|
// number is a part
|
|
4694
4855
|
[
|
|
@@ -4699,15 +4860,15 @@
|
|
|
4699
4860
|
}
|
|
4700
4861
|
]
|
|
4701
4862
|
);
|
|
4702
|
-
|
|
4703
|
-
|
|
4863
|
+
const pr = pluralRules.select(value);
|
|
4864
|
+
const pattern = po[pr];
|
|
4704
4865
|
return MakePartsList(pattern, resolvedUnit, fv);
|
|
4705
4866
|
}
|
|
4706
4867
|
|
|
4707
|
-
//
|
|
4868
|
+
// packages/intl-relativetimeformat/get_internal_slots.ts
|
|
4708
4869
|
var internalSlotMap = /* @__PURE__ */ new WeakMap();
|
|
4709
4870
|
function getInternalSlots(x) {
|
|
4710
|
-
|
|
4871
|
+
let internalSlots = internalSlotMap.get(x);
|
|
4711
4872
|
if (!internalSlots) {
|
|
4712
4873
|
internalSlots = /* @__PURE__ */ Object.create(null);
|
|
4713
4874
|
internalSlotMap.set(x, internalSlots);
|
|
@@ -4715,93 +4876,96 @@
|
|
|
4715
4876
|
return internalSlots;
|
|
4716
4877
|
}
|
|
4717
4878
|
|
|
4718
|
-
//
|
|
4719
|
-
var
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
if (!newTarget) {
|
|
4725
|
-
throw new TypeError("Intl.RelativeTimeFormat must be called with 'new'");
|
|
4726
|
-
}
|
|
4727
|
-
return InitializeRelativeTimeFormat(this, locales, options, {
|
|
4728
|
-
getInternalSlots,
|
|
4729
|
-
availableLocales: RelativeTimeFormat2.availableLocales,
|
|
4730
|
-
relevantExtensionKeys: RelativeTimeFormat2.relevantExtensionKeys,
|
|
4731
|
-
localeData: RelativeTimeFormat2.localeData,
|
|
4732
|
-
getDefaultLocale: RelativeTimeFormat2.getDefaultLocale
|
|
4733
|
-
});
|
|
4879
|
+
// packages/intl-relativetimeformat/index.ts
|
|
4880
|
+
var _RelativeTimeFormat = class _RelativeTimeFormat {
|
|
4881
|
+
constructor(locales, options) {
|
|
4882
|
+
const newTarget = this && this instanceof _RelativeTimeFormat ? this.constructor : void 0;
|
|
4883
|
+
if (!newTarget) {
|
|
4884
|
+
throw new TypeError("Intl.RelativeTimeFormat must be called with 'new'");
|
|
4734
4885
|
}
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4886
|
+
return InitializeRelativeTimeFormat(this, locales, options, {
|
|
4887
|
+
getInternalSlots,
|
|
4888
|
+
availableLocales: _RelativeTimeFormat.availableLocales,
|
|
4889
|
+
relevantExtensionKeys: _RelativeTimeFormat.relevantExtensionKeys,
|
|
4890
|
+
localeData: _RelativeTimeFormat.localeData,
|
|
4891
|
+
getDefaultLocale: _RelativeTimeFormat.getDefaultLocale
|
|
4892
|
+
});
|
|
4893
|
+
}
|
|
4894
|
+
format(value, unit) {
|
|
4895
|
+
if (typeof this !== "object") {
|
|
4896
|
+
throw new TypeError("format was called on a non-object");
|
|
4897
|
+
}
|
|
4898
|
+
const internalSlots = getInternalSlots(this);
|
|
4899
|
+
if (!internalSlots.initializedRelativeTimeFormat) {
|
|
4900
|
+
throw new TypeError("format was called on a invalid context");
|
|
4901
|
+
}
|
|
4902
|
+
return PartitionRelativeTimePattern(
|
|
4903
|
+
this,
|
|
4904
|
+
Number(value),
|
|
4905
|
+
ToString(unit),
|
|
4906
|
+
{
|
|
4744
4907
|
getInternalSlots
|
|
4745
|
-
}).map(function(el) {
|
|
4746
|
-
return el.value;
|
|
4747
|
-
}).join("");
|
|
4748
|
-
};
|
|
4749
|
-
RelativeTimeFormat2.prototype.formatToParts = function(value, unit) {
|
|
4750
|
-
if (typeof this !== "object") {
|
|
4751
|
-
throw new TypeError("formatToParts was called on a non-object");
|
|
4752
4908
|
}
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
}
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
}
|
|
4774
|
-
|
|
4775
|
-
|
|
4909
|
+
).map((el) => el.value).join("");
|
|
4910
|
+
}
|
|
4911
|
+
formatToParts(value, unit) {
|
|
4912
|
+
if (typeof this !== "object") {
|
|
4913
|
+
throw new TypeError("formatToParts was called on a non-object");
|
|
4914
|
+
}
|
|
4915
|
+
const internalSlots = getInternalSlots(this);
|
|
4916
|
+
if (!internalSlots.initializedRelativeTimeFormat) {
|
|
4917
|
+
throw new TypeError("formatToParts was called on a invalid context");
|
|
4918
|
+
}
|
|
4919
|
+
return PartitionRelativeTimePattern(
|
|
4920
|
+
this,
|
|
4921
|
+
Number(value),
|
|
4922
|
+
ToString(unit),
|
|
4923
|
+
{ getInternalSlots }
|
|
4924
|
+
);
|
|
4925
|
+
}
|
|
4926
|
+
resolvedOptions() {
|
|
4927
|
+
if (typeof this !== "object") {
|
|
4928
|
+
throw new TypeError("resolvedOptions was called on a non-object");
|
|
4929
|
+
}
|
|
4930
|
+
const internalSlots = getInternalSlots(this);
|
|
4931
|
+
if (!internalSlots.initializedRelativeTimeFormat) {
|
|
4932
|
+
throw new TypeError("resolvedOptions was called on a invalid context");
|
|
4933
|
+
}
|
|
4934
|
+
return {
|
|
4935
|
+
locale: internalSlots.locale,
|
|
4936
|
+
style: internalSlots.style,
|
|
4937
|
+
numeric: internalSlots.numeric,
|
|
4938
|
+
numberingSystem: internalSlots.numberingSystem
|
|
4776
4939
|
};
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4940
|
+
}
|
|
4941
|
+
static supportedLocalesOf(locales, options) {
|
|
4942
|
+
return SupportedLocales(
|
|
4943
|
+
_RelativeTimeFormat.availableLocales,
|
|
4944
|
+
CanonicalizeLocaleList(locales),
|
|
4945
|
+
options
|
|
4946
|
+
);
|
|
4947
|
+
}
|
|
4948
|
+
static __addLocaleData(...data2) {
|
|
4949
|
+
for (const { data: d, locale } of data2) {
|
|
4950
|
+
const minimizedLocale = new Intl.Locale(locale).minimize().toString();
|
|
4951
|
+
_RelativeTimeFormat.localeData[locale] = _RelativeTimeFormat.localeData[minimizedLocale] = d;
|
|
4952
|
+
_RelativeTimeFormat.availableLocales.add(minimizedLocale);
|
|
4953
|
+
_RelativeTimeFormat.availableLocales.add(locale);
|
|
4954
|
+
if (!_RelativeTimeFormat.__defaultLocale) {
|
|
4955
|
+
_RelativeTimeFormat.__defaultLocale = minimizedLocale;
|
|
4791
4956
|
}
|
|
4792
|
-
}
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
var lib_default = RelativeTimeFormat;
|
|
4957
|
+
}
|
|
4958
|
+
}
|
|
4959
|
+
static getDefaultLocale() {
|
|
4960
|
+
return _RelativeTimeFormat.__defaultLocale;
|
|
4961
|
+
}
|
|
4962
|
+
};
|
|
4963
|
+
__publicField(_RelativeTimeFormat, "localeData", {});
|
|
4964
|
+
__publicField(_RelativeTimeFormat, "availableLocales", /* @__PURE__ */ new Set());
|
|
4965
|
+
__publicField(_RelativeTimeFormat, "__defaultLocale", "");
|
|
4966
|
+
__publicField(_RelativeTimeFormat, "relevantExtensionKeys", ["nu"]);
|
|
4967
|
+
__publicField(_RelativeTimeFormat, "polyfilled", true);
|
|
4968
|
+
var RelativeTimeFormat = _RelativeTimeFormat;
|
|
4805
4969
|
try {
|
|
4806
4970
|
if (typeof Symbol !== "undefined") {
|
|
4807
4971
|
Object.defineProperty(RelativeTimeFormat.prototype, Symbol.toStringTag, {
|
|
@@ -4826,15 +4990,15 @@
|
|
|
4826
4990
|
} catch (e) {
|
|
4827
4991
|
}
|
|
4828
4992
|
|
|
4829
|
-
//
|
|
4993
|
+
// packages/intl-relativetimeformat/supported-locales.generated.ts
|
|
4830
4994
|
var supportedLocales = ["af", "af-NA", "agq", "ak", "am", "ar", "ar-AE", "ar-BH", "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER", "ar-IL", "ar-IQ", "ar-JO", "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA", "ar-MR", "ar-OM", "ar-PS", "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS", "ar-SY", "ar-TD", "ar-TN", "ar-YE", "as", "asa", "ast", "az", "az-Cyrl", "az-Latn", "bas", "be", "be-tarask", "bem", "bez", "bg", "bm", "bn", "bn-IN", "bo", "bo-IN", "br", "brx", "bs", "bs-Cyrl", "bs-Latn", "ca", "ca-AD", "ca-ES-valencia", "ca-FR", "ca-IT", "ccp", "ccp-IN", "ce", "ceb", "cgg", "chr", "ckb", "ckb-IR", "cs", "cy", "da", "da-GL", "dav", "de", "de-AT", "de-BE", "de-CH", "de-IT", "de-LI", "de-LU", "dje", "doi", "dsb", "dua", "dyo", "dz", "ebu", "ee", "ee-TG", "el", "el-CY", "en", "en-001", "en-150", "en-AE", "en-AG", "en-AI", "en-AS", "en-AT", "en-AU", "en-BB", "en-BE", "en-BI", "en-BM", "en-BS", "en-BW", "en-BZ", "en-CA", "en-CC", "en-CH", "en-CK", "en-CM", "en-CX", "en-CY", "en-DE", "en-DG", "en-DK", "en-DM", "en-ER", "en-FI", "en-FJ", "en-FK", "en-FM", "en-GB", "en-GD", "en-GG", "en-GH", "en-GI", "en-GM", "en-GU", "en-GY", "en-HK", "en-IE", "en-IL", "en-IM", "en-IN", "en-IO", "en-JE", "en-JM", "en-KE", "en-KI", "en-KN", "en-KY", "en-LC", "en-LR", "en-LS", "en-MG", "en-MH", "en-MO", "en-MP", "en-MS", "en-MT", "en-MU", "en-MW", "en-MY", "en-NA", "en-NF", "en-NG", "en-NL", "en-NR", "en-NU", "en-NZ", "en-PG", "en-PH", "en-PK", "en-PN", "en-PR", "en-PW", "en-RW", "en-SB", "en-SC", "en-SD", "en-SE", "en-SG", "en-SH", "en-SI", "en-SL", "en-SS", "en-SX", "en-SZ", "en-TC", "en-TK", "en-TO", "en-TT", "en-TV", "en-TZ", "en-UG", "en-UM", "en-VC", "en-VG", "en-VI", "en-VU", "en-WS", "en-ZA", "en-ZM", "en-ZW", "eo", "es", "es-419", "es-AR", "es-BO", "es-BR", "es-BZ", "es-CL", "es-CO", "es-CR", "es-CU", "es-DO", "es-EA", "es-EC", "es-GQ", "es-GT", "es-HN", "es-IC", "es-MX", "es-NI", "es-PA", "es-PE", "es-PH", "es-PR", "es-PY", "es-SV", "es-US", "es-UY", "es-VE", "et", "eu", "ewo", "fa", "fa-AF", "ff", "ff-Adlm", "ff-Adlm-BF", "ff-Adlm-CM", "ff-Adlm-GH", "ff-Adlm-GM", "ff-Adlm-GW", "ff-Adlm-LR", "ff-Adlm-MR", "ff-Adlm-NE", "ff-Adlm-NG", "ff-Adlm-SL", "ff-Adlm-SN", "ff-Latn", "ff-Latn-BF", "ff-Latn-CM", "ff-Latn-GH", "ff-Latn-GM", "ff-Latn-GN", "ff-Latn-GW", "ff-Latn-LR", "ff-Latn-MR", "ff-Latn-NE", "ff-Latn-NG", "ff-Latn-SL", "fi", "fil", "fo", "fo-DK", "fr", "fr-BE", "fr-BF", "fr-BI", "fr-BJ", "fr-BL", "fr-CA", "fr-CD", "fr-CF", "fr-CG", "fr-CH", "fr-CI", "fr-CM", "fr-DJ", "fr-DZ", "fr-GA", "fr-GF", "fr-GN", "fr-GP", "fr-GQ", "fr-HT", "fr-KM", "fr-LU", "fr-MA", "fr-MC", "fr-MF", "fr-MG", "fr-ML", "fr-MQ", "fr-MR", "fr-MU", "fr-NC", "fr-NE", "fr-PF", "fr-PM", "fr-RE", "fr-RW", "fr-SC", "fr-SN", "fr-SY", "fr-TD", "fr-TG", "fr-TN", "fr-VU", "fr-WF", "fr-YT", "fur", "fy", "ga", "ga-GB", "gd", "gl", "gsw", "gsw-FR", "gsw-LI", "gu", "guz", "gv", "ha", "ha-GH", "ha-NE", "haw", "he", "hi", "hr", "hr-BA", "hsb", "hu", "hy", "ia", "id", "ig", "ii", "is", "it", "it-CH", "it-SM", "it-VA", "ja", "jgo", "jmc", "jv", "ka", "kab", "kam", "kde", "kea", "kgp", "khq", "ki", "kk", "kkj", "kl", "kln", "km", "kn", "ko", "ko-KP", "kok", "ks", "ks-Arab", "ksb", "ksf", "ksh", "ku", "kw", "ky", "lag", "lb", "lg", "lkt", "ln", "ln-AO", "ln-CF", "ln-CG", "lo", "lrc", "lrc-IQ", "lt", "lu", "luo", "luy", "lv", "mai", "mas", "mas-TZ", "mer", "mfe", "mg", "mgh", "mgo", "mi", "mk", "ml", "mn", "mni", "mni-Beng", "mr", "ms", "ms-BN", "ms-ID", "ms-SG", "mt", "mua", "my", "mzn", "naq", "nb", "nb-SJ", "nd", "nds", "nds-NL", "ne", "ne-IN", "nl", "nl-AW", "nl-BE", "nl-BQ", "nl-CW", "nl-SR", "nl-SX", "nmg", "nn", "nnh", "no", "nus", "nyn", "om", "om-KE", "or", "os", "os-RU", "pa", "pa-Arab", "pa-Guru", "pcm", "pl", "ps", "ps-PK", "pt", "pt-AO", "pt-CH", "pt-CV", "pt-GQ", "pt-GW", "pt-LU", "pt-MO", "pt-MZ", "pt-PT", "pt-ST", "pt-TL", "qu", "qu-BO", "qu-EC", "rm", "rn", "ro", "ro-MD", "rof", "ru", "ru-BY", "ru-KG", "ru-KZ", "ru-MD", "ru-UA", "rw", "rwk", "sa", "sah", "saq", "sat", "sat-Olck", "sbp", "sc", "sd", "sd-Arab", "sd-Deva", "se", "se-FI", "se-SE", "seh", "ses", "sg", "shi", "shi-Latn", "shi-Tfng", "si", "sk", "sl", "smn", "sn", "so", "so-DJ", "so-ET", "so-KE", "sq", "sq-MK", "sq-XK", "sr", "sr-Cyrl", "sr-Cyrl-BA", "sr-Cyrl-ME", "sr-Cyrl-XK", "sr-Latn", "sr-Latn-BA", "sr-Latn-ME", "sr-Latn-XK", "su", "su-Latn", "sv", "sv-AX", "sv-FI", "sw", "sw-CD", "sw-KE", "sw-UG", "ta", "ta-LK", "ta-MY", "ta-SG", "te", "teo", "teo-KE", "tg", "th", "ti", "ti-ER", "tk", "to", "tr", "tr-CY", "tt", "twq", "tzm", "ug", "uk", "und", "ur", "ur-IN", "uz", "uz-Arab", "uz-Cyrl", "uz-Latn", "vai", "vai-Latn", "vai-Vaii", "vi", "vun", "wae", "wo", "xh", "xog", "yav", "yi", "yo", "yo-BJ", "yrl", "yrl-CO", "yrl-VE", "yue", "yue-Hans", "yue-Hant", "zgh", "zh", "zh-Hans", "zh-Hans-HK", "zh-Hans-MO", "zh-Hans-SG", "zh-Hant", "zh-Hant-HK", "zh-Hant-MO", "zu"];
|
|
4831
4995
|
|
|
4832
|
-
//
|
|
4996
|
+
// packages/intl-relativetimeformat/should-polyfill.ts
|
|
4833
4997
|
function supportedLocalesOf(locale) {
|
|
4834
4998
|
if (!locale) {
|
|
4835
4999
|
return true;
|
|
4836
5000
|
}
|
|
4837
|
-
|
|
5001
|
+
const locales = Array.isArray(locale) ? locale : [locale];
|
|
4838
5002
|
return Intl.RelativeTimeFormat.supportedLocalesOf(locales).length === locales.length;
|
|
4839
5003
|
}
|
|
4840
5004
|
function hasResolvedOptionsNumberingSystem(locale) {
|
|
@@ -4846,19 +5010,16 @@
|
|
|
4846
5010
|
return false;
|
|
4847
5011
|
}
|
|
4848
5012
|
}
|
|
4849
|
-
function shouldPolyfill(locale) {
|
|
4850
|
-
if (locale === void 0) {
|
|
4851
|
-
locale = "en";
|
|
4852
|
-
}
|
|
5013
|
+
function shouldPolyfill(locale = "en") {
|
|
4853
5014
|
if (!("RelativeTimeFormat" in Intl) || !supportedLocalesOf(locale) || !hasResolvedOptionsNumberingSystem(locale)) {
|
|
4854
5015
|
return match([locale], supportedLocales, "en");
|
|
4855
5016
|
}
|
|
4856
5017
|
}
|
|
4857
5018
|
|
|
4858
|
-
//
|
|
5019
|
+
// packages/intl-relativetimeformat/polyfill.ts
|
|
4859
5020
|
if (shouldPolyfill()) {
|
|
4860
5021
|
Object.defineProperty(Intl, "RelativeTimeFormat", {
|
|
4861
|
-
value:
|
|
5022
|
+
value: RelativeTimeFormat,
|
|
4862
5023
|
writable: true,
|
|
4863
5024
|
enumerable: false,
|
|
4864
5025
|
configurable: true
|
package/should-polyfill.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.shouldPolyfill =
|
|
3
|
+
exports.shouldPolyfill = shouldPolyfill;
|
|
4
4
|
var intl_localematcher_1 = require("@formatjs/intl-localematcher");
|
|
5
5
|
var supported_locales_generated_1 = require("./supported-locales.generated");
|
|
6
6
|
function supportedLocalesOf(locale) {
|
|
@@ -30,4 +30,3 @@ function shouldPolyfill(locale) {
|
|
|
30
30
|
return (0, intl_localematcher_1.match)([locale], supported_locales_generated_1.supportedLocales, 'en');
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
exports.shouldPolyfill = shouldPolyfill;
|