decord/alpha/source/utils/FriendsUtils.tsx

100 lines
3.8 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 06:59:38 +00:00
// Module ID: 7023
// Function ID: 7024
// Name: FriendsUtils
2026-10-12 06:59:38 +00:00
// Dependencies: [32, 1085, 1126, 38, 1265, 7024, 2]
2026-07-20 16:05:17 +00:00
// Exports: humanizeAbortCodeForA11y, isValidDiscordTag
2026-10-12 06:59:38 +00:00
// Module 7023 (FriendsUtils)
2026-08-24 06:08:38 +00:00
import _modDef38 from "module_38" /* 38 */;
2026-10-03 08:58:59 +00:00
import intl8 from "intl" /* 1126 */;
2026-10-09 10:00:15 +00:00
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1265 */;
2026-10-12 06:59:38 +00:00
import ValidationUtilsDefault from "ValidationUtils" /* 7024 */;
2026-10-03 08:58:59 +00:00
import _slicedToArray from "_slicedToArray" /* 32 */;
import Constants from "Constants" /* 1085 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
let closure_4;
let hasOwnProperty;
function validateDiscordTag(substr) {
2026-10-03 08:58:59 +00:00
let first;
let str2;
let tmp5Result;
let tmp5Result2;
2026-07-20 16:05:17 +00:00
let stringResult = null;
if (!re8.test(substr)) {
if (!substr.includes("#")) {
2026-10-03 08:58:59 +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-07-20 16:05:17 +00:00
} else {
stringResult = null;
}
}
return stringResult;
}
2026-10-03 08:58:59 +00:00
function humanizeAbortCode(arg0, trimmed) {
2026-07-20 16:05:17 +00:00
if (constants.RELATIONSHIP_INCOMING_DISABLED === arg0) {
2026-10-03 08:58:59 +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-07-20 16:05:17 +00:00
} else {
2026-10-03 08:58:59 +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-07-20 16:05:17 +00:00
} else {
2026-10-03 08:58:59 +00:00
if (constants.RELATIONSHIP_INCOMING_BLOCKED !== arg0) {
if (constants.RELATIONSHIP_INVALID_SELF !== arg0) {
if (constants.RELATIONSHIP_INVALUD_USER_BOT !== arg0) {
2026-07-29 08:29:29 +00:00
const RELATIONSHIP_INVALID_DISCORD_TAG = tmp.RELATIONSHIP_INVALID_DISCORD_TAG;
2026-07-20 16:05:17 +00:00
}
}
}
2026-10-03 08:58:59 +00:00
const intl = intl8.intl;
return intl.string(intl8.t.paDJBM);
2026-07-20 16:05:17 +00:00
}
}
}
2026-10-03 08:58:59 +00:00
const intl4 = intl8.intl;
return intl4.string(intl8.t.EouHwv);
2026-07-20 16:05:17 +00:00
}
}
({ AbortCodes: closure_4, AnalyticEvents: hasOwnProperty } = Constants);
2026-07-23 10:11:24 +00:00
const re6 = /^\d+$/;
const re7 = /^(.+?@.+?\..+?|.+?#\d{4})$/;
const re8 = /^[a-zA-Z0-9_\\.]+$/;
const result = size.fileFinishedImporting("utils/FriendsUtils.tsx");
2026-07-20 16:05:17 +00:00
export { validateDiscordTag };
export const isValidDiscordTag = function isValidDiscordTag(substr) {
return null == validateDiscordTag(substr);
2026-07-20 16:05:17 +00:00
};
export { humanizeAbortCode };
2026-10-03 08:58:59 +00:00
export const humanizeAbortCodeForA11y = function humanizeAbortCodeForA11y(arg0, trimmed) {
let formatToPlainStringResult = humanizeAbortCode(arg0, trimmed);
2026-07-20 16:05:17 +00:00
if (arg0 === constants.RELATIONSHIP_INCOMING_DISABLED) {
2026-10-03 08:58:59 +00:00
const intl = intl8.intl;
const obj = { discordTag: trimmed };
formatToPlainStringResult = intl.formatToPlainString(intl8.t["ihb+UW"], obj);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
_modDef38(typeof formatToPlainStringResult === "string", "abortCode should be a string for a11y");
2026-07-20 16:05:17 +00:00
return formatToPlainStringResult;
};