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,20 @@
// Metro module 8211 (f8212).
const r9 = {
NONE: 0,
0: "NONE",
WEEKLY: 1,
1: "WEEKLY",
MONTHLY: 2,
2: "MONTHLY",
YEARLY: 3,
3: "YEARLY",
WEEKDAY_ONLY: 4,
4: "WEEKDAY_ONLY",
BIWEEKLY: 5,
5: "BIWEEKLY",
WEEKEND_ONLY: 6,
6: "WEEKEND_ONLY",
DAILY: 7,
7: "DAILY"
};
export { r9 as RecurrenceOptions };
@@ -0,0 +1,59 @@
// Metro module 15884 (f15885).
import { GuildScheduledEventStatus } from "./GuildScheduledEventsConstants";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let dismissedEventIds = {};
class EventBannerStore extends Module589.PersistedStore {
static displayName = "EventBannerStore";
static persistKey = "EventBanner";
initialize(a0) {
if (a0 != null) {
let dismissedEventIds2 = a0.dismissedEventIds;
if (dismissedEventIds2 == null) {
dismissedEventIds2 = {};
}
dismissedEventIds = dismissedEventIds2;
}
}
isEventDismissed(a0) {
return dismissedEventIds[a0] != null;
}
getState() {
return {
dismissedEventIds
};
}
}
const eventBannerStore = new EventBannerStore(Dispatcher, {
EVENT_BANNER_DISMISS: function handleDismiss({ eventId }) {
const r7 = {
...dismissedEventIds
};
r7[eventId] = true;
dismissedEventIds = r7;
},
GUILD_SCHEDULED_EVENT_UPDATE: function handleEventUpdate({ guildScheduledEvent }) {
if (guildScheduledEvent.status !== GuildScheduledEventStatus.CANCELED && guildScheduledEvent.status !== GuildScheduledEventStatus.COMPLETED) {
return false;
}
if (dismissedEventIds[guildScheduledEvent.id] == null) {
return false;
}
const r14 = {
...dismissedEventIds
};
delete r14[guildScheduledEvent.id];
dismissedEventIds = r14;
},
GUILD_SCHEDULED_EVENT_DELETE: function handleEventDelete({ guildScheduledEvent }) {
if (dismissedEventIds[guildScheduledEvent.id] == null) {
return false;
}
const r9 = {
...dismissedEventIds
};
delete r9[guildScheduledEvent.id];
dismissedEventIds = r9;
}
});
export default eventBannerStore;
@@ -0,0 +1,334 @@
// Metro module 8221 (f8222).
import SelectedGuildStore from "../../stores/SelectedGuildStore";
import GuildScheduledEventStore from "./GuildScheduledEventStore";
import GuildScheduledEventsActionCreators from "./GuildScheduledEventsActionCreators";
import AutomaticLifecycleManager from "../../lib/AutomaticLifecycleManager";
function $mk115269() {
return (a0) => setTimeout(a0, 200 * Math.random() + 50);
}
let c5226_5, c5226_6, c5226_7, c5226_8;
const getGuildEventsForCurrentUser2 = async function getGuildEventsForCurrentUser(c26150_0) {
let c26150_4 = 0;
let c29922_0;
L15: {
L14: {
try {
c29922_0 = c26150_0;
if (GuildScheduledEventStore.getGuildScheduledEventsForGuild(c26150_0).length === 0) {
break L15;
}
if (c5226_6.has(c26150_0)) {
break L15;
}
if (c5226_7.has(c26150_0)) {
break L15;
}
c26150_4 = 1;
c5226_6.add(c26150_0);
await GuildScheduledEventsActionCreators.getGuildEventsForCurrentUser(c26150_0);
c5226_7.add(c29922_0);
c26150_4 = 0;
} catch ($e) {
let r8 = $e;
if (c26150_4 !== 0) {
while (true) {
try {
c26150_4 = 0;
c5226_6.delete(c29922_0);
break L14;
} catch ($e) {
r8 = $e;
if (c26150_4 === 0) {
break;
}
}
}
}
throw r8;
}
}
return void 0;
}
};
c5226_5 = {};
c5226_6 = new Set();
c5226_7 = new Set();
c5226_8 = 1800000;
class GuildScheduledEventManager extends AutomaticLifecycleManager {
actions = {
POST_CONNECTION_OPEN: () => this.handleConnectionOpen(),
GUILD_DELETE: (a0) => this.handleGuildDelete(a0),
GUILD_UNAVAILABLE: (a0) => this.handleGuildUnavailable(a0),
INVITE_RESOLVE_SUCCESS: (a0) => this.handleInviteResolveSuccess(a0),
CHANNEL_SELECT: (a0) => this.handleChannelSelect(a0)
};
async getGuildEventUserCounts(c16376_0, c16376_1, c16376_2) {
let c26151_2;
let c26151_3 = 0;
L14: {
L10: {
try {
const r21 = c16376_2.filter((item) => c5226_5[`${c16376_0}-${c16376_1}-${item}`] == null || Date.now() - c5226_5[`${c16376_0}-${c16376_1}-${item}`] > c5226_8);
const r37 = Date.now();
if (r37 - c5226_5[`${c16376_0}-${c16376_1}`] < c5226_8 && r21.length === 0) {
break L10;
}
c5226_5[`${c16376_0}-${c16376_1}`] = Date.now();
r21.forEach((item) => {
const r16 = `${c16376_0}-${c16376_1}-${item}`;
const r18 = Date.now();
c5226_5[r16] = r18;
return r18;
});
c26151_3 = 1;
await GuildScheduledEventsActionCreators.fetchGuildEventUserCounts(c16376_0, c16376_1, r21);
c26151_3 = 0;
break L14;
} catch ($e) {
const r32 = $e;
let r8 = r32;
c26151_2 = r32;
if (c26151_3 !== 0) {
while (true) {
try {
c26151_3 = 0;
break L14;
} catch (r85) {
r8 = r85;
c26151_2 = r85;
if (c26151_3 === 0) {
break;
}
}
}
}
throw r8;
}
}
return void 0;
}
}
getGuildEventUsers(a0, a1, a2) {
return GuildScheduledEventsActionCreators.fetchUsersForGuildEvent(a0, a1, a2);
}
getGuildEventsForCurrentUser(a0) {
return getGuildEventsForCurrentUser2(a0);
}
async handleConnectionOpen() {
let r33;
const _this = this;
let c26152_0, guildScheduledEventsForGuild, c26152_2, c26152_3, c26152_4;
let c26152_5 = 0;
const r13 = void 0;
L20: {
L19: {
try {
let env29923;
c26152_3 = r13;
const r45 = env29923 = {};
c26152_2 = r45;
env29923[0] = void 0;
env29923[1] = void 0;
c5226_6.clear();
c5226_7.clear();
c5226_5 = {};
const lastSelectedGuildId = SelectedGuildStore.getLastSelectedGuildId();
env29923[0] = lastSelectedGuildId;
if (lastSelectedGuildId == null) {
break L20;
}
const guildScheduledEventsForGuild3 = GuildScheduledEventStore.getGuildScheduledEventsForGuild(lastSelectedGuildId);
guildScheduledEventsForGuild = guildScheduledEventsForGuild3;
const r59 = guildScheduledEventsForGuild3[Symbol.iterator]();
guildScheduledEventsForGuild = r59.next;
c26152_0 = r59;
const r61 = guildScheduledEventsForGuild;
let r62 = c26152_0;
const r63 = r62 === void 0 ? void 0 : (r33 = r61.call(r62)).done ? r62 = void 0 : r33.value;
c26152_0 = r62;
if (r62 === void 0) {
break L20;
}
c26152_5 = 1;
env29923[1] = r63;
await _this.getGuildEventUserCounts(env29923[0], env29923[1].id, []);
while (true) {
await new Promise((resolve) => setTimeout(resolve, 200 * Math.random() + 50));
c26152_5 = 0;
const r111 = guildScheduledEventsForGuild;
let r112 = c26152_0;
const r113 = r112 === void 0 ? void 0 : (r33 = r111.call(r112)).done ? r112 = void 0 : r33.value;
c26152_0 = r112;
if (r112 === void 0) {
break L19;
}
c26152_5 = 1;
env29923[1] = r113;
await _this.getGuildEventUserCounts(env29923[0], env29923[1].id, []);
}
break L20;
} catch ($e) {
const r43 = $e;
let r8 = r43;
c26152_4 = r43;
if (c26152_5 !== 0) {
while (true) {
try {
const r147 = c26152_4;
c26152_5 = 0;
const r149 = c26152_0;
if (r149 !== void 0 && typeof r149.return === "function") {
try {
r149.return();
} catch {}
}
throw r147;
} catch (r145) {
r8 = r145;
c26152_4 = r145;
if (c26152_5 === 0) {
break;
}
}
}
}
throw r8;
}
}
return void 0;
}
}
handleGuildUnavailable({ guildId: guildId2 }) {
c5226_6.delete(guildId2);
c5226_7.delete(guildId2);
delete c5226_5[guildId2];
}
handleGuildDelete(a0) {
const id = a0.guild.id;
c5226_6.delete(id);
c5226_7.delete(id);
delete c5226_5[id];
}
handleInviteResolveSuccess({ invite }) {
const guild_scheduled_event = invite.guild_scheduled_event;
const id = invite.guild?.id;
if (guild_scheduled_event != null && id != null) {
getGuildEventsForCurrentUser2(id);
}
}
async handleChannelSelect({ guildId }) {
let r35;
const _this2 = this;
let c26153_0, guildScheduledEventsForGuild2, value, c26153_3, c26153_4, c26153_5, c26153_7;
let c26153_6 = 0;
const r14 = void 0;
L25: {
L24: {
L21: {
try {
let env29924;
c26153_5 = r14;
const r51 = env29924 = {};
c26153_4 = r51;
env29924[0] = void 0;
if (guildId == null) {
break L25;
}
const guildScheduledEventsForGuild3 = GuildScheduledEventStore.getGuildScheduledEventsForGuild(guildId);
guildScheduledEventsForGuild2 = guildScheduledEventsForGuild3;
const r58 = guildScheduledEventsForGuild3[Symbol.iterator]();
guildScheduledEventsForGuild2 = r58.next;
c26153_0 = r58;
const r60 = guildScheduledEventsForGuild2;
let r61 = c26153_0;
const r62 = r61 === void 0 ? void 0 : (r35 = r60.call(r61)).done ? r61 = void 0 : r35.value;
c26153_0 = r61;
if (r61 === void 0) {
break L25;
}
env29924[0] = r62;
c26153_6 = 2;
let r75 = await _this2.getGuildEventUserCounts(guildId, env29924[0].id, []);
let r76 = 0;
while (true) {
value = r75;
if (r76 === 2) {
c26153_6 = 1;
await new Promise($mk115269());
c26153_6 = 0;
const r171 = c26153_0;
if (r171 !== void 0 && typeof r171.return === "function") {
r171.return();
}
break L24;
}
c26153_6 = 1;
await new Promise($mk115269());
c26153_6 = 0;
const r120 = guildScheduledEventsForGuild2;
let r121 = c26153_0;
const r122 = r121 === void 0 ? void 0 : (r35 = r120.call(r121)).done ? r121 = void 0 : r35.value;
c26153_0 = r121;
if (r121 === void 0) {
break L21;
}
env29924[0] = r122;
c26153_6 = 2;
r75 = await _this2.getGuildEventUserCounts(guildId, env29924[0].id, []);
r76 = 0;
}
break L25;
} catch ($e) {
const r49 = $e;
let r8 = r49;
c26153_7 = r49;
let r50 = c26153_6;
if (r50 !== 0) {
while (true) {
if (r50 === 1) {
try {
const r210 = c26153_7;
c26153_6 = 0;
const r212 = c26153_0;
if (r212 !== void 0 && typeof r212.return === "function") {
try {
r212.return();
} catch {}
}
throw r210;
} catch (r209) {
r8 = r209;
c26153_7 = r209;
r50 = c26153_6;
if (r50 === 0) {
break;
}
}
} else {
try {
c26153_3 = c26153_7;
c26153_6 = 1;
await new Promise($mk115269());
throw c26153_3;
} catch (r177) {
r8 = r177;
c26153_7 = r177;
r50 = c26153_6;
if (r50 === 0) {
break;
}
}
}
}
}
throw r8;
}
}
return void 0;
}
return value;
}
}
}
const guildScheduledEventManager = new GuildScheduledEventManager();
export default guildScheduledEventManager;
@@ -0,0 +1,40 @@
// Metro module 8217 (f8218).
import { EXPLICIT_END_EVENT_SHEET_KEY } from "./GuildScheduledEventsConstants";
import { GUILD_EVENT_INFO_ACTION_SHEET_KEY } from "./native/GuildEventModalConstants";
import ActionSheetActionCreators from "../action_sheet/native/ActionSheetActionCreators";
import { getNextRecurrenceIdInEvent } from "./utils/ScheduleUtils";
const openGuildEventDetails = function openGuildEventDetails(a0) {
const { eventId, event, onClose } = a0;
let recurrenceId = a0.recurrenceId;
const r23 = import("./native/components/GuildScheduledEventDetailsActionSheet");
if (recurrenceId == null) {
recurrenceId = getNextRecurrenceIdInEvent(event);
}
if (recurrenceId == null) {
recurrenceId = void 0;
}
ActionSheetActionCreators.openLazy(r23, GUILD_EVENT_INFO_ACTION_SHEET_KEY, {
eventId,
event,
onCloseActionSheet: onClose,
recurrenceId
}, "stack");
};
export { openGuildEventDetails };
export async function transitionToEventDetailsFromInvite(c26149_0, c26149_1) {
let c26149_3;
c26149_3 = void 0;
let c29921_0 = c26149_0;
let c29921_1 = c26149_1;
await Promise.resolve();
openGuildEventDetails({
eventId: c29921_0.id,
event: c29921_0,
recurrenceId: c29921_1?.recurrenceId
});
}
export function openEndEventModal(a0) {
ActionSheetActionCreators.openLazy(import("./native/components/EndEventActionSheet"), EXPLICIT_END_EVENT_SHEET_KEY, {
channel: a0
});
}
@@ -0,0 +1,515 @@
// Metro module 5779 (f5780).
import AuthenticationStore from "../../stores/AuthenticationStore";
import GuildMemberStore from "../../stores/GuildMemberStore";
import { GuildScheduledEventStatus, GuildScheduledEventUserResponses, GuildScheduledEventStatusDone } from "./GuildScheduledEventsConstants";
import { SecondaryIndexMap } from "../../_bundle/Module3813";
import Module12 from "../../_bundle/Module12";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
function $mk76980($env) {
return ({ id }) => {
const r1 = $env[0];
const r8 = $env.$parent;
r8[8].delete(id);
delete r8[12][id];
if (r1) {
delete r8[13][id];
}
r8[9] = r8[9] + 1;
};
}
let saveEvent, addGuildEventUser, removeGuildEventUser, c3595_7, c3595_8, c3595_10, c3595_11, c3595_17;
let env3595 = {};
export function scheduledEventSort(a0) {
const id = a0.id;
return `${a0 != null && a0?.status === GuildScheduledEventStatus.ACTIVE ? "\x00" : "\x01"}-${new Date(a0.scheduled_start_time).getTime()}-${id}`;
}
saveEvent = function saveEvent(a0) {
c3595_8.set(a0.id, a0);
env3595[9] = env3595[9] + 1;
};
addGuildEventUser = function addGuildEventUser(a0, r2 = true, r3 = true) {
let r0;
const guild_scheduled_event_id = a0.guild_scheduled_event_id;
if (env3595[12][guild_scheduled_event_id] == null) {
env3595[12][guild_scheduled_event_id] = {};
}
let guild_scheduled_event_exception_id = a0.guild_scheduled_event_exception_id;
if (guild_scheduled_event_exception_id == null) {
guild_scheduled_event_exception_id = c3595_11;
}
if (env3595[12][guild_scheduled_event_id][guild_scheduled_event_exception_id] == null) {
env3595[12][guild_scheduled_event_id][guild_scheduled_event_exception_id] = {};
}
env3595[12][guild_scheduled_event_id][guild_scheduled_event_exception_id][a0.user_id] = a0;
if (r2) {
let guild_scheduled_event_exception_id2 = a0.guild_scheduled_event_exception_id;
if (guild_scheduled_event_exception_id2 == null) {
guild_scheduled_event_exception_id2 = c3595_11;
}
const r27 = env3595[13][a0.guild_scheduled_event_id];
let r29 = r27 == null ? void 0 : r27[guild_scheduled_event_exception_id2];
if (r29 == null) {
r29 = 0;
}
L22: {
if (!(a0.guild_scheduled_event_exception_id != null && a0.response === GuildScheduledEventUserResponses.UNINTERESTED)) {
const r35 = a0.guild_scheduled_event_exception_id == null;
r0 = -1;
if (!r35) {
break L22;
}
r0 = a0.response === GuildScheduledEventUserResponses.INTERESTED ? 1 : -1;
} else {
r0 = 1;
}
}
const guild_scheduled_event_id2 = a0.guild_scheduled_event_id;
let guild_scheduled_event_exception_id3 = a0.guild_scheduled_event_exception_id;
const r41 = r29 + r0;
if (guild_scheduled_event_exception_id3 == null) {
guild_scheduled_event_exception_id3 = c3595_11;
}
if (env3595[13][guild_scheduled_event_id2] == null) {
env3595[13][guild_scheduled_event_id2] = {};
}
env3595[13][guild_scheduled_event_id2][guild_scheduled_event_exception_id3] = r41;
}
if (r3) {
env3595[9] = env3595[9] + 1;
}
};
removeGuildEventUser = function removeGuildEventUser(a0, r3 = true) {
let r0;
let guild_scheduled_event_exception_id = a0.guild_scheduled_event_exception_id;
if (guild_scheduled_event_exception_id == null) {
guild_scheduled_event_exception_id = c3595_11;
}
const r13 = env3595[12][a0.guild_scheduled_event_id];
const r2 = r13 == null;
let r14 = void 0;
if (!r2) {
const r12 = r13[guild_scheduled_event_exception_id];
r14 = r12 == null ? void 0 : r12[a0.user_id];
}
const r6 = r14 != null;
const user_id = a0.user_id;
const id = AuthenticationStore.getId();
if (!(r6 ? !r6 : user_id === id)) {
const r24 = env3595[12][a0.guild_scheduled_event_id];
if (r24 != null) {
const r25 = r24[guild_scheduled_event_exception_id];
if (r25 != null) {
delete r25[a0.user_id];
}
}
let guild_scheduled_event_exception_id2 = a0.guild_scheduled_event_exception_id;
if (guild_scheduled_event_exception_id2 == null) {
guild_scheduled_event_exception_id2 = c3595_11;
}
const r31 = env3595[13][a0.guild_scheduled_event_id];
let r33 = r31 == null ? void 0 : r31[guild_scheduled_event_exception_id2];
if (r33 == null) {
r33 = 0;
}
L24: {
if (!(a0.guild_scheduled_event_exception_id != null && a0.response === GuildScheduledEventUserResponses.UNINTERESTED)) {
const r39 = a0.guild_scheduled_event_exception_id == null;
r0 = 1;
if (!r39) {
break L24;
}
r0 = a0.response === GuildScheduledEventUserResponses.INTERESTED ? -1 : 1;
} else {
r0 = -1;
}
}
const guild_scheduled_event_id = a0.guild_scheduled_event_id;
let guild_scheduled_event_exception_id3 = a0.guild_scheduled_event_exception_id;
const r45 = r33 + r0;
if (guild_scheduled_event_exception_id3 == null) {
guild_scheduled_event_exception_id3 = c3595_11;
}
if (env3595[13][guild_scheduled_event_id] == null) {
env3595[13][guild_scheduled_event_id] = {};
}
env3595[13][guild_scheduled_event_id][guild_scheduled_event_exception_id3] = r45;
if (r3) {
env3595[9] = env3595[9] + 1;
}
}
};
const handleGuildScheduledEventUpdateOrCreate = function handleGuildScheduledEventUpdateOrCreate({ guildScheduledEvent }) {
c3595_8.set(guildScheduledEvent.id, guildScheduledEvent);
env3595[9] = env3595[9] + 1;
return true;
};
const handleGuildScheduledEventExceptionCreateOrUpdate = function handleGuildScheduledEventExceptionCreateOrUpdate({ eventException }) {
const r14 = c3595_8.get(eventException.event_id);
if (r14 == null) {
return false;
}
const r17 = r14.guild_scheduled_event_exceptions.findIndex((guild_scheduled_event_exception) => guild_scheduled_event_exception.event_exception_id === eventException.event_exception_id);
const guild_scheduled_event_exceptions = [...r14.guild_scheduled_event_exceptions];
if (r17 < 0) {
guild_scheduled_event_exceptions.push(eventException);
} else {
guild_scheduled_event_exceptions[r17] = eventException;
}
const r21 = {
...r14,
guild_scheduled_event_exceptions
};
c3595_8.set(r21.id, r21);
env3595[9] = env3595[9] + 1;
return true;
};
c3595_7 = {
EVENT: "event",
EVENT_ACTIVE: "active",
EVENT_UPCOMING: "event-upcoming",
GUILD_EVENT: (a0) => `${a0}-${c3595_7.EVENT}`,
GUILD_EVENT_ACTIVE: (a0) => `${a0}-${c3595_7.EVENT_ACTIVE}`,
GUILD_EVENT_UPCOMING: (a0) => `${a0}-${c3595_7.EVENT_UPCOMING}`,
CHANNEL_EVENT: (a0) => `${a0}-${c3595_7.EVENT}`,
CHANNEL_EVENT_ACTIVE: (a0) => `${a0}-${c3595_7.EVENT_ACTIVE}`,
CHANNEL_EVENT_UPCOMING: (a0) => `${a0}-${c3595_7.EVENT_UPCOMING}`
};
c3595_8 = new SecondaryIndexMap(function scheduledEventIndex(a0) {
const { guild_id, entity_id, channel_id } = a0;
const r3 = [guild_id];
if (entity_id != null) {
r3.push(entity_id);
}
r3.push(c3595_7.GUILD_EVENT(guild_id));
if (channel_id != null) {
r3.push(c3595_7.CHANNEL_EVENT(channel_id));
}
if (a0 != null && a0?.status === GuildScheduledEventStatus.ACTIVE) {
r3.push(c3595_7.EVENT_ACTIVE);
r3.push(c3595_7.GUILD_EVENT_ACTIVE(guild_id));
if (channel_id != null) {
r3.push(c3595_7.CHANNEL_EVENT_ACTIVE(channel_id));
}
}
if (!GuildScheduledEventStatusDone.has(a0.status)) {
r3.push(c3595_7.EVENT_UPCOMING);
r3.push(c3595_7.GUILD_EVENT_UPCOMING(guild_id));
if (channel_id != null) {
r3.push(c3595_7.CHANNEL_EVENT_UPCOMING(channel_id));
}
}
return r3;
}, scheduledEventSort);
env3595[9] = 0;
c3595_10 = [];
c3595_11 = "SERIES";
env3595[12] = {};
env3595[13] = {};
class GuildScheduledEventStore extends Module589.Store {
static displayName = "GuildScheduledEventStore";
constructor() {
super(...arguments);
}
initialize() {
this.waitFor(AuthenticationStore, GuildMemberStore);
}
getGuildScheduledEvent(a0) {
const r1 = a0 == null;
let r2 = null;
if (!r1) {
let r7 = c3595_8.get(a0);
if (r7 == null) {
r7 = null;
}
r2 = r7;
}
return r2;
}
getGuildEventCountByIndex(a0) {
return c3595_8.size(a0);
}
getGuildScheduledEventsForGuild(a0) {
return a0 == null ? [] : c3595_8.values(a0);
}
getGuildScheduledEventsByIndex(a0) {
return c3595_8.values(a0);
}
getRsvpVersion() {
return env3595[9];
}
getRsvp(a0, a1, a2) {
if (a0 == null) {
return null;
}
const r5 = a1 == null ? c3595_11 : a1;
const r7 = env3595[12][a0];
const r2 = r7 == null;
let r8 = void 0;
if (!r2) {
const r9 = r7[r5];
r8 = r9 == null ? void 0 : r9[a2];
}
return r8;
}
isInterestedInEventRecurrence(a0, a1) {
const id = AuthenticationStore.getId();
const rsvp = this.getRsvp(a0, null, id);
const rsvp2 = this.getRsvp(a0, a1, id);
const response = rsvp?.response;
const INTERESTED = GuildScheduledEventUserResponses.INTERESTED;
const response2 = rsvp2?.response;
const INTERESTED2 = GuildScheduledEventUserResponses.INTERESTED;
const response3 = rsvp2?.response;
let r21 = response === INTERESTED;
const UNINTERESTED = GuildScheduledEventUserResponses.UNINTERESTED;
if (r21) {
r21 = !(response3 === UNINTERESTED);
}
if (!r21) {
r21 = response2 === INTERESTED2;
}
return r21;
}
getUserCount(a0, a1) {
if (a0 == null) {
return 0;
}
const r7 = env3595[13][a0];
let r4 = r7 == null ? void 0 : r7[c3595_11];
if (r4 == null) {
r4 = 0;
}
let r11 = r4;
if (a1 != null) {
const r13 = env3595[13][a0];
let r5 = r13 == null ? void 0 : r13[a1];
if (r5 == null) {
r5 = 0;
}
r11 = r4 - r5;
}
return r11;
}
hasUserCount(a0, a1) {
const r4 = a1 == null ? c3595_11 : a1;
const r6 = env3595[13][a0];
return (r6 == null ? void 0 : r6[r4]) != null;
}
isActive(a0) {
let r0 = a0 != null;
if (r0) {
const r7 = c3595_8.get(a0);
r0 = r7 != null && r7?.status === GuildScheduledEventStatus.ACTIVE;
}
return r0;
}
getActiveEventByChannel(a0) {
if (a0 != null) {
return this.getGuildScheduledEventsByIndex(c3595_7.CHANNEL_EVENT_ACTIVE(a0))[0];
}
}
getUsersForGuildEvent(a0, a1) {
if (a0 == null) {
return {};
}
const r4 = a1 == null ? c3595_11 : a1;
const r6 = env3595[12][a0];
let r7 = r6 == null ? void 0 : r6[r4];
if (r7 == null) {
r7 = {};
}
return r7;
}
}
c3595_17 = GuildScheduledEventStore;
const r102 = new GuildScheduledEventStore(Dispatcher, {
CONNECTION_OPEN: function handleConnectionOpen({ guilds }) {
c3595_8.clear();
env3595[9] = 0;
env3595[12] = {};
env3595[13] = {};
c3595_10.forEach(saveEvent);
guilds.forEach((guild) => guild.guild_scheduled_events.forEach((guild_scheduled_event) => {
c3595_8.set(guild_scheduled_event.id, guild_scheduled_event);
env3595[9] = env3595[9] + 1;
}));
return true;
},
GUILD_CREATE: function handleGuildCreate({ guild }) {
let env15147;
const id = guild.id;
const r3 = env15147 = {
$parent: env3595
};
env15147[0] = false;
c3595_8.values(c3595_7.GUILD_EVENT(id)).forEach($mk76980(r3));
guild.guild_scheduled_events.forEach((guild_scheduled_event) => {
c3595_8.set(guild_scheduled_event.id, guild_scheduled_event);
env3595[9] = env3595[9] + 1;
});
return true;
},
GUILD_DELETE: function handleGuildDelete(a0) {
let env15148;
const id = a0.guild.id;
const r8 = env15148 = {
$parent: env3595
};
env15148[0] = true;
c3595_8.values(c3595_7.GUILD_EVENT(id)).forEach($mk76980(r8));
return true;
},
FETCH_GUILD_EVENT: function handleFetchGuildEvent({ guildScheduledEvent }) {
c3595_8.set(guildScheduledEvent.id, guildScheduledEvent);
env3595[9] = env3595[9] + 1;
},
FETCH_GUILD_EVENTS_FOR_GUILD: function handleFetchGuildEventsForGuild({ guildId, guildScheduledEvents }) {
Module12.difference(c3595_8.values(c3595_7.GUILD_EVENT(guildId), true).map((item) => item.id), guildScheduledEvents.map((guildScheduledEvent) => guildScheduledEvent.id)).forEach((item) => {
c3595_8.delete(item);
delete env3595[12][item];
delete env3595[13][item];
env3595[9] = env3595[9] + 1;
});
for (const item of guildScheduledEvents) {
saveEvent(item);
}
return true;
},
GUILD_SCHEDULED_EVENT_CREATE: handleGuildScheduledEventUpdateOrCreate,
GUILD_SCHEDULED_EVENT_UPDATE: handleGuildScheduledEventUpdateOrCreate,
GUILD_SCHEDULED_EVENT_DELETE: function handleGuildScheduledEventDelete(a0) {
const id = a0.guildScheduledEvent.id;
c3595_8.delete(id);
delete env3595[12][id];
delete env3595[13][id];
env3595[9] = env3595[9] + 1;
return true;
},
GUILD_SCHEDULED_EVENT_USER_ADD: function handleRsvpCreate({ userId, guildEventId, guildId, guildEventExceptionId, response }) {
let r12 = guildEventExceptionId;
if (r12 == null) {
r12 = c3595_11;
}
const r14 = env3595[12][guildEventId];
const r2 = r14 == null;
let r5 = void 0;
if (!r2) {
const r15 = r14[r12];
r5 = r15 == null ? void 0 : r15[userId];
}
if (r5 != null) {
removeGuildEventUser(r5, false);
}
let member = GuildMemberStore.getMember(guildId, userId);
if (member == null) {
member = void 0;
}
addGuildEventUser({
user_id: userId,
guild_scheduled_event_id: guildEventId,
member,
guild_scheduled_event_exception_id: guildEventExceptionId,
response
});
return true;
},
GUILD_SCHEDULED_EVENT_USER_REMOVE: function handleRsvpDelete(a0) {
removeGuildEventUser({
user_id: a0.userId,
guild_scheduled_event_id: a0.guildEventId,
guild_scheduled_event_exception_id: a0.guildEventExceptionId,
response: a0.response
});
},
GUILD_SCHEDULED_EVENT_RSVPS_FETCH_SUCESS: function handleFetchGuildEventsForUser(a0) {
a0.guildScheduledEventUsers.forEach((guildScheduledEventUser) => {
addGuildEventUser(guildScheduledEventUser, false, false);
});
env3595[9] = env3595[9] + 1;
return true;
},
GUILD_SCHEDULED_EVENT_USERS_FETCH_SUCCESS: function handleFetchUsersForGuildEventSuccess(a0) {
a0.guildScheduledEventUsers.forEach((guildScheduledEventUser) => {
addGuildEventUser(guildScheduledEventUser, false, false);
});
env3595[9] = env3595[9] + 1;
return true;
},
GUILD_SCHEDULED_EVENT_USER_COUNTS_FETCH_SUCCESS: function handleEventUserCountsFetchSuccess({ eventId, counts }) {
const eventCount = counts.eventCount;
if (env3595[13][eventId] == null) {
env3595[13][eventId] = {};
}
env3595[13][eventId][c3595_11] = eventCount;
SnowflakeUtils.forEachKey(counts.recurrenceCounts, (a0) => {
let r3 = a0;
const r10 = counts.eventCount - counts.recurrenceCounts[a0];
if (a0 == null) {
r3 = c3595_11;
}
if (env3595[13][eventId] == null) {
env3595[13][eventId] = {};
}
env3595[13][eventId][r3] = r10;
});
},
INVITE_RESOLVE_SUCCESS: function handleInviteResolveSuccess(a0) {
const guild_scheduled_event = a0.invite.guild_scheduled_event;
let r9 = guild_scheduled_event != null;
if (r9) {
c3595_8.set(guild_scheduled_event.id, guild_scheduled_event);
env3595[9] = env3595[9] + 1;
r9 = true;
}
return r9;
},
GUILD_SCHEDULED_EVENT_EXCEPTION_CREATE: handleGuildScheduledEventExceptionCreateOrUpdate,
GUILD_SCHEDULED_EVENT_EXCEPTION_UPDATE: handleGuildScheduledEventExceptionCreateOrUpdate,
GUILD_SCHEDULED_EVENT_EXCEPTION_DELETE: function handleGuildScheduledEventExceptionDelete({ eventException: eventException2 }) {
const r12 = c3595_8.get(eventException2.event_id);
if (r12 == null) {
return false;
}
const r16 = {
...r12,
guild_scheduled_event_exceptions: r12.guild_scheduled_event_exceptions.filter((guild_scheduled_event_exception) => guild_scheduled_event_exception.event_exception_id !== eventException2.event_exception_id)
};
c3595_8.set(r16.id, r16);
env3595[9] = env3595[9] + 1;
return true;
},
GUILD_SCHEDULED_EVENT_EXCEPTIONS_DELETE: function handleGuildScheduledEventExceptionsDelete({ eventId: eventId2 }) {
const r11 = c3595_8.get(eventId2);
let r12 = r11 != null;
if (r12) {
const r6 = {
...r11,
guild_scheduled_event_exceptions: []
};
c3595_8.set(r6.id, r6);
env3595[9] = env3595[9] + 1;
r12 = true;
}
return r12;
},
LOGOUT: function handleLogout() {
c3595_8.clear();
return true;
}
});
export default r102;
export { c3595_7 as StaticGuildEventIndexes };
export function isGuildScheduledEventActive(a0) {
return a0 != null && a0?.status === GuildScheduledEventStatus.ACTIVE;
}
export function isEventUpcoming(a0) {
return !GuildScheduledEventStatusDone.has(a0.status);
}
export function eventScheduledToStartWithin(a0, a1) {
return new Date(a0.scheduled_start_time).getTime() < Date.now() + 1000 * a1;
}
export function isGuildEventEnded(a0) {
return a0 != null && GuildScheduledEventStatusDone.has(a0.status);
}
@@ -0,0 +1,40 @@
// Metro module 8323 (f8324).
import { ACKED_RECENTLY_WINDOW_DAYS, EVENT_STARTING_SOON_WINDOW_MILLISECONDS, NEW_EVENT_WINDOW_MILLISECONDS, UpcomingGuildEventNoticeTypes } from "./GuildScheduledEventsConstants";
import Module3771 from "../../_bundle/Module3771";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
export function getNextShownUpcomingEventNoticeType(a0, a1, a2, a3) {
let r57;
const r12 = Module3771();
const time = new Date(a0.scheduled_start_time).getTime();
const r24 = time - EVENT_STARTING_SOON_WINDOW_MILLISECONDS;
if (r12.isBetween(r24, time)) {
if (a1 != null) {
L14: {
const r45 = Module3771(a1);
const isBetween = r45.isBetween(r24, time);
const isBetween2 = r45.isBetween(Module3771(time).subtract(ACKED_RECENTLY_WINDOW_DAYS, "days"), time);
r57 = void 0;
if (!isBetween) {
if (isBetween2) {
r57 = void 0;
if (!a3) {
break L14;
}
}
r57 = UpcomingGuildEventNoticeTypes.EVENT_STARTING_SOON;
}
}
return r57;
}
return UpcomingGuildEventNoticeTypes.EVENT_STARTING_SOON;
}
let r14 = a2;
const r30 = SnowflakeUtils.extractTimestamp(a0.id);
const r31 = Math;
if (a2 == null) {
r14 = r30;
}
if (r12.isBetween(r30, r31.min(r14 + NEW_EVENT_WINDOW_MILLISECONDS, time)) && a1 == null && !a3) {
return UpcomingGuildEventNoticeTypes.NEW_EVENT;
}
}
@@ -0,0 +1,412 @@
// Metro module 8208 (f8209).
import AuthenticationStore from "../../stores/AuthenticationStore";
import GuildScheduledEventStore from "./GuildScheduledEventStore";
import { ENTITY_TYPES_REQUIRED_CHANNEL_ID, ENTITY_TYPES_REQUIRED_ENTITY_METADATA, GuildScheduledEventStatus, MAX_RSVP_USER_DISPLAY_COUNT } from "./GuildScheduledEventsConstants";
import { Endpoints, Routes } from "../../Constants";
import { HTTP, rejectWithMigratedError } from "../../_bundle/sendRequest";
import SelectedChannelActionCreators from "../../actions/SelectedChannelActionCreators";
import { transitionTo } from "../routing/router_utils";
import { recurrenceRuleToServer } from "./utils/EditGuildEventUtils";
import { httpGetWithCountryCodeQuery } from "../../utils/StoreUtils";
import Dispatcher from "../../Dispatcher";
import { getExistingRsvp } from "./utils/GuildEventRsvpUtils";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
const r29 = {
startEvent: (a0, a1) => HTTP.patch({
url: Endpoints.GUILD_EVENT(a1, a0),
body: {
status: GuildScheduledEventStatus.ACTIVE
},
rejectWithError: rejectWithMigratedError()
}),
endEvent: (a0, a1) => HTTP.patch({
url: Endpoints.GUILD_EVENT(a1, a0),
body: {
status: GuildScheduledEventStatus.COMPLETED
},
rejectWithError: rejectWithMigratedError()
}),
joinVoiceEvent: (a0, a1) => {
SelectedChannelActionCreators.selectVoiceChannel(a1);
transitionTo(Routes.CHANNEL(a0, a1));
},
saveEvent: (a0, a1, a2) => {
const channel_id = ENTITY_TYPES_REQUIRED_CHANNEL_ID.has(a1.entityType) ? a1.channelId : null;
const entity_metadata = ENTITY_TYPES_REQUIRED_ENTITY_METADATA.has(a1.entityType) ? a1.entityMetadata : null;
const body = {
name: a1.name,
description: a1.description,
image: a1.image != null ? /^data:/.test(a1.image) !== false ? a1.image : void 0 : a1.image,
privacy_level: a1.privacyLevel,
scheduled_start_time: a1.scheduledStartTime,
scheduled_end_time: a1.scheduledEndTime,
entity_type: a1.entityType,
channel_id,
entity_metadata,
recurrence_rule: recurrenceRuleToServer(a1.recurrenceRule)
};
return HTTP.patch({
url: Endpoints.GUILD_EVENT(a2, a0),
body,
rejectWithError: rejectWithMigratedError()
});
},
createGuildEvent: (a0, a1) => {
const body = {
name: a0.name,
description: a0.description,
image: a0.image,
privacy_level: a0.privacyLevel,
scheduled_start_time: a0.scheduledStartTime,
scheduled_end_time: a0.scheduledEndTime,
entity_type: a0.entityType,
channel_id: a0.channelId,
entity_metadata: a0.entityMetadata,
recurrence_rule: recurrenceRuleToServer(a0.recurrenceRule)
};
return HTTP.post({
url: Endpoints.GUILD_EVENTS_FOR_GUILD(a1),
body,
rejectWithError: rejectWithMigratedError()
});
},
fetchGuildEvent: async (c16349_0, c16349_1) => {
let c26141_1;
c26141_1 = void 0;
let c29905_0 = (await httpGetWithCountryCodeQuery({
url: Endpoints.GUILD_EVENT(c16349_0, c16349_1),
rejectWithError: rejectWithMigratedError()
})).body;
Dispatcher.dispatch({
type: "FETCH_GUILD_EVENT",
guildScheduledEvent: c29905_0
});
return c29905_0;
},
fetchGuildEventsForGuild: async (c16350_0) => {
let c26142_1;
c26142_1 = void 0;
let c29906_0 = (await httpGetWithCountryCodeQuery({
url: Endpoints.GUILD_EVENTS_FOR_GUILD(c16350_0),
rejectWithError: rejectWithMigratedError()
})).body;
Dispatcher.dispatch({
type: "FETCH_GUILD_EVENTS_FOR_GUILD",
guildId: c16350_0,
guildScheduledEvents: c29906_0
});
return c29906_0;
},
fetchGuildEventUserCounts: async (c16351_0, c16351_1, guild_scheduled_event_exception_ids) => {
let c26143_1;
c26143_1 = void 0;
let c29907_0 = (await HTTP.get({
url: Endpoints.GUILD_EVENT_USER_COUNTS(c16351_0, c16351_1),
query: {
guild_scheduled_event_exception_ids
},
rejectWithError: rejectWithMigratedError()
})).body;
let c29907_1 = {
eventCount: c29907_0.guild_scheduled_event_count,
recurrenceCounts: c29907_0.guild_scheduled_event_exception_counts
};
Dispatcher.dispatch({
type: "GUILD_SCHEDULED_EVENT_USER_COUNTS_FETCH_SUCCESS",
guildId: c16351_0,
eventId: c16351_1,
counts: c29907_1
});
return c29907_1;
},
cancelGuildEvent: (a0, a1) => HTTP.patch({
url: Endpoints.GUILD_EVENT(a1, a0),
body: {
status: GuildScheduledEventStatus.CANCELED
},
rejectWithError: rejectWithMigratedError()
}),
deleteGuildEvent: (a0, a1) => HTTP.del({
url: Endpoints.GUILD_EVENT(a1, a0),
rejectWithError: rejectWithMigratedError()
}),
getGuildEventsForCurrentUser: async (c16352_0) => {
let c26144_1;
c26144_1 = void 0;
let c29908_0 = (await HTTP.get({
url: Endpoints.USER_GUILD_EVENTS,
query: {
guild_ids: [c16352_0]
},
rejectWithError: rejectWithMigratedError()
})).body;
Dispatcher.dispatch({
type: "GUILD_SCHEDULED_EVENT_RSVPS_FETCH_SUCESS",
guildScheduledEventUsers: c29908_0,
guildId: c16352_0
});
},
createRsvpForGuildEvent: async (guildEventId, guildEventExceptionId, guildId, response) => {
let r66;
let c26145_2;
let c26145_3 = 0;
let c29909_0, c29909_1;
try {
c29909_0 = void 0;
const id = AuthenticationStore.getId();
c29909_0 = id;
c26145_3 = 1;
Dispatcher.dispatch({
type: "GUILD_SCHEDULED_EVENT_USER_ADD",
userId: id,
guildId,
guildEventId,
guildEventExceptionId,
response
});
r66 = await HTTP.put({
url: Endpoints.USER_GUILD_EVENT(guildId, guildEventId, guildEventExceptionId),
body: {
response
},
rejectWithError: rejectWithMigratedError()
});
c26145_3 = 0;
} catch ($e) {
const r31 = $e;
let r8 = r31;
c26145_2 = r31;
if (c26145_3 !== 0) {
while (true) {
try {
const r85 = c26145_2;
c26145_3 = 0;
c29909_1 = r85;
Dispatcher.dispatch({
type: "GUILD_SCHEDULED_EVENT_USER_REMOVE",
userId: c29909_0,
guildId,
guildEventId,
guildEventExceptionId,
response
});
throw c29909_1;
} catch (r81) {
r8 = r81;
c26145_2 = r81;
if (c26145_3 === 0) {
break;
}
}
}
}
throw r8;
}
return r66;
},
deleteRsvpForGuildEvent: async (guildEventId2, guildEventExceptionId2, guildId2) => {
let r71;
let c26146_2;
let c26146_3 = 0;
let c29910_0, c29910_1, c29910_2;
L12: {
try {
c29910_0 = void 0;
c29910_1 = void 0;
const id = AuthenticationStore.getId();
c29910_0 = id;
const rsvp = GuildScheduledEventStore.getRsvp(guildEventId2, guildEventExceptionId2, id);
c29910_1 = rsvp;
if (rsvp != null) {
c26146_3 = 1;
Dispatcher.dispatch({
type: "GUILD_SCHEDULED_EVENT_USER_REMOVE",
userId: id,
guildId: guildId2,
guildEventId: guildEventId2,
guildEventExceptionId: guildEventExceptionId2,
response: rsvp.response
});
r71 = await HTTP.del({
url: Endpoints.USER_GUILD_EVENT(guildId2, guildEventId2, guildEventExceptionId2),
rejectWithError: rejectWithMigratedError()
});
c26146_3 = 0;
break L12;
}
} catch ($e) {
const r32 = $e;
let r8 = r32;
c26146_2 = r32;
if (c26146_3 !== 0) {
while (true) {
try {
const r91 = c26146_2;
c26146_3 = 0;
c29910_2 = r91;
Dispatcher.dispatch({
type: "GUILD_SCHEDULED_EVENT_USER_ADD",
userId: c29910_0,
guildId: guildId2,
guildEventId: guildEventId2,
guildEventExceptionId: guildEventExceptionId2,
response: c29910_1.response
});
throw c29910_2;
} catch (r87) {
r8 = r87;
c26146_2 = r87;
if (c26146_3 === 0) {
break;
}
}
}
}
throw r8;
}
return void 0;
}
return r71;
},
updateRsvp: async function updateRsvp(c16355_0, c16355_1, c16355_2, c16355_3, c16355_4) {
const _this = this;
let c26147_2;
let c26147_3 = 0;
let c29911_0, c29911_1;
L14: {
try {
if (getExistingRsvp(c16355_0, c16355_1) != null) {
c26147_3 = 1;
await _this.deleteRsvpForGuildEvent(c16355_0, c16355_1, c16355_2);
if (c16355_4 != null) {
c16355_4();
}
c26147_3 = 0;
} else {
c26147_3 = 2;
await _this.createRsvpForGuildEvent(c16355_0, c16355_1, c16355_2, c16355_3);
if (c16355_4 != null) {
c16355_4();
}
c26147_3 = 0;
}
} catch ($e) {
const r34 = $e;
let r8 = r34;
c26147_2 = r34;
let r35 = c26147_3;
if (r35 !== 0) {
while (true) {
if (r35 === 1) {
try {
const r108 = c26147_2;
c26147_3 = 0;
c29911_0 = r108;
if (c16355_4 == null) {
break L14;
}
c16355_4(c29911_0);
break L14;
} catch (r105) {
r8 = r105;
c26147_2 = r105;
r35 = c26147_3;
if (r35 === 0) {
break;
}
}
} else {
try {
const r96 = c26147_2;
c26147_3 = 0;
c29911_1 = r96;
if (c16355_4 == null) {
break L14;
}
c16355_4(c29911_1);
break L14;
} catch (r93) {
r8 = r93;
c26147_2 = r93;
r35 = c26147_3;
if (r35 === 0) {
break;
}
}
}
}
}
throw r8;
}
}
},
fetchUsersForGuildEvent: async function fetchUsersForGuildEvent(c16356_0, c16356_1, c16356_2, r6 = MAX_RSVP_USER_DISPLAY_COUNT) {
const MAX_RSVP_USER_DISPLAY_COUNT2 = r6;
let c26148_1;
let c29912_0;
L13: {
c26148_1 = void 0;
c29912_0 = void 0;
if (c16356_0 == null) {
break L13;
}
if (c16356_2 == null) {
break L13;
}
c29912_0 = await HTTP.get({
url: Endpoints.GUILD_EVENT_USERS(c16356_2, c16356_0, c16356_1),
query: {
limit: MAX_RSVP_USER_DISPLAY_COUNT2,
with_member: true
},
rejectWithError: rejectWithMigratedError()
});
Dispatcher.dispatch({
type: "GUILD_SCHEDULED_EVENT_USERS_FETCH_SUCCESS",
guildEventId: c16356_0,
guildScheduledEventUsers: c29912_0.body,
guildId: c16356_2,
guildEventExceptionId: c16356_1
});
return c29912_0.body.users;
}
return [];
},
createGuildEventException: ({ original_scheduled_start_time, scheduled_start_time, scheduled_end_time, is_canceled }, a1, a2) => HTTP.post({
url: Endpoints.GUILD_EVENT_EXCEPTIONS(a1, a2),
body: {
original_scheduled_start_time,
scheduled_start_time,
scheduled_end_time,
is_canceled
},
rejectWithError: rejectWithMigratedError()
}),
updateGuildEventException: ({ scheduled_start_time, scheduled_end_time, is_canceled }, a1, a2, a3) => HTTP.patch({
url: Endpoints.GUILD_EVENT_EXCEPTION(a1, a2, a3),
body: {
scheduled_start_time,
scheduled_end_time,
is_canceled
},
rejectWithError: rejectWithMigratedError()
}),
deleteGuildEventException: (a0, a1, a2) => HTTP.del({
url: Endpoints.GUILD_EVENT_EXCEPTION(a0, a1, a2),
rejectWithError: rejectWithMigratedError()
}),
deleteRecurrence: function deleteRecurrence(a0, a1, a2, a3) {
if (a3 != null) {
return this.updateGuildEventException({
scheduled_start_time: a3.scheduled_start_time,
scheduled_end_time: a3.scheduled_end_time,
is_canceled: true
}, a0, a1, a2);
}
return this.createGuildEventException({
original_scheduled_start_time: new Date(SnowflakeUtils.extractTimestamp(a2)).toISOString(),
is_canceled: true
}, a0, a1);
}
};
export default r29;
@@ -0,0 +1,83 @@
// Metro module 1378 (f1379).
import { ChannelTypes } from "../../Constants";
import Durations from "../../utils/Durations";
const r22 = {
SCHEDULED: 1,
1: "SCHEDULED",
ACTIVE: 2,
2: "ACTIVE",
COMPLETED: 3,
3: "COMPLETED",
CANCELED: 4,
4: "CANCELED"
};
const set2 = new Set([r22.COMPLETED, r22.CANCELED]);
const r19 = {
NONE: 0,
0: "NONE",
STAGE_INSTANCE: 1,
1: "STAGE_INSTANCE",
VOICE: 2,
2: "VOICE",
EXTERNAL: 3,
3: "EXTERNAL",
PRIME_TIME: 4,
4: "PRIME_TIME"
};
const r18 = {
EVENT_START: 1,
1: "EVENT_START"
};
const r17 = {
PUBLIC: 1,
1: "PUBLIC",
GUILD_ONLY: 2,
2: "GUILD_ONLY"
};
const set = new Set([r19.STAGE_INSTANCE, r19.PRIME_TIME]);
const r14 = {};
r14[r19.STAGE_INSTANCE] = ChannelTypes.GUILD_STAGE_VOICE;
r14[r19.VOICE] = ChannelTypes.GUILD_VOICE;
const set3 = new Set([r19.EXTERNAL]);
const set4 = new Set([r19.STAGE_INSTANCE, r19.VOICE]);
const r74 = {
EVENT_INFO: 0,
0: "EVENT_INFO",
RSVP_LIST: 1,
1: "RSVP_LIST"
};
const r81 = 2 * Durations.Millis.DAY;
const r87 = 12 * Durations.Millis.HOUR;
const r88 = {
NEW_EVENT: "Upcoming Event Notice",
EVENT_STARTING_SOON: "Event Starting Soon Notice"
};
const r91 = {
UNINTERESTED: 0,
0: "UNINTERESTED",
INTERESTED: 1,
1: "INTERESTED"
};
export const GUILD_EVENT_MAX_NAME_LENGTH = 100;
export const GUILD_EVENT_MAX_DESCRIPTION_LENGTH = 1000;
export const MAX_EVENT_LOCATION_LENGTH = 100;
export const EXPLICIT_END_EVENT_SHEET_KEY = "explicit-end-stage";
export const ANALYTICS_GUILD_EVENTS_MODAL_NAME = "Guild Events Modal";
export const GUILD_EVENT_STAGE_UPSELL_CARD_KEY = "hasSeenGuildEventStageUpsellCard";
export const FAKE_EVENT_ID = "-1";
export { r22 as GuildScheduledEventStatus };
export { set2 as GuildScheduledEventStatusDone };
export { r19 as GuildScheduledEventEntityTypes };
export { r18 as GuildScheduledEventNotificationTypes };
export { r17 as GuildScheduledEventPrivacyLevel };
export { set as AGE_VERIFICATION_STAGE_CHANNEL_TYPES };
export { r14 as EntityChannelTypes };
export { set3 as ENTITY_TYPES_REQUIRED_ENTITY_METADATA };
export { set4 as ENTITY_TYPES_REQUIRED_CHANNEL_ID };
export { r74 as EventDetailSections };
export const MAX_RSVP_USER_DISPLAY_COUNT = 100;
export { r81 as NEW_EVENT_WINDOW_MILLISECONDS };
export { r87 as EVENT_STARTING_SOON_WINDOW_MILLISECONDS };
export const ACKED_RECENTLY_WINDOW_DAYS = 4;
export { r88 as UpcomingGuildEventNoticeTypes };
export { r91 as GuildScheduledEventUserResponses };
@@ -0,0 +1,29 @@
// Metro module 15885 (f15886).
import Dispatcher from "../../Dispatcher";
export function hideLiveChannelNotice({ eventId, stageId }) {
if (!(eventId == null && stageId == null)) {
Dispatcher.dispatch({
type: "LIVE_CHANNEL_NOTICE_HIDE",
eventId,
stageId
});
}
}
export function hideUpcomingEventNotice(a0) {
Dispatcher.dispatch({
type: "UPCOMING_GUILD_EVENT_NOTICE_HIDE",
eventId: a0
});
}
export function markUpcomingEventNoticeAsSeen(a0) {
Dispatcher.dispatch({
type: "UPCOMING_GUILD_EVENT_NOTICE_SEEN",
guildEventId: a0
});
}
export function dismissEventBanner(a0) {
Dispatcher.dispatch({
type: "EVENT_BANNER_DISMISS",
eventId: a0
});
}
@@ -0,0 +1,55 @@
// Metro module 15155 (f15156).
import { GuildScheduledEventStatus } from "./GuildScheduledEventsConstants";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c10751_1 = {
hiddenEventsAndStages: []
};
class LiveChannelNoticesStore extends Module589.PersistedStore {
static displayName = "LiveChannelNoticesStore";
static persistKey = "liveChannelNotices_v2";
initialize(a0) {
if (a0 != null && a0.hiddenEventsAndStages != null) {
c10751_1 = a0;
}
}
isLiveChannelNoticeHidden({ eventId, stageId }) {
const r0 = stageId == null || !c10751_1.hiddenEventsAndStages.includes(`stage-${stageId}`);
return r0 ? eventId != null && c10751_1.hiddenEventsAndStages.includes(`event-${eventId}`) : !r0;
}
getState() {
return c10751_1;
}
}
const liveChannelNoticesStore = new LiveChannelNoticesStore(Dispatcher, {
LIVE_CHANNEL_NOTICE_HIDE: function handleHideNotice({ eventId, stageId }) {
if (eventId != null) {
c10751_1.hiddenEventsAndStages.push(`event-${eventId}`);
} else if (stageId != null) {
c10751_1.hiddenEventsAndStages.push(`stage-${stageId}`);
}
},
GUILD_SCHEDULED_EVENT_UPDATE: function handleEventUpdate({ guildScheduledEvent }) {
const r13 = `event-${guildScheduledEvent.id}`;
let c21713_0 = r13;
const r17 = c10751_1.hiddenEventsAndStages.includes(r13);
if (!(r17 ? guildScheduledEvent.status !== GuildScheduledEventStatus.CANCELED && guildScheduledEvent.status !== GuildScheduledEventStatus.COMPLETED : !r17)) {
c10751_1.hiddenEventsAndStages = c10751_1.hiddenEventsAndStages.filter((hiddenEventsAndStage) => hiddenEventsAndStage !== c21713_0);
}
},
GUILD_SCHEDULED_EVENT_DELETE: function handleEventDelete({ guildScheduledEvent }) {
const r10 = `event-${guildScheduledEvent.id}`;
let c21714_0 = r10;
if (c10751_1.hiddenEventsAndStages.includes(r10)) {
c10751_1.hiddenEventsAndStages = c10751_1.hiddenEventsAndStages.filter((hiddenEventsAndStage) => hiddenEventsAndStage !== c21714_0);
}
},
STAGE_INSTANCE_DELETE: function handleStageUpdate({ instance }) {
const r10 = `stage-${instance.id}`;
let c21715_0 = r10;
if (c10751_1.hiddenEventsAndStages.includes(r10)) {
c10751_1.hiddenEventsAndStages = c10751_1.hiddenEventsAndStages.filter((hiddenEventsAndStage) => hiddenEventsAndStage !== c21715_0);
}
}
});
export default liveChannelNoticesStore;
@@ -0,0 +1,10 @@
// Metro module 8265 (f8266).
import { Permissions } from "../../Constants";
import { combine } from "../../_bundle/HighLow";
import { MODERATE_STAGE_CHANNEL_PERMISSIONS } from "../stage_channels/StageChannelPermissions";
const VIEW_CHANNEL = Permissions.VIEW_CHANNEL;
const r19 = combine(VIEW_CHANNEL, Permissions.CONNECT);
const r26 = combine(VIEW_CHANNEL, MODERATE_STAGE_CHANNEL_PERMISSIONS);
export { VIEW_CHANNEL as CREATE_GUILD_EVENT_CORE_PERMISSIONS };
export { r19 as CREATE_GUILD_EVENT_VOICE_CHANNEL_PERMISSIONS };
export { r26 as CREATE_GUILD_EVENT_STAGE_CHANNEL_PERMISSIONS };
@@ -0,0 +1,18 @@
// Metro module 8270 (f8271).
import { GUILD_EVENT_STAGE_UPSELL_CARD_KEY } from "./GuildScheduledEventsConstants";
import { createWithEqualityFn } from "../../_bundle/identity_700";
import { Storage } from "../../_bundle/Module595";
import { batchUpdates } from "../../_bundle/Module705";
import { shallow } from "../../_bundle/Module3802";
const withEqualityFn = createWithEqualityFn((c16432_0) => ({
hasSeenUpsellCard: Storage.get(GUILD_EVENT_STAGE_UPSELL_CARD_KEY) === true,
markAsSeen: () => {
Storage.set(GUILD_EVENT_STAGE_UPSELL_CARD_KEY, true);
batchUpdates(() => c16432_0({
hasSeenUpsellCard: true
}));
}
}));
export function useStageChannelUpsellCardStore() {
return withEqualityFn((a0) => [a0.hasSeenUpsellCard, a0.markAsSeen], shallow);
}
@@ -0,0 +1,65 @@
// Metro module 8338 (f8339).
import ChannelStore from "../../stores/ChannelStore";
import RTCConnectionStore from "../../stores/RTCConnectionStore";
import SelectedGuildStore from "../../stores/SelectedGuildStore";
import { GuildScheduledEventEntityTypes } from "./GuildScheduledEventsConstants";
import { Routes } from "../../Constants";
import Module38 from "../../_bundle/Module38";
import { connectToStage, navigateToStage } from "../stage_channels/StageChannelModalActionCreators";
import { audienceAckRequestToSpeak } from "../stage_channels/StageChannelActionCreators";
import SelectedChannelActionCreators from "../../actions/SelectedChannelActionCreators";
import { transitionTo } from "../routing/router_utils";
export async function navigateToEvent(c26192_0, c26192_1) {
let c26192_3;
let c29947_0, c29947_1;
L27: {
c26192_3 = void 0;
c29947_0 = c26192_1;
c29947_1 = void 0;
const { entity_type, guild_id } = c26192_0;
if (GuildScheduledEventEntityTypes.STAGE_INSTANCE === entity_type) {
const channelId = RTCConnectionStore.getChannelId();
const channel = ChannelStore.getChannel(c26192_0.channel_id);
c29947_1 = channel;
Module38(channel != null, "could not find channel");
if (channelId !== channel.id) {
await connectToStage(channel, true);
const r166 = c29947_0;
if (r166 != null) {
r166();
}
await navigateToStage(c29947_1, null);
} else {
const r100 = c29947_0;
if (r100 != null) {
r100();
}
await navigateToStage(c29947_1, null);
}
await audienceAckRequestToSpeak(c29947_1, false);
break L27;
}
if (GuildScheduledEventEntityTypes.VOICE === entity_type) {
const channelId2 = RTCConnectionStore.getChannelId();
const channel2 = ChannelStore.getChannel(c26192_0.channel_id);
Module38(channel2 != null, "could not find channel");
if (channelId2 !== channel2.id) {
SelectedChannelActionCreators.selectVoiceChannel(channel2.id);
}
if (c26192_1 != null) {
c26192_1();
}
} else if (GuildScheduledEventEntityTypes.EXTERNAL === entity_type) {
if (SelectedGuildStore.getGuildId() !== guild_id) {
transitionTo(Routes.CHANNEL(guild_id));
}
if (c26192_1 != null) {
c26192_1();
}
}
return void 0;
}
}
export function postStartActions() {
return Promise.resolve();
}
@@ -0,0 +1,122 @@
// Metro module 8337 (f8338).
import { createChannelRecordFromServer } from "../../records/ChannelRecord";
import ChannelStore from "../../stores/ChannelStore";
import GuildStore from "../../stores/GuildStore";
import { GuildScheduledEventEntityTypes, GuildScheduledEventPrivacyLevel } from "./GuildScheduledEventsConstants";
import { ChannelTypes } from "../../Constants";
import CreateChannelActionCreators from "../../actions/CreateChannelActionCreators";
import Module38 from "../../_bundle/Module38";
import { startStageInstance } from "../stage_channels/StageInstanceActionCreators";
import GuildScheduledEventsActionCreators from "./GuildScheduledEventsActionCreators";
let findOrCreateEventChannel;
const createStageChannelForEvent = async function createStageChannelForEvent(c26189_0, c26189_1, c26189_2) {
let r103;
let c26189_4;
let c29944_2, c29944_0, c29944_1, c29944_3, c29944_4;
L16: {
c26189_4 = void 0;
c29944_2 = void 0;
c29944_0 = c26189_0;
c29944_1 = c26189_1;
let r33 = c26189_2;
if (r33 === void 0) {
r33 = [];
}
c29944_2 = r33;
c29944_3 = void 0;
c29944_4 = void 0;
await void 0;
c29944_3 = [];
const r48 = c29944_3;
r48.push.apply(r48, [...c29944_2]);
c29944_4 = await CreateChannelActionCreators.createChannel({
guildId: c29944_0.id,
type: ChannelTypes.GUILD_STAGE_VOICE,
name: c29944_1.substring(0, 100),
permissionOverwrites: c29944_3
});
if (c29944_4 != null && c29944_4.status === 201) {
r103 = (0, createChannelRecordFromServer)(c29944_4.body);
break L16;
}
throw new Error("Can't create channel for event");
}
return r103;
};
findOrCreateEventChannel = function findOrCreateEventChannel(a0, a1) {
const { guild_id, channel_id } = a0;
const guild = GuildStore.getGuild(guild_id);
if (guild == null) {
return Promise.resolve(null);
}
const channel = ChannelStore.getChannel(channel_id);
return channel == null ? createStageChannelForEvent(guild, a0.name, a1) : Promise.resolve(channel);
};
export { createStageChannelForEvent };
export { findOrCreateEventChannel };
export async function preStartEventActions(c26190_0, c26190_1) {
let c26190_3;
let c29945_0;
L13: {
c26190_3 = void 0;
c29945_0 = void 0;
if (c26190_0.entity_type === GuildScheduledEventEntityTypes.STAGE_INSTANCE) {
c29945_0 = await findOrCreateEventChannel(c26190_0, c26190_1);
Module38(c29945_0 != null, "could not find or create channel");
break L13;
}
return void 0;
}
}
export async function setEventAsActive(c26191_0, c26191_1) {
let c26191_3;
let c29946_1, c29946_0, c29946_2, c29946_3, c29946_4, c29946_5, c29946_6;
L24: {
L22: {
L20: {
c26191_3 = void 0;
c29946_1 = void 0;
c29946_0 = c26191_0;
if (c26191_1 !== void 0) {
c29946_1 = c26191_1;
c29946_2 = void 0;
c29946_3 = void 0;
c29946_4 = void 0;
c29946_5 = void 0;
c29946_6 = void 0;
} else {
c29946_1 = false;
c29946_2 = void 0;
c29946_3 = void 0;
c29946_4 = void 0;
c29946_5 = void 0;
c29946_6 = void 0;
}
await void 0;
c29946_2 = c29946_0.channel_id;
c29946_3 = c29946_0.entity_type;
c29946_4 = c29946_0.name;
c29946_5 = c29946_0.id;
c29946_6 = c29946_0.guild_id;
const r66 = c29946_3;
if (GuildScheduledEventEntityTypes.STAGE_INSTANCE === r66) {
Module38(c29946_2 != null, "channel_id is required");
await startStageInstance(c29946_2, c29946_4, GuildScheduledEventPrivacyLevel.GUILD_ONLY, c29946_1, c29946_5);
break L24;
}
if (GuildScheduledEventEntityTypes.VOICE === r66) {
Module38(c29946_2 != null, "channel_id is required");
await GuildScheduledEventsActionCreators.startEvent(c29946_5, c29946_6);
break L22;
}
if (GuildScheduledEventEntityTypes.EXTERNAL === r66) {
await GuildScheduledEventsActionCreators.startEvent(c29946_5, c29946_6);
break L20;
}
return void 0;
}
return void 0;
}
return void 0;
}
}
@@ -0,0 +1,105 @@
// Metro module 8322 (f8323).
import AuthenticationStore from "../../stores/AuthenticationStore";
import GuildScheduledEventStore from "./GuildScheduledEventStore";
import { GuildScheduledEventStatus, UpcomingGuildEventNoticeTypes } from "./GuildScheduledEventsConstants";
import { getNextShownUpcomingEventNoticeType } from "./GuildScheduledEventUtils";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let upcomingEventDismissals = {};
let upcomingEventSeenTimestamps = {};
class UpcomingEventNoticesStore extends Module589.PersistedStore {
static displayName = "UpcomingEventNoticesStore";
static persistKey = "UpcomingEventNotices";
initialize(a0) {
this.waitFor(AuthenticationStore, GuildScheduledEventStore);
if (a0 != null) {
let upcomingEventDismissals2 = a0.upcomingEventDismissals;
if (upcomingEventDismissals2 == null) {
upcomingEventDismissals2 = {};
}
upcomingEventDismissals = upcomingEventDismissals2;
let upcomingEventSeenTimestamps2 = a0.upcomingEventSeenTimestamps;
if (upcomingEventSeenTimestamps2 == null) {
upcomingEventSeenTimestamps2 = {};
}
upcomingEventSeenTimestamps = upcomingEventSeenTimestamps2;
}
}
getGuildEventNoticeDismissalTime(a0) {
return upcomingEventDismissals[a0];
}
getAllEventDismissals() {
return upcomingEventDismissals;
}
getUpcomingNoticeSeenTime(a0) {
return upcomingEventSeenTimestamps[a0];
}
getAllUpcomingNoticeSeenTimes() {
return upcomingEventSeenTimestamps;
}
getState() {
return {
upcomingEventDismissals,
upcomingEventSeenTimestamps
};
}
}
const upcomingEventNoticesStore = new UpcomingEventNoticesStore(Dispatcher, {
UPCOMING_GUILD_EVENT_NOTICE_HIDE: function handleHideNotice({ eventId }) {
const r8 = {
...upcomingEventDismissals
};
r8[eventId] = Date.now();
upcomingEventDismissals = r8;
},
GUILD_SCHEDULED_EVENT_UPDATE: function handleEventUpdate({ guildScheduledEvent }) {
if (!(guildScheduledEvent.status !== GuildScheduledEventStatus.CANCELED && guildScheduledEvent.status !== GuildScheduledEventStatus.COMPLETED)) {
const id = guildScheduledEvent.id;
const r13 = {
...upcomingEventDismissals
};
delete r13[id];
upcomingEventDismissals = r13;
const r16 = {
...upcomingEventSeenTimestamps
};
delete r16[id];
upcomingEventSeenTimestamps = r16;
}
},
GUILD_SCHEDULED_EVENT_DELETE: function handleEventDelete(a0) {
const id = a0.guildScheduledEvent.id;
const r8 = {
...upcomingEventDismissals
};
delete r8[id];
upcomingEventDismissals = r8;
const r9 = {
...upcomingEventSeenTimestamps
};
delete r9[id];
upcomingEventSeenTimestamps = r9;
},
GUILD_SCHEDULED_EVENT_USER_ADD: function handleMaybeHideNewEventNotice({ userId, guildEventId }) {
if (userId === AuthenticationStore.getId()) {
const guildScheduledEvent = GuildScheduledEventStore.getGuildScheduledEvent(guildEventId);
if (guildScheduledEvent != null && guildScheduledEvent.status === GuildScheduledEventStatus.SCHEDULED && upcomingEventDismissals[guildEventId] == null) {
if (getNextShownUpcomingEventNoticeType(guildScheduledEvent, void 0, upcomingEventSeenTimestamps[guildEventId], false) === UpcomingGuildEventNoticeTypes.NEW_EVENT) {
const r31 = {
...upcomingEventDismissals
};
r31[guildEventId] = Date.now();
upcomingEventDismissals = r31;
}
}
}
},
UPCOMING_GUILD_EVENT_NOTICE_SEEN: function handleMarkUpcomingNoticeAsSeen({ guildEventId }) {
const r8 = {
...upcomingEventSeenTimestamps
};
r8[guildEventId] = Date.now();
upcomingEventSeenTimestamps = r8;
}
});
export default upcomingEventNoticesStore;
@@ -0,0 +1,3 @@
// Metro module 8317 (f8318).
import MarkupUtils from "../markup/MarkupUtils";
export const guildEventDetailsParser = MarkupUtils.parseGuildEventDescription;
@@ -0,0 +1,8 @@
// Metro module 8218 (f8219).
export const CREATE_GUILD_EVENT_MODAL_KEY = "create-guild-event-modal";
export const START_EVENT_MODAL_KEY = "start-event-modal";
export const GUILD_EVENTS_LIST_ACTION_SHEET_KEY = "guild-scheduled-events-list";
export const GUILD_EVENT_INFO_ACTION_SHEET_KEY = "guild-scheduled-events-info";
export function isGuildEventValid(a0, a1) {
return a0 !== "" && a1 != null;
}
@@ -0,0 +1,72 @@
// Metro module 12273 (f12274).
import { isGuildEventEnded, isGuildScheduledEventActive } from "../GuildScheduledEventStore";
import { GuildScheduledEventEntityTypes } from "../GuildScheduledEventsConstants";
import { getNextRecurrenceIdInEvent } from "../utils/ScheduleUtils";
import Module712 from "../../../_bundle/Module712";
import Module8326 from "../../../_bundle/Module8326";
import { intl, t } from "../../../intl/index.native";
import Module7683 from "../../../_bundle/Module7683";
import Module12274 from "../../../_bundle/Module12274";
export function getGuildScheduledEventHeaderProps(a0) {
let ICON_FEEDBACK_POSITIVE, icon, text;
const eventTimeData = a0.eventTimeData;
const { startDateTimeString, diffMinutes, currentOrPastEvent, upcomingEvent } = eventTimeData;
const { isStage, theme, event, isCanceled, recurrenceId } = a0;
const nextRecurrenceIdInEvent = getNextRecurrenceIdInEvent(event);
let r33 = recurrenceId != null ? nextRecurrenceIdInEvent === recurrenceId && isGuildScheduledEventActive(event) : isGuildScheduledEventActive(event);
const isGuildEventEnded2 = isGuildEventEnded(event);
const ICON_SUBTLE = Module712.colors.ICON_SUBTLE;
let r16 = Module8326;
if (r33) {
let r75 = intl.string(t["X2K3/4"]);
if (isStage) {
r16 = Module7683;
}
if (event?.entity_type === GuildScheduledEventEntityTypes.EXTERNAL) {
r75 = intl.string(t.TxqPQR);
}
ICON_FEEDBACK_POSITIVE = Module712.colors.ICON_FEEDBACK_POSITIVE;
text = r75;
icon = r16;
} else if (isGuildEventEnded2) {
icon = Module12274;
text = startDateTimeString;
ICON_FEEDBACK_POSITIVE = ICON_SUBTLE;
} else if (currentOrPastEvent) {
icon = Module12274;
text = intl.string(t.WINqKV);
ICON_FEEDBACK_POSITIVE = ICON_SUBTLE;
} else {
icon = r16;
text = startDateTimeString;
ICON_FEEDBACK_POSITIVE = ICON_SUBTLE;
if (upcomingEvent) {
text = diffMinutes > 0 ? intl.formatToPlainString(t.PQlCWk, {
minutes: diffMinutes
}) : intl.string(t.WINqKV);
icon = Module12274;
ICON_FEEDBACK_POSITIVE = ICON_SUBTLE;
}
}
if (isCanceled) {
ICON_FEEDBACK_POSITIVE = Module712.colors.ICON_FEEDBACK_CRITICAL;
}
const r100 = {
icon,
text,
color: Module712.internal.resolveSemanticColor(theme, ICON_FEEDBACK_POSITIVE),
shouldChangeTextColor: null
};
let shouldChangeTextColor = !isGuildEventEnded2;
if (!isGuildEventEnded2) {
if (!r33) {
r33 = currentOrPastEvent;
}
if (!r33) {
r33 = upcomingEvent;
}
shouldChangeTextColor = r33;
}
r100.shouldChangeTextColor = shouldChangeTextColor;
return r100;
}
@@ -0,0 +1,409 @@
// Metro module 8229 (f8230).
import { lazy } from "react";
import ChannelStore from "../../../stores/ChannelStore";
import GuildChannelStore from "../../../stores/GuildChannelStore";
import GuildStore from "../../../stores/GuildStore";
import PermissionStore from "../../../stores/PermissionStore";
import GuildScheduledEventStore, { isGuildScheduledEventActive, isGuildEventEnded } from "../GuildScheduledEventStore";
import "../GuildScheduledEventsConstants";
import { CREATE_GUILD_EVENT_MODAL_KEY, GUILD_EVENTS_LIST_ACTION_SHEET_KEY, START_EVENT_MODAL_KEY } from "./GuildEventModalConstants";
import { Permissions, InstantInviteSources, Routes } from "../../../Constants";
import { jsx } from "react/jsx-runtime";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import Module38 from "../../../_bundle/Module38";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { openAlert } from "../../../design/components/AlertModal/native/useAlertStore.native";
import GuildScheduledEventsActionCreators from "../GuildScheduledEventsActionCreators";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import * as _index_native from "../../../intl/index.native";
import { t } from "../../../intl/index.native";
import Module8346 from "../../../_bundle/Module8346";
import { handleRsvp } from "../utils/GuildEventRsvpUtils";
import * as _useCanInviteForGuildEvent from "../useCanInviteForGuildEvent";
import { copy } from "../../../utils/ClipboardUtils.native";
import { presentLinkCopied, presentCopiedToClipboard } from "../../toast/native/ToastUtils";
import { showVanityUrlInviteActionSheet, showInstantInviteActionSheet } from "../../instant_invite/native/InstantInviteUtils";
import { transitionToGuildFromEventInvite } from "../../../actions/InstantInviteActionCreators";
import { openGuildEventDetails } from "../GuildScheduledEventModalActionCreators.native";
import { getEventException } from "../useEventException";
import { getEventTimeData } from "../utils/ScheduleUtils";
import restoreEventRecurrence from "../restoreEventRecurrence";
import { showReportModalForGuildScheduledEvent } from "../../in_app_reports/ReportModals";
import { DeveloperMode } from "../../user_settings/UserSettings";
import TidaWebformExperiment from "../../guild/TidaWebformExperiment";
import { getWindowDimensions } from "../../screen/useWindowDimensions.native";
import getGuildEventImage from "../utils/getGuildEventImage";
import { showSimpleActionSheet } from "../../action_sheet/native/showSimpleActionSheet";
function $mk80176($env) {
return function(a0) {
const r1 = a0 != null;
if (r1 || $env[0] === $env.$parent[12].INTERESTED) {
const r6 = $env.$parent;
const r7 = r6[1];
const r8 = r6[2];
const r5 = r7(r8[22]);
const key = r1 ? "ERROR_OCCURRED_TRY_AGAIN" : "GUILD_EVENT_INTERESTED_NOTIFICATION";
const r21 = r6[0];
const intl = r21(r8[23]).intl;
const r26 = r21(r8[23]).t;
r5.open({
key,
content: r1 ? intl.string(r26.fEptJP) : intl.string(r26.osvXlf),
icon: r7(r1 ? r8[24] : r8[25])
});
}
};
}
function $mk80177($env) {
return (a0, a1, a2, a3) => {
let env26157;
const r1 = $env;
const r2 = $env.$parent;
const r6 = r1[0];
const r10 = r1[1];
const r14 = env26157 = {
$parent: r2
};
env26157[0] = a3;
(0, r2[1])(r2[2][21]).updateRsvp(r6, a1, r10, a3, $mk80176(r14));
};
}
function $mk80178($env) {
return function openRsvpPicker(a0, a1) {
const r1 = $env;
const r3 = $env.$parent;
const r5 = r3[1];
const r2 = r3[2];
r5(r2[15]).openLazy((0, r3[0])(r2[14])(r2[27], r2.paths), "GuildEventRsvpPickerActionSheet", {
event: a0,
recurrenceId: a1,
guildId: r1[1],
onRsvp: r1[2]
}, "stack");
};
}
let $mk80175 = function() {
return () => import("./components/DeleteEventAlert");
};
let env5233 = {};
export function openCreateOrEditGuildEventModal(a0, { guildEvent, channel, onClose, recurrenceId: recurrenceId2 }) {
const handleClose = function handleClose() {
ModalActionCreators.popWithKey(CREATE_GUILD_EVENT_MODAL_KEY);
if (onClose != null) {
onClose();
}
};
if (recurrenceId2 != null) {
Module38(guildEvent != null, "recurrence editing requires a guild event");
ModalActionCreators.pushLazy(import("./components/EditGuildEventRecurrenceModal"), {
guildEvent,
recurrenceId: recurrenceId2,
onCloseModal: handleClose
}, CREATE_GUILD_EVENT_MODAL_KEY);
} else {
ActionSheetActionCreators.hideAllActionSheets();
ModalActionCreators.pushLazy(import("./components/EditGuildEventModal"), {
guild: a0,
targetChannel: channel,
initialGuildEvent: guildEvent,
onCloseModal: handleClose
}, CREATE_GUILD_EVENT_MODAL_KEY);
}
}
export function openGuildEventListActionSheet(a0) {
ActionSheetActionCreators.openLazy(import("./components/GuildEventsListActionSheet"), GUILD_EVENTS_LIST_ACTION_SHEET_KEY, {
guild: a0
});
}
export function closeGuildEventListActionSheet() {
ActionSheetActionCreators.hideActionSheet(GUILD_EVENTS_LIST_ACTION_SHEET_KEY);
}
export function openStartGuildEventModal(a0, a1, a2) {
ActionSheetActionCreators.hideAllActionSheets();
ModalActionCreators.pushLazy(import("./components/StartEventModal"), {
event: a0,
recurrenceId: a1,
onCloseActionSheet: a2
}, START_EVENT_MODAL_KEY);
}
export function openDeleteGuildEventActionSheet(a0, a1, a2) {
openAlert("DeleteEventAlert", (0, jsx)(lazy($mk80175()), {
eventId: a0,
guildId: a1,
recurrenceId: a2
}));
}
export function updateRsvp(a0, a1, a2, a3) {
let env16398;
const r1 = env16398 = {
$parent: env5233
};
env16398[0] = a3;
GuildScheduledEventsActionCreators.updateRsvp(a0, a1, a2, a3, $mk80176(r1));
}
export function handleGuildScheduledEventRsvp(a0, a1, a2, a3) {
let env16399;
const r5 = env16399 = {
$parent: env5233
};
env16399[0] = a0;
env16399[1] = a2;
env16399[2] = a3;
handleRsvp({
eventId: a0,
recurrenceId: a1,
guildId: a2,
updateRsvp: $mk80177(r5),
openRsvpPicker: $mk80178(r5),
onRsvp: a3
});
}
export function openShareEvent(a0, a1) {
let r7 = ChannelStore.getChannel(a0.channel_id);
if (r7 == null) {
r7 = GuildChannelStore.getDefaultChannel(a0.guild_id);
}
L16: {
if (r7 != null) {
const isGuildEventInvitable = _useCanInviteForGuildEvent.isGuildEventInvitable(a0);
if (isGuildEventInvitable) {
const guild2 = GuildStore.getGuild(a0.guild_id);
if (guild2?.vanityURLCode != null && guild2.vanityURLCode !== "" && !PermissionStore.can(Permissions.CREATE_INSTANT_INVITE, r7)) {
showVanityUrlInviteActionSheet(guild2, r7, InstantInviteSources.GUILD_SCHEDULED_EVENT, {
guildScheduledEventId: a0.id,
stackingBehavior: "stack"
});
break L16;
}
showInstantInviteActionSheet(r7, {
createInvite: isGuildEventInvitable,
guildScheduledEventId: a0.id,
stackingBehavior: "stack",
source: InstantInviteSources.GUILD_SCHEDULED_EVENT
});
} else if (a1 != null && a1 !== "") {
copy(a1);
presentLinkCopied();
}
} else {
ToastActionCreators.open({
key: "ERROR_OCCURRED_TRY_AGAIN",
content: _index_native.intl.string(t.fEptJP),
icon: Module8346
});
}
}
}
export async function transitionToEventDetailsFromInvite(c26158_0, c26158_1) {
let c29927_0 = c26158_0;
let c29927_1 = c26158_1;
await transitionToGuildFromEventInvite(c26158_0);
if (!(c29927_0.channel_id != null && (0, isGuildScheduledEventActive)(c29927_0))) {
openGuildEventDetails({
eventId: c29927_0.id,
event: c29927_0,
recurrenceId: c29927_1
});
}
}
export function showGuildEventModeratorActionSheet(a0, a1, a2) {
let options;
let c16400_5;
const event = a0;
const recurrenceId = a2;
const guild_id = a0.guild_id;
const guild = GuildStore.getGuild(guild_id);
const isInterestedInEventRecurrence = GuildScheduledEventStore.isInterestedInEventRecurrence(a0.id, a2);
const eventException = getEventException(a2, a0.id);
let r13 = eventException?.is_canceled;
if (r13 == null) {
r13 = false;
}
const r12 = (0, isGuildScheduledEventActive)(a0);
const withinStartWindow = getEventTimeData(a0.scheduled_start_time).withinStartWindow;
const r35 = r12 ? null : r13 ? null : {
label: isInterestedInEventRecurrence ? _index_native.intl.string(t["7M5gaN"]) : _index_native.intl.string(t.FXixvH),
onPress: () => {
let env26159;
const r1 = env5233;
const id = event.id;
const r4 = env26159 = {
$parent: r1
};
env26159[0] = id;
env26159[1] = guild_id;
env26159[2] = void 0;
handleRsvp({
eventId: id,
recurrenceId,
guildId: guild_id,
updateRsvp: $mk80177(r4),
openRsvpPicker: $mk80178(r4),
onRsvp: void 0
});
}
};
L50: {
options = [];
if (guild != null && (a1 && !(0, isGuildEventEnded)(a0))) {
L20: {
if (!r12) {
if (withinStartWindow && !isInterestedInEventRecurrence) {
if (r35 == null) {
break L20;
}
options.push(r35);
break L20;
}
if (!r13) {
options.push({
label: _index_native.intl.string(t.cK1GGY),
onPress: () => {
ActionSheetActionCreators.hideAllActionSheets();
ModalActionCreators.pushLazy(import("./components/StartEventModal"), {
event,
recurrenceId,
onCloseActionSheet: void 0
}, START_EVENT_MODAL_KEY);
}
});
}
}
}
if (!((r12 ? !r12 : withinStartWindow) && !isInterestedInEventRecurrence || r35 == null)) {
options.push(r35);
}
if (!(a2 == null || r13)) {
options.push({
label: _index_native.intl.string(t.wmVmXN),
onPress: () => {
openCreateOrEditGuildEventModal(guild, {
guildEvent: event,
recurrenceId
});
}
});
}
if (!r13) {
options.push({
label: a2 != null ? _index_native.intl.string(t.BW1Qoh) : _index_native.intl.string(t.Rgy2dU),
onPress: () => {
openCreateOrEditGuildEventModal(guild, {
guildEvent: event
});
}
});
}
if (r12) {
options.push({
label: _index_native.intl.string(t.qaYzPA),
isDestructive: true,
onPress: () => {
GuildScheduledEventsActionCreators.endEvent(event.id, event.guild_id);
}
});
break L50;
}
L43: {
if (a2 != null) {
if (eventException != null && eventException.is_canceled) {
options.push({
label: _index_native.intl.string(t.b8606G),
onPress: () => {
restoreEventRecurrence(eventException, guild.id, event.id, recurrenceId);
}
});
break L43;
}
options.push({
label: _index_native.intl.string(t.tqClly),
isDestructive: true,
onPress: () => {
const { id, guild_id: guild_id2 } = event;
openAlert("DeleteEventAlert", (0, jsx)(lazy($mk80175()), {
eventId: id,
guildId: guild_id2,
recurrenceId
}));
}
});
}
}
options.push({
label: a0.recurrence_rule != null ? _index_native.intl.string(t.wr33rW) : _index_native.intl.string(t.B9sJLX),
isDestructive: true,
onPress: () => {
const { id, guild_id: guild_id2 } = event;
openAlert("DeleteEventAlert", (0, jsx)(lazy($mk80175()), {
eventId: id,
guildId: guild_id2,
recurrenceId: void 0
}));
}
});
} else if (r35 != null) {
options.push(r35);
}
}
options.push({
label: _index_native.intl.string(t.IBA5wX),
isDestructive: true,
onPress: () => {
ActionSheetActionCreators.hideAllActionSheets();
showReportModalForGuildScheduledEvent(event);
}
});
options.push({
label: a0.recurrence_rule != null ? _index_native.intl.string(t.AYnhB7) : _index_native.intl.string(t["9o+VKx"]),
onPress: () => {
copy(`${location.protocol}//${location.host}${Routes.GUILD_EVENT_DETAILS(guild_id, event.id, null)}`);
}
});
if (a2 != null) {
options.push({
label: _index_native.intl.string(t.QLtDqP),
onPress: () => {
copy(`${location.protocol}//${location.host}${Routes.GUILD_EVENT_DETAILS(guild_id, event.id, recurrenceId)}`);
}
});
}
if (DeveloperMode.getSetting()) {
options.push({
label: _index_native.intl.string(t.WZwPO4),
onPress: () => {
copy(event.id);
}
});
if (a2 != null) {
options.push({
label: _index_native.intl.string(t.NZRGQo),
onPress: () => {
copy(recurrenceId);
}
});
}
let tidaWebformEnabled = TidaWebformExperiment.getCurrentConfig({
location: "showGuildEventModeratorActionSheet"
}).tidaWebformEnabled;
const guildEventImage = getGuildEventImage(a0, getWindowDimensions().width);
c16400_5 = guildEventImage;
if (tidaWebformEnabled) {
tidaWebformEnabled = guildEventImage != null;
}
if (tidaWebformEnabled) {
options.push({
label: _index_native.intl.string(t["8xHmxo"]),
onPress: () => {
copy(c16400_5);
presentCopiedToClipboard();
}
});
}
}
showSimpleActionSheet({
key: "GuildEvent",
stackingBehavior: "stack",
options,
hasIcons: false
});
}
@@ -0,0 +1,42 @@
// Metro module 8345 (f8346).
import GuildScheduledEventStore from "../../GuildScheduledEventStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../../_bundle/Module589";
import GuildScheduledEventsActionCreators from "../../GuildScheduledEventsActionCreators";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { AlertModal, AlertActionButton } from "../../../../design/components/AlertModal/native/AlertModal.native";
import { intl, t } from "../../../../intl/index.native";
import { Text } from "../../../../design/components/Text/native/Text";
const useStyles = createStyles({
contentText: {
textAlign: "center"
}
});
export default function DeleteEventAlert(props) {
let c16518_4;
const { eventId, guildId, recurrenceId, eventException } = props;
c16518_4 = void 0;
let _handleConfirmClick2 = function _handleConfirmClick() {
const r9 = async () => {
let c29950_0;
c29950_0 = void 0;
if (c16518_4) {
await GuildScheduledEventsActionCreators.deleteRecurrence(guildId, eventId, recurrenceId, eventException);
} else {
await GuildScheduledEventsActionCreators.deleteGuildEvent(eventId, guildId);
}
ActionSheetActionCreators.hideActionSheet();
};
_handleConfirmClick2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
const r3 = useStateFromStores([GuildScheduledEventStore], () => GuildScheduledEventStore.getGuildScheduledEvent(eventId))?.recurrence_rule != null;
const r27 = recurrenceId != null;
c16518_4 = r27;
return <AlertModal title={r27 ? intl.string(t.tqClly) : r3 ? intl.string(t.wr33rW) : intl.string(t.B9sJLX)} content={intl.string(t.v2GWNQ)} extraContent={r3 ? r27 ? null : <Text variant="text-md/medium" color="text-default" style={styles.contentText}>
{intl.format(t.ZcpcyO, {})}
</Text> : null} actions={[<AlertActionButton key="delete" variant="destructive" onPress={function handleConfirmClick() {
return _handleConfirmClick2.apply(this, arguments);
}} text={r3 && !r27 ? intl.string(t["8ZsNv5"]) : intl.string(t.B9sJLX)} />, <AlertActionButton key="cancel" variant="secondary" text={intl.string(t.oEAioF)} />]} />;
};
@@ -0,0 +1,125 @@
// Metro module 8268 (f8269).
import { View } from "react-native";
import PermissionStore from "../../../../stores/PermissionStore";
import RelationshipStore from "../../../../stores/RelationshipStore";
import UserStore from "../../../../stores/UserStore";
import GuildScheduledEventStore from "../../GuildScheduledEventStore";
import { ChannelTypes, Permissions } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useInputStyles } from "../../../../design/components/Input/native/InputFieldContainer.native";
import { useGetEventChannelsByType } from "../../useGetEventChannelsByType";
import { useChannelsUserCanStartStageIn } from "../../useGuildsUserCanStartStageIn";
import useChannelName, { computeChannelName } from "../../../channel/useChannelName";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { getChannelIcon, getChannelIconComponent } from "../../../../utils/native/ChannelUtils";
import Module8250 from "../../../../_bundle/Module8250";
import { LocationIcon } from "../../../../design/components/Icon/native/redesign/generated/LocationIcon";
import { intl, t } from "../../../../intl/index.native";
import { Text } from "../../../../design/components/Text/native/Text";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { dismissGlobalKeyboard } from "../../../../utils/native/KeyboardManagerUtils";
import StageChannelUpsell from "./StageChannelUpsell";
import { openCreateOrEditGuildEventModal } from "../GuildScheduledEventModalActionCreators";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { Icon } from "../../../../design/void/native";
import Module8247 from "../../../../_bundle/Module8247";
const useStyles = createStyles({
container: {
flexDirection: "column"
},
channelSelectorButton: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
backgroundColor: Module712.colors.REDESIGN_BUTTON_TERTIARY_BACKGROUND
},
channelIcon: {
marginRight: 8
},
channelTypeText: {
flex: 1,
marginBottom: 8
},
channelNameText: {
flex: 1
}
});
export default function EditGuildEventChannelSelection(props) {
let stateFromStores2;
const { guild, channelType, channel, guildEventId, recurrenceId, onChangeChannel, style } = props;
stateFromStores2 = void 0;
const styles = useStyles();
const styles2 = useInputStyles({
hasLeadingIcon: true
});
const r1 = channelType === ChannelTypes.GUILD_STAGE_VOICE;
let c16430_5 = r1;
const getEventChannelsByType = useGetEventChannelsByType(guild.id, channelType);
const channelsUserCanStartStageIn = useChannelsUserCanStartStageIn(guild);
const channelName = useChannelName(channel);
const stateFromStores = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.MANAGE_CHANNELS, guild));
stateFromStores2 = useStateFromStores([GuildScheduledEventStore], () => GuildScheduledEventStore.getGuildScheduledEvent(guildEventId), [guildEventId]);
const source = channel != null ? getChannelIcon(channel) : Module8250;
const Component = channel != null ? getChannelIconComponent(channel) : LocationIcon;
const accessibilityLabel = r1 ? intl.string(t.S7GjDz) : intl.string(t["7RYWCP"]);
const r87 = [<Text style={styles.channelTypeText} variant="text-sm/semibold" color="text-subtle">{accessibilityLabel}</Text>, ,];
const props2 = {
accessibilityLabel,
accessibilityHint: intl.string(t.AaXbMD),
accessibilityValue: null,
accessibilityRole: "button",
style: null,
onPress: null,
children: null
};
let text = channelName;
if (text == null) {
text = void 0;
}
props2.accessibilityValue = {
text
};
props2.style = [styles2.padding, styles2.radius, styles.channelSelectorButton];
props2.onPress = function onPress() {
dismissGlobalKeyboard();
const items = getEventChannelsByType.map((item) => ({
value: item.id,
label: computeChannelName(item, UserStore, RelationshipStore, true)
}));
const body = channelsUserCanStartStageIn.length === 0 ? stateFromStores ? <StageChannelUpsell guildId={guild.id} onCreate={(event) => {
let guildEvent = stateFromStores2;
if (stateFromStores2 == null) {
guildEvent = void 0;
}
openCreateOrEditGuildEventModal(guild, {
channel: event,
guildEvent,
recurrenceId
});
}} /> : null : null;
const r37 = import("../../../../components_native/common/ItemSelectorActionSheet");
const title = c16430_5 ? intl.string(t.S7GjDz) : intl.string(t["7RYWCP"]);
let selectedItem = channel?.id;
if (selectedItem == null) {
selectedItem = void 0;
}
ActionSheetActionCreators.openLazy(r37, "SelectUpdatesChannel", {
title,
items,
body,
onItemSelect: (c29930_0) => {
const r7 = getEventChannelsByType.find((item) => item.id === c29930_0);
if (r7 != null) {
onChangeChannel(r7);
}
ActionSheetActionCreators.hideActionSheet();
},
selectedItem,
hasIcons: false
});
};
props2.children = [Component != null ? <Component style={styles.channelIcon} /> : <Icon source={source} style={styles.channelIcon} />, <Text style={styles.channelNameText} variant="text-md/medium" color="interactive-text-active">{channelName}</Text>, <Icon source={Module8247} />];
r87[1] = <PressableOpacity {...props2} />;
return <View style={[styles.container, style]}>{r87}</View>;
};
@@ -0,0 +1,119 @@
// Metro module 8313 (f8314).
import { useMemo, useState, useRef } from "react";
import { isGuildScheduledEventActive } from "../../GuildScheduledEventStore";
import { GuildScheduledEventEntityTypes } from "../../GuildScheduledEventsConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { intl, t } from "../../../../intl/index.native";
import Module3771 from "../../../../_bundle/Module3771";
import { recurrenceRuleToOption, MAX_DAYS_AHEAD_AN_EVENT_CAN_START, MAX_DAYS_AHEAD_AN_EVENT_CAN_END, recurrenceOptionToRecurrenceRule } from "../../utils/ScheduleUtils";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { Text } from "../../../../design/components/Text/native/Text";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { dismissGlobalKeyboard } from "../../../../utils/native/KeyboardManagerUtils";
import { EditGuildEventScreens } from "../../utils/EditGuildEventUtils";
import { AccessibilityAnnouncer } from "../../../../_bundle/Module3902";
import EditGuildEventStepContainer from "./EditGuildEventStepContainer";
import EditGuildEventStepHeader from "./EditGuildEventStepHeader";
import { GuildEventTopic, GuildEventDatetime, GuildEventRecurrence, GuildEventDescription } from "./GuildEventModalComponents";
const useStyles = createStyles({
error: {
paddingVertical: 8
}
});
export default function EditGuildEventDetails(props) {
let memo2, state, setState, ref, isGuildScheduledEventActive2, setState2, navigation;
const { guildEvent, initialGuildEvent, onChange: onChange2 } = props;
memo2 = void 0;
state = void 0;
setState = void 0;
ref = void 0;
isGuildScheduledEventActive2 = void 0;
setState2 = void 0;
navigation = void 0;
const styles = useStyles();
const name = guildEvent.name;
let description = guildEvent.description;
const { entityType, scheduledStartTime, scheduledEndTime, recurrenceRule } = guildEvent;
const memo = useMemo(() => Module3771(scheduledStartTime), [scheduledStartTime]);
memo2 = useMemo(() => scheduledEndTime != null ? Module3771(scheduledEndTime) : Module3771(scheduledStartTime).add(1, "hour"), [scheduledEndTime, scheduledStartTime]);
[state, setState] = useState(() => recurrenceRuleToOption(Module3771(scheduledStartTime), recurrenceRule));
const memo6 = useMemo(() => Module3771(), []);
const memo5 = useMemo(() => Module3771().add(MAX_DAYS_AHEAD_AN_EVENT_CAN_START, "days"), []);
const memo4 = useMemo(() => Module3771(memo).add(15, "minutes"), [memo]);
const memo3 = useMemo(() => Module3771().add(MAX_DAYS_AHEAD_AN_EVENT_CAN_END, "days"), []);
ref = useRef(null);
isGuildScheduledEventActive2 = isGuildScheduledEventActive(initialGuildEvent);
let state2;
[state2, setState2] = useState(null);
navigation = useNavigation();
const action = <>
{state2 != null ? <Text style={styles.error} variant="text-sm/normal" color="text-feedback-critical">{state2}</Text> : null}
<Button text={intl.string(t.PDTjLN)} variant="primary" onPress={function onPress() {
dismissGlobalKeyboard();
try {
setState2(null);
(function assertGuildEventDetailsValid(a0) {
if (a0.name.length === 0) {
throw new Error(intl.string(t.GoV0uR));
}
})(guildEvent);
navigation.navigate(EditGuildEventScreens.PREVIEW);
} catch (r24) {
setState2(r24.message);
AccessibilityAnnouncer.announce(r24.message);
}
}} disabled={state2 != null} />
</>;
const r120 = [<EditGuildEventStepHeader title={intl.string(t.GG6vbr)} subtitle={intl.string(t.q5lgwV)} />, <GuildEventTopic topic={name} onChange={(event) => {
const r3 = {
name: event
};
setState2(null);
onChange2(r3);
}} />, <GuildEventDatetime date={memo} onChange={function onChange(event) {
if (isGuildScheduledEventActive2) {
return setState2(intl.string(t.nKIaRG));
}
const r6 = {
scheduledStartTime: event.toISOString()
};
if (scheduledEndTime != null && memo2.isBefore(event)) {
r6.scheduledEndTime = Module3771(event).add(1, "hour").toISOString();
}
if (event != null && state != null) {
r6.recurrenceRule = recurrenceOptionToRecurrenceRule(state, event);
}
setState2(null);
onChange2(r6);
}} disabled={isGuildScheduledEventActive2} minimumDate={memo6} maximumDate={memo5} dateLabel={intl.string(t.kKOIwJ)} timeLabel={intl.string(t["6dGmCD"])} />, entityType === GuildScheduledEventEntityTypes.EXTERNAL && <GuildEventDatetime date={memo2} onChange={function onChange(event) {
const r3 = {
scheduledEndTime: event.toISOString()
};
setState2(null);
onChange2(r3);
}} minimumDate={memo4} maximumDate={memo3} dateLabel={intl.string(t.CTLgZJ)} timeLabel={intl.string(t.j2RuXF)} />, <GuildEventRecurrence startDate={memo} recurrenceRule={recurrenceRule} onRecurrenceChange={function onRecurrenceChange(event) {
if (memo != null) {
onChange2({
recurrenceRule: recurrenceOptionToRecurrenceRule(event, memo)
});
setState(event);
}
}} />, ,];
if (description == null) {
description = "";
}
r120[5] = <GuildEventDescription description={description} onChange={(event) => {
const r3 = {
description: event
};
setState2(null);
onChange2(r3);
}} onFocus={function onFocus() {
setTimeout(() => {
if (ref.current != null) {
ref.current.scrollToEnd();
}
}, 100);
}} />;
return <EditGuildEventStepContainer action={action} ref={ref}>{r120}</EditGuildEventStepContainer>;
};
@@ -0,0 +1,180 @@
// Metro module 8263 (f8264).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { memo, useState } from "react";
import { GuildScheduledEventEntityTypes } from "../../GuildScheduledEventsConstants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { getInitialGuildEventData, isEditingEvent, EditGuildEventScreens } from "../../utils/EditGuildEventUtils";
import LazyAPIPromise from "../../../../utils/LazyAPIPromise";
import { dismissGlobalKeyboard } from "../../../../utils/native/KeyboardManagerUtils";
import GuildScheduledEventsActionCreators from "../../GuildScheduledEventsActionCreators";
import { AccessibilityAnnouncer } from "../../../../_bundle/Module3902";
import { intl, t } from "../../../../intl/index.native";
import { getChannelTypeFromEntity } from "../../utils/EntityUtils";
import { getEventChannelsByType } from "../../useGetEventChannelsByType";
import EditGuildEventWhere from "./EditGuildEventWhere";
import EditGuildEventDetails from "./EditGuildEventDetails";
import EditGuildEventPreview from "./EditGuildEventPreview";
import { Navigator } from "../../../../design/components/Navigator/native/Navigator.native";
function $mk105770($env) {
return () => {
const r1 = $env.$parent.$parent;
return (0, r1[8])((0, r1[1])(r1[3][15]), {
screen: $env[0],
onClose: $env.$parent[1]
});
};
}
let env5260 = {};
const useStyles = createStyles({
cardStyle: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
}
});
const r37 = memo(function(a0) {
let env16420;
let env16421;
let env16422;
let env16423;
const r11 = env16420 = {
$parent: env5260
};
const guild = a0.guild;
env16420[0] = guild;
env16420[1] = a0.onCloseModal;
const initialGuildEvent = a0.initialGuildEvent;
env16420[2] = initialGuildEvent;
const targetChannel = a0.targetChannel;
env16420[3] = void 0;
env16420[4] = void 0;
env16420[5] = void 0;
env16420[6] = void 0;
env16420[8] = void 0;
env16420[7] = function _handleSave() {
const r9 = async () => {
let r45;
let c29929_0 = env16420;
if (await (0, env16420[6])() != null) {
if (env16420[5]) {
if (env16420[2]?.id != null) {
AccessibilityAnnouncer.announce(intl.string(t["F9On+q"]));
} else {
r45 = c29929_0.$parent;
AccessibilityAnnouncer.announce(intl.string(t["5HzXO5"]));
}
} else {
r45 = c29929_0.$parent;
AccessibilityAnnouncer.announce(intl.string(t["5HzXO5"]));
}
(0, env16420[1])();
}
};
env16420[7] = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
const r25 = _slicedToArray(useState(getInitialGuildEventData(initialGuildEvent, targetChannel)), 2);
const guildEvent = r25[0];
env16420[3] = guildEvent;
env16420[4] = r25[1];
const [isEdit] = useState(isEditingEvent(initialGuildEvent));
env16420[5] = isEdit;
const [initialRouteStack] = useState(() => {
const r6 = env16420[5];
const r3 = {
name: EditGuildEventScreens.CHANNEL_SELECTOR
};
return r6 ? [r3, {
name: EditGuildEventScreens.DETAILS
}] : [r3];
});
const r44 = _slicedToArray(LazyAPIPromise(() => {
let r21;
dismissGlobalKeyboard();
if (env16420[5]) {
const r15 = env16420[2];
r21 = r15?.id != null ? GuildScheduledEventsActionCreators.saveEvent(r15.id, env16420[3], env16420[0].id) : GuildScheduledEventsActionCreators.createGuildEvent(env16420[3], env16420[0].id);
} else {
r21 = GuildScheduledEventsActionCreators.createGuildEvent(env16420[3], env16420[0].id);
}
return r21;
}), 2);
env16420[6] = r44[0];
const r46 = r44[1];
env16420[8] = {
guild,
guildEvent,
initialGuildEvent,
isEdit,
error: r46.error,
loading: r46.loading,
onSave: function handleSave() {
return env16420[7].apply(this, arguments);
},
onChange: function handleChange(a0) {
let c26162_0 = a0;
if (a0.entityType != null) {
let channelId = _slicedToArray(getEventChannelsByType(env16420[0].id, getChannelTypeFromEntity(a0.entityType)), 1)[0]?.id;
if (channelId == null) {
channelId = null;
}
a0.channelId = channelId;
if (a0.entityType !== GuildScheduledEventEntityTypes.EXTERNAL && env16420[3].entityType === GuildScheduledEventEntityTypes.EXTERNAL) {
a0.entityMetadata = null;
}
}
(0, env16420[4])((a0) => ({
...a0,
...c26162_0
}));
}
};
const screens = {};
const CHANNEL_SELECTOR = EditGuildEventScreens.CHANNEL_SELECTOR;
const CHANNEL_SELECTOR2 = EditGuildEventScreens.CHANNEL_SELECTOR;
const r61 = env16421 = {
$parent: r11
};
env16421[0] = CHANNEL_SELECTOR2;
screens[CHANNEL_SELECTOR] = {
title: "",
customNavbar: $mk105770(r61),
headerLeft: () => null,
render: () => <EditGuildEventWhere {...env16420[8]} guildEventId={env16420[2]?.id} />,
fullscreen: true
};
const DETAILS = EditGuildEventScreens.DETAILS;
const DETAILS2 = EditGuildEventScreens.DETAILS;
const r74 = env16422 = {
$parent: r11
};
env16422[0] = DETAILS2;
screens[DETAILS] = {
title: "",
customNavbar: $mk105770(r74),
render: () => <EditGuildEventDetails {...env16420[8]} />,
fullscreen: true
};
const PREVIEW = EditGuildEventScreens.PREVIEW;
const PREVIEW2 = EditGuildEventScreens.PREVIEW;
const r86 = env16423 = {
$parent: r11
};
env16423[0] = PREVIEW2;
screens[PREVIEW] = {
title: "",
customNavbar: $mk105770(r86),
render: () => <EditGuildEventPreview {...env16420[8]} />,
fullscreen: true
};
return (0, jsx)(Navigator, {
screens,
initialRouteName: EditGuildEventScreens.CHANNEL_SELECTOR,
initialRouteStack,
cardShadowEnabled: false,
cardOverlayEnabled: false,
cardStyle: styles.cardStyle
});
});
export default r37;
@@ -0,0 +1,58 @@
// Metro module 8232 (f8233).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { EditGuildEventScreens } from "../../utils/EditGuildEventUtils";
import { assertNever } from "../../../../utils/GlobalUtils";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { HeaderActionButton } from "../../../../design/components/Navigator/native/HeaderActionButton.native";
import Module7699 from "../../../../_bundle/Module7699";
const useStyles = createStyles({
header: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
paddingHorizontal: 4,
paddingVertical: 8
},
headerTitle: {
lineHeight: 28,
textTransform: "uppercase"
},
buttonContainer: {
width: 60
},
rightButton: {
marginLeft: 12
}
});
export default function EditGuildEventModalNavbar(props) {
let r37;
const { screen, onClose } = props;
const styles = useStyles();
if (EditGuildEventScreens.CHANNEL_SELECTOR === screen) {
r37 = [1, 3];
} else if (EditGuildEventScreens.DETAILS === screen) {
r37 = [2, 3];
} else if (EditGuildEventScreens.PREVIEW === screen) {
r37 = [3, 3];
} else {
assertNever(screen);
r37 = void 0;
}
const r39 = _slicedToArray(r37, 2);
return <SafeAreaPaddingView top style={styles.header}>
<View style={styles.buttonContainer} />
<Text style={styles.headerTitle} variant="text-xs/bold" color="text-default">
{intl.format(t["42HaFY"], {
step: r39[0],
total: r39[1]
})}
</Text>
<View style={styles.buttonContainer}>
<HeaderActionButton accessibilityLabel={intl.string(t.cpT0Cq)} onPress={onClose} source={Module7699} style={styles.rightButton} />
</View>
</SafeAreaPaddingView>;
};
@@ -0,0 +1,180 @@
// Metro module 8314 (f8315).
import { Fragment, useMemo } from "react";
import { View } from "react-native";
import ChannelStore from "../../../../stores/ChannelStore";
import { Fonts } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { isAndroid } from "../../../../utils/PlatformUtils";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useChannelName from "../../../channel/useChannelName";
import { getLocationFromEvent } from "../../utils/EntityUtils";
import { getEventLocationIconSource } from "./GuildEventUtils";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import getChannelA11yLabel from "../../../channel/getChannelA11yLabel";
import { Icon, LegacyText } from "../../../../design/void/native";
import { guildEventDetailsParser } from "../../guildEventDetailsParser.native";
import { convertToFakeGuildEvent } from "../../utils/EditGuildEventUtils";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import { GuildEventCardImageHeader, GuildEventCardHeader, GuildEventCardMetaInfo, GuildEventSimpleLocation } from "./GuildEventCardComponents";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { hasScheduleChanges } from "../../utils/ScheduleUtils";
import AlertActionCreators from "../../../../actions/native/AlertActionCreators";
let useStyles;
const PreviewBody = function PreviewBody(props) {
let locationFromEvent, eventLocationIconSource;
const event = props.event;
locationFromEvent = void 0;
eventLocationIconSource = void 0;
const styles = useStyles();
const channel_id = event.channel_id;
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channel_id), [channel_id]);
let r16 = useChannelName(stateFromStores);
const locationFromEvent2 = getLocationFromEvent(event);
if (r16 == null) {
r16 = locationFromEvent2;
}
locationFromEvent = r16;
eventLocationIconSource = getEventLocationIconSource(event, stateFromStores, true);
return <View style={styles.header}>
<Text style={styles.headerTitle} variant="heading-xl/bold" color="mobile-text-heading-primary">
{intl.string(t.yBsFE3)}
</Text>
<Text style={styles.headerSubtitle} accessibilityLabel={stateFromStores != null ? intl.formatToPlainString(t.sxcQPE, {
channelName: getChannelA11yLabel({
channel: stateFromStores
})
}) : void 0} variant="text-sm/medium" color="text-default">
{stateFromStores != null ? intl.format(t.f55NX0, {
channelName: locationFromEvent,
channelHook: function channelHook() {
const children = [<View style={styles.channelContainer}>
{eventLocationIconSource != null && <Icon source={eventLocationIconSource} size={Icon.Sizes.EXTRA_SMALL} style={styles.channelIcon} />}
</View>, ,];
let key = locationFromEvent;
children[1] = <Text accessibilityElementsHidden importantForAccessibility="no" variant="text-sm/medium" color="text-default">
{locationFromEvent != null ? guildEventDetailsParser(locationFromEvent, true) : null}
</Text>;
const props = {
children
};
if (locationFromEvent == null) {
key = "preview-body";
}
return <Fragment key={key} {...props} />;
}
}) : intl.string(t.KDPFi9)}
</Text>
</View>;
};
useStyles = createStyles({
container: {
flex: 1,
padding: 16,
paddingBottom: 0,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
flexDirection: "column",
height: "100%",
overflow: "visible"
},
centered: {
flexDirection: "column",
alignItems: "center",
justifyContent: "center"
},
centerContainer: {
flexGrow: 0,
width: "100%"
},
flex: {
flex: 1,
overflow: "visible"
},
header: {
alignItems: "center",
paddingBottom: 24
},
headerTitle: {
marginTop: 16,
marginBottom: 8
},
headerSubtitle: {
textAlign: "center"
},
eventContainer: {
padding: 16,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
marginBottom: 24,
borderColor: Module712.colors.BORDER_SUBTLE,
borderWidth: 1,
borderRadius: Module712.radii.sm,
shadowOpacity: 0.2,
elevation: 2,
shadowRadius: 16,
shadowOffset: {
height: 8,
width: 0
},
overflow: "visible"
},
channelContainer: {
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
height: 14
},
channelIcon: {
tintColor: Module712.colors.TEXT_SUBTLE,
marginRight: 4,
height: 14,
transform: [{
translateY: isAndroid() ? 2 : 0
}]
},
buttonContainer: {
position: "absolute",
bottom: 16,
left: 0,
right: 0
},
error: {
paddingBottom: 8,
fontSize: 14,
fontFamily: Fonts.PRIMARY_MEDIUM,
color: Module712.unsafe_rawColors.RED_400
}
});
export default function EditGuildEventPreview(props) {
const { guild, initialGuildEvent, guildEvent, isEdit, loading, error, onSave } = props;
const styles2 = useStyles();
const text = isEdit ? intl.string(t.e5VEcE) : intl.string(t["60lJ0C"]);
const memo = useMemo(() => convertToFakeGuildEvent(guildEvent, guild.id), [guildEvent, guild.id]);
return <SafeAreaPaddingView bottom style={styles2.container}>
<View style={[styles2.flex, styles2.centered]}>
<View style={styles2.centerContainer}>
<View style={styles2.eventContainer}>
<GuildEventCardImageHeader event={memo} />
<GuildEventCardHeader event={memo} isPreview />
<GuildEventCardMetaInfo event={memo} />
<GuildEventSimpleLocation event={memo} />
</View>
<PreviewBody event={memo} />
</View>
<View style={styles2.buttonContainer}>
{error != null ? <LegacyText style={styles2.error}>
{error.getAnyErrorMessage()}
</LegacyText> : null}
<Button text={text} variant="primary" onPress={function onPress() {
if (guildEvent.recurrenceRule != null && (isEdit && hasScheduleChanges(initialGuildEvent, guildEvent))) {
AlertActionCreators.openLazy({
importer: () => import("./EditGuildScheduledEventResetWarningAlert").then(({ default: Component }) => (a0) => <Component {...a0} onConfirm={onSave} />)
});
} else {
onSave();
}
}} disabled={loading} loading={loading} />
</View>
</View>
</SafeAreaPaddingView>;
};
@@ -0,0 +1,98 @@
// Metro module 8230 (f8231).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { useState, useEffect } from "react";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useEventException from "../../useEventException";
import { areSchedulesIdentical, getScheduleForRecurrenceWithException, getBaseScheduleForRecurrence } from "../../utils/ScheduleUtils";
import LazyAPIPromise from "../../../../utils/LazyAPIPromise";
import { dismissGlobalKeyboard } from "../../../../utils/native/KeyboardManagerUtils";
import saveGuildEventRecurrence from "../../saveGuildEventRecurrence";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { intl, t } from "../../../../intl/index.native";
import EditGuildEventModalNavbar from "./EditGuildEventModalNavbar";
import { EditGuildEventScreens } from "../../utils/EditGuildEventUtils";
import EditGuildEventStepContainer from "./EditGuildEventStepContainer";
import GuildEventSchedule from "./GuildEventSchedule";
import { Text } from "../../../../design/components/Text/native/Text";
import { Navigator } from "../../../../design/components/Navigator/native/Navigator.native";
const useStyles = createStyles({
cardStyle: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
}
});
let c5234_10 = {
TIME: "TIME"
};
export default function EditGuildEventRecurrenceModal(props) {
let c16401_3, scheduleForRecurrenceWithException, state, setState, state2, setState2, c16401_9, error, handleScheduleChange2, action;
const { guildEvent, onCloseModal, recurrenceId } = props;
c16401_3 = void 0;
scheduleForRecurrenceWithException = void 0;
state = void 0;
setState = void 0;
state2 = void 0;
setState2 = void 0;
c16401_9 = void 0;
error = void 0;
action = void 0;
let _handleSave2 = function _handleSave() {
const r9 = async () => {
let c29928_0;
L15: {
c29928_0 = void 0;
if (areSchedulesIdentical(state, scheduleForRecurrenceWithException)) {
onCloseModal();
break L15;
}
if (await c16401_9() != null) {
(0, onCloseModal)();
}
return void 0;
}
};
_handleSave2 = r9;
return r9.apply(this, arguments);
};
handleScheduleChange2 = function handleScheduleChange({ startDate, endDate }) {
setState({
startDate,
endDate: startDate != null && endDate != null && endDate.isBefore(startDate) ? startDate.clone().add(1, "hour") : endDate
});
setState2(null);
};
const styles = useStyles();
const eventException = useEventException(recurrenceId, guildEvent.id);
c16401_3 = eventException;
scheduleForRecurrenceWithException = getScheduleForRecurrenceWithException(getBaseScheduleForRecurrence(recurrenceId, guildEvent), eventException);
[state, setState] = useState(scheduleForRecurrenceWithException);
[state2, setState2] = useState(null);
const r45 = _slicedToArray(LazyAPIPromise(() => {
dismissGlobalKeyboard();
return saveGuildEventRecurrence(guildEvent, recurrenceId, state, c16401_3);
}), 2);
c16401_9 = r45[0];
error = r45[1].error;
useEffect(() => {
let r7 = error == null ? void 0 : error.getAnyErrorMessage();
if (r7 == null) {
r7 = null;
}
setState2(r7);
}, [error]);
action = <Button size="md" text={intl.string(t["R3BPH+"])} onPress={function handleSave() {
return _handleSave2.apply(this, arguments);
}} disabled={state2 != null} />;
const screens = {};
screens[c5234_10.TIME] = {
title: "",
customNavbar: () => <EditGuildEventModalNavbar screen={EditGuildEventScreens.DETAILS} onClose={onCloseModal} />,
headerLeft: () => null,
render: () => <EditGuildEventStepContainer action={action}>
<GuildEventSchedule guildEvent={guildEvent} recurrenceId={recurrenceId} schedule={state} onChange={handleScheduleChange2} />
{state2 != null ? <Text variant="text-md/normal" color="text-feedback-critical">{state2}</Text> : null}
</EditGuildEventStepContainer>,
fullscreen: true
};
return <Navigator screens={screens} initialRouteName={c5234_10.TIME} cardShadowEnabled={false} cardOverlayEnabled={false} cardStyle={styles.cardStyle} />;
};
@@ -0,0 +1,47 @@
// Metro module 8233 (f8234).
import { forwardRef, useState, useCallback } from "react";
import { ScrollView, View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useSafeAreaInsetsKeyboardAware_native from "../../../safe_area/useSafeAreaInsetsKeyboardAware.native";
const useStyles = createStyles({
container: {
flex: 1,
paddingHorizontal: 0,
paddingVertical: 0,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
flexDirection: "column",
height: "100%"
},
flex: {
flex: 1
},
scroller: {
paddingHorizontal: 16
},
buttonContainer: {
position: "absolute",
bottom: 0,
left: 0,
right: 0,
paddingHorizontal: 16,
paddingVertical: 16,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
}
});
const r44 = forwardRef(function({ children, action }, a1) {
const styles = useStyles();
const [state, setState] = useState(32);
const insets = useSafeAreaInsetsKeyboardAware_native().insets;
return <View style={styles.container}>
<ScrollView ref={a1} automaticallyAdjustContentInsets={false} keyboardShouldPersistTaps="handled" style={[styles.flex, {
marginBottom: state + insets.bottom
}]} contentContainerStyle={styles.scroller}>{children}</ScrollView>
<View style={[styles.buttonContainer, {
paddingBottom: insets.bottom
}]} onLayout={useCallback((a0) => {
setState(a0.nativeEvent.layout.height);
}, [])}>{action}</View>
</View>;
});
export default r44;
@@ -0,0 +1,25 @@
// Metro module 8302 (f8303).
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { Text } from "../../../../design/components/Text/native/Text";
const useStyles = createStyles({
header: {
alignItems: "center",
paddingBottom: 24
},
headerTitle: {
marginTop: 8,
marginBottom: 8
},
headerSubtitle: {
textAlign: "center"
}
});
export default function EditGuildEventStepHeader(props) {
const { title, subtitle } = props;
const styles = useStyles();
return <View style={styles.header}>
<Text style={styles.headerTitle} accessibilityRole="header" variant="heading-xl/semibold" color="mobile-text-heading-primary">{title}</Text>
{subtitle != null ? subtitle !== "" ? <Text style={styles.headerSubtitle} variant="text-sm/medium" color="text-default">{subtitle}</Text> : null : null}
</View>;
};
@@ -0,0 +1,129 @@
// Metro module 8267 (f8268).
import { useRef, useState } from "react";
import ChannelStore from "../../../../stores/ChannelStore";
import PermissionStore from "../../../../stores/PermissionStore";
import { isGuildScheduledEventActive } from "../../GuildScheduledEventStore";
import { AGE_VERIFICATION_STAGE_CHANNEL_TYPES, GuildScheduledEventEntityTypes } from "../../GuildScheduledEventsConstants";
import { GuildSettingsSections, Permissions } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { intl, t } from "../../../../intl/index.native";
import { getChannelTypeFromEntity, getLocationFromEventData } from "../../utils/EntityUtils";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import EditGuildEventChannelSelection from "./EditGuildEventChannelSelection";
import { GuildEventLocation, GuildEventEntityTypeSelection } from "./GuildEventModalComponents";
import { Text } from "../../../../design/components/Text/native/Text";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { dismissGlobalKeyboard } from "../../../../utils/native/KeyboardManagerUtils";
import { EditGuildEventScreens } from "../../utils/EditGuildEventUtils";
import { AccessibilityAnnouncer } from "../../../../_bundle/Module3902";
import EditGuildEventStepContainer from "./EditGuildEventStepContainer";
import EditGuildEventStepHeader from "./EditGuildEventStepHeader";
import Module3771 from "../../../../_bundle/Module3771";
import StageChannelAgeVerificationNoticeForEvent from "../../../stage_channels/native/StageChannelAgeVerificationNoticeForEvent";
import GuildSettingsActionCreators from "../../../guild_settings/GuildSettingsActionCreators";
const useStyles = createStyles({
channelSelection: {
marginTop: 16
},
error: {
paddingVertical: 8
},
text: {
marginTop: 24
}
});
export default function EditGuildEventWhere(props) {
let r68;
let setState, navigation;
const { guild, guildEvent, guildEventId, initialGuildEvent, onChange: onChange2 } = props;
setState = void 0;
navigation = void 0;
const styles = useStyles();
const ref = useRef(null);
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(guildEvent.channelId), [guildEvent.channelId]);
let r41 = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.MANAGE_ROLES, guild), [guild]);
let state;
[state, setState] = useState(null);
navigation = useNavigation();
const isGuildScheduledEventActive2 = isGuildScheduledEventActive(initialGuildEvent);
const r64 = <EditGuildEventChannelSelection guild={guild} channel={stateFromStores} guildEventId={guildEventId} channelType={getChannelTypeFromEntity(guildEvent.entityType)} onChangeChannel={function onChangeChannel(event) {
setState(null);
onChange2({
channelId: event.id
});
}} style={styles.channelSelection} />;
if (guildEvent.entityType === GuildScheduledEventEntityTypes.EXTERNAL) {
let location2 = getLocationFromEventData(guildEvent);
if (location2 == null) {
location2 = "";
}
r68 = <GuildEventLocation location={location2} onChange={function handleChangeEventLocation(event) {
setState(null);
onChange2({
entityMetadata: {
location: event
}
});
}} onFocus={function onFocus() {
setTimeout(() => {
if (ref.current != null) {
ref.current.scrollToEnd();
}
}, 100);
}} />;
} else {
r68 = stateFromStores == null ? null : r64;
}
const action = <>
{state != null ? <Text style={styles.error} variant="text-sm/normal" color="text-feedback-critical">{state}</Text> : null}
<Button text={intl.string(t.PDTjLN)} variant="primary" onPress={function onPress() {
dismissGlobalKeyboard();
try {
setState(null);
(function assertGuildEventWhereIsValid(a0) {
const { entityType, channelId } = a0;
if (entityType === GuildScheduledEventEntityTypes.NONE) {
throw new Error(intl.string(t.C4KzmQ));
}
if (entityType === GuildScheduledEventEntityTypes.EXTERNAL && getLocationFromEventData(a0) == null) {
throw new Error(intl.string(t.q91szp));
}
if (channelId == null && entityType !== GuildScheduledEventEntityTypes.EXTERNAL) {
throw new Error(intl.string(t["4LQwnw"]));
}
})(guildEvent);
navigation.push(EditGuildEventScreens.DETAILS);
} catch (r24) {
setState(r24.message);
AccessibilityAnnouncer.announce(r24.message);
}
}} disabled={state != null} />
</>;
const r127 = [<EditGuildEventStepHeader title={intl.string(t["DC+Qm8"])} subtitle={intl.string(t.IwmXLP)} />, <GuildEventEntityTypeSelection guild={guild} entityType={guildEvent.entityType} onChange={function onChange(event) {
setState(null);
const r10 = {
entityType: event,
scheduledEndTime: void 0
};
if (event === GuildScheduledEventEntityTypes.EXTERNAL) {
let r17 = Module3771(guildEvent.scheduledStartTime);
if (r17 == null) {
r17 = Module3771();
}
r10.scheduledEndTime = r17.add(1, "hour").toISOString();
}
onChange2(r10);
}} disabled={isGuildScheduledEventActive2} />, r68, AGE_VERIFICATION_STAGE_CHANNEL_TYPES.has(guildEvent.entityType) && <StageChannelAgeVerificationNoticeForEvent />, ,];
if (r41) {
r41 = <Text style={styles.text} variant="text-sm/normal" color="text-default">
{intl.format(t["K+DH2o"], {
onClick: () => {
GuildSettingsActionCreators.open(guild.id, GuildSettingsSections.ROLES);
}
})}
</Text>;
}
r127[4] = r41;
return <EditGuildEventStepContainer action={action} ref={ref}>{r127}</EditGuildEventStepContainer>;
};
@@ -0,0 +1,6 @@
// Metro module 8318 (f8319).
import Alert from "../../../../components_native/common/Alert";
import { intl, t } from "../../../../intl/index.native";
export default function EditGuildScheduledEventResetWarningAlert(props) {
return <Alert onClose={props.onClose} onConfirm={props.onConfirm} title={intl.string(t.aNCYas)} body={intl.format(t.RWBa5X, {})} confirmText={intl.string(t["cY+Oob"])} confirmColor={Alert.Colors.GREEN} cancelText={intl.string(t["ETE/oC"])} />;
};
@@ -0,0 +1,73 @@
// Metro module 12279 (f12280).
import { View } from "react-native";
import { EXPLICIT_END_EVENT_SHEET_KEY } from "../../GuildScheduledEventsConstants";
import { Fonts } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useActiveEvent } from "../../useGuildScheduledEvents";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { handleDisconnect } from "../../../voice_calls/native/CallsUtils";
import ScrollHandlingActionSheet from "../../../stage_channels/native/components/ScrollHandlingActionSheet";
import { LegacyText } from "../../../../design/void/native";
import { intl, t } from "../../../../intl/index.native";
import { Text } from "../../../../design/components/Text/native/Text";
import { Button } from "../../../../design/components/Button/native/Button.native";
import GuildScheduledEventsActionCreators from "../../GuildScheduledEventsActionCreators";
const useStyles = createStyles({
container: {
paddingVertical: 24,
paddingHorizontal: 16,
alignItems: "center"
},
title: {
fontSize: 24,
fontFamily: Fonts.PRIMARY_BOLD,
textAlign: "center",
color: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY
},
subtitle: {
marginTop: 8,
textAlign: "center"
},
cancelButtonContainer: {
marginTop: 24,
alignSelf: "stretch"
},
confirmButtonContainer: {
marginTop: 8,
alignSelf: "stretch"
}
});
export default function EndEventActionSheet(props) {
const channel = props.channel;
const styles = useStyles();
const activeEvent = useActiveEvent(channel.id);
if (activeEvent == null) {
return null;
}
return <ScrollHandlingActionSheet>
<View style={styles.container}>
<LegacyText style={styles.title} accessibilityRole="header">
{intl.string(t["4Ao8LC"])}
</LegacyText>
<Text style={styles.subtitle} variant="text-md/medium" color="text-default">
{intl.string(t["0I0B8f"])}
</Text>
<View style={styles.cancelButtonContainer}>
<Button text={intl.string(t.P60OAX)} grow onPress={function handleClose() {
ActionSheetActionCreators.hideActionSheet(EXPLICIT_END_EVENT_SHEET_KEY);
handleDisconnect(channel);
}} />
</View>
<View style={styles.confirmButtonContainer}>
<Button text={intl.string(t.mjB9pd)} variant="destructive" grow onPress={function onPress() {
if (activeEvent != null) {
GuildScheduledEventsActionCreators.endEvent(activeEvent.id, activeEvent.guild_id);
ActionSheetActionCreators.hideActionSheet(EXPLICIT_END_EVENT_SHEET_KEY);
handleDisconnect(channel);
}
}} />
</View>
</View>
</ScrollHandlingActionSheet>;
};
@@ -0,0 +1,52 @@
// Metro module 8329 (f8330).
import { memo } from "react";
import { View } from "react-native";
import RTCConnectionStore from "../../../../stores/RTCConnectionStore";
import { isGuildScheduledEventActive } from "../../GuildScheduledEventStore";
import { AGE_VERIFICATION_STAGE_CHANNEL_TYPES } from "../../GuildScheduledEventsConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { GuildEventCardPrimaryAction, usePrimaryActionButtonType, PrimaryActionType, GuildEventCardRSVPAction, GuildEventShareAction, GuildEventCardHeader, GuildEventCardMetaInfo, GuildEventSimpleLocation } from "./GuildEventCardComponents";
import { ButtonGroup } from "../../../../design/components/ButtonGroup/native/ButtonGroup.native";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { recurrenceRuleFromServer } from "../../utils/EditGuildEventUtils";
import { Card } from "../../../../design/components/Card/native/Card.native";
import StageChannelAgeVerificationNotice from "../../../stage_channels/native/StageChannelAgeVerificationNotice";
import GuildEventRecurrences from "./GuildEventRecurrences";
let useStyles;
const GuildEventCardControls = function GuildEventCardControls(props) {
const { event: event2, isConnected, onCloseAction } = props;
return <ButtonGroup direction="horizontal" style={useStyles().actionContainer}>
<GuildEventCardPrimaryAction event={event2} onCloseAction={onCloseAction} isConnected={isConnected} />
{usePrimaryActionButtonType(event2, isConnected) === PrimaryActionType.START && <GuildEventCardRSVPAction event={event2} />}
<GuildEventShareAction event={event2} />
</ButtonGroup>;
};
useStyles = createStyles({
actionContainer: {
paddingTop: Module712.space.PX_16,
paddingBottom: 0
}
});
const r43 = memo(function({ event, onPress, onCloseAction, hideControls = false, hideAgeVerificationNotice = false, isNew = false }) {
const channel_id = event.channel_id;
const isConnected = useStateFromStores([RTCConnectionStore], () => RTCConnectionStore.isConnected() && RTCConnectionStore.getChannelId() === channel_id, [channel_id]) && isGuildScheduledEventActive(event);
const handlePress = function handlePress() {
if (onPress != null) {
onPress(event);
}
};
const recurrenceRule = recurrenceRuleFromServer(event.recurrence_rule);
return <Card accessible={false} onPress={handlePress}>
<View>
<GuildEventCardHeader event={event} isNew={isNew} />
<GuildEventCardMetaInfo event={event} onTitlePress={handlePress} />
{(hideAgeVerificationNotice ? !hideAgeVerificationNotice : AGE_VERIFICATION_STAGE_CHANNEL_TYPES.has(event.entity_type)) && <StageChannelAgeVerificationNotice noBackground onConfirmPress={onCloseAction} channelId={channel_id} />}
<GuildEventSimpleLocation event={event} />
{hideControls ? null : <GuildEventCardControls event={event} onCloseAction={onCloseAction} isConnected={isConnected} />}
{recurrenceRule != null && <GuildEventRecurrences guildId={event.guild_id} recurrenceRule={recurrenceRule} guildEventId={event.id} onRecurrencePress={(a0) => onPress == null ? void 0 : onPress(event, a0)} />}
</View>
</Card>;
});
export default r43;
export { useStyles as useGuildEventCardStyles };
@@ -0,0 +1,678 @@
// Metro module 8225 (f8226).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import * as Module19 from "react";
import { useMemo, useState, useCallback } from "react";
import { Pressable, View, Image } from "react-native";
import AuthenticationStore from "../../../../stores/AuthenticationStore";
import ChannelStore from "../../../../stores/ChannelStore";
import GuildMemberStore from "../../../../stores/GuildMemberStore";
import GuildStore from "../../../../stores/GuildStore";
import PermissionStore from "../../../../stores/PermissionStore";
import UserStore from "../../../../stores/UserStore";
import GuildScheduledEventStore, { isGuildEventEnded, isGuildScheduledEventActive } from "../../GuildScheduledEventStore";
import { GuildScheduledEventEntityTypes } from "../../GuildScheduledEventsConstants";
import { JoinGuildSources, Permissions } from "../../../../Constants";
import { Fonts, NOOP } from "../../../../_bundle/Module505";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useCanInviteForGuildEvent from "../../useCanInviteForGuildEvent";
import { SHARE_EVENT_DETAILS_LINK } from "../../utils/ShareEventUtils";
import { IconButton } from "../../../../design/components/Button/native/IconButton.native";
import { intl, t } from "../../../../intl/index.native";
import { openStartGuildEventModal, openShareEvent, showGuildEventModeratorActionSheet } from "../GuildScheduledEventModalActionCreators";
import { copy } from "../../../../utils/ClipboardUtils.native";
import { presentLinkCopied } from "../../../toast/native/ToastUtils";
import Module12238 from "../../../../_bundle/Module12238";
import Module4134 from "../../../../_bundle/Module4134";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useManageResourcePermissions } from "../../../permissions/useManageResourcePermissions";
import Module8964 from "../../../../_bundle/Module8964";
import { CheckmarkLargeIcon } from "../../../../design/components/Icon/native/redesign/generated/CheckmarkLargeIcon";
import { BellIcon } from "../../../../design/components/Icon/native/redesign/generated/BellIcon";
import ThrottledButton from "./ThrottledButton";
import { getEventTimeData } from "../../utils/ScheduleUtils";
import GuildActionCreators from "../../../../actions/GuildActionCreators";
import { transitionToGuild } from "../../../routing/transitionToGuild.native";
import useSelectStage from "../../useSelectStage";
import AlertActionCreators from "../../../../actions/native/AlertActionCreators";
import GuildScheduledEventsActionCreators from "../../GuildScheduledEventsActionCreators";
import Alert from "../../../../components_native/common/Alert";
import { openGuildVoiceModal } from "../../../../utils/native/PrivateChannelCallUtils";
import { assertNever } from "../../../../utils/GlobalUtils";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import { makeSource } from "../../../../utils/AvatarUtils";
import getGuildEventImage from "../../utils/getGuildEventImage";
import useGuildScheduledEventUserCount from "../../useGuildScheduledEventUserCount";
import { IconPill, NewTag, Avatar, AvatarSizes, Icon } from "../../../../design/void/native";
import { GroupIcon } from "../../../../design/components/Icon/native/redesign/generated/GroupIcon";
import useTheme from "../../../../hooks/useTheme";
import useEventException from "../../useEventException";
import useEventSchedule from "../../useEventSchedule";
import { getGuildScheduledEventHeaderProps } from "../GuildScheduledEventHeaderUtils";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { Text } from "../../../../design/components/Text/native/Text";
import { CalendarIcon } from "../../../../design/components/Icon/native/redesign/generated/CalendarIcon";
import { guildEventDetailsParser } from "../../guildEventDetailsParser.native";
import useChannelName from "../../../channel/useChannelName";
import { getLocationFromEvent } from "../../utils/EntityUtils";
import { getEventLocationIconComponent, getEventLocationIconSource } from "./GuildEventUtils";
import getChannelA11yLabel from "../../../channel/getChannelA11yLabel";
import GuildIcon, { GuildIconSizes } from "../../../guild/native/GuildIcon";
function $mk80145($env) {
return () => {
const r0 = $env;
return $env.$parent[17].isInterestedInEventRecurrence(r0[0].id, r0[1]);
};
}
function $mk80146($env) {
return function() {
const r2 = $env;
const r1 = $env.$parent;
const r5 = (0, r1[0])(r1[2][21]);
const r8 = r2[0];
r5.handleGuildScheduledEventRsvp(r8.id, r2[1], r8.guild_id);
};
}
let GuildEventCardRSVPAction, GuildEventJoinAndRSVPAction, UserCountIconPill, GuildEventCardTitle, GuildEventCardDescription, useStyles, c5230_26;
let env5230 = {};
export function usePrimaryActionButtonType(a0, a1) {
let r45, r57, ENDED;
const { guild_id, channel_id, scheduled_start_time, entity_type } = a0;
const withinStartWindow = useMemo(() => getEventTimeData(scheduled_start_time), [scheduled_start_time]).withinStartWindow;
const stateFromStores4 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guild_id));
let r31 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channel_id), [channel_id]);
if (r31 == null) {
r31 = stateFromStores4;
}
const r37 = (0, useManageResourcePermissions(r31).canManageGuildEvent)(a0);
if (useStateFromStores([GuildStore], () => GuildStore.getGuild(a0.guild_id) != null)) {
L26: {
if ((0, isGuildEventEnded)(a0)) {
ENDED = c5230_26.ENDED;
} else if ((0, isGuildScheduledEventActive)(a0)) {
if (entity_type === GuildScheduledEventEntityTypes.EXTERNAL) {
r57 = r37 ? c5230_26.END : c5230_26.STARTED;
} else {
r57 = a1 ? r37 ? c5230_26.END : c5230_26.CONNECTED : c5230_26.JOIN;
}
ENDED = r57;
} else {
if (withinStartWindow && r37) {
ENDED = c5230_26.START;
break L26;
}
ENDED = c5230_26.RSVP;
}
}
r45 = ENDED;
} else {
r45 = c5230_26.JOIN_GUILD;
}
return r45;
}
GuildEventCardRSVPAction = function GuildEventCardRSVPAction(props) {
let env16384;
const { event: event6, recurrenceId: recurrenceId3 } = props;
const r15 = env16384 = {
$parent: env5230
};
env16384[0] = event6;
env16384[1] = recurrenceId3;
const r7 = [GuildScheduledEventStore];
const r17 = [event6.id, recurrenceId3];
const [checked, onPress2] = [useStateFromStores(r7, $mk80145(r15), r17), $mk80146(r15)];
const variant = checked ? "tertiary" : "secondary";
const Component = checked ? CheckmarkLargeIcon : BellIcon;
return <ThrottledButton accessibilityRole="togglebutton" accessibilityState={{
checked
}} accessibilityLabel={`${intl.string(t.DlcqlU)}, ${event6.name}`} variant={variant} icon={<Component size="sm" />} text={intl.string(t.DlcqlU)} onPress={onPress2} grow />;
};
GuildEventJoinAndRSVPAction = function GuildEventJoinAndRSVPAction(props) {
let c16385_1, c16385_2, setState;
let env16386;
const { event, recurrenceId: recurrenceId3 } = props;
c16385_1 = void 0;
c16385_2 = void 0;
setState = void 0;
let _handleJoinGuild2 = function _handleJoinGuild() {
const r9 = async () => {
let c29926_2;
let c29926_3 = 0;
try {
setState(true);
c29926_3 = 1;
await GuildActionCreators.joinGuild(event.guild_id, {
source: JoinGuildSources.DIRECTORY_EVENTS
});
transitionToGuild(event.guild_id);
if (!(c16385_1 || (0, isGuildScheduledEventActive)(event))) {
(0, c16385_2)();
}
c29926_3 = 0;
(0, setState)(false);
} catch ($e) {
const r27 = $e;
let r7 = r27;
c29926_2 = r27;
if (c29926_3 !== 0) {
while (true) {
try {
const r84 = c29926_2;
c29926_3 = 0;
(0, setState)(false);
throw r84;
} catch (r81) {
r7 = r81;
c29926_2 = r81;
if (c29926_3 === 0) {
break;
}
}
}
}
throw r7;
}
};
_handleJoinGuild2 = r9;
return r9.apply(this, arguments);
};
const r16 = env16386 = {
$parent: env5230
};
env16386[0] = event;
env16386[1] = recurrenceId3;
const r10 = [GuildScheduledEventStore];
const r18 = [event.id, recurrenceId3];
[c16385_1, c16385_2] = [useStateFromStores(r10, $mk80145(r16), r18), $mk80146(r16)];
let loading;
[loading, setState] = useState(false);
return <ThrottledButton loading={loading} variant="active" text={intl.string(t.VJlc0S)} accessibilityLabel={`${intl.string(t.VJlc0S)}, ${event.name}`} onPress={function handleJoinGuild() {
return _handleJoinGuild2.apply(this, arguments);
}} grow />;
};
UserCountIconPill = function UserCountIconPill(props) {
const event6 = props.event;
const guildScheduledEventUserCount = useGuildScheduledEventUserCount(event6?.guild_id, event6?.id, props.recurrenceId);
return <IconPill accessibilityLabel={`${intl.formatToPlainString(t["+DLsD8"], {
count: guildScheduledEventUserCount
})}, ${event6.name}`} IconComponent={GroupIcon} text={guildScheduledEventUserCount.toLocaleString()} />;
};
GuildEventCardTitle = function GuildEventCardTitle(props) {
const { event: event6, style, textStyle, condensed, onPress: onPress2 } = props;
const styles = useStyles();
return <Pressable accessibilityRole="button" accessibilityHint={intl.string(t.epxpiy)} accessibilityLabel={event6.name} onPress={onPress2} style={[styles.topicContainer, style]}>
<Text variant="text-md/bold" color="mobile-text-heading-primary" style={textStyle} lineClamp={condensed ? 1 : void 0}>{event6.name}</Text>
</Pressable>;
};
GuildEventCardDescription = function GuildEventCardDescription(props) {
const event6 = props.event;
const { description, guild_id: guild_id5 } = event6;
const { style, textStyle, numberOfLines, condensed } = props;
const styles = useStyles();
return description != null ? description.length > 0 ? condensed ? null : description != null ? <View style={[styles.detailsContainer, style]}>
<Text variant="text-md/medium" color="text-subtle" style={textStyle} lineClamp={numberOfLines}>
{guildEventDetailsParser(description, true, {
guildId: guild_id5,
allowLinks: true,
allowHeading: true,
allowList: true
})}
</Text>
</View> : null : null : null;
};
const useStyles2 = createStyles({
imageHeaderContainer: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
},
imageHeaderBanner: {
width: "100%",
aspectRatio: 2.5
},
headerContainer: {
flexDirection: "row",
alignItems: "center"
},
dateContainer: {
flexDirection: "row",
alignItems: "center",
flex: 1
},
dateIcon: {
marginRight: Module712.space.PX_8
},
newBadge: {
paddingHorizontal: 4,
paddingVertical: 2,
marginEnd: 8,
backgroundColor: Module712.colors.BACKGROUND_BRAND
},
topicContainer: {
paddingTop: Module712.space.PX_8
},
detailsContainer: {
paddingTop: Module712.space.PX_8
},
channelContainer: {
flexDirection: "row",
alignItems: "center",
paddingTop: Module712.space.PX_8
},
channelIcon: {
marginRight: Module712.space.PX_8
},
channelText: {
fontFamily: Fonts.PRIMARY_MEDIUM,
color: Module712.colors.TEXT_SUBTLE,
fontSize: 14,
lineHeight: 18,
flexShrink: 1
},
guildInfoContainer: {
flexDirection: "row",
alignItems: "center",
paddingTop: Module712.space.PX_8
},
guildIcon: {
marginRight: Module712.space.PX_8,
borderRadius: Module712.radii.sm
},
guildInfo: {
flexDirection: "column"
},
guildInfoChannelContainer: {
flexDirection: "row",
alignItems: "center"
},
guildInfoChannelText: {
fontFamily: Fonts.PRIMARY_MEDIUM,
color: Module712.colors.TEXT_SUBTLE,
fontSize: 12,
lineHeight: 16
},
creatorAvatar: {
marginRight: Module712.space.PX_8
}
});
useStyles = useStyles2;
c5230_26 = {
RSVP: 0,
0: "RSVP",
JOIN: 1,
1: "JOIN",
START: 2,
2: "START",
STARTED: 3,
3: "STARTED",
CONNECTED: 4,
4: "CONNECTED",
END: 5,
5: "END",
ENDED: 6,
6: "ENDED",
JOIN_GUILD: 7,
7: "JOIN_GUILD"
};
const r159 = Module19.memo(function GuildEventCardPrimaryAction(props) {
let c16387_6;
const { event: event2, isConnected, onCloseAction, recurrenceId } = props;
c16387_6 = void 0;
const { guild_id: guild_id2, channel_id: channel_id2 } = event2;
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channel_id2), [channel_id2]);
c16387_6 = _slicedToArray(useSelectStage(), 2)[1];
const primaryActionButtonType = usePrimaryActionButtonType(event2, isConnected);
const stateFromStores4 = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.CONNECT, stateFromStores));
if (c5230_26.ENDED === primaryActionButtonType) {
return <ThrottledButton variant="secondary" text={intl.string(t.Pj7Xrv)} accessibilityLabel={`${intl.string(t.Pj7Xrv)}, ${event2.name}`} grow disabled onPress={NOOP} />;
}
const handleListenIn = function handleListenIn() {
if (stateFromStores != null) {
if (event2.entity_type === GuildScheduledEventEntityTypes.STAGE_INSTANCE) {
c16387_6(guild_id2, stateFromStores.id);
}
openGuildVoiceModal(stateFromStores);
if (onCloseAction != null) {
onCloseAction();
}
}
};
if (c5230_26.JOIN === primaryActionButtonType) {
const text = stateFromStores4 ? intl.string(t.ZYO5OK) : intl.string(t.TVBCKZ);
return <ThrottledButton variant="active" text={text} accessibilityLabel={`${text}, ${event2.name}`} onPress={handleListenIn} disabled={!stateFromStores4} grow />;
}
if (c5230_26.CONNECTED === primaryActionButtonType) {
return <ThrottledButton variant="active" text={intl.string(t.aW2YlJ)} accessibilityLabel={`${intl.string(t.aW2YlJ)}, ${event2.name}`} onPress={handleListenIn} grow />;
}
if (c5230_26.RSVP === primaryActionButtonType) {
return (0, jsx)(GuildEventCardRSVPAction, {
event: event2,
recurrenceId
});
}
if (c5230_26.START === primaryActionButtonType) {
return <ThrottledButton variant="active" text={intl.string(t.cK1GGY)} accessibilityLabel={`${intl.string(t.cK1GGY)}, ${event2.name}`} onPress={function handleStartEvent() {
if (onCloseAction != null) {
onCloseAction();
}
openStartGuildEventModal(event2, recurrenceId);
}} grow />;
}
if (c5230_26.STARTED === primaryActionButtonType) {
return <ThrottledButton variant="secondary" text={intl.string(t.Yz0V6O)} accessibilityLabel={`${intl.string(t.Yz0V6O)}, ${event2.name}`} grow disabled onPress={NOOP} />;
}
if (c5230_26.END === primaryActionButtonType) {
return <ThrottledButton variant="secondary" text={intl.string(t.qaYzPA)} accessibilityLabel={`${intl.string(t.qaYzPA)}, ${event2.name}`} onPress={function handleEndEvent() {
AlertActionCreators.show({
title: intl.string(t.qaYzPA),
body: intl.string(t.bnDQ7E),
cancelText: intl.string(t.gm1Vej),
confirmText: intl.string(t.p89ACt),
onConfirm: () => GuildScheduledEventsActionCreators.endEvent(event2.id, event2.guild_id),
confirmColor: Alert.Colors.RED
});
}} grow />;
}
if (c5230_26.JOIN_GUILD === primaryActionButtonType) {
return (0, jsx)(GuildEventJoinAndRSVPAction, {
event: event2,
recurrenceId
});
}
assertNever(primaryActionButtonType);
});
export { useStyles2 as useGuildEventCardStyles };
export function GuildEventShareAction(props) {
const event3 = props.event;
const canInviteForGuildEvent = useCanInviteForGuildEvent(event3);
let c16388_1 = canInviteForGuildEvent;
let c16388_2 = SHARE_EVENT_DETAILS_LINK({
guildId: event3.guild_id,
guildEventId: event3.id
});
return <IconButton accessibilityLabel={`${intl.string(t.RDE0Sc)}, ${event3.name}`} onPress={function onPress() {
if (c16388_1) {
openShareEvent(event3);
} else {
copy(c16388_2);
presentLinkCopied();
}
}} icon={canInviteForGuildEvent ? Module12238 : Module4134} variant="secondary" />;
}
export function GuildEventModeratorAction(props) {
let canManageGuildEvent;
const { event: event4, recurrenceId: recurrenceId2 } = props;
canManageGuildEvent = void 0;
const channel_id3 = event4.channel_id;
const stateFromStores4 = useStateFromStores([GuildStore], () => GuildStore.getGuild(event4.guild_id));
let r24 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channel_id3), [channel_id3]);
if (r24 == null) {
r24 = stateFromStores4;
}
canManageGuildEvent = (0, useManageResourcePermissions(r24).canManageGuildEvent)(event4);
return <IconButton accessibilityLabel={`${intl.string(t.HIgA5a)}, ${event4.name}`} onPress={() => showGuildEventModeratorActionSheet(event4, canManageGuildEvent, recurrenceId2)} icon={Module8964} variant="secondary" />;
}
export function useEventRsvpState(a0, a1) {
let env16382;
const r2 = env16382 = {
$parent: env5230
};
env16382[0] = a0;
env16382[1] = a1;
const r11 = [GuildScheduledEventStore];
const r13 = [a0.id, a1];
return [useStateFromStores(r11, $mk80145(r2), r13), $mk80146(r2)];
}
export function GuildEventIndicateInterestAction(props) {
let env16390;
const event6 = props.event;
const r16 = env16390 = {
$parent: env5230
};
env16390[0] = event6;
env16390[1] = null;
const r8 = [GuildScheduledEventStore];
const r6 = [event6.id, null];
const [checked, onPress2] = [useStateFromStores(r8, $mk80145(r16), r6), $mk80146(r16)];
const variant = checked ? "tertiary" : "secondary";
const Component = checked ? CheckmarkLargeIcon : BellIcon;
return <ThrottledButton accessibilityRole="togglebutton" accessibilityState={{
checked
}} accessibilityLabel={`${intl.string(t.DlcqlU)}, ${event6.name}`} variant={variant} icon={<Component size="sm" />} text={intl.string(t.DlcqlU)} onPress={onPress2} grow />;
}
export { c5230_26 as PrimaryActionType };
export { GuildEventCardRSVPAction };
export { GuildEventJoinAndRSVPAction };
export { r159 as GuildEventCardPrimaryAction };
export function GuildEventCardImageHeader(props) {
const event6 = props.event;
const styles = useStyles();
let width2 = useWindowDimensions_native().width;
const [state, setState2] = useState(0);
const callback = useCallback(({ nativeEvent }) => {
const width = nativeEvent.layout.width;
if (width > 0) {
setState2((prevState2) => {
const r5 = Math;
let r7 = width;
if (r5.abs(prevState2 - width) < 1) {
r7 = prevState2;
}
return r7;
});
}
}, []);
if (event6.image == null) {
return null;
}
if (state > 0) {
width2 = state;
}
return <View style={styles.imageHeaderContainer} onLayout={callback}>
<Image style={styles.imageHeaderBanner} source={makeSource(getGuildEventImage(event6, width2))} resizeMode="cover" />
</View>;
}
export { UserCountIconPill };
export function GuildEventCardHeader(props) {
let r104, r118, jsx2;
let color, shouldChangeTextColor;
const { event: event5, recurrenceId: recurrenceId3, showUserCount = true, showEndDate = false, isPreview = false } = props;
let showCreator = props.showCreator;
if (showCreator === void 0) {
showCreator = true;
}
const { isNew = false, isActive = false, style } = props;
color = void 0;
shouldChangeTextColor = void 0;
const styles = useStyles();
const theme = useTheme();
let r30 = useEventException(recurrenceId3, event5?.id);
const entity_type = event5.entity_type;
if (r30 == null) {
r30 = {};
}
const is_canceled = r30.is_canceled;
const isCanceled = is_canceled !== void 0 && is_canceled;
const eventSchedule = useEventSchedule(event5, recurrenceId3);
const r19 = eventSchedule == null ? void 0 : eventSchedule.startTime.toISOString();
let c16392_1 = r19;
let r38 = void 0;
if (showEndDate) {
const r39 = eventSchedule == null;
let r40 = void 0;
if (!r39) {
const endTime = eventSchedule.endTime;
r40 = endTime == null ? void 0 : endTime.toISOString();
}
r38 = r40;
}
let c16392_2 = r38;
const memo = useMemo(() => getEventTimeData(c16392_1, c16392_2), [r19, r38]);
const guildScheduledEventHeaderProps = getGuildScheduledEventHeaderProps({
eventTimeData: memo,
isStage: entity_type === GuildScheduledEventEntityTypes.STAGE_INSTANCE,
theme,
event: event5,
isCanceled,
recurrenceId: recurrenceId3
});
color = guildScheduledEventHeaderProps.color;
const text = guildScheduledEventHeaderProps.text;
let shouldChangeTextColor2 = guildScheduledEventHeaderProps.shouldChangeTextColor;
shouldChangeTextColor = shouldChangeTextColor2;
const endDateTimeString = memo.endDateTimeString;
let r61 = null;
if (showUserCount) {
const r65 = <UserCountIconPill event={event5} recurrenceId={recurrenceId3} />;
r61 = isPreview ? r65 : <PressableOpacity accessibilityRole="button" onPress={function handleOpenRSVPList() {}}>{r65}</PressableOpacity>;
}
const stateFromStores4 = useStateFromStores([UserStore], () => UserStore.getUser(event5.creator_id), [event5]);
const r80 = endDateTimeString != null && endDateTimeString !== "";
const children = r80 ? intl.format(t.vHYgJW, {
start: text,
startHook: function startHook(a0) {
let style = shouldChangeTextColor;
if (shouldChangeTextColor) {
style = {
color
};
}
return <Text variant="text-sm/semibold" color="text-subtle" style={style}>
{a0}
</Text>;
},
end: endDateTimeString
}) : text;
if (isNew) {
r104 = <NewTag containerStyle={styles.newBadge} variant="text-xs/bold" />;
jsx2 = jsx;
} else {
r104 = <CalendarIcon size="sm" color={color} style={styles.dateIcon} />;
jsx2 = jsx;
}
const r111 = [r104, , , ,];
if (r80) {
r118 = {
variant: "text-sm/semibold",
color: "text-default",
children
};
} else {
const color2 = isActive ? "text-strong" : "text-subtle";
if (shouldChangeTextColor) {
shouldChangeTextColor2 = {
color
};
}
r118 = {
variant: "text-sm/semibold",
color: color2,
style: shouldChangeTextColor2,
children
};
}
r111[1] = jsx2(View, {
style: styles.dateContainer,
children: jsx2(Text, r118)
});
if (showCreator) {
showCreator = stateFromStores4 != null;
}
if (showCreator) {
showCreator = jsx2(Avatar, {
accessible: true,
accessibilityLabel: `${intl.formatToPlainString(t["+3iypQ"], {
username: stateFromStores4.username
})}, ${event5.name}`,
user: stateFromStores4,
guildId: event5.guild_id,
size: AvatarSizes.XSMALL_20,
style: styles.creatorAvatar
});
}
r111[2] = showCreator;
r111[3] = r61;
return <View style={[styles.headerContainer, style]}>{r111}</View>;
}
export { GuildEventCardTitle };
export { GuildEventCardDescription };
export function GuildEventCardMetaInfo(props) {
const { event: event6, titleStyle, titleContainerStyle, onTitlePress, descriptionStyle, descriptionContainerStyle, condensed } = props;
return <>
<GuildEventCardTitle event={event6} textStyle={titleStyle} style={titleContainerStyle} condensed={condensed} onPress={onTitlePress} />
<GuildEventCardDescription event={event6} textStyle={descriptionStyle} style={descriptionContainerStyle} condensed={condensed} numberOfLines={3} />
</>;
}
export function GuildEventSimpleLocation(props) {
const event6 = props.event;
const styles = useStyles();
const { channel_id: channel_id4, guild_id: guild_id5 } = event6;
const stateFromStores2 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channel_id4), [channel_id4]);
const stateFromStores4 = useStateFromStores([GuildMemberStore, AuthenticationStore], () => GuildMemberStore.isMember(stateFromStores2?.guild_id, AuthenticationStore.getId()), [stateFromStores2]);
const channelName = useChannelName(stateFromStores2);
const locationFromEvent = getLocationFromEvent(event6);
if (stateFromStores2 == null && locationFromEvent == null) {
return null;
}
let r14 = channelName;
if (r14 == null) {
r14 = locationFromEvent;
}
const eventLocationIconComponent = getEventLocationIconComponent(event6, stateFromStores2, stateFromStores4);
return <View style={styles.channelContainer}>
{eventLocationIconComponent != null && (0, jsx)(eventLocationIconComponent, {
size: "sm",
style: styles.channelIcon
})}
<Text style={styles.channelText} accessibilityLabel={stateFromStores2 != null ? getChannelA11yLabel({
channel: stateFromStores2
}) : locationFromEvent != null ? `${intl.string(t.gwSn4I)}, ${locationFromEvent}` : void 0} variant="text-sm/medium" color="text-default">
{r14 != null ? guildEventDetailsParser(r14, true, {
guildId: guild_id5
}) : null}
</Text>
</View>;
}
export function GuildEventCardSimpleGuildInfo(props) {
const { event: event6, style, textStyle } = props;
const styles = useStyles();
const guild_id3 = event6.guild_id;
const stateFromStores4 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guild_id3), [guild_id3]);
return stateFromStores4 != null ? <View style={[styles.guildInfoContainer, style]}>
<GuildIcon guild={stateFromStores4} size={GuildIconSizes.XSMALL_20} style={styles.guildIcon} />
<View style={styles.guildInfo}>
<Text variant="text-sm/semibold" style={textStyle}>{stateFromStores4.name}</Text>
</View>
</View> : null;
}
export function GuildEventCardGuildInfo(props) {
const event6 = props.event;
const styles = useStyles();
const { channel_id: channel_id5, guild_id: guild_id4 } = event6;
const stateFromStores3 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channel_id5), [channel_id5]);
const stateFromStores4 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guild_id4), [guild_id4]);
const stateFromStores5 = useStateFromStores([GuildMemberStore, AuthenticationStore], () => GuildMemberStore.isMember(stateFromStores3?.guild_id, AuthenticationStore.getId()), [stateFromStores3]);
const channelName = useChannelName(stateFromStores3);
if (stateFromStores4 == null) {
return null;
}
const locationFromEvent = getLocationFromEvent(event6);
let r53 = stateFromStores3 != null || locationFromEvent != null;
let r15 = channelName;
if (r15 == null) {
r15 = locationFromEvent;
}
const eventLocationIconSource = getEventLocationIconSource(event6, stateFromStores3, stateFromStores5);
const r70 = [<GuildIcon guild={stateFromStores4} size={GuildIconSizes.SMALL} style={styles.guildIcon} />, ,];
const r79 = [<Text variant="text-sm/medium" color="mobile-text-heading-primary">{stateFromStores4.name}</Text>, ,];
if (r53) {
r53 = <View style={styles.guildInfoChannelContainer} accessible accessibilityLabel={stateFromStores3 != null ? getChannelA11yLabel({
channel: stateFromStores3
}) : locationFromEvent != null ? `${intl.string(t.gwSn4I)}, ${locationFromEvent}` : void 0}>
{eventLocationIconSource != null && <Icon source={eventLocationIconSource} size={Icon.Sizes.EXTRA_SMALL} style={styles.channelIcon} disableColor />}
<Text style={styles.guildInfoChannelText} variant="text-xs/medium" color="text-default">{r15}</Text>
</View>;
}
r79[1] = r53;
r70[1] = <View style={styles.guildInfo}>{r79}</View>;
return <View style={styles.guildInfoContainer}>{r70}</View>;
}
@@ -0,0 +1,259 @@
// Metro module 8235 (f8236).
import { useMemo, useRef } from "react";
import { View } from "react-native";
import { GUILD_EVENT_MAX_NAME_LENGTH, MAX_EVENT_LOCATION_LENGTH, GuildScheduledEventEntityTypes, GUILD_EVENT_MAX_DESCRIPTION_LENGTH } from "../../GuildScheduledEventsConstants";
import { GuildFeatures } from "../../../../Constants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { TextInput } from "../../../../design/components/TextInput/native/TextInput.native";
import { intl, t } from "../../../../intl/index.native";
import { recurrenceRuleToOption, getRecurrenceOptions } from "../../utils/ScheduleUtils";
import { Text } from "../../../../design/components/Text/native/Text";
import { InputButton } from "../../../../design/components/experimental/native";
import { dismissGlobalKeyboard } from "../../../../utils/native/KeyboardManagerUtils";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import Module8247 from "../../../../_bundle/Module8247";
import { useChannelsUserCanStartStageIn } from "../../useGuildsUserCanStartStageIn";
import Module8249 from "../../../../_bundle/Module8249";
import { VoiceNormalIcon } from "../../../../design/components/Icon/native/redesign/generated/VoiceNormalIcon";
import Module8250 from "../../../../_bundle/Module8250";
import { LocationIcon } from "../../../../design/components/Icon/native/redesign/generated/LocationIcon";
import Module7683 from "../../../../_bundle/Module7683";
import { StageIcon } from "../../../../design/components/Icon/native/redesign/generated/StageIcon";
import { TableRadioGroup } from "../../../../design/components/TableRow/native/TableRadioGroup.native";
import { TableRadioRow } from "../../../../design/components/TableRow/native/TableRadioRow.native";
import { TextArea } from "../../../../design/components/TextInput/native/TextArea.native";
import Module3771 from "../../../../_bundle/Module3771";
import { Stack } from "../../../../design/components/Stack/native/Stack.native";
function $mk105764($env) {
return () => {
const r6 = $env.$parent;
if (!r6[5]) {
const r8 = $env;
const r3 = $env.$parent.$parent;
const r4 = r3[2];
const r2 = r3[3];
r4(r2[11]).dismissGlobalKeyboard();
const mode = r8[0];
const title = mode === "date" ? r6[0] : r6[1];
const r17 = (0, r3[1])(r2[12]);
const r23 = (0, r3[0])(r2[14])(r2[27], r2.paths);
const r25 = {
onSubmit: $mk115273(r8),
title,
startDate: null,
minimumDate: null,
maximumDate: null,
requireDateChanged: true,
mode: null
};
const r26 = r6[2];
r25.startDate = r26.toDate();
const r29 = r6[3];
r25.minimumDate = r29 != null ? r29.toDate() : r26.toDate();
r25.maximumDate = r6[4].toDate();
r25.mode = mode;
r17.openLazy(r23, "DatePicker", r25);
}
};
}
function $mk115273($env) {
return (a0) => {
if ($env[0] !== "date") {
(0, $env.$parent[6])(a0);
} else {
const set = a0.set;
const r9 = $env.$parent;
const r7 = r9[2];
(0, r9[6])(set.call(a0, {
hour: r7.get("hour"),
minute: r7.get("minute"),
second: 0,
millisecond: 0
}));
}
};
}
let env5239 = {};
const useStyles = createStyles({
formGroup: {
paddingVertical: 8
},
formGroupSmall: {
paddingVertical: 4
},
formGroupLarge: {
paddingTop: 16,
paddingBottom: 4
},
dateInput: {
flexGrow: 1,
flexShrink: 1,
flexBasis: "60%"
},
timeInput: {
flexGrow: 1,
flexShrink: 1,
flexBasis: "30%"
},
formHeader: {
marginBottom: 8
},
header: {
display: "flex",
flexDirection: "row",
alignItems: "center",
marginBottom: 8
}
});
export function GuildEventTopic(props) {
const { topic, onChange } = props;
return <View style={useStyles().formGroupSmall}>
<TextInput label={intl.string(t["0HbEQ6"])} accessibilityLabel={intl.string(t["0HbEQ6"])} placeholder={intl.string(t["6/yars"])} onChange={onChange} value={topic} maxLength={GUILD_EVENT_MAX_NAME_LENGTH} autoFocus isClearable />
</View>;
}
export function GuildEventLocation(props) {
const { location: location2, onChange, onFocus: onFocus3 } = props;
return <View style={useStyles().formGroupLarge}>
<TextInput label={intl.string(t.yx785A)} placeholder={intl.string(t.mkCMia)} value={location2} maxLength={MAX_EVENT_LOCATION_LENGTH} onChange={onChange} onFocus={onFocus3} isClearable />
</View>;
}
export function GuildEventRecurrence(props) {
let recurrenceOptions;
const { startDate, recurrenceRule, onRecurrenceChange } = props;
recurrenceOptions = void 0;
const styles = useStyles();
const memo = useMemo(() => recurrenceRuleToOption(startDate, recurrenceRule), [recurrenceRule, startDate]);
recurrenceOptions = getRecurrenceOptions(startDate);
const label = recurrenceOptions.find((recurrenceOption) => recurrenceOption.value === memo)?.label;
return <View style={styles.formGroup}>
<View style={styles.header}>
<Text variant="text-sm/semibold" color="text-subtle">
{intl.string(t["59TVxL"])}
</Text>
</View>
<InputButton onPress={function onPress() {
dismissGlobalKeyboard();
ActionSheetActionCreators.openLazy(import("../../../../components_native/common/ItemSelectorActionSheet"), "SelectRecurrenceOption", {
title: intl.string(t["59TVxL"]),
items: recurrenceOptions,
onItemSelect: (a0) => {
onRecurrenceChange(a0);
ActionSheetActionCreators.hideActionSheet();
},
selectedItem: memo,
hasIcons: false
});
}} text={intl.string(t["59TVxL"])} value={label} icon={Module8247} iconPosition="end" accessibilityLabel={intl.string(t["59TVxL"])} accessibilityHint={label} />
</View>;
}
export function GuildEventEntityTypeSelection({ guild, entityType, disabled, onChange }) {
const channelsUserCanStartStageIn = useChannelsUserCanStartStageIn(guild);
const r43 = [{
name: intl.string(t.BVZqJl),
value: GuildScheduledEventEntityTypes.VOICE,
description: intl.string(t["EV//4f"]),
icon: Module8249,
IconComponent: VoiceNormalIcon,
disabled
}, {
name: intl.string(t.w7ipbz),
value: GuildScheduledEventEntityTypes.EXTERNAL,
description: intl.string(t.DYxrHm),
icon: Module8250,
IconComponent: LocationIcon,
disabled
}];
if (guild.features.has(GuildFeatures.COMMUNITY)) {
r43.unshift({
name: intl.string(t.EErMzA),
value: GuildScheduledEventEntityTypes.STAGE_INSTANCE,
description: intl.string(t.LgALpp),
icon: Module7683,
IconComponent: StageIcon,
disabled: channelsUserCanStartStageIn.length === 0 || disabled
});
}
return (0, jsx)(TableRadioGroup, {
defaultValue: entityType,
onChange,
hasIcons: true,
children: r43.map(({ name, value, description, IconComponent, disabled }) => <TableRadioRow key={name} label={name} subLabel={description} value={value} icon={<IconComponent />} disabled={disabled} />)
});
}
export function GuildEventDescription(props) {
const { description, onChange, onFocus: onFocus2 } = props;
const styles = useStyles();
const ref = useRef(null);
return <View style={styles.formGroupSmall} ref={ref}>
<TextArea label={intl.string(t["+gRCC7"])} maxLength={GUILD_EVENT_MAX_DESCRIPTION_LENGTH} placeholder={intl.string(t["kWO/E8"])} onChange={onChange} onFocus={function onFocus() {
if (onFocus2 != null) {
onFocus2(ref);
}
}} value={description} />
</View>;
}
export function GuildEventDatetime(props) {
let env16406;
const r14 = env16406 = {
$parent: env5239
};
const dateLabel = props.dateLabel;
env16406[0] = dateLabel;
const timeLabel = props.timeLabel;
env16406[1] = timeLabel;
let date = props.date;
if (date === void 0) {
date = Module3771();
}
env16406[2] = date;
env16406[3] = props.minimumDate;
let maximumDate = props.maximumDate;
if (maximumDate === void 0) {
maximumDate = Module3771().add(30, "days").endOf("month");
}
env16406[4] = maximumDate;
const disabled = props.disabled;
env16406[5] = disabled;
let onChange = props.onChange;
if (onChange === void 0) {
onChange = () => {};
}
let env16407;
let env16408;
env16406[6] = onChange;
const styles = useStyles();
const r47 = [<Text style={styles.formHeader} variant="text-sm/semibold" color="text-subtle">{dateLabel}</Text>, ,];
const props2 = {
text: dateLabel,
value: date.format("MMM Do YYYY"),
onPress: null,
disabled: null
};
const r54 = env16407 = {
$parent: r14
};
env16407[0] = "date";
props2.onPress = $mk105764(r54);
props2.disabled = disabled;
r47[1] = <InputButton {...props2} />;
const r59 = [<View style={styles.dateInput}>{r47}</View>, ,];
const r68 = [<Text style={styles.formHeader} variant="text-sm/semibold" color="text-subtle">{timeLabel}</Text>, ,];
const props3 = {
text: timeLabel,
value: date.format("LT"),
onPress: null,
disabled: null
};
const r76 = env16408 = {
$parent: r14
};
env16408[0] = "time";
props3.onPress = $mk105764(r76);
props3.disabled = disabled;
r68[1] = <InputButton {...props3} />;
r59[1] = <View style={styles.timeInput}>{r68}</View>;
return <View style={styles.formGroup}>
<Stack direction="horizontal" spacing={16}>{r59}</Stack>
</View>;
}
@@ -0,0 +1,112 @@
// Metro module 8333 (f8334).
import { useMemo } from "react";
import { View } from "react-native";
import ChannelStore from "../../../../stores/ChannelStore";
import GuildStore from "../../../../stores/GuildStore";
import GuildScheduledEventStore from "../../GuildScheduledEventStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useEventException from "../../useEventException";
import { useManageResourcePermissions } from "../../../permissions/useManageResourcePermissions";
import { useEventScheduleById } from "../../useEventSchedule";
import { getEventTimeData } from "../../utils/ScheduleUtils";
import { intl, t } from "../../../../intl/index.native";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { GuildEventCardHeader } from "./GuildEventCardComponents";
import { Text } from "../../../../design/components/Text/native/Text";
import { showGuildEventModeratorActionSheet } from "../GuildScheduledEventModalActionCreators";
import { Icon } from "../../../../design/void/native";
import Module8334 from "../../../../_bundle/Module8334";
const useStyles = createStyles({
container: {
alignSelf: "stretch",
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center"
},
eventHeader: {
marginStart: 8,
flexShrink: 0,
flexGrow: 1
},
active: {
backgroundColor: Module712.colors.INTERACTIVE_BACKGROUND_SELECTED,
borderRadius: Module712.radii.xs
},
actions: {
alignItems: "center",
flexDirection: "row",
flexShrink: 0
},
secondarySmallButton: {
flexShrink: 0,
alignItems: "center",
flexDirection: "row",
padding: 8,
marginLeft: 8,
borderRadius: Module712.radii.xs
},
secondarySmallIcon: {
tintColor: Module712.colors.TEXT_STRONG
}
});
export default function GuildEventRecurrence(props) {
let stateFromStores2, canManageGuildEvent, c16509_6, is_canceled;
const { recurrenceId, guildEventId, onPress: onPress2, isActive } = props;
stateFromStores2 = void 0;
canManageGuildEvent = void 0;
c16509_6 = void 0;
is_canceled = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([GuildScheduledEventStore], () => GuildScheduledEventStore.getGuildScheduledEvent(guildEventId));
let r30 = useEventException(recurrenceId, stateFromStores?.id);
stateFromStores2 = useStateFromStores([GuildStore], () => GuildStore.getGuild(stateFromStores?.guild_id));
let r42 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(stateFromStores?.channel_id));
if (r42 == null) {
r42 = stateFromStores2;
}
canManageGuildEvent = (0, useManageResourcePermissions(r42).canManageGuildEvent)(stateFromStores);
const eventScheduleById = useEventScheduleById(guildEventId, recurrenceId);
const r54 = eventScheduleById == null ? void 0 : eventScheduleById.startTime.toISOString();
c16509_6 = r54;
const memo = useMemo(() => c16509_6 != null ? getEventTimeData(c16509_6) : null, [r54]);
if (stateFromStores == null) {
return null;
}
if (r30 == null) {
r30 = {};
}
const is_canceled2 = r30.is_canceled;
let r63 = is_canceled2 !== void 0 && is_canceled2;
is_canceled = r63;
const accessibilityLabel = (is_canceled ? `${intl.string(t.fyBVRm)}, ` : "") + stateFromStores.name + (memo != null ? `, ${memo.startDateTimeString}` : "");
const style = [styles.container, isActive ? styles.active : void 0];
const r105 = [<PressableOpacity accessible accessibilityRole="button" accessibilityLabel={accessibilityLabel} onPress={function onPress(event) {
event.stopPropagation();
if (!is_canceled && onPress2 != null) {
onPress2(recurrenceId);
}
}} style={styles.eventHeader}>
<GuildEventCardHeader isActive={isActive} event={stateFromStores} showUserCount={false} showCreator={false} recurrenceId={recurrenceId} />
</PressableOpacity>, ,];
if (is_canceled) {
r63 = <Text variant="text-sm/semibold" color="text-feedback-critical">
{intl.string(t.fyBVRm)}
</Text>;
}
r105[1] = <View style={styles.actions}>
{r63}
<PressableOpacity accessible accessibilityRole="button" accessibilityLabel={`${intl.string(t.HIgA5a)}, ${accessibilityLabel}`} onPress={function onPress(event) {
if (stateFromStores != null) {
event.stopPropagation();
if (stateFromStores2 != null) {
showGuildEventModeratorActionSheet(stateFromStores, canManageGuildEvent, recurrenceId);
}
}
}} style={styles.secondarySmallButton}>
<Icon source={Module8334} size={Icon.Sizes.REFRESH_SMALL_16} style={styles.secondarySmallIcon} />
</PressableOpacity>
</View>;
return <View style={style}>{r105}</View>;
};
@@ -0,0 +1,54 @@
// Metro module 8330 (f8331).
import { useRef } from "react";
import { ScrollView, View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useGuildEventRecurrences from "../../useGuildEventRecurrences";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import SnowflakeUtils from "../../../../utils/SnowflakeUtils";
import GuildEventRecurrence from "./GuildEventRecurrence";
import { Button } from "../../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
marginTop: 16
},
scrollView: {
marginTop: 8,
marginBottom: 8,
borderRadius: Module712.radii.sm,
maxHeight: 140
}
});
export default function GuildEventRecurrences(props) {
const { guildId, recurrenceRule, guildEventId, onRecurrencePress, activeRecurrenceId, hideViewMoreButton } = props;
const ref = useRef(null);
const styles = useStyles();
const guildEventRecurrences = useGuildEventRecurrences(guildEventId, guildId, recurrenceRule);
const recurrenceStartTimes = guildEventRecurrences.recurrenceStartTimes;
let canViewMoreRecurrences = guildEventRecurrences.canViewMoreRecurrences;
const updateRecurrenceStartTimes = guildEventRecurrences.updateRecurrenceStartTimes;
const r44 = [<Text variant="heading-md/semibold">
{intl.string(t["D/jjoa"])}
</Text>, <ScrollView style={styles.scrollView} ref={ref}>
{recurrenceStartTimes.map((recurrenceStartTime) => {
const key = SnowflakeUtils.fromTimestamp(recurrenceStartTime.getTime());
return <GuildEventRecurrence key={key} recurrenceId={key} guildEventId={guildEventId} onPress={onRecurrencePress} isActive={key === activeRecurrenceId} />;
})}
</ScrollView>, ,];
if (canViewMoreRecurrences) {
canViewMoreRecurrences = !hideViewMoreButton;
}
if (canViewMoreRecurrences) {
canViewMoreRecurrences = <Button text={intl.string(t["8O7Hpy"])} onPress={function onPress(event) {
event.stopPropagation();
updateRecurrenceStartTimes();
const current = ref.current;
if (current != null) {
current.scrollToEnd();
}
}} size="sm" />;
}
r44[2] = canViewMoreRecurrences;
return <View style={styles.container}>{r44}</View>;
};
@@ -0,0 +1,31 @@
// Metro module 8234 (f8235).
import { useMemo } from "react";
import Module3771 from "../../../../_bundle/Module3771";
import { MAX_DAYS_AHEAD_AN_EVENT_CAN_START, MAX_DAYS_AHEAD_AN_EVENT_CAN_END, MAX_YEARS_AHEAD_RECURRING_EVENT } from "../../utils/ScheduleUtils";
import { GuildEventDatetime } from "./GuildEventModalComponents";
import { intl, t } from "../../../../intl/index.native";
export default function GuildEventSchedule(props) {
const { guildEvent, recurrenceId, schedule, onChange: onChange2 } = props;
const minimumDate = Module3771();
const maximumDate = Module3771().add(MAX_DAYS_AHEAD_AN_EVENT_CAN_START, "days");
const memo = useMemo(() => Module3771(schedule.startDate).add(15, "minutes"), [schedule.startDate]);
const maximumDate2 = Module3771().add(MAX_DAYS_AHEAD_AN_EVENT_CAN_END, "days");
if (recurrenceId != null) {
maximumDate.add(MAX_YEARS_AHEAD_RECURRING_EVENT, "years");
maximumDate2.add(MAX_YEARS_AHEAD_RECURRING_EVENT, "years");
}
return <>
<GuildEventDatetime date={schedule.startDate} onChange={function onChange(event) {
onChange2({
...schedule,
startDate: event
});
}} minimumDate={minimumDate} maximumDate={maximumDate} dateLabel={intl.string(t.kKOIwJ)} timeLabel={intl.string(t["6dGmCD"])} />
{guildEvent.scheduled_end_time != null && <GuildEventDatetime date={schedule.endDate} onChange={function onChange(event) {
onChange2({
...schedule,
endDate: event
});
}} minimumDate={memo} maximumDate={maximumDate2} dateLabel={intl.string(t.CTLgZJ)} timeLabel={intl.string(t.j2RuXF)} />}
</>;
};
@@ -0,0 +1,25 @@
// Metro module 8315 (f8316).
import { getLocationFromEvent } from "../../utils/EntityUtils";
import Module8250 from "../../../../_bundle/Module8250";
import { getChannelIcon, getSimpleChannelIcon, getChannelIconComponent, getSimpleChannelIconComponent } from "../../../../utils/native/ChannelUtils";
import { LocationIcon } from "../../../../design/components/Icon/native/redesign/generated/LocationIcon";
export function getEventLocationIconSource(a0, a1, a2) {
return getLocationFromEvent(a0) != null ? Module8250 : a1 != null ? a2 ? getChannelIcon(a1) : getSimpleChannelIcon(a1) : null;
}
export function getEventLocationIconComponent(a0, a1, a2) {
let LocationIcon2;
if (getLocationFromEvent(a0) != null) {
LocationIcon2 = LocationIcon;
} else {
const r2 = a1 != null;
LocationIcon2 = null;
if (r2) {
let r17 = a2 ? getChannelIconComponent(a1) : getSimpleChannelIconComponent(a1);
if (r17 == null) {
r17 = null;
}
LocationIcon2 = r17;
}
}
return LocationIcon2;
}
@@ -0,0 +1,89 @@
// Metro module 12837 (f12838).
import { memo, useCallback } from "react";
import { View } from "react-native";
import SelectedChannelStore from "../../../../stores/SelectedChannelStore";
import { isGuildScheduledEventActive } from "../../GuildScheduledEventStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useActiveEvent, useImminentUpcomingGuildEvents } from "../../useGuildScheduledEvents";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useManageResourcePermissions } from "../../../permissions/useManageResourcePermissions";
import { getNextRecurrenceIdInEvent } from "../../utils/ScheduleUtils";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { openStartGuildEventModal } from "../GuildScheduledEventModalActionCreators";
import { openVoiceChannelActionSheet } from "../../../../utils/native/PrivateChannelCallUtils";
import { openGuildEventDetails } from "../../GuildScheduledEventModalActionCreators.native";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { GuildEventCardHeader, GuildEventCardMetaInfo } from "./GuildEventCardComponents";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { intl, t } from "../../../../intl/index.native";
const useStyles = createStyles({
header: {
margin: 12,
padding: 12,
borderRadius: Module712.radii.sm,
borderColor: Module712.colors.BORDER_SUBTLE,
borderWidth: 1,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
descriptionContainerStyle: {
paddingTop: 4
},
buttonContainer: {
marginTop: 12
}
});
const r49 = memo(function({ channel }) {
let event, c20240_3;
event = void 0;
c20240_3 = void 0;
const styles = useStyles();
const activeEvent = useActiveEvent(channel.id);
const imminentUpcomingGuildEvents = useImminentUpcomingGuildEvents(channel.id);
const stateFromStores = useStateFromStores([SelectedChannelStore], () => SelectedChannelStore.getVoiceChannelId());
const id = channel.id;
event = activeEvent == null ? imminentUpcomingGuildEvents == null ? void 0 : imminentUpcomingGuildEvents[0] : activeEvent;
const r12 = (0, useManageResourcePermissions(channel).canManageGuildEvent)(event);
let r43 = getNextRecurrenceIdInEvent(event);
if (r43 == null) {
r43 = void 0;
}
c20240_3 = r43;
const callback = useCallback(() => {
if (activeEvent == null && event != null) {
ActionSheetActionCreators.hideActionSheet();
openStartGuildEventModal(event, c20240_3, () => {
openVoiceChannelActionSheet(channel);
});
}
}, [event, channel, activeEvent, r43]);
const callback2 = useCallback(() => {
if (event != null) {
ActionSheetActionCreators.hideActionSheet();
openGuildEventDetails({
eventId: event.id,
event
});
}
}, [event]);
if (event == null) {
return null;
}
let condensed = stateFromStores === id;
const isGuildScheduledEventActive2 = isGuildScheduledEventActive(event);
const r67 = [<GuildEventCardHeader event={event} showUserCount={false} />, <GuildEventCardMetaInfo event={event} descriptionContainerStyle={styles.descriptionContainerStyle} condensed={condensed} />, ,];
if (condensed) {
condensed = r12;
}
if (condensed) {
condensed = !isGuildScheduledEventActive2;
}
if (condensed) {
condensed = <View style={styles.buttonContainer}>
<Button text={intl.string(t.cK1GGY)} onPress={callback} variant="active" size="sm" grow />
</View>;
}
r67[2] = condensed;
return <PressableOpacity accessibilityRole="button" onPress={callback2} style={styles.header}>{r67}</PressableOpacity>;
});
export default r49;
@@ -0,0 +1,90 @@
// Metro module 8319 (f8320).
import { useRef, useEffect, useCallback } from "react";
import { View } from "react-native";
import ReadStateStore from "../../../../stores/ReadStateStore";
import { ANALYTICS_GUILD_EVENTS_MODAL_NAME } from "../../GuildScheduledEventsConstants";
import { AnalyticEvents } from "../../../../Constants";
import { ReadStateTypes } from "../../../read_states/ReadStateConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import useCanCreateAnEvent from "../../useCanCreateAnEvent";
import { BottomSheetTitleHeader } from "../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { intl, t } from "../../../../intl/index.native";
import { ActionSheetHeaderPressableText } from "../../../../design/components/Sheet/native/ActionSheetHeaderPressableText.native";
import { closeGuildEventListActionSheet, openCreateOrEditGuildEventModal, openGuildEventListActionSheet } from "../GuildScheduledEventModalActionCreators";
import useGuildScheduledEvents from "../../useGuildScheduledEvents";
import GuildScheduledEventManager from "../../GuildScheduledEventManager";
import { openGuildEventDetails } from "../../GuildScheduledEventModalActionCreators.native";
import useMountEffect from "../../../../hooks/useMountEffect";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import { ackGuildFeature } from "../../../../actions/ReadStateActionCreators";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import GuildEventsListView from "./GuildEventsListView";
import useRefValue from "../../../../hooks/useRefValue";
let useStyles;
const GuildEventsListHeader = function GuildEventsListHeader(props) {
const { eventCount, guild } = props;
let trailing = useCanCreateAnEvent(guild.id);
let c16491_1 = trailing;
const title = eventCount > 0 ? intl.formatToPlainString(t.p1zLAf, {
count: eventCount
}) : intl.string(t.tlopTM);
if (trailing) {
trailing = <ActionSheetHeaderPressableText accessibilityLabel={intl.string(t["60lJ0C"])} label={intl.string(t.NzROFF)} onPress={function onPress() {
if (c16491_1) {
closeGuildEventListActionSheet();
openCreateOrEditGuildEventModal(guild, {
onClose: () => {
openGuildEventListActionSheet(guild);
}
});
}
}} />;
}
return <BottomSheetTitleHeader title={title} trailing={trailing} />;
};
useStyles = createStyles({
container: {
flex: 1
}
});
export default function GuildEventsListActionSheet(props) {
const guild2 = props.guild;
const guildScheduledEvents = useGuildScheduledEvents(guild2.id);
let c16492_1 = guildScheduledEvents;
const styles = useStyles();
const ref = useRef(ReadStateStore.ackMessageId(guild2.id, ReadStateTypes.GUILD_EVENT));
useEffect(() => {
c16492_1.forEach((item) => GuildScheduledEventManager.getGuildEventUserCounts(guild2.id, item.id, []));
GuildScheduledEventManager.getGuildEventsForCurrentUser(guild2.id);
}, [guildScheduledEvents, guild2.id]);
const callback2 = useCallback(() => {
closeGuildEventListActionSheet();
}, []);
const callback = useCallback((a0, a1) => {
openGuildEventDetails({
eventId: a0.id,
event: a0,
recurrenceId: a1,
onClose: () => {
openGuildEventListActionSheet(guild2);
}
});
}, [guild2]);
useMountEffect(() => {
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
type: ANALYTICS_GUILD_EVENTS_MODAL_NAME,
guild_id: guild2.id,
guild_events_count: c16492_1.length
});
});
useEffect(() => {
if (guild2.id != null) {
ackGuildFeature(guild2.id, ReadStateTypes.GUILD_EVENT);
}
}, [guild2.id]);
return <BottomSheet showGradient scrollable={guildScheduledEvents.length > 0} startExpanded dismissAccessibilityLabel={intl.string(t.VSlyAn)} header={<GuildEventsListHeader eventCount={guildScheduledEvents.length} guild={guild2} />}>
<View style={styles.container}>
<GuildEventsListView inActionSheet events={guildScheduledEvents} onPressEvent={callback} onCloseAction={callback2} guild={guild2} lastAckedId={useRefValue(ref)} />
</View>
</BottomSheet>;
};
@@ -0,0 +1,40 @@
// Metro module 8324 (f8325).
import { FlatList, View } from "react-native";
import Module712 from "../../../../_bundle/Module712";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { BottomSheetView, BottomSheetFlatList } from "../../../../_bundle/Module5245";
import GuildEventsNoContent from "./GuildEventsNoContent";
import GuildEventCard from "./GuildEventCard";
import SnowflakeUtils from "../../../../utils/SnowflakeUtils";
let c5310_6;
const FormSeparator = function FormSeparator() {
return <View style={c5310_6.spacer} />;
};
c5310_6 = {
spacer: {
height: Module712.space.PX_16,
width: "100%"
},
container: {
paddingHorizontal: Module712.space.PX_16
}
};
export default function GuildEventsListView(props) {
const { events, guild, onPressEvent, onCloseAction, lastAckedId, inActionSheet } = props;
const bottom = useSafeAreaInsets_native().bottom;
if (events.length === 0) {
return <BottomSheetView>
<GuildEventsNoContent onClose={onCloseAction} guild={guild} />
</BottomSheetView>;
}
return inActionSheet ? <BottomSheetFlatList data={events} style={c5310_6.container} keyExtractor={function keyExtractor(item) {
return item.id;
}} renderItem={({ item }) => <GuildEventCard event={item} onCloseAction={onCloseAction} onPress={onPressEvent} isNew={lastAckedId != null && SnowflakeUtils.compare(item.id, lastAckedId) > 0} />} ItemSeparatorComponent={FormSeparator} initialNumToRender={5} ListEmptyComponent={() => <GuildEventsNoContent onClose={onCloseAction} guild={guild} />} contentContainerStyle={{
paddingBottom: Module712.space.PX_16 + bottom
}} /> : <FlatList data={events} style={c5310_6.container} keyExtractor={function keyExtractor(item) {
return item.id;
}} renderItem={({ item }) => <GuildEventCard event={item} onCloseAction={onCloseAction} onPress={onPressEvent} isNew={lastAckedId != null && SnowflakeUtils.compare(item.id, lastAckedId) > 0} />} ItemSeparatorComponent={FormSeparator} initialNumToRender={5} ListEmptyComponent={() => <GuildEventsNoContent onClose={onCloseAction} guild={guild} />} contentContainerStyle={{
paddingBottom: Module712.space.PX_16 + bottom
}} />;
};
export { c5310_6 as styles };
@@ -0,0 +1,57 @@
// Metro module 8325 (f8326).
import { View } from "react-native";
import PermissionStore from "../../../../stores/PermissionStore";
import { GuildSettingsSections } from "../../../../Constants";
import { Permissions, Fonts } from "../../../../_bundle/Module505";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import TextStyles from "../../../rebrand/native/TextStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import StageSparkle from "../../../stage_channels/native/components/StageSparkle";
import Module8326 from "../../../../_bundle/Module8326";
import { CalendarIcon } from "../../../../design/components/Icon/native/redesign/generated/CalendarIcon";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import GuildSettingsActionCreators from "../../../guild_settings/GuildSettingsActionCreators";
const useStyles = createStyles({
container: {
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
marginBottom: 88,
padding: 16
},
title: {
...TextStyles(Fonts.DISPLAY_EXTRABOLD, Module712.colors.MOBILE_TEXT_HEADING_PRIMARY, 24, {
marginBottom: 8
}),
textAlign: "center"
},
subtitle: {
paddingBottom: 2,
textAlign: "center"
}
});
export default function GuildEventsNoContent(props) {
const { guild, onClose } = props;
const styles = useStyles();
let r22 = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.MANAGE_ROLES, guild), [guild]);
const r35 = [<StageSparkle icon={Module8326} IconComponent={CalendarIcon} />, <Text style={styles.title} accessibilityRole="header" variant="heading-xl/extrabold" color="mobile-text-heading-primary">
{intl.string(t["WgZ+3D"])}
</Text>, <Text style={styles.subtitle} variant="text-sm/normal" color="text-default">
{intl.string(t["v/S/PG"])}
</Text>, ,];
if (r22) {
r22 = <Text style={styles.subtitle} variant="text-sm/normal" color="text-default">
{intl.format(t["K+DH2o"], {
onClick: () => {
onClose();
GuildSettingsActionCreators.open(guild.id, GuildSettingsSections.ROLES);
}
})}
</Text>;
}
r35[3] = r22;
return <View style={styles.container}>{r35}</View>;
};
@@ -0,0 +1,116 @@
// Metro module 8219 (f8220).
import { useState, useMemo, useCallback } from "react";
import { View } from "react-native";
import GuildStore from "../../../../stores/GuildStore";
import GuildScheduledEventStore from "../../GuildScheduledEventStore";
import { EventDetailSections, MAX_RSVP_USER_DISPLAY_COUNT } from "../../GuildScheduledEventsConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { intl, t } from "../../../../intl/index.native";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useGuildScheduledEventUserCount from "../../useGuildScheduledEventUserCount";
import useInterestedEventUsers from "../../useInterestedEventUsers";
import LazyAPIPromise from "../../../../utils/LazyAPIPromise";
import GuildScheduledEventManager from "../../GuildScheduledEventManager";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { useSegmentedControlState } from "../../../../design/components/SegmentedControl/native/SegmentedControlState.native";
import { GuildEventCardImageHeader } from "./GuildEventCardComponents";
import { SegmentedControl } from "../../../../design/components/SegmentedControl/native/SegmentedControl.native";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetScrollView } from "../../../../_bundle/Module5245";
import EventDetailInfoSheet from "./event_detail/EventDetailInfoSheet";
import EventDetailRsvpSheet from "./event_detail/EventDetailRsvpSheet";
const useStyles = createStyles({
segmentedControl: {
paddingHorizontal: Module712.space.PX_12
},
header: {
flexDirection: "column"
}
});
export default function GuildScheduledEventDetailsActionSheet(props) {
let userCount, c16373_4, c16373_5, setState, setState2, c16373_8;
const { eventId, event, recurrenceId, onCloseActionSheet } = props;
userCount = void 0;
c16373_4 = void 0;
c16373_5 = void 0;
setState = void 0;
setState2 = void 0;
c16373_8 = void 0;
const styles = useStyles();
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.GUILD_EVENT_MODAL).analyticsLocations;
const [recurrenceId2, onRecurrencePress] = useState(recurrenceId);
const stateFromStores = useStateFromStores([GuildScheduledEventStore], () => {
let r6 = GuildScheduledEventStore.getGuildScheduledEvent(eventId);
if (r6 == null) {
r6 = event;
}
return r6;
}, [eventId, event]);
const stateFromStores2 = useStateFromStores([GuildStore], () => GuildStore.getGuild(stateFromStores?.guild_id) != null);
const id = stateFromStores?.id;
userCount = useGuildScheduledEventUserCount(stateFromStores?.guild_id, id, recurrenceId2);
const interestedEventUsers = useInterestedEventUsers(id, recurrenceId2);
c16373_4 = interestedEventUsers;
const memo = useMemo(() => {
const length = c16373_4.length;
const count = length >= MAX_RSVP_USER_DISPLAY_COUNT && userCount > MAX_RSVP_USER_DISPLAY_COUNT ? Math.max(userCount - length, 0) : 0;
return count > 0 ? c16373_4.length > 0 ? [...c16373_4, {
count
}] : c16373_4 : c16373_4;
}, [interestedEventUsers, userCount]);
let r72;
[c16373_5, r72] = LazyAPIPromise(() => GuildScheduledEventManager.getGuildEventUsers(stateFromStores?.id, null, stateFromStores?.guild_id));
const { loading, error } = r72;
let defaultIndex;
[defaultIndex, setState] = useState(0);
let state;
[state, setState2] = useState(0);
const bottom = useSafeAreaInsets_native().bottom;
const callback2 = useCallback((a0) => {
setState2(a0.nativeEvent.layout.height);
}, []);
const callback = useCallback(() => {}, []);
const r95 = [EventDetailSections.EVENT_INFO];
c16373_8 = r95;
if (stateFromStores2) {
r95.push(EventDetailSections.RSVP_LIST);
}
const segmentedControlState = useSegmentedControlState({
pageWidth: 0,
defaultIndex,
onSetActiveIndex: (a0) => {
if (a0 < c16373_8.length && c16373_8[a0] === EventDetailSections.RSVP_LIST) {
c16373_5();
}
setState(a0);
},
items: r95.map((item) => {
const id = EventDetailSections.EVENT_INFO === item ? intl.string(t.iW6Xuo) : EventDetailSections.RSVP_LIST === item ? intl.formatToPlainString(t["ZrTT/N"], {
userCount
}) : intl.string(t.iW6Xuo);
return {
id,
label: id,
page: null
};
})
});
if (stateFromStores == null) {
return null;
}
return <AnalyticsLocationProvider value={analyticsLocations}>
<BottomSheet scrollable startExpanded onDismiss={onCloseActionSheet} header={<View style={styles.header} onLayout={callback}>
<GuildEventCardImageHeader event={stateFromStores} />
{r95.length > 1 ? <View style={styles.segmentedControl}>
<SegmentedControl state={segmentedControlState} />
</View> : null}
</View>}>
{(defaultIndex < r95.length ? r95[defaultIndex] : EventDetailSections.EVENT_INFO) === EventDetailSections.EVENT_INFO ? <BottomSheetScrollView>
<EventDetailInfoSheet guildEvent={stateFromStores} safeBottomPadding={bottom} onCloseActionSheet={onCloseActionSheet} onLayout={callback2} recurrenceId={recurrenceId2} onRecurrencePress={onRecurrencePress} />
</BottomSheetScrollView> : <EventDetailRsvpSheet userListItems={memo} guildId={stateFromStores.guild_id} loading={loading} error={error} contentHeight={state - bottom} safeBottomPadding={bottom} />}
</BottomSheet>
</AnalyticsLocationProvider>;
};
@@ -0,0 +1,49 @@
// Metro module 10700 (f10701).
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useManageResourcePermissions } from "../../../permissions/useManageResourcePermissions";
import { FormCTA } from "../../../../design/void/Form/native/index";
import { openCreateOrEditGuildEventModal, openStartGuildEventModal } from "../GuildScheduledEventModalActionCreators";
import Module8326 from "../../../../_bundle/Module8326";
import { intl, t } from "../../../../intl/index.native";
import { calendarFormat } from "../../../../utils/DateUtils";
import Module3771 from "../../../../_bundle/Module3771";
const useStyles = createStyles({
actionBarCTAContainer: {
marginVertical: 4
},
iconStyle: {
tintColor: Module712.colors.WHITE,
width: 20,
height: 20
},
iconContainerStyle: {
backgroundColor: Module712.colors.BACKGROUND_BRAND,
borderRadius: Module712.radii.lg,
padding: 4
},
greenIcon: {
backgroundColor: Module712.unsafe_rawColors.GREEN_360
}
});
export function ScheduleEventPrompt(props) {
const { guild, channel, isLive } = props;
const styles = useStyles();
return useManageResourcePermissions(channel).canCreateGuildEvent ? <FormCTA style={styles.actionBarCTAContainer} onPress={function onPress() {
openCreateOrEditGuildEventModal(guild, {
channel
});
}} iconSource={Module8326} iconStyle={styles.iconStyle} iconContainerStyle={styles.iconContainerStyle} completed={isLive} title={intl.string(t["60lJ0C"])} subtitle={intl.string(t["EYn7/y"])} /> : null;
}
export function StartEventPrompt(props) {
const { event, recurrenceId, channel: channel2, isLive } = props;
const styles = useStyles();
const { name, scheduled_start_time } = event;
return (0, useManageResourcePermissions(channel2).canManageGuildEvent)(event) ? <FormCTA style={styles.actionBarCTAContainer} onPress={function onPress() {
openStartGuildEventModal(event, recurrenceId);
}} iconSource={Module8326} iconStyle={styles.iconStyle} iconContainerStyle={[styles.iconContainerStyle, styles.greenIcon]} completed={isLive} title={intl.formatToPlainString(t["1vGXqM"], {
eventName: name
})} subtitle={intl.formatToPlainString(t.PTebCR, {
startTime: calendarFormat(Module3771(scheduled_start_time))
})} /> : null;
}
@@ -0,0 +1,98 @@
// Metro module 8269 (f8270).
import { Image as Image2, View } from "react-native";
import { createChannelRecord } from "../../../../records/ChannelRecord";
import { useStageChannelUpsellCardStore } from "../../StageChannelUpsellCardStore";
import { CREATE_GUILD_EVENT_MODAL_KEY } from "../GuildEventModalConstants";
import { ChannelTypes } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { Icon } from "../../../../design/void/native";
import Module7699 from "../../../../_bundle/Module7699";
import Module8271 from "../../../../_bundle/Module8271";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { Button } from "../../../../design/components/Button/native/Button.native";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
let c5265_12 = "CREATE_CHANNEL_MODAL_KEY";
const useStyles = createStyles({
container: {
flexDirection: "column",
alignItems: "center",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
padding: 16,
margin: 16,
borderRadius: Module712.radii.sm
},
image: {
marginBottom: 16
},
closeContainer: {
position: "absolute",
top: 14,
right: 14
},
header: {
lineHeight: 20,
marginBottom: 4
},
description: {
textAlign: "center",
marginBottom: 4
},
button: {
marginTop: 12,
alignSelf: "stretch"
}
});
export default function StageChannelUpsell(props) {
const { guildId, onCreate } = props;
const styles = useStyles();
const [r25, onPress2] = useStageChannelUpsellCardStore();
let c16431_2 = onPress2;
return r25 ? null : <View style={styles.container}>
<PressableOpacity onPress={onPress2} accessibilityRole="button" style={styles.closeContainer}>
<Icon source={Module7699} />
</PressableOpacity>
<Image2 source={Module8271} style={styles.image} />
<Text style={styles.header} variant="text-md/bold" color="mobile-text-heading-primary">
{intl.string(t.Sx8Ezi)}
</Text>
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.string(t.JUzPhm)}
</Text>
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.format(t.Vh7rP7, {
suggestionsHook: function suggestionsHook(a0, a1) {
return <Text key={a1} variant="text-sm/semibold" color="mobile-text-heading-primary">
{a0}
</Text>;
}
})}
</Text>
<View style={styles.button}>
<Button variant="secondary" size="md" text={intl.string(t["X/3SyA"])} onPress={function onPress() {
ModalActionCreators.popWithKey(CREATE_GUILD_EVENT_MODAL_KEY);
ModalActionCreators.pushLazy(import("../../../../components_native/CreateChannelModal"), {
guildId,
channelType: ChannelTypes.GUILD_STAGE_VOICE,
onChannelCreated: (a0) => {
const channelRecord = createChannelRecord({
id: a0,
type: ChannelTypes.GUILD_STAGE_VOICE
});
if (channelRecord != null) {
onCreate(channelRecord);
}
},
onClose: () => {
ModalActionCreators.popWithKey(c5265_12);
}
}, c5265_12);
c16431_2();
ActionSheetActionCreators.hideActionSheet();
}} />
</View>
</View>;
};
@@ -0,0 +1,169 @@
// Metro module 8335 (f8336).
import { useState } from "react";
import { View } from "react-native";
import ChannelStore from "../../../../stores/ChannelStore";
import GuildStore from "../../../../stores/GuildStore";
import { AGE_VERIFICATION_STAGE_CHANNEL_TYPES, GuildScheduledEventEntityTypes } from "../../GuildScheduledEventsConstants";
import { START_EVENT_MODAL_KEY } from "../GuildEventModalConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { intl, t } from "../../../../intl/index.native";
import { Icon } from "../../../../design/void/native";
import Module7734 from "../../../../_bundle/Module7734";
import { Text } from "../../../../design/components/Text/native/Text";
import GuildEventCard from "./GuildEventCard";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useManageResourcePermissions } from "../../../permissions/useManageResourcePermissions";
import useStartEvent from "../../useStartEvent";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import StageChannelAgeVerificationNotice from "../../../stage_channels/native/StageChannelAgeVerificationNotice";
import { NotificationToggle } from "../../../stage_channels/native/modals/StartStageChannelModal";
import { Button } from "../../../../design/components/Button/native/Button.native";
let useStyles, StartEventHeader, PreviewEventCard;
const NavigationBar = function NavigationBar(props) {
const onClose = props.onClose;
return <View>
<PressableOpacity accessibilityRole="button" accessibilityLabel={intl.string(t.cpT0Cq)} onPress={() => onClose()}>
<Icon source={Module7734} />
</PressableOpacity>
</View>;
};
StartEventHeader = function StartEventHeader(props) {
const event2 = props.event;
const styles = useStyles();
return <View style={styles.header}>
<Text style={styles.headerPrivacyLevel} variant="heading-lg/bold" color="mobile-text-heading-primary">
{intl.string(t["q+fFJv"])}
</Text>
<Text style={styles.headerTitle} variant="text-md/medium" color="text-default">{event2.name}</Text>
</View>;
};
PreviewEventCard = function PreviewEventCard(props) {
return <GuildEventCard event={props.event} hideControls style={useStyles().previewCard} hideAgeVerificationNotice />;
};
useStyles = createStyles({
mainContainer: {
flex: 1,
padding: Module712.space.PX_16,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
container: {
flex: 1,
flexDirection: "column",
justifyContent: "space-between",
alignContent: "center"
},
headerContainer: {
display: "flex",
flexDirection: "column",
gap: Module712.space.PX_24
},
footerContainer: {
display: "flex",
flexDirection: "column"
},
header: {
alignItems: "center",
paddingTop: Module712.space.PX_24
},
headerTitle: {
lineHeight: 24,
textAlign: "center"
},
buttonContainer: {
display: "flex",
flexDirection: "column",
gap: Module712.space.PX_8,
marginTop: Module712.space.PX_16
},
previewCard: {
borderColor: Module712.colors.BORDER_SUBTLE,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
shadowColor: "#000",
shadowOpacity: 0.2,
shadowRadius: 16,
shadowOffset: {
height: 8,
width: 0
}
},
headerPrivacyLevel: {
textAlign: "center",
lineHeight: 18
}
});
export default function StartEventModal(props) {
let guild_id, canManageGuildEvent, state, setState, c16511_6, _handleStart2;
const { event, onCloseActionSheet } = props;
guild_id = void 0;
canManageGuildEvent = void 0;
state = void 0;
setState = void 0;
c16511_6 = void 0;
const onCloseModal2 = function onCloseModal(r3 = false) {
ModalActionCreators.popWithKey(START_EVENT_MODAL_KEY);
if (onCloseActionSheet != null) {
onCloseActionSheet(r3);
}
};
_handleStart2 = function _handleStart() {
const r9 = async () => {
L12: {
if (canManageGuildEvent) {
await c16511_6(event, state, {
onSuccess: () => {
ModalActionCreators.popWithKey(START_EVENT_MODAL_KEY);
if (onCloseActionSheet != null) {
onCloseActionSheet(true);
}
}
});
break L12;
}
onCloseModal2(false);
return void 0;
}
};
_handleStart2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
guild_id = event.guild_id;
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(guild_id));
let r38 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(event.channel_id), [event]);
if (r38 == null) {
r38 = stateFromStores;
}
canManageGuildEvent = (0, useManageResourcePermissions(r38).canManageGuildEvent)(event);
const r2 = event.entity_type === GuildScheduledEventEntityTypes.STAGE_INSTANCE;
[state, setState] = useState(r2);
let r59;
[c16511_6, r59] = useStartEvent();
const { loading, error } = r59;
return <SafeAreaPaddingView top bottom style={styles.mainContainer}>
<NavigationBar onClose={onCloseModal2} />
<View style={styles.container}>
<View style={styles.headerContainer}>
<StartEventHeader event={event} />
<PreviewEventCard event={event} />
</View>
<View style={styles.footerContainer}>
{AGE_VERIFICATION_STAGE_CHANNEL_TYPES.has(event.entity_type) && <StageChannelAgeVerificationNotice channelId={event.channel_id} />}
{r2 ? <NotificationToggle sendStartNotification={state} onToggle={function handleToggleNotifyMembers() {
setState((prevState) => !prevState);
}} /> : null}
<View style={styles.buttonContainer}>
{error != null ? <Text variant="text-sm/medium" color="text-feedback-critical">
{error.getAnyErrorMessage()}
</Text> : null}
<Button variant="active" text={intl.string(t.cK1GGY)} onPress={function handleStart() {
return _handleStart2.apply(this, arguments);
}} disabled={loading} loading={loading} />
</View>
</View>
</View>
</SafeAreaPaddingView>;
};
export { PreviewEventCard };
@@ -0,0 +1,83 @@
// Metro module 12271 (f12272).
import { useRef, useEffect } from "react";
import { Button } from "../../../../design/components/Button/native/Button.native";
function $mk89559($env) {
return () => $mk108777($env);
}
function $mk108777($env) {
return () => clearTimeout($env[1].current);
}
function $mk108778($env) {
return (a0) => {
const r3 = $env[0];
if (r3 != null && $env.$parent[1].current === null) {
r3(a0);
const r12 = $env.$parent;
const r13 = r12[1];
const r5 = setTimeout;
const r14 = r12[0];
r13.current = r5($mk116389(r12), r14);
}
};
}
function $mk116389($env) {
return () => {
$env[1].current = null;
};
}
export default function ThrottledButton(props) {
const { onPress, onPressIn, onPressOut } = props;
let throttleMs = props.throttleMs;
if (throttleMs === void 0) {
throttleMs = 500;
}
const { onPress: _onPress, onPressIn: _onPressIn, onPressOut: _onPressOut, throttleMs: _throttleMs, ...rest } = props;
let env19759;
const r16 = env19759 = {};
env19759[0] = void 0;
if (throttleMs === void 0) {
throttleMs = 500;
}
let env19760;
let env19761;
let env19762;
env19759[0] = throttleMs;
env19759[1] = void 0;
env19759[1] = useRef(null);
useEffect($mk89559(r16), []);
const r31 = env19760 = {
$parent: r16
};
env19760[0] = onPress;
const props2 = {
...rest,
onPress: $mk108778(r31)
};
const r33 = env19761 = {
$parent: r16
};
env19761[0] = onPressIn;
props2.onPressIn = $mk108778(r33);
const r35 = env19762 = {
$parent: r16
};
env19762[0] = onPressOut;
props2.onPressOut = $mk108778(r35);
return <Button {...props2} />;
};
export function useThrottledActionHandler(r4 = 500) {
let env19758;
const r2 = env19758 = {};
env19758[0] = r4;
env19758[1] = void 0;
env19758[1] = useRef(null);
useEffect($mk89559(r2), []);
return function(a0) {
let env27279;
const r0 = env27279 = {
$parent: env19758
};
env27279[0] = a0;
return $mk108778(r0);
};
}
@@ -0,0 +1,47 @@
// Metro module 11474 (f11475).
import { View } from "react-native";
import GuildStore from "../../../../stores/GuildStore";
import UserGuildSettingsStore from "../../../../stores/UserGuildSettingsStore";
import { ReadStateTypes } from "../../../read_states/ReadStateConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { ActionSheet } from "../../../../design/components/Sheet/native/ActionSheet.native";
import { BottomSheetTitleHeader } from "../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import GuildIcon, { GuildIconSizes } from "../../../guild/native/GuildIcon";
import { intl, t } from "../../../../intl/index.native";
import { FormRow, FormLabel } from "../../../../design/void/Form/native/index";
import { Icon } from "../../../../design/void/native";
import Module11475 from "../../../../_bundle/Module11475";
import { ackGuildFeature } from "../../../../actions/ReadStateActionCreators";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import Module11476 from "../../../../_bundle/Module11476";
import Module11477 from "../../../../_bundle/Module11477";
import NotificationSettingsModalActionCreators from "../../../../actions/NotificationSettingsModalActionCreators";
import { NotificationLabel } from "../../../../utils/NotificationSettingsUtils";
const useStyles = createStyles({
headerIcon: {
marginRight: 16
}
});
export default function UpcomingEventsLongPressActionSheet(props) {
let stateFromStores;
const guildId = props.guildId;
stateFromStores = void 0;
const styles = useStyles();
const stateFromStores2 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId));
stateFromStores = useStateFromStores([UserGuildSettingsStore], () => UserGuildSettingsStore.isMuteScheduledEventsEnabled(guildId));
return <ActionSheet>
<BottomSheetTitleHeader leading={<View style={styles.headerIcon}>
<GuildIcon guild={stateFromStores2} size={GuildIconSizes.LARGE} />
</View>} title={intl.string(t.tlopTM)} />
<FormRow leading={<Icon source={Module11475} />} label={<FormLabel text={intl.string(t.e6RscS)} />} onPress={() => {
ackGuildFeature(guildId, ReadStateTypes.GUILD_EVENT);
ActionSheetActionCreators.hideActionSheet();
}} />
<FormRow leading={<Icon source={stateFromStores ? Module11476 : Module11477} />} label={<FormLabel text={stateFromStores ? intl.string(t.COiLo0) : intl.string(t.ONG3Yz)} />} onPress={() => {
NotificationSettingsModalActionCreators.updateGuildNotificationSettings(guildId, {
mute_scheduled_events: !stateFromStores
}, NotificationLabel.mutedEvents(!stateFromStores));
}} />
</ActionSheet>;
};
@@ -0,0 +1,46 @@
// Metro module 8347 (f8348).
import { useState } from "react";
import { View } from "react-native";
import { GuildScheduledEventUserResponses } from "../../../GuildScheduledEventsConstants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { ResponseOptions, getExistingRsvp, getResponseOptions } from "../../../utils/GuildEventRsvpUtils";
import { intl, t } from "../../../../../intl/index.native";
import { BottomSheet } from "../../../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetTitleHeader } from "../../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { SafeAreaPaddingView } from "../../../../../components_native/common/SafeAreaView";
import { TableRadioGroup } from "../../../../../design/components/TableRow/native/TableRadioGroup.native";
import { TableRadioRow } from "../../../../../design/components/TableRow/native/TableRadioRow.native";
import { Button } from "../../../../../design/components/Button/native/Button.native";
import { updateRsvp } from "../../GuildScheduledEventModalActionCreators";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
const useStyles = createStyles({
container: {
paddingHorizontal: Module712.space.PX_16
},
buttonWrapper: {
marginTop: Module712.space.PX_24
}
});
export default function GuildEventRsvpPickerActionSheet(props) {
const { event, recurrenceId, guildId, onRsvp } = props;
const styles = useStyles();
const [state, onChange] = useState(ResponseOptions.SERIES);
const UNINTERESTED = getExistingRsvp(event.id, null)?.response === GuildScheduledEventUserResponses.INTERESTED ? GuildScheduledEventUserResponses.UNINTERESTED : GuildScheduledEventUserResponses.INTERESTED;
return <BottomSheet header={<BottomSheetTitleHeader title={UNINTERESTED === GuildScheduledEventUserResponses.INTERESTED ? intl.string(t.WtORed) : intl.string(t["8MPCVr"])} />}>
<SafeAreaPaddingView bottom style={styles.container}>
<TableRadioGroup defaultValue={state} onChange={onChange} hasIcons={false}>
{getResponseOptions().map((item) => <TableRadioRow key={item.value} value={item.value} label={item.name} />)}
</TableRadioGroup>
<View style={styles.buttonWrapper}>
<Button onPress={function onPress() {
updateRsvp(event.id, state !== ResponseOptions.SERIES ? recurrenceId : null, guildId, UNINTERESTED);
if (onRsvp != null) {
onRsvp();
}
ActionSheetActionCreators.hideActionSheet();
}} text={intl.string(t.TyCVIq)} />
</View>
</SafeAreaPaddingView>
</BottomSheet>;
};
@@ -0,0 +1,139 @@
// Metro module 12275 (f12276).
import { useEffect } from "react";
import { View } from "react-native";
import AccessibilityStore from "../../../../a11y/AccessibilityStore";
import GuildMemberStore from "../../../../../stores/GuildMemberStore";
import GuildStore from "../../../../../stores/GuildStore";
import RTCConnectionStore from "../../../../../stores/RTCConnectionStore";
import UserStore from "../../../../../stores/UserStore";
import { AGE_VERIFICATION_STAGE_CHANNEL_TYPES } from "../../../GuildScheduledEventsConstants";
import { GUILD_EVENT_INFO_ACTION_SHEET_KEY } from "../../GuildEventModalConstants";
import { Fonts } from "../../../../../_bundle/Module505";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import TextStyles from "../../../../rebrand/native/TextStyles";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { useStateFromStores, useStateFromStoresObject } from "../../../../../_bundle/Module589";
import { recurrenceRuleFromServer } from "../../../utils/EditGuildEventUtils";
import GuildScheduledEventManager from "../../../GuildScheduledEventManager";
import useGuildScheduledEventUserCount from "../../../useGuildScheduledEventUserCount";
import { GuildEventCardHeader, GuildEventCardTitle, GuildEventCardSimpleGuildInfo, GuildEventSimpleLocation, GuildEventCardDescription, GuildEventCardPrimaryAction, GuildEventShareAction, GuildEventModeratorAction } from "../GuildEventCardComponents";
import { BellIcon } from "../../../../../design/components/Icon/native/redesign/generated/BellIcon";
import { Text } from "../../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../../intl/index.native";
import { Avatar, AvatarSizes, RoleDot, LegacyText } from "../../../../../design/void/native";
import UserUtils from "../../../../../utils/UserUtils";
import StageChannelAgeVerificationNotice, { DividerPosition } from "../../../../stage_channels/native/StageChannelAgeVerificationNotice";
import { ButtonGroup } from "../../../../../design/components/ButtonGroup/native/ButtonGroup.native";
import GuildEventRecurrences from "../GuildEventRecurrences";
const useStyles = createStyles({
eventContainer: {
paddingHorizontal: Module712.space.PX_16
},
eventHeader: {
paddingTop: 19
},
eventTitle: {
...TextStyles(Fonts.DISPLAY_EXTRABOLD, Module712.colors.MOBILE_TEXT_HEADING_PRIMARY, 20)
},
controlsContainer: {
paddingTop: Module712.space.PX_16
},
eventTitleContainer: {
paddingTop: Module712.space.PX_16,
paddingBottom: Module712.space.PX_8
},
eventDescriptionContainer: {
paddingTop: Module712.space.PX_16,
paddingBottom: Module712.space.PX_4
},
guildTextStyle: {
...TextStyles(Fonts.PRIMARY_MEDIUM, Module712.colors.TEXT_SUBTLE, 14)
},
interestedContainer: {
paddingTop: Module712.space.PX_8,
flexDirection: "row"
},
interestedIcon: {
marginRight: Module712.space.PX_8
},
ageVerificationContainer: {
marginTop: 16
}
});
export default function EventDetailInfoSheet(props) {
let creator, creatorMember;
const { guildEvent, safeBottomPadding, onLayout, onCloseActionSheet, recurrenceId, onRecurrencePress: onRecurrencePress2 } = props;
creator = void 0;
creatorMember = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.roleStyle);
const stateFromStores3 = useStateFromStores([RTCConnectionStore], () => RTCConnectionStore.isConnected() && RTCConnectionStore.getChannelId() === guildEvent.channel_id, [guildEvent.channel_id]);
const recurrenceRule = recurrenceRuleFromServer(guildEvent.recurrence_rule);
useEffect(() => {
GuildScheduledEventManager.getGuildEventUserCounts(guildEvent.guild_id, guildEvent.id, []);
GuildScheduledEventManager.getGuildEventsForCurrentUser(guildEvent.guild_id);
}, [guildEvent.guild_id, guildEvent.id]);
const guildScheduledEventUserCount = useGuildScheduledEventUserCount(guildEvent.guild_id, guildEvent.id, recurrenceId);
const stateFromStores2 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildEvent.guild_id) != null);
const stateFromStoresObject = useStateFromStoresObject([UserStore, GuildMemberStore], () => guildEvent.creator_id != null ? {
creator: UserStore.getUser(guildEvent.creator_id),
creatorMember: GuildMemberStore.getMember(guildEvent.guild_id, guildEvent.creator_id)
} : {
creator: null,
creatorMember: null
}, [guildEvent]);
creator = stateFromStoresObject.creator;
creatorMember = stateFromStoresObject.creatorMember;
return <View style={[styles.eventContainer, {
paddingBottom: safeBottomPadding + 16
}]} onLayout={onLayout}>
<GuildEventCardHeader event={guildEvent} style={styles.eventHeader} showUserCount={false} showEndDate showCreator={false} recurrenceId={recurrenceId} />
<GuildEventCardTitle event={guildEvent} textStyle={styles.eventTitle} style={styles.eventTitleContainer} />
<GuildEventCardSimpleGuildInfo event={guildEvent} textStyle={styles.guildTextStyle} />
<GuildEventSimpleLocation event={guildEvent} />
<View style={styles.interestedContainer}>
<BellIcon size="sm" style={styles.interestedIcon} />
<Text variant="text-sm/medium" color="text-default">
{intl.format(t["+DLsD8"], {
count: guildScheduledEventUserCount
})}
</Text>
</View>
{creator != null && stateFromStores2 && <View style={styles.interestedContainer}>
<Avatar user={creator} guildId={guildEvent.guild_id} size={AvatarSizes.XSMALL_20} style={styles.interestedIcon} />
<Text variant="text-sm/medium" color="text-default">
{intl.format(t["66DLFs"], {
usernameHook: function usernameHook() {
const r24 = [stateFromStores === "dot" && creatorMember?.colorString != null && <RoleDot size="small" color={creatorMember.colorString} colors={creatorMember.colorStrings} />, ,];
const style = creatorMember != null ? stateFromStores === "username" ? creatorMember.colorString != null ? {
color: creatorMember.colorString
} : void 0 : void 0 : void 0;
let r41 = creatorMember?.nick;
if (r41 == null) {
r41 = UserUtils.getName(creator);
}
r24[1] = <LegacyText style={style}>{r41}</LegacyText>;
return <>{r24}</>;
}
})}
</Text>
</View>}
<GuildEventCardDescription event={guildEvent} style={styles.eventDescriptionContainer} />
{AGE_VERIFICATION_STAGE_CHANNEL_TYPES.has(guildEvent.entity_type) && <StageChannelAgeVerificationNotice noBackground divider={[DividerPosition.TOP, DividerPosition.BOTTOM]} onConfirmPress={() => ActionSheetActionCreators.hideAllActionSheets()} channelId={guildEvent.channel_id} style={styles.ageVerificationContainer} />}
<ButtonGroup direction="horizontal" style={styles.controlsContainer}>
<GuildEventCardPrimaryAction event={guildEvent} onCloseAction={function onCloseAction() {
ActionSheetActionCreators.hideActionSheet(GUILD_EVENT_INFO_ACTION_SHEET_KEY);
if (onCloseActionSheet != null) {
onCloseActionSheet();
}
}} isConnected={stateFromStores3} recurrenceId={recurrenceId} />
{stateFromStores2 ? <GuildEventShareAction event={guildEvent} /> : null}
<GuildEventModeratorAction event={guildEvent} recurrenceId={recurrenceId} />
</ButtonGroup>
{recurrenceRule != null && <GuildEventRecurrences guildId={guildEvent.guild_id} recurrenceRule={recurrenceRule} guildEventId={guildEvent.id} onRecurrencePress={(event) => onRecurrencePress2(event)} activeRecurrenceId={recurrenceId} />}
</View>;
};
export function closeGuildEventInfoActionSheet() {
ActionSheetActionCreators.hideActionSheet(GUILD_EVENT_INFO_ACTION_SHEET_KEY);
}
@@ -0,0 +1,154 @@
// Metro module 12276 (f12277).
import { useCallback, memo } from "react";
import { View } from "react-native";
import PresenceStore from "../../../../../stores/PresenceStore";
import UserStore from "../../../../../stores/UserStore";
import { Fonts } from "../../../../../_bundle/Module505";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import TextStyles from "../../../../rebrand/native/TextStyles";
import StageSparkle from "../../../../stage_channels/native/components/StageSparkle";
import Module12277 from "../../../../../_bundle/Module12277";
import { Text } from "../../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../../intl/index.native";
import { FormRow, FormDivider } from "../../../../../design/void/Form/native/index";
import FastImage from "../../../../../components_native/common/FastImage";
import useAnalyticsLocations from "../../../../app_analytics/useAnalyticsLocations";
import { useStateFromStores, useStateFromStoresObject } from "../../../../../_bundle/Module589";
import { Avatar, AvatarSizes } from "../../../../../design/void/native";
import DiscordTag from "../../../../user_profile/native/DiscordTag";
import UserUtils from "../../../../../utils/UserUtils";
import showUserProfileActionSheet from "../../../../user_profile/native/showUserProfileActionSheet";
import { isRemainingUsersGroup } from "./EventDetailTypes";
import { BottomSheetScrollView, BottomSheetFlatList } from "../../../../../_bundle/Module5245";
import { ActivityIndicator } from "../../../../../design/components/ActivityIndicator/native/ActivityIndicator.native";
let useStyles, FetchErrorDisplay, NoUsersDisplay, RemainingUsersRow, Component, keyExtractor;
const EmptyDisplay = function EmptyDisplay(props) {
const { children, style } = props;
return <View style={[useStyles().emptyDisplayContainer, style]}>
<StageSparkle icon={Module12277} />
{children}
</View>;
};
FetchErrorDisplay = function FetchErrorDisplay(props) {
return <EmptyDisplay style={props.style}>
<Text style={useStyles().emptyDisplayTitle} variant="heading-lg/extrabold" color="mobile-text-heading-primary">
{intl.string(t.obChXk)}
</Text>
</EmptyDisplay>;
};
NoUsersDisplay = function NoUsersDisplay(props) {
return <EmptyDisplay style={props.style}>
<Text style={useStyles().emptyDisplayTitle} variant="heading-lg/extrabold" color="mobile-text-heading-primary">
{intl.string(t.hW0mBR)}
</Text>
</EmptyDisplay>;
};
RemainingUsersRow = function RemainingUsersRow(props) {
const remainingUsersGroup = props.remainingUsersGroup;
const styles = useStyles();
return <FormRow key="userRemaining" DEPRECATED_style={styles.userListRow} leading={<View style={styles.remainingUsersIconContainer}>
<FastImage source={Module12277} style={styles.remainingUsersIcon} />
</View>} label={intl.formatToPlainString(t.BdQTfR, {
userRemainCount: remainingUsersGroup.count
})} />;
};
keyExtractor = function keyExtractor(a0) {
return isRemainingUsersGroup(a0) ? `RemainingUsersGroup-${a0.count}` : a0.user_id;
};
const EventDetailRsvpSheet = function EventDetailRsvpSheet(props) {
const { userListItems, guildId, loading, error, contentHeight, safeBottomPadding } = props;
const StaticMessageContainer = function StaticMessageContainer(props) {
const children = props.children;
const styles = useStyles();
return <BottomSheetScrollView style={styles.staticMessageContentContainer} scrollEnabled={false}>
<View style={[styles.staticMessageContentContainer, {
minHeight: contentHeight
}]}>{children}</View>
</BottomSheetScrollView>;
};
const styles = useStyles();
const r10 = {
paddingBottom: safeBottomPadding
};
const callback = useCallback(({ item }) => isRemainingUsersGroup(item) ? <RemainingUsersRow remainingUsersGroup={item} /> : <Component eventUser={item} guildId={guildId} />, [guildId]);
return loading && userListItems.length === 0 ? <StaticMessageContainer>
<ActivityIndicator style={[styles.staticMessageContent, r10]} />
</StaticMessageContainer> : error != null ? <StaticMessageContainer>
<FetchErrorDisplay style={[styles.staticMessageContent, r10]} />
</StaticMessageContainer> : userListItems.length === 0 ? <StaticMessageContainer>
<NoUsersDisplay style={[styles.staticMessageContent, r10]} />
</StaticMessageContainer> : <BottomSheetFlatList contentContainerStyle={[styles.userList, {
paddingBottom: safeBottomPadding
}]} data={userListItems} renderItem={callback} ItemSeparatorComponent={FormDivider} keyExtractor={keyExtractor} />;
};
useStyles = createStyles({
staticMessageContentContainer: {
flex: 1,
padding: 16
},
userList: {
paddingTop: 16
},
userListRow: {
paddingVertical: 8
},
userName: {
color: Module712.colors.TEXT_DEFAULT,
fontFamily: Fonts.PRIMARY_SEMIBOLD,
fontSize: 16
},
emptyDisplayContainer: {
alignItems: "center",
justifyContent: "center",
minHeight: 200
},
staticMessageContent: {
height: "100%"
},
emptyDisplayTitle: {
paddingTop: 24,
...TextStyles(Fonts.DISPLAY_EXTRABOLD, Module712.colors.MOBILE_TEXT_HEADING_PRIMARY, 20, {
marginBottom: 8
}),
textAlign: "center"
},
remainingUsersIcon: {
tintColor: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY,
height: 18,
width: 18
},
remainingUsersIconContainer: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
borderRadius: 16,
height: 32,
width: 32,
alignItems: "center",
justifyContent: "center"
}
});
Component = memo(function({ eventUser, guildId: guildId2 }) {
const styles = useStyles();
const analyticsLocations = useAnalyticsLocations().analyticsLocations;
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getUser(eventUser.user_id));
const stateFromStoresObject = useStateFromStoresObject([PresenceStore], () => ({
isMobileOnline: PresenceStore.isMobileOnline(eventUser.user_id),
isVROnline: PresenceStore.isVROnline(eventUser.user_id),
status: PresenceStore.getStatus(eventUser.user_id)
}), [eventUser.user_id]);
const { isMobileOnline, isVROnline, status } = stateFromStoresObject;
const leading = stateFromStores != null ? <Avatar user={stateFromStores} guildId={guildId2} isMobileOnline={isMobileOnline} isVROnline={isVROnline} status={status} size={AvatarSizes.REFRESH_MEDIUM_32} autoStatusCutout /> : null;
let nick = eventUser.member?.nick;
if (nick == null) {
nick = UserUtils.getName(eventUser.user);
}
return <FormRow key={eventUser.user_id} DEPRECATED_style={styles.userListRow} leading={leading} label={<DiscordTag user={stateFromStores} nick={nick} usernameStyle={styles.userName} nicknameStyle={styles.userName} />} onPress={() => {
showUserProfileActionSheet({
userId: eventUser.user_id,
sourceAnalyticsLocations: analyticsLocations
});
}} />;
});
EventDetailRsvpSheet.displayName = "EventDetailRsvpSheet";
export default EventDetailRsvpSheet;
export { Component as UserRow };
@@ -0,0 +1,4 @@
// Metro module 12278 (f12279).
export function isRemainingUsersGroup(a0) {
return a0.count !== void 0;
}
@@ -0,0 +1,417 @@
// Metro module 15158 (f15159).
import { useCallback, memo } from "react";
import { View } from "react-native";
import StageChannelParticipantStore from "../../../stage_channels/StageChannelParticipantStore";
import StageInstanceStore from "../../../stage_channels/StageInstanceStore";
import ApplicationStreamingStore from "../../../../stores/ApplicationStreamingStore";
import PermissionStore from "../../../../stores/PermissionStore";
import SortedVoiceStateStore from "../../../../stores/views/SortedVoiceStateStore";
import { GuildScheduledEventEntityTypes } from "../../GuildScheduledEventsConstants";
import { Permissions } from "../../../../_bundle/Module505";
import { jsx } from "react/jsx-runtime";
import Module712 from "../../../../_bundle/Module712";
import { Avatar, LiveTag, AvatarSizes, AVATAR_SIZE_MAP } from "../../../../design/void/native";
import MarkupUtils from "../../../markup/MarkupUtils";
import { inlineChannelMentionReact, inlineChannelReact } from "../../../markup/native/MarkupInlineChannelMentionRules";
import { smartOutput } from "../../../markup/MarkupRulesUtils";
import { scaleTextLineHeight } from "../../../screen/native/useScaledTextLineHeight.android";
import { isAndroid } from "../../../../utils/PlatformUtils";
import { SMALL_BUTTON_HEIGHT } from "../../../../design/components/Button/native/ButtonConstants.native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { Text } from "../../../../design/components/Text/native/Text";
import { HeadphonesIcon } from "../../../../design/components/Icon/native/redesign/generated/HeadphonesIcon";
import { makeSizeStyle } from "../../../main_tabs_v2/native/shared_components/guild_channels/layouts/ChannelListLayout";
import useTheme from "../../../../hooks/useTheme";
import useIsUsingClientTheme from "../../../client_themes/native/useIsUsingClientTheme";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { isThemeLight } from "../../../../design/shared";
import useChannelName from "../../../channel/useChannelName";
import { useStateFromStoresArray, useStateFromStores } from "../../../../_bundle/Module589";
import { intl, t } from "../../../../intl/index.native";
import { getChannelIconComponent } from "../../../../utils/native/ChannelUtils";
import { CalendarIcon } from "../../../../design/components/Icon/native/redesign/generated/CalendarIcon";
import { getLocationFromEvent } from "../../utils/EntityUtils";
import * as _LocationIcon from "../../../../design/components/Icon/native/redesign/generated/LocationIcon";
import { openGuildEventDetails } from "../../GuildScheduledEventModalActionCreators.native";
import { useStageParticipants } from "../../../stage_channels/StageChannelParticipantStoreHooks";
import { StageChannelParticipantNamedIndex, StageChannelParticipantTypes } from "../../../stage_channels/StageChannelParticipants";
import { useStageHasStream } from "../../../stage_channels/StageMediaHooks";
import { useGuildActiveEvent } from "../../useGuildScheduledEvents";
import { StageIcon } from "../../../../design/components/Icon/native/redesign/generated/StageIcon";
import { useActiveEventOrStageInstanceChannel } from "../../useActiveEventOrStageInstanceChannel";
import { openChannelLongPressActionSheet } from "../../../channel/native/openChannelLongPressActionSheet";
import { Card } from "../../../../design/components/Card/native/Card.native";
function $mk95601($env) {
return () => {
const r3 = $env[0];
if (r3 != null) {
const r2 = $env.$parent;
const r5 = r2[2];
const r6 = r2[3];
r5(r6[22]).dismissGlobalKeyboard();
const isGuildVoice = r3.isGuildVoice();
const r13 = r2[0];
if (isGuildVoice) {
r13(r6[23]).openGuildVoiceModal(r3);
} else {
r13(r6[24]).connectAndOpen(r3);
}
}
};
}
let JoinChannelButton, GuildVoiceEventNotice, GuildExternalEventNotice, SeeDetailButton, GuildLiveStageNotice, PX_8, PX_12, XSMALL, c10754_19, PX_122, c10754_21, c10754_22, c10754_23, PX_82, PX_4, c10754_26, useStyles, useStyles2, Component;
let env10754 = {};
const UserSummaryRow = function UserSummaryRow(props) {
let r30, audienceCount, isLiveStreaming, styles;
const { users, max = 5 } = props;
let c21719_0, guildId, c21719_2, c21719_3;
L15: {
L6: {
c21719_0 = max;
guildId = props.guildId;
audienceCount = props.audienceCount;
isLiveStreaming = props.isLiveStreaming;
c21719_2 = void 0;
c21719_3 = void 0;
c21719_2 = Math.max(users.length - max, 0);
styles = useStyles(c10754_19);
c21719_3 = styles;
if (users.length === 0) {
if (audienceCount != null && audienceCount !== 0) {
break L6;
}
r30 = null;
if (!isLiveStreaming) {
break L15;
}
}
}
const r37 = [users.map((a0, index) => {
let r30, View2, jsx2;
if (index >= c21719_0) {
return void 0;
}
if (index === c21719_0 - 1) {
if (c21719_2 > 0) {
r30 = <View key="overflow" style={[c21719_3.wrapper, index !== 0 && {
marginLeft: 4
}]}>
<View style={c21719_3.overflowCircle}>
<Text variant="text-xs/medium" lineClamp={1} maxFontSizeMultiplier={1}>
{`+${c21719_2 + 1}`}
</Text>
</View>
</View>;
} else {
jsx2 = jsx;
View2 = View;
r30 = jsx2(View2, {
style: [c21719_3.wrapper, index !== 0 && {
marginLeft: 4
}],
children: (0, jsx)(Avatar, {
user: a0,
guildId,
size: XSMALL
})
}, index);
}
} else {
jsx2 = jsx;
View2 = View;
r30 = jsx2(View2, {
style: [c21719_3.wrapper, index !== 0 && {
marginLeft: 4
}],
children: (0, jsx)(Avatar, {
user: a0,
guildId,
size: XSMALL
})
}, index);
}
return r30;
}), audienceCount != null && audienceCount > 0 && <View style={[styles.wrapper, users.length > 0 && {
marginLeft: 4
}]}>
<View style={[styles.badge, styles.audienceBadge]}>
<HeadphonesIcon size="custom" style={makeSizeStyle(14)} />
<Text variant="text-xs/semibold" style={{
marginLeft: 4
}} maxFontSizeMultiplier={1}>{audienceCount}</Text>
</View>
</View>, ,];
if (isLiveStreaming) {
isLiveStreaming = (0, jsx)(LiveTag, {
style: {
marginLeft: 4
}
});
}
r37[2] = isLiveStreaming;
r30 = <View style={styles.container}>{r37}</View>;
}
return r30;
};
JoinChannelButton = function JoinChannelButton(props) {
const { channel: channel3, label, disabled = false } = props;
let env21720;
const styles2 = useStyles2();
const theme = useTheme();
const isUsingClientTheme = useIsUsingClientTheme();
const r19 = env21720 = {
$parent: env10754
};
env21720[0] = channel3;
return <View style={styles2.button}>
<Button onPress={useCallback($mk95601(r19), [channel3])} variant={isThemeLight(theme) ? isUsingClientTheme ? "tertiary" : "active" : "tertiary"} size="sm" disabled={disabled} text={label} />
</View>;
};
GuildVoiceEventNotice = function GuildVoiceEventNotice(props) {
const { guildEvent: guildEvent2, channel } = props;
const channelName = useChannelName(channel);
const stateFromStoresArray = useStateFromStoresArray([SortedVoiceStateStore], () => SortedVoiceStateStore.getVoiceStatesForChannel(channel).map((item) => item.user));
const stateFromStores = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.CONNECT, channel));
const stateFromStores2 = useStateFromStores([ApplicationStreamingStore], () => ApplicationStreamingStore.getAllApplicationStreamsForChannel(channel.id).length > 0);
return <Component heading={intl.string(t["X2K3/4"])} topic={guildEvent2.name} location={channelName} LocationIcon={getChannelIconComponent(channel)} LiveIcon={CalendarIcon} voiceUsers={<UserSummaryRow guildId={channel.guild_id} users={stateFromStoresArray} isLiveStreaming={stateFromStores2} />} joinButton={stateFromStores ? <JoinChannelButton channel={channel} label={intl.string(t.VJlc0S)} /> : void 0} />;
};
GuildExternalEventNotice = function GuildExternalEventNotice(props) {
const guildEvent2 = props.guildEvent;
const locationFromEvent = getLocationFromEvent(guildEvent2);
return locationFromEvent != null ? <Component heading={intl.string(t.TxqPQR)} topic={guildEvent2.name} location={c10754_26(locationFromEvent, true)} LocationIcon={_LocationIcon.LocationIcon} LiveIcon={CalendarIcon} joinButton={<SeeDetailButton guildEvent={guildEvent2} />} /> : null;
};
SeeDetailButton = function SeeDetailButton(props) {
const guildEvent = props.guildEvent;
return <View style={useStyles2().button}>
<Button onPress={useCallback(() => {
openGuildEventDetails({
eventId: guildEvent.id,
event: guildEvent
});
}, [guildEvent])} variant="active" size="sm" text={intl.string(t.z4FcDs)} />
</View>;
};
GuildLiveStageNotice = function GuildLiveStageNotice(props) {
const { stageInstance, channel: channel2 } = props;
const channelName = useChannelName(channel2);
const users = useStageParticipants(channel2.id, StageChannelParticipantNamedIndex.SPEAKER).filter((item) => item.type === StageChannelParticipantTypes.VOICE).map((item) => item.user);
const stateFromStores = useStateFromStores([StageChannelParticipantStore], () => StageChannelParticipantStore.getParticipantCount(channel2.id, StageChannelParticipantNamedIndex.AUDIENCE), [channel2.id]);
const stateFromStores2 = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.CONNECT, channel2));
const stageHasStream = useStageHasStream(channel2.id);
const guildActiveEvent2 = useGuildActiveEvent(channel2.guild_id);
return <Component heading={intl.string(t["X2K3/4"])} location={channelName} LocationIcon={guildActiveEvent2 != null ? getChannelIconComponent(channel2) : void 0} LiveIcon={guildActiveEvent2 != null ? CalendarIcon : StageIcon} topic={stageInstance.topic} voiceUsers={<UserSummaryRow guildId={channel2.guild_id} users={users} isLiveStreaming={stageHasStream} audienceCount={stateFromStores} />} joinButton={stateFromStores2 ? <JoinChannelButton channel={channel2} label={intl.string(t["7vb2cc"])} /> : void 0} />;
};
PX_8 = Module712.space.PX_8;
PX_12 = Module712.space.PX_12;
XSMALL = AvatarSizes.XSMALL;
c10754_19 = AVATAR_SIZE_MAP[XSMALL];
PX_122 = Module712.space.PX_12;
c10754_21 = "text-xs/bold";
c10754_22 = "text-md/semibold";
c10754_23 = "text-xs/medium";
PX_82 = Module712.space.PX_8;
PX_4 = Module712.space.PX_4;
c10754_26 = MarkupUtils.reactParserFor({
...MarkupUtils.guildEventRules,
channelMention: {
...MarkupUtils.guildEventRules.channelMention,
react: inlineChannelMentionReact
},
guild: {
react: (a0, a1, a2) => typeof a0.content === "string" ? a0.content : smartOutput(a0, a1, a2)
},
channel: {
react: inlineChannelReact
}
});
useStyles = createStyles((a0) => ({
container: {
flexDirection: "row",
alignItems: "center",
marginTop: PX_82
},
overflowCircle: {
backgroundColor: Module712.colors.BACKGROUND_MOD_STRONG,
borderRadius: Module712.radii.round,
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
height: a0,
paddingHorizontal: 6
},
wrapper: {
borderRadius: Module712.radii.round,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
height: c10754_19
},
badge: {
borderRadius: Module712.radii.round,
paddingHorizontal: 8,
display: "flex",
flexDirection: "row",
alignItems: "center",
height: a0
},
audienceBadge: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER
}
}));
useStyles2 = createStyles({
card: {
padding: PX_122
},
row: {
flexDirection: "row",
alignItems: "center"
},
infoRow: {
marginTop: PX_4
},
liveNowIcon: {
marginEnd: 4
},
uppercase: {
textTransform: "uppercase"
},
headingText: {
marginTop: isAndroid() ? -2 : 0
},
liveDot: {
width: 7,
height: 7,
marginRight: 7,
backgroundColor: Module712.colors.STATUS_POSITIVE,
borderRadius: Module712.radii.xs
},
calendarIcon: {
marginRight: 7
},
topic: {
marginTop: PX_82
},
button: {
marginTop: PX_82
}
});
Component = memo(function(a0) {
let r27, jsx2;
const { heading, location: location2, LocationIcon: LocationIcon2, topic } = a0;
let isLiveStreaming = a0.isLiveStreaming;
const { LiveIcon, voiceUsers, joinButton } = a0;
const styles2 = useStyles2();
if (LiveIcon != null) {
r27 = <LiveIcon size="xxs" color="status-positive" style={styles2.calendarIcon} />;
jsx2 = jsx;
} else {
jsx2 = jsx;
r27 = jsx2(View, {
style: styles2.liveDot
});
}
const r29 = [r27, ,];
const variant = isLiveStreaming ? c10754_21 : "text-xs/semibold";
const style = [styles2.headingText, ,];
if (isLiveStreaming) {
isLiveStreaming = styles2.uppercase;
}
style[1] = isLiveStreaming;
r29[1] = jsx2(Text, {
variant,
color: "status-positive",
style,
children: heading
});
return <View>
<View style={styles2.row}>{r29}</View>
{voiceUsers}
{jsx2(Text, {
style: styles2.topic,
lineClamp: 1,
variant: c10754_22,
color: "redesign-channel-name-text",
children: topic
})}
{jsx2(View, {
style: [styles2.row, styles2.infoRow],
children: location2 != null && <>
{[LocationIcon2 != null && jsx2(LocationIcon2, {
style: styles2.liveNowIcon,
size: "xxs",
color: "redesign-channel-name-muted-text"
}), jsx2(Text, {
lineClamp: 1,
variant: c10754_23,
color: "redesign-channel-name-muted-text",
style: {
marginTop: isAndroid() ? -2 : 0,
flexShrink: 1
},
children: location2
})]}
</>
})}
{joinButton}
</View>;
});
const r140 = memo(function({ guild, style }) {
let children;
let env21725;
const styles2 = useStyles2();
const activeEventOrStageInstanceChannel = useActiveEventOrStageInstanceChannel(guild.id);
const guildActiveEvent = useGuildActiveEvent(guild.id);
const stateFromStores = useStateFromStores([StageInstanceStore], () => StageInstanceStore.getStageInstanceByChannel(activeEventOrStageInstanceChannel?.id), [activeEventOrStageInstanceChannel]);
const r31 = env21725 = {
$parent: env10754
};
env21725[0] = activeEventOrStageInstanceChannel;
const callback = useCallback($mk95601(r31), [activeEventOrStageInstanceChannel]);
const callback2 = useCallback(() => {
if (guildActiveEvent != null) {
openGuildEventDetails({
eventId: guildActiveEvent.id,
event: guildActiveEvent
});
} else if (activeEventOrStageInstanceChannel?.id != null) {
openChannelLongPressActionSheet(activeEventOrStageInstanceChannel.id);
}
}, [activeEventOrStageInstanceChannel?.id, guildActiveEvent]);
const entity_type = guildActiveEvent?.entity_type;
L13: {
if (entity_type === GuildScheduledEventEntityTypes.EXTERNAL) {
children = (0, jsx)(GuildExternalEventNotice, {
guildEvent: guildActiveEvent
});
} else {
if (activeEventOrStageInstanceChannel != null && stateFromStores != null) {
children = (0, jsx)(GuildLiveStageNotice, {
stageInstance: stateFromStores,
channel: activeEventOrStageInstanceChannel
});
break L13;
}
children = activeEventOrStageInstanceChannel != null && guildActiveEvent != null ? (0, jsx)(GuildVoiceEventNotice, {
guildEvent: guildActiveEvent,
channel: activeEventOrStageInstanceChannel
}) : null;
}
}
return children == null ? null : (0, jsx)(Card, {
variant: "secondary",
style: [styles2.card, style],
onPress: callback,
onLongPress: callback2,
children
});
});
export default r140;
export { PX_8 as LIVE_CHANNEL_NOTICE_MARGIN_TOP };
export { PX_12 as LIVE_CHANNEL_NOTICE_MARGIN_BOTTOM };
export function getScaledLiveChannelNoticeHeight(a0, { hasSpeakers, hasButton, hasAudience, hasStream }) {
const r19 = scaleTextLineHeight(c10754_21, a0);
const r20 = !hasSpeakers && !hasAudience ? hasStream ? PX_82 + c10754_19 : 0 : PX_82 + c10754_19;
const r29 = PX_82 + scaleTextLineHeight(c10754_22, a0);
const r38 = PX_4 + (isAndroid() ? -2 : 0) + scaleTextLineHeight(c10754_23, a0);
const r39 = hasButton ? PX_82 + SMALL_BUTTON_HEIGHT : 0;
return PX_8 + PX_122 + r19 + r20 + r29 + r38 + r39 + PX_122 + PX_12;
}
@@ -0,0 +1,23 @@
// Metro module 9510 (f9511).
import GuildScheduledEventStore from "../GuildScheduledEventStore";
import { handleNSFWGuildInvite } from "../../age_gate/native/AgeGateUtils";
import { isGuildScheduledEventInviteEmbed } from "../../instant_invite/InviteTypeUtils";
import InstantInviteActionCreators from "../../../actions/InstantInviteActionCreators";
import { transitionToEventDetailsFromInvite } from "./GuildScheduledEventModalActionCreators";
export default function handleAcceptEventInstantInvite(a0) {
if (!handleNSFWGuildInvite(a0) && isGuildScheduledEventInviteEmbed(a0) && a0.code != null) {
const id = a0.guild_scheduled_event?.id;
const guildScheduledEvent = GuildScheduledEventStore.getGuildScheduledEvent(id);
if (guildScheduledEvent != null) {
InstantInviteActionCreators.acceptInvite({
inviteKey: a0.code,
context: {
location: "Guild Scheduled Event Invite Button Embed"
},
callback: () => {
transitionToEventDetailsFromInvite(guildScheduledEvent);
}
});
}
}
};
@@ -0,0 +1,45 @@
// Metro module 11473 (f11474).
import { useCallback } from "react";
import ReadStateStore from "../../../../stores/ReadStateStore";
import UserGuildSettingsStore from "../../../../stores/UserGuildSettingsStore";
import { ReadStateTypes } from "../../../read_states/ReadStateConstants";
import { useStateFromStoresObject, useStateFromStores } from "../../../../_bundle/Module589";
import useGuildScheduledEvents from "../../useGuildScheduledEvents";
import { shouldShowMembershipVerificationGate } from "../../../guild_member_verification/hooks/useShowMemberVerificationGate";
import { openMemberVerificationModal } from "../../../guild_member_verification/MemberVerificationModalActionCreators";
import { openGuildEventListActionSheet } from "../GuildScheduledEventModalActionCreators";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { intl, t } from "../../../../intl/index.native";
import { ChannelModes } from "../../../guild_sidebar/native/BaseChannelItem";
export default function useEventsButtonProps(a0) {
const stateFromStoresObject = useStateFromStoresObject([ReadStateStore], () => ({
hasUnread: ReadStateStore.hasUnread(a0.id, ReadStateTypes.GUILD_EVENT),
mentionCount: ReadStateStore.getMentionCount(a0.id, ReadStateTypes.GUILD_EVENT)
}), [a0.id]);
const { hasUnread, mentionCount } = stateFromStoresObject;
const stateFromStores = useStateFromStores([UserGuildSettingsStore], () => UserGuildSettingsStore.isMuteScheduledEventsEnabled(a0.id));
const guildScheduledEvents = useGuildScheduledEvents(a0.id);
const callback = useCallback(() => shouldShowMembershipVerificationGate(a0.id) ? openMemberVerificationModal(a0.id) : openGuildEventListActionSheet(a0), [a0]);
const callback2 = useCallback(() => {
const r14 = import("../components/UpcomingEventsLongPressActionSheet");
ActionSheetActionCreators.openLazy(r14, `UpcomingEventsLongPress-${a0.id}`, {
guildId: a0.id
});
}, [a0.id]);
const name = guildScheduledEvents.length > 0 ? intl.formatToPlainString(t.IBdqSu, {
number: guildScheduledEvents.length
}) : intl.string(t.tlopTM);
let DEFAULT = ChannelModes.DEFAULT;
if (hasUnread && !stateFromStores) {
DEFAULT = ChannelModes.UNREAD_IMPORTANT;
}
return {
hasUnread,
mentionCount,
mode: DEFAULT,
name,
eventsMuted: stateFromStores,
handlePress: callback,
handleLongPress: callback2
};
};
@@ -0,0 +1,9 @@
// Metro module 12269 (f12270).
import GuildScheduledEventsActionCreators from "./GuildScheduledEventsActionCreators";
export default function restoreEventRecurrence({ scheduled_start_time, scheduled_end_time }, a1, a2, a3) {
return scheduled_start_time == null && scheduled_end_time == null ? GuildScheduledEventsActionCreators.deleteGuildEventException(a1, a2, a3) : GuildScheduledEventsActionCreators.updateGuildEventException({
scheduled_start_time,
scheduled_end_time,
is_canceled: false
}, a1, a2, a3);
};
@@ -0,0 +1,22 @@
// Metro module 8231 (f8232).
import { getBaseScheduleForRecurrence, areDatesIdentical, areSchedulesIdentical } from "./utils/ScheduleUtils";
import GuildScheduledEventsActionCreators from "./GuildScheduledEventsActionCreators";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
export default function saveGuildEventRecurrence(a0, a1, a2, a3) {
const baseScheduleForRecurrence = getBaseScheduleForRecurrence(a1, a0);
const r29 = areDatesIdentical(baseScheduleForRecurrence.startDate, a2.startDate) ? null : a2.startDate;
const r35 = areDatesIdentical(baseScheduleForRecurrence.endDate, a2.endDate) ? null : a2.endDate;
if (a3 != null) {
return areSchedulesIdentical(a2, baseScheduleForRecurrence) ? GuildScheduledEventsActionCreators.deleteGuildEventException(a0.guild_id, a0.id, a3.event_exception_id) : GuildScheduledEventsActionCreators.updateGuildEventException({
scheduled_start_time: r29 == null ? void 0 : r29.toISOString(),
scheduled_end_time: r35 == null ? void 0 : r35.toISOString(),
is_canceled: a3.is_canceled
}, a0.guild_id, a0.id, a1);
}
return GuildScheduledEventsActionCreators.createGuildEventException({
original_scheduled_start_time: new Date(SnowflakeUtils.extractTimestamp(a1)).toISOString(),
scheduled_start_time: r29 == null ? void 0 : r29.toISOString(),
scheduled_end_time: r35 == null ? void 0 : r35.toISOString(),
is_canceled: false
}, a0.guild_id, a0.id);
};
@@ -0,0 +1,12 @@
// Metro module 15157 (f15158).
import ChannelStore from "../../stores/ChannelStore";
import { useFirstActiveEventChannel } from "./useGuildScheduledEvents";
import useLiveStageChannels from "../stage_channels/useLiveStageChannels";
export function useActiveEventOrStageInstanceChannel(a0) {
let r10 = useFirstActiveEventChannel(a0);
const channel = ChannelStore.getChannel(useLiveStageChannels(a0)[0]?.id);
if (r10 == null) {
r10 = channel;
}
return r10;
}
@@ -0,0 +1,27 @@
// Metro module 8320 (f8321).
import _slicedToArray from "../../_bundle/_slicedToArray";
import GuildChannelStore, { GUILD_VOCAL_CHANNELS_KEY } from "../../stores/GuildChannelStore";
import GuildStore from "../../stores/GuildStore";
import PermissionStore from "../../stores/PermissionStore";
import { Permissions } from "../../Constants";
import { useStateFromStores } from "../../_bundle/Module589";
import { attachChannelPermissions } from "../permissions/useManageResourcePermissions";
export default function useCanCreateAnEvent(a0, a1) {
return useStateFromStores([GuildStore, GuildChannelStore, PermissionStore], () => {
const guild = GuildStore.getGuild(a0);
if (!PermissionStore.can(Permissions.ADMINISTRATOR, guild) && !PermissionStore.can(Permissions.CREATE_EVENTS, guild)) {
for (const item of GuildChannelStore.getChannels(a0)[GUILD_VOCAL_CHANNELS_KEY]) {
const channel = item.channel;
if (a1 != null && channel.type !== a1) {
continue;
}
if (!PermissionStore.can(_slicedToArray(attachChannelPermissions(channel), 1)[0], channel)) {
continue;
}
return true;
}
return false;
}
return true;
}, [a0, a1]);
};
@@ -0,0 +1,40 @@
// Metro module 8226 (f8227).
import StageInstanceStore from "../stage_channels/StageInstanceStore";
import ChannelStore from "../../stores/ChannelStore";
import GuildChannelStore from "../../stores/GuildChannelStore";
import GuildStore from "../../stores/GuildStore";
import PermissionStore from "../../stores/PermissionStore";
import { isGuildEventEnded } from "./GuildScheduledEventStore";
import { GuildScheduledEventEntityTypes } from "./GuildScheduledEventsConstants";
import { Permissions } from "../../Constants";
import { canEveryoneRole } from "../../utils/PermissionUtils";
import { canViewInviteModal } from "../instant_invite/canViewInviteModal";
import { useStateFromStores } from "../../_bundle/Module589";
let isGuildEventInvitable;
const canEveryoneRoleViewEvent = function canEveryoneRoleViewEvent(a0, r5 = [ChannelStore]) {
const [r25] = r5;
const r28 = "entity_type" in a0 ? {
entityType: a0.entity_type,
channelId: a0.channel_id
} : a0;
const { entityType, channelId } = r28;
if (entityType === GuildScheduledEventEntityTypes.EXTERNAL) {
return true;
}
const channel = r25.getChannel(channelId);
return channel != null && canEveryoneRole(Permissions.VIEW_CHANNEL, channel);
};
isGuildEventInvitable = function isGuildEventInvitable(guildEvent, r6 = [GuildChannelStore, ChannelStore, GuildStore, StageInstanceStore]) {
const [r13, r8, r11, r9] = r6;
if (isGuildEventEnded(guildEvent)) {
return false;
}
const { guild_id, channel_id } = guildEvent;
const r57 = guildEvent.entity_type === GuildScheduledEventEntityTypes.EXTERNAL ? r13.getDefaultChannel(guildEvent.guild_id) : r8.getChannel(channel_id);
return !!canViewInviteModal(PermissionStore, r11.getGuild(guild_id), r57, r9.getStageInstanceByChannel(channel_id)) && (r57 != null && canEveryoneRoleViewEvent(guildEvent, [r8]));
};
export default function useCanInviteForGuildEvent(a0) {
return useStateFromStores([GuildChannelStore, ChannelStore, GuildStore, StageInstanceStore], () => isGuildEventInvitable(a0, [GuildChannelStore, ChannelStore, GuildStore, StageInstanceStore]), [a0]);
};
export { canEveryoneRoleViewEvent };
export { isGuildEventInvitable };
@@ -0,0 +1,17 @@
// Metro module 11471 (f11472).
import useCanCreateAnEvent from "./useCanCreateAnEvent";
import useGuildScheduledEvents from "./useGuildScheduledEvents";
import useIsHubForGuild from "../hub/useIsHubForGuild";
export default function useCanSeeEventsInChannelList(a0) {
let r9 = useCanCreateAnEvent(a0);
const guildScheduledEvents = useGuildScheduledEvents(a0);
const isHubForGuild = useIsHubForGuild(a0);
let r15 = !isHubForGuild;
if (!isHubForGuild) {
if (!r9) {
r9 = guildScheduledEvents.length > 0;
}
r15 = r9;
}
return r15;
};
@@ -0,0 +1,29 @@
// Metro module 8215 (f8216).
import GuildScheduledEventStore from "./GuildScheduledEventStore";
import { useStateFromStoresArray } from "../../_bundle/Module589";
function $mk80113($env) {
return (a0) => a0.event_exception_id === $env[0];
}
export default function useEventException(a0, c16369_0) {
let env16370;
const stateFromStoresArray = useStateFromStoresArray([GuildScheduledEventStore], () => {
let r8 = GuildScheduledEventStore.getGuildScheduledEvent(c16369_0)?.guild_scheduled_event_exceptions;
if (r8 == null) {
r8 = [];
}
return r8;
});
const r14 = env16370 = {};
env16370[0] = a0;
return stateFromStoresArray == null ? void 0 : stateFromStoresArray.find($mk80113(r14));
};
export function getEventException(a0, a1) {
let r5 = GuildScheduledEventStore.getGuildScheduledEvent(a1)?.guild_scheduled_event_exceptions;
if (r5 == null) {
r5 = [];
}
let env16371;
const r9 = env16371 = {};
env16371[0] = a0;
return r5 == null ? void 0 : r5.find($mk80113(r9));
}
@@ -0,0 +1,71 @@
// 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;
}
@@ -0,0 +1,42 @@
// Metro module 8264 (f8265).
import StageInstanceStore from "../stage_channels/StageInstanceStore";
import GuildChannelStore, { GUILD_VOCAL_CHANNELS_KEY } from "../../stores/GuildChannelStore";
import PermissionStore from "../../stores/PermissionStore";
import { CREATE_GUILD_EVENT_STAGE_CHANNEL_PERMISSIONS, CREATE_GUILD_EVENT_VOICE_CHANNEL_PERMISSIONS } from "./PermissionsConstants";
import { useStateFromStores, useStateFromStoresArray } from "../../_bundle/Module589";
import { getManageResourcePermissions } from "../permissions/useManageResourcePermissions";
const getEventChannelsByType = function getEventChannelsByType(id, a1, r2 = [GuildChannelStore]) {
const [r29] = r2;
if (a1 == null) {
return [];
}
const r9 = r29.getChannels(id)[GUILD_VOCAL_CHANNELS_KEY];
const r36 = [];
for (const item of r9) {
const channel = item.channel;
const manageResourcePermissions = getManageResourcePermissions(channel);
let canCreateGuildEvent = manageResourcePermissions.canCreateGuildEvent;
const canManageAllEvents = manageResourcePermissions.canManageAllEvents;
if (!canCreateGuildEvent) {
canCreateGuildEvent = canManageAllEvents;
}
const r51 = canCreateGuildEvent;
if (channel.type === a1 && (channel.isGuildVoice() && r51 || channel.isGuildStageVoice() && r51)) {
r36.push(channel);
}
}
return r36;
};
export function useCanCreateEventInStageChannel(a0) {
const stateFromStores = useStateFromStores([PermissionStore], () => PermissionStore.can(CREATE_GUILD_EVENT_STAGE_CHANNEL_PERMISSIONS, a0), [a0]);
const stateFromStores2 = useStateFromStores([StageInstanceStore], () => StageInstanceStore.getStageInstanceByChannel(a0.id));
return a0.isGuildStageVoice() && stateFromStores && stateFromStores2 == null;
}
export function useCanCreateEventInVoiceChannel(a0) {
const stateFromStores = useStateFromStores([PermissionStore], () => PermissionStore.can(CREATE_GUILD_EVENT_VOICE_CHANNEL_PERMISSIONS, a0), [a0]);
return a0.isGuildVoice() && stateFromStores;
}
export { getEventChannelsByType };
export function useGetEventChannelsByType(a0, a1) {
return useStateFromStoresArray([GuildChannelStore], () => getEventChannelsByType(a0, a1, [GuildChannelStore]), [a0, a1]);
}
@@ -0,0 +1,47 @@
// Metro module 8331 (f8332).
import { useState, useEffect, useMemo } from "react";
import GuildScheduledEventStore from "./GuildScheduledEventStore";
import { useStateFromStores } from "../../_bundle/Module589";
import usePrevValue from "../../hooks/usePrevValue";
import { generateNextRecurrences, getRRule, MAX_YEARS_AHEAD_RECURRING_EVENT } from "./utils/ScheduleUtils";
import Module12 from "../../_bundle/Module12";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import Durations from "../../utils/Durations";
import GuildScheduledEventManager from "./GuildScheduledEventManager";
export default function useGuildEventRecurrences(a0, a1, a2) {
let c16508_4;
const stateFromStores = useStateFromStores([GuildScheduledEventStore], () => GuildScheduledEventStore.getGuildScheduledEvent(a0));
const prevValue = usePrevValue(a2);
c16508_4 = prevValue;
const [state, setState] = useState(a2 != null && stateFromStores != null ? generateNextRecurrences(4, getRRule(a2), new Date(stateFromStores.scheduled_start_time)) : []);
useEffect(() => {
if (c16508_4 != null) {
if (a2 != null && stateFromStores != null && !Module12.isEqual(c16508_4, a2)) {
setState(generateNextRecurrences(state.length, getRRule(a2), new Date(stateFromStores.scheduled_start_time)));
}
}
}, [a2, state.length, stateFromStores, prevValue]);
useEffect(() => {
if (a1 != null) {
GuildScheduledEventManager.getGuildEventUserCounts(a1, a0, state.map((item) => SnowflakeUtils.fromTimestamp(Math.floor(item.getTime() / Durations.Millis.SECOND) * Durations.Millis.SECOND)));
}
}, [a0, a1, state]);
return {
recurrenceStartTimes: state,
canViewMoreRecurrences: useMemo(() => {
if (a2 != null && state.length !== 0 && stateFromStores?.scheduled_start_time != null) {
const date = new Date();
date.setFullYear(date.getFullYear() + MAX_YEARS_AHEAD_RECURRING_EVENT);
const r31 = state[state.length - 1];
const r37 = getRRule(a2).after(r31);
return r37 != null && r37 <= date;
}
return false;
}, [a2, state, stateFromStores?.scheduled_start_time]),
updateRecurrenceStartTimes: function updateRecurrenceStartTimes() {
if (a2 != null && stateFromStores != null) {
setState([...state, ...generateNextRecurrences(4, getRRule(a2), state[state.length - 1], true)]);
}
}
};
};
@@ -0,0 +1,65 @@
// Metro module 15154 (f15155).
import { useMemo } from "react";
import StageChannelParticipantStore from "../stage_channels/StageChannelParticipantStore";
import StageInstanceStore from "../stage_channels/StageInstanceStore";
import ApplicationStreamingStore from "../../stores/ApplicationStreamingStore";
import ChannelStore from "../../stores/ChannelStore";
import PermissionStore from "../../stores/PermissionStore";
import SortedVoiceStateStore from "../../stores/views/SortedVoiceStateStore";
import LiveChannelNoticesStore from "./LiveChannelNoticesStore";
import { GuildScheduledEventEntityTypes } from "./GuildScheduledEventsConstants";
import { Permissions } from "../../_bundle/Module505";
import useLiveStageChannels from "../stage_channels/useLiveStageChannels";
import { useStateFromStores, useStateFromStoresObject } from "../../_bundle/Module589";
import { useGuildActiveEvent } from "./useGuildScheduledEvents";
import { useActiveEventOrStageInstanceChannel } from "./useActiveEventOrStageInstanceChannel";
import { useActualStageSpeakerCount } from "../stage_channels/StageChannelParticipantStoreHooks";
import { StageChannelParticipantNamedIndex } from "../stage_channels/StageChannelParticipants";
export function useGuildHasLiveChannelNotice(a0) {
const id = useLiveStageChannels(a0)[0]?.id;
let guildActiveEvent;
const channel = ChannelStore.getChannel(id);
const stateFromStores = useStateFromStores([StageInstanceStore], () => StageInstanceStore.getStageInstanceByChannel(channel?.id), [channel]);
guildActiveEvent = useGuildActiveEvent(a0);
const stateFromStoresObject = useStateFromStoresObject([LiveChannelNoticesStore], () => ({
isStageNoticeHidden: LiveChannelNoticesStore.isLiveChannelNoticeHidden({
stageId: stateFromStores?.id
}),
isEventNoticeHidden: LiveChannelNoticesStore.isLiveChannelNoticeHidden({
eventId: guildActiveEvent?.id
})
}), [stateFromStores, guildActiveEvent]);
const { isStageNoticeHidden, isEventNoticeHidden } = stateFromStoresObject;
return guildActiveEvent != null ? stateFromStores != null ? !isStageNoticeHidden : !isEventNoticeHidden : stateFromStores != null && !isStageNoticeHidden;
}
export function useGuildLiveChannelNoticeInfo(a0) {
let r48;
let stateFromStores3, stateFromStores4, stateFromStores5, entity_type;
const activeEventOrStageInstanceChannel = useActiveEventOrStageInstanceChannel(a0);
const stateFromStores2 = useStateFromStores([PermissionStore], () => activeEventOrStageInstanceChannel != null && PermissionStore.can(Permissions.CONNECT, activeEventOrStageInstanceChannel));
const guildActiveEvent2 = useGuildActiveEvent(a0);
const stateFromStores6 = useStateFromStores([StageInstanceStore], () => StageInstanceStore.getStageInstanceByChannel(activeEventOrStageInstanceChannel?.id), [activeEventOrStageInstanceChannel]);
const r39 = useActualStageSpeakerCount(activeEventOrStageInstanceChannel?.id) > 0;
const stateFromStores7 = useStateFromStores([SortedVoiceStateStore], () => activeEventOrStageInstanceChannel != null && SortedVoiceStateStore.getVoiceStatesForChannel(activeEventOrStageInstanceChannel).length > 0);
stateFromStores3 = false;
if (activeEventOrStageInstanceChannel != null && stateFromStores6 != null) {
stateFromStores3 = r39;
r48 = r39;
} else {
const r2 = activeEventOrStageInstanceChannel != null && guildActiveEvent2 != null;
r48 = false;
if (r2) {
stateFromStores3 = stateFromStores7;
r48 = stateFromStores7;
}
}
stateFromStores4 = useStateFromStores([StageChannelParticipantStore], () => activeEventOrStageInstanceChannel != null && StageChannelParticipantStore.getParticipantCount(activeEventOrStageInstanceChannel.id, StageChannelParticipantNamedIndex.AUDIENCE) > 0, [activeEventOrStageInstanceChannel]);
stateFromStores5 = useStateFromStores([ApplicationStreamingStore], () => activeEventOrStageInstanceChannel != null && ApplicationStreamingStore.getAllApplicationStreamsForChannel(activeEventOrStageInstanceChannel.id).length > 0);
entity_type = guildActiveEvent2?.entity_type;
return useMemo(() => ({
hasButton: entity_type === GuildScheduledEventEntityTypes.EXTERNAL || stateFromStores2,
hasSpeakers: stateFromStores3,
hasAudience: stateFromStores4,
hasStream: stateFromStores5
}), [stateFromStores2, entity_type, r48, stateFromStores4, stateFromStores5]);
}
@@ -0,0 +1,14 @@
// Metro module 8220 (f8221).
import { useEffect } from "react";
import GuildScheduledEventStore from "./GuildScheduledEventStore";
import { useStateFromStores } from "../../_bundle/Module589";
import GuildScheduledEventManager from "./GuildScheduledEventManager";
export default function useGuildScheduledEventUserCount(a0, a1, a2) {
const stateFromStores = useStateFromStores([GuildScheduledEventStore], () => GuildScheduledEventStore.getUserCount(a1, a2));
useEffect(() => {
if (a0 != null && a1 != null) {
GuildScheduledEventManager.getGuildEventUserCounts(a0, a1, a2 != null ? [a2] : []);
}
}, [a1, a0, a2]);
return stateFromStores;
};
@@ -0,0 +1,170 @@
// Metro module 8321 (f8322).
import { useMemo, useState, useEffect } from "react";
import ChannelStore from "../../stores/ChannelStore";
import GuildStore from "../../stores/GuildStore";
import PermissionStore from "../../stores/PermissionStore";
import GuildScheduledEventStore, { StaticGuildEventIndexes, isGuildScheduledEventActive } from "./GuildScheduledEventStore";
import UpcomingEventNoticesStore from "./UpcomingEventNoticesStore";
import { GuildScheduledEventEntityTypes, GuildScheduledEventStatus } from "./GuildScheduledEventsConstants";
import { Permissions, GuildFeatures } from "../../Constants";
import Durations from "../../utils/Durations";
import { useStateFromStoresArray, useStateFromStores, useStateFromStoresObject } from "../../_bundle/Module589";
import { getNextRecurrenceIdInEvent, getEventTimeData } from "./utils/ScheduleUtils";
import { getNextShownUpcomingEventNoticeType } from "./GuildScheduledEventUtils";
import { getEventSchedule } from "./useEventSchedule";
function $mk80422($env) {
return () => {
const r0 = $env.$parent;
return r0[9].getGuildScheduledEventsByIndex(r0[8].GUILD_EVENT_UPCOMING($env[0])).filter($mk105831(r0));
};
}
function $mk105831($env) {
return (a0) => {
const r1 = $env;
if (a0.entity_type !== r1[11].NONE && a0.status === r1[12].SCHEDULED) {
if (a0.channel_id == null) {
return true;
}
return r1[6].can(r1[14].VIEW_CHANNEL, r1[4].getChannel(a0.channel_id));
}
return false;
};
}
let env5307 = {};
const c5307_15 = [];
const c5307_16 = 15 * Durations.Millis.MINUTE;
export default function useGuildEvents(a0, a1) {
return useStateFromStoresArray([GuildStore, GuildScheduledEventStore, PermissionStore, ChannelStore], () => {
let r16;
const guild = GuildStore.getGuild(a0);
if (guild == null) {
r16 = c5307_15;
} else {
let r11 = a1;
if (r11 == null) {
r11 = StaticGuildEventIndexes.GUILD_EVENT_UPCOMING(guild.id);
}
r16 = GuildScheduledEventStore.getGuildScheduledEventsByIndex(r11).filter(({ channel_id }) => {
if (channel_id == null) {
return true;
}
return PermissionStore.can(Permissions.VIEW_CHANNEL, ChannelStore.getChannel(channel_id));
});
}
return r16;
}, [a1, a0]);
};
export function useActiveEvent(a0) {
return useStateFromStores([GuildScheduledEventStore, ChannelStore, PermissionStore], () => {
const channel = ChannelStore.getChannel(a0);
if (PermissionStore.can(Permissions.VIEW_CHANNEL, channel)) {
if (channel?.guild_id == null) {
return null;
}
const guildScheduledEventsByIndex = GuildScheduledEventStore.getGuildScheduledEventsByIndex(StaticGuildEventIndexes.CHANNEL_EVENT_ACTIVE(a0));
return guildScheduledEventsByIndex.length > 0 ? guildScheduledEventsByIndex[0] : null;
}
return null;
}, [a0]);
}
export function useActiveEventsByChannel(a0) {
const stateFromStoresArray = useStateFromStoresArray([GuildScheduledEventStore], () => GuildScheduledEventStore.getGuildScheduledEventsForGuild(a0), [a0]);
return useMemo(() => {
const map = new Map();
let c26187_0 = map;
stateFromStoresArray.forEach((item) => {
const channel_id = item.channel_id;
if (channel_id != null) {
c26187_0.set(channel_id, item);
}
});
return map;
}, [stateFromStoresArray]);
}
export function useGuildUpcomingEvents(a0) {
let env16494;
const r1 = env16494 = {
$parent: env5307
};
env16494[0] = a0;
return useStateFromStoresArray([GuildScheduledEventStore, ChannelStore, PermissionStore], $mk80422(r1), [a0]);
}
export function useGuildUpcomingEventsNotice(a0) {
let env16499;
const r11 = env16499 = {
$parent: env5307
};
env16499[0] = a0;
const stateFromStoresArray2 = useStateFromStoresArray([GuildScheduledEventStore, ChannelStore, PermissionStore], $mk80422(r11), [a0]);
const stateFromStoresObject = useStateFromStoresObject([UpcomingEventNoticesStore], () => UpcomingEventNoticesStore.getAllEventDismissals());
const stateFromStoresObject2 = useStateFromStoresObject([UpcomingEventNoticesStore], () => UpcomingEventNoticesStore.getAllUpcomingNoticeSeenTimes());
const stateFromStoresObject3 = useStateFromStoresObject([GuildScheduledEventStore], () => stateFromStoresArray2 == null ? {} : stateFromStoresArray2.reduce((acc, item) => {
const nextRecurrenceIdInEvent = getNextRecurrenceIdInEvent(item);
const r12 = {
...acc
};
r12[item.id] = GuildScheduledEventStore.isInterestedInEventRecurrence(item.id, nextRecurrenceIdInEvent);
return r12;
}, {}), [stateFromStoresArray2]);
const stateFromStores2 = useStateFromStores([GuildStore], () => GuildStore.getGuild(a0));
const r55 = stateFromStores2 != null && !stateFromStores2.features.has(GuildFeatures.COMMUNITY) && stateFromStores2.features.has(GuildFeatures.INTERNAL_EMPLOYEE_ONLY);
if (stateFromStoresArray2 != null && stateFromStoresObject3 != null && r55) {
const length = stateFromStoresArray2.length;
let r0 = 0;
if (0 < length) {
do {
const upcomingEvent = stateFromStoresArray2[r0];
const r68 = stateFromStoresObject[upcomingEvent.id];
const r70 = stateFromStoresObject2[upcomingEvent.id];
let r72 = stateFromStoresObject3[upcomingEvent.id];
const r1 = r0;
if (r72 == null) {
r72 = false;
}
const nextShownUpcomingEventNoticeType = getNextShownUpcomingEventNoticeType(upcomingEvent, r68, r70, r72);
if (nextShownUpcomingEventNoticeType != null) {
return {
upcomingEvent,
noticeType: nextShownUpcomingEventNoticeType
};
}
r0 = r1 + 1;
} while (r0 < stateFromStoresArray2.length);
}
}
}
export function useGuildActiveEvent(a0) {
return useStateFromStores([GuildScheduledEventStore, ChannelStore, PermissionStore], () => GuildScheduledEventStore.getGuildScheduledEventsByIndex(StaticGuildEventIndexes.GUILD_EVENT_ACTIVE(a0)).find((item) => {
if (item.entity_type !== GuildScheduledEventEntityTypes.NONE && (0, isGuildScheduledEventActive)(item)) {
if (item.channel_id == null) {
return true;
}
return PermissionStore.can(Permissions.VIEW_CHANNEL, ChannelStore.getChannel(item.channel_id));
}
return false;
}), [a0]);
}
export function useGuildChannelScheduledEvents(a0) {
return useStateFromStores([GuildScheduledEventStore], () => GuildScheduledEventStore.getGuildScheduledEventsByIndex(StaticGuildEventIndexes.CHANNEL_EVENT_UPCOMING(a0)), [a0]);
}
export function useFirstActiveEventChannel(a0) {
return useStateFromStores([ChannelStore, GuildScheduledEventStore], () => ChannelStore.getChannel(GuildScheduledEventStore.getGuildScheduledEventsByIndex(StaticGuildEventIndexes.GUILD_EVENT_ACTIVE(a0)).find((item) => ChannelStore.getChannel(item.channel_id) != null)?.channel_id), [a0]);
}
export function useImminentUpcomingGuildEvents(a0) {
let stateFromStores;
const [state, setState] = useState(() => Date.now());
useEffect(() => {
let c26188_0 = setInterval(() => {
setState(Date.now());
}, c5307_16);
return () => clearInterval(c26188_0);
}, []);
stateFromStores = useStateFromStores([GuildScheduledEventStore], () => a0 == null ? [] : GuildScheduledEventStore.getGuildScheduledEventsByIndex(StaticGuildEventIndexes.CHANNEL_EVENT_UPCOMING(a0)), [a0, state]);
return useMemo(() => stateFromStores.filter((stateFromStore) => {
const eventSchedule = getEventSchedule(stateFromStore);
const { startTime, endTime } = eventSchedule;
const eventTimeData = getEventTimeData(startTime.toISOString(), endTime == null ? void 0 : endTime.toISOString());
const { withinStartWindow, diffMinutes } = eventTimeData;
return stateFromStore.status !== GuildScheduledEventStatus.ACTIVE && withinStartWindow && diffMinutes < 15;
}), [stateFromStores]);
}
@@ -0,0 +1,22 @@
// Metro module 8248 (f8249).
import GuildChannelStore, { GUILD_VOCAL_CHANNELS_KEY } from "../../stores/GuildChannelStore";
import PermissionStore from "../../stores/PermissionStore";
import { MODERATE_STAGE_CHANNEL_PERMISSIONS } from "../stage_channels/StageChannelPermissions";
import { useStateFromStoresArray } from "../../_bundle/Module589";
export function useChannelsUserCanStartStageIn(a0) {
let r8 = a0?.id;
if (r8 == null) {
r8 = null;
}
let c16414_0 = r8;
return useStateFromStoresArray([GuildChannelStore, PermissionStore], () => GuildChannelStore.getChannels(c16414_0)[GUILD_VOCAL_CHANNELS_KEY].reduce((acc, item) => {
const channel = item.channel;
if (channel.isGuildStageVoice()) {
const channel2 = item.channel;
if (PermissionStore !== void 0 && !!channel2.isGuildStageVoice() && PermissionStore.can(MODERATE_STAGE_CHANNEL_PERMISSIONS, channel2)) {
acc.push(channel);
}
}
return acc;
}, []), [r8]);
}
@@ -0,0 +1,35 @@
// Metro module 8222 (f8223).
import { useMemo } from "react";
import GuildScheduledEventStore from "./GuildScheduledEventStore";
import { GuildScheduledEventUserResponses } from "./GuildScheduledEventsConstants";
import { useStateFromStoresArray } from "../../_bundle/Module589";
export default function useInterestedEventUsers(a0, a1) {
let stateFromStoresArray2;
let c16379_0 = a0;
const stateFromStoresArray = useStateFromStoresArray([GuildScheduledEventStore], () => Object.values(GuildScheduledEventStore.getUsersForGuildEvent(c16379_0, null)), [a0]);
stateFromStoresArray2 = useStateFromStoresArray([GuildScheduledEventStore], () => Object.values(GuildScheduledEventStore.getUsersForGuildEvent(c16379_0, a1)), [a0, a1]);
return useMemo(() => {
let c26154_0, c26154_1, c26154_2;
const addUserToAllInterested = function addUserToAllInterested(a0) {
if (!c26154_1.has(a0.user_id)) {
c26154_2.push(a0);
c26154_1.add(a0.user_id);
}
};
c26154_0 = stateFromStoresArray2.reduce((acc, item) => {
acc[item.user_id] = item;
return acc;
}, {});
const r16 = stateFromStoresArray.filter((item) => {
const r6 = c26154_0[item.user_id];
return r6 == null || r6.response === GuildScheduledEventUserResponses.INTERESTED;
});
const r19 = stateFromStoresArray2.filter((item) => item.response === GuildScheduledEventUserResponses.INTERESTED);
c26154_1 = new Set();
const r25 = [];
c26154_2 = r25;
r16.forEach(addUserToAllInterested);
r19.forEach(addUserToAllInterested);
return r25;
}, [stateFromStoresArray, stateFromStoresArray2]);
};
@@ -0,0 +1,72 @@
// Metro module 12272 (f12273).
import _slicedToArray from "../../_bundle/_slicedToArray";
import { useState, useEffect, useCallback } from "react";
import ChannelStore from "../../stores/ChannelStore";
import SelectedChannelStore from "../../stores/SelectedChannelStore";
import { useStateFromStores } from "../../_bundle/Module589";
import { navigateToStage, connectOrLurkStage } from "../stage_channels/StageChannelModalActionCreators";
let env8475 = {};
export default function useSelectStage() {
let c19764_0;
let env19763 = {
$parent: env8475
};
const stateFromStores = useStateFromStores([SelectedChannelStore], () => SelectedChannelStore.getVoiceChannelId(), []);
env19763[0] = stateFromStores;
const r18 = _slicedToArray(useState(stateFromStores), 2);
const r19 = r18[0];
env19763[1] = r19;
env19763[2] = r18[1];
useEffect(() => {
let c27280_0 = setTimeout(() => {
(0, env19763[2])(env19763[0]);
}, 500);
return () => {
clearTimeout(c27280_0);
};
}, [stateFromStores]);
c19764_0 = void 0;
c19764_0 = async (c30516_0, c30516_1) => {
let c30516_5 = 0;
L14: {
L10: {
try {
c30516_5 = 1;
if (env19763[1] === c30516_1) {
const channel = ChannelStore.getChannel(c30516_1);
if (channel != null) {
navigateToStage(channel);
c30516_5 = 0;
break L10;
}
}
(0, env19763[2])(c30516_1);
await connectOrLurkStage(c30516_0, c30516_1);
c30516_5 = 0;
break L14;
} catch ($e) {
let r7 = $e;
if (c30516_5 !== 0) {
while (true) {
try {
c30516_5 = 0;
(0, env19763[2])(null);
break L14;
} catch ($e) {
r7 = $e;
if (c30516_5 === 0) {
break;
}
}
}
}
throw r7;
}
}
return void 0;
}
};
return [r19, useCallback(function() {
return c19764_0.apply(this, arguments);
}, [r19])];
};
@@ -0,0 +1,86 @@
// Metro module 8336 (f8337).
import { useState } from "react";
import { preStartEventActions, setEventAsActive } from "./StartEventUtils";
import { navigateToEvent, postStartActions } from "./StartEventPlatformUtils.native";
import { APIError } from "../../errors/index";
let c5319_6 = {
onSuccess: () => {},
permissionOverwrites: []
};
export default function useStartEvent() {
let _startEvent2 = function _startEvent() {
const r9 = async function(c29943_0, c29943_1, c29943_2) {
let c29943_5;
let c29943_6 = 0;
let c31465_2, c31465_3, c31465_0, c31465_1, c31465_4, c31465_5;
L24: {
try {
c31465_2 = void 0;
c31465_3 = void 0;
c31465_0 = c29943_0;
c31465_1 = c29943_1;
let r42 = c29943_2;
if (r42 === void 0) {
r42 = c5319_6;
}
let onSuccess2 = r42.onSuccess;
if (onSuccess2 === void 0) {
onSuccess2 = c5319_6.onSuccess;
}
c31465_2 = onSuccess2;
let permissionOverwrites = r42.permissionOverwrites;
if (permissionOverwrites === void 0) {
permissionOverwrites = c5319_6.permissionOverwrites;
}
c31465_3 = permissionOverwrites;
c31465_4 = void 0;
await void 0;
(0, setState)(true);
c29943_6 = 1;
await preStartEventActions(c31465_0, c31465_3);
await setEventAsActive(c31465_0, c31465_1);
await navigateToEvent(c31465_0, c31465_2);
await postStartActions(c31465_0, c31465_2);
(0, setState)(false);
c29943_6 = 0;
(0, setState)(false);
} catch ($e) {
const r38 = $e;
let r7 = r38;
c29943_5 = r38;
if (c29943_6 !== 0) {
while (true) {
try {
const r209 = c29943_5;
c29943_6 = 0;
c31465_5 = r209;
c31465_4 = new APIError(c31465_5);
(0, setState2)(c31465_4);
(0, setState)(false);
(0, setState)(false);
break L24;
} catch (r205) {
r7 = r205;
c29943_5 = r205;
if (c29943_6 === 0) {
break;
}
}
}
}
throw r7;
}
}
};
_startEvent2 = r9;
return r9.apply(this, arguments);
};
const [loading, setState] = useState(false);
const [error, setState2] = useState(null);
return [function startEvent(a0, a1) {
return _startEvent2.apply(this, arguments);
}, {
loading,
error
}];
};
@@ -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}`;
};