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

568 lines
24 KiB
JavaScript

/* Metro module 178; source: unknown; dependencies: [44, 179, 63] */
import Module00179 from './module-00179.js'; /* Metro dependency 179 */
import * as Module00044Module from './module-00044.js'; /* Metro dependency 44 */
import * as Module00063Module from './module-00063.js'; /* Metro dependency 63 */
function _fun2581(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#2581, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:6, offset: 0x00c84122, size: 481 bytes, params: 8, frame: 21
var r1;
var callReactNativeMicrotasks;
var queueReactNativeMicrotask;
const env0_1 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_5 = [];
const env0_6 = [];
const env0_7 = [];
const env0_8 = [];
const env0_9 = [];
const env0_10 = [];
const env0_11 = {};
const env0_13 = [];
object = {setTimeout: setTimeout, setInterval: setInterval, queueReactNativeMicrotask: queueReactNativeMicrotask,
requestAnimationFrame: requestAnimationFrame, requestIdleCallback: requestIdleCallback,
cancelIdleCallback: cancelIdleCallback, clearTimeout: function(a0) {
_freeCallback(a0);
}, clearInterval: function(a0) {
_freeCallback(a0);
}, clearReactNativeMicrotask: clearReactNativeMicrotask, cancelAnimationFrame: function(a0) {
_freeCallback(a0);
}, callTimers: callTimers, callIdleCallbacks: callIdleCallbacks,
callReactNativeMicrotasks: callReactNativeMicrotasks, emitTimeDriftWarning: emitTimeDriftWarning};
if (importDefault(179) /* metro dependency 179 */) {
r1 = object;
} else {
global.console.warn("Timing native module is not available, can't set timers.");
r1 = {callReactNativeMicrotasks: object.callReactNativeMicrotasks,
queueReactNativeMicrotask: object.queueReactNativeMicrotask};
}
const property = (Module00063Module).default;
property.setReactNativeMicrotasksCallback(object.callReactNativeMicrotasks);
global._flushReactNativeMicrotasks = _flushReactNativeMicrotasks;
exports.default = r1;
function _allocateCallback(a0, a1) { // fn#2582, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:169, offset: 0x00c84303, size: 78 bytes, params: 3, frame: 12
const binding = env0_12;
const value2 = typeof binding === 'bigint' ? binding : +binding;
env0_12 = typeof value2 === 'bigint' ? value2 + 1n : +value2 + 1;
const value3 = env0_8.pop();
const r3 = value3 !== undefined ? value3 : env0_7.length;
env0_7[r3] = value2;
env0_5[r3] = a0;
env0_6[r3] = a1;
return value2;
}
function _callTimer(a0, a1, a2) { // fn#2583, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:314, offset: 0x00c84351, size: 342 bytes, params: 4, frame: 20
var console;
var property;
var property2;
var error;
var value3;
var value4;
var value5;
var value6;
var value7;
var value8;
var timeRemaining2;
var performance;
var value9;
const env0_0 = a1;
if (a0 > env0_12) {
console = global.console;
console.warn('Tried to call timer with ID %s but no such timer exists.', a0);
}
let binding = env0_7;
const value2 = binding.indexOf(a0);
if (value2 !== -1) {
property = env0_6[value2];
property2 = env0_5[value2];
if (property2) {
if (property) {
if (property !== 'setInterval') {
_clearIndex(value2);
}
try {
value3 = property === 'setTimeout';
if (value3) {
property2();
} else {
value4 = property === 'setInterval';
if (value4) {
property2();
} else {
value5 = property === 'queueReactNativeMicrotask';
if (value5) {
property2();
} else {
value6 = property === 'requestAnimationFrame';
if (value6) {
binding = env0_0;
performance = binding.performance;
value9 = performance.now();
property2(value9);
} else {
value7 = property === 'requestIdleCallback';
if (value7) {
timeRemaining2 = timeRemaining;
property2({timeRemaining: timeRemaining2, didTimeout: !!a2});
} else {
console = global.console;
error = console.error;
value8 = 'Tried to call a callback with invalid type: ' + property;
Reflect.apply(error, console, [value8]);
}
}
}
}
}
} catch (error) {
binding = env0_13;
binding.push(error);
}
} else {
global.console.error('No callback found for timerID ' + a0);
}
} else {
global.console.error('No callback found for timerID ' + a0);
}
}
function timeRemaining() { // fn#2584, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:683, owner: _callTimer.timeRemaining, offset: 0x00c844a7, size: 64 bytes, params: 1, frame: 14
const Math = global.Math;
const max = Math.max;
const value = environment.__proto__;
return Reflect.apply(max, Math, [0, env1_4 - (env1_0.performance.now() - require)]);
}
}
function _callReactNativeMicrotasksPass() { // fn#2585, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:911, offset: 0x00c844e7, size: 91 bytes, params: 1, frame: 16
var r3;
var value3;
let length = env0_9.length;
const value2 = 0;
if (value2 === length) {
return false;
}
const binding = env0_9;
length = binding.length;
if (value2 < length) {
r3 = value2;
reducibleLoop2: while (true) {
_callTimer(binding[r3], value2);
value3 = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
length = binding.length;
if (value3 < length) {
r3 = value3;
continue reducibleLoop2;
}
break reducibleLoop2;
}
}
return [].length > value2;
}
function _clearIndex(a0) { // fn#2586, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:1055, offset: 0x00c84542, size: 50 bytes, params: 2, frame: 12
env0_7[a0] = null;
env0_5[a0] = null;
env0_6[a0] = null;
env0_8.push(a0);
}
function _freeCallback(a0) { // fn#2587, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:1119, offset: 0x00c84574, size: 152 bytes, params: 2, frame: 17
var value;
var value2;
var property;
var moduleValue;
if (a0 != null) {
value2 = env0_7.indexOf(a0);
if (value2 !== -1) {
property = env0_6[value2];
_clearIndex(value2);
if (property !== 'queueReactNativeMicrotask' && property !== 'requestIdleCallback') {
moduleValue = require(44) /* metro dependency 44 */;
value = importDefault(179) /* metro dependency 179 */;
moduleValue(value, 'NativeTiming is available');
value = importDefault(179) /* metro dependency 179 */;
value.deleteTimer(a0);
}
}
}
}
function createTimer(a0, a1, a2, a3) { // fn#2588, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:4021, offset: 0x00c8460c, size: 88 bytes, params: 5, frame: 18
(Module00044Module)(Module00179, 'NativeTiming is available');
(Module00179).createTimer(a0, a1, a2, a3);
}
function setSendIdleEvents(a0) { // fn#2589, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:4127, offset: 0x00c84664, size: 77 bytes, params: 2, frame: 16
(Module00044Module)(Module00179, 'NativeTiming is available');
(Module00179).setSendIdleEvents(a0);
}
function setTimeout(a0, a1) { // fn#2590, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:1393, offset: 0x00c846b1, size: 161 bytes, params: 3, frame: 23
var r3;
var value5;
var value8;
var value9;
const value = a1;
const env0_0 = a0;
const length = arguments.length;
const Array = global.Array;
const value3 = 2;
const value4 = 0;
reducibleJoin2: while (true) {
if (length > value3) {
value5 = length - value3;
r3 = value5;
break reducibleJoin2;
}
r3 = value4;
break reducibleJoin2;
}
const value6 = Object.create(Array.prototype, {constructor: {value: Array}});
const array = new Array();
if (value3 < length) {
r3 = value3;
reducibleLoop3: while (true) {
value8 = r3 - value3;
(array instanceof Object ? array : value6)[value8] = arguments[r3];
value9 = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
if (value9 < length) {
r3 = value9;
continue reducibleLoop3;
}
break reducibleLoop3;
}
}
const value11 = _allocateCallback(_fun2591, 'setTimeout');
const createTimerBinding = createTimer;
const r5 = value || value4;
const Date = global.Date;
createTimerBinding(value11, r5, Date.now(), false);
return value11;
function _fun2591() { // fn#2591, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:1525, offset: 0x00c84752, size: 26 bytes, params: 1, frame: 13
return env0_0.apply(undefined, env0_1);
}
}
function setInterval(a0, a1) { // fn#2592, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:1633, offset: 0x00c8476c, size: 161 bytes, params: 3, frame: 23
var r3;
var value5;
var value8;
var value9;
const value = a1;
const env0_0 = a0;
const length = arguments.length;
const Array = global.Array;
const value3 = 2;
const value4 = 0;
reducibleJoin2: while (true) {
if (length > value3) {
value5 = length - value3;
r3 = value5;
break reducibleJoin2;
}
r3 = value4;
break reducibleJoin2;
}
const value6 = Object.create(Array.prototype, {constructor: {value: Array}});
const array = new Array();
if (value3 < length) {
r3 = value3;
reducibleLoop3: while (true) {
value8 = r3 - value3;
(array instanceof Object ? array : value6)[value8] = arguments[r3];
value9 = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
if (value9 < length) {
r3 = value9;
continue reducibleLoop3;
}
break reducibleLoop3;
}
}
const value11 = _allocateCallback(_fun2593, 'setInterval');
const createTimerBinding = createTimer;
const r5 = value || value4;
const Date = global.Date;
createTimerBinding(value11, r5, Date.now(), true);
return value11;
function _fun2593() { // fn#2593, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:1766, offset: 0x00c84752, size: 26 bytes, params: 1, frame: 13
return env0_0.apply(undefined, env0_1);
}
}
function queueReactNativeMicrotask(a0) { // fn#2594, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:1889, offset: 0x00c8480d, size: 134 bytes, params: 2, frame: 18
var r1;
var value4;
var value7;
var value8;
const env0_0 = a0;
const length = arguments.length;
const Array = global.Array;
const value2 = 1;
reducibleJoin2: while (true) {
if (length > value2) {
value4 = length - value2;
r1 = value4;
break reducibleJoin2;
}
r1 = 0;
break reducibleJoin2;
}
const value5 = Object.create(Array.prototype, {constructor: {value: Array}});
const array = new Array();
if (value2 < length) {
r1 = value2;
reducibleLoop3: while (true) {
value7 = r1 - value2;
(array instanceof Object ? array : value5)[value7] = arguments[r1];
value8 = typeof r1 === 'bigint' ? r1 + 1n : +r1 + 1;
if (value8 < length) {
r1 = value8;
continue reducibleLoop3;
}
break reducibleLoop3;
}
}
const value9 = _allocateCallback(_fun2595, 'queueReactNativeMicrotask');
env0_9.push(value9);
return value9;
function _fun2595() { // fn#2595, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:2034, offset: 0x00c84752, size: 26 bytes, params: 1, frame: 13
return env0_0.apply(undefined, env0_1);
}
}
function requestAnimationFrame(a0) { // fn#2596, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:2143, offset: 0x00c84893, size: 59 bytes, params: 2, frame: 17
const value2 = _allocateCallback(a0, 'requestAnimationFrame');
const createTimerBinding = createTimer;
const Date = global.Date;
createTimerBinding(value2, 1, Date.now(), false);
return value2;
}
function requestIdleCallback(a0, a1) { // fn#2597, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:2289, offset: 0x00c848ce, size: 134 bytes, params: 3, frame: 17
let value = a0;
const value2 = a1;
if (env0_10.length === 0) {
setSendIdleEvents(true);
}
const r5 = value2 && value2.timeout;
value = _allocateCallback(r5 == null ? value : _fun2598, 'requestIdleCallback');
env0_10.push(value);
if (r5 != null) {
env0_11[value] = env0_15.setTimeout(_fun2599, r5);
}
return value;
function _fun2598(a0) { // fn#2598, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:2406, offset: 0x00c84954, size: 64 bytes, params: 2, frame: 13
let binding = env1_11;
const property = binding[env0_1];
if (property) {
binding = env1_15;
binding.clearTimeout(property);
binding = env1_11;
delete binding[env0_1];
}
return env0_0(a0);
}
function _fun2599() { // fn#2599, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:2544, offset: 0x00c84994, size: 136 bytes, params: 1, frame: 17
var _callTimerBinding;
let binding = env1_10;
const value3 = binding.indexOf(env0_1);
if (value3 > -1) {
binding = env1_10;
binding.splice(value3, 1);
_callTimerBinding = _callTimer;
binding = env0_1;
_callTimerBinding(binding, env1_0.performance.now(), true);
}
delete env1_11[env0_1];
if (env1_10.length === 0) {
setSendIdleEvents(false);
}
}
}
function cancelIdleCallback(a0) { // fn#2600, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:2722, offset: 0x00c84a1c, size: 123 bytes, params: 2, frame: 16
_freeCallback(a0);
const value2 = env0_10.indexOf(a0);
if (value2 !== -1) {
env0_10.splice(value2, 1);
}
const property = env0_11[a0];
if (property) {
env0_15.clearTimeout(property);
delete env0_11[a0];
}
if (env0_10.length === 0) {
setSendIdleEvents(false);
}
}
function clearReactNativeMicrotask(a0) { // fn#2603, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:3034, offset: 0x00c84aaa, size: 63 bytes, params: 2, frame: 14
_freeCallback(a0);
const value2 = env0_9.indexOf(a0);
if (value2 !== -1) {
env0_9.splice(value2, 1);
}
}
function callTimers(a0) { // fn#2605, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:3214, offset: 0x00c84ae9, size: 187 bytes, params: 2, frame: 20
var r4;
var r3;
var value3;
var value4;
var binding;
var setTimeout;
var closure;
var bind;
var value5;
const value2 = 0;
const moduleValue = require(dependencyMap[value2]);
let length = a0.length;
moduleValue(value2 !== length, 'Cannot call `callTimers` with an empty list of IDs.');
env0_13.length = value2;
length = a0.length;
if (value2 < length) {
r4 = value2;
reducibleLoop1: while (true) {
_callTimer(a0[r4], value2);
value3 = typeof r4 === 'bigint' ? r4 + 1n : +r4 + 1;
length = a0.length;
if (value3 < length) {
r4 = value3;
continue reducibleLoop1;
}
break reducibleLoop1;
}
}
length = env0_13.length;
if (length > value2) {
value4 = 1;
reducibleJoin7: while (true) {
if (!(length > value4)) {
break reducibleJoin7;
}
if (!(value4 < length)) {
break reducibleJoin7;
}
r3 = value4;
reducibleLoop6: while (true) {
binding = env0_15;
setTimeout = binding.setTimeout;
closure = function(a0) {
throw a0;
};
bind = closure.bind;
Reflect.apply(setTimeout, binding, [Reflect.apply(bind, closure, [null, env0_13[r3]]), value2]);
value5 = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
if (value5 < length) {
r3 = value5;
continue reducibleLoop6;
}
break reducibleJoin7;
}
}
throw env0_13[value2];
}
}
function callIdleCallbacks(a0) { // fn#2607, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:3504, offset: 0x00c84ba4, size: 175 bytes, params: 2, frame: 17
var r3;
var value3;
var length;
var value4;
var forEach;
let binding = env0_4;
const Date = global.Date;
reducibleJoin7: while (true) {
if (binding - (Date.now() - a0) < 1) {
break reducibleJoin7;
}
value3 = 0;
env0_13.length = value3;
length = items2.length;
reducibleJoin4: while (true) {
if (!(length > value3)) {
break reducibleJoin4;
}
binding = items2;
items2 = [];
length = binding.length;
if (!(value3 < length)) {
break reducibleJoin4;
}
r3 = value3;
reducibleLoop3: while (true) {
_callTimer(binding[r3], a0);
value4 = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
length = binding.length;
if (value4 < length) {
r3 = value4;
continue reducibleLoop3;
}
break reducibleJoin4;
}
}
length = items2.length;
reducibleJoin6: while (true) {
if (value3 !== length) {
break reducibleJoin6;
}
setSendIdleEvents(false);
break reducibleJoin6;
}
binding = env0_13;
forEach = binding.forEach;
Reflect.apply(forEach, binding, [_fun2608]);
break reducibleJoin7;
}
function _fun2608(a0) { // fn#2608, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:3692, offset: 0x00c84c53, size: 36 bytes, params: 2, frame: 13
const env0_0 = a0;
return env1_15.setTimeout(_fun2609, 0);
function _fun2609() { // fn#2609, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:3725, offset: 0x00c6dfd8, size: 9 bytes, params: 1, frame: 1
throw env0_0;
}
}
}
function callReactNativeMicrotasks() { // fn#2610, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:3780, offset: 0x00c84c77, size: 62 bytes, params: 1, frame: 12
env0_13.length = 0;
if (_callReactNativeMicrotasksPass()) {
while (true) {
if (!_callReactNativeMicrotasksPass()) {
break;
}
}
}
env0_13.forEach(_fun2611);
function _fun2611(a0) { // fn#2611, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:3878, offset: 0x00c84cb5, size: 36 bytes, params: 2, frame: 13
const env0_0 = a0;
return env1_15.setTimeout(_fun2612, 0);
function _fun2612() { // fn#2612, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:3911, offset: 0x00c6dfd8, size: 9 bytes, params: 1, frame: 1
throw env0_0;
}
}
}
function emitTimeDriftWarning(a0) { // fn#2613, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:3960, offset: 0x00c84cd9, size: 41 bytes, params: 2, frame: 11
if (!env0_14) {
global.console.warn(a0);
}
}
function _flushReactNativeMicrotasks() { // fn#2614, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:203:4541, offset: 0x00c84d02, size: 19 bytes, params: 1, frame: 9
return env0_15.callReactNativeMicrotasks();
}
}
global.__d(_fun2581, 178, [44, 179, 63]) /* metro module 178, dependencies: [44, 179, 63] */;