decord/beta/source/modules/activities/EmbeddedActivitiesStore.tsx
github-actions e7a050048e chore: update source for beta 347.7
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4943.js (118.4 MB)
2026-09-21 19:31:18 +00:00

1001 lines
36 KiB
TypeScript

// Module ID: 2044
// Function ID: 2045
// Name: EmbeddedActivitiesStore
// Dependencies: [32, 502, 2045, 2099, 1376, 2008, 9313, 1078, 9615, 9616, 4389, 9314, 14257, 1114, 9634, 577, 9610, 9520, 1368, 1982, 7770, 504, 2]
// Module 2044 (EmbeddedActivitiesStore)
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 577 */;
import Server from "Server" /* 1982 */;
import embeddedActivityLocationUtils from "embeddedActivityLocationUtils" /* 4389 */;
import ApplicationCommandTypes from "ApplicationCommandTypes" /* 7770 */;
import getURLForApplicationDefault from "getURLForApplication" /* 9314 */;
import getPlatformDefault from "getPlatform" /* 9520 */;
import ContentClassificationEmbeddedActivityFilterExperiment2 from "ContentClassificationEmbeddedActivityFilterExperiment" /* 9615 */;
import ContentClassificationReference from "ContentClassificationReference" /* 9616 */;
import _slicedToArray from "module_32" /* 32 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
import ChannelStore from "ChannelStore" /* 2045 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2099 */;
import UserStore from "UserStore" /* 1376 */;
const isVoiceEmbeddedActivityDefault = combined(9610);
require = fn;
function participantFromServer(userId) {
return { userId: userId.user_id, sessionId: userId.session_id, nonce: userId.nonce };
}
function updateEmbeddedActivities(content_classification) {
({ application_id, launch_id, composite_instance_id, location: _location, participants } = content_classification);
const mapped = participants.map(participantFromServer);
let combined = importDefault;
const tmp3 = getURLForApplicationDefault(application_id);
if (null != tmp3) {
const embeddedActivityLocationChannelId = application_id(4389).getEmbeddedActivityLocationChannelId(_location);
if (null != embeddedActivityLocationChannelId) {
value = map2.get(embeddedActivityLocationChannelId);
items = undefined;
if (value != null) {
items = value.getItems("all");
}
let arr2 = items;
} else {
arr2 = items;
}
const value8 = map3.get(_location.id);
items1 = undefined;
if (value8 != null) {
items1 = value8.getItems("all");
}
if (items1 == null) {
items1 = items;
}
const found = items1.find((applicationId) => applicationId.applicationId === application_id);
const mapped1 = mapped.map((userId) => userId.userId);
importDefault = AuthenticationStore.getId();
const someResult = mapped1.some((item) => item === closure_1);
const found1 = mapped.find((userId) => userId.userId === closure_1);
if (found1 != null) {
const sessionId = found1.sessionId;
}
const obj19 = application_id(4389);
const value9 = map.get(application_id);
let tmp12 = embeddedActivityLocationChannelId;
if (embeddedActivityLocationChannelId == null) {
tmp12 = null;
}
const _HermesInternal = HermesInternal;
const value10 = map4.get("" + application_id + ":" + tmp12);
if (value10 != null) {
const launchParams = value10.launchParams;
}
obj = { applicationId: application_id, location: _location, launchId: launch_id, compositeInstanceId: composite_instance_id, url: tmp3, userIds: null, participants: null, contentClassification: null, referrerId: null, customId: null, proxyTicket: null };
const _Set = Set;
const set = new Set(mapped1);
obj.userIds = set;
obj.participants = mapped;
obj.contentClassification = content_classification.content_classification;
let referrerId1;
if (value9 != null) {
referrerId1 = value9.referrerId;
}
if (referrerId1 == null) {
let referrerId2;
if (launchParams != null) {
referrerId2 = launchParams.referrerId;
}
referrerId1 = referrerId2;
}
obj.referrerId = referrerId1;
let customId1;
if (value9 != null) {
customId1 = value9.customId;
}
if (customId1 == null) {
let customId2;
if (launchParams != null) {
customId2 = launchParams.customId;
}
customId1 = customId2;
}
obj.customId = customId1;
let proxyTicket1;
if (value10 != null) {
proxyTicket1 = value10.proxyTicket;
}
obj.proxyTicket = proxyTicket1;
let tmp25 = someResult;
if (someResult) {
tmp25 = null != value9;
}
if (tmp25) {
const obj3 = {};
const merged = Object.assign(value9);
const merged1 = Object.assign(obj);
let proxyTicket = obj.proxyTicket;
if (proxyTicket == null) {
proxyTicket = value9.proxyTicket;
}
obj3.proxyTicket = proxyTicket;
const result = obj5.set(value9.applicationId, obj3);
}
if (null != value9) {
if (_location.id === value9.location.id) {
if (application_id === value9.applicationId) {
if (someResult) {
let tmp61 = null;
if (mapped1.length > 0) {
tmp61 = obj;
}
const id = _location.id;
let value11 = obj2.get(id);
if (null == value11) {
if (typeof ActivityBucket === "function") {
const merged2 = Object.assign({ items: null, cachedVisible: null, cachedHidden: null });
merged2[0] = [];
const result1 = obj2.set(id, merged2);
value11 = merged2;
} else {
throw new TypeError("Trying to call a non-function");
}
}
value11.upsert(application_id, _location.id, tmp61);
const embeddedActivityLocationChannelId1 = tmp76(4389).getEmbeddedActivityLocationChannelId(_location);
if (null != embeddedActivityLocationChannelId1) {
let value12 = map2.get(embeddedActivityLocationChannelId1);
if (null == value12) {
if (typeof ActivityBucket === "function") {
const merged3 = Object.assign({ items: null, cachedVisible: null, cachedHidden: null });
merged3[0] = [];
const result2 = obj22.set(embeddedActivityLocationChannelId1, merged3);
value12 = merged3;
} else {
throw new TypeError("Trying to call a non-function");
}
}
value12.upsert(application_id, _location.id, tmp61);
let str5 = tmp76(4389).getEmbeddedActivityLocationGuildId(_location);
if (str5 == null) {
str5 = "0";
}
let value13 = map1.get(str5);
if (null == value13) {
if (typeof ActivityBucket === "function") {
const merged4 = Object.assign({ items: null, cachedVisible: null, cachedHidden: null });
merged4[0] = [];
const result3 = obj17.set(str5, merged4);
value13 = merged4;
} else {
throw new TypeError("Trying to call a non-function");
}
}
value13.upsert(application_id, _location.id, tmp61);
obj17 = map1;
obj22 = map2;
const tmp76Result4 = tmp76(4389);
}
const tmp76Result = tmp76(4389);
} else {
const _Array = Array;
const arr = Array.from(value9.userIds);
}
obj5.delete(value9.applicationId);
const ComponentDispatch = tmp76(1114).ComponentDispatch;
ComponentDispatch.dispatch(constants.RELEASE_ACTIVITY_WEB_VIEW);
}
}
}
if (someResult) {
if (sessionId === obj4.getSessionId()) {
({ referrerId, customId } = obj);
if (value10 != null) {
const inviterUserId = value10.inviterUserId;
}
if (launchParams != null) {
const renderInFramePool = launchParams.renderInFramePool;
}
const tmp36 = getURLForApplicationDefault(application_id);
if (null != tmp36) {
if (null != obj4.getSessionId()) {
const value14 = obj5.get(application_id);
let id1;
if (value14 != null) {
id1 = value14.location.id;
}
if (id1 !== _location.id) {
const embeddedActivityLocationChannelId2 = tmp76(4389).getEmbeddedActivityLocationChannelId(_location);
const channel = ChannelStore.getChannel(embeddedActivityLocationChannelId2);
if (channel != null) {
const guildId = channel.getGuildId();
}
if (null != UserStore.getCurrentUser()) {
if (null == guildId) {
let isPrivateResult;
if (channel != null) {
isPrivateResult = channel.isPrivate();
}
}
const obj7 = { applicationId: application_id, url: tmp36, userIds: null, participants: null, connectedSince: null, launchId: null, compositeInstanceId: null, location: null, referrerId: null, customId: null, proxyTicket: null, renderInFramePool: null };
const _Set2 = Set;
const set1 = new Set(mapped.map((userId) => userId.userId));
obj7.userIds = set1;
obj7.participants = mapped;
const _Date = Date;
obj7.connectedSince = Date.now();
obj7.launchId = launch_id;
obj7.compositeInstanceId = composite_instance_id;
obj7.location = _location;
obj7.referrerId = referrerId;
obj7.customId = customId;
obj7.proxyTicket = obj.proxyTicket;
obj7.renderInFramePool = renderInFramePool;
const result4 = obj5.set(application_id, obj7);
const ComponentDispatch2 = tmp76(1114).ComponentDispatch;
const obj8 = { location: _location, applicationId: application_id, isFirstActivityInChannel: 0 === arr2.length, isStart: tmp78, participants: mapped, embeddedActivity: obj7, inviterUserId };
ComponentDispatch2.dispatch(constants.OPEN_EMBEDDED_ACTIVITY, obj8);
tmp76(9634);
if (true === renderInFramePool) {
let ACTIVITY_POPOUT_WINDOW = ActivityPanelModes.DISCONNECTED;
const _HermesInternal2 = HermesInternal;
combined = "" + _location.id + ":" + application_id;
const _Date2 = Date;
const result5 = map11.set(combined, Date.now());
} else if (!tmp50) {
if (embeddedActivityLocationChannelId2 === SelectedChannelStore.getChannelId()) {
if (!isVoiceEmbeddedActivityDefault(embeddedActivityLocationChannelId2)) {
PIP = ActivityPanelModes.PANEL;
}
ACTIVITY_POPOUT_WINDOW = PIP;
}
PIP = ActivityPanelModes.PIP;
}
ACTIVITY_POPOUT_WINDOW = ActivityPanelModes.ACTIVITY_POPOUT_WINDOW;
DispatcherDefault.wait(() => {
closure_1(577).dispatch({ type: "ACTIVITY_POPOUT_WINDOW_OPEN" });
});
const combinedResult = DispatcherDefault;
const tmp41 = 0 === arr2.length;
}
const tmp76Result5 = tmp76(4389);
}
}
}
tmp78 = null == found;
}
let tmp59 = embeddedActivityLocationChannelId;
if (embeddedActivityLocationChannelId == null) {
tmp59 = null;
}
const _HermesInternal3 = HermesInternal;
obj6.delete("" + application_id + ":" + tmp59);
}
obj6 = map4;
const someResult1 = mapped.some((item) => application_id(14257).isActivityParticipantCurrentUserCurrentSession(item));
}
}
const ActivityPanelConstants = fn(9313);
const ActivityPanelModes = ActivityPanelConstants.ActivityPanelModes;
const FocusedActivityLayouts = ActivityPanelConstants.FocusedActivityLayouts;
const Constants = fn(1078);
({ ComponentActions: c10, PopoutWindowKeys: closure_11 } = Constants);
let obj = { everLaunchedActivities: null, seenNewActivities: null, seenUpdatedActivities: null, lastCheckedForBadgeableActivities: null, dateRangesForSurfaces: null };
let set = new Set([]);
obj.everLaunchedActivities = new Set();
obj.seenNewActivities = {};
obj.seenUpdatedActivities = {};
obj.dateRangesForSurfaces = {};
let items = [];
let items1 = [];
class ActivityBucket {
constructor() {
merged = Object.assign({ items: null, cachedVisible: null, cachedHidden: null });
merged[0] = [];
return merged;
}
}
const prototype = ActivityBucket.prototype;
prototype["upsert"] = function upsert(arg0, arg1, arg2) {
const self = this;
closure_0 = arg0;
closure_1 = arg1;
items = this.items;
this.items = items.filter((applicationId) => {
let tmp = applicationId.applicationId === closure_0;
if (tmp) {
tmp = applicationId.location.id === closure_1;
}
return !tmp;
});
if (null != arg2) {
items1 = self.items;
items1.push(arg2);
}
self.invalidate();
};
prototype["removeWhere"] = function removeWhere(arg0) {
closure_0 = arg0;
items = this.items;
this.items = items.filter((item) => !closure_0(item));
this.invalidate();
};
prototype["clear"] = function clear() {
this.items = [];
this.invalidate();
};
prototype["getItems"] = function getItems(arg0) {
const self = this;
const ContentClassificationEmbeddedActivityFilterExperiment = ContentClassificationEmbeddedActivityFilterExperiment2.ContentClassificationEmbeddedActivityFilterExperiment;
if (ContentClassificationEmbeddedActivityFilterExperiment.getConfig({ location: "embedded_activity_store" }).enabled) {
if ("all" !== arg0) {
if ("visible" === arg0) {
let cachedVisible = self.cachedVisible;
if (cachedVisible == null) {
items = self.items;
const found = items.filter((contentClassification) => !ContentClassificationReference.isAgeRestrictedClassificationReference(contentClassification.contentClassification));
self.cachedVisible = found;
cachedVisible = found;
}
return cachedVisible;
} else if ("hidden" === arg0) {
let cachedHidden = self.cachedHidden;
if (cachedHidden == null) {
items1 = self.items;
const found1 = items1.filter((contentClassification) => ContentClassificationReference.isAgeRestrictedClassificationReference(contentClassification.contentClassification));
self.cachedHidden = found1;
cachedHidden = found1;
}
return cachedHidden;
}
}
}
return self.items;
};
prototype["invalidate"] = function invalidate() {
this.cachedVisible = null;
this.cachedHidden = null;
};
let map = new Map();
const map1 = new Map();
const map2 = new Map();
const map3 = new Map();
const map4 = new Map();
const set2 = new Set();
const map5 = new Map();
const map6 = new Map();
const map7 = new Map();
const map8 = new Map();
const map9 = new Map();
const map10 = new Map();
const map11 = new Map();
let c29;
let PIP = ActivityPanelModes.DISCONNECTED;
let focusedActivityLayout = FocusedActivityLayouts.RESIZABLE;
let layout = fn(2008).ActivityPopoutWindowLayouts.NORMAL;
const PersistedStore = initializeDefault.PersistedStore;
class EmbeddedActivitiesStoreClass extends PersistedStore {
}
const prototype2 = EmbeddedActivitiesStoreClass.prototype;
prototype2["initialize"] = function initialize(everLaunchedActivities) {
this.waitFor(AuthenticationStore, ChannelStore, SelectedChannelStore, UserStore);
let prop;
if (everLaunchedActivities != null) {
prop = everLaunchedActivities.everLaunchedActivities;
}
if (prop == null) {
prop = [];
}
const set = new Set(prop);
if (null != everLaunchedActivities) {
obj = {};
const merged = Object.assign(everLaunchedActivities);
obj.everLaunchedActivities = set;
}
};
prototype2["getState"] = function getState() {
return obj;
};
prototype2["getSelfEmbeddedActivityForChannel"] = function getSelfEmbeddedActivityForChannel(currentClientVoiceChannelId) {
closure_0 = currentClientVoiceChannelId;
let tmp = null;
if (null != currentClientVoiceChannelId) {
const _Array = Array;
let found = Array.from(map.values()).find((location) => embeddedActivityLocationUtils.getEmbeddedActivityLocationChannelId(location.location) === closure_0);
if (found == null) {
found = null;
}
tmp = found;
const arr = Array.from(map.values());
}
return tmp;
};
prototype2["getSelfEmbeddedActivityForLocation"] = function getSelfEmbeddedActivityForLocation(connectedActivityLocation) {
const id = connectedActivityLocation;
let tmp = null;
if (null != connectedActivityLocation) {
const _Array = Array;
let found = Array.from(map.values()).find((location) => location.location.id === id.id);
if (found == null) {
found = null;
}
tmp = found;
const arr = Array.from(map.values());
}
return tmp;
};
prototype2["getSelfEmbeddedActivities"] = function getSelfEmbeddedActivities() {
return map;
};
prototype2["getEmbeddedActivitiesForGuild"] = function getEmbeddedActivitiesForGuild(guildId) {
value = map1.get(guildId);
items = undefined;
if (value != null) {
items = value.getItems("visible");
}
return items;
};
prototype2["getEmbeddedActivitiesForChannel"] = function getEmbeddedActivitiesForChannel(id) {
value = map2.get(id);
items = undefined;
if (value != null) {
items = value.getItems("visible");
}
return items;
};
prototype2["getEmbeddedActivitiesForLocation"] = function getEmbeddedActivitiesForLocation(id) {
value = map3.get(id.id);
items = undefined;
if (value != null) {
items = value.getItems("visible");
}
return items;
};
prototype2["getEmbeddedActivitiesForGuildIncludingHidden"] = function getEmbeddedActivitiesForGuildIncludingHidden(arg0) {
value = map1.get(arg0);
items = undefined;
if (value != null) {
items = value.getItems("all");
}
return items;
};
prototype2["getEmbeddedActivitiesForChannelIncludingHidden"] = function getEmbeddedActivitiesForChannelIncludingHidden(id) {
value = map2.get(id);
items = undefined;
if (value != null) {
items = value.getItems("all");
}
return items;
};
prototype2["getEmbeddedActivitiesForLocationIncludingHidden"] = function getEmbeddedActivitiesForLocationIncludingHidden(location) {
value = map3.get(location.id);
items = undefined;
if (value != null) {
items = value.getItems("all");
}
return items;
};
prototype2["getEmbeddedActivitiesByChannel"] = function getEmbeddedActivitiesByChannel() {
map = new Map();
const item = map2.forEach((getItems, index) => {
items = getItems.getItems("visible");
if (items.length > 0) {
const result = map.set(index, items);
}
});
return map;
};
prototype2["getEmbeddedActivityDurationMs"] = function getEmbeddedActivityDurationMs(id, arg1) {
value = map11.get("" + id + ":" + arg1);
let diff = null;
if (null != value) {
const _Date = Date;
diff = Date.now() - value;
}
return diff;
};
prototype2["isLaunchingActivity"] = function isLaunchingActivity() {
return map4.size > 0;
};
prototype2["getShelfActivities"] = function getShelfActivities(embeddedActivityLocationGuildId) {
let str = embeddedActivityLocationGuildId;
if (embeddedActivityLocationGuildId == null) {
str = "0";
}
value = map5.get(str);
if (value == null) {
value = items1;
}
return value;
};
prototype2["getShelfFetchStatus"] = function getShelfFetchStatus(arg0) {
let str = arg0;
if (arg0 == null) {
str = "0";
}
return map6.get(str);
};
prototype2["shouldFetchShelf"] = function shouldFetchShelf(arg0) {
let str = arg0;
if (arg0 == null) {
str = "0";
}
obj = map6.get(str);
if (obj == null) {
obj = { isFetching: false };
}
let num;
const timestamp = Date.now();
if (obj != null) {
num = obj.lastFetchTimestampMs;
}
if (num == null) {
num = 0;
}
let isFetching;
const diff = timestamp - num;
if (obj != null) {
isFetching = obj.isFetching;
}
let tmp4 = !isFetching;
if (!isFetching) {
tmp4 = diff > 21600000;
}
return tmp4;
};
prototype2["getOrientationLockStateForApp"] = function getOrientationLockStateForApp(applicationId) {
return map7.get(applicationId);
};
prototype2["getPipOrientationLockStateForApp"] = function getPipOrientationLockStateForApp(applicationId) {
let orientationLockStateForApp = map8.get(applicationId);
if (orientationLockStateForApp == null) {
const self = this;
orientationLockStateForApp = this.getOrientationLockStateForApp(applicationId);
}
return orientationLockStateForApp;
};
prototype2["getGridOrientationLockStateForApp"] = function getGridOrientationLockStateForApp(applicationId) {
let orientationLockStateForApp = map9.get(applicationId);
if (orientationLockStateForApp == null) {
orientationLockStateForApp = map8.get(applicationId);
}
if (orientationLockStateForApp == null) {
const self = this;
orientationLockStateForApp = this.getOrientationLockStateForApp(applicationId);
}
return orientationLockStateForApp;
};
prototype2["getLayoutModeForApp"] = function getLayoutModeForApp(id) {
return map10.get(id);
};
prototype2["getConnectedActivityChannelId"] = function getConnectedActivityChannelId() {
if (null != c29) {
return embeddedActivityLocationUtils.getEmbeddedActivityLocationChannelId(c29);
}
};
prototype2["getConnectedActivityLocation"] = function getConnectedActivityLocation() {
return c29;
};
prototype2["getActivityPanelMode"] = function getActivityPanelMode() {
return PIP;
};
prototype2["getFocusedLayout"] = function getFocusedLayout() {
return focusedActivityLayout;
};
prototype2["getCurrentEmbeddedActivity"] = function getCurrentEmbeddedActivity() {
const selfEmbeddedActivityForLocation = this.getSelfEmbeddedActivityForLocation(this.getConnectedActivityLocation());
return selfEmbeddedActivityForLocation;
};
prototype2["isProxyTicketRefreshing"] = function isProxyTicketRefreshing(arg0) {
return set2.has(arg0);
};
prototype2["getEmbeddedActivityForUserId"] = function getEmbeddedActivityForUserId(author_id, id) {
if (undefined !== id) {
obj = map3[Symbol.iterator]();
while (obj !== undefined) {
let tmp8 = _slicedToArray(tmp5, 2);
[r10016, obj2] = tmp8;
items = obj2.getItems("visible");
for (const item10023 of items) {
if (item10023.applicationId === arg1) {
let userIds = tmp12.userIds;
if (userIds.has(arg0)) {
let tmp = item10023;
obj3.return();
obj.return();
break label0;
}
return tmp;
}
continue;
}
continue;
}
}
};
prototype2["hasActivityEverBeenLaunched"] = function hasActivityEverBeenLaunched(arg0) {
const everLaunchedActivities = obj.everLaunchedActivities;
return everLaunchedActivities.has(arg0);
};
prototype2["getLaunchState"] = function getLaunchState(applicationId, id) {
if (null != applicationId) {
let tmp = id;
if (id == null) {
tmp = null;
}
const _HermesInternal = HermesInternal;
return map4.get("" + applicationId + ":" + tmp);
}
};
prototype2["getLaunchStates"] = function getLaunchStates() {
return map4;
};
prototype2["getActivityPopoutWindowLayout"] = function getActivityPopoutWindowLayout() {
return layout;
};
EmbeddedActivitiesStoreClass.displayName = "EmbeddedActivitiesStore";
EmbeddedActivitiesStoreClass.persistKey = "EmbeddedActivities";
const items2 = [
(arg0) => {
obj = {};
const merged = Object.assign(arg0);
obj.seenFeaturedActivities = [];
obj.shouldShowNewActivityIndicator = false;
return obj;
},
(arg0) => {
delete tmp2[tmp];
const merged = Object.assign(arg0);
return {};
},
(arg0) => {
delete tmp2[tmp];
const merged = Object.assign(arg0);
return {};
},
(arg0) => {
delete tmp2[tmp];
delete tmp2[tmp];
delete tmp2[tmp];
delete tmp2[tmp];
const merged = Object.assign(arg0);
return {};
},
(arg0) => {
obj = {};
const merged = Object.assign(arg0);
obj.seenNewActivities = {};
obj.seenUpdatedActivities = {};
return obj;
},
(everLaunchedActivities) => {
let prop = everLaunchedActivities.everLaunchedActivities;
if (prop == null) {
prop = [];
}
obj = {};
const merged = Object.assign(everLaunchedActivities);
obj.everLaunchedActivities = new Set(prop);
return obj;
},
(arg0) => {
delete tmp2[tmp];
const merged = Object.assign(arg0);
return {};
},
(shouldShowNewActivityIndicator) => {
shouldShowNewActivityIndicator.surfacesToShowNewActivityIndicator = new Set();
if (shouldShowNewActivityIndicator.shouldShowNewActivityIndicator) {
const surfacesToShowNewActivityIndicator = shouldShowNewActivityIndicator.surfacesToShowNewActivityIndicator;
surfacesToShowNewActivityIndicator.add(Server.EmbeddedActivitySurfaces.VOICE_LAUNCHER);
}
delete tmp2[tmp];
const merged = Object.assign(shouldShowNewActivityIndicator);
return {};
},
(arg0) => {
obj = {};
const merged = Object.assign(arg0);
obj.lastCheckedForBadgeableActivities = null;
return obj;
},
(arg0) => {
delete tmp2[tmp];
obj = {};
const merged = Object.assign(arg0);
obj.dateRangesForSurfaces = {};
return obj;
}
];
EmbeddedActivitiesStoreClass.migrations = items2;
const embeddedActivitiesStoreClass = new EmbeddedActivitiesStoreClass(DispatcherDefault, {
ACTIVITY_LAYOUT_MODE_UPDATE: function handleActivityLayoutModeUpdate(applicationId) {
const result = map10.set(applicationId.applicationId, applicationId.layoutMode);
},
CONNECTION_OPEN_SUPPLEMENTAL: function handleConnectionOpen(guilds) {
guilds = guilds.guilds;
map2.clear();
map1.clear();
map3.clear();
let item = guilds.forEach((activity_instances) => {
activity_instances = activity_instances.activity_instances;
if (activity_instances != null) {
const item = activity_instances.forEach((item) => {
closure_1_34(item);
});
}
});
const id = AuthenticationStore.getId();
function _loop(iter) {
embeddedActivitiesForLocationIncludingHidden = embeddedActivitiesForLocationIncludingHidden.getEmbeddedActivitiesForLocationIncludingHidden(iter.location);
if (!embeddedActivitiesForLocationIncludingHidden.some((applicationId) => {
let hasItem = applicationId.applicationId === iter.applicationId && applicationId.launchId === tmp.launchId;
if (hasItem) {
const userIds = applicationId.userIds;
hasItem = userIds.has(iter);
}
return hasItem;
})) {
set.delete(iter.applicationId);
const ComponentDispatch = iter(dependencyMap[13]).ComponentDispatch;
ComponentDispatch.dispatch(constants.RELEASE_ACTIVITY_WEB_VIEW);
}
}
const iter = Array.from(map.values())[Symbol.iterator]();
while (iter !== undefined) {
let _loopResult = _loop(iter.next());
continue;
}
},
GUILD_CREATE: function handleGuildCreate(guild) {
const activity_instances = guild.guild.activity_instances;
if (activity_instances != null) {
const item = activity_instances.forEach((item) => {
closure_1_34(item);
});
}
},
CHANNEL_DELETE: function handleChannelDelete(channel) {
channel = channel.channel;
value = map2.get(channel.id);
items = undefined;
if (value != null) {
items = value.getItems("all");
}
map2.delete(channel.id);
let str2 = channel.guild_id;
if (str2 == null) {
str2 = "0";
}
value2 = map1.get(str2);
if (value2 != null) {
value2.removeWhere((location) => embeddedActivityLocationUtils.getEmbeddedActivityLocationChannelId(location.location) === channel.id);
}
const item = items.forEach((location) => {
set.delete(location.location.id);
});
},
EMBEDDED_ACTIVITY_LAUNCH_START: function handleEmbeddedActivityLaunchStart(applicationId) {
({ componentId, commandOrigin, launchParams, inviterUserId } = applicationId);
const result = map4.set("" + applicationId.applicationId + ":" + applicationId.channelId, { isLaunching: true, componentId, inviterUserId, launchParams });
if (commandOrigin === ApplicationCommandTypes.CommandOrigin.APP_DMS_ENTRY_POINT_COMMAND_BUTTON) {
let RESIZABLE = FocusedActivityLayouts.NO_CHAT;
} else {
RESIZABLE = FocusedActivityLayouts.RESIZABLE;
}
focusedActivityLayout = RESIZABLE;
},
EMBEDDED_ACTIVITY_LAUNCH_SET_PROXY_TICKET: function handleEmbeddedActivityLaunchSetProxyTicket(applicationId) {
const combined = "" + applicationId.applicationId + ":" + applicationId.channelId;
value = map4.get(combined);
if (null != value) {
const obj2 = {};
const merged = Object.assign(value);
obj2.proxyTicket = applicationId.proxyTicket;
const result = map4.set(combined, obj2);
}
},
EMBEDDED_ACTIVITY_UPDATE_CONNECTED_PROXY_TICKET: function handleEmbeddedActivityUpdateConnectedProxyTicket(applicationId) {
applicationId = applicationId.applicationId;
value = map.get(applicationId);
if (null == value) {
return false;
} else {
const obj2 = {};
const merged = Object.assign(value);
obj2.proxyTicket = applicationId.proxyTicket;
const result = obj.set(applicationId, obj2);
}
obj = map;
},
EMBEDDED_ACTIVITY_SET_PROXY_TICKET_REFRESHING: function handleEmbeddedActivitySetProxyTicketRefreshing(applicationId) {
applicationId = applicationId.applicationId;
if (applicationId.refreshing) {
obj.add(applicationId);
} else {
obj.delete(applicationId);
}
},
EMBEDDED_ACTIVITY_LAUNCH_SUCCESS: function handleEmbeddedActivityLaunchSuccess(applicationId) {
const everLaunchedActivities = obj.everLaunchedActivities;
everLaunchedActivities.add(applicationId.applicationId);
},
EMBEDDED_ACTIVITY_LAUNCH_FAIL: function handleEmbeddedActivityLaunchFail(applicationId) {
applicationId = applicationId.applicationId;
map4.delete("" + applicationId + ":" + applicationId.channelId);
set2.delete(applicationId);
},
EMBEDDED_ACTIVITY_LAUNCH_CANCEL: function handleEmbeddedActivityLaunchCancel(applicationId) {
applicationId = applicationId.applicationId;
map4.delete("" + applicationId + ":" + applicationId.channelId);
set2.delete(applicationId);
},
EMBEDDED_ACTIVITY_CLOSE: function handleEmbeddedActivityClose(applicationId) {
applicationId = applicationId.applicationId;
value = map.get(applicationId);
map.delete(applicationId);
let id;
if (value != null) {
id = value.location.id;
}
let id1;
if (_undefined != null) {
id1 = _undefined.id;
}
if (id === id1) {
_undefined = undefined;
}
},
EMBEDDED_ACTIVITY_UPDATE_POPOUT_WINDOW_LAYOUT: function handleUpdatePopoutWindowLayout(layout) {
layout = layout.layout;
},
EMBEDDED_ACTIVITY_UPDATE_V2: function handleEmbeddedActivityUpdateV2(instance) {
updateEmbeddedActivities(instance.instance);
},
LOCAL_ACTIVITY_UPDATE: function handleLocalActivityUpdate(activity) {
activity = activity.activity;
if (null == activity) {
return false;
} else {
let str = activity.application_id;
if (str == null) {
str = "";
}
value = map.get(str);
if (null == value) {
return false;
} else {
const obj2 = {};
const merged = Object.assign(value);
const result = obj.set(value.applicationId, obj2);
}
obj = map;
}
},
EMBEDDED_ACTIVITY_SET_CONFIG: function handleSetSelfEmbeddedActivityConfig(applicationId) {
value = map.get(applicationId.applicationId);
if (null != value) {
const obj2 = {};
const merged = Object.assign(value);
obj2.config = applicationId.config;
const result = map.set(value.applicationId, obj2);
}
},
EMBEDDED_ACTIVITY_FETCH_SHELF: function handleEmbeddedActivityFetchShelf(guildId) {
let str = guildId.guildId;
if (str == null) {
str = "0";
}
value = map6.get(str);
let lastFetchTimestampMs;
if (value != null) {
lastFetchTimestampMs = value.lastFetchTimestampMs;
}
const result = map6.set(str, { isFetching: true, lastFetchTimestampMs });
obj.lastCheckedForBadgeableActivities = new Date(Date.now()).toISOString();
},
EMBEDDED_ACTIVITY_FETCH_SHELF_SUCCESS: function handleEmbeddedActivityFetchShelfSuccess(arg0) {
({ guildId, activities } = arg0);
if (guildId == null) {
guildId = "0";
}
const result = map5.set(guildId, activities);
const timestamp = Date.now();
obj = timestamp(1368);
importDefault = getPlatformDefault(obj.getOS());
obj.dateRangesForSurfaces = activities.reduce((acc, item) => {
closure_1 = tmp;
if (null != item.client_platform_config[closure_1].label_from) {
if (null != tmp.label_until) {
obj = { fromDate: null, untilDate: null };
({ label_from: obj.fromDate, label_until: obj.untilDate } = tmp);
let _Date = Date;
let date = new Date(tmp.label_from);
const time = date.getTime();
const _Date2 = Date;
const date1 = new Date(tmp.label_until);
if (!tmp2) {
const _Object = Object;
const values = Object.values(Server.EmbeddedActivitySurfaces);
const found = values.filter((item) => {
const omit_badge_from_surfaces = closure_1.omit_badge_from_surfaces;
return !omit_badge_from_surfaces.includes(item);
});
item = found.forEach((item) => {
let tmp3 = null == tmp2;
if (!tmp3) {
const _Date = Date;
const date = new Date(tmp2.fromDate);
tmp3 = date.getTime() < time;
}
if (tmp3) {
acc[item] = obj;
}
});
}
return acc;
}
}
return acc;
}, {});
const result1 = map6.set(guildId, { isFetching: false, lastFetchTimestampMs: timestamp });
},
EMBEDDED_ACTIVITY_FETCH_SHELF_FAIL: function handleEmbeddedActivityFetchShelfFail(guildId) {
let str = guildId.guildId;
if (str == null) {
str = "0";
}
value = map6.get(str);
let lastFetchTimestampMs;
if (value != null) {
lastFetchTimestampMs = value.lastFetchTimestampMs;
}
const result = map6.set(str, { isFetching: false, lastFetchTimestampMs });
},
EMBEDDED_ACTIVITY_SET_ORIENTATION_LOCK_STATE: function handleOrientationLockState(arg0) {
({ applicationId, lockState, pictureInPictureLockState, gridLockState } = arg0);
if (null == lockState) {
map7.delete(applicationId);
} else {
const result = map7.set(applicationId, lockState);
}
if (null === pictureInPictureLockState) {
map8.delete(applicationId);
} else if (undefined !== pictureInPictureLockState) {
const result1 = map8.set(applicationId, pictureInPictureLockState);
}
if (null === gridLockState) {
map9.delete(applicationId);
} else if (undefined !== gridLockState) {
const result2 = map9.set(applicationId, gridLockState);
}
},
EMBEDDED_ACTIVITY_SET_PANEL_MODE: function handleSetPanelMode(activityPanelMode) {
PIP = activityPanelMode.activityPanelMode;
},
EMBEDDED_ACTIVITY_SET_FOCUSED_LAYOUT: function handleSetFocusedLayout(focusedActivityLayout) {
focusedActivityLayout = focusedActivityLayout.focusedActivityLayout;
},
CHANNEL_SELECT: function handleChannelSelect(arg0) {
if (null != c29) {
const embeddedActivityLocationChannelId = embeddedActivityLocationUtils.getEmbeddedActivityLocationChannelId(c29);
let tmp6 = null != embeddedActivityLocationChannelId && embeddedActivityLocationChannelId !== tmp;
if (tmp6) {
tmp6 = PIP === ActivityPanelModes.PANEL;
}
if (tmp6) {
PIP = ActivityPanelModes.PIP;
}
}
},
POPOUT_WINDOW_CLOSE: function handlePopoutWindowClose(key) {
if (key.key === constants2.ACTIVITY_POPOUT) {
PIP = ActivityPanelModes.PIP;
}
}
});
const size = fn(2);
let result = size.fileFinishedImporting("modules/activities/EmbeddedActivitiesStore.tsx");
export default embeddedActivitiesStoreClass;
export const FEATURED_ACTIVITY_IDS = set;
export const NO_ACTIVITIES = items;
export const NO_ACTIVITY_CONFIGS = items1;
export const ACTIVITIES_GUILD_ID_SENTINEL_FOR_PRIVATE_CHANNELS = "0";