/* Metro module 8914; source: stores/ApplicationStreamPreviewStore.tsx; dependencies: [6, 7, 15, 17, 18, 4286, 22, 4285, 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 Flux from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as StreamKeyUtilsModule from '../modules/go_live/utils/StreamKeyUtils.tsx'; /* Metro dependency 4285 */ import * as ConstantsModule from '../modules/go_live/Constants.tsx'; /* Metro dependency 4286 */ function _fun69564(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#69564, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9099:6, offset: 0x01c76ddb, size: 400 bytes, params: 8, frame: 21 const env0_0 = require; const closure = function() { env0_9 = {}; env0_10 = {}; }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let env0_9 = {}; let env0_10 = {}; const Set = global.Set; let set = new Set(); const Store = (Flux).Store; _fun69569(Store).displayName = 'ApplicationStreamPreviewStore'; set = new set(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: closure, LOGOUT: closure, STREAM_PREVIEW_FETCH_START: STREAM_PREVIEW_FETCH_START, STREAM_PREVIEW_FETCH_SUCCESS: STREAM_PREVIEW_FETCH_SUCCESS, STREAM_PREVIEW_FETCH_FAIL: STREAM_PREVIEW_FETCH_FAIL, VOICE_STATE_UPDATES: VOICE_STATE_UPDATES_69578}); (FileImportTrackerModule).fileFinishedImporting('stores/ApplicationStreamPreviewStore.tsx'); exports.default = set; function _isNativeReflectConstruct_69565() { // fn#69565, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9099:170, offset: 0x01c76f6b, size: 98 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_69565_isNativeReflectConstruct = function() { return !!result; })(); } function _fun69569(a0) { // fn#69569, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9099:420, offset: 0x01c76fcd, size: 151 bytes, params: 2, frame: 16 const ApplicationStreamPreviewStore2 = ApplicationStreamPreviewStore; Inherits(ApplicationStreamPreviewStore2, a0); return CreateClass(ApplicationStreamPreviewStore2, [{key: 'getPreviewURL', value: value_69571}, {key: 'shouldFetchPreview', value: value_69572}, {key: 'getPreviewURLForStreamKey', value: value_69573}, {key: 'getIsPreviewLoading', value: value_69574}]); function ApplicationStreamPreviewStore() { // fn#69570, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9099:432, offset: 0x0108afcb, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_3(this, ApplicationStreamPreviewStore); const value3 = env1_6(ApplicationStreamPreviewStore); return env1_5(this, _isNativeReflectConstruct_69565() ? global.Reflect.construct(value3, arguments, env1_6(this).constructor) : value3.apply(this, arguments)); } function value_69571(a0, a1, a2) { // fn#69571, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9099:798, offset: 0x01c77064, size: 117 bytes, params: 4, frame: 17 const value2 = undefined; const property = env1_9[StreamKeyUtilsModule.encodeStreamKey({streamType: a0 != null ? StreamTypes.GUILD : StreamTypes.CALL, guildId: a0, channelId: a1, ownerId: a2})]; return property == null ? value2 : property.url; } function value_69572(a0, a1, a2) { // fn#69572, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9099:982, offset: 0x01c770d9, size: 197 bytes, params: 4, frame: 16 const value = environment.__proto__; const value2 = (require(4285) /* metro dependency 4285: StreamKeyUtils */).encodeStreamKey({streamType: a0 != null ? StreamTypes.GUILD : StreamTypes.CALL, guildId: a0, channelId: a1, ownerId: a2}); const property = env1_9[value2]; const r5 = env1_10[value2] ?? 0; const r2 = property != null && global.Date.now() > property.expires; let r0 = property == null && r5 < 5; r0 = (!r0 ? r2 : r0) && !env1_11.has(value2); return r0; } function value_69573(a0) { // fn#69573, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9099:1235, offset: 0x01c7719e, size: 73 bytes, params: 2, frame: 15 let value = environment.__proto__; value = require(4285) /* metro dependency 4285: StreamKeyUtils */; value = value.decodeStreamKey(a0); return this.getPreviewURL(value.guildId, value.channelId, value.ownerId); } function value_69574(a0, a1, a2) { // fn#69574, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9099:1386, offset: 0x01c771e7, size: 109 bytes, params: 4, frame: 15 return env1_11.has(StreamKeyUtilsModule.encodeStreamKey({streamType: a0 != null ? StreamTypes.GUILD : StreamTypes.CALL, guildId: a0, channelId: a1, ownerId: a2})); } } function STREAM_PREVIEW_FETCH_START({streamKey}) { // fn#69575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9099:1666, offset: 0x01c77254, size: 63 bytes, params: 2, frame: 14 const binding = env0_10; binding[streamKey] = (binding[streamKey] ?? 0) + 1; env0_11.add(streamKey); } function STREAM_PREVIEW_FETCH_SUCCESS({streamKey, previewURL}) { // fn#69576, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9099:1788, offset: 0x01c77293, size: 92 bytes, params: 2, frame: 14 const binding = env0_9; const object = {url: previewURL}; const Date = global.Date; object.expires = Date.now() + 120000; binding[streamKey] = object; env0_10[streamKey] = 0; env0_11.delete(streamKey); } function STREAM_PREVIEW_FETCH_FAIL({streamKey, retryAfter}) { // fn#69577, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9099:1940, offset: 0x01c772ef, size: 100 bytes, params: 2, frame: 16 const binding = env0_9; const object = {url: null}; const Date = global.Date; object.expires = Date.now() + (retryAfter ?? 10000 * env0_10[streamKey]); binding[streamKey] = object; env0_11.delete(streamKey); } function VOICE_STATE_UPDATES_69578({voiceStates}) { // fn#69578, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9099:2095, offset: 0x01c77353, size: 118 bytes, params: 2, frame: 16 var r0; var defaultImport2; const isEmpty2 = (importDefault(22) /* metro dependency 22 */).isEmpty(env0_9); if (isEmpty2) { defaultImport2 = importDefault(22) /* metro dependency 22 */; r0 = !defaultImport2.isEmpty(env0_10); } else { r0 = !isEmpty2; } r0 = r0 && voiceStates.reduce(_fun69579, false); return r0; function _fun69579(a0, a1) { // fn#69579, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9099:2205, offset: 0x01c773c9, size: 136 bytes, params: 3, frame: 17 const userId = a1.userId; const guildId = a1.guildId; const channelId = a1.channelId; if (a1.selfStream) { return a0; } const value2 = (require(4285) /* metro dependency 4285: StreamKeyUtils */).encodeStreamKey({streamType: guildId != null ? StreamTypes.GUILD : StreamTypes.CALL, guildId: guildId, channelId: channelId, ownerId: userId}); delete env1_9[value2]; delete env1_10[value2]; return true; } } } global.__d(_fun69564, 8914, [6, 7, 15, 17, 18, 4286, 22, 4285, 566, 694, 2]) /* metro module 8914, dependencies: [6, 7, 15, 17, 18, 4286, 22, 4285, 566, 694, 2] */;