/* Metro module 15756; source: modules/js_watchdog/native/JSWatchdogManager.android.tsx; dependencies: [5, 6, 7, 15, 17, 18, 661, 3, 672, 15757, 1216, 683, 4884, 4882, 4875, 4860, 2] */ function _fun120990(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120990, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15964:6, offset: 0x0253c1c5, size: 352 bytes, params: 8, frame: 20 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importDefault(5) /* metro dependency 5 */; const env0_4 = importDefault(6) /* metro dependency 6 */; const env0_5 = importDefault(7) /* metro dependency 7 */; const env0_6 = importDefault(15) /* metro dependency 15 */; const env0_7 = importDefault(17) /* metro dependency 17 */; const env0_8 = importDefault(18) /* metro dependency 18 */; let value = require(661) /* metro dependency 661: Constants */; const env0_9 = value.AppStates; const env0_10 = value.AnalyticEvents; value = importDefault(3) /* metro dependency 3: Logger */; value = new value('JSWatchdogManager'); const Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; const HALF_SECOND = Millis.HALF_SECOND; const env0_12 = 1 * HALF_SECOND; value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */; value = _fun120994(value); value = new value(); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/js_watchdog/native/JSWatchdogManager.android.tsx'); exports.default = value; } function _isNativeReflectConstruct_120991() { // fn#120991, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15964:201, offset: 0x0253c325, 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_120991_isNativeReflectConstruct = function() { return !!result; })(); } function _fun120994(a0) { // fn#120994, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15964:467, offset: 0x0253c387, size: 274 bytes, params: 2, frame: 17 const closure = JSWatchdogManager; env0_8(closure, a0); const binding = env0_5; const items2 = [{key: 'handleAppStateUpdate', value: function({state}) { if (state === AppStates.ACTIVE) { this.startWatchdog(); } else { this.stopWatchdog(); } }}]; items2[1] = {key: 'handleConnectionOpenSupplemental', value: function() { var env0_0 = this; global.setTimeout(_fun121000, 0); }}; const binding2 = env0_3; const env0_2 = binding2(_fun121002); items2[2] = {key: 'ping', value: value_121005}; const env0_1 = binding2(_fun121007); items2[3] = {key: 'startWatchdog', value: value_121008}; items2[4] = {key: 'stopWatchdog', value: value_121009}; items2[5] = {key: 'reportStall', value: value_121010}; let env0_0 = binding2(_fun121012); items2[6] = {key: 'getCurrentSessionId', value: value_121013}; return binding(closure, items2); } function JSWatchdogManager(a0) { // fn#120995, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15964:479, offset: 0x0253c499, size: 207 bytes, params: 2, frame: 20 var r0; var Reflect; let value = copyRestArgs(0, undefined); let binding = env1_4; binding(this, JSWatchdogManager); const items = []; arraySpread(items, value, 0, items); value = env1_7(JSWatchdogManager); binding = env1_6; if (_isNativeReflectConstruct_120991()) { Reflect = global.Reflect; value = Reflect.construct(value, items, env1_7(this).constructor); r0 = value; } else { value = value.apply(this, items); r0 = value; } value = binding(this, r0); value._enabled = true; value._timeoutId = null; value._analyticsReportsRemaining = 3; value._cachedSession = null; value._lastSessionId = null; value._pingCompleted = true; value.actions = {APP_STATE_UPDATE: APP_STATE_UPDATE_120996, CONNECTION_OPEN_SUPPLEMENTAL: CONNECTION_OPEN_SUPPLEMENTAL_120997}; return value; } function value_120999() { // fn#120999, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15964:1184, offset: 0x0253c59e, size: 36 bytes, params: 1, frame: 13 global.setTimeout(_fun121000, 0); } async function _fun121002() { // fn#121002, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15964:1264, offset: 0x0253c5eb, size: 609 bytes, params: 1, frame: 29 var environment; var r1; var r5; var r9; var value; var value2; var value3; var value4; var value5; var getCurrentSessionId; var value6; var value7; var value8; var binding; var binding2; var property; var value9; var value10; var binding3; var value11; var ping; var Date; var now; var value12; var value13; var value14; var value15; var binding4; var value16; var value17; var binding5; var value18; var checkForStallReport; var value19; var value20; var _lastSessionId; var value21; var _analyticsReportsRemaining; var value22; var value23; var value24; var reportStall; var stopWatchdog; var binding6; var binding7; var disable; var _enabled; var setTimeout; var closure; var error; var binding8; var captureException; exceptionLanding116: while (true) { value = a0; value2 = undefined; value3 = false; if (value3) { return value2; } var env0_0 = this; value4 = undefined; reducibleJoin3: while (true) { if (value !== value4) { r1 = value; break reducibleJoin3; } value = false; r1 = value; break reducibleJoin3; } await value4; value = undefined; value5 = false; if (value5) { return value; } this._pingCompleted = false; reducibleJoin7: while (true) { reduciblePort115: while (true) { exceptionLanding106: while (true) { try { try { getCurrentSessionId = this.getCurrentSessionId; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } break reducibleJoin7; } value = environment.__proto__.__proto__; try { binding = env2_1; } catch (error) { break exceptionLanding116; } try { binding8 = env2_2; } catch (error) { break exceptionLanding116; } try { property = binding8[10]; } catch (error) { break exceptionLanding116; } try { value = binding(property); } catch (error) { break exceptionLanding116; } try { captureException = value.captureException; } catch (error) { break exceptionLanding116; } try { Reflect.apply(captureException, value, [error]); } catch (error) { break exceptionLanding116; } break reduciblePort115; } this._pingCompleted = true; return value4; } try { try { value = Reflect.apply(getCurrentSessionId, this, []); } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } await value; try { try { value = undefined; value6 = false; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } if (value6) { this._pingCompleted = true; return value; } try { try { value7 = value == null; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } if (value7) { try { try { _enabled = this._enabled; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } reducibleJoin104: while (true) { if (_enabled) { try { try { setTimeout = global.setTimeout; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } value = environment.__proto__.__proto__; try { try { binding = env2_12; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { closure = _fun121003; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value = setTimeout(closure, binding); } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { this._timeoutId = value; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } break reducibleJoin104; } break reducibleJoin104; } this._pingCompleted = true; return value4; } value8 = environment.__proto__.__proto__; try { try { binding = env2_1; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { binding2 = env2_2; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { property = binding2[9]; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value9 = binding(property); } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value10 = value9 == null; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } reducibleJoin32: while (true) { if (value10) { r5 = value4; break reducibleJoin32; } try { try { binding = env2_1; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { binding3 = env2_2; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { property = binding3[9]; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value11 = binding(property); } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { ping = value11.ping; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { Date = global.Date; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { now = Date.now; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value12 = Reflect.apply(now, Date, []); } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value13 = Reflect.apply(ping, value11, [value12, value, r1, false]); } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } r5 = value13; break reducibleJoin32; } await r5; try { try { value14 = undefined; value15 = false; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } if (value15) { this._pingCompleted = true; return value14; } reducibleJoin84: while (true) { if (value14) { try { try { binding = env2_1; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { binding4 = env2_2; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { property = binding4[9]; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value16 = binding(property); } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value17 = value16 == null; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } reducibleJoin48: while (true) { if (value17) { r9 = value4; break reducibleJoin48; } try { try { binding = env2_1; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { binding5 = env2_2; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { property = binding5[9]; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value18 = binding(property); } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { checkForStallReport = value18.checkForStallReport; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value19 = Reflect.apply(checkForStallReport, value18, []); } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } r9 = value19; break reducibleJoin48; } try { try { value20 = r9 == null; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } if (value20) { break reducibleJoin84; } try { try { _lastSessionId = this._lastSessionId; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value21 = _lastSessionId === value; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } reducibleJoin57: while (true) { if (value21) { break reducibleJoin57; } try { try { this._lastSessionId = value; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { this._analyticsReportsRemaining = 3; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } break reducibleJoin57; } try { try { _analyticsReportsRemaining = this._analyticsReportsRemaining; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value22 = typeof _analyticsReportsRemaining === 'bigint' ? _analyticsReportsRemaining : +_analyticsReportsRemaining; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value23 = typeof value22 === 'bigint' ? value22 - 1n : +value22 - 1; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { this._analyticsReportsRemaining = value23; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value24 = value22 > 0; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } reducibleJoin68: while (true) { if (value24) { try { try { reportStall = this.reportStall; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { _analyticsReportsRemaining = this._analyticsReportsRemaining; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { Reflect.apply(reportStall, this, [r9, value, false, _analyticsReportsRemaining]); } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } break reducibleJoin68; } break reducibleJoin68; } try { try { _analyticsReportsRemaining = this._analyticsReportsRemaining; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value = _analyticsReportsRemaining !== 0; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } if (value) { break reducibleJoin84; } try { try { stopWatchdog = this.stopWatchdog; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { Reflect.apply(stopWatchdog, this, []); } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { binding = env2_1; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { binding6 = env2_2; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { property = binding6[9]; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value = binding(property); } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value = value == null; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } if (value) { break reducibleJoin84; } try { try { binding = env2_1; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { binding7 = env2_2; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { property = binding7[9]; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value = binding(property); } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { disable = value.disable; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { Reflect.apply(disable, value, []); } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } break reducibleJoin84; } break reducibleJoin84; } try { try { _enabled = this._enabled; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } reducibleJoin92: while (true) { if (_enabled) { try { try { setTimeout = global.setTimeout; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { binding = env2_12; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { closure = _fun121004; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { value = setTimeout(closure, binding); } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } try { try { this._timeoutId = value; } catch (error) { break exceptionLanding106; } } catch (error) { break exceptionLanding116; } break reducibleJoin92; } break reducibleJoin92; } this._pingCompleted = true; return value4; } this._pingCompleted = true; throw error; } function* _fun121007() { // fn#121007, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15964:2057, offset: 0x0253c857, size: 259 bytes, params: 1, frame: 21 var r6; let value = undefined; if (false) { return value; } if (this._timeoutId == null) { value = environment.__proto__.__proto__; var binding = env2_1; var value3 = undefined; if (binding(env2_2[9]) == null) { return undefined; } var getCurrentSessionId = this.getCurrentSessionId; yield Reflect.apply(getCurrentSessionId, this, []); var value4 = undefined; if (false) { return value4; } if (value4 != null) { if (this._lastSessionId !== value4) { env2_11.info('startWatchdog()'); this._enabled = true; if (this._pingCompleted) { if (env2_1(env2_2[9]) == null) { r6 = value3; } else { value = env2_1(env2_2[9]); value = value.checkForStallReport(); r6 = value; } if (r6 != null) { this.reportStall(r6, value4, true, -1); } } this.ping(true); } else if (this._analyticsReportsRemaining !== 0) { env2_11.info('startWatchdog()'); this._enabled = true; if (this._pingCompleted) { if (env2_1(env2_2[9]) == null) { r6 = value3; } else { value = env2_1(env2_2[9]); value = value.checkForStallReport(); r6 = value; } if (r6 != null) { this.reportStall(r6, value4, true, -1); } } this.ping(true); } } } } function value_121009() { // fn#121009, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15964:2490, offset: 0x0253c95a, size: 66 bytes, params: 1, frame: 12 env1_11.info('stopWatchdog()'); this._enabled = false; global.clearTimeout(this._timeoutId); this._timeoutId = null; } function value_121010(a0, a1, a2, a3) { // fn#121010, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15964:2621, offset: 0x0253c99c, size: 188 bytes, params: 5, frame: 19 let value = environment.__proto__; const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */; const track = defaultImport.track; const APP_JS_STALLED = AnalyticEvents.APP_JS_STALLED; const object2 = {}; value = require(4884) /* metro dependency 4884: TTIAnalyticsUtils */; const getDeviceMetadata = value.getDeviceMetadata; copyDataProperties(object2, Reflect.apply(getDeviceMetadata, value, []), undefined); object2['version'] = 1; object2['stall_time'] = a0.stallTime; object2['is_previous'] = a2; object2['reports_remaining'] = a3; let sessionId = a0.sessionId; value = null; sessionId = sessionId === a1 ? value : a0.sessionId; object2['stall_session_id'] = sessionId; object2['trace'] = value; Reflect.apply(track, defaultImport, [APP_JS_STALLED, object2]); } function* _fun121012() { // fn#121012, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15964:2875, offset: 0x0253ca63, size: 149 bytes, params: 1, frame: 14 let value = undefined; if (false) { return value; } if (this._cachedSession == null) { value = environment.__proto__.__proto__; value = env2_0(env2_2[14]); yield value.getSession(); value = undefined; if (false) { return value; } if (value == null) { return null; } this._cachedSession = value; } else { value = environment.__proto__.__proto__; if (Reflect.apply(env2_0(env2_2[13]).isSessionExpired, value, [this._cachedSession])) { value = environment.__proto__.__proto__; value = env2_0(env2_2[14]); yield value.getSession(); value = undefined; if (false) { return value; } if (value == null) { return null; } this._cachedSession = value; return this._cachedSession.uuid; } } return this._cachedSession.uuid; } function _fun121000() { // fn#121000, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15964:1207, offset: 0x0253c5c2, size: 21 bytes, params: 1, frame: 9 env0_0.startWatchdog(); }