decord/source/modules/markup/MarkupRules.tsx

1198 lines
94 KiB
TypeScript
Raw Normal View History

// Module ID: 5079
// Function ID: 5080
// Name: MarkupRules
// Dependencies: [32, 718, 1957, 2015, 1979, 1371, 1074, 5080, 5081, 5082, 1114, 5085, 2018, 4788, 4481, 4333, 5086, 5087, 5090, 4289, 5092, 5103, 5104, 5105, 5106, 5107, 5078, 5108, 12, 2]
2026-07-29 08:29:29 +00:00
// Exports: hydrateCommandMention
2026-07-20 16:05:17 +00:00
// Module 5079 (MarkupRules)
import util from "util" /* 1114 */;
import EnhancedRoleColorUtils from "EnhancedRoleColorUtils" /* 2018 */;
import UnicodeEmojisDefault from "UnicodeEmojis" /* 4289 */;
import NicknameUtilsDefault from "NicknameUtils" /* 4788 */;
import MarkupLinkRule from "MarkupLinkRule" /* 5082 */;
import useHasEnhancedRoleColors from "useHasEnhancedRoleColors" /* 5085 */;
import MarkupTextRuleDefault from "MarkupTextRule" /* 5086 */;
import MarkupChannelMentionRuleDefault from "MarkupChannelMentionRule" /* 5087 */;
import MarkupAttachmentLinkRuleDefault from "MarkupAttachmentLinkRule" /* 5090 */;
import getSoundmojiASTFromString from "getSoundmojiASTFromString" /* 5092 */;
import TimestampUtils from "TimestampUtils" /* 5103 */;
import StaticRouteRendering from "StaticRouteRendering" /* 5104 */;
import MarkupHeadingRuleDefault from "MarkupHeadingRule" /* 5105 */;
import MarkupListRuleDefault from "MarkupListRule" /* 5106 */;
import MarkupSubtextRuleDefault from "MarkupSubtextRule" /* 5107 */;
import PlatformMarkupRulesDefault from "PlatformMarkupRules" /* 5108 */;
import _slicedToArray from "module_32" /* 32 */;
import _toArray from "_toArray" /* 718 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import GuildRoleStore from "GuildRoleStore" /* 2015 */;
import GuildStore from "GuildStore" /* 1979 */;
import UserStore from "UserStore" /* 1371 */;
import t_mod from "module_4333" /* 4333 */;
import combineMarkupRules_mod from "combineMarkupRules" /* 5078 */;
import "module_12";
import apply_mod from "module_12" /* 12 */;
2026-07-23 10:11:24 +00:00
const MarkupLinkRuleDefault = MarkupLinkRule;
const getSoundmojiASTFromStringDefault = getSoundmojiASTFromString;
require = fn;
2026-07-20 16:05:17 +00:00
function parseLink(arg0) {
const punycodeLinkResult = MarkupLinkRule.punycodeLink(arg0[1]);
2026-07-20 16:05:17 +00:00
if (null == punycodeLinkResult) {
const obj2 = { type: "text", content: arg0[1] };
let obj3 = obj2;
2026-07-20 16:05:17 +00:00
} else {
obj3 = { type: "link", content: null, target: null, title: "call" };
const obj4 = { type: "text", content: punycodeLinkResult.displayTarget };
const items = [obj4];
obj3.content = items;
obj3.target = punycodeLinkResult.target;
2026-07-20 16:05:17 +00:00
}
return obj3;
2026-07-20 16:05:17 +00:00
}
function hydrateRoleMention(roleId, guildId) {
2026-07-20 16:05:17 +00:00
if (null != guildId.guildId) {
let guild = GuildStore.getGuild(guildId.guildId);
2026-07-20 16:05:17 +00:00
} else {
guild = null;
if (null != guildId.channelId) {
const channel = ChannelStore.getChannel(guildId.channelId);
2026-07-29 08:29:29 +00:00
guildId = undefined;
if (channel != null) {
guildId = channel.getGuildId();
}
guild = GuildStore.getGuild(guildId);
2026-07-20 16:05:17 +00:00
}
}
let role = null;
2026-07-29 08:29:29 +00:00
if (null != guild) {
role = GuildRoleStore.getRole(guild.id, roleId);
2026-07-20 16:05:17 +00:00
}
if (null == role) {
const obj = { type: "text", content: null };
const intl = util.intl;
2026-07-20 16:05:17 +00:00
const _HermesInternal3 = HermesInternal;
obj.content = "@" + intl.string(util.t["YV4F/n"]);
2026-07-20 16:05:17 +00:00
return obj;
} else {
let id;
2026-07-29 08:29:29 +00:00
if (guild != null) {
id = guild.id;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
let hasEnhancedRoleColorsForRole = useHasEnhancedRoleColors.getHasEnhancedRoleColorsForRole(id, role);
2026-07-20 16:05:17 +00:00
if (hasEnhancedRoleColorsForRole) {
hasEnhancedRoleColorsForRole = !EnhancedRoleColorUtils.getIsDefaultErc(role);
const tmp19Result = EnhancedRoleColorUtils;
2026-07-20 16:05:17 +00:00
}
const obj2 = { type: "mention", channelId: guildId.channelId, guildId: null, roleId: null, roleColor: null, roleColors: null, roleName: null, color: null, colorString: null, content: null };
2026-07-20 16:05:17 +00:00
let id1 = null;
2026-07-29 08:29:29 +00:00
if (null != guild) {
id1 = guild.id;
2026-07-20 16:05:17 +00:00
}
obj2.guildId = id1;
obj2.roleId = roleId;
obj2.roleColor = role.color;
2026-07-29 08:29:29 +00:00
let tmp11 = null;
2026-07-20 16:05:17 +00:00
if (hasEnhancedRoleColorsForRole) {
const colors = role.colors;
let primary_color;
2026-07-29 08:29:29 +00:00
if (colors != null) {
2026-07-20 16:05:17 +00:00
primary_color = colors.primary_color;
}
const obj4 = { primaryColor: primary_color, secondaryColor: null, tertiaryColor: null };
2026-07-20 16:05:17 +00:00
const colors2 = role.colors;
let secondary_color;
2026-07-29 08:29:29 +00:00
if (colors2 != null) {
2026-07-20 16:05:17 +00:00
secondary_color = colors2.secondary_color;
}
obj4.secondaryColor = secondary_color;
2026-07-20 16:05:17 +00:00
const colors3 = role.colors;
let tertiary_color;
2026-07-29 08:29:29 +00:00
if (colors3 != null) {
2026-07-20 16:05:17 +00:00
tertiary_color = colors3.tertiary_color;
}
obj4.tertiaryColor = tertiary_color;
tmp11 = obj4;
2026-07-20 16:05:17 +00:00
}
obj2.roleColors = tmp11;
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal;
obj2.roleName = "@" + role.name;
({ color: obj3.color, colorString: obj3.colorString } = role);
const obj5 = { type: "text", content: null };
2026-07-20 16:05:17 +00:00
const _HermesInternal2 = HermesInternal;
obj5.content = "@" + role.name;
const items = [obj5];
obj2.content = items;
return obj2;
2026-07-20 16:05:17 +00:00
}
}
function hydrateUserMention(everyoneOrHere, channelId) {
({ fullMatch, id } = everyoneOrHere);
const str = UserStore.getUser(id);
const channel = ChannelStore.getChannel(channelId.channelId);
let id1;
2026-07-29 08:29:29 +00:00
let tmp2;
2026-07-20 16:05:17 +00:00
if (null != str) {
let str1 = str.toString();
2026-07-20 16:05:17 +00:00
if (null != channel) {
let nickname = NicknameUtilsDefault.getNickname(channel.getGuildId(), channelId.channelId, str);
2026-07-29 08:29:29 +00:00
if (nickname == null) {
nickname = tmp4(4481).getName(str);
const tmp4Result = tmp4(4481);
2026-07-20 16:05:17 +00:00
}
str1 = nickname;
2026-07-29 08:29:29 +00:00
tmp4 = importDefault;
2026-07-20 16:05:17 +00:00
}
tmp2 = str1;
id1 = str.id;
2026-07-20 16:05:17 +00:00
}
let isMatch = null != id;
if (isMatch) {
isMatch = regex.test(id.trim());
}
let combined = fullMatch;
if (isMatch) {
combined = fullMatch;
if (channelId.unknownUserMentionPlaceholder) {
const intl = util.intl;
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal;
combined = "@" + intl.string(util.t.sKdZ6U);
2026-07-20 16:05:17 +00:00
}
}
const obj = { type: "mention", userId: id1, channelId: channelId.channelId, viewingChannelId: channelId.viewingChannelId, guildId: null, parsedUserId: null, roleName: null, content: null };
2026-07-20 16:05:17 +00:00
let guildId;
2026-07-29 08:29:29 +00:00
if (channel != null) {
2026-07-20 16:05:17 +00:00
guildId = channel.getGuildId();
}
obj.guildId = guildId;
2026-07-29 08:29:29 +00:00
let tmp14 = null;
2026-07-20 16:05:17 +00:00
if (isMatch) {
2026-07-29 08:29:29 +00:00
tmp14 = id;
2026-07-20 16:05:17 +00:00
}
obj.parsedUserId = tmp14;
obj.roleName = everyoneOrHere.everyoneOrHere;
2026-07-29 08:29:29 +00:00
if (null != tmp2) {
2026-07-20 16:05:17 +00:00
const _HermesInternal2 = HermesInternal;
2026-07-29 08:29:29 +00:00
combined = "@" + tmp2;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const items = [{ type: "text", content: combined }];
obj.content = items;
2026-07-20 16:05:17 +00:00
return obj;
}
const Constants = fn(1074);
({ ID_REGEX: closure_9, MARKDOWN_SPOILER_REGEXP: c10, MARKDOWN_STATIC_ROUTE_NAME_REGEXP: closure_11 } = Constants);
const SUB_COMMAND_KEY_SEPARATOR = fn(5080).SUB_COMMAND_KEY_SEPARATOR;
const GAME_MENTION_RAW_RE = fn(5081).GAME_MENTION_RAW_RE;
2026-08-06 08:05:19 +00:00
const re14 = /^( *>>> +([\s\S]*))|^( *>(?!>>) +[^\n]*(\n *>(?!>>) +[^\n]*)*\n?)/;
const re15 = /^$|\n *$/;
const re16 = /^ *>>> ?/;
const re17 = /^ *> ?/gm;
const re18 = /^((?:https?|steam):\/\/[^\s<]+[^<.,:;"'\]\s])/;
let obj = { newline: t.defaultRules.newline, paragraph: t.defaultRules.paragraph, escape: null, blockQuote: null, link: null, autolink: null, mailto: null, tel: null, url: null, strong: null, em: null, u: null, br: null, text: null, inlineCode: null, emoticon: null, codeBlock: null, roleMention: null, mention: null, silentPrefix: null, channelMention: null, channelOrMessageUrl: null, mediaPostLink: null, attachmentLink: null, commandMention: null, timestampMentionInput: null, gameMention: null, emoji: null, soundboard: null, customEmoji: null, timestamp: null, s: null, spoiler: null, staticRouteLink: null, heading: null, list: null, subtext: null };
let obj2 = {};
let merged = Object.assign(t.defaultRules.escape);
obj2.match = function match(arg0, allowEscape, arg2) {
2026-07-20 16:05:17 +00:00
let match = null;
if (false !== allowEscape.allowEscape) {
match = t.defaultRules.escape.match(arg0, allowEscape, arg2);
2026-07-20 16:05:17 +00:00
}
return match;
};
obj.escape = obj2;
let obj3 = {};
const merged1 = Object.assign(t.defaultRules.blockQuote);
obj3.requiredFirstCharacters = [" ", ">"];
obj3.match = function match(arg0, prevCapture) {
2026-07-20 16:05:17 +00:00
prevCapture = prevCapture.prevCapture;
if (!prevCapture.inQuote) {
if (!prevCapture.nested) {
if (null == prevCapture) {
return re14.exec(arg0);
2026-07-20 16:05:17 +00:00
} else {
let match = null;
if (re15.test(prevCapture[0])) {
match = re14.exec(arg0);
2026-07-20 16:05:17 +00:00
}
return match;
}
}
}
return null;
};
obj3.parse = function parse(arg0, fn, inQuote) {
const BooleanResult = Boolean(re16.exec(arg0[0]));
let tmp2 = re16;
2026-07-29 08:29:29 +00:00
if (!BooleanResult) {
tmp2 = re17;
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
let flag = inQuote.inQuote;
2026-07-29 08:29:29 +00:00
const replaced = str.replace(tmp2, "");
2026-07-20 16:05:17 +00:00
if (!flag) {
flag = false;
}
inQuote.inQuote = true;
if (!BooleanResult) {
inQuote.inline = true;
}
const content = fn(replaced, inQuote);
2026-07-20 16:05:17 +00:00
inQuote.inQuote = flag;
inQuote.inline = inQuote.inline || false;
if (0 === content.length) {
2026-07-23 10:11:24 +00:00
content.push({ type: "text", content: " " });
2026-07-20 16:05:17 +00:00
}
return { content, type: "blockQuote" };
};
obj.blockQuote = obj3;
obj.link = MarkupLinkRuleDefault;
let obj4 = {};
const merged2 = Object.assign(t.defaultRules.autolink);
obj4.parse = parseLink;
obj.autolink = obj4;
let obj5 = {};
const merged3 = Object.assign(t.defaultRules.mailto);
let t = t_mod;
obj5.match = t.inlineRegex(/^<([^\s<>@]+@[^\s<>@]+\.[^\s<>@]+)>/);
obj5.requiredFirstCharacters = ["<"];
obj5.parse = function parse(content) {
let text = obj;
2026-07-29 08:29:29 +00:00
if (!content[1].startsWith("mailto:")) {
text = `mailto:${obj}`;
2026-07-20 16:05:17 +00:00
}
const obj2 = { type: "link", content: null, target: text };
const items = [{ type: "text", content: content[1] }];
obj2.content = items;
return obj2;
2026-07-20 16:05:17 +00:00
};
obj.mailto = obj5;
let obj6 = {};
const merged4 = Object.assign(t.defaultRules.mailto);
obj6.requiredFirstCharacters = ["<"];
let t = t_mod;
obj6.match = t.inlineRegex(/^<((?:(?:tel|sms):\+?|\+)(?:(?:[0-9]|\([0-9]+\)))(?:[- .\/]?(?:[0-9]|\([0-9]+\)))+)>/);
obj6.parse = function parse(content) {
2026-07-29 08:29:29 +00:00
const replaced = content[1].replaceAll(/[ \/]+/g, "-");
2026-07-20 16:05:17 +00:00
let startsWithResult = replaced.startsWith("tel:");
if (!startsWithResult) {
startsWithResult = replaced.startsWith("sms:");
}
let text = replaced;
2026-07-20 16:05:17 +00:00
if (!startsWithResult) {
text = `tel:${obj2}`;
2026-07-20 16:05:17 +00:00
}
const obj3 = { type: "link", content: null, target: text };
const items = [{ type: "text", content: content[1] }];
obj3.content = items;
return obj3;
2026-07-20 16:05:17 +00:00
};
obj.tel = obj6;
const obj7 = {};
const merged5 = Object.assign(t.defaultRules.url);
obj7.requiredFirstCharacters = ["h", "s"];
obj7.match = function match(arg0, inline) {
2026-07-20 16:05:17 +00:00
if (inline.inline) {
const match = re18.exec(arg0);
2026-07-20 16:05:17 +00:00
if (null == match) {
return match;
} else {
const first = match[0];
let diff = first.length - 1;
let substr = first;
2026-07-29 08:29:29 +00:00
if (0 <= diff) {
2026-07-20 16:05:17 +00:00
let num2 = 0;
substr = first;
if (")" === first[diff]) {
const index = first.indexOf("(", num2);
while (-1 !== index) {
2026-07-29 08:29:29 +00:00
let diff1 = diff - 1;
2026-07-20 16:05:17 +00:00
substr = first;
2026-07-29 08:29:29 +00:00
if (0 <= diff1) {
diff = diff1;
num2 = tmp7;
2026-07-20 16:05:17 +00:00
substr = first;
}
break;
}
}
substr = first.slice(0, first.length - 1);
}
match[1] = substr;
match[0] = substr;
}
} else {
return null;
}
};
obj7.parse = parseLink;
obj.url = obj7;
obj.strong = t.defaultRules.strong;
obj.em = t.defaultRules.em;
obj.u = t.defaultRules.u;
obj.br = t.defaultRules.br;
obj.text = MarkupTextRuleDefault;
const obj8 = {};
const merged6 = Object.assign(t.defaultRules.inlineCode);
obj8.parse = function parse(arg0, fn, parseInlineCodeChildContent) {
const inlineCode = t.defaultRules.inlineCode;
const parsed = inlineCode.parse(arg0, fn, parseInlineCodeChildContent);
2026-07-20 16:05:17 +00:00
let tmp2 = parsed;
if (true === parseInlineCodeChildContent.parseInlineCodeChildContent) {
const obj = {};
const merged = Object.assign(parsed);
obj.validationChildContent = fn(parsed.content, parseInlineCodeChildContent);
2026-07-20 16:05:17 +00:00
tmp2 = obj;
}
return tmp2;
};
obj.inlineCode = obj8;
obj.emoticon = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["\u00AF"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return /^(¯\\_\(ツ\)_\/¯)/.exec(arg0);
},
parse(content) {
return { type: "text", content: content[1] };
}
};
const obj9 = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["\u00AF"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return /^(¯\\_\(ツ\)_\/¯)/.exec(arg0);
},
parse(content) {
return { type: "text", content: content[1] };
}
};
obj.codeBlock = {
order: t.defaultRules.codeBlock.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["`"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return /^```(?:([a-z0-9_+\-.#]+?)\n)?\n*([^\n][^]*?)\n*```/i.exec(arg0);
},
parse(arg0, arg1, inQuote) {
2026-07-29 08:29:29 +00:00
let str = arg0[1];
if (str == null) {
str = "";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const obj = { lang: str, content: null, inQuote: null };
let str2 = arg0[2];
if (str2 == null) {
str2 = "";
2026-07-20 16:05:17 +00:00
}
obj.content = str2;
obj.inQuote = inQuote.inQuote || inQuote.formatInline || false;
2026-07-20 16:05:17 +00:00
return obj;
}
};
const obj10 = {
order: t.defaultRules.codeBlock.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["`"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return /^```(?:([a-z0-9_+\-.#]+?)\n)?\n*([^\n][^]*?)\n*```/i.exec(arg0);
},
parse(arg0, arg1, inQuote) {
2026-07-29 08:29:29 +00:00
let str = arg0[1];
if (str == null) {
str = "";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const obj = { lang: str, content: null, inQuote: null };
let str2 = arg0[2];
if (str2 == null) {
str2 = "";
2026-07-20 16:05:17 +00:00
}
obj.content = str2;
obj.inQuote = inQuote.inQuote || inQuote.formatInline || false;
2026-07-20 16:05:17 +00:00
return obj;
}
};
obj.roleMention = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return /^<@&(\d+)>/.exec(arg0);
},
parse(arg0, arg1, returnMentionIds) {
[, tmp] = arg0;
if (returnMentionIds.returnMentionIds) {
const obj = { type: "roleMention", id: tmp };
2026-07-20 16:05:17 +00:00
let tmp3 = obj;
} else {
tmp3 = hydrateRoleMention(tmp, returnMentionIds);
}
return tmp3;
}
};
const obj11 = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return /^<@&(\d+)>/.exec(arg0);
},
parse(arg0, arg1, returnMentionIds) {
[, tmp] = arg0;
if (returnMentionIds.returnMentionIds) {
const obj = { type: "roleMention", id: tmp };
2026-07-20 16:05:17 +00:00
let tmp3 = obj;
} else {
tmp3 = hydrateRoleMention(tmp, returnMentionIds);
}
return tmp3;
}
};
obj.mention = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<", "@"],
2026-07-20 16:05:17 +00:00
match(arg0) {
const match = /^<@!?(\d+)>|^(@(?:everyone|here))/.exec(arg0);
let tmp2 = null;
if (null != match) {
tmp2 = match;
}
return tmp2;
},
parse(arg0, arg1, returnMentionIds) {
2026-07-29 08:29:29 +00:00
let first = arg0;
2026-07-20 16:05:17 +00:00
if (returnMentionIds.returnMentionIds) {
2026-07-29 08:29:29 +00:00
if (null == first[1]) {
const obj2 = { type: "mention", text: null };
2026-07-29 08:29:29 +00:00
first = first[0];
obj2.text = first;
2026-07-20 16:05:17 +00:00
} else {
const obj3 = { type: "mention", id: first[1] };
2026-07-20 16:05:17 +00:00
}
} else {
const obj = { fullMatch: null, id: null, everyoneOrHere: null };
[obj.fullMatch, obj.id, obj.everyoneOrHere] = first;
2026-07-20 16:05:17 +00:00
return hydrateUserMention(obj, returnMentionIds);
}
}
};
const obj12 = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<", "@"],
2026-07-20 16:05:17 +00:00
match(arg0) {
const match = /^<@!?(\d+)>|^(@(?:everyone|here))/.exec(arg0);
let tmp2 = null;
if (null != match) {
tmp2 = match;
}
return tmp2;
},
parse(arg0, arg1, returnMentionIds) {
2026-07-29 08:29:29 +00:00
let first = arg0;
2026-07-20 16:05:17 +00:00
if (returnMentionIds.returnMentionIds) {
2026-07-29 08:29:29 +00:00
if (null == first[1]) {
const obj2 = { type: "mention", text: null };
2026-07-29 08:29:29 +00:00
first = first[0];
obj2.text = first;
2026-07-20 16:05:17 +00:00
} else {
const obj3 = { type: "mention", id: first[1] };
2026-07-20 16:05:17 +00:00
}
} else {
const obj = { fullMatch: null, id: null, everyoneOrHere: null };
[obj.fullMatch, obj.id, obj.everyoneOrHere] = first;
2026-07-20 16:05:17 +00:00
return hydrateUserMention(obj, returnMentionIds);
}
}
};
obj.silentPrefix = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["@"],
2026-07-20 16:05:17 +00:00
match(arg0, arg1, arg2) {
if (null == arg2) {
let match = /^(@silent(?![^\s]))/.exec(arg0);
const obj = /^(@silent(?![^\s]))/;
} else {
match = null;
}
return match;
},
parse(content) {
return { type: "silentPrefix", content: content[0] };
}
};
obj.channelMention = MarkupChannelMentionRuleDefault.channelMention;
obj.channelOrMessageUrl = MarkupChannelMentionRuleDefault.channelOrMessageUrl;
obj.mediaPostLink = MarkupChannelMentionRuleDefault.mediaPostLink;
obj.attachmentLink = MarkupAttachmentLinkRuleDefault.attachmentLink;
const obj13 = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["@"],
2026-07-20 16:05:17 +00:00
match(arg0, arg1, arg2) {
if (null == arg2) {
let match = /^(@silent(?![^\s]))/.exec(arg0);
const obj = /^(@silent(?![^\s]))/;
} else {
match = null;
}
return match;
},
parse(content) {
return { type: "silentPrefix", content: content[0] };
}
};
obj.commandMention = {
order: t.defaultRules.text.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return /^<\/((?:(?:[\x2D0-9A-Z_a-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0900-\u0950\u0955-\u0963\u0966-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E3A\u0E40-\u0E5B\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8E0-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\
},
parse(arg0, arg1, returnMentionIds) {
if (returnMentionIds.returnMentionIds) {
const obj = { type: "commandMention", id: arg0[2] };
let obj2 = obj;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const items = [];
HermesBuiltin.arraySpread(_toArray(arg0[1].split(" ")).slice(1), 0);
const mapped = items.map((item) => "" + SUB_COMMAND_KEY_SEPARATOR + item);
2026-07-29 08:29:29 +00:00
const _HermesInternal = HermesInternal;
obj2 = { type: "commandMention", channelId: returnMentionIds.channelId, commandId: arg0[2], commandName: arg0[1], commandKey: "" + arg0[2] + mapped.join(""), content: null };
const obj3 = { type: "text", content: null };
2026-07-29 08:29:29 +00:00
const _HermesInternal2 = HermesInternal;
obj3.content = "" + arg0[1];
const items1 = [obj3];
obj2.content = items1;
const arr = _toArray(arg0[1].split(" "));
2026-07-20 16:05:17 +00:00
}
return obj2;
2026-07-20 16:05:17 +00:00
}
};
const obj14 = {
order: t.defaultRules.text.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return /^<\/((?:(?:[\x2D0-9A-Z_a-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0900-\u0950\u0955-\u0963\u0966-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E3A\u0E40-\u0E5B\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8E0-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\
},
parse(arg0, arg1, returnMentionIds) {
if (returnMentionIds.returnMentionIds) {
const obj = { type: "commandMention", id: arg0[2] };
let obj2 = obj;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const items = [];
HermesBuiltin.arraySpread(_toArray(arg0[1].split(" ")).slice(1), 0);
const mapped = items.map((item) => "" + SUB_COMMAND_KEY_SEPARATOR + item);
2026-07-29 08:29:29 +00:00
const _HermesInternal = HermesInternal;
obj2 = { type: "commandMention", channelId: returnMentionIds.channelId, commandId: arg0[2], commandName: arg0[1], commandKey: "" + arg0[2] + mapped.join(""), content: null };
const obj3 = { type: "text", content: null };
2026-07-29 08:29:29 +00:00
const _HermesInternal2 = HermesInternal;
obj3.content = "" + arg0[1];
const items1 = [obj3];
obj2.content = items1;
const arr = _toArray(arg0[1].split(" "));
2026-07-20 16:05:17 +00:00
}
return obj2;
2026-07-20 16:05:17 +00:00
}
};
obj.timestampMentionInput = {
order: t.defaultRules.text.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0, allowTimeMentionInput) {
let match = null;
if (allowTimeMentionInput.allowTimeMentionInput) {
match = /^<@time:([^>]*)>/.exec(arg0);
const obj = /^<@time:([^>]*)>/;
}
return match;
},
parse(content) {
return { type: "timestampMentionInput", content: content[1] };
}
};
const obj15 = {
order: t.defaultRules.text.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0, allowTimeMentionInput) {
let match = null;
if (allowTimeMentionInput.allowTimeMentionInput) {
match = /^<@time:([^>]*)>/.exec(arg0);
const obj = /^<@time:([^>]*)>/;
}
return match;
},
parse(content) {
return { type: "timestampMentionInput", content: content[1] };
}
};
obj.gameMention = {
order: t.defaultRules.text.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0, allowGameMentions) {
let match = null;
if (allowGameMentions.allowGameMentions) {
match = GAME_MENTION_RAW_RE.exec(arg0);
}
return match;
},
2026-08-06 08:05:19 +00:00
parse(gameId) {
return { type: "gameMention", gameId: gameId[1] };
2026-07-20 16:05:17 +00:00
}
};
const obj16 = {
order: t.defaultRules.text.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0, allowGameMentions) {
let match = null;
if (allowGameMentions.allowGameMentions) {
match = GAME_MENTION_RAW_RE.exec(arg0);
}
return match;
},
2026-08-06 08:05:19 +00:00
parse(gameId) {
return { type: "gameMention", gameId: gameId[1] };
2026-07-20 16:05:17 +00:00
}
};
obj.emoji = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: [":"],
2026-07-20 16:05:17 +00:00
match(arg0) {
const EMOJI_NAME_RE = UnicodeEmojisDefault.EMOJI_NAME_RE;
2026-07-20 16:05:17 +00:00
const match = EMOJI_NAME_RE.exec(arg0);
2026-07-29 08:29:29 +00:00
let tmp4 = null;
2026-07-20 16:05:17 +00:00
if (null != match) {
2026-07-29 08:29:29 +00:00
tmp4 = null;
if ("" !== tmpResult.convertNameToSurrogate(match[1])) {
tmp4 = match;
2026-07-20 16:05:17 +00:00
}
tmpResult = UnicodeEmojisDefault;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp4;
2026-07-20 16:05:17 +00:00
},
parse(arg0) {
let content = UnicodeEmojisDefault.convertNameToSurrogate(arg0[1]);
2026-07-29 08:29:29 +00:00
if (null == content) {
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal;
2026-07-29 08:29:29 +00:00
content = ":" + arg0[1] + ":";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return { type: "text", content };
2026-07-20 16:05:17 +00:00
}
};
const obj17 = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: [":"],
2026-07-20 16:05:17 +00:00
match(arg0) {
const EMOJI_NAME_RE = UnicodeEmojisDefault.EMOJI_NAME_RE;
2026-07-20 16:05:17 +00:00
const match = EMOJI_NAME_RE.exec(arg0);
2026-07-29 08:29:29 +00:00
let tmp4 = null;
2026-07-20 16:05:17 +00:00
if (null != match) {
2026-07-29 08:29:29 +00:00
tmp4 = null;
if ("" !== tmpResult.convertNameToSurrogate(match[1])) {
tmp4 = match;
2026-07-20 16:05:17 +00:00
}
tmpResult = UnicodeEmojisDefault;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp4;
2026-07-20 16:05:17 +00:00
},
parse(arg0) {
let content = UnicodeEmojisDefault.convertNameToSurrogate(arg0[1]);
2026-07-29 08:29:29 +00:00
if (null == content) {
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal;
2026-07-29 08:29:29 +00:00
content = ":" + arg0[1] + ":";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return { type: "text", content };
2026-07-20 16:05:17 +00:00
}
};
obj.soundboard = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0) {
2026-08-24 06:08:38 +00:00
const soundmojiRawFormatRegex = getSoundmojiASTFromString.soundmojiRawFormatRegex;
2026-07-20 16:05:17 +00:00
return soundmojiRawFormatRegex.exec(arg0);
},
parse(arg0, arg1, arg2) {
2026-08-24 06:08:38 +00:00
return getSoundmojiASTFromStringDefault(arg0, arg2);
2026-07-20 16:05:17 +00:00
}
};
const obj18 = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0) {
2026-08-24 06:08:38 +00:00
const soundmojiRawFormatRegex = getSoundmojiASTFromString.soundmojiRawFormatRegex;
2026-07-20 16:05:17 +00:00
return soundmojiRawFormatRegex.exec(arg0);
},
parse(arg0, arg1, arg2) {
2026-08-24 06:08:38 +00:00
return getSoundmojiASTFromStringDefault(arg0, arg2);
2026-07-20 16:05:17 +00:00
}
};
obj.customEmoji = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return /^<a?:(\w+):(\d+)>/.exec(arg0);
},
parse(arg0) {
return { type: "text", content: ":" + arg0[1] + ":" };
}
};
const obj19 = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return /^<a?:(\w+):(\d+)>/.exec(arg0);
},
parse(arg0) {
return { type: "text", content: ":" + arg0[1] + ":" };
}
};
obj.timestamp = {
order: MarkupTextRuleDefault.order - 1,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0) {
const TIMESTAMP_REGEX = TimestampUtils.TIMESTAMP_REGEX;
2026-07-20 16:05:17 +00:00
return TIMESTAMP_REGEX.exec(arg0);
},
parse(arg0) {
[tmp, tmp2, tmp3] = arg0;
let parseTimestampResult = TimestampUtils.parseTimestamp(tmp2, tmp3);
2026-07-20 16:05:17 +00:00
if (null == parseTimestampResult) {
const obj2 = { type: "text", content: tmp };
parseTimestampResult = obj2;
2026-07-20 16:05:17 +00:00
} else {
parseTimestampResult.type = "timestamp";
}
return parseTimestampResult;
}
};
const obj21 = { order: t.defaultRules.u.order, requiredFirstCharacters: ["~"], match: null, parse: null };
let t = t_mod;
obj21.match = t.inlineRegex(/^~~([\s\S]+?)~~(?!_)/);
obj21.parse = t.defaultRules.u.parse;
obj.s = obj21;
const obj20 = {
order: MarkupTextRuleDefault.order - 1,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0) {
const TIMESTAMP_REGEX = TimestampUtils.TIMESTAMP_REGEX;
2026-07-20 16:05:17 +00:00
return TIMESTAMP_REGEX.exec(arg0);
},
parse(arg0) {
[tmp, tmp2, tmp3] = arg0;
let parseTimestampResult = TimestampUtils.parseTimestamp(tmp2, tmp3);
2026-07-20 16:05:17 +00:00
if (null == parseTimestampResult) {
const obj2 = { type: "text", content: tmp };
parseTimestampResult = obj2;
2026-07-20 16:05:17 +00:00
} else {
parseTimestampResult.type = "timestamp";
}
return parseTimestampResult;
}
};
obj.spoiler = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["|"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return regex2.exec(arg0);
},
parse(arg0, fn, channelId) {
return { content: fn(arg0[1], channelId), channelId: channelId.channelId };
2026-07-20 16:05:17 +00:00
}
};
const obj22 = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["|"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return regex2.exec(arg0);
},
parse(arg0, fn, channelId) {
return { content: fn(arg0[1], channelId), channelId: channelId.channelId };
2026-07-20 16:05:17 +00:00
}
};
obj.staticRouteLink = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return regex3.exec(arg0);
},
2026-07-29 08:29:29 +00:00
parse(arg0, arg1, guildId) {
const tmp = _slicedToArray(arg0, 3);
const result = StaticRouteRendering.staticRouteToTranslation(tmp2);
2026-07-29 08:29:29 +00:00
if (null != guildId.guildId) {
let guild = GuildStore.getGuild(guildId.guildId);
2026-07-29 08:29:29 +00:00
} else {
guild = null;
if (null != guildId.channelId) {
const channel = ChannelStore.getChannel(guildId.channelId);
2026-07-29 08:29:29 +00:00
guildId = undefined;
if (channel != null) {
guildId = channel.getGuildId();
}
guild = GuildStore.getGuild(guildId);
2026-07-20 16:05:17 +00:00
}
}
let id;
2026-07-29 08:29:29 +00:00
if (guild != null) {
id = guild.id;
2026-07-20 16:05:17 +00:00
}
const result1 = StaticRouteRendering.staticRouteToItemString(tmp2, tmp3, id);
2026-07-20 16:05:17 +00:00
let str = "";
if (null != result1) {
const _HermesInternal = HermesInternal;
str = " \u203A " + result1;
}
const obj3 = { content: null, mainContent: null, itemContent: null, itemId: null, id: null, guildId: null, channelId: null };
const items = [{ type: "text", content: result + str }];
obj3.content = items;
2026-07-29 08:29:29 +00:00
let tmp13 = null;
if (null != result) {
const obj5 = { type: "text", content: result };
const items1 = [obj5];
2026-07-29 08:29:29 +00:00
tmp13 = items1;
}
obj3.mainContent = tmp13;
2026-07-29 08:29:29 +00:00
let tmp14 = null;
if (null != result1) {
const obj6 = { type: "text", content: result1 };
const items2 = [obj6];
2026-07-29 08:29:29 +00:00
tmp14 = items2;
}
obj3.itemContent = tmp14;
obj3.itemId = tmp[2];
obj3.id = tmp[1];
const channel1 = ChannelStore.getChannel(guildId.channelId);
2026-07-29 08:29:29 +00:00
let guildId1;
if (channel1 != null) {
guildId1 = channel1.getGuildId();
}
obj3.guildId = guildId1;
obj3.channelId = tmp[1];
return obj3;
2026-07-20 16:05:17 +00:00
}
};
obj.heading = MarkupHeadingRuleDefault;
obj.list = MarkupListRuleDefault;
obj.subtext = MarkupSubtextRuleDefault;
2026-07-23 10:11:24 +00:00
let items = [obj, ];
let combineMarkupRules = combineMarkupRules_mod;
items[1] = PlatformMarkupRulesDefault;
const importDefaultResult3Result = combineMarkupRules(items);
const obj23 = {
order: MarkupTextRuleDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return regex3.exec(arg0);
},
2026-07-29 08:29:29 +00:00
parse(arg0, arg1, guildId) {
const tmp = _slicedToArray(arg0, 3);
const result = StaticRouteRendering.staticRouteToTranslation(tmp2);
2026-07-29 08:29:29 +00:00
if (null != guildId.guildId) {
let guild = GuildStore.getGuild(guildId.guildId);
2026-07-29 08:29:29 +00:00
} else {
guild = null;
if (null != guildId.channelId) {
const channel = ChannelStore.getChannel(guildId.channelId);
2026-07-29 08:29:29 +00:00
guildId = undefined;
if (channel != null) {
guildId = channel.getGuildId();
}
guild = GuildStore.getGuild(guildId);
2026-07-20 16:05:17 +00:00
}
}
let id;
2026-07-29 08:29:29 +00:00
if (guild != null) {
id = guild.id;
2026-07-20 16:05:17 +00:00
}
const result1 = StaticRouteRendering.staticRouteToItemString(tmp2, tmp3, id);
2026-07-20 16:05:17 +00:00
let str = "";
if (null != result1) {
const _HermesInternal = HermesInternal;
str = " \u203A " + result1;
}
const obj3 = { content: null, mainContent: null, itemContent: null, itemId: null, id: null, guildId: null, channelId: null };
const items = [{ type: "text", content: result + str }];
obj3.content = items;
2026-07-29 08:29:29 +00:00
let tmp13 = null;
if (null != result) {
const obj5 = { type: "text", content: result };
const items1 = [obj5];
2026-07-29 08:29:29 +00:00
tmp13 = items1;
}
obj3.mainContent = tmp13;
2026-07-29 08:29:29 +00:00
let tmp14 = null;
if (null != result1) {
const obj6 = { type: "text", content: result1 };
const items2 = [obj6];
2026-07-29 08:29:29 +00:00
tmp14 = items2;
}
obj3.itemContent = tmp14;
obj3.itemId = tmp[2];
obj3.id = tmp[1];
const channel1 = ChannelStore.getChannel(guildId.channelId);
2026-07-29 08:29:29 +00:00
let guildId1;
if (channel1 != null) {
guildId1 = channel1.getGuildId();
}
obj3.guildId = guildId1;
obj3.channelId = tmp[1];
return obj3;
2026-07-20 16:05:17 +00:00
}
};
let apply = apply_mod;
const omitResult = apply.omit(importDefaultResult3Result, ["inlineCode", "codeBlock", "br", "blockQuote", "subtext", "soundboard"]);
let apply = apply_mod;
const omitResult1 = apply.omit(importDefaultResult3Result, ["inlineCode", "codeBlock", "br", "blockQuote", "autolink", "url", "attachmentLink", "mention", "roleMention", "channelMention", "channelOrMessageUrl", "mediaPostLink", "subtext", "soundboard", "gameMention"]);
let apply = apply_mod;
2026-07-23 10:11:24 +00:00
let items1 = [
2026-07-20 16:05:17 +00:00
importDefaultResult3Result,
{
inlineCode: {
match(arg0, arg1, arg2) {
const match = importDefaultResult3Result.codeBlock.match(arg0, arg1, arg2);
if (null != match) {
return match;
} else {
2026-07-29 08:29:29 +00:00
const match1 = tmp.inlineCode.match(arg0, arg1, arg2);
2026-07-20 16:05:17 +00:00
let tmp4;
if (null != match1) {
tmp4 = match1;
}
return tmp4;
}
2026-07-29 08:29:29 +00:00
tmp = importDefaultResult3Result;
2026-07-20 16:05:17 +00:00
}
}
}
];
const obj24 = {
inlineCode: {
match(arg0, arg1, arg2) {
const match = importDefaultResult3Result.codeBlock.match(arg0, arg1, arg2);
if (null != match) {
return match;
} else {
const match1 = tmp.inlineCode.match(arg0, arg1, arg2);
let tmp4;
if (null != match1) {
tmp4 = match1;
}
return tmp4;
2026-07-20 16:05:17 +00:00
}
tmp = importDefaultResult3Result;
2026-07-20 16:05:17 +00:00
}
}
};
const omitResult2 = apply.omit(importDefaultResult3Result, ["codeBlock", "br", "mention", "channel", "roleMention", "attachmentLink", "subtext", "soundboard", "gameMention"]);
let apply = apply_mod;
const omitResult3 = apply.omit(combineMarkupRules(items1), ["blockQuote", "codeBlock", "br"]);
let apply = apply_mod;
const omitResult4 = apply.omit(importDefaultResult3Result, ["codeBlock", "br", "blockQuote"]);
let apply = apply_mod;
const omitResult5 = apply.omit(importDefaultResult3Result, ["codeBlock", "br", "attachmentLink", "mention", "roleMention", "channel", "paragraph", "newline", "soundboard"]);
let apply = apply_mod;
const omitResult6 = apply.omit(importDefaultResult3Result, ["codeBlock", "blockQuote", "br"]);
2026-07-29 08:29:29 +00:00
let items2 = [
2026-07-20 16:05:17 +00:00
{
highlightWord: {
order: -1,
match(arr, parseDepth) {
if (null != parseDepth.parseDepth) {
if (parseDepth.parseDepth > 10) {
return null;
}
}
if (null != parseDepth.highlightWord) {
if (0 !== parseDepth.highlightWord.length) {
const index = arr.indexOf(parseDepth.highlightWord);
if (-1 === index) {
return null;
} else {
2026-07-29 08:29:29 +00:00
let tmp2 = 0 === arr.length;
if (!tmp2) {
let tmp = 0 === index;
if (!tmp) {
tmp = "" === arr.charAt(index - 1).trim();
const str = arr.charAt(index - 1);
}
tmp2 = tmp;
2026-07-24 07:16:23 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp3 = !tmp2;
2026-07-24 07:16:23 +00:00
if (tmp2) {
2026-07-29 08:29:29 +00:00
const sum = index + parseDepth.highlightWord.length;
let tmp5 = sum === arr.length;
if (!tmp5) {
tmp5 = "" === arr.charAt(sum).trim();
const str3 = arr.charAt(sum);
}
tmp3 = !tmp5;
}
let tmp6 = index;
let tmp7 = index;
if (tmp3) {
2026-07-24 07:16:23 +00:00
while (true) {
2026-07-29 08:29:29 +00:00
let index1 = arr.indexOf(parseDepth.highlightWord, tmp6 + 1);
let tmp9 = 0 === arr.length;
if (!tmp9) {
let tmp10 = 0 === index1;
if (!tmp10) {
let str6 = arr.charAt(index1 - 1);
tmp10 = "" === str6.trim();
}
tmp9 = tmp10;
2026-07-24 07:16:23 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp11 = !tmp9;
if (tmp9) {
let sum1 = index1 + parseDepth.highlightWord.length;
let tmp13 = sum1 === arr.length;
if (!tmp13) {
let str7 = arr.charAt(sum1);
tmp13 = "" === str7.trim();
}
tmp11 = !tmp13;
}
tmp7 = index1;
if (!tmp11) {
2026-07-20 16:05:17 +00:00
break;
2026-07-24 07:16:23 +00:00
} else {
2026-07-29 08:29:29 +00:00
tmp6 = index1;
tmp7 = index1;
2026-07-24 07:16:23 +00:00
if (-1 === index1) {
break;
}
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
if (-1 === tmp7) {
2026-07-20 16:05:17 +00:00
return null;
} else {
2026-07-29 08:29:29 +00:00
const substr = arr.substring(0, tmp7);
const items = [arr, parseDepth.highlightWord, substr, arr.substring(tmp7 + parseDepth.highlightWord.length)];
2026-07-20 16:05:17 +00:00
return items;
}
}
}
}
return null;
},
parse(arg0, arg1, arg2) {
2026-07-29 08:29:29 +00:00
let num = module.parseDepth;
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
const obj = {};
2026-07-20 16:05:17 +00:00
const merged = Object.assign(module);
2026-07-29 08:29:29 +00:00
obj.parseDepth = num + 1;
const _module = require("ChannelStore");
const _module1 = require("GuildRoleStore");
const items = [..._module, obj2, ..._module1];
2026-07-20 16:05:17 +00:00
return items;
}
}
},
];
let combineMarkupRules = combineMarkupRules_mod;
let apply = apply_mod;
items2[1] = apply.omit(importDefaultResult3Result, ["url"]);
const obj25 = {
highlightWord: {
order: -1,
match(arr, parseDepth) {
if (null != parseDepth.parseDepth) {
if (parseDepth.parseDepth > 10) {
2026-07-20 16:05:17 +00:00
return null;
}
}
if (null != parseDepth.highlightWord) {
if (0 !== parseDepth.highlightWord.length) {
const index = arr.indexOf(parseDepth.highlightWord);
if (-1 === index) {
return null;
} else {
let tmp2 = 0 === arr.length;
if (!tmp2) {
let tmp = 0 === index;
if (!tmp) {
tmp = "" === arr.charAt(index - 1).trim();
const str = arr.charAt(index - 1);
}
tmp2 = tmp;
2026-07-29 08:29:29 +00:00
}
let tmp3 = !tmp2;
if (tmp2) {
const sum = index + parseDepth.highlightWord.length;
let tmp5 = sum === arr.length;
if (!tmp5) {
tmp5 = "" === arr.charAt(sum).trim();
const str3 = arr.charAt(sum);
}
tmp3 = !tmp5;
2026-07-29 08:29:29 +00:00
}
let tmp6 = index;
let tmp7 = index;
if (tmp3) {
while (true) {
let index1 = arr.indexOf(parseDepth.highlightWord, tmp6 + 1);
let tmp9 = 0 === arr.length;
if (!tmp9) {
let tmp10 = 0 === index1;
if (!tmp10) {
let str6 = arr.charAt(index1 - 1);
tmp10 = "" === str6.trim();
}
tmp9 = tmp10;
2026-07-29 08:29:29 +00:00
}
let tmp11 = !tmp9;
if (tmp9) {
let sum1 = index1 + parseDepth.highlightWord.length;
let tmp13 = sum1 === arr.length;
if (!tmp13) {
let str7 = arr.charAt(sum1);
tmp13 = "" === str7.trim();
}
tmp11 = !tmp13;
2026-07-29 08:29:29 +00:00
}
tmp7 = index1;
if (!tmp11) {
2026-07-24 07:16:23 +00:00
break;
} else {
tmp6 = index1;
tmp7 = index1;
if (-1 === index1) {
break;
}
2026-07-24 07:16:23 +00:00
}
2026-07-20 16:05:17 +00:00
}
}
if (-1 === tmp7) {
return null;
} else {
const substr = arr.substring(0, tmp7);
const items = [arr, parseDepth.highlightWord, substr, arr.substring(tmp7 + parseDepth.highlightWord.length)];
return items;
}
2026-07-20 16:05:17 +00:00
}
}
}
return null;
},
parse(arg0, arg1, arg2) {
let num = module.parseDepth;
if (num == null) {
num = 0;
}
const obj = {};
const merged = Object.assign(module);
obj.parseDepth = num + 1;
const _module = require("ChannelStore");
const _module1 = require("GuildRoleStore");
const items = [..._module, obj2, ..._module1];
return items;
2026-07-20 16:05:17 +00:00
}
}
};
const omitResult7 = apply.omit(importDefaultResult3Result, ["codeBlock", "br", "inlineCode"]);
const size = fn(2);
let result = size.fileFinishedImporting("modules/markup/MarkupRules.tsx");
2026-07-20 16:05:17 +00:00
export default { RULES: importDefaultResult3Result, CHANNEL_TOPIC_RULES: omitResult, VOICE_CHANNEL_STATUS_RULES: omitResult1, EMBED_TITLE_RULES: omitResult2, INLINE_REPLY_RULES: omitResult3, GUILD_VERIFICATION_FORM_RULES: omitResult4, GUILD_EVENT_RULES: omitResult6, PROFILE_BIO_RULES: omitResult5, AUTO_MODERATION_SYSTEM_MESSAGE_RULES: combineMarkupRules(items2), NATIVE_SEARCH_RESULT_LINK_RULES: apply.omit(importDefaultResult3Result, ["codeBlock", "br", "inlineCode"]) };
2026-07-20 16:05:17 +00:00
export { hydrateRoleMention };
export { hydrateUserMention };
export const hydrateCommandMention = function hydrateCommandMention(name, commandId, channelId) {
const items = [..._toArray(name.split(" ")).slice(1)];
const mapped = items.map((item) => "" + SUB_COMMAND_KEY_SEPARATOR + item);
const obj = { type: "commandMention", channelId: channelId.channelId, commandId, commandName: name, commandKey: "" + commandId + mapped.join(""), content: null };
const arr = _toArray(name.split(" "));
const items1 = [{ type: "text", content: "" + name }];
obj.content = items1;
2026-07-29 08:29:29 +00:00
return obj;
};