@formatjs/intl-locale 2.4.39 → 2.4.43
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/index.js +64 -64
- package/lib/index.js +3 -3
- package/package.json +3 -3
- package/polyfill.iife.js +67 -444
- package/polyfill.js +1 -1
package/index.js
CHANGED
|
@@ -4,25 +4,25 @@ exports.Locale = void 0;
|
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
6
6
|
var intl_getcanonicallocales_1 = require("@formatjs/intl-getcanonicallocales");
|
|
7
|
-
var get_internal_slots_1 = tslib_1.__importDefault(require("./get_internal_slots"));
|
|
7
|
+
var get_internal_slots_1 = (0, tslib_1.__importDefault)(require("./get_internal_slots"));
|
|
8
8
|
var RELEVANT_EXTENSION_KEYS = ['ca', 'co', 'hc', 'kf', 'kn', 'nu'];
|
|
9
9
|
var UNICODE_TYPE_REGEX = /^[a-z0-9]{3,8}(-[a-z0-9]{3,8})*$/i;
|
|
10
10
|
function applyOptionsToTag(tag, options) {
|
|
11
|
-
ecma402_abstract_1.invariant(typeof tag === 'string', 'language tag must be a string');
|
|
12
|
-
ecma402_abstract_1.invariant(intl_getcanonicallocales_1.isStructurallyValidLanguageTag(tag), 'malformed language tag', RangeError);
|
|
13
|
-
var language = ecma402_abstract_1.GetOption(options, 'language', 'string', undefined, undefined);
|
|
11
|
+
(0, ecma402_abstract_1.invariant)(typeof tag === 'string', 'language tag must be a string');
|
|
12
|
+
(0, ecma402_abstract_1.invariant)((0, intl_getcanonicallocales_1.isStructurallyValidLanguageTag)(tag), 'malformed language tag', RangeError);
|
|
13
|
+
var language = (0, ecma402_abstract_1.GetOption)(options, 'language', 'string', undefined, undefined);
|
|
14
14
|
if (language !== undefined) {
|
|
15
|
-
ecma402_abstract_1.invariant(intl_getcanonicallocales_1.isUnicodeLanguageSubtag(language), 'Malformed unicode_language_subtag', RangeError);
|
|
15
|
+
(0, ecma402_abstract_1.invariant)((0, intl_getcanonicallocales_1.isUnicodeLanguageSubtag)(language), 'Malformed unicode_language_subtag', RangeError);
|
|
16
16
|
}
|
|
17
|
-
var script = ecma402_abstract_1.GetOption(options, 'script', 'string', undefined, undefined);
|
|
17
|
+
var script = (0, ecma402_abstract_1.GetOption)(options, 'script', 'string', undefined, undefined);
|
|
18
18
|
if (script !== undefined) {
|
|
19
|
-
ecma402_abstract_1.invariant(intl_getcanonicallocales_1.isUnicodeScriptSubtag(script), 'Malformed unicode_script_subtag', RangeError);
|
|
19
|
+
(0, ecma402_abstract_1.invariant)((0, intl_getcanonicallocales_1.isUnicodeScriptSubtag)(script), 'Malformed unicode_script_subtag', RangeError);
|
|
20
20
|
}
|
|
21
|
-
var region = ecma402_abstract_1.GetOption(options, 'region', 'string', undefined, undefined);
|
|
21
|
+
var region = (0, ecma402_abstract_1.GetOption)(options, 'region', 'string', undefined, undefined);
|
|
22
22
|
if (region !== undefined) {
|
|
23
|
-
ecma402_abstract_1.invariant(intl_getcanonicallocales_1.isUnicodeRegionSubtag(region), 'Malformed unicode_region_subtag', RangeError);
|
|
23
|
+
(0, ecma402_abstract_1.invariant)((0, intl_getcanonicallocales_1.isUnicodeRegionSubtag)(region), 'Malformed unicode_region_subtag', RangeError);
|
|
24
24
|
}
|
|
25
|
-
var languageId = intl_getcanonicallocales_1.parseUnicodeLanguageId(tag);
|
|
25
|
+
var languageId = (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(tag);
|
|
26
26
|
if (language !== undefined) {
|
|
27
27
|
languageId.lang = language;
|
|
28
28
|
}
|
|
@@ -32,12 +32,12 @@ function applyOptionsToTag(tag, options) {
|
|
|
32
32
|
if (region !== undefined) {
|
|
33
33
|
languageId.region = region;
|
|
34
34
|
}
|
|
35
|
-
return Intl.getCanonicalLocales(intl_getcanonicallocales_1.emitUnicodeLocaleId(tslib_1.__assign(tslib_1.__assign({}, intl_getcanonicallocales_1.parseUnicodeLocaleId(tag)), { lang: languageId })))[0];
|
|
35
|
+
return Intl.getCanonicalLocales((0, intl_getcanonicallocales_1.emitUnicodeLocaleId)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, (0, intl_getcanonicallocales_1.parseUnicodeLocaleId)(tag)), { lang: languageId })))[0];
|
|
36
36
|
}
|
|
37
37
|
function applyUnicodeExtensionToTag(tag, options, relevantExtensionKeys) {
|
|
38
38
|
var unicodeExtension;
|
|
39
39
|
var keywords = [];
|
|
40
|
-
var ast = intl_getcanonicallocales_1.parseUnicodeLocaleId(tag);
|
|
40
|
+
var ast = (0, intl_getcanonicallocales_1.parseUnicodeLocaleId)(tag);
|
|
41
41
|
for (var _i = 0, _a = ast.extensions; _i < _a.length; _i++) {
|
|
42
42
|
var ext = _a[_i];
|
|
43
43
|
if (ext.type === 'u') {
|
|
@@ -57,10 +57,10 @@ function applyUnicodeExtensionToTag(tag, options, relevantExtensionKeys) {
|
|
|
57
57
|
value = entry[1];
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
ecma402_abstract_1.invariant(key in options, key
|
|
60
|
+
(0, ecma402_abstract_1.invariant)(key in options, "".concat(key, " must be in options"));
|
|
61
61
|
var optionsValue = options[key];
|
|
62
62
|
if (optionsValue !== undefined) {
|
|
63
|
-
ecma402_abstract_1.invariant(typeof optionsValue === 'string', "Value for "
|
|
63
|
+
(0, ecma402_abstract_1.invariant)(typeof optionsValue === 'string', "Value for ".concat(key, " must be a string"));
|
|
64
64
|
value = optionsValue;
|
|
65
65
|
if (entry) {
|
|
66
66
|
entry[1] = value;
|
|
@@ -83,7 +83,7 @@ function applyUnicodeExtensionToTag(tag, options, relevantExtensionKeys) {
|
|
|
83
83
|
else {
|
|
84
84
|
unicodeExtension.keywords = keywords;
|
|
85
85
|
}
|
|
86
|
-
result.locale = Intl.getCanonicalLocales(intl_getcanonicallocales_1.emitUnicodeLocaleId(ast))[0];
|
|
86
|
+
result.locale = Intl.getCanonicalLocales((0, intl_getcanonicallocales_1.emitUnicodeLocaleId)(ast))[0];
|
|
87
87
|
return result;
|
|
88
88
|
}
|
|
89
89
|
function mergeUnicodeLanguageId(lang, script, region, variants, replacement) {
|
|
@@ -100,45 +100,45 @@ function mergeUnicodeLanguageId(lang, script, region, variants, replacement) {
|
|
|
100
100
|
lang: !lang || lang === 'und' ? replacement.lang : lang,
|
|
101
101
|
script: script || replacement.script,
|
|
102
102
|
region: region || replacement.region,
|
|
103
|
-
variants: tslib_1.__spreadArray(tslib_1.__spreadArray([], variants), replacement.variants),
|
|
103
|
+
variants: (0, tslib_1.__spreadArray)((0, tslib_1.__spreadArray)([], variants, true), replacement.variants, true),
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
function addLikelySubtags(tag) {
|
|
107
|
-
var ast = intl_getcanonicallocales_1.parseUnicodeLocaleId(tag);
|
|
107
|
+
var ast = (0, intl_getcanonicallocales_1.parseUnicodeLocaleId)(tag);
|
|
108
108
|
var unicodeLangId = ast.lang;
|
|
109
109
|
var lang = unicodeLangId.lang, script = unicodeLangId.script, region = unicodeLangId.region, variants = unicodeLangId.variants;
|
|
110
110
|
if (script && region) {
|
|
111
|
-
var match_1 = intl_getcanonicallocales_1.likelySubtags[intl_getcanonicallocales_1.emitUnicodeLanguageId({ lang: lang, script: script, region: region, variants: [] })];
|
|
111
|
+
var match_1 = intl_getcanonicallocales_1.likelySubtags[(0, intl_getcanonicallocales_1.emitUnicodeLanguageId)({ lang: lang, script: script, region: region, variants: [] })];
|
|
112
112
|
if (match_1) {
|
|
113
|
-
var parts_1 = intl_getcanonicallocales_1.parseUnicodeLanguageId(match_1);
|
|
113
|
+
var parts_1 = (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(match_1);
|
|
114
114
|
ast.lang = mergeUnicodeLanguageId(undefined, undefined, undefined, variants, parts_1);
|
|
115
|
-
return intl_getcanonicallocales_1.emitUnicodeLocaleId(ast);
|
|
115
|
+
return (0, intl_getcanonicallocales_1.emitUnicodeLocaleId)(ast);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
if (script) {
|
|
119
|
-
var match_2 = intl_getcanonicallocales_1.likelySubtags[intl_getcanonicallocales_1.emitUnicodeLanguageId({ lang: lang, script: script, variants: [] })];
|
|
119
|
+
var match_2 = intl_getcanonicallocales_1.likelySubtags[(0, intl_getcanonicallocales_1.emitUnicodeLanguageId)({ lang: lang, script: script, variants: [] })];
|
|
120
120
|
if (match_2) {
|
|
121
|
-
var parts_2 = intl_getcanonicallocales_1.parseUnicodeLanguageId(match_2);
|
|
121
|
+
var parts_2 = (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(match_2);
|
|
122
122
|
ast.lang = mergeUnicodeLanguageId(undefined, undefined, region, variants, parts_2);
|
|
123
|
-
return intl_getcanonicallocales_1.emitUnicodeLocaleId(ast);
|
|
123
|
+
return (0, intl_getcanonicallocales_1.emitUnicodeLocaleId)(ast);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
if (region) {
|
|
127
|
-
var match_3 = intl_getcanonicallocales_1.likelySubtags[intl_getcanonicallocales_1.emitUnicodeLanguageId({ lang: lang, region: region, variants: [] })];
|
|
127
|
+
var match_3 = intl_getcanonicallocales_1.likelySubtags[(0, intl_getcanonicallocales_1.emitUnicodeLanguageId)({ lang: lang, region: region, variants: [] })];
|
|
128
128
|
if (match_3) {
|
|
129
|
-
var parts_3 = intl_getcanonicallocales_1.parseUnicodeLanguageId(match_3);
|
|
129
|
+
var parts_3 = (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(match_3);
|
|
130
130
|
ast.lang = mergeUnicodeLanguageId(undefined, script, undefined, variants, parts_3);
|
|
131
|
-
return intl_getcanonicallocales_1.emitUnicodeLocaleId(ast);
|
|
131
|
+
return (0, intl_getcanonicallocales_1.emitUnicodeLocaleId)(ast);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
var match = intl_getcanonicallocales_1.likelySubtags[lang] ||
|
|
135
|
-
intl_getcanonicallocales_1.likelySubtags[intl_getcanonicallocales_1.emitUnicodeLanguageId({ lang: 'und', script: script, variants: [] })];
|
|
135
|
+
intl_getcanonicallocales_1.likelySubtags[(0, intl_getcanonicallocales_1.emitUnicodeLanguageId)({ lang: 'und', script: script, variants: [] })];
|
|
136
136
|
if (!match) {
|
|
137
137
|
throw new Error("No match for addLikelySubtags");
|
|
138
138
|
}
|
|
139
|
-
var parts = intl_getcanonicallocales_1.parseUnicodeLanguageId(match);
|
|
139
|
+
var parts = (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(match);
|
|
140
140
|
ast.lang = mergeUnicodeLanguageId(undefined, script, region, variants, parts);
|
|
141
|
-
return intl_getcanonicallocales_1.emitUnicodeLocaleId(ast);
|
|
141
|
+
return (0, intl_getcanonicallocales_1.emitUnicodeLocaleId)(ast);
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* From: https://github.com/unicode-org/icu/blob/4231ca5be053a22a1be24eb891817458c97db709/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java#L2395
|
|
@@ -149,23 +149,23 @@ function removeLikelySubtags(tag) {
|
|
|
149
149
|
if (!maxLocale) {
|
|
150
150
|
return tag;
|
|
151
151
|
}
|
|
152
|
-
maxLocale = intl_getcanonicallocales_1.emitUnicodeLanguageId(tslib_1.__assign(tslib_1.__assign({}, intl_getcanonicallocales_1.parseUnicodeLanguageId(maxLocale)), { variants: [] }));
|
|
153
|
-
var ast = intl_getcanonicallocales_1.parseUnicodeLocaleId(tag);
|
|
152
|
+
maxLocale = (0, intl_getcanonicallocales_1.emitUnicodeLanguageId)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(maxLocale)), { variants: [] }));
|
|
153
|
+
var ast = (0, intl_getcanonicallocales_1.parseUnicodeLocaleId)(tag);
|
|
154
154
|
var _a = ast.lang, lang = _a.lang, script = _a.script, region = _a.region, variants = _a.variants;
|
|
155
|
-
var trial = addLikelySubtags(intl_getcanonicallocales_1.emitUnicodeLanguageId({ lang: lang, variants: [] }));
|
|
155
|
+
var trial = addLikelySubtags((0, intl_getcanonicallocales_1.emitUnicodeLanguageId)({ lang: lang, variants: [] }));
|
|
156
156
|
if (trial === maxLocale) {
|
|
157
|
-
return intl_getcanonicallocales_1.emitUnicodeLocaleId(tslib_1.__assign(tslib_1.__assign({}, ast), { lang: mergeUnicodeLanguageId(lang, undefined, undefined, variants) }));
|
|
157
|
+
return (0, intl_getcanonicallocales_1.emitUnicodeLocaleId)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, ast), { lang: mergeUnicodeLanguageId(lang, undefined, undefined, variants) }));
|
|
158
158
|
}
|
|
159
159
|
if (region) {
|
|
160
|
-
var trial_1 = addLikelySubtags(intl_getcanonicallocales_1.emitUnicodeLanguageId({ lang: lang, region: region, variants: [] }));
|
|
160
|
+
var trial_1 = addLikelySubtags((0, intl_getcanonicallocales_1.emitUnicodeLanguageId)({ lang: lang, region: region, variants: [] }));
|
|
161
161
|
if (trial_1 === maxLocale) {
|
|
162
|
-
return intl_getcanonicallocales_1.emitUnicodeLocaleId(tslib_1.__assign(tslib_1.__assign({}, ast), { lang: mergeUnicodeLanguageId(lang, undefined, region, variants) }));
|
|
162
|
+
return (0, intl_getcanonicallocales_1.emitUnicodeLocaleId)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, ast), { lang: mergeUnicodeLanguageId(lang, undefined, region, variants) }));
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
if (script) {
|
|
166
|
-
var trial_2 = addLikelySubtags(intl_getcanonicallocales_1.emitUnicodeLanguageId({ lang: lang, script: script, variants: [] }));
|
|
166
|
+
var trial_2 = addLikelySubtags((0, intl_getcanonicallocales_1.emitUnicodeLanguageId)({ lang: lang, script: script, variants: [] }));
|
|
167
167
|
if (trial_2 === maxLocale) {
|
|
168
|
-
return intl_getcanonicallocales_1.emitUnicodeLocaleId(tslib_1.__assign(tslib_1.__assign({}, ast), { lang: mergeUnicodeLanguageId(lang, script, undefined, variants) }));
|
|
168
|
+
return (0, intl_getcanonicallocales_1.emitUnicodeLocaleId)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, ast), { lang: mergeUnicodeLanguageId(lang, script, undefined, variants) }));
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
return tag;
|
|
@@ -201,42 +201,42 @@ var Locale = /** @class */ (function () {
|
|
|
201
201
|
}
|
|
202
202
|
var internalSlots;
|
|
203
203
|
if (typeof tag === 'object' &&
|
|
204
|
-
(internalSlots = get_internal_slots_1.default(tag)) &&
|
|
204
|
+
(internalSlots = (0, get_internal_slots_1.default)(tag)) &&
|
|
205
205
|
internalSlots.initializedLocale) {
|
|
206
206
|
tag = internalSlots.locale;
|
|
207
207
|
}
|
|
208
208
|
else {
|
|
209
209
|
tag = tag.toString();
|
|
210
210
|
}
|
|
211
|
-
internalSlots = get_internal_slots_1.default(this);
|
|
212
|
-
var options = ecma402_abstract_1.CoerceOptionsToObject(opts);
|
|
211
|
+
internalSlots = (0, get_internal_slots_1.default)(this);
|
|
212
|
+
var options = (0, ecma402_abstract_1.CoerceOptionsToObject)(opts);
|
|
213
213
|
tag = applyOptionsToTag(tag, options);
|
|
214
214
|
var opt = Object.create(null);
|
|
215
|
-
var calendar = ecma402_abstract_1.GetOption(options, 'calendar', 'string', undefined, undefined);
|
|
215
|
+
var calendar = (0, ecma402_abstract_1.GetOption)(options, 'calendar', 'string', undefined, undefined);
|
|
216
216
|
if (calendar !== undefined) {
|
|
217
217
|
if (!UNICODE_TYPE_REGEX.test(calendar)) {
|
|
218
218
|
throw new RangeError('invalid calendar');
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
opt.ca = calendar;
|
|
222
|
-
var collation = ecma402_abstract_1.GetOption(options, 'collation', 'string', undefined, undefined);
|
|
222
|
+
var collation = (0, ecma402_abstract_1.GetOption)(options, 'collation', 'string', undefined, undefined);
|
|
223
223
|
if (collation !== undefined) {
|
|
224
224
|
if (!UNICODE_TYPE_REGEX.test(collation)) {
|
|
225
225
|
throw new RangeError('invalid collation');
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
opt.co = collation;
|
|
229
|
-
var hc = ecma402_abstract_1.GetOption(options, 'hourCycle', 'string', ['h11', 'h12', 'h23', 'h24'], undefined);
|
|
229
|
+
var hc = (0, ecma402_abstract_1.GetOption)(options, 'hourCycle', 'string', ['h11', 'h12', 'h23', 'h24'], undefined);
|
|
230
230
|
opt.hc = hc;
|
|
231
|
-
var kf = ecma402_abstract_1.GetOption(options, 'caseFirst', 'string', ['upper', 'lower', 'false'], undefined);
|
|
231
|
+
var kf = (0, ecma402_abstract_1.GetOption)(options, 'caseFirst', 'string', ['upper', 'lower', 'false'], undefined);
|
|
232
232
|
opt.kf = kf;
|
|
233
|
-
var _kn = ecma402_abstract_1.GetOption(options, 'numeric', 'boolean', undefined, undefined);
|
|
233
|
+
var _kn = (0, ecma402_abstract_1.GetOption)(options, 'numeric', 'boolean', undefined, undefined);
|
|
234
234
|
var kn;
|
|
235
235
|
if (_kn !== undefined) {
|
|
236
236
|
kn = String(_kn);
|
|
237
237
|
}
|
|
238
238
|
opt.kn = kn;
|
|
239
|
-
var numberingSystem = ecma402_abstract_1.GetOption(options, 'numberingSystem', 'string', undefined, undefined);
|
|
239
|
+
var numberingSystem = (0, ecma402_abstract_1.GetOption)(options, 'numberingSystem', 'string', undefined, undefined);
|
|
240
240
|
if (numberingSystem !== undefined) {
|
|
241
241
|
if (!UNICODE_TYPE_REGEX.test(numberingSystem)) {
|
|
242
242
|
throw new RangeError('Invalid numberingSystem');
|
|
@@ -252,7 +252,7 @@ var Locale = /** @class */ (function () {
|
|
|
252
252
|
internalSlots.caseFirst = r.kf;
|
|
253
253
|
}
|
|
254
254
|
if (relevantExtensionKeys.indexOf('kn') > -1) {
|
|
255
|
-
internalSlots.numeric = ecma402_abstract_1.SameValue(r.kn, 'true');
|
|
255
|
+
internalSlots.numeric = (0, ecma402_abstract_1.SameValue)(r.kn, 'true');
|
|
256
256
|
}
|
|
257
257
|
internalSlots.numberingSystem = r.nu;
|
|
258
258
|
}
|
|
@@ -260,7 +260,7 @@ var Locale = /** @class */ (function () {
|
|
|
260
260
|
* https://www.unicode.org/reports/tr35/#Likely_Subtags
|
|
261
261
|
*/
|
|
262
262
|
Locale.prototype.maximize = function () {
|
|
263
|
-
var locale = get_internal_slots_1.default(this).locale;
|
|
263
|
+
var locale = (0, get_internal_slots_1.default)(this).locale;
|
|
264
264
|
try {
|
|
265
265
|
var maximizedLocale = addLikelySubtags(locale);
|
|
266
266
|
return new Locale(maximizedLocale);
|
|
@@ -273,7 +273,7 @@ var Locale = /** @class */ (function () {
|
|
|
273
273
|
* https://www.unicode.org/reports/tr35/#Likely_Subtags
|
|
274
274
|
*/
|
|
275
275
|
Locale.prototype.minimize = function () {
|
|
276
|
-
var locale = get_internal_slots_1.default(this).locale;
|
|
276
|
+
var locale = (0, get_internal_slots_1.default)(this).locale;
|
|
277
277
|
try {
|
|
278
278
|
var minimizedLocale = removeLikelySubtags(locale);
|
|
279
279
|
return new Locale(minimizedLocale);
|
|
@@ -283,54 +283,54 @@ var Locale = /** @class */ (function () {
|
|
|
283
283
|
}
|
|
284
284
|
};
|
|
285
285
|
Locale.prototype.toString = function () {
|
|
286
|
-
return get_internal_slots_1.default(this).locale;
|
|
286
|
+
return (0, get_internal_slots_1.default)(this).locale;
|
|
287
287
|
};
|
|
288
288
|
Object.defineProperty(Locale.prototype, "baseName", {
|
|
289
289
|
get: function () {
|
|
290
|
-
var locale = get_internal_slots_1.default(this).locale;
|
|
291
|
-
return intl_getcanonicallocales_1.emitUnicodeLanguageId(intl_getcanonicallocales_1.parseUnicodeLanguageId(locale));
|
|
290
|
+
var locale = (0, get_internal_slots_1.default)(this).locale;
|
|
291
|
+
return (0, intl_getcanonicallocales_1.emitUnicodeLanguageId)((0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(locale));
|
|
292
292
|
},
|
|
293
293
|
enumerable: false,
|
|
294
294
|
configurable: true
|
|
295
295
|
});
|
|
296
296
|
Object.defineProperty(Locale.prototype, "calendar", {
|
|
297
297
|
get: function () {
|
|
298
|
-
return get_internal_slots_1.default(this).calendar;
|
|
298
|
+
return (0, get_internal_slots_1.default)(this).calendar;
|
|
299
299
|
},
|
|
300
300
|
enumerable: false,
|
|
301
301
|
configurable: true
|
|
302
302
|
});
|
|
303
303
|
Object.defineProperty(Locale.prototype, "collation", {
|
|
304
304
|
get: function () {
|
|
305
|
-
return get_internal_slots_1.default(this).collation;
|
|
305
|
+
return (0, get_internal_slots_1.default)(this).collation;
|
|
306
306
|
},
|
|
307
307
|
enumerable: false,
|
|
308
308
|
configurable: true
|
|
309
309
|
});
|
|
310
310
|
Object.defineProperty(Locale.prototype, "hourCycle", {
|
|
311
311
|
get: function () {
|
|
312
|
-
return get_internal_slots_1.default(this).hourCycle;
|
|
312
|
+
return (0, get_internal_slots_1.default)(this).hourCycle;
|
|
313
313
|
},
|
|
314
314
|
enumerable: false,
|
|
315
315
|
configurable: true
|
|
316
316
|
});
|
|
317
317
|
Object.defineProperty(Locale.prototype, "caseFirst", {
|
|
318
318
|
get: function () {
|
|
319
|
-
return get_internal_slots_1.default(this).caseFirst;
|
|
319
|
+
return (0, get_internal_slots_1.default)(this).caseFirst;
|
|
320
320
|
},
|
|
321
321
|
enumerable: false,
|
|
322
322
|
configurable: true
|
|
323
323
|
});
|
|
324
324
|
Object.defineProperty(Locale.prototype, "numeric", {
|
|
325
325
|
get: function () {
|
|
326
|
-
return get_internal_slots_1.default(this).numeric;
|
|
326
|
+
return (0, get_internal_slots_1.default)(this).numeric;
|
|
327
327
|
},
|
|
328
328
|
enumerable: false,
|
|
329
329
|
configurable: true
|
|
330
330
|
});
|
|
331
331
|
Object.defineProperty(Locale.prototype, "numberingSystem", {
|
|
332
332
|
get: function () {
|
|
333
|
-
return get_internal_slots_1.default(this).numberingSystem;
|
|
333
|
+
return (0, get_internal_slots_1.default)(this).numberingSystem;
|
|
334
334
|
},
|
|
335
335
|
enumerable: false,
|
|
336
336
|
configurable: true
|
|
@@ -340,8 +340,8 @@ var Locale = /** @class */ (function () {
|
|
|
340
340
|
* https://tc39.es/proposal-intl-locale/#sec-Intl.Locale.prototype.language
|
|
341
341
|
*/
|
|
342
342
|
get: function () {
|
|
343
|
-
var locale = get_internal_slots_1.default(this).locale;
|
|
344
|
-
return intl_getcanonicallocales_1.parseUnicodeLanguageId(locale).lang;
|
|
343
|
+
var locale = (0, get_internal_slots_1.default)(this).locale;
|
|
344
|
+
return (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(locale).lang;
|
|
345
345
|
},
|
|
346
346
|
enumerable: false,
|
|
347
347
|
configurable: true
|
|
@@ -351,8 +351,8 @@ var Locale = /** @class */ (function () {
|
|
|
351
351
|
* https://tc39.es/proposal-intl-locale/#sec-Intl.Locale.prototype.script
|
|
352
352
|
*/
|
|
353
353
|
get: function () {
|
|
354
|
-
var locale = get_internal_slots_1.default(this).locale;
|
|
355
|
-
return intl_getcanonicallocales_1.parseUnicodeLanguageId(locale).script;
|
|
354
|
+
var locale = (0, get_internal_slots_1.default)(this).locale;
|
|
355
|
+
return (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(locale).script;
|
|
356
356
|
},
|
|
357
357
|
enumerable: false,
|
|
358
358
|
configurable: true
|
|
@@ -362,8 +362,8 @@ var Locale = /** @class */ (function () {
|
|
|
362
362
|
* https://tc39.es/proposal-intl-locale/#sec-Intl.Locale.prototype.region
|
|
363
363
|
*/
|
|
364
364
|
get: function () {
|
|
365
|
-
var locale = get_internal_slots_1.default(this).locale;
|
|
366
|
-
return intl_getcanonicallocales_1.parseUnicodeLanguageId(locale).region;
|
|
365
|
+
var locale = (0, get_internal_slots_1.default)(this).locale;
|
|
366
|
+
return (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(locale).region;
|
|
367
367
|
},
|
|
368
368
|
enumerable: false,
|
|
369
369
|
configurable: true
|
package/lib/index.js
CHANGED
|
@@ -54,10 +54,10 @@ function applyUnicodeExtensionToTag(tag, options, relevantExtensionKeys) {
|
|
|
54
54
|
value = entry[1];
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
invariant(key in options, key
|
|
57
|
+
invariant(key in options, "".concat(key, " must be in options"));
|
|
58
58
|
var optionsValue = options[key];
|
|
59
59
|
if (optionsValue !== undefined) {
|
|
60
|
-
invariant(typeof optionsValue === 'string', "Value for "
|
|
60
|
+
invariant(typeof optionsValue === 'string', "Value for ".concat(key, " must be a string"));
|
|
61
61
|
value = optionsValue;
|
|
62
62
|
if (entry) {
|
|
63
63
|
entry[1] = value;
|
|
@@ -97,7 +97,7 @@ function mergeUnicodeLanguageId(lang, script, region, variants, replacement) {
|
|
|
97
97
|
lang: !lang || lang === 'und' ? replacement.lang : lang,
|
|
98
98
|
script: script || replacement.script,
|
|
99
99
|
region: region || replacement.region,
|
|
100
|
-
variants: __spreadArray(__spreadArray([], variants), replacement.variants),
|
|
100
|
+
variants: __spreadArray(__spreadArray([], variants, true), replacement.variants, true),
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
function addLikelySubtags(tag) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-locale",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.43",
|
|
4
4
|
"description": "Intl.Locale polyfill",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intl",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"url": "https://github.com/formatjs/formatjs/issues"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@formatjs/ecma402-abstract": "1.
|
|
28
|
-
"@formatjs/intl-getcanonicallocales": "1.
|
|
27
|
+
"@formatjs/ecma402-abstract": "1.11.1",
|
|
28
|
+
"@formatjs/intl-getcanonicallocales": "1.9.0",
|
|
29
29
|
"tslib": "^2.1.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/polyfill.iife.js
CHANGED
|
@@ -8,27 +8,24 @@
|
|
|
8
8
|
var __markAsModule = function(target) {
|
|
9
9
|
return __defProp(target, "__esModule", { value: true });
|
|
10
10
|
};
|
|
11
|
-
var __require = typeof require !== "undefined" ? require : function(x) {
|
|
12
|
-
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
-
};
|
|
14
11
|
var __commonJS = function(cb, mod) {
|
|
15
|
-
return function
|
|
16
|
-
return mod || (0, cb[
|
|
12
|
+
return function __require() {
|
|
13
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
14
|
};
|
|
18
15
|
};
|
|
19
|
-
var __reExport = function(target, module, desc) {
|
|
16
|
+
var __reExport = function(target, module, copyDefault, desc) {
|
|
20
17
|
if (module && typeof module === "object" || typeof module === "function")
|
|
21
18
|
for (var keys = __getOwnPropNames(module), i = 0, n = keys.length, key; i < n; i++) {
|
|
22
19
|
key = keys[i];
|
|
23
|
-
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
20
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
24
21
|
__defProp(target, key, { get: function(k) {
|
|
25
22
|
return module[k];
|
|
26
23
|
}.bind(null, key), enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
|
|
27
24
|
}
|
|
28
25
|
return target;
|
|
29
26
|
};
|
|
30
|
-
var
|
|
31
|
-
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default",
|
|
27
|
+
var __toESM = function(module, isNodeMode) {
|
|
28
|
+
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", !isNodeMode && module && module.__esModule ? { get: function() {
|
|
32
29
|
return module.default;
|
|
33
30
|
}, enumerable: true } : { value: module, enumerable: true })), module);
|
|
34
31
|
};
|
|
@@ -36,7 +33,7 @@
|
|
|
36
33
|
// node_modules/tslib/tslib.js
|
|
37
34
|
var require_tslib = __commonJS({
|
|
38
35
|
"node_modules/tslib/tslib.js": function(exports, module) {
|
|
39
|
-
var
|
|
36
|
+
var __extends;
|
|
40
37
|
var __assign2;
|
|
41
38
|
var __rest;
|
|
42
39
|
var __decorate;
|
|
@@ -91,7 +88,7 @@
|
|
|
91
88
|
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
92
89
|
d[p] = b[p];
|
|
93
90
|
};
|
|
94
|
-
|
|
91
|
+
__extends = function(d, b) {
|
|
95
92
|
if (typeof b !== "function" && b !== null)
|
|
96
93
|
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
97
94
|
extendStatics(d, b);
|
|
@@ -316,7 +313,7 @@
|
|
|
316
313
|
ar[i] = from[i];
|
|
317
314
|
}
|
|
318
315
|
}
|
|
319
|
-
return to.concat(ar || from);
|
|
316
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
320
317
|
};
|
|
321
318
|
__await = function(v) {
|
|
322
319
|
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
@@ -434,7 +431,7 @@
|
|
|
434
431
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
435
432
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
436
433
|
};
|
|
437
|
-
exporter("__extends",
|
|
434
|
+
exporter("__extends", __extends);
|
|
438
435
|
exporter("__assign", __assign2);
|
|
439
436
|
exporter("__rest", __rest);
|
|
440
437
|
exporter("__decorate", __decorate);
|
|
@@ -462,309 +459,6 @@
|
|
|
462
459
|
}
|
|
463
460
|
});
|
|
464
461
|
|
|
465
|
-
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/utils.js
|
|
466
|
-
var require_utils = __commonJS({
|
|
467
|
-
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/utils.js": function(exports) {
|
|
468
|
-
"use strict";
|
|
469
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
470
|
-
exports.invariant = exports.UNICODE_EXTENSION_SEQUENCE_REGEX = void 0;
|
|
471
|
-
exports.UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
|
|
472
|
-
function invariant2(condition, message, Err) {
|
|
473
|
-
if (Err === void 0) {
|
|
474
|
-
Err = Error;
|
|
475
|
-
}
|
|
476
|
-
if (!condition) {
|
|
477
|
-
throw new Err(message);
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
exports.invariant = invariant2;
|
|
481
|
-
}
|
|
482
|
-
});
|
|
483
|
-
|
|
484
|
-
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestAvailableLocale.js
|
|
485
|
-
var require_BestAvailableLocale = __commonJS({
|
|
486
|
-
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestAvailableLocale.js": function(exports) {
|
|
487
|
-
"use strict";
|
|
488
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
489
|
-
exports.BestAvailableLocale = void 0;
|
|
490
|
-
function BestAvailableLocale(availableLocales, locale) {
|
|
491
|
-
var candidate = locale;
|
|
492
|
-
while (true) {
|
|
493
|
-
if (availableLocales.has(candidate)) {
|
|
494
|
-
return candidate;
|
|
495
|
-
}
|
|
496
|
-
var pos = candidate.lastIndexOf("-");
|
|
497
|
-
if (!~pos) {
|
|
498
|
-
return void 0;
|
|
499
|
-
}
|
|
500
|
-
if (pos >= 2 && candidate[pos - 2] === "-") {
|
|
501
|
-
pos -= 2;
|
|
502
|
-
}
|
|
503
|
-
candidate = candidate.slice(0, pos);
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
exports.BestAvailableLocale = BestAvailableLocale;
|
|
507
|
-
}
|
|
508
|
-
});
|
|
509
|
-
|
|
510
|
-
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupMatcher.js
|
|
511
|
-
var require_LookupMatcher = __commonJS({
|
|
512
|
-
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupMatcher.js": function(exports) {
|
|
513
|
-
"use strict";
|
|
514
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
515
|
-
exports.LookupMatcher = void 0;
|
|
516
|
-
var utils_1 = require_utils();
|
|
517
|
-
var BestAvailableLocale_1 = require_BestAvailableLocale();
|
|
518
|
-
function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
519
|
-
var result = { locale: "" };
|
|
520
|
-
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
521
|
-
var locale = requestedLocales_1[_i];
|
|
522
|
-
var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
523
|
-
var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
|
|
524
|
-
if (availableLocale) {
|
|
525
|
-
result.locale = availableLocale;
|
|
526
|
-
if (locale !== noExtensionLocale) {
|
|
527
|
-
result.extension = locale.slice(noExtensionLocale.length + 1, locale.length);
|
|
528
|
-
}
|
|
529
|
-
return result;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
result.locale = getDefaultLocale();
|
|
533
|
-
return result;
|
|
534
|
-
}
|
|
535
|
-
exports.LookupMatcher = LookupMatcher;
|
|
536
|
-
}
|
|
537
|
-
});
|
|
538
|
-
|
|
539
|
-
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestFitMatcher.js
|
|
540
|
-
var require_BestFitMatcher = __commonJS({
|
|
541
|
-
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestFitMatcher.js": function(exports) {
|
|
542
|
-
"use strict";
|
|
543
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
544
|
-
exports.BestFitMatcher = void 0;
|
|
545
|
-
var BestAvailableLocale_1 = require_BestAvailableLocale();
|
|
546
|
-
var utils_1 = require_utils();
|
|
547
|
-
function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
548
|
-
var minimizedAvailableLocaleMap = Array.from(availableLocales).reduce(function(all, l2) {
|
|
549
|
-
all[l2] = l2;
|
|
550
|
-
return all;
|
|
551
|
-
}, {});
|
|
552
|
-
var minimizedAvailableLocales = new Set();
|
|
553
|
-
availableLocales.forEach(function(locale2) {
|
|
554
|
-
var minimizedLocale = new Intl.Locale(locale2).minimize().toString();
|
|
555
|
-
minimizedAvailableLocaleMap[minimizedLocale] = locale2;
|
|
556
|
-
minimizedAvailableLocales.add(minimizedLocale);
|
|
557
|
-
});
|
|
558
|
-
var foundLocale;
|
|
559
|
-
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
560
|
-
var l = requestedLocales_1[_i];
|
|
561
|
-
if (foundLocale) {
|
|
562
|
-
break;
|
|
563
|
-
}
|
|
564
|
-
var noExtensionLocale = l.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
565
|
-
if (availableLocales.has(noExtensionLocale)) {
|
|
566
|
-
foundLocale = noExtensionLocale;
|
|
567
|
-
break;
|
|
568
|
-
}
|
|
569
|
-
if (minimizedAvailableLocales.has(noExtensionLocale)) {
|
|
570
|
-
foundLocale = noExtensionLocale;
|
|
571
|
-
break;
|
|
572
|
-
}
|
|
573
|
-
var locale = new Intl.Locale(noExtensionLocale);
|
|
574
|
-
var maximizedRequestedLocale = locale.maximize().toString();
|
|
575
|
-
var minimizedRequestedLocale = locale.minimize().toString();
|
|
576
|
-
if (minimizedAvailableLocales.has(minimizedRequestedLocale)) {
|
|
577
|
-
foundLocale = minimizedRequestedLocale;
|
|
578
|
-
break;
|
|
579
|
-
}
|
|
580
|
-
foundLocale = BestAvailableLocale_1.BestAvailableLocale(minimizedAvailableLocales, maximizedRequestedLocale);
|
|
581
|
-
}
|
|
582
|
-
return {
|
|
583
|
-
locale: foundLocale && minimizedAvailableLocaleMap[foundLocale] || getDefaultLocale()
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
exports.BestFitMatcher = BestFitMatcher;
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
|
|
590
|
-
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/UnicodeExtensionValue.js
|
|
591
|
-
var require_UnicodeExtensionValue = __commonJS({
|
|
592
|
-
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/UnicodeExtensionValue.js": function(exports) {
|
|
593
|
-
"use strict";
|
|
594
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
595
|
-
exports.UnicodeExtensionValue = void 0;
|
|
596
|
-
var utils_1 = require_utils();
|
|
597
|
-
function UnicodeExtensionValue(extension, key) {
|
|
598
|
-
utils_1.invariant(key.length === 2, "key must have 2 elements");
|
|
599
|
-
var size = extension.length;
|
|
600
|
-
var searchValue = "-" + key + "-";
|
|
601
|
-
var pos = extension.indexOf(searchValue);
|
|
602
|
-
if (pos !== -1) {
|
|
603
|
-
var start = pos + 4;
|
|
604
|
-
var end = start;
|
|
605
|
-
var k = start;
|
|
606
|
-
var done = false;
|
|
607
|
-
while (!done) {
|
|
608
|
-
var e = extension.indexOf("-", k);
|
|
609
|
-
var len = void 0;
|
|
610
|
-
if (e === -1) {
|
|
611
|
-
len = size - k;
|
|
612
|
-
} else {
|
|
613
|
-
len = e - k;
|
|
614
|
-
}
|
|
615
|
-
if (len === 2) {
|
|
616
|
-
done = true;
|
|
617
|
-
} else if (e === -1) {
|
|
618
|
-
end = size;
|
|
619
|
-
done = true;
|
|
620
|
-
} else {
|
|
621
|
-
end = e;
|
|
622
|
-
k = e + 1;
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
return extension.slice(start, end);
|
|
626
|
-
}
|
|
627
|
-
searchValue = "-" + key;
|
|
628
|
-
pos = extension.indexOf(searchValue);
|
|
629
|
-
if (pos !== -1 && pos + 3 === size) {
|
|
630
|
-
return "";
|
|
631
|
-
}
|
|
632
|
-
return void 0;
|
|
633
|
-
}
|
|
634
|
-
exports.UnicodeExtensionValue = UnicodeExtensionValue;
|
|
635
|
-
}
|
|
636
|
-
});
|
|
637
|
-
|
|
638
|
-
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/ResolveLocale.js
|
|
639
|
-
var require_ResolveLocale = __commonJS({
|
|
640
|
-
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/ResolveLocale.js": function(exports) {
|
|
641
|
-
"use strict";
|
|
642
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
643
|
-
exports.ResolveLocale = void 0;
|
|
644
|
-
var LookupMatcher_1 = require_LookupMatcher();
|
|
645
|
-
var BestFitMatcher_1 = require_BestFitMatcher();
|
|
646
|
-
var utils_1 = require_utils();
|
|
647
|
-
var UnicodeExtensionValue_1 = require_UnicodeExtensionValue();
|
|
648
|
-
function ResolveLocale2(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData, getDefaultLocale) {
|
|
649
|
-
var matcher = options.localeMatcher;
|
|
650
|
-
var r;
|
|
651
|
-
if (matcher === "lookup") {
|
|
652
|
-
r = LookupMatcher_1.LookupMatcher(availableLocales, requestedLocales, getDefaultLocale);
|
|
653
|
-
} else {
|
|
654
|
-
r = BestFitMatcher_1.BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale);
|
|
655
|
-
}
|
|
656
|
-
var foundLocale = r.locale;
|
|
657
|
-
var result = { locale: "", dataLocale: foundLocale };
|
|
658
|
-
var supportedExtension = "-u";
|
|
659
|
-
for (var _i = 0, relevantExtensionKeys_1 = relevantExtensionKeys; _i < relevantExtensionKeys_1.length; _i++) {
|
|
660
|
-
var key = relevantExtensionKeys_1[_i];
|
|
661
|
-
utils_1.invariant(foundLocale in localeData, "Missing locale data for " + foundLocale);
|
|
662
|
-
var foundLocaleData = localeData[foundLocale];
|
|
663
|
-
utils_1.invariant(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data " + key + " must be an object");
|
|
664
|
-
var keyLocaleData = foundLocaleData[key];
|
|
665
|
-
utils_1.invariant(Array.isArray(keyLocaleData), "keyLocaleData for " + key + " must be an array");
|
|
666
|
-
var value = keyLocaleData[0];
|
|
667
|
-
utils_1.invariant(typeof value === "string" || value === null, "value must be string or null but got " + typeof value + " in key " + key);
|
|
668
|
-
var supportedExtensionAddition = "";
|
|
669
|
-
if (r.extension) {
|
|
670
|
-
var requestedValue = UnicodeExtensionValue_1.UnicodeExtensionValue(r.extension, key);
|
|
671
|
-
if (requestedValue !== void 0) {
|
|
672
|
-
if (requestedValue !== "") {
|
|
673
|
-
if (~keyLocaleData.indexOf(requestedValue)) {
|
|
674
|
-
value = requestedValue;
|
|
675
|
-
supportedExtensionAddition = "-" + key + "-" + value;
|
|
676
|
-
}
|
|
677
|
-
} else if (~requestedValue.indexOf("true")) {
|
|
678
|
-
value = "true";
|
|
679
|
-
supportedExtensionAddition = "-" + key;
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
if (key in options) {
|
|
684
|
-
var optionsValue = options[key];
|
|
685
|
-
utils_1.invariant(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
|
|
686
|
-
if (~keyLocaleData.indexOf(optionsValue)) {
|
|
687
|
-
if (optionsValue !== value) {
|
|
688
|
-
value = optionsValue;
|
|
689
|
-
supportedExtensionAddition = "";
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
result[key] = value;
|
|
694
|
-
supportedExtension += supportedExtensionAddition;
|
|
695
|
-
}
|
|
696
|
-
if (supportedExtension.length > 2) {
|
|
697
|
-
var privateIndex = foundLocale.indexOf("-x-");
|
|
698
|
-
if (privateIndex === -1) {
|
|
699
|
-
foundLocale = foundLocale + supportedExtension;
|
|
700
|
-
} else {
|
|
701
|
-
var preExtension = foundLocale.slice(0, privateIndex);
|
|
702
|
-
var postExtension = foundLocale.slice(privateIndex, foundLocale.length);
|
|
703
|
-
foundLocale = preExtension + supportedExtension + postExtension;
|
|
704
|
-
}
|
|
705
|
-
foundLocale = Intl.getCanonicalLocales(foundLocale)[0];
|
|
706
|
-
}
|
|
707
|
-
result.locale = foundLocale;
|
|
708
|
-
return result;
|
|
709
|
-
}
|
|
710
|
-
exports.ResolveLocale = ResolveLocale2;
|
|
711
|
-
}
|
|
712
|
-
});
|
|
713
|
-
|
|
714
|
-
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupSupportedLocales.js
|
|
715
|
-
var require_LookupSupportedLocales = __commonJS({
|
|
716
|
-
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupSupportedLocales.js": function(exports) {
|
|
717
|
-
"use strict";
|
|
718
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
719
|
-
exports.LookupSupportedLocales = void 0;
|
|
720
|
-
var utils_1 = require_utils();
|
|
721
|
-
var BestAvailableLocale_1 = require_BestAvailableLocale();
|
|
722
|
-
function LookupSupportedLocales2(availableLocales, requestedLocales) {
|
|
723
|
-
var subset = [];
|
|
724
|
-
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
725
|
-
var locale = requestedLocales_1[_i];
|
|
726
|
-
var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
727
|
-
var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
|
|
728
|
-
if (availableLocale) {
|
|
729
|
-
subset.push(availableLocale);
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
return subset;
|
|
733
|
-
}
|
|
734
|
-
exports.LookupSupportedLocales = LookupSupportedLocales2;
|
|
735
|
-
}
|
|
736
|
-
});
|
|
737
|
-
|
|
738
|
-
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/index.js
|
|
739
|
-
var require_intl_localematcher = __commonJS({
|
|
740
|
-
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/index.js": function(exports) {
|
|
741
|
-
"use strict";
|
|
742
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
743
|
-
exports.ResolveLocale = exports.LookupSupportedLocales = exports.match = void 0;
|
|
744
|
-
var ResolveLocale_1 = require_ResolveLocale();
|
|
745
|
-
function match(requestedLocales, availableLocales, defaultLocale, opts) {
|
|
746
|
-
var locales = availableLocales.reduce(function(all, l) {
|
|
747
|
-
all.add(l);
|
|
748
|
-
return all;
|
|
749
|
-
}, new Set());
|
|
750
|
-
return ResolveLocale_1.ResolveLocale(locales, requestedLocales, {
|
|
751
|
-
localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || "best fit"
|
|
752
|
-
}, [], {}, function() {
|
|
753
|
-
return defaultLocale;
|
|
754
|
-
}).locale;
|
|
755
|
-
}
|
|
756
|
-
exports.match = match;
|
|
757
|
-
var LookupSupportedLocales_1 = require_LookupSupportedLocales();
|
|
758
|
-
Object.defineProperty(exports, "LookupSupportedLocales", { enumerable: true, get: function() {
|
|
759
|
-
return LookupSupportedLocales_1.LookupSupportedLocales;
|
|
760
|
-
} });
|
|
761
|
-
var ResolveLocale_2 = require_ResolveLocale();
|
|
762
|
-
Object.defineProperty(exports, "ResolveLocale", { enumerable: true, get: function() {
|
|
763
|
-
return ResolveLocale_2.ResolveLocale;
|
|
764
|
-
} });
|
|
765
|
-
}
|
|
766
|
-
});
|
|
767
|
-
|
|
768
462
|
// bazel-out/darwin-fastbuild/bin/packages/intl-getcanonicallocales/src/parser.js
|
|
769
463
|
var require_parser = __commonJS({
|
|
770
464
|
"bazel-out/darwin-fastbuild/bin/packages/intl-getcanonicallocales/src/parser.js": function(exports) {
|
|
@@ -835,7 +529,7 @@
|
|
|
835
529
|
while (chunks.length && isUnicodeVariantSubtag(chunks[0])) {
|
|
836
530
|
var variant = chunks.shift();
|
|
837
531
|
if (variant in variants) {
|
|
838
|
-
throw new RangeError('Duplicate variant "'
|
|
532
|
+
throw new RangeError('Duplicate variant "'.concat(variant, '"'));
|
|
839
533
|
}
|
|
840
534
|
variants[variant] = 1;
|
|
841
535
|
}
|
|
@@ -906,7 +600,7 @@
|
|
|
906
600
|
value.push(chunks.shift());
|
|
907
601
|
}
|
|
908
602
|
if (!value.length) {
|
|
909
|
-
throw new RangeError('Missing tvalue for tkey "'
|
|
603
|
+
throw new RangeError('Missing tvalue for tkey "'.concat(key, '"'));
|
|
910
604
|
}
|
|
911
605
|
fields.push([key, value.join(exports.SEPARATOR)]);
|
|
912
606
|
}
|
|
@@ -983,7 +677,7 @@
|
|
|
983
677
|
throw new RangeError("Malformed extension type");
|
|
984
678
|
}
|
|
985
679
|
if (type in otherExtensionMap) {
|
|
986
|
-
throw new RangeError("There can only be 1 -"
|
|
680
|
+
throw new RangeError("There can only be 1 -".concat(type, "- extension"));
|
|
987
681
|
}
|
|
988
682
|
var extension = {
|
|
989
683
|
type: type,
|
|
@@ -999,7 +693,7 @@
|
|
|
999
693
|
function parseUnicodeLocaleId2(locale) {
|
|
1000
694
|
var chunks = locale.split(exports.SEPARATOR);
|
|
1001
695
|
var lang = parseUnicodeLanguageId2(chunks);
|
|
1002
|
-
return tslib_1.__assign({ lang: lang }, parseExtensions(chunks));
|
|
696
|
+
return (0, tslib_1.__assign)({ lang: lang }, parseExtensions(chunks));
|
|
1003
697
|
}
|
|
1004
698
|
exports.parseUnicodeLocaleId = parseUnicodeLocaleId2;
|
|
1005
699
|
}
|
|
@@ -1016,7 +710,7 @@
|
|
|
1016
710
|
if (!lang) {
|
|
1017
711
|
return "";
|
|
1018
712
|
}
|
|
1019
|
-
return tslib_1.__spreadArray([lang.lang, lang.script, lang.region], lang.variants || []).filter(Boolean).join("-");
|
|
713
|
+
return (0, tslib_1.__spreadArray)([lang.lang, lang.script, lang.region], lang.variants || [], true).filter(Boolean).join("-");
|
|
1020
714
|
}
|
|
1021
715
|
exports.emitUnicodeLanguageId = emitUnicodeLanguageId2;
|
|
1022
716
|
function emitUnicodeLocaleId2(_a) {
|
|
@@ -1027,14 +721,14 @@
|
|
|
1027
721
|
chunks.push(ext.type);
|
|
1028
722
|
switch (ext.type) {
|
|
1029
723
|
case "u":
|
|
1030
|
-
chunks.push.apply(chunks, tslib_1.__spreadArray(tslib_1.__spreadArray([], ext.attributes), ext.keywords.reduce(function(all, kv) {
|
|
724
|
+
chunks.push.apply(chunks, (0, tslib_1.__spreadArray)((0, tslib_1.__spreadArray)([], ext.attributes, false), ext.keywords.reduce(function(all, kv) {
|
|
1031
725
|
return all.concat(kv);
|
|
1032
|
-
}, [])));
|
|
726
|
+
}, []), false));
|
|
1033
727
|
break;
|
|
1034
728
|
case "t":
|
|
1035
|
-
chunks.push.apply(chunks, tslib_1.__spreadArray([emitUnicodeLanguageId2(ext.lang)], ext.fields.reduce(function(all, kv) {
|
|
729
|
+
chunks.push.apply(chunks, (0, tslib_1.__spreadArray)([emitUnicodeLanguageId2(ext.lang)], ext.fields.reduce(function(all, kv) {
|
|
1036
730
|
return all.concat(kv);
|
|
1037
|
-
}, [])));
|
|
731
|
+
}, []), false));
|
|
1038
732
|
break;
|
|
1039
733
|
default:
|
|
1040
734
|
chunks.push(ext.value);
|
|
@@ -1093,11 +787,13 @@
|
|
|
1093
787
|
"bgm": "bcg",
|
|
1094
788
|
"bh": "bho",
|
|
1095
789
|
"bhk": "fbl",
|
|
790
|
+
"bic": "bir",
|
|
1096
791
|
"bih": "bho",
|
|
1097
792
|
"bis": "bi",
|
|
1098
793
|
"bjd": "drl",
|
|
1099
794
|
"bjq": "bzc",
|
|
1100
795
|
"bkb": "ebk",
|
|
796
|
+
"blg": "iba",
|
|
1101
797
|
"bod": "bo",
|
|
1102
798
|
"bos": "bs",
|
|
1103
799
|
"bre": "br",
|
|
@@ -1360,6 +1056,7 @@
|
|
|
1360
1056
|
"oss": "os",
|
|
1361
1057
|
"oun": "vaj",
|
|
1362
1058
|
"pan": "pa",
|
|
1059
|
+
"pat": "kxr",
|
|
1363
1060
|
"pbu": "ps",
|
|
1364
1061
|
"pcr": "adx",
|
|
1365
1062
|
"per": "fa",
|
|
@@ -2358,6 +2055,7 @@
|
|
|
2358
2055
|
"bkq": "bkq-Latn-ZZ",
|
|
2359
2056
|
"bku": "bku-Latn-PH",
|
|
2360
2057
|
"bkv": "bkv-Latn-ZZ",
|
|
2058
|
+
"blg": "blg-Latn-MY",
|
|
2361
2059
|
"blt": "blt-Tavt-VN",
|
|
2362
2060
|
"bm": "bm-Latn-ML",
|
|
2363
2061
|
"bmh": "bmh-Latn-ZZ",
|
|
@@ -2669,7 +2367,7 @@
|
|
|
2669
2367
|
"hmt": "hmt-Latn-ZZ",
|
|
2670
2368
|
"hnd": "hnd-Arab-PK",
|
|
2671
2369
|
"hne": "hne-Deva-IN",
|
|
2672
|
-
"hnj": "hnj-
|
|
2370
|
+
"hnj": "hnj-Hmnp-US",
|
|
2673
2371
|
"hnn": "hnn-Latn-PH",
|
|
2674
2372
|
"hno": "hno-Arab-PK",
|
|
2675
2373
|
"ho": "ho-Latn-PG",
|
|
@@ -2759,7 +2457,7 @@
|
|
|
2759
2457
|
"kcl": "kcl-Latn-ZZ",
|
|
2760
2458
|
"kct": "kct-Latn-ZZ",
|
|
2761
2459
|
"kde": "kde-Latn-TZ",
|
|
2762
|
-
"kdh": "kdh-
|
|
2460
|
+
"kdh": "kdh-Latn-TG",
|
|
2763
2461
|
"kdl": "kdl-Latn-ZZ",
|
|
2764
2462
|
"kdt": "kdt-Thai-TH",
|
|
2765
2463
|
"kea": "kea-Latn-CV",
|
|
@@ -3127,6 +2825,7 @@
|
|
|
3127
2825
|
"nsn": "nsn-Latn-ZZ",
|
|
3128
2826
|
"nso": "nso-Latn-ZA",
|
|
3129
2827
|
"nss": "nss-Latn-ZZ",
|
|
2828
|
+
"nst": "nst-Tnsa-IN",
|
|
3130
2829
|
"ntm": "ntm-Latn-ZZ",
|
|
3131
2830
|
"ntr": "ntr-Latn-ZZ",
|
|
3132
2831
|
"nui": "nui-Latn-ZZ",
|
|
@@ -3158,6 +2857,7 @@
|
|
|
3158
2857
|
"osa": "osa-Osge-US",
|
|
3159
2858
|
"ota": "ota-Arab-ZZ",
|
|
3160
2859
|
"otk": "otk-Orkh-MN",
|
|
2860
|
+
"oui": "oui-Ougr-143",
|
|
3161
2861
|
"ozm": "ozm-Latn-ZZ",
|
|
3162
2862
|
"pa": "pa-Guru-IN",
|
|
3163
2863
|
"pa-Arab": "pa-Arab-PK",
|
|
@@ -3212,7 +2912,7 @@
|
|
|
3212
2912
|
"rel": "rel-Latn-ZZ",
|
|
3213
2913
|
"res": "res-Latn-ZZ",
|
|
3214
2914
|
"rgn": "rgn-Latn-IT",
|
|
3215
|
-
"rhg": "rhg-
|
|
2915
|
+
"rhg": "rhg-Rohg-MM",
|
|
3216
2916
|
"ria": "ria-Latn-IN",
|
|
3217
2917
|
"rif": "rif-Tfng-MA",
|
|
3218
2918
|
"rif-NL": "rif-Latn-NL",
|
|
@@ -3436,6 +3136,7 @@
|
|
|
3436
3136
|
"twh": "twh-Latn-ZZ",
|
|
3437
3137
|
"twq": "twq-Latn-NE",
|
|
3438
3138
|
"txg": "txg-Tang-CN",
|
|
3139
|
+
"txo": "txo-Toto-IN",
|
|
3439
3140
|
"ty": "ty-Latn-PF",
|
|
3440
3141
|
"tya": "tya-Latn-ZZ",
|
|
3441
3142
|
"tyv": "tyv-Cyrl-RU",
|
|
@@ -3562,6 +3263,8 @@
|
|
|
3562
3263
|
"und-CO": "es-Latn-CO",
|
|
3563
3264
|
"und-Copt": "cop-Copt-EG",
|
|
3564
3265
|
"und-CP": "und-Latn-CP",
|
|
3266
|
+
"und-Cpmn": "und-Cpmn-CY",
|
|
3267
|
+
"und-Cpmn-CY": "und-Cpmn-CY",
|
|
3565
3268
|
"und-Cprt": "grc-Cprt-CY",
|
|
3566
3269
|
"und-CR": "es-Latn-CR",
|
|
3567
3270
|
"und-CU": "es-Latn-CU",
|
|
@@ -3648,7 +3351,7 @@
|
|
|
3648
3351
|
"und-Hluw": "hlu-Hluw-TR",
|
|
3649
3352
|
"und-HM": "und-Latn-HM",
|
|
3650
3353
|
"und-Hmng": "hnj-Hmng-LA",
|
|
3651
|
-
"und-Hmnp": "
|
|
3354
|
+
"und-Hmnp": "hnj-Hmnp-US",
|
|
3652
3355
|
"und-HN": "es-Latn-HN",
|
|
3653
3356
|
"und-HR": "hr-Latn-HR",
|
|
3654
3357
|
"und-HT": "ht-Latn-HT",
|
|
@@ -3779,6 +3482,7 @@
|
|
|
3779
3482
|
"und-Orya": "or-Orya-IN",
|
|
3780
3483
|
"und-Osge": "osa-Osge-US",
|
|
3781
3484
|
"und-Osma": "so-Osma-SO",
|
|
3485
|
+
"und-Ougr": "oui-Ougr-143",
|
|
3782
3486
|
"und-PA": "es-Latn-PA",
|
|
3783
3487
|
"und-Palm": "arc-Palm-SY",
|
|
3784
3488
|
"und-Pauc": "ctd-Pauc-MM",
|
|
@@ -3867,7 +3571,9 @@
|
|
|
3867
3571
|
"und-TL": "pt-Latn-TL",
|
|
3868
3572
|
"und-TM": "tk-Latn-TM",
|
|
3869
3573
|
"und-TN": "ar-Arab-TN",
|
|
3574
|
+
"und-Tnsa": "nst-Tnsa-IN",
|
|
3870
3575
|
"und-TO": "to-Latn-TO",
|
|
3576
|
+
"und-Toto": "txo-Toto-IN",
|
|
3871
3577
|
"und-TR": "tr-Latn-TR",
|
|
3872
3578
|
"und-TV": "tvl-Latn-TV",
|
|
3873
3579
|
"und-TW": "zh-Hant-TW",
|
|
@@ -3880,6 +3586,7 @@
|
|
|
3880
3586
|
"und-VA": "it-Latn-VA",
|
|
3881
3587
|
"und-Vaii": "vai-Vaii-LR",
|
|
3882
3588
|
"und-VE": "es-Latn-VE",
|
|
3589
|
+
"und-Vith": "sq-Vith-AL",
|
|
3883
3590
|
"und-VN": "vi-Latn-VN",
|
|
3884
3591
|
"und-VU": "bi-Latn-VU",
|
|
3885
3592
|
"und-Wara": "hoc-Wara-IN",
|
|
@@ -4096,7 +3803,7 @@
|
|
|
4096
3803
|
return e1.type < e2.type ? -1 : e1.type > e2.type ? 1 : 0;
|
|
4097
3804
|
}
|
|
4098
3805
|
function mergeVariants(v1, v2) {
|
|
4099
|
-
var result = tslib_1.__spreadArray([], v1);
|
|
3806
|
+
var result = (0, tslib_1.__spreadArray)([], v1, true);
|
|
4100
3807
|
for (var _i = 0, v2_1 = v2; _i < v2_1.length; _i++) {
|
|
4101
3808
|
var v = v2_1[_i];
|
|
4102
3809
|
if (v1.indexOf(v) < 0) {
|
|
@@ -4111,11 +3818,11 @@
|
|
|
4111
3818
|
var replacedLang_1 = "";
|
|
4112
3819
|
for (var _i = 0, _a = unicodeLanguageId.variants; _i < _a.length; _i++) {
|
|
4113
3820
|
var variant = _a[_i];
|
|
4114
|
-
if (replacedLang_1 = aliases_generated_1.languageAlias[emitter_1.emitUnicodeLanguageId({
|
|
3821
|
+
if (replacedLang_1 = aliases_generated_1.languageAlias[(0, emitter_1.emitUnicodeLanguageId)({
|
|
4115
3822
|
lang: unicodeLanguageId.lang,
|
|
4116
3823
|
variants: [variant]
|
|
4117
3824
|
})]) {
|
|
4118
|
-
var replacedLangAst = parser_1.parseUnicodeLanguageId(replacedLang_1.split(parser_1.SEPARATOR));
|
|
3825
|
+
var replacedLangAst = (0, parser_1.parseUnicodeLanguageId)(replacedLang_1.split(parser_1.SEPARATOR));
|
|
4119
3826
|
finalLangAst = {
|
|
4120
3827
|
lang: replacedLangAst.lang,
|
|
4121
3828
|
script: finalLangAst.script || replacedLangAst.script,
|
|
@@ -4127,14 +3834,14 @@
|
|
|
4127
3834
|
}
|
|
4128
3835
|
}
|
|
4129
3836
|
if (finalLangAst.script && finalLangAst.region) {
|
|
4130
|
-
var replacedLang_2 = aliases_generated_1.languageAlias[emitter_1.emitUnicodeLanguageId({
|
|
3837
|
+
var replacedLang_2 = aliases_generated_1.languageAlias[(0, emitter_1.emitUnicodeLanguageId)({
|
|
4131
3838
|
lang: finalLangAst.lang,
|
|
4132
3839
|
script: finalLangAst.script,
|
|
4133
3840
|
region: finalLangAst.region,
|
|
4134
3841
|
variants: []
|
|
4135
3842
|
})];
|
|
4136
3843
|
if (replacedLang_2) {
|
|
4137
|
-
var replacedLangAst = parser_1.parseUnicodeLanguageId(replacedLang_2.split(parser_1.SEPARATOR));
|
|
3844
|
+
var replacedLangAst = (0, parser_1.parseUnicodeLanguageId)(replacedLang_2.split(parser_1.SEPARATOR));
|
|
4138
3845
|
finalLangAst = {
|
|
4139
3846
|
lang: replacedLangAst.lang,
|
|
4140
3847
|
script: replacedLangAst.script,
|
|
@@ -4144,13 +3851,13 @@
|
|
|
4144
3851
|
}
|
|
4145
3852
|
}
|
|
4146
3853
|
if (finalLangAst.region) {
|
|
4147
|
-
var replacedLang_3 = aliases_generated_1.languageAlias[emitter_1.emitUnicodeLanguageId({
|
|
3854
|
+
var replacedLang_3 = aliases_generated_1.languageAlias[(0, emitter_1.emitUnicodeLanguageId)({
|
|
4148
3855
|
lang: finalLangAst.lang,
|
|
4149
3856
|
region: finalLangAst.region,
|
|
4150
3857
|
variants: []
|
|
4151
3858
|
})];
|
|
4152
3859
|
if (replacedLang_3) {
|
|
4153
|
-
var replacedLangAst = parser_1.parseUnicodeLanguageId(replacedLang_3.split(parser_1.SEPARATOR));
|
|
3860
|
+
var replacedLangAst = (0, parser_1.parseUnicodeLanguageId)(replacedLang_3.split(parser_1.SEPARATOR));
|
|
4154
3861
|
finalLangAst = {
|
|
4155
3862
|
lang: replacedLangAst.lang,
|
|
4156
3863
|
script: finalLangAst.script || replacedLangAst.script,
|
|
@@ -4159,12 +3866,12 @@
|
|
|
4159
3866
|
};
|
|
4160
3867
|
}
|
|
4161
3868
|
}
|
|
4162
|
-
var replacedLang = aliases_generated_1.languageAlias[emitter_1.emitUnicodeLanguageId({
|
|
3869
|
+
var replacedLang = aliases_generated_1.languageAlias[(0, emitter_1.emitUnicodeLanguageId)({
|
|
4163
3870
|
lang: finalLangAst.lang,
|
|
4164
3871
|
variants: []
|
|
4165
3872
|
})];
|
|
4166
3873
|
if (replacedLang) {
|
|
4167
|
-
var replacedLangAst = parser_1.parseUnicodeLanguageId(replacedLang.split(parser_1.SEPARATOR));
|
|
3874
|
+
var replacedLangAst = (0, parser_1.parseUnicodeLanguageId)(replacedLang.split(parser_1.SEPARATOR));
|
|
4168
3875
|
finalLangAst = {
|
|
4169
3876
|
lang: replacedLangAst.lang,
|
|
4170
3877
|
script: finalLangAst.script || replacedLangAst.script,
|
|
@@ -4179,13 +3886,13 @@
|
|
|
4179
3886
|
if (regionAlias) {
|
|
4180
3887
|
var regions = regionAlias.split(" ");
|
|
4181
3888
|
replacedRegion = regions[0];
|
|
4182
|
-
var likelySubtag = likelySubtags_generated_1.likelySubtags[emitter_1.emitUnicodeLanguageId({
|
|
3889
|
+
var likelySubtag = likelySubtags_generated_1.likelySubtags[(0, emitter_1.emitUnicodeLanguageId)({
|
|
4183
3890
|
lang: finalLangAst.lang,
|
|
4184
3891
|
script: finalLangAst.script,
|
|
4185
3892
|
variants: []
|
|
4186
3893
|
})];
|
|
4187
3894
|
if (likelySubtag) {
|
|
4188
|
-
var likelyRegion = parser_1.parseUnicodeLanguageId(likelySubtag.split(parser_1.SEPARATOR)).region;
|
|
3895
|
+
var likelyRegion = (0, parser_1.parseUnicodeLanguageId)(likelySubtag.split(parser_1.SEPARATOR)).region;
|
|
4189
3896
|
if (likelyRegion && regions.indexOf(likelyRegion) > -1) {
|
|
4190
3897
|
replacedRegion = likelyRegion;
|
|
4191
3898
|
}
|
|
@@ -4207,9 +3914,9 @@
|
|
|
4207
3914
|
var variant = finalLangAst.variants[i].toLowerCase();
|
|
4208
3915
|
if (aliases_generated_1.variantAlias[variant]) {
|
|
4209
3916
|
var alias = aliases_generated_1.variantAlias[variant];
|
|
4210
|
-
if (parser_1.isUnicodeVariantSubtag(alias)) {
|
|
3917
|
+
if ((0, parser_1.isUnicodeVariantSubtag)(alias)) {
|
|
4211
3918
|
finalLangAst.variants[i] = alias;
|
|
4212
|
-
} else if (parser_1.isUnicodeLanguageSubtag(alias)) {
|
|
3919
|
+
} else if ((0, parser_1.isUnicodeLanguageSubtag)(alias)) {
|
|
4213
3920
|
finalLangAst.lang = alias;
|
|
4214
3921
|
}
|
|
4215
3922
|
}
|
|
@@ -4268,7 +3975,7 @@
|
|
|
4268
3975
|
var parser_1 = require_parser();
|
|
4269
3976
|
var emitter_1 = require_emitter();
|
|
4270
3977
|
var canonicalizer_1 = require_canonicalizer();
|
|
4271
|
-
function
|
|
3978
|
+
function CanonicalizeLocaleList(locales) {
|
|
4272
3979
|
if (locales === void 0) {
|
|
4273
3980
|
return [];
|
|
4274
3981
|
}
|
|
@@ -4278,7 +3985,7 @@
|
|
|
4278
3985
|
}
|
|
4279
3986
|
for (var _i = 0, locales_1 = locales; _i < locales_1.length; _i++) {
|
|
4280
3987
|
var locale = locales_1[_i];
|
|
4281
|
-
var canonicalizedTag = emitter_1.emitUnicodeLocaleId(canonicalizer_1.canonicalizeUnicodeLocaleId(parser_1.parseUnicodeLocaleId(locale)));
|
|
3988
|
+
var canonicalizedTag = (0, emitter_1.emitUnicodeLocaleId)((0, canonicalizer_1.canonicalizeUnicodeLocaleId)((0, parser_1.parseUnicodeLocaleId)(locale)));
|
|
4282
3989
|
if (seen.indexOf(canonicalizedTag) < 0) {
|
|
4283
3990
|
seen.push(canonicalizedTag);
|
|
4284
3991
|
}
|
|
@@ -4286,7 +3993,7 @@
|
|
|
4286
3993
|
return seen;
|
|
4287
3994
|
}
|
|
4288
3995
|
function getCanonicalLocales(locales) {
|
|
4289
|
-
return
|
|
3996
|
+
return CanonicalizeLocaleList(locales);
|
|
4290
3997
|
}
|
|
4291
3998
|
exports.getCanonicalLocales = getCanonicalLocales;
|
|
4292
3999
|
var parser_2 = require_parser();
|
|
@@ -4308,14 +4015,14 @@
|
|
|
4308
4015
|
Object.defineProperty(exports, "isUnicodeLanguageSubtag", { enumerable: true, get: function() {
|
|
4309
4016
|
return parser_2.isUnicodeLanguageSubtag;
|
|
4310
4017
|
} });
|
|
4311
|
-
tslib_1.__exportStar(require_types(), exports);
|
|
4312
|
-
tslib_1.__exportStar(require_emitter(), exports);
|
|
4313
|
-
tslib_1.__exportStar(require_likelySubtags_generated(), exports);
|
|
4018
|
+
(0, tslib_1.__exportStar)(require_types(), exports);
|
|
4019
|
+
(0, tslib_1.__exportStar)(require_emitter(), exports);
|
|
4020
|
+
(0, tslib_1.__exportStar)(require_likelySubtags_generated(), exports);
|
|
4314
4021
|
}
|
|
4315
4022
|
});
|
|
4316
4023
|
|
|
4317
4024
|
// bazel-out/darwin-fastbuild/bin/packages/intl-locale/lib/index.js
|
|
4318
|
-
var
|
|
4025
|
+
var import_tslib = __toESM(require_tslib());
|
|
4319
4026
|
|
|
4320
4027
|
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/262.js
|
|
4321
4028
|
function ToString(o) {
|
|
@@ -4372,64 +4079,13 @@
|
|
|
4372
4079
|
if (values !== void 0 && !values.filter(function(val) {
|
|
4373
4080
|
return val == value;
|
|
4374
4081
|
}).length) {
|
|
4375
|
-
throw new RangeError(value
|
|
4082
|
+
throw new RangeError("".concat(value, " is not within ").concat(values.join(", ")));
|
|
4376
4083
|
}
|
|
4377
4084
|
return value;
|
|
4378
4085
|
}
|
|
4379
4086
|
return fallback;
|
|
4380
4087
|
}
|
|
4381
4088
|
|
|
4382
|
-
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/IsSanctionedSimpleUnitIdentifier.js
|
|
4383
|
-
var SANCTIONED_UNITS = [
|
|
4384
|
-
"angle-degree",
|
|
4385
|
-
"area-acre",
|
|
4386
|
-
"area-hectare",
|
|
4387
|
-
"concentr-percent",
|
|
4388
|
-
"digital-bit",
|
|
4389
|
-
"digital-byte",
|
|
4390
|
-
"digital-gigabit",
|
|
4391
|
-
"digital-gigabyte",
|
|
4392
|
-
"digital-kilobit",
|
|
4393
|
-
"digital-kilobyte",
|
|
4394
|
-
"digital-megabit",
|
|
4395
|
-
"digital-megabyte",
|
|
4396
|
-
"digital-petabyte",
|
|
4397
|
-
"digital-terabit",
|
|
4398
|
-
"digital-terabyte",
|
|
4399
|
-
"duration-day",
|
|
4400
|
-
"duration-hour",
|
|
4401
|
-
"duration-millisecond",
|
|
4402
|
-
"duration-minute",
|
|
4403
|
-
"duration-month",
|
|
4404
|
-
"duration-second",
|
|
4405
|
-
"duration-week",
|
|
4406
|
-
"duration-year",
|
|
4407
|
-
"length-centimeter",
|
|
4408
|
-
"length-foot",
|
|
4409
|
-
"length-inch",
|
|
4410
|
-
"length-kilometer",
|
|
4411
|
-
"length-meter",
|
|
4412
|
-
"length-mile-scandinavian",
|
|
4413
|
-
"length-mile",
|
|
4414
|
-
"length-millimeter",
|
|
4415
|
-
"length-yard",
|
|
4416
|
-
"mass-gram",
|
|
4417
|
-
"mass-kilogram",
|
|
4418
|
-
"mass-ounce",
|
|
4419
|
-
"mass-pound",
|
|
4420
|
-
"mass-stone",
|
|
4421
|
-
"temperature-celsius",
|
|
4422
|
-
"temperature-fahrenheit",
|
|
4423
|
-
"volume-fluid-ounce",
|
|
4424
|
-
"volume-gallon",
|
|
4425
|
-
"volume-liter",
|
|
4426
|
-
"volume-milliliter"
|
|
4427
|
-
];
|
|
4428
|
-
function removeUnitNamespace(unit) {
|
|
4429
|
-
return unit.slice(unit.indexOf("-") + 1);
|
|
4430
|
-
}
|
|
4431
|
-
var SIMPLE_UNITS = SANCTIONED_UNITS.map(removeUnitNamespace);
|
|
4432
|
-
|
|
4433
4089
|
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/utils.js
|
|
4434
4090
|
function invariant(condition, message, Err) {
|
|
4435
4091
|
if (Err === void 0) {
|
|
@@ -4440,44 +4096,11 @@
|
|
|
4440
4096
|
}
|
|
4441
4097
|
}
|
|
4442
4098
|
|
|
4443
|
-
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/regex.generated.js
|
|
4444
|
-
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]/;
|
|
4445
|
-
|
|
4446
|
-
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/NumberFormat/format_to_parts.js
|
|
4447
|
-
var CARET_S_UNICODE_REGEX = new RegExp("^" + S_UNICODE_REGEX.source);
|
|
4448
|
-
var S_DOLLAR_UNICODE_REGEX = new RegExp(S_UNICODE_REGEX.source + "$");
|
|
4449
|
-
|
|
4450
|
-
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/NumberFormat/InitializeNumberFormat.js
|
|
4451
|
-
var import_intl_localematcher = __toModule(require_intl_localematcher());
|
|
4452
|
-
|
|
4453
|
-
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/SupportedLocales.js
|
|
4454
|
-
var import_intl_localematcher2 = __toModule(require_intl_localematcher());
|
|
4455
|
-
|
|
4456
|
-
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/data.js
|
|
4457
|
-
var import_tslib = __toModule(require_tslib());
|
|
4458
|
-
var MissingLocaleDataError = function(_super) {
|
|
4459
|
-
(0, import_tslib.__extends)(MissingLocaleDataError2, _super);
|
|
4460
|
-
function MissingLocaleDataError2() {
|
|
4461
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
4462
|
-
_this.type = "MISSING_LOCALE_DATA";
|
|
4463
|
-
return _this;
|
|
4464
|
-
}
|
|
4465
|
-
return MissingLocaleDataError2;
|
|
4466
|
-
}(Error);
|
|
4467
|
-
|
|
4468
|
-
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/types/date-time.js
|
|
4469
|
-
var RangePatternType;
|
|
4470
|
-
(function(RangePatternType2) {
|
|
4471
|
-
RangePatternType2["startRange"] = "startRange";
|
|
4472
|
-
RangePatternType2["shared"] = "shared";
|
|
4473
|
-
RangePatternType2["endRange"] = "endRange";
|
|
4474
|
-
})(RangePatternType || (RangePatternType = {}));
|
|
4475
|
-
|
|
4476
4099
|
// bazel-out/darwin-fastbuild/bin/packages/intl-locale/lib/index.js
|
|
4477
|
-
var import_intl_getcanonicallocales =
|
|
4100
|
+
var import_intl_getcanonicallocales = __toESM(require_intl_getcanonicallocales());
|
|
4478
4101
|
|
|
4479
4102
|
// bazel-out/darwin-fastbuild/bin/packages/intl-locale/lib/get_internal_slots.js
|
|
4480
|
-
var internalSlotMap = new WeakMap();
|
|
4103
|
+
var internalSlotMap = /* @__PURE__ */ new WeakMap();
|
|
4481
4104
|
function getInternalSlots(x) {
|
|
4482
4105
|
var internalSlots = internalSlotMap.get(x);
|
|
4483
4106
|
if (!internalSlots) {
|
|
@@ -4515,7 +4138,7 @@
|
|
|
4515
4138
|
if (region !== void 0) {
|
|
4516
4139
|
languageId.region = region;
|
|
4517
4140
|
}
|
|
4518
|
-
return Intl.getCanonicalLocales((0, import_intl_getcanonicallocales.emitUnicodeLocaleId)((0,
|
|
4141
|
+
return Intl.getCanonicalLocales((0, import_intl_getcanonicallocales.emitUnicodeLocaleId)((0, import_tslib.__assign)((0, import_tslib.__assign)({}, (0, import_intl_getcanonicallocales.parseUnicodeLocaleId)(tag)), { lang: languageId })))[0];
|
|
4519
4142
|
}
|
|
4520
4143
|
function applyUnicodeExtensionToTag(tag, options, relevantExtensionKeys) {
|
|
4521
4144
|
var unicodeExtension;
|
|
@@ -4540,10 +4163,10 @@
|
|
|
4540
4163
|
value = entry[1];
|
|
4541
4164
|
}
|
|
4542
4165
|
}
|
|
4543
|
-
invariant(key in options, key
|
|
4166
|
+
invariant(key in options, "".concat(key, " must be in options"));
|
|
4544
4167
|
var optionsValue = options[key];
|
|
4545
4168
|
if (optionsValue !== void 0) {
|
|
4546
|
-
invariant(typeof optionsValue === "string", "Value for "
|
|
4169
|
+
invariant(typeof optionsValue === "string", "Value for ".concat(key, " must be a string"));
|
|
4547
4170
|
value = optionsValue;
|
|
4548
4171
|
if (entry) {
|
|
4549
4172
|
entry[1] = value;
|
|
@@ -4583,7 +4206,7 @@
|
|
|
4583
4206
|
lang: !lang || lang === "und" ? replacement.lang : lang,
|
|
4584
4207
|
script: script || replacement.script,
|
|
4585
4208
|
region: region || replacement.region,
|
|
4586
|
-
variants: (0,
|
|
4209
|
+
variants: (0, import_tslib.__spreadArray)((0, import_tslib.__spreadArray)([], variants, true), replacement.variants, true)
|
|
4587
4210
|
};
|
|
4588
4211
|
}
|
|
4589
4212
|
function addLikelySubtags(tag) {
|
|
@@ -4627,23 +4250,23 @@
|
|
|
4627
4250
|
if (!maxLocale) {
|
|
4628
4251
|
return tag;
|
|
4629
4252
|
}
|
|
4630
|
-
maxLocale = (0, import_intl_getcanonicallocales.emitUnicodeLanguageId)((0,
|
|
4253
|
+
maxLocale = (0, import_intl_getcanonicallocales.emitUnicodeLanguageId)((0, import_tslib.__assign)((0, import_tslib.__assign)({}, (0, import_intl_getcanonicallocales.parseUnicodeLanguageId)(maxLocale)), { variants: [] }));
|
|
4631
4254
|
var ast = (0, import_intl_getcanonicallocales.parseUnicodeLocaleId)(tag);
|
|
4632
4255
|
var _a = ast.lang, lang = _a.lang, script = _a.script, region = _a.region, variants = _a.variants;
|
|
4633
4256
|
var trial = addLikelySubtags((0, import_intl_getcanonicallocales.emitUnicodeLanguageId)({ lang: lang, variants: [] }));
|
|
4634
4257
|
if (trial === maxLocale) {
|
|
4635
|
-
return (0, import_intl_getcanonicallocales.emitUnicodeLocaleId)((0,
|
|
4258
|
+
return (0, import_intl_getcanonicallocales.emitUnicodeLocaleId)((0, import_tslib.__assign)((0, import_tslib.__assign)({}, ast), { lang: mergeUnicodeLanguageId(lang, void 0, void 0, variants) }));
|
|
4636
4259
|
}
|
|
4637
4260
|
if (region) {
|
|
4638
4261
|
var trial_1 = addLikelySubtags((0, import_intl_getcanonicallocales.emitUnicodeLanguageId)({ lang: lang, region: region, variants: [] }));
|
|
4639
4262
|
if (trial_1 === maxLocale) {
|
|
4640
|
-
return (0, import_intl_getcanonicallocales.emitUnicodeLocaleId)((0,
|
|
4263
|
+
return (0, import_intl_getcanonicallocales.emitUnicodeLocaleId)((0, import_tslib.__assign)((0, import_tslib.__assign)({}, ast), { lang: mergeUnicodeLanguageId(lang, void 0, region, variants) }));
|
|
4641
4264
|
}
|
|
4642
4265
|
}
|
|
4643
4266
|
if (script) {
|
|
4644
4267
|
var trial_2 = addLikelySubtags((0, import_intl_getcanonicallocales.emitUnicodeLanguageId)({ lang: lang, script: script, variants: [] }));
|
|
4645
4268
|
if (trial_2 === maxLocale) {
|
|
4646
|
-
return (0, import_intl_getcanonicallocales.emitUnicodeLocaleId)((0,
|
|
4269
|
+
return (0, import_intl_getcanonicallocales.emitUnicodeLocaleId)((0, import_tslib.__assign)((0, import_tslib.__assign)({}, ast), { lang: mergeUnicodeLanguageId(lang, script, void 0, variants) }));
|
|
4647
4270
|
}
|
|
4648
4271
|
}
|
|
4649
4272
|
return tag;
|
package/polyfill.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var _1 = require("./");
|
|
4
4
|
var should_polyfill_1 = require("./should-polyfill");
|
|
5
|
-
if (should_polyfill_1.shouldPolyfill()) {
|
|
5
|
+
if ((0, should_polyfill_1.shouldPolyfill)()) {
|
|
6
6
|
Object.defineProperty(Intl, 'Locale', {
|
|
7
7
|
value: _1.Locale,
|
|
8
8
|
writable: true,
|