Files
discord-decomp/sources/by-id/module-06483-AverageWindow.js
T
2026-07-28 01:06:53 +03:00

48 lines
2.7 KiB
JavaScript

/* Metro module 6483; source: unknown; dependencies: [6374, 6375] */
import ClassCallCheck from './module-06374-ClassCallCheck.js'; /* Metro dependency 6374 */
import CreateClass from './module-06375-CreateClass.js'; /* Metro dependency 6375 */
function _fun51051(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#51051, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6661:6, offset: 0x01227c56, size: 93 bytes, params: 8, frame: 18
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
exports.AverageWindow = _fun51052();
function _fun51052() { // fn#51052, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6661:118, offset: 0x01227cb3, size: 101 bytes, params: 1, frame: 15
return CreateClass(AverageWindow_51053, [{key: 'currentValue', get: function() {
return this.currentAverage;
}}, {key: 'addValue', value: function(a0) {
var r1;
var value = this.getNextIndex();
var property = this.inputValues[value];
r1 = property === undefined ? this.currentCount + 1 : this.currentCount;
this.inputValues[value] = a0;
this.currentAverage = this.currentAverage * (this.currentCount / r1) + (a0 - (property ?? 0)) / r1;
this.currentCount = r1;
}}, {key: 'getNextIndex', value: function() {
var nextIndex = this.nextIndex;
this.nextIndex = (this.nextIndex + 1) % this.inputValues.length;
return nextIndex;
}}]);
function AverageWindow_51053(a0, a1) { // fn#51053, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6661:139, offset: 0x0120e67c, size: 149 bytes, params: 3, frame: 18
const value = a1;
env1_0(this, AverageWindow_51053);
const value4 = 0;
this.nextIndex = value4;
const Array = global.Array;
const Math = global.Math;
const value5 = 1;
const value6 = Math.max(value5, a0);
const value7 = Object.create(Array.prototype, {constructor: {value: Array}});
const array = new Array(value6);
this.inputValues = array instanceof Object ? array : value7;
this.currentAverage = value ?? value4;
this.currentCount = value !== undefined ? value5 : value4;
this.nextIndex = this.currentCount;
this.inputValues[value4] = value;
}
}
}
global.__d(_fun51051, 6483, [6374, 6375]) /* metro module 6483, dependencies: [6374, 6375] */;