decord/source/modules/channel/getChannelA11yLabel.tsx

287 lines
9.5 KiB
TypeScript
Raw Normal View History

2026-08-27 16:17:25 +00:00
// Module ID: 9346
// Function ID: 9347
2026-07-29 08:29:29 +00:00
// Name: getChannelA11yLabel
2026-08-27 16:17:25 +00:00
// Dependencies: [1395, 4098, 1922, 676, 1236, 4639, 4964, 4289, 7976, 2]
2026-07-29 08:29:29 +00:00
// Exports: default, getChannelA11yHint, getStatusLabel
2026-07-20 16:05:17 +00:00
2026-08-27 16:17:25 +00:00
// Module 9346 (getChannelA11yLabel)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
import getSystemLocale from "getSystemLocale" /* 1236 */;
import createChannelRecord from "createChannelRecord" /* 1395 */;
2026-08-27 16:17:25 +00:00
import nameFromUser from "nameFromUser" /* 4289 */;
import computeChannelName from "computeChannelName" /* 4639 */;
import isRoleRequiredDefault from "isRoleRequired" /* 4964 */;
2026-08-26 06:04:24 +00:00
import closure_4 from "markAllUserIdListsStale" /* 4098 */;
2026-08-24 06:08:38 +00:00
import closure_5 from "mergeGuildAvatar" /* 1922 */;
import ME from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
const THREAD_CHANNEL_TYPES = createChannelRecord.THREAD_CHANNEL_TYPES;
2026-07-29 08:29:29 +00:00
({ ChannelTypes: closure_6, StatusTypes: error } = ME);
2026-08-24 06:08:38 +00:00
const result = set.fileFinishedImporting("modules/channel/getChannelA11yLabel.tsx");
2026-07-20 16:05:17 +00:00
export default function getChannelA11yLabel(mentionCount) {
({ channel, unread } = mentionCount);
if (unread === undefined) {
unread = false;
}
let num = mentionCount.mentionCount;
if (num === undefined) {
num = 0;
}
({ voiceStates, embeddedActivitiesCount, activityNames, isIncomingCall, isSubscriptionGated, needSubscriptionToAccess } = mentionCount);
if (isIncomingCall === undefined) {
isIncomingCall = false;
}
let flag = mentionCount.isOngoingCall;
if (flag === undefined) {
flag = false;
}
2026-08-27 16:17:25 +00:00
({ voiceChannelStartTime, ignored } = mentionCount);
if (ignored === undefined) {
ignored = false;
}
let flag2 = mentionCount.blocked;
if (flag2 === undefined) {
flag2 = false;
}
2026-08-24 06:08:38 +00:00
let obj = computeChannelName;
const channelName = obj.computeChannelName(channel, closure_5, closure_4);
if (isRoleRequiredDefault(channel)) {
2026-07-29 08:29:29 +00:00
const intl = tmp(1236).intl;
const stringResult = intl.string(tmp(1236).t["4qvAtn"]);
2026-07-20 16:05:17 +00:00
}
2026-08-27 16:17:25 +00:00
if (flag2) {
const intl3 = tmp(1236).intl;
let stringResult1 = intl3.string(tmp(1236).t.dByf4y);
} else if (ignored) {
const intl2 = tmp(1236).intl;
stringResult1 = intl2.string(tmp(1236).t.mMCUM9);
}
2026-07-20 16:05:17 +00:00
const type = channel.type;
if (constants.DM === type) {
if (num > 0) {
2026-07-29 08:29:29 +00:00
let TO8LYt = tmp(1236).t.TO8LYt;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const t5 = tmp(1236).t;
2026-07-20 16:05:17 +00:00
TO8LYt = unread ? t5.F2MZsu : t5.fYqXVY;
}
} else {
2026-08-27 16:17:25 +00:00
if (tmp6.GROUP_DM === type) {
2026-07-20 16:05:17 +00:00
if (num > 0) {
2026-07-29 08:29:29 +00:00
let Lo0dCa = tmp(1236).t.Lo0dCa;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const t4 = tmp(1236).t;
2026-07-23 10:11:24 +00:00
Lo0dCa = unread ? t4["fxxUo/"] : t4.lts3Ld;
2026-07-20 16:05:17 +00:00
}
2026-08-27 16:17:25 +00:00
const intl10 = tmp(1236).intl;
2026-07-29 08:29:29 +00:00
obj = { channelName: null, mentionCount: null };
obj[0] = channelName;
obj[1] = num;
2026-08-27 16:17:25 +00:00
const items = [intl10.formatToPlainString(Lo0dCa, obj), ];
const intl11 = tmp(1236).intl;
2026-07-29 08:29:29 +00:00
obj = { members: null };
obj[0] = channel.recipients.length + 1;
2026-08-27 16:17:25 +00:00
items[1] = intl11.formatToPlainString(tmp(1236).t.CxSA5N, obj);
2026-07-20 16:05:17 +00:00
let joined = items.join(", ");
2026-08-27 16:17:25 +00:00
} else if (tmp6.GUILD_STORE === type) {
2026-07-29 08:29:29 +00:00
let g8ONM0 = tmp(1236).t.Bo4msg;
2026-08-27 16:17:25 +00:00
} else if (tmp6.GUILD_DIRECTORY === type) {
2026-07-29 08:29:29 +00:00
g8ONM0 = tmp(1236).t["92EAF2"];
2026-08-27 16:17:25 +00:00
} else if (tmp6.GUILD_ANNOUNCEMENT === type) {
2026-07-20 16:05:17 +00:00
if (num > 0) {
2026-07-29 08:29:29 +00:00
let sDKIpm = tmp(1236).t.sDKIpm;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const t3 = tmp(1236).t;
2026-07-20 16:05:17 +00:00
sDKIpm = unread ? t3.VM7z8f : t3.WJ3MPt;
}
g8ONM0 = sDKIpm;
2026-08-27 16:17:25 +00:00
} else if (tmp6.GUILD_VOICE === type) {
const intl4 = tmp(1236).intl;
2026-08-24 06:08:38 +00:00
obj1 = { channelName: null };
2026-07-29 08:29:29 +00:00
obj1[0] = channelName;
2026-08-27 16:17:25 +00:00
const items1 = [intl4.formatToPlainString(tmp(1236).t.bkpadO, obj1)];
2026-07-20 16:05:17 +00:00
if (num > 0) {
2026-08-27 16:17:25 +00:00
const intl5 = tmp(1236).intl;
2026-07-29 08:29:29 +00:00
const obj2 = { mentionCount: null };
obj2[0] = num;
2026-08-27 16:17:25 +00:00
items1.push(intl5.formatToPlainString(tmp(1236).t["3l1GOx"], obj2));
2026-07-20 16:05:17 +00:00
}
if (unread) {
2026-08-27 16:17:25 +00:00
const intl6 = tmp(1236).intl;
items1.push(intl6.string(tmp(1236).t.x5zAGZ));
2026-07-20 16:05:17 +00:00
}
const userLimit = channel.userLimit;
if (null != voiceStates) {
if (voiceStates.length > 0) {
const diff = voiceStates.length - 3;
const substr = voiceStates.slice(0, 3);
const mapped = substr.map((nick) => {
nick = nick.nick;
2026-07-29 08:29:29 +00:00
if (nick == null) {
nick = callback(table[7]).getName(tmp);
const obj = callback(table[7]);
2026-07-20 16:05:17 +00:00
}
return nick;
});
items1.push(mapped.join(", "));
2026-07-29 08:29:29 +00:00
if (0 < diff) {
2026-08-27 16:17:25 +00:00
const intl7 = tmp(1236).intl;
2026-07-29 08:29:29 +00:00
const obj3 = { overflow: null };
obj3[0] = diff;
2026-08-27 16:17:25 +00:00
items1.push(intl7.formatToPlainString(tmp(1236).t.sfgpgr, obj3));
2026-07-20 16:05:17 +00:00
}
2026-08-27 16:17:25 +00:00
if (tmp13) {
const intl8 = tmp(1236).intl;
2026-07-29 08:29:29 +00:00
const obj4 = { userCount: null, limit: null };
obj4[0] = voiceStates.length;
obj4[1] = userLimit;
2026-08-27 16:17:25 +00:00
items1.push(intl8.formatToPlainString(tmp(1236).t["6qgTOF"], obj4));
2026-07-20 16:05:17 +00:00
}
2026-08-27 16:17:25 +00:00
tmp13 = null != userLimit && userLimit > 0;
2026-07-20 16:05:17 +00:00
}
}
if (null != voiceChannelStartTime) {
2026-08-27 16:17:25 +00:00
const intl17 = tmp(1236).intl;
2026-07-29 08:29:29 +00:00
const obj5 = { duration: null };
const obj6 = { start: null };
obj6[0] = voiceChannelStartTime;
2026-07-20 16:05:17 +00:00
const _Date = Date;
2026-08-27 16:17:25 +00:00
obj5[0] = tmp(7976).formatActiveA11yTimestamp(obj6, Date.now());
items1.push(intl17.formatToPlainString(tmp(1236).t.JQtsGh, obj5));
const tmpResult = tmp(7976);
2026-07-20 16:05:17 +00:00
}
2026-08-27 16:17:25 +00:00
if (tmp15) {
const intl9 = tmp(1236).intl;
2026-07-29 08:29:29 +00:00
const obj7 = { activeActivities: null };
obj7[0] = activityNames.join(", ");
2026-08-27 16:17:25 +00:00
items1.push(intl9.formatToPlainString(tmp(1236).t.LmYuHT, obj7));
2026-07-20 16:05:17 +00:00
}
joined = items1.join(", ");
2026-08-27 16:17:25 +00:00
tmp15 = null != activityNames && activityNames.length > 0;
} else if (tmp6.GUILD_STAGE_VOICE === type) {
2026-07-29 08:29:29 +00:00
g8ONM0 = tmp(1236).t.TPPk2T;
2026-07-20 16:05:17 +00:00
} else if (THREAD_CHANNEL_TYPES.has(channel.type)) {
if (num > 0) {
2026-07-29 08:29:29 +00:00
ZL7_I6 = tmp(1236).t["ZL7+I6"];
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const t2 = tmp(1236).t;
2026-07-23 10:11:24 +00:00
ZL7_I6 = unread ? t2.YlVvmc : t2["0nZpiF"];
2026-07-20 16:05:17 +00:00
}
} else if (num > 0) {
2026-07-29 08:29:29 +00:00
g8ONM0 = tmp(1236).t.g8ONM0;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const t = tmp(1236).t;
2026-07-20 16:05:17 +00:00
g8ONM0 = unread ? t.smf1CZ : t.s0JADj;
}
if (null != joined) {
const items2 = [joined];
let items4 = items2;
} else if (null != g8ONM0) {
2026-08-27 16:17:25 +00:00
const intl12 = tmp(1236).intl;
2026-07-29 08:29:29 +00:00
const obj8 = { channelName: null, mentionCount: null };
obj8[0] = channelName;
obj8[1] = num;
2026-08-27 16:17:25 +00:00
const items3 = [intl12.formatToPlainString(g8ONM0, obj8)];
2026-07-20 16:05:17 +00:00
items4 = items3;
} else {
items4 = [];
}
2026-08-27 16:17:25 +00:00
if (null != stringResult1) {
items4.unshift(stringResult1);
}
2026-07-20 16:05:17 +00:00
if (isIncomingCall) {
2026-08-27 16:17:25 +00:00
const intl14 = tmp(1236).intl;
items4.push(intl14.string(tmp(1236).t["fk1/bX"]));
2026-08-15 05:55:55 +00:00
} else if (flag) {
2026-08-27 16:17:25 +00:00
const intl13 = tmp(1236).intl;
items4.push(intl13.string(tmp(1236).t["NGg/fm"]));
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
let tmp22 = null != embeddedActivitiesCount;
if (tmp22) {
tmp22 = embeddedActivitiesCount > 0;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
if (tmp22) {
2026-08-27 16:17:25 +00:00
const intl15 = tmp(1236).intl;
2026-07-29 08:29:29 +00:00
const obj9 = { activitiesCount: null };
obj9[0] = embeddedActivitiesCount;
2026-08-27 16:17:25 +00:00
items4.push(intl15.formatToPlainString(tmp(1236).t.O6PLYd, obj9));
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!isSubscriptionGated) {
2026-07-20 16:05:17 +00:00
if (null != undefined) {
items4.push(undefined);
}
if (null != stringResult) {
items4.push(stringResult);
}
return items4.join(", ");
} else {
2026-08-27 16:17:25 +00:00
const intl16 = tmp(1236).intl;
const string = intl16.string;
2026-07-29 08:29:29 +00:00
oj_HOs = tmp(1236).t;
if (needSubscriptionToAccess) {
2026-07-23 10:11:24 +00:00
oj_HOs = oj_HOs["oj+HOs"];
2026-08-27 16:17:25 +00:00
let stringResult2 = string(oj_HOs);
2026-07-20 16:05:17 +00:00
} else {
2026-08-27 16:17:25 +00:00
stringResult2 = string(oj_HOs.xI3TQQ);
2026-07-20 16:05:17 +00:00
}
}
}
};
2026-07-29 08:29:29 +00:00
export const getStatusLabel = function getStatusLabel(status) {
if (constants2.ONLINE === status) {
2026-08-24 06:08:38 +00:00
return nameFromUser.humanizeStatus(tmp.ONLINE);
2026-07-29 08:29:29 +00:00
} else if (tmp.IDLE === status) {
2026-08-24 06:08:38 +00:00
return nameFromUser.humanizeStatus(tmp.IDLE);
2026-07-29 08:29:29 +00:00
} else if (tmp.DND === status) {
2026-08-24 06:08:38 +00:00
return nameFromUser.humanizeStatus(tmp.DND);
2026-07-29 08:29:29 +00:00
} else if (tmp.INVISIBLE === status) {
2026-08-24 06:08:38 +00:00
return nameFromUser.humanizeStatus(tmp.INVISIBLE);
2026-07-29 08:29:29 +00:00
} else {
return "";
}
};
2026-07-20 16:05:17 +00:00
export const getChannelA11yHint = function getChannelA11yHint(userStatus) {
userStatus = userStatus.userStatus;
const items = [];
({ channel, muted } = userStatus);
if (userStatus.isFavorite) {
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
items.push(intl.string(getSystemLocale.t.cCPjSK));
2026-07-20 16:05:17 +00:00
}
if (true === muted) {
2026-08-24 06:08:38 +00:00
const intl2 = getSystemLocale.intl;
items.push(intl2.string(getSystemLocale.t.C4zCMb));
2026-07-20 16:05:17 +00:00
return items.join(", ");
} else {
if (channel.type === constants.DM) {
if (null != userStatus) {
2026-07-29 08:29:29 +00:00
let ONLINE = constants2;
if (constants2.ONLINE === userStatus) {
ONLINE = ONLINE.ONLINE;
2026-08-24 06:08:38 +00:00
let str = nameFromUser.humanizeStatus(ONLINE);
const obj3 = nameFromUser;
2026-07-29 08:29:29 +00:00
} else {
if (ONLINE.IDLE === userStatus) {
2026-08-24 06:08:38 +00:00
str = nameFromUser.humanizeStatus(ONLINE.IDLE);
const obj2 = nameFromUser;
2026-07-29 08:29:29 +00:00
} else if (ONLINE.DND !== userStatus) {
str = "";
if (ONLINE.INVISIBLE === userStatus) {
2026-08-24 06:08:38 +00:00
str = nameFromUser.humanizeStatus(ONLINE.INVISIBLE);
const obj4 = nameFromUser;
2026-07-29 08:29:29 +00:00
}
}
2026-08-24 06:08:38 +00:00
str = nameFromUser.humanizeStatus(ONLINE.DND);
const obj = nameFromUser;
2026-07-29 08:29:29 +00:00
}
items.push(str);
2026-07-20 16:05:17 +00:00
}
}
let joined;
if (items.length > 0) {
joined = items.join(", ");
}
return joined;
}
};