Files
discord-decomp/sources/modules/app_launcher/utils/AppLauncherSearchUtils.tsx
T
2026-07-28 01:06:53 +03:00

1297 lines
64 KiB
TypeScript

/* Metro module 11608; source: modules/app_launcher/utils/AppLauncherSearchUtils.tsx; dependencies: [57, 31, 7863, 7861, 7862, 11609, 5066, 6625, 7866, 1909, 8046, 8039, 11580, 11611, 22, 8048, 566, 8042, 11610, 11612, 2] */
import Module00022 from '../../../by-id/module-00022.js'; /* Metro dependency 22 */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import ApplicationFrecencyStore from '../../applications/ApplicationFrecencyStore.tsx'; /* Metro dependency 7862 */
import ApplicationCommandFrecencyStore from '../../application_commands/ApplicationCommandFrecencyStore.tsx'; /* Metro dependency 7863 */
import ApplicationDirectorySearchStore from '../../global_discovery_apps/stores/ApplicationDirectorySearchStore.tsx'; /* Metro dependency 11609 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ServerModule from '../../../flow/Server.tsx'; /* Metro dependency 1909 */
import * as ApplicationCommandConstantsModule from '../../application_commands/ApplicationCommandConstants.tsx'; /* Metro dependency 5066 */
import * as ChannelAutocompleteConstantsModule from '../../channel_autocomplete/ChannelAutocompleteConstants.tsx'; /* Metro dependency 6625 */
import * as ApplicationCommandIndexStoreModule from '../../application_commands/ApplicationCommandIndexStore.tsx'; /* Metro dependency 7861 */
import * as CommandPermissionContextModule from '../../application_commands/CommandPermissionContext.tsx'; /* Metro dependency 7866 */
import * as CommandPermissionUtilsModule from '../../application_commands/CommandPermissionUtils.tsx'; /* Metro dependency 8039 */
import * as ApplicationIntegrationTypeModule from '../../../external/discord_common/js/shared/shared-constants/ApplicationIntegrationType.tsx'; /* Metro dependency 8042 */
import * as AppLauncherUtilsModule from './AppLauncherUtils.tsx'; /* Metro dependency 8046 */
import * as AppLauncherTypesModule from '../AppLauncherTypes.tsx'; /* Metro dependency 8048 */
import * as ApplicationDirectorySearchStoreModule from '../../global_discovery_apps/stores/ApplicationDirectorySearchStore.tsx'; /* Metro dependency 11609 */
import * as SearchAppsRequestSourceModule from '../../../external/discord_common/js/shared/shared-constants/SearchAppsRequestSource.tsx'; /* Metro dependency 11610 */
import * as ArraySearchModule from '../../queries/ArraySearch.tsx'; /* Metro dependency 11611 */
import * as ApplicationDirectoryActionCreatorsModule from '../../global_discovery_apps/ApplicationDirectoryActionCreators.tsx'; /* Metro dependency 11612 */
function _fun88877(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#88877, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:6, offset: 0x01ff7b68, size: 745 bytes, params: 8, frame: 40
let env0_0 = require;
const _arrayLikeToArray_88880 = 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 useApplicationsInContext2 = useApplicationsInContext;
const useApplicationCommandsInContext2 = useApplicationCommandsInContext;
const filterApplicationAllowed2 = filterApplicationAllowed;
const closure4 = function(a0) {
var items = [bucketApplicationNameStartsWith(a0)];
items[1] = bucketApplicationNameContains(a0);
items[2] = bucketApplicationDescriptionStartsWith(a0);
items[3] = bucketApplicationDescriptionContains(a0);
return items;
};
const closure5 = function(a0) {
var env0_0 = a0;
return _fun88893;
};
const closure6 = function(a0) {
var env0_0 = a0;
return _fun88895;
};
const closure7 = function(a0) {
var env0_0 = a0;
return _fun88897;
};
const closure8 = function(a0) {
var env0_0 = a0;
return _fun88899;
};
const closure9 = function(a0, a1) {
return ApplicationFrecencyStore.getScoreWithoutLoadingLatest(a1.id) - ApplicationFrecencyStore.getScoreWithoutLoadingLatest(a0.id);
};
const closure10 = function(a0, a1) {
return appLauncherOnlyCompareNames(require(dependencyMap[10]).getSectionName(a0),
require(dependencyMap[10]).getSectionName(a1));
};
const closure11 = function(a0) {
var r2;
var env0_0 = a0;
var value2 = undefined;
var moduleValue = require(dependencyMap[8]);
var buildPermissionContext = moduleValue.buildPermissionContext;
r2 = a0.type !== 'channel' ? value2 : a0.channel;
var CHAT = require(dependencyMap[9]).ApplicationCommandType.CHAT;
var env0_1 = Reflect.apply(buildPermissionContext, moduleValue, [r2, [CHAT]]);
var env0_2 = {};
return _fun88903;
};
const closure12 = function(a0) {
var items = [bucketRootCommandNameStartsWith(a0)];
items[1] = bucketFullCommandNameStartsWith(a0);
items[2] = bucketCommandNameContains(a0);
items[3] = bucketOptionNameStartsWithOrCommandAndOptionStartsWith(a0);
items[4] = bucketCommandOptionNameContains(a0);
return items;
};
const closure13 = function(a0) {
var env0_0 = a0;
return _fun88906;
};
const closure14 = function(a0) {
var r3;
r3 = a0?.split(' ');
var env0_0 = r3[0];
var env0_1 = r3.slice(1).join(' ');
return _fun88908;
};
const closure15 = function(a0) {
var env0_0 = a0;
return _fun88910;
};
const closure16 = function(a0) {
var env0_0 = a0;
return _fun88912;
};
const closure17 = function(a0) {
var env0_0 = a0;
return _fun88914;
};
const closure18 = function(a0) {
var items = [sortCommandsByFreceny(a0)];
items[1] = sortCommandsAlpha;
return items;
};
const closure19 = function(a0) {
var env0_0 = a0;
return _fun88917;
};
const closure20 = function(a0, a1) {
return appLauncherOnlyCompareNames(a0.displayName, a1.displayName);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/app_launcher/utils/AppLauncherSearchUtils.tsx');
exports.useApplicationsInContext = useApplicationsInContext2;
exports.useApplicationCommandsInContext = useApplicationCommandsInContext2;
exports.filterApplicationAllowed = filterApplicationAllowed2;
exports.defaultApplicationBucketing = closure4;
exports.bucketApplicationNameStartsWith = closure5;
exports.bucketApplicationNameContains = closure6;
exports.bucketApplicationDescriptionStartsWith = closure7;
exports.bucketApplicationDescriptionContains = closure8;
exports.sortApplicationFreceny = closure9;
exports.sortApplicationAlpha = closure10;
exports.filterCommandAllowed = closure11;
exports.defaultCommandBucketing = closure12;
exports.bucketRootCommandNameStartsWith = closure13;
exports.bucketFullCommandNameStartsWith = closure14;
exports.bucketCommandNameContains = closure15;
exports.bucketOptionNameStartsWithOrCommandAndOptionStartsWith = closure16;
exports.bucketCommandOptionNameContains = closure17;
exports.bucketCommandSectionNameStartsWith = function(a0, a1) {
var env0_0 = a0;
var env0_1 = a1;
var env0_2 = {};
return _fun88920;
};
exports.bucketCommandSectionNameContains = function(a0, a1) {
var env0_0 = a0;
var env0_1 = a1;
var env0_2 = {};
return _fun88923;
};
exports.defaultCommandsSort = closure18;
exports.sortCommandsByFreceny = closure19;
exports.sortCommandsAlpha = closure20;
exports.useLocalSearchResults = useLocalSearchResults;
exports.useGlobalSearchResults = useGlobalSearchResults;
function _createForOfIteratorHelperLoose_88878(a0, a1) { // fn#88878, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:334, offset: 0x01ff7e51, 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 _fun88879;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_88880(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_88880(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_88880(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun88879;
}
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 _fun88879() { // fn#88879, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:905, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function useApplicationsInContext({context, onlyWithCommands, includeBuiltIn, allowFetch, includeEmbeddedApps, includeNonEmbeddedApps}) { // fn#88881, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:1244, offset: 0x01ff7fc5, size: 604 bytes, params: 2, frame: 27
var r10;
var r14;
var r9;
var r8;
var Object;
var value9;
var length;
var value10;
var property;
var descriptor;
var application;
var value11;
var value12;
var add;
var id;
var value13;
var value14;
var value15;
var value16;
var has;
var value17;
var value18;
var value19;
allowFetch = allowFetch === undefined || allowFetch;
const channel = context.type !== 'channel' ? undefined : context.channel;
const usePermissionContext = CommandPermissionContextModule.usePermissionContext;
const ApplicationCommandType = (ServerModule).ApplicationCommandType;
const CHAT = ApplicationCommandType.CHAT;
const hasBaseAccessPermissions = Reflect.apply(usePermissionContext, CommandPermissionContextModule, [channel,
[CHAT]]).hasBaseAccessPermissions;
const value4 = useContextIndexState(context, hasBaseAccessPermissions, allowFetch);
const value5 = useUserIndexState(hasBaseAccessPermissions, allowFetch);
const value6 = ReactModule.useCallback(_fun88882, [includeEmbeddedApps, includeNonEmbeddedApps, onlyWithCommands]);
items2 = [];
const Set = global.Set;
const set = new Set();
if (value4.result != null) {
Object = global.Object;
value9 = Object.values(value4.result.sections);
length = value9.length;
value10 = 0;
if (value10 < length) {
r10 = value10;
while (true) {
property = value9[r10];
descriptor = property.descriptor;
application = descriptor.application;
value11 = application != null;
if (value11) {
value12 = value6(property);
r14 = value12;
} else {
r14 = value11;
}
if (!r14) {
continue;
}
items2.push(application);
add = set.add;
id = application.id;
Reflect.apply(add, set, [id]);
value13 = typeof r10 === 'bigint' ? r10 + 1n : +r10 + 1;
length = value9.length;
if (value13 < length) {
r10 = value13;
continue;
}
break;
}
}
}
if (value5.result != null) {
Object = global.Object;
value14 = Object.values(value5.result.sections);
length = value14.length;
value15 = 0;
if (value15 < length) {
r9 = value15;
while (true) {
property = value14[r9];
descriptor = property.descriptor;
application = descriptor.application;
value16 = application != null;
if (value16) {
has = set.has;
id = application.id;
value17 = !Reflect.apply(has, set, [id]);
r8 = value17;
} else {
r8 = value16;
}
if (!r8) {
continue;
}
value18 = value6(property);
r8 = value18;
if (!r8) {
continue;
}
items2.push(application);
value19 = typeof r9 === 'bigint' ? r9 + 1n : +r9 + 1;
length = value14.length;
if (value19 < length) {
r9 = value19;
continue;
}
break;
}
}
}
if (includeNonEmbeddedApps && includeBuiltIn) {
items2.push((require(8046) /* metro dependency 8046: AppLauncherUtils */).FAKE_BUILT_IN_APP);
}
return {apps: items2,
loading: (value4 == null ? undefined : value4.fetchState.fetching) === true || (value5 == null ? undefined : value5.fetchState.fetching) === true};
function _fun88882(a0) { // fn#88882, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:1568, offset: 0x01ff8221, size: 196 bytes, params: 2, frame: 17
var r5;
var r2;
var r1;
var r0;
var includeEmbeddedAppsBinding;
var value3;
var moduleValue;
var value7;
var moduleValue2;
const application = a0.descriptor.application;
const value = application != null;
if (value) {
includeEmbeddedAppsBinding = includeEmbeddedApps;
if (includeEmbeddedAppsBinding) {
value3 = environment.__proto__;
moduleValue = require(8046) /* metro dependency 8046: AppLauncherUtils */;
r5 = !moduleValue.isEmbeddedApp(application);
} else {
r5 = !includeEmbeddedAppsBinding;
}
if (r5) {
r2 = application != null && includeNonEmbeddedApps;
if (r2) {
value7 = environment.__proto__;
moduleValue2 = require(8046) /* metro dependency 8046: AppLauncherUtils */;
r2 = !moduleValue2.isEmbeddedApp(application);
}
r2 = r2 && (onlyWithCommands ? global.Object.keys(a0.commands).length > 0 : !onlyWithCommands);
r1 = r2;
} else {
r1 = !r5;
}
r0 = r1;
} else {
r0 = value;
}
return r0;
}
}
function useApplicationCommandsInContext({context, includeBuiltIn, allowFetch}) { // fn#88883, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:2234, offset: 0x01ff82e5, size: 206 bytes, params: 2, frame: 20
includeBuiltIn = includeBuiltIn === undefined || includeBuiltIn;
allowFetch = allowFetch === undefined || allowFetch;
const value5 = useContextIndexState(context, true, allowFetch);
const value6 = useUserIndexState(true, allowFetch);
return ReactModule.useMemo(_fun88884, [context, includeBuiltIn, value5.fetchState.fetching, value5.result?.sections,
value6.fetchState.fetching, value6.result?.sections]);
function _fun88884() { // fn#88884, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:2372, offset: 0x01ff83b3, size: 301 bytes, params: 1, frame: 19
var environment;
var sections;
var r4;
var r5;
var r1;
var push;
var value8;
var BUILT_IN;
var value9;
let value = Object.create(environment);
let result = env0_2.result;
const value3 = undefined;
reducibleJoin2: while (true) {
if (result == null) {
sections = value3;
break reducibleJoin2;
}
sections = result.sections;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (sections != null) {
r4 = sections;
break reducibleJoin4;
}
r4 = {};
break reducibleJoin4;
}
result = env0_3.result;
reducibleJoin6: while (true) {
if (result == null) {
sections = value3;
break reducibleJoin6;
}
sections = result.sections;
break reducibleJoin6;
}
reducibleJoin8: while (true) {
if (sections != null) {
r5 = sections;
break reducibleJoin8;
}
r5 = {};
break reducibleJoin8;
}
let Object = global.Object;
const value4 = Object.keys(r4);
const items2 = [];
const value5 = 0;
const value6 = arraySpread(items2, value4, value5, value);
Object = global.Object;
const value7 = Object.keys(r5);
arraySpread(items2, value7.filter(_fun88885), value6, value);
reducibleJoin10: while (true) {
if (includeBuiltIn) {
push = items2.push;
value8 = environment.__proto__;
BUILT_IN = BuiltInSectionId.BUILT_IN;
Reflect.apply(push, items2, [BUILT_IN]);
break reducibleJoin10;
}
break reducibleJoin10;
}
const object = {};
var env0_2 = object;
const _loop_888862 = _loop_88886;
let length = items2.length;
if (value5 < length) {
r4 = value5;
reducibleLoop11: while (true) {
var env0_3 = items2[r4];
_loop_888862();
value9 = typeof r4 === 'bigint' ? r4 + 1n : +r4 + 1;
length = items2.length;
if (value9 < length) {
r4 = value9;
continue reducibleLoop11;
}
break reducibleLoop11;
}
}
let fetchState = env0_2.fetchState;
let fetching = fetchState.fetching;
value = fetching === true;
reducibleJoin14: while (true) {
if (value) {
r1 = value;
break reducibleJoin14;
}
fetchState = env0_3.fetchState;
fetching = fetchState.fetching;
value = fetching === true;
r1 = value;
break reducibleJoin14;
}
return {commands: [], commandSectionMap: object, loading: r1};
function _fun88885(a0) { // fn#88885, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:2544, offset: 0x01ff84e0, size: 19 bytes, params: 2, frame: 2
return !(a0 in env0_0);
}
function _loop_88886() { // fn#88886, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:2606, offset: 0x01ff84f3, size: 108 bytes, params: 1, frame: 17
const r3 = getSection(context, env0_3).sectionCommands ?? [];
const binding = env0_1;
const push = binding.push;
const items2 = [];
apply(push, items2, binding, arraySpread(items2, r3, 0, undefined));
r3.forEach(_fun88887);
function _fun88887(a0) { // fn#88887, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:2691, offset: 0x01ff855f, size: 52 bytes, params: 2, frame: 3
var value2;
if (env0_0.descriptor != null) {
value2 = environment.__proto__;
env1_2[a0.id] = env0_0.descriptor;
}
}
}
}
}
function filterApplicationAllowed(a0) { // fn#88888, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:3014, offset: 0x01ff8593, size: 144 bytes, params: 2, frame: 19
const env0_0 = a0;
const value2 = undefined;
const buildPermissionContext = CommandPermissionContextModule.buildPermissionContext;
const channel = a0.type !== 'channel' ? value2 : a0.channel;
const {CHAT, PRIMARY_ENTRY_POINT} = (ServerModule).ApplicationCommandType;
const env0_1 = Reflect.apply(buildPermissionContext, CommandPermissionContextModule, [channel, [CHAT,
PRIMARY_ENTRY_POINT]]);
return _fun88889;
function _fun88889({id}) { // fn#88889, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:3224, offset: 0x01ff8623, size: 324 bytes, params: 2, frame: 27
var moduleValue;
var allowedForUser;
var moduleValue2;
const context = isGuildInstalled.context;
const userId = isGuildInstalled.userId;
const roleIds = isGuildInstalled.roleIds;
const isImpersonating = isGuildInstalled.isImpersonating;
const getSectionBinding = getSection;
const binding = env0_0;
let value = undefined;
const sectionBinding = getSectionBinding(binding, id);
const descriptor = sectionBinding.descriptor;
const sectionCommands = sectionBinding.sectionCommands;
var isGuildInstalled = sectionBinding.isGuildInstalled;
const env0_2 = sectionBinding.isUserInstalled;
if ((context == null ? value : context.guild_id) != null) {
moduleValue = importAll(8039) /* metro dependency 8039: CommandPermissionUtils */;
allowedForUser = moduleValue.computeAllowedForUser(descriptor == null ? value : descriptor.permissions,
context.guild_id, userId, roleIds, isImpersonating);
}
if ((context == null ? value : context.guild_id) != null) {
moduleValue2 = importAll(8039) /* metro dependency 8039: CommandPermissionUtils */;
value = moduleValue2.computeAllowedForChannel(descriptor == null ? value : descriptor.permissions, context,
context.guild_id);
}
const r2 = sectionCommands != null && sectionCommands.length > 0;
return r2 ? sectionCommands.some(_fun88890) : !r2;
function _fun88890(a0) { // fn#88890, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:3652, offset: 0x01ff8767, size: 154 bytes, params: 2, frame: 20
const value2 = undefined;
const hasAccess2 = CommandPermissionUtilsModule.hasAccess(a0, env1_1, {applicationAllowedForUser: env0_3,
applicationAllowedForChannel: Module00057, commandBotId: descriptor == null ? value2 : descriptor.botId,
isGuildInstalled: isGuildInstalled, isUserInstalled: isUserInstalled});
const HasAccessResult = (CommandPermissionUtilsModule).HasAccessResult;
const ALLOWED = HasAccessResult.ALLOWED;
return hasAccess2 === ALLOWED;
}
}
}
function bucketApplicationNameStartsWith(a0) { // fn#88892, offset: 0x01ff8843, size: 18 bytes, params: 2, frame: 2
const env0_0 = a0;
return _fun88893;
function _fun88893(a0) { // fn#88893, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:4102, offset: 0x01ff8855, size: 79 bytes, params: 2, frame: 12
let value = environment.__proto__;
value = require(8046) /* metro dependency 8046: AppLauncherUtils */;
value = value.getSectionName(a0);
value = value.toLocaleLowerCase();
const startsWith = value.startsWith;
const binding = env0_0;
return Reflect.apply(startsWith, value, [binding.toLocaleLowerCase()]);
}
}
function bucketApplicationNameContains(a0) { // fn#88894, offset: 0x01ff88a4, size: 18 bytes, params: 2, frame: 2
const env0_0 = a0;
return _fun88895;
function _fun88895(a0) { // fn#88895, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:4236, offset: 0x01ff88b6, size: 78 bytes, params: 2, frame: 12
let value = environment.__proto__;
value = require(8046) /* metro dependency 8046: AppLauncherUtils */;
value = value.getSectionName(a0);
value = value.toLocaleLowerCase();
const includes = value.includes;
const binding = env0_0;
return Reflect.apply(includes, value, [binding.toLocaleLowerCase()]);
}
}
function bucketApplicationDescriptionStartsWith(a0) { // fn#88896, offset: 0x01ff8904, size: 18 bytes, params: 2, frame: 2
const env0_0 = a0;
return _fun88897;
function _fun88897(a0) { // fn#88897, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:4377, offset: 0x01ff8916, size: 109 bytes, params: 2, frame: 14
let value = environment.__proto__;
value = undefined;
const sectionDescription = (AppLauncherUtilsModule).getSectionDescription(a0);
const r4 = sectionDescription == null ? value : sectionDescription.toLocaleLowerCase();
const r1 = r4 == null ? value : r4.startsWith(env0_0.toLocaleLowerCase());
return r1 != null && r1;
}
}
function bucketApplicationDescriptionContains(a0) { // fn#88898, offset: 0x01ff8983, size: 18 bytes, params: 2, frame: 2
const env0_0 = a0;
return _fun88899;
function _fun88899(a0) { // fn#88899, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:4593, offset: 0x01ff8995, size: 108 bytes, params: 2, frame: 14
let value = environment.__proto__;
value = undefined;
const sectionDescription = (AppLauncherUtilsModule).getSectionDescription(a0);
const r4 = sectionDescription == null ? value : sectionDescription.toLocaleLowerCase();
const r1 = r4 == null ? value : r4.includes(env0_0.toLocaleLowerCase());
return r1 != null && r1;
}
}
function filterCommandAllowed(a0) { // fn#88902, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:4990, offset: 0x01ff8a82, size: 125 bytes, params: 2, frame: 18
const env0_0 = a0;
const value2 = undefined;
const buildPermissionContext = CommandPermissionContextModule.buildPermissionContext;
const channel = a0.type !== 'channel' ? value2 : a0.channel;
const ApplicationCommandType = (ServerModule).ApplicationCommandType;
const CHAT = ApplicationCommandType.CHAT;
const env0_1 = Reflect.apply(buildPermissionContext, CommandPermissionContextModule, [channel, [CHAT]]);
const env0_2 = {};
return _fun88903;
function _fun88903(a0) { // fn#88903, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:5149, offset: 0x01ff8aff, size: 475 bytes, params: 2, frame: 29
var guild_id;
var r8;
var r6;
var value2;
var getSectionBinding;
var binding;
var value3;
var sectionBinding;
var value5;
var moduleValue;
var moduleValue2;
const context = env0_1.context;
const userId = env0_1.userId;
const roleIds = env0_1.roleIds;
const isImpersonating = env0_1.isImpersonating;
let applicationId = a0.applicationId;
if (!(applicationId in env0_2)) {
value2 = environment.__proto__;
getSectionBinding = getSection;
binding = env0_0;
applicationId = a0.applicationId;
value3 = undefined;
sectionBinding = getSectionBinding(binding, applicationId);
descriptor = sectionBinding.descriptor;
isGuildInstalled = sectionBinding.isGuildInstalled;
isUserInstalled = sectionBinding.isUserInstalled;
value5 = null;
guild_id = value5 == context ? value3 : context.guild_id;
if (value5 != guild_id) {
moduleValue = importAll(8039) /* metro dependency 8039: CommandPermissionUtils */;
r8 = moduleValue.computeAllowedForUser(value5 == descriptor ? value3 : descriptor.permissions,
context.guild_id,
userId, roleIds, isImpersonating);
} else {
r8 = value5;
}
guild_id = value5 == context ? value3 : context.guild_id;
if (value5 != guild_id) {
moduleValue2 = importAll(8039) /* metro dependency 8039: CommandPermissionUtils */;
r6 = moduleValue2.computeAllowedForChannel(value5 == descriptor ? value3 : descriptor.permissions, context,
context.guild_id);
} else {
r6 = value5;
}
binding = env0_2;
applicationId = a0.applicationId;
binding[applicationId] = {descriptor: descriptor, applicationAllowedForUser: r8,
applicationAllowedForChannel: r6,
isGuildInstalled: isGuildInstalled, isUserInstalled: isUserInstalled};
}
var {descriptor, applicationAllowedForChannel, applicationAllowedForUser, isGuildInstalled,
isUserInstalled} = env0_2[a0.applicationId];
const value7 = undefined;
const commandPermissionUtilsModule = importAll(8039) /* metro dependency 8039: CommandPermissionUtils */;
const value = commandPermissionUtilsModule.hasAccess(a0, env0_1,
{applicationAllowedForUser: applicationAllowedForUser,
applicationAllowedForChannel: applicationAllowedForChannel,
commandBotId: descriptor == null ? value7 : descriptor.botId, isGuildInstalled: isGuildInstalled,
isUserInstalled: isUserInstalled});
const HasAccessResult = (CommandPermissionUtilsModule).HasAccessResult;
const ALLOWED = HasAccessResult.ALLOWED;
return value === ALLOWED;
}
}
function bucketRootCommandNameStartsWith(a0) { // fn#88905, offset: 0x01ff8d29, size: 18 bytes, params: 2, frame: 2
const env0_0 = a0;
return _fun88906;
function _fun88906({untranslatedName, displayName}) { // fn#88906, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:6326, offset: 0x01ff8d3b, size: 52 bytes, params: 2, frame: 13
return untranslatedName.startsWith(env0_0) || displayName.startsWith(env0_0);
}
}
function bucketFullCommandNameStartsWith(a0) { // fn#88907, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:6412, offset: 0x01ff8d6f, size: 84 bytes, params: 2, frame: 13
const r3 = a0?.split(' ');
const env0_0 = r3[0];
const env0_1 = r3.slice(1).join(' ');
return _fun88908;
function _fun88908({untranslatedName, displayName}) { // fn#88908, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:6527, offset: 0x01ff8dc3, size: 179 bytes, params: 2, frame: 14
var value4;
var value7;
let startsWith = untranslatedName.startsWith;
if (Reflect.apply(startsWith, untranslatedName, [env0_0])) {
value4 = untranslatedName.split(' ').slice(1).join(' ');
startsWith = value4.startsWith;
if (Reflect.apply(startsWith, value4, [env0_1])) {
return true;
}
startsWith = displayName.startsWith;
if (Reflect.apply(startsWith, displayName, [env0_0])) {
value7 = displayName.split(' ').slice(1).join(' ');
if (value7.startsWith(env0_1)) {
return true;
}
return false;
}
} else if (displayName.startsWith(env0_0)) {
value7 = displayName.split(' ').slice(1).join(' ');
if (value7.startsWith(env0_1)) {
return true;
}
return false;
}
return false;
}
}
function bucketCommandNameContains(a0) { // fn#88909, offset: 0x01ff8e76, size: 18 bytes, params: 2, frame: 2
const env0_0 = a0;
return _fun88910;
function _fun88910({untranslatedName, displayName}) { // fn#88910, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:6777, offset: 0x01ff8e88, size: 50 bytes, params: 2, frame: 13
return untranslatedName.includes(env0_0) || displayName.includes(env0_0);
}
}
function bucketOptionNameStartsWithOrCommandAndOptionStartsWith(a0) { // fn#88911, offset: 0x01ff8eba, size: 18 bytes, params: 2, frame: 2
const env0_0 = a0;
return _fun88912;
function _fun88912(a0) { // fn#88912, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:6933, offset: 0x01ff8ecc, size: 343 bytes, params: 2, frame: 24
var r0;
var r1;
var value4;
var name;
var serverLocalizedName;
var startsWith;
var untranslatedName;
var HermesInternal;
var concat;
var value5;
var displayName;
var value6;
var value7;
var value8;
var value9;
let value = environment.__proto__;
const _createForOfIteratorHelperLoose_88878Binding = _createForOfIteratorHelperLoose_88878;
const options = a0.options;
reducibleJoin2: while (true) {
if (options != null) {
r0 = options;
break reducibleJoin2;
}
r0 = [];
break reducibleJoin2;
}
value = _createForOfIteratorHelperLoose_88878Binding(r0);
const value2 = value();
let done = value2.done;
if (!done) {
r1 = value2;
reducibleLoop3: while (true) {
value4 = r1.value;
name = value4.name;
serverLocalizedName = value4.serverLocalizedName;
startsWith = name.startsWith;
if (Reflect.apply(startsWith, name, [env0_0])) {
return true;
}
untranslatedName = a0.untranslatedName;
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value5 = '' + untranslatedName + ' ' + name;
startsWith = value5.startsWith;
if (Reflect.apply(startsWith, value5, [env0_0])) {
return true;
}
displayName = a0.displayName;
if (displayName != null) {
displayName = a0.displayName;
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value6 = '' + displayName + ' ' + name;
startsWith = value6.startsWith;
reducibleJoin7: while (true) {
if (Reflect.apply(startsWith, value6, [env0_0])) {
return true;
}
break reducibleJoin7;
}
}
if (serverLocalizedName != null) {
startsWith = serverLocalizedName.startsWith;
reducibleJoin12: while (true) {
reducibleJoin13: while (true) {
if (Reflect.apply(startsWith, serverLocalizedName, [env0_0])) {
break reducibleJoin13;
}
untranslatedName = a0.untranslatedName;
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value7 = '' + untranslatedName + ' ' + serverLocalizedName;
startsWith = value7.startsWith;
if (Reflect.apply(startsWith, value7, [env0_0])) {
break reducibleJoin13;
}
displayName = a0.displayName;
if (displayName == null) {
break reducibleJoin12;
}
displayName = a0.displayName;
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value8 = '' + displayName + ' ' + serverLocalizedName;
startsWith = value8.startsWith;
if (Reflect.apply(startsWith, value8, [env0_0])) {
break reducibleJoin13;
}
break reducibleJoin12;
}
return true;
}
}
value9 = value();
done = value9.done;
if (done) {
return false;
}
r1 = value9;
continue reducibleLoop3;
}
}
return false;
}
}
function bucketCommandOptionNameContains(a0) { // fn#88913, offset: 0x01ff9023, size: 18 bytes, params: 2, frame: 2
const env0_0 = a0;
return _fun88914;
function _fun88914({options}) { // fn#88914, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:7408, offset: 0x01ff9035, size: 126 bytes, params: 2, frame: 17
var r0;
var r1;
var value4;
var name;
var serverLocalizedName;
var includes;
var value5;
let value = environment.__proto__;
const _createForOfIteratorHelperLoose_88878Binding = _createForOfIteratorHelperLoose_88878;
reducibleJoin2: while (true) {
if (options != null) {
r0 = options;
break reducibleJoin2;
}
r0 = [];
break reducibleJoin2;
}
value = _createForOfIteratorHelperLoose_88878Binding(r0);
const value2 = value();
let done = value2.done;
if (!done) {
r1 = value2;
reducibleLoop3: while (true) {
value4 = r1.value;
name = value4.name;
serverLocalizedName = value4.serverLocalizedName;
includes = name.includes;
if (Reflect.apply(includes, name, [env0_0])) {
return true;
}
if (serverLocalizedName != null) {
includes = serverLocalizedName.includes;
reducibleJoin6: while (true) {
if (Reflect.apply(includes, serverLocalizedName, [env0_0])) {
return true;
}
break reducibleJoin6;
}
}
value5 = value();
done = value5.done;
if (done) {
return false;
}
r1 = value5;
continue reducibleLoop3;
}
}
return false;
}
}
function sortCommandsByFreceny(a0) { // fn#88916, offset: 0x01ff90d6, size: 18 bytes, params: 2, frame: 2
const env0_0 = a0;
return _fun88917;
function _fun88917(a0, a1) { // fn#88917, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:7730, offset: 0x01ff90e8, size: 54 bytes, params: 3, frame: 14
let applicationCommandFrecencyStoreBinding = ApplicationCommandFrecencyStore;
let getScoreWithoutLoadingLatest = applicationCommandFrecencyStoreBinding.getScoreWithoutLoadingLatest;
const binding = env0_0;
const value3 = Reflect.apply(getScoreWithoutLoadingLatest, applicationCommandFrecencyStoreBinding, [binding, a0]);
applicationCommandFrecencyStoreBinding = ApplicationCommandFrecencyStore;
getScoreWithoutLoadingLatest = applicationCommandFrecencyStoreBinding.getScoreWithoutLoadingLatest;
return Reflect.apply(getScoreWithoutLoadingLatest, applicationCommandFrecencyStoreBinding, [binding, a1]) - value3;
}
}
function bucketCommandSectionNameStartsWith(a0, a1) { // fn#88919, offset: 0x01ff913f, size: 31 bytes, params: 3, frame: 2
const env0_0 = a0;
const env0_1 = a1;
const env0_2 = {};
return _fun88920;
function _fun88920(a0) { // fn#88920, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:9167, offset: 0x01ff915e, size: 183 bytes, params: 2, frame: 17
const env0_0 = a0;
if (a0.applicationId in env0_2) {
return env0_2[a0.applicationId];
}
const sectionName = (require(8046) /* metro dependency 8046: AppLauncherUtils */).getSectionName(env0_0.find(_fun88921) ?? (require(8046) /* metro dependency 8046: AppLauncherUtils */).FAKE_BUILT_IN_APP);
const value5 = sectionName.toLocaleLowerCase();
const value6 = value5.startsWith(require.toLocaleLowerCase());
env0_2[a0.applicationId] = value6;
return value6;
function _fun88921({id}) { // fn#88921, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:9235, offset: 0x01ff09e1, size: 26 bytes, params: 2, frame: 2
return id === env0_0.applicationId;
}
}
}
function bucketCommandSectionNameContains(a0, a1) { // fn#88922, offset: 0x01ff9215, size: 31 bytes, params: 3, frame: 2
const env0_0 = a0;
const env0_1 = a1;
const env0_2 = {};
return _fun88923;
function _fun88923(a0) { // fn#88923, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:9514, offset: 0x01ff9234, size: 182 bytes, params: 2, frame: 17
const env0_0 = a0;
if (a0.applicationId in env0_2) {
return env0_2[a0.applicationId];
}
const sectionName = (require(8046) /* metro dependency 8046: AppLauncherUtils */).getSectionName(env0_0.find(_fun88924) ?? (require(8046) /* metro dependency 8046: AppLauncherUtils */).FAKE_BUILT_IN_APP);
const value5 = sectionName.toLocaleLowerCase();
const value6 = value5.includes(require.toLocaleLowerCase());
env0_2[a0.applicationId] = value6;
return value6;
function _fun88924({id}) { // fn#88924, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:9582, offset: 0x01ff09e1, size: 26 bytes, params: 2, frame: 2
return id === env0_0.applicationId;
}
}
}
function useLocalSearchResults({context, query, commandLimit, applicationLimit, searchesCommands, searchesBots, searchesActivities}) { // fn#88925, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:9914, offset: 0x01ff92ea, size: 555 bytes, params: 2, frame: 28
searchesCommands = searchesCommands === undefined || searchesCommands;
searchesBots = searchesBots === undefined || searchesBots;
const searchesBots2 = searchesBots;
searchesActivities = searchesActivities === undefined || searchesActivities;
const r9 = query.startsWith('' + COMMAND_SENTINEL) ? query.substring(1) : query;
const {commands, commandSectionMap, loading} = useApplicationCommandsInContext({context: context,
includeBuiltIn: true});
const apps = useApplicationsInContext({'context': null, 'onlyWithCommands': true, 'includeBuiltIn': true,
context: context, includeEmbeddedApps: searchesActivities, includeNonEmbeddedApps: searchesBots}).apps;
const value5 = (importDefault(11580) /* metro dependency 11580: useActivityShelfItems */)({guildId: context.type !== 'channel' ? null : context.channel.guild_id});
const value7 = searchesBots2.useMemo(_fun88927, [apps, searchesBots2.useMemo(_fun88926, [searchesCommands, commands,
commandLimit, context, r9]), commandSectionMap]);
const value = searchesBots2.useMemo(_fun88930, [searchesBots, searchesActivities, applicationLimit, context, r9,
apps, value5]);
const value8 = value7.length > 0;
const value9 = value.length > 0;
return {commandResults: value7, hasCommandResults: value8, applicationResults: value, hasApplicationResults: value9,
isEmptyState: !value8 && !value9, loading: loading && searchesCommands};
function _fun88926() { // fn#88926, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:10429, offset: 0x01ff9515, size: 160 bytes, params: 1, frame: 21
var r0;
var object;
var value2;
var value3;
var moduleValue;
var queryData;
var commandsBinding;
var filterCommandAllowedBinding;
var contextBinding;
if (searchesCommands) {
value2 = environment.__proto__;
value3 = undefined;
moduleValue = require(11611) /* metro dependency 11611: ArraySearch */;
queryData = moduleValue.queryData;
commandsBinding = commands;
object = {};
object.limit = commandLimit;
filterCommandAllowedBinding = filterCommandAllowed;
contextBinding = context;
object.filterPredicates = [filterCommandAllowedBinding(contextBinding)];
object.bucketPredicates = defaultCommandBucketing(query);
object.sortComparers = defaultCommandsSort({channel: contextBinding.type !== 'channel' ? value3 : context.channel});
r0 = Reflect.apply(queryData, moduleValue, [commandsBinding, object]);
} else {
r0 = [];
}
return r0;
}
function _fun88927() { // fn#88927, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:10666, offset: 0x01ff95b5, size: 138 bytes, params: 1, frame: 14
if (env0_11.length === 0) {
return [];
}
const Map = global.Map;
const appsBinding = apps;
let map = appsBinding.map;
map = new Map(Reflect.apply(map, appsBinding, [function(a0) {
return [a0.id, a0];
}]));
const defaultImport = Module00022;
const compact = defaultImport.compact;
const binding = env0_11;
return Reflect.apply(compact, defaultImport, [binding.map(_fun88929)]);
function _fun88929(a0) { // fn#88929, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:10763, offset: 0x01ff963f, size: 85 bytes, params: 2, frame: 14
var r0;
var object;
var property;
let value = env0_0.get(a0.applicationId);
const value2 = null;
if (value2 == value) {
r0 = value2;
} else {
object = {command: a0, application: value};
value = environment.__proto__;
property = commandSectionMap[a0.id];
object.section = value2 != property ? property : value2;
r0 = object;
}
return r0;
}
}
function _fun88930() { // fn#88930, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:10905, offset: 0x01ff9694, size: 316 bytes, params: 1, frame: 19
var r3;
var appsBinding;
var Set;
var value2;
var set;
var push;
var items3;
var binding;
var value6;
var items2;
let object = [];
if (searchesActivities) {
Set = global.Set;
value2 = apps.map(function(a0) {
return a0.id;
});
set = new Set();
push = object.push;
appsBinding = apps;
items3 = [];
arraySpread(items3, appsBinding, 0, undefined);
apply(push, items3, object, undefined);
push = object.push;
binding = ApplicationCommandIndexStoreModule.useUserIndexState;
value6 = binding.filter(_fun88932).map(_fun88933);
items2 = [];
arraySpread(items2, value6, 0, binding);
apply(push, items2, object, binding);
r3 = object;
} else {
r3 = searchesBots ? apps : object;
}
const queryData = ArraySearchModule.queryData;
object = {};
object.limit = applicationLimit;
object.filterPredicates = [filterApplicationAllowed(context)];
object.bucketPredicates = defaultApplicationBucketing(query);
object.sortComparers = [sortApplicationFreceny, sortApplicationAlpha];
return Reflect.apply(queryData, ArraySearchModule, [r3, object]);
function _fun88932({application}) { // fn#88932, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:10994, offset: 0x01ff97d0, size: 35 bytes, params: 2, frame: 11
const id = application.id;
const binding = env0_0;
return !binding.has(id);
}
}
}
function useGlobalSearchResults({context, query, fetches, pageLimit, entrypoint}) { // fn#88934, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:11463, offset: 0x01ff97f3, size: 641 bytes, params: 2, frame: 25
let value = undefined;
fetches = fetches === value || fetches;
pageLimit = pageLimit === value ? Infinity : pageLimit;
let env0_5 = value;
const r7 = query.startsWith('' + COMMAND_SENTINEL) ? query.substring(1) : query;
const AppLauncherEntrypoint = (AppLauncherTypesModule).AppLauncherEntrypoint;
const VOICE = AppLauncherEntrypoint.VOICE;
const value6 = entrypoint === VOICE;
const guild_id = context.type !== 'channel' ? value : context.channel.guild_id;
const value8 = guild_id(env0_5.useState(1), 2);
const property = value8[0];
env0_5 = property;
const env0_6 = value8[1];
env0_5.useRef(property).current = property;
const useStateFromStoresObject = (FluxModule).useStateFromStoresObject;
value = Reflect.apply(useStateFromStoresObject, value, [[ApplicationDirectorySearchStore], _fun88935, [r7, guild_id,
property, value6]]);
const fetchState = value.fetchState;
const totalPages = value.totalPages;
value = env0_5.useMemo(_fun88936, [fetchState, guild_id, r7, property, value6]);
const value10 = env0_5.useCallback(_fun88938, [fetchState, pageLimit, value, totalPages]);
env0_5.useEffect(_fun88941, [r7, guild_id, env0_5.useCallback(_fun88940, [value6]), property, fetches]);
env0_5.useEffect(_fun88942, [guild_id, r7]);
object = {fetchState: fetchState};
object.applicationResults = value.flat();
object.fetchNextPage = value10;
return object;
function _fun88935() { // fn#88935, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:11805, offset: 0x01ff9a74, size: 300 bytes, params: 1, frame: 21
const object = {};
let value = environment.__proto__;
const applicationDirectorySearchStoreBinding = ApplicationDirectorySearchStore;
const getFetchState = applicationDirectorySearchStoreBinding.getFetchState;
const object2 = {};
object2.query = query;
object2.guildId = guild_id;
object2.page = env0_5;
value = undefined;
const ApplicationIntegrationType = (ApplicationIntegrationTypeModule).ApplicationIntegrationType;
let USER_INSTALL = ApplicationIntegrationType.USER_INSTALL;
object2.integrationType = USER_INSTALL;
object2.minUserInstallCommandCount = 1;
object2.excludeAppsWithCustomInstallUrl = true;
object2.excludeNonEmbeddedApps = env0_3;
object2.excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand = true;
const SearchAppsRequestSource = (SearchAppsRequestSourceModule).SearchAppsRequestSource;
let APP_LAUNCHER = SearchAppsRequestSource.APP_LAUNCHER;
object2.source = APP_LAUNCHER;
object.fetchState = Reflect.apply(getFetchState, applicationDirectorySearchStoreBinding, [object2]);
const getSearchResults = applicationDirectorySearchStoreBinding.getSearchResults;
USER_INSTALL = ApplicationIntegrationType.USER_INSTALL;
APP_LAUNCHER = SearchAppsRequestSource.APP_LAUNCHER;
const value3 = Reflect.apply(getSearchResults, applicationDirectorySearchStoreBinding, [{query: query,
guildId: guild_id, page: env0_5, integrationType: USER_INSTALL, minUserInstallCommandCount: 1,
excludeAppsWithCustomInstallUrl: true, excludeNonEmbeddedApps: env0_3,
excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand: true, source: APP_LAUNCHER}]);
object.totalPages = (value3 == null ? value : value3.totalPages) ?? 0;
return object;
}
function _fun88936() { // fn#88936, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:12571, offset: 0x01ff9ba0, size: 95 bytes, params: 1, frame: 16
const Array = global.Array;
const from = Array.from;
const fetchStateBinding = fetchState;
const FETCHED = FetchState.FETCHED;
return Reflect.apply(from, Array,
[{length: fetchStateBinding === FETCHED || fetchState === FetchState.ERROR ? env0_5 : env0_5 - 1}, _fun88937]);
function _fun88937(a0, a1) { // fn#88937, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:12629, offset: 0x01ff9bff, size: 173 bytes, params: 3, frame: 17
let value = environment.__proto__.__proto__;
const applicationDirectorySearchStoreBinding = ApplicationDirectorySearchStore;
const getSearchResults = applicationDirectorySearchStoreBinding.getSearchResults;
const object = {};
object.query = query;
object.guildId = guild_id;
object.page = a1 + 1;
value = undefined;
const ApplicationIntegrationType = (ApplicationIntegrationTypeModule).ApplicationIntegrationType;
const USER_INSTALL = ApplicationIntegrationType.USER_INSTALL;
object.integrationType = USER_INSTALL;
object.minUserInstallCommandCount = 1;
object.excludeAppsWithCustomInstallUrl = true;
object.excludeNonEmbeddedApps = env1_3;
object.excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand = true;
const SearchAppsRequestSource = (SearchAppsRequestSourceModule).SearchAppsRequestSource;
const APP_LAUNCHER = SearchAppsRequestSource.APP_LAUNCHER;
object.source = APP_LAUNCHER;
const value3 = Reflect.apply(getSearchResults, applicationDirectorySearchStoreBinding, [object]);
return (value3 == null ? value : value3.results) ?? [];
}
}
function _fun88938() { // fn#88938, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:13043, offset: 0x01ff9cac, size: 154 bytes, params: 1, frame: 13
var current;
var binding;
const length = ApplicationCommandIndexStoreModule.useUserIndexState.length;
const fetchStateBinding = fetchState;
const FETCHED = FetchState.FETCHED;
let r1 = fetchStateBinding === FETCHED && length === ApplicationCommandIndexStoreModule.appLauncherOnlyCompareNames.current && length > 0;
r1 = r1 && length < totalPages && length < pageLimit && ApplicationCommandIndexStoreModule.useUserIndexState[length - 1].length > 0;
if (r1) {
binding = ApplicationCommandIndexStoreModule.appLauncherOnlyCompareNames;
current = binding.current;
binding.current = typeof current === 'bigint' ? current + 1n : +current + 1;
binding = env0_6;
binding(function(a0) {
return a0 + 1;
});
}
}
function _fun88940({query, page, guildId}) { // fn#88940, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:13181, offset: 0x01ff9d46, size: 168 bytes, params: 2, frame: 17
const search = ApplicationDirectoryActionCreatorsModule.search;
const object = {query: query, guildId: guildId};
const object2 = {'page': null, 'integrationType': null, 'minUserInstallCommandCount': 1,
'excludeAppsWithCustomInstallUrl': true, 'excludeNonEmbeddedApps': null,
'excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand': true};
object2.page = page;
const ApplicationIntegrationType = (ApplicationIntegrationTypeModule).ApplicationIntegrationType;
const USER_INSTALL = ApplicationIntegrationType.USER_INSTALL;
object2.integrationType = USER_INSTALL;
object2.excludeNonEmbeddedApps = env0_3;
const SearchAppsRequestSource = (SearchAppsRequestSourceModule).SearchAppsRequestSource;
const APP_LAUNCHER = SearchAppsRequestSource.APP_LAUNCHER;
object2.source = APP_LAUNCHER;
object.options = object2;
Reflect.apply(search, ApplicationDirectoryActionCreatorsModule, [object]);
}
function _fun88941() { // fn#88941, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:13560, offset: 0x01ff9dee, size: 53 bytes, params: 1, frame: 12
if (fetches) {
env0_11({query: query, page: env0_5, guildId: guild_id});
}
}
function _fun88942() { // fn#88942, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:13626, offset: 0x00df7534, size: 19 bytes, params: 1, frame: 11
env0_6(1);
}
}
}
function _fun88933(a0) { // fn#88933, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11794:11035, offset: 0x01fedd61, size: 10 bytes, params: 2, frame: 1
return a0.application;
}
global.__d(_fun88877, 11608, [57, 31, 7863, 7861, 7862, 11609, 5066, 6625, 7866, 1909, 8046, 8039, 11580, 11611, 22,
8048, 566, 8042, 11610, 11612,
2]) /* metro module 11608, dependencies: [57, 31, 7863, 7861, 7862, 11609, 5066, 6625, 7866, 1909, 8046, 8039, 11580, 11611, 22, 8048, 566, 8042, 11610, 11612, 2] */;