// Module ID: 7200 // Function ID: 7201 // Name: ChannelConversationsStore // Dependencies: [502, 2044, 4508, 2098, 1372, 7201, 7202, 1439, 11, 7203, 7204, 1370, 5067, 504, 573, 2] // Module 7200 (ChannelConversationsStore) import SnowflakeUtilsDefault from "SnowflakeUtils" /* 11 */; import initializeDefault from "initialize" /* 504 */; import DispatcherDefault from "Dispatcher" /* 573 */; import privDefault from "priv" /* 1439 */; import MessageRecordUtils from "MessageRecordUtils" /* 5067 */; import ConversationMessageCacheUtils from "ConversationMessageCacheUtils" /* 7203 */; import AuthenticationStore from "AuthenticationStore" /* 502 */; import ChannelStore from "ChannelStore" /* 2044 */; import RelationshipStore from "RelationshipStore" /* 4508 */; import SelectedChannelStore from "SelectedChannelStore" /* 2098 */; import UserStore from "UserStore" /* 1372 */; import ConversationVisibilityStore from "ConversationVisibilityStore" /* 7201 */; require = fn; function removePendingListFetch(channelId, requestKey) { value = map.get(channelId); const tmp = null == value || !value.has(requestKey); let flag = !tmp; if (!tmp) { value.delete(requestKey); flag = true; if (0 === value.size) { map.delete(channelId); flag = true; } } return flag; } function buildModerationLabel(arr) { const first = arr[0]; const mapped = arr.map((category) => { let reason = category.category; if (reason == null) { reason = category.reason; } return reason; }); const found = mapped.filter((item) => null != item); let severity; if (first != null) { severity = first.severity; } if (severity == null) { severity = null; } let confidence; if (first != null) { confidence = first.confidence; } if (confidence == null) { confidence = null; } let combined = null; if (null != severity) { const _HermesInternal = HermesInternal; combined = "" + severity + " severity"; } const items = [combined, ]; let combined1 = null; if (null != confidence) { const _HermesInternal2 = HermesInternal; combined1 = "" + confidence + " confidence"; } items[1] = combined1; const found1 = items.filter(Boolean); const joined = found1.join(", "); let joined1 = null; if (found.length > 0) { joined1 = found.join(", "); } const items1 = [joined1, ]; let tmp9 = null; if (joined.length > 0) { tmp9 = joined; } items1[1] = tmp9; const found2 = items1.filter(Boolean); const joined2 = found2.join(" \u00B7 "); let str5 = "Moderation Failed"; if (joined2.length > 0) { str5 = joined2; } return str5; } function processHydratedMessages(arg0, arg1, messages, fullyHydrated) { closure_0 = arg1; const items = []; const peekResult = navigation.peek(arg0); c1 = peekResult; if (null != peekResult) { const conversationMetadataById = peekResult.conversationMetadataById; value = conversationMetadataById.get(arg1); if (null != value) { const obj2 = { meta: value, messages, fullyHydrated, messageReferences: items, upsertMessage(id) { const messageMetadataByMessageId = _undefined.messageMetadataByMessageId; value = messageMetadataByMessageId.get(id.id); if (null != value) { value.conversationId = conversationId; value.message = id; } else { const messageMetadataByMessageId2 = _undefined.messageMetadataByMessageId; const obj = { conversationId, moderationLabel: null, message: id }; const result = messageMetadataByMessageId2.set(id.id, obj); } }, upsertReference(id) { const messageMetadataByMessageId = _undefined.messageMetadataByMessageId; if (!messageMetadataByMessageId.has(id.id)) { const messageMetadataByMessageId2 = _undefined.messageMetadataByMessageId; const obj = { conversationId: null, moderationLabel: null, message: id }; const result = messageMetadataByMessageId2.set(id.id, obj); } } }; const result = ConversationMessageCacheUtils.applyHydratedMessages(obj2); } } } function handleReaction(messageId) { messageId = messageId.messageId; const peekResult = navigation.peek(messageId.channelId); let flag = false; if (null != peekResult) { const messageMetadataByMessageId = peekResult.messageMetadataByMessageId; value = messageMetadataByMessageId.get(messageId); let message; if (value != null) { message = value.message; } flag = false; if (null != message) { const applyReactionResult = ConversationMessageCacheUtils.applyReaction(messageId, value.message); let flag2 = null != applyReactionResult; if (flag2) { value.message = applyReactionResult; let tmp7 = null; if (null != value.conversationId) { const conversationMetadataById = peekResult.conversationMetadataById; value2 = conversationMetadataById.get(value.conversationId); if (value2 == null) { value2 = null; } tmp7 = value2; } const result = tmp4(7203).replaceHydratedMessage(tmp7, messageId, applyReactionResult); flag2 = true; const tmp4Result = tmp4(7203); } flag = flag2; tmp4 = require; } } return flag; } function handleRelationshipUpdate() { c0 = false; let item = navigation.forEach((messageMetadataByMessageId) => { const prop = messageMetadataByMessageId.messageMetadataByMessageId; const item = prop.forEach((message, index) => { if (null != message.message) { const result = ConversationMessageCacheUtils.applyRelationshipFlags(message.message); if (null != result) { c0 = true; message.message = result; let tmp = null; if (null != message.conversationId) { const conversationMetadataById = messageMetadataByMessageId.conversationMetadataById; value = conversationMetadataById.get(message.conversationId); if (value == null) { value = null; } tmp = value; } const result1 = tmp5(7203).replaceHydratedMessage(tmp, index, result); const tmp5Result = tmp5(7203); } tmp5 = require; } }); }); return c0; } function removeMessage(arg0, id) { const peekResult = navigation.peek(arg0); if (null == peekResult) { return false; } else { const messageMetadataByMessageId2 = peekResult.messageMetadataByMessageId; value = messageMetadataByMessageId2.get(id); let tmp4 = null; if (null != value) { let tmp2 = null; if (null != value.conversationId) { const conversationMetadataById = peekResult.conversationMetadataById; value2 = conversationMetadataById.get(value.conversationId); if (value2 == null) { value2 = null; } tmp2 = value2; } tmp4 = tmp2; } const result = ConversationMessageCacheUtils.removeHydratedMessage(tmp4, id); const messageMetadataByMessageId = peekResult.messageMetadataByMessageId; return messageMetadataByMessageId.delete(id); } } function evictChannel(arg0) { let hasItem = navigation.has(arg0); navigation.del(arg0); if (!hasItem) { hasItem = map.delete(arg0); } return hasItem; } const ConversationConstants = fn(7202); ({ CONVERSATION_COLORS: closure_9, CONVERSATION_FEEDBACK_RATINGS_CACHE_MAX: c10, MAX_CONVERSATIONS_PER_CHANNEL: closure_11, MAX_CHANNELS_WITH_CONVERSATIONS } = ConversationConstants); const navigation = new privDefault({ max: MAX_CHANNELS_WITH_CONVERSATIONS, dispose: function cleanupChannelSideState(arg0) { return map.delete(arg0); } }); let map = new Map(); let map1 = new Map(); let closure_16 = 0; let closure_17 = 0; const Store = initializeDefault.Store; class ChannelConversationsStore extends Store { } const prototype = ChannelConversationsStore.prototype; prototype["initialize"] = function initialize() { this.waitFor(AuthenticationStore, ChannelStore, ConversationVisibilityStore, RelationshipStore, SelectedChannelStore, UserStore); }; prototype["hasChannelData"] = function hasChannelData(id) { return navigation.has(id); }; prototype["getChannelConversations"] = function getChannelConversations(id) { const peekResult = navigation.peek(id); let conversations = null; if (null != peekResult) { conversations = peekResult.conversations; } return conversations; }; prototype["getConversationForMessage"] = function getConversationForMessage(arg0, arg1) { const peekResult = navigation.peek(arg0); let conversationId; if (peekResult != null) { const messageMetadataByMessageId = peekResult.messageMetadataByMessageId; value = messageMetadataByMessageId.get(arg1); if (value != null) { conversationId = value.conversationId; } } if (conversationId == null) { conversationId = null; } return conversationId; }; prototype["getMessageMetadata"] = function getMessageMetadata(arg0, arg1) { const peekResult = navigation.peek(arg0); value = undefined; if (peekResult != null) { const messageMetadataByMessageId = peekResult.messageMetadataByMessageId; value = messageMetadataByMessageId.get(arg1); } if (value == null) { value = null; } return value; }; prototype["getMessage"] = function getMessage(arg0, arg1) { const messageMetadata = this.getMessageMetadata(arg0, arg1); let message; if (messageMetadata != null) { message = messageMetadata.message; } if (message == null) { message = null; } return message; }; prototype["getConversationMetadata"] = function getConversationMetadata(channelId, conversationId) { const peekResult = navigation.peek(channelId); value = undefined; if (peekResult != null) { const conversationMetadataById = peekResult.conversationMetadataById; value = conversationMetadataById.get(conversationId); } if (value == null) { value = null; } return value; }; prototype["getEdgeMarker"] = function getEdgeMarker(id, after) { const peekResult = navigation.peek(id); if (null == peekResult) { return null; } }; prototype["isPendingFetch"] = function isPendingFetch(id) { return map.has(id); }; prototype["isListFetchPending"] = function isListFetchPending(arg0, arg1) { value = map.get(arg0); let flag; if (value != null) { flag = value.has(arg1); } if (flag == null) { flag = false; } return flag; }; prototype["getSelectedConversationId"] = function getSelectedConversationId(arg0) { const peekResult = navigation.peek(arg0); let prop; if (peekResult != null) { prop = peekResult.selectedConversationId; } if (prop == null) { prop = null; } return prop; }; prototype["consumeFocusRequest"] = function consumeFocusRequest() { let flag = closure_16 !== closure_17; if (flag) { closure_17 = closure_16; flag = true; } return flag; }; prototype["getSelectedConversation"] = function getSelectedConversation(arg0) { const peekResult = navigation.peek(arg0); let prop; if (peekResult != null) { prop = peekResult.selectedConversationId; } let tmp3 = null; if (null != prop) { let conversation; if (peekResult != null) { const conversationMetadataById = peekResult.conversationMetadataById; value = conversationMetadataById.get(prop); if (value != null) { conversation = value.conversation; } } if (conversation == null) { conversation = null; } tmp3 = conversation; } return tmp3; }; prototype["getConversationColor"] = function getConversationColor(arg0, arg1) { const peekResult = navigation.peek(arg0); let tmp2 = null; if (null != peekResult) { const conversationMetadataById = peekResult.conversationMetadataById; value = conversationMetadataById.get(arg1); let color; if (value != null) { color = value.color; } if (color == null) { color = null; } tmp2 = color; } return tmp2; }; prototype["isFullyHydrated"] = function isFullyHydrated(arg0, arg1) { const peekResult = navigation.peek(arg0); let fullyHydrated; if (peekResult != null) { const conversationMetadataById = peekResult.conversationMetadataById; value = conversationMetadataById.get(arg1); if (value != null) { fullyHydrated = value.fullyHydrated; } } return true === fullyHydrated; }; prototype["getHydratedMessages"] = function getHydratedMessages(arg0, arg1) { const peekResult = navigation.peek(arg0); let hydratedMessages; if (peekResult != null) { const conversationMetadataById = peekResult.conversationMetadataById; value = conversationMetadataById.get(arg1); if (value != null) { hydratedMessages = value.hydratedMessages; } } if (hydratedMessages == null) { hydratedMessages = null; } return hydratedMessages; }; prototype["getHydratedMessageById"] = function getHydratedMessageById(arg0, arg1) { const peekResult = navigation.peek(arg0); let message; if (peekResult != null) { const messageMetadataByMessageId = peekResult.messageMetadataByMessageId; value = messageMetadataByMessageId.get(arg1); if (value != null) { message = value.message; } } if (message == null) { message = null; } return message; }; prototype["isConversationFetchPending"] = function isConversationFetchPending(arg0, arg1) { value = map1.get(arg0); let tmp = null != value; if (tmp) { tmp = 0 !== value.size; } if (tmp) { let hasItem = true !== arg1; if (!hasItem) { hasItem = value.has("full"); } tmp = hasItem; } return tmp; }; prototype["getConversationFeedbackRating"] = function getConversationFeedbackRating(arg0, arg1) { const peekResult = navigation.peek(arg0); value = undefined; if (peekResult != null) { const recentFeedbackRatingsByConversationId = peekResult.recentFeedbackRatingsByConversationId; value = recentFeedbackRatingsByConversationId.get(arg1); } if (value == null) { value = null; } return value; }; ChannelConversationsStore.displayName = "ChannelConversationsStore"; const channelConversationsStore = new ChannelConversationsStore(DispatcherDefault, { CONVERSATION_MESSAGES_FETCH_START: function handleConversationMessagesFetchStart(conversationId) { conversationId = conversationId.conversationId; if (true === conversationId.isStandalone) { return false; } else { let str = "preview"; if (tmp) { str = "full"; } value = map1.get(conversationId); if (null != value) { value.add(str); } else { const _Set = Set; const items = [str]; const set = new Set(items); const result = map1.set(conversationId, set); } } }, CONVERSATION_MESSAGES_FETCH_SUCCESS: function handleConversationMessagesFetchSuccess(isStandalone) { ({ conversationId, messageReferences, fullyHydrated } = isStandalone); if (true === isStandalone.isStandalone) { return false; } else { let str = "preview"; if (fullyHydrated) { str = "full"; } value = map1.get(conversationId); if (null != value) { value.delete(str); if (0 === value.size) { map1.delete(conversationId); } } if (messageReferences === undefined) { messageReferences = []; } const peekResult = navigation.peek(tmp); c1 = peekResult; if (null != peekResult) { const conversationMetadataById = peekResult.conversationMetadataById; value2 = conversationMetadataById.get(conversationId); if (null != value2) { const obj2 = { meta: value2, messages: tmp2, fullyHydrated, messageReferences, upsertMessage(id) { const messageMetadataByMessageId = _undefined.messageMetadataByMessageId; value = messageMetadataByMessageId.get(id.id); if (null != value) { value.conversationId = conversationId; value.message = id; } else { const messageMetadataByMessageId2 = _undefined.messageMetadataByMessageId; const obj = { conversationId, moderationLabel: null, message: id }; const result = messageMetadataByMessageId2.set(id.id, obj); } }, upsertReference(id) { const messageMetadataByMessageId = _undefined.messageMetadataByMessageId; if (!messageMetadataByMessageId.has(id.id)) { const messageMetadataByMessageId2 = _undefined.messageMetadataByMessageId; const obj = { conversationId: null, moderationLabel: null, message: id }; const result = messageMetadataByMessageId2.set(id.id, obj); } } }; let result = ConversationMessageCacheUtils.applyHydratedMessages(obj2); } } } }, CONVERSATION_MESSAGES_FETCH_FAILURE: function handleConversationMessagesFetchFailure(conversationId) { conversationId = conversationId.conversationId; if (true === conversationId.isStandalone) { return false; } else { let str = "preview"; if (tmp) { str = "full"; } value = map1.get(conversationId); if (null != value) { value.delete(str); if (0 === value.size) { map1.delete(conversationId); } } } }, CHANNEL_CONVERSATIONS_FETCH_START: function handleFetchStart(isJump) { ({ channelId, requestKey } = isJump); if (isJump.isJump) { map.delete(channelId); } value = map.get(channelId); if (null == value) { const _Set = Set; const set = new Set(); const result = map.set(channelId, set); value = set; } value.add(requestKey); }, CHANNEL_CONVERSATIONS_FETCH_SUCCESS: function handleFetchSuccess(requestKey) { ({ channelId, rawConversations, direction, anchor, isJump, fullyHydrated } = requestKey); let set; if (removePendingListFetch(channelId, requestKey.requestKey)) { const mapped = rawConversations.map(set(7204).mapConversation); const found = mapped.filter(set(1370).isNotNullish); const peekResult = navigation.peek(channelId); if (isJump) { let prop; if (!tmp5) { prop = peekResult.selectedConversationId; } let tmp7 = null; if (null != prop) { let conversation; if (peekResult != null) { let conversationMetadataById = peekResult.conversationMetadataById; value = conversationMetadataById.get(prop); if (value != null) { conversation = value.conversation; } } tmp7 = conversation; } if (null != tmp7) { let items = [tmp7]; let items1 = items; } else { items1 = []; } } else { let conversations; if (!tmp5) { conversations = peekResult.conversations; } if (conversations == null) { conversations = []; } let timestamp1 = null; if (!isJump) { let reachedOldest; if (peekResult != null) { reachedOldest = peekResult.reachedOldest; } if (reachedOldest == null) { reachedOldest = null; } timestamp1 = reachedOldest; } let tmp13 = null; if (!isJump) { let reachedNewest; if (peekResult != null) { reachedNewest = peekResult.reachedNewest; } if (reachedNewest == null) { reachedNewest = null; } tmp13 = reachedNewest; } let tmp15 = globalThis; const _Set = Set; set = new Set(conversations.map((id) => id.id)); let timestamp = tmp13; if (tmp20) { let tmp27 = tmp26; if ("before" === direction) { tmp27 = null == anchor; } if (tmp27) { const _Date3 = Date; timestamp = Date.now(); } const arr5 = (function mergeConversations(conversations, found) { map = new Map(); const iter = conversations[Symbol.iterator](); const nextResult = iter.next(); while (iter !== undefined) { let result = map.set(nextResult.id, nextResult); continue; } const iter2 = found[Symbol.iterator](); const nextResult1 = iter2.next(); while (iter2 !== undefined) { let result1 = map.set(nextResult1.id, nextResult1); continue; } const arr = Array.from(map.values()); const sorted = arr.sort((startMessageId, startMessageId2) => closure_1_1(dependencyMap[8]).compare(startMessageId.startMessageId, startMessageId2.startMessageId)); return arr; })(conversations, found); let tmp29 = timestamp; let tmp30 = timestamp1; let substr = arr5; if (arr5.length > closure_11) { if ("after" === direction) { substr = arr5.slice(arr5.length - tmp28); tmp29 = timestamp; tmp30 = null; } else if (tmp26) { substr = arr5.slice(0, tmp28); tmp29 = null; tmp30 = timestamp1; } else { let tmp32 = (function clampAnchorWindowStart(arr5, anchor) { closure_0 = anchor; if (null == anchor) { return 0; } else { length = arr5.findIndex((startMessageId) => SnowflakeUtilsDefault.compare(startMessageId.startMessageId, closure_0) >= 0); if (-1 === length) { length = arr5.length; } const _Math = Math; const _Math2 = Math; const _Math3 = Math; return Math.max(0, Math.min(length - Math.floor(closure_11 / 2), arr5.length - closure_11)); } })(arr5, anchor); let tmp33 = timestamp1; if (tmp32 > 0) { tmp33 = null; } let tmp34 = timestamp; if (tmp32 + tmp28 < arr5.length) { tmp34 = null; } substr = arr5.slice(tmp32, tmp32 + tmp28); tmp29 = tmp34; tmp30 = tmp33; } } let tmp35 = (function buildChannelData(channelId, substr, peekResult) { let guildId; if (peekResult != null) { guildId = peekResult.guildId; } if (guildId == null) { const first = substr[0]; let guildId1; if (first != null) { guildId1 = first.guildId; } guildId = guildId1; } if (guildId == null) { channel = channel.getChannel(channelId); let guild_id; if (channel != null) { guild_id = channel.guild_id; } guildId = guild_id; } if (guildId == null) { guildId = null; } map = new Map(); map1 = new Map(); let num; if (peekResult != null) { num = peekResult.colorIndex; } if (num == null) { num = 0; } let sum = num; const iter = substr[Symbol.iterator](); const nextResult = iter.next(); while (iter !== undefined) { let tmp10 = nextResult; value = undefined; if (peekResult != null) { let conversationMetadataById = peekResult.conversationMetadataById; value = conversationMetadataById.get(tmp10.id); } let tmp13 = value; let color; if (value != null) { color = value.color; } if (color == null) { let tmp17 = +sum; sum = tmp17 + 1; color = length[tmp17 % length.length]; } let hydratedMessages; let tmp18 = color; if (tmp13 != null) { hydratedMessages = tmp13.hydratedMessages; } if (hydratedMessages == null) { hydratedMessages = null; } let tmp22 = null != hydratedMessages; let tmp21 = hydratedMessages; if (tmp22) { let fullyHydrated; if (tmp13 != null) { fullyHydrated = tmp13.fullyHydrated; } tmp22 = fullyHydrated; } let obj = { conversation: tmp10, color: null, hydratedMessages: null, fullyHydrated: null }; obj.color = tmp18; obj.hydratedMessages = tmp21; obj.fullyHydrated = tmp22; let result = map.set(tmp10.id, obj); let map2 = null; if (null != tmp10.moderation) { let _Map = Map; let tmp87 = new.target; let tmp88 = new.target; map2 = new Map(); let flaggedMessageDetails = tmp10.moderation.flaggedMessageDetails; for (const item10083 of flaggedMessageDetails) { let tmp31 = item10083; let value5 = map2.get(item10083.messageId); let arr = value5; if (null != value5) { let arr2 = arr.push(tmp31); } else { let items = [tmp31]; let result1 = map2.set(tmp31.messageId, items); } continue; } } let messageIds = tmp10.messageIds; for (const item10107 of messageIds) { let tmp43 = item10107; let value6; if (arg2 != null) { let messageMetadataByMessageId = arg2.messageMetadataByMessageId; value6 = messageMetadataByMessageId.get(tmp43); } let tmp46 = value6; let tmp54Result = null; let moderationLabel; if (value6 != null) { moderationLabel = value6.moderationLabel; } let hasItem = null == moderationLabel; if (hasItem) { hasItem = null != tmp10.moderation; } if (hasItem) { let flaggedMessageIds = tmp10.moderation.flaggedMessageIds; hasItem = flaggedMessageIds.includes(tmp43); } if (hasItem) { hasItem = null != map2; } if (hasItem) { let tmp54 = buildModerationLabel; let value7 = map2.get(tmp43); if (value7 == null) { value7 = []; } tmp54Result = tmp54(value7); } let obj2 = { conversationId: null, moderationLabel: null, message: null }; obj2.conversationId = tmp10.id; let moderationLabel1; if (tmp46 != null) { moderationLabel1 = tmp46.moderationLabel; } if (moderationLabel1 == null) { moderationLabel1 = tmp54Result; } obj2.moderationLabel = moderationLabel1; let message1; if (tmp46 != null) { message1 = tmp46.message; } if (message1 == null) { message1 = null; } obj2.message = message1; let result2 = map1.set(tmp43, obj2); let message_id; if (tmp46 != null) { let message = tmp46.message; if (message != null) { let messageReference = message.messageReference; if (messageReference != null) { message_id = messageReference.message_id; } } } let tmp66 = message_id; if (null != message_id) { let value8; if (arg2 != null) { let messageMetadataByMessageId2 = arg2.messageMetadataByMessageId; value8 = messageMetadataByMessageId2.get(tmp66); } let message2; let tmp69 = value8; if (value8 != null) { message2 = value8.message; } let hasItem1 = null == message2; if (!hasItem1) { hasItem1 = map1.has(tmp66); } if (!hasItem1) { let result3 = map1.set(tmp66, tmp69); } } continue; } continue; } let prop; if (peekResult != null) { prop = peekResult.recentFeedbackRatingsByConversationId; } if (prop == null) { const obj3 = { max }; prop = new privDefault(obj3); } let prop1; if (peekResult != null) { prop1 = peekResult.selectedConversationId; } if (prop1 == null) { prop1 = null; } let tmp84 = null; if (null != prop1) { tmp84 = null; if (substr.some((id) => id.id === prop1)) { tmp84 = prop1; } } const obj4 = { guildId, conversations: substr, conversationMetadataById: map, messageMetadataByMessageId: map1, recentFeedbackRatingsByConversationId: prop, reachedOldest: null, reachedNewest: null, selectedConversationId: null, colorIndex: null }; let reachedOldest; if (peekResult != null) { reachedOldest = peekResult.reachedOldest; } if (reachedOldest == null) { reachedOldest = null; } obj4.reachedOldest = reachedOldest; let reachedNewest; if (peekResult != null) { reachedNewest = peekResult.reachedNewest; } if (reachedNewest == null) { reachedNewest = null; } obj4.reachedNewest = reachedNewest; obj4.selectedConversationId = tmp84; obj4.colorIndex = sum; return obj4; })(channelId, substr, peekResult); tmp35.reachedOldest = tmp30; tmp35.reachedNewest = tmp29; if (null != peekResult) { const _Object = tmp15.Object; _Object.assign(peekResult, tmp35); } else { let result = obj2.set(channelId, tmp35); } tmp15 = rawConversations; rawConversations[Symbol.iterator](); } else if ("before" === direction) { const _Date2 = Date; timestamp1 = Date.now(); let timestamp2 = tmp13; } else { timestamp2 = tmp13; if ("after" === direction) { const _Date = Date; timestamp2 = Date.now(); } } tmp20 = found.some((id) => !set.has(id.id)) || null == anchor; } obj2 = navigation; } else { return false; } }, CHANNEL_CONVERSATIONS_FETCH_FAILURE: function handleFetchFailure(arg0) { ({ channelId, requestKey } = arg0); value = map.get(channelId); const tmp = null == value || !value.has(requestKey); let flag = !tmp; if (!tmp) { value.delete(requestKey); flag = true; if (0 === value.size) { map.delete(channelId); flag = true; } } return flag; }, CHANNEL_SELECT: function handleChannelSelect(channelId) { channelId = channelId.channelId; let hasItem = null != channelId; if (hasItem) { hasItem = navigation.has(channelId); } if (hasItem) { value = navigation.get(channelId); } let flag = false; const keys = navigation.keys(); for (const item10020 of keys) { if (item10020 !== channelId) { let peekResult = navigation.peek(tmp6); let prop; let tmp10 = peekResult; if (peekResult != null) { prop = peekResult.selectedConversationId; } if (null != prop) { tmp10.selectedConversationId = null; flag = true; } } continue; } return flag; }, CHANNEL_DELETE: function handleChannelDelete(channel) { const id = channel.channel.id; let hasItem = navigation.has(id); navigation.del(id); if (!hasItem) { hasItem = map.delete(id); } return hasItem; }, GUILD_DELETE: function handleGuildDelete(guild) { guild = guild.guild; if ("unavailable" in guild) { if (true === guild.unavailable) { return false; } } let flag2 = false; const keys = navigation.keys(); const iter = keys[Symbol.iterator](); const nextResult = iter.next(); while (iter !== undefined) { let tmp3 = nextResult; let peekResult = navigation.peek(nextResult); let guildId; if (peekResult != null) { guildId = peekResult.guildId; } let tmp7 = guildId === guild.id; if (tmp7) { tmp7 = evictChannel(tmp3); } if (tmp7) { flag2 = true; } continue; } return flag2; }, LOAD_MESSAGES_SUCCESS: function handleLoadMessagesSuccess(channelId) { channelId = channelId.channelId; if (null != channelId.jump) { if (SelectedChannelStore.getChannelId() === channelId) { const peekResult = navigation.peek(channelId); let flag = null != peekResult; if (flag) { peekResult.reachedOldest = null; peekResult.reachedNewest = null; flag = true; } return flag; } } return false; }, SET_SELECTED_CONVERSATION: function handleSetSelectedConversation(channelId) { channelId = channelId.channelId; if (null == channelId) { return false; } else { const peekResult = navigation.peek(channelId); let flag = null != peekResult; if (flag) { peekResult.selectedConversationId = tmp; flag = true; } return flag; } }, CONVERSATION_FOCUS_REQUEST: function handleConversationFocusRequest() { closure_16 = closure_16 + 1; return true; }, CLEAR_CONVERSATION_SELECTION: function handleClearConversationSelection(conversationId) { conversationId = conversationId.conversationId; const peekResult = navigation.peek(conversationId.channelId); if (null == peekResult) { return false; } else { const selectedConversationId = peekResult.selectedConversationId; let flag = null != selectedConversationId; if (flag) { flag = null == conversationId || selectedConversationId === conversationId; const tmp2 = null == conversationId || selectedConversationId === conversationId; } if (flag) { peekResult.selectedConversationId = null; flag = true; } return flag; } }, SET_CONVERSATION_FEEDBACK_RATING: function handleSetConversationFeedbackRating(channelId) { ({ conversationId, rating } = channelId); const peekResult = navigation.peek(channelId.channelId); let flag = null != peekResult; if (flag) { const recentFeedbackRatingsByConversationId = peekResult.recentFeedbackRatingsByConversationId; const result = recentFeedbackRatingsByConversationId.set(conversationId, rating); flag = true; } return flag; }, MESSAGE_UPDATE: function handleMessageUpdate(message) { message = message.message; ({ channel_id, id } = message); let tmp = null != channel_id && null != id; if (tmp) { const peekResult = navigation.peek(channel_id); let flag = false; if (null != peekResult) { const messageMetadataByMessageId = peekResult.messageMetadataByMessageId; value = messageMetadataByMessageId.get(id); let message1; if (value != null) { message1 = value.message; } flag = false; if (null != message1) { const updateMessageRecordResult = MessageRecordUtils.updateMessageRecord(value.message, message); let flag2 = null != updateMessageRecordResult; if (flag2) { value.message = updateMessageRecordResult; let tmp9 = null; if (null != value.conversationId) { const conversationMetadataById = peekResult.conversationMetadataById; value2 = conversationMetadataById.get(value.conversationId); if (value2 == null) { value2 = null; } tmp9 = value2; } const result = tmp6(7203).replaceHydratedMessage(tmp9, id, updateMessageRecordResult); flag2 = true; const tmp6Result = tmp6(7203); } flag = flag2; tmp6 = require; } } tmp = flag; } return tmp; }, MESSAGE_REACTION_ADD: handleReaction, MESSAGE_REACTION_REMOVE: handleReaction, MESSAGE_REACTION_ADD_MANY: function handleReactionBatch(messageId) { messageId = messageId.messageId; const peekResult = navigation.peek(messageId.channelId); let flag = false; if (null != peekResult) { const messageMetadataByMessageId = peekResult.messageMetadataByMessageId; value = messageMetadataByMessageId.get(messageId); let message1; if (value != null) { message1 = value.message; } flag = false; if (null != message1) { const message = value.message; const addReactionBatchResult = message.addReactionBatch(messageId.reactions, AuthenticationStore.getId()); let flag2 = null != addReactionBatchResult; if (flag2) { value.message = addReactionBatchResult; let tmp8 = null; if (null != value.conversationId) { const conversationMetadataById = peekResult.conversationMetadataById; value2 = conversationMetadataById.get(value.conversationId); if (value2 == null) { value2 = null; } tmp8 = value2; } const result = ConversationMessageCacheUtils.replaceHydratedMessage(tmp8, messageId, addReactionBatchResult); flag2 = true; } flag = flag2; } } return flag; }, MESSAGE_REACTION_REMOVE_ALL: function handleRemoveAllReactions(messageId) { messageId = messageId.messageId; const peekResult = navigation.peek(messageId.channelId); let flag = false; if (null != peekResult) { const messageMetadataByMessageId = peekResult.messageMetadataByMessageId; value = messageMetadataByMessageId.get(messageId); let message1; if (value != null) { message1 = value.message; } flag = false; if (null != message1) { const message = value.message; const result = message.set("reactions", []); let flag2 = null != result; if (flag2) { value.message = result; let tmp7 = null; if (null != value.conversationId) { const conversationMetadataById = peekResult.conversationMetadataById; value2 = conversationMetadataById.get(value.conversationId); if (value2 == null) { value2 = null; } tmp7 = value2; } const result1 = ConversationMessageCacheUtils.replaceHydratedMessage(tmp7, messageId, result); flag2 = true; } flag = flag2; } } return flag; }, MESSAGE_REACTION_REMOVE_EMOJI: function handleRemoveEmojiReactions(messageId) { messageId = messageId.messageId; const peekResult = navigation.peek(messageId.channelId); let flag = false; if (null != peekResult) { const messageMetadataByMessageId = peekResult.messageMetadataByMessageId; value = messageMetadataByMessageId.get(messageId); let message1; if (value != null) { message1 = value.message; } flag = false; if (null != message1) { const message = value.message; const result = message.removeReactionsForEmoji(messageId.emoji); let flag2 = null != result; if (flag2) { value.message = result; let tmp7 = null; if (null != value.conversationId) { const conversationMetadataById = peekResult.conversationMetadataById; value2 = conversationMetadataById.get(value.conversationId); if (value2 == null) { value2 = null; } tmp7 = value2; } const result1 = ConversationMessageCacheUtils.replaceHydratedMessage(tmp7, messageId, result); flag2 = true; } flag = flag2; } } return flag; }, MESSAGE_DELETE: function handleMessageDelete(id) { id = id.id; const peekResult = navigation.peek(id.channelId); let flag = false; if (null != peekResult) { const messageMetadataByMessageId = peekResult.messageMetadataByMessageId; value = messageMetadataByMessageId.get(id); let tmp3 = null; if (null != value) { let tmp4 = null; if (null != value.conversationId) { const conversationMetadataById = peekResult.conversationMetadataById; value2 = conversationMetadataById.get(value.conversationId); if (value2 == null) { value2 = null; } tmp4 = value2; } tmp3 = tmp4; } const result = ConversationMessageCacheUtils.removeHydratedMessage(tmp3, id); const messageMetadataByMessageId2 = peekResult.messageMetadataByMessageId; flag = messageMetadataByMessageId2.delete(id); } return flag; }, MESSAGE_DELETE_BULK: function handleMessageDeleteBulk(arg0) { let flag = false; while (tmp2 !== undefined) { if (removeMessage(tmp, tmp3)) { flag = true; } continue; } return flag; }, RELATIONSHIP_ADD: handleRelationshipUpdate, RELATIONSHIP_UPDATE: handleRelationshipUpdate, RELATIONSHIP_REMOVE: handleRelationshipUpdate, LOGOUT: function handleLogout() { navigation.reset(); map.clear(); map1.clear(); } }); const size = fn(2); let result = size.fileFinishedImporting("modules/conversations/ChannelConversationsStore.tsx"); export default channelConversationsStore;