@formatjs/intl-displaynames 4.0.6 → 4.0.7
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.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +9 -27
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +10 -28
- package/package.json +2 -2
- package/polyfill.umd.js +40 -27
- package/polyfill.umd.min.js +1 -1
package/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare class DisplayNames {
|
|
|
15
15
|
constructor(locales: string | string[] | undefined, options: DisplayNamesOptions);
|
|
16
16
|
static supportedLocalesOf(locales?: string | string[], options?: Pick<DisplayNamesOptions, 'localeMatcher'>): string[];
|
|
17
17
|
static __addLocaleData(...data: DisplayNamesLocaleData[]): void;
|
|
18
|
-
of(code: string | number |
|
|
18
|
+
of(code: string | number | Record<string, unknown>): string | undefined;
|
|
19
19
|
resolvedOptions(): DisplayNamesResolvedOptions;
|
|
20
20
|
static localeData: Record<string, DisplayNamesData | undefined>;
|
|
21
21
|
private static availableLocales;
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-displaynames/index.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,sBAAsB,EACtB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-displaynames/index.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,sBAAsB,EACtB,gBAAgB,EAKjB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IACtC,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;IACpC,IAAI,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;IACpD,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;IACjD,IAAI,EAAE,WAAW,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/C,QAAQ,EAAE,WAAW,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC;CACxD;AAED,qBAAa,YAAY;gBAErB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,EACtC,OAAO,EAAE,mBAAmB;IAkF9B,MAAM,CAAC,kBAAkB,CACvB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,eAAe,CAAC,GACnD,MAAM,EAAE;IAQX,MAAM,CAAC,eAAe,CAAC,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAAG,IAAI;IAgB/D,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS;IA4DvE,eAAe,IAAI,2BAA2B;IAc9C,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC,CAAM;IACrE,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAqB;IACpD,OAAO,CAAC,MAAM,CAAC,eAAe,CAAM;IACpC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAG/B,gBAAuB,UAAU,QAAQ;CAC1C"}
|
package/index.js
CHANGED
|
@@ -70,36 +70,18 @@ var DisplayNames = /** @class */ (function () {
|
|
|
70
70
|
}
|
|
71
71
|
var _a = ecma402_abstract_1.getMultiInternalSlots(__INTERNAL_SLOT_MAP__, this, 'localeData', 'style', 'fallback'), localeData = _a.localeData, style = _a.style, fallback = _a.fallback;
|
|
72
72
|
// Canonicalize the case.
|
|
73
|
-
var canonicalCode;
|
|
73
|
+
var canonicalCode = ecma402_abstract_1.CanonicalCodeForDisplayNames(type, codeAsString);
|
|
74
74
|
// This is only used to store extracted language region.
|
|
75
75
|
var regionSubTag;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var regionMatch = /-([a-z]{2}|\d{3})\b/i.exec(canonicalCode);
|
|
81
|
-
if (regionMatch) {
|
|
82
|
-
// Remove region subtag
|
|
83
|
-
canonicalCode =
|
|
84
|
-
canonicalCode.substring(0, regionMatch.index) +
|
|
85
|
-
canonicalCode.substring(regionMatch.index + regionMatch[0].length);
|
|
86
|
-
regionSubTag = regionMatch[1];
|
|
87
|
-
}
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
// currency code should be all upper-case.
|
|
91
|
-
case 'currency':
|
|
92
|
-
canonicalCode = codeAsString.toUpperCase();
|
|
93
|
-
break;
|
|
94
|
-
// script code should be title case
|
|
95
|
-
case 'script':
|
|
76
|
+
if (type === 'language') {
|
|
77
|
+
var regionMatch = /-([a-z]{2}|\d{3})\b/i.exec(canonicalCode);
|
|
78
|
+
if (regionMatch) {
|
|
79
|
+
// Remove region subtag
|
|
96
80
|
canonicalCode =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
canonicalCode = codeAsString.toUpperCase();
|
|
102
|
-
break;
|
|
81
|
+
canonicalCode.substring(0, regionMatch.index) +
|
|
82
|
+
canonicalCode.substring(regionMatch.index + regionMatch[0].length);
|
|
83
|
+
regionSubTag = regionMatch[1];
|
|
84
|
+
}
|
|
103
85
|
}
|
|
104
86
|
var typesData = localeData.types[type];
|
|
105
87
|
// If the style of choice does not exist, fallback to "long".
|
package/lib/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare class DisplayNames {
|
|
|
15
15
|
constructor(locales: string | string[] | undefined, options: DisplayNamesOptions);
|
|
16
16
|
static supportedLocalesOf(locales?: string | string[], options?: Pick<DisplayNamesOptions, 'localeMatcher'>): string[];
|
|
17
17
|
static __addLocaleData(...data: DisplayNamesLocaleData[]): void;
|
|
18
|
-
of(code: string | number |
|
|
18
|
+
of(code: string | number | Record<string, unknown>): string | undefined;
|
|
19
19
|
resolvedOptions(): DisplayNamesResolvedOptions;
|
|
20
20
|
static localeData: Record<string, DisplayNamesData | undefined>;
|
|
21
21
|
private static availableLocales;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-displaynames/index.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,sBAAsB,EACtB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-displaynames/index.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,sBAAsB,EACtB,gBAAgB,EAKjB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IACtC,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;IACpC,IAAI,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;IACpD,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;IACjD,IAAI,EAAE,WAAW,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/C,QAAQ,EAAE,WAAW,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC;CACxD;AAED,qBAAa,YAAY;gBAErB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,EACtC,OAAO,EAAE,mBAAmB;IAkF9B,MAAM,CAAC,kBAAkB,CACvB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,eAAe,CAAC,GACnD,MAAM,EAAE;IAQX,MAAM,CAAC,eAAe,CAAC,GAAG,IAAI,EAAE,sBAAsB,EAAE,GAAG,IAAI;IAgB/D,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS;IA4DvE,eAAe,IAAI,2BAA2B;IAc9C,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC,CAAM;IACrE,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAqB;IACpD,OAAO,CAAC,MAAM,CAAC,eAAe,CAAM;IACpC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAG/B,gBAAuB,UAAU,QAAQ;CAC1C"}
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
|
-
import { getInternalSlot, setInternalSlot, GetOption, ResolveLocale, invariant, SupportedLocales, IsWellFormedCurrencyCode, getMultiInternalSlots, ToString, CanonicalizeLocaleList, ToObject, } from '@formatjs/ecma402-abstract';
|
|
2
|
+
import { getInternalSlot, setInternalSlot, GetOption, ResolveLocale, invariant, SupportedLocales, IsWellFormedCurrencyCode, getMultiInternalSlots, ToString, CanonicalizeLocaleList, ToObject, CanonicalCodeForDisplayNames, } from '@formatjs/ecma402-abstract';
|
|
3
3
|
var DisplayNames = /** @class */ (function () {
|
|
4
4
|
function DisplayNames(locales, options) {
|
|
5
5
|
var _newTarget = this.constructor;
|
|
@@ -67,36 +67,18 @@ var DisplayNames = /** @class */ (function () {
|
|
|
67
67
|
}
|
|
68
68
|
var _a = getMultiInternalSlots(__INTERNAL_SLOT_MAP__, this, 'localeData', 'style', 'fallback'), localeData = _a.localeData, style = _a.style, fallback = _a.fallback;
|
|
69
69
|
// Canonicalize the case.
|
|
70
|
-
var canonicalCode;
|
|
70
|
+
var canonicalCode = CanonicalCodeForDisplayNames(type, codeAsString);
|
|
71
71
|
// This is only used to store extracted language region.
|
|
72
72
|
var regionSubTag;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var regionMatch = /-([a-z]{2}|\d{3})\b/i.exec(canonicalCode);
|
|
78
|
-
if (regionMatch) {
|
|
79
|
-
// Remove region subtag
|
|
80
|
-
canonicalCode =
|
|
81
|
-
canonicalCode.substring(0, regionMatch.index) +
|
|
82
|
-
canonicalCode.substring(regionMatch.index + regionMatch[0].length);
|
|
83
|
-
regionSubTag = regionMatch[1];
|
|
84
|
-
}
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
// currency code should be all upper-case.
|
|
88
|
-
case 'currency':
|
|
89
|
-
canonicalCode = codeAsString.toUpperCase();
|
|
90
|
-
break;
|
|
91
|
-
// script code should be title case
|
|
92
|
-
case 'script':
|
|
73
|
+
if (type === 'language') {
|
|
74
|
+
var regionMatch = /-([a-z]{2}|\d{3})\b/i.exec(canonicalCode);
|
|
75
|
+
if (regionMatch) {
|
|
76
|
+
// Remove region subtag
|
|
93
77
|
canonicalCode =
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
canonicalCode = codeAsString.toUpperCase();
|
|
99
|
-
break;
|
|
78
|
+
canonicalCode.substring(0, regionMatch.index) +
|
|
79
|
+
canonicalCode.substring(regionMatch.index + regionMatch[0].length);
|
|
80
|
+
regionSubTag = regionMatch[1];
|
|
81
|
+
}
|
|
100
82
|
}
|
|
101
83
|
var typesData = localeData.types[type];
|
|
102
84
|
// If the style of choice does not exist, fallback to "long".
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-displaynames",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.7",
|
|
4
4
|
"description": "Polyfill for: https://tc39.es/proposal-intl-displaynames",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"i18n",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "git+https://github.com/formatjs/formatjs.git"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@formatjs/ecma402-abstract": "1.5.
|
|
24
|
+
"@formatjs/ecma402-abstract": "1.5.4",
|
|
25
25
|
"tslib": "^2.0.1"
|
|
26
26
|
},
|
|
27
27
|
"bugs": {
|
package/polyfill.umd.js
CHANGED
|
@@ -356,6 +356,37 @@
|
|
|
356
356
|
return true;
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
+
var UNICODE_REGION_SUBTAG_REGEX = /^([a-z]{2}|[0-9]{3})$/i;
|
|
360
|
+
var ALPHA_4 = /^[a-z]{4}$/i;
|
|
361
|
+
function isUnicodeRegionSubtag(region) {
|
|
362
|
+
return UNICODE_REGION_SUBTAG_REGEX.test(region);
|
|
363
|
+
}
|
|
364
|
+
function isUnicodeScriptSubtag(script) {
|
|
365
|
+
return ALPHA_4.test(script);
|
|
366
|
+
}
|
|
367
|
+
function CanonicalCodeForDisplayNames(type, code) {
|
|
368
|
+
if (type === 'language') {
|
|
369
|
+
return CanonicalizeLocaleList([code])[0];
|
|
370
|
+
}
|
|
371
|
+
if (type === 'region') {
|
|
372
|
+
if (!isUnicodeRegionSubtag(code)) {
|
|
373
|
+
throw RangeError('invalid region');
|
|
374
|
+
}
|
|
375
|
+
return code.toUpperCase();
|
|
376
|
+
}
|
|
377
|
+
if (type === 'script') {
|
|
378
|
+
if (!isUnicodeScriptSubtag(code)) {
|
|
379
|
+
throw RangeError('invalid script');
|
|
380
|
+
}
|
|
381
|
+
return "" + code[0].toUpperCase() + code.slice(1).toLowerCase();
|
|
382
|
+
}
|
|
383
|
+
invariant(type === 'currency', 'invalid type');
|
|
384
|
+
if (!IsWellFormedCurrencyCode(code)) {
|
|
385
|
+
throw RangeError('invalid currency');
|
|
386
|
+
}
|
|
387
|
+
return code.toUpperCase();
|
|
388
|
+
}
|
|
389
|
+
|
|
359
390
|
/**
|
|
360
391
|
* https://tc39.es/ecma402/#sec-lookupsupportedlocales
|
|
361
392
|
* @param availableLocales
|
|
@@ -459,36 +490,18 @@
|
|
|
459
490
|
}
|
|
460
491
|
var _a = getMultiInternalSlots(__INTERNAL_SLOT_MAP__, this, 'localeData', 'style', 'fallback'), localeData = _a.localeData, style = _a.style, fallback = _a.fallback;
|
|
461
492
|
// Canonicalize the case.
|
|
462
|
-
var canonicalCode;
|
|
493
|
+
var canonicalCode = CanonicalCodeForDisplayNames(type, codeAsString);
|
|
463
494
|
// This is only used to store extracted language region.
|
|
464
495
|
var regionSubTag;
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
var regionMatch = /-([a-z]{2}|\d{3})\b/i.exec(canonicalCode);
|
|
470
|
-
if (regionMatch) {
|
|
471
|
-
// Remove region subtag
|
|
472
|
-
canonicalCode =
|
|
473
|
-
canonicalCode.substring(0, regionMatch.index) +
|
|
474
|
-
canonicalCode.substring(regionMatch.index + regionMatch[0].length);
|
|
475
|
-
regionSubTag = regionMatch[1];
|
|
476
|
-
}
|
|
477
|
-
break;
|
|
478
|
-
}
|
|
479
|
-
// currency code should be all upper-case.
|
|
480
|
-
case 'currency':
|
|
481
|
-
canonicalCode = codeAsString.toUpperCase();
|
|
482
|
-
break;
|
|
483
|
-
// script code should be title case
|
|
484
|
-
case 'script':
|
|
496
|
+
if (type === 'language') {
|
|
497
|
+
var regionMatch = /-([a-z]{2}|\d{3})\b/i.exec(canonicalCode);
|
|
498
|
+
if (regionMatch) {
|
|
499
|
+
// Remove region subtag
|
|
485
500
|
canonicalCode =
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
canonicalCode = codeAsString.toUpperCase();
|
|
491
|
-
break;
|
|
501
|
+
canonicalCode.substring(0, regionMatch.index) +
|
|
502
|
+
canonicalCode.substring(regionMatch.index + regionMatch[0].length);
|
|
503
|
+
regionSubTag = regionMatch[1];
|
|
504
|
+
}
|
|
492
505
|
}
|
|
493
506
|
var typesData = localeData.types[type];
|
|
494
507
|
// If the style of choice does not exist, fallback to "long".
|
package/polyfill.umd.min.js
CHANGED
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var e=function(){return(e=Object.assign||function e(t){for(var
|
|
15
|
+
***************************************************************************** */var e=function(){return(e=Object.assign||function e(t){for(var r,n=1,a=arguments.length;n<a;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)};function t(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var a=e.get(t);if(!a)throw new TypeError(t+" InternalSlot has not been initialized");return r.reduce((function(e,t){return e[t]=a[t],e}),Object.create(null))}var r=/-u(?:-[0-9a-z]{2,8})+/gi;function n(e,t,r){if(void 0===r&&(r=Error),!e)throw new r(t)}function a(e){return Intl.getCanonicalLocales(e)}function o(e){if("symbol"==typeof e)throw TypeError("Cannot convert a Symbol value to a string");return String(e)}function i(e){if(null==e)throw new TypeError("undefined/null cannot be converted to object");return Object(e)}function l(e,t,r,n,a){var i=e[t];if(void 0!==i){if("boolean"!==r&&"string"!==r)throw new TypeError("invalid type");if("boolean"===r&&(i=Boolean(i)),"string"===r&&(i=o(i)),void 0!==n&&!n.filter((function(e){return e==i})).length)throw new RangeError(i+" is not within "+n.join(", "));return i}return a}function c(e,t){for(var r=t;;){if(e.has(r))return r;var n=r.lastIndexOf("-");if(!~n)return;n>=2&&"-"===r[n-2]&&(n-=2),r=r.slice(0,n)}}function u(e,t){n(2===t.length,"key must have 2 elements");var r=e.length,a="-"+t+"-",o=e.indexOf(a);if(-1!==o){for(var i=o+4,l=i,c=i,u=!1;!u;){var f=e.indexOf("-",c);2==(-1===f?r-c:f-c)?u=!0:-1===f?(l=r,u=!0):(l=f,c=f+1)}return e.slice(i,l)}if(-1!==(o=e.indexOf(a="-"+t))&&o+3===r)return""}var f=/[^A-Z]/;function s(e){return 3===(e=function t(e){return e.replace(/([a-z])/g,(function(e,t){return t.toUpperCase()}))}(e)).length&&!f.test(e)}var p=/^([a-z]{2}|[0-9]{3})$/i,d=/^[a-z]{4}$/i,v=function(){function f(e,t){if(void 0===this.constructor)throw TypeError("Constructor Intl.DisplayNames requires 'new'");var o=a(e);t=i(t);var s=Object.create(null),p=f.localeData,d=l(t,"localeMatcher","string",["lookup","best fit"],"best fit");s.localeMatcher=d;var v=function g(e,t,a,o,i,l){for(var f,s=(f="lookup"===a.localeMatcher?function p(e,t,n){for(var a={locale:""},o=0,i=t;o<i.length;o++){var l=i[o],u=l.replace(r,""),f=c(e,u);if(f)return a.locale=f,l!==u&&(a.extension=l.slice(u.length+1,l.length)),a}return a.locale=n(),a}(e,t,l):function d(e,t,n){var a,o={},i=new Set;e.forEach((function(e){var t=new Intl.Locale(e).minimize().toString();o[t]=e,i.add(t)}));for(var l=0,u=t;l<u.length;l++){var f=u[l];if(a)break;var s=f.replace(r,"");if(e.has(s)){a=s;break}if(i.has(s)){a=o[s];break}var p=new Intl.Locale(s),d=p.maximize().toString(),v=p.minimize().toString();if(i.has(v)){a=o[v];break}a=c(i,d)}return{locale:a||n()}}(e,t,l)).locale,v={locale:"",dataLocale:s},g="-u",y=0,h=o;y<h.length;y++){var b=h[y];n(s in i,"Missing locale data for "+s);var w=i[s];n("object"==typeof w&&null!==w,"locale data "+b+" must be an object");var m=w[b];n(Array.isArray(m),"keyLocaleData for "+b+" must be an array");var L=m[0];n("string"==typeof L||null===L,"value must be string or null but got "+typeof L+" in key "+b);var D="";if(f.extension){var O=u(f.extension,b);void 0!==O&&(""!==O?~m.indexOf(O)&&(D="-"+b+"-"+(L=O)):~O.indexOf("true")&&(L="true",D="-"+b))}if(b in a){var x=a[b];n("string"==typeof x||null==x,"optionsValue must be String, Undefined or Null"),~m.indexOf(x)&&x!==L&&(L=x,D="")}v[b]=L,g+=D}if(g.length>2){var z=s.indexOf("-x-");if(-1===z)s+=g;else{var j=s.slice(0,z),k=s.slice(z,s.length);s=j+g+k}s=Intl.getCanonicalLocales(s)[0]}return v.locale=s,v}(f.availableLocales,o,s,[],f.localeData,f.getDefaultLocale),h=l(t,"style","string",["narrow","short","long"],"long");y(this,"style",h);var b=l(t,"type","string",["language","currency","region","script"],void 0);if(void 0===b)throw TypeError('Intl.DisplayNames constructor requires "type" option');y(this,"type",b),y(this,"fallback",l(t,"fallback","string",["code","none"],"code")),y(this,"locale",v.locale);var w=v.dataLocale,m=p[w];n(!!m,"Missing locale data for "+w),y(this,"localeData",m),n(void 0!==m,"locale data for "+v.locale+" does not exist.");var L=m.types;n("object"==typeof L&&null!=L,"invalid types data");var D=L[b];n("object"==typeof D&&null!=D,"invalid typeFields data");var O=D[h];n("object"==typeof O&&null!=O,"invalid styleFields data"),y(this,"fields",O)}return f.supportedLocalesOf=function(e,t){return function n(e,t,a){return void 0!==a&&l(a=i(a),"localeMatcher","string",["lookup","best fit"],"best fit"),function o(e,t){for(var n=[],a=0,o=t;a<o.length;a++){var i=c(e,o[a].replace(r,""));i&&n.push(i)}return n}(e,t)}(f.availableLocales,a(e),t)},f.__addLocaleData=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=0,n=e;r<n.length;r++){var a=n[r],o=a.data,i=a.locale,l=new Intl.Locale(i).minimize().toString();f.localeData[i]=f.localeData[l]=o,f.availableLocales.add(l),f.availableLocales.add(i),f.__defaultLocale||(f.__defaultLocale=l)}},f.prototype.of=function(e){h(this,"of");var r=function i(e,r){return function n(e,r,a){return t(e,r,a)[a]}(g,e,r)}(this,"type"),l=o(e);if(!function c(e,t){switch(e){case"language":return/^[a-z]{2,3}(-[a-z]{4})?(-([a-z]{2}|\d{3}))?(-([a-z\d]{5,8}|\d[a-z\d]{3}))*$/i.test(t);case"region":return/^([a-z]{2}|\d{3})$/i.test(t);case"script":return/^[a-z]{4}$/i.test(t);case"currency":return s(t)}}(r,l))throw RangeError("invalid code for Intl.DisplayNames.prototype.of");var u,f=t(g,this,"localeData","style","fallback"),v=f.localeData,y=f.style,b=f.fallback,w=function m(e,t){if("language"===e)return a([t])[0];if("region"===e){if(!function r(e){return p.test(e)}(t))throw RangeError("invalid region");return t.toUpperCase()}if("script"===e){if(!function o(e){return d.test(e)}(t))throw RangeError("invalid script");return""+t[0].toUpperCase()+t.slice(1).toLowerCase()}if(n("currency"===e,"invalid type"),!s(t))throw RangeError("invalid currency");return t.toUpperCase()}(r,l);if("language"===r){var L=/-([a-z]{2}|\d{3})\b/i.exec(w);L&&(w=w.substring(0,L.index)+w.substring(L.index+L[0].length),u=L[1])}var D=v.types[r],O=D[y][w]||D.long[w];if(void 0!==O){if(!u)return O;var x=v.types.region,z=x[y][u]||x.long[u];if(z||"code"===b)return v.patterns.locale.replace("{0}",O).replace("{1}",z||u)}if("code"===b)return l},f.prototype.resolvedOptions=function(){return h(this,"resolvedOptions"),e({},t(g,this,"locale","style","type","fallback"))},f.getDefaultLocale=function(){return f.__defaultLocale},f.localeData={},f.availableLocales=new Set,f.__defaultLocale="",f.polyfilled=!0,f}();try{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(v.prototype,Symbol.toStringTag,{value:"Intl.DisplayNames",configurable:!0,enumerable:!1,writable:!1}),Object.defineProperty(v,"length",{value:2,writable:!1,enumerable:!1,configurable:!0})}catch(e){}var g=new WeakMap;function y(e,t,r){!function n(e,t,r,a){e.get(t)||e.set(t,Object.create(null)),e.get(t)[r]=a}(g,e,t,r)}function h(e,t){if(!(e instanceof v))throw TypeError("Method Intl.DisplayNames.prototype."+t+" called on incompatible receiver")}(function b(){return!Intl.DisplayNames||function e(){return!!Intl.DisplayNames&&"CA"===new Intl.DisplayNames(["en"],{type:"region"}).of("CA")}()})()&&Object.defineProperty(Intl,"DisplayNames",{value:v,enumerable:!1,writable:!0,configurable:!0})}));
|