decord/source/utils/FriendsUtils.tsx

103 lines
3.8 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 9395
// Function ID: 9396
2026-07-20 16:05:17 +00:00
// Name: validateDiscordTag
2026-08-25 06:04:03 +00:00
// Dependencies: [32, 676, 1236, 38, 698, 9085, 2]
2026-07-20 16:05:17 +00:00
// Exports: humanizeAbortCodeForA11y, isValidDiscordTag
2026-08-25 06:04:03 +00:00
// Module 9395 (validateDiscordTag)
2026-08-24 06:08:38 +00:00
import _modDef38 from "module_38" /* 38 */;
import expandEventPropertiesDefault from "expandEventProperties" /* 698 */;
import getSystemLocale from "getSystemLocale" /* 1236 */;
import closure_3 from "_slicedToArray" /* 32 */;
import ME from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function validateDiscordTag(arr) {
let stringResult = null;
if (!regex3.test(arr)) {
if (!arr.includes("#")) {
const tmp4 = callback(arr.split("#"), 2);
2026-07-29 08:29:29 +00:00
let str2 = tmp4[1];
2026-08-24 06:08:38 +00:00
let obj = expandEventPropertiesDefault;
2026-07-29 08:29:29 +00:00
obj = { reason: "Invalid Username", query: null, discrim_len: null, username_len: null, is_email_like: null, is_invite_like: null, is_num_only: null };
obj[1] = arr;
if (str2 == null) {
str2 = "";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[2] = str2.length;
obj[3] = tmp4[0].length;
2026-08-25 06:04:03 +00:00
let tmp5Result = tmp5(9085);
2026-07-29 08:29:29 +00:00
obj[4] = tmp5Result.isEmail(arr);
2026-08-25 06:04:03 +00:00
tmp5Result = tmp5(9085);
2026-07-29 08:29:29 +00:00
obj[5] = tmp5Result.isInvite(arr);
obj[6] = regex.test(arr);
2026-07-20 16:05:17 +00:00
obj.track(constants2.FRIEND_REQUEST_FAILED, obj);
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
stringResult = intl.string(getSystemLocale.t.paDJBM);
2026-07-20 16:05:17 +00:00
} else {
stringResult = null;
}
}
return stringResult;
}
function humanizeAbortCode(arg0, substr) {
if (constants.RELATIONSHIP_INCOMING_DISABLED === arg0) {
2026-08-24 06:08:38 +00:00
const intl7 = getSystemLocale.intl;
2026-07-29 08:29:29 +00:00
const obj = { discordTag: null };
obj[0] = substr;
2026-08-24 06:08:38 +00:00
return intl7.format(getSystemLocale.t.Oxe6Ur, obj);
2026-07-29 08:29:29 +00:00
} else if (tmp.TOO_MANY_FRIENDS === arg0) {
2026-08-24 06:08:38 +00:00
const intl6 = getSystemLocale.intl;
return intl6.string(getSystemLocale.t.tnBalD);
2026-07-29 08:29:29 +00:00
} else if (tmp.RELATIONSHIP_ALREADY_FRIENDS === arg0) {
2026-08-24 06:08:38 +00:00
const intl5 = getSystemLocale.intl;
return intl5.string(getSystemLocale.t.VNLneq);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
if (tmp.USER_QUARANTINED !== arg0) {
if (tmp.USER_FRIEND_REQUEST_LIMITED_ACCESS !== arg0) {
if (tmp.TOO_MANY_BLOCKED_USERS === arg0) {
2026-08-24 06:08:38 +00:00
const intl3 = getSystemLocale.intl;
return intl3.string(getSystemLocale.t.sIGo1i);
2026-07-29 08:29:29 +00:00
} else if (tmp.TOO_MANY_PENDING_OUTGOING === arg0) {
2026-08-24 06:08:38 +00:00
const intl2 = getSystemLocale.intl;
return intl2.string(getSystemLocale.t.k1K15p);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
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;
2026-07-20 16:05:17 +00:00
}
}
}
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
return intl.string(getSystemLocale.t.paDJBM);
2026-07-20 16:05:17 +00:00
}
}
}
2026-08-24 06:08:38 +00:00
const intl4 = getSystemLocale.intl;
return intl4.string(getSystemLocale.t.EouHwv);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
({ AbortCodes: c4, AnalyticEvents: c5 } = ME);
2026-07-23 10:11:24 +00:00
const re6 = /^\d+$/;
const re7 = /^(.+?@.+?\..+?|.+?#\d{4})$/;
const re8 = /^[a-zA-Z0-9_\\.]+$/;
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("utils/FriendsUtils.tsx");
2026-07-20 16:05:17 +00:00
export { validateDiscordTag };
export const isValidDiscordTag = function isValidDiscordTag(arr) {
return null == validateDiscordTag(arr);
};
export { humanizeAbortCode };
export const humanizeAbortCodeForA11y = function humanizeAbortCodeForA11y(arg0, substr) {
let formatToPlainStringResult = humanizeAbortCode(arg0, substr);
if (arg0 === constants.RELATIONSHIP_INCOMING_DISABLED) {
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
2026-07-29 08:29:29 +00:00
const obj = { discordTag: null };
obj[0] = substr;
2026-08-24 06:08:38 +00:00
formatToPlainStringResult = intl.formatToPlainString(getSystemLocale.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;
};