/* Metro module 7168; source: modules/application_commands/ApplicationCommandStore.tsx; dependencies: [6, 7, 15, 17, 18, 57, 4791, 1934, 5065, 566, 694, 2] */ import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */ import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */ import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */ import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */ import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import SelectedChannelStore from '../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */ import ChannelSectionStore from '../../stores/ChannelSectionStore.tsx'; /* Metro dependency 4791 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ function _fun57543(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57543, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7346:6, offset: 0x013e8743, size: 396 bytes, params: 8, frame: 23 const env0_0 = require; const closure = function() { env0_10 = {}; return true; }; const APPLICATION_COMMAND_SET_ACTIVE_COMMAND_575492 = APPLICATION_COMMAND_SET_ACTIVE_COMMAND_57549; const APPLICATION_COMMAND_SET_PREFERRED_COMMAND2 = APPLICATION_COMMAND_SET_PREFERRED_COMMAND; const APPLICATION_COMMAND_UPDATE_OPTIONS2 = APPLICATION_COMMAND_UPDATE_OPTIONS; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let env0_10 = {}; const Store = (Flux).Store; let value = _fun57553(Store); value.displayName = 'ApplicationCommandStore'; value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: closure, CHANNEL_SELECT: closure, LOGOUT: closure, APPLICATION_COMMAND_SET_ACTIVE_COMMAND: APPLICATION_COMMAND_SET_ACTIVE_COMMAND_575492, APPLICATION_COMMAND_SET_PREFERRED_COMMAND: APPLICATION_COMMAND_SET_PREFERRED_COMMAND2, APPLICATION_COMMAND_UPDATE_OPTIONS: APPLICATION_COMMAND_UPDATE_OPTIONS2, APPLICATION_COMMAND_UPDATE_CHANNEL_STATE: APPLICATION_COMMAND_UPDATE_CHANNEL_STATE_57570}); (FileImportTrackerModule).fileFinishedImporting('modules/application_commands/ApplicationCommandStore.tsx'); exports.default = value; function _isNativeReflectConstruct_57544() { // fn#57544, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7346:178, offset: 0x013e88cf, size: 94 bytes, params: 1, frame: 18 var Boolean; var prototype; var valueOf; var call; var Reflect; var construct; var closure; var value; var error; try { Boolean = global.Boolean; prototype = Boolean.prototype; valueOf = prototype.valueOf; call = valueOf.call; Reflect = global.Reflect; construct = Reflect.construct; Boolean = global.Boolean; closure = function() { }; value = Reflect.apply(construct, Reflect, [Boolean, [], closure]); value = Reflect.apply(call, valueOf, [value]); var result = !value; } catch (error) { } return (_isNativeReflectConstruct_57544_isNativeReflectConstruct = function() { return !!result; })(); } function getOrCreateChannelState_57548(a0) { // fn#57548, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7346:417, offset: 0x013e893a, size: 65 bytes, params: 2, frame: 5 if (!(a0 in env0_10)) { env0_10[a0] = {'activeCommand': null, 'activeCommandSection': null, 'activeOptionName': null, 'preferredCommandId': null, 'optionStates': null, 'initialValues': null, 'commandOrigin': null, optionStates: {}, initialValues: {}}; } return env0_10[a0]; } function APPLICATION_COMMAND_SET_ACTIVE_COMMAND_57549({channelId, command, section, initialValues, location, triggerSection, queryLength, sectionName, query, searchResultsPosition, source, commandOrigin}) { // fn#57549, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7346:625, offset: 0x013e897b, size: 328 bytes, params: 2, frame: 28 let value = undefined; const orCreateChannelState_57548 = getOrCreateChannelState_57548(channelId); const id = command == null ? value : command.id; const activeCommand = orCreateChannelState_57548.activeCommand; if (id === (activeCommand == null ? value : activeCommand.id)) { return false; } orCreateChannelState_57548.activeCommand = command; orCreateChannelState_57548.activeCommandSection = section; orCreateChannelState_57548.activeOptionName = null; orCreateChannelState_57548.preferredCommandId = null; orCreateChannelState_57548.initialValues = initialValues ?? ({}); orCreateChannelState_57548.commandOrigin = commandOrigin ?? null; orCreateChannelState_57548.source = source; if ((command == null ? value : command.options) != null) { command.options.forEach(_fun57550); } orCreateChannelState_57548.optionStates = {}; if (command != null) { value = require(5065) /* metro dependency 5065: ApplicationCommandUtils */; value.trackCommandSelected({command: command, location: location, triggerSection: triggerSection, queryLength: queryLength, sectionName: sectionName, query: query, searchResultsPosition: searchResultsPosition, source: source}); } return true; function _fun57550({name}) { // fn#57550, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7346:1165, offset: 0x013e8ac3, size: 37 bytes, params: 2, frame: 3 env0_0[name] = {'isActive': false, 'hasValue': false, 'lastValidationResult': null, 'optionValue': null}; } } function APPLICATION_COMMAND_SET_PREFERRED_COMMAND({channelId, commandId}) { // fn#57551, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7346:1419, offset: 0x013e8ae8, size: 130 bytes, params: 2, frame: 16 const getOrCreateChannelState_57548Binding = getOrCreateChannelState_57548; const value = undefined; const orCreateChannelState_57548Binding = getOrCreateChannelState_57548Binding(channelId); let r0 = commandId !== orCreateChannelState_57548Binding.preferredCommandId && (orCreateChannelState_57548Binding.preferredCommandId !== null || commandId !== ((orCreateChannelState_57548Binding.activeCommand == null ? value : orCreateChannelState_57548Binding.activeCommand.id) ?? null)); if (r0) { orCreateChannelState_57548Binding.activeCommand = null; orCreateChannelState_57548Binding.activeOptionName = null; orCreateChannelState_57548Binding.preferredCommandId = commandId; orCreateChannelState_57548Binding.optionStates = {}; r0 = true; } return r0; } function APPLICATION_COMMAND_UPDATE_OPTIONS({channelId, changedOptionStates}) { // fn#57552, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7346:1735, offset: 0x013e8b6a, size: 589 bytes, params: 2, frame: 38 var r8; var hasValue; var isActive; var lastValidationResult; var r21; var r27; var r25; var property; var value5; var property2; var activeOptionName; var property3; var object; var optionValue; var location; var value6; var value7; var object3; var activeOptionName2; var value8; const orCreateChannelState_57548 = getOrCreateChannelState_57548(channelId); const object4 = {}; let optionStates = orCreateChannelState_57548.optionStates; copyDataProperties(object4, optionStates, undefined); const Object = global.Object; const value3 = Object.entries(changedOptionStates); let length = value3.length; if (0 < length) { r8 = 0; while (true) { property = value3[r8]; value5 = Module00057(property, 2); property = value5[0]; property2 = value5[1]; optionStates = orCreateChannelState_57548.optionStates; if (property in optionStates) { hasValue = property2.hasValue; hasValue = hasValue !== undefined ? property2.hasValue : object4[property].hasValue; if (hasValue) { property3 = object4[property]; object = {hasValue: true}; isActive = property2.isActive; isActive = isActive !== undefined ? property2.isActive : property3.isActive; object.isActive = isActive; lastValidationResult = property2.lastValidationResult; lastValidationResult = lastValidationResult !== undefined ? property2.lastValidationResult : property3.lastValidationResult; object.lastValidationResult = lastValidationResult; optionValue = property2.optionValue; if (optionValue != null) { r21 = optionValue; continue; } optionValue = property3.optionValue; r21 = optionValue; object.optionValue = r21; location = property2.location; if (location != null) { r21 = location; continue; } location = property3.location; r21 = location; object.location = r21; length = property2.length; if (length != null) { r27 = length; continue; } r27 = property3.length; object.length = r27; object4[property] = object; isActive = property2.isActive; if (isActive === undefined) { break; } isActive = property2.isActive; activeOptionName = orCreateChannelState_57548.activeOptionName; if (isActive) { value6 = activeOptionName != null; if (!value6) { r25 = value6; continue; } activeOptionName = orCreateChannelState_57548.activeOptionName; value7 = activeOptionName !== property; r25 = value7; if (!r25) { continue; } activeOptionName = orCreateChannelState_57548.activeOptionName; object3 = {}; activeOptionName2 = orCreateChannelState_57548.activeOptionName; copyDataProperties(object3, object4[activeOptionName2], undefined); object4[activeOptionName] = object3; activeOptionName = orCreateChannelState_57548.activeOptionName; object4[activeOptionName].isActive = false; orCreateChannelState_57548.activeOptionName = property; break; } if (property !== activeOptionName) { break; } orCreateChannelState_57548.activeOptionName = null; break; } object4[property] = {'hasValue': false, 'isActive': false, 'lastValidationResult': null, 'optionValue': null, location: undefined, length: undefined}; activeOptionName = orCreateChannelState_57548.activeOptionName; if (activeOptionName !== property) { break; } orCreateChannelState_57548.activeOptionName = null; break; } value8 = typeof r8 === 'bigint' ? r8 + 1n : +r8 + 1; length = value3.length; if (value8 < length) { r8 = value8; continue; } break; } } orCreateChannelState_57548.optionStates = object4; return true; } function _fun57553(a0) { // fn#57553, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7346:2763, offset: 0x013e8db7, size: 329 bytes, params: 2, frame: 16 const ApplicationCommandStore2 = ApplicationCommandStore; Inherits(ApplicationCommandStore2, a0); return CreateClass(ApplicationCommandStore2, [{key: 'initialize', value: function() { var channelSectionStoreBinding = ChannelSectionStore; this.waitFor(channelSectionStoreBinding, SelectedChannelStore); channelSectionStoreBinding.addChangeListener(_fun57556); }}, {key: 'getActiveCommand', value: function(a0) { return getOrCreateChannelState_57548(a0).activeCommand; }}, {key: 'getActiveCommandSection', value: function(a0) { return getOrCreateChannelState_57548(a0).activeCommandSection; }}, {key: 'getActiveOptionName', value: function(a0) { return getOrCreateChannelState_57548(a0).activeOptionName; }}, {key: 'getActiveOption', value: value_57560}, {key: 'getPreferredCommandId', value: function(a0) { return getOrCreateChannelState_57548(a0).preferredCommandId; }}, {key: 'getOptionStates', value: function(a0) { return getOrCreateChannelState_57548(a0).optionStates; }}, {key: 'getOptionState', value: function(a0, a1) { return getOrCreateChannelState_57548(a0).optionStates[a1]; }}, {key: 'getCommandOrigin', value: function(a0) { return getOrCreateChannelState_57548(a0).commandOrigin; }}, {key: 'getSource', value: function(a0) { return getOrCreateChannelState_57548(a0).source; }}, {key: 'getOption', value: value_57567}, {key: 'getState', value: function(a0) { var object = {}; var getOrCreateChannelState_57548Binding = getOrCreateChannelState_57548; copyDataProperties(object, getOrCreateChannelState_57548Binding(a0), getOrCreateChannelState_57548Binding); return object; }}]); function ApplicationCommandStore() { // fn#57554, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7346:2775, offset: 0x00ff71a7, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_2(this, ApplicationCommandStore); const value3 = env1_5(ApplicationCommandStore); return env1_4(this, _isNativeReflectConstruct_57544() ? global.Reflect.construct(value3, arguments, env1_5(this).constructor) : value3.apply(this, arguments)); } function value_57555() { // fn#57555, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7346:3108, offset: 0x013e8f00, size: 48 bytes, params: 1, frame: 13 const waitFor = this.waitFor; const channelSectionStoreBinding = ChannelSectionStore; Reflect.apply(waitFor, this, [channelSectionStoreBinding, SelectedChannelStore]); channelSectionStoreBinding.addChangeListener(_fun57556); function _fun57556() { // fn#57556, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7346:3158, offset: 0x013e8f30, size: 108 bytes, params: 1, frame: 13 var object3; var object; const channelId = SelectedChannelStore.getChannelId(); if (channelId == null) { object3 = {}; return true; } const currentSidebarChannelId = ChannelSectionStore.getCurrentSidebarChannelId(channelId); if (currentSidebarChannelId == null) { if (channelId in object3) { ({})[channelId] = object3[channelId]; } else { object = {}; } } else { if (currentSidebarChannelId in object3) { return false; } if (channelId in object3) { ({})[channelId] = object3[channelId]; } else { object = {}; } } } } function value_57560(a0) { // fn#57560, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7346:3631, offset: 0x013e8fe7, size: 84 bytes, params: 2, frame: 14 var environment; let value = environment.__proto__; const getOrCreateChannelState_57548Binding = getOrCreateChannelState_57548; value = undefined; const activeCommand = getOrCreateChannelState_57548Binding(a0).activeCommand; const value3 = null; const r1 = value3 == activeCommand || value3 == activeCommand.options ? value : activeCommand.options.find(_fun57561); return value3 != r1 ? r1 : value3; function _fun57561({name}) { // fn#57561, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7346:3758, offset: 0x013e903b, size: 27 bytes, params: 2, frame: 2 return name === env0_0.activeOptionName; } } function value_57567(a0, a1) { // fn#57567, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7346:4280, offset: 0x013e90d9, size: 75 bytes, params: 3, frame: 14 var environment; const env0_0 = a1; let value = environment.__proto__; const getOrCreateChannelState_57548Binding = getOrCreateChannelState_57548; value = undefined; const activeCommand = getOrCreateChannelState_57548Binding(a0).activeCommand; return activeCommand == null || activeCommand.options == null ? value : activeCommand.options.find(function({name}) { return name === require; }); } } function APPLICATION_COMMAND_UPDATE_CHANNEL_STATE_57570({channelId, preferredCommandId, command, section, location, changedOptionStates}) { // fn#57570, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7346:4868, offset: 0x013e9140, size: 152 bytes, params: 2, frame: 18 const value2 = APPLICATION_COMMAND_SET_ACTIVE_COMMAND_57549({type: 'APPLICATION_COMMAND_SET_ACTIVE_COMMAND', channelId: channelId, command: command, section: section, location: location}); const value3 = APPLICATION_COMMAND_SET_PREFERRED_COMMAND({type: 'APPLICATION_COMMAND_SET_PREFERRED_COMMAND', channelId: channelId, commandId: preferredCommandId}); APPLICATION_COMMAND_UPDATE_OPTIONS({type: 'APPLICATION_COMMAND_UPDATE_OPTIONS', channelId: channelId, changedOptionStates: changedOptionStates}); let r0 = value2 || value3; r0 = !r0 || r0; return r0; } } global.__d(_fun57543, 7168, [6, 7, 15, 17, 18, 57, 4791, 1934, 5065, 566, 694, 2]) /* metro module 7168, dependencies: [6, 7, 15, 17, 18, 57, 4791, 1934, 5065, 566, 694, 2] */;