/* Metro module 16226; source: lib/websocketTelemetryHook.android.tsx; dependencies: [2] */ import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ function _fun125470(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#125470, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16434:6, offset: 0x025d9b68, size: 94 bytes, params: 8, frame: 16 const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('lib/websocketTelemetryHook.android.tsx'); exports.installWebsocketTelemetryHook = installWebsocketTelemetryHook; function installWebsocketTelemetryHook(a0) { // fn#125471, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16434:196, offset: 0x025d9bc6, size: 179 bytes, params: 2, frame: 16 var window; var r2; var closure; const env0_0 = a0; if (typeof global.globalThis !== 'undefined') { r2 = global.globalThis; } else if (env0_0 !== undefined) { r2 = env0_0; } else { window = global.window; window = typeof window === 'undefined' ? null : global.window; r2 = window; } let value = undefined; let WebSocket = r2 == null ? value : r2.WebSocket; if (WebSocket != null) { if (!r2.__discordWebsocketTelemetryPatched) { WebSocket = r2.WebSocket; closure = function(a0) { var r5; var r7; var value = copyRestArgs(0, r7); var items = []; arraySpread(items, value, 0, r5); var value3 = apply(WebSocket, items, 0); _fun125474(value3, typeof value[0] === 'string' ? value[0] : value3.url ?? ''); return value3; }; closure.prototype = WebSocket.prototype; global.Object.assign(closure, WebSocket); r2.WebSocket = closure; r2.__discordWebsocketTelemetryPatched = true; } } return value; function installWebsocketTelemetryHookHandleMessage(a0, a1) { // fn#125472, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16434:864, owner: installWebsocketTelemetryHook.handleMessage, offset: 0x025d9c79, size: 539 bytes, params: 3, frame: 22 var r7; var r4; var r2; var URL; var prototype; var value; var uRL; var hostname; var pathname; var HermesInternal; var concat; var error; var split; var property; var value2; var length; var JSON; var parse; var value3; var value4; var value5; var op; var value6; var s; var value7; var t; var value8; var type; var value9; var evt; var value10; var cmd; var value11; var binding; const object = {}; reducibleJoin92: while (true) { reduciblePort94: while (true) { exceptionLanding93: while (true) { reducibleJoin85: while (true) { reduciblePort84: while (true) { exceptionLanding83: while (true) { reducibleJoin3: while (true) { reduciblePort28: while (true) { exceptionLanding27: while (true) { try { URL = global.URL; } catch (error) { break exceptionLanding27; } break reducibleJoin3; } break reduciblePort28; } split = a0.split; value = Reflect.apply(split, a0, ['?']); property = value[0]; value = null; r4 = property === '' ? value : property; r7 = r4; reducibleJoin32: while (true) { if (r7 == null) { break reducibleJoin32; } object.url = r7; break reducibleJoin32; } value = false; value2 = typeof a1; if (value2 !== 'string') { r2 = value; break reduciblePort84; } length = a1.length; if (length > 0) { if (a1[0] !== '{') { r2 = value; break reduciblePort84; } try { JSON = global.JSON; } catch (error) { break exceptionLanding83; } try { parse = JSON.parse; } catch (error) { break exceptionLanding83; } try { value3 = Reflect.apply(parse, JSON, [a1]); } catch (error) { break exceptionLanding83; } try { value4 = value3 != null; } catch (error) { break exceptionLanding83; } reducibleJoin44: while (true) { if (value4) { value5 = typeof value3 === 'object'; r7 = value5; break reducibleJoin44; } r7 = value4; break reducibleJoin44; } reducibleJoin82: while (true) { if (r7) { try { op = value3.op; } catch (error) { break exceptionLanding83; } try { value6 = op == null; } catch (error) { break exceptionLanding83; } reducibleJoin51: while (true) { if (value6) { break reducibleJoin51; } try { op = value3.op; } catch (error) { break exceptionLanding83; } try { object.op = op; } catch (error) { break exceptionLanding83; } break reducibleJoin51; } try { s = value3.s; } catch (error) { break exceptionLanding83; } try { value7 = s == null; } catch (error) { break exceptionLanding83; } reducibleJoin57: while (true) { if (value7) { break reducibleJoin57; } try { s = value3.s; } catch (error) { break exceptionLanding83; } try { object.s = s; } catch (error) { break exceptionLanding83; } break reducibleJoin57; } try { t = value3.t; } catch (error) { break exceptionLanding83; } try { value8 = t == null; } catch (error) { break exceptionLanding83; } reducibleJoin63: while (true) { if (value8) { break reducibleJoin63; } try { t = value3.t; } catch (error) { break exceptionLanding83; } try { object.t = t; } catch (error) { break exceptionLanding83; } break reducibleJoin63; } try { type = value3.type; } catch (error) { break exceptionLanding83; } try { value9 = type == null; } catch (error) { break exceptionLanding83; } reducibleJoin69: while (true) { if (value9) { break reducibleJoin69; } try { type = value3.type; } catch (error) { break exceptionLanding83; } try { object.type = type; } catch (error) { break exceptionLanding83; } break reducibleJoin69; } try { evt = value3.evt; } catch (error) { break exceptionLanding83; } try { value10 = evt == null; } catch (error) { break exceptionLanding83; } reducibleJoin75: while (true) { if (value10) { break reducibleJoin75; } try { evt = value3.evt; } catch (error) { break exceptionLanding83; } try { object.evt = evt; } catch (error) { break exceptionLanding83; } break reducibleJoin75; } try { cmd = value3.cmd; } catch (error) { break exceptionLanding83; } try { value11 = cmd == null; } catch (error) { break exceptionLanding83; } reducibleJoin81: while (true) { if (value11) { break reducibleJoin81; } try { cmd = value3.cmd; } catch (error) { break exceptionLanding83; } try { object.cmd = cmd; } catch (error) { break exceptionLanding83; } break reducibleJoin81; } value = true; r2 = value; break reducibleJoin82; } r2 = value; break reducibleJoin82; } break reduciblePort84; } r2 = value; break reduciblePort84; } try { prototype = URL.prototype; } catch (error) { break exceptionLanding27; } try { } catch (error) { break exceptionLanding27; } try { uRL = new URL(a0); } catch (error) { break exceptionLanding27; } try { value = uRL instanceof Object ? uRL : value; } catch (error) { break exceptionLanding27; } try { hostname = value.hostname; } catch (error) { break exceptionLanding27; } try { pathname = value.pathname; } catch (error) { break exceptionLanding27; } try { value = hostname == null; } catch (error) { break exceptionLanding27; } reducibleJoin30: while (true) { reducibleJoin29: while (true) { if (value) { value = a0.split('?'); property = value[0]; value = null; if (property === '') { r4 = value; break reducibleJoin29; } r4 = property; break reducibleJoin29; } try { value = hostname !== ''; } catch (error) { break exceptionLanding27; } if (value) { try { value = pathname == null; } catch (error) { break exceptionLanding27; } reducibleJoin26: while (true) { reducibleJoin22: while (true) { if (value) { break reducibleJoin22; } try { value = pathname === ''; } catch (error) { break exceptionLanding27; } if (value) { break reducibleJoin22; } try { value = pathname !== '/'; } catch (error) { break exceptionLanding27; } if (value) { try { HermesInternal = global.HermesInternal; } catch (error) { break exceptionLanding27; } try { concat = HermesInternal.concat; } catch (error) { break exceptionLanding27; } try { value = '' + hostname + pathname; } catch (error) { break exceptionLanding27; } r7 = value; break reducibleJoin26; } break reducibleJoin22; } r7 = hostname; break reducibleJoin26; } break reducibleJoin30; } split = a0.split; value = Reflect.apply(split, a0, ['?']); property = value[0]; value = null; if (property === '') { r4 = value; break reducibleJoin29; } r4 = property; break reducibleJoin29; } r7 = r4; break reducibleJoin30; } reducibleJoin32: while (true) { if (r7 == null) { break reducibleJoin32; } object.url = r7; break reducibleJoin32; } value = false; value2 = typeof a1; if (value2 !== 'string') { r2 = value; break reduciblePort84; } length = a1.length; if (length > 0) { if (a1[0] !== '{') { r2 = value; break reduciblePort84; } try { JSON = global.JSON; } catch (error) { break exceptionLanding83; } try { parse = JSON.parse; } catch (error) { break exceptionLanding83; } try { value3 = Reflect.apply(parse, JSON, [a1]); } catch (error) { break exceptionLanding83; } try { value4 = value3 != null; } catch (error) { break exceptionLanding83; } reducibleJoin44: while (true) { if (value4) { value5 = typeof value3 === 'object'; r7 = value5; break reducibleJoin44; } r7 = value4; break reducibleJoin44; } reducibleJoin82: while (true) { if (r7) { try { op = value3.op; } catch (error) { break exceptionLanding83; } try { value6 = op == null; } catch (error) { break exceptionLanding83; } reducibleJoin51: while (true) { if (value6) { break reducibleJoin51; } try { op = value3.op; } catch (error) { break exceptionLanding83; } try { object.op = op; } catch (error) { break exceptionLanding83; } break reducibleJoin51; } try { s = value3.s; } catch (error) { break exceptionLanding83; } try { value7 = s == null; } catch (error) { break exceptionLanding83; } reducibleJoin57: while (true) { if (value7) { break reducibleJoin57; } try { s = value3.s; } catch (error) { break exceptionLanding83; } try { object.s = s; } catch (error) { break exceptionLanding83; } break reducibleJoin57; } try { t = value3.t; } catch (error) { break exceptionLanding83; } try { value8 = t == null; } catch (error) { break exceptionLanding83; } reducibleJoin63: while (true) { if (value8) { break reducibleJoin63; } try { t = value3.t; } catch (error) { break exceptionLanding83; } try { object.t = t; } catch (error) { break exceptionLanding83; } break reducibleJoin63; } try { type = value3.type; } catch (error) { break exceptionLanding83; } try { value9 = type == null; } catch (error) { break exceptionLanding83; } reducibleJoin69: while (true) { if (value9) { break reducibleJoin69; } try { type = value3.type; } catch (error) { break exceptionLanding83; } try { object.type = type; } catch (error) { break exceptionLanding83; } break reducibleJoin69; } try { evt = value3.evt; } catch (error) { break exceptionLanding83; } try { value10 = evt == null; } catch (error) { break exceptionLanding83; } reducibleJoin75: while (true) { if (value10) { break reducibleJoin75; } try { evt = value3.evt; } catch (error) { break exceptionLanding83; } try { object.evt = evt; } catch (error) { break exceptionLanding83; } break reducibleJoin75; } try { cmd = value3.cmd; } catch (error) { break exceptionLanding83; } try { value11 = cmd == null; } catch (error) { break exceptionLanding83; } reducibleJoin81: while (true) { if (value11) { break reducibleJoin81; } try { cmd = value3.cmd; } catch (error) { break exceptionLanding83; } try { object.cmd = cmd; } catch (error) { break exceptionLanding83; } break reducibleJoin81; } value = true; r2 = value; break reducibleJoin82; } r2 = value; break reducibleJoin82; } break reduciblePort84; } r2 = value; break reduciblePort84; } r2 = value; break reduciblePort84; } reducibleJoin86: while (true) { if (r2) { break reducibleJoin86; } break reducibleJoin85; } reducibleJoin88: while (true) { if (r2) { break reducibleJoin88; } value = value2 === 'string'; r2 = value; break reducibleJoin88; } reducibleJoin90: while (true) { if (r2) { break reducibleJoin90; } object.type = 'binary'; break reducibleJoin90; } value = environment; try { binding = env0_0; } catch (error) { break exceptionLanding93; } break reducibleJoin92; } value = a1 == null; r2 = value; reducibleJoin88: while (true) { if (r2) { break reducibleJoin88; } value = value2 === 'string'; r2 = value; break reducibleJoin88; } reducibleJoin90: while (true) { if (r2) { break reducibleJoin90; } object.type = 'binary'; break reducibleJoin90; } value = environment; try { binding = env0_0; } catch (error) { break exceptionLanding93; } break reducibleJoin92; } break reduciblePort94; } return undefined; } try { binding(object); } catch (error) { break exceptionLanding93; } } function installWebsocketTelemetryHookWebSocket(a0) { // fn#125473, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16434:481, owner: installWebsocketTelemetryHook.WebSocket, offset: 0x025d9e94, size: 102 bytes, params: 2, frame: 16 const value = copyRestArgs(0, undefined); const items2 = []; arraySpread(items2, value, 0, undefined); const value3 = apply(WebSocket, items2, 0); ((a0, a1) => { var env0_0 = a1; if (typeof a0.addEventListener === 'function') { a0.addEventListener('message', _fun125475); } })(value3, typeof value[0] === 'string' ? value[0] : value3.url ?? ''); return value3; function attachListener(a0, a1) { // fn#125474, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16434:523, owner: installWebsocketTelemetryHook.WebSocket.attachListener, offset: 0x025d9efa, size: 56 bytes, params: 3, frame: 13 const env0_0 = a1; if (typeof a0.addEventListener === 'function') { a0.addEventListener('message', _fun125475); } function _fun125475(a0) { // fn#125475, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16434:621, offset: 0x025d9f32, size: 43 bytes, params: 2, frame: 15 let value = environment.__proto__.__proto__; const installWebsocketTelemetryHookHandleMessageBinding = installWebsocketTelemetryHookHandleMessage; value = undefined; installWebsocketTelemetryHookHandleMessageBinding(require, a0 == null ? value : a0.data); return value; } } } } } global.__d(_fun125470, 16226, [2]) /* metro module 16226, dependencies: [2] */;