/* Metro module 4258; source: stores/CallStore.tsx; dependencies: [6, 7, 15, 17, 18, 1379, 1934, 3969, 661, 694, 507, 22, 566, 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 Module00022 from '../by-id/module-00022.js'; /* Metro dependency 22 */ import Flux from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import ChannelStore from './ChannelStore.tsx'; /* Metro dependency 1379 */ import SelectedChannelStore from './SelectedChannelStore.tsx'; /* Metro dependency 1934 */ import SelectedGuildStore from './SelectedGuildStore.tsx'; /* Metro dependency 3969 */ import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */ function _fun35445(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#35445, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4430:6, offset: 0x01072d96, size: 464 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let env0_12 = {}; let env0_13 = {}; const Store = (Flux).Store; let value = _fun35450(Store); value.displayName = 'CallStore'; value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: function() { return callConnect(true); }, CONNECTION_CLOSED: function() { env0_12 = {}; env0_13 = {}; }, OVERLAY_INITIALIZE: function({callStoreInternalState}) { var object = {}; copyDataProperties(object, callStoreInternalState.calls, callStoreInternalState); env0_12 = object; object = {}; copyDataProperties(object, callStoreInternalState.enqueuedRings, callStoreInternalState); env0_13 = object; }, CONNECTION_RESUMED: function() { return callConnect(true); }, CHANNEL_SELECT: function({channelId}) { return callConnect(false, channelId); }, CHANNEL_DELETE: CHANNEL_DELETE_35464, CALL_CREATE: CALL_CREATE, CALL_UPDATE: CALL_UPDATE, CALL_DELETE: CALL_DELETE_35467, CALL_ENQUEUE_RING: CALL_ENQUEUE_RING, VOICE_CHANNEL_SELECT: VOICE_CHANNEL_SELECT_35469}); (FileImportTrackerModule).fileFinishedImporting('stores/CallStore.tsx'); exports.default = value; function _isNativeReflectConstruct_35446() { // fn#35446, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4430:198, offset: 0x01072f66, 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_35446_isNativeReflectConstruct = function() { return !!result; })(); } function callConnect() { // fn#35449, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4430:405, offset: 0x01072fc4, size: 177 bytes, params: 1, frame: 15 var binding; let value = a0; const value2 = a1; const r1 = value !== undefined ? value : false; const r3 = value2 !== undefined ? value2 : SelectedChannelStore.getChannelId(); const channel = ChannelStore.getChannel(r3); if (channel != null) { var getGuildId = channel.getGuildId; if (Reflect.apply(getGuildId, channel, []) != null) { return false; } if (r3 == null) { return false; } if (env0_12[r3] == null) { binding = env0_12; binding[r3] = binding[r3] ?? ({channelId: r3, ringing: []}); value = importDefault(694) /* metro dependency 694: Dispatcher */; value.dispatch({type: 'CALL_CONNECT', channelId: r3}); return true; } if (r1) { binding = env0_12; binding[r3] = binding[r3] ?? ({channelId: r3, ringing: []}); value = importDefault(694) /* metro dependency 694: Dispatcher */; value.dispatch({type: 'CALL_CONNECT', channelId: r3}); return true; } } return false; } function _fun35450(a0) { // fn#35450, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4430:660, offset: 0x01073075, size: 210 bytes, params: 2, frame: 16 const CallStore2 = CallStore; Inherits(CallStore2, a0); return CreateClass(CallStore2, [{key: 'initialize', value: function() { this.waitFor(ChannelStore, SelectedChannelStore, SelectedGuildStore); }}, {key: 'getCall', value: value_35453}, {key: 'getCalls', value: value_35454}, {key: 'getMessageId', value: function(a0) { var value = this.getCall(a0); var value2 = null; return value2 != value ? value.messageId : value2; }}, {key: 'isCallActive', value: value_35456}, {key: 'isCallUnavailable', value: value_35457}, {key: 'getInternalState', value: value_35458}]); function CallStore() { // fn#35451, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4430:672, offset: 0x00e2f839, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_3(this, CallStore); const value3 = env1_6(CallStore); return env1_5(this, _isNativeReflectConstruct_35446() ? global.Reflect.construct(value3, arguments, env1_6(this).constructor) : value3.apply(this, arguments)); } function value_35453(a0) { // fn#35453, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4430:989, offset: 0x00f8559b, size: 16 bytes, params: 2, frame: 2 return env1_12[a0]; } function value_35454() { // fn#35454, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4430:1037, offset: 0x0107316a, size: 27 bytes, params: 1, frame: 11 const Object = global.Object; return Object.values(env1_12); } function value_35456(a0, a1) { // fn#35456, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4430:1194, offset: 0x010731a6, size: 68 bytes, params: 3, frame: 5 const value = environment.__proto__; const property = env1_12[a0]; return property != null && !property.unavailable && (a1 != null ? property.messageId === a1 : property.region != null); } function value_35457(a0) { // fn#35457, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4430:1325, offset: 0x010731ea, size: 31 bytes, params: 2, frame: 3 const value = environment.__proto__; const property = env1_12[a0]; return property != null && property.unavailable; } function value_35458() { // fn#35458, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4430:1410, offset: 0x01073209, size: 25 bytes, params: 1, frame: 3 return {calls: env1_12, enqueuedRings: env1_13}; } } function CHANNEL_DELETE_35464({channel}) { // fn#35464, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4430:1953, offset: 0x0107329a, size: 81 bytes, params: 2, frame: 5 if (env0_13[channel.id] != null) { delete env0_13[channel.id]; } if (env0_12[channel.id] == null) { return false; } delete env0_12[channel.id]; } function CALL_CREATE({channelId, messageId, region, ongoingRings}) { // fn#35465, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4430:2079, offset: 0x010732eb, size: 228 bytes, params: 2, frame: 16 var r4; var property; var HTTP; var post; const binding = env0_12; let object = {channelId: channelId, messageId: messageId, region: region}; const Object = global.Object; object.ringing = Object.keys(ongoingRings); object.unavailable = false; object.regionUpdated = false; binding[channelId] = object; if (env0_13[channelId] != null) { property = env0_13[channelId]; delete env0_13[channelId]; r4 = property.indexOf('all') === 1 ? property : null; HTTP = (require(507) /* metro dependency 507: HTTPUtils */).HTTP; post = HTTP.post; object = {}; object.url = Endpoints.CALL_RING(channelId); object.body = {recipients: r4}; object.oldFormErrors = true; object.rejectWithError = true; Reflect.apply(post, HTTP, [object]); } } function CALL_UPDATE({channelId, messageId, region, ongoingRings}) { // fn#35466, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4430:2431, offset: 0x010733cf, size: 146 bytes, params: 2, frame: 18 const property = env0_12[channelId]; const r4 = property != null && (property.regionUpdated || property.region !== region); const binding = env0_12; const object = {}; copyDataProperties(object, binding[channelId], undefined); object['messageId'] = messageId; object['region'] = region; const Object = global.Object; object['ringing'] = Object.keys(ongoingRings); object['regionUpdated'] = r4; binding[channelId] = object; } function CALL_DELETE_35467({channelId, unavailable}) { // fn#35467, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4430:2650, offset: 0x01073461, size: 132 bytes, params: 2, frame: 16 var r2; var object; const property = env0_12[channelId]; const binding = env0_12; if (unavailable !== true) { r2 = {'channelId': null, 'ringing': null, 'messageId': null, 'region': null, 'regionUpdated': false, channelId: channelId, ringing: [], unavailable: unavailable}; } else if (property != null) { object = {}; copyDataProperties(object, property, unavailable); object['unavailable'] = unavailable; r2 = object; } else { r2 = {'channelId': null, 'ringing': null, 'messageId': null, 'region': null, 'regionUpdated': false, channelId: channelId, ringing: [], unavailable: unavailable}; } binding[channelId] = r2; if (env0_13[channelId] != null) { delete env0_13[channelId]; } } function CALL_ENQUEUE_RING({channelId, recipients}) { // fn#35468, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4430:2884, offset: 0x010734e5, size: 93 bytes, params: 2, frame: 18 const binding = env0_13; const defaultImport = Module00022; binding[channelId] = defaultImport.union(env0_13[channelId] ?? [], recipients ?? ['all']); } function VOICE_CHANNEL_SELECT_35469({channelId}) { // fn#35469, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4430:3030, offset: 0x01073542, size: 27 bytes, params: 2, frame: 2 if (channelId == null) { env0_13 = {}; } } } global.__d(_fun35445, 4258, [6, 7, 15, 17, 18, 1379, 1934, 3969, 661, 694, 507, 22, 566, 2]) /* metro module 4258, dependencies: [6, 7, 15, 17, 18, 1379, 1934, 3969, 661, 694, 507, 22, 566, 2] */;