This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,210 @@
// Metro module 8209 (f8210).
import AuthenticationStore from "../../../stores/AuthenticationStore";
import { FAKE_EVENT_ID, GuildScheduledEventEntityTypes, GuildScheduledEventPrivacyLevel, GuildScheduledEventStatus } from "../GuildScheduledEventsConstants";
import { getInitialEventStartDate } from "./ScheduleUtils";
import { getLocationFromEvent } from "./EntityUtils";
const r20 = {
CHANNEL_SELECTOR: "ChannelSelector",
DETAILS: "Details",
PREVIEW: "Preview"
};
export { r20 as EditGuildEventScreens };
export function isEditingEvent(a0) {
return Boolean(a0?.id);
}
export function recurrenceRuleToServer(a0) {
const r1 = a0 == null;
let r2 = null;
if (!r1) {
let r15 = a0.byMonthDay?.length;
if (r15 == null) {
r15 = 0;
}
r2 = {
start: a0.start,
end: a0.end,
frequency: a0.frequency,
interval: a0.interval,
by_weekday: a0.byWeekday,
by_n_weekday: a0.byNWeekday,
by_month: a0.byMonth,
by_month_day: r15 > 0 ? a0.byMonthDay : null,
by_year_day: a0.byYearDay,
count: a0.count
};
}
return r2;
}
export function recurrenceRuleFromServer(a0) {
return a0 == null ? null : {
start: new Date(a0.start).toISOString(),
end: a0.end != null ? new Date(a0.end).toISOString() : null,
frequency: a0.frequency,
interval: a0.interval,
byWeekday: a0.by_weekday,
byNWeekday: a0.by_n_weekday,
byMonth: a0.by_month,
byMonthDay: a0.by_month_day,
byYearDay: a0.by_year_day,
count: a0.count
};
}
export function isExistingGuildEvent(a0) {
return a0 != null && "id" in a0;
}
export function convertToFakeGuildEvent(a0, a1, a2) {
let id = a2;
const name = a0.name;
let description = a0.description;
const { privacyLevel, channelId, scheduledStartTime, scheduledEndTime, entityType } = a0;
let entityMetadata = a0.entityMetadata;
let image = a0.image;
const { recurrenceRule, eventExceptions } = a0;
if (a2 == null) {
id = FAKE_EVENT_ID;
}
if (description == null) {
description = null;
}
if (entityMetadata == null) {
entityMetadata = null;
}
if (image == null) {
image = void 0;
}
const r17 = {
id,
name,
description,
privacy_level: privacyLevel,
scheduled_start_time: scheduledStartTime,
scheduled_end_time: scheduledEndTime,
entity_type: entityType,
entity_metadata: entityMetadata,
image,
channel_id: channelId,
guild_id: a1,
creator_id: AuthenticationStore.getId(),
status: GuildScheduledEventStatus.SCHEDULED,
recurrence_rule: null,
guild_scheduled_event_exceptions: null
};
const r1 = recurrenceRule == null;
let recurrence_rule = null;
if (!r1) {
let r35 = recurrenceRule.byMonthDay?.length;
if (r35 == null) {
r35 = 0;
}
recurrence_rule = {
start: recurrenceRule.start,
end: recurrenceRule.end,
frequency: recurrenceRule.frequency,
interval: recurrenceRule.interval,
by_weekday: recurrenceRule.byWeekday,
by_n_weekday: recurrenceRule.byNWeekday,
by_month: recurrenceRule.byMonth,
by_month_day: r35 > 0 ? recurrenceRule.byMonthDay : null,
by_year_day: recurrenceRule.byYearDay,
count: recurrenceRule.count
};
}
r17.recurrence_rule = recurrence_rule;
r17.guild_scheduled_event_exceptions = eventExceptions.map((eventException) => ({
event_exception_id: eventException.eventExceptionId,
event_id: eventException.eventId,
guild_id: eventException.guildId,
scheduled_start_time: eventException.scheduledStartTime,
scheduled_end_time: eventException.scheduledEndTime,
is_canceled: eventException.isCanceled
}));
return r17;
}
export function getInitialGuildEventData(a0, a1) {
let name = a0?.name;
if (name == null) {
name = "";
}
let privacyLevel = a0?.privacy_level;
if (privacyLevel == null) {
privacyLevel = GuildScheduledEventPrivacyLevel.GUILD_ONLY;
}
let description = a0?.description;
if (description == null) {
description = "";
}
let scheduledStartTime = a0?.scheduled_start_time;
if (scheduledStartTime == null) {
scheduledStartTime = getInitialEventStartDate().toISOString();
}
let entityType = a0?.entity_type;
if (entityType == null) {
entityType = GuildScheduledEventEntityTypes.NONE;
}
let entityMetadata = a0?.entity_metadata;
if (entityMetadata == null) {
entityMetadata = void 0;
}
const channel_id = a0?.channel_id;
const creator_id = a0?.creator_id;
const image = a0?.image;
const scheduled_end_time = a0?.scheduled_end_time;
const recurrence_rule = a0?.recurrence_rule;
const recurrenceRule = recurrence_rule == null ? null : {
start: new Date(recurrence_rule.start).toISOString(),
end: recurrence_rule.end != null ? new Date(recurrence_rule.end).toISOString() : null,
frequency: recurrence_rule.frequency,
interval: recurrence_rule.interval,
byWeekday: recurrence_rule.by_weekday,
byNWeekday: recurrence_rule.by_n_weekday,
byMonth: recurrence_rule.by_month,
byMonthDay: recurrence_rule.by_month_day,
byYearDay: recurrence_rule.by_year_day,
count: recurrence_rule.count
};
let r68 = a0?.guild_scheduled_event_exceptions;
if (r68 == null) {
r68 = [];
}
const r4 = {
name,
privacyLevel,
description,
scheduledStartTime,
entityType,
entityMetadata,
channelId: channel_id,
creatorId: creator_id,
image,
scheduledEndTime: scheduled_end_time,
recurrenceRule,
eventExceptions: r68.map((item) => ({
eventExceptionId: item.event_exception_id,
eventId: item.event_id,
guildId: item.guild_id,
scheduledStartTime: item.scheduled_start_time,
scheduledEndTime: item.scheduled_end_time,
isCanceled: item.is_canceled
}))
};
const r72 = a0 != null && "id" in a0;
L57: {
if (r72 && a0?.entity_type === GuildScheduledEventEntityTypes.EXTERNAL) {
const locationFromEvent = getLocationFromEvent(a0);
if (locationFromEvent == null) {
break L57;
}
r4.entityMetadata = {
location: locationFromEvent
};
} else if (r4.channelId == null && a1 != null) {
r4.channelId = a1.id;
if (a1.isGuildStageVoice()) {
r4.entityType = GuildScheduledEventEntityTypes.STAGE_INSTANCE;
} else if (a1.isGuildVoice()) {
r4.entityType = GuildScheduledEventEntityTypes.VOICE;
}
}
}
return r4;
}
@@ -0,0 +1,25 @@
// Metro module 8213 (f8214).
import ChannelStore from "../../../stores/ChannelStore";
import { EntityChannelTypes, GuildScheduledEventEntityTypes } from "../GuildScheduledEventsConstants";
export function getChannelFromEvent(a0) {
const { entity_type, channel_id } = a0;
const r0 = entity_type in EntityChannelTypes && channel_id != null;
let r7 = void 0;
if (r0) {
let r11 = ChannelStore.getChannel(a0.channel_id);
if (r11 == null) {
r11 = void 0;
}
r7 = r11;
}
return r7;
}
export function getLocationFromEvent({ entity_type, entity_metadata }) {
return entity_type === GuildScheduledEventEntityTypes.EXTERNAL && entity_metadata != null && "location" in entity_metadata ? entity_metadata.location : null;
}
export function getLocationFromEventData({ entityType, entityMetadata }) {
return entityType === GuildScheduledEventEntityTypes.EXTERNAL && entityMetadata != null && "location" in entityMetadata ? entityMetadata.location : null;
}
export function getChannelTypeFromEntity(a0) {
return a0 !== GuildScheduledEventEntityTypes.VOICE ? a0 === GuildScheduledEventEntityTypes.STAGE_INSTANCE ? EntityChannelTypes[a0] : void 0 : EntityChannelTypes[a0];
}
@@ -0,0 +1,67 @@
// Metro module 8214 (f8215).
import AuthenticationStore from "../../../stores/AuthenticationStore";
import GuildScheduledEventStore from "../GuildScheduledEventStore";
import { GuildScheduledEventStatusDone, GuildScheduledEventUserResponses } from "../GuildScheduledEventsConstants";
import { intl, t } from "../../../intl/index.native";
import { getEventException } from "../useEventException";
import { getEventSchedule } from "../useEventSchedule";
import { getRecurrenceStatus, getNextRecurrenceIdInEvent } from "./ScheduleUtils";
let c5220_6 = {
SERIES: 0,
0: "SERIES",
RECURRENCE: 1,
1: "RECURRENCE"
};
export function getExistingRsvp(a0, a1) {
return GuildScheduledEventStore.getRsvp(a0, a1, AuthenticationStore.getId());
}
export { c5220_6 as ResponseOptions };
export function getResponseOptions() {
return [{
name: intl.string(t.uoorxi),
value: c5220_6.SERIES
}, {
name: intl.string(t.lwZCFT),
value: c5220_6.RECURRENCE
}];
}
export function handleRsvp(a0) {
let r46;
const eventId = a0.eventId;
let recurrenceId = a0.recurrenceId;
const { guildId, updateRsvp, openRsvpPicker, onRsvp } = a0;
const guildScheduledEvent = GuildScheduledEventStore.getGuildScheduledEvent(eventId);
if (guildScheduledEvent != null) {
const eventException = getEventException(recurrenceId, eventId);
const startTime = getEventSchedule(guildScheduledEvent, recurrenceId).startTime;
const r16 = guildScheduledEvent?.scheduled_start_time != null ? getRecurrenceStatus(eventException, startTime, new Date(guildScheduledEvent?.scheduled_start_time)) : null;
L12: {
if (r16 != null) {
const r45 = GuildScheduledEventStatusDone.has(r16);
r46 = null;
if (r45) {
break L12;
}
}
if (recurrenceId == null) {
recurrenceId = getNextRecurrenceIdInEvent(guildScheduledEvent);
}
r46 = recurrenceId;
}
const rsvp = GuildScheduledEventStore.getRsvp(guildScheduledEvent.id, void 0, AuthenticationStore.getId());
const rsvp2 = GuildScheduledEventStore.getRsvp(guildScheduledEvent.id, r46, AuthenticationStore.getId());
if (r46 == null) {
updateRsvp(eventId, null, guildId, rsvp != null ? GuildScheduledEventUserResponses.UNINTERESTED : GuildScheduledEventUserResponses.INTERESTED);
if (onRsvp != null) {
onRsvp();
}
} else if (rsvp2 != null) {
updateRsvp(eventId, r46, guildId, rsvp != null ? GuildScheduledEventUserResponses.INTERESTED : GuildScheduledEventUserResponses.UNINTERESTED);
if (onRsvp != null) {
onRsvp();
}
} else {
openRsvpPicker(guildScheduledEvent, r46);
}
}
}
@@ -0,0 +1,396 @@
// Metro module 8210 (f8211).
import UserStore from "../../../stores/UserStore";
import { RecurrenceOptions } from "../CreateGuildScheduledEventConstants";
import { GuildScheduledEventEntityTypes, GuildScheduledEventStatus } from "../GuildScheduledEventsConstants";
import { Weekday, RRule } from "../../../_bundle/Module8212";
import { intl, t } from "../../../intl/index.native";
import Module3771 from "../../../_bundle/Module3771";
import { differenceInCalendarDays, dateFormat } from "../../../utils/DateUtils";
import SnowflakeUtils from "../../../utils/SnowflakeUtils";
import Durations from "../../../utils/Durations";
import { isEqual } from "../../../_bundle/Module12";
let c5218_7, c5218_8, c5218_9, c5218_10, c5218_11, c5218_12, c5218_13, c5218_14, getValidWeekdays, getValidWeekends;
const getRRule = function getRRule(a0) {
let byweekday = a0.byWeekday != null ? [...a0.byWeekday] : null;
const byNWeekday = a0.byNWeekday;
const r9 = byNWeekday == null ? void 0 : byNWeekday.map((item) => new Weekday(item.day, item.n));
const date = new Date(a0.start);
date.setMilliseconds(0);
const until = a0.end != null ? new Date(a0.end) : null;
if (byweekday == null) {
byweekday = r9;
}
return new RRule({
dtstart: date,
until,
freq: a0.frequency,
interval: a0.interval,
byweekday,
bymonth: a0.byMonth != null ? [...a0.byMonth] : null,
bymonthday: a0.byMonthDay != null ? [...a0.byMonthDay] : null,
byyearday: a0.byYearDay != null ? [...a0.byYearDay] : null,
count: a0.count
});
};
getValidWeekdays = function getValidWeekdays(a0) {
const weekday = new Weekday(c5218_13[a0.toDate().getDay()]);
const weekday2 = new Weekday(c5218_13[a0.toDate().getUTCDay()]);
return weekday2.weekday - weekday.weekday > 0 ? c5218_9 : weekday2.weekday - weekday.weekday < 0 ? c5218_8 : c5218_7;
};
getValidWeekends = function getValidWeekends(a0) {
const weekday = new Weekday(c5218_13[a0.toDate().getDay()]);
const weekday2 = new Weekday(c5218_13[a0.toDate().getUTCDay()]);
return weekday2.weekday - weekday.weekday > 0 ? c5218_12 : weekday2.weekday - weekday.weekday < 0 ? c5218_11 : c5218_10;
};
c5218_7 = [RRule.MO.weekday, RRule.TU.weekday, RRule.WE.weekday, RRule.TH.weekday, RRule.FR.weekday];
c5218_8 = [RRule.SU.weekday, RRule.MO.weekday, RRule.TU.weekday, RRule.WE.weekday, RRule.TH.weekday];
c5218_9 = [RRule.TU.weekday, RRule.WE.weekday, RRule.TH.weekday, RRule.FR.weekday, RRule.SA.weekday];
c5218_10 = [RRule.SA.weekday, RRule.SU.weekday];
c5218_11 = [RRule.FR.weekday, RRule.SA.weekday];
c5218_12 = [RRule.SU.weekday, RRule.MO.weekday];
c5218_13 = [RRule.SU.weekday, RRule.MO.weekday, RRule.TU.weekday, RRule.WE.weekday, RRule.TH.weekday, RRule.FR.weekday, RRule.SA.weekday];
c5218_14 = new Set([0, 6]);
export const MAX_DAYS_AHEAD_AN_EVENT_CAN_START = 365;
export const MAX_DAYS_AHEAD_AN_EVENT_CAN_END = 366;
export const MAX_YEARS_AHEAD_RECURRING_EVENT = 4;
export function getRecurrenceOptions(a0) {
const r11 = a0.toDate();
const nth = Math.ceil(r11.getDate() / 7);
const weekday = a0.format("dddd");
const r34 = [{
id: "none",
value: RecurrenceOptions.NONE,
label: intl.string(t["0bK0B1"])
}, {
id: "weekly",
value: RecurrenceOptions.WEEKLY,
label: intl.formatToPlainString(t["B8/yfp"], {
weekday
})
}, {
id: "biweekly",
value: RecurrenceOptions.BIWEEKLY,
label: intl.formatToPlainString(t["z+aIuX"], {
weekday
})
}, {
id: "monthly",
value: RecurrenceOptions.MONTHLY,
label: intl.formatToPlainString(t.mjOEBk, {
nth,
weekday
})
}, {
id: "yearly",
value: RecurrenceOptions.YEARLY,
label: intl.formatToPlainString(t["5DFcVl"], {
date: r11.toLocaleString(intl.currentLocale, {
month: "short",
day: "2-digit"
})
})
}, {
id: "daily",
value: RecurrenceOptions.DAILY,
label: intl.string(t.JX8E1E)
}];
if (c5218_14.has(r11.getDay())) {
const currentUser = UserStore.getCurrentUser();
if (currentUser == null ? void 0 : currentUser.isStaff()) {
r34.push({
id: "weekendOnly",
value: RecurrenceOptions.WEEKEND_ONLY,
label: intl.string(t.hRpynV)
});
}
} else {
r34.push({
id: "weekdayOnly",
value: RecurrenceOptions.WEEKDAY_ONLY,
label: intl.string(t["jYR/MY"])
});
}
return r34;
}
export function getInitialEventStartDate() {
const r12 = Module3771().add(1, "hour");
const r14 = r12.hour();
return r12.hour(r12.minutes() >= 30 ? r14 + 1 : r14).minutes(0).seconds(0);
}
export function getInitialEventEndDate(a0) {
const r20 = (a0 != null ? Module3771(a0) : Module3771()).add(1, "hour");
const r23 = r20.minutes() % 60;
return Module3771(r20).add(60 - r23, "minutes").seconds(0);
}
export function getNextBucketedTime(a0, a1) {
const r8 = a1 - a0.minutes() % a1;
return Module3771(a0).add(r8, "minutes").seconds(0);
}
export function getEventTimeData(a0, a1, a2) {
const r9 = a2 == null ? Module3771() : a2;
const r24 = Module3771(a0);
const r14 = a1 != null ? a1 !== "" ? Module3771(a1) : void 0 : void 0;
const r28 = a1 != null && r24.isSame(r14, "day");
const r36 = differenceInCalendarDays(r24.toDate(), r9.toDate());
return {
startDateTimeString: !(r36 > 1) && !(r36 < 0) ? dateFormat(r24, r24.localeData().calendar(r36 < 1 ? "sameDay" : "nextDay", r24, r9)) : dateFormat(r24, r24.get("years") === r9.get("years") ? "ddd MMM Do · LT" : "ddd MMM Do, YYYY · LT"),
endDateTimeString: r14 != null ? r28 ? r14.format("LT") : dateFormat(r14, r14.get("years") === r9.get("years") ? "ddd MMM Do · LT" : "ddd MMM Do, YYYY · LT") : void 0,
currentOrPastEvent: r24 <= r9,
upcomingEvent: r24 <= Module3771().add(1, "hour"),
withinStartWindow: r24 <= Module3771().add(15, "minute"),
diffMinutes: r24.diff(r9, "minutes")
};
}
export function convertJSDayToRRuleDay(a0) {
return new Weekday(c5218_13[a0]);
}
export function getBaseScheduleForRecurrence(a0, { scheduled_start_time, scheduled_end_time }) {
const r2 = scheduled_start_time != null;
let r11 = void 0;
if (r2) {
const r5 = {
startDate: Module3771(scheduled_start_time),
endDate: void 0
};
r11 = r5;
if (scheduled_end_time != null) {
r5.endDate = Module3771(scheduled_end_time);
r11 = r5;
}
}
const startDate = Module3771(SnowflakeUtils.extractTimestamp(a0));
return {
startDate,
endDate: r11?.endDate != null ? startDate.clone().add(r11.endDate.diff(r11.startDate)) : void 0
};
}
export function getScheduleForRecurrenceWithException(a0, a1) {
if (a1 == null) {
return a0;
}
let scheduled_end_time = a1.scheduled_end_time;
if (scheduled_end_time == null) {
scheduled_end_time = a0.endDate;
}
return {
startDate: a1.scheduled_start_time != null ? Module3771(a1.scheduled_start_time) : a0.startDate,
endDate: scheduled_end_time != null ? Module3771(scheduled_end_time) : void 0
};
}
export function getScheduleFromEventData({ scheduledStartTime, scheduledEndTime }) {
const r2 = scheduledStartTime != null;
let r10 = void 0;
if (r2) {
const r4 = {
startDate: Module3771(scheduledStartTime),
endDate: void 0
};
r10 = r4;
if (scheduledEndTime != null) {
r4.endDate = Module3771(scheduledEndTime);
r10 = r4;
}
}
return r10;
}
export function getScheduleFromEvent({ scheduled_start_time, scheduled_end_time }) {
const r2 = scheduled_start_time != null;
let r10 = void 0;
if (r2) {
const r4 = {
startDate: Module3771(scheduled_start_time),
endDate: void 0
};
r10 = r4;
if (scheduled_end_time != null) {
r4.endDate = Module3771(scheduled_end_time);
r10 = r4;
}
}
return r10;
}
export function hasValidSchedule({ startDate, endDate }, a1) {
let r2 = startDate != null;
if (r2) {
let r15 = !(startDate < Module3771());
if (r15) {
const r0 = endDate != null && endDate < startDate;
r15 = r0 ? !r0 : a1 !== GuildScheduledEventEntityTypes.EXTERNAL || endDate != null;
}
r2 = r15;
}
return r2;
}
export function areDatesIdentical(a0, a1) {
return a0 != null && a1 != null ? a0.isSame(a1) : a0 == null && a1 == null;
}
export function areSchedulesIdentical(a0, a1) {
let r9;
L20: {
if (a0 != null && a1 != null) {
const startDate2 = a0.startDate;
const startDate = a1.startDate;
r9 = startDate2 != null && startDate != null ? startDate2.isSame(startDate) : startDate2 == null && startDate == null;
if (!r9) {
break L20;
}
const endDate = a0.endDate;
const endDate2 = a1.endDate;
r9 = endDate != null && endDate2 != null ? endDate.isSame(endDate2) : endDate == null && endDate2 == null;
} else {
r9 = a0 == null && a1 == null;
}
}
return r9;
}
export { getRRule };
export function generateNextRecurrences(a0, a1, a2) {
let c16357_0 = a0;
let r2 = arguments[3];
if (r2 === void 0) {
r2 = false;
}
const r9 = a2 > new Date() ? a2 : new Date();
const date = new Date();
date.setFullYear(date.getFullYear() + 4);
const r34 = a1.between(r9, date, true, (a0, a1) => a1 < c16357_0 + 1);
return r2 && (r34.length > 0 && a2.getTime() === r34[0].getTime()) ? r34.slice(1) : r34.slice(0, a0);
}
export function getNextRecurrenceInEvent(a0) {
return a0.recurrence_rule != null ? new Date(a0.scheduled_start_time) : null;
}
export function getNextRecurrenceIdInEvent(a0) {
if (a0 == null) {
return null;
}
const r10 = a0.recurrence_rule == null ? null : new Date(a0.scheduled_start_time);
return r10 != null ? SnowflakeUtils.fromTimestamp(Math.floor(r10.getTime() / Durations.Millis.SECOND) * Durations.Millis.SECOND) : null;
}
export function isValidRecurrence(a0, a1) {
if (a1 != null && a0 != null) {
const date = new Date(a0.start);
const date2 = new Date(SnowflakeUtils.extractTimestamp(a1));
if (date.getUTCHours() === date2.getUTCHours() && date.getUTCMinutes() === date2.getUTCMinutes() && date.getUTCSeconds() === date2.getUTCSeconds()) {
const frequency = a0.frequency;
if (RRule.WEEKLY === frequency) {
return date.getUTCDay() === date2.getUTCDay();
}
if (RRule.YEARLY === frequency) {
return date.getUTCDate() === date2.getUTCDate();
}
return true;
}
return false;
}
return false;
}
export { getValidWeekdays };
export { getValidWeekends };
export function recurrenceOptionToRecurrenceRule(a0, a1) {
const validWeekdays = getValidWeekdays(a1);
const validWeekends = getValidWeekends(a1);
const weekday = new Weekday(c5218_13[a1.toDate().getUTCDay()]);
const r33 = Math.ceil(a1.toDate().getUTCDate() / 7);
const dtstart2 = a1.toDate();
dtstart2.setMilliseconds(0);
const r41 = RecurrenceOptions.NONE !== a0 ? RecurrenceOptions.WEEKLY === a0 ? new RRule({
dtstart: dtstart2,
freq: RRule.WEEKLY
}) : RecurrenceOptions.BIWEEKLY === a0 ? new RRule({
dtstart: dtstart2,
freq: RRule.WEEKLY,
interval: 2
}) : RecurrenceOptions.MONTHLY === a0 ? new RRule({
dtstart: dtstart2,
freq: RRule.MONTHLY,
byweekday: [weekday.nth(r33)]
}) : RecurrenceOptions.YEARLY === a0 ? new RRule({
dtstart: dtstart2,
freq: RRule.YEARLY
}) : RecurrenceOptions.DAILY === a0 ? new RRule({
dtstart: dtstart2,
freq: RRule.DAILY
}) : RecurrenceOptions.WEEKDAY_ONLY === a0 ? new RRule({
dtstart: dtstart2,
freq: RRule.DAILY,
byweekday: validWeekdays
}) : RecurrenceOptions.WEEKEND_ONLY === a0 ? new RRule({
dtstart: dtstart2,
freq: RRule.DAILY,
byweekday: validWeekends
}) : void 0 : null;
if (r41 == null) {
return null;
}
const options = r41.options;
const { dtstart, until, freq, interval, byweekday, bynweekday, bymonth, bymonthday, byyearday, count } = options;
const byNWeekday = bynweekday == null ? void 0 : bynweekday.map((item) => ({
n: item[1],
day: item[0]
}));
return {
start: dtstart.toISOString(),
end: until == null ? void 0 : until.toISOString(),
frequency: freq,
interval,
byWeekday: byweekday,
byNWeekday,
byMonth: bymonth,
byMonthDay: bymonthday,
byYearDay: byyearday,
count
};
}
export function recurrenceRuleToOption(a0, a1) {
let WEEKDAY_ONLY, WEEKLY;
if (a1 == null) {
return RecurrenceOptions.NONE;
}
const rRule = getRRule(a1);
const freq = rRule.options.freq;
if (RRule.WEEKLY === freq) {
L26: {
if (!(rRule.options.interval < 1) && !(rRule.options.interval > 2)) {
if (rRule.options.interval === 1) {
WEEKLY = RecurrenceOptions.WEEKLY;
break L26;
}
WEEKLY = RecurrenceOptions.BIWEEKLY;
} else {
WEEKLY = RecurrenceOptions.NONE;
}
}
return WEEKLY;
}
if (RRule.YEARLY === freq) {
return RecurrenceOptions.YEARLY;
}
if (RRule.MONTHLY === freq) {
return RecurrenceOptions.MONTHLY;
}
if (RRule.DAILY === freq) {
L16: {
if (rRule.options.byweekday != null && rRule.options.byweekday.length !== 0) {
if (isEqual(rRule.options.byweekday, getValidWeekdays(a0))) {
WEEKDAY_ONLY = RecurrenceOptions.WEEKDAY_ONLY;
break L16;
}
if (isEqual(rRule.options.byweekday, getValidWeekends(a0))) {
WEEKDAY_ONLY = RecurrenceOptions.WEEKEND_ONLY;
break L16;
}
WEEKDAY_ONLY = RecurrenceOptions.NONE;
} else {
WEEKDAY_ONLY = RecurrenceOptions.DAILY;
}
}
return WEEKDAY_ONLY;
}
return RecurrenceOptions.NONE;
}
export function hasScheduleChanges(a0, a1) {
return a0?.scheduled_start_time !== a1.scheduledStartTime || a0.scheduled_end_time !== a1.scheduledEndTime || !isEqual(a0.recurrence_rule, a1.recurrenceRule);
}
export function getRecurrenceStatus(a0, a1, a2) {
return a0?.is_canceled ? GuildScheduledEventStatus.CANCELED : a1 < a2 ? GuildScheduledEventStatus.COMPLETED : a0 != null ? GuildScheduledEventStatus.SCHEDULED : null;
}
@@ -0,0 +1,5 @@
// Metro module 8228 (f8229).
export const SHARE_EVENT_DETAILS_LINK = (a0) => `https://discord.com/events/${a0.guildId}/${a0.guildEventId}`;
export function canUseInviteModal(a0, a1, a2) {
return (a0 ? a1 : a0) && a2 != null;
}
@@ -0,0 +1,11 @@
// Metro module 12270 (f12271).
import { Endpoints } from "../../../Constants";
import { getBestMediaProxySize, getDevicePixelRatio } from "../../image_upload/ImageLoaderUtils";
export default function getGuildEventImageURL(a0, a1) {
if (a0.image == null) {
return null;
}
const bestMediaProxySize = getBestMediaProxySize(a1 == null ? window.screen.width * getDevicePixelRatio() : a1);
const CDN_HOST = window.GLOBAL_ENV.CDN_HOST;
return (CDN_HOST != null ? `https://${CDN_HOST}/guild-events/${a0.id}/${a0.image}` : location.protocol + window.GLOBAL_ENV.API_ENDPOINT + Endpoints.GUILD_EVENT_IMAGE(a0.id, a0.image, "png")) + `?size=${bestMediaProxySize}`;
};