/* Metro module 9763; source: modules/quickswitcher/QuickSwitcherActionCreators.tsx; dependencies: [5, 57, 6527, 1383, 1379, 4270, 1934, 3969, 7233, 661, 1386, 663, 7234, 683, 8788, 694, 6947, 4601, 7712, 4796, 4603, 9764, 6837, 9765, 5120, 6789, 8879, 2] */ import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */ import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */ import AnalyticsUtils from '../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */ import Dispatcher from '../../Dispatcher.tsx'; /* Metro dependency 694 */ import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */ import SelectedChannelStore from '../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */ import SelectedGuildStore from '../../stores/SelectedGuildStore.tsx'; /* Metro dependency 3969 */ import LibraryApplicationStore from '../../stores/LibraryApplicationStore.tsx'; /* Metro dependency 4270 */ import QuickSwitcherStore from './QuickSwitcherStore.tsx'; /* Metro dependency 7233 */ import ValidationUtils from '../../utils/ValidationUtils.tsx'; /* Metro dependency 8788 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ import * as CollectiblesShopConstantsModule from '../collectibles/CollectiblesShopConstants.tsx'; /* Metro dependency 663 */ import * as ChannelRecordModule from '../../records/ChannelRecord.tsx'; /* Metro dependency 1383 */ import * as ChannelConstantsModule from '../channel/ChannelConstants.tsx'; /* Metro dependency 1386 */ import * as InAppNavigationRecordModule from '../autocompleter/record/InAppNavigationRecord.tsx'; /* Metro dependency 6527 */ import * as AutocompleterModule from '../autocompleter/index.tsx'; /* Metro dependency 7234 */ function _fun76623(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#76623, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9949:6, offset: 0x01ddd902, size: 962 bytes, params: 8, frame: 36 const env0_0 = require; const getQuickSwitcherOptions2 = getQuickSwitcherOptions; const trackOpen2 = trackOpen; const trackClose2 = trackClose; const show_766292 = show_76629; const closure5 = function() { trackClose(AnalyticEvents.QUICKSWITCHER_CLOSED); hideQuickSwitcher(); }; let Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); ConstantsModule.Layers; Object = global.Object; const freeze = Object.freeze; const AutocompleterQuerySymbols = (AutocompleterModule).AutocompleterQuerySymbols; let USER = AutocompleterQuerySymbols.USER; const AutocompleterResultTypes = (AutocompleterModule).AutocompleterResultTypes; const USER2 = AutocompleterResultTypes.USER; let TEXT_CHANNEL = AutocompleterQuerySymbols.TEXT_CHANNEL; const TEXT_CHANNEL2 = AutocompleterResultTypes.TEXT_CHANNEL; let VOICE_CHANNEL = AutocompleterQuerySymbols.VOICE_CHANNEL; const VOICE_CHANNEL2 = AutocompleterResultTypes.VOICE_CHANNEL; let GUILD = AutocompleterQuerySymbols.GUILD; const GUILD2 = AutocompleterResultTypes.GUILD; let APPLICATION = AutocompleterQuerySymbols.APPLICATION; const APPLICATION2 = AutocompleterResultTypes.APPLICATION; const env0_19 = Reflect.apply(freeze, Object, [{[USER]: USER2, [TEXT_CHANNEL]: TEXT_CHANNEL2, [VOICE_CHANNEL]: VOICE_CHANNEL2, [GUILD]: GUILD2, [APPLICATION]: APPLICATION2}]); const RegExp = global.RegExp; USER = AutocompleterQuerySymbols.USER; TEXT_CHANNEL = AutocompleterQuerySymbols.TEXT_CHANNEL; VOICE_CHANNEL = AutocompleterQuerySymbols.VOICE_CHANNEL; GUILD = AutocompleterQuerySymbols.GUILD; APPLICATION = AutocompleterQuerySymbols.APPLICATION; const regExp = new RegExp('^' + USER + '|' + TEXT_CHANNEL + '|' + VOICE_CHANNEL + '|\\' + GUILD + '|\\' + APPLICATION); (FileImportTrackerModule).fileFinishedImporting('modules/quickswitcher/QuickSwitcherActionCreators.tsx'); exports.getQuickSwitcherOptions = getQuickSwitcherOptions2; exports.trackOpen = trackOpen2; exports.trackClose = trackClose2; exports.show = show_766292; exports.hide = closure5; exports.toggle = toggle; exports.search = function(a0) { var defaultImport = importDefault(dependencyMap[15]); var object = {type: 'QUICKSWITCHER_SEARCH'}; var getQuickSwitcherOptionsBinding = getQuickSwitcherOptions; copyDataProperties(object, getQuickSwitcherOptionsBinding(a0), getQuickSwitcherOptionsBinding); defaultImport.dispatch(object); }; exports.selectResult = selectResult; exports.switchToResult = switchToResult; function getQuickSwitcherOptions(a0) { // fn#76624, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9949:1125, offset: 0x01dddcc4, size: 150 bytes, params: 2, frame: 18 let value = a0.charAt(0); const property = env0_19[value]; const value3 = null; let r2 = value3 != property ? property : value3; const AutocompleterQuerySymbols = (AutocompleterModule).AutocompleterQuerySymbols; const APPLICATION = AutocompleterQuerySymbols.APPLICATION; r2 = value === APPLICATION ? value3 : r2; value = Module00057([a0.replace(env0_20, ''), r2], 2); return {query: value[0], queryMode: value[1]}; } function trackOpen(a0) { // fn#76625, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9949:1371, offset: 0x01dddd5a, size: 165 bytes, params: 2, frame: 17 var r4; var guildId; var channelId; var value4; var channel; var defaultImport; const quickSwitcherStoreBinding = QuickSwitcherStore; if (!quickSwitcherStoreBinding.isOpen()) { guildId = SelectedGuildStore.getGuildId(); channelId = SelectedChannelStore.getChannelId(guildId); value4 = null; if (value4 != channelId) { channel = ChannelStore.getChannel(channelId); r4 = value4 != channel ? channel.type : value4; } else { r4 = undefined; } defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */; defaultImport.track(AnalyticEvents.QUICKSWITCHER_OPENED, {source: a0, current_guild_id: guildId, current_channel_id: channelId, current_channel_type: r4}); } } function trackClose(a0, a1) { // fn#76626, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9949:1622, offset: 0x01ddddff, size: 1023 bytes, params: 3, frame: 30 var type; var guild_id; var channel; var record; const {results, queryMode, query, maxQueryLength} = QuickSwitcherStore.getProps(); const guildId = SelectedGuildStore.getGuildId(); const channelId = SelectedChannelStore.getChannelId(guildId); const value5 = undefined; const findNextSelectedResult = AutocompleterModule.findNextSelectedResult; const FindResultDirections = AutocompleterModule.FindResultDirections; const DOWN = FindResultDirections.DOWN; const property = results[Reflect.apply(findNextSelectedResult, AutocompleterModule, [DOWN, -1, results])]; const isEmail2 = (ValidationUtils).isEmail(query); const isPhoneNumber2 = (ValidationUtils).isPhoneNumber(query); const isUserTagLike2 = (ValidationUtils).isUserTagLike(query); const value6 = null; const r18 = value6 != channelId && isStaticChannelRoute(channelId); const getResultType2 = getResultType; const object = {}; object.current_channel_id = r18 ? value5 : channelId; object.current_channel_static_route = r18 ? channelId : value5; object.current_guild_id = guildId; object.query_mode = value6 != queryMode ? queryMode : 'GENERAL'; object.query_length = query.length; object.max_query_length = maxQueryLength; object.is_email_like = isEmail2; object.is_phone_like = isPhoneNumber2; object.is_username_like = isUserTagLike2; object.query = isEmail2 || isPhoneNumber2 || isUserTagLike2 ? value6 : query; object.top_result_type = getResultType2(property); let score = value6 != property ? property.score : value6; object.top_result_score = score; quickSwitcherStoreBinding = QuickSwitcherStore; let getResultTotals = quickSwitcherStoreBinding.getResultTotals; object.num_results_total = Reflect.apply(getResultTotals, quickSwitcherStoreBinding, []); quickSwitcherStoreBinding = QuickSwitcherStore; getResultTotals = quickSwitcherStoreBinding.getResultTotals; const AutocompleterResultTypes = AutocompleterModule.AutocompleterResultTypes; const USER = AutocompleterResultTypes.USER; object.num_results_users = Reflect.apply(getResultTotals, quickSwitcherStoreBinding, [USER]); quickSwitcherStoreBinding = QuickSwitcherStore; getResultTotals = quickSwitcherStoreBinding.getResultTotals; const TEXT_CHANNEL = AutocompleterResultTypes.TEXT_CHANNEL; object.num_results_text_channels = Reflect.apply(getResultTotals, quickSwitcherStoreBinding, [TEXT_CHANNEL]); quickSwitcherStoreBinding = QuickSwitcherStore; getResultTotals = quickSwitcherStoreBinding.getResultTotals; const VOICE_CHANNEL = AutocompleterResultTypes.VOICE_CHANNEL; object.num_results_voice_channels = Reflect.apply(getResultTotals, quickSwitcherStoreBinding, [VOICE_CHANNEL]); quickSwitcherStoreBinding = QuickSwitcherStore; getResultTotals = quickSwitcherStoreBinding.getResultTotals; const GUILD = AutocompleterResultTypes.GUILD; object.num_results_guilds = Reflect.apply(getResultTotals, quickSwitcherStoreBinding, [GUILD]); quickSwitcherStoreBinding = QuickSwitcherStore; getResultTotals = quickSwitcherStoreBinding.getResultTotals; const GROUP_DM = AutocompleterResultTypes.GROUP_DM; object.num_results_group_dms = Reflect.apply(getResultTotals, quickSwitcherStoreBinding, [GROUP_DM]); if (value6 != channelId) { channel = ChannelStore.getChannel(channelId); object.current_channel_type = value6 != channel ? channel.type : value6; } if (value6 != a1) { type = a1.type; score = a1.score; record = a1.record; object.selected_type = getResultType2(a1); object.selected_score = score; object.selected_index = results.indexOf(a1); if (AutocompleterResultTypes.GUILD === type) { object.selected_guild_id = record.id; } else if (AutocompleterResultTypes.TEXT_CHANNEL === type) { if (record instanceof ChannelRecordBase) { guild_id = record.guild_id; guild_id = value6 != guild_id ? record.guild_id : value6; object.selected_guild_id = guild_id; } object.selected_channel_id = record.id; } else if (AutocompleterResultTypes.VOICE_CHANNEL === type) { if (record instanceof ChannelRecordBase) { guild_id = record.guild_id; guild_id = value6 != guild_id ? record.guild_id : value6; object.selected_guild_id = guild_id; } object.selected_channel_id = record.id; } else if (AutocompleterResultTypes.GROUP_DM === type) { object.selected_channel_id = record.id; } else if (AutocompleterResultTypes.USER === type) { object.selected_user_id = record.id; } } (AnalyticsUtils).track(a0, object); return value5; function getResultType(a0) { // fn#76627, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9949:1944, owner: trackClose.getResultType, offset: 0x01dde1fe, size: 98 bytes, params: 2, frame: 14 var r1; var r0; var type; let value = null; if (value == a0) { r0 = value; } else { type = a0.type; value = environment.__proto__; if (type === (require(7234) /* metro dependency 7234: autocompleter */).AutocompleterResultTypes.IN_APP_NAVIGATION) { type = a0.type; value = type + '_'; type = a0.record.type; value += type; r1 = value; } else { r1 = a0.type; } r0 = r1; } return r0; } } function hideQuickSwitcher() { // fn#76628, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9949:3493, offset: 0x01dde260, size: 47 bytes, params: 1, frame: 13 (Dispatcher).dispatch({type: 'QUICKSWITCHER_HIDE'}); } function show_76629() { // fn#76629, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9949:3569, offset: 0x01dde28f, size: 94 bytes, params: 1, frame: 16 const value = a0; const value2 = a1; const r2 = value !== undefined ? value : 'KEYBIND'; const r5 = value2 !== undefined ? value2 : ''; trackOpen(r2); const defaultImport = Dispatcher; const dispatch = defaultImport.dispatch; const object = {type: 'QUICKSWITCHER_SHOW'}; copyDataProperties(object, getQuickSwitcherOptions(r5), 'QUICKSWITCHER_SHOW'); Reflect.apply(dispatch, defaultImport, [object]); } function _openInviteFromQuickSwitcher() { // fn#76631, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9949:3762, offset: 0x01dde30f, size: 50 bytes, params: 1, frame: 14 return Module00005(_fun76633).apply(this, arguments); function* _fun76633(a0) { // fn#76633, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9949:3841, offset: 0x01dde34c, size: 152 bytes, params: 2, frame: 19 if (true) { value = environment.__proto__.__proto__; var value3 = env2_1(env2_2[26]); yield value3.resolveInvite(a0, 'Quick Switcher'); var value4 = undefined; if (false) { return value4; } var invite = value4.invite; if (invite != null) { env2_1(env2_2[15]).dispatch({type: 'INVITE_MODAL_OPEN', invite: invite, code: a0, context: env2_13.APP}); } } } } function toggle() { // fn#76634, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9949:4246, offset: 0x01dde3e4, size: 54 bytes, params: 1, frame: 13 const value = a0; const r3 = value !== undefined ? value : 'KEYBIND'; const quickSwitcherStoreBinding = QuickSwitcherStore; if (quickSwitcherStoreBinding.isOpen()) { hide_76630(); } else { show_76629(r3); } } function selectResult(a0) { // fn#76636, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9949:4425, offset: 0x01dde45e, size: 57 bytes, params: 2, frame: 13 (Dispatcher).dispatch({type: 'QUICKSWITCHER_SELECT', selectedIndex: a0}); } function switchToResult(a0) { // fn#76637, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9949:4533, offset: 0x01dde497, size: 1333 bytes, params: 2, frame: 23 var moduleValue; var openCollectiblesShop; var moduleValue2; var libraryApplicationStoreBinding; var id; var moduleValue3; var transitionToChannel; var defaultImport3; var channelListScrollTo; var defaultImport4; var openPrivateChannel; var defaultImport5; var channelStoreBinding; var getDMFromUserId; var value2; var defaultImport6; var defaultImport7; var moduleValue4; var value3; var moduleValue5; var moduleValue6; const value = a1; const r5 = value !== undefined ? value : false; hideQuickSwitcher(); const trackCloseBinding = trackClose; const QUICKSWITCHER_RESULT_SELECTED = AnalyticEvents.QUICKSWITCHER_RESULT_SELECTED; trackCloseBinding(QUICKSWITCHER_RESULT_SELECTED, a0); let type = a0.type; const record = a0.record; let object = {}; let QUICK_SWITCHER = AnalyticsPages.QUICK_SWITCHER; object.page = QUICK_SWITCHER; const AutocompleterResultTypes = (AutocompleterModule).AutocompleterResultTypes; const GUILD = AutocompleterResultTypes.GUILD; if (GUILD === type) { moduleValue6 = require(6947) /* metro dependency 6947: transitionToGuildNative */; moduleValue6.transitionToGuild(record.id, {navigationReplace: true}); (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'QUICKSWITCHER_SWITCH_TO', result: a0}); } else { var TEXT_CHANNEL = AutocompleterResultTypes.TEXT_CHANNEL; if (TEXT_CHANNEL === type) { channelStoreBinding = ChannelStore; value3 = channelStoreBinding.getChannel(record.id); if (value3 != null) { moduleValue5 = require(4601) /* metro dependency 4601: transitionToChannel */; moduleValue5.transitionToChannel(value3.id, {state: {analyticsSource: object}, navigationReplace: true}); } (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'QUICKSWITCHER_SWITCH_TO', result: a0}); return undefined; } var VOICE_CHANNEL = AutocompleterResultTypes.VOICE_CHANNEL; if (VOICE_CHANNEL === type) { channelStoreBinding = ChannelStore; value2 = channelStoreBinding.getChannel(record.id); if (value2 != null) { if (r5) { defaultImport7 = importDefault(7712) /* metro dependency 7712: ChannelRTCActionCreators */; defaultImport7.updateChatOpen(record.id, true); } else { defaultImport6 = importDefault(4796) /* metro dependency 4796: SelectedChannelActionCreators */; defaultImport6.selectVoiceChannel(record.id); } moduleValue4 = require(4601) /* metro dependency 4601: transitionToChannel */; moduleValue4.transitionToChannel(value2.id, {state: {analyticsSource: object}, navigationReplace: true}); } (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'QUICKSWITCHER_SWITCH_TO', result: a0}); return undefined; } var USER = AutocompleterResultTypes.USER; if (USER === type) { defaultImport4 = importDefault(4603) /* metro dependency 4603: ChannelActionCreators */; openPrivateChannel = defaultImport4.openPrivateChannel; id = record.id; Reflect.apply(openPrivateChannel, defaultImport4, [{recipientIds: [id], location: 'Quickswitcher'}]); defaultImport5 = importDefault(9764) /* metro dependency 9764: DimensionActionCreators */; channelListScrollTo = defaultImport5.channelListScrollTo; channelStoreBinding = ChannelStore; getDMFromUserId = channelStoreBinding.getDMFromUserId; id = record.id; Reflect.apply(channelListScrollTo, defaultImport5, [ME, Reflect.apply(getDMFromUserId, channelStoreBinding, [id])]); (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'QUICKSWITCHER_SWITCH_TO', result: a0}); return undefined; } var GROUP_DM = AutocompleterResultTypes.GROUP_DM; if (GROUP_DM === type) { moduleValue3 = require(4601) /* metro dependency 4601: transitionToChannel */; transitionToChannel = moduleValue3.transitionToChannel; id = record.id; Reflect.apply(transitionToChannel, moduleValue3, [id, {navigationReplace: true}]); defaultImport3 = importDefault(9764) /* metro dependency 9764: DimensionActionCreators */; channelListScrollTo = defaultImport3.channelListScrollTo; id = record.id; Reflect.apply(channelListScrollTo, defaultImport3, [ME, id]); (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'QUICKSWITCHER_SWITCH_TO', result: a0}); return undefined; } var APPLICATION = AutocompleterResultTypes.APPLICATION; if (APPLICATION === type) { libraryApplicationStoreBinding = LibraryApplicationStore; libraryApplicationStoreBinding.getActiveLibraryApplication(record.id); record.id; AnalyticsLocations.QUICK_SWITCHER; AnalyticsLocations.QUICK_SWITCHER; global.Promise.resolve(); (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'QUICKSWITCHER_SWITCH_TO', result: a0}); return undefined; } var LINK = AutocompleterResultTypes.LINK; if (LINK === type) { if (record.inviteCode != null) { (function() { return _openInviteFromQuickSwitcher.apply(this, arguments); })(record.inviteCode); } else { (importDefault(6837) /* metro dependency 6837: safeTransitionToNative */)(record.path, {navigationReplace: true}); } (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'QUICKSWITCHER_SWITCH_TO', result: a0}); return undefined; } var IN_APP_NAVIGATION = AutocompleterResultTypes.IN_APP_NAVIGATION; if (IN_APP_NAVIGATION !== type) { (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'QUICKSWITCHER_SWITCH_TO', result: a0}); return undefined; } type = a0.record.type; var SETTINGS = InAppNavigationType.SETTINGS; if (type === SETTINGS) { (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'QUICKSWITCHER_SWITCH_TO', result: a0}); return undefined; } type = a0.record.type; var PLAYGROUND = InAppNavigationType.PLAYGROUND; if (type === PLAYGROUND) { moduleValue2 = require(9765) /* metro dependency 9765: PlaygroundAccessExperiment */; if (moduleValue2.getHasPlaygroundAccess('quickswitcher_action')) { (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'QUICKSWITCHER_SWITCH_TO', result: a0}); return undefined; } return undefined; } type = a0.record.type; var SHOP_ORBS_TAB = InAppNavigationType.SHOP_ORBS_TAB; if (type === SHOP_ORBS_TAB) { moduleValue = require(5120) /* metro dependency 5120: CollectiblesActionCreators */; openCollectiblesShop = moduleValue.openCollectiblesShop; object = {}; object.tab = CollectibleShopTab.ORBS; QUICK_SWITCHER = (importDefault(6789) /* metro dependency 6789: AnalyticsLocation */).QUICK_SWITCHER; object.analyticsLocations = [QUICK_SWITCHER]; QUICK_SWITCHER = (importDefault(6789) /* metro dependency 6789: AnalyticsLocation */).QUICK_SWITCHER; object.analyticsSource = QUICK_SWITCHER; Reflect.apply(openCollectiblesShop, moduleValue, [object]); } else { (importDefault(6837) /* metro dependency 6837: safeTransitionToNative */)(record.path, {navigationReplace: true}); } (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'QUICKSWITCHER_SWITCH_TO', result: a0}); } } } global.__d(_fun76623, 9763, [5, 57, 6527, 1383, 1379, 4270, 1934, 3969, 7233, 661, 1386, 663, 7234, 683, 8788, 694, 6947, 4601, 7712, 4796, 4603, 9764, 6837, 9765, 5120, 6789, 8879, 2]) /* metro module 9763, dependencies: [5, 57, 6527, 1383, 1379, 4270, 1934, 3969, 7233, 661, 1386, 663, 7234, 683, 8788, 694, 6947, 4601, 7712, 4796, 4603, 9764, 6837, 9765, 5120, 6789, 8879, 2] */;