Files
discord-decomp/sources/modules/search/native/SearchPlatformUtils.tsx
T
2026-07-27 16:20:00 +03:00

831 lines
37 KiB
TypeScript

/* Metro module 11822; source: modules/search/native/SearchPlatformUtils.tsx; dependencies: [4792, 9674, 9615, 11823, 661, 9675, 9546, 1391, 6996, 477, 1848, 4056, 1471, 8765, 697, 3829, 9673, 11828, 9682, 22, 628, 2] */
function _fun90549(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#90549, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:6, offset: 0x0203e054, size: 676 bytes, params: 8, frame: 31
var object2;
let env0_0 = require;
const _arrayLikeToArray_90552 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const closure = performKeyboardAwareNavigation;
const closure2 = function(a0) {
var env0_0 = a0;
global.setTimeout(_fun90556, 200);
};
const closure3 = getUrlIcon;
const closure4 = getGridItemBorderStyles;
const closure5 = function({itemIndex, numItems, numColumns, spacing}) {
var r8;
var object = {};
copyDataProperties(object, getGridItemBorderStyles({itemIndex: itemIndex, numItems: numItems,
numColumns: numColumns}), r8);
copyDataProperties(object, getGridItemSpacingStyles({itemIndex: itemIndex, spacing: spacing,
numColumns: numColumns}), r8);
return object;
};
const closure6 = function({itemIndex, spacing, numColumns}) {
var value = spacing * (numColumns - 1) / numColumns;
var value2 = itemIndex % numColumns;
if (value2 === 0) {
return {marginEnd: value};
}
if (numColumns - 1 === value2) {
return {marginStart: value};
}
return {marginHorizontal: value / 2};
};
const closure7 = function(a0) {
return {id: a0.text, text: a0.text};
};
const _getLimit = function(a0) {
var Math = global.Math;
return Math.min(a0, MAX_SEARCH_RESULTS_LIMIT);
};
const getInitialFetchLimit = function(a0) {
return _getLimit(SEARCH_TABS_TO_SEARCH_QUERY_LIMITS[a0]);
};
const getNextFetchLimit = function(a0) {
return _getLimit(2 * SEARCH_TABS_TO_SEARCH_QUERY_LIMITS[a0]);
};
const closure8 = fetchInitialMessages;
const closure9 = syncAutocomplete;
const closure10 = subscribeSearchQueryState;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const searchMessageStore = importDefault(4792) /* metro dependency 4792: SearchMessageStore */;
const searchQueryStore = importDefault(9674) /* metro dependency 9674: SearchQueryStore */;
let value = require(9615) /* metro dependency 9615: SearchConstants */;
const env0_5 = value.CHANNEL_SEARCH_INITIAL_MESSAGE_TABS;
const env0_6 = value.MAX_SEARCH_RESULTS_LIMIT;
const env0_7 = value.MESSAGE_SEARCH_RESULT_TABS;
const env0_8 = value.SEARCH_INITIAL_MESSAGE_TABS;
const env0_9 = value.SEARCH_TABS_TO_SEARCH_QUERY_LIMITS;
const env0_10 = value.SearchFileTypes;
const env0_11 = value.SearchLinkTypes;
const env0_12 = value.SearchMediaTypes;
value = require(11823) /* metro dependency 11823: SearchPlatformConstants */;
const env0_13 = value.PLATFORM_REGEX_ICON_PAIRS;
const SEARCH_TEXT_INPUT_DEBOUNCE_TIME = value.SEARCH_TEXT_INPUT_DEBOUNCE_TIME;
value = require(661) /* metro dependency 661: Constants */;
const env0_14 = value.MessageFlags;
const env0_15 = value.SearchModes;
const env0_16 = value.SearchTypes;
object2 = {performKeyboardAwareNavigation: closure, delayUntilNavigationComplete: closure2, getUrlIcon: closure3,
getGridItemBorderStyles: closure4, getMediaGridItemStyles: closure5, getGridItemSpacingStyles: closure6,
toSearchBarTag: closure7, fetchInitialMessages: closure8};
object2.fetchInitialMessagesDebounced = (importDefault(22) /* metro dependency 22 */).debounce(closure8,
SEARCH_TEXT_INPUT_DEBOUNCE_TIME);
object2.fetchNextMessages = fetchNextMessages;
object2.syncAutocomplete = closure9;
object2.syncAutocompleteDebounced = (importDefault(22) /* metro dependency 22 */).debounce(closure9,
SEARCH_TEXT_INPUT_DEBOUNCE_TIME);
object2.navigateToSearchWithPrefetch = function(a0, a1) {
importDefault(dependencyMap[18]).initializeAutocomplete(a1);
importDefault(dependencyMap[17]).initializeSearchQuery(a1);
fetchInitialMessages(a1);
a0.navigate('search', {searchContext: a1});
};
object2.subscribeSearchQueryState = closure10;
object2.subscribeTextInputValue = function(a0, a1, a2) {
var env0_0 = a1;
return subscribeSearchQueryState(a0, _fun90579, _fun90580, a2);
};
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/search/native/SearchPlatformUtils.tsx');
exports.default = object2;
exports.getMedia = getMedia;
exports.getFiles = function(a0) {
var env0_0 = a0;
var value = a0.getContentMessage();
var env0_2 = value;
var attachments = value.attachments;
if (attachments != null) {
attachments.forEach(_fun90586);
}
return [];
};
exports.getLinks = getLinks;
exports.performKeyboardAwareNavigation = closure;
exports.delayUntilNavigationComplete = closure2;
exports.getUrlIcon = closure3;
exports.getGridItemBorderStyles = closure4;
exports.getMediaGridItemStyles = closure5;
exports.getGridItemSpacingStyles = closure6;
exports.toSearchBarTag = closure7;
}
function _createForOfIteratorHelperLoose_90550(a0, a1) { // fn#90550, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:503, offset: 0x0203e2f8, size: 372 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun90551;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_90552(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_90552(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_90552(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun90551;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
}
function performKeyboardAwareNavigation(a0) { // fn#90553, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:1413, offset: 0x0203e46c, size: 142 bytes, params: 2, frame: 16
var moduleValue2;
const env0_0 = a0;
const useKeyboardIsOpenModule = require(6996) /* metro dependency 6996: useKeyboardIsOpen */;
const getKeyboardIsOpen = useKeyboardIsOpenModule.getKeyboardIsOpen;
if (Reflect.apply(getKeyboardIsOpen, useKeyboardIsOpenModule, [])) {
moduleValue2 = require(477) /* metro dependency 477: PlatformUtils */;
if (moduleValue2.isIOS()) {
(require(1848) /* metro dependency 1848: KeyboardManagerUtils */).dismissGlobalKeyboard();
global.setTimeout(_fun90554, 100);
} else {
a0();
}
} else {
a0();
}
}
function delayUntilNavigationComplete(a0) { // fn#90555, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:1569, offset: 0x0203e4fa, size: 37 bytes, params: 2, frame: 13
const env0_0 = a0;
global.setTimeout(_fun90556, 200);
}
function getUrlIcon(a0) { // fn#90557, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:1636, offset: 0x0203e51f, size: 273 bytes, params: 2, frame: 16
var r4;
var property;
var REGEX;
var Icon;
var exec;
var value3;
if (a0 != null) {
var defaultImport = importDefault(1471) /* metro dependency 1471: URLUtils */;
if (defaultImport.safeParseWithQuery(a0) == null) {
return (require(4056) /* metro dependency 4056: LinkIcon */).LinkIcon;
}
var defaultImport2 = importDefault(1471) /* metro dependency 1471: URLUtils */;
if (defaultImport2.isDiscordUrl(a0)) {
return (require(8765) /* metro dependency 8765: ClydeIcon */).ClydeIcon;
}
var length = PLATFORM_REGEX_ICON_PAIRS.length;
var value2 = 0;
if (value2 < length) {
r4 = value2;
loopExit4: while (true) {
property = PLATFORM_REGEX_ICON_PAIRS[r4];
REGEX = property.REGEX;
Icon = property.Icon;
exec = REGEX.exec;
if (Reflect.apply(exec, REGEX, [a0]) != null) {
return Icon;
}
value3 = typeof r4 === 'bigint' ? r4 + 1n : +r4 + 1;
length = PLATFORM_REGEX_ICON_PAIRS.length;
if (value3 < length) {
r4 = value3;
continue;
}
break loopExit4;
}
return (require(4056) /* metro dependency 4056: LinkIcon */).LinkIcon;
}
}
return (require(4056) /* metro dependency 4056: LinkIcon */).LinkIcon;
}
function getGridItemBorderStyles({itemIndex, numItems, numColumns}) { // fn#90558, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:1931, offset: 0x0203e630, size: 310 bytes, params: 2, frame: 16
var r0;
var object2;
let Math = global.Math;
let value = Math.ceil(numItems / numColumns);
Math = global.Math;
if (itemIndex === 0) {
object2 = {};
object2.borderTopLeftRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
r0 = object2;
} else if (itemIndex === numColumns - 1) {
object2 = {};
object2.borderTopRightRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
r0 = object2;
} else if (itemIndex % numColumns != 0) {
value = undefined;
if (itemIndex !== value * numColumns - 1) {
r0 = value;
} else {
object2 = {};
object2.borderBottomRightRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
r0 = object2;
}
} else if (Math.floor(itemIndex / numColumns) === value - 1) {
object2 = {};
object2.borderBottomLeftRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
r0 = object2;
} else {
value = undefined;
if (itemIndex !== value * numColumns - 1) {
r0 = value;
} else {
object2 = {};
object2.borderBottomRightRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
r0 = object2;
}
}
return r0;
}
function onInitialFetchMessagesSuccess({searchContext, tabEntries}) { // fn#90565, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:2896, offset: 0x0203e899, size: 85 bytes, params: 2, frame: 12
var value;
if (tabEntries.every(function(a0) {
var r0;
var r1;
var r2;
var item3;
var value3;
var iterator = a0[Symbol.iterator]();
var iterator2 = iterator.next;
var item2 = Reflect.apply(iterator2, iterator, []);
var item = item2.value;
item2 = item2.done ? undefined : iterator;
var value = undefined;
var value2 = item2 === value;
if (value2) {
r0 = item2;
r1 = value;
r2 = value2;
} else {
item3 = Reflect.apply(iterator2, item2, []);
item = item3.value;
item3 = item3.done ? undefined : item2;
value3 = item3 === value;
if (value3) {
r0 = item3;
r1 = value;
r2 = value3;
} else {
r0 = item3;
r1 = item;
r2 = value3;
}
}
if (!r2) {
r0.return();
}
return r1.total_results === 0 || r1.total_results == null;
})) {
value = importDefault(9673) /* metro dependency 9673: Tracking */;
value.trackSearchEmptyMessageResult({searchContext: searchContext});
}
}
function onFetchMessagesStart({searchContext, searchQueryString}) { // fn#90567, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:3090, offset: 0x0203e942, size: 67 bytes, params: 2, frame: 14
(importDefault(11828) /* metro dependency 11828: SearchPlatformActionCreators */).updateSearchQuery(searchContext,
function(a0) {
return a0.setSearchResultsQuery(searchQueryString);
});
}
function fetchInitialMessages(a0) { // fn#90569, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:3222, offset: 0x0203e99c, size: 395 bytes, params: 2, frame: 24
var object2;
var defaultImport3;
var fetchTabMessages;
var cursor;
var value5;
const env0_0 = a0;
const isInitialSearchQuery2 = SearchQueryStore.isInitialSearchQuery(a0);
const queryString = SearchQueryStore.getQueryString(a0);
const r7 = isInitialSearchQuery2 ? SearchTypes.GUILD_CHANNEL === a0.type || SearchTypes.CHANNEL === a0.type ? CHANNEL_SEARCH_INITIAL_MESSAGE_TABS : SEARCH_INITIAL_MESSAGE_TABS : MESSAGE_SEARCH_RESULT_TABS;
const searchTabFetchId = (require(9675) /* metro dependency 9675: SearchUtils */).getSearchTabFetchId(a0, r7[0],
queryString);
const getIsFetching = SearchMessageStore.getIsFetching;
if (!Reflect.apply(getIsFetching, SearchMessageStore, [searchTabFetchId])) {
(importDefault(9682) /* metro dependency 9682: SearchActionCreators */).clearAllSearchMesssages();
(importDefault(9673) /* metro dependency 9673: Tracking */).trackSearchStarted({searchContext: a0});
defaultImport3 = importDefault(9682) /* metro dependency 9682: SearchActionCreators */;
fetchTabMessages = defaultImport3.fetchTabMessages;
object2 = {searchContext: a0, searchTabs: r7, searchQueryString: queryString, getId: getId_90570};
object2.getLimit = getInitialFetchLimit;
object2.onFetchStart = onFetchMessagesStart;
object2.onFetchSuccess = onInitialFetchMessagesSuccess;
cursor = SearchMessageStore.getCursor(searchTabFetchId);
value5 = null;
object2.pagination = {cursor: value5 != cursor ? cursor : value5};
object2.trackExactTotalHits = (require(3829) /* metro dependency 3829: UserSettings */).SearchResultExactCountEnabled.getSetting();
object2.searchMode = SearchModes.NEWEST;
Reflect.apply(fetchTabMessages, defaultImport3, [object2]);
}
}
function syncAutocomplete(a0) { // fn#90571, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:3964, offset: 0x0203eb5d, size: 151 bytes, params: 2, frame: 21
const queryString = SearchQueryStore.getQueryString(a0, true);
const value3 = (require(9675) /* metro dependency 9675: SearchUtils */).tokenizeQuery(queryString);
const selectionScope = (require(9675) /* metro dependency 9675: SearchUtils */).getSelectionScope(value3,
queryString.length - 1, queryString.length - 1);
const value = importDefault(9682) /* metro dependency 9682: SearchActionCreators */;
value.updateAutocompleteQuery({searchContext: a0, tokens: value3, cursorScope: selectionScope,
queryString: queryString});
}
function subscribeSearchQueryState(a0, a1, a2, a3) { // fn#90572, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:4194, offset: 0x0203ebf4, size: 116 bytes, params: 5, frame: 17
const value = a3;
const env0_0 = a0;
const env0_1 = a1;
const env0_2 = a2;
const env0_3 = a1(SearchQueryStore.getManager(a0));
if (value && env0_3 != null) {
a2(env0_3, undefined);
}
SearchQueryStore.addChangeListener(subscribeSearchQueryStateCallback);
return function() {
return SearchQueryStore.removeChangeListener(subscribeSearchQueryStateCallback);
};
}
function fetchNextMessages(a0, a1, a2) { // fn#90575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:4918, offset: 0x0203ece6, size: 505 bytes, params: 4, frame: 25
var r1;
var r0;
var r3;
var cursor;
var totalCount;
var messages;
const SearchResultExactCountEnabled = (require(3829) /* metro dependency 3829: UserSettings */).SearchResultExactCountEnabled;
var defaultImport;
var fetchTabMessages;
var object2;
var cursor2;
var value22;
const env0_0 = a0;
const queryString = SearchQueryStore.getQueryString(a0);
const searchTabFetchId = (require(9675) /* metro dependency 9675: SearchUtils */).getSearchTabFetchId(a0, a1,
queryString);
const initialFetchLimit = getInitialFetchLimit(a1);
const searchTabFetchId2 = (require(9675) /* metro dependency 9675: SearchUtils */).getSearchTabFetchId(a0, a1,
queryString);
if (SearchMessageStore.getIsInitialFetchComplete(searchTabFetchId2)) {
cursor = SearchMessageStore.getCursor(searchTabFetchId2);
totalCount = SearchMessageStore.getTotalCount(searchTabFetchId2);
messages = SearchMessageStore.getMessages(searchTabFetchId2);
if (SearchResultExactCountEnabled.getSetting()) {
r1 = cursor != null && totalCount != null;
r1 = r1 && messages != null;
r1 = r1 && messages.length < totalCount;
r0 = r1;
} else if (totalCount == null) {
r0 = cursor != null;
} else if (totalCount < initialFetchLimit) {
r1 = cursor != null && totalCount != null;
r1 = r1 && messages != null;
r1 = r1 && messages.length < totalCount;
r0 = r1;
} else {
r0 = cursor != null;
}
r3 = r0;
} else {
r3 = true;
}
const isFetching = SearchMessageStore.getIsFetching(searchTabFetchId);
r0 = r3 ? !SearchMessageStore.getIsInitialFetchComplete(searchTabFetchId) : !r3;
r0 = !r0 ? isFetching : r0;
if (r0) {
r0 = !r0;
} else {
defaultImport = importDefault(9682) /* metro dependency 9682: SearchActionCreators */;
fetchTabMessages = defaultImport.fetchTabMessages;
object2 = {searchContext: a0};
object2.searchTabs = [a1];
object2.searchQueryString = queryString;
object2.getLimit = getNextFetchLimit;
object2.getId = getId_90576;
object2.onFetchStart = onFetchMessagesStart;
object2.onFetchSuccess = a2;
cursor2 = SearchMessageStore.getCursor(searchTabFetchId);
value22 = null;
object2.pagination = {cursor: value22 != cursor2 ? cursor2 : value22};
object2.trackExactTotalHits = SearchResultExactCountEnabled.getSetting();
object2.searchMode = SearchModes.NEWEST;
r0 = Reflect.apply(fetchTabMessages, defaultImport, [object2]);
}
return r0;
}
function subscribeTextInputValue(a0, a1, a2) { // fn#90578, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:6162, offset: 0x0203ef42, size: 44 bytes, params: 4, frame: 17
const env0_0 = a1;
return subscribeSearchQueryState(a0, function(a0) {
return {textInputValue: a0.getTextInputValue(), textInputChangedFromInput: a0.getTextValueChangedFromInput()};
}, _fun90580, a2);
}
function getMedia(a0, a1) { // fn#90581, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:6544, offset: 0x0203efc8, size: 87 bytes, params: 3, frame: 14
const env0_0 = (require(9675) /* metro dependency 9675: SearchUtils */).getGuildIdFromSearchContext(a0) ?? undefined;
a1.forEach(_fun90582);
return [];
}
function getFiles(a0) { // fn#90585, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:7760, offset: 0x0203f39e, size: 62 bytes, params: 2, frame: 12
const env0_0 = a0;
const attachments = a0.getContentMessage().attachments;
if (attachments != null) {
attachments.forEach(_fun90586);
}
return [];
}
function getLinks(a0, a1) { // fn#90587, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:8323, offset: 0x0203f53f, size: 190 bytes, params: 3, frame: 16
const env0_0 = a1;
const env0_1 = (require(9675) /* metro dependency 9675: SearchUtils */).getGuildIdFromSearchContext(a0) ?? undefined;
const items2 = [];
const embeds = a1.getContentMessage().embeds;
if (embeds != null) {
embeds.forEach(_fun90588);
}
if (items2.length === 0) {
items2.push({type: SearchLinkTypes.TEXT, messageId: a1.id, channelId: a1.channel_id, author: a1.author,
linkIndex: 0});
}
return items2;
}
function fetchInitialMessagesGetId(a0) { // fn#90570, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:3668, owner: fetchInitialMessages.getId, offset: 0x0203eb27, size: 54 bytes, params: 2, frame: 15
const value = environment.__proto__;
return (require(9675) /* metro dependency 9675: SearchUtils */).getSearchTabFetchId(env0_0, a0, env0_1);
}
function subscribeSearchQueryStateCallback() { // fn#90573, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:4304, owner: subscribeSearchQueryState.callback, offset: 0x0203ec68, size: 99 bytes, params: 1, frame: 15
const value = environment.__proto__;
const moduleValue = require(SearchQueryStore.getManager(env0_0));
if (env0_3 == null) {
importDefault(moduleValue, env0_3);
} else if (!(importDefault(628) /* metro dependency 628: shallowEqual */)(env0_3, moduleValue)) {
importDefault(moduleValue, env0_3);
}
}
function _fun90580({textInputValue, textInputChangedFromInput}, a1) { // fn#90580, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:6343, offset: 0x0203ef93, size: 53 bytes, params: 3, frame: 17
const textInputValue = a1?.textInputValue;
require(textInputValue, textInputValue, textInputChangedFromInput);
}
function _fun90582(a0) { // fn#90582, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:6657, offset: 0x0203f01f, size: 403 bytes, params: 2, frame: 23
var r7;
var forEach;
var value6;
var binding;
var push;
var COMPONENT;
var id;
var channel_id;
var author;
var sources;
var unfurledMediaItem;
var value7;
var AUDIO;
const env0_0 = a0;
let env0_1 = 0;
const contentMessage = a0.getContentMessage();
const attachments = contentMessage.attachments;
reducibleJoin2: while (true) {
if (attachments == null) {
break reducibleJoin2;
}
forEach = attachments.forEach;
Reflect.apply(forEach, attachments, [_fun90583]);
break reducibleJoin2;
}
const embeds = contentMessage.embeds;
reducibleJoin4: while (true) {
if (embeds == null) {
break reducibleJoin4;
}
forEach = embeds.forEach;
Reflect.apply(forEach, embeds, [_fun90584]);
break reducibleJoin4;
}
const _createForOfIteratorHelperLoose_90550Binding = _createForOfIteratorHelperLoose_90550;
const mediaSourceUtilModule = require(9546) /* metro dependency 9546: MediaSourceUtil */;
const value4 = _createForOfIteratorHelperLoose_90550Binding(mediaSourceUtilModule.extractMediaFromMessageComponents(a0,
contentMessage, env0_0));
const value5 = value4();
let done = value5.done;
if (!done) {
r7 = value5;
reducibleLoop5: while (true) {
value6 = r7.value;
binding = env0_1;
push = binding.push;
COMPONENT = SearchMediaTypes.COMPONENT;
id = a0.id;
channel_id = a0.channel_id;
author = a0.author;
sources = value6.sources;
unfurledMediaItem = value6.unfurledMediaItem;
Reflect.apply(push, binding, [{type: COMPONENT, messageId: id, channelId: channel_id, author: author,
mediaIndex: env0_1, sources: sources, unfurledMediaItem: unfurledMediaItem}]);
binding = env0_1;
env0_1 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
value7 = value4();
done = value7.done;
if (done) {
break reducibleLoop5;
}
r7 = value7;
continue reducibleLoop5;
}
}
const flagUtilsModule = require(1391) /* metro dependency 1391: FlagUtils */;
const hasFlag = flagUtilsModule.hasFlag;
const flags = contentMessage.flags;
const IS_VOICE_MESSAGE = MessageFlags.IS_VOICE_MESSAGE;
reducibleJoin8: while (true) {
if (Reflect.apply(hasFlag, flagUtilsModule, [flags, IS_VOICE_MESSAGE])) {
binding = env0_1;
push = binding.push;
AUDIO = SearchMediaTypes.AUDIO;
id = a0.id;
channel_id = a0.channel_id;
author = a0.author;
Reflect.apply(push, binding, [{type: AUDIO, messageId: id, channelId: channel_id, author: author,
mediaIndex: env0_1}]);
binding = env0_1;
env0_1 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
break reducibleJoin8;
}
break reducibleJoin8;
}
}
function _fun90586(a0, a1) { // fn#90586, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:7859, offset: 0x0203f3dc, size: 355 bytes, params: 3, frame: 20
var moduleValue2;
var moduleValue3;
var hasFlag2;
var binding;
var push;
var object2;
var binding2;
var binding3;
var binding4;
const mediaSourceUtilModule = require(9546) /* metro dependency 9546: MediaSourceUtil */;
if (mediaSourceUtilModule.isValidImageAttachment(a0)) {
binding = env0_1;
push = binding.push;
binding4 = env0_0;
Reflect.apply(push, binding, [{type: SearchFileTypes.MEDIA_ATTACHMENT, messageId: binding4.id,
channelId: binding4.channel_id, author: binding4.author, fileIndex: a1, attachment: a0}]);
} else {
moduleValue2 = mediaSourceUtilModule;
if (moduleValue2.isValidVideoAttachment(a0)) {
binding = env0_1;
push = binding.push;
binding4 = env0_0;
Reflect.apply(push, binding, [{type: SearchFileTypes.MEDIA_ATTACHMENT, messageId: binding4.id,
channelId: binding4.channel_id, author: binding4.author, fileIndex: a1, attachment: a0}]);
} else {
moduleValue3 = require(1391) /* metro dependency 1391: FlagUtils */;
hasFlag2 = moduleValue3.hasFlag(env0_2.flags, MessageFlags.IS_VOICE_MESSAGE);
binding = env0_1;
push = binding.push;
object2 = {};
if (hasFlag2) {
object2.type = SearchFileTypes.AUDIO;
binding3 = env0_0;
object2.messageId = binding3.id;
object2.channelId = binding3.channel_id;
object2.author = binding3.author;
object2.fileIndex = a1;
object2.attachment = a0;
Reflect.apply(push, binding, [object2]);
} else {
object2.type = SearchFileTypes.ATTACHMENT;
binding2 = env0_0;
object2.messageId = binding2.id;
object2.channelId = binding2.channel_id;
object2.author = binding2.author;
object2.fileIndex = a1;
object2.attachment = a0;
Reflect.apply(push, binding, [object2]);
}
}
}
}
function _fun90588(a0, a1) { // fn#90588, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:8486, offset: 0x0203f5fd, size: 228 bytes, params: 3, frame: 22
var moduleValue2;
var moduleValue3;
var extractMediaFromEmbed;
var binding;
var value3;
const mediaSourceUtilModule = require(9546) /* metro dependency 9546: MediaSourceUtil */;
if (mediaSourceUtilModule.isValidImageEmbed(a0)) {
moduleValue3 = mediaSourceUtilModule;
extractMediaFromEmbed = moduleValue3.extractMediaFromEmbed;
binding = env0_3;
value3 = Reflect.apply(extractMediaFromEmbed, moduleValue3, [a0, require, binding, a1, env0_1]);
if (value3 != null) {
binding = env0_2;
binding.push({type: SearchLinkTypes.EMBED, messageId: require.id, channelId: require.channel_id,
author: require.author, linkIndex: env0_4, sources: value3, embed: a0});
binding = env0_4;
env0_4 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
}
} else {
moduleValue2 = require(9546) /* metro dependency 9546: MediaSourceUtil */;
if (moduleValue2.isValidVideoEmbed(a0)) {
moduleValue3 = require(9546) /* metro dependency 9546: MediaSourceUtil */;
extractMediaFromEmbed = moduleValue3.extractMediaFromEmbed;
binding = env0_3;
value3 = Reflect.apply(extractMediaFromEmbed, moduleValue3, [a0, require, binding, a1, env0_1]);
if (value3 != null) {
binding = env0_2;
binding.push({type: SearchLinkTypes.EMBED, messageId: require.id, channelId: require.channel_id,
author: require.author, linkIndex: env0_4, sources: value3, embed: a0});
binding = env0_4;
env0_4 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
}
}
}
}
function _fun90583(a0, a1) { // fn#90583, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:6733, offset: 0x0203f1b2, size: 261 bytes, params: 3, frame: 21
var moduleValue2;
var moduleValue3;
var moduleValue4;
var extractMediaFromAttachment;
var binding;
var value3;
var value4;
var push;
var binding2;
const mediaSourceUtilModule = require(9546) /* metro dependency 9546: MediaSourceUtil */;
if (!mediaSourceUtilModule.isThumbnailAttachment(a0)) {
moduleValue2 = mediaSourceUtilModule;
if (moduleValue2.isValidImageAttachment(a0)) {
moduleValue4 = require(9546) /* metro dependency 9546: MediaSourceUtil */;
extractMediaFromAttachment = moduleValue4.extractMediaFromAttachment;
binding = env0_0;
value3 = environment.__proto__;
value4 = Reflect.apply(extractMediaFromAttachment, moduleValue4, [a0, binding, a1, env1_0]);
if (value4 != null) {
binding = env1_1;
push = binding.push;
binding2 = env0_0;
Reflect.apply(push, binding, [{type: SearchMediaTypes.ATTACHMENT, attachment: a0,
messageId: binding2.id,
channelId: binding2.channel_id, author: binding2.author, mediaIndex: env0_1, sources: value4}]);
binding = env0_1;
env0_1 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
}
} else {
moduleValue3 = require(9546) /* metro dependency 9546: MediaSourceUtil */;
if (moduleValue3.isValidVideoAttachment(a0)) {
moduleValue4 = require(9546) /* metro dependency 9546: MediaSourceUtil */;
extractMediaFromAttachment = moduleValue4.extractMediaFromAttachment;
binding = env0_0;
value3 = environment.__proto__;
value4 = Reflect.apply(extractMediaFromAttachment, moduleValue4, [a0, binding, a1, env1_0]);
if (value4 != null) {
binding = env1_1;
push = binding.push;
binding2 = env0_0;
Reflect.apply(push, binding, [{type: SearchMediaTypes.ATTACHMENT, attachment: a0,
messageId: binding2.id,
channelId: binding2.channel_id, author: binding2.author, mediaIndex: env0_1, sources: value4}]);
binding = env0_1;
env0_1 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
}
}
}
}
}
function _fun90584(a0, a1) { // fn#90584, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12008:7073, offset: 0x0203f2b7, size: 231 bytes, params: 3, frame: 23
var moduleValue2;
var moduleValue3;
var extractMediaFromEmbed;
var binding;
var binding2;
var value3;
var value4;
var push;
var binding3;
const mediaSourceUtilModule = require(9546) /* metro dependency 9546: MediaSourceUtil */;
if (mediaSourceUtilModule.isValidImageEmbed(a0)) {
moduleValue3 = mediaSourceUtilModule;
extractMediaFromEmbed = moduleValue3.extractMediaFromEmbed;
binding = env0_0;
binding2 = env0_2;
value3 = environment.__proto__;
value4 = Reflect.apply(extractMediaFromEmbed, moduleValue3, [a0, binding, binding2, a1, env1_0]);
if (value4 != null) {
binding = env1_1;
push = binding.push;
binding3 = env0_0;
Reflect.apply(push, binding, [{type: SearchMediaTypes.EMBED, embed: a0, messageId: binding3.id,
channelId: binding3.channel_id, author: binding3.author, mediaIndex: env0_1, sources: value4}]);
binding = env0_1;
env0_1 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
}
} else {
moduleValue2 = require(9546) /* metro dependency 9546: MediaSourceUtil */;
if (moduleValue2.isValidVideoEmbed(a0)) {
moduleValue3 = require(9546) /* metro dependency 9546: MediaSourceUtil */;
extractMediaFromEmbed = moduleValue3.extractMediaFromEmbed;
binding = env0_0;
binding2 = env0_2;
value3 = environment.__proto__;
value4 = Reflect.apply(extractMediaFromEmbed, moduleValue3, [a0, binding, binding2, a1, env1_0]);
if (value4 != null) {
binding = env1_1;
push = binding.push;
binding3 = env0_0;
Reflect.apply(push, binding, [{type: SearchMediaTypes.EMBED, embed: a0, messageId: binding3.id,
channelId: binding3.channel_id, author: binding3.author, mediaIndex: env0_1, sources: value4}]);
binding = env0_1;
env0_1 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
}
}
}
}