/* Metro module 7735; source: modules/calls/VideoSpeakerStore.tsx; dependencies: [6, 7, 15, 17, 18, 4492, 1226, 4259, 4607, 4606, 4299, 4285, 22, 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 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 AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */ import MediaEngineStore from '../../stores/MediaEngineStore.tsx'; /* Metro dependency 4259 */ import ApplicationStreamingStore from '../../stores/ApplicationStreamingStore.tsx'; /* Metro dependency 4492 */ import ChannelRTCStore from './ChannelRTCStore.tsx'; /* Metro dependency 4606 */ import SpeakingStore from '../../stores/SpeakingStore.tsx'; /* Metro dependency 4607 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as CallConstantsModule from './CallConstants.tsx'; /* Metro dependency 4299 */ function _fun61916(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#61916, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:6, offset: 0x01b4e36f, size: 444 bytes, params: 8, frame: 22 const env0_0 = require; const _arrayLikeToArray_61922 = 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 updateSpeaker2 = updateSpeaker; const AUDIO_SET_LOCAL_VIDEO_DISABLED_619242 = AUDIO_SET_LOCAL_VIDEO_DISABLED_61924; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_15 = (Module00022).throttle(updateSpeaker2, 300, {trailing: true}); const Store = (Flux).Store; _fun61925(Store).displayName = 'VideoSpeakerStore'; value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {AUDIO_SET_LOCAL_VIDEO_DISABLED: AUDIO_SET_LOCAL_VIDEO_DISABLED_619242}); (FileImportTrackerModule).fileFinishedImporting('modules/calls/VideoSpeakerStore.tsx'); exports.default = value; function _isNativeReflectConstruct_61917() { // fn#61917, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:233, offset: 0x01b4e52b, 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_61917_isNativeReflectConstruct = function() { return !!result; })(); } function _createForOfIteratorHelperLoose_61920(a0, a1) { // fn#61920, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:426, offset: 0x01b4e589, size: 370 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 _fun61921; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_61922(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_61922(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_61922(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun61921; } 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 _fun61921() { // fn#61921, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:997, 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 updateSpeaker() { // fn#61923, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:1336, offset: 0x01b4e6fb, size: 776 bytes, params: 1, frame: 28 var r4; var r5; var r8; var r6; var id; var r9; var r10; var r11; var r14; var r3; var channelRTCStoreBinding; var selectedParticipantId; var isParticipantPoppedOut; var lastActiveStream; var getParticipant; var value8; var binding; var moduleValue; var value11; var id2; var value14; var items3; var items2; var _createForOfIteratorHelperLoose_61920Binding; var value15; var value16; var done; var value17; var value18; var user; var mediaEngineStoreBinding; var isLocalVideoDisabled; var push; var speakingStoreBinding; var getSpeakingDuration; var value19; var value20; var length; var property; var userId; var duration; var value21; var value22; var value23; const value = a0; const value2 = undefined; const r2 = !(value !== value2) || value; const value3 = null; if (value3 == env0_2) { r3 = value3; } else { selectedParticipantId = ChannelRTCStore.getSelectedParticipantId(env0_2); r4 = value3 != selectedParticipantId && ChannelRTCStore.isParticipantPoppedOut(env0_2, selectedParticipantId); r5 = r4 ? value3 : selectedParticipantId; lastActiveStream = ApplicationStreamingStore.getLastActiveStream(); r8 = value3 != r5 ? ChannelRTCStore.getParticipant(env0_2, r5) : value3; value8 = (value3 == r8 ? value2 : r8.type) !== ParticipantTypes.ACTIVITY; if (value8) { r6 = (value3 == r8 ? value2 : r8.type) !== ParticipantTypes.USER || value3 != r8.voiceState && r8.voiceState.selfVideo; r4 = r6; } else { r4 = value8; } r8 = r4 ? r5 : value3; if (value3 == lastActiveStream) { r4 = r8; } else if (value3 != r8) { r4 = r8; } else { channelRTCStoreBinding = ChannelRTCStore; getParticipant = channelRTCStoreBinding.getParticipant; binding = env0_2; moduleValue = require(4285) /* metro dependency 4285: StreamKeyUtils */; value11 = Reflect.apply(getParticipant, channelRTCStoreBinding, [binding, moduleValue.encodeStreamKey(lastActiveStream)]); id = value3 == value11 ? value2 : value11.id; r6 = value3 == id || ChannelRTCStore.isParticipantPoppedOut(env0_2, id); r4 = r6 ? r8 : id; } if (value3 != r4) { r3 = r4; } else { id2 = AuthenticationStore.getId(); value14 = global.Date.now(); items3 = []; items2 = []; _createForOfIteratorHelperLoose_61920Binding = _createForOfIteratorHelperLoose_61920; channelRTCStoreBinding = ChannelRTCStore; value15 = _createForOfIteratorHelperLoose_61920Binding(channelRTCStoreBinding.getVideoParticipants(env0_2)); value16 = value15(); done = value16.done; value17 = 0; if (!done) { r9 = value16; while (true) { value18 = r9.value; user = value18.user; id = user.id; if (id !== id2) { mediaEngineStoreBinding = MediaEngineStore; isLocalVideoDisabled = mediaEngineStoreBinding.isLocalVideoDisabled; user = value18.user; id = user.id; if (Reflect.apply(isLocalVideoDisabled, mediaEngineStoreBinding, [id])) { break; } channelRTCStoreBinding = ChannelRTCStore; isParticipantPoppedOut = channelRTCStoreBinding.isParticipantPoppedOut; binding = env0_2; id = value18.id; if (Reflect.apply(isParticipantPoppedOut, channelRTCStoreBinding, [binding, id])) { break; } push = items3.push; user = value18.user; id = user.id; Reflect.apply(push, items3, [id]); speakingStoreBinding = SpeakingStore; getSpeakingDuration = speakingStoreBinding.getSpeakingDuration; user = value18.user; id = user.id; value19 = Reflect.apply(getSpeakingDuration, speakingStoreBinding, [id, value14]); if (value17 === value19) { break; } push = items2.push; user = value18.user; id = user.id; Reflect.apply(push, items2, [{userId: id, duration: value19}]); break; } value20 = value15(); done = value20.done; if (done) { break; } r9 = value20; continue; } } length = items2.length; if (value17 < length) { r9 = value17; r10 = value2; r11 = value2; while (true) { property = items2[r9]; userId = property.userId; duration = property.duration; value21 = value3 == r10; if (value21) { r14 = value21; } else { value22 = duration < r10; r14 = value22; } if (r14) { r10 = duration; r11 = userId; continue; } continue; value23 = typeof r9 === 'bigint' ? r9 + 1n : +r9 + 1; length = items2.length; if (value23 < length) { r9 = value23; continue; } r6 = r11; break; } } else { r6 = value2; } r3 = value3 != r6 ? r6 : value3 == env0_3 ? items3[value17] : items3.includes(env0_3) ? env0_3 : items3[value17]; } } if (env0_3 !== r3) { if (r2) { env0_16.emitChange(); } } return value2; } function AUDIO_SET_LOCAL_VIDEO_DISABLED_61924() { // fn#61924, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:2389, offset: 0x01b4ea03, size: 17 bytes, params: 1, frame: 9 env0_15(); return false; } function _fun61925(a0) { // fn#61925, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:2443, offset: 0x01b4ea14, size: 93 bytes, params: 2, frame: 16 const VideoSpeakerStoreClass2 = VideoSpeakerStoreClass; Inherits(VideoSpeakerStoreClass2, a0); return CreateClass(VideoSpeakerStoreClass2, [{key: 'initialize', value: function() { this.waitFor(ChannelRTCStore, AuthenticationStore, SpeakingStore, ApplicationStreamingStore, MediaEngineStore); this.syncWith([ChannelRTCStore, ApplicationStreamingStore], AUDIO_SET_LOCAL_VIDEO_DISABLED_61924); }}, {key: 'getSpeaker', value: value_61928}]); function VideoSpeakerStoreClass() { // fn#61926, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:2455, offset: 0x01b4ea71, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_4(this, VideoSpeakerStoreClass); const value3 = env1_7(VideoSpeakerStoreClass); return env1_6(this, _isNativeReflectConstruct_61917() ? global.Reflect.construct(value3, arguments, env1_7(this).constructor) : value3.apply(this, arguments)); } function value_61928(a0) { // fn#61928, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:2888, offset: 0x01b4eb31, size: 69 bytes, params: 2, frame: 12 const value = environment.__proto__; if (env1_2 !== a0) { env1_2 = a0; env1_3 = null; updateSpeaker(false); } return env1_3 ?? AuthenticationStore.getId(); } } } global.__d(_fun61916, 7735, [6, 7, 15, 17, 18, 4492, 1226, 4259, 4607, 4606, 4299, 4285, 22, 566, 694, 2]) /* metro module 7735, dependencies: [6, 7, 15, 17, 18, 4492, 1226, 4259, 4607, 4606, 4299, 4285, 22, 566, 694, 2] */;