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

88 lines
4.1 KiB
TypeScript

/* Metro module 4136; source: utils/FileSizeUtils.tsx; dependencies: [1244, 2] */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as IndexNativeModule from '../intl/index.native.tsx'; /* Metro dependency 1244 */
function _fun34338(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#34338, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4307:6, offset: 0x01053560, size: 151 bytes, params: 8, frame: 19
const env0_0 = require;
const formatSize2 = formatSize;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = {'useKibibytes': false, 'showDecimalForGB': true, 'useSpace': true};
(FileImportTrackerModule).fileFinishedImporting('utils/FileSizeUtils.tsx');
exports.BYTE_IN_KB = 1024;
exports.KB_IN_MB = 1024;
exports.formatSize = formatSize2;
exports.formatKbSize = formatKbSize;
function formatSize(a0) { // fn#34339, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4307:155, offset: 0x010535f7, size: 332 bytes, params: 2, frame: 19
var useSpace;
const intl = (IndexNativeModule).intl;
var formatToPlainString;
const t = (IndexNativeModule).t;
let value = a1;
let r0 = value !== undefined ? value : env0_3;
let useKibibytes = r0.useKibibytes;
value = 1000;
const r7 = useKibibytes ? env0_2 : value;
useKibibytes = r0.useKibibytes;
const r1 = useKibibytes ? 1024 : value;
let Math = global.Math;
value = Math.ceil(a0 / r7);
if (value < r1) {
useSpace = r0.useSpace;
formatToPlainString = intl.formatToPlainString;
r0 = useSpace ? Reflect.apply(formatToPlainString, intl, [t.cS889N,
{size: value}]) : Reflect.apply(formatToPlainString, intl, [t.pIn7Af, {size: value}]);
return r0;
}
value /= r1;
const showDecimalForGB = r0.showDecimalForGB;
Math = global.Math;
const round = Math.round;
const r8 = showDecimalForGB ? Reflect.apply(round, Math, [10 * value]) / 10 : Reflect.apply(round, Math, [value]);
useSpace = r0.useSpace;
formatToPlainString = intl.formatToPlainString;
return useSpace ? Reflect.apply(formatToPlainString, intl, [t.yhEXX7,
{size: r8}]) : Reflect.apply(formatToPlainString, intl, [t.TbMX9D, {size: r8}]);
}
function formatKbSize(a0) { // fn#34340, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4307:727, offset: 0x01053743, size: 229 bytes, params: 2, frame: 19
var useSpace;
var intl;
var formatToPlainString;
var t;
var kEk9pr;
var object;
var bTzRR6;
let value = a1;
const r4 = value !== undefined ? value : env0_3;
let useKibibytes = r4.useKibibytes;
value = 1000;
const value3 = a0 / (useKibibytes ? 1024 : value);
useKibibytes = r4.useKibibytes;
let r0 = useKibibytes ? env0_2 : value;
if (value3 / r0 >= 1) {
r0 = formatSize(value3, r4);
} else {
useSpace = r4.useSpace;
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
formatToPlainString = intl.formatToPlainString;
t = (require(1244) /* metro dependency 1244: indexNative */).t;
if (useSpace) {
bTzRR6 = t.bTzRR6;
object = {};
object.size = global.Math.ceil(value3);
r0 = Reflect.apply(formatToPlainString, intl, [bTzRR6, object]);
} else {
kEk9pr = t.kEk9pr;
object = {};
object.size = global.Math.ceil(value3);
r0 = Reflect.apply(formatToPlainString, intl, [kEk9pr, object]);
}
}
return r0;
}
}
global.__d(_fun34338, 4136, [1244, 2]) /* metro module 4136, dependencies: [1244, 2] */;