/* Metro module 7137; source: lib/SystemResources.tsx; dependencies: [5, 6, 7, 7131, 5256, 7138, 2] */ import Module00005 from '../by-id/module-00005.js'; /* Metro dependency 5 */ 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 ProcessUtilsNative from '../utils/ProcessUtils.native.tsx'; /* Metro dependency 5256 */ import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as HistogramModule from './Histogram.tsx'; /* Metro dependency 7131 */ function _fun57111(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57111, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7315:6, offset: 0x013dcbb5, size: 152 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const value = _fun57112(); (FileImportTrackerModule).fileFinishedImporting('lib/SystemResources.tsx'); exports.default = value; function _fun57112() { // fn#57112, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7315:128, offset: 0x013dcc4d, size: 197 bytes, params: 1, frame: 17 const SystemResources2 = SystemResources; const items2 = [{key: 'getStats', value: value_57114}]; items2[1] = {key: 'takeSample', value: value_57115}; const env0_2 = Module00005(_fun57117); items2[2] = {key: 'getCurrentBattery', value: value_57118}; const env0_1 = Module00005(_fun57120); items2[3] = {key: 'setLastBattery', value: value_57121}; const env0_0 = Module00005(_fun57123); items2[4] = {key: 'getBatteryLevelStats', value: value_57124}; return CreateClass(SystemResources2, items2); function SystemResources() { // fn#57113, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7315:149, offset: 0x013dcd12, size: 172 bytes, params: 1, frame: 17 let value = environment.__proto__; env1_4(this, SystemResources); const Histogram = (HistogramModule).Histogram; const value3 = Object.create(Histogram.prototype, {constructor: {value: Histogram}}); let histogram = new Histogram(); this.cpuHistogram = histogram instanceof Object ? histogram : value3; const value5 = Object.create(Histogram.prototype, {constructor: {value: Histogram}}); histogram = new Histogram(); this.memoryHistogram = histogram instanceof Object ? histogram : value5; value = importDefault(5256) /* metro dependency 5256: ProcessUtilsNative */; const getCumulativeCPUUsage = value.getCumulativeCPUUsage; this.startCPU = Reflect.apply(getCumulativeCPUUsage, value, []); this.lastCPU = this.startCPU; this.lastBattery = null; } function value_57114() { // fn#57114, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7315:405, offset: 0x013dcdbe, size: 404 bytes, params: 1, frame: 19 var r2; var usage; var value6; var sampleTime; const report = this.cpuHistogram.getReport(); const report2 = this.memoryHistogram.getReport(); const value4 = undefined; const cumulativeCPUUsage = (ProcessUtilsNative).getCumulativeCPUUsage(); let startCPU = this.startCPU; if (startCPU == null) { r2 = value4; } else if (cumulativeCPUUsage == null) { r2 = value4; } else { usage = cumulativeCPUUsage.usage; startCPU = this.startCPU; value6 = 100 * (usage - startCPU.usage); sampleTime = cumulativeCPUUsage.sampleTime; startCPU = this.startCPU; r2 = value6 / ((sampleTime - startCPU.sampleTime) / 1000); } r2 = r2 ?? report.mean; return {client_performance_cpu_percentile25: report.percentiles[25], client_performance_cpu_percentile50: report.percentiles[50], client_performance_cpu_percentile75: report.percentiles[75], client_performance_cpu_percentile90: report.percentiles[90], client_performance_cpu_percentile95: report.percentiles[95], client_performance_cpu_mean: r2, client_performance_memory_percentile25: report2.percentiles[25], client_performance_memory_percentile50: report2.percentiles[50], client_performance_memory_percentile75: report2.percentiles[75], client_performance_memory_percentile90: report2.percentiles[90], client_performance_memory_percentile95: report2.percentiles[95], client_performance_memory_min: report2.min, client_performance_memory_max: report2.max, client_performance_memory_mean: report2.mean}; } function value_57115() { // fn#57115, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7315:1383, offset: 0x013dcf52, size: 257 bytes, params: 1, frame: 21 var r5; var lastCPU; var value4; let value = environment.__proto__; const cumulativeCPUUsage = (importDefault(5256) /* metro dependency 5256: ProcessUtilsNative */).getCumulativeCPUUsage(); const currentMemoryUsageKB = (importDefault(5256) /* metro dependency 5256: ProcessUtilsNative */).getCurrentMemoryUsageKB(); if (cumulativeCPUUsage != null) { lastCPU = this.lastCPU; value = true; if (lastCPU != null) { value4 = cumulativeCPUUsage.sampleTime - this.lastCPU.sampleTime; if (value4 >= 1) { this.cpuHistogram.addSample((cumulativeCPUUsage.usage - this.lastCPU.usage) / (value4 / 1000) * 100, value4); r5 = value; } else { r5 = false; } } else { r5 = value; } if (r5) { this.lastCPU = cumulativeCPUUsage; } } else { value = importDefault(5256) /* metro dependency 5256: ProcessUtilsNative */; value = value.getCurrentCPUUsagePercent(); if (value != null) { this.cpuHistogram.addSample(value); } } if (currentMemoryUsageKB != null) { this.memoryHistogram.addSample(currentMemoryUsageKB); } } function* _fun57117() { // fn#57117, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7315:1841, offset: 0x013dd05c, size: 84 bytes, params: 1, frame: 13 var binding; var binding2; var property; var getDeviceState; var object; var value3; var batteryLevel; var error; if (false) { return undefined; } value = environment.__proto__.__proto__; try { binding = env2_0; } catch (error) { return null; } try { binding2 = env2_2; } catch (error) { return null; } try { property = binding2[5]; } catch (error) { return null; } try { value = binding(property); } catch (error) { return null; } try { getDeviceState = value.getDeviceState; } catch (error) { return null; } try { object = {}; } catch (error) { return null; } try { object.fallback = false; } catch (error) { return null; } try { value = Reflect.apply(getDeviceState, value, [object]); } catch (error) { return null; } yield value; try { value = undefined; value3 = false; } catch (error) { return null; } if (value3) { return value; } try { batteryLevel = value.batteryLevel; } catch (error) { return null; } return batteryLevel; } function value_57118() { // fn#57118, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7315:1947, offset: 0x00d6b059, size: 30 bytes, params: 1, frame: 13 return env0_2.apply(this, arguments); } function value_57121() { // fn#57121, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7315:2107, offset: 0x00c3b2ba, size: 30 bytes, params: 1, frame: 13 return env0_1.apply(this, arguments); } function value_57124() { // fn#57124, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7315:2482, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13 return env0_0.apply(this, arguments); } } } function* _fun57120() { // fn#57120, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7315:2044, offset: 0x013dd0b9, size: 47 bytes, params: 1, frame: 11 if (true) { var getCurrentBattery = this.getCurrentBattery; yield Reflect.apply(getCurrentBattery, this, []); value = undefined; if (false) { return value; } this.lastBattery = value; } } function* _fun57123() { // fn#57123, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7315:2207, offset: 0x013dd0f1, size: 151 bytes, params: 1, frame: 17 var r2; var object; var Math; var round; if (false) { return undefined; } const getCurrentBattery = this.getCurrentBattery; yield Reflect.apply(getCurrentBattery, this, []); value = undefined; if (false) { return value; } let lastBattery = this.lastBattery; if (lastBattery == null) { r2 = {startBattery: this.lastBattery, currentBattery: value, batteryUsageRounded: null}; } else if (value == null) { r2 = {startBattery: this.lastBattery, currentBattery: value, batteryUsageRounded: null}; } else { object = {}; lastBattery = this.lastBattery; object.startBattery = lastBattery; object.currentBattery = value; Math = global.Math; round = Math.round; lastBattery = this.lastBattery; object.batteryUsageRounded = Reflect.apply(round, Math, [1000 * (value - lastBattery)]) / 1000; r2 = object; } return r2; } global.__d(_fun57111, 7137, [5, 6, 7, 7131, 5256, 7138, 2]) /* metro module 7137, dependencies: [5, 6, 7, 7131, 5256, 7138, 2] */;