130 lines
6.6 KiB
TypeScript
130 lines
6.6 KiB
TypeScript
/* Metro module 8360; source: modules/interaction_components/validateComponent.tsx; dependencies: [1909, 4627, 1244, 44, 2] */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
|
|
function _fun66584(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#66584, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8545:6, offset: 0x01c01366, size: 114 bytes, params: 8, frame: 18
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/interaction_components/validateComponent.tsx');
|
|
exports.default = validateComponent;
|
|
function validateSelect({minValues, maxValues, required}, a1, a2) { // fn#66585, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8545:111, offset: 0x01c013d8, size: 381 bytes, params: 4, frame: 20
|
|
const intl = (IndexNativeModule).intl;
|
|
const t = (IndexNativeModule).t;
|
|
var moduleValue;
|
|
const value = null;
|
|
let r0 = value == a1 ? 0 : a1.type === (require(1909) /* metro dependency 1909: Server */).ComponentType.STRING_SELECT ? a1.values.length : a1.selectedOptions.length;
|
|
if (r0 === 0) {
|
|
moduleValue = require(4627) /* metro dependency 4627: InteractionComponentUtils */;
|
|
r0 = moduleValue.canSelectBeEmpty({minValues: minValues, required: required},
|
|
a2) ? value : intl.string(t.eJEUvD);
|
|
} else {
|
|
r0 = r0 < minValues ? intl.formatToPlainString(t.Jmwzdx,
|
|
{count: minValues}) : r0 > maxValues ? intl.formatToPlainString(t.LDvfRP, {count: maxValues}) : value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function validateComponent(a0, a1, a2) { // fn#66586, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8545:645, offset: 0x01c01555, size: 1340 bytes, params: 4, frame: 25
|
|
var length;
|
|
var r2;
|
|
var minValues;
|
|
var maxValues;
|
|
var required;
|
|
const intl = (IndexNativeModule).intl;
|
|
const t = (IndexNativeModule).t;
|
|
var minLength;
|
|
var maxLength;
|
|
const value = null;
|
|
if (value != a1) {
|
|
(importDefault(44) /* metro dependency 44 */)(a1.type === a0.type, 'component type matches state');
|
|
}
|
|
const type = a0.type;
|
|
const value4 = 0;
|
|
const value5 = undefined;
|
|
let ComponentType = require(dependencyMap[value4]).ComponentType;
|
|
const BUTTON = ComponentType.BUTTON;
|
|
if (BUTTON === type) {
|
|
return value;
|
|
}
|
|
ComponentType = require(dependencyMap[value4]).ComponentType;
|
|
const STRING_SELECT = ComponentType.STRING_SELECT;
|
|
if (STRING_SELECT === type) {
|
|
return validateSelect(a0, a1, a2);
|
|
}
|
|
ComponentType = require(dependencyMap[value4]).ComponentType;
|
|
const USER_SELECT = ComponentType.USER_SELECT;
|
|
if (USER_SELECT === type) {
|
|
return validateSelect(a0, a1, a2);
|
|
}
|
|
ComponentType = require(dependencyMap[value4]).ComponentType;
|
|
const ROLE_SELECT = ComponentType.ROLE_SELECT;
|
|
if (ROLE_SELECT === type) {
|
|
return validateSelect(a0, a1, a2);
|
|
}
|
|
ComponentType = require(dependencyMap[value4]).ComponentType;
|
|
const MENTIONABLE_SELECT = ComponentType.MENTIONABLE_SELECT;
|
|
if (MENTIONABLE_SELECT === type) {
|
|
return validateSelect(a0, a1, a2);
|
|
}
|
|
ComponentType = require(dependencyMap[value4]).ComponentType;
|
|
const CHANNEL_SELECT = ComponentType.CHANNEL_SELECT;
|
|
if (CHANNEL_SELECT === type) {
|
|
return validateSelect(a0, a1, a2);
|
|
}
|
|
ComponentType = require(dependencyMap[value4]).ComponentType;
|
|
const TEXT_INPUT = ComponentType.TEXT_INPUT;
|
|
if (TEXT_INPUT === type) {
|
|
minLength = a0.minLength;
|
|
maxLength = a0.maxLength;
|
|
return value == a1 || value4 === a1.value.length ? a0.required ? intl.string(t.eJEUvD) : value : a1.value.length < minLength || a1.value.length > maxLength ? intl.formatToPlainString(t.ONSqYd,
|
|
|
|
{min: minLength, max: maxLength}) : value;
|
|
}
|
|
ComponentType = require(dependencyMap[value4]).ComponentType;
|
|
const FILE_UPLOAD = ComponentType.FILE_UPLOAD;
|
|
if (FILE_UPLOAD === type) {
|
|
minValues = a0.minValues;
|
|
maxValues = a0.maxValues;
|
|
required = a0.required;
|
|
length = value == a1 ? value5 : a1.uploadIds.length;
|
|
r2 = value != length ? length : value4;
|
|
r2 = value4 === r2 ? required ? intl.string(t.eJEUvD) : value : r2 < minValues ? intl.formatToPlainString(t.pmAt62,
|
|
|
|
{minValues: minValues}) : r2 > maxValues ? intl.formatToPlainString(t.dy6viJ,
|
|
{maxValues: maxValues}) : value;
|
|
return r2;
|
|
}
|
|
ComponentType = require(dependencyMap[value4]).ComponentType;
|
|
const RADIO_GROUP = ComponentType.RADIO_GROUP;
|
|
if (RADIO_GROUP === type) {
|
|
required = a0.required;
|
|
return value == a1 ? required ? intl.string(t.eJEUvD) : value : value != a1.value ? value : required ? intl.string(t.eJEUvD) : value;
|
|
}
|
|
ComponentType = require(dependencyMap[value4]).ComponentType;
|
|
const CHECKBOX_GROUP = ComponentType.CHECKBOX_GROUP;
|
|
if (CHECKBOX_GROUP === type) {
|
|
minValues = a0.minValues;
|
|
maxValues = a0.maxValues;
|
|
required = a0.required;
|
|
length = value == a1 ? value5 : a1.values.length;
|
|
r2 = value != length ? length : value4;
|
|
r2 = value4 === r2 ? required ? intl.string(t.eJEUvD) : value : r2 < minValues ? intl.formatToPlainString(t.Jmwzdx,
|
|
|
|
{count: minValues}) : r2 > maxValues ? intl.formatToPlainString(t.LDvfRP, {count: maxValues}) : value;
|
|
return r2;
|
|
}
|
|
ComponentType = require(dependencyMap[value4]).ComponentType;
|
|
const CHECKBOX = ComponentType.CHECKBOX;
|
|
if (CHECKBOX === type) {
|
|
return value;
|
|
}
|
|
(importDefault(44) /* metro dependency 44 */)(false, 'missing validator for this component');
|
|
return value5;
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun66584, 8360, [1909, 4627, 1244, 44,
|
|
2]) /* metro module 8360, dependencies: [1909, 4627, 1244, 44, 2] */;
|