Files
discord-decomp/sources/lib/RTCBandwidthMonitor.tsx
T
2026-07-28 01:06:53 +03:00

252 lines
11 KiB
TypeScript

/* Metro module 4883; source: lib/RTCBandwidthMonitor.tsx; dependencies: [6, 7, 22, 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 Module00022 from '../by-id/module-00022.js'; /* Metro dependency 22 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
function _fun42790(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#42790, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5061:6, offset: 0x01142287, size: 169 bytes, params: 8, frame: 18
const _arrayLikeToArray_42793 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_4 = [];
let value = _fun42794();
(FileImportTrackerModule).fileFinishedImporting('lib/RTCBandwidthMonitor.tsx');
exports.default = value;
exports.getRTCTotalBytes = getRTCTotalBytes;
function _createForOfIteratorHelperLoose_42791(a0, a1) { // fn#42791, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5061:120, offset: 0x01142330, size: 370 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun42792;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_42793(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_42793(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_42793(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun42792;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
function _fun42792() { // fn#42792, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5061:691, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function _fun42794() { // fn#42794, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5061:1041, offset: 0x011424a2, size: 85 bytes, params: 1, frame: 16
return CreateClass(RTCBandwidthMonitor, [{key: 'getTotalBytes', value: value_42797}], [{key: 'create',
value: value_42798}]);
function RTCBandwidthMonitor() { // fn#42795, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5061:1052, offset: 0x011424f7, size: 52 bytes, params: 1, frame: 14
env1_2(this, RTCBandwidthMonitor);
this.bytes = {};
this.record = record_42796;
function RTCBandwidthMonitorRecord(a0) { // fn#42796, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5061:1137, owner: RTCBandwidthMonitor.record, offset: 0x0114252b, size: 350 bytes, params: 2, frame: 31
var r16;
var r3;
var r1;
var rtp;
var inbound;
var value;
var propertyName;
var propertyName2;
var _createForOfIteratorHelperLoose_42791Binding;
var inbound2;
var value3;
var value4;
var done;
var value5;
var type;
var value6;
var bytes;
var bytesReceived;
var value7;
var value8;
var value9;
var value10;
var bytesSent;
var value11;
if (a0 != null) {
rtp = a0.rtp;
inbound = rtp.inbound;
value = environment.__proto__.__proto__;
for (propertyName in inbound) {
_createForOfIteratorHelperLoose_42791Binding = _createForOfIteratorHelperLoose_42791;
rtp = a0.rtp;
inbound2 = rtp.inbound;
value3 = _createForOfIteratorHelperLoose_42791Binding(inbound2[propertyName]);
value4 = value3();
done = value4.done;
if (done) {
r16 = propertyName2;
continue;
}
r3 = value4;
while (true) {
value5 = r3.value;
type = value5.type;
value6 = 'inbound-' + propertyName + '-' + type;
bytes = env0_0.bytes;
if (!(value6 in bytes)) {
env0_0.bytes[value6] = 0;
}
bytes = env0_0.bytes;
bytesReceived = value5.bytesReceived;
bytes[value6] = bytesReceived;
value7 = value3();
done = value7.done;
if (done) {
r16 = propertyName2;
break;
}
r3 = value7;
continue;
}
}
_createForOfIteratorHelperLoose_42791Binding = _createForOfIteratorHelperLoose_42791;
rtp = a0.rtp;
value = _createForOfIteratorHelperLoose_42791Binding(rtp.outbound);
value8 = value();
done = value8.done;
if (!done) {
r1 = value8;
while (true) {
value9 = r1.value;
type = value9.type;
value10 = 'outbound-' + type;
bytes = env0_0.bytes;
if (!(value10 in bytes)) {
env0_0.bytes[value10] = 0;
}
bytes = env0_0.bytes;
bytesSent = value9.bytesSent;
bytes[value10] = bytesSent;
value11 = value();
done = value11.done;
if (done) {
break;
}
r1 = value11;
continue;
}
}
}
}
}
function value_42797() { // fn#42797, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5061:1598, offset: 0x01142689, size: 65 bytes, params: 1, frame: 13
let value = environment.__proto__;
value = importDefault(22) /* metro dependency 22 */;
const sum = value.sum;
const Object = global.Object;
return Reflect.apply(sum, value, [Object.values(this.bytes)]);
}
function value_42798() { // fn#42798, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5061:1679, offset: 0x011426ca, size: 52 bytes, params: 1, frame: 11
const rTCBandwidthMonitor = new RTCBandwidthMonitor();
env1_4.push(rTCBandwidthMonitor);
return rTCBandwidthMonitor.record;
}
}
function getRTCTotalBytes() { // fn#42799, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5061:1848, offset: 0x011426fe, size: 59 bytes, params: 1, frame: 13
const defaultImport = Module00022;
const sum = defaultImport.sum;
const binding = env0_4;
return Reflect.apply(sum, defaultImport, [binding.map(function(a0) {
return a0.getTotalBytes();
})]);
}
}
global.__d(_fun42790, 4883, [6, 7, 22, 2]) /* metro module 4883, dependencies: [6, 7, 22, 2] */;