Files
2026-07-28 01:06:53 +03:00

393 lines
18 KiB
TypeScript

/* Metro module 7080; source: stores/SlowmodeStore.tsx; dependencies: [6, 7, 15, 17, 18, 1379, 3784, 7081, 4041, 694, 672, 566, 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 PossibleConstructorReturn from '../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import Flux from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import ChannelStore from './ChannelStore.tsx'; /* Metro dependency 1379 */
import PermissionStore from './PermissionStore.tsx'; /* Metro dependency 3784 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as SlowmodeUtilsModule from '../modules/chat/SlowmodeUtils.tsx'; /* Metro dependency 7081 */
function _fun56487(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#56487, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:6, offset: 0x013c9572, size: 470 bytes, params: 8, frame: 21
const env0_0 = require;
const _arrayLikeToArray_56493 = 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 UPLOAD_FAIL_564972 = UPLOAD_FAIL_56497;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
object = {SendMessage: 0};
object[0] = 'SendMessage';
object.CreateThread = 1;
object[1] = 'CreateThread';
const object2 = {};
const SendMessage = object.SendMessage;
object2[SendMessage] = {};
const CreateThread = object.CreateThread;
object2[CreateThread] = {};
const Store = (Flux).Store;
let value = _fun56498(Store);
value.displayName = 'SlowmodeStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
{SLOWMODE_RESET_COOLDOWN: function({channelId, slowmodeType}) {
return resetCooldown(channelId, slowmodeType);
}, SLOWMODE_SET_COOLDOWN: SLOWMODE_SET_COOLDOWN, UPLOAD_START: UPLOAD_START_56505, UPLOAD_FAIL: UPLOAD_FAIL_564972,
UPLOAD_CANCEL_REQUEST: UPLOAD_FAIL_564972, CHANNEL_UPDATES: CHANNEL_UPDATES_56506, LOGOUT: LOGOUT_56508});
(FileImportTrackerModule).fileFinishedImporting('stores/SlowmodeStore.tsx');
exports.default = value;
exports.SlowmodeType = object;
function _isNativeReflectConstruct_56488() { // fn#56488, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:170, offset: 0x013c9748, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_56488_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_56491(a0, a1) { // fn#56491, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:363, offset: 0x013c97a6, 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 _fun56492;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_56493(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_56493(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_56493(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun56492;
}
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 _fun56492() { // fn#56492, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:934, 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 setCooldown(a0, a1, a2) { // fn#56494, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:1416, offset: 0x013c9918, size: 312 bytes, params: 4, frame: 21
var Date;
var value2;
var object;
var Timeout;
var value3;
var timeout;
const env0_0 = a0;
const env0_1 = a1;
let property = env0_11[a1];
let id = a0.id;
if (property[id] != null) {
property = env0_11[a1];
id = a0.id;
property[id].timer.stop();
property = env0_11[a1];
id = a0.id;
delete property[id];
}
if (!SlowmodeUtilsModule.canBypassSlowmode(a0, a1)) {
if (!(a2 <= 0)) {
Date = global.Date;
value2 = a2 + Date.now();
property = env0_11[a1];
id = a0.id;
object = {};
object.rateLimitPerUser = a0.rateLimitPerUser;
object.cooldownMs = a2;
object.cooldownEndTimestamp = value2;
Timeout = (require(4041) /* metro dependency 4041: Timers */).Timeout;
value3 = Object.create(Timeout.prototype, {constructor: {value: Timeout}});
timeout = new Timeout();
object.timer = timeout instanceof Object ? timeout : value3;
property[id] = object;
property = env0_11[a1];
id = a0.id;
property[id].timer.start(1000, _fun56495, true);
}
}
function _fun56495() { // fn#56495, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:1745, offset: 0x013c9a50, size: 123 bytes, params: 1, frame: 18
let value = environment.__proto__;
value = importDefault(694) /* metro dependency 694: Dispatcher */;
const dispatch = value.dispatch;
const Math = global.Math;
const max = Math.max;
const binding = env0_2;
const Date = global.Date;
Reflect.apply(dispatch, value, [{type: 'SLOWMODE_SET_COOLDOWN', channelId: env0_0.id, slowmodeType: require,
cooldownMs: Reflect.apply(max, Math, [binding - Date.now(), 0])}]);
}
}
function resetCooldown(a0, a1) { // fn#56496, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:1872, offset: 0x013c9acb, size: 111 bytes, params: 3, frame: 17
const channel = ChannelStore.getChannel(a0);
if (channel == null) {
return false;
}
const setCooldownBinding = setCooldown;
const rateLimitPerUser = channel.rateLimitPerUser;
const value3 = 0;
setCooldownBinding(channel, a1,
value3 === rateLimitPerUser ? value3 : channel.rateLimitPerUser * (importDefault(672) /* metro dependency 672: Durations */).Millis.SECOND + 100);
}
function UPLOAD_CANCEL_REQUEST({channelId}) { // fn#56497, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:2030, offset: 0x013c9b3a, size: 63 bytes, params: 2, frame: 16
var r0;
var setCooldownBinding;
var SendMessage;
var value;
const channel = ChannelStore.getChannel(channelId);
const value3 = channel != null;
if (value3) {
setCooldownBinding = setCooldown;
SendMessage = env0_10.SendMessage;
value = undefined;
setCooldownBinding(channel, SendMessage, 0);
r0 = value;
} else {
r0 = value3;
}
return r0;
}
function _fun56498(a0) { // fn#56498, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:2148, offset: 0x013c9b79, size: 114 bytes, params: 2, frame: 16
const SlowmodeStore2 = SlowmodeStore;
Inherits(SlowmodeStore2, a0);
return CreateClass(SlowmodeStore2, [{key: 'initialize', value: function() {
this.waitFor(ChannelStore, PermissionStore);
}}, {key: 'getSlowmodeCooldownGuess', value: value_56501}, {key: 'isChannelOnCooldown', value: function(a0, a1) {
var value = this.getSlowmodeCooldownGuess(a0.id, a1);
value = value > 0;
return value && a0.rateLimitPerUser > 0;
}}]);
function SlowmodeStore() { // fn#56499, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:2160, offset: 0x0108afcb, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_3(this, SlowmodeStore);
const value3 = env1_6(SlowmodeStore);
return env1_5(this, _isNativeReflectConstruct_56488() ? global.Reflect.construct(value3, arguments,
env1_6(this).constructor) : value3.apply(this, arguments));
}
function value_56501(a0, a1) { // fn#56501, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:2512, offset: 0x013c9beb, size: 54 bytes, params: 3, frame: 5
const property = env1_11[a1 ?? env1_10.SendMessage][a0];
return property != null ? property.cooldownMs : 0;
}
}
function SLOWMODE_SET_COOLDOWN({channelId, slowmodeType, cooldownMs}) { // fn#56504, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:2922, offset: 0x013c9c6f, size: 75 bytes, params: 2, frame: 16
const channel = ChannelStore.getChannel(channelId);
if (channel == null) {
return false;
}
setCooldown(channel, slowmodeType, cooldownMs === 0 ? 0 : cooldownMs + 100);
}
function UPLOAD_START_56505({channelId}) { // fn#56505, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:3087, offset: 0x013c9cba, size: 35 bytes, params: 2, frame: 13
const resetCooldownBinding = resetCooldown;
const SendMessage = env0_10.SendMessage;
return resetCooldownBinding(channelId, SendMessage);
}
function CHANNEL_UPDATES_56506({channels}) { // fn#56506, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:3256, offset: 0x013c9cdd, size: 69 bytes, params: 2, frame: 12
const SendMessage = env0_10.SendMessage;
const CreateThread = env0_10.CreateThread;
[SendMessage, CreateThread].forEach(_fun56507);
function _fun56507(a0) { // fn#56507, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:3340, offset: 0x013c9d22, size: 213 bytes, params: 2, frame: 30
var r3;
var cooldownMs;
var r15;
var value6;
var property;
var id;
var rateLimitPerUser;
var rateLimitPerUser2;
var setCooldownBinding;
var Math;
var min;
var value7;
var Millis;
var SECOND;
var value8;
const _createForOfIteratorHelperLoose_56491Binding = _createForOfIteratorHelperLoose_56491;
const channelsBinding = channels;
const value3 = undefined;
const value4 = _createForOfIteratorHelperLoose_56491Binding(channelsBinding);
const value5 = value4();
let done = value5.done;
if (!done) {
r3 = value5;
while (true) {
value6 = r3.value;
property = env1_11[a0];
id = value6.id;
property = property[id];
rateLimitPerUser = value6.rateLimitPerUser;
if (property != null) {
rateLimitPerUser2 = property.rateLimitPerUser;
if (rateLimitPerUser2 === rateLimitPerUser) {
break;
}
setCooldownBinding = setCooldown;
Math = global.Math;
min = Math.min;
if (property == null) {
cooldownMs = value3;
continue;
}
cooldownMs = property.cooldownMs;
value7 = 0;
if (cooldownMs != null) {
r15 = cooldownMs;
continue;
}
r15 = value7;
continue;
Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
SECOND = Millis.SECOND;
setCooldownBinding(value6, a0, Reflect.apply(min, Math, [r15, rateLimitPerUser * SECOND]));
break;
}
value8 = value4();
done = value8.done;
if (done) {
break;
}
r3 = value8;
continue;
}
}
return value3;
}
}
function LOGOUT_56508() { // fn#56508, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:3598, offset: 0x013c9df7, size: 56 bytes, params: 1, frame: 11
const SendMessage = env0_10.SendMessage;
const CreateThread = env0_10.CreateThread;
[SendMessage, CreateThread].forEach(_fun56509);
function _fun56509(a0) { // fn#56509, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:3655, offset: 0x013c9e2f, size: 67 bytes, params: 2, frame: 14
const env0_0 = a0;
const Object = global.Object;
Object.keys(env1_11[a0]).forEach(_fun56510);
env1_11[a0] = {};
function _fun56510(a0) { // fn#56510, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7258:3686, offset: 0x013c9e72, size: 43 bytes, params: 2, frame: 9
return env2_11[env0_0][a0].timer.stop();
}
}
}
}
global.__d(_fun56487, 7080, [6, 7, 15, 17, 18, 1379, 3784, 7081, 4041, 694, 672, 566,
2]) /* metro module 7080, dependencies: [6, 7, 15, 17, 18, 1379, 3784, 7081, 4041, 694, 672, 566, 2] */;