/* Metro module 4492; source: stores/ApplicationStreamingStore.tsx; dependencies: [6, 7, 15, 17, 18, 4295, 4266, 1226, 1379, 1867, 4259, 3784, 4294, 1934, 4297, 661, 4286, 4285, 4493, 4494, 4495, 1962, 7118, 12381, 566, 694, 2] */ function _fun38283(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#38283, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:6, offset: 0x010bbb2b, size: 772 bytes, params: 8, frame: 21 const env0_0 = require; const _arrayLikeToArray_38289 = 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 closure = function() { var Map = global.Map; env0_3 = new Map(); env0_4 = {}; env0_5 = {}; env0_6 = {}; }; const closure2 = STREAM_CREATE_38293; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_7 = importDefault(6) /* metro dependency 6 */; const env0_8 = importDefault(7) /* metro dependency 7 */; const env0_9 = importDefault(15) /* metro dependency 15 */; const env0_10 = importDefault(17) /* metro dependency 17 */; const env0_11 = importDefault(18) /* metro dependency 18 */; const gameConsoleStore = importDefault(4295) /* metro dependency 4295: GameConsoleStore */; const runningGameStoreNative = importDefault(4266) /* metro dependency 4266: RunningGameStoreNative */; const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */; const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */; const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */; const mediaEngineStore = importDefault(4259) /* metro dependency 4259: MediaEngineStore */; const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */; const rtcConnectionStore = importDefault(4294) /* metro dependency 4294: RTCConnectionStore */; const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */; const voiceStateStore = importDefault(4297) /* metro dependency 4297: VoiceStateStore */; let value = require(661) /* metro dependency 661: Constants */; const env0_22 = value.ApplicationStreamStates; const env0_23 = value.RTCConnectionStates; const env0_24 = value.ApplicationStreamDeleteReasons; const env0_25 = value.NULL_STRING_GUILD_ID; const env0_26 = value.BasicPermissions; const env0_27 = (require(4286) /* metro dependency 4286: Constants */).StreamTypes; const env0_29 = {}; closure(); const PersistedStore = (importDefault(566) /* metro dependency 566: flux */).PersistedStore; value = _fun38296(PersistedStore); value.displayName = 'ApplicationStreamingStore'; value.persistKey = 'ApplicationStreamingStore'; value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {MEDIA_ENGINE_SET_GO_LIVE_SOURCE: MEDIA_ENGINE_SET_GO_LIVE_SOURCE_38327, NATIVE_SCREEN_SHARE_PICKER_UPDATE: NATIVE_SCREEN_SHARE_PICKER_UPDATE, OVERLAY_INITIALIZE: function({applicationStreamState}) { env0_4 = applicationStreamState.streamsByUserAndGuild; var Map = global.Map; var value3 = new Map(applicationStreamState.activeStreams); env0_5 = applicationStreamState.rtcStreams; env0_6 = applicationStreamState.streamerActiveStreamMetadatas; }, VOICE_STATE_UPDATES: function({voiceStates}) { return voiceStates.reduce(_fun38331, false); }, STREAM_WATCH: STREAM_WATCH_38332, STREAM_START: STREAM_START_38333, STREAM_STOP: STREAM_STOP_38335, STREAM_CREATE: closure2, STREAM_UPDATE: closure2, STREAM_TIMED_OUT: STREAM_TIMED_OUT, STREAM_DELETE: STREAM_DELETE_38337, STREAM_CLOSE: function({streamKey}) { closeActiveStream(streamKey); }, STREAM_UPDATE_SELF_HIDDEN: STREAM_UPDATE_SELF_HIDDEN, SET_STREAM_APP_INTENT: function(a0) { env0_30 = a0.intent; }, RTC_CONNECTION_STATE: RTC_CONNECTION_STATE_38342, CHANNEL_RTC_SELECT_PARTICIPANT: CHANNEL_RTC_SELECT_PARTICIPANT, CONNECTION_OPEN: closure, CONNECTION_CLOSED: closure, LOGOUT: closure}); (require(2) /* metro dependency 2 */).fileFinishedImporting('stores/ApplicationStreamingStore.tsx'); exports.default = value; } function _isNativeReflectConstruct_38284() { // fn#38284, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:432, offset: 0x010bbe2f, 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_38284_isNativeReflectConstruct = function() { return !!result; })(); } function _createForOfIteratorHelperLoose_38287(a0, a1) { // fn#38287, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:625, offset: 0x010bbe8d, 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 _fun38288; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_38289(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_38289(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_38289(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun38288; } 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 getAllStreams() { // fn#38292, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:1642, offset: 0x010bc050, size: 88 bytes, params: 1, frame: 24 var r10; var r3; var propertyName; var propertyName2; var property; var properties4; var properties5; var properties6; var propertyName3; var propertyName4; const items2 = []; for (propertyName in env0_4) { property = env0_4[propertyName]; properties4 = Object.keys(property); properties5 = 0; properties6 = properties4.length; if (properties4 === undefined) { r10 = propertyName2; continue; } for (r3 = properties5; true; r3 = propertyName4) { propertyName3 = properties4[r3]; propertyName4 = r3 + 1; if (propertyName3 === undefined) { r10 = propertyName2; break; } items2.push(env0_4[propertyName][propertyName3]); } } return items2; } function STREAM_CREATE_38293({streamKey, region, viewerIds, paused}) { // fn#38293, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:1773, offset: 0x010bc0a8, size: 144 bytes, params: 2, frame: 20 const binding = env0_3; const set = binding.set; const object2 = {}; const streamKeyUtilsModule = require(4285) /* metro dependency 4285: StreamKeyUtils */; copyDataProperties(object2, streamKeyUtilsModule.decodeStreamKey(streamKey), streamKeyUtilsModule); object2['state'] = paused ? ApplicationStreamStates.PAUSED : ApplicationStreamStates.ACTIVE; Reflect.apply(set, binding, [streamKey, object2]); env0_5[streamKey] = {streamKey: streamKey, region: region, viewerIds: viewerIds}; } function canViewChannel_38294(a0, a1) { // fn#38294, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:1955, offset: 0x010bc138, size: 81 bytes, params: 3, frame: 15 const basicChannel = ChannelStore.getBasicChannel(a1); const CALL = StreamTypes.CALL; return a0 === CALL || basicChannel != null && PermissionStore.canBasicChannel(BasicPermissions.VIEW_CHANNEL, basicChannel); } function isWatchableStream(a0) { // fn#38295, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:2075, offset: 0x010bc189, size: 125 bytes, params: 2, frame: 20 if (canViewChannel_38294(a0.streamType, a0.channelId)) { return true; } const basicChannel = ChannelStore.getBasicChannel(a0.channelId); return basicChannel != null && (require(7118) /* metro dependency 7118: StreamPermissionUtils */).canWatchStream(basicChannel, VoiceStateStore, GuildStore, PermissionStore, GameConsoleStore)[0]; } function _fun38296(a0) { // fn#38296, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:2256, offset: 0x010bc206, size: 567 bytes, params: 2, frame: 16 const closure = ApplicationStreamingStore; env0_11(closure, a0); return env0_8(closure, [{key: 'initialize', value: value_38298}, {key: 'getState', value: value_38300}, {key: 'isSelfStreamHidden', value: value_38301}, {key: 'getLastActiveStream', value: value_38302}, {key: 'getAllActiveStreams', value: value_38303}, {key: 'getAllActiveStreamsForChannel', value: value_38304}, {key: 'getActiveStreamForStreamKey', value: value_38306}, {key: 'getActiveStreamForApplicationStream', value: value_38307}, {key: 'getCurrentUserActiveStream', value: value_38308}, {key: 'getActiveStreamForUser', value: function(a0, a1) { var r0; var env0_0 = a0; var value = this.getStreamForUser(a0, a1); var value2 = null; if (value2 != value) { value = this.getActiveStreamForApplicationStream(value); r0 = value; } else { value = this.getAllActiveStreams(); value = value.find(_fun38310); r0 = value2 != value ? value : value2; } return r0; }}, {key: 'getStreamerActiveStreamMetadata', value: value_38311}, {key: 'getStreamerActiveStreamMetadataForStream', value: value_38312}, {key: 'getIsActiveStreamPreviewDisabled', value: value_38313}, {key: 'getAnyStreamForUser', value: value_38314}, {key: 'getAnyDiscoverableStreamForUser', value: value_38316}, {key: 'getStreamForUser', value: value_38318}, {key: 'getRTCStream', value: value_38319}, {key: 'getAllApplicationStreams', value: value_38320}, {key: 'getAllApplicationStreamsForChannel', value: value_38322}, {key: 'getViewerIds', value: value_38324}, {key: 'getCurrentAppIntent', value: value_38325}, {key: 'getStreamingState', value: value_38326}]); } function MEDIA_ENGINE_SET_GO_LIVE_SOURCE_38327({settings, endReason, errorCode}) { // fn#38327, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:6115, offset: 0x010bcca2, size: 204 bytes, params: 2, frame: 29 var r1; var r9; var r0; var propertyName; var propertyName2; var binding2; var value4; var binding3; var set; var object2; var FAILED; var value5; if (settings?.desktopSettings != null) { return false; } if (settings?.cameraSettings != null) { return false; } if (errorCode == null) { return false; } const properties = Object.keys(env0_6); const properties3 = properties.length; if (properties === undefined) { r0 = false; } else { r1 = false; r9 = 0; while (true) { propertyName = properties[r9]; propertyName2 = r9 + 1; if (propertyName === undefined) { r0 = r1; break; } binding2 = env0_3; value4 = binding2.get(propertyName); if (value4 == null) { r9 = propertyName2; continue; } binding3 = env0_3; set = binding3.set; object2 = {}; copyDataProperties(object2, value4, value4); FAILED = ApplicationStreamStates.FAILED; object2['state'] = FAILED; object2['endReason'] = endReason; object2['errorCode'] = errorCode; Reflect.apply(set, binding3, [propertyName, object2]); value5 = true; r1 = value5; r9 = propertyName2; } } return r0; } function NATIVE_SCREEN_SHARE_PICKER_UPDATE({existing, content}) { // fn#38328, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:6453, offset: 0x010bcd6e, size: 425 bytes, params: 2, frame: 26 var r5; var r6; var r4; var pid; var id; var r1; var r12; var r15; var r0; var value5; var getGameForPID; var value6; var value7; var windows; var value8; var value9; var value10; var owningApplication; var value11; var value12; var value13; var object3; var binding; var value14; var properties; var properties2; var properties3; var propertyName; var propertyName2; var property; var value15; var sourceId; var value16; var startsWith; var value17; var binding2; var object4; var value18; if (content != null) { var _createForOfIteratorHelperLoose_38287Binding = _createForOfIteratorHelperLoose_38287; var applications = content.applications; var value2 = undefined; var value3 = _createForOfIteratorHelperLoose_38287Binding(applications); var value4 = value3(); var done = value4.done; reducibleJoin8: while (true) { reducibleJoin4: while (true) { if (!done) { r5 = value4; reducibleLoop2: while (true) { value5 = r5.value; getGameForPID = RunningGameStoreNative.getGameForPID; id = value5.id; value6 = Reflect.apply(getGameForPID, RunningGameStoreNative, [id]); if (value6 != null) { r4 = value6; break reducibleJoin8; } value7 = value3(); done = value7.done; if (done) { break reducibleJoin4; } r5 = value7; continue reducibleLoop2; } env0_32 = r4; reducibleJoin10: while (true) { if (r4 == null) { pid = value2; break reducibleJoin10; } pid = r4.pid; break reducibleJoin10; } env0_31 = pid; if (existing) { value13 = (importDefault(4494) /* metro dependency 4494: getTitleFromPickedStreamContent */)(content); object3 = {pid: env0_31}; binding = env0_32; reducibleJoin14: while (true) { if (binding == null) { id = value2; break reducibleJoin14; } id = binding.id; break reducibleJoin14; } object3.id = id; reducibleJoin16: while (true) { if (value13 == null) { break reducibleJoin16; } object3.sourceName = value13; break reducibleJoin16; } binding = env0_6; value14 = false; properties = Object.keys(binding); properties2 = 0; properties3 = properties.length; if (properties === value2) { r0 = value14; } else { r1 = value14; r6 = properties2; reducibleLoop17: while (true) { propertyName = properties[r6]; propertyName2 = r6 + 1; if (propertyName === value2) { r0 = r1; break reducibleLoop17; } property = env0_6[propertyName]; value15 = property != null; reducibleJoin20: while (true) { if (value15) { sourceId = property.sourceId; value16 = sourceId != null; r12 = value16; r15 = sourceId; break reducibleJoin20; } r12 = value15; r15 = property; break reducibleJoin20; } reducibleJoin22: while (true) { if (r12) { startsWith = r15.startsWith; value17 = Reflect.apply(startsWith, r15, ['prepicked:']); r12 = value17; break reducibleJoin22; } break reducibleJoin22; } if (r12) { binding2 = env0_6; object4 = {}; copyDataProperties(object4, binding2[propertyName], undefined); copyDataProperties(object4, object3, undefined); binding2[propertyName] = object4; value18 = true; r1 = value18; r6 = propertyName2; continue reducibleLoop17; } r6 = propertyName2; continue reducibleLoop17; } } return r0; } return false; } break reducibleJoin4; } _createForOfIteratorHelperLoose_38287Binding = _createForOfIteratorHelperLoose_38287; windows = content.windows; value8 = _createForOfIteratorHelperLoose_38287Binding(windows); value9 = value8(); done = value9.done; if (done) { r4 = value2; break reducibleJoin8; } r6 = value9; reducibleLoop5: while (true) { value10 = r6.value; owningApplication = value10.owningApplication; if (owningApplication != null) { getGameForPID = RunningGameStoreNative.getGameForPID; owningApplication = value10.owningApplication; id = owningApplication.id; value11 = Reflect.apply(getGameForPID, RunningGameStoreNative, [id]); reducibleJoin7: while (true) { if (value11 != null) { r4 = value11; break reducibleJoin8; } break reducibleJoin7; } } value12 = value8(); done = value12.done; if (done) { r4 = value2; break reducibleJoin8; } r6 = value12; continue reducibleLoop5; } break reducibleJoin8; } env0_32 = r4; reducibleJoin10: while (true) { if (r4 == null) { pid = value2; break reducibleJoin10; } pid = r4.pid; break reducibleJoin10; } env0_31 = pid; if (existing) { value13 = (importDefault(4494) /* metro dependency 4494: getTitleFromPickedStreamContent */)(content); object3 = {pid: env0_31}; binding = env0_32; reducibleJoin14: while (true) { if (binding == null) { id = value2; break reducibleJoin14; } id = binding.id; break reducibleJoin14; } object3.id = id; reducibleJoin16: while (true) { if (value13 == null) { break reducibleJoin16; } object3.sourceName = value13; break reducibleJoin16; } binding = env0_6; value14 = false; properties = Object.keys(binding); properties2 = 0; properties3 = properties.length; if (properties === value2) { r0 = value14; } else { r1 = value14; r6 = properties2; reducibleLoop17: while (true) { propertyName = properties[r6]; propertyName2 = r6 + 1; if (propertyName === value2) { r0 = r1; break reducibleLoop17; } property = env0_6[propertyName]; value15 = property != null; reducibleJoin20: while (true) { if (value15) { sourceId = property.sourceId; value16 = sourceId != null; r12 = value16; r15 = sourceId; break reducibleJoin20; } r12 = value15; r15 = property; break reducibleJoin20; } reducibleJoin22: while (true) { if (r12) { startsWith = r15.startsWith; value17 = Reflect.apply(startsWith, r15, ['prepicked:']); r12 = value17; break reducibleJoin22; } break reducibleJoin22; } if (r12) { binding2 = env0_6; object4 = {}; copyDataProperties(object4, binding2[propertyName], undefined); copyDataProperties(object4, object3, undefined); binding2[propertyName] = object4; value18 = true; r1 = value18; r6 = propertyName2; continue reducibleLoop17; } r6 = propertyName2; continue reducibleLoop17; } } return r0; } } return false; } function VOICE_STATE_UPDATES_38330({voiceStates}) { // fn#38330, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:7352, offset: 0x010bcf6d, size: 32 bytes, params: 2, frame: 13 return voiceStates.reduce(_fun38331, false); } function STREAM_WATCH_38332({streamKey}) { // fn#38332, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:7936, offset: 0x010bd0bd, size: 146 bytes, params: 2, frame: 18 const value2 = (require(4285) /* metro dependency 4285: StreamKeyUtils */).decodeStreamKey(streamKey); let binding = env0_3; binding.delete(streamKey); binding = env0_3; const set = binding.set; const object2 = {}; copyDataProperties(object2, value2, undefined); const CONNECTING = ApplicationStreamStates.CONNECTING; object2['state'] = CONNECTING; Reflect.apply(set, binding, [streamKey, object2]); const ownerId = value2.ownerId; const getId = AuthenticationStore.getId; if (ownerId === Reflect.apply(getId, AuthenticationStore, [])) { env0_29[value2.channelId] = false; } } function STREAM_START_38333({streamType, guildId, channelId, pid, sourceName, sourceId, sourceIcon, previewDisabled}) { // fn#38333, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:8117, offset: 0x010bd14f, size: 407 bytes, params: 2, frame: 25 const streamKeyUtilsModule = require(4285) /* metro dependency 4285: StreamKeyUtils */; const encodeStreamKey = streamKeyUtilsModule.encodeStreamKey; let object2 = {streamType: streamType, guildId: guildId, channelId: channelId}; object2.ownerId = AuthenticationStore.getId(); const value3 = Reflect.apply(encodeStreamKey, streamKeyUtilsModule, [object2]); const r12 = sourceId != null && sourceId.startsWith('prepicked:') && pid == null ? env0_31 : pid; env0_6[value3] = {id: ((sourceId == null ? r12 != null ? RunningGameStoreNative.getGameForPID(r12) : sourceId != null ? RunningGameStoreNative.getRunningGames().find(_fun38334) : null : sourceId.startsWith('prepicked:') && env0_32 != null ? env0_32 : r12 != null ? RunningGameStoreNative.getGameForPID(r12) : sourceId != null ? RunningGameStoreNative.getRunningGames().find(_fun38334) : null) ?? null)?.id, pid: r12, sourceName: sourceName, previewDisabled: previewDisabled, sourceIcon: sourceIcon, sourceId: sourceId}; env0_3.delete(value3); const binding = env0_3; const set = binding.set; object2 = {streamType: streamType, guildId: guildId, channelId: channelId}; object2.ownerId = AuthenticationStore.getId(); const CONNECTING = ApplicationStreamStates.CONNECTING; object2.state = CONNECTING; Reflect.apply(set, binding, [value3, object2]); } function STREAM_STOP_38335({streamKey}) { // fn#38335, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:8752, offset: 0x010bd317, size: 26 bytes, params: 2, frame: 3 env0_6[streamKey] = null; } function STREAM_TIMED_OUT({streamKey}) { // fn#38336, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:8887, offset: 0x010bd331, size: 86 bytes, params: 2, frame: 15 let binding = env0_3; const value2 = binding.get(streamKey); if (value2 == null) { return false; } binding = env0_3; const set = binding.set; const object2 = {}; copyDataProperties(object2, value2, value2); const FAILED = ApplicationStreamStates.FAILED; object2['state'] = FAILED; Reflect.apply(set, binding, [streamKey, object2]); } function STREAM_DELETE_38337({streamKey, unavailable, reason}) { // fn#38337, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:9013, offset: 0x010bd387, size: 362 bytes, params: 2, frame: 19 var r9; var r4; var moduleValue; var guildId; delete env0_5[streamKey]; let binding = env0_3; const value2 = binding.get(streamKey); if (value2 == null) { return false; } let ENDED = ApplicationStreamStates.ENDED; if (unavailable) { r4 = ApplicationStreamStates.RECONNECTING; } else if (reason === ApplicationStreamDeleteReasons.UNAUTHORIZED) { r4 = ApplicationStreamStates.FAILED; } else if (reason === ApplicationStreamDeleteReasons.SAFETY_GUILD_RATE_LIMITED) { moduleValue = require(dependencyMap[17]); guildId = moduleValue.decodeStreamKey(streamKey).guildId; require(dependencyMap[21])(dependencyMap[20], dependencyMap.paths).then(function({default: property}) { property(guildId); }); r4 = ApplicationStreamStates.ENDED; r9 = moduleValue; } else { r4 = value2.state === ApplicationStreamStates.FAILED && reason === ApplicationStreamDeleteReasons.USER_REQUESTED ? ApplicationStreamStates.FAILED : ENDED; } binding = env0_3; const set = binding.set; const object2 = {}; copyDataProperties(object2, value2, r9); object2['state'] = r4; Reflect.apply(set, binding, [streamKey, object2]); ENDED = ApplicationStreamStates.ENDED; if (r4 === ENDED && env0_28 !== streamKey) { closeActiveStream(streamKey); } } function STREAM_UPDATE_SELF_HIDDEN({channelId, selfStreamHidden}) { // fn#38340, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:9578, offset: 0x010bd522, size: 144 bytes, params: 2, frame: 17 var r4; var r7; var binding; const isStreamKey2 = (require(4285) /* metro dependency 4285: StreamKeyUtils */).isStreamKey(env0_28); if (isStreamKey2) { binding = env0_28; r4 = binding != null; r7 = binding; } else { r4 = isStreamKey2; r7 = undefined; } r4 = r4 && r7.includes(AuthenticationStore.getId()) && env0_29[channelId] === false && selfStreamHidden === true; if (r4) { } env0_29[channelId] = selfStreamHidden; } function RTC_CONNECTION_STATE_38342({streamKey, state}) { // fn#38342, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:9848, offset: 0x010bd5c6, size: 232 bytes, params: 2, frame: 16 var r6; var r5; var set; var object2; if (streamKey == null) { return false; } let binding = env0_3; const value2 = binding.get(streamKey); if (value2 == null) { return false; } const state2 = value2.state; const ENDED = ApplicationStreamStates.ENDED; if (state2 === ENDED) { return false; } const state3 = value2.state; const FAILED = ApplicationStreamStates.FAILED; if (state3 !== FAILED) { r5 = RTCConnectionStates.DISCONNECTED === state ? ApplicationStreamStates.RECONNECTING : RTCConnectionStates.RTC_CONNECTED !== state ? value2.state : ApplicationStreamStates.ACTIVE; state = value2.state; if (r5 === state) { return false; } binding = env0_3; set = binding.set; object2 = {}; copyDataProperties(object2, value2, r6); object2['state'] = r5; Reflect.apply(set, binding, [streamKey, object2]); } else { var ownerId = value2.ownerId; var getId = AuthenticationStore.getId; if (ownerId === Reflect.apply(getId, AuthenticationStore, [])) { return false; } r6 = AuthenticationStore; r5 = RTCConnectionStates.DISCONNECTED === state ? ApplicationStreamStates.RECONNECTING : RTCConnectionStates.RTC_CONNECTED !== state ? value2.state : ApplicationStreamStates.ACTIVE; state = value2.state; if (r5 === state) { return false; } binding = env0_3; set = binding.set; object2 = {}; copyDataProperties(object2, value2, r6); object2['state'] = r5; Reflect.apply(set, binding, [streamKey, object2]); } } function CHANNEL_RTC_SELECT_PARTICIPANT({id, channelId}) { // fn#38343, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:10212, offset: 0x010bd6ae, size: 154 bytes, params: 2, frame: 15 const Array = global.Array; const from = Array.from; const binding = env0_3; Reflect.apply(from, Array, [binding.values()]).forEach(_fun38344); if (id != null && (require(4285) /* metro dependency 4285: StreamKeyUtils */).isStreamKey(id) && id.includes(AuthenticationStore.getId())) { env0_29[channelId] = false; } } function ApplicationStreamingStore() { // fn#38297, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:2268, offset: 0x010bc43d, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_7(this, ApplicationStreamingStore); const value3 = env1_10(ApplicationStreamingStore); return env1_9(this, _isNativeReflectConstruct_38284() ? global.Reflect.construct(value3, arguments, env1_10(this).constructor) : value3.apply(this, arguments)); } function value_38298(a0) { // fn#38298, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:2611, offset: 0x010bc4ae, size: 140 bytes, params: 2, frame: 23 var Object; this.syncWith([PermissionStore], function() { return true; }); this.waitFor(AuthenticationStore, ChannelStore, PermissionStore, RTCConnectionStore, RunningGameStoreNative, SelectedChannelStore); const value2 = undefined; if (value2 !== (a0 == null ? value2 : a0.selfStreamParticipantsHidden)) { Object = global.Object; Object.assign(env1_29, a0 == null ? value2 : a0.selfStreamParticipantsHidden); } return value2; } function value_38300() { // fn#38300, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:2822, offset: 0x010bc53a, size: 16 bytes, params: 1, frame: 2 return {selfStreamParticipantsHidden: env1_29}; } function value_38301(a0) { // fn#38301, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:2906, offset: 0x010bc54a, size: 28 bytes, params: 2, frame: 3 const value = environment.__proto__; const property = env1_29[a0]; return property != null && property; } function value_38302() { // fn#38302, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:2984, offset: 0x010bc566, size: 96 bytes, params: 1, frame: 14 var r0; var Array; var from; var binding; let value = environment.__proto__; const value2 = (importDefault(12381) /* metro dependency 12381: canSpectate */)(MediaEngineStore); const value3 = null; if (value2) { Array = global.Array; from = Array.from; binding = env1_3; value = Reflect.apply(from, Array, [binding.values()]); value = value.pop(); r0 = value3 != value ? value : value3; } else { r0 = value3; } return r0; } function value_38303() { // fn#38303, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:3102, offset: 0x010bc5c6, size: 76 bytes, params: 1, frame: 13 const value = environment.__proto__; return (importDefault(12381) /* metro dependency 12381: canSpectate */)(MediaEngineStore) ? global.Array.from(env1_3.values()) : []; } function value_38304(a0) { // fn#38304, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:3203, offset: 0x010bc612, size: 100 bytes, params: 2, frame: 14 var environment; var r0; var Array; var from; var binding; const env0_0 = a0; let value = environment.__proto__; if ((importDefault(12381) /* metro dependency 12381: canSpectate */)(MediaEngineStore)) { Array = global.Array; from = Array.from; binding = env1_3; value = Reflect.apply(from, Array, [binding.values()]); value = value.filter(_fun38305); r0 = value; } else { r0 = []; } return r0; } function value_38306(a0) { // fn#38306, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:3332, offset: 0x010bc68b, size: 72 bytes, params: 2, frame: 13 var r0; let value = environment.__proto__; const value2 = (importDefault(12381) /* metro dependency 12381: canSpectate */)(MediaEngineStore); const value3 = null; if (value2) { value = env1_3.get(a0); r0 = value3 != value ? value : value3; } else { r0 = value3; } return r0; } function value_38307(a0) { // fn#38307, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:3447, offset: 0x010bc6d3, size: 109 bytes, params: 2, frame: 15 var value2; let value = environment.__proto__; if ((importDefault(12381) /* metro dependency 12381: canSpectate */)(MediaEngineStore)) { value2 = null; if (value2 == a0) { return null; } value = require(4285) /* metro dependency 4285: StreamKeyUtils */; value = value.encodeStreamKey(a0); value = this.getActiveStreamForStreamKey(value); return value2 != value ? value : value2; } return null; } function value_38308() { // fn#38308, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:3639, offset: 0x010bc740, size: 81 bytes, params: 1, frame: 15 var r0; var getActiveStreamForUser; let value = environment.__proto__; const channel = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId()); const value4 = null; if (value4 == channel) { r0 = value4; } else { getActiveStreamForUser = this.getActiveStreamForUser; value = AuthenticationStore.getId(); value = Reflect.apply(getActiveStreamForUser, this, [value, channel.getGuildId()]); r0 = value; } return r0; } function value_38309(a0, a1) { // fn#38309, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:3808, offset: 0x010bc791, size: 88 bytes, params: 3, frame: 15 var r0; const env0_0 = a0; let value = this.getStreamForUser(a0, a1); const value2 = null; if (value2 != value) { value = this.getActiveStreamForApplicationStream(value); r0 = value; } else { value = this.getAllActiveStreams(); value = value.find(_fun38310); r0 = value2 != value ? value : value2; } return r0; } function value_38311() { // fn#38311, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:4032, offset: 0x010bc7ff, size: 145 bytes, params: 1, frame: 16 var r1; var binding; var property; let value = environment.__proto__; const channel = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId()); const value4 = null; if (value4 == channel) { return value4; } const getActiveStreamForUser = this.getActiveStreamForUser; const id = AuthenticationStore.getId(); const getGuildId = channel.getGuildId; const value6 = Reflect.apply(getActiveStreamForUser, this, [id, Reflect.apply(getGuildId, channel, [])]); if (value4 == value6) { r1 = value4; } else { binding = env1_6; value = require(4285) /* metro dependency 4285: StreamKeyUtils */; property = binding[value.encodeStreamKey(value6)]; r1 = value4 != property ? property : value4; } return r1; } function value_38312(a0) { // fn#38312, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:4299, offset: 0x010bc890, size: 28 bytes, params: 2, frame: 3 let value = environment.__proto__; const property = env1_6[a0]; value = null; return value != property ? property : value; } function value_38313(a0) { // fn#38313, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:4394, offset: 0x010bc8ac, size: 43 bytes, params: 2, frame: 4 const value = environment.__proto__; const previewDisabled = env1_6[a0]?.previewDisabled; return previewDisabled != null && previewDisabled; } function value_38314(a0) { // fn#38314, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:4507, offset: 0x010bc8d7, size: 114 bytes, params: 2, frame: 13 var environment; var r0; var property; let value = environment.__proto__; const value2 = (importDefault(12381) /* metro dependency 12381: canSpectate */)(MediaEngineStore); const value3 = null; if (value2) { property = env1_4[a0]; if (value3 == property) { r0 = value3; } else { value = global.Object.values(property); value = value.find(function(a0) { return isWatchableStream(a0); }); r0 = value3 != value ? value : value3; } return r0; } return value3; } function value_38316(a0) { // fn#38316, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:4697, offset: 0x010bc95c, size: 114 bytes, params: 2, frame: 13 var environment; var r0; var property; let value = environment.__proto__; const value2 = (importDefault(12381) /* metro dependency 12381: canSpectate */)(MediaEngineStore); const value3 = null; if (value2) { property = env1_4[a0]; if (value3 == property) { r0 = value3; } else { value = global.Object.values(property); value = value.find(_fun38317); r0 = value3 != value ? value : value3; } return r0; } return value3; } function value_38318(a0, a1) { // fn#38318, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:4893, offset: 0x010bc9f0, size: 107 bytes, params: 3, frame: 15 var r2; var property; const value = a1; const value3 = undefined; const value4 = (importDefault(12381) /* metro dependency 12381: canSpectate */)(MediaEngineStore); const value5 = null; if (value4) { property = env1_4[a0]; r2 = value5 == property ? value3 : property[value5 != value ? value : NULL_STRING_GUILD_ID]; return value5 == r2 ? value5 : isWatchableStream(r2) ? r2 : value5; } return value5; } function value_38319(a0) { // fn#38319, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:5060, offset: 0x010bca5b, size: 66 bytes, params: 2, frame: 12 const value2 = (importDefault(12381) /* metro dependency 12381: canSpectate */)(MediaEngineStore); const value3 = null; return value2 && value3 != env1_5[a0] ? env1_5[a0] : value3; } function value_38320() { // fn#38320, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:5160, offset: 0x010bca9d, size: 70 bytes, params: 1, frame: 12 var environment; var r0; let value = environment.__proto__; if ((importDefault(12381) /* metro dependency 12381: canSpectate */)(MediaEngineStore)) { value = getAllStreams(); value = value.filter(_fun38321); r0 = value; } else { r0 = []; } return r0; } function value_38322(a0) { // fn#38322, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:5322, offset: 0x010bcb0b, size: 77 bytes, params: 2, frame: 13 var environment; var r0; const env0_0 = a0; let value = environment.__proto__; if ((importDefault(12381) /* metro dependency 12381: canSpectate */)(MediaEngineStore)) { value = getAllStreams(); value = value.filter(_fun38323); r0 = value; } else { r0 = []; } return r0; } function value_38324(a0) { // fn#38324, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:5480, offset: 0x010bcb93, size: 128 bytes, params: 2, frame: 15 var r3; var r1; let value = a0; if ((importDefault(12381) /* metro dependency 12381: canSpectate */)(MediaEngineStore)) { if (typeof value === 'string') { r3 = value; } else { value = (require(4285) /* metro dependency 4285: StreamKeyUtils */).encodeStreamKey(value); r3 = value; } value = null; r1 = value != r3 ? env1_5[r3] : value; return value != r1 ? r1.viewerIds : []; } return []; } function value_38326() { // fn#38326, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:5718, offset: 0x010bcc13, size: 143 bytes, params: 1, frame: 15 var Array; var from; var binding; const value2 = (importDefault(12381) /* metro dependency 12381: canSpectate */)(MediaEngineStore); const object2 = {}; if (value2) { Array = global.Array; from = Array.from; binding = env1_3; object2.activeStreams = Reflect.apply(from, Array, [binding.entries()]); object2.streamsByUserAndGuild = env1_4; object2.rtcStreams = env1_5; object2.streamerActiveStreamMetadatas = env1_6; } else { object2.activeStreams = []; object2.streamsByUserAndGuild = {}; object2.rtcStreams = {}; object2.streamerActiveStreamMetadatas = {}; } return object2; } function _fun38331(a0, {userId, guildId, channelId, sessionId, selfStream, discoverable}) { // fn#38331, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:7419, offset: 0x010bcf8d, size: 304 bytes, params: 3, frame: 20 var r9; var r6; var r2; var value2; var property; var value7; var object2; var binding; var ownerId; let value = a0; if (selfStream) { if (channelId != null) { object2 = {}; object2.streamType = guildId != null ? StreamTypes.GUILD : StreamTypes.CALL; object2.ownerId = userId; object2.guildId = guildId; object2.channelId = channelId; object2.discoverable = discoverable; value = environment.__proto__; binding = env1_4; ownerId = object2.ownerId; if (binding[ownerId] == null) { env1_4[object2.ownerId] = {}; } binding = env1_4; ownerId = object2.ownerId; property = binding[ownerId]; guildId = object2.guildId; property[guildId ?? NULL_STRING_GUILD_ID] = object2; return true; } value2 = environment.__proto__; } if (userId !== AuthenticationStore.getId()) { r9 = guildId ?? NULL_STRING_GUILD_ID; r6 = env1_4[userId]?.[r9]; value7 = r6 != null; if (value7) { delete env1_4[userId][r9]; r6 = true; } else { r6 = value7; } r6 = !r6 ? value : r6; r2 = r6; } else if (sessionId === AuthenticationStore.getSessionId()) { r9 = guildId ?? NULL_STRING_GUILD_ID; r6 = env1_4[userId]?.[r9]; value7 = r6 != null; if (value7) { delete env1_4[userId][r9]; r6 = true; } else { r6 = value7; } r6 = !r6 ? value : r6; r2 = r6; } else if (RTCConnectionStore.getChannelId() != null) { r2 = value; } else { r9 = guildId ?? NULL_STRING_GUILD_ID; r6 = env1_4[userId]?.[r9]; value7 = r6 != null; if (value7) { delete env1_4[userId][r9]; r6 = true; } else { r6 = value7; } r6 = !r6 ? value : r6; r2 = r6; } return r2; } function _fun38334({windowHandle}) { // fn#38334, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:8508, offset: 0x010bd2e6, size: 49 bytes, params: 2, frame: 13 const value = environment.__proto__; return (importDefault(4493) /* metro dependency 4493: windowSourceMatches */)(sourceId, windowHandle); } function _fun38344(a0) { // fn#38344, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:10298, offset: 0x010bd748, size: 111 bytes, params: 2, frame: 15 var closeActiveStreamBinding; let value = environment.__proto__; if ((require(4285) /* metro dependency 4285: StreamKeyUtils */).encodeStreamKey(a0) !== env1_28 && a0.state === ApplicationStreamStates.ENDED) { closeActiveStreamBinding = closeActiveStream; value = require(4285) /* metro dependency 4285: StreamKeyUtils */; closeActiveStreamBinding(value.encodeStreamKey(a0)); } } function _fun38310({ownerId}) { // fn#38310, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:3958, offset: 0x010bc7e9, size: 22 bytes, params: 2, frame: 2 return ownerId === env0_0; } function _fun38317(a0) { // fn#38317, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:4806, offset: 0x010bc9ce, size: 34 bytes, params: 2, frame: 11 const value = environment.__proto__.__proto__; return isWatchableStream(a0) && a0.discoverable !== false; } function _fun38321(a0) { // fn#38321, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:5214, offset: 0x010bcae3, size: 40 bytes, params: 2, frame: 14 var r0; let value = a0 != null; if (value) { value = environment.__proto__.__proto__; value = canViewChannel_38294(a0.streamType, a0.channelId); r0 = value; } else { r0 = value; } return r0; } function _fun38323(a0) { // fn#38323, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4670:5377, offset: 0x010bcb58, size: 59 bytes, params: 2, frame: 14 let value = a0 != null; let r0 = value && a0.channelId === env0_0; if (r0) { value = environment.__proto__.__proto__; value = canViewChannel_38294(a0.streamType, a0.channelId); r0 = value; } return r0; }