1100 lines
46 KiB
TypeScript
1100 lines
46 KiB
TypeScript
/* Metro module 4627; source: modules/interaction_components/InteractionComponentUtils.tsx; dependencies: [4628, 3, 1423, 1244, 1909, 4629, 4630, 491, 1360, 4633, 673, 21, 2] */
|
|
import Logger from '../debug/Logger.tsx'; /* Metro dependency 3 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
import * as GlobalUtilsModule from '../../utils/GlobalUtils.tsx'; /* Metro dependency 1360 */
|
|
import * as ServerModule from '../../flow/Server.tsx'; /* Metro dependency 1909 */
|
|
import * as CheckpointConstantsModule from '../checkpoint/CheckpointConstants.tsx'; /* Metro dependency 4628 */
|
|
import * as InteractionComponentTypesModule from './InteractionComponentTypes.tsx'; /* Metro dependency 4633 */
|
|
|
|
function _fun39800(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#39800, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:6, offset: 0x010eb252, size: 349 bytes, params: 8, frame: 21
|
|
let env0_0 = require;
|
|
const _arrayLikeToArray_39803 = 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;
|
|
};
|
|
let closure = function(a0) {
|
|
var r2;
|
|
var value6;
|
|
var Map = global.Map;
|
|
var value2 = new Map();
|
|
var value4 = _createForOfIteratorHelperLoose_39801(a0);
|
|
var value5 = value4();
|
|
if (!value5.done) {
|
|
for (r2 = value5; true; r2 = value6) {
|
|
flattenComponent(value2, r2.value);
|
|
value6 = value4();
|
|
if (value6.done) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return value2;
|
|
};
|
|
const findChildComponent2 = findChildComponent;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = Logger;
|
|
value = new value('InteractionComponentUtils');
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/interaction_components/InteractionComponentUtils.tsx');
|
|
exports.getLayoutComponentErrorText = getLayoutComponentErrorText;
|
|
exports.getSelectPlaceholder = getSelectPlaceholder;
|
|
exports.canSelectBeEmpty = function({minValues, required}, a1) {
|
|
return a1 === 'modal' ? !required : minValues === 0;
|
|
};
|
|
exports.flattenComponents = closure;
|
|
exports.findChildComponent = findChildComponent2;
|
|
exports.getAllTextDisplayContent = getAllTextDisplayContent;
|
|
exports.getFirstInteractionComponentMedia = getFirstInteractionComponentMedia;
|
|
exports.getParents = function(a0, a1) {
|
|
var env0_0 = a1;
|
|
var closure = _fun39831;
|
|
var env0_1 = closure;
|
|
return closure(a0);
|
|
};
|
|
exports.makeComponentUploadId = makeComponentUploadId;
|
|
exports.deserializeComponentUploadId = function(a0) {
|
|
var r3;
|
|
var r0;
|
|
var property;
|
|
var value2;
|
|
var value3;
|
|
var value4;
|
|
var error;
|
|
var value = undefined;
|
|
try {
|
|
property = global.JSON;
|
|
value2 = property.parse(a0);
|
|
value3 = null;
|
|
value4 = value3 == value2;
|
|
if (value4) {
|
|
r3 = value;
|
|
} else {
|
|
property = value2.type;
|
|
r3 = property;
|
|
}
|
|
value = r3 !== 'component-upload';
|
|
if (value) {
|
|
r0 = value3;
|
|
} else {
|
|
property = value2.containerId;
|
|
value = typeof property !== 'string';
|
|
if (value) {
|
|
r0 = value3;
|
|
} else {
|
|
property = value2.uniqueId;
|
|
value = typeof property !== 'string';
|
|
r0 = value ? value3 : value2;
|
|
}
|
|
}
|
|
} catch (error) {
|
|
return null;
|
|
}
|
|
return r0;
|
|
};
|
|
exports.transformComponents = function(a0) {
|
|
return a0.map(_fun39836).filter(_fun39837);
|
|
};
|
|
function _createForOfIteratorHelperLoose_39801(a0, a1) { // fn#39801, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:130, offset: 0x010eb3af, 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 _fun39802;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_39803(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_39803(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_39803(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun39802;
|
|
}
|
|
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 _fun39802() { // fn#39802, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:701, 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 flattenComponent(a0, a1) { // fn#39805, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:1376, offset: 0x010eb57a, size: 228 bytes, params: 3, frame: 18
|
|
const env0_0 = a0;
|
|
a0.set(a1.id, a1);
|
|
const type = a1.type;
|
|
const ComponentType = (ServerModule).ComponentType;
|
|
const ACTION_ROW = ComponentType.ACTION_ROW;
|
|
if (ACTION_ROW === type) {
|
|
a1.components.forEach(_fun39806);
|
|
} else if (ComponentType.SECTION === type) {
|
|
a1.components.forEach(_fun39807);
|
|
flattenComponent(a0, a1.accessory);
|
|
} else if (ComponentType.CONTAINER === type) {
|
|
a1.components.forEach(_fun39808);
|
|
}
|
|
function _fun39806(a0) { // fn#39806, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:1497, offset: 0x010eb65e, size: 27 bytes, params: 2, frame: 13
|
|
flattenComponent(env0_0, a0);
|
|
}
|
|
|
|
function _fun39807(a0) { // fn#39807, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:1588, offset: 0x010eb65e, size: 27 bytes, params: 2, frame: 13
|
|
flattenComponent(env0_0, a0);
|
|
}
|
|
|
|
function _fun39808(a0) { // fn#39808, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:1713, offset: 0x010eb65e, size: 27 bytes, params: 2, frame: 13
|
|
flattenComponent(env0_0, a0);
|
|
}
|
|
|
|
}
|
|
|
|
function findChildComponent(a0, a1) { // fn#39809, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:1741, offset: 0x010eb679, size: 260 bytes, params: 3, frame: 17
|
|
var r2;
|
|
var value2;
|
|
var value3;
|
|
var value4;
|
|
const env0_0 = a1;
|
|
const type = a0.type;
|
|
var value;
|
|
const ComponentType = (ServerModule).ComponentType;
|
|
const ACTION_ROW = ComponentType.ACTION_ROW;
|
|
if (ACTION_ROW === type) {
|
|
value = a0.components.find(function({id}) {
|
|
return id === require;
|
|
});
|
|
value4 = null;
|
|
return value4 != value ? value : value4;
|
|
}
|
|
const SECTION = ComponentType.SECTION;
|
|
if (SECTION === type) {
|
|
if (a0.accessory.id === a1) {
|
|
r2 = a0.accessory;
|
|
} else {
|
|
value = a0.components.find(function({id}) {
|
|
return id === require;
|
|
});
|
|
value3 = null;
|
|
r2 = value3 != value ? value : value3;
|
|
}
|
|
return r2;
|
|
}
|
|
const CONTAINER = ComponentType.CONTAINER;
|
|
if (CONTAINER === type) {
|
|
value = a0.components.find(function({id}) {
|
|
return id === require;
|
|
});
|
|
value2 = null;
|
|
return value2 != value ? value : value2;
|
|
}
|
|
}
|
|
|
|
function getComponentChildren(a0) { // fn#39813, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:2123, offset: 0x010eb77d, size: 908 bytes, params: 2, frame: 17
|
|
var items2;
|
|
var components;
|
|
let type = a0.type;
|
|
var value;
|
|
const ComponentType = (ServerModule).ComponentType;
|
|
const ACTION_ROW = ComponentType.ACTION_ROW;
|
|
if (ACTION_ROW === type) {
|
|
return a0.components;
|
|
}
|
|
const SECTION = ComponentType.SECTION;
|
|
if (SECTION === type) {
|
|
components = a0.components;
|
|
items2 = [];
|
|
value = arraySpread(items2, components, 0, 4);
|
|
items2[value] = a0.accessory;
|
|
value + 1;
|
|
return items2;
|
|
}
|
|
const CONTAINER = ComponentType.CONTAINER;
|
|
if (CONTAINER === type) {
|
|
return a0.components;
|
|
}
|
|
const LABEL = ComponentType.LABEL;
|
|
if (LABEL === type) {
|
|
return [a0.component];
|
|
}
|
|
const BUTTON = ComponentType.BUTTON;
|
|
if (BUTTON !== type) {
|
|
var STRING_SELECT = ComponentType.STRING_SELECT;
|
|
if (STRING_SELECT === type) {
|
|
return [];
|
|
}
|
|
var TEXT_INPUT = ComponentType.TEXT_INPUT;
|
|
if (TEXT_INPUT === type) {
|
|
return [];
|
|
}
|
|
var USER_SELECT = ComponentType.USER_SELECT;
|
|
if (USER_SELECT === type) {
|
|
return [];
|
|
}
|
|
var ROLE_SELECT = ComponentType.ROLE_SELECT;
|
|
if (ROLE_SELECT === type) {
|
|
return [];
|
|
}
|
|
var MENTIONABLE_SELECT = ComponentType.MENTIONABLE_SELECT;
|
|
if (MENTIONABLE_SELECT === type) {
|
|
return [];
|
|
}
|
|
var CHANNEL_SELECT = ComponentType.CHANNEL_SELECT;
|
|
if (CHANNEL_SELECT === type) {
|
|
return [];
|
|
}
|
|
var TEXT_DISPLAY = ComponentType.TEXT_DISPLAY;
|
|
if (TEXT_DISPLAY === type) {
|
|
return [];
|
|
}
|
|
var THUMBNAIL = ComponentType.THUMBNAIL;
|
|
if (THUMBNAIL === type) {
|
|
return [];
|
|
}
|
|
var MEDIA_GALLERY = ComponentType.MEDIA_GALLERY;
|
|
if (MEDIA_GALLERY === type) {
|
|
return [];
|
|
}
|
|
var FILE = ComponentType.FILE;
|
|
if (FILE === type) {
|
|
return [];
|
|
}
|
|
var SEPARATOR = ComponentType.SEPARATOR;
|
|
if (SEPARATOR === type) {
|
|
return [];
|
|
}
|
|
var CONTENT_INVENTORY_ENTRY = ComponentType.CONTENT_INVENTORY_ENTRY;
|
|
if (CONTENT_INVENTORY_ENTRY === type) {
|
|
return [];
|
|
}
|
|
var FILE_UPLOAD = ComponentType.FILE_UPLOAD;
|
|
if (FILE_UPLOAD === type) {
|
|
return [];
|
|
}
|
|
var CHECKPOINT_CARD = ComponentType.CHECKPOINT_CARD;
|
|
if (CHECKPOINT_CARD === type) {
|
|
return [];
|
|
}
|
|
var RADIO_GROUP = ComponentType.RADIO_GROUP;
|
|
if (RADIO_GROUP === type) {
|
|
return [];
|
|
}
|
|
var CHECKBOX_GROUP = ComponentType.CHECKBOX_GROUP;
|
|
if (CHECKBOX_GROUP === type) {
|
|
return [];
|
|
}
|
|
var CHECKBOX = ComponentType.CHECKBOX;
|
|
if (CHECKBOX === type) {
|
|
return [];
|
|
}
|
|
var binding = env0_4;
|
|
var warn = binding.warn;
|
|
type = a0.type;
|
|
Reflect.apply(warn, binding, ['getComponentChildren: Unknown component type', type]);
|
|
}
|
|
return [];
|
|
}
|
|
|
|
function transformComponent(a0, a1) { // fn#39814, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:3238, offset: 0x010ebb09, size: 4526 bytes, params: 3, frame: 27
|
|
var r5;
|
|
var r6;
|
|
var r11;
|
|
var emoji_id;
|
|
var r10;
|
|
var binding;
|
|
var warn;
|
|
var object;
|
|
var required;
|
|
var checkpoint_data;
|
|
var version;
|
|
var V2025;
|
|
var value5;
|
|
var object2;
|
|
var top_guild;
|
|
var object3;
|
|
var top_emoji;
|
|
var isProbablyAValidSnowflake;
|
|
var top_game;
|
|
var object5;
|
|
var childComponent2;
|
|
var value7;
|
|
const isNotNullish = (GlobalUtilsModule).isNotNullish;
|
|
var value9;
|
|
var content_inventory_entry;
|
|
var value10;
|
|
var divider;
|
|
var value13;
|
|
var accessory;
|
|
var length;
|
|
var childComponent22;
|
|
var value15;
|
|
var value18;
|
|
const env0_0 = a1;
|
|
const getChildComponent2 = getChildComponent;
|
|
let type = a0.type;
|
|
var value;
|
|
const value2 = undefined;
|
|
const ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType;
|
|
const ACTION_ROW = ComponentType.ACTION_ROW;
|
|
const value3 = true;
|
|
if (ACTION_ROW === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.BUTTON === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.STRING_SELECT === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.TEXT_INPUT === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.USER_SELECT === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.ROLE_SELECT === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.MENTIONABLE_SELECT === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.CHANNEL_SELECT === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.SECTION === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.TEXT_DISPLAY === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.THUMBNAIL === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.MEDIA_GALLERY === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.FILE === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.SEPARATOR === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.CONTAINER === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.LABEL === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.FILE_UPLOAD === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.CHECKPOINT_CARD === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.RADIO_GROUP === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.CHECKBOX_GROUP === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.CHECKBOX === type) {
|
|
r5 = value3;
|
|
} else if (ComponentType.CONTENT_INVENTORY_ENTRY === type) {
|
|
r5 = value3;
|
|
} else {
|
|
ComponentType.UNKNOWN;
|
|
r5 = false;
|
|
}
|
|
if (r5) {
|
|
type = a0.type;
|
|
if (ComponentType.ACTION_ROW === type) {
|
|
value18 = a0.components.map(function(a0, a1) {
|
|
return getChildComponent(a0, a1);
|
|
}).filter(isNotNullish);
|
|
object = {};
|
|
object.type = ComponentType.ACTION_ROW;
|
|
object.id = indicesToId(a1);
|
|
object.components = value18;
|
|
return object;
|
|
}
|
|
if (ComponentType.BUTTON === type) {
|
|
r6 = a0.emoji != null ? getEmoji(a0.emoji, value3) : value2;
|
|
object = {};
|
|
object.type = ComponentType.BUTTON;
|
|
object.id = indicesToId(a1);
|
|
object.customId = a0.custom_id;
|
|
object.style = a0.style;
|
|
object.disabled = a0.disabled;
|
|
object.url = a0.url;
|
|
object.label = a0.label;
|
|
object.emoji = r6;
|
|
object.skuId = a0.sku_id;
|
|
return object;
|
|
}
|
|
if (ComponentType.STRING_SELECT === type) {
|
|
object = {};
|
|
object.type = ComponentType.STRING_SELECT;
|
|
object.id = indicesToId(a1);
|
|
object.customId = a0.custom_id;
|
|
object.disabled = a0.disabled;
|
|
required = a0.required;
|
|
object.required = required != null && required;
|
|
object.options = a0.options.map(_fun39817);
|
|
object.placeholder = a0.placeholder;
|
|
object.minValues = a0.min_values;
|
|
object.maxValues = a0.max_values;
|
|
return object;
|
|
}
|
|
if (ComponentType.TEXT_INPUT === type) {
|
|
object = {};
|
|
object.type = a0.type;
|
|
object.id = indicesToId(a1);
|
|
object.style = a0.style;
|
|
object.customId = a0.custom_id;
|
|
object.label = a0.label;
|
|
value = a0.value;
|
|
object.value = value;
|
|
object.placeholder = a0.placeholder;
|
|
object.disabled = a0.disabled;
|
|
required = a0.required;
|
|
value = required != null;
|
|
object.required = value && required;
|
|
object.minLength = a0.min_length;
|
|
object.maxLength = a0.max_length;
|
|
return object;
|
|
}
|
|
if (ComponentType.USER_SELECT === type) {
|
|
object = {};
|
|
object.type = ComponentType.USER_SELECT;
|
|
object.id = indicesToId(a1);
|
|
object.customId = a0.custom_id;
|
|
object.disabled = a0.disabled;
|
|
required = a0.required;
|
|
object.required = required != null && required;
|
|
object.placeholder = a0.placeholder;
|
|
object.minValues = a0.min_values;
|
|
object.maxValues = a0.max_values;
|
|
object.defaultValues = a0.default_values;
|
|
return object;
|
|
}
|
|
if (ComponentType.ROLE_SELECT === type) {
|
|
object = {};
|
|
object.type = ComponentType.ROLE_SELECT;
|
|
object.id = indicesToId(a1);
|
|
object.customId = a0.custom_id;
|
|
object.disabled = a0.disabled;
|
|
required = a0.required;
|
|
object.required = required != null && required;
|
|
object.placeholder = a0.placeholder;
|
|
object.minValues = a0.min_values;
|
|
object.maxValues = a0.max_values;
|
|
object.defaultValues = a0.default_values;
|
|
return object;
|
|
}
|
|
if (ComponentType.MENTIONABLE_SELECT === type) {
|
|
object = {};
|
|
object.type = ComponentType.MENTIONABLE_SELECT;
|
|
object.id = indicesToId(a1);
|
|
object.customId = a0.custom_id;
|
|
object.disabled = a0.disabled;
|
|
required = a0.required;
|
|
object.required = required != null && required;
|
|
object.placeholder = a0.placeholder;
|
|
object.minValues = a0.min_values;
|
|
object.maxValues = a0.max_values;
|
|
object.defaultValues = a0.default_values;
|
|
return object;
|
|
}
|
|
if (ComponentType.CHANNEL_SELECT === type) {
|
|
object = {};
|
|
object.type = ComponentType.CHANNEL_SELECT;
|
|
object.id = indicesToId(a1);
|
|
object.customId = a0.custom_id;
|
|
object.disabled = a0.disabled;
|
|
required = a0.required;
|
|
object.required = required != null && required;
|
|
object.placeholder = a0.placeholder;
|
|
object.minValues = a0.min_values;
|
|
object.maxValues = a0.max_values;
|
|
object.channelTypes = a0.channel_types;
|
|
object.defaultValues = a0.default_values;
|
|
return object;
|
|
}
|
|
if (ComponentType.SECTION === type) {
|
|
value13 = a0.components.map(_fun39818).filter(isNotNullish);
|
|
accessory = a0.accessory;
|
|
length = value13.length;
|
|
childComponent22 = getChildComponent2(accessory, length);
|
|
length = value13.length;
|
|
value15 = null;
|
|
if (length === 0) {
|
|
r5 = value15;
|
|
} else if (value15 == childComponent22) {
|
|
r5 = value15;
|
|
} else {
|
|
object = {};
|
|
object.type = ComponentType.SECTION;
|
|
object.id = indicesToId(a1);
|
|
object.components = value13;
|
|
object.accessory = childComponent22;
|
|
r5 = object;
|
|
}
|
|
return r5;
|
|
}
|
|
if (ComponentType.TEXT_DISPLAY === type) {
|
|
object = {};
|
|
object.type = ComponentType.TEXT_DISPLAY;
|
|
object.id = indicesToId(a1);
|
|
object.content = a0.content;
|
|
return object;
|
|
}
|
|
if (ComponentType.THUMBNAIL === type) {
|
|
object = {};
|
|
object.type = ComponentType.THUMBNAIL;
|
|
object.id = indicesToId(a1);
|
|
value = require(4630) /* metro dependency 4630: MediaTypes */;
|
|
object.media = value.toUnfurledMediaItem(a0.media);
|
|
object.description = a0.description;
|
|
object.spoiler = a0.spoiler;
|
|
return object;
|
|
}
|
|
if (ComponentType.MEDIA_GALLERY === type) {
|
|
object = {};
|
|
object.type = ComponentType.MEDIA_GALLERY;
|
|
object.id = indicesToId(a1);
|
|
object.items = a0.items.map(_fun39819);
|
|
return object;
|
|
}
|
|
if (ComponentType.FILE === type) {
|
|
object = {};
|
|
object.type = ComponentType.FILE;
|
|
object.id = indicesToId(a1);
|
|
value = require(4630) /* metro dependency 4630: MediaTypes */;
|
|
object.file = value.toUnfurledMediaItem(a0.file);
|
|
object.name = a0.name;
|
|
object.size = a0.size;
|
|
object.spoiler = a0.spoiler;
|
|
return object;
|
|
}
|
|
if (ComponentType.SEPARATOR === type) {
|
|
object = {};
|
|
object.type = ComponentType.SEPARATOR;
|
|
object.id = indicesToId(a1);
|
|
divider = a0.divider;
|
|
r6 = divider == null || divider;
|
|
object.divider = r6;
|
|
r6 = a0.spacing ?? (require(1909) /* metro dependency 1909: Server */).SeparatorSpacingSize.SMALL;
|
|
object.spacing = r6;
|
|
return object;
|
|
}
|
|
if (ComponentType.CONTENT_INVENTORY_ENTRY === type) {
|
|
content_inventory_entry = a0.content_inventory_entry;
|
|
value10 = null;
|
|
if (value10 == content_inventory_entry) {
|
|
r5 = value10;
|
|
} else {
|
|
object = {};
|
|
object.type = ComponentType.CONTENT_INVENTORY_ENTRY;
|
|
object.id = indicesToId(a1);
|
|
object.contentInventoryEntry = a0.content_inventory_entry;
|
|
r5 = object;
|
|
}
|
|
return r5;
|
|
}
|
|
if (ComponentType.CONTAINER === type) {
|
|
value9 = a0.components.map(_fun39820).filter(isNotNullish);
|
|
object = {};
|
|
object.type = ComponentType.CONTAINER;
|
|
object.id = indicesToId(a1);
|
|
if (a0.accent_color != null) {
|
|
value = require(673) /* metro dependency 673: ColorUtils */;
|
|
value = value.int2hsl(a0.accent_color, false);
|
|
r10 = value;
|
|
} else {
|
|
r10 = value2;
|
|
}
|
|
object.accentColor = r10;
|
|
object.spoiler = a0.spoiler;
|
|
object.components = value9;
|
|
return object;
|
|
}
|
|
if (ComponentType.LABEL === type) {
|
|
childComponent2 = getChildComponent2(a0.component, 0);
|
|
value7 = null;
|
|
if (value7 == childComponent2) {
|
|
r5 = value7;
|
|
} else {
|
|
object = {};
|
|
object.type = ComponentType.LABEL;
|
|
object.id = indicesToId(a1);
|
|
object.label = a0.label;
|
|
object.description = a0.description;
|
|
object.component = childComponent2;
|
|
r5 = object;
|
|
}
|
|
return r5;
|
|
}
|
|
if (ComponentType.FILE_UPLOAD === type) {
|
|
object = {};
|
|
object.type = a0.type;
|
|
object.id = indicesToId(a1);
|
|
object.customId = a0.custom_id;
|
|
object.disabled = a0.disabled;
|
|
required = a0.required;
|
|
object.required = required != null && required;
|
|
object.minValues = a0.min_values;
|
|
object.maxValues = a0.max_values;
|
|
return object;
|
|
}
|
|
if (ComponentType.CHECKPOINT_CARD === type) {
|
|
checkpoint_data = a0.checkpoint_data;
|
|
version = checkpoint_data.version;
|
|
V2025 = CheckpointVersions.V2025;
|
|
value5 = null;
|
|
if (version !== V2025) {
|
|
r5 = value5;
|
|
} else {
|
|
object = {};
|
|
object.type = a0.type;
|
|
object.id = indicesToId(a1);
|
|
object2 = {};
|
|
object2.version = checkpoint_data.version;
|
|
object2.cardId = checkpoint_data.card_id;
|
|
object2.powerLevel = checkpoint_data.power_level;
|
|
object2.powerLevelPercentile = checkpoint_data.power_level_percentile;
|
|
object2.numMessagesSent = checkpoint_data.num_messages_sent;
|
|
object2.totalVoiceMinutes = checkpoint_data.total_voice_minutes;
|
|
object2.numEmojisSent = checkpoint_data.num_emojis_sent;
|
|
top_guild = checkpoint_data.top_guild;
|
|
if (value5 != top_guild) {
|
|
object3 = {};
|
|
top_guild = checkpoint_data.top_guild;
|
|
object3.guildId = top_guild.guild_id;
|
|
top_guild = checkpoint_data.top_guild;
|
|
object3.guildName = top_guild.guild_name;
|
|
top_guild = checkpoint_data.top_guild;
|
|
object3.guildIcon = top_guild.guild_icon;
|
|
r11 = object3;
|
|
} else {
|
|
r11 = value2;
|
|
}
|
|
object2.topGuild = r11;
|
|
top_emoji = checkpoint_data.top_emoji;
|
|
if (value5 != top_emoji) {
|
|
value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
|
|
isProbablyAValidSnowflake = value.isProbablyAValidSnowflake;
|
|
top_emoji = checkpoint_data.top_emoji;
|
|
emoji_id = top_emoji.emoji_id;
|
|
emoji_id = Reflect.apply(isProbablyAValidSnowflake, value,
|
|
[emoji_id]) ? checkpoint_data.top_emoji.emoji_id : value2;
|
|
top_emoji = checkpoint_data.top_emoji;
|
|
r11 = {emojiId: emoji_id, emojiName: value5 == top_emoji ? value2 : top_emoji.emoji_name};
|
|
} else {
|
|
r11 = value2;
|
|
}
|
|
object2.topEmoji = r11;
|
|
top_game = checkpoint_data.top_game;
|
|
if (value5 != top_game) {
|
|
object5 = {};
|
|
top_game = checkpoint_data.top_game;
|
|
object5.applicationId = top_game.application_id;
|
|
top_game = checkpoint_data.top_game;
|
|
object5.applicationName = top_game.application_name;
|
|
top_game = checkpoint_data.top_game;
|
|
object5.applicationImageId = top_game.application_image_id;
|
|
r11 = object5;
|
|
} else {
|
|
r11 = value2;
|
|
}
|
|
object2.topGame = r11;
|
|
object.checkpointData = object2;
|
|
r5 = object;
|
|
}
|
|
return r5;
|
|
}
|
|
if (ComponentType.RADIO_GROUP === type) {
|
|
object = {};
|
|
object.type = a0.type;
|
|
object.id = indicesToId(a1);
|
|
object.customId = a0.custom_id;
|
|
object.options = a0.options;
|
|
required = a0.required;
|
|
object.required = required != null && required;
|
|
return object;
|
|
}
|
|
if (ComponentType.CHECKBOX_GROUP === type) {
|
|
object = {};
|
|
object.type = a0.type;
|
|
object.id = indicesToId(a1);
|
|
object.customId = a0.custom_id;
|
|
object.options = a0.options;
|
|
object.minValues = a0.min_values;
|
|
object.maxValues = a0.max_values;
|
|
required = a0.required;
|
|
object.required = required != null && required;
|
|
return object;
|
|
}
|
|
if (ComponentType.CHECKBOX === type) {
|
|
object = {};
|
|
object.type = a0.type;
|
|
object.id = indicesToId(a1);
|
|
object.customId = a0.custom_id;
|
|
object.default = a0.default;
|
|
return object;
|
|
}
|
|
binding = env0_4;
|
|
warn = binding.warn;
|
|
type = a0.type;
|
|
Reflect.apply(warn, binding, ['transformComponent: Unknown component type', type]);
|
|
}
|
|
return null;
|
|
function getChildComponent(a0, a1) { // fn#39815, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:4256, owner: transformComponent.getChildComponent, offset: 0x010eccb7, size: 67 bytes, params: 3, frame: 14
|
|
let value = environment.__proto__;
|
|
const transformComponentBinding = transformComponent;
|
|
const items2 = [];
|
|
value = arraySpread(items2, require, 0, transformComponentBinding);
|
|
items2[value] = a1;
|
|
value + 1;
|
|
value = transformComponentBinding(a0, items2);
|
|
const value2 = null;
|
|
return value2 == value ? value2 : value;
|
|
}
|
|
|
|
function _fun39817(a0) { // fn#39817, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:5031, offset: 0x010ecd11, size: 129 bytes, params: 2, frame: 15
|
|
const object = {};
|
|
const value = environment.__proto__;
|
|
const value2 = undefined;
|
|
const SelectOptionType = (InteractionComponentTypesModule).SelectOptionType;
|
|
const STRING = SelectOptionType.STRING;
|
|
object.type = STRING;
|
|
object.label = a0.label;
|
|
object.value = a0.value;
|
|
object.default = a0.default;
|
|
object.description = a0.description;
|
|
object.emoji = a0.emoji != null ? getEmoji(a0.emoji, env0_1) : value2;
|
|
return object;
|
|
}
|
|
|
|
function _fun39818(a0, a1) { // fn#39818, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:6806, offset: 0x010eccfa, size: 23 bytes, params: 3, frame: 13
|
|
return getChildComponent(a0, a1);
|
|
}
|
|
|
|
function _fun39819({media, description, spoiler}) { // fn#39819, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:7469, offset: 0x010ecd92, size: 74 bytes, params: 2, frame: 13
|
|
const object = {};
|
|
const value = environment.__proto__;
|
|
object.media = (require(4630) /* metro dependency 4630: MediaTypes */).toUnfurledMediaItem(media);
|
|
object.description = description;
|
|
object.spoiler = spoiler;
|
|
return object;
|
|
}
|
|
|
|
function _fun39820(a0, a1) { // fn#39820, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:8228, offset: 0x010eccfa, size: 23 bytes, params: 3, frame: 13
|
|
return getChildComponent(a0, a1);
|
|
}
|
|
|
|
}
|
|
|
|
function indicesToId(a0) { // fn#39821, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:10327, offset: 0x010ecddc, size: 55 bytes, params: 2, frame: 13
|
|
return InteractionComponentTypesModule.asComponentId(a0.join(','));
|
|
}
|
|
|
|
function getEmoji(a0, a1) { // fn#39822, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:1097, offset: 0x010ece13, size: 135 bytes, params: 3, frame: 15
|
|
var r1;
|
|
var getEmojiURL;
|
|
const object = {};
|
|
object.id = a0.id;
|
|
object.name = a0.name;
|
|
let animated = a0.animated;
|
|
object.animated = animated;
|
|
let value = undefined;
|
|
if (a1) {
|
|
if (a0.id != null) {
|
|
value = importDefault(1423) /* metro dependency 1423: AvatarUtils */;
|
|
getEmojiURL = value.getEmojiURL;
|
|
animated = a0.animated;
|
|
animated = !!animated && animated;
|
|
value = Reflect.apply(getEmojiURL, value, [{id: a0.id, animated: animated, size: 48}]);
|
|
r1 = value;
|
|
} else {
|
|
r1 = value;
|
|
}
|
|
} else {
|
|
r1 = value;
|
|
}
|
|
object.src = r1;
|
|
return object;
|
|
}
|
|
|
|
function getLayoutComponentErrorText(a0, a1, a2) { // fn#39823, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:10521, offset: 0x010ece9a, size: 328 bytes, params: 4, frame: 19
|
|
var interactionError;
|
|
const intl = (IndexNativeModule).intl;
|
|
const t = (IndexNativeModule).t;
|
|
const value = null;
|
|
const value2 = undefined;
|
|
const interactionType = value == a0 ? value2 : a0.data.interactionType;
|
|
const InteractionTypes = (ServerModule).InteractionTypes;
|
|
const MESSAGE_COMPONENT = InteractionTypes.MESSAGE_COMPONENT;
|
|
const componentId = interactionType !== MESSAGE_COMPONENT || (value == a0 ? value2 : a0.state) !== (require(4629) /* metro dependency 4629: InteractionTypes */).InteractionState.FAILED ? value : a0.data.componentId;
|
|
if (value != (value != componentId ? findChildComponent(a2, componentId) : value)) {
|
|
interactionError = value == a1 ? value2 : a1.interactionError;
|
|
return value != interactionError ? interactionError : (value == a0 ? value2 : a0.errorCode) === 429 ? intl.string(t.fitPBS) : intl.string(t.VCsUJu);
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
function getSelectPlaceholder({placeholder}) { // fn#39824, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:10959, offset: 0x010ecfe2, size: 77 bytes, params: 2, frame: 15
|
|
var r0;
|
|
var intl;
|
|
if (placeholder != null) {
|
|
r0 = placeholder;
|
|
} else {
|
|
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
r0 = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.Otr6W2);
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function getAllTextDisplayContent(a0) { // fn#39826, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:11282, offset: 0x010ed056, size: 105 bytes, params: 2, frame: 13
|
|
let value = flattenComponents(a0);
|
|
const Array = global.Array;
|
|
value = Array.from(value.values());
|
|
value = value.filter(function({type}) {
|
|
return type === require(dependencyMap[4]).ComponentType.TEXT_DISPLAY;
|
|
});
|
|
value = value.map(function(a0) {
|
|
return a0.content;
|
|
});
|
|
value = value.join('\n');
|
|
return value === '' ? null : value;
|
|
}
|
|
|
|
function getFirstInteractionComponentMedia(a0) { // fn#39829, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:11518, offset: 0x010ed0f2, size: 398 bytes, params: 2, frame: 28
|
|
var r5;
|
|
var value5;
|
|
var type;
|
|
const ComponentType = (ServerModule).ComponentType;
|
|
var MEDIA_GALLERY;
|
|
var THUMBNAIL;
|
|
var moduleValue;
|
|
var getUnfurledMediaItemType;
|
|
var media;
|
|
var value6;
|
|
var object;
|
|
var items2;
|
|
var property;
|
|
var moduleValue2;
|
|
var value7;
|
|
var value8;
|
|
const _createForOfIteratorHelperLoose_39801Binding = _createForOfIteratorHelperLoose_39801;
|
|
const value2 = flattenComponents(a0);
|
|
const value3 = _createForOfIteratorHelperLoose_39801Binding(value2.values());
|
|
const value4 = value3();
|
|
let done = value4.done;
|
|
if (!done) {
|
|
r5 = value4;
|
|
reducibleLoop1: while (true) {
|
|
value5 = r5.value;
|
|
type = value5.type;
|
|
MEDIA_GALLERY = ComponentType.MEDIA_GALLERY;
|
|
if (type === MEDIA_GALLERY) {
|
|
items2 = value5.items;
|
|
property = items2[0];
|
|
reducibleJoin8: while (true) {
|
|
if (property == null) {
|
|
break reducibleJoin8;
|
|
}
|
|
moduleValue2 = require(4630) /* metro dependency 4630: MediaTypes */;
|
|
getUnfurledMediaItemType = moduleValue2.getUnfurledMediaItemType;
|
|
media = property.media;
|
|
value7 = Reflect.apply(getUnfurledMediaItemType, moduleValue2, [media]);
|
|
if (value7 !== 'INVALID') {
|
|
object = {};
|
|
copyDataProperties(object, property.media, value7);
|
|
object['type'] = value7;
|
|
object['alt'] = property.description;
|
|
return object;
|
|
}
|
|
break reducibleJoin8;
|
|
}
|
|
} else {
|
|
type = value5.type;
|
|
THUMBNAIL = ComponentType.THUMBNAIL;
|
|
reducibleJoin8: while (true) {
|
|
if (type !== THUMBNAIL) {
|
|
break reducibleJoin8;
|
|
}
|
|
moduleValue = require(4630) /* metro dependency 4630: MediaTypes */;
|
|
getUnfurledMediaItemType = moduleValue.getUnfurledMediaItemType;
|
|
media = value5.media;
|
|
value6 = Reflect.apply(getUnfurledMediaItemType, moduleValue, [media]);
|
|
if (value6 !== 'INVALID') {
|
|
object = {};
|
|
copyDataProperties(object, value5.media, value6);
|
|
object['type'] = value6;
|
|
object['alt'] = value5.description;
|
|
return object;
|
|
}
|
|
break reducibleJoin8;
|
|
}
|
|
}
|
|
value8 = value3();
|
|
done = value8.done;
|
|
if (done) {
|
|
return null;
|
|
}
|
|
r5 = value8;
|
|
continue reducibleLoop1;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function getParents(a0, a1) { // fn#39830, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:12055, offset: 0x010ed280, size: 30 bytes, params: 3, frame: 11
|
|
const env0_0 = a1;
|
|
return search(a0);
|
|
function search(a0) { // fn#39831, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:12087, owner: getParents.search, offset: 0x010ed29e, size: 161 bytes, params: 2, frame: 24
|
|
var r13;
|
|
var environment;
|
|
var items2;
|
|
var value5;
|
|
var componentChildren;
|
|
var some;
|
|
var value7;
|
|
var searchBinding;
|
|
var value8;
|
|
var value9;
|
|
let value = a1;
|
|
const r3 = value !== undefined ? value : [];
|
|
value = environment.__proto__;
|
|
const value2 = _createForOfIteratorHelperLoose_39801(a0);
|
|
const value3 = value2();
|
|
let done = value3.done;
|
|
if (done) {
|
|
return null;
|
|
}
|
|
let r7 = value3;
|
|
loopExit3: while (true) {
|
|
value5 = r7.value;
|
|
componentChildren = getComponentChildren(value5);
|
|
some = componentChildren.some;
|
|
value7 = Reflect.apply(some, componentChildren, [function({id}) {
|
|
return id === require.id;
|
|
}]);
|
|
items2 = [];
|
|
if (value7) {
|
|
items2[0] = value5;
|
|
arraySpread(items2, r3, 1, r13);
|
|
return items2;
|
|
}
|
|
searchBinding = search;
|
|
items2[0] = value5;
|
|
arraySpread(items2, r3, 1, r13);
|
|
value8 = searchBinding(componentChildren, items2);
|
|
if (value8 != null) {
|
|
break loopExit3;
|
|
}
|
|
value9 = value2();
|
|
done = value9.done;
|
|
if (done) {
|
|
return null;
|
|
}
|
|
r7 = value9;
|
|
r13 = value9;
|
|
continue;
|
|
}
|
|
return value8;
|
|
}
|
|
|
|
}
|
|
|
|
function makeComponentUploadId(a0) { // fn#39833, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:12344, offset: 0x010ed359, size: 124 bytes, params: 2, frame: 15
|
|
const randomUUID = global.crypto.randomUUID;
|
|
let value = undefined;
|
|
let r1 = randomUUID == null ? value : global.crypto.randomUUID();
|
|
if (r1 == null) {
|
|
value = require(491) /* metro dependency 491 */;
|
|
value = value.v4();
|
|
r1 = value;
|
|
}
|
|
const JSON = global.JSON;
|
|
return JSON.stringify({type: 'component-upload', containerId: a0, uniqueId: r1});
|
|
}
|
|
|
|
function transformComponents(a0) { // fn#39835, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:12800, offset: 0x010ed442, size: 37 bytes, params: 2, frame: 12
|
|
return a0.map(function(a0, a1) {
|
|
return transformComponent(a0, [a1]);
|
|
}).filter(function(a0) {
|
|
return a0 != null;
|
|
});
|
|
function _fun39836(a0, a1) { // fn#39836, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:12846, offset: 0x010ed467, size: 31 bytes, params: 3, frame: 13
|
|
return transformComponent(a0, [a1]);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function _fun39837(a0) { // fn#39837, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4805:12889, offset: 0x00d0b2f0, size: 11 bytes, params: 2, frame: 2
|
|
return a0 != null;
|
|
}
|
|
|
|
global.__d(_fun39800, 4627, [4628, 3, 1423, 1244, 1909, 4629, 4630, 491, 1360, 4633, 673, 21,
|
|
2]) /* metro module 4627, dependencies: [4628, 3, 1423, 1244, 1909, 4629, 4630, 491, 1360, 4633, 673, 21, 2] */;
|