116 lines
5.8 KiB
TypeScript
116 lines
5.8 KiB
TypeScript
/* Metro module 10247; source: modules/user_profile/hooks/useActivityTimer.tsx; dependencies: [57, 31, 672, 8375, 4041, 2] */
|
|
function _fun79580(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#79580, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10433:6, offset: 0x01e58fbb, size: 198 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(57) /* metro dependency 57 */;
|
|
const value = require(31) /* metro dependency 31 */;
|
|
const env0_4 = value.useEffect;
|
|
const env0_5 = value.useState;
|
|
const pad_79582 = function(a0) {
|
|
return (0, global.String)(a0).padStart(2, '0');
|
|
};
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/user_profile/hooks/useActivityTimer.tsx');
|
|
exports.default = useActivityTimer;
|
|
exports.formatTime = formatTime;
|
|
exports.formatTimeForA11yLabel = formatTimeForA11yLabel;
|
|
}
|
|
|
|
function extractTimeComponents(a0) { // fn#79581, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10433:165, offset: 0x01e59081, size: 191 bytes, params: 2, frame: 18
|
|
let Math = global.Math;
|
|
let floor = Math.floor;
|
|
let value = Reflect.apply(floor, Math, [a0]);
|
|
let Seconds = (importDefault(672) /* metro dependency 672: Durations */).Seconds;
|
|
let MINUTE = Seconds.MINUTE;
|
|
value %= MINUTE;
|
|
Math = global.Math;
|
|
floor = Math.floor;
|
|
Seconds = (importDefault(672) /* metro dependency 672: Durations */).Seconds;
|
|
MINUTE = Seconds.MINUTE;
|
|
const value3 = Reflect.apply(floor, Math, [a0 / MINUTE]);
|
|
Seconds = (importDefault(672) /* metro dependency 672: Durations */).Seconds;
|
|
MINUTE = Seconds.MINUTE;
|
|
const value4 = value3 % MINUTE;
|
|
Math = global.Math;
|
|
floor = Math.floor;
|
|
Seconds = (importDefault(672) /* metro dependency 672: Durations */).Seconds;
|
|
const HOUR = Seconds.HOUR;
|
|
return {hours: Reflect.apply(floor, Math, [a0 / HOUR]), minutes: value4, seconds: value};
|
|
}
|
|
|
|
function useActivityTimer({start, end}) { // fn#79583, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10433:468, offset: 0x01e59140, size: 310 bytes, params: 2, frame: 23
|
|
const Interval = (require(4041) /* metro dependency 4041: Timers */).Interval;
|
|
const value2 = Object.create(Interval.prototype, {constructor: {value: Interval}});
|
|
const interval = new Interval();
|
|
const value4 = useState(interval instanceof Object ? interval : value2);
|
|
const binding = env0_3;
|
|
const property = binding(value4, 1)[0];
|
|
const [property2, env0_1] = binding(useState(function() {
|
|
var Date = global.Date;
|
|
return Date.now();
|
|
}), 2);
|
|
useEffect(_fun79585, [property]);
|
|
const value8 = end - start;
|
|
let Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
let SECOND = Millis.SECOND;
|
|
const value = value8 / SECOND;
|
|
let Math = global.Math;
|
|
let max = Math.max;
|
|
const Math2 = global.Math;
|
|
const min = Math2.min;
|
|
const value9 = property2 - start;
|
|
Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
SECOND = Millis.SECOND;
|
|
const value10 = Reflect.apply(max, Math, [Reflect.apply(min, Math2, [value9 / SECOND, value]), 0]);
|
|
Math = global.Math;
|
|
max = Math.max;
|
|
const Math3 = global.Math;
|
|
return {elapsed: value10, duration: value, percentage: Reflect.apply(max, Math, [Math3.min(value10 / value, 1), 0])};
|
|
}
|
|
|
|
function formatTime(a0) { // fn#79588, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10433:853, offset: 0x01e592f3, size: 140 bytes, params: 2, frame: 22
|
|
var r0;
|
|
var pad_79582Binding;
|
|
var value;
|
|
const {hours, minutes, seconds} = extractTimeComponents(a0);
|
|
if (hours === 0) {
|
|
pad_79582Binding = pad_79582;
|
|
value = pad_79582Binding(minutes);
|
|
value = '' + value + ':' + pad_79582Binding(seconds);
|
|
r0 = value;
|
|
} else {
|
|
pad_79582Binding = pad_79582;
|
|
value = pad_79582Binding(hours);
|
|
value = '' + value + ':' + pad_79582Binding(minutes) + ':' + pad_79582Binding(seconds);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function formatTimeForA11yLabel(a0) { // fn#79589, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10433:1015, offset: 0x01e5937f, size: 85 bytes, params: 2, frame: 15
|
|
const {hours, minutes, seconds} = extractTimeComponents(a0);
|
|
const value = require(8375) /* metro dependency 8375: utils */;
|
|
return value.formatTimestampToA11yLabel({hours: hours, minutes: minutes, seconds: seconds});
|
|
}
|
|
|
|
function _fun79585() { // fn#79585, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10433:602, offset: 0x01e59276, size: 73 bytes, params: 1, frame: 15
|
|
const binding = env0_0;
|
|
const start = binding.start;
|
|
const Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
const HALF_SECOND = Millis.HALF_SECOND;
|
|
Reflect.apply(start, binding, [HALF_SECOND, _fun79586]);
|
|
return _fun79587;
|
|
}
|
|
|
|
function _fun79586() { // fn#79586, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10433:643, offset: 0x01e592bf, size: 33 bytes, params: 1, frame: 11
|
|
const value = environment.__proto__;
|
|
const binding = env1_1;
|
|
const Date = global.Date;
|
|
return binding(Date.now());
|
|
}
|
|
|
|
function _fun79587() { // fn#79587, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10433:663, offset: 0x01e592e0, size: 19 bytes, params: 1, frame: 9
|
|
return env1_0.stop();
|
|
}
|
|
|