decord/source/modules/parent_tools/FamilyCenterRestrictedHoursUtils.tsx

216 lines
7.5 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 10056
// Function ID: 10057
2026-07-29 08:29:29 +00:00
// Name: setsEqual
2026-08-24 06:08:38 +00:00
// Dependencies: [1940, 1236, 2336, 2]
2026-07-29 08:29:29 +00:00
// Exports: computeOverlappingInfo, formatDuration, formatRestrictedScheduleInAppSubtitle, formatTime, getShortDayLabels, sortRulesByStartTime, timeToMinutes, toTimeProto
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 10056 (setsEqual)
import getSystemLocale from "getSystemLocale" /* 1236 */;
import create from "create" /* 1940 */;
import messagesProxyDefault from "messagesProxy" /* 2336 */;
import set from "set" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-07-20 16:05:17 +00:00
function setsEqual(set, set2) {
if (set.size !== set2.size) {
return false;
} else {
2026-07-29 08:29:29 +00:00
const obj = set[Symbol.iterator]();
while (obj !== undefined) {
if (set2.has(tmp3)) {
continue;
} else {
let tmp5 = obj;
obj.return();
let flag = false;
return false;
2026-07-20 16:05:17 +00:00
}
}
return true;
}
}
function formatDays(days) {
2026-08-24 06:08:38 +00:00
set = new Set(days);
2026-07-20 16:05:17 +00:00
if (setsEqual(set, set2)) {
2026-07-29 08:29:29 +00:00
const intl3 = set(1236).intl;
2026-08-24 06:08:38 +00:00
return intl3.string(dateTimeFormat(2336).bPjqd1);
2026-07-29 08:29:29 +00:00
} else if (tmp2(set, set)) {
const intl2 = set(1236).intl;
2026-08-24 06:08:38 +00:00
return intl2.string(dateTimeFormat(2336)["4dr9L9"]);
2026-07-29 08:29:29 +00:00
} else if (tmp2(set, set1)) {
const intl = set(1236).intl;
2026-08-24 06:08:38 +00:00
return intl.string(dateTimeFormat(2336)["6lTTJ+"]);
2026-07-20 16:05:17 +00:00
} else {
const _Intl = Intl;
2026-07-29 08:29:29 +00:00
dateTimeFormat = new Intl.DateTimeFormat(set(1236).intl.currentLocale, { weekday: "short" });
2026-07-20 16:05:17 +00:00
const mapped = items.map((arg0, arg1) => {
let formatResult = null;
if (set.has(arg0)) {
const _Date = Date;
const date = new Date(2025, 0, 5 + arg1);
formatResult = dateTimeFormat.format(date);
}
return formatResult;
});
const found = mapped.filter((arg0) => null !== arg0);
return found.join(", ");
}
}
function getScheduleRuleDateRange(rule) {
let str = "";
if (null != rule.startTime) {
str = "";
if (null != rule.endTime) {
2026-07-29 08:29:29 +00:00
const startTime = rule.startTime;
const _Intl = Intl;
2026-08-24 06:08:38 +00:00
const dateTimeFormat = new Intl.DateTimeFormat(getSystemLocale.intl.currentLocale, { hour: "numeric", minute: "2-digit" });
2026-07-29 08:29:29 +00:00
const _Date = Date;
const date = new Date(2025, 0, 1, startTime.hours, startTime.minutes);
const endTime = rule.endTime;
const _Intl2 = Intl;
2026-08-24 06:08:38 +00:00
const dateTimeFormat1 = new Intl.DateTimeFormat(getSystemLocale.intl.currentLocale, { hour: "numeric", minute: "2-digit" });
2026-07-29 08:29:29 +00:00
const _Date2 = Date;
const date1 = new Date(2025, 0, 1, endTime.hours, endTime.minutes);
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal;
2026-07-29 08:29:29 +00:00
str = "" + dateTimeFormat.format(date) + " \u2013 " + dateTimeFormat1.format(date1);
const formatResult = dateTimeFormat.format(date);
2026-07-20 16:05:17 +00:00
}
}
return str;
}
2026-08-24 06:08:38 +00:00
const items = [create.DayOfWeek.SUNDAY, create.DayOfWeek.MONDAY, create.DayOfWeek.TUESDAY, create.DayOfWeek.WEDNESDAY, create.DayOfWeek.THURSDAY, create.DayOfWeek.FRIDAY, create.DayOfWeek.SATURDAY];
let set = new Set(require("module_1"));
2026-07-20 16:05:17 +00:00
const items1 = [items[0], items[6]];
const set1 = new Set(items1);
const set2 = new Set(items);
2026-07-23 10:11:24 +00:00
let result = set.fileFinishedImporting("modules/parent_tools/FamilyCenterRestrictedHoursUtils.tsx");
2026-07-20 16:05:17 +00:00
export const DAYS_ORDERED = items;
export const getShortDayLabels = function getShortDayLabels(narrow) {
2026-07-29 08:29:29 +00:00
dateTimeFormat = new Intl.DateTimeFormat(dateTimeFormat(1236).intl.currentLocale, { weekday: narrow });
2026-07-20 16:05:17 +00:00
return items.map((arg0, arg1) => dateTimeFormat.format(new Date(2025, 0, 5 + arg1)));
};
2026-07-29 08:29:29 +00:00
export const formatTime = function formatTime(hours) {
2026-08-24 06:08:38 +00:00
const dateTimeFormat = new Intl.DateTimeFormat(getSystemLocale.intl.currentLocale, { hour: "numeric", minute: "2-digit" });
2026-07-29 08:29:29 +00:00
return dateTimeFormat.format(new Date(2025, 0, 1, hours.hours, hours.minutes));
};
2026-07-20 16:05:17 +00:00
export { formatDays };
2026-07-29 08:29:29 +00:00
export const timeToMinutes = function timeToMinutes(first1) {
return 60 * first1.hours + first1.minutes;
};
2026-07-20 16:05:17 +00:00
export const formatDuration = function formatDuration(arg0) {
const result = arg0 / 60;
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
2026-07-20 16:05:17 +00:00
const formatToPlainString = intl.formatToPlainString;
2026-08-24 06:08:38 +00:00
const tmp3 = messagesProxyDefault;
2026-07-20 16:05:17 +00:00
if (isIntegerResult) {
2026-07-29 08:29:29 +00:00
let obj = { hours: null };
obj[0] = result;
2026-07-20 16:05:17 +00:00
let formatToPlainStringResult = formatToPlainString(tmp3.hFDcmZ, obj);
} else {
2026-07-29 08:29:29 +00:00
obj = { hours: null };
2026-07-20 16:05:17 +00:00
const _Math = Math;
2026-07-29 08:29:29 +00:00
obj[0] = Math.floor(result);
2026-07-20 16:05:17 +00:00
formatToPlainStringResult = formatToPlainString(tmp3.wcrXLM, obj);
}
return formatToPlainStringResult;
};
export { getScheduleRuleDateRange };
export const formatRestrictedScheduleInAppSubtitle = function formatRestrictedScheduleInAppSubtitle(startTime) {
if (null != startTime.startTime) {
if (null != startTime.endTime) {
2026-07-29 08:29:29 +00:00
startTime = startTime.startTime;
const _Intl = Intl;
2026-08-24 06:08:38 +00:00
const dateTimeFormat = new Intl.DateTimeFormat(getSystemLocale.intl.currentLocale, { hour: "numeric", minute: "2-digit" });
2026-07-29 08:29:29 +00:00
const _Date = Date;
const date = new Date(2025, 0, 1, startTime.hours, startTime.minutes);
const endTime = startTime.endTime;
const _Intl2 = Intl;
const tmp4 = formatDays(startTime.days);
const tmp6 = require;
2026-08-24 06:08:38 +00:00
const dateTimeFormat1 = new Intl.DateTimeFormat(getSystemLocale.intl.currentLocale, { hour: "numeric", minute: "2-digit" });
2026-07-29 08:29:29 +00:00
const _Date2 = Date;
const date1 = new Date(2025, 0, 1, endTime.hours, endTime.minutes);
const startTime2 = startTime.startTime;
const endTime2 = startTime.endTime;
const formatResult = dateTimeFormat.format(date);
if (60 * startTime2.hours + startTime2.minutes > 60 * endTime2.hours + endTime2.minutes) {
2026-08-24 06:08:38 +00:00
ERTn_E = messagesProxyDefault.OxveI8;
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
ERTn_E = messagesProxyDefault["ERTn+E"];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const intl = tmp6(1236).intl;
const obj = { days: null, startTime: null, endTime: null };
obj[0] = tmp4;
obj[1] = formatResult;
obj[2] = dateTimeFormat1.format(date1);
2026-07-20 16:05:17 +00:00
return intl.formatToPlainString(ERTn_E, obj);
}
}
return null;
};
export const sortRulesByStartTime = function sortRulesByStartTime(rules) {
const substr = rules.slice();
return substr.sort((startTime, startTime2) => {
startTime = startTime.startTime;
2026-07-29 08:29:29 +00:00
let num;
if (startTime != null) {
num = startTime.hours;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
startTime2 = startTime.startTime;
2026-07-29 08:29:29 +00:00
let num2;
2026-07-20 16:05:17 +00:00
const result = 60 * num;
2026-07-29 08:29:29 +00:00
if (startTime2 != null) {
num2 = startTime2.minutes;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num2 == null) {
num2 = 0;
2026-07-20 16:05:17 +00:00
}
const startTime3 = startTime2.startTime;
2026-07-29 08:29:29 +00:00
let num3;
2026-07-20 16:05:17 +00:00
const sum = result + num2;
2026-07-29 08:29:29 +00:00
if (startTime3 != null) {
num3 = startTime3.hours;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num3 == null) {
num3 = 0;
2026-07-20 16:05:17 +00:00
}
const startTime4 = startTime2.startTime;
2026-07-29 08:29:29 +00:00
let num4;
2026-07-20 16:05:17 +00:00
const result1 = 60 * num3;
2026-07-29 08:29:29 +00:00
if (startTime4 != null) {
num4 = startTime4.minutes;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num4 == null) {
num4 = 0;
2026-07-20 16:05:17 +00:00
}
return sum - (result1 + num4);
});
};
2026-08-24 06:08:38 +00:00
export const toTimeProto = function toTimeProto(closure_1_10) {
return { hours: closure_1_10.hours, minutes: closure_1_10.minutes, seconds: 0, nanos: 0 };
2026-07-20 16:05:17 +00:00
};
export const computeOverlappingInfo = function computeOverlappingInfo(first3, memo1, memo) {
2026-08-24 06:08:38 +00:00
closure_0 = first3;
closure_1 = memo1;
closure_2 = memo;
2026-07-20 16:05:17 +00:00
const conflictingEntries = [];
2026-07-23 10:11:24 +00:00
const item = conflictingEntries.forEach((arg0, arg1) => {
2026-07-20 16:05:17 +00:00
if (arg0.has(arg0)) {
2026-07-23 10:11:24 +00:00
const found = memo1.find((days) => {
2026-07-20 16:05:17 +00:00
days = days.days;
2026-07-23 10:11:24 +00:00
return days.includes(closure_0);
2026-07-20 16:05:17 +00:00
});
if (null != found) {
2026-07-29 08:29:29 +00:00
const obj = { dayLabel: null, timeRange: null };
obj[0] = memo[arg1];
2026-08-24 06:08:38 +00:00
obj[1] = closure_1_9(found);
2026-07-20 16:05:17 +00:00
conflictingEntries.push(obj);
}
}
});
return { conflictingEntries };
};