Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4973.js (118.4 MB)
101 lines
3.8 KiB
TypeScript
101 lines
3.8 KiB
TypeScript
// Module ID: 10039
|
|
// Function ID: 10040
|
|
// Name: FriendsUtils
|
|
// Dependencies: [32, 1074, 1115, 38, 1241, 8679, 2]
|
|
// Exports: humanizeAbortCodeForA11y, isValidDiscordTag
|
|
|
|
// Module 10039 (FriendsUtils)
|
|
import _modDef38 from "module_38" /* 38 */;
|
|
import util from "util" /* 1115 */;
|
|
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1241 */;
|
|
import ValidationUtilsDefault from "ValidationUtils" /* 8679 */;
|
|
import _slicedToArray from "module_32" /* 32 */;
|
|
|
|
require = fn;
|
|
function validateDiscordTag(substr) {
|
|
let stringResult = null;
|
|
if (!re8.test(substr)) {
|
|
if (!substr.includes("#")) {
|
|
const tmp4 = _slicedToArray(substr.split("#"), 2);
|
|
let str2 = tmp4[1];
|
|
const obj2 = { reason: "Invalid Username", query: substr, discrim_len: null, username_len: null, is_email_like: null, is_invite_like: null, is_num_only: null };
|
|
if (str2 == null) {
|
|
str2 = "";
|
|
}
|
|
obj2.discrim_len = str2.length;
|
|
obj2.username_len = tmp4[0].length;
|
|
const obj = AnalyticsUtilsDefault;
|
|
obj2.is_email_like = ValidationUtilsDefault.isEmail(substr);
|
|
const tmp5Result = ValidationUtilsDefault;
|
|
obj2.is_invite_like = ValidationUtilsDefault.isInvite(substr);
|
|
obj2.is_num_only = re6.test(substr);
|
|
obj.track(constants2.FRIEND_REQUEST_FAILED, obj2);
|
|
const intl = util.intl;
|
|
stringResult = intl.string(util.t.paDJBM);
|
|
const tmp5Result2 = ValidationUtilsDefault;
|
|
} else {
|
|
stringResult = null;
|
|
}
|
|
}
|
|
return stringResult;
|
|
}
|
|
function humanizeAbortCode(arg0, substr) {
|
|
if (constants.RELATIONSHIP_INCOMING_DISABLED === arg0) {
|
|
const intl7 = util.intl;
|
|
const obj = { discordTag: substr };
|
|
return intl7.format(util.t.Oxe6Ur, obj);
|
|
} else if (tmp.TOO_MANY_FRIENDS === arg0) {
|
|
const intl6 = util.intl;
|
|
return intl6.string(util.t.tnBalD);
|
|
} else if (tmp.RELATIONSHIP_ALREADY_FRIENDS === arg0) {
|
|
const intl5 = util.intl;
|
|
return intl5.string(util.t.VNLneq);
|
|
} else {
|
|
if (tmp.USER_QUARANTINED !== arg0) {
|
|
if (tmp.USER_FRIEND_REQUEST_LIMITED_ACCESS !== arg0) {
|
|
if (tmp.TOO_MANY_BLOCKED_USERS === arg0) {
|
|
const intl3 = util.intl;
|
|
return intl3.string(util.t.sIGo1i);
|
|
} else if (tmp.TOO_MANY_PENDING_OUTGOING === arg0) {
|
|
const intl2 = util.intl;
|
|
return intl2.string(util.t.k1K15p);
|
|
} else {
|
|
if (tmp.RELATIONSHIP_INCOMING_BLOCKED !== arg0) {
|
|
if (tmp.RELATIONSHIP_INVALID_SELF !== arg0) {
|
|
if (tmp.RELATIONSHIP_INVALUD_USER_BOT !== arg0) {
|
|
const RELATIONSHIP_INVALID_DISCORD_TAG = tmp.RELATIONSHIP_INVALID_DISCORD_TAG;
|
|
}
|
|
}
|
|
}
|
|
const intl = util.intl;
|
|
return intl.string(util.t.paDJBM);
|
|
}
|
|
}
|
|
}
|
|
const intl4 = util.intl;
|
|
return intl4.string(util.t.EouHwv);
|
|
}
|
|
}
|
|
const Constants = fn(1074);
|
|
({ AbortCodes: closure_4, AnalyticEvents: hasOwnProperty } = Constants);
|
|
const re6 = /^\d+$/;
|
|
const re7 = /^(.+?@.+?\..+?|.+?#\d{4})$/;
|
|
const re8 = /^[a-zA-Z0-9_\\.]+$/;
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("utils/FriendsUtils.tsx");
|
|
|
|
export { validateDiscordTag };
|
|
export const isValidDiscordTag = function isValidDiscordTag(substr) {
|
|
return null == validateDiscordTag(substr);
|
|
};
|
|
export { humanizeAbortCode };
|
|
export const humanizeAbortCodeForA11y = function humanizeAbortCodeForA11y(arg0, substr) {
|
|
let formatToPlainStringResult = humanizeAbortCode(arg0, substr);
|
|
if (arg0 === constants.RELATIONSHIP_INCOMING_DISABLED) {
|
|
const intl = util.intl;
|
|
const obj = { discordTag: substr };
|
|
formatToPlainStringResult = intl.formatToPlainString(util.t["ihb+UW"], obj);
|
|
}
|
|
_modDef38(typeof formatToPlainStringResult === "string", "abortCode should be a string for a11y");
|
|
return formatToPlainStringResult;
|
|
};
|