decord/source/modules/search/SearchMessageStore.tsx

380 lines
11 KiB
TypeScript
Raw Normal View History

2026-07-23 10:11:24 +00:00
// Module ID: 5660
2026-07-24 07:16:23 +00:00
// Function ID: 48556
2026-07-20 16:05:17 +00:00
// Name: _isNativeReflectConstruct
2026-07-23 10:11:24 +00:00
// Dependencies: [15, 17, 18, 6, 7, 1194, 3767, 4029, 4351, 3769, 566, 686, 2]
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
// Module 5660 (_isNativeReflectConstruct)
import _possibleConstructorReturn from "_possibleConstructorReturn";
import _getPrototypeOf from "_getPrototypeOf";
import _inherits from "_inherits";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import V6OrEarlierAPIError from "V6OrEarlierAPIError";
import closure_7 from "_isNativeReflectConstruct";
import closure_8 from "_isNativeReflectConstruct";
const require = arg1;
2026-07-20 16:05:17 +00:00
function _isNativeReflectConstruct() {
let closure_0 = !valueOf.call(Reflect.construct(Boolean, [], () => {
}));
function _isNativeReflectConstruct() {
return closure_0;
}
const result = _isNativeReflectConstruct();
}
function getSearchStateOrDefault(arg0) {
let value = map.get(arg0);
if (null == value) {
const prototype = ctor.prototype;
value = new ctor();
}
return value;
}
function getOrCreateSearchState(arg0) {
const tmp = getSearchStateOrDefault(arg0);
const result = map.set(arg0, tmp);
return tmp;
}
function updateMessage(arg0, arg1) {
const value = map1.get(arg0);
if (null == value) {
return false;
} else {
const result = map1.set(arg0, arg1(value));
return true;
}
}
function withSearchState(arg0, arg1) {
return arg1(getSearchStateOrDefault(arg0));
}
function handleReaction(optimistic) {
2026-07-23 10:11:24 +00:00
let _possibleConstructorReturn;
let dependencyMap;
2026-07-20 16:05:17 +00:00
let messageId;
let userId;
2026-07-23 10:11:24 +00:00
const _require = optimistic;
({ type: dependencyMap, emoji: _possibleConstructorReturn } = optimistic);
2026-07-20 16:05:17 +00:00
({ messageId, userId } = optimistic);
if (obj.shouldApplyReaction(optimistic)) {
2026-07-23 10:11:24 +00:00
let _getPrototypeOf = store.getId() === userId;
2026-07-20 16:05:17 +00:00
return updateMessage(messageId, (addReaction) => {
2026-07-23 10:11:24 +00:00
const reactionType = optimistic.reactionType;
2026-07-20 16:05:17 +00:00
if ("MESSAGE_REACTION_ADD" === closure_1) {
2026-07-23 10:11:24 +00:00
let addReactionResult = addReaction.addReaction(_possibleConstructorReturn, _getPrototypeOf, optimistic.colors, reactionType);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
addReactionResult = addReaction.removeReaction(_possibleConstructorReturn, _getPrototypeOf, reactionType);
2026-07-20 16:05:17 +00:00
}
return addReactionResult;
});
} else {
return false;
}
2026-07-23 10:11:24 +00:00
obj = _require(3769);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let closure_9 = (() => {
2026-07-20 16:05:17 +00:00
class SearchState {
constructor() {
2026-07-23 10:11:24 +00:00
tmp = outer1_5(this, SearchState);
2026-07-20 16:05:17 +00:00
this.isIndexing = false;
this.isHistoricalIndexing = false;
this.isFetching = false;
this.analyticsId = null;
this.error = null;
this.messages = null;
this.documentsIndexed = 0;
this.totalResults = null;
set = new Set();
this.messageIds = set;
this.isInitialFetchComplete = false;
this.cursor = null;
return;
}
}
let obj = {
key: "handleSearchStart",
value() {
this.isFetching = true;
this.isIndexing = false;
this.analyticsId = null;
this.error = null;
}
};
2026-07-23 10:11:24 +00:00
let items = [obj, , , ];
2026-07-20 16:05:17 +00:00
obj = {
key: "handleSearchIndexing",
value() {
this.isInitialFetchComplete = true;
this.isIndexing = true;
this.isHistoricalIndexing = true;
this.isFetching = false;
this.error = null;
}
};
items[1] = obj;
obj = {
key: "handleSearchFailure",
value(arg0) {
this.isFetching = false;
this.isIndexing = false;
this.isInitialFetchComplete = true;
this.isHistoricalIndexing = false;
2026-07-23 10:11:24 +00:00
const aPIError = new SearchState(outer1_1[7]).APIError(arg0);
2026-07-20 16:05:17 +00:00
this.error = aPIError;
this.analyticsId = null;
this.documentsIndexed = 0;
}
};
items[2] = obj;
items[3] = {
key: "handleSearchSuccess",
value(analyticsId, arr) {
2026-07-23 10:11:24 +00:00
let self = this;
self = this;
2026-07-20 16:05:17 +00:00
let items;
let items1;
this.analyticsId = analyticsId.analyticsId;
this.isFetching = false;
this.isIndexing = false;
this.isInitialFetchComplete = true;
this.isHistoricalIndexing = analyticsId.doingHistoricalIndex;
this.error = null;
({ documentsIndexed: this.documentsIndexed, cursor: this.cursor } = analyticsId);
let messages = this.messages;
if (null == messages) {
messages = [];
}
items = [...messages];
items1 = [];
const item = arr.forEach((id) => {
const messageIds = self.messageIds;
let hasItem = messageIds.has(id.id);
if (!hasItem) {
2026-07-23 10:11:24 +00:00
hasItem = outer2_8.isBlockedOrIgnoredForMessage(id);
2026-07-20 16:05:17 +00:00
}
if (!hasItem) {
const messageIds2 = self.messageIds;
messageIds2.add(id.id);
items.push(id);
items1.push(id);
}
});
self.messages = items;
self.totalResults = analyticsId.totalResults;
return items1;
}
};
return callback2(SearchState, items);
2026-07-23 10:11:24 +00:00
})();
let map = new Map();
let map1 = new Map();
let map2 = new Map();
let tmp5 = ((Store) => {
2026-07-20 16:05:17 +00:00
class SearchMessageStore {
constructor() {
self = this;
2026-07-23 10:11:24 +00:00
tmp = outer1_5(this, SearchMessageStore);
obj = outer1_3(SearchMessageStore);
tmp2 = outer1_2;
if (outer1_13()) {
2026-07-20 16:05:17 +00:00
tmp6 = globalThis;
_Reflect = Reflect;
2026-07-23 10:11:24 +00:00
tmp7 = outer1_3;
2026-07-20 16:05:17 +00:00
tmp8 = arguments;
2026-07-23 10:11:24 +00:00
constructResult = Reflect.construct(obj, arguments, outer1_3(self).constructor);
2026-07-20 16:05:17 +00:00
} else {
tmp3 = arguments;
tmp4 = arguments;
constructResult = obj(...arguments);
}
return tmp2(self, constructResult);
}
}
callback(SearchMessageStore, Store);
let obj = {
key: "initialize",
value() {
2026-07-23 10:11:24 +00:00
this.waitFor(outer1_7, outer1_8);
2026-07-20 16:05:17 +00:00
}
};
const items = [obj, , , , , , , , , , , , ];
obj = {
key: "getMessage",
value(arg0) {
2026-07-23 10:11:24 +00:00
return outer1_11.get(arg0);
2026-07-20 16:05:17 +00:00
}
};
items[1] = obj;
obj = {
key: "getTotalCount",
value(arg0) {
2026-07-23 10:11:24 +00:00
return outer1_17(arg0, (totalResults) => totalResults.totalResults);
2026-07-20 16:05:17 +00:00
}
};
items[2] = obj;
items[3] = {
key: "getIsInitialFetchComplete",
value(arg0) {
2026-07-23 10:11:24 +00:00
return outer1_17(arg0, (isInitialFetchComplete) => isInitialFetchComplete.isInitialFetchComplete);
2026-07-20 16:05:17 +00:00
}
};
items[4] = {
key: "getIsIndexing",
value(arg0) {
2026-07-23 10:11:24 +00:00
return outer1_17(arg0, (isIndexing) => isIndexing.isIndexing);
2026-07-20 16:05:17 +00:00
}
};
items[5] = {
key: "getIsHistoricalIndexing",
value(arg0) {
2026-07-23 10:11:24 +00:00
return outer1_17(arg0, (isHistoricalIndexing) => isHistoricalIndexing.isHistoricalIndexing);
2026-07-20 16:05:17 +00:00
}
};
items[6] = {
key: "getDocumentsIndexed",
value(arg0) {
2026-07-23 10:11:24 +00:00
return outer1_17(arg0, (documentsIndexed) => documentsIndexed.documentsIndexed);
2026-07-20 16:05:17 +00:00
}
};
items[7] = {
key: "getIsFetching",
value(arg0) {
2026-07-23 10:11:24 +00:00
return outer1_17(arg0, (isFetching) => isFetching.isFetching);
2026-07-20 16:05:17 +00:00
}
};
items[8] = {
key: "getError",
value(arg0) {
2026-07-23 10:11:24 +00:00
return outer1_17(arg0, (error) => error.error);
2026-07-20 16:05:17 +00:00
}
};
items[9] = {
key: "getMessages",
value(arg0) {
2026-07-23 10:11:24 +00:00
return outer1_17(arg0, (messages) => messages.messages);
2026-07-20 16:05:17 +00:00
}
};
items[10] = {
key: "getCursor",
value(arg0) {
2026-07-23 10:11:24 +00:00
return outer1_17(arg0, (cursor) => cursor.cursor);
2026-07-20 16:05:17 +00:00
}
};
items[11] = {
key: "getAnalyticsId",
value(arg0) {
2026-07-23 10:11:24 +00:00
return outer1_17(arg0, (analyticsId) => analyticsId.analyticsId);
2026-07-20 16:05:17 +00:00
}
};
items[12] = {
key: "hasSearchState",
value(arg0) {
2026-07-23 10:11:24 +00:00
return outer1_10.has(arg0);
2026-07-20 16:05:17 +00:00
}
};
return callback2(SearchMessageStore, items);
2026-07-23 10:11:24 +00:00
})(require("initialize").Store);
2026-07-20 16:05:17 +00:00
tmp5.displayName = "SearchMessageStore";
2026-07-23 10:11:24 +00:00
tmp5 = new tmp5(require("dispatcher"), {
2026-07-20 16:05:17 +00:00
SEARCH_MESSAGES_START: function handleSearchMessagesStart(ids) {
ids = ids.ids;
const item = ids.forEach((arg0) => {
2026-07-23 10:11:24 +00:00
outer1_15(arg0).handleSearchStart();
2026-07-20 16:05:17 +00:00
});
},
SEARCH_MESSAGES_SUCCESS: function handleSearchMessagesSuccess(data) {
data = data.data;
2026-07-23 10:11:24 +00:00
let item = data.forEach((id) => {
2026-07-20 16:05:17 +00:00
const messages = id.messages;
2026-07-23 10:11:24 +00:00
const obj = outer1_15(id.id);
const item = outer1_15(id.id).handleSearchSuccess(id, messages.map((arg0) => {
2026-07-20 16:05:17 +00:00
let tmp;
[tmp] = arg0;
2026-07-23 10:11:24 +00:00
return outer2_0(outer2_1[8]).createMessageRecord(tmp);
2026-07-20 16:05:17 +00:00
})).forEach((id) => {
2026-07-23 10:11:24 +00:00
const result = outer2_11.set(id.id, id);
const value = outer2_12.get(id.id);
2026-07-20 16:05:17 +00:00
let num = 0;
if (null != value) {
num = value;
}
2026-07-23 10:11:24 +00:00
const result1 = outer2_12.set(id.id, num + 1);
2026-07-20 16:05:17 +00:00
});
});
},
SEARCH_MESSAGES_INDEXING: function handleSearchMessagesIndexing(ids) {
ids = ids.ids;
const item = ids.forEach((arg0) => {
2026-07-23 10:11:24 +00:00
outer1_15(arg0).handleSearchIndexing();
2026-07-20 16:05:17 +00:00
});
},
SEARCH_MESSAGES_FAILURE: function handleSearchMessagesFailure(ids) {
2026-07-23 10:11:24 +00:00
let closure_0 = ids;
2026-07-20 16:05:17 +00:00
ids = ids.ids;
const item = ids.forEach((arg0) => {
2026-07-23 10:11:24 +00:00
outer1_15(arg0).handleSearchFailure(ids.error);
2026-07-20 16:05:17 +00:00
});
},
SEARCH_MESSAGES_CLEAR: function handleSearchMessagesClear(id) {
2026-07-23 10:11:24 +00:00
let value = map.get(id.id);
2026-07-20 16:05:17 +00:00
if (null == value) {
return false;
} else {
const messageIds = value.messageIds;
const item = messageIds.forEach((arg0) => {
2026-07-23 10:11:24 +00:00
const value = outer1_12.get(arg0);
2026-07-20 16:05:17 +00:00
let num = 0;
if (null != value) {
num = value;
}
if (num <= 1) {
2026-07-23 10:11:24 +00:00
outer1_11.delete(arg0);
outer1_12.delete(arg0);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
const result = outer1_12.set(arg0, num - 1);
2026-07-20 16:05:17 +00:00
}
});
map.delete(id.id);
}
},
SEARCH_MESSAGES_CLEAR_ALL: function handleSearchMessagesClearAll() {
const map = new Map();
const map1 = new Map();
const map2 = new Map();
},
MESSAGE_UPDATE: function handleMessageUpdate(message) {
const id = message.message.id;
if (null == id) {
return false;
} else {
const value = map1.get(id);
if (null == value) {
return false;
} else {
2026-07-23 10:11:24 +00:00
const result = map1.set(id, require(4351) /* createMinimalMessageRecord */.updateMessageRecord(value, message.message));
2026-07-20 16:05:17 +00:00
}
}
},
MESSAGE_REACTION_ADD: handleReaction,
MESSAGE_REACTION_ADD_MANY: function handleReactionBatch(reactions) {
2026-07-23 10:11:24 +00:00
reactions = reactions.reactions;
2026-07-20 16:05:17 +00:00
const id = store.getId();
return updateMessage(reactions.messageId, (addReactionBatch) => addReactionBatch.addReactionBatch(reactions, closure_1));
},
MESSAGE_REACTION_REMOVE: handleReaction,
MESSAGE_REACTION_REMOVE_ALL: function handleRemoveAllReactions(messageId) {
return updateMessage(messageId.messageId, (set) => set.set("reactions", []));
},
MESSAGE_REACTION_REMOVE_EMOJI: function handleRemoveEmojiReactions(emoji) {
2026-07-23 10:11:24 +00:00
emoji = emoji.emoji;
2026-07-20 16:05:17 +00:00
return updateMessage(emoji.messageId, (removeReactionsForEmoji) => removeReactionsForEmoji.removeReactionsForEmoji(emoji));
},
CONNECTION_OPEN: function handleConnectionOpen() {
const map = new Map();
const map1 = new Map();
const map2 = new Map();
}
});
2026-07-23 10:11:24 +00:00
let result = require("_inherits").fileFinishedImporting("modules/search/SearchMessageStore.tsx");
2026-07-20 16:05:17 +00:00
export default tmp5;