Socket
Socket
Sign inDemoInstall

@formatjs/intl-datetimeformat

Package Overview
Dependencies
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formatjs/intl-datetimeformat - npm Package Compare versions

Comparing version 2.6.3 to 2.6.4

2

_validate_dist-base_options.optionsvalid.d.ts
// /home/longlho/.cache/bazel/_bazel_longlho/576c18efaac10246ec115c72af79fca6/sandbox/linux-sandbox/1029/execroot/formatjs/node_modules/@bazel/typescript/internal/ts_project_options_validator.js checked attributes for //packages/intl-datetimeformat:dist-base
// /home/longlho/.cache/bazel/_bazel_longlho/576c18efaac10246ec115c72af79fca6/sandbox/linux-sandbox/129/execroot/formatjs/node_modules/@bazel/typescript/internal/ts_project_options_validator.js checked attributes for //packages/intl-datetimeformat:dist-base
// composite: false

@@ -4,0 +4,0 @@ // declaration: true

// /home/longlho/.cache/bazel/_bazel_longlho/576c18efaac10246ec115c72af79fca6/sandbox/linux-sandbox/299/execroot/formatjs/node_modules/@bazel/typescript/internal/ts_project_options_validator.js checked attributes for //packages/intl-datetimeformat:dist-esm
// /home/longlho/.cache/bazel/_bazel_longlho/576c18efaac10246ec115c72af79fca6/sandbox/linux-sandbox/137/execroot/formatjs/node_modules/@bazel/typescript/internal/ts_project_options_validator.js checked attributes for //packages/intl-datetimeformat:dist-esm
// composite: false

@@ -4,0 +4,0 @@ // declaration: true

export * from './src/core';
export { DateTimeFormatOptions } from './src/types';
//# sourceMappingURL=index.d.ts.map
export * from './src/core';
export { DateTimeFormatOptions } from './src/types';
//# sourceMappingURL=index.d.ts.map
import { DateTimeFormat } from './';
import { defineProperty } from '@formatjs/ecma402-abstract';
import { defineProperty, } from '@formatjs/ecma402-abstract';
import { toLocaleString as _toLocaleString, toLocaleDateString as _toLocaleDateString, toLocaleTimeString as _toLocaleTimeString, } from './src/to_locale_string';

@@ -4,0 +4,0 @@ defineProperty(Intl, 'DateTimeFormat', { value: DateTimeFormat });

import { DateTimeFormat } from './';
import { defineProperty } from '@formatjs/ecma402-abstract';
import { defineProperty, } from '@formatjs/ecma402-abstract';
import { shouldPolyfill } from './should-polyfill';

@@ -4,0 +4,0 @@ import { toLocaleString as _toLocaleString, toLocaleDateString as _toLocaleDateString, toLocaleTimeString as _toLocaleTimeString, } from './src/to_locale_string';

@@ -1,2 +0,3 @@

import { PackedData, UnpackedZoneData, DateTimeFormatOptions, Formats, DateTimeFormatLocaleInternalData, RawDateTimeLocaleData } from './types';
import { DateTimeFormatOptions, DateTimeFormatLocaleInternalData, UnpackedZoneData } from '@formatjs/ecma402-abstract';
import { PackedData, RawDateTimeLocaleData } from './types';
export interface IntlDateTimeFormatInternal {

@@ -23,44 +24,9 @@ locale: string;

}
export interface DateTimeFormatPart {
type: 'literal' | 'era' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'weekday' | 'timeZoneName' | 'dayPeriod' | 'relatedYear' | 'yearName' | 'unknown';
value: 'string';
}
export interface ResolvedDateTimeFormatOptions {
locale: string;
calendar?: string;
dateStyle?: 'full' | 'long' | 'medium' | 'short';
timeStyle?: 'full' | 'long' | 'medium' | 'short';
weekday: 'narrow' | 'short' | 'long';
era: 'narrow' | 'short' | 'long';
year: '2-year' | 'numeric';
month: '2-year' | 'numeric' | 'narrow' | 'short' | 'long';
day: '2-year' | 'numeric';
hour: '2-year' | 'numeric';
minute: '2-year' | 'numeric';
second: '2-year' | 'numeric';
timeZoneName: 'short' | 'long';
hourCycle: string;
numberingSystem: string;
}
/**
* https://tc39.es/ecma402/#sec-todatetimeoptions
* @param options
* @param required
* @param defaults
*/
export declare function toDateTimeOptions(options?: DateTimeFormatOptions | null, required?: string, defaults?: string): DateTimeFormatOptions;
export declare function basicFormatMatcherScore(options: DateTimeFormatOptions, format: Formats): number;
/**
* Credit: https://github.com/andyearnshaw/Intl.js/blob/0958dc1ad8153f1056653ea22b8208f0df289a4e/src/12.datetimeformat.js#L611
* with some modifications
* @param options
* @param format
*/
export declare function bestFitFormatMatcherScore(options: DateTimeFormatOptions, format: Formats): number;
export interface DateTimeFormatConstructor {
new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
(locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
new (locales?: string | string[], options?: DateTimeFormatOptions): Intl.DateTimeFormat;
(locales?: string | string[], options?: DateTimeFormatOptions): Intl.DateTimeFormat;
__addLocaleData(...data: RawDateTimeLocaleData[]): void;
supportedLocalesOf(locales: string | string[], options?: Pick<DateTimeFormatOptions, 'localeMatcher'>): string[];
getDefaultLocale(): string;
relevantExtensionKeys: string[];
__defaultLocale: string;

@@ -76,8 +42,3 @@ __defaultTimeZone: string;

}
export interface DateTimeFormat {
resolvedOptions(): ResolvedDateTimeFormatOptions;
formatToParts(x?: number | Date): DateTimeFormatPart[];
format(x?: number | Date): string;
}
export declare const DateTimeFormat: DateTimeFormatConstructor;
//# sourceMappingURL=core.d.ts.map

@@ -23,17 +23,6 @@ var __assign = (this && this.__assign) || function () {

};
import { GetOption, ResolveLocale, invariant, defineProperty, SupportedLocales, PartitionPattern, unpackData, } from '@formatjs/ecma402-abstract';
import { invariant, defineProperty, SupportedLocales, unpackData, InitializeDateTimeFormat, IsValidTimeZoneName, CanonicalizeTimeZoneName, DATE_TIME_PROPS, FormatDateTime, FormatDateTimeToParts, CanonicalizeLocaleList, parseDateTimeSkeleton, ToNumber, } from '@formatjs/ecma402-abstract';
import getInternalSlots from './get_internal_slots';
import links from './data/links';
import { unpack } from './packer';
import { parseDateTimeSkeleton } from './skeleton';
import ToObject from 'es-abstract/2019/ToObject';
import TimeClip from 'es-abstract/2019/TimeClip';
import ToNumber from 'es-abstract/2019/ToNumber';
import WeekDay from 'es-abstract/2019/WeekDay';
import MonthFromTime from 'es-abstract/2019/MonthFromTime';
import DateFromTime from 'es-abstract/2019/DateFromTime';
import HourFromTime from 'es-abstract/2019/HourFromTime';
import MinFromTime from 'es-abstract/2019/MinFromTime';
import SecFromTime from 'es-abstract/2019/SecFromTime';
import YearFromTime from 'es-abstract/2019/YearFromTime';
var UPPERCASED_LINKS = Object.keys(links).reduce(function (all, l) {

@@ -43,13 +32,2 @@ all[l.toUpperCase()] = links[l];

}, {});
var DATE_TIME_PROPS = [
'weekday',
'era',
'year',
'month',
'day',
'hour',
'minute',
'second',
'timeZoneName',
];
var RESOLVED_OPTIONS_KEYS = [

@@ -73,439 +51,2 @@ 'locale',

];
var TYPE_REGEX = /^[a-z0-9]{3,8}$/i;
/**
* https://tc39.es/ecma402/#sec-isvalidtimezonename
* @param tz
*/
function isValidTimeZoneName(tz) {
var uppercasedTz = tz.toUpperCase();
var zoneNames = new Set(Object.keys(DateTimeFormat.tzData).map(function (z) { return z.toUpperCase(); }));
return zoneNames.has(uppercasedTz) || uppercasedTz in UPPERCASED_LINKS;
}
/**
* https://tc39.es/ecma402/#sec-canonicalizetimezonename
* @param tz
*/
function canonicalizeTimeZoneName(tz) {
var uppercasedTz = tz.toUpperCase();
var uppercasedZones = Object.keys(DateTimeFormat.tzData).reduce(function (all, z) {
all[z.toUpperCase()] = z;
return all;
}, {});
var ianaTimeZone = UPPERCASED_LINKS[uppercasedTz] || uppercasedZones[uppercasedTz];
if (ianaTimeZone === 'Etc/UTC' || ianaTimeZone === 'Etc/GMT') {
return 'UTC';
}
return ianaTimeZone;
}
function isTimeRelated(opt) {
for (var _i = 0, _a = ['hour', 'minute', 'second']; _i < _a.length; _i++) {
var prop = _a[_i];
var value = opt[prop];
if (value !== undefined) {
return true;
}
}
return false;
}
/**
* https://tc39.es/ecma402/#sec-initializedatetimeformat
* @param dtf DateTimeFormat
* @param locales locales
* @param opts options
*/
function initializeDateTimeFormat(dtf, locales, opts) {
// @ts-ignore
var requestedLocales = Intl.getCanonicalLocales(locales);
var options = toDateTimeOptions(opts, 'any', 'date');
var opt = Object.create(null);
var matcher = GetOption(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');
opt.localeMatcher = matcher;
var calendar = GetOption(options, 'calendar', 'string', undefined, undefined);
if (calendar !== undefined && !TYPE_REGEX.test(calendar)) {
throw new RangeError('Malformed calendar');
}
var internalSlots = getInternalSlots(dtf);
opt.ca = calendar;
var numberingSystem = GetOption(options, 'numberingSystem', 'string', undefined, undefined);
if (numberingSystem !== undefined && !TYPE_REGEX.test(numberingSystem)) {
throw new RangeError('Malformed numbering system');
}
opt.nu = numberingSystem;
var hour12 = GetOption(options, 'hour12', 'boolean', undefined, undefined);
var hourCycle = GetOption(options, 'hourCycle', 'string', ['h11', 'h12', 'h23', 'h24'], undefined);
if (hour12 !== undefined) {
// @ts-ignore
hourCycle = null;
}
opt.hc = hourCycle;
var r = ResolveLocale(DateTimeFormat.availableLocales, requestedLocales,
// TODO: Fix the type
opt,
// [[RelevantExtensionKeys]] slot, which is a constant
['nu', 'ca', 'hc'], DateTimeFormat.localeData, DateTimeFormat.getDefaultLocale);
internalSlots.locale = r.locale;
calendar = r.ca;
internalSlots.calendar = calendar;
internalSlots.hourCycle = r.hc;
internalSlots.numberingSystem = r.nu;
var dataLocale = r.dataLocale;
internalSlots.dataLocale = dataLocale;
var timeZone = options.timeZone;
if (timeZone !== undefined) {
timeZone = String(timeZone);
if (!isValidTimeZoneName(timeZone)) {
throw new RangeError('Invalid timeZoneName');
}
timeZone = canonicalizeTimeZoneName(timeZone);
}
else {
timeZone = DateTimeFormat.getDefaultTimeZone();
}
internalSlots.timeZone = timeZone;
opt = Object.create(null);
opt.weekday = GetOption(options, 'weekday', 'string', ['narrow', 'short', 'long'], undefined);
opt.era = GetOption(options, 'era', 'string', ['narrow', 'short', 'long'], undefined);
opt.year = GetOption(options, 'year', 'string', ['2-digit', 'numeric'], undefined);
opt.month = GetOption(options, 'month', 'string', ['2-digit', 'numeric', 'narrow', 'short', 'long'], undefined);
opt.day = GetOption(options, 'day', 'string', ['2-digit', 'numeric'], undefined);
opt.hour = GetOption(options, 'hour', 'string', ['2-digit', 'numeric'], undefined);
opt.minute = GetOption(options, 'minute', 'string', ['2-digit', 'numeric'], undefined);
opt.second = GetOption(options, 'second', 'string', ['2-digit', 'numeric'], undefined);
opt.timeZoneName = GetOption(options, 'timeZoneName', 'string', ['short', 'long'], undefined);
var dataLocaleData = DateTimeFormat.localeData[dataLocale];
var formats = dataLocaleData.formats[calendar];
matcher = GetOption(options, 'formatMatcher', 'string', ['basic', 'best fit'], 'best fit');
var dateStyle = GetOption(options, 'dateStyle', 'string', ['full', 'long', 'medium', 'short'], undefined);
internalSlots.dateStyle = dateStyle;
var timeStyle = GetOption(options, 'timeStyle', 'string', ['full', 'long', 'medium', 'short'], undefined);
internalSlots.timeStyle = timeStyle;
var bestFormat;
if (dateStyle === undefined && timeStyle === undefined) {
if (matcher === 'basic') {
bestFormat = basicFormatMatcher(opt, formats);
}
else {
if (isTimeRelated(opt)) {
opt.hour12 =
internalSlots.hourCycle === 'h11' ||
internalSlots.hourCycle === 'h12';
}
bestFormat = bestFitFormatMatcher(opt, formats);
}
}
else {
for (var _i = 0, DATE_TIME_PROPS_1 = DATE_TIME_PROPS; _i < DATE_TIME_PROPS_1.length; _i++) {
var prop = DATE_TIME_PROPS_1[_i];
var p = opt[prop];
if (p !== undefined) {
throw new TypeError("Intl.DateTimeFormat can't set option " + prop + " when " + (dateStyle ? 'dateStyle' : 'timeStyle') + " is used");
}
}
bestFormat = dateTimeStyleFormat(dateStyle, timeStyle, dataLocaleData);
}
for (var prop in opt) {
var p = bestFormat[prop];
if (p !== undefined) {
internalSlots[prop] = p;
}
}
var pattern;
if (internalSlots.hour !== undefined) {
var hcDefault = dataLocaleData.hourCycle;
var hc = internalSlots.hourCycle;
if (hc == null) {
hc = hcDefault;
}
if (hour12 !== undefined) {
if (hour12) {
if (hcDefault === 'h11' || hcDefault === 'h23') {
hc = 'h11';
}
else {
hc = 'h12';
}
}
else {
invariant(!hour12, 'hour12 must not be set');
if (hcDefault === 'h11' || hcDefault === 'h23') {
hc = 'h23';
}
else {
hc = 'h24';
}
}
}
internalSlots.hourCycle = hc;
if (hc === 'h11' || hc === 'h12') {
pattern = bestFormat.pattern12;
}
else {
pattern = bestFormat.pattern;
}
}
else {
// @ts-ignore
internalSlots.hourCycle = undefined;
pattern = bestFormat.pattern;
}
internalSlots.pattern = pattern;
return dtf;
}
/**
* https://tc39.es/ecma402/#sec-todatetimeoptions
* @param options
* @param required
* @param defaults
*/
export function toDateTimeOptions(options, required, defaults) {
if (options === undefined) {
options = null;
}
else {
options = ToObject(options);
}
options = Object.create(options);
var needDefaults = true;
if (required === 'date' || required === 'any') {
for (var _i = 0, _a = ['weekday', 'year', 'month', 'day']; _i < _a.length; _i++) {
var prop = _a[_i];
var value = options[prop];
if (value !== undefined) {
needDefaults = false;
}
}
}
if (required === 'time' || required === 'any') {
for (var _b = 0, _c = ['hour', 'minute', 'second']; _b < _c.length; _b++) {
var prop = _c[_b];
var value = options[prop];
if (value !== undefined) {
needDefaults = false;
}
}
}
if (options.dateStyle !== undefined || options.timeStyle !== undefined) {
needDefaults = false;
}
if (required === 'date' && options.timeStyle) {
throw new TypeError('Intl.DateTimeFormat date was required but timeStyle was included');
}
if (required === 'time' && options.dateStyle) {
throw new TypeError('Intl.DateTimeFormat time was required but dateStyle was included');
}
if (needDefaults && (defaults === 'date' || defaults === 'all')) {
for (var _d = 0, _e = ['year', 'month', 'day']; _d < _e.length; _d++) {
var prop = _e[_d];
options[prop] = 'numeric';
}
}
if (needDefaults && (defaults === 'time' || defaults === 'all')) {
for (var _f = 0, _g = ['hour', 'minute', 'second']; _f < _g.length; _f++) {
var prop = _g[_f];
options[prop] = 'numeric';
}
}
return options;
}
var BASIC_FORMAT_MATCHER_VALUES = [
'2-digit',
'numeric',
'narrow',
'short',
'long',
];
var removalPenalty = 120;
var additionPenalty = 20;
var differentNumericTypePenalty = 15;
var longLessPenalty = 8;
var longMorePenalty = 6;
var shortLessPenalty = 6;
var shortMorePenalty = 3;
export function basicFormatMatcherScore(options, format) {
var score = 0;
for (var _i = 0, DATE_TIME_PROPS_2 = DATE_TIME_PROPS; _i < DATE_TIME_PROPS_2.length; _i++) {
var prop = DATE_TIME_PROPS_2[_i];
var optionsProp = options[prop];
var formatProp = format[prop];
if (optionsProp === undefined && formatProp !== undefined) {
score -= additionPenalty;
}
else if (optionsProp !== undefined && formatProp === undefined) {
score -= removalPenalty;
}
else if (optionsProp !== formatProp) {
var optionsPropIndex = BASIC_FORMAT_MATCHER_VALUES.indexOf(optionsProp);
var formatPropIndex = BASIC_FORMAT_MATCHER_VALUES.indexOf(formatProp);
var delta = Math.max(-2, Math.min(formatPropIndex - optionsPropIndex, 2));
if (delta === 2) {
score -= longMorePenalty;
}
else if (delta === 1) {
score -= shortMorePenalty;
}
else if (delta === -1) {
score -= shortLessPenalty;
}
else if (delta === -2) {
score -= longLessPenalty;
}
}
}
return score;
}
/**
* Credit: https://github.com/andyearnshaw/Intl.js/blob/0958dc1ad8153f1056653ea22b8208f0df289a4e/src/12.datetimeformat.js#L611
* with some modifications
* @param options
* @param format
*/
export function bestFitFormatMatcherScore(options, format) {
var score = 0;
if (options.hour12 && !format.hour12) {
score -= removalPenalty;
}
else if (!options.hour12 && format.hour12) {
score -= additionPenalty;
}
for (var _i = 0, DATE_TIME_PROPS_3 = DATE_TIME_PROPS; _i < DATE_TIME_PROPS_3.length; _i++) {
var prop = DATE_TIME_PROPS_3[_i];
var optionsProp = options[prop];
var formatProp = format[prop];
if (optionsProp === undefined && formatProp !== undefined) {
score -= additionPenalty;
}
else if (optionsProp !== undefined && formatProp === undefined) {
score -= removalPenalty;
}
else if (optionsProp !== formatProp) {
// extra penalty for numeric vs non-numeric
if (isNumericType(optionsProp) !==
isNumericType(formatProp)) {
score -= differentNumericTypePenalty;
}
else {
var optionsPropIndex = BASIC_FORMAT_MATCHER_VALUES.indexOf(optionsProp);
var formatPropIndex = BASIC_FORMAT_MATCHER_VALUES.indexOf(formatProp);
var delta = Math.max(-2, Math.min(formatPropIndex - optionsPropIndex, 2));
if (delta === 2) {
score -= longMorePenalty;
}
else if (delta === 1) {
score -= shortMorePenalty;
}
else if (delta === -1) {
score -= shortLessPenalty;
}
else if (delta === -2) {
score -= longLessPenalty;
}
}
}
}
return score;
}
function dateTimeStyleFormat(dateStyle, timeStyle, dataLocaleData) {
var dateFormat, timeFormat;
if (timeStyle !== undefined) {
timeFormat = dataLocaleData.timeFormat[timeStyle];
}
if (dateStyle !== undefined) {
dateFormat = dataLocaleData.dateFormat[dateStyle];
}
if (dateStyle !== undefined &&
dateFormat !== undefined &&
timeFormat !== undefined) {
var format = __assign(__assign({}, dateFormat), timeFormat);
delete format.pattern;
delete format.pattern12;
var connector = dataLocaleData.dateTimeFormat[dateStyle];
format.pattern = connector
.replace('{0}', timeFormat.pattern)
.replace('{1}', dateFormat.pattern);
if (timeFormat.pattern12 !== undefined) {
format.pattern12 = connector
.replace('{0}', timeFormat.pattern12)
.replace('{1}', dateFormat.pattern);
}
return format;
}
if (timeFormat !== undefined) {
return timeFormat;
}
if (dateFormat === undefined) {
throw new TypeError('Intl.DateTimeFormat neither the dateFormat or the timeFormat could be found');
}
return dateFormat;
}
/**
* https://tc39.es/ecma402/#sec-basicformatmatcher
* @param options
* @param formats
*/
function basicFormatMatcher(options, formats) {
var bestScore = -Infinity;
var bestFormat = formats[0];
invariant(Array.isArray(formats), 'formats should be a list of things');
for (var _i = 0, formats_1 = formats; _i < formats_1.length; _i++) {
var format = formats_1[_i];
var score = basicFormatMatcherScore(options, format);
if (score > bestScore) {
bestScore = score;
bestFormat = format;
}
}
return __assign({}, bestFormat);
}
function isNumericType(t) {
return t === 'numeric' || t === '2-digit';
}
/**
* https://tc39.es/ecma402/#sec-bestfitformatmatcher
* Just alias to basic for now
* @param options
* @param formats
*/
function bestFitFormatMatcher(options, formats) {
var bestScore = -Infinity;
var bestFormat = formats[0];
invariant(Array.isArray(formats), 'formats should be a list of things');
for (var _i = 0, formats_2 = formats; _i < formats_2.length; _i++) {
var format = formats_2[_i];
var score = bestFitFormatMatcherScore(options, format);
if (score > bestScore) {
bestScore = score;
bestFormat = format;
}
}
var skeletonFormat = __assign({}, bestFormat);
var patternFormat = parseDateTimeSkeleton(bestFormat.rawPattern);
// Kinda following https://github.com/unicode-org/icu/blob/dd50e38f459d84e9bf1b0c618be8483d318458ad/icu4j/main/classes/core/src/com/ibm/icu/text/DateTimePatternGenerator.java
// Method adjustFieldTypes
for (var prop in patternFormat) {
var skeletonValue = skeletonFormat[prop];
var patternValue = patternFormat[prop];
var requestedValue = options[prop];
// Don't mess with minute/second or we can get in the situation of
// 7:0:0 which is weird
if (prop === 'minute' || prop === 'second') {
continue;
}
// Nothing to do here
if (!requestedValue) {
continue;
}
// https://unicode.org/reports/tr35/tr35-dates.html#Matching_Skeletons
// Looks like we should not convert numeric to alphabetic but the other way
// around is ok
if (isNumericType(patternValue) &&
!isNumericType(requestedValue)) {
continue;
}
if (skeletonValue === requestedValue) {
continue;
}
patternFormat[prop] = requestedValue;
}
return patternFormat;
}
var formatDescriptor = {

@@ -532,3 +73,8 @@ enumerable: false,

}
return formatDateTime(dtf, x);
return FormatDateTime(dtf, x, {
getInternalSlots: getInternalSlots,
localeData: DateTimeFormat.localeData,
tzData: DateTimeFormat.tzData,
getDefaultTimeZone: DateTimeFormat.getDefaultTimeZone,
});
};

@@ -566,239 +112,2 @@ try {

}
function pad(n) {
if (n < 10) {
return "0" + n;
}
return String(n);
}
function offsetToGmtString(gmtFormat, hourFormat, offsetInMs, style) {
var offsetInMinutes = Math.floor(offsetInMs / 60000);
var mins = Math.abs(offsetInMinutes) % 60;
var hours = Math.floor(Math.abs(offsetInMinutes) / 60);
var _a = hourFormat.split(';'), positivePattern = _a[0], negativePattern = _a[1];
var offsetStr = '';
var pattern = offsetInMs < 0 ? negativePattern : positivePattern;
if (style === 'long') {
offsetStr = pattern
.replace('HH', pad(hours))
.replace('H', String(hours))
.replace('mm', pad(mins))
.replace('m', String(mins));
}
else if (mins || hours) {
if (!mins) {
pattern = pattern.replace(/:?m+/, '');
}
offsetStr = pattern
.replace(/H+/, String(hours))
.replace(/m+/, String(mins));
}
return gmtFormat.replace('{0}', offsetStr);
}
/**
* https://tc39.es/ecma402/#sec-partitiondatetimepattern
* @param dtf
* @param x
*/
function partitionDateTimePattern(dtf, x) {
x = TimeClip(x);
if (isNaN(x)) {
throw new RangeError('invalid time');
}
/** IMPL START */
var internalSlots = getInternalSlots(dtf);
var dataLocale = internalSlots.dataLocale;
var dataLocaleData = DateTimeFormat.localeData[dataLocale];
/** IMPL END */
var locale = internalSlots.locale;
var nfOptions = Object.create(null);
nfOptions.useGrouping = false;
var nf = new Intl.NumberFormat(locale, nfOptions);
var nf2Options = Object.create(null);
nf2Options.minimumIntegerDigits = 2;
nf2Options.useGrouping = false;
var nf2 = new Intl.NumberFormat(locale, nf2Options);
var tm = toLocalTime(x,
// @ts-ignore
internalSlots.calendar, internalSlots.timeZone);
var result = [];
var patternParts = PartitionPattern(internalSlots.pattern);
for (var _i = 0, patternParts_1 = patternParts; _i < patternParts_1.length; _i++) {
var patternPart = patternParts_1[_i];
var p = patternPart.type;
if (p === 'literal') {
result.push({
type: 'literal',
value: patternPart.value,
});
}
else if (DATE_TIME_PROPS.indexOf(p) > -1) {
var fv = '';
var f = internalSlots[p];
// @ts-ignore
var v = tm[p];
if (p === 'year' && v <= 0) {
v = 1 - v;
}
if (p === 'month') {
v++;
}
var hourCycle = internalSlots.hourCycle;
if (p === 'hour' && (hourCycle === 'h11' || hourCycle === 'h12')) {
v = v % 12;
if (v === 0 && hourCycle === 'h12') {
v = 12;
}
}
if (p === 'hour' && hourCycle === 'h24') {
if (v === 0) {
v = 24;
}
}
if (f === 'numeric') {
fv = nf.format(v);
}
else if (f === '2-digit') {
fv = nf2.format(v);
if (fv.length > 2) {
fv = fv.slice(fv.length - 2, fv.length);
}
}
else if (f === 'narrow' || f === 'short' || f === 'long') {
if (p === 'era') {
fv = dataLocaleData[p][f][v];
}
else if (p === 'timeZoneName') {
var timeZoneName = dataLocaleData.timeZoneName, gmtFormat = dataLocaleData.gmtFormat, hourFormat = dataLocaleData.hourFormat;
var timeZone = internalSlots.timeZone || DateTimeFormat.getDefaultTimeZone();
var timeZoneData = timeZoneName[timeZone];
if (timeZoneData && timeZoneData[f]) {
fv = timeZoneData[f][+tm.inDST];
}
else {
// Fallback to gmtFormat
fv = offsetToGmtString(gmtFormat, hourFormat, tm.timeZoneOffset, f);
}
}
else if (p === 'month') {
fv = dataLocaleData.month[f][v - 1];
}
else {
fv = dataLocaleData[p][f][v];
}
}
result.push({
type: p,
value: fv,
});
}
else if (p === 'ampm') {
var v = tm.hour;
var fv = void 0;
if (v >= 11) {
fv = dataLocaleData.pm;
}
else {
fv = dataLocaleData.am;
}
result.push({
type: 'dayPeriod',
value: fv,
});
}
else if (p === 'relatedYear') {
var v = tm.relatedYear;
// @ts-ignore
var fv = nf.format(v);
result.push({
type: 'relatedYear',
value: fv,
});
}
else if (p === 'yearName') {
var v = tm.yearName;
// @ts-ignore
var fv = nf.format(v);
result.push({
type: 'yearName',
value: fv,
});
}
else {
result.push({
type: 'unknown',
value: x,
});
}
}
return result;
}
/**
* https://tc39.es/ecma402/#sec-formatdatetime
* @param dtf DateTimeFormat
* @param x
*/
function formatDateTime(dtf, x) {
var parts = partitionDateTimePattern(dtf, x);
var result = '';
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
var part = parts_1[_i];
result += part.value;
}
return result;
}
/**
* https://tc39.es/ecma402/#sec-formatdatetimetoparts
* @param dtf DateTimeFormat
* @param x
*/
function formatDateTimeParts(dtf, x) {
return partitionDateTimePattern(dtf, x);
}
function getApplicableZoneData(t, timeZone) {
var _a;
var tzData = DateTimeFormat.tzData;
var zoneData = tzData[timeZone];
// We don't have data for this so just say it's UTC
if (!zoneData) {
return [0, false];
}
var i = 0;
var offset = 0;
var dst = false;
for (; i <= zoneData.length; i++) {
if (i === zoneData.length || zoneData[i][0] * 1e3 >= t) {
_a = zoneData[i - 1], offset = _a[2], dst = _a[3];
break;
}
}
return [offset * 1e3, dst];
}
/**
* https://tc39.es/ecma402/#sec-tolocaltime
* @param t
* @param calendar
* @param timeZone
*/
function toLocalTime(t, calendar, timeZone) {
invariant(typeof t === 'number', 'invalid time');
invariant(calendar === 'gregory', 'We only support Gregory calendar right now');
var _a = getApplicableZoneData(t, timeZone), timeZoneOffset = _a[0], inDST = _a[1];
var tz = t + timeZoneOffset;
var year = YearFromTime(tz);
return {
weekday: WeekDay(tz),
era: year < 0 ? 'BC' : 'AD',
year: year,
relatedYear: undefined,
yearName: undefined,
month: MonthFromTime(tz),
day: DateFromTime(tz),
hour: HourFromTime(tz),
minute: MinFromTime(tz),
second: SecFromTime(tz),
inDST: inDST,
// IMPORTANT: Not in spec
timeZoneOffset: timeZoneOffset,
};
}
export var DateTimeFormat = function (locales, options) {

@@ -809,3 +118,12 @@ // Cannot use `new.target` bc of IE11 & TS transpiles it to something else

}
initializeDateTimeFormat(this, locales, options);
InitializeDateTimeFormat(this, locales, options, {
tzData: DateTimeFormat.tzData,
uppercaseLinks: UPPERCASED_LINKS,
availableLocales: DateTimeFormat.availableLocales,
relevantExtensionKeys: DateTimeFormat.relevantExtensionKeys,
getDefaultLocale: DateTimeFormat.getDefaultLocale,
getDefaultTimeZone: DateTimeFormat.getDefaultTimeZone,
getInternalSlots: getInternalSlots,
localeData: DateTimeFormat.localeData,
});
/** IMPL START */

@@ -821,3 +139,3 @@ var internalSlots = getInternalSlots(this);

value: function supportedLocalesOf(locales, options) {
return SupportedLocales(DateTimeFormat.availableLocales, Intl.getCanonicalLocales(locales), options);
return SupportedLocales(DateTimeFormat.availableLocales, CanonicalizeLocaleList(locales), options);
},

@@ -866,13 +184,24 @@ });

}
return formatDateTimeParts(this, date);
return FormatDateTimeToParts(this, date, {
getInternalSlots: getInternalSlots,
localeData: DateTimeFormat.localeData,
tzData: DateTimeFormat.tzData,
getDefaultTimeZone: DateTimeFormat.getDefaultTimeZone,
});
},
});
var DEFAULT_TIMEZONE = (typeof process !== 'undefined' && process.env && process.env.TZ) || 'UTC';
var DEFAULT_TIMEZONE = 'UTC';
DateTimeFormat.__setDefaultTimeZone = function (timeZone) {
if (timeZone !== undefined) {
timeZone = String(timeZone);
if (!isValidTimeZoneName(timeZone)) {
if (!IsValidTimeZoneName(timeZone, {
tzData: DateTimeFormat.tzData,
uppercaseLinks: UPPERCASED_LINKS,
})) {
throw new RangeError('Invalid timeZoneName');
}
timeZone = canonicalizeTimeZoneName(timeZone);
timeZone = CanonicalizeTimeZoneName(timeZone, {
tzData: DateTimeFormat.tzData,
uppercaseLinks: UPPERCASED_LINKS,
});
}

@@ -884,2 +213,3 @@ else {

};
DateTimeFormat.relevantExtensionKeys = ['nu', 'ca', 'hc'];
DateTimeFormat.__defaultTimeZone = DEFAULT_TIMEZONE;

@@ -897,3 +227,3 @@ DateTimeFormat.getDefaultTimeZone = function () { return DateTimeFormat.__defaultTimeZone; };

try {
var _a = unpackData(locale, datum), dateFormat = _a.dateFormat, timeFormat = _a.timeFormat, dateTimeFormat = _a.dateTimeFormat, formats_3 = _a.formats, rawData = __rest(_a, ["dateFormat", "timeFormat", "dateTimeFormat", "formats"]);
var _a = unpackData(locale, datum), dateFormat = _a.dateFormat, timeFormat = _a.timeFormat, dateTimeFormat = _a.dateTimeFormat, formats_1 = _a.formats, rawData = __rest(_a, ["dateFormat", "timeFormat", "dateTimeFormat", "formats"]);
var processedData = __assign(__assign({}, rawData), { dateFormat: {

@@ -916,7 +246,7 @@ full: parseDateTimeSkeleton(dateFormat.full),

var _loop_2 = function (calendar) {
processedData.formats[calendar] = Object.keys(formats_3[calendar]).map(function (skeleton) {
return parseDateTimeSkeleton(skeleton, formats_3[calendar][skeleton]);
processedData.formats[calendar] = Object.keys(formats_1[calendar]).map(function (skeleton) {
return parseDateTimeSkeleton(skeleton, formats_1[calendar][skeleton]);
});
};
for (var calendar in formats_3) {
for (var calendar in formats_1) {
_loop_2(calendar);

@@ -923,0 +253,0 @@ }

@@ -1,3 +0,4 @@

import { DateTimeFormat, IntlDateTimeFormatInternal } from '..';
import { IntlDateTimeFormatInternal } from '..';
import { DateTimeFormat } from '@formatjs/ecma402-abstract';
export default function getInternalSlots(x: DateTimeFormat): IntlDateTimeFormatInternal;
//# sourceMappingURL=get_internal_slots.d.ts.map

@@ -1,4 +0,5 @@

import { UnpackedData, PackedData, UnpackedZoneData } from './types';
import { UnpackedData, PackedData } from './types';
import { UnpackedZoneData } from '@formatjs/ecma402-abstract';
export declare function pack(data: UnpackedData): PackedData;
export declare function unpack(data: PackedData): Record<string, UnpackedZoneData[]>;
//# sourceMappingURL=packer.d.ts.map

@@ -1,2 +0,2 @@

import { DateTimeFormatOptions } from './types';
import { DateTimeFormatOptions } from '@formatjs/ecma402-abstract';
/**

@@ -3,0 +3,0 @@ * Number.prototype.toLocaleString ponyfill

// eslint-disable-next-line import/no-cycle
import { DateTimeFormat, toDateTimeOptions } from './core';
import { DateTimeFormat } from './core';
import { ToDateTimeOptions, } from '@formatjs/ecma402-abstract';
/**

@@ -12,8 +13,8 @@ * Number.prototype.toLocaleString ponyfill

export function toLocaleDateString(x, locales, options) {
var dtf = new DateTimeFormat(locales, toDateTimeOptions(options, 'date', 'date'));
var dtf = new DateTimeFormat(locales, ToDateTimeOptions(options, 'date', 'date'));
return dtf.format(x);
}
export function toLocaleTimeString(x, locales, options) {
var dtf = new DateTimeFormat(locales, toDateTimeOptions(options, 'time', 'time'));
var dtf = new DateTimeFormat(locales, ToDateTimeOptions(options, 'time', 'time'));
return dtf.format(x);
}

@@ -1,2 +0,2 @@

import { LocaleData } from '@formatjs/ecma402-abstract';
import { LocaleData, DateTimeFormatLocaleInternalData } from '@formatjs/ecma402-abstract';
export interface PackedData {

@@ -16,3 +16,2 @@ zones: string[];

export declare type ZoneData = [number | string, number, number, number];
export declare type UnpackedZoneData = [number, string, number, boolean];
export declare type RawDateTimeLocaleData = LocaleData<RawDateTimeLocaleInternalData>;

@@ -44,72 +43,2 @@ export declare type RawDateTimeLocaleInternalData = Omit<DateTimeFormatLocaleInternalData, 'dateFormat' | 'timeFormat' | 'dateTimeFormat' | 'formats'> & {

}>;
export interface EraData {
BC: string;
AD: string;
}
export interface DateTimeFormatLocaleInternalData {
am: string;
pm: string;
weekday: {
narrow: string[];
long: string[];
short: string[];
};
era: {
narrow: EraData;
long: EraData;
short: EraData;
};
month: {
narrow: string[];
long: string[];
short: string[];
};
timeZoneName: TimeZoneNameData;
/**
* So we can construct GMT+08:00
*/
gmtFormat: string;
/**
* So we can construct GMT+08:00
*/
hourFormat: string;
hourCycle: string;
dateFormat: {
full: Formats;
long: Formats;
medium: Formats;
short: Formats;
};
timeFormat: {
full: Formats;
long: Formats;
medium: Formats;
short: Formats;
};
dateTimeFormat: {
full: string;
long: string;
medium: string;
short: string;
};
formats: Record<string, Formats[]>;
nu: string[];
hc: string[];
ca: string[];
}
export declare type Formats = Pick<DateTimeFormatOptions, 'weekday' | 'era' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'timeZoneName'> & {
hour12?: boolean;
pattern: string;
pattern12: string;
skeleton: string;
rawPattern: string;
};
export interface DateTimeFormatOptions extends Intl.DateTimeFormatOptions {
hourCycle?: 'h11' | 'h12' | 'h23' | 'h24';
dateStyle?: 'full' | 'long' | 'medium' | 'short';
timeStyle?: 'full' | 'long' | 'medium' | 'short';
fractionalSecondDigits?: number;
calendar?: 'buddhist' | 'chinese' | 'coptic' | 'ethiopia' | 'ethiopic' | 'gregory' | 'hebrew' | 'indian' | 'islamic' | 'iso8601' | 'japanese' | 'persian' | 'roc';
numberingSystem?: string;
}
//# sourceMappingURL=types.d.ts.map
{
"name": "@formatjs/intl-datetimeformat",
"version": "2.6.3",
"version": "2.6.4",
"description": "Intl.DateTimeFormat polyfill",

@@ -25,7 +25,4 @@ "main": "index.js",

"dependencies": {
"@formatjs/ecma402-abstract": "^1.0.3",
"@formatjs/intl-getcanonicallocales": "^1.4.2",
"@types/es-abstract": "^1.17.1",
"es-abstract": "^1.17.6"
"@formatjs/ecma402-abstract": "^1.1.0"
}
}

@@ -1,1 +0,1 @@

!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).Symbol,r=function r(){return"function"==typeof e&&"function"==typeof Symbol&&"symbol"==typeof e("foo")&&"symbol"==typeof Symbol("bar")&&function e(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var r={},t=Symbol("test"),o=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(o))return!1;for(t in r[t]=42,r)return!1;if("function"==typeof Object.keys&&0!==Object.keys(r).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(r).length)return!1;var n=Object.getOwnPropertySymbols(r);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(r,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var a=Object.getOwnPropertyDescriptor(r,t);if(42!==a.value||!0!==a.enumerable)return!1}return!0}()},t="Function.prototype.bind called on incompatible ",o=Array.prototype.slice,n=Object.prototype.toString,a=Function.prototype.bind||function e(r){var a=this;if("function"!=typeof a||"[object Function]"!==n.call(a))throw new TypeError(t+a);for(var i,u=o.call(arguments,1),l=function(){if(this instanceof i){var e=a.apply(this,u.concat(o.call(arguments)));return Object(e)===e?e:this}return a.apply(r,u.concat(o.call(arguments)))},c=Math.max(0,a.length-u.length),f=[],p=0;p<c;p++)f.push("$"+p);if(i=Function("binder","return function ("+f.join(",")+"){ return binder.apply(this,arguments); }")(l),a.prototype){var y=function e(){};y.prototype=a.prototype,i.prototype=new y,y.prototype=null}return i},i=TypeError,u=Object.getOwnPropertyDescriptor;if(u)try{u({},"")}catch(e){u=null}var l=function(){throw new i},c=u?function(){try{return l}catch(e){try{return u(arguments,"callee").get}catch(e){return l}}}():l,f=r(),p=Object.getPrototypeOf||function(e){return e.__proto__},y="undefined"==typeof Uint8Array?void 0:p(Uint8Array),s={"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayBufferPrototype%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer.prototype,"%ArrayIteratorPrototype%":f?p([][Symbol.iterator]()):void 0,"%ArrayPrototype%":Array.prototype,"%ArrayProto_entries%":Array.prototype.entries,"%ArrayProto_forEach%":Array.prototype.forEach,"%ArrayProto_keys%":Array.prototype.keys,"%ArrayProto_values%":Array.prototype.values,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":void 0,"%AsyncFunctionPrototype%":void 0,"%AsyncGenerator%":void 0,"%AsyncGeneratorFunction%":void 0,"%AsyncGeneratorPrototype%":void 0,"%AsyncIteratorPrototype%":void 0,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%Boolean%":Boolean,"%BooleanPrototype%":Boolean.prototype,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%DataViewPrototype%":"undefined"==typeof DataView?void 0:DataView.prototype,"%Date%":Date,"%DatePrototype%":Date.prototype,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%ErrorPrototype%":Error.prototype,"%eval%":eval,"%EvalError%":EvalError,"%EvalErrorPrototype%":EvalError.prototype,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float32ArrayPrototype%":"undefined"==typeof Float32Array?void 0:Float32Array.prototype,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%Float64ArrayPrototype%":"undefined"==typeof Float64Array?void 0:Float64Array.prototype,"%Function%":Function,"%FunctionPrototype%":Function.prototype,"%Generator%":void 0,"%GeneratorFunction%":void 0,"%GeneratorPrototype%":void 0,"%Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"%Int8ArrayPrototype%":"undefined"==typeof Int8Array?void 0:Int8Array.prototype,"%Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"%Int16ArrayPrototype%":"undefined"==typeof Int16Array?void 0:Int8Array.prototype,"%Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"%Int32ArrayPrototype%":"undefined"==typeof Int32Array?void 0:Int32Array.prototype,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":f?p(p([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%JSONParse%":"object"==typeof JSON?JSON.parse:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&f?p((new Map)[Symbol.iterator]()):void 0,"%MapPrototype%":"undefined"==typeof Map?void 0:Map.prototype,"%Math%":Math,"%Number%":Number,"%NumberPrototype%":Number.prototype,"%Object%":Object,"%ObjectPrototype%":Object.prototype,"%ObjProto_toString%":Object.prototype.toString,"%ObjProto_valueOf%":Object.prototype.valueOf,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?void 0:Promise,"%PromisePrototype%":"undefined"==typeof Promise?void 0:Promise.prototype,"%PromiseProto_then%":"undefined"==typeof Promise?void 0:Promise.prototype.then,"%Promise_all%":"undefined"==typeof Promise?void 0:Promise.all,"%Promise_reject%":"undefined"==typeof Promise?void 0:Promise.reject,"%Promise_resolve%":"undefined"==typeof Promise?void 0:Promise.resolve,"%Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"%RangeError%":RangeError,"%RangeErrorPrototype%":RangeError.prototype,"%ReferenceError%":ReferenceError,"%ReferenceErrorPrototype%":ReferenceError.prototype,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%RegExpPrototype%":RegExp.prototype,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&f?p((new Set)[Symbol.iterator]()):void 0,"%SetPrototype%":"undefined"==typeof Set?void 0:Set.prototype,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%SharedArrayBufferPrototype%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer.prototype,"%String%":String,"%StringIteratorPrototype%":f?p(""[Symbol.iterator]()):void 0,"%StringPrototype%":String.prototype,"%Symbol%":f?Symbol:void 0,"%SymbolPrototype%":f?Symbol.prototype:void 0,"%SyntaxError%":SyntaxError,"%SyntaxErrorPrototype%":SyntaxError.prototype,"%ThrowTypeError%":c,"%TypedArray%":y,"%TypedArrayPrototype%":y?y.prototype:void 0,"%TypeError%":i,"%TypeErrorPrototype%":i.prototype,"%Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"%Uint8ArrayPrototype%":"undefined"==typeof Uint8Array?void 0:Uint8Array.prototype,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint8ClampedArrayPrototype%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray.prototype,"%Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"%Uint16ArrayPrototype%":"undefined"==typeof Uint16Array?void 0:Uint16Array.prototype,"%Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"%Uint32ArrayPrototype%":"undefined"==typeof Uint32Array?void 0:Uint32Array.prototype,"%URIError%":URIError,"%URIErrorPrototype%":URIError.prototype,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakMapPrototype%":"undefined"==typeof WeakMap?void 0:WeakMap.prototype,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet,"%WeakSetPrototype%":"undefined"==typeof WeakSet?void 0:WeakSet.prototype},d=a.call(Function.call,String.prototype.replace),m=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,v=/\\(\\)?/g,h=function e(r){var t=[];return d(r,m,(function(e,r,o,n){t[t.length]=o?d(n,v,"$1"):r||e})),t},g=function e(r,t){if(!(r in s))throw new SyntaxError("intrinsic "+r+" does not exist!");if(void 0===s[r]&&!t)throw new i("intrinsic "+r+" exists, but is not available. Please file an issue!");return s[r]},A=function e(r,t){if("string"!=typeof r||0===r.length)throw new TypeError("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new TypeError('"allowMissing" argument must be a boolean');for(var o=h(r),n=g("%"+(o.length>0?o[0]:"")+"%",t),a=1;a<o.length;a+=1)if(null!=n)if(u&&a+1>=o.length){var l=u(n,o[a]);if(!t&&!(o[a]in n))throw new i("base intrinsic for "+r+" exists, but the property is not available.");n=l?l.get||l.value:n[o[a]]}else n=n[o[a]];return n},b=A("%String%"),w=A("%TypeError%");function S(e,r,t,o,n){var a=e[r];if(void 0!==a){if("boolean"!==t&&"string"!==t)throw new TypeError("invalid type");if("boolean"===t&&(a=Boolean(a)),"string"===t&&(a=function e(r){if("symbol"==typeof r)throw new w("Cannot convert a Symbol value to a string");return b(r)}(a)),void 0!==o&&!o.filter((function(e){return e==a})).length)throw new RangeError(a+" is not within "+o.join(", "));return a}return n}function P(e,r,t){Object.defineProperty(e,r,{configurable:!0,enumerable:!1,writable:!0,value:t.value})}var E=/-u(?:-[0-9a-z]{2,8})+/gi;function O(e,r,t){if(void 0===t&&(t=Error),!e)throw new t(r)}function j(e,r){for(var t=r;;){if(~e.indexOf(t))return t;var o=t.lastIndexOf("-");if(!~o)return;o>=2&&"-"===t[o-2]&&(o-=2),t=t.slice(0,o)}}function T(e,r){O(2===r.length,"key must have 2 elements");var t=e.length,o="-"+r+"-",n=e.indexOf(o);if(-1!==n){for(var a=n+4,i=a,u=a,l=!1;!l;){var c=e.indexOf("-",u);2==(-1===c?t-u:c-u)?l=!0:-1===c?(i=t,l=!0):(i=c,u=c+1)}return e.slice(a,i)}if(-1!==(n=e.indexOf(o="-"+r))&&n+3===t)return""}var C,F=A("%TypeError%"),I=A("%Object%"),k=function e(r){return function e(r,t){if(null==r)throw new F(t||"Cannot call method on "+r)}(r),I(r)},U=(C=function(e,r){return(C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])})(e,r)},function(e,r){function t(){this.constructor=e}C(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}),D=function(){return(D=Object.assign||function(e){for(var r,t=1,o=arguments.length;t<o;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e}).apply(this,arguments)},M=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.type="MISSING_LOCALE_DATA",r}return U(r,e),r}(Error);function _(e,r,t){void 0===t&&(t=function(e,r){return D(D({},e),r)});var o=function n(e){for(var r=[e],t=e.split("-"),o=t.length;o>1;o--)r.push(t.slice(0,o-1).join("-"));return r}(e),a=o.map((function(e){return r.data[e]})).filter(Boolean);if(!a.length)throw new M('Missing locale data for "'+e+'", lookup hierarchy: '+o.join(", "));return a.reverse(),a.reduce(t,{})}var x=new WeakMap;function N(e){var r=x.get(e);return r||(r=Object.create(null),x.set(e,r)),r}var R={"Africa/Asmera":"Africa/Nairobi","Africa/Timbuktu":"Africa/Abidjan","America/Argentina/ComodRivadavia":"America/Argentina/Catamarca","America/Atka":"America/Adak","America/Buenos_Aires":"America/Argentina/Buenos_Aires","America/Catamarca":"America/Argentina/Catamarca","America/Coral_Harbour":"America/Atikokan","America/Cordoba":"America/Argentina/Cordoba","America/Ensenada":"America/Tijuana","America/Fort_Wayne":"America/Indiana/Indianapolis","America/Godthab":"America/Nuuk","America/Indianapolis":"America/Indiana/Indianapolis","America/Jujuy":"America/Argentina/Jujuy","America/Knox_IN":"America/Indiana/Knox","America/Louisville":"America/Kentucky/Louisville","America/Mendoza":"America/Argentina/Mendoza","America/Montreal":"America/Toronto","America/Porto_Acre":"America/Rio_Branco","America/Rosario":"America/Argentina/Cordoba","America/Santa_Isabel":"America/Tijuana","America/Shiprock":"America/Denver","America/Virgin":"America/Port_of_Spain","Antarctica/South_Pole":"Pacific/Auckland","Asia/Ashkhabad":"Asia/Ashgabat","Asia/Calcutta":"Asia/Kolkata","Asia/Chongqing":"Asia/Shanghai","Asia/Chungking":"Asia/Shanghai","Asia/Dacca":"Asia/Dhaka","Asia/Harbin":"Asia/Shanghai","Asia/Kashgar":"Asia/Urumqi","Asia/Katmandu":"Asia/Kathmandu","Asia/Macao":"Asia/Macau","Asia/Rangoon":"Asia/Yangon","Asia/Saigon":"Asia/Ho_Chi_Minh","Asia/Tel_Aviv":"Asia/Jerusalem","Asia/Thimbu":"Asia/Thimphu","Asia/Ujung_Pandang":"Asia/Makassar","Asia/Ulan_Bator":"Asia/Ulaanbaatar","Atlantic/Faeroe":"Atlantic/Faroe","Atlantic/Jan_Mayen":"Europe/Oslo","Australia/ACT":"Australia/Sydney","Australia/Canberra":"Australia/Sydney","Australia/LHI":"Australia/Lord_Howe","Australia/NSW":"Australia/Sydney","Australia/North":"Australia/Darwin","Australia/Queensland":"Australia/Brisbane","Australia/South":"Australia/Adelaide","Australia/Tasmania":"Australia/Hobart","Australia/Victoria":"Australia/Melbourne","Australia/West":"Australia/Perth","Australia/Yancowinna":"Australia/Broken_Hill","Brazil/Acre":"America/Rio_Branco","Brazil/DeNoronha":"America/Noronha","Brazil/East":"America/Sao_Paulo","Brazil/West":"America/Manaus","Canada/Atlantic":"America/Halifax","Canada/Central":"America/Winnipeg","Canada/Eastern":"America/Toronto","Canada/Mountain":"America/Edmonton","Canada/Newfoundland":"America/St_Johns","Canada/Pacific":"America/Vancouver","Canada/Saskatchewan":"America/Regina","Canada/Yukon":"America/Whitehorse","Chile/Continental":"America/Santiago","Chile/EasterIsland":"Pacific/Easter",Cuba:"America/Havana",Egypt:"Africa/Cairo",Eire:"Europe/Dublin","Etc/UCT":"Etc/UTC","Europe/Belfast":"Europe/London","Europe/Tiraspol":"Europe/Chisinau",GB:"Europe/London","GB-Eire":"Europe/London","GMT+0":"Etc/GMT","GMT-0":"Etc/GMT",GMT0:"Etc/GMT",Greenwich:"Etc/GMT",Hongkong:"Asia/Hong_Kong",Iceland:"Atlantic/Reykjavik",Iran:"Asia/Tehran",Israel:"Asia/Jerusalem",Jamaica:"America/Jamaica",Japan:"Asia/Tokyo",Kwajalein:"Pacific/Kwajalein",Libya:"Africa/Tripoli","Mexico/BajaNorte":"America/Tijuana","Mexico/BajaSur":"America/Mazatlan","Mexico/General":"America/Mexico_City",NZ:"Pacific/Auckland","NZ-CHAT":"Pacific/Chatham",Navajo:"America/Denver",PRC:"Asia/Shanghai","Pacific/Johnston":"Pacific/Honolulu","Pacific/Ponape":"Pacific/Pohnpei","Pacific/Samoa":"Pacific/Pago_Pago","Pacific/Truk":"Pacific/Chuuk","Pacific/Yap":"Pacific/Chuuk",Poland:"Europe/Warsaw",Portugal:"Europe/Lisbon",ROC:"Asia/Taipei",ROK:"Asia/Seoul",Singapore:"Asia/Singapore",Turkey:"Europe/Istanbul",UCT:"Etc/UTC","US/Alaska":"America/Anchorage","US/Aleutian":"America/Adak","US/Arizona":"America/Phoenix","US/Central":"America/Chicago","US/East-Indiana":"America/Indiana/Indianapolis","US/Eastern":"America/New_York","US/Hawaii":"Pacific/Honolulu","US/Indiana-Starke":"America/Indiana/Knox","US/Michigan":"America/Detroit","US/Mountain":"America/Denver","US/Pacific":"America/Los_Angeles","US/Samoa":"Pacific/Pago_Pago",UTC:"Etc/UTC",Universal:"Etc/UTC","W-SU":"Europe/Moscow",Zulu:"Etc/UTC"},L=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g,B=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function Z(e,r){void 0===r&&(r={pattern:"",pattern12:"",skeleton:"",rawPattern:""});var t=e.length;switch(e[0]){case"G":return r.era=4===t?"long":5===t?"narrow":"short","{era}";case"y":case"Y":case"u":case"U":case"r":return r.year=2===t?"2-digit":"numeric","{year}";case"q":case"Q":throw new RangeError("`w/Q` (quarter) patterns are not supported");case"M":case"L":return r.month=["numeric","2-digit","short","long","narrow"][t-1],"{month}";case"w":case"W":throw new RangeError("`w/W` (week of year) patterns are not supported");case"d":return r.day=["numeric","2-digit"][t-1],"{day}";case"D":case"F":case"g":return r.day="numeric","{day}";case"E":return r.weekday=4===t?"long":5===t?"narrow":"short","{weekday}";case"e":return r.weekday=["numeric","2-digit","short","long","narrow","short"][t-1],"{weekday}";case"c":return r.weekday=["numeric",void 0,"short","long","narrow","short"][t-1],"{weekday}";case"a":case"b":case"B":return r.hour12=!0,"{ampm}";case"h":case"H":case"K":case"k":return r.hour=["numeric","2-digit"][t-1],"{hour}";case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":return r.minute=["numeric","2-digit"][t-1],"{minute}";case"s":return r.second=["numeric","2-digit"][t-1],"{second}";case"S":case"A":return r.second="numeric","{second}";case"z":case"Z":case"O":case"v":case"V":case"X":case"x":return r.timeZoneName=t<4?"short":"long","{timeZoneName}"}return""}function G(e,r){void 0===r&&(r=e);var t={pattern:"",pattern12:"",skeleton:e,rawPattern:r},o=[];return t.pattern12=r.replace(/'{2}/g,"{apostrophe}").replace(/'(.*?)'/g,(function(e,r){return o.push(r),"$$"+(o.length-1)+"$$"})).replace(L,Z),e.replace(L,(function(e){return Z(e,t)})),o.length&&(t.pattern12=t.pattern12.replace(/\$\$(\d+)\$\$/g,(function(e,r){return o[+r]})).replace(/\{apostrophe\}/g,"'")),t.pattern=t.pattern12.replace(/([\s\uFEFF\xA0])\{ampm\}([\s\uFEFF\xA0])/,"$1").replace("{ampm}","").replace(B,""),t}var W=Number.isNaN||function(e){return e!=e},H=Number.isFinite||function(e){return"number"==typeof e&&!W(e)&&e!==1/0&&e!==-1/0},$=A("%Function.prototype.apply%"),z=A("%Function.prototype.call%"),J=A("%Reflect.apply%",!0)||a.call(z,$),K=function e(){return J(a,z,arguments)};K.apply=function e(){return J(a,$,arguments)};var V,Y,q=K(A("String.prototype.indexOf")),Q=function e(r,t){var o=A(r,!!t);return"function"==typeof o&&q(r,".prototype.")?K(o):o},X=A("RegExp.prototype.test"),ee=function e(r){return K(X,r)},re=function e(r){return null===r||"function"!=typeof r&&"object"!=typeof r},te=Function.prototype.toString,oe="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof oe&&"function"==typeof Object.defineProperty)try{V=Object.defineProperty({},"length",{get:function(){throw Y}}),Y={}}catch(e){oe=null}else oe=null;var ne=/^\s*class\b/,ae=function e(r){try{var t=te.call(r);return ne.test(t)}catch(e){return!1}},ie=Object.prototype.toString,ue="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,le=oe?function e(r){if(!r)return!1;if("function"!=typeof r&&"object"!=typeof r)return!1;if("function"==typeof r&&!r.prototype)return!0;try{oe(r,null,V)}catch(e){if(e!==Y)return!1}return!ae(r)}:function e(r){if(!r)return!1;if("function"!=typeof r&&"object"!=typeof r)return!1;if("function"==typeof r&&!r.prototype)return!0;if(ue)return function e(r){try{return!ae(r)&&(te.call(r),!0)}catch(e){return!1}}(r);if(ae(r))return!1;var t=ie.call(r);return"[object Function]"===t||"[object GeneratorFunction]"===t},ce=Date.prototype.getDay,fe=Object.prototype.toString,pe="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,ye=function e(r){return"object"==typeof r&&null!==r&&(pe?function e(r){try{return ce.call(r),!0}catch(e){return!1}}(r):"[object Date]"===fe.call(r))},se=function de(e,r,t){return e(t={path:r,exports:{},require:function(e,r){return function t(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},t.exports),t.exports}((function(e){var t=Object.prototype.toString;if(r()){var o=Symbol.prototype.toString,n=/^Symbol\(.*\)$/;e.exports=function e(r){if("symbol"==typeof r)return!0;if("[object Symbol]"!==t.call(r))return!1;try{return function e(r){return"symbol"==typeof r.valueOf()&&n.test(o.call(r))}(r)}catch(e){return!1}}}else e.exports=function e(r){return!1}})),me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,ve=function e(r,t){if(null==r)throw new TypeError("Cannot call method on "+r);if("string"!=typeof t||"number"!==t&&"string"!==t)throw new TypeError('hint must be "string" or "number"');var o,n,a,i="string"===t?["toString","valueOf"]:["valueOf","toString"];for(a=0;a<i.length;++a)if(le(o=r[i[a]])&&(n=o.call(r),re(n)))return n;throw new TypeError("No default value")},he=function e(r,t){var o=r[t];if(null!=o){if(!le(o))throw new TypeError(o+" returned for property "+t+" of object "+r+" is not a function");return o}},ge=function e(r){if(re(r))return r;var t,o="default";if(arguments.length>1&&(arguments[1]===String?o="string":arguments[1]===Number&&(o="number")),me&&(Symbol.toPrimitive?t=he(r,Symbol.toPrimitive):se(r)&&(t=Symbol.prototype.valueOf)),void 0!==t){var n=t.call(r,o);if(re(n))return n;throw new TypeError("unable to convert exotic object to primitive")}return"default"===o&&(ye(r)||se(r))&&(o="string"),ve(r,"default"===o?"number":o)},Ae=A("%TypeError%"),be=A("%Number%"),we=A("%RegExp%"),Se=A("%parseInt%"),Pe=Q("String.prototype.slice"),Ee=ee(/^0b[01]+$/i),Oe=ee(/^0o[0-7]+$/i),je=ee(/^[-+]0x[0-9a-f]+$/i),Te=ee(new we("["+["…","​","￾"].join("")+"]","g")),Ce=["\t\n\v\f\r   ᠎    ","          \u2028","\u2029\ufeff"].join(""),Fe=new RegExp("(^["+Ce+"]+)|(["+Ce+"]+$)","g"),Ie=Q("String.prototype.replace"),ke=function e(r){var t=function e(r){return null===r||"function"!=typeof r&&"object"!=typeof r}(r)?r:function e(r){return arguments.length>1?ge(r,arguments[1]):ge(r)}(r,be);if("symbol"==typeof t)throw new Ae("Cannot convert a Symbol value to a number");if("string"==typeof t){if(Ee(t))return e(Se(Pe(t,2),2));if(Oe(t))return e(Se(Pe(t,2),8));if(Te(t)||je(t))return NaN;var o=function(e){return Ie(e,Fe,"")}(t);if(o!==t)return e(o)}return be(t)},Ue=A("%Date%"),De=A("%Number%"),Me=A("%Math.abs%"),_e=Math.floor,xe=function e(r,t){var o=r%t;return _e(o>=0?o:o+t)},Ne=A("%Math.floor%"),Re=function e(r){return Ne(r/864e5)},Le=function e(r){return xe(Re(r)+4,7)},Be=A("%Math.floor%"),Ze=A("%Date%"),Ge=Q("Date.prototype.getUTCFullYear"),We=function e(r){return Ge(new Ze(r))},He=function e(r){return Re(r)-function e(r){return 365*(r-1970)+Be((r-1969)/4)-Be((r-1901)/100)+Be((r-1601)/400)}(We(r))},$e=A("%EvalError%"),ze=function e(r){var t=function e(r){return 0!==xe(r,4)?365:0!==xe(r,100)?366:0!==xe(r,400)?365:366}(We(r));if(365===t)return 0;if(366===t)return 1;throw new $e("Assertion failed: there are not 365 or 366 days in a year, got: "+t)},Je=function e(r){var t=He(r);if(0<=t&&t<31)return 0;var o=ze(r);return 31<=t&&t<59+o?1:59+o<=t&&t<90+o?2:90+o<=t&&t<120+o?3:120+o<=t&&t<151+o?4:151+o<=t&&t<181+o?5:181+o<=t&&t<212+o?6:212+o<=t&&t<243+o?7:243+o<=t&&t<273+o?8:273+o<=t&&t<304+o?9:304+o<=t&&t<334+o?10:334+o<=t&&t<365+o?11:void 0},Ke=A("%EvalError%"),Ve=function e(r){var t=Je(r),o=He(r);if(0===t)return o+1;if(1===t)return o-30;var n=ze(r);if(2===t)return o-58-n;if(3===t)return o-89-n;if(4===t)return o-119-n;if(5===t)return o-150-n;if(6===t)return o-180-n;if(7===t)return o-211-n;if(8===t)return o-242-n;if(9===t)return o-272-n;if(10===t)return o-303-n;if(11===t)return o-333-n;throw new Ke("Assertion failed: MonthFromTime returned an impossible value: "+t)},Ye=A("%Math.floor%"),qe=function e(r){return xe(Ye(r/36e5),24)},Qe=A("%Math.floor%"),Xe=function e(r){return xe(Qe(r/6e4),60)},er=A("%Math.floor%"),rr=function e(r){return xe(er(r/1e3),60)},tr=function(){return(tr=Object.assign||function(e){for(var r,t=1,o=arguments.length;t<o;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e}).apply(this,arguments)},or=function(e,r){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)r.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(t[o[n]]=e[o[n]])}return t},nr=Object.keys(R).reduce((function(e,r){return e[r.toUpperCase()]=R[r],e}),{}),ar=["weekday","era","year","month","day","hour","minute","second","timeZoneName"],ir=["locale","calendar","numberingSystem","dateStyle","timeStyle","timeZone","hourCycle","weekday","era","year","month","day","hour","minute","second","timeZoneName"],ur=/^[a-z0-9]{3,8}$/i;function lr(e){var r=e.toUpperCase();return new Set(Object.keys(Ar.tzData).map((function(e){return e.toUpperCase()}))).has(r)||r in nr}function cr(e){var r=e.toUpperCase(),t=Object.keys(Ar.tzData).reduce((function(e,r){return e[r.toUpperCase()]=r,e}),{}),o=nr[r]||t[r];return"Etc/UTC"===o||"Etc/GMT"===o?"UTC":o}function fr(e,r,t){e=void 0===e?null:k(e),e=Object.create(e);var o=!0;if("date"===r||"any"===r)for(var n=0,a=["weekday","year","month","day"];n<a.length;n++)void 0!==e[a[n]]&&(o=!1);if("time"===r||"any"===r)for(var i=0,u=["hour","minute","second"];i<u.length;i++)void 0!==e[u[i]]&&(o=!1);if(void 0===e.dateStyle&&void 0===e.timeStyle||(o=!1),"date"===r&&e.timeStyle)throw new TypeError("Intl.DateTimeFormat date was required but timeStyle was included");if("time"===r&&e.dateStyle)throw new TypeError("Intl.DateTimeFormat time was required but dateStyle was included");if(o&&("date"===t||"all"===t))for(var l=0,c=["year","month","day"];l<c.length;l++)e[c[l]]="numeric";if(o&&("time"===t||"all"===t))for(var f=0,p=["hour","minute","second"];f<p.length;f++)e[p[f]]="numeric";return e}var pr=["2-digit","numeric","narrow","short","long"];function yr(e,r){for(var t=0,o=0,n=ar;o<n.length;o++){var a=n[o],i=e[a],u=r[a];if(void 0===i&&void 0!==u)t-=20;else if(void 0!==i&&void 0===u)t-=120;else if(i!==u){var l=pr.indexOf(i),c=pr.indexOf(u),f=Math.max(-2,Math.min(c-l,2));2===f?t-=6:1===f?t-=3:-1===f?t-=6:-2===f&&(t-=8)}}return t}function sr(e,r){var t=0;e.hour12&&!r.hour12?t-=120:!e.hour12&&r.hour12&&(t-=20);for(var o=0,n=ar;o<n.length;o++){var a=n[o],i=e[a],u=r[a];if(void 0===i&&void 0!==u)t-=20;else if(void 0!==i&&void 0===u)t-=120;else if(i!==u)if(dr(i)!==dr(u))t-=15;else{var l=pr.indexOf(i),c=pr.indexOf(u),f=Math.max(-2,Math.min(c-l,2));2===f?t-=6:1===f?t-=3:-1===f?t-=6:-2===f&&(t-=8)}}return t}function dr(e){return"numeric"===e||"2-digit"===e}var mr={enumerable:!1,configurable:!0,get:function(){if("object"!=typeof this||!(this instanceof Ar))throw TypeError("Intl.DateTimeFormat format property accessor called on incompatible receiver");var e=N(this),r=this,t=e.boundFormat;if(void 0===t){t=function(e){var t;return t=void 0===e?Date.now():Number(e),function o(e,r){for(var t="",o=0,n=gr(e,r);o<n.length;o++)t+=n[o].value;return t}(r,t)};try{Object.defineProperty(t,"name",{configurable:!0,enumerable:!1,writable:!1,value:""})}catch(e){}e.boundFormat=t}return t}};try{Object.defineProperty(mr.get,"name",{configurable:!0,enumerable:!1,writable:!1,value:"get format"})}catch(e){}function vr(e){return e<10?"0"+e:String(e)}function hr(e,r,t,o){var n=Math.floor(t/6e4),a=Math.abs(n)%60,i=Math.floor(Math.abs(n)/60),u=r.split(";"),l="",c=t<0?u[1]:u[0];return"long"===o?l=c.replace("HH",vr(i)).replace("H",String(i)).replace("mm",vr(a)).replace("m",String(a)):(a||i)&&(a||(c=c.replace(/:?m+/,"")),l=c.replace(/H+/,String(i)).replace(/m+/,String(a))),e.replace("{0}",l)}function gr(e,r){if(r=function e(r){return!H(r)||Me(r)>864e13?NaN:De(new Ue(ke(r)))}(r),isNaN(r))throw new RangeError("invalid time");var t=N(e),o=Ar.localeData[t.dataLocale],n=t.locale,a=Object.create(null);a.useGrouping=!1;var i=new Intl.NumberFormat(n,a),u=Object.create(null);u.minimumIntegerDigits=2,u.useGrouping=!1;for(var l=new Intl.NumberFormat(n,u),c=function f(e,r,t){O("number"==typeof e,"invalid time"),O("gregory"===r,"We only support Gregory calendar right now");var o=function n(e,r){var t,o=Ar.tzData[r];if(!o)return[0,!1];for(var n=0,a=0,i=!1;n<=o.length;n++)if(n===o.length||1e3*o[n][0]>=e){a=(t=o[n-1])[2],i=t[3];break}return[1e3*a,i]}(e,t),a=o[0],i=o[1],u=e+a,l=We(u);return{weekday:Le(u),era:l<0?"BC":"AD",year:l,relatedYear:void 0,yearName:void 0,month:Je(u),day:Ve(u),hour:qe(u),minute:Xe(u),second:rr(u),inDST:i,timeZoneOffset:a}}(r,t.calendar,t.timeZone),p=[],y=0,s=function d(e){for(var r=[],t=e.indexOf("{"),o=0,n=0,a=e.length;t<e.length&&t>-1;)O((o=e.indexOf("}",t))>t,"Invalid pattern "+e),t>n&&r.push({type:"literal",value:e.substring(n,t)}),r.push({type:e.substring(t+1,o),value:void 0}),t=e.indexOf("{",n=o+1);return n<a&&r.push({type:"literal",value:e.substring(n,a)}),r}(t.pattern);y<s.length;y++){var m=s[y],v=m.type;if("literal"===v)p.push({type:"literal",value:m.value});else if(ar.indexOf(v)>-1){var h="",g=t[v],A=c[v];"year"===v&&A<=0&&(A=1-A),"month"===v&&A++;var b=t.hourCycle;if("hour"!==v||"h11"!==b&&"h12"!==b||0==(A%=12)&&"h12"===b&&(A=12),"hour"===v&&"h24"===b&&0===A&&(A=24),"numeric"===g)h=i.format(A);else if("2-digit"===g)(h=l.format(A)).length>2&&(h=h.slice(h.length-2,h.length));else if("narrow"===g||"short"===g||"long"===g)if("era"===v)h=o[v][g][A];else if("timeZoneName"===v){var w=o.gmtFormat,S=o.hourFormat,P=o.timeZoneName[t.timeZone||Ar.getDefaultTimeZone()];h=P&&P[g]?P[g][+c.inDST]:hr(w,S,c.timeZoneOffset,g)}else h="month"===v?o.month[g][A-1]:o[v][g][A];p.push({type:v,value:h})}else"ampm"===v?(h=void 0,p.push({type:"dayPeriod",value:h=(A=c.hour)>=11?o.pm:o.am})):"relatedYear"===v?(h=i.format(A=c.relatedYear),p.push({type:"relatedYear",value:h})):"yearName"===v?(h=i.format(A=c.yearName),p.push({type:"yearName",value:h})):p.push({type:"unknown",value:r})}return p}var Ar=function(e,r){if(!(this&&this instanceof Ar))return new Ar(e,r);!function t(e,r,o){var n=Intl.getCanonicalLocales(r),a=fr(o,"any","date"),i=Object.create(null),u=S(a,"localeMatcher","string",["lookup","best fit"],"best fit");i.localeMatcher=u;var l=S(a,"calendar","string",void 0,void 0);if(void 0!==l&&!ur.test(l))throw new RangeError("Malformed calendar");var c=N(e);i.ca=l;var f=S(a,"numberingSystem","string",void 0,void 0);if(void 0!==f&&!ur.test(f))throw new RangeError("Malformed numbering system");i.nu=f;var p=S(a,"hour12","boolean",void 0,void 0),y=S(a,"hourCycle","string",["h11","h12","h23","h24"],void 0);void 0!==p&&(y=null),i.hc=y;var s=function d(e,r,t,o,n,a){for(var i,u=(i="lookup"===t.localeMatcher?function l(e,r,t){for(var o={locale:""},n=0,a=r;n<a.length;n++){var i=a[n],u=i.replace(E,""),l=j(e,u);if(l)return o.locale=l,i!==u&&(o.extension=i.slice(u.length+1,i.length)),o}return o.locale=t(),o}(e,r,a):function c(e,r,t){for(var o={locale:""},n=0,a=r;n<a.length;n++){var i=a[n],u=i.replace(E,""),l=j(e,u);if(l)return o.locale=l,i!==u&&(o.extension=i.slice(u.length+1,i.length)),o}return o.locale=t(),o}(e,r,a)).locale,f={locale:"",dataLocale:u},p="-u",y=0,s=o;y<s.length;y++){var d=s[y],m=n[u];O("object"==typeof m&&null!==m,"locale data "+d+" must be an object");var v=m[d];O(Array.isArray(v),"keyLocaleData for "+d+" must be an array");var h=v[0];O("string"==typeof h||null===h,"value must be string or null but got "+typeof h+" in key "+d);var g="";if(i.extension){var A=T(i.extension,d);void 0!==A&&(""!==A?~v.indexOf(A)&&(g="-"+d+"-"+(h=A)):~A.indexOf("true")&&(h="true",g="-"+d))}if(d in t){var b=t[d];O("string"==typeof b||null==b,"optionsValue must be String, Undefined or Null"),~v.indexOf(b)&&b!==h&&(h=b,g="")}f[d]=h,p+=g}if(p.length>2){var w=u.indexOf("-x-");if(-1===w)u+=p;else{var S=u.slice(0,w),P=u.slice(w,u.length);u=S+p+P}u=Intl.getCanonicalLocales(u)[0]}return f.locale=u,f}(Ar.availableLocales,n,i,["nu","ca","hc"],Ar.localeData,Ar.getDefaultLocale);c.locale=s.locale,c.calendar=l=s.ca,c.hourCycle=s.hc,c.numberingSystem=s.nu;var m=s.dataLocale;c.dataLocale=m;var v=a.timeZone;if(void 0!==v){if(!lr(v=String(v)))throw new RangeError("Invalid timeZoneName");v=cr(v)}else v=Ar.getDefaultTimeZone();c.timeZone=v,(i=Object.create(null)).weekday=S(a,"weekday","string",["narrow","short","long"],void 0),i.era=S(a,"era","string",["narrow","short","long"],void 0),i.year=S(a,"year","string",["2-digit","numeric"],void 0),i.month=S(a,"month","string",["2-digit","numeric","narrow","short","long"],void 0),i.day=S(a,"day","string",["2-digit","numeric"],void 0),i.hour=S(a,"hour","string",["2-digit","numeric"],void 0),i.minute=S(a,"minute","string",["2-digit","numeric"],void 0),i.second=S(a,"second","string",["2-digit","numeric"],void 0),i.timeZoneName=S(a,"timeZoneName","string",["short","long"],void 0);var h=Ar.localeData[m],g=h.formats[l];u=S(a,"formatMatcher","string",["basic","best fit"],"best fit");var A=S(a,"dateStyle","string",["full","long","medium","short"],void 0);c.dateStyle=A;var b,w,P=S(a,"timeStyle","string",["full","long","medium","short"],void 0);if(c.timeStyle=P,void 0===A&&void 0===P)"basic"===u?b=function C(e,r){var t=-1/0,o=r[0];O(Array.isArray(r),"formats should be a list of things");for(var n=0,a=r;n<a.length;n++){var i=a[n],u=yr(e,i);u>t&&(t=u,o=i)}return tr({},o)}(i,g):(function F(e){for(var r=0,t=["hour","minute","second"];r<t.length;r++)if(void 0!==e[t[r]])return!0;return!1}(i)&&(i.hour12="h11"===c.hourCycle||"h12"===c.hourCycle),b=function I(e,r){var t=-1/0,o=r[0];O(Array.isArray(r),"formats should be a list of things");for(var n=0,a=r;n<a.length;n++){var i=a[n],u=sr(e,i);u>t&&(t=u,o=i)}var l=tr({},o),c=G(o.rawPattern);for(var f in c){var p=l[f],y=e[f];"minute"!==f&&"second"!==f&&y&&(dr(c[f])&&!dr(y)||p!==y&&(c[f]=y))}return c}(i,g));else{for(var k=0,U=ar;k<U.length;k++)if(void 0!==(_=i[M=U[k]]))throw new TypeError("Intl.DateTimeFormat can't set option "+M+" when "+(A?"dateStyle":"timeStyle")+" is used");b=function D(e,r,t){var o,n;if(void 0!==r&&(n=t.timeFormat[r]),void 0!==e&&(o=t.dateFormat[e]),void 0!==e&&void 0!==o&&void 0!==n){var a=tr(tr({},o),n);delete a.pattern,delete a.pattern12;var i=t.dateTimeFormat[e];return a.pattern=i.replace("{0}",n.pattern).replace("{1}",o.pattern),void 0!==n.pattern12&&(a.pattern12=i.replace("{0}",n.pattern12).replace("{1}",o.pattern)),a}if(void 0!==n)return n;if(void 0===o)throw new TypeError("Intl.DateTimeFormat neither the dateFormat or the timeFormat could be found");return o}(A,P,h)}for(var M in i){var _;void 0!==(_=b[M])&&(c[M]=_)}if(void 0!==c.hour){var x=h.hourCycle,R=c.hourCycle;null==R&&(R=x),void 0!==p&&(p?R="h11"===x||"h23"===x?"h11":"h12":(O(!p,"hour12 must not be set"),R="h11"===x||"h23"===x?"h23":"h24")),c.hourCycle=R,w="h11"===R||"h12"===R?b.pattern12:b.pattern}else c.hourCycle=void 0,w=b.pattern;return c.pattern=w,e}(this,e,r);var o=N(this).dataLocale;O(void 0!==Ar.localeData[o],"Cannot load locale-dependent data for "+o+".")};P(Ar,"supportedLocalesOf",{value:function e(r,t){return function o(e,r,t){return void 0!==t&&S(t=k(t),"localeMatcher","string",["lookup","best fit"],"best fit"),function o(e,r){for(var t=[],o=0,n=r;o<n.length;o++){var a=j(e,n[o].replace(E,""));a&&t.push(a)}return t}(e,r)}(Ar.availableLocales,Intl.getCanonicalLocales(r),t)}}),P(Ar.prototype,"resolvedOptions",{value:function e(){if("object"!=typeof this||!(this instanceof Ar))throw TypeError("Method Intl.DateTimeFormat.prototype.resolvedOptions called on incompatible receiver");for(var r=N(this),t={},o=0,n=ir;o<n.length;o++){var a=n[o],i=r[a];if("hourCycle"===a){var u="h11"===i||"h12"===i||"h23"!==i&&"h24"!==i&&void 0;void 0!==u&&(t.hour12=u)}ar.indexOf(a)>-1&&(void 0===r.dateStyle&&void 0===r.timeStyle||(i=void 0)),void 0!==i&&(t[a]=i)}return t}}),P(Ar.prototype,"formatToParts",{value:function e(r){return function t(e,r){return gr(e,r)}(this,r=void 0===r?Date.now():ke(r))}});var br="undefined"!=typeof process&&process.env&&process.env.TZ||"UTC";Ar.__setDefaultTimeZone=function(e){if(void 0!==e){if(!lr(e=String(e)))throw new RangeError("Invalid timeZoneName");e=cr(e)}else e=br;Ar.__defaultTimeZone=e},Ar.__defaultTimeZone=br,Ar.getDefaultTimeZone=function(){return Ar.__defaultTimeZone},Ar.__addLocaleData=function e(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];for(var o=0,n=r;o<n.length;o++)for(var a=n[o],i=a.availableLocales,u=function(e){try{var r=_(e,a),t=r.dateFormat,o=r.timeFormat,n=r.dateTimeFormat,i=r.formats,u=or(r,["dateFormat","timeFormat","dateTimeFormat","formats"]),l=tr(tr({},u),{dateFormat:{full:G(t.full),long:G(t.long),medium:G(t.medium),short:G(t.short)},timeFormat:{full:G(o.full),long:G(o.long),medium:G(o.medium),short:G(o.short)},dateTimeFormat:{full:G(n.full).pattern,long:G(n.long).pattern,medium:G(n.medium).pattern,short:G(n.short).pattern},formats:{}}),c=function(e){l.formats[e]=Object.keys(i[e]).map((function(r){return G(r,i[e][r])}))};for(var f in i)c(f);Ar.localeData[e]=l}catch(e){}},l=0,c=i;l<c.length;l++){var f=c[l];u(f)}Ar.availableLocales=Object.keys(Ar.localeData),Ar.__defaultLocale||(Ar.__defaultLocale=Ar.availableLocales[0])},Object.defineProperty(Ar.prototype,"format",mr),Ar.__defaultLocale="",Ar.localeData={},Ar.availableLocales=[],Ar.getDefaultLocale=function(){return Ar.__defaultLocale},Ar.polyfilled=!0,Ar.tzData={},Ar.__addTZData=function(e){Ar.tzData=function r(e){for(var r=e.abbrvs.split("|"),t=e.offsets.split("|").map((function(e){return parseInt(e,36)})),o={},n=0,a=e.zones;n<a.length;n++){var i=a[n].split("|"),u=i[0],l=i.slice(1);o[u]=l.map((function(e){return e.split(",")})).map((function(e){var o=e[0],n=e[1],a=e[2],i=e[3];return[""===o?-1/0:parseInt(o,36),r[+n],t[+a],"1"===i]}))}return o}(e)};try{"undefined"!=typeof Symbol&&Object.defineProperty(Ar.prototype,Symbol.toStringTag,{value:"Intl.DateTimeFormat",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperty(Ar.prototype.constructor,"length",{value:1,writable:!1,enumerable:!1,configurable:!0})}catch(e){}(function wr(){return!("DateTimeFormat"in Intl)||!("formatToParts"in Intl.DateTimeFormat.prototype)||function e(){return"dayPeriod"!==new Intl.DateTimeFormat("en",{hourCycle:"h11",hour:"numeric"}).formatToParts(0)[2].type}()||!function r(){return!!new Intl.DateTimeFormat(void 0,{dateStyle:"short"}).resolvedOptions().dateStyle}()})()&&(P(Intl,"DateTimeFormat",{value:Ar}),P(Date.prototype,"toLocaleString",{value:function e(r,t){return function o(e,r,t){return new Ar(r,t).format(e)}(this,r,t)}}),P(Date.prototype,"toLocaleDateString",{value:function e(r,t){return function o(e,r,t){return new Ar(r,fr(t,"date","date")).format(e)}(this,r,t)}}),P(Date.prototype,"toLocaleTimeString",{value:function e(r,t){return function o(e,r,t){return new Ar(r,fr(t,"time","time")).format(e)}(this,r,t)}}))}));
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";function e(e){return Intl.getCanonicalLocales(e)}function a(e,a){var r=a.tzData,t=a.uppercaseLinks,n=e.toUpperCase(),i=Object.keys(r).reduce((function(e,a){return e[a.toUpperCase()]=a,e}),{}),o=t[n]||i[n];return"Etc/UTC"===o||"Etc/GMT"===o?"UTC":o}function r(e,a,r){Object.defineProperty(e,a,{configurable:!0,enumerable:!1,writable:!0,value:r.value})}var t=/-u(?:-[0-9a-z]{2,8})+/gi;function n(e,a,r){if(void 0===r&&(r=Error),!e)throw new r(a)}var i=["weekday","era","year","month","day","hour","minute","second","timeZoneName"],o=function(){return(o=Object.assign||function(e){for(var a,r=1,t=arguments.length;r<t;r++)for(var n in a=arguments[r])Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);return e}).apply(this,arguments)},l=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g,u=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function c(e,a){void 0===a&&(a={pattern:"",pattern12:"",skeleton:"",rawPattern:""});var r=e.length;switch(e[0]){case"G":return a.era=4===r?"long":5===r?"narrow":"short","{era}";case"y":case"Y":case"u":case"U":case"r":return a.year=2===r?"2-digit":"numeric","{year}";case"q":case"Q":throw new RangeError("`w/Q` (quarter) patterns are not supported");case"M":case"L":return a.month=["numeric","2-digit","short","long","narrow"][r-1],"{month}";case"w":case"W":throw new RangeError("`w/W` (week of year) patterns are not supported");case"d":return a.day=["numeric","2-digit"][r-1],"{day}";case"D":case"F":case"g":return a.day="numeric","{day}";case"E":return a.weekday=4===r?"long":5===r?"narrow":"short","{weekday}";case"e":return a.weekday=["numeric","2-digit","short","long","narrow","short"][r-1],"{weekday}";case"c":return a.weekday=["numeric",void 0,"short","long","narrow","short"][r-1],"{weekday}";case"a":case"b":case"B":return a.hour12=!0,"{ampm}";case"h":case"H":case"K":case"k":return a.hour=["numeric","2-digit"][r-1],"{hour}";case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":return a.minute=["numeric","2-digit"][r-1],"{minute}";case"s":return a.second=["numeric","2-digit"][r-1],"{second}";case"S":case"A":return a.second="numeric","{second}";case"z":case"Z":case"O":case"v":case"V":case"X":case"x":return a.timeZoneName=r<4?"short":"long","{timeZoneName}"}return""}function s(e,a){void 0===a&&(a=e);var r={pattern:"",pattern12:"",skeleton:e,rawPattern:a},t=[];return r.pattern12=a.replace(/'{2}/g,"{apostrophe}").replace(/'(.*?)'/g,(function(e,a){return t.push(a),"$$"+(t.length-1)+"$$"})).replace(l,c),e.replace(l,(function(e){return c(e,r)})),t.length&&(r.pattern12=r.pattern12.replace(/\$\$(\d+)\$\$/g,(function(e,a){return t[+a]})).replace(/\{apostrophe\}/g,"'")),r.pattern=r.pattern12.replace(/([\s\uFEFF\xA0])\{ampm\}([\s\uFEFF\xA0])/,"$1").replace("{ampm}","").replace(u,""),r}var f=function(){return(f=Object.assign||function(e){for(var a,r=1,t=arguments.length;r<t;r++)for(var n in a=arguments[r])Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);return e}).apply(this,arguments)};function m(e){return"numeric"===e||"2-digit"===e}function d(e,a){var r=0;e.hour12&&!a.hour12?r-=120:!e.hour12&&a.hour12&&(r-=20);for(var t=0,n=i;t<n.length;t++){var o=n[t],l=e[o],u=a[o];if(void 0===l&&void 0!==u)r-=20;else if(void 0!==l&&void 0===u)r-=120;else if(l!==u)if(m(l)!==m(u))r-=15;else{var c=["2-digit","numeric","narrow","short","long"],s=c.indexOf(l),f=c.indexOf(u),d=Math.max(-2,Math.min(f-s,2));2===d?r-=6:1===d?r-=3:-1===d?r-=6:-2===d&&(r-=8)}}return r}function h(e){if(void 0===e)return NaN;if(null===e)return 0;if("boolean"==typeof e)return e?1:0;if("number"==typeof e)return e;if("symbol"==typeof e||"bigint"==typeof e)throw new TypeError("Cannot convert symbol/bigint to number");return Number(e)}function p(e){if(null==e)throw new TypeError("undefined/null cannot be converted to object");return Object(e)}function v(e,a){return Object.is?Object.is(e,a):e===a?0!==e||1/e==1/a:e!=e&&a!=a}function g(e,a){return e-Math.floor(e/a)*a}function y(e){return Math.floor(e/864e5)}function A(e){return g(y(e)+4,7)}function b(e){return 365*(e-1970)+Math.floor((e-1969)/4)-Math.floor((e-1901)/100)+Math.floor((e-1601)/400)}function w(e){return 864e5*b(e)}function S(e){for(var a=Math.ceil(e/864e5/366);w(a)<=e;)a++;return a-1}function T(e){return y(e)-b(S(e))}function D(e){return 365===function a(e){return e%4!=0?365:e%100!=0?366:e%400!=0?365:366}(S(e))?0:1}function C(e){var a=T(e),r=D(e);if(a>=0&&a<31)return 0;if(a<59+r)return 1;if(a<90+r)return 2;if(a<120+r)return 3;if(a<151+r)return 4;if(a<181+r)return 5;if(a<212+r)return 6;if(a<243+r)return 7;if(a<273+r)return 8;if(a<304+r)return 9;if(a<334+r)return 10;if(a<365+r)return 11;throw new Error("Invalid time")}function O(e){var a=T(e),r=C(e),t=D(e);if(0===r)return a+1;if(1===r)return a-30;if(2===r)return a-58-t;if(3===r)return a-89-t;if(4===r)return a-119-t;if(5===r)return a-150-t;if(6===r)return a-180-t;if(7===r)return a-211-t;if(8===r)return a-242-t;if(9===r)return a-272-t;if(10===r)return a-303-t;if(11===r)return a-333-t;throw new Error("Invalid time")}function k(e){return g(Math.floor(e/36e5),24)}function E(e){return g(Math.floor(e/6e4),60)}function M(e){return g(Math.floor(e/1e3),60)}function j(e){return e<10?"0"+e:String(e)}function P(e,a,r,t){var n=Math.floor(r/6e4),i=Math.abs(n)%60,o=Math.floor(Math.abs(n)/60),l=a.split(";"),u="",c=r<0?l[1]:l[0];return"long"===t?u=c.replace("HH",j(o)).replace("H",String(o)).replace("mm",j(i)).replace("m",String(i)):(i||o)&&(i||(c=c.replace(/:?m+/,"")),u=c.replace(/H+/,String(o)).replace(/m+/,String(i))),e.replace("{0}",u)}function _(e,a,r){var t=r.getInternalSlots,o=r.localeData,l=r.getDefaultTimeZone,u=r.tzData;if(a=function c(e){return isFinite(e)?Math.abs(e)>864e14?NaN:function a(e){var a=h(e);if(isNaN(a)||v(a,-0))return 0;if(isFinite(a))return a;var r=Math.floor(Math.abs(a));return a<0&&(r=-r),v(r,-0)?0:r}(e):NaN}(a),isNaN(a))throw new RangeError("invalid time");var s=t(e),f=o[s.dataLocale],m=s.locale,d=Object.create(null);d.useGrouping=!1;var p=new Intl.NumberFormat(m,d),g=Object.create(null);g.minimumIntegerDigits=2,g.useGrouping=!1;for(var y=new Intl.NumberFormat(m,g),b=function w(e,a,r,t){var i=t.tzData;n("Number"===function o(e){return null===e?"Null":void 0===e?"Undefined":"function"==typeof e||"object"==typeof e?"Object":"number"==typeof e?"Number":"boolean"==typeof e?"Boolean":"string"==typeof e?"String":"symbol"==typeof e?"Symbol":"bigint"==typeof e?"BigInt":void 0}(e),"invalid time"),n("gregory"===a,"We only support Gregory calendar right now");var l=function u(e,a,r){var t,n=r[a];if(!n)return[0,!1];for(var i=0,o=0,l=!1;i<=n.length;i++)if(i===n.length||1e3*n[i][0]>=e){o=(t=n[i-1])[2],l=t[3];break}return[1e3*o,l]}(e,r,i),c=l[0],s=l[1],f=e+c,m=S(f);return{weekday:A(f),era:m<0?"BC":"AD",year:m,relatedYear:void 0,yearName:void 0,month:C(f),day:O(f),hour:k(f),minute:E(f),second:M(f),inDST:s,timeZoneOffset:c}}(a,s.calendar,s.timeZone,{tzData:u}),T=[],D=0,j=function _(e){for(var a=[],r=e.indexOf("{"),t=0,i=0,o=e.length;r<e.length&&r>-1;)n((t=e.indexOf("}",r))>r,"Invalid pattern "+e),r>i&&a.push({type:"literal",value:e.substring(i,r)}),a.push({type:e.substring(r+1,t),value:void 0}),r=e.indexOf("{",i=t+1);return i<o&&a.push({type:"literal",value:e.substring(i,o)}),a}(s.pattern);D<j.length;D++){var I=j[D],L=I.type;if("literal"===L)T.push({type:"literal",value:I.value});else if(i.indexOf(L)>-1){var F="",x=s[L],N=b[L];"year"===L&&N<=0&&(N=1-N),"month"===L&&N++;var U=s.hourCycle;if("hour"!==L||"h11"!==U&&"h12"!==U||0==(N%=12)&&"h12"===U&&(N=12),"hour"===L&&"h24"===U&&0===N&&(N=24),"numeric"===x)F=p.format(N);else if("2-digit"===x)(F=y.format(N)).length>2&&(F=F.slice(F.length-2,F.length));else if("narrow"===x||"short"===x||"long"===x)if("era"===L)F=f[L][x][N];else if("timeZoneName"===L){var Z=f.gmtFormat,z=f.hourFormat,B=f.timeZoneName[s.timeZone||l()];F=B&&B[x]?B[x][+b.inDST]:P(Z,z,b.timeZoneOffset,x)}else F="month"===L?f.month[x][N-1]:f[L][x][N];T.push({type:L,value:F})}else"ampm"===L?(F=void 0,T.push({type:"dayPeriod",value:F=(N=b.hour)>=11?f.pm:f.am})):"relatedYear"===L?(F=p.format(N=b.relatedYear),T.push({type:"relatedYear",value:F})):"yearName"===L?(F=p.format(N=b.yearName),T.push({type:"yearName",value:F})):T.push({type:"unknown",value:String(a)})}return T}function I(e,a,r){e=void 0===e?null:p(e),e=Object.create(e);var t=!0;if("date"===a||"any"===a)for(var n=0,i=["weekday","year","month","day"];n<i.length;n++)void 0!==e[i[n]]&&(t=!1);if("time"===a||"any"===a)for(var o=0,l=["hour","minute","second"];o<l.length;o++)void 0!==e[l[o]]&&(t=!1);if(void 0===e.dateStyle&&void 0===e.timeStyle||(t=!1),"date"===a&&e.timeStyle)throw new TypeError("Intl.DateTimeFormat date was required but timeStyle was included");if("time"===a&&e.dateStyle)throw new TypeError("Intl.DateTimeFormat time was required but dateStyle was included");if(t&&("date"===r||"all"===r))for(var u=0,c=["year","month","day"];u<c.length;u++)e[c[u]]="numeric";if(t&&("time"===r||"all"===r))for(var s=0,f=["hour","minute","second"];s<f.length;s++)e[f[s]]="numeric";return e}function L(e,a,r,t,n){var i=e[a];if(void 0!==i){if("boolean"!==r&&"string"!==r)throw new TypeError("invalid type");if("boolean"===r&&(i=Boolean(i)),"string"===r&&(i=function o(e){if("symbol"==typeof e)throw TypeError("Cannot convert a Symbol value to a string");return String(e)}(i)),void 0!==t&&!t.filter((function(e){return e==i})).length)throw new RangeError(i+" is not within "+t.join(", "));return i}return n}function F(e,a){for(var r=a;;){if(~e.indexOf(r))return r;var t=r.lastIndexOf("-");if(!~t)return;t>=2&&"-"===r[t-2]&&(t-=2),r=r.slice(0,t)}}function x(e,a){n(2===a.length,"key must have 2 elements");var r=e.length,t="-"+a+"-",i=e.indexOf(t);if(-1!==i){for(var o=i+4,l=o,u=o,c=!1;!c;){var s=e.indexOf("-",u);2==(-1===s?r-u:s-u)?c=!0:-1===s?(l=r,c=!0):(l=s,u=s+1)}return e.slice(o,l)}if(-1!==(i=e.indexOf(t="-"+a))&&i+3===r)return""}function N(e,a){var r=a.tzData,t=a.uppercaseLinks,n=e.toUpperCase();return new Set(Object.keys(r).map((function(e){return e.toUpperCase()}))).has(n)||n in t}var U=/^[a-z0-9]{3,8}$/i;var Z,z=(Z=function(e,a){return(Z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var r in a)a.hasOwnProperty(r)&&(e[r]=a[r])})(e,a)},function(e,a){function r(){this.constructor=e}Z(e,a),e.prototype=null===a?Object.create(a):(r.prototype=a.prototype,new r)}),B=function(){return(B=Object.assign||function(e){for(var a,r=1,t=arguments.length;r<t;r++)for(var n in a=arguments[r])Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);return e}).apply(this,arguments)},H=function(e){function a(){var a=null!==e&&e.apply(this,arguments)||this;return a.type="MISSING_LOCALE_DATA",a}return z(a,e),a}(Error);function G(e,a,r){void 0===r&&(r=function(e,a){return B(B({},e),a)});var t=function n(e){for(var a=[e],r=e.split("-"),t=r.length;t>1;t--)a.push(r.slice(0,t-1).join("-"));return a}(e),i=t.map((function(e){return a.data[e]})).filter(Boolean);if(!i.length)throw new H('Missing locale data for "'+e+'", lookup hierarchy: '+t.join(", "));return i.reverse(),i.reduce(r,{})}var K=new WeakMap;function R(e){var a=K.get(e);return a||(a=Object.create(null),K.set(e,a)),a}var W={"Africa/Asmera":"Africa/Nairobi","Africa/Timbuktu":"Africa/Abidjan","America/Argentina/ComodRivadavia":"America/Argentina/Catamarca","America/Atka":"America/Adak","America/Buenos_Aires":"America/Argentina/Buenos_Aires","America/Catamarca":"America/Argentina/Catamarca","America/Coral_Harbour":"America/Atikokan","America/Cordoba":"America/Argentina/Cordoba","America/Ensenada":"America/Tijuana","America/Fort_Wayne":"America/Indiana/Indianapolis","America/Godthab":"America/Nuuk","America/Indianapolis":"America/Indiana/Indianapolis","America/Jujuy":"America/Argentina/Jujuy","America/Knox_IN":"America/Indiana/Knox","America/Louisville":"America/Kentucky/Louisville","America/Mendoza":"America/Argentina/Mendoza","America/Montreal":"America/Toronto","America/Porto_Acre":"America/Rio_Branco","America/Rosario":"America/Argentina/Cordoba","America/Santa_Isabel":"America/Tijuana","America/Shiprock":"America/Denver","America/Virgin":"America/Port_of_Spain","Antarctica/South_Pole":"Pacific/Auckland","Asia/Ashkhabad":"Asia/Ashgabat","Asia/Calcutta":"Asia/Kolkata","Asia/Chongqing":"Asia/Shanghai","Asia/Chungking":"Asia/Shanghai","Asia/Dacca":"Asia/Dhaka","Asia/Harbin":"Asia/Shanghai","Asia/Kashgar":"Asia/Urumqi","Asia/Katmandu":"Asia/Kathmandu","Asia/Macao":"Asia/Macau","Asia/Rangoon":"Asia/Yangon","Asia/Saigon":"Asia/Ho_Chi_Minh","Asia/Tel_Aviv":"Asia/Jerusalem","Asia/Thimbu":"Asia/Thimphu","Asia/Ujung_Pandang":"Asia/Makassar","Asia/Ulan_Bator":"Asia/Ulaanbaatar","Atlantic/Faeroe":"Atlantic/Faroe","Atlantic/Jan_Mayen":"Europe/Oslo","Australia/ACT":"Australia/Sydney","Australia/Canberra":"Australia/Sydney","Australia/LHI":"Australia/Lord_Howe","Australia/NSW":"Australia/Sydney","Australia/North":"Australia/Darwin","Australia/Queensland":"Australia/Brisbane","Australia/South":"Australia/Adelaide","Australia/Tasmania":"Australia/Hobart","Australia/Victoria":"Australia/Melbourne","Australia/West":"Australia/Perth","Australia/Yancowinna":"Australia/Broken_Hill","Brazil/Acre":"America/Rio_Branco","Brazil/DeNoronha":"America/Noronha","Brazil/East":"America/Sao_Paulo","Brazil/West":"America/Manaus","Canada/Atlantic":"America/Halifax","Canada/Central":"America/Winnipeg","Canada/Eastern":"America/Toronto","Canada/Mountain":"America/Edmonton","Canada/Newfoundland":"America/St_Johns","Canada/Pacific":"America/Vancouver","Canada/Saskatchewan":"America/Regina","Canada/Yukon":"America/Whitehorse","Chile/Continental":"America/Santiago","Chile/EasterIsland":"Pacific/Easter",Cuba:"America/Havana",Egypt:"Africa/Cairo",Eire:"Europe/Dublin","Etc/UCT":"Etc/UTC","Europe/Belfast":"Europe/London","Europe/Tiraspol":"Europe/Chisinau",GB:"Europe/London","GB-Eire":"Europe/London","GMT+0":"Etc/GMT","GMT-0":"Etc/GMT",GMT0:"Etc/GMT",Greenwich:"Etc/GMT",Hongkong:"Asia/Hong_Kong",Iceland:"Atlantic/Reykjavik",Iran:"Asia/Tehran",Israel:"Asia/Jerusalem",Jamaica:"America/Jamaica",Japan:"Asia/Tokyo",Kwajalein:"Pacific/Kwajalein",Libya:"Africa/Tripoli","Mexico/BajaNorte":"America/Tijuana","Mexico/BajaSur":"America/Mazatlan","Mexico/General":"America/Mexico_City",NZ:"Pacific/Auckland","NZ-CHAT":"Pacific/Chatham",Navajo:"America/Denver",PRC:"Asia/Shanghai","Pacific/Johnston":"Pacific/Honolulu","Pacific/Ponape":"Pacific/Pohnpei","Pacific/Samoa":"Pacific/Pago_Pago","Pacific/Truk":"Pacific/Chuuk","Pacific/Yap":"Pacific/Chuuk",Poland:"Europe/Warsaw",Portugal:"Europe/Lisbon",ROC:"Asia/Taipei",ROK:"Asia/Seoul",Singapore:"Asia/Singapore",Turkey:"Europe/Istanbul",UCT:"Etc/UTC","US/Alaska":"America/Anchorage","US/Aleutian":"America/Adak","US/Arizona":"America/Phoenix","US/Central":"America/Chicago","US/East-Indiana":"America/Indiana/Indianapolis","US/Eastern":"America/New_York","US/Hawaii":"Pacific/Honolulu","US/Indiana-Starke":"America/Indiana/Knox","US/Michigan":"America/Detroit","US/Mountain":"America/Denver","US/Pacific":"America/Los_Angeles","US/Samoa":"Pacific/Pago_Pago",UTC:"Etc/UTC",Universal:"Etc/UTC","W-SU":"Europe/Moscow",Zulu:"Etc/UTC"},J=function(){return(J=Object.assign||function(e){for(var a,r=1,t=arguments.length;r<t;r++)for(var n in a=arguments[r])Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);return e}).apply(this,arguments)},$=function(e,a){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&a.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(t=Object.getOwnPropertySymbols(e);n<t.length;n++)a.indexOf(t[n])<0&&Object.prototype.propertyIsEnumerable.call(e,t[n])&&(r[t[n]]=e[t[n]])}return r},Y=Object.keys(W).reduce((function(e,a){return e[a.toUpperCase()]=W[a],e}),{}),q=["locale","calendar","numberingSystem","dateStyle","timeStyle","timeZone","hourCycle","weekday","era","year","month","day","hour","minute","second","timeZoneName"],V={enumerable:!1,configurable:!0,get:function(){if("object"!=typeof this||!(this instanceof Q))throw TypeError("Intl.DateTimeFormat format property accessor called on incompatible receiver");var e=R(this),a=this,r=e.boundFormat;if(void 0===r){r=function(e){var r;return r=void 0===e?Date.now():Number(e),function t(e,a,r){for(var t="",n=0,i=_(e,a,r);n<i.length;n++)t+=i[n].value;return t}(a,r,{getInternalSlots:R,localeData:Q.localeData,tzData:Q.tzData,getDefaultTimeZone:Q.getDefaultTimeZone})};try{Object.defineProperty(r,"name",{configurable:!0,enumerable:!1,writable:!1,value:""})}catch(e){}e.boundFormat=r}return r}};try{Object.defineProperty(V.get,"name",{configurable:!0,enumerable:!1,writable:!1,value:"get format"})}catch(e){}var Q=function(r,l){if(!(this&&this instanceof Q))return new Q(r,l);!function u(r,l,c,h){var p=h.getInternalSlots,v=h.availableLocales,g=h.localeData,y=h.getDefaultLocale,A=h.getDefaultTimeZone,b=h.relevantExtensionKeys,w=h.tzData,S=h.uppercaseLinks,T=e(l),D=I(c,"any","date"),C=Object.create(null),O=L(D,"localeMatcher","string",["lookup","best fit"],"best fit");C.localeMatcher=O;var k=L(D,"calendar","string",void 0,void 0);if(void 0!==k&&!U.test(k))throw new RangeError("Malformed calendar");var E=p(r);C.ca=k;var M=L(D,"numberingSystem","string",void 0,void 0);if(void 0!==M&&!U.test(M))throw new RangeError("Malformed numbering system");C.nu=M;var j=L(D,"hour12","boolean",void 0,void 0),P=L(D,"hourCycle","string",["h11","h12","h23","h24"],void 0);void 0!==j&&(P=null),C.hc=P;var _=function Z(e,a,r,i,o,l){for(var u,c=(u="lookup"===r.localeMatcher?function s(e,a,r){for(var n={locale:""},i=0,o=a;i<o.length;i++){var l=o[i],u=l.replace(t,""),c=F(e,u);if(c)return n.locale=c,l!==u&&(n.extension=l.slice(u.length+1,l.length)),n}return n.locale=r(),n}(e,a,l):function f(e,a,r){for(var n={locale:""},i=0,o=a;i<o.length;i++){var l=o[i],u=l.replace(t,""),c=F(e,u);if(c)return n.locale=c,l!==u&&(n.extension=l.slice(u.length+1,l.length)),n}return n.locale=r(),n}(e,a,l)).locale,m={locale:"",dataLocale:c},d="-u",h=0,p=i;h<p.length;h++){var v=p[h],g=o[c];n("object"==typeof g&&null!==g,"locale data "+v+" must be an object");var y=g[v];n(Array.isArray(y),"keyLocaleData for "+v+" must be an array");var A=y[0];n("string"==typeof A||null===A,"value must be string or null but got "+typeof A+" in key "+v);var b="";if(u.extension){var w=x(u.extension,v);void 0!==w&&(""!==w?~y.indexOf(w)&&(b="-"+v+"-"+(A=w)):~w.indexOf("true")&&(A="true",b="-"+v))}if(v in r){var S=r[v];n("string"==typeof S||null==S,"optionsValue must be String, Undefined or Null"),~y.indexOf(S)&&S!==A&&(A=S,b="")}m[v]=A,d+=b}if(d.length>2){var T=c.indexOf("-x-");if(-1===T)c+=d;else{var D=c.slice(0,T),C=c.slice(T,c.length);c=D+d+C}c=Intl.getCanonicalLocales(c)[0]}return m.locale=c,m}(v,T,C,b,g,y);E.locale=_.locale,E.calendar=k=_.ca,E.hourCycle=_.hc,E.numberingSystem=_.nu;var z=_.dataLocale;E.dataLocale=z;var B=D.timeZone;if(void 0!==B){if(!N(B=String(B),{tzData:w,uppercaseLinks:S}))throw new RangeError("Invalid timeZoneName");B=a(B,{tzData:w,uppercaseLinks:S})}else B=A();E.timeZone=B,(C=Object.create(null)).weekday=L(D,"weekday","string",["narrow","short","long"],void 0),C.era=L(D,"era","string",["narrow","short","long"],void 0),C.year=L(D,"year","string",["2-digit","numeric"],void 0),C.month=L(D,"month","string",["2-digit","numeric","narrow","short","long"],void 0),C.day=L(D,"day","string",["2-digit","numeric"],void 0),C.hour=L(D,"hour","string",["2-digit","numeric"],void 0),C.minute=L(D,"minute","string",["2-digit","numeric"],void 0),C.second=L(D,"second","string",["2-digit","numeric"],void 0),C.timeZoneName=L(D,"timeZoneName","string",["short","long"],void 0);var H=g[z],G=H.formats[k];O=L(D,"formatMatcher","string",["basic","best fit"],"best fit");var K=L(D,"dateStyle","string",["full","long","medium","short"],void 0);E.dateStyle=K;var R,W,J=L(D,"timeStyle","string",["full","long","medium","short"],void 0);if(E.timeStyle=J,void 0===K&&void 0===J)"basic"===O?R=function $(e,a){var r=-1/0,t=a[0];n(Array.isArray(a),"formats should be a list of things");for(var l=0,u=a;l<u.length;l++){for(var c=u[l],s=0,f=0,m=i;f<m.length;f++){var d=m[f],h=e[d],p=c[d];if(void 0===h&&void 0!==p)s-=20;else if(void 0!==h&&void 0===p)s-=120;else if(h!==p){var v=["2-digit","numeric","narrow","short","long"],g=v.indexOf(h),y=v.indexOf(p),A=Math.max(-2,Math.min(y-g,2));2===A?s-=6:1===A?s-=3:-1===A?s-=6:-2===A&&(s-=8)}}s>r&&(r=s,t=c)}return o({},t)}(C,G):(function Y(e){for(var a=0,r=["hour","minute","second"];a<r.length;a++)if(void 0!==e[r[a]])return!0;return!1}(C)&&(C.hour12="h11"===E.hourCycle||"h12"===E.hourCycle),R=function q(e,a){var r=-1/0,t=a[0];n(Array.isArray(a),"formats should be a list of things");for(var i=0,o=a;i<o.length;i++){var l=o[i],u=d(e,l);u>r&&(r=u,t=l)}var c=f({},t),h=s(t.rawPattern);for(var p in h){var v=c[p],g=e[p];"minute"!==p&&"second"!==p&&g&&(m(h[p])&&!m(g)||v!==g&&(h[p]=g))}return h}(C,G));else{for(var V=0,Q=i;V<Q.length;V++)if(void 0!==(ae=C[ee=Q[V]]))throw new TypeError("Intl.DateTimeFormat can't set option "+ee+" when "+(K?"dateStyle":"timeStyle")+" is used");R=function X(e,a,r){var t,i;if(void 0!==a&&(n("full"===a||"long"===a||"medium"===a||"short"===a,"invalid timeStyle"),i=r.timeFormat[a]),void 0!==e&&(n("full"===e||"long"===e||"medium"===e||"short"===e,"invalid dateStyle"),t=r.dateFormat[e]),void 0!==e&&void 0!==a){var o={};for(var l in t)"pattern"!==l&&(o[l]=t[l]);for(var l in i)"pattern"!==l&&"pattern12"!==l&&(o[l]=i[l]);var u=r.dateTimeFormat[e],c=u.replace("{0}",i.pattern).replace("{1}",t.pattern);if(o.pattern=c,"pattern12"in i){var s=u.replace("{0}",i.pattern12).replace("{1}",t.pattern);o.pattern12=s}return o}return void 0!==a?i:(n(void 0!==e,"dateStyle should not be undefined"),t)}(K,J,H)}for(var ee in C){var ae;void 0!==(ae=R[ee])&&(E[ee]=ae)}if(void 0!==E.hour){var re=H.hourCycle,te=E.hourCycle;null==te&&(te=re),void 0!==j&&(j?te="h11"===re||"h23"===re?"h11":"h12":(n(!j,"hour12 must not be set"),te="h11"===re||"h23"===re?"h23":"h24")),E.hourCycle=te,W="h11"===te||"h12"===te?R.pattern12:R.pattern}else E.hourCycle=void 0,W=R.pattern;return E.pattern=W,r}(this,r,l,{tzData:Q.tzData,uppercaseLinks:Y,availableLocales:Q.availableLocales,relevantExtensionKeys:Q.relevantExtensionKeys,getDefaultLocale:Q.getDefaultLocale,getDefaultTimeZone:Q.getDefaultTimeZone,getInternalSlots:R,localeData:Q.localeData});var c=R(this).dataLocale;n(void 0!==Q.localeData[c],"Cannot load locale-dependent data for "+c+".")};r(Q,"supportedLocalesOf",{value:function a(r,n){return function i(e,a,r){return void 0!==r&&L(r=p(r),"localeMatcher","string",["lookup","best fit"],"best fit"),function n(e,a){for(var r=[],n=0,i=a;n<i.length;n++){var o=F(e,i[n].replace(t,""));o&&r.push(o)}return r}(e,a)}(Q.availableLocales,e(r),n)}}),r(Q.prototype,"resolvedOptions",{value:function e(){if("object"!=typeof this||!(this instanceof Q))throw TypeError("Method Intl.DateTimeFormat.prototype.resolvedOptions called on incompatible receiver");for(var a=R(this),r={},t=0,n=q;t<n.length;t++){var o=n[t],l=a[o];if("hourCycle"===o){var u="h11"===l||"h12"===l||"h23"!==l&&"h24"!==l&&void 0;void 0!==u&&(r.hour12=u)}i.indexOf(o)>-1&&(void 0===a.dateStyle&&void 0===a.timeStyle||(l=void 0)),void 0!==l&&(r[o]=l)}return r}}),r(Q.prototype,"formatToParts",{value:function e(a){return function r(e,a,t){for(var n=_(e,a,t),i=function o(e){return new Array(e)}(0),l=0,u=n;l<u.length;l++){var c=u[l];i.push({type:c.type,value:c.value})}return i}(this,a=void 0===a?Date.now():h(a),{getInternalSlots:R,localeData:Q.localeData,tzData:Q.tzData,getDefaultTimeZone:Q.getDefaultTimeZone})}}),Q.__setDefaultTimeZone=function(e){if(void 0!==e){if(!N(e=String(e),{tzData:Q.tzData,uppercaseLinks:Y}))throw new RangeError("Invalid timeZoneName");e=a(e,{tzData:Q.tzData,uppercaseLinks:Y})}else e="UTC";Q.__defaultTimeZone=e},Q.relevantExtensionKeys=["nu","ca","hc"],Q.__defaultTimeZone="UTC",Q.getDefaultTimeZone=function(){return Q.__defaultTimeZone},Q.__addLocaleData=function e(){for(var a=[],r=0;r<arguments.length;r++)a[r]=arguments[r];for(var t=0,n=a;t<n.length;t++)for(var i=n[t],o=i.availableLocales,l=function(e){try{var a=G(e,i),r=a.dateFormat,t=a.timeFormat,n=a.dateTimeFormat,o=a.formats,l=$(a,["dateFormat","timeFormat","dateTimeFormat","formats"]),u=J(J({},l),{dateFormat:{full:s(r.full),long:s(r.long),medium:s(r.medium),short:s(r.short)},timeFormat:{full:s(t.full),long:s(t.long),medium:s(t.medium),short:s(t.short)},dateTimeFormat:{full:s(n.full).pattern,long:s(n.long).pattern,medium:s(n.medium).pattern,short:s(n.short).pattern},formats:{}}),c=function(e){u.formats[e]=Object.keys(o[e]).map((function(a){return s(a,o[e][a])}))};for(var f in o)c(f);Q.localeData[e]=u}catch(e){}},u=0,c=o;u<c.length;u++){var f=c[u];l(f)}Q.availableLocales=Object.keys(Q.localeData),Q.__defaultLocale||(Q.__defaultLocale=Q.availableLocales[0])},Object.defineProperty(Q.prototype,"format",V),Q.__defaultLocale="",Q.localeData={},Q.availableLocales=[],Q.getDefaultLocale=function(){return Q.__defaultLocale},Q.polyfilled=!0,Q.tzData={},Q.__addTZData=function(e){Q.tzData=function a(e){for(var a=e.abbrvs.split("|"),r=e.offsets.split("|").map((function(e){return parseInt(e,36)})),t={},n=0,i=e.zones;n<i.length;n++){var o=i[n].split("|"),l=o[0],u=o.slice(1);t[l]=u.map((function(e){return e.split(",")})).map((function(e){var t=e[0],n=e[1],i=e[2],o=e[3];return[""===t?-1/0:parseInt(t,36),a[+n],r[+i],"1"===o]}))}return t}(e)};try{"undefined"!=typeof Symbol&&Object.defineProperty(Q.prototype,Symbol.toStringTag,{value:"Intl.DateTimeFormat",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype.constructor,"length",{value:1,writable:!1,enumerable:!1,configurable:!0})}catch(e){}(function X(){return!("DateTimeFormat"in Intl)||!("formatToParts"in Intl.DateTimeFormat.prototype)||function e(){return"dayPeriod"!==new Intl.DateTimeFormat("en",{hourCycle:"h11",hour:"numeric"}).formatToParts(0)[2].type}()||!function a(){return!!new Intl.DateTimeFormat(void 0,{dateStyle:"short"}).resolvedOptions().dateStyle}()})()&&(r(Intl,"DateTimeFormat",{value:Q}),r(Date.prototype,"toLocaleString",{value:function e(a,r){return function t(e,a,r){return new Q(a,r).format(e)}(this,a,r)}}),r(Date.prototype,"toLocaleDateString",{value:function e(a,r){return function t(e,a,r){return new Q(a,I(r,"date","date")).format(e)}(this,a,r)}}),r(Date.prototype,"toLocaleTimeString",{value:function e(a,r){return function t(e,a,r){return new Q(a,I(r,"time","time")).format(e)}(this,a,r)}}))}));

@@ -1,2 +0,3 @@

import { PackedData, UnpackedZoneData, DateTimeFormatOptions, Formats, DateTimeFormatLocaleInternalData, RawDateTimeLocaleData } from './types';
import { DateTimeFormatOptions, DateTimeFormatLocaleInternalData, UnpackedZoneData } from '@formatjs/ecma402-abstract';
import { PackedData, RawDateTimeLocaleData } from './types';
export interface IntlDateTimeFormatInternal {

@@ -23,44 +24,9 @@ locale: string;

}
export interface DateTimeFormatPart {
type: 'literal' | 'era' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'weekday' | 'timeZoneName' | 'dayPeriod' | 'relatedYear' | 'yearName' | 'unknown';
value: 'string';
}
export interface ResolvedDateTimeFormatOptions {
locale: string;
calendar?: string;
dateStyle?: 'full' | 'long' | 'medium' | 'short';
timeStyle?: 'full' | 'long' | 'medium' | 'short';
weekday: 'narrow' | 'short' | 'long';
era: 'narrow' | 'short' | 'long';
year: '2-year' | 'numeric';
month: '2-year' | 'numeric' | 'narrow' | 'short' | 'long';
day: '2-year' | 'numeric';
hour: '2-year' | 'numeric';
minute: '2-year' | 'numeric';
second: '2-year' | 'numeric';
timeZoneName: 'short' | 'long';
hourCycle: string;
numberingSystem: string;
}
/**
* https://tc39.es/ecma402/#sec-todatetimeoptions
* @param options
* @param required
* @param defaults
*/
export declare function toDateTimeOptions(options?: DateTimeFormatOptions | null, required?: string, defaults?: string): DateTimeFormatOptions;
export declare function basicFormatMatcherScore(options: DateTimeFormatOptions, format: Formats): number;
/**
* Credit: https://github.com/andyearnshaw/Intl.js/blob/0958dc1ad8153f1056653ea22b8208f0df289a4e/src/12.datetimeformat.js#L611
* with some modifications
* @param options
* @param format
*/
export declare function bestFitFormatMatcherScore(options: DateTimeFormatOptions, format: Formats): number;
export interface DateTimeFormatConstructor {
new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
(locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
new (locales?: string | string[], options?: DateTimeFormatOptions): Intl.DateTimeFormat;
(locales?: string | string[], options?: DateTimeFormatOptions): Intl.DateTimeFormat;
__addLocaleData(...data: RawDateTimeLocaleData[]): void;
supportedLocalesOf(locales: string | string[], options?: Pick<DateTimeFormatOptions, 'localeMatcher'>): string[];
getDefaultLocale(): string;
relevantExtensionKeys: string[];
__defaultLocale: string;

@@ -76,8 +42,3 @@ __defaultTimeZone: string;

}
export interface DateTimeFormat {
resolvedOptions(): ResolvedDateTimeFormatOptions;
formatToParts(x?: number | Date): DateTimeFormatPart[];
format(x?: number | Date): string;
}
export declare const DateTimeFormat: DateTimeFormatConstructor;
//# sourceMappingURL=core.d.ts.map

@@ -28,3 +28,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.DateTimeFormat = exports.bestFitFormatMatcherScore = exports.basicFormatMatcherScore = exports.toDateTimeOptions = void 0;
exports.DateTimeFormat = void 0;
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");

@@ -34,13 +34,2 @@ var get_internal_slots_1 = __importDefault(require("./get_internal_slots"));

var packer_1 = require("./packer");
var skeleton_1 = require("./skeleton");
var ToObject_1 = __importDefault(require("es-abstract/2019/ToObject"));
var TimeClip_1 = __importDefault(require("es-abstract/2019/TimeClip"));
var ToNumber_1 = __importDefault(require("es-abstract/2019/ToNumber"));
var WeekDay_1 = __importDefault(require("es-abstract/2019/WeekDay"));
var MonthFromTime_1 = __importDefault(require("es-abstract/2019/MonthFromTime"));
var DateFromTime_1 = __importDefault(require("es-abstract/2019/DateFromTime"));
var HourFromTime_1 = __importDefault(require("es-abstract/2019/HourFromTime"));
var MinFromTime_1 = __importDefault(require("es-abstract/2019/MinFromTime"));
var SecFromTime_1 = __importDefault(require("es-abstract/2019/SecFromTime"));
var YearFromTime_1 = __importDefault(require("es-abstract/2019/YearFromTime"));
var UPPERCASED_LINKS = Object.keys(links_1.default).reduce(function (all, l) {

@@ -50,13 +39,2 @@ all[l.toUpperCase()] = links_1.default[l];

}, {});
var DATE_TIME_PROPS = [
'weekday',
'era',
'year',
'month',
'day',
'hour',
'minute',
'second',
'timeZoneName',
];
var RESOLVED_OPTIONS_KEYS = [

@@ -80,442 +58,2 @@ 'locale',

];
var TYPE_REGEX = /^[a-z0-9]{3,8}$/i;
/**
* https://tc39.es/ecma402/#sec-isvalidtimezonename
* @param tz
*/
function isValidTimeZoneName(tz) {
var uppercasedTz = tz.toUpperCase();
var zoneNames = new Set(Object.keys(exports.DateTimeFormat.tzData).map(function (z) { return z.toUpperCase(); }));
return zoneNames.has(uppercasedTz) || uppercasedTz in UPPERCASED_LINKS;
}
/**
* https://tc39.es/ecma402/#sec-canonicalizetimezonename
* @param tz
*/
function canonicalizeTimeZoneName(tz) {
var uppercasedTz = tz.toUpperCase();
var uppercasedZones = Object.keys(exports.DateTimeFormat.tzData).reduce(function (all, z) {
all[z.toUpperCase()] = z;
return all;
}, {});
var ianaTimeZone = UPPERCASED_LINKS[uppercasedTz] || uppercasedZones[uppercasedTz];
if (ianaTimeZone === 'Etc/UTC' || ianaTimeZone === 'Etc/GMT') {
return 'UTC';
}
return ianaTimeZone;
}
function isTimeRelated(opt) {
for (var _i = 0, _a = ['hour', 'minute', 'second']; _i < _a.length; _i++) {
var prop = _a[_i];
var value = opt[prop];
if (value !== undefined) {
return true;
}
}
return false;
}
/**
* https://tc39.es/ecma402/#sec-initializedatetimeformat
* @param dtf DateTimeFormat
* @param locales locales
* @param opts options
*/
function initializeDateTimeFormat(dtf, locales, opts) {
// @ts-ignore
var requestedLocales = Intl.getCanonicalLocales(locales);
var options = toDateTimeOptions(opts, 'any', 'date');
var opt = Object.create(null);
var matcher = ecma402_abstract_1.GetOption(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');
opt.localeMatcher = matcher;
var calendar = ecma402_abstract_1.GetOption(options, 'calendar', 'string', undefined, undefined);
if (calendar !== undefined && !TYPE_REGEX.test(calendar)) {
throw new RangeError('Malformed calendar');
}
var internalSlots = get_internal_slots_1.default(dtf);
opt.ca = calendar;
var numberingSystem = ecma402_abstract_1.GetOption(options, 'numberingSystem', 'string', undefined, undefined);
if (numberingSystem !== undefined && !TYPE_REGEX.test(numberingSystem)) {
throw new RangeError('Malformed numbering system');
}
opt.nu = numberingSystem;
var hour12 = ecma402_abstract_1.GetOption(options, 'hour12', 'boolean', undefined, undefined);
var hourCycle = ecma402_abstract_1.GetOption(options, 'hourCycle', 'string', ['h11', 'h12', 'h23', 'h24'], undefined);
if (hour12 !== undefined) {
// @ts-ignore
hourCycle = null;
}
opt.hc = hourCycle;
var r = ecma402_abstract_1.ResolveLocale(exports.DateTimeFormat.availableLocales, requestedLocales,
// TODO: Fix the type
opt,
// [[RelevantExtensionKeys]] slot, which is a constant
['nu', 'ca', 'hc'], exports.DateTimeFormat.localeData, exports.DateTimeFormat.getDefaultLocale);
internalSlots.locale = r.locale;
calendar = r.ca;
internalSlots.calendar = calendar;
internalSlots.hourCycle = r.hc;
internalSlots.numberingSystem = r.nu;
var dataLocale = r.dataLocale;
internalSlots.dataLocale = dataLocale;
var timeZone = options.timeZone;
if (timeZone !== undefined) {
timeZone = String(timeZone);
if (!isValidTimeZoneName(timeZone)) {
throw new RangeError('Invalid timeZoneName');
}
timeZone = canonicalizeTimeZoneName(timeZone);
}
else {
timeZone = exports.DateTimeFormat.getDefaultTimeZone();
}
internalSlots.timeZone = timeZone;
opt = Object.create(null);
opt.weekday = ecma402_abstract_1.GetOption(options, 'weekday', 'string', ['narrow', 'short', 'long'], undefined);
opt.era = ecma402_abstract_1.GetOption(options, 'era', 'string', ['narrow', 'short', 'long'], undefined);
opt.year = ecma402_abstract_1.GetOption(options, 'year', 'string', ['2-digit', 'numeric'], undefined);
opt.month = ecma402_abstract_1.GetOption(options, 'month', 'string', ['2-digit', 'numeric', 'narrow', 'short', 'long'], undefined);
opt.day = ecma402_abstract_1.GetOption(options, 'day', 'string', ['2-digit', 'numeric'], undefined);
opt.hour = ecma402_abstract_1.GetOption(options, 'hour', 'string', ['2-digit', 'numeric'], undefined);
opt.minute = ecma402_abstract_1.GetOption(options, 'minute', 'string', ['2-digit', 'numeric'], undefined);
opt.second = ecma402_abstract_1.GetOption(options, 'second', 'string', ['2-digit', 'numeric'], undefined);
opt.timeZoneName = ecma402_abstract_1.GetOption(options, 'timeZoneName', 'string', ['short', 'long'], undefined);
var dataLocaleData = exports.DateTimeFormat.localeData[dataLocale];
var formats = dataLocaleData.formats[calendar];
matcher = ecma402_abstract_1.GetOption(options, 'formatMatcher', 'string', ['basic', 'best fit'], 'best fit');
var dateStyle = ecma402_abstract_1.GetOption(options, 'dateStyle', 'string', ['full', 'long', 'medium', 'short'], undefined);
internalSlots.dateStyle = dateStyle;
var timeStyle = ecma402_abstract_1.GetOption(options, 'timeStyle', 'string', ['full', 'long', 'medium', 'short'], undefined);
internalSlots.timeStyle = timeStyle;
var bestFormat;
if (dateStyle === undefined && timeStyle === undefined) {
if (matcher === 'basic') {
bestFormat = basicFormatMatcher(opt, formats);
}
else {
if (isTimeRelated(opt)) {
opt.hour12 =
internalSlots.hourCycle === 'h11' ||
internalSlots.hourCycle === 'h12';
}
bestFormat = bestFitFormatMatcher(opt, formats);
}
}
else {
for (var _i = 0, DATE_TIME_PROPS_1 = DATE_TIME_PROPS; _i < DATE_TIME_PROPS_1.length; _i++) {
var prop = DATE_TIME_PROPS_1[_i];
var p = opt[prop];
if (p !== undefined) {
throw new TypeError("Intl.DateTimeFormat can't set option " + prop + " when " + (dateStyle ? 'dateStyle' : 'timeStyle') + " is used");
}
}
bestFormat = dateTimeStyleFormat(dateStyle, timeStyle, dataLocaleData);
}
for (var prop in opt) {
var p = bestFormat[prop];
if (p !== undefined) {
internalSlots[prop] = p;
}
}
var pattern;
if (internalSlots.hour !== undefined) {
var hcDefault = dataLocaleData.hourCycle;
var hc = internalSlots.hourCycle;
if (hc == null) {
hc = hcDefault;
}
if (hour12 !== undefined) {
if (hour12) {
if (hcDefault === 'h11' || hcDefault === 'h23') {
hc = 'h11';
}
else {
hc = 'h12';
}
}
else {
ecma402_abstract_1.invariant(!hour12, 'hour12 must not be set');
if (hcDefault === 'h11' || hcDefault === 'h23') {
hc = 'h23';
}
else {
hc = 'h24';
}
}
}
internalSlots.hourCycle = hc;
if (hc === 'h11' || hc === 'h12') {
pattern = bestFormat.pattern12;
}
else {
pattern = bestFormat.pattern;
}
}
else {
// @ts-ignore
internalSlots.hourCycle = undefined;
pattern = bestFormat.pattern;
}
internalSlots.pattern = pattern;
return dtf;
}
/**
* https://tc39.es/ecma402/#sec-todatetimeoptions
* @param options
* @param required
* @param defaults
*/
function toDateTimeOptions(options, required, defaults) {
if (options === undefined) {
options = null;
}
else {
options = ToObject_1.default(options);
}
options = Object.create(options);
var needDefaults = true;
if (required === 'date' || required === 'any') {
for (var _i = 0, _a = ['weekday', 'year', 'month', 'day']; _i < _a.length; _i++) {
var prop = _a[_i];
var value = options[prop];
if (value !== undefined) {
needDefaults = false;
}
}
}
if (required === 'time' || required === 'any') {
for (var _b = 0, _c = ['hour', 'minute', 'second']; _b < _c.length; _b++) {
var prop = _c[_b];
var value = options[prop];
if (value !== undefined) {
needDefaults = false;
}
}
}
if (options.dateStyle !== undefined || options.timeStyle !== undefined) {
needDefaults = false;
}
if (required === 'date' && options.timeStyle) {
throw new TypeError('Intl.DateTimeFormat date was required but timeStyle was included');
}
if (required === 'time' && options.dateStyle) {
throw new TypeError('Intl.DateTimeFormat time was required but dateStyle was included');
}
if (needDefaults && (defaults === 'date' || defaults === 'all')) {
for (var _d = 0, _e = ['year', 'month', 'day']; _d < _e.length; _d++) {
var prop = _e[_d];
options[prop] = 'numeric';
}
}
if (needDefaults && (defaults === 'time' || defaults === 'all')) {
for (var _f = 0, _g = ['hour', 'minute', 'second']; _f < _g.length; _f++) {
var prop = _g[_f];
options[prop] = 'numeric';
}
}
return options;
}
exports.toDateTimeOptions = toDateTimeOptions;
var BASIC_FORMAT_MATCHER_VALUES = [
'2-digit',
'numeric',
'narrow',
'short',
'long',
];
var removalPenalty = 120;
var additionPenalty = 20;
var differentNumericTypePenalty = 15;
var longLessPenalty = 8;
var longMorePenalty = 6;
var shortLessPenalty = 6;
var shortMorePenalty = 3;
function basicFormatMatcherScore(options, format) {
var score = 0;
for (var _i = 0, DATE_TIME_PROPS_2 = DATE_TIME_PROPS; _i < DATE_TIME_PROPS_2.length; _i++) {
var prop = DATE_TIME_PROPS_2[_i];
var optionsProp = options[prop];
var formatProp = format[prop];
if (optionsProp === undefined && formatProp !== undefined) {
score -= additionPenalty;
}
else if (optionsProp !== undefined && formatProp === undefined) {
score -= removalPenalty;
}
else if (optionsProp !== formatProp) {
var optionsPropIndex = BASIC_FORMAT_MATCHER_VALUES.indexOf(optionsProp);
var formatPropIndex = BASIC_FORMAT_MATCHER_VALUES.indexOf(formatProp);
var delta = Math.max(-2, Math.min(formatPropIndex - optionsPropIndex, 2));
if (delta === 2) {
score -= longMorePenalty;
}
else if (delta === 1) {
score -= shortMorePenalty;
}
else if (delta === -1) {
score -= shortLessPenalty;
}
else if (delta === -2) {
score -= longLessPenalty;
}
}
}
return score;
}
exports.basicFormatMatcherScore = basicFormatMatcherScore;
/**
* Credit: https://github.com/andyearnshaw/Intl.js/blob/0958dc1ad8153f1056653ea22b8208f0df289a4e/src/12.datetimeformat.js#L611
* with some modifications
* @param options
* @param format
*/
function bestFitFormatMatcherScore(options, format) {
var score = 0;
if (options.hour12 && !format.hour12) {
score -= removalPenalty;
}
else if (!options.hour12 && format.hour12) {
score -= additionPenalty;
}
for (var _i = 0, DATE_TIME_PROPS_3 = DATE_TIME_PROPS; _i < DATE_TIME_PROPS_3.length; _i++) {
var prop = DATE_TIME_PROPS_3[_i];
var optionsProp = options[prop];
var formatProp = format[prop];
if (optionsProp === undefined && formatProp !== undefined) {
score -= additionPenalty;
}
else if (optionsProp !== undefined && formatProp === undefined) {
score -= removalPenalty;
}
else if (optionsProp !== formatProp) {
// extra penalty for numeric vs non-numeric
if (isNumericType(optionsProp) !==
isNumericType(formatProp)) {
score -= differentNumericTypePenalty;
}
else {
var optionsPropIndex = BASIC_FORMAT_MATCHER_VALUES.indexOf(optionsProp);
var formatPropIndex = BASIC_FORMAT_MATCHER_VALUES.indexOf(formatProp);
var delta = Math.max(-2, Math.min(formatPropIndex - optionsPropIndex, 2));
if (delta === 2) {
score -= longMorePenalty;
}
else if (delta === 1) {
score -= shortMorePenalty;
}
else if (delta === -1) {
score -= shortLessPenalty;
}
else if (delta === -2) {
score -= longLessPenalty;
}
}
}
}
return score;
}
exports.bestFitFormatMatcherScore = bestFitFormatMatcherScore;
function dateTimeStyleFormat(dateStyle, timeStyle, dataLocaleData) {
var dateFormat, timeFormat;
if (timeStyle !== undefined) {
timeFormat = dataLocaleData.timeFormat[timeStyle];
}
if (dateStyle !== undefined) {
dateFormat = dataLocaleData.dateFormat[dateStyle];
}
if (dateStyle !== undefined &&
dateFormat !== undefined &&
timeFormat !== undefined) {
var format = __assign(__assign({}, dateFormat), timeFormat);
delete format.pattern;
delete format.pattern12;
var connector = dataLocaleData.dateTimeFormat[dateStyle];
format.pattern = connector
.replace('{0}', timeFormat.pattern)
.replace('{1}', dateFormat.pattern);
if (timeFormat.pattern12 !== undefined) {
format.pattern12 = connector
.replace('{0}', timeFormat.pattern12)
.replace('{1}', dateFormat.pattern);
}
return format;
}
if (timeFormat !== undefined) {
return timeFormat;
}
if (dateFormat === undefined) {
throw new TypeError('Intl.DateTimeFormat neither the dateFormat or the timeFormat could be found');
}
return dateFormat;
}
/**
* https://tc39.es/ecma402/#sec-basicformatmatcher
* @param options
* @param formats
*/
function basicFormatMatcher(options, formats) {
var bestScore = -Infinity;
var bestFormat = formats[0];
ecma402_abstract_1.invariant(Array.isArray(formats), 'formats should be a list of things');
for (var _i = 0, formats_1 = formats; _i < formats_1.length; _i++) {
var format = formats_1[_i];
var score = basicFormatMatcherScore(options, format);
if (score > bestScore) {
bestScore = score;
bestFormat = format;
}
}
return __assign({}, bestFormat);
}
function isNumericType(t) {
return t === 'numeric' || t === '2-digit';
}
/**
* https://tc39.es/ecma402/#sec-bestfitformatmatcher
* Just alias to basic for now
* @param options
* @param formats
*/
function bestFitFormatMatcher(options, formats) {
var bestScore = -Infinity;
var bestFormat = formats[0];
ecma402_abstract_1.invariant(Array.isArray(formats), 'formats should be a list of things');
for (var _i = 0, formats_2 = formats; _i < formats_2.length; _i++) {
var format = formats_2[_i];
var score = bestFitFormatMatcherScore(options, format);
if (score > bestScore) {
bestScore = score;
bestFormat = format;
}
}
var skeletonFormat = __assign({}, bestFormat);
var patternFormat = skeleton_1.parseDateTimeSkeleton(bestFormat.rawPattern);
// Kinda following https://github.com/unicode-org/icu/blob/dd50e38f459d84e9bf1b0c618be8483d318458ad/icu4j/main/classes/core/src/com/ibm/icu/text/DateTimePatternGenerator.java
// Method adjustFieldTypes
for (var prop in patternFormat) {
var skeletonValue = skeletonFormat[prop];
var patternValue = patternFormat[prop];
var requestedValue = options[prop];
// Don't mess with minute/second or we can get in the situation of
// 7:0:0 which is weird
if (prop === 'minute' || prop === 'second') {
continue;
}
// Nothing to do here
if (!requestedValue) {
continue;
}
// https://unicode.org/reports/tr35/tr35-dates.html#Matching_Skeletons
// Looks like we should not convert numeric to alphabetic but the other way
// around is ok
if (isNumericType(patternValue) &&
!isNumericType(requestedValue)) {
continue;
}
if (skeletonValue === requestedValue) {
continue;
}
patternFormat[prop] = requestedValue;
}
return patternFormat;
}
var formatDescriptor = {

@@ -542,3 +80,8 @@ enumerable: false,

}
return formatDateTime(dtf, x);
return ecma402_abstract_1.FormatDateTime(dtf, x, {
getInternalSlots: get_internal_slots_1.default,
localeData: exports.DateTimeFormat.localeData,
tzData: exports.DateTimeFormat.tzData,
getDefaultTimeZone: exports.DateTimeFormat.getDefaultTimeZone,
});
};

@@ -576,239 +119,2 @@ try {

}
function pad(n) {
if (n < 10) {
return "0" + n;
}
return String(n);
}
function offsetToGmtString(gmtFormat, hourFormat, offsetInMs, style) {
var offsetInMinutes = Math.floor(offsetInMs / 60000);
var mins = Math.abs(offsetInMinutes) % 60;
var hours = Math.floor(Math.abs(offsetInMinutes) / 60);
var _a = hourFormat.split(';'), positivePattern = _a[0], negativePattern = _a[1];
var offsetStr = '';
var pattern = offsetInMs < 0 ? negativePattern : positivePattern;
if (style === 'long') {
offsetStr = pattern
.replace('HH', pad(hours))
.replace('H', String(hours))
.replace('mm', pad(mins))
.replace('m', String(mins));
}
else if (mins || hours) {
if (!mins) {
pattern = pattern.replace(/:?m+/, '');
}
offsetStr = pattern
.replace(/H+/, String(hours))
.replace(/m+/, String(mins));
}
return gmtFormat.replace('{0}', offsetStr);
}
/**
* https://tc39.es/ecma402/#sec-partitiondatetimepattern
* @param dtf
* @param x
*/
function partitionDateTimePattern(dtf, x) {
x = TimeClip_1.default(x);
if (isNaN(x)) {
throw new RangeError('invalid time');
}
/** IMPL START */
var internalSlots = get_internal_slots_1.default(dtf);
var dataLocale = internalSlots.dataLocale;
var dataLocaleData = exports.DateTimeFormat.localeData[dataLocale];
/** IMPL END */
var locale = internalSlots.locale;
var nfOptions = Object.create(null);
nfOptions.useGrouping = false;
var nf = new Intl.NumberFormat(locale, nfOptions);
var nf2Options = Object.create(null);
nf2Options.minimumIntegerDigits = 2;
nf2Options.useGrouping = false;
var nf2 = new Intl.NumberFormat(locale, nf2Options);
var tm = toLocalTime(x,
// @ts-ignore
internalSlots.calendar, internalSlots.timeZone);
var result = [];
var patternParts = ecma402_abstract_1.PartitionPattern(internalSlots.pattern);
for (var _i = 0, patternParts_1 = patternParts; _i < patternParts_1.length; _i++) {
var patternPart = patternParts_1[_i];
var p = patternPart.type;
if (p === 'literal') {
result.push({
type: 'literal',
value: patternPart.value,
});
}
else if (DATE_TIME_PROPS.indexOf(p) > -1) {
var fv = '';
var f = internalSlots[p];
// @ts-ignore
var v = tm[p];
if (p === 'year' && v <= 0) {
v = 1 - v;
}
if (p === 'month') {
v++;
}
var hourCycle = internalSlots.hourCycle;
if (p === 'hour' && (hourCycle === 'h11' || hourCycle === 'h12')) {
v = v % 12;
if (v === 0 && hourCycle === 'h12') {
v = 12;
}
}
if (p === 'hour' && hourCycle === 'h24') {
if (v === 0) {
v = 24;
}
}
if (f === 'numeric') {
fv = nf.format(v);
}
else if (f === '2-digit') {
fv = nf2.format(v);
if (fv.length > 2) {
fv = fv.slice(fv.length - 2, fv.length);
}
}
else if (f === 'narrow' || f === 'short' || f === 'long') {
if (p === 'era') {
fv = dataLocaleData[p][f][v];
}
else if (p === 'timeZoneName') {
var timeZoneName = dataLocaleData.timeZoneName, gmtFormat = dataLocaleData.gmtFormat, hourFormat = dataLocaleData.hourFormat;
var timeZone = internalSlots.timeZone || exports.DateTimeFormat.getDefaultTimeZone();
var timeZoneData = timeZoneName[timeZone];
if (timeZoneData && timeZoneData[f]) {
fv = timeZoneData[f][+tm.inDST];
}
else {
// Fallback to gmtFormat
fv = offsetToGmtString(gmtFormat, hourFormat, tm.timeZoneOffset, f);
}
}
else if (p === 'month') {
fv = dataLocaleData.month[f][v - 1];
}
else {
fv = dataLocaleData[p][f][v];
}
}
result.push({
type: p,
value: fv,
});
}
else if (p === 'ampm') {
var v = tm.hour;
var fv = void 0;
if (v >= 11) {
fv = dataLocaleData.pm;
}
else {
fv = dataLocaleData.am;
}
result.push({
type: 'dayPeriod',
value: fv,
});
}
else if (p === 'relatedYear') {
var v = tm.relatedYear;
// @ts-ignore
var fv = nf.format(v);
result.push({
type: 'relatedYear',
value: fv,
});
}
else if (p === 'yearName') {
var v = tm.yearName;
// @ts-ignore
var fv = nf.format(v);
result.push({
type: 'yearName',
value: fv,
});
}
else {
result.push({
type: 'unknown',
value: x,
});
}
}
return result;
}
/**
* https://tc39.es/ecma402/#sec-formatdatetime
* @param dtf DateTimeFormat
* @param x
*/
function formatDateTime(dtf, x) {
var parts = partitionDateTimePattern(dtf, x);
var result = '';
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
var part = parts_1[_i];
result += part.value;
}
return result;
}
/**
* https://tc39.es/ecma402/#sec-formatdatetimetoparts
* @param dtf DateTimeFormat
* @param x
*/
function formatDateTimeParts(dtf, x) {
return partitionDateTimePattern(dtf, x);
}
function getApplicableZoneData(t, timeZone) {
var _a;
var tzData = exports.DateTimeFormat.tzData;
var zoneData = tzData[timeZone];
// We don't have data for this so just say it's UTC
if (!zoneData) {
return [0, false];
}
var i = 0;
var offset = 0;
var dst = false;
for (; i <= zoneData.length; i++) {
if (i === zoneData.length || zoneData[i][0] * 1e3 >= t) {
_a = zoneData[i - 1], offset = _a[2], dst = _a[3];
break;
}
}
return [offset * 1e3, dst];
}
/**
* https://tc39.es/ecma402/#sec-tolocaltime
* @param t
* @param calendar
* @param timeZone
*/
function toLocalTime(t, calendar, timeZone) {
ecma402_abstract_1.invariant(typeof t === 'number', 'invalid time');
ecma402_abstract_1.invariant(calendar === 'gregory', 'We only support Gregory calendar right now');
var _a = getApplicableZoneData(t, timeZone), timeZoneOffset = _a[0], inDST = _a[1];
var tz = t + timeZoneOffset;
var year = YearFromTime_1.default(tz);
return {
weekday: WeekDay_1.default(tz),
era: year < 0 ? 'BC' : 'AD',
year: year,
relatedYear: undefined,
yearName: undefined,
month: MonthFromTime_1.default(tz),
day: DateFromTime_1.default(tz),
hour: HourFromTime_1.default(tz),
minute: MinFromTime_1.default(tz),
second: SecFromTime_1.default(tz),
inDST: inDST,
// IMPORTANT: Not in spec
timeZoneOffset: timeZoneOffset,
};
}
exports.DateTimeFormat = function (locales, options) {

@@ -819,3 +125,12 @@ // Cannot use `new.target` bc of IE11 & TS transpiles it to something else

}
initializeDateTimeFormat(this, locales, options);
ecma402_abstract_1.InitializeDateTimeFormat(this, locales, options, {
tzData: exports.DateTimeFormat.tzData,
uppercaseLinks: UPPERCASED_LINKS,
availableLocales: exports.DateTimeFormat.availableLocales,
relevantExtensionKeys: exports.DateTimeFormat.relevantExtensionKeys,
getDefaultLocale: exports.DateTimeFormat.getDefaultLocale,
getDefaultTimeZone: exports.DateTimeFormat.getDefaultTimeZone,
getInternalSlots: get_internal_slots_1.default,
localeData: exports.DateTimeFormat.localeData,
});
/** IMPL START */

@@ -831,3 +146,3 @@ var internalSlots = get_internal_slots_1.default(this);

value: function supportedLocalesOf(locales, options) {
return ecma402_abstract_1.SupportedLocales(exports.DateTimeFormat.availableLocales, Intl.getCanonicalLocales(locales), options);
return ecma402_abstract_1.SupportedLocales(exports.DateTimeFormat.availableLocales, ecma402_abstract_1.CanonicalizeLocaleList(locales), options);
},

@@ -855,3 +170,3 @@ });

}
if (DATE_TIME_PROPS.indexOf(key) > -1) {
if (ecma402_abstract_1.DATE_TIME_PROPS.indexOf(key) > -1) {
if (internalSlots.dateStyle !== undefined ||

@@ -875,15 +190,26 @@ internalSlots.timeStyle !== undefined) {

else {
date = ToNumber_1.default(date);
date = ecma402_abstract_1.ToNumber(date);
}
return formatDateTimeParts(this, date);
return ecma402_abstract_1.FormatDateTimeToParts(this, date, {
getInternalSlots: get_internal_slots_1.default,
localeData: exports.DateTimeFormat.localeData,
tzData: exports.DateTimeFormat.tzData,
getDefaultTimeZone: exports.DateTimeFormat.getDefaultTimeZone,
});
},
});
var DEFAULT_TIMEZONE = (typeof process !== 'undefined' && process.env && process.env.TZ) || 'UTC';
var DEFAULT_TIMEZONE = 'UTC';
exports.DateTimeFormat.__setDefaultTimeZone = function (timeZone) {
if (timeZone !== undefined) {
timeZone = String(timeZone);
if (!isValidTimeZoneName(timeZone)) {
if (!ecma402_abstract_1.IsValidTimeZoneName(timeZone, {
tzData: exports.DateTimeFormat.tzData,
uppercaseLinks: UPPERCASED_LINKS,
})) {
throw new RangeError('Invalid timeZoneName');
}
timeZone = canonicalizeTimeZoneName(timeZone);
timeZone = ecma402_abstract_1.CanonicalizeTimeZoneName(timeZone, {
tzData: exports.DateTimeFormat.tzData,
uppercaseLinks: UPPERCASED_LINKS,
});
}

@@ -895,2 +221,3 @@ else {

};
exports.DateTimeFormat.relevantExtensionKeys = ['nu', 'ca', 'hc'];
exports.DateTimeFormat.__defaultTimeZone = DEFAULT_TIMEZONE;

@@ -908,25 +235,25 @@ exports.DateTimeFormat.getDefaultTimeZone = function () { return exports.DateTimeFormat.__defaultTimeZone; };

try {
var _a = ecma402_abstract_1.unpackData(locale, datum), dateFormat = _a.dateFormat, timeFormat = _a.timeFormat, dateTimeFormat = _a.dateTimeFormat, formats_3 = _a.formats, rawData = __rest(_a, ["dateFormat", "timeFormat", "dateTimeFormat", "formats"]);
var _a = ecma402_abstract_1.unpackData(locale, datum), dateFormat = _a.dateFormat, timeFormat = _a.timeFormat, dateTimeFormat = _a.dateTimeFormat, formats_1 = _a.formats, rawData = __rest(_a, ["dateFormat", "timeFormat", "dateTimeFormat", "formats"]);
var processedData = __assign(__assign({}, rawData), { dateFormat: {
full: skeleton_1.parseDateTimeSkeleton(dateFormat.full),
long: skeleton_1.parseDateTimeSkeleton(dateFormat.long),
medium: skeleton_1.parseDateTimeSkeleton(dateFormat.medium),
short: skeleton_1.parseDateTimeSkeleton(dateFormat.short),
full: ecma402_abstract_1.parseDateTimeSkeleton(dateFormat.full),
long: ecma402_abstract_1.parseDateTimeSkeleton(dateFormat.long),
medium: ecma402_abstract_1.parseDateTimeSkeleton(dateFormat.medium),
short: ecma402_abstract_1.parseDateTimeSkeleton(dateFormat.short),
}, timeFormat: {
full: skeleton_1.parseDateTimeSkeleton(timeFormat.full),
long: skeleton_1.parseDateTimeSkeleton(timeFormat.long),
medium: skeleton_1.parseDateTimeSkeleton(timeFormat.medium),
short: skeleton_1.parseDateTimeSkeleton(timeFormat.short),
full: ecma402_abstract_1.parseDateTimeSkeleton(timeFormat.full),
long: ecma402_abstract_1.parseDateTimeSkeleton(timeFormat.long),
medium: ecma402_abstract_1.parseDateTimeSkeleton(timeFormat.medium),
short: ecma402_abstract_1.parseDateTimeSkeleton(timeFormat.short),
}, dateTimeFormat: {
full: skeleton_1.parseDateTimeSkeleton(dateTimeFormat.full).pattern,
long: skeleton_1.parseDateTimeSkeleton(dateTimeFormat.long).pattern,
medium: skeleton_1.parseDateTimeSkeleton(dateTimeFormat.medium).pattern,
short: skeleton_1.parseDateTimeSkeleton(dateTimeFormat.short).pattern,
full: ecma402_abstract_1.parseDateTimeSkeleton(dateTimeFormat.full).pattern,
long: ecma402_abstract_1.parseDateTimeSkeleton(dateTimeFormat.long).pattern,
medium: ecma402_abstract_1.parseDateTimeSkeleton(dateTimeFormat.medium).pattern,
short: ecma402_abstract_1.parseDateTimeSkeleton(dateTimeFormat.short).pattern,
}, formats: {} });
var _loop_2 = function (calendar) {
processedData.formats[calendar] = Object.keys(formats_3[calendar]).map(function (skeleton) {
return skeleton_1.parseDateTimeSkeleton(skeleton, formats_3[calendar][skeleton]);
processedData.formats[calendar] = Object.keys(formats_1[calendar]).map(function (skeleton) {
return ecma402_abstract_1.parseDateTimeSkeleton(skeleton, formats_1[calendar][skeleton]);
});
};
for (var calendar in formats_3) {
for (var calendar in formats_1) {
_loop_2(calendar);

@@ -933,0 +260,0 @@ }

@@ -1,3 +0,4 @@

import { DateTimeFormat, IntlDateTimeFormatInternal } from '..';
import { IntlDateTimeFormatInternal } from '..';
import { DateTimeFormat } from '@formatjs/ecma402-abstract';
export default function getInternalSlots(x: DateTimeFormat): IntlDateTimeFormatInternal;
//# sourceMappingURL=get_internal_slots.d.ts.map

@@ -1,4 +0,5 @@

import { UnpackedData, PackedData, UnpackedZoneData } from './types';
import { UnpackedData, PackedData } from './types';
import { UnpackedZoneData } from '@formatjs/ecma402-abstract';
export declare function pack(data: UnpackedData): PackedData;
export declare function unpack(data: PackedData): Record<string, UnpackedZoneData[]>;
//# sourceMappingURL=packer.d.ts.map

@@ -1,2 +0,2 @@

import { DateTimeFormatOptions } from './types';
import { DateTimeFormatOptions } from '@formatjs/ecma402-abstract';
/**

@@ -3,0 +3,0 @@ * Number.prototype.toLocaleString ponyfill

@@ -6,2 +6,3 @@ "use strict";

var core_1 = require("./core");
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
/**

@@ -17,3 +18,3 @@ * Number.prototype.toLocaleString ponyfill

function toLocaleDateString(x, locales, options) {
var dtf = new core_1.DateTimeFormat(locales, core_1.toDateTimeOptions(options, 'date', 'date'));
var dtf = new core_1.DateTimeFormat(locales, ecma402_abstract_1.ToDateTimeOptions(options, 'date', 'date'));
return dtf.format(x);

@@ -23,5 +24,5 @@ }

function toLocaleTimeString(x, locales, options) {
var dtf = new core_1.DateTimeFormat(locales, core_1.toDateTimeOptions(options, 'time', 'time'));
var dtf = new core_1.DateTimeFormat(locales, ecma402_abstract_1.ToDateTimeOptions(options, 'time', 'time'));
return dtf.format(x);
}
exports.toLocaleTimeString = toLocaleTimeString;

@@ -1,2 +0,2 @@

import { LocaleData } from '@formatjs/ecma402-abstract';
import { LocaleData, DateTimeFormatLocaleInternalData } from '@formatjs/ecma402-abstract';
export interface PackedData {

@@ -16,3 +16,2 @@ zones: string[];

export declare type ZoneData = [number | string, number, number, number];
export declare type UnpackedZoneData = [number, string, number, boolean];
export declare type RawDateTimeLocaleData = LocaleData<RawDateTimeLocaleInternalData>;

@@ -44,72 +43,2 @@ export declare type RawDateTimeLocaleInternalData = Omit<DateTimeFormatLocaleInternalData, 'dateFormat' | 'timeFormat' | 'dateTimeFormat' | 'formats'> & {

}>;
export interface EraData {
BC: string;
AD: string;
}
export interface DateTimeFormatLocaleInternalData {
am: string;
pm: string;
weekday: {
narrow: string[];
long: string[];
short: string[];
};
era: {
narrow: EraData;
long: EraData;
short: EraData;
};
month: {
narrow: string[];
long: string[];
short: string[];
};
timeZoneName: TimeZoneNameData;
/**
* So we can construct GMT+08:00
*/
gmtFormat: string;
/**
* So we can construct GMT+08:00
*/
hourFormat: string;
hourCycle: string;
dateFormat: {
full: Formats;
long: Formats;
medium: Formats;
short: Formats;
};
timeFormat: {
full: Formats;
long: Formats;
medium: Formats;
short: Formats;
};
dateTimeFormat: {
full: string;
long: string;
medium: string;
short: string;
};
formats: Record<string, Formats[]>;
nu: string[];
hc: string[];
ca: string[];
}
export declare type Formats = Pick<DateTimeFormatOptions, 'weekday' | 'era' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'timeZoneName'> & {
hour12?: boolean;
pattern: string;
pattern12: string;
skeleton: string;
rawPattern: string;
};
export interface DateTimeFormatOptions extends Intl.DateTimeFormatOptions {
hourCycle?: 'h11' | 'h12' | 'h23' | 'h24';
dateStyle?: 'full' | 'long' | 'medium' | 'short';
timeStyle?: 'full' | 'long' | 'medium' | 'short';
fractionalSecondDigits?: number;
calendar?: 'buddhist' | 'chinese' | 'coptic' | 'ethiopia' | 'ethiopic' | 'gregory' | 'hebrew' | 'indian' | 'islamic' | 'iso8601' | 'japanese' | 'persian' | 'roc';
numberingSystem?: string;
}
//# sourceMappingURL=types.d.ts.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc