369 lines
21 KiB
TypeScript
369 lines
21 KiB
TypeScript
/* Metro module 11085; source: modules/autocompleter/native/AutocompleteOptions.tsx; dependencies: [7167, 7168, 6583, 1379, 1945, 1867, 661, 5066, 6625, 11086, 1881, 22, 8050, 6526, 11050, 6943, 1423, 1244, 2] */
|
|
import ChannelStore from '../../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
|
|
import GuildStore from '../../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
|
|
import GuildMemberStore from '../../../stores/GuildMemberStore.tsx'; /* Metro dependency 1945 */
|
|
import AutocompleteUtils from '../../../utils/AutocompleteUtils.tsx'; /* Metro dependency 6526 */
|
|
import StickersStore from '../../stickers/StickersStore.tsx'; /* Metro dependency 6583 */
|
|
import ApplicationCommandAutocompleteStore from '../../application_commands/ApplicationCommandAutocompleteStore.tsx'; /* Metro dependency 7167 */
|
|
import ApplicationCommandStore from '../../application_commands/ApplicationCommandStore.tsx'; /* Metro dependency 7168 */
|
|
import ExecuteCommand from '../../application_commands/executeCommand.tsx'; /* Metro dependency 8050 */
|
|
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as ApplicationCommandConstantsModule from '../../application_commands/ApplicationCommandConstants.tsx'; /* Metro dependency 5066 */
|
|
import * as ChannelAutocompleteConstantsModule from '../../channel_text_area/native/ChannelAutocompleteConstants.tsx'; /* Metro dependency 11086 */
|
|
|
|
function _fun84865(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#84865, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11271:6, offset: 0x01f5a285, size: 425 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ConstantsModule;
|
|
const env0_9 = value.AutoCompleteResultTypes;
|
|
const env0_10 = value.MAX_AUTOCOMPLETE_RESULTS;
|
|
const AUTOCOMPLETE_OPTION_DEBOUNCE_TIME = (ApplicationCommandConstantsModule).AUTOCOMPLETE_OPTION_DEBOUNCE_TIME;
|
|
value = require(6625) /* metro dependency 6625: ChannelAutocompleteConstants */;
|
|
const env0_11 = value.MENTION_SENTINEL;
|
|
const env0_12 = value.EMOJI_SENTINEL;
|
|
const env0_13 = value.CHANNEL_SENTINEL;
|
|
const env0_14 = value.COMMAND_SENTINEL;
|
|
value = require(1881) /* metro dependency 1881: EmojiConstants */;
|
|
const env0_16 = value.EmojiIntention;
|
|
const env0_17 = value.EMOJI_MAX_LENGTH;
|
|
const env0_18 = value.EMOJI_URL_BASE_SIZE;
|
|
value = importDefault(22) /* metro dependency 22 */;
|
|
const env0_20 = value.debounce(ExecuteCommand,
|
|
AUTOCOMPLETE_OPTION_DEBOUNCE_TIME, {'leading': true, 'trailing': true});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/autocompleter/native/AutocompleteOptions.tsx');
|
|
exports.getAutocompleteOptions = getAutocompleteOptions;
|
|
function getAutocompleteOptions(a0) { // fn#84866, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11271:636, offset: 0x01f5a42e, size: 312 bytes, params: 2, frame: 8
|
|
const value = a1;
|
|
const value2 = a2;
|
|
const env0_0 = a0;
|
|
const env0_1 = value !== undefined ? value : false;
|
|
const env0_2 = !(value2 !== undefined) || value2;
|
|
const MENTIONS = AutocompleteTypes.MENTIONS;
|
|
const CHANNELS = AutocompleteTypes.CHANNELS;
|
|
const EMOJIS_AND_STICKERS = AutocompleteTypes.EMOJIS_AND_STICKERS;
|
|
const SLASHES = AutocompleteTypes.SLASHES;
|
|
const SLASHES_DISCOVERY = AutocompleteTypes.SLASHES_DISCOVERY;
|
|
const CHOICES = AutocompleteTypes.CHOICES;
|
|
return {[MENTIONS]: {stores: [GuildMemberStore], queryResults: queryResults, matches: function(a0, a1) {
|
|
return importDefault(dependencyMap[13]).matchSentinel(a0, a1, MENTION_SENTINEL);
|
|
}}, [CHANNELS]: {queryResults: queryResults_84872, matches: matches_84874},
|
|
[EMOJIS_AND_STICKERS]: {queryResults: queryResults_84875, matches: matches_84879},
|
|
[SLASHES]: {queryResults: function() {
|
|
return [];
|
|
}, matches: matches_84881}, [SLASHES_DISCOVERY]: {queryResults: function() {
|
|
return [];
|
|
}, matches: matches_84883}, [CHOICES]: {stores: [ApplicationCommandStore, ApplicationCommandAutocompleteStore],
|
|
queryResults: queryResults_84884, matches: function() {
|
|
return false;
|
|
}}};
|
|
function getAutocompleteOptionsQueryResults(a0, a1, a2) { // fn#84867, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11271:678, owner: getAutocompleteOptions.queryResults, offset: 0x01f5a566, size: 324 bytes, params: 4, frame: 20
|
|
var environment;
|
|
let value = environment.__proto__;
|
|
const value2 = undefined;
|
|
const defaultImport = AutocompleteUtils;
|
|
const value4 = a1 == null;
|
|
const {users, globals, roles} = defaultImport.queryMentionResults({query: a0, channel: env0_0,
|
|
canMentionEveryone: a1 == null ? value2 : a1.canMentionEveryone,
|
|
canMentionHere: a1 == null ? value2 : a1.canMentionHere,
|
|
canMentionUsers: a1 == null ? value2 : a1.canMentionUsers,
|
|
canMentionRoles: a1 == null ? value2 : a1.canMentionRoles,
|
|
includeAllGuildUsers: value4 ? value2 : a1.canMentionAnyGuildUser,
|
|
includeNonMentionableRoles: a1 == null ? value2 : a1.canMentionNonMentionableRoles, request: a2});
|
|
value = importDefault(22) /* metro dependency 22 */;
|
|
const value6 = users.map(function(a0) {
|
|
var object = {};
|
|
var USER = AutoCompleteResultTypes.USER;
|
|
object.type = USER;
|
|
copyDataProperties(object, a0, USER);
|
|
return object;
|
|
});
|
|
items2 = [];
|
|
arraySpread(items2, roles.map(function(a0) {
|
|
var object = {};
|
|
var ROLE = AutoCompleteResultTypes.ROLE;
|
|
object.type = ROLE;
|
|
copyDataProperties(object, a0, ROLE);
|
|
return object;
|
|
}), arraySpread(items2, globals.map(function(a0) {
|
|
var object = {};
|
|
var GLOBAL = AutoCompleteResultTypes.GLOBAL;
|
|
object.type = GLOBAL;
|
|
copyDataProperties(object, a0, GLOBAL);
|
|
return object;
|
|
}), arraySpread(items2, value6, 0, value4), value4), value4);
|
|
value = value(items2);
|
|
return value.value();
|
|
}
|
|
|
|
function getAutocompleteOptionsQueryResults_84872(a0, a1) { // fn#84872, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11271:1329, owner: getAutocompleteOptions.queryResults, offset: 0x01f5a739, size: 176 bytes, params: 3, frame: 15
|
|
var environment;
|
|
var r0;
|
|
var value2;
|
|
var value4;
|
|
let value = undefined;
|
|
if (a1 == null) {
|
|
value2 = environment.__proto__;
|
|
value = importDefault(6526) /* metro dependency 6526: AutocompleteUtils */;
|
|
value = value.queryChannelResults({query: a0, channel: env0_0});
|
|
r0 = value;
|
|
} else if (a1.isActiveApplicationCommand) {
|
|
value4 = environment.__proto__;
|
|
value = importDefault(6526) /* metro dependency 6526: AutocompleteUtils */;
|
|
value = value.queryApplicationCommandChannelResults({query: a0, channel: env0_0,
|
|
channelTypes: a1 == null ? value : a1.channelTypes});
|
|
r0 = value;
|
|
} else {
|
|
value2 = environment.__proto__;
|
|
value = importDefault(6526) /* metro dependency 6526: AutocompleteUtils */;
|
|
value = value.queryChannelResults({query: a0, channel: env0_0});
|
|
r0 = value;
|
|
}
|
|
return r0.channels.map(function(a0) {
|
|
var object = {};
|
|
object.type = AutoCompleteResultTypes.CHANNEL;
|
|
object.channel = a0;
|
|
object.category = ChannelStore.getChannel(a0.parent_id);
|
|
return object;
|
|
});
|
|
}
|
|
|
|
function getAutocompleteOptionsMatches_84874(a0, a1) { // fn#84874, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11271:1654, owner: getAutocompleteOptions.matches, offset: 0x01f5a81d, size: 73 bytes, params: 3, frame: 16
|
|
var r0;
|
|
var value;
|
|
if (value) {
|
|
r0 = !env0_0.isPrivate();
|
|
} else {
|
|
value = environment.__proto__;
|
|
value = (importDefault(6526) /* metro dependency 6526: AutocompleteUtils */).matchSentinel(a0, a1,
|
|
CHANNEL_SENTINEL);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function getAutocompleteOptionsQueryResults_84875(a0, a1) { // fn#84875, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11271:1733, owner: getAutocompleteOptions.queryResults, offset: 0x01f5a866, size: 422 bytes, params: 3, frame: 22
|
|
var r5;
|
|
var binding;
|
|
var defaultImport2;
|
|
var queryStickers;
|
|
let r11 = env0_2 ? 0 : 40;
|
|
const defaultImport = importDefault(dependencyMap[13]);
|
|
const queryEmojiResults = defaultImport.queryEmojiResults;
|
|
const CHAT = EmojiIntention.CHAT;
|
|
const value5 = Reflect.apply(queryEmojiResults, defaultImport, [{query: a0, channel: env0_0, intention: CHAT,
|
|
maxCount: MAX_AUTOCOMPLETE_RESULTS + r11}]);
|
|
const r2 = a1 == null ? [] : a1.includeEmojiPremiumUpsell && value5.emojis.locked.length > 0 && value5.emojis.unlocked.length < 4 ? [{type: AutoCompleteResultTypes.EMOJI_PREMIUM_UPSELL,
|
|
results: value5.emojis.locked}] : [];
|
|
if (env0_2) {
|
|
binding = env1_19;
|
|
if (!(binding || StickersStore.hasLoadedStickerPacks)) {
|
|
require(dependencyMap[14]).fetchStickerPacks();
|
|
r11 = dependencyMap;
|
|
}
|
|
defaultImport2 = importDefault(dependencyMap[13]);
|
|
queryStickers = defaultImport2.queryStickers;
|
|
binding = env0_0;
|
|
r5 = Reflect.apply(queryStickers, defaultImport2, [[a0], true, [binding, function(a0, a1) {
|
|
var SENDABLE = require(dependencyMap[15]).StickerSendability.SENDABLE;
|
|
return a1 === SENDABLE;
|
|
}]]);
|
|
} else {
|
|
r5 = [];
|
|
}
|
|
let value = r5.map(function({sticker}) {
|
|
return {type: AutoCompleteResultTypes.STICKER, name: sticker.name, sticker: sticker};
|
|
});
|
|
items2 = [];
|
|
value = arraySpread(items2, value, 0, r11);
|
|
const unlocked = value5.emojis.unlocked;
|
|
arraySpread(items2, r2, arraySpread(items2, unlocked.map(_fun84878), value, r11), r11);
|
|
return items2;
|
|
function _fun84878(a0) { // fn#84878, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11271:2257, offset: 0x01f5aa66, size: 141 bytes, params: 2, frame: 17
|
|
const object = {};
|
|
const value = environment.__proto__.__proto__;
|
|
const EMOJI = AutoCompleteResultTypes.EMOJI;
|
|
object.type = EMOJI;
|
|
object.name = a0.name;
|
|
object.url = a0.id != null ? (importDefault(1423) /* metro dependency 1423: AvatarUtils */).getEmojiURL({id: a0.id,
|
|
animated: a0.animated, size: EMOJI_URL_BASE_SIZE}) : a0.url;
|
|
object.surrogates = a0.id == null ? a0.surrogates : undefined;
|
|
return object;
|
|
}
|
|
|
|
}
|
|
|
|
function getAutocompleteOptionsMatches_84879(a0, a1) { // fn#84879, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11271:2428, owner: getAutocompleteOptions.matches, offset: 0x01f5aaf3, size: 76 bytes, params: 3, frame: 14
|
|
const value = environment.__proto__;
|
|
return a0 === EMOJI_SENTINEL && (!(a1.length < 2 || a1.length > EMOJI_MAX_LENGTH) && !a1.includes(EMOJI_SENTINEL));
|
|
}
|
|
|
|
function getAutocompleteOptionsMatches_84881(a0, a1, a2) { // fn#84881, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11271:2528, owner: getAutocompleteOptions.matches, offset: 0x01f5ab3f, size: 56 bytes, params: 4, frame: 4
|
|
var r0;
|
|
let value = a2 === 0;
|
|
if (value) {
|
|
value = environment.__proto__;
|
|
value = a0 === COMMAND_SENTINEL;
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
r0 = r0 && !(env0_1 && a1.length === 0);
|
|
return r0;
|
|
}
|
|
|
|
function getAutocompleteOptionsMatches_84883(a0, a1, a2) { // fn#84883, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11271:2622, owner: getAutocompleteOptions.matches, offset: 0x01f5ab77, size: 55 bytes, params: 4, frame: 3
|
|
var value;
|
|
let r0 = env0_1 && a2 === 0;
|
|
if (r0) {
|
|
value = environment.__proto__;
|
|
value = a0 === COMMAND_SENTINEL;
|
|
r0 = value;
|
|
}
|
|
r0 = r0 && a1.length === 0;
|
|
return r0;
|
|
}
|
|
|
|
function getAutocompleteOptionsQueryResults_84884(a0, a1) { // fn#84884, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11271:2688, owner: getAutocompleteOptions.queryResults, offset: 0x01f5abae, size: 492 bytes, params: 3, frame: 22
|
|
var environment;
|
|
var choices;
|
|
var r3;
|
|
var r0;
|
|
var value;
|
|
var value2;
|
|
var object;
|
|
var value3;
|
|
var guildStoreBinding;
|
|
var getGuild;
|
|
var binding;
|
|
var value5;
|
|
var binding2;
|
|
var name;
|
|
var applicationCommandAutocompleteStoreBinding;
|
|
var getAutocompleteChoices;
|
|
var id;
|
|
var value6;
|
|
var intl;
|
|
var array;
|
|
if (a1 == null) {
|
|
choices = a1?.choices;
|
|
} else {
|
|
var option = a1.option;
|
|
if (option == null) {
|
|
value = undefined;
|
|
choices = a1 == null ? value : a1.choices;
|
|
if (choices == null) {
|
|
r3 = [];
|
|
} else {
|
|
value2 = environment.__proto__;
|
|
value = importDefault(6526) /* metro dependency 6526: AutocompleteUtils */;
|
|
choices = value.queryChoiceResults({query: a0, choices: choices}).choices;
|
|
value = choices.map(function(a0) {
|
|
return {type: AutoCompleteResultTypes.CHOICE, choice: a0};
|
|
});
|
|
r3 = value;
|
|
}
|
|
return r3;
|
|
}
|
|
if (option.autocomplete) {
|
|
value = undefined;
|
|
if ((a1 == null ? value : a1.activeCommand) == null) {
|
|
value = undefined;
|
|
choices = a1 == null ? value : a1.choices;
|
|
if (choices == null) {
|
|
r3 = [];
|
|
} else {
|
|
value2 = environment.__proto__;
|
|
value = importDefault(6526) /* metro dependency 6526: AutocompleteUtils */;
|
|
choices = value.queryChoiceResults({query: a0, choices: choices}).choices;
|
|
value = choices.map(function(a0) {
|
|
return {type: AutoCompleteResultTypes.CHOICE, choice: a0};
|
|
});
|
|
r3 = value;
|
|
}
|
|
return r3;
|
|
}
|
|
if ((a1 == null ? value : a1.optionValues) != null) {
|
|
value3 = environment.__proto__;
|
|
guildStoreBinding = GuildStore;
|
|
getGuild = guildStoreBinding.getGuild;
|
|
binding = env0_0;
|
|
value5 = Reflect.apply(getGuild, guildStoreBinding, [binding.guild_id]);
|
|
binding2 = env1_20;
|
|
object = {};
|
|
object.command = a1.activeCommand;
|
|
object.optionValues = a1.optionValues;
|
|
option = a1.option;
|
|
name = option.name;
|
|
object.context = {channel: binding, guild: value5, autocomplete: {name: name, query: a0}};
|
|
binding2(object);
|
|
applicationCommandAutocompleteStoreBinding = ApplicationCommandAutocompleteStore;
|
|
getAutocompleteChoices = applicationCommandAutocompleteStoreBinding.getAutocompleteChoices;
|
|
id = binding.id;
|
|
option = a1.option;
|
|
name = option.name;
|
|
value6 = Reflect.apply(getAutocompleteChoices, applicationCommandAutocompleteStoreBinding, [id, name,
|
|
a0]);
|
|
if (value6 == null) {
|
|
array = new global.Array(4);
|
|
array = array.fill({type: AutoCompleteResultTypes.CHOICE_LOADING});
|
|
r0 = array;
|
|
} else if (value6.length === 0) {
|
|
object = {};
|
|
object.type = AutoCompleteResultTypes.LABEL;
|
|
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
object.label = intl.string((require(1244) /* metro dependency 1244: indexNative */).t['41014u']);
|
|
r0 = [object];
|
|
} else {
|
|
r0 = value6.map(_fun84885);
|
|
}
|
|
return r0;
|
|
}
|
|
value = undefined;
|
|
choices = a1 == null ? value : a1.choices;
|
|
if (choices == null) {
|
|
r3 = [];
|
|
} else {
|
|
value2 = environment.__proto__;
|
|
value = importDefault(6526) /* metro dependency 6526: AutocompleteUtils */;
|
|
choices = value.queryChoiceResults({query: a0, choices: choices}).choices;
|
|
value = choices.map(_fun84886);
|
|
r3 = value;
|
|
}
|
|
return r3;
|
|
}
|
|
choices = a1?.choices;
|
|
}
|
|
if (choices == null) {
|
|
r3 = [];
|
|
} else {
|
|
value2 = environment.__proto__;
|
|
value = importDefault(6526) /* metro dependency 6526: AutocompleteUtils */;
|
|
choices = value.queryChoiceResults({query: a0, choices: choices}).choices;
|
|
value = choices.map(function(a0) {
|
|
return {type: AutoCompleteResultTypes.CHOICE, choice: a0};
|
|
});
|
|
r3 = value;
|
|
}
|
|
return r3;
|
|
function _fun84885(a0) { // fn#84885, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11271:3192, offset: 0x01f5ad9a, size: 29 bytes, params: 2, frame: 2
|
|
const CHOICE = AutoCompleteResultTypes.CHOICE;
|
|
return {type: CHOICE, choice: a0};
|
|
}
|
|
|
|
function _fun84886(a0) { // fn#84886, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11271:3335, offset: 0x01f5ad9a, size: 29 bytes, params: 2, frame: 2
|
|
const CHOICE = AutoCompleteResultTypes.CHOICE;
|
|
return {type: CHOICE, choice: a0};
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun84865, 11085, [7167, 7168, 6583, 1379, 1945, 1867, 661, 5066, 6625, 11086, 1881, 22, 8050, 6526,
|
|
11050, 6943, 1423, 1244,
|
|
2]) /* metro module 11085, dependencies: [7167, 7168, 6583, 1379, 1945, 1867, 661, 5066, 6625, 11086, 1881, 22, 8050, 6526, 11050, 6943, 1423, 1244, 2] */;
|