Files
discord-decomp/sources/modules/interactions/InteractionUtils.tsx
T
2026-07-27 16:20:00 +03:00

987 lines
42 KiB
TypeScript

/* Metro module 8056; source: modules/interactions/InteractionUtils.tsx; dependencies: [5, 4234, 1226, 8057, 661, 21, 7153, 8055, 1909, 507, 7067, 8058, 694, 4629, 8059, 1244, 2] */
function _fun63905(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#63905, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8234:6, offset: 0x01b95303, size: 420 bytes, params: 8, frame: 26
var object2;
const env0_0 = require;
const _arrayLikeToArray_63908 = 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 closure = getInteractionTimeoutTimestamp;
const closure2 = getInteractionInitialResponseDeadlineTimestamp;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(5) /* metro dependency 5 */;
const applicationStore = importDefault(4234) /* metro dependency 4234: ApplicationStore */;
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
const interactionStore = importDefault(8057) /* metro dependency 8057: InteractionStore */;
let value = require(661) /* metro dependency 661: Constants */;
const env0_7 = value.Endpoints;
const env0_8 = value.AbortCodes;
const env0_9 = value.MessageStates;
const env0_10 = value.MessageFlags;
value = _fun63913();
const closure3 = handleInteractionResponse;
object2 = {SENDING: 0};
object2[0] = 'SENDING';
object2.CREATED = 1;
object2[1] = 'CREATED';
object2.FAILED = 2;
object2[2] = 'FAILED';
object2.TIMED_OUT = 3;
object2[3] = 'TIMED_OUT';
object2.EPHEMERAL_SUCCESS = 4;
object2[4] = 'EPHEMERAL_SUCCESS';
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/interactions/InteractionUtils.tsx');
exports.getInteractionTimeoutTimestamp = closure;
exports.getInteractionInitialResponseDeadlineTimestamp = closure2;
exports.executeMessageComponentInteraction = value;
exports.handleInteractionResponse = closure3;
exports.InteractionStatusViewState = object2;
exports.getInteractionStatusViewState = getInteractionStatusViewState;
exports.canRetryInteractionData = canRetryInteractionData;
exports.interactionCallbackErrorReason = interactionCallbackErrorReason;
}
function _createForOfIteratorHelperLoose_63906(a0, a1) { // fn#63906, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8234:215, offset: 0x01b954a7, 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 _fun63907;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_63908(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_63908(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_63908(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun63907;
}
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 getInteractionTimeoutTimestamp(a0) { // fn#63909, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8234:1125, offset: 0x01b95619, size: 106 bytes, params: 2, frame: 12
var r0;
var Number;
var value;
if (a0 == null) {
r0 = global.Date.now();
} else if (a0 === '') {
r0 = global.Date.now();
} else {
Number = global.Number;
if (Number.isNaN(a0)) {
r0 = global.Date.now();
} else {
value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
value = value.extractTimestamp(a0);
value += 900000;
r0 = value;
}
}
return r0;
}
function getInteractionInitialResponseDeadlineTimestamp(a0) { // fn#63910, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8234:1251, offset: 0x01b95683, size: 106 bytes, params: 2, frame: 12
var r0;
var Number;
var value;
if (a0 == null) {
r0 = global.Date.now();
} else if (a0 === '') {
r0 = global.Date.now();
} else {
Number = global.Number;
if (Number.isNaN(a0)) {
r0 = global.Date.now();
} else {
value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
value = value.extractTimestamp(a0);
value += 3000;
r0 = value;
}
}
return r0;
}
function mapMessageComponentLocalStateForAPI(a0) { // fn#63911, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8234:2344, offset: 0x01b956ed, size: 421 bytes, params: 2, frame: 16
if (a0 != null) {
var type = a0.type;
var value;
var ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType;
var TEXT_INPUT = ComponentType.TEXT_INPUT;
if (TEXT_INPUT === type) {
return null;
}
ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType;
var FILE_UPLOAD = ComponentType.FILE_UPLOAD;
if (FILE_UPLOAD === type) {
return null;
}
ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType;
var RADIO_GROUP = ComponentType.RADIO_GROUP;
if (RADIO_GROUP === type) {
return null;
}
ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType;
var CHECKBOX_GROUP = ComponentType.CHECKBOX_GROUP;
if (CHECKBOX_GROUP === type) {
return null;
}
ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType;
var CHECKBOX = ComponentType.CHECKBOX;
if (CHECKBOX === type) {
return null;
}
ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType;
var STRING_SELECT = ComponentType.STRING_SELECT;
if (STRING_SELECT === type) {
return a0;
}
ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType;
var USER_SELECT = ComponentType.USER_SELECT;
if (USER_SELECT === type) {
return {type: a0.type, values: a0.selectedOptions.map(function(a0) {
return a0.value;
})};
}
ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType;
var ROLE_SELECT = ComponentType.ROLE_SELECT;
if (ROLE_SELECT === type) {
return {type: a0.type, values: a0.selectedOptions.map(function(a0) {
return a0.value;
})};
}
ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType;
var MENTIONABLE_SELECT = ComponentType.MENTIONABLE_SELECT;
if (MENTIONABLE_SELECT === type) {
return {type: a0.type, values: a0.selectedOptions.map(function(a0) {
return a0.value;
})};
}
ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType;
var CHANNEL_SELECT = ComponentType.CHANNEL_SELECT;
if (CHANNEL_SELECT === type) {
return {type: a0.type, values: a0.selectedOptions.map(function(a0) {
return a0.value;
})};
}
}
return null;
}
function _fun63913() { // fn#63913, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8234:1399, offset: 0x01b95892, size: 32 bytes, params: 1, frame: 12
const env0_0 = env0_3(_fun63915);
return _fun63918;
}
function handleInteractionFailure(a0, a1, a2) { // fn#63919, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8234:2983, offset: 0x01b95b4a, size: 66 bytes, params: 4, frame: 13
if (a2 == null && a1 != null) {
(importDefault(7067) /* metro dependency 7067: MessageActionCreators */).sendClydeError(a0, a1);
}
}
function handleInteractionResponse(a0, a1, a2, a3, a4) { // fn#63920, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8234:3067, offset: 0x01b95b8c, size: 636 bytes, params: 6, frame: 24
var code;
var r3;
var body;
var moduleValue;
var setFailed;
var moduleValue2;
var value3;
var defaultImport;
var value4;
var value5;
var moduleValue3;
var value6;
var value7;
let value = a4;
if (a1.ok) {
return undefined;
}
if (a1.hasErr) {
(require(8055) /* metro dependency 8055: InteractionActionCreators */).setFailed(a0);
return undefined;
}
if (a1.status >= 400) {
if (a1.status < 500) {
body = a1.body;
if (body) {
body = a1.body;
code = body.code;
if (code !== AbortCodes.INVALID_FORM_BODY) {
body = a1.body;
code = body.code;
if (code === AbortCodes.UNKNOWN_INTEGRATION) {
value3 = undefined;
defaultImport = importDefault(694) /* metro dependency 694: Dispatcher */;
value4 = null;
defaultImport.dispatch({type: 'APPLICATION_COMMAND_EXECUTE_BAD_VERSION', applicationId: a2,
channelId: a3,
guildId: value4 != value ? value : value4});
value = require(8055) /* metro dependency 8055: InteractionActionCreators */;
value.setFailed(a0, value3, a1.body.message);
r3 = value3;
} else {
value = undefined;
moduleValue2 = require(8055) /* metro dependency 8055: InteractionActionCreators */;
setFailed = moduleValue2.setFailed;
body = a1.body;
code = body.code;
body = a1.body;
Reflect.apply(setFailed, moduleValue2, [a0, code, body.message, a1.status]);
r3 = value;
}
return r3;
}
body = a1.body;
if (body.errors) {
value5 = undefined;
moduleValue3 = require(8058) /* metro dependency 8058: SkemaUtils */;
value6 = moduleValue3.getFirstSkemaError(a1.body.errors);
value7 = null;
if (!(value7 == value6 || value6.code !== 'INTERACTION_APPLICATION_COMMAND_INVALID_VERSION' && value6.code !== 'INTERACTION_APPLICATION_COMMAND_INVALID')) {
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'APPLICATION_COMMAND_EXECUTE_BAD_VERSION',
applicationId: a2, channelId: a3, guildId: value7 != value ? value : value7});
}
value = require(8055) /* metro dependency 8055: InteractionActionCreators */;
value.setFailed(a0, value5, value7 == value6 ? value5 : value6.message);
return value5;
}
body = a1.body;
code = body.code;
if (code === AbortCodes.UNKNOWN_INTEGRATION) {
value3 = undefined;
defaultImport = importDefault(694) /* metro dependency 694: Dispatcher */;
value4 = null;
defaultImport.dispatch({type: 'APPLICATION_COMMAND_EXECUTE_BAD_VERSION', applicationId: a2,
channelId: a3,
guildId: value4 != value ? value : value4});
value = require(8055) /* metro dependency 8055: InteractionActionCreators */;
value.setFailed(a0, value3, a1.body.message);
r3 = value3;
} else {
value = undefined;
moduleValue2 = require(8055) /* metro dependency 8055: InteractionActionCreators */;
setFailed = moduleValue2.setFailed;
body = a1.body;
code = body.code;
body = a1.body;
Reflect.apply(setFailed, moduleValue2, [a0, code, body.message, a1.status]);
r3 = value;
}
return r3;
}
value = undefined;
moduleValue = require(8055) /* metro dependency 8055: InteractionActionCreators */;
setFailed = moduleValue.setFailed;
body = a1.body;
code = body == null ? value : body.code;
Reflect.apply(setFailed, moduleValue, [a0, code]);
return value;
}
value = undefined;
moduleValue = require(8055) /* metro dependency 8055: InteractionActionCreators */;
setFailed = moduleValue.setFailed;
body = a1.body;
code = body == null ? value : body.code;
Reflect.apply(setFailed, moduleValue, [a0, code]);
} else {
value = undefined;
moduleValue = require(8055) /* metro dependency 8055: InteractionActionCreators */;
setFailed = moduleValue.setFailed;
body = a1.body;
Reflect.apply(setFailed, moduleValue, [a0, body == null ? value : body.code]);
}
return value;
}
function getInteractionStatusViewState(a0, a1) { // fn#63921, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8234:4499, offset: 0x01b95e08, size: 550 bytes, params: 3, frame: 21
var state;
var r6;
var r4;
var interactionType;
var EPHEMERAL_SUCCESS;
var r0;
var getInteractionTimeoutTimestampBinding;
var id;
var interactionTimeoutTimestampBinding;
var Date;
var now;
var value5;
var getInteractionInitialResponseDeadlineTimestampBinding;
var interactionInitialResponseDeadlineTimestampBinding;
var value8;
var data;
const InteractionState = (require(4629) /* metro dependency 4629: InteractionTypes */).InteractionState;
var QUEUED;
var state4;
var SENDING;
var CREATED;
var hasFlag;
var LOADING;
var interaction;
var EPHEMERAL;
var FAILED;
var TIMED_OUT;
const value = undefined;
reducibleJoin2: while (true) {
if (a1 == null) {
state = value;
break reducibleJoin2;
}
state = a1.state;
break reducibleJoin2;
}
const state2 = a0.state;
const SENT = MessageStates.SENT;
const value3 = state2 === SENT;
reducibleJoin4: while (true) {
if (value3) {
getInteractionTimeoutTimestampBinding = getInteractionTimeoutTimestamp;
id = a0.id;
interactionTimeoutTimestampBinding = getInteractionTimeoutTimestampBinding(id);
Date = global.Date;
now = Date.now;
value5 = interactionTimeoutTimestampBinding < Reflect.apply(now, Date, []);
r6 = value5;
break reducibleJoin4;
}
r6 = value3;
break reducibleJoin4;
}
const state3 = a0.state;
let SEND_FAILED = MessageStates.SEND_FAILED;
const value6 = state3 === SEND_FAILED;
reducibleJoin6: while (true) {
if (value6) {
getInteractionInitialResponseDeadlineTimestampBinding = getInteractionInitialResponseDeadlineTimestamp;
id = a0.id;
interactionInitialResponseDeadlineTimestampBinding = getInteractionInitialResponseDeadlineTimestampBinding(id);
Date = global.Date;
now = Date.now;
value8 = interactionInitialResponseDeadlineTimestampBinding < Reflect.apply(now, Date, []);
r4 = value8;
break reducibleJoin6;
}
r4 = value6;
break reducibleJoin6;
}
reducibleJoin8: while (true) {
if (a1 == null) {
interactionType = value;
break reducibleJoin8;
}
data = a1.data;
interactionType = data.interactionType;
break reducibleJoin8;
}
const InteractionTypes = (require(1909) /* metro dependency 1909: Server */).InteractionTypes;
const APPLICATION_COMMAND = InteractionTypes.APPLICATION_COMMAND;
const value9 = interactionType === APPLICATION_COMMAND;
const isCommandType2 = a0.isCommandType();
reducibleJoin36: while (true) {
reducibleJoin34: while (true) {
if (value9) {
QUEUED = InteractionState.QUEUED;
if (state !== QUEUED) {
if (isCommandType2) {
state4 = a0.state;
if (state4 === MessageStates.SENDING) {
if (a1 != null) {
r0 = env0_13.SENDING;
break reducibleJoin36;
}
}
}
if (value9) {
CREATED = InteractionState.CREATED;
if (state === CREATED) {
CREATED = env0_13.CREATED;
r0 = CREATED;
break reducibleJoin34;
}
}
hasFlag = a0.hasFlag;
LOADING = MessageFlags.LOADING;
if (Reflect.apply(hasFlag, a0, [LOADING])) {
if (!r6) {
CREATED = env0_13.CREATED;
r0 = CREATED;
break reducibleJoin34;
}
}
interaction = a0.interaction;
reducibleJoin32: while (true) {
reducibleJoin30: while (true) {
if (interaction == null) {
interaction = a0.interaction;
if (interaction != null) {
hasFlag = a0.hasFlag;
if (!Reflect.apply(hasFlag, a0, [MessageFlags.LOADING])) {
if (r4) {
TIMED_OUT = env0_13.TIMED_OUT;
r0 = TIMED_OUT;
break reducibleJoin32;
}
}
}
if (isCommandType2) {
state = a0.state;
SEND_FAILED = MessageStates.SEND_FAILED;
if (state === SEND_FAILED) {
FAILED = env0_13.FAILED;
r0 = FAILED;
break reducibleJoin30;
}
}
interaction = a0.interaction;
reducibleJoin28: while (true) {
if (interaction != null) {
hasFlag = a0.hasFlag;
EPHEMERAL = MessageFlags.EPHEMERAL;
if (Reflect.apply(hasFlag, a0, [EPHEMERAL])) {
EPHEMERAL_SUCCESS = env0_13.EPHEMERAL_SUCCESS;
break reducibleJoin28;
}
EPHEMERAL_SUCCESS = value;
break reducibleJoin28;
}
EPHEMERAL_SUCCESS = value;
break reducibleJoin28;
}
r0 = EPHEMERAL_SUCCESS;
break reducibleJoin30;
}
hasFlag = a0.hasFlag;
LOADING = MessageFlags.LOADING;
if (Reflect.apply(hasFlag, a0, [LOADING])) {
if (r6) {
TIMED_OUT = env0_13.TIMED_OUT;
r0 = TIMED_OUT;
break reducibleJoin32;
}
}
interaction = a0.interaction;
if (interaction != null) {
hasFlag = a0.hasFlag;
LOADING = MessageFlags.LOADING;
if (!Reflect.apply(hasFlag, a0, [LOADING])) {
if (r4) {
TIMED_OUT = env0_13.TIMED_OUT;
r0 = TIMED_OUT;
break reducibleJoin32;
}
}
}
if (isCommandType2) {
state = a0.state;
SEND_FAILED = MessageStates.SEND_FAILED;
if (state === SEND_FAILED) {
FAILED = env0_13.FAILED;
r0 = FAILED;
break reducibleJoin30;
}
}
interaction = a0.interaction;
reducibleJoin28: while (true) {
if (interaction != null) {
hasFlag = a0.hasFlag;
EPHEMERAL = MessageFlags.EPHEMERAL;
if (Reflect.apply(hasFlag, a0, [EPHEMERAL])) {
EPHEMERAL_SUCCESS = env0_13.EPHEMERAL_SUCCESS;
break reducibleJoin28;
}
EPHEMERAL_SUCCESS = value;
break reducibleJoin28;
}
EPHEMERAL_SUCCESS = value;
break reducibleJoin28;
}
r0 = EPHEMERAL_SUCCESS;
break reducibleJoin30;
}
break reducibleJoin32;
}
break reducibleJoin34;
}
SENDING = env0_13.SENDING;
r0 = SENDING;
break reducibleJoin36;
}
if (isCommandType2) {
state4 = a0.state;
SENDING = MessageStates.SENDING;
if (state4 === SENDING) {
if (a1 != null) {
SENDING = env0_13.SENDING;
r0 = SENDING;
break reducibleJoin36;
}
}
}
if (value9) {
CREATED = InteractionState.CREATED;
if (state === CREATED) {
CREATED = env0_13.CREATED;
r0 = CREATED;
break reducibleJoin34;
}
}
hasFlag = a0.hasFlag;
LOADING = MessageFlags.LOADING;
if (Reflect.apply(hasFlag, a0, [LOADING])) {
if (!r6) {
CREATED = env0_13.CREATED;
r0 = CREATED;
break reducibleJoin34;
}
}
interaction = a0.interaction;
reducibleJoin32: while (true) {
reducibleJoin30: while (true) {
if (interaction == null) {
interaction = a0.interaction;
if (interaction != null) {
hasFlag = a0.hasFlag;
if (!Reflect.apply(hasFlag, a0, [MessageFlags.LOADING])) {
if (r4) {
TIMED_OUT = env0_13.TIMED_OUT;
r0 = TIMED_OUT;
break reducibleJoin32;
}
}
}
if (isCommandType2) {
state = a0.state;
SEND_FAILED = MessageStates.SEND_FAILED;
if (state === SEND_FAILED) {
FAILED = env0_13.FAILED;
r0 = FAILED;
break reducibleJoin30;
}
}
interaction = a0.interaction;
reducibleJoin28: while (true) {
if (interaction != null) {
hasFlag = a0.hasFlag;
EPHEMERAL = MessageFlags.EPHEMERAL;
if (Reflect.apply(hasFlag, a0, [EPHEMERAL])) {
EPHEMERAL_SUCCESS = env0_13.EPHEMERAL_SUCCESS;
break reducibleJoin28;
}
EPHEMERAL_SUCCESS = value;
break reducibleJoin28;
}
EPHEMERAL_SUCCESS = value;
break reducibleJoin28;
}
r0 = EPHEMERAL_SUCCESS;
break reducibleJoin30;
}
hasFlag = a0.hasFlag;
LOADING = MessageFlags.LOADING;
if (Reflect.apply(hasFlag, a0, [LOADING])) {
if (r6) {
TIMED_OUT = env0_13.TIMED_OUT;
r0 = TIMED_OUT;
break reducibleJoin32;
}
}
interaction = a0.interaction;
if (interaction != null) {
hasFlag = a0.hasFlag;
LOADING = MessageFlags.LOADING;
if (!Reflect.apply(hasFlag, a0, [LOADING])) {
if (r4) {
TIMED_OUT = env0_13.TIMED_OUT;
r0 = TIMED_OUT;
break reducibleJoin32;
}
}
}
if (isCommandType2) {
state = a0.state;
SEND_FAILED = MessageStates.SEND_FAILED;
if (state === SEND_FAILED) {
FAILED = env0_13.FAILED;
r0 = FAILED;
break reducibleJoin30;
}
}
interaction = a0.interaction;
reducibleJoin28: while (true) {
if (interaction != null) {
hasFlag = a0.hasFlag;
EPHEMERAL = MessageFlags.EPHEMERAL;
if (Reflect.apply(hasFlag, a0, [EPHEMERAL])) {
EPHEMERAL_SUCCESS = env0_13.EPHEMERAL_SUCCESS;
break reducibleJoin28;
}
EPHEMERAL_SUCCESS = value;
break reducibleJoin28;
}
EPHEMERAL_SUCCESS = value;
break reducibleJoin28;
}
r0 = EPHEMERAL_SUCCESS;
break reducibleJoin30;
}
break reducibleJoin32;
}
break reducibleJoin34;
}
break reducibleJoin36;
}
return r0;
}
function canRetryInteractionData({options}) { // fn#63922, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8234:5213, offset: 0x01b9602e, size: 369 bytes, params: 2, frame: 20
var length;
var r4;
var r1;
var type;
var value2;
const ApplicationCommandOptionType = (require(1909) /* metro dependency 1909: Server */).ApplicationCommandOptionType;
var SUB_COMMAND_GROUP;
var SUB_COMMAND;
var value6;
var ATTACHMENT;
var value7;
reducibleJoin2: while (true) {
if (options == null) {
length = undefined;
break reducibleJoin2;
}
length = options.length;
break reducibleJoin2;
}
reducibleJoin10: while (true) {
if (length !== 1) {
r1 = options;
break reducibleJoin10;
}
type = options[0].type;
value2 = environment;
SUB_COMMAND_GROUP = ApplicationCommandOptionType.SUB_COMMAND_GROUP;
if (type === SUB_COMMAND_GROUP) {
r4 = options;
} else {
type = options[0].type;
SUB_COMMAND = ApplicationCommandOptionType.SUB_COMMAND;
if (type !== SUB_COMMAND) {
r1 = options;
break reducibleJoin10;
}
r4 = options;
}
reducibleLoop5: while (true) {
options = r4[0].options;
reducibleJoin7: while (true) {
if (options == null) {
length = undefined;
break reducibleJoin7;
}
length = options.length;
break reducibleJoin7;
}
if (length !== 1) {
r1 = options;
break reducibleJoin10;
}
type = options[0].type;
SUB_COMMAND_GROUP = ApplicationCommandOptionType.SUB_COMMAND_GROUP;
if (type === SUB_COMMAND_GROUP) {
r4 = options;
continue reducibleLoop5;
}
type = options[0].type;
SUB_COMMAND = ApplicationCommandOptionType.SUB_COMMAND;
if (type === SUB_COMMAND) {
r4 = options;
continue reducibleLoop5;
}
r1 = options;
break reducibleJoin10;
}
}
const _createForOfIteratorHelperLoose_63906Binding = _createForOfIteratorHelperLoose_63906;
reducibleJoin12: while (true) {
if (r1 != null) {
break reducibleJoin12;
}
r1 = [];
break reducibleJoin12;
}
const value4 = _createForOfIteratorHelperLoose_63906Binding(r1);
const value5 = value4();
let done = value5.done;
if (!done) {
r1 = value5;
reducibleLoop13: while (true) {
value6 = r1.value;
type = value6.type;
ATTACHMENT = ApplicationCommandOptionType.ATTACHMENT;
if (type === ATTACHMENT) {
return false;
}
value7 = value4();
done = value7.done;
if (done) {
return true;
}
r1 = value7;
continue reducibleLoop13;
}
}
return true;
}
function interactionCallbackErrorReason(a0, a1) { // fn#63923, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8234:5654, offset: 0x01b9619f, size: 1219 bytes, params: 3, frame: 17
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
var application;
let ReasonCodes = (importDefault(8059) /* metro dependency 8059: InteractionCallbackError */).ReasonCodes;
const TIMEOUT = ReasonCodes.TIMEOUT;
if (TIMEOUT === a0) {
application = ApplicationStore.getApplication(a1);
return application != null ? intl.formatToPlainString(t.u2D2Uj,
{applicationName: application.name}) : intl.string(t['vGU8+r']);
}
ReasonCodes = (importDefault(8059) /* metro dependency 8059: InteractionCallbackError */).ReasonCodes;
const ACTIVITY_LAUNCH_NOT_IN_EXPERIMENT = ReasonCodes.ACTIVITY_LAUNCH_NOT_IN_EXPERIMENT;
if (ACTIVITY_LAUNCH_NOT_IN_EXPERIMENT === a0) {
return intl.string(t.GyzcrS);
}
ReasonCodes = (importDefault(8059) /* metro dependency 8059: InteractionCallbackError */).ReasonCodes;
const ACTIVITY_LAUNCH_INVALID_USER_VERIFICATION_LEVEL = ReasonCodes.ACTIVITY_LAUNCH_INVALID_USER_VERIFICATION_LEVEL;
if (ACTIVITY_LAUNCH_INVALID_USER_VERIFICATION_LEVEL === a0) {
return intl.string(t.hHGrWz);
}
ReasonCodes = (importDefault(8059) /* metro dependency 8059: InteractionCallbackError */).ReasonCodes;
const ACTIVITY_LAUNCH_INVALID_USER_PERMISSIONS = ReasonCodes.ACTIVITY_LAUNCH_INVALID_USER_PERMISSIONS;
if (ACTIVITY_LAUNCH_INVALID_USER_PERMISSIONS === a0) {
return intl.string(t.hHGrWz);
}
ReasonCodes = (importDefault(8059) /* metro dependency 8059: InteractionCallbackError */).ReasonCodes;
const ACTIVITY_LAUNCH_UNKNOWN_CHANNEL = ReasonCodes.ACTIVITY_LAUNCH_UNKNOWN_CHANNEL;
if (ACTIVITY_LAUNCH_UNKNOWN_CHANNEL === a0) {
return intl.string(t.j29zCr);
}
ReasonCodes = (importDefault(8059) /* metro dependency 8059: InteractionCallbackError */).ReasonCodes;
const ACTIVITY_LAUNCH_UNKNOWN_GUILD = ReasonCodes.ACTIVITY_LAUNCH_UNKNOWN_GUILD;
if (ACTIVITY_LAUNCH_UNKNOWN_GUILD === a0) {
return intl.string(t.j29zCr);
}
ReasonCodes = (importDefault(8059) /* metro dependency 8059: InteractionCallbackError */).ReasonCodes;
const ACTIVITY_LAUNCH_INVALID_CHANNEL_TYPE = ReasonCodes.ACTIVITY_LAUNCH_INVALID_CHANNEL_TYPE;
if (ACTIVITY_LAUNCH_INVALID_CHANNEL_TYPE === a0) {
return intl.string(t.j29zCr);
}
ReasonCodes = (importDefault(8059) /* metro dependency 8059: InteractionCallbackError */).ReasonCodes;
const ACTIVITY_LAUNCH_INVALID_CHANNEL_NO_AFK = ReasonCodes.ACTIVITY_LAUNCH_INVALID_CHANNEL_NO_AFK;
if (ACTIVITY_LAUNCH_INVALID_CHANNEL_NO_AFK === a0) {
return intl.string(t.j29zCr);
}
ReasonCodes = (importDefault(8059) /* metro dependency 8059: InteractionCallbackError */).ReasonCodes;
const ACTIVITY_LAUNCH_INVALID_USER_AGE_GATE = ReasonCodes.ACTIVITY_LAUNCH_INVALID_USER_AGE_GATE;
if (ACTIVITY_LAUNCH_INVALID_USER_AGE_GATE === a0) {
return intl.string(t['4WuFRE']);
}
ReasonCodes = (importDefault(8059) /* metro dependency 8059: InteractionCallbackError */).ReasonCodes;
const ACTIVITY_LAUNCH_INVALID_DEV_PREVIEW_GUILD_SIZE = ReasonCodes.ACTIVITY_LAUNCH_INVALID_DEV_PREVIEW_GUILD_SIZE;
if (ACTIVITY_LAUNCH_INVALID_DEV_PREVIEW_GUILD_SIZE === a0) {
return intl.string(t.RvkXdb);
}
ReasonCodes = (importDefault(8059) /* metro dependency 8059: InteractionCallbackError */).ReasonCodes;
const ACTIVITY_LAUNCH_INVALID_CONFIGURATION_PLATFORM_NOT_SUPPORTED = ReasonCodes.ACTIVITY_LAUNCH_INVALID_CONFIGURATION_PLATFORM_NOT_SUPPORTED;
if (ACTIVITY_LAUNCH_INVALID_CONFIGURATION_PLATFORM_NOT_SUPPORTED === a0) {
return intl.string(t.uGDCcw);
}
ReasonCodes = (importDefault(8059) /* metro dependency 8059: InteractionCallbackError */).ReasonCodes;
const ACTIVITY_LAUNCH_INVALID_CONFIGURATION_PLATFORM_NOT_RELEASED = ReasonCodes.ACTIVITY_LAUNCH_INVALID_CONFIGURATION_PLATFORM_NOT_RELEASED;
if (ACTIVITY_LAUNCH_INVALID_CONFIGURATION_PLATFORM_NOT_RELEASED === a0) {
return intl.string(t.uGDCcw);
}
ReasonCodes = (importDefault(8059) /* metro dependency 8059: InteractionCallbackError */).ReasonCodes;
const ACTIVITY_LAUNCH_INVALID_USER_NO_ACCESS_TO_ACTIVITY = ReasonCodes.ACTIVITY_LAUNCH_INVALID_USER_NO_ACCESS_TO_ACTIVITY;
if (ACTIVITY_LAUNCH_INVALID_USER_NO_ACCESS_TO_ACTIVITY === a0) {
return intl.string(t.WjNAAA);
}
ReasonCodes = (importDefault(8059) /* metro dependency 8059: InteractionCallbackError */).ReasonCodes;
const ACTIVITY_LAUNCH_INVALID_LOCATION_TYPE = ReasonCodes.ACTIVITY_LAUNCH_INVALID_LOCATION_TYPE;
if (ACTIVITY_LAUNCH_INVALID_LOCATION_TYPE === a0) {
return intl.string(t.PtobXW);
}
ReasonCodes = (importDefault(8059) /* metro dependency 8059: InteractionCallbackError */).ReasonCodes;
const ACTIVITY_LAUNCH_INVALID_USER_REGION_FOR_APPLICATION = ReasonCodes.ACTIVITY_LAUNCH_INVALID_USER_REGION_FOR_APPLICATION;
if (ACTIVITY_LAUNCH_INVALID_USER_REGION_FOR_APPLICATION === a0) {
return intl.string(t.PrHIM5);
}
}
async function _fun63915({componentType, messageId, messageFlags, customId, componentId, applicationId, channelId, guildId, localState}) { // fn#63915, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8234:1419, offset: 0x01b958c4, size: 576 bytes, params: 2, frame: 35
var r25;
var environment;
var value6;
var binding2;
var value9;
var addQueued;
var object2;
var InteractionTypes;
var MESSAGE_COMPONENT;
var binding3;
var object4;
var HTTP;
if (true) {
await undefined;
if (false) {
return undefined;
}
value = environment.__proto__.__proto__;
var binding = env2_1;
var value4 = binding(env2_2[5]);
var fromTimestamp = value4.fromTimestamp;
var Date = global.Date;
var value5 = Reflect.apply(fromTimestamp, value4, [Date.now()]);
if (Reflect.apply(env2_6.canQueueInteraction, binding, [messageId, value5])) {
binding = env2_1;
value6 = binding(env2_2[6]);
await value6.unarchiveThreadIfNecessary(channelId);
if (false) {
return undefined;
}
binding = env2_0;
binding2 = env2_2;
value9 = binding(binding2[7]);
addQueued = value9.addQueued;
object2 = {messageId: messageId};
InteractionTypes = binding(binding2[8]).InteractionTypes;
MESSAGE_COMPONENT = InteractionTypes.MESSAGE_COMPONENT;
object2.data = {interactionType: MESSAGE_COMPONENT, applicationId: applicationId, customId: customId,
componentId: componentId};
object2.onFailure = onFailure_63916;
Reflect.apply(addQueued, value9, [value5, object2]);
if (localState != null) {
env2_0(env2_2[7]).queueInteractionComponentState(messageId, value5, localState, componentId);
r25 = localState;
}
object2 = {};
binding = env2_0;
binding3 = env2_2;
InteractionTypes = binding(binding3[8]).InteractionTypes;
MESSAGE_COMPONENT = InteractionTypes.MESSAGE_COMPONENT;
object2.type = MESSAGE_COMPONENT;
object2.nonce = value5;
object2.guild_id = guildId;
object2.channel_id = channelId;
object2.message_flags = messageFlags;
object2.message_id = messageId;
object2.application_id = applicationId;
object2.session_id = env2_5.getSessionId();
object4 = {component_type: componentType, custom_id: customId};
copyDataProperties(object4, env2_18(localState), r25);
object2.data = object4;
HTTP = binding(binding3[9]).HTTP;
await HTTP.post({url: env2_7.INTERACTIONS, body: object2, timeout: 3000, rejectWithError: false},
_fun63917);
return undefined;
}
}
}
function onFailure_63916(a0, a1) { // fn#63916, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8234:1818, offset: 0x01b95b04, size: 31 bytes, params: 3, frame: 15
return env3_11(channelId, a0, a1);
}
function _fun63917(a0) { // fn#63917, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8234:2243, offset: 0x01b95b23, size: 39 bytes, params: 2, frame: 19
env3_12(env0_3, a0, applicationId, channelId, guildId);
}