/* Metro module 15818; source: modules/rtc/RTCLatencyTestManager.tsx; dependencies: [6, 7, 15, 17, 18, 4259, 4402, 4291, 672, 3, 15819, 477, 4860, 2] */ import Logger from '../debug/Logger.tsx'; /* Metro dependency 3 */ 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 Durations from '../../utils/Durations.tsx'; /* Metro dependency 672 */ import MediaEngineStore from '../../stores/MediaEngineStore.tsx'; /* Metro dependency 4259 */ import RTCRegionStore from '../../stores/RTCRegionStore.tsx'; /* Metro dependency 4402 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../external/discord_common/js/packages/media-engine/Constants.tsx'; /* Metro dependency 4291 */ import * as RTCLatencyTestActionCreatorsModule from '../../actions/RTCLatencyTestActionCreators.tsx'; /* Metro dependency 15819 */ function _fun121563(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#121563, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16026:6, offset: 0x0254af89, size: 401 bytes, params: 8, frame: 20 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; let SECOND = Millis.SECOND; const env0_11 = 1 * SECOND; Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; SECOND = Millis.SECOND; const env0_12 = 30 * SECOND; let value = Logger; value = new value('RTCLatencyTestManager'); value.enableNativeLogger(true); value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */; value = _fun121567(value); value = new value(); (FileImportTrackerModule).fileFinishedImporting('modules/rtc/RTCLatencyTestManager.tsx'); exports.default = value; function _isNativeReflectConstruct_121564() { // fn#121564, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16026:187, offset: 0x0254b11a, 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_121564_isNativeReflectConstruct = function() { return !!result; })(); } function _fun121567(a0) { // fn#121567, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16026:512, offset: 0x0254b17c, size: 72 bytes, params: 2, frame: 15 const RTCLatencyTestManager2 = RTCLatencyTestManager; Inherits(RTCLatencyTestManager2, a0); return CreateClass(RTCLatencyTestManager2, [{key: '_terminate', value: function() { if (this.refetchTimeout != null) { global.clearTimeout(this.refetchTimeout); } }}]); function RTCLatencyTestManager(a0) { // fn#121568, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16026:524, offset: 0x0254b1c4, size: 191 bytes, params: 2, frame: 20 var r0; var Reflect; let value = copyRestArgs(0, undefined); let binding = env1_3; binding(this, RTCLatencyTestManager); const items2 = []; arraySpread(items2, value, 0, items2); value = env1_6(RTCLatencyTestManager); binding = env1_5; if (_isNativeReflectConstruct_121564()) { Reflect = global.Reflect; value = Reflect.construct(value, items2, env1_6(this).constructor); r0 = value; } else { value = value.apply(this, items2); r0 = value; } value = binding(this, r0); value.actions = {POST_CONNECTION_OPEN: POST_CONNECTION_OPEN_121569}; value._handleTestRegionsResponse = _handleTestRegionsResponse; value._fetchAndScheduleRefetch = _fetchAndScheduleRefetch; value._handleConnectionOpen = _handleConnectionOpen_121577; return value; function RTCLatencyTestManagerPOST_CONNECTION_OPEN() { // fn#121569, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16026:805, owner: RTCLatencyTestManager.POST_CONNECTION_OPEN, offset: 0x016c0abe, size: 19 bytes, params: 1, frame: 9 return env0_0._handleConnectionOpen(); } function _handleTestRegionsResponse(a0) { // fn#121570, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16026:865, owner: RTCLatencyTestManager._handleTestRegionsResponse, offset: 0x0254b283, size: 168 bytes, params: 2, frame: 16 var binding; let value = a0.map(function(a0) { return a0.region; }); const rtcRegionStoreBinding = RTCRegionStore; if (rtcRegionStoreBinding.shouldPerformLatencyTest(value)) { value = MediaEngineStore.getMediaEngine(); value = value.rankRtcRegions(a0); value = value.then(_fun121572); value.catch(_fun121573); } else { binding = env2_13; binding.verbose('RTC cached ranked preferred regions are ' + RTCRegionStore.getPreferredRegions()); } function _fun121572(a0) { // fn#121572, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16026:969, offset: 0x0254b336, size: 71 bytes, params: 2, frame: 14 const value = environment.__proto__.__proto__.__proto__; env3_13.verbose('RTC region latency test completed, ranked regions are: ', a0); (RTCLatencyTestActionCreatorsModule).completeRTCLatencyTest(a0, env0_0); } function _fun121573(a0) { // fn#121573, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16026:1091, offset: 0x0254b37d, size: 22 bytes, params: 2, frame: 11 return env3_13.warn(a0); } } function _fetchAndScheduleRefetch() { // fn#121574, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16026:1214, owner: RTCLatencyTestManager._fetchAndScheduleRefetch, offset: 0x0254b393, size: 180 bytes, params: 1, frame: 16 const mediaEngineStoreBinding = MediaEngineStore; const supports = mediaEngineStoreBinding.supports; const PORT_AWARE_LATENCY_TESTING = Features.PORT_AWARE_LATENCY_TESTING; (require(15819) /* metro dependency 15819: RTCLatencyTestActionCreators */).fetchRTCLatencyTestRegions(Reflect.apply(supports, mediaEngineStoreBinding, [PORT_AWARE_LATENCY_TESTING]) ? 2 : 1).then(_fun121575).catch(_fun121576); const binding = env0_0; const setTimeout = global.setTimeout; const _fetchAndScheduleRefetch = binding._fetchAndScheduleRefetch; const Millis = (Durations).Millis; const MINUTE = Millis.MINUTE; binding.refetchTimeout = setTimeout(_fetchAndScheduleRefetch, 360 * MINUTE); function _fun121575({body}) { // fn#121575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16026:1315, offset: 0x0254b447, size: 28 bytes, params: 2, frame: 11 return env1_0._handleTestRegionsResponse(body); } function _fun121576(a0) { // fn#121576, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16026:1364, offset: 0x0254b37d, size: 22 bytes, params: 2, frame: 11 return env3_13.warn(a0); } } function RTCLatencyTestManager_handleConnectionOpen() { // fn#121577, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16026:1486, owner: RTCLatencyTestManager._handleConnectionOpen, offset: 0x0254b463, size: 155 bytes, params: 1, frame: 17 var Math; var floor; var binding; let value = environment.__proto__.__proto__; if ((require(477) /* metro dependency 477: PlatformUtils */).isPlatformEmbedded) { Math = global.Math; floor = Math.floor; binding = env2_11; value = Reflect.apply(floor, Math, [binding + global.Math.random() * env2_12]); if (env0_0.refetchTimeout != null) { global.clearTimeout(env0_0.refetchTimeout); } binding = env0_0; binding.refetchTimeout = global.setTimeout(binding._fetchAndScheduleRefetch, value); } } } } } global.__d(_fun121563, 15818, [6, 7, 15, 17, 18, 4259, 4402, 4291, 672, 3, 15819, 477, 4860, 2]) /* metro module 15818, dependencies: [6, 7, 15, 17, 18, 4259, 4402, 4291, 672, 3, 15819, 477, 4860, 2] */;