2026-10-06 22:12:49 +00:00
|
|
|
// Module ID: 9211
|
|
|
|
|
// Function ID: 9212
|
2026-09-18 20:18:48 +00:00
|
|
|
// Name: FriendsUtils
|
2026-10-06 22:12:49 +00:00
|
|
|
// Dependencies: [32, 1086, 1127, 38, 1253, 7828, 2]
|
2026-09-18 20:18:48 +00:00
|
|
|
// Exports: humanizeAbortCodeForA11y, isValidDiscordTag
|
|
|
|
|
|
2026-10-06 22:12:49 +00:00
|
|
|
// Module 9211 (FriendsUtils)
|
2026-09-18 20:18:48 +00:00
|
|
|
import _modDef38 from "module_38" /* 38 */;
|
2026-10-06 22:12:49 +00:00
|
|
|
import intl8 from "intl" /* 1127 */;
|
|
|
|
|
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1253 */;
|
|
|
|
|
import ValidationUtilsDefault from "ValidationUtils" /* 7828 */;
|
|
|
|
|
import _slicedToArray from "_slicedToArray" /* 32 */;
|
|
|
|
|
import Constants from "Constants" /* 1086 */;
|
|
|
|
|
import size from "module_2" /* 2 */;
|
2026-09-18 20:18:48 +00:00
|
|
|
|
2026-10-06 22:12:49 +00:00
|
|
|
let closure_4;
|
|
|
|
|
let hasOwnProperty;
|
2026-09-18 20:18:48 +00:00
|
|
|
function validateDiscordTag(substr) {
|
2026-10-06 22:12:49 +00:00
|
|
|
let first;
|
|
|
|
|
let str2;
|
|
|
|
|
let tmp5Result;
|
|
|
|
|
let tmp5Result2;
|
2026-09-18 20:18:48 +00:00
|
|
|
let stringResult = null;
|
|
|
|
|
if (!re8.test(substr)) {
|
|
|
|
|
if (!substr.includes("#")) {
|
2026-10-06 22:12:49 +00:00
|
|
|
[first, str2] = substr.split("#");
|
|
|
|
|
const obj = { reason: "Invalid Username", query: substr, discrim_len: str2.length, username_len: first.length, is_email_like: tmp5Result.isEmail(substr), is_invite_like: tmp5Result2.isInvite(substr), is_num_only: re6.test(substr) };
|
|
|
|
|
const track = AnalyticsUtilsDefault.track;
|
|
|
|
|
const FRIEND_REQUEST_FAILED = hasOwnProperty.FRIEND_REQUEST_FAILED;
|
|
|
|
|
AnalyticsUtilsDefault;
|
|
|
|
|
tmp5Result = ValidationUtilsDefault;
|
|
|
|
|
tmp5Result2 = ValidationUtilsDefault;
|
|
|
|
|
track(FRIEND_REQUEST_FAILED, obj);
|
|
|
|
|
const intl = intl8.intl;
|
|
|
|
|
stringResult = intl.string(intl8.t.paDJBM);
|
2026-09-18 20:18:48 +00:00
|
|
|
} else {
|
|
|
|
|
stringResult = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return stringResult;
|
|
|
|
|
}
|
2026-10-06 22:12:49 +00:00
|
|
|
function humanizeAbortCode(arg0, trimmed) {
|
2026-09-18 20:18:48 +00:00
|
|
|
if (constants.RELATIONSHIP_INCOMING_DISABLED === arg0) {
|
2026-10-06 22:12:49 +00:00
|
|
|
const intl7 = intl8.intl;
|
|
|
|
|
const obj = { discordTag: trimmed };
|
|
|
|
|
return intl7.format(intl8.t.Oxe6Ur, obj);
|
|
|
|
|
} else if (constants.TOO_MANY_FRIENDS === arg0) {
|
|
|
|
|
const intl6 = intl8.intl;
|
|
|
|
|
return intl6.string(intl8.t.tnBalD);
|
|
|
|
|
} else if (constants.RELATIONSHIP_ALREADY_FRIENDS === arg0) {
|
|
|
|
|
const intl5 = intl8.intl;
|
|
|
|
|
return intl5.string(intl8.t.VNLneq);
|
2026-09-18 20:18:48 +00:00
|
|
|
} else {
|
2026-10-06 22:12:49 +00:00
|
|
|
if (constants.USER_QUARANTINED !== arg0) {
|
|
|
|
|
if (constants.USER_FRIEND_REQUEST_LIMITED_ACCESS !== arg0) {
|
|
|
|
|
if (constants.TOO_MANY_BLOCKED_USERS === arg0) {
|
|
|
|
|
const intl3 = intl8.intl;
|
|
|
|
|
return intl3.string(intl8.t.sIGo1i);
|
|
|
|
|
} else if (constants.TOO_MANY_PENDING_OUTGOING === arg0) {
|
|
|
|
|
const intl2 = intl8.intl;
|
|
|
|
|
return intl2.string(intl8.t.k1K15p);
|
2026-09-18 20:18:48 +00:00
|
|
|
} else {
|
2026-10-06 22:12:49 +00:00
|
|
|
if (constants.RELATIONSHIP_INCOMING_BLOCKED !== arg0) {
|
|
|
|
|
if (constants.RELATIONSHIP_INVALID_SELF !== arg0) {
|
|
|
|
|
if (constants.RELATIONSHIP_INVALUD_USER_BOT !== arg0) {
|
2026-09-18 20:18:48 +00:00
|
|
|
const RELATIONSHIP_INVALID_DISCORD_TAG = tmp.RELATIONSHIP_INVALID_DISCORD_TAG;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-10-06 22:12:49 +00:00
|
|
|
const intl = intl8.intl;
|
|
|
|
|
return intl.string(intl8.t.paDJBM);
|
2026-09-18 20:18:48 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-10-06 22:12:49 +00:00
|
|
|
const intl4 = intl8.intl;
|
|
|
|
|
return intl4.string(intl8.t.EouHwv);
|
2026-09-18 20:18:48 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
({ AbortCodes: closure_4, AnalyticEvents: hasOwnProperty } = Constants);
|
|
|
|
|
const re6 = /^\d+$/;
|
|
|
|
|
const re7 = /^(.+?@.+?\..+?|.+?#\d{4})$/;
|
|
|
|
|
const re8 = /^[a-zA-Z0-9_\\.]+$/;
|
|
|
|
|
const result = size.fileFinishedImporting("utils/FriendsUtils.tsx");
|
|
|
|
|
|
|
|
|
|
export { validateDiscordTag };
|
|
|
|
|
export const isValidDiscordTag = function isValidDiscordTag(substr) {
|
|
|
|
|
return null == validateDiscordTag(substr);
|
|
|
|
|
};
|
|
|
|
|
export { humanizeAbortCode };
|
2026-10-06 22:12:49 +00:00
|
|
|
export const humanizeAbortCodeForA11y = function humanizeAbortCodeForA11y(arg0, trimmed) {
|
|
|
|
|
let formatToPlainStringResult = humanizeAbortCode(arg0, trimmed);
|
2026-09-18 20:18:48 +00:00
|
|
|
if (arg0 === constants.RELATIONSHIP_INCOMING_DISABLED) {
|
2026-10-06 22:12:49 +00:00
|
|
|
const intl = intl8.intl;
|
|
|
|
|
const obj = { discordTag: trimmed };
|
|
|
|
|
formatToPlainStringResult = intl.formatToPlainString(intl8.t["ihb+UW"], obj);
|
2026-09-18 20:18:48 +00:00
|
|
|
}
|
|
|
|
|
_modDef38(typeof formatToPlainStringResult === "string", "abortCode should be a string for a11y");
|
|
|
|
|
return formatToPlainStringResult;
|
|
|
|
|
};
|