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

218 lines
9.3 KiB
TypeScript

/* Metro module 7131; source: lib/Histogram.tsx; dependencies: [6, 7, 7132, 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 * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as Module07132Module from '../by-id/module-07132.js'; /* Metro dependency 7132 */
function _fun57033(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57033, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7309:6, offset: 0x013da7e7, size: 150 bytes, params: 8, frame: 19
const env0_0 = require;
const _arrayLikeToArray_57036 = 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});
let value = _fun57037();
(FileImportTrackerModule).fileFinishedImporting('lib/Histogram.tsx');
exports.Histogram = value;
function _createForOfIteratorHelperLoose_57034(a0, a1) { // fn#57034, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7309:120, offset: 0x013da87d, 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 _fun57035;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_57036(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_57036(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_57036(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun57035;
}
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 _fun57035() { // fn#57035, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7309: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 _fun57037() { // fn#57037, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7309:1036, offset: 0x013da9ef, size: 147 bytes, params: 1, frame: 15
return CreateClass(Histogram, [{key: 'getSamples', value: function() {
return this.samples;
}}, {key: 'addSample', value: value_57040}, {key: 'addSamples', value: value_57041}, {key: 'getReport',
value: value_57043}, {key: 'getPercentile', value: function(a0) {
return this.digest.percentile(a0 / 100) ?? 0;
}}]);
function Histogram() { // fn#57038, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7309:1057, offset: 0x013daa82, size: 99 bytes, params: 1, frame: 14
const value = environment.__proto__;
env1_2(this, Histogram);
const Digest = (Module07132Module).Digest;
this.digest = new Digest();
this.total = 0;
this.samples = 0;
this.totalWeight = 0;
}
function value_57040(a0) { // fn#57040, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7309:1259, offset: 0x013daaf0, size: 144 bytes, params: 2, frame: 17
let value = a1;
const r5 = value !== undefined ? value : 1;
this.total = this.total + a0 * r5;
this.totalWeight = this.totalWeight + r5;
const samples = this.samples;
this.samples = typeof samples === 'bigint' ? samples + 1n : +samples + 1;
value = environment.__proto__;
const TDigest = (Module07132Module).TDigest;
const push = TDigest.prototype.push;
push.call(this.digest, a0, r5);
this.digest.check_continuous();
}
function value_57041(a0) { // fn#57041, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7309:1437, offset: 0x013dab80, size: 180 bytes, params: 2, frame: 18
var environment;
let value = a1;
const r5 = value !== undefined ? value : 1;
this.total = this.total + a0.reduce(_fun57042, 0);
this.totalWeight = this.totalWeight + r5 * a0.length;
this.samples = this.samples + a0.length;
value = environment.__proto__;
const TDigest = (Module07132Module).TDigest;
const push = TDigest.prototype.push;
push.call(this.digest, a0, r5);
this.digest.check_continuous();
function _fun57042(a0, a1) { // fn#57042, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7309:1475, offset: 0x013dac34, size: 23 bytes, params: 3, frame: 2
return a0 + a1 * env0_0;
}
}
function value_57043() { // fn#57043, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7309:1654, offset: 0x013dac4b, size: 268 bytes, params: 1, frame: 20
var r5;
var r0;
var value4;
var digest;
var value5;
var value6;
let value = a0;
const r2 = value !== undefined ? value : [25, 50, 75, 90, 95];
const object = {};
value = environment.__proto__;
value = _createForOfIteratorHelperLoose_57034(r2);
const value2 = value();
let done = value2.done;
const value3 = 0;
if (!done) {
r5 = value2;
while (true) {
value4 = r5.value;
digest = this.digest;
value5 = digest.percentile(value4 / 100);
r0 = value5 ?? value3;
object[value4] = r0;
value6 = value();
done = value6.done;
if (done) {
break;
}
r5 = value6;
continue;
}
}
const object2 = {};
object2.min = this.digest.percentile(value3) ?? value3;
object2.max = this.digest.percentile(1) ?? value3;
object2.count = this.digest.size() ?? value3;
object2.percentiles = object;
object2.mean = this.totalWeight > value3 ? this.total / this.totalWeight : value3;
object2.samples = this.samples;
return object2;
}
}
}
global.__d(_fun57033, 7131, [6, 7, 7132, 2]) /* metro module 7131, dependencies: [6, 7, 7132, 2] */;