// Metro module 8216 (f8217). import GuildScheduledEventStore from "./GuildScheduledEventStore"; import { getNextRecurrenceIdInEvent, getScheduleForRecurrenceWithException, getBaseScheduleForRecurrence } from "./utils/ScheduleUtils"; import useEventException, { getEventException } from "./useEventException"; import { useStateFromStores } from "../../_bundle/Module589"; export default function useEventSchedule(a0, a1) { let r35; const r8 = a1 == null ? getNextRecurrenceIdInEvent(a0) : a1; const eventException = useEventException(r8, a0.id); const recurrence_rule = a0.recurrence_rule; if (recurrence_rule != null && r8 != null) { const scheduleForRecurrenceWithException = getScheduleForRecurrenceWithException(getBaseScheduleForRecurrence(r8, a0), eventException); const { startDate, endDate } = scheduleForRecurrenceWithException; r35 = { startTime: startDate.toDate(), endTime: endDate == null ? void 0 : endDate.toDate() }; } else { r35 = { startTime: new Date(a0.scheduled_start_time), endTime: a0.scheduled_end_time != null ? new Date(a0.scheduled_end_time) : null }; } return r35; }; export function useEventScheduleById(c16372_0, a1) { let r42; let r10 = a1; const stateFromStores = useStateFromStores([GuildScheduledEventStore], () => GuildScheduledEventStore.getGuildScheduledEvent(c16372_0)); if (a1 == null) { r10 = getNextRecurrenceIdInEvent(stateFromStores); } const eventException = useEventException(r10, stateFromStores?.id); const r27 = stateFromStores == null; let r28 = null; if (!r27) { if (stateFromStores.recurrence_rule != null && r10 != null) { const scheduleForRecurrenceWithException = getScheduleForRecurrenceWithException(getBaseScheduleForRecurrence(r10, stateFromStores), eventException); const { startDate, endDate } = scheduleForRecurrenceWithException; r42 = { startTime: startDate.toDate(), endTime: endDate == null ? void 0 : endDate.toDate() }; } else { r42 = { startTime: new Date(stateFromStores.scheduled_start_time), endTime: stateFromStores.scheduled_end_time != null ? new Date(stateFromStores.scheduled_end_time) : null }; } r28 = r42; } return r28; } export function getEventSchedule(a0, a1) { let r29; const eventException = getEventException(a1, a0.id); if (a0.recurrence_rule != null && a1 != null) { const scheduleForRecurrenceWithException = getScheduleForRecurrenceWithException(getBaseScheduleForRecurrence(a1, a0), eventException); const { startDate, endDate } = scheduleForRecurrenceWithException; r29 = { startTime: startDate.toDate(), endTime: endDate == null ? void 0 : endDate.toDate() }; } else { r29 = { startTime: new Date(a0.scheduled_start_time), endTime: a0.scheduled_end_time != null ? new Date(a0.scheduled_end_time) : null }; } return r29; }