202 lines
7.0 KiB
JavaScript
202 lines
7.0 KiB
JavaScript
// Metro module 3500 (f3501).
|
|
import * as _isValid from "./isValid";
|
|
import { __esModule } from "./isValid";
|
|
import * as _subMilliseconds from "./subMilliseconds";
|
|
import * as _toDate from "./toDate";
|
|
import * as _Module3502 from "./Module3502";
|
|
import * as _dateLongFormatter from "./dateLongFormatter";
|
|
import * as _getTimezoneOffsetInMilliseconds from "./getTimezoneOffsetInMilliseconds";
|
|
import * as _toInteger from "./toInteger";
|
|
import * as _requiredArgs from "./requiredArgs";
|
|
import * as _Module3514 from "./Module3514";
|
|
import { getDefaultOptions } from "./Module3273";
|
|
import { isProtectedWeekYearToken, throwProtectedError, isProtectedDayOfYearToken } from "./Module3515";
|
|
let c1855_2, c1855_3, c1855_4, c1855_5, c1855_6, c1855_7, c1855_8, c1855_9, c1855_10, c1855_11, c1855_12, c1855_13, c1855_14, c1855_15;
|
|
export default function format(a0, a1, a2) {
|
|
let c13421_4, c13421_5;
|
|
(0, c1855_9.default)(2, arguments);
|
|
const r25 = String(a1);
|
|
const r30 = (0, getDefaultOptions)();
|
|
let r31 = a2?.locale;
|
|
if (!(r31 !== null && r31 !== void 0)) {
|
|
r31 = r30.locale;
|
|
}
|
|
if (!(r31 !== null && r31 !== void 0)) {
|
|
r31 = c1855_10.default;
|
|
}
|
|
const default2 = r31;
|
|
const default3 = c1855_8.default;
|
|
let r14 = a2?.firstWeekContainsDate;
|
|
if (!(r14 !== null && r14 !== void 0)) {
|
|
const r34 = a2 == null;
|
|
let r11 = void 0;
|
|
if (!r34) {
|
|
const locale = a2.locale;
|
|
r11 = void 0;
|
|
if (locale !== null) {
|
|
r11 = void 0;
|
|
if (locale !== void 0) {
|
|
const options = locale.options;
|
|
r11 = options !== null ? options !== void 0 ? options.firstWeekContainsDate : void 0 : void 0;
|
|
}
|
|
}
|
|
}
|
|
r14 = r11;
|
|
}
|
|
if (!(r14 !== null && r14 !== void 0)) {
|
|
r14 = r30.firstWeekContainsDate;
|
|
}
|
|
if (!(r14 !== null && r14 !== void 0)) {
|
|
const locale2 = r30.locale;
|
|
let r37 = void 0;
|
|
if (locale2 !== null) {
|
|
r37 = void 0;
|
|
if (locale2 !== void 0) {
|
|
const options2 = locale2.options;
|
|
r37 = options2 !== null ? options2 !== void 0 ? options2.firstWeekContainsDate : void 0 : void 0;
|
|
}
|
|
}
|
|
r14 = r37;
|
|
}
|
|
const firstWeekContainsDate = default3(r14 !== null ? r14 !== void 0 ? r14 : 1 : 1);
|
|
if (firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7) {
|
|
const default4 = c1855_8.default;
|
|
let r49 = a2?.weekStartsOn;
|
|
if (!(r49 !== null && r49 !== void 0)) {
|
|
const r50 = a2 == null;
|
|
let r51 = void 0;
|
|
if (!r50) {
|
|
const locale3 = a2.locale;
|
|
r51 = void 0;
|
|
if (locale3 !== null) {
|
|
r51 = void 0;
|
|
if (locale3 !== void 0) {
|
|
const options3 = locale3.options;
|
|
r51 = options3 !== null ? options3 !== void 0 ? options3.weekStartsOn : void 0 : void 0;
|
|
}
|
|
}
|
|
}
|
|
r49 = r51;
|
|
}
|
|
if (!(r49 !== null && r49 !== void 0)) {
|
|
r49 = r30.weekStartsOn;
|
|
}
|
|
if (!(r49 !== null && r49 !== void 0)) {
|
|
const locale4 = r30.locale;
|
|
let r55 = void 0;
|
|
if (locale4 !== null) {
|
|
r55 = void 0;
|
|
if (locale4 !== void 0) {
|
|
const options4 = locale4.options;
|
|
r55 = options4 !== null ? options4 !== void 0 ? options4.weekStartsOn : void 0 : void 0;
|
|
}
|
|
}
|
|
r49 = r55;
|
|
}
|
|
const weekStartsOn = default4(r49 !== null ? r49 !== void 0 ? r49 : 0 : 0);
|
|
if (weekStartsOn >= 0 && weekStartsOn <= 6) {
|
|
if (default2.localize) {
|
|
if (default2.formatLong) {
|
|
const _originalDate = (0, c1855_4.default)(a0);
|
|
if ((0, c1855_2.default)(_originalDate)) {
|
|
c13421_4 = (0, c1855_3.default)(_originalDate, (0, c1855_7.default)(_originalDate));
|
|
c13421_5 = {
|
|
firstWeekContainsDate,
|
|
weekStartsOn,
|
|
locale: default2,
|
|
_originalDate
|
|
};
|
|
return r25.match(c1855_12).map(function(item) {
|
|
const r5 = item[0];
|
|
return r5 !== "p" ? r5 === "P" ? (0, c1855_6.default[r5])(item, default2.formatLong) : item : (0, c1855_6.default[r5])(item, default2.formatLong);
|
|
}).join("").match(c1855_11).map(function(item) {
|
|
let r2 = item;
|
|
if (item === "''") {
|
|
return "'";
|
|
}
|
|
const r5 = item[0];
|
|
if (r5 === "'") {
|
|
const r74 = item.match(c1855_13);
|
|
if (r74) {
|
|
r2 = r74[1].replace(c1855_14, "'");
|
|
}
|
|
return r2;
|
|
}
|
|
const r7 = c1855_5.default[r5];
|
|
if (r7) {
|
|
if (!(a2 != null && a2.useAdditionalWeekYearTokens || !(0, isProtectedWeekYearToken)(item))) {
|
|
(0, throwProtectedError)(item, a1, String(a0));
|
|
}
|
|
if (!(a2 != null && a2.useAdditionalDayOfYearTokens || !(0, isProtectedDayOfYearToken)(item))) {
|
|
(0, throwProtectedError)(item, a1, String(a0));
|
|
}
|
|
return r7(c13421_4, item, default2.localize, c13421_5);
|
|
}
|
|
if (r5.match(c1855_15)) {
|
|
throw new RangeError("Format string contains an unescaped latin alphabet character `" + r5 + "`");
|
|
}
|
|
return item;
|
|
}).join("");
|
|
}
|
|
throw new RangeError("Invalid time value");
|
|
}
|
|
throw new RangeError("locale must contain formatLong property");
|
|
}
|
|
throw new RangeError("locale must contain localize property");
|
|
}
|
|
throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
|
|
}
|
|
throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
|
|
};
|
|
c1855_2 = _isValid ? __esModule ? _isValid : {
|
|
default: _isValid
|
|
} : {
|
|
default: _isValid
|
|
};
|
|
c1855_3 = _subMilliseconds ? _subMilliseconds.__esModule ? _subMilliseconds : {
|
|
default: _subMilliseconds
|
|
} : {
|
|
default: _subMilliseconds
|
|
};
|
|
c1855_4 = _toDate ? _toDate.__esModule ? _toDate : {
|
|
default: _toDate
|
|
} : {
|
|
default: _toDate
|
|
};
|
|
c1855_5 = _Module3502 ? _Module3502.__esModule ? _Module3502 : {
|
|
default: _Module3502
|
|
} : {
|
|
default: _Module3502
|
|
};
|
|
c1855_6 = _dateLongFormatter ? _dateLongFormatter.__esModule ? _dateLongFormatter : {
|
|
default: _dateLongFormatter
|
|
} : {
|
|
default: _dateLongFormatter
|
|
};
|
|
c1855_7 = _getTimezoneOffsetInMilliseconds ? _getTimezoneOffsetInMilliseconds.__esModule ? _getTimezoneOffsetInMilliseconds : {
|
|
default: _getTimezoneOffsetInMilliseconds
|
|
} : {
|
|
default: _getTimezoneOffsetInMilliseconds
|
|
};
|
|
c1855_8 = _toInteger ? _toInteger.__esModule ? _toInteger : {
|
|
default: _toInteger
|
|
} : {
|
|
default: _toInteger
|
|
};
|
|
c1855_9 = _requiredArgs ? _requiredArgs.__esModule ? _requiredArgs : {
|
|
default: _requiredArgs
|
|
} : {
|
|
default: _requiredArgs
|
|
};
|
|
c1855_10 = _Module3514 ? _Module3514.__esModule ? _Module3514 : {
|
|
default: _Module3514
|
|
} : {
|
|
default: _Module3514
|
|
};
|
|
c1855_11 = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
|
c1855_12 = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
c1855_13 = /^'([^]*?)'?$/;
|
|
c1855_14 = /''/g;
|
|
c1855_15 = /[a-zA-Z]/;
|
|
module.exports = exports.default;
|