decord/source/lib/makeDateFormatter.tsx

222 lines
6 KiB
TypeScript
Raw Normal View History

2026-09-01 10:26:29 +00:00
// Module ID: 4182
// Function ID: 4183
2026-07-29 08:29:29 +00:00
// Name: defaultMeridiem
2026-09-02 09:53:35 +00:00
// Dependencies: [4166, 1305, 4180, 4183, 4074, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-09-01 10:26:29 +00:00
// Module 4182 (defaultMeridiem)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
2026-07-20 16:05:17 +00:00
function defaultMeridiem(arg0, arg1, arg2) {
if (arg0 < 12) {
let str2 = "AM";
if (arg2) {
str2 = "am";
}
let str = str2;
} else {
str = "PM";
if (arg2) {
str = "pm";
}
}
return str;
}
function getLocaleData() {
2026-09-02 09:53:35 +00:00
let obj = format5(4074);
2026-07-20 16:05:17 +00:00
const _config = obj.localeData()._config;
2026-07-29 08:29:29 +00:00
({ months, monthsShort, weekdays, weekdaysShort, weekdaysMin, meridiem } = _config);
2026-07-20 16:05:17 +00:00
if (undefined === meridiem) {
meridiem = defaultMeridiem;
}
2026-07-29 08:29:29 +00:00
({ ordinal, week, longDateFormat } = _config);
2026-07-20 16:05:17 +00:00
if (undefined === week) {
2026-07-23 10:11:24 +00:00
week = { dow: 0, doy: 6 };
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
ordinal = "month";
format5 = months;
2026-08-04 21:03:28 +00:00
if (typeof months === "function") {
2026-09-02 09:53:35 +00:00
let tmpResult = tmp(4074);
2026-08-24 06:08:38 +00:00
dependencyMap = months.bind(tmpResult.localeData());
2026-07-29 08:29:29 +00:00
let fn = (arg0, arg1) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-29 08:29:29 +00:00
return callback({ [closure_0]: () => closure_0 }, arg1);
};
} else {
const _Array = Array;
let format = months;
if (!Array.isArray(months)) {
format = months.format;
}
format5 = format;
fn = (arg0) => format5[arg0];
}
obj = { months: fn, monthsShort: null, weekdays: null, weekdaysShort: null, weekdaysMin: null, meridiem: null, ordinal: null, longDateFormat: null, longFormatters: null, week: null };
ordinal = "month";
format5 = monthsShort;
2026-08-04 21:03:28 +00:00
if (typeof monthsShort === "function") {
2026-09-02 09:53:35 +00:00
tmpResult = tmp(4074);
2026-07-29 08:29:29 +00:00
dependencyMap = monthsShort.bind(tmpResult.localeData());
let fn2 = (arg0, arg1) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-29 08:29:29 +00:00
return callback({ [closure_0]: () => closure_0 }, arg1);
};
} else {
const _Array2 = Array;
let format2 = monthsShort;
if (!Array.isArray(monthsShort)) {
format2 = monthsShort.format;
}
format5 = format2;
fn2 = (arg0) => format5[arg0];
}
obj[1] = fn2;
ordinal = "day";
format5 = weekdays;
2026-08-04 21:03:28 +00:00
if (typeof weekdays === "function") {
2026-09-02 09:53:35 +00:00
dependencyMap = weekdays.bind(tmp(4074).localeData());
2026-07-29 08:29:29 +00:00
let fn3 = (arg0, arg1) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-29 08:29:29 +00:00
return callback({ [closure_0]: () => closure_0 }, arg1);
};
2026-09-02 09:53:35 +00:00
const tmpResult1 = tmp(4074);
2026-07-29 08:29:29 +00:00
} else {
const _Array3 = Array;
let format3 = weekdays;
if (!Array.isArray(weekdays)) {
format3 = weekdays.format;
}
format5 = format3;
fn3 = (arg0) => format5[arg0];
}
obj[2] = fn3;
ordinal = "day";
format5 = weekdaysShort;
2026-08-04 21:03:28 +00:00
if (typeof weekdaysShort === "function") {
2026-09-02 09:53:35 +00:00
dependencyMap = weekdaysShort.bind(tmp(4074).localeData());
2026-07-29 08:29:29 +00:00
let fn4 = (arg0, arg1) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-29 08:29:29 +00:00
return callback({ [closure_0]: () => closure_0 }, arg1);
};
2026-09-02 09:53:35 +00:00
const tmpResult2 = tmp(4074);
2026-07-29 08:29:29 +00:00
} else {
const _Array4 = Array;
let format4 = weekdaysShort;
if (!Array.isArray(weekdaysShort)) {
format4 = weekdaysShort.format;
}
format5 = format4;
fn4 = (arg0) => format5[arg0];
}
obj[3] = fn4;
ordinal = "day";
format5 = weekdaysMin;
2026-08-04 21:03:28 +00:00
if (typeof weekdaysMin === "function") {
2026-09-02 09:53:35 +00:00
dependencyMap = weekdaysMin.bind(tmp(4074).localeData());
2026-07-29 08:29:29 +00:00
let fn5 = (arg0, arg1) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-29 08:29:29 +00:00
return callback({ [closure_0]: () => closure_0 }, arg1);
};
2026-09-02 09:53:35 +00:00
const tmpResult3 = tmp(4074);
2026-07-29 08:29:29 +00:00
} else {
const _Array5 = Array;
format5 = weekdaysMin;
if (!Array.isArray(weekdaysMin)) {
format5 = weekdaysMin.format;
}
fn5 = (arg0) => format5[arg0];
}
obj[4] = fn5;
obj[5] = meridiem;
2026-08-04 21:03:28 +00:00
if (typeof ordinal === "string") {
2026-07-29 08:29:29 +00:00
ordinal = (arg0) => ordinal.replace("%d", "" + arg0);
}
obj[6] = ordinal;
obj[7] = longDateFormat;
obj[8] = [];
obj[9] = week;
2026-07-20 16:05:17 +00:00
return obj;
}
2026-08-24 06:08:38 +00:00
let result = set.fileFinishedImporting("lib/makeDateFormatter.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default function makeFormatter(str) {
2026-07-20 16:05:17 +00:00
let flag = arg2;
if (arg2 === undefined) {
flag = false;
}
2026-07-23 10:11:24 +00:00
let _require;
2026-07-29 08:29:29 +00:00
let _function;
let tmp = arg1;
if (arg1 == null) {
tmp = getLocaleData();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
_require = tmp;
let result = undefined === arg1 && !flag;
2026-07-20 16:05:17 +00:00
if (result) {
2026-09-01 10:26:29 +00:00
result = undefined !== _require(4180).makeFormatter;
2026-07-20 16:05:17 +00:00
}
if (result) {
2026-09-01 10:26:29 +00:00
result = _require(4180).supportsSystemDateFormatter();
const obj = _require(4180);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let replaced = str;
2026-07-20 16:05:17 +00:00
if (!result) {
2026-07-29 08:29:29 +00:00
_require = str;
_function = tmp;
replaced = str.replace(/L[L|T|S]{0,3}/g, (arr) => {
if (obj.test(arr)) {
let LLLL = _function.longDateFormat.LLLL;
} else {
if (obj2.test(arr)) {
LLLL = _function.longDateFormat.LLL + arr.slice(3);
} else {
if (obj3.test(arr)) {
LLLL = _function.longDateFormat.LL + arr.slice(2);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
if (obj4.test(arr)) {
LLLL = _function.longDateFormat.LTS + arr.slice(3);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
if (obj5.test(arr)) {
LLLL = _function.longDateFormat.LT + arr.slice(2);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
LLLL = arr;
if (obj6.test(arr)) {
2026-07-20 16:05:17 +00:00
LLLL = arr;
2026-07-29 08:29:29 +00:00
if ("[" !== "["[arg1 - 1]) {
LLLL = _function.longDateFormat.L + arr.slice(1);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
obj6 = /^L/;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj5 = /^LT/;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj4 = /^LTS/;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj3 = /^LL/;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj2 = /^LLL/;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return LLLL;
});
}
const items = [];
2026-09-02 09:53:35 +00:00
if (replaced.length > 0) {
str.charAt(0);
}
2026-09-03 10:05:34 +00:00
// // eliminated: always false
// // eliminated: always false
// // eliminated: always false
// // eliminated: always false
// // eliminated: always false
// // eliminated: always false
// // eliminated: always false
// // eliminated: always false
// // eliminated: always false
// // eliminated: always false
// // eliminated: always false
// // eliminated: always false
_function = new Function("d", "localeData", tmp44 + "return (\n\"\" +\n" + items.join(" +\n") + "\n);");
2026-07-29 08:29:29 +00:00
return (input) => _function(input, closure_0);
2026-07-20 16:05:17 +00:00
};
export { getLocaleData };