This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
// Metro module 9007 (f9008).
import combineMarkupRules from "./combineMarkupRules";
import MarkupRules from "./MarkupRules";
import MarkupReactRules_native from "./MarkupReactRules.native";
import LRUCache from "../../_bundle/LRUCache";
import { reactParserFor } from "../../_bundle/Module7768";
import MarkupUtils from "./MarkupUtils";
import Module3888 from "../../_bundle/Module3888";
import Module12 from "../../_bundle/Module12";
let c5893_2 = combineMarkupRules([MarkupRules.PROFILE_BIO_RULES, MarkupReactRules_native({
enableBuildOverrides: false,
mustConfirmExternalLink: true
})]);
let c5893_3 = new LRUCache({
max: 2000
});
const r36 = reactParserFor(c5893_2);
let c5893_4 = MarkupUtils.astParserFor(c5893_2);
const r55 = reactParserFor(combineMarkupRules([Module12.omit(c5893_2, ["link", "url", "autolink", "customEmoji", "emoji", "commandMention"]), {
emoji: {
react: () => null
}
}]));
export { r36 as parseBioReact };
export function getOrParseBioAST(a0) {
let r7 = c5893_3.get(a0);
if (r7 == null) {
const r10 = c5893_4(a0, true);
c5893_3.set(a0, r10);
r7 = r10;
}
return r7;
}
export function parseBioReactWithCachedAST(a0) {
if (a0.trim().length === 0) {
return null;
}
let r13 = c5893_3.get(a0);
if (r13 == null) {
const r15 = c5893_4(a0, true);
c5893_3.set(a0, r15);
r13 = r15;
}
return Module3888.reactFor(Module3888.ruleOutput(c5893_2, "react"))(r13);
}
export { r55 as parseBioReactWithoutScrolling };
+5
View File
@@ -0,0 +1,5 @@
// Metro module 4632 (f4633).
import { isGuildSelectableChannelType, isGuildVocalChannelType } from "../../records/ChannelRecord";
export function isChannelTypeMentionable(a0) {
return isGuildSelectableChannelType(a0) || isGuildVocalChannelType(a0);
}
+100
View File
@@ -0,0 +1,100 @@
// Metro module 4619 (f4620).
import { AST_KEY } from "./MarkupTypes";
import MarkupReactRules_native, { plainMentionRenderer, plainSpoilerRenderer } from "./MarkupReactRules.native";
import combineMarkupRules from "./combineMarkupRules";
import MarkupUtils from "./MarkupUtils";
import Module3888 from "../../_bundle/Module3888";
import MarkupRules from "./MarkupRules";
let c2817_3, createRulesWithoutLinks, createNotifCenterV2MessagePreviewRules;
const createRules = function createRules(a0, r3 = {}) {
const r7 = MarkupReactRules_native(a0, r3);
const r19 = [MarkupUtils.defaultRules, r7, ,];
const r20 = {};
r20[AST_KEY.LINK] = {
...Module3888.defaultRules.link,
react: r7[AST_KEY.LINK].react
};
r20[AST_KEY.URL] = {
...Module3888.defaultRules.url,
react: r7[AST_KEY.URL].react
};
r20[AST_KEY.AUTOLINK] = {
...Module3888.defaultRules.autolink,
react: r7[AST_KEY.AUTOLINK].react
};
r20[AST_KEY.BLOCK_QUOTE] = {
...Module3888.defaultRules.blockQuote,
react: r7[AST_KEY.BLOCK_QUOTE].react
};
r19[2] = r20;
return combineMarkupRules(r19);
};
createRulesWithoutLinks = function createRulesWithoutLinks(a0, r5 = {}) {
const r0 = {
...createRules(a0, r5)
};
for (const item of c2817_3) {
delete r0[item];
}
return r0;
};
createNotifCenterV2MessagePreviewRules = function createNotifCenterV2MessagePreviewRules(a0, a1, a2) {
const r7 = MarkupReactRules_native(a0, a1, a2);
const r21 = [MarkupUtils.notifCenterV2MessagePreviewRules, ,];
const r22 = {};
r22[AST_KEY.MENTION] = {
...MarkupRules.RULES[AST_KEY.MENTION],
react: r7[AST_KEY.MENTION].react
};
r22[AST_KEY.CHANNEL_MENTION] = {
...MarkupRules.RULES[AST_KEY.CHANNEL_MENTION],
react: r7[AST_KEY.CHANNEL_MENTION].react
};
r22[AST_KEY.ITALICS] = {
...MarkupRules.RULES[AST_KEY.ITALICS],
react: r7[AST_KEY.ITALICS].react
};
r21[1] = r22;
return combineMarkupRules(r21);
};
c2817_3 = [AST_KEY.URL, AST_KEY.AUTOLINK, AST_KEY.LINK, "mailto", "tel"];
export { createRules };
export function getParser(r5 = {}, r4 = {}) {
return MarkupUtils.reactParserFor(createRules(r5, r4));
}
export { createRulesWithoutLinks };
export function getParserWithoutLinks(r5 = {}, r4 = {}) {
return MarkupUtils.reactParserFor(createRulesWithoutLinks(r5, r4));
}
export { createNotifCenterV2MessagePreviewRules };
export function getNotifCenterV2MessagePreviewParser(r6 = {}, r5 = {}) {
return MarkupUtils.reactParserFor(createNotifCenterV2MessagePreviewRules(r6, r5, arguments[2]));
}
export function createWidgetMessageRules() {
const r15 = [MarkupUtils.lockscreenWidgetMessageRules, ,];
const r16 = {};
r16[AST_KEY.MENTION] = {
...MarkupRules.RULES[AST_KEY.MENTION],
react: plainMentionRenderer
};
r16[AST_KEY.SPOILER] = {
...MarkupRules.RULES.spoiler,
react: plainSpoilerRenderer
};
r15[1] = r16;
return combineMarkupRules(r15);
}
export function getWidgetMessageRules() {
const r18 = [MarkupUtils.lockscreenWidgetMessageRules, ,];
const r19 = {};
r19[AST_KEY.MENTION] = {
...MarkupRules.RULES[AST_KEY.MENTION],
react: plainMentionRenderer
};
r19[AST_KEY.SPOILER] = {
...MarkupRules.RULES.spoiler,
react: plainSpoilerRenderer
};
r18[1] = r19;
return MarkupUtils.reactParserFor(combineMarkupRules(r18));
}
@@ -0,0 +1,24 @@
// Metro module 4633 (f4634).
import Module3888 from "../../_bundle/Module3888";
let c2828_0 = /^https:\/\/(?:(?:media|images)\.discordapp\.net|(?:cdn\.discordapp\.com))\/(?:attachments|ephemeral-attachments)\/\d+\/\d+\/([A-Za-z0-9._-]*[A-Za-z0-9_-])(?:[?][a-zA-Z0-9?&=_-]*)?/;
const r23 = {
attachmentLink: {
order: Module3888.defaultRules.url.order - 0.5,
requiredFirstCharacters: ["h"],
match: (a0) => c2828_0.exec(a0),
parse: (a0) => {
const attachmentUrl = a0[0];
const attachmentName = a0[1];
return {
type: "attachmentLink",
content: [{
type: "text",
content: attachmentName
}],
attachmentUrl,
attachmentName
};
}
}
};
export default r23;
+360
View File
@@ -0,0 +1,360 @@
// Metro module 4630 (f4631).
import GatedChannelStore from "../channel/GatedChannelStore";
import ChannelStore from "../../stores/ChannelStore";
import GuildStore from "../../stores/GuildStore";
import PermissionStore from "../../stores/PermissionStore";
import RelationshipStore from "../../stores/RelationshipStore";
import UserStore from "../../stores/UserStore";
import { ChannelTypes, ME } from "../../Constants";
import { truncateText } from "../../utils/StringUtils";
import AvatarUtils from "../../utils/AvatarUtils";
import { intl, t } from "../../intl/index.native";
import { getChannelRoleSubscriptionStatus } from "../guild_role_subscriptions/useChannelRoleSubscriptionStatus";
import { getMentionIconType } from "../../utils/ChannelUtils";
import { computeChannelName } from "../channel/useChannelName";
import { isChannelTypeMentionable } from "./ChannelUtils";
import * as _LinkUtils from "../links/LinkUtils";
import { CHANNEL_OR_MESSAGES_URL_RE, MEDIA_POST_URL_RE } from "../links/LinkUtils";
import MarkupTextRule from "./MarkupTextRule";
import Module3888 from "../../_bundle/Module3888";
import { HermesBuiltin } from "../../_hermes/prelude";
let handleUnknownChannel, parseChannel;
const getChannel = function getChannel(a0, mentionChannels) {
const channel = ChannelStore.getChannel(a0);
const isSubscriptionGated = getChannelRoleSubscriptionStatus(a0, ChannelStore, GatedChannelStore, PermissionStore).isSubscriptionGated;
let iconType = getMentionIconType(channel);
if (iconType == null) {
iconType = "text";
}
if (mentionChannels != null) {
const r29 = mentionChannels.find((item) => item.id === a0);
if (r29 != null) {
return {
type: r29.type,
id: r29.id,
guildId: r29.guild_id,
name: r29.name,
isDm: channel != null && channel.isPrivate(),
isForumPost: channel != null && channel.isForumPost(),
isMentionable: true,
canViewChannel: true,
roleSubscriptionGated: isSubscriptionGated,
iconType,
parentId: channel?.parent_id
};
}
}
return channel != null ? {
type: channel.type,
id: channel.id,
guildId: channel.guild_id,
name: computeChannelName(channel, UserStore, RelationshipStore),
isDm: channel.isPrivate(),
isForumPost: channel.isForumPost(),
isMentionable: isChannelTypeMentionable(channel.type),
canViewChannel: _LinkUtils.canViewChannel(channel),
roleSubscriptionGated: isSubscriptionGated,
iconType,
parentId: channel.parent_id
} : null;
};
handleUnknownChannel = function handleUnknownChannel(a0, a1, a2, a3, target) {
const guild = GuildStore.getGuild(a0);
const inContent = guild == null ? null : guild?.id !== a3 ? [{
type: "guild",
guildId: guild.id,
content: truncateText(guild.name, 32),
icon: AvatarUtils.getGuildIconURL({
id: guild.id,
icon: guild.icon,
size: 40
})
}] : null;
const r48 = intl.string(t.zLZPmk).toLowerCase();
const UNKNOWN = ChannelTypes.UNKNOWN;
return {
type: "channelMention",
guildId: a0,
channelId: a1,
messageId: a2,
originalLink: target,
inContent,
content: [{
type: "channel",
content: [{
type: "em",
content: [{
type: "text",
content: truncateText(r48, 32)
}]
}],
channelType: UNKNOWN,
iconType: "text"
}]
};
};
parseChannel = function parseChannel(a0, a1, a2, a3) {
let r89;
if (a0.canViewChannel) {
if (a0.isMentionable) {
const r52 = {
type: "channelMention",
channelId: a0.id,
guildId: a0.guildId,
messageId: a1,
originalLink: a3
};
const guild = GuildStore.getGuild(a0.guildId);
if (guild == null) {
return a0.isDm ? {
...r52,
guildId: ME,
inContent: [{
type: "channel",
content: [{
type: "text",
content: truncateText(a0.name, 32)
}],
channelType: a0.type,
iconType: a0.iconType
}],
content: [{
type: "channel",
content: [{
type: "text",
content: ""
}],
iconType: "message"
}]
} : a3 != null ? {
type: "link",
content: [{
type: "text",
content: a3
}],
target: a3,
title: void 0
} : {
type: "text",
content: `#${intl.string(t.J90oLW)}`
};
}
const guildId = a0.guildId;
const r58 = {
...r52
};
const r4 = a1 != null;
const r19 = {
type: "guild",
guildId: guild.id,
content: truncateText(guild.name, 32),
icon: AvatarUtils.getGuildIconURL({
id: guild.id,
icon: guild.icon,
size: 40
})
};
const r79 = {
type: "channel",
content: [{
type: "text",
content: truncateText(a0.name, 32)
}],
channelType: a0.type,
iconType: a0.iconType
};
const isForumPost = a0.isForumPost;
const r85 = {
type: "channel",
content: [{
type: "text",
content: ""
}],
iconType: null
};
const iconType = isForumPost ? "post" : "message";
L35: {
const r3 = guildId === a2;
r85.iconType = iconType;
if (r3 && r4) {
if (a0.isForumPost) {
const channel = ChannelStore.getChannel(a0.parentId);
if (channel != null) {
const r111 = computeChannelName(channel, UserStore, RelationshipStore);
const type = channel.type;
let iconType2 = getMentionIconType(channel);
if (iconType2 == null) {
iconType2 = "forum";
}
r89 = {
inContent: [{
type: "channel",
content: [{
type: "text",
content: truncateText(r111, 32)
}],
channelType: type,
iconType: iconType2
}],
content: [r79]
};
break L35;
}
}
r89 = {
inContent: [r79],
content: [r85]
};
} else {
r89 = r3 && !r4 ? {
inContent: null,
content: [r79]
} : !r3 && r4 ? {
inContent: [r19],
content: [a0.isForumPost ? r79 : r85]
} : r3 ? void 0 : r4 ? void 0 : {
inContent: [r19],
content: [r79]
};
}
}
HermesBuiltin.copyDataProperties(r58, r89);
return r58;
}
return {
type: "text",
content: `#${a0.name}`
};
}
return {
type: "channelMention",
guildId: a0.guildId,
channelId: a0.id,
messageId: a1,
inContent: null,
content: [{
type: "channel",
content: [{
type: "text",
content: a0.roleSubscriptionGated ? a0.name : intl.string(t["/YzI63"])
}],
channelType: a0.roleSubscriptionGated ? a0.type : ChannelTypes.UNKNOWN,
iconType: "locked"
}]
};
};
const r40 = {
channelMention: {
order: MarkupTextRule.order,
requiredFirstCharacters: ["<"],
match: (a0) => /^<#(\d+)>/.exec(a0),
parse: (a0, a1, a2) => {
let r23;
const id = a0[1];
if (a2.returnMentionIds) {
return {
type: "channelMention",
id
};
}
const channel = getChannel(id, a2.mentionChannels);
if (channel == null) {
const channel3 = ChannelStore.getChannel(a2.channelId);
r23 = handleUnknownChannel(null, id, null, channel3 == null ? void 0 : channel3.getGuildId());
} else {
const channel2 = ChannelStore.getChannel(a2.channelId);
r23 = parseChannel(channel, null, channel2 == null ? void 0 : channel2.getGuildId());
}
return r23;
}
},
channelOrMessageUrl: {
order: Module3888.defaultRules.url.order - 0.5,
requiredFirstCharacters: ["h"],
match: (a0) => {
const r10 = CHANNEL_OR_MESSAGES_URL_RE.exec(a0);
if (r10 != null) {
if (r10[2] != null && /\D/.test(r10[2])) {
return null;
}
if (r10[3] != null && /\D/.test(r10[3])) {
return null;
}
}
return r10;
},
parse: (a0, a1, a2) => {
let r25;
const target = a0[0];
const r9 = a0[1];
const r8 = a0[2];
const r7 = a0[3];
if (r8 == null) {
return {
type: "link",
content: [{
type: "text",
content: target
}],
target,
title: void 0
};
}
const channel = getChannel(r8, null);
if (channel == null) {
const channel3 = ChannelStore.getChannel(a2.channelId);
r25 = handleUnknownChannel(r9, r8, r7, channel3 == null ? void 0 : channel3.getGuildId(), target);
} else {
const channel2 = ChannelStore.getChannel(a2.channelId);
r25 = parseChannel(channel, r7, channel2 == null ? void 0 : channel2.getGuildId(), target);
}
return r25;
}
},
mediaPostLink: {
order: Module3888.defaultRules.url.order - 0.5,
requiredFirstCharacters: ["h"],
match: (a0) => MEDIA_POST_URL_RE.exec(a0),
parse: (a0, a1, a2) => {
let r27;
const target = a0[0];
const r12 = a0[1];
const r10 = a0[2];
const r6 = a0[3];
const r7 = a0[4];
if (r10 != null && r6 != null) {
const channel2 = getChannel(r6, null);
if (channel2 != null) {
const channel5 = ChannelStore.getChannel(a2.channelId);
return parseChannel(channel2, r7, channel5 == null ? void 0 : channel5.getGuildId(), target);
}
const channel = getChannel(r10, null);
if (channel != null) {
const channel4 = ChannelStore.getChannel(a2.channelId);
r27 = parseChannel(channel, r7, channel4 == null ? void 0 : channel4.getGuildId(), target);
} else {
const channel3 = ChannelStore.getChannel(a2.channelId);
r27 = handleUnknownChannel(r12, r10, r7, channel3 == null ? void 0 : channel3.getGuildId(), target);
}
return r27;
}
return {
type: "link",
content: [{
type: "text",
content: target
}],
target,
title: void 0
};
}
}
};
export default r40;
export function getGuildIdFromChannelId(a0) {
const channel = ChannelStore.getChannel(a0);
return channel == null ? void 0 : channel.getGuildId();
}
export { getChannel };
export { handleUnknownChannel };
export { parseChannel };
@@ -0,0 +1,5 @@
// Metro module 7863 (f7864).
import SnowflakeUtils from "../../utils/SnowflakeUtils";
export function isMessageNewerThanImprovedMarkdownEpoch(a0) {
return !(a0 < SnowflakeUtils.extractTimestamp("1088216706570268682"));
}
+26
View File
@@ -0,0 +1,26 @@
// Metro module 4646 (f4647).
import Module3888, { anyScopeRegex } from "../../_bundle/Module3888";
let c2836_2 = /\n$/;
const r15 = {
...Module3888.defaultRules.heading,
requiredFirstCharacters: [" ", "#"],
match: (a0, a1, a2) => {
let r2;
L5: {
const allowHeading = a1.allowHeading;
r2 = null;
if (allowHeading) {
if (a2 != null && a2 !== "") {
const r1 = a2.match(c2836_2) != null;
r2 = null;
if (!r1) {
break L5;
}
}
r2 = anyScopeRegex(/^ *(#{1,3})(?:\s+)([^\n]+?)#*\s*(?:\n|$)/)(a0, a1, a2);
}
}
return r2;
}
};
export default r15;
+285
View File
@@ -0,0 +1,285 @@
// Metro module 4625 (f4626).
import LRUCache from "../../_bundle/LRUCache";
import { sanitizeWhitespace, sanitizeUnicodeConfusables, safelyMakeUrlHumanReadable } from "./UnicodeSanitizationUtils";
import { AST_KEY } from "./MarkupTypes";
import { assertNever } from "../../utils/GlobalUtils";
import findCodedLinks, { isSuspiciousCodedLink } from "../coded_links/findCodedLinks";
import URLUtils from "../../utils/URLUtils";
import error from "../../_bundle/error";
import Module3888 from "../../_bundle/Module3888";
import Module12 from "../../_bundle/Module12";
let c2821_4, _excluded, c2821_6, c2821_7, c2821_8, c2821_9, c2821_10, getRawText, isSuspiciousUrl, punycodeLink;
const validateContentTypes = function validateContentTypes(a0, a1, r8 = []) {
const r28 = Array.isArray(a0) ? a0 : [a0];
for (const item of r28) {
L15: {
L13: {
if (item === void 0) {
break L15;
}
if (!a1.includes(item.type)) {
break L15;
}
if (!(item.type === AST_KEY.INLINE_CODE && validateContentTypes(item.validationChildContent, [...a1, ...r8]) == null)) {
if (!Array.isArray(item.content)) {
continue;
}
if (validateContentTypes(item.content, a1) == null) {
break L13;
}
continue;
}
return null;
}
return null;
}
return null;
}
return r28;
};
getRawText = function getRawText(content) {
let r0 = "";
for (const item of content) {
const type = item.type;
if (AST_KEY.TEXT !== type && AST_KEY.INLINE_CODE !== type) {
if (AST_KEY.CUSTOM_EMOJI === type) {
r0 = r0 + item.name;
continue;
}
if (AST_KEY.EMOJI === type) {
r0 = r0 + item.surrogate;
continue;
}
if (AST_KEY.LINE_BREAK === type) {
r0 = r0 + "\n";
continue;
}
if (AST_KEY.STRONG !== type && AST_KEY.ITALICS !== type && AST_KEY.UNDERLINE !== type && AST_KEY.STRIKETHROUGH !== type && AST_KEY.SPOILER !== type) {
if (AST_KEY.TIMESTAMP === type) {
r0 = r0 + "<timestamp>";
continue;
}
if (AST_KEY.BLOCK_QUOTE !== type && AST_KEY.LIST !== type && AST_KEY.HEADING !== type && AST_KEY.SUBTEXT !== type) {
assertNever(item.type);
continue;
}
r0 = r0 + `<${item.type}Content>`;
continue;
}
r0 = r0 + getRawText(item.content);
continue;
}
r0 = r0 + item.content;
}
return r0;
};
isSuspiciousUrl = function isSuspiciousUrl(a0) {
if (isSuspiciousCodedLink(a0)) {
return true;
}
let r16 = c2821_4.get(a0);
if (r16 == null) {
const whitespaceSanitized = sanitizeWhitespace(a0);
const r23 = {
whitespaceSanitized,
fullySanitized: sanitizeUnicodeConfusables(whitespaceSanitized)
};
c2821_4.set(a0, r23);
r16 = r23;
}
if (r16.whitespaceSanitized !== a0) {
return true;
}
const r31 = URLUtils.toURLSafe(a0);
if (r31 == null) {
return true;
}
if (r31.protocol !== "http:" && r31.protocol !== "https:") {
return false;
}
const r38 = a0.split("/");
return r38.length < 3 || (r38[1] !== "" || URLUtils.safeDecodeURIComponent(r38[2]) !== r38[2]);
};
punycodeLink = function punycodeLink(a0) {
let r67;
try {
if (isSuspiciousUrl(a0)) {
throw new Error("Rejected due to suspicious characters in URL: " + JSON.stringify(a0));
}
const uRL = new URL(a0);
let protocol = uRL.protocol;
if (protocol == null) {
protocol = "";
}
if (!_excluded.includes(protocol.toLowerCase())) {
throw new Error("Provided protocol is not allowed: " + protocol);
}
if (!(protocol !== "http:" && protocol !== "https:") && !(uRL.hostname != null && uRL.hostname.length !== 0)) {
throw new Error("no hostname");
}
uRL.hostname = error.toASCII(uRL.hostname.toLowerCase());
const target = safelyMakeUrlHumanReadable(uRL);
uRL.username = "";
uRL.password = "";
r67 = {
target,
displayTarget: safelyMakeUrlHumanReadable(uRL)
};
} catch ($e) {
return null;
}
return r67;
};
c2821_4 = new LRUCache({
max: 50
});
_excluded = ["http:", "https:", "discord:", "tel:", "sms:", "mailto:"];
c2821_6 = [AST_KEY.TEXT, AST_KEY.UNDERLINE, AST_KEY.STRONG, AST_KEY.ITALICS, AST_KEY.STRIKETHROUGH, AST_KEY.INLINE_CODE, AST_KEY.SPOILER, AST_KEY.LINE_BREAK, AST_KEY.TIMESTAMP];
c2821_7 = [...c2821_6, AST_KEY.EMOJI, AST_KEY.CUSTOM_EMOJI];
c2821_8 = [AST_KEY.LIST, AST_KEY.HEADING, AST_KEY.BLOCK_QUOTE, AST_KEY.SUBTEXT];
c2821_9 = [AST_KEY.TEXT];
c2821_10 = [AST_KEY.UNDERLINE, AST_KEY.STRONG, AST_KEY.ITALICS, AST_KEY.STRIKETHROUGH, AST_KEY.INLINE_CODE, AST_KEY.SPOILER, AST_KEY.LINE_BREAK, AST_KEY.TIMESTAMP, AST_KEY.EMOJI, AST_KEY.CUSTOM_EMOJI, AST_KEY.LIST, AST_KEY.HEADING, AST_KEY.BLOCK_QUOTE, AST_KEY.SUBTEXT];
const r157 = {
...Module3888.defaultRules.link,
match: (a0, a1, a2) => {
let r0, r1, r2, r9, length;
if (a1.allowLinks) {
if (a0.indexOf("](") === -1) {
return null;
}
const r25 = 0 < a0.length;
let r3 = 0;
let r5 = 0;
let r27 = 0;
if (r25) {
do {
L13: {
const r28 = a0[r3];
r9 = r3;
const r8 = r5;
const r4 = r27;
r1 = 0;
r2 = r4;
if (r28 !== ")") {
if (r28 === "[") {
r0 = r4 + 1;
if (10 < r0) {
return null;
}
} else if (r28 === "]") {
r0 = 0 < r4 ? r4 - 1 : r4;
} else {
r0 = r4;
r1 = r8;
r2 = r0;
if (r28 !== "(") {
break L13;
}
}
r1 = r8 + 1;
r2 = r0;
if (200 < r1) {
return null;
}
}
}
r3 = r9 + 1;
length = a0.length;
r5 = r1;
r27 = r2;
} while (r3 < length);
}
return Module3888.defaultRules.link.match(a0, a1, a2);
}
return null;
},
parse: (a0, a1, a2) => {
const [content, r17, r19, r14] = a0;
if (isSuspiciousUrl(r19)) {
return {
type: AST_KEY.TEXT,
content
};
}
let r9 = c2821_4.get(r19);
if (r9 == null) {
const whitespaceSanitized2 = sanitizeWhitespace(r19);
const r39 = {
whitespaceSanitized: whitespaceSanitized2,
fullySanitized: sanitizeUnicodeConfusables(whitespaceSanitized2)
};
c2821_4.set(r19, r39);
r9 = r39;
}
let r43 = c2821_4.get(r17);
if (r43 == null) {
const whitespaceSanitized3 = sanitizeWhitespace(r17);
const r53 = {
whitespaceSanitized: whitespaceSanitized3,
fullySanitized: sanitizeUnicodeConfusables(whitespaceSanitized3)
};
c2821_4.set(r17, r53);
r43 = r53;
}
const r56 = r14 ?? "";
let r58 = c2821_4.get(r56);
if (r58 == null) {
const whitespaceSanitized4 = sanitizeWhitespace(r56);
const r68 = {
whitespaceSanitized: whitespaceSanitized4,
fullySanitized: sanitizeUnicodeConfusables(whitespaceSanitized4)
};
c2821_4.set(r56, r68);
r58 = r68;
}
const whitespaceSanitized = r9.whitespaceSanitized;
const fullySanitized = r43.fullySanitized;
const fullySanitized2 = r58.fullySanitized;
const r75 = fullySanitized.trim();
if (whitespaceSanitized.trim().length !== 0 && r75.length !== 0) {
const r88 = punycodeLink(Module3888.unescapeUrl(r19));
const r93 = findCodedLinks(r17).length > 0 || findCodedLinks(r14).length > 0;
if (r88 != null && !r93) {
const r99 = {
...a2,
allowEscape: false,
parseInlineCodeChildContent: true
};
const r104 = a2.allowEmojiLinks ? c2821_7 : c2821_6;
const r22 = [...r104, ...c2821_8];
const r20 = [...c2821_9, ...c2821_10];
const r124 = validateContentTypes(a1(fullySanitized, r99), r22, [AST_KEY.EMOJI]);
const r126 = validateContentTypes(a1(fullySanitized2, r99), r20);
if (r124 != null && r126 != null) {
if (getRawText(r124).trim().length === 0) {
return {
type: AST_KEY.TEXT,
content
};
}
return {
content: Module3888.parserFor(Module12.pick(a1.rules, r104))(r43.whitespaceSanitized, r99),
target: r88.target,
title: r58.whitespaceSanitized
};
}
return {
type: AST_KEY.TEXT,
content
};
}
return {
type: AST_KEY.TEXT,
content
};
}
return {
type: AST_KEY.TEXT,
content
};
}
};
export default r157;
export { _excluded as ALLOWED_PROTOCOLS };
export { isSuspiciousUrl };
export { punycodeLink };
+87
View File
@@ -0,0 +1,87 @@
// Metro module 4647 (f4648).
import Module3888 from "../../_bundle/Module3888";
import Module38 from "../../_bundle/Module38";
let c2837_2 = /\n{2,}$/;
let c2837_3 = /(?:^|\n)( *)$/;
let c2837_4 = new RegExp("^" + "(%INDENT_CAPTURE_PATTERN%)((?:[*-]|\\d+\\.)) +".replace("%INDENT_CAPTURE_PATTERN%", " *"));
let c2837_5 = / *\n$/;
const r29 = RegExp;
const r31 = "^( *)((?:[*-]|\\d+\\.)) [\\s\\S]+?(?:\\n(?! )(?!\\1(?:[*-]|\\d+\\.) )|$)";
let c2837_6 = new r29(r31);
let c2837_7 = new RegExp("^\\n" + r31.slice(1));
let c2837_8 = /^\n/;
let c2837_9 = /\n *$/;
let c2837_10 = "\n".charCodeAt(0);
let c2837_11 = /^[ \t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+$/;
const r52 = {
...Module3888.defaultRules.list,
requiredFirstCharacters: "\n *-0123456789".split(""),
match: (a0, a1) => {
if (a1.allowList) {
if (a1._listLevel >= 11) {
return null;
}
if (a0.charCodeAt(0) === c2837_10) {
const r31 = a1.prevCapture == null ? "" : a1.prevCapture[0];
return r31 !== "" ? c2837_9.test(r31) ? null : c2837_7.exec(a0) : null;
}
const r19 = c2837_3.exec(a1.prevCapture == null ? "" : a1.prevCapture[0]);
return r19 == null ? null : c2837_11.test(r19[0]) ? null : c2837_6.exec(a0);
}
return null;
},
parse: (a0, c14379_0, c14379_1) => {
const r13 = a0[2];
const ordered = r13.length > 1;
const start = ordered ? Math.min(1000000000, Math.max(1, +r13)) : void 0;
const r40 = a0[0].replace(c2837_8, "").replace(c2837_2, "\n");
const r43 = c2837_4.exec(r40);
const r44 = r43 != null ? r43[0].length : 0;
const r19 = r43 != null ? r43[1].length : 0;
const regExp = new RegExp("(%INDENT_CAPTURE_PATTERN%)((?:[*-]|\\d+\\.)) +[^\\n]*(?:\\n(?!%INDENT_CAPTURE_PATTERN%(?:[*-]|\\d+\\.) )[^\\n]*)*(\n|$)".replaceAll("%INDENT_CAPTURE_PATTERN%", ` {${r19},${r19 + 1}}`), "gm");
let c14379_2 = new RegExp("^ {1," + r44 + "}", "gm");
const r69 = r40.match(regExp);
let c14379_3 = r69;
Module38(r69 != null, "markup list items can not be parsed.");
let c14379_4 = false;
return {
ordered,
start,
items: r69.map((item, index) => {
let r33;
const r15 = item.replace(c2837_4, "").replace(c14379_2, "");
const r2 = c14379_3.length - 1;
const r4 = r15.indexOf("\n\n") !== -1 || index === r2 && c14379_4;
c14379_4 = r4;
const { inline, _list, _listLevel } = c14379_1;
c14379_1._list = true;
let r12 = _listLevel;
if (r12 == null) {
r12 = 0;
}
c14379_1._listLevel = r12 + 1;
if (r4) {
c14379_1.inline = false;
r33 = r15.replace(c2837_5, "\n\n");
} else {
c14379_1.inline = true;
r33 = r15.replace(c2837_5, "");
}
const r45 = c14379_0(r33, {
...c14379_1,
allowHeading: false
}).map((item) => {
if (item.type === "text" && item.content != null) {
item.content = item.content.replace(/\n+\s*$/, "");
}
return item;
});
c14379_1.inline = inline;
c14379_1._list = _list;
c14379_1._listLevel = _listLevel;
return r45;
})
};
}
};
export default r52;
+6
View File
@@ -0,0 +1,6 @@
// Metro module 9509 (f9510).
import * as _MaskedLinkUtils from "../../utils/MaskedLinkUtils";
import { astToString } from "../../_bundle/Module7768";
export function isLinkTrusted(a0) {
return a0.target != null && _MaskedLinkUtils.isLinkTrusted(a0.target, a0.title != null && a0.title !== "" ? a0.title : astToString(a0.content));
}
+682
View File
@@ -0,0 +1,682 @@
// Metro module 4180 (f4181).
import { Fragment } from "react";
import { PixelRatio, Pressable, Text, View } from "react-native";
import AccessibilityStore from "../a11y/AccessibilityStore";
import ChannelStore from "../../stores/ChannelStore";
import GuildMemberStore from "../../stores/GuildMemberStore";
import GuildRoleStore from "../../stores/GuildRoleStore";
import GuildStore from "../../stores/GuildStore";
import { GuildFeatures, EMOJI_CHAT_SIZE } from "../../Constants";
import { StaticChannelId, StaticChannelRoute } from "../channel/ChannelConstants";
import { Fonts } from "../../_bundle/Module505";
import { ANSI_CONTROL_SEQUENCE_RE } from "../../utils/HighlightJsAnsiLanguage";
import * as _Text from "../../design/components/Text/native/Text";
import { createStyles } from "../../design/components/Styles/native/createStyles";
import Module712 from "../../_bundle/Module712";
import { transitionToMessage, transitionToChannel, transitionToStaticChannelRoute } from "../routing/transitionToChannel";
import { canViewChannel } from "../links/LinkUtils";
import { getRootNavigationRef } from "../main_tabs_v2/RootNavigationRef.native";
import ModalActionCreators from "../../actions/ModalActionCreators";
import showUserProfileActionSheet from "../user_profile/native/showUserProfileActionSheet";
import AlertActionCreators from "../../actions/AlertActionCreators";
import { intl, t } from "../../intl/index.native";
import { copy } from "../../utils/ClipboardUtils.native";
import { presentCopiedToClipboard } from "../toast/native/ToastUtils";
import GuildIcon, { GuildIconSizes } from "../guild/native/GuildIcon";
import { RoleDot, ThemedIcon, Icon } from "../../design/void/native";
import URLUtils from "../../utils/URLUtils";
import { handleClick } from "../../utils/MaskedLinkUtils";
import Linking from "../../lib/native/Linking";
import { isLinkTrusted } from "./MarkupReactLinkUtils";
import showLongPressURLActionSheet from "../links/native/showLongPressURLActionSheet";
import { smartOutput, isStaticRouteIconType } from "./MarkupRulesUtils";
import { useStateFromStores } from "../../_bundle/Module589";
import { hexWithOpacity } from "../../utils/ColorUtils";
import { useProcessColorStringsArray, useIsRoleStyleAndRoleColorsEligibleForERC } from "../premium/enhanced_role_colors/native/EnhancedRoleColorUtils";
import ActionSheetActionCreators from "../action_sheet/native/ActionSheetActionCreators";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import { AnimateEmoji } from "../user_settings/UserSettings";
import FastImage from "../../components_native/common/FastImage";
import Module10009 from "../../_bundle/Module10009";
import Module12980 from "../../_bundle/Module12980";
import MarkupReactCommandRule from "./native/MarkupReactCommandRule";
import { AST_KEY } from "./MarkupTypes";
import Spoiler from "./native/Spoiler";
import { SignPostIcon } from "../../design/components/Icon/native/redesign/generated/SignPostIcon";
import { ChannelListMagnifyingGlassIcon } from "../../design/components/Icon/native/redesign/generated/ChannelListMagnifyingGlassIcon";
import { LinkIcon } from "../../design/components/Icon/native/redesign/generated/LinkIcon";
import MarkupRules from "./MarkupRules";
import { isAndroid } from "../../utils/PlatformUtils";
import { getChannelMentionIcon } from "../../utils/native/ChannelUtils";
import MarkupReactGameMentionRule from "./native/MarkupReactGameMentionRule";
import Timestamp_native from "./Timestamp.native";
import { HermesBuiltin } from "../../_hermes/prelude";
let c2406_18, c2406_19, useStyles, c2406_22, MarkupLink, MarkupMention, MarkupBlockQuote, MarkupInlineCode, MarkupCodeBlock, MarkupCustomEmoji, MarkupChannelMention, MarkupAttachmentLink, MarkupCommandMention;
const MarkupText = function MarkupText(props) {
const { children, color = "text-default", variant = "text-sm/medium", ...rest } = props;
return <_Text.Text variant={variant} color={color} {...rest}>{children}</_Text.Text>;
};
MarkupLink = function MarkupLink(props) {
const { state: state3, node, output, styles: styles4 } = props;
const styles5 = useStyles();
let linkVariant = state3.linkVariant;
if (linkVariant == null) {
linkVariant = "text-sm/medium";
}
return <_Text.Text key={state3.key} variant={linkVariant} accessibilityRole="link" style={styles4.link || styles5.link} onPress={(event) => {
const target = node.target;
let href = null;
if (typeof target === "string") {
const r13 = URLUtils.safeParseWithQuery(target);
href = r13 == null ? null : r13.protocol == null ? null : r13.hostname == null ? null : URLUtils.format(r13);
}
let c24947_0 = href;
if (href != null) {
event.stopPropagation();
handleClick({
href,
onConfirm: () => Linking.openURL(c24947_0),
trusted: () => isLinkTrusted(node)
});
}
}} onLongPress={(event) => {
const target = node.target;
let urlString = null;
if (typeof target === "string") {
const r13 = URLUtils.safeParseWithQuery(target);
urlString = r13 == null ? null : r13.protocol == null ? null : r13.hostname == null ? null : URLUtils.format(r13);
}
if (urlString != null) {
event.stopPropagation();
showLongPressURLActionSheet({
urlString
});
}
}}>
{smartOutput(node, output, {
...state3,
inLink: true
})}
</_Text.Text>;
};
MarkupMention = function MarkupMention(props) {
const { roleStyle: roleStyle2, state: state3, node: node2, output, styles: styles4 } = props;
const styles5 = useStyles();
const { userId, roleId, guildId } = node2;
const stateFromStores = useStateFromStores([GuildMemberStore, GuildRoleStore], () => guildId != null && roleId != null ? GuildRoleStore.getRole(guildId, roleId) : guildId != null ? userId != null ? GuildMemberStore.getMember(guildId, userId) : null : null, [guildId, roleId, userId]);
let color = stateFromStores?.colorString;
if (color == null) {
color = null;
}
let colors = stateFromStores?.colorStrings;
if (colors == null) {
colors = null;
}
let style = styles4.mention || styles5.mention;
if (color != null && roleStyle2 === "username") {
let backgroundColor = styles4.mention?.backgroundColor;
if (backgroundColor == null) {
backgroundColor = hexWithOpacity(color, 0.1);
}
style = {
color,
backgroundColor
};
}
const processColorStringsArray = useProcessColorStringsArray(colors);
const isRoleStyleAndRoleColorsEligibleForERC = useIsRoleStyleAndRoleColorsEligibleForERC(guildId, userId, roleStyle2, processColorStringsArray);
return <MarkupText key={state3.key} accessibilityRole={state3.noStyleAndInteraction ? "text" : "button"} style={style} color={state3?.textColor} gradientColors={isRoleStyleAndRoleColorsEligibleForERC ? processColorStringsArray : void 0} onPress={state3.noStyleAndInteraction ? void 0 : () => {
if (node2.roleId != null && node2.guildId != null) {
ActionSheetActionCreators.openLazy(import("../messages/native/RoleMembersActionSheet"), "RoleMembersActionSheet", {
guildId: node2.guildId,
roleId: node2.roleId,
channelId: node2.channelId
}, "stack");
} else if (node2.roleName === "@everyone" && node2.guildId != null) {
ActionSheetActionCreators.openLazy(import("../messages/native/RoleMembersActionSheet"), "RoleMembersActionSheet", {
guildId: node2.guildId,
roleId: SnowflakeUtils.castGuildIdAsEveryoneGuildRoleId(node2.guildId),
channelId: node2.channelId
}, "stack");
} else {
const userId2 = node2.userId;
let channelId = node2.channelId;
if (userId2 != null) {
if (channelId == null) {
channelId = void 0;
}
showUserProfileActionSheet({
userId: userId2,
channelId
});
} else {
AlertActionCreators.show({
title: intl.string(t.r0DLNm),
body: intl.string(t.Fqqbhg),
confirmText: intl.string(t.BddRzS)
});
}
}
}}>
{roleStyle2 === "dot" && <RoleDot guildId={guildId == null ? void 0 : guildId} color={color} colors={colors} size="small" />}
{smartOutput(node2, output, state3)}
</MarkupText>;
};
MarkupBlockQuote = function MarkupBlockQuote(props) {
const { styles: styles4, state: state3, node: node6, output } = props;
const styles5 = useStyles();
return <MarkupText key={state3.key} style={styles4.blockQuote || styles5.blockQuote} color={state3?.textColor}>
{smartOutput(node6, output, state3)}
</MarkupText>;
};
MarkupInlineCode = function MarkupInlineCode(props) {
const { styles: styles4, state: state3, node: node3, output } = props;
const styles5 = useStyles();
const noStyleAndInteraction = state3.noStyleAndInteraction;
const r0 = noStyleAndInteraction ? !noStyleAndInteraction : !state3.inLink;
const accessibilityRole = r0 ? "button" : "text";
const style = {
...styles4.inlineCode || styles5.inlineCode
};
if (state3.inLink) {
delete style["color"];
}
return <MarkupText key={state3.key} accessibilityRole={accessibilityRole} style={style} color={state3?.textColor} onPress={r0 ? () => {
const content = node3.content;
if (typeof content === "string") {
copy(content);
presentCopiedToClipboard();
}
} : void 0}>
{smartOutput(node3, output, state3)}
</MarkupText>;
};
MarkupCodeBlock = function MarkupCodeBlock(props) {
const { styles: styles4, state: state3, node: node6, output } = props;
const styles5 = useStyles();
return <MarkupText key={state3.key} style={styles4.codeBlock || styles5.codeBlock} color={state3?.textColor}>
{smartOutput(node6, output, state3)}
{"\n"}
</MarkupText>;
};
MarkupCustomEmoji = function MarkupCustomEmoji(props) {
const { styles: styles4, state: state3, node: node6 } = props;
const setting = AnimateEmoji.useSetting();
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
return node6.src ? <FastImage key={state3.key} style={[styles4.emoji || c2406_19.emoji, state3.customEmojiOffsetY != null ? {
transform: [{
translateY: state3.customEmojiOffsetY
}]
} : null]} source={{
uri: node6.src
}} enableAnimation={stateFromStores ? !stateFromStores : setting} /> : <MarkupText key={state3.key} color={state3?.textColor}>{node6.alt}</MarkupText>;
};
MarkupChannelMention = function MarkupChannelMention(props) {
const { state, node: node4, output, styles: styles5, variants: variants2 } = props;
const styles4 = useStyles();
const accessibilityRole = state.noStyleAndInteraction ? "text" : "button";
let channelMentionText = variants2.channelMentionText;
if (channelMentionText == null) {
channelMentionText = "text-xs/medium";
}
const r34 = [node4.inContent != null ? output(node4.inContent, state) : null, , ,];
const r36 = node4.inContent != null;
let r37 = null;
if (r36) {
const fontScale = PixelRatio.getFontScale();
r37 = <ThemedIcon themedColor={Module712.colors.MENTION_FOREGROUND} style={fontScale < 1.25 ? {
width: 8,
height: 8
} : fontScale < 2 ? {
width: 12,
height: 12
} : {
width: 16,
height: 16
}} source={Module10009} size={Icon.Sizes.CUSTOM} />;
}
r34[1] = r37;
r34[2] = smartOutput(node4, output, state);
const r59 = <_Text.Text key={state.key} variant={channelMentionText} style={styles4.channelMentionText}>{r34}</_Text.Text>;
return state.disablePressableChannelMention ? r59 : <Pressable key={state.key} accessibilityRole={accessibilityRole} style={[styles5.channel || styles4.channelMention, state.mentionPillOffsetY != null ? {
transform: [{
translateY: state.mentionPillOffsetY
}]
} : null]} pointerEvents={state.noStyleAndInteraction ? "none" : "auto"} onPress={() => {
const noStyleAndInteraction = state.noStyleAndInteraction;
let r0 = null;
if (!noStyleAndInteraction) {
const { channelId, messageId } = node4;
const { shouldNavigateBack, shouldCloseModal } = state;
const r3 = channelId != null;
r0 = void 0;
if (r3) {
if (messageId != null) {
transitionToMessage(channelId, messageId);
r0 = void 0;
} else {
const channel = ChannelStore.getChannel(channelId);
if ((channel == null ? void 0 : channel.isGuildVocal()) && canViewChannel(channel)) {
if (shouldNavigateBack) {
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null) {
rootNavigationRef.goBack();
}
}
if (shouldCloseModal) {
ModalActionCreators.pop();
}
}
transitionToChannel(channelId);
r0 = void 0;
}
}
}
return r0;
}}>{r59}</Pressable>;
};
MarkupAttachmentLink = function MarkupAttachmentLink(props) {
const { state: state2, node: node5, output, styles: styles5, variants: variants2 } = props;
const styles4 = useStyles();
const accessibilityRole = state2.noStyleAndInteraction ? "text" : "button";
let channelMentionText = variants2.channelMentionText;
if (channelMentionText == null) {
channelMentionText = "text-xs/medium";
}
const fontScale = PixelRatio.getFontScale();
const r61 = <_Text.Text key={state2.key} variant={channelMentionText} style={styles4.channelMentionText}>
<ThemedIcon themedColor={Module712.colors.MENTION_FOREGROUND} source={Module12980} size={fontScale < 1 ? Icon.Sizes.EXTRA_SMALL_10 : fontScale < 1.25 ? Icon.Sizes.EXTRA_SMALL : Icon.Sizes.SMALL} />
{smartOutput(node5, output, state2)}
</_Text.Text>;
return state2.disablePressableChannelMention ? r61 : <Pressable key={state2.key} accessibilityRole={accessibilityRole} style={[styles5.channel || styles4.channelMention, state2.mentionPillOffsetY != null ? {
transform: [{
translateY: state2.mentionPillOffsetY
}]
} : null]} pointerEvents={state2.noStyleAndInteraction ? "none" : "auto"} onPress={(event) => {
if (!state2.noStyleAndInteraction) {
event.stopPropagation();
Linking.openURL(node5.attachmentLink);
}
}}>{r61}</Pressable>;
};
MarkupCommandMention = function MarkupCommandMention(props) {
const { state: state3, node: node6, output, styles: styles4 } = props;
const styles5 = useStyles();
return <MarkupReactCommandRule key={state3.key} node={node6} output={output} state={state3} style={styles4.mention || styles5.mention} />;
};
c2406_18 = new RegExp(ANSI_CONTROL_SEQUENCE_RE, "g");
c2406_19 = {
emoji: {
width: EMOJI_CHAT_SIZE,
height: EMOJI_CHAT_SIZE,
resizeMode: "contain"
},
guildIcon: {
paddingEnd: 2,
paddingBottom: 1
},
list: {
paddingTop: 16
},
listItem: {
paddingTop: 4
},
bullet: {
fontFamily: Fonts.CODE_BOLD
},
strong: {
fontFamily: Fonts.PRIMARY_BOLD
}
};
useStyles = createStyles({
link: {
fontFamily: Fonts.PRIMARY_BOLD,
color: Module712.colors.TEXT_LINK
},
channelMention: {
backgroundColor: Module712.colors.MENTION_BACKGROUND,
borderRadius: 3,
paddingHorizontal: 2,
alignItems: "center"
},
channelMentionText: {
color: Module712.colors.MENTION_FOREGROUND
},
mention: {
color: Module712.unsafe_rawColors.BRAND_500,
backgroundColor: Module712.colors.BORDER_SUBTLE
},
inlineCode: {
fontFamily: Fonts.CODE_BOLD,
color: Module712.colors.TEXT_DEFAULT,
backgroundColor: Module712.colors.BACKGROUND_CODE
},
codeBlock: {
fontFamily: Fonts.CODE_BOLD,
color: Module712.colors.TEXT_DEFAULT,
backgroundColor: Module712.colors.BACKGROUND_CODE
},
blockQuote: {
borderLeftWidth: 4,
borderLeftColor: Module712.colors.SPINE_DEFAULT,
paddingLeft: 8
}
});
c2406_22 = " ";
export default function createRules(r4 = {}) {
const styles = r4;
let r2 = arguments[1];
if (r2 === void 0) {
r2 = {};
}
const variants = r2;
const r1 = styles !== void 0;
const r12 = r1 ? styles : {};
let roleStyle;
const styles2 = r12;
roleStyle = void 0;
if (!r1) {
r4 = {};
}
let r13 = arguments[2];
const styles3 = r4;
if (r13 === void 0) {
r13 = "username";
}
const react2 = (a0, a1, a2) => a2.noStyleAndInteraction ? <MarkupText key={a2.key} color={a2?.textColor}>
{smartOutput(a0, a1, a2)}
</MarkupText> : <MarkupLink key={a2.key} state={a2} node={a0} output={a1} styles={styles2} />;
roleStyle = r13;
const r14 = {};
r14[AST_KEY.TEXT] = {
react: (a0, a1, a2) => typeof a0.content === "string" ? a0.content : <MarkupText key={a2.key} color={a2?.textColor}>
{smartOutput(a0, a1, a2)}
</MarkupText>
};
r14[AST_KEY.STRIKETHROUGH] = {
react: (a0, a1, a2) => <MarkupText key={a2.key} style={{
textDecorationLine: "line-through"
}} color={a2?.textColor} variant={a2.textVariant}>
{smartOutput(a0, a1, a2)}
</MarkupText>
};
r14[AST_KEY.UNDERLINE] = {
react: (a0, a1, a2) => <MarkupText key={a2.key} style={{
textDecorationLine: "underline"
}} color={a2?.textColor} variant={a2.textVariant}>
{smartOutput(a0, a1, a2)}
</MarkupText>
};
r14[AST_KEY.ITALICS] = {
react: (a0, a1, a2) => {
let fontStyle = styles.em?.fontStyle;
if (fontStyle == null) {
fontStyle = "italic";
}
return <MarkupText key={a2.key} style={{
fontStyle
}} color={a2?.textColor} variant={a2.textVariant}>
{smartOutput(a0, a1, a2)}
</MarkupText>;
}
};
r14[AST_KEY.STRONG] = {
react: (a0, a1, a2) => <MarkupText key={a2.key} style={styles.strong || c2406_19.strong} color={a2?.textColor} variant={a2.textVariant}>
{smartOutput(a0, a1, a2)}
</MarkupText>
};
r14[AST_KEY.LINK] = {
react: react2
};
r14[AST_KEY.URL] = {
react: react2
};
r14[AST_KEY.AUTOLINK] = {
react: react2
};
r14[AST_KEY.LINE_BREAK] = {
react: (a0, a1, a2) => <MarkupText key={a2.key} color={a2?.textColor}>{"\n"}</MarkupText>
};
r14[AST_KEY.HIGHLIGHT] = {
react: (a0, a1, a2) => <MarkupText key={a2.key} color={a2?.textColor}>
{smartOutput(a0, a1, a2)}
</MarkupText>
};
r14[AST_KEY.BLOCK_QUOTE] = {
react: (a0, a1, a2) => <MarkupBlockQuote key={a2.key} styles={styles} state={a2} node={a0} output={a1} />
};
r14[AST_KEY.PARAGRAPH] = {
order: 600,
react: (a0, a1, a2) => <MarkupText key={a2.key} color={a2?.textColor}>
{smartOutput(a0, a1, a2)}
</MarkupText>
};
r14[AST_KEY.EMOJI] = {
react: (a0, a1, a2) => <Text key={a2.key}>
{a0.surrogate || a0.content}
</Text>
};
r14[AST_KEY.CUSTOM_EMOJI] = {
react: (a0, a1, a2) => <MarkupCustomEmoji key={a2.key} state={a2} node={a0} styles={styles} />
};
r14[AST_KEY.SPOILER] = {
react: (a0, a1, a2) => <Spoiler key={a2.key} spoilerStyle={styles.spoiler} spoilerRevealedStyle={styles.spoilerRevealed}>
{smartOutput(a0, a1, a2)}
</Spoiler>
};
r14[AST_KEY.STATIC_ROUTE_LINK] = {
react: (a0, a1, a2) => {
let SignPostIcon2;
if (isStaticRouteIconType(a0.channelId)) {
L10: {
SignPostIcon2 = SignPostIcon;
const channelId = a0.channelId;
if (StaticChannelId.GUILD_HOME !== channelId && StaticChannelId.SERVER_GUIDE !== channelId) {
if (StaticChannelId.CHANNEL_BROWSER !== channelId && StaticChannelId.CUSTOMIZE_COMMUNITY !== channelId) {
if (StaticChannelId.LINKED_ROLES !== channelId) {
break L10;
}
SignPostIcon2 = LinkIcon;
break L10;
}
SignPostIcon2 = ChannelListMagnifyingGlassIcon;
} else {
SignPostIcon2 = SignPostIcon;
}
}
return <MarkupText key={a2.key} accessibilityRole="button" style={styles.staticRouteLink} color={a2?.textColor} onPress={function onPress() {
const { guildId: guildId2, channelId } = a0;
const guild = GuildStore.getGuild(guildId2);
if (guildId2 != null && guild != null && guild.features.has(GuildFeatures.COMMUNITY) && !(channelId !== StaticChannelId.GUILD_HOME && channelId !== StaticChannelId.SERVER_GUIDE)) {
transitionToStaticChannelRoute(guildId2, StaticChannelRoute.GUILD_HOME);
}
}}>
<SignPostIcon2 style={styles.staticRouteLinkIcon} size="sm" />
{smartOutput(a0, a1, a2)}
</MarkupText>;
}
return null;
}
};
r14[AST_KEY.INLINE_CODE] = {
react: (a0, a1, a2) => <MarkupInlineCode key={a2.key} styles={styles} state={a2} node={a0} output={a1} />
};
r14[AST_KEY.CODE_BLOCK] = {
parse: (a0, a1, a2) => {
const r17 = MarkupRules.RULES[AST_KEY.CODE_BLOCK].parse(a0, a1, a2);
if (r17.lang.toLowerCase() === "ansi") {
r17.content = r17.content.replaceAll(c2406_18, "");
}
return r17;
},
react: (a0, a1, a2) => <MarkupCodeBlock key={a2.key} styles={styles} state={a2} node={a0} output={a1} />
};
r14[AST_KEY.MENTION] = {
react: (a0, a1, a2) => <MarkupMention key={a2.key} roleStyle={roleStyle} state={a2} node={a0} output={a1} styles={styles3} />
};
r14[AST_KEY.CHANNEL_MENTION] = {
react: (a0, a1, a2) => <MarkupChannelMention key={a2.key} styles={styles} state={a2} node={a0} output={a1} variants={variants} />
};
r14[AST_KEY.ATTACHMENT_LINK] = {
react: (a0, a1, a2) => <MarkupAttachmentLink key={a2.key} styles={styles} state={a2} node={a0} output={a1} variants={variants} />
};
r14[AST_KEY.SOUNDBOARD] = {
react: (a0, a1, a2) => <_Text.Text key={a2.key} variant="text-md/bold">
{"<sound:"}
{smartOutput(a0, a1, a2)}
{">"}
</_Text.Text>
};
r14[AST_KEY.GUILD] = {
react: (a0, a1, a2) => {
const top = isAndroid() ? 2 : PixelRatio.getFontScale() < 1.5 ? 1 : 0;
const r5 = a0.icon != null;
let r15 = null;
if (r5) {
const fontScale = PixelRatio.getFontScale();
r15 = <GuildIcon style={{
top
}} icon={a0.icon} size={fontScale < 1 ? GuildIconSizes.XXXSMALL : fontScale < 1.25 ? GuildIconSizes.XXSMALL_12 : GuildIconSizes.XXSMALL} />;
}
return <MarkupText key={a2.key} color={a2?.textColor}>
<View style={c2406_19.guildIcon}>{r15}</View>
<MarkupText color={a2?.textColor}>
{smartOutput(a0, a1, a2)}
</MarkupText>
</MarkupText>;
}
};
r14[AST_KEY.CHANNEL] = {
react: (a0, a1, a2) => {
let iconType = a0.iconType;
if (iconType == null) {
iconType = "text";
}
const paddingEnd = iconType === "text" ? 0 : 2;
const props = {
themedColor: Module712.colors.MENTION_FOREGROUND,
source: getChannelMentionIcon(iconType),
size: null,
style: null
};
const fontScale = PixelRatio.getFontScale();
props.size = fontScale < 1 ? Icon.Sizes.EXTRA_SMALL_10 : fontScale < 1.25 ? Icon.Sizes.EXTRA_SMALL : Icon.Sizes.SMALL;
props.style = {
top: 1
};
return <MarkupText key={a2.key} color={a2?.textColor}>
<View style={{
paddingEnd
}}>
<ThemedIcon {...props} />
</View>
{smartOutput(a0, a1, a2)}
</MarkupText>;
}
};
r14[AST_KEY.COMMAND_MENTION] = {
react: (a0, a1, a2) => <MarkupCommandMention key={a2.key} styles={styles} state={a2} node={a0} output={a1} />
};
r14[AST_KEY.GAME_MENTION] = {
react: (a0, a1, a2) => <MarkupReactGameMentionRule key={a2.key} node={a0} state={a2} />
};
r14[AST_KEY.TIMESTAMP] = {
react: (a0, a1, a2) => <Timestamp_native key={a2.key} node={a0} style={styles.timestamp} />
};
r14[AST_KEY.LIST] = {
react: (a0, c24949_1, a2) => {
const level = a2.level != null ? a2.level : 0;
const start = a0.start != null ? a0.start : a2.start;
if (a2.formatInline) {
return <MarkupText key={`list-${a2.key}`} color={a2?.textColor}>
{a0.items.map((item, index) => {
const r6 = a0.ordered === true ? start != null ? `${start + index}. ` : "• " : "• ";
const r31 = {};
HermesBuiltin.copyDataProperties(r31, a2);
r31.key = `${a2.key}-${index}`;
return <Fragment key={`list-${a2.key}-item-${index}`}>
{r6}
{c24949_1(item, r31)}
{index !== a0.items.length - 1 ? c2406_22 : " "}
</Fragment>;
})}
</MarkupText>;
}
return <_Text.Text key={`list-${a2.key}`} style={c2406_19.list} variant="text-sm/medium">
{a0.items.map((item, index) => {
let c29276_0 = item;
let r10 = "⚬ ";
if (level === 0) {
r10 = typeof a0.ordered === "boolean" && (a0.ordered && start != null) ? `${start + index}. ` : isAndroid() ? "• " : "● ";
}
const r18 = {};
HermesBuiltin.copyDataProperties(r18, a2);
const key = a2.key;
const concat = HermesInternal.concat;
let r13 = "";
r18.key = concat.call("", key, "-", index);
r18.level = level + 1;
r18.start = start != null ? start + 1 : start;
let c29276_1 = r18;
const r76 = [<MarkupText key={`list-${a2.key}-item-${index}-bullet`} style={c2406_19.bullet} color={a2?.textColor}>
{level > 0 ? c2406_22.repeat(level) : ""}
{r10}
</MarkupText>, Array.isArray(item) ? item.map((item, index) => {
const r1 = item.type === "list";
const r8 = index + 1;
const length = c29276_0.length;
const r9 = r1 && "\n";
let r16 = r8 === length;
const r17 = [r9, c24949_1(item, c29276_1), ,];
if (r16) {
r16 = !r1;
}
if (r16) {
r16 = "\n";
}
r17[2] = r16;
return <Fragment key={index}>{r17}</Fragment>;
}) : c24949_1(item, r18), ,];
if (a0.items.length !== index + 1) {
r13 = c2406_22;
}
r76[2] = r13;
return <_Text.Text key={`list-${a2.key}-item-${index}`} style={c2406_19.listItem} variant="text-sm/medium">{r76}</_Text.Text>;
})}
</_Text.Text>;
}
};
r14[AST_KEY.HEADING] = {
react: (a0, a1, a2) => {
if (a2.formatInline) {
return <MarkupText key={a2.key} variant="text-sm/semibold" color={a2?.textColor}>
{smartOutput(a0, a1, a2)}
{" "}
</MarkupText>;
}
return <_Text.Text key={a2.key} variant={a0.level !== 1 ? a0.level === 2 ? "heading-lg/bold" : "heading-md/bold" : "heading-xl/bold"} color={a2.forceWhite ? "text-overlay-light" : "text-strong"}>
{smartOutput(a0, a1, a2)}
{"\n"}
</_Text.Text>;
}
};
r14[AST_KEY.SUBTEXT] = {
react: (a0, a1, a2) => <_Text.Text key={a2.key} variant="text-sm/normal" color="text-muted">
{smartOutput(a0, a1, a2)}
{"\n"}
</_Text.Text>
};
r14[AST_KEY.SILENT_PREFIX] = {
react: (a0, a1, a2) => typeof a0.content === "string" ? a0.content : <MarkupText key={a2.key} color={a2?.textColor}>
{smartOutput(a0, a1, a2)}
</MarkupText>
};
return r14;
};
export { MarkupText };
export function plainMentionRenderer(a0, a1, a2) {
return typeof a0.content === "string" ? a0.content : smartOutput(a0, a1, a2);
}
export function plainSpoilerRenderer(a0) {
return typeof a0.content === "string" ? a0.content.replace(/[^\n]/g, "█") : "███";
}
+656
View File
@@ -0,0 +1,656 @@
// Metro module 4622 (f4623).
import _toArray from "../../_bundle/_toArray";
import ChannelStore from "../../stores/ChannelStore";
import DetectableGameStore from "../../stores/DetectableGameStore";
import GuildRoleStore from "../../stores/GuildRoleStore";
import GuildStore from "../../stores/GuildStore";
import UserStore from "../../stores/UserStore";
import { ID_REGEX, MARKDOWN_SPOILER_REGEXP, MARKDOWN_STATIC_ROUTE_NAME_REGEXP } from "../../Constants";
import { SUB_COMMAND_KEY_SEPARATOR } from "../application_commands/ApplicationCommandConstants";
import { GAME_MENTION_RAW_RE } from "../channel_autocomplete/ChannelAutocompleteConstants";
import MarkupLinkRule, { punycodeLink } from "./MarkupLinkRule";
import { intl, t } from "../../intl/index.native";
import { getHasEnhancedRoleColorsForRole } from "../premium/powerups/hooks/useHasEnhancedRoleColors";
import { getIsDefaultErc } from "../premium/enhanced_role_colors/EnhancedRoleColorUtils";
import NicknameUtils from "../../utils/NicknameUtils";
import UserUtils from "../../utils/UserUtils";
import getGameMediaRefURL from "../games/getGameMediaRefURL";
import AvatarUtils from "../../utils/AvatarUtils";
import Module3888 from "../../_bundle/Module3888";
import MarkupTextRule from "./MarkupTextRule";
import MarkupChannelMentionRule from "./MarkupChannelMentionRule";
import MarkupAttachmentLinkRule from "./MarkupAttachmentLinkRule";
import UnicodeEmojis from "../emojis/UnicodeEmojis";
import getSoundmojiASTFromString, { soundmojiRawFormatRegex } from "../premium/sounds/soundmoji/utils/getSoundmojiASTFromString";
import { TIMESTAMP_REGEX, parseTimestamp } from "./TimestampUtils";
import { staticRouteToTranslation, staticRouteToItemString } from "./StaticRouteRendering";
import MarkupHeadingRule from "./MarkupHeadingRule";
import MarkupListRule from "./MarkupListRule";
import MarkupSubtextRule from "./MarkupSubtextRule";
import combineMarkupRules from "./combineMarkupRules";
import PlatformMarkupRules_native from "./PlatformMarkupRules.native";
import Module12 from "../../_bundle/Module12";
let c2818_15, c2818_16, c2818_17, c2818_18, c2818_19, hydrateRoleMention, hydrateUserMention, hydrateGameMention, c2818_23, $mk74846 = function() {
return (a0) => `${SUB_COMMAND_KEY_SEPARATOR}${a0}`;
};
const parseLink = function parseLink(a0) {
const r10 = punycodeLink(a0[1]);
return r10 == null ? {
type: "text",
content: a0[1]
} : {
type: "link",
content: [{
type: "text",
content: r10.displayTarget
}],
target: r10.target,
title: void 0
};
};
hydrateRoleMention = function hydrateRoleMention(id, a1) {
let r9;
if (a1.guildId != null) {
r9 = GuildStore.getGuild(a1.guildId);
} else {
const r1 = a1.channelId != null;
r9 = null;
if (r1) {
const channel = ChannelStore.getChannel(a1.channelId);
r9 = GuildStore.getGuild(channel == null ? void 0 : channel.getGuildId());
}
}
const r24 = r9 != null ? GuildRoleStore.getRole(r9.id, id) : null;
if (r24 == null) {
return {
type: "text",
content: `@${intl.string(t["YV4F/n"])}`
};
}
const r33 = getHasEnhancedRoleColorsForRole(r9?.id, r24) && !getIsDefaultErc(r24);
const guildId = r9 != null ? r9.id : null;
return {
type: "mention",
channelId: a1.channelId,
guildId,
roleId: id,
roleColor: r24.color,
roleColors: r33 ? {
primaryColor: r24.colors?.primary_color,
secondaryColor: r24.colors?.secondary_color,
tertiaryColor: r24.colors?.tertiary_color
} : null,
roleName: `@${r24.name}`,
color: r24.color,
colorString: r24.colorString,
content: [{
type: "text",
content: `@${r24.name}`
}]
};
};
hydrateUserMention = function hydrateUserMention({ fullMatch, id, everyoneOrHere }, a1) {
const user = UserStore.getUser(id);
const channel = ChannelStore.getChannel(a1.channelId);
const r2 = user != null;
let userId = void 0;
let r23 = void 0;
if (r2) {
const id2 = user.id;
let r26 = user.toString();
if (channel != null) {
let r29 = NicknameUtils.getNickname(channel.getGuildId(), a1.channelId, user);
if (r29 == null) {
r29 = UserUtils.getName(user);
}
r26 = r29;
}
r23 = r26;
userId = id2;
}
const r33 = id != null && ID_REGEX.test(id.trim());
let content = r33 ? a1.unknownUserMentionPlaceholder ? `@${intl.string(t.sKdZ6U)}` : fullMatch : fullMatch;
const guildId = channel == null ? void 0 : channel.getGuildId();
const parsedUserId = r33 ? id : null;
if (r23 != null) {
content = `@${r23}`;
}
return {
type: "mention",
userId,
channelId: a1.channelId,
viewingChannelId: a1.viewingChannelId,
guildId,
parsedUserId,
roleName: everyoneOrHere,
content: [{
type: "text",
content
}]
};
};
hydrateGameMention = function hydrateGameMention(a0, a1) {
const mentionGames = a1.mentionGames;
const r8 = mentionGames == null ? void 0 : mentionGames.get(a0);
const detectableGame = DetectableGameStore.getDetectableGame(a0);
if (a1.returnMentionIds !== true && r8 == null && detectableGame == null) {
return {
type: "text",
content: `@${intl.string(t["11pdXZ"])}`
};
}
let displayName = r8?.name;
if (displayName == null) {
displayName = detectableGame?.name;
}
if (displayName == null) {
displayName = intl.string(t["11pdXZ"]);
}
let icon = getGameMediaRefURL(a0, r8?.icon, {
size: 32
});
if (icon == null) {
icon = detectableGame?.icon != null ? AvatarUtils.getApplicationIconURL({
id: detectableGame.id,
icon: detectableGame.icon,
size: 32
}) : void 0;
}
return {
type: "gameMention",
gameId: a0,
channelId: a1.channelId,
gameName: r8?.name,
gameIcon: r8?.icon,
icon,
displayName
};
};
c2818_15 = /^( *>>> +([\s\S]*))|^( *>(?!>>) +[^\n]*(\n *>(?!>>) +[^\n]*)*\n?)/;
c2818_16 = /^$|\n *$/;
c2818_17 = /^ *>>> ?/;
c2818_18 = /^ *> ?/gm;
c2818_19 = /^((?:https?|steam):\/\/[^\s<]+[^<.,:;"'\]\s])/;
c2818_23 = combineMarkupRules([{
newline: Module3888.defaultRules.newline,
paragraph: Module3888.defaultRules.paragraph,
escape: {
...Module3888.defaultRules.escape,
match: (a0, a1, a2) => a1.allowEscape !== false ? Module3888.defaultRules.escape.match(a0, a1, a2) : null
},
blockQuote: {
...Module3888.defaultRules.blockQuote,
requiredFirstCharacters: [" ", ">"],
match: (a0, { prevCapture, inQuote, nested }) => {
if (!inQuote && !nested) {
if (prevCapture == null) {
return c2818_15.exec(a0);
}
return c2818_16.test(prevCapture[0]) ? c2818_15.exec(a0) : null;
}
return null;
},
parse: (a0, a1, a2) => {
const r8 = a0[0];
const r12 = Boolean(c2818_17.exec(r8));
const r16 = r8.replace(r12 ? c2818_17 : c2818_18, "");
const inQuote = a2.inQuote || false;
const inline = a2.inline || false;
a2.inQuote = true;
if (!r12) {
a2.inline = true;
}
const content = a1(r16, a2);
a2.inQuote = inQuote;
a2.inline = inline;
if (content.length === 0) {
content.push({
type: "text",
content: " "
});
}
return {
content,
type: "blockQuote"
};
}
},
link: MarkupLinkRule,
autolink: {
...Module3888.defaultRules.autolink,
parse: parseLink
},
mailto: {
...Module3888.defaultRules.mailto,
match: Module3888.inlineRegex(/^<([^\s<>@]+@[^\s<>@]+\.[^\s<>@]+)>/),
requiredFirstCharacters: ["<"],
parse: (a0) => {
const content = a0[1];
const r3 = a0[1];
return {
type: "link",
content: [{
type: "text",
content
}],
target: r3.startsWith("mailto:") ? r3 : "mailto:" + r3
};
}
},
tel: {
...Module3888.defaultRules.mailto,
requiredFirstCharacters: ["<"],
match: Module3888.inlineRegex(/^<((?:(?:tel|sms):\+?|\+)(?:(?:[0-9]|\([0-9]+\)))(?:[- .\/]?(?:[0-9]|\([0-9]+\)))+)>/),
parse: (a0) => {
const content = a0[1];
const r7 = a0[1].replaceAll(/[ \/]+/g, "-");
return {
type: "link",
content: [{
type: "text",
content
}],
target: r7.startsWith("tel:") || r7.startsWith("sms:") ? r7 : "tel:" + r7
};
}
},
url: {
...Module3888.defaultRules.url,
requiredFirstCharacters: ["h", "s"],
match: (a0, a1) => {
let r24;
if (a1.inline) {
const r17 = c2818_19.exec(a0);
if (r17 != null) {
const r9 = r17[0];
let r0 = r9.length - 1;
let r19 = r9;
if (0 <= r0) {
const r20 = r9[r0];
let r10 = 0;
r19 = r9;
if (r20 === ")") {
do {
const r22 = r9.indexOf("(", r10);
const r1 = r0;
if (r22 === -1) {
r19 = r9.slice(0, r9.length - 1);
break;
}
const r13 = r22 + 1;
const r23 = r1 - 1;
r19 = r9;
if (!(0 <= r23)) {
break;
}
r24 = r9[r23];
r0 = r23;
r10 = r13;
r19 = r9;
} while (r24 === ")");
}
}
r17[1] = r19;
r17[0] = r19;
}
return r17;
}
return null;
},
parse: parseLink
},
strong: Module3888.defaultRules.strong,
em: Module3888.defaultRules.em,
u: Module3888.defaultRules.u,
br: Module3888.defaultRules.br,
text: MarkupTextRule,
inlineCode: {
...Module3888.defaultRules.inlineCode,
parse: (a0, a1, a2) => {
const r17 = Module3888.defaultRules.inlineCode.parse(a0, a1, a2);
return a2.parseInlineCodeChildContent === true ? {
...r17,
validationChildContent: a1(r17.content, a2)
} : r17;
}
},
emoticon: {
order: MarkupTextRule.order,
requiredFirstCharacters: ["¯"],
match: (a0) => /^(¯\\_\(ツ\)_\/¯)/.exec(a0),
parse: (a0) => ({
type: "text",
content: a0[1]
})
},
codeBlock: {
order: Module3888.defaultRules.codeBlock.order,
requiredFirstCharacters: ["`"],
match: (a0) => /^```(?:([a-z0-9_+\-.#]+?)\n)?\n*([^\n][^]*?)\n*```/i.exec(a0),
parse: (a0, a1, a2) => {
let lang = a0[1];
if (lang == null) {
lang = "";
}
let content = a0[2];
if (content == null) {
content = "";
}
return {
lang,
content,
inQuote: a2.inQuote || a2.formatInline || false
};
}
},
roleMention: {
order: MarkupTextRule.order,
requiredFirstCharacters: ["<"],
match: (a0) => /^<@&(\d+)>/.exec(a0),
parse: (a0, a1, a2) => {
const [, id] = a0;
return a2.returnMentionIds ? {
type: "roleMention",
id
} : hydrateRoleMention(id, a2);
}
},
mention: {
order: MarkupTextRule.order,
requiredFirstCharacters: ["<", "@"],
match: (a0) => {
const r4 = /^<@!?(\d+)>|^(@(?:everyone|here))/.exec(a0);
return r4 ?? null;
},
parse: (a0, a1, a2) => a2.returnMentionIds ? a0[1] == null ? {
type: "mention",
text: a0[0]
} : {
type: "mention",
id: a0[1]
} : hydrateUserMention({
fullMatch: a0[0],
id: a0[1],
everyoneOrHere: a0[2]
}, a2)
},
silentPrefix: {
order: MarkupTextRule.order,
requiredFirstCharacters: ["@"],
match: (a0, a1, a2) => a2 != null ? a2 === "" ? /^(@silent(?![^\s]))/.exec(a0) : null : /^(@silent(?![^\s]))/.exec(a0),
parse: function parse(a0) {
return {
type: "silentPrefix",
content: a0[0]
};
}
},
channelMention: MarkupChannelMentionRule.channelMention,
channelOrMessageUrl: MarkupChannelMentionRule.channelOrMessageUrl,
mediaPostLink: MarkupChannelMentionRule.mediaPostLink,
attachmentLink: MarkupAttachmentLinkRule.attachmentLink,
commandMention: {
order: Module3888.defaultRules.text.order,
requiredFirstCharacters: ["<"],
match: (a0) => /^<\/((?:(?:[\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\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF7Line truncated
parse: (a0, a1, a2) => {
let r30;
if (a2.returnMentionIds) {
r30 = {
type: "commandMention",
id: a0[2]
};
} else {
const commandName = a0[1];
const commandId = a0[2];
r30 = {
type: "commandMention",
channelId: a2.channelId,
commandId,
commandName,
commandKey: `${commandId}${[..._toArray(commandName.split(" ")).slice(1)].map($mk74846()).join("")}`,
content: [{
type: "text",
content: `${commandName}`
}]
};
}
return r30;
}
},
timestampMentionInput: {
order: Module3888.defaultRules.text.order,
requiredFirstCharacters: ["<"],
match: (a0, a1) => a1.allowTimeMentionInput ? /^<@time:([^>]*)>/.exec(a0) : null,
parse: (a0) => ({
type: "timestampMentionInput",
content: a0[1]
})
},
gameMention: {
order: Module3888.defaultRules.text.order,
requiredFirstCharacters: ["<"],
match: (a0, a1) => a1.allowGameMentions ? GAME_MENTION_RAW_RE.exec(a0) : null,
parse: (a0, a1, a2) => hydrateGameMention(a0[1], a2)
},
emoji: {
order: MarkupTextRule.order,
requiredFirstCharacters: [":"],
match: (a0) => {
const r11 = UnicodeEmojis.EMOJI_NAME_RE.exec(a0);
return r11 != null ? UnicodeEmojis.convertNameToSurrogate(r11[1]) !== "" ? r11 : null : null;
},
parse: (a0) => {
let content = UnicodeEmojis.convertNameToSurrogate(a0[1]);
if (!(content != null && content !== "")) {
content = `:${a0[1]}:`;
}
return {
type: "text",
content
};
}
},
soundboard: {
order: MarkupTextRule.order,
requiredFirstCharacters: ["<"],
match: (a0) => soundmojiRawFormatRegex.exec(a0),
parse: (a0, a1, a2) => getSoundmojiASTFromString(a0, a2)
},
customEmoji: {
order: MarkupTextRule.order,
requiredFirstCharacters: ["<"],
match: (a0) => /^<a?:(\w+):(\d+)>/.exec(a0),
parse: (a0) => ({
type: "text",
content: `:${a0[1]}:`
})
},
timestamp: {
order: MarkupTextRule.order - 1,
requiredFirstCharacters: ["<"],
match: (a0) => TIMESTAMP_REGEX.exec(a0),
parse: (a0) => {
const [content, r7, r28] = a0;
let r38 = parseTimestamp(r7, r28);
if (r38 == null) {
r38 = {
type: "text",
content
};
} else {
r38.type = "timestamp";
}
return r38;
}
},
s: {
order: Module3888.defaultRules.u.order,
requiredFirstCharacters: ["~"],
match: Module3888.inlineRegex(/^~~([\s\S]+?)~~(?!_)/),
parse: Module3888.defaultRules.u.parse
},
spoiler: {
order: MarkupTextRule.order,
requiredFirstCharacters: ["|"],
match: (a0) => MARKDOWN_SPOILER_REGEXP.exec(a0),
parse: (a0, a1, a2) => ({
content: a1(a0[1], a2),
channelId: a2.channelId
})
},
staticRouteLink: {
order: MarkupTextRule.order,
requiredFirstCharacters: ["<"],
match: (a0) => MARKDOWN_STATIC_ROUTE_NAME_REGEXP.exec(a0),
parse: (a0, a1, a2) => {
let r12;
const [, id, itemId] = a0;
const content = staticRouteToTranslation(id);
if (a2.guildId != null) {
r12 = GuildStore.getGuild(a2.guildId);
} else {
const r3 = a2.channelId != null;
r12 = null;
if (r3) {
const channel = ChannelStore.getChannel(a2.channelId);
r12 = GuildStore.getGuild(channel == null ? void 0 : channel.getGuildId());
}
}
const content2 = staticRouteToItemString(id, itemId, r12?.id);
const r39 = content2 != null ? ` › ${content2}` : "";
const mainContent = content == null ? null : [{
type: "text",
content
}];
const itemContent = content2 == null ? null : [{
type: "text",
content: content2
}];
const channel2 = ChannelStore.getChannel(a2.channelId);
return {
content: [{
type: "text",
content: content + r39
}],
mainContent,
itemContent,
itemId,
id,
guildId: channel2 == null ? void 0 : channel2.getGuildId(),
channelId: id
};
}
},
heading: MarkupHeadingRule,
list: MarkupListRule,
subtext: MarkupSubtextRule
}, PlatformMarkupRules_native]);
const CHANNEL_TOPIC_RULES = Module12.omit(c2818_23, ["inlineCode", "codeBlock", "br", "blockQuote", "subtext", "soundboard"]);
const VOICE_CHANNEL_STATUS_RULES = Module12.omit(c2818_23, ["inlineCode", "codeBlock", "br", "blockQuote", "autolink", "url", "attachmentLink", "mention", "roleMention", "channelMention", "channelOrMessageUrl", "mediaPostLink", "subtext", "soundboard", "gameMention"]);
const EMBED_TITLE_RULES = Module12.omit(c2818_23, ["codeBlock", "br", "mention", "channel", "roleMention", "attachmentLink", "subtext", "soundboard", "gameMention"]);
const INLINE_REPLY_RULES = Module12.omit(combineMarkupRules([c2818_23, {
inlineCode: {
match: (a0, a1, a2) => {
const r8 = c2818_23.codeBlock.match(a0, a1, a2);
if (r8 != null) {
return r8;
}
const r11 = c2818_23.inlineCode.match(a0, a1, a2);
return r11 ?? void 0;
}
}
}]), ["blockQuote", "codeBlock", "br"]);
const GUILD_VERIFICATION_FORM_RULES = Module12.omit(c2818_23, ["codeBlock", "br", "blockQuote"]);
const PROFILE_BIO_RULES = Module12.omit(c2818_23, ["codeBlock", "br", "attachmentLink", "mention", "roleMention", "channel", "paragraph", "newline", "subtext", "soundboard"]);
const GUILD_EVENT_RULES = Module12.omit(c2818_23, ["codeBlock", "blockQuote", "br"]);
const NATIVE_SEARCH_RESULT_LINK_RULES = Module12.omit(c2818_23, ["codeBlock", "br", "inlineCode"]);
const r355 = {
RULES: c2818_23,
CHANNEL_TOPIC_RULES,
VOICE_CHANNEL_STATUS_RULES,
EMBED_TITLE_RULES,
INLINE_REPLY_RULES,
GUILD_VERIFICATION_FORM_RULES,
GUILD_EVENT_RULES,
PROFILE_BIO_RULES,
AUTO_MODERATION_SYSTEM_MESSAGE_RULES: combineMarkupRules([{
highlightWord: {
order: -1,
match: (a0, a1) => {
let r44;
if (a1.parseDepth != null && a1.parseDepth > 10) {
return null;
}
if (a1.highlightWord != null && a1.highlightWord.length !== 0) {
const r22 = a0.indexOf(a1.highlightWord);
if (r22 === -1) {
return null;
}
const r4 = a0.length === 0 || (r22 === 0 || a0.charAt(r22 - 1).trim() === "");
let r29 = !r4;
if (r4) {
const r32 = r22 + a1.highlightWord.length;
r29 = !(r32 === a0.length || a0.charAt(r32).trim() === "");
}
let r42 = r22;
let r13 = r42;
if (r29) {
do {
r44 = a0.indexOf(a1.highlightWord, r42 + 1);
const r46 = a0.length === 0 || (r44 === 0 || a0.charAt(r44 - 1).trim() === "");
let r52 = !r46;
if (r46) {
const r55 = r44 + a1.highlightWord.length;
r52 = !(r55 === a0.length || a0.charAt(r55).trim() === "");
}
r13 = r44;
if (!r52) {
break;
}
r42 = r44;
r13 = r42;
} while (r44 !== -1);
}
if (r13 === -1) {
return null;
}
return [a0, a1.highlightWord, a0.substring(0, r13), a0.substring(r13 + a1.highlightWord.length)];
}
return null;
},
parse: (a0, a1, a2) => {
let parseDepth = a2.parseDepth;
if (parseDepth == null) {
parseDepth = 0;
}
const r4 = {
...a2,
parseDepth: parseDepth + 1
};
return [...a1(a0[2], r4), {
type: "highlight",
content: a0[1]
}, ...a1(a0[3], r4)];
}
}
}, Module12.omit(c2818_23, ["url"])]),
NATIVE_SEARCH_RESULT_LINK_RULES
};
export default r355;
export { hydrateRoleMention };
export { hydrateUserMention };
export { hydrateGameMention };
export function hydrateCommandMention(a0, a1, a2) {
return {
type: "commandMention",
channelId: a2.channelId,
commandId: a1,
commandName: a0,
commandKey: `${a1}${[..._toArray(a0.split(" ")).slice(1)].map($mk74846()).join("")}`,
content: [{
type: "text",
content: `${a0}`
}]
};
}
+7
View File
@@ -0,0 +1,7 @@
// Metro module 9991 (f9992).
export function smartOutput(a0, a1, a2) {
return typeof a0.content !== "string" && a0.content !== void 0 ? a1(a0.content, a2) : a0.content;
}
export function isStaticRouteIconType(a0) {
return a0 === "home" || a0 === "browse" || a0 === "customize" || a0 === "guide" || a0 === "linked-roles";
}
+15
View File
@@ -0,0 +1,15 @@
// Metro module 4648 (f4649).
import Module3888, { anyScopeRegex, parseInline } from "../../_bundle/Module3888";
let c2838_2 = /\n$/;
let c2838_3 = /^ *-# +((?!(-#)+)[^\n]+?) *(?:\n|$)/;
const r19 = {
order: Module3888.defaultRules.heading.order,
requiredFirstCharacters: ["-"],
match: (a0, a1, a2) => a2 != null && a2 !== "" ? a2.match(c2838_2) != null ? anyScopeRegex(c2838_3)(a0, a1, a2) : null : anyScopeRegex(c2838_3)(a0, a1, a2),
parse: function parse(a0, a1, a2) {
return {
content: parseInline(a1, a0[1].trim(), a2)
};
}
};
export default r19;
+12
View File
@@ -0,0 +1,12 @@
// Metro module 4629 (f4630).
import Module3888, { anyScopeRegex } from "../../_bundle/Module3888";
const r13 = /^[\s\S]+?(?=[^0-9A-Za-z\s\u00c0-\uffff]|\n\n| {2,}\n|\w+:\S|[0-9]+\.|$)/;
const r14 = {
...Module3888.defaultRules.text,
match: anyScopeRegex(r13)
};
export default r14;
export { r13 as textRegexp };
export function textMarkupPatternWithExclusions(a0) {
return new RegExp(`^[\\s\\S]+?(?=${a0}|[^0-9A-Za-z\\s\\u00ff-\\uffff]|\\n\\n| {2,}\\n|\\w+:\\S|[0-9]+\\.|\$)`);
}
+39
View File
@@ -0,0 +1,39 @@
// Metro module 4620 (f4621).
const r8 = {
TEXT: "text",
STRIKETHROUGH: "s",
UNDERLINE: "u",
STRONG: "strong",
ITALICS: "em",
IMAGE: "image",
EMOJI: "emoji",
CUSTOM_EMOJI: "customEmoji",
LINK: "link",
URL: "url",
AUTOLINK: "autolink",
HIGHLIGHT: "highlight",
PARAGRAPH: "paragraph",
LINE_BREAK: "br",
NEWLINE: "newline",
ESCAPE: "escape",
SPOILER: "spoiler",
BLOCK_QUOTE: "blockQuote",
INLINE_CODE: "inlineCode",
CODE_BLOCK: "codeBlock",
MENTION: "mention",
CHANNEL_MENTION: "channelMention",
CHANNEL: "channel",
GUILD: "guild",
ATTACHMENT_LINK: "attachmentLink",
SOUNDBOARD: "soundboard",
STATIC_ROUTE_LINK: "staticRouteLink",
ROLE_MENTION: "roleMention",
COMMAND_MENTION: "commandMention",
TIMESTAMP: "timestamp",
LIST: "list",
HEADING: "heading",
SUBTEXT: "subtext",
SILENT_PREFIX: "silentPrefix",
GAME_MENTION: "gameMention"
};
export { r8 as AST_KEY };
+189
View File
@@ -0,0 +1,189 @@
// Metro module 4179 (f4180).
import MarkupReactRules_native from "./MarkupReactRules.native";
import combineMarkupRules from "./combineMarkupRules";
import Module12 from "../../_bundle/Module12";
import MarkupRules from "./MarkupRules";
import { reactParserFor, astParserFor } from "../../_bundle/Module7768";
let c2405_6, c2405_7, c2405_8, c2405_9, c2405_10, c2405_11, c2405_12, c2405_13, c2405_14, c2405_15, c2405_16, c2405_17, c2405_18, c2405_19, c2405_20, c2405_21, c2405_22, c2405_23, c2405_24, c2405_25, c2405_26, c2405_27, c2405_28, c2405_29, c2405_30, c2405_31;
const _excluded = ["url", "autolink", "link", "mailto", "tel"];
let c2405_4 = {
enableBuildOverrides: false,
enableEmojiClick: true
};
let c2405_5 = Module12.once(() => {
const r15 = [MarkupReactRules_native({
enableBuildOverrides: true
})];
MarkupRules.RULES.mention;
return combineMarkupRules([MarkupRules.RULES, ...r15, {}]);
});
c2405_6 = Module12.once(() => {
const r18 = [MarkupReactRules_native(c2405_4)];
MarkupRules.RULES.mention;
return Module12.omit(combineMarkupRules([MarkupRules.RULES, ...r18, {}]), "paragraph", "newline");
});
c2405_7 = Module12.once(() => {
const r19 = [MarkupReactRules_native({
...c2405_4,
emojiTooltipPosition: "bottom",
shouldCloseDefaultModals: true,
shouldStopPropagation: true
}), {
codeBlock: {
react: MarkupRules.RULES.text.react
}
}];
MarkupRules.CHANNEL_TOPIC_RULES.mention;
return combineMarkupRules([MarkupRules.CHANNEL_TOPIC_RULES, ...r19, {}]);
});
c2405_8 = Module12.once(() => {
const r17 = [MarkupReactRules_native({
...c2405_4,
enableEmojiClick: false
})];
MarkupRules.VOICE_CHANNEL_STATUS_RULES.mention;
return combineMarkupRules([MarkupRules.VOICE_CHANNEL_STATUS_RULES, ...r17, {}]);
});
c2405_9 = Module12.once(() => {
const r15 = [MarkupReactRules_native(c2405_4)];
MarkupRules.EMBED_TITLE_RULES.mention;
return combineMarkupRules([MarkupRules.EMBED_TITLE_RULES, ...r15, {}]);
});
c2405_10 = Module12.once(() => {
const r18 = [MarkupReactRules_native(c2405_4)];
MarkupRules.EMBED_TITLE_RULES.mention;
return Module12.omit(combineMarkupRules([MarkupRules.EMBED_TITLE_RULES, ...r18, {}]), _excluded);
});
c2405_11 = Module12.once(() => {
const r15 = [MarkupReactRules_native(c2405_4)];
MarkupRules.INLINE_REPLY_RULES.mention;
return combineMarkupRules([MarkupRules.INLINE_REPLY_RULES, ...r15, {}]);
});
c2405_12 = Module12.once(() => {
const r15 = [MarkupReactRules_native(c2405_4)];
MarkupRules.GUILD_VERIFICATION_FORM_RULES.mention;
return combineMarkupRules([MarkupRules.GUILD_VERIFICATION_FORM_RULES, ...r15, {}]);
});
c2405_13 = Module12.once(() => {
const r17 = [MarkupReactRules_native({
...c2405_4,
shouldStopPropagation: true
})];
MarkupRules.GUILD_EVENT_RULES.mention;
return combineMarkupRules([MarkupRules.GUILD_EVENT_RULES, ...r17, {}]);
});
c2405_14 = Module12.once(() => {
const r15 = [MarkupReactRules_native(c2405_4)];
MarkupRules.AUTO_MODERATION_SYSTEM_MESSAGE_RULES.mention;
return combineMarkupRules([MarkupRules.AUTO_MODERATION_SYSTEM_MESSAGE_RULES, ...r15, {}]);
});
c2405_15 = Module12.once(() => {
const omit = Module12.omit;
const r18 = [MarkupReactRules_native(c2405_4)];
MarkupRules.RULES.mention;
return omit.apply(Module12, [combineMarkupRules([MarkupRules.RULES, ...r18, {}]), "paragraph", "newline", "strong", "codeBlock", "inlineCode", "u", "list", "heading", "subtext", ..._excluded]);
});
const lockscreenWidgetMessageRules = {
text: MarkupRules.RULES.text
};
c2405_16 = Module12.once(() => reactParserFor(c2405_5()));
c2405_17 = Module12.once(() => reactParserFor(c2405_7()));
c2405_18 = Module12.once(() => reactParserFor(c2405_8()));
c2405_19 = Module12.once(() => reactParserFor(c2405_9()));
c2405_20 = Module12.once(() => reactParserFor(c2405_10()));
c2405_21 = Module12.once(() => reactParserFor(c2405_11()));
c2405_22 = Module12.once(() => reactParserFor(c2405_12()));
c2405_23 = Module12.once(() => reactParserFor(c2405_13()));
c2405_24 = Module12.once(() => reactParserFor(c2405_14()));
c2405_25 = Module12.once(() => reactParserFor(c2405_6()));
c2405_26 = Module12.once(() => astParserFor(c2405_5()));
c2405_27 = Module12.once(() => astParserFor(c2405_7()));
c2405_28 = Module12.once(() => astParserFor(c2405_9()));
c2405_29 = Module12.once(() => astParserFor(c2405_10()));
c2405_30 = Module12.once(() => astParserFor(c2405_11()));
c2405_31 = Module12.once(() => astParserFor(c2405_14()));
const r155 = {
combineAndInjectMentionRule: function combineAndInjectMentionRule(a0, a1) {
a0.mention;
return combineMarkupRules([a0, ...a1, {}]);
},
createReactRules: MarkupReactRules_native,
defaultReactRuleOptions: c2405_4
};
Object.defineProperty(r155, "defaultRules", {
get: function() {
return c2405_5();
},
set: void 0,
enumerable: true,
configurable: true
});
Object.defineProperty(r155, "guildEventRules", {
get: function() {
return c2405_13();
},
set: void 0,
enumerable: true,
configurable: true
});
Object.defineProperty(r155, "notifCenterV2MessagePreviewRules", {
get: function() {
return c2405_15();
},
set: void 0,
enumerable: true,
configurable: true
});
r155.lockscreenWidgetMessageRules = lockscreenWidgetMessageRules;
r155.astParserFor = astParserFor;
r155.reactParserFor = reactParserFor;
r155.parse = function parse(...args) {
return c2405_16().apply(void 0, [...args]);
};
r155.parseTopic = (a0, a1, a2, a3) => c2405_17()(a0, a1, {
allowLinks: true,
...a2
}, a3);
r155.parseVoiceChannelStatus = function parseVoiceChannelStatus(...args) {
return c2405_18().apply(void 0, [...args]);
};
r155.parseEmbedTitle = function parseEmbedTitle(...args) {
return c2405_19().apply(void 0, [...args]);
};
r155.parseEmbedTitleWithoutLinks = function parseEmbedTitleWithoutLinks(...args) {
return c2405_20().apply(void 0, [...args]);
};
r155.parseInlineReply = function parseInlineReply(...args) {
return c2405_21().apply(void 0, [...args]);
};
r155.parseGuildVerificationFormRule = function parseGuildVerificationFormRule(...args) {
return c2405_22().apply(void 0, [...args]);
};
r155.parseGuildEventDescription = function parseGuildEventDescription(...args) {
return c2405_23().apply(void 0, [...args]);
};
r155.parseAutoModerationSystemMessage = function parseAutoModerationSystemMessage(...args) {
return c2405_24().apply(void 0, [...args]);
};
r155.parseForumPostGuidelines = function parseForumPostGuidelines(...args) {
return c2405_25().apply(void 0, [...args]);
};
r155.parseToAST = function parseToAST(...args) {
return c2405_26().apply(void 0, [...args]);
};
r155.parseTopicToAST = function parseTopicToAST(...args) {
return c2405_27().apply(void 0, [...args]);
};
r155.parseEmbedTitleToAST = function parseEmbedTitleToAST(...args) {
return c2405_28().apply(void 0, [...args]);
};
r155.parseEmbedTitleWithoutLinksToAST = function parseEmbedTitleWithoutLinksToAST(...args) {
return c2405_29().apply(void 0, [...args]);
};
r155.parseInlineReplyToAST = function parseInlineReplyToAST(...args) {
return c2405_30().apply(void 0, [...args]);
};
r155.parseAutoModerationSystemMessageToAST = function parseAutoModerationSystemMessageToAST(...args) {
return c2405_31().apply(void 0, [...args]);
};
export default r155;
@@ -0,0 +1,198 @@
// Metro module 4649 (f4650).
import { Image as Image2 } from "react-native";
import { getChannelMentionIcon } from "../../utils/native/ChannelUtils";
import UnicodeEmojis from "../emojis/UnicodeEmojis";
import Module3888 from "../../_bundle/Module3888";
import MarkupTextRule from "./MarkupTextRule";
import AvatarUtils from "../../utils/AvatarUtils";
import MarkupChannelMentionRule from "./MarkupChannelMentionRule";
import MarkupAttachmentLinkRule from "./MarkupAttachmentLinkRule";
let $mk74862 = function() {
return (a0) => a0.type === "channel" ? {
...a0,
icon: Image2.resolveAssetSource(getChannelMentionIcon(a0.iconType))?.uri
} : a0;
};
let c2839_4 = /^[\u200B-\u200D\uFEFF\u180E\u061C]/;
const r22 = {
escape: {
requiredFirstCharacters: ["\\"],
match: (a0, a1) => {
let r18;
if (a1.allowEscape === false) {
return null;
}
L5: {
const r9 = /^\\([^0-9A-Za-z\s])/.exec(a0);
if (r9 != null) {
const hasSurrogates = UnicodeEmojis.hasSurrogates(r9[0]);
r18 = null;
if (hasSurrogates) {
break L5;
}
r18 = JSON.stringify(r9[0]).includes("\\ud") ? null : r9;
} else {
r18 = r9;
}
}
return r18;
}
},
invisibleUnicode: {
...Module3888.defaultRules.escape,
requiredFirstCharacters: void 0,
match: (a0) => c2839_4.exec(a0),
parse: () => ({
type: "text",
content: ""
})
},
text: {
parse: (a0, a1, a2) => {
if (a2.nested) {
return {
content: a0[0]
};
}
const r14 = UnicodeEmojis.maybeTranslateSurrogatesToInlineEmoji(a0[0]);
return r14 == null ? {
content: a0[0]
} : a1(r14, {
...a2,
nested: true
});
}
},
emoji: {
parse: (a0) => ({
type: "emoji",
content: a0[0],
surrogate: UnicodeEmojis.convertNameToSurrogate(a0[1])
})
},
customEmoji: {
order: MarkupTextRule.order,
requiredFirstCharacters: ["<"],
match: (a0) => /^<(a)?:(\w+):(\d+)>/.exec(a0),
parse: (a0, a1, a2) => {
const [, r12, alt, id] = a0;
let disableAnimatedEmoji = a2.disableAnimatedEmoji;
if (disableAnimatedEmoji === void 0) {
disableAnimatedEmoji = false;
}
let src = AvatarUtils.getEmojiURL({
id,
animated: r12 === "a",
size: 48
});
const emojiURL = AvatarUtils.getEmojiURL({
id,
animated: false,
size: 48
});
if (disableAnimatedEmoji) {
src = emojiURL;
}
return {
id,
alt,
src,
frozenSrc: emojiURL
};
}
},
channelMention: {
parse: (a0, a1, a2) => {
const r16 = MarkupChannelMentionRule.channelMention.parse(a0, a1, a2);
const content = r16.content;
let content2 = content;
if (content != null) {
content2 = content;
if (typeof content2 !== "string") {
content2 = (content instanceof Array ? content : [content]).map($mk74862());
}
}
const inContent = r16.inContent;
let inContent2 = inContent;
if (inContent != null) {
inContent2 = inContent;
if (typeof inContent2 !== "string") {
inContent2 = (inContent instanceof Array ? inContent : [inContent]).map($mk74862());
}
}
return {
...r16,
content: content2,
inContent: inContent2
};
}
},
channelOrMessageUrl: {
parse: (a0, a1, a2) => {
const r16 = MarkupChannelMentionRule.channelOrMessageUrl.parse(a0, a1, a2);
const content = r16.content;
let content2 = content;
if (content != null) {
content2 = content;
if (typeof content2 !== "string") {
content2 = (content instanceof Array ? content : [content]).map($mk74862());
}
}
const inContent = r16.inContent;
let inContent2 = inContent;
if (inContent != null) {
inContent2 = inContent;
if (typeof inContent2 !== "string") {
inContent2 = (inContent instanceof Array ? inContent : [inContent]).map($mk74862());
}
}
return {
...r16,
content: content2,
inContent: inContent2
};
}
},
mediaPostLink: {
parse: (a0, a1, a2) => {
const r16 = MarkupChannelMentionRule.mediaPostLink.parse(a0, a1, a2);
const content = r16.content;
let content2 = content;
if (content != null) {
content2 = content;
if (typeof content2 !== "string") {
content2 = (content instanceof Array ? content : [content]).map($mk74862());
}
}
const inContent = r16.inContent;
let inContent2 = inContent;
if (inContent != null) {
inContent2 = inContent;
if (typeof inContent2 !== "string") {
inContent2 = (inContent instanceof Array ? inContent : [inContent]).map($mk74862());
}
}
return {
...r16,
content: content2,
inContent: inContent2
};
}
},
attachmentLink: {
parse: (a0, a1, a2) => MarkupAttachmentLinkRule.attachmentLink.parse(a0, a1, a2)
},
silentPrefix: {
order: MarkupTextRule.order,
requiredFirstCharacters: ["@"],
match: (a0) => /^(@silent(?![^\s]))/.exec(a0),
parse: (a0) => ({
type: "text",
content: a0[0]
})
}
};
export default r22;
export function decorateWithIcon(a0) {
return a0 != null ? typeof a0 !== "string" ? (a0 instanceof Array ? a0 : [a0]).map($mk74862()) : a0 : a0;
}
+28
View File
@@ -0,0 +1,28 @@
// Metro module 4645 (f4646).
import GuildRoleStore from "../../stores/GuildRoleStore";
import { intl, t } from "../../intl/index.native";
export function staticRouteToTranslation(a0) {
if (a0 !== "home" && a0 !== "guide") {
if (a0 === "browse") {
return intl.string(t.et6wav);
}
if (a0 === "customize") {
return intl.string(t.h9mGOP);
}
if (a0 === "linked-roles") {
return intl.string(t.ghtnss);
}
return null;
}
return intl.string(t.VbpLyU);
}
export function staticRouteToItemString(a0, a1, a2) {
if (a0 === "linked-roles") {
if (a2 == null) {
return null;
}
const role = GuildRoleStore.getRole(a2, a1);
return role == null ? null : role.tags?.guild_connections === null ? role.name : null;
}
return null;
}
+27
View File
@@ -0,0 +1,27 @@
// Metro module 10293 (f10294).
import { createStyles } from "../../design/components/Styles/native/createStyles";
import Module712 from "../../_bundle/Module712";
import useFormattedTimestamp from "./useFormattedTimestamp";
import { LegacyText } from "../../design/void/native";
import ToastActionCreators from "../toast/native/ToastActionCreators";
const useStyles = createStyles({
timestamp: {
color: Module712.colors.TEXT_DEFAULT,
backgroundColor: Module712.colors.BORDER_SUBTLE
}
});
export default function Timestamp(props) {
const { node, style } = props;
const styles = useStyles();
const formattedTimestamp = useFormattedTimestamp(node);
let timestamp = styles.timestamp;
if (timestamp == null) {
timestamp = style;
}
return <LegacyText style={timestamp} onPress={() => {
ToastActionCreators.open({
key: "TIMESTAMP",
content: node.full
});
}}>{formattedTimestamp}</LegacyText>;
};
+77
View File
@@ -0,0 +1,77 @@
// Metro module 4644 (f4645).
import { dateFormat } from "../../utils/DateUtils";
import Module3771 from "../../_bundle/Module3771";
import Durations from "../../utils/Durations";
let c2834_3 = {
t: (a0) => dateFormat(a0, "LT"),
T: (a0) => dateFormat(a0, "LTS"),
d: (a0) => dateFormat(a0, "L"),
D: (a0) => dateFormat(a0, "LL"),
f: (a0) => dateFormat(a0, "LLL"),
F: (a0) => dateFormat(a0, "LLLL"),
s: (a0) => dateFormat(a0, "L LT"),
S: (a0) => dateFormat(a0, "L LTS"),
R: (a0) => {
let r43;
const r12 = Module3771.relativeTimeThreshold("s");
Module3771.relativeTimeThreshold("s", 60);
const r10 = Module3771.relativeTimeThreshold("ss");
Module3771.relativeTimeThreshold("ss", -1);
const r30 = Module3771.relativeTimeThreshold("m");
Module3771.relativeTimeThreshold("m", 60);
try {
r43 = Module3771(a0.toDate()).fromNow();
} catch ($e) {}
Module3771.relativeTimeThreshold("s", r12);
Module3771.relativeTimeThreshold("ss", r10);
Module3771.relativeTimeThreshold("m", r30);
if (r43 == null) {
r43 = Module3771(a0.toDate()).fromNow();
}
return r43;
}
};
Object.setPrototypeOf(c2834_3, null);
const regExp = new RegExp(`^<t:(-?\\d{1,17})(?::(${Object.keys(c2834_3).join("|")}))?>`);
export { c2834_3 as TIMESTAMP_FORMATS };
export const DEFAULT_TIMESTAMP_FORMAT = "f";
export { regExp as TIMESTAMP_REGEX };
export function formatTimestampMention({ timestamp, format }) {
const parsed = Module3771(Number(timestamp) * Durations.Millis.SECOND);
if (parsed.isValid()) {
let r22 = format != null ? c2834_3[format] : void 0;
if (r22 == null) {
r22 = c2834_3.f;
}
return {
timestamp,
format,
parsed,
full: c2834_3.F(parsed),
formatted: r22(parsed)
};
}
return null;
}
export function parseTimestamp(a0, a1) {
const parsed = Module3771(Number(a0) * Durations.Millis.SECOND);
const isValid = parsed.isValid();
let r21 = null;
if (isValid) {
let r22 = a1 != null ? c2834_3[a1] : void 0;
if (r22 == null) {
r22 = c2834_3.f;
}
r21 = {
timestamp: a0,
format: a1,
parsed,
full: c2834_3.F(parsed),
formatted: r22(parsed)
};
}
return r21;
}
export function unparseTimestamp(a0, a1) {
return a1 != null ? `<t:${a0}:${a1}>` : `<t:${a0}>`;
}
@@ -0,0 +1,97 @@
// Metro module 4626 (f4627).
import URLUtils from "../../utils/URLUtils";
let c2822_2, c2822_3, c2822_4, c2822_5;
const safelyPartiallyDecodeURIComponent = function safelyPartiallyDecodeURIComponent(a0) {
let r119, r124, r125, length;
const r111 = URLUtils.safeDecodeURIComponent(a0);
if (r111 == null) {
return a0;
}
const r113 = a0.length > 0;
let r93 = "";
let r95 = r111;
let r94 = a0;
let r114 = "";
if (r113) {
do {
const r99 = r94.codePointAt(0);
const r107 = r95.codePointAt(0);
const r104 = r95;
const r105 = r94;
const r101 = r93;
if (r99 !== r107) {
const r127 = String.fromCodePoint(r107);
const r106 = encodeURIComponent(r127);
const r103 = r106 !== r127 ? r106.length : 3;
r119 = r101 + ((r107 >= 0 && r107 < 128 ? c2822_5[r107] !== 1 : r107 === 8206 || r107 === 8207 || r107 === 8234 || r107 === 8235 || r107 === 8236 || r107 === 8237 || r107 === 8238 || r107 === 1564 || r107 === 8294 || r107 === 8295 || r107 === 8296 || r107 === 8297 || r107 === 128271 || r107 === 128272 || r107 === 128274 || r107 === 128275 || r107 === 133 || r107 === 160 || r107 === 5760 || r107 === 8192 || r107 === 8193 || r107 === 8194 || r107 === 8195 || r107 === 8196 || r107 === 8197 || r107 === 8198 || r107 === 8199 || r107 === 8200 || r107 === 8201 || r107 === 8202 || r107 === 8232 || r107 === 8233 || r107 === 8239 || r107 === 8287 || r107 === 12288 || r107 === 10240 || r107 === 173 || r107 === 847 || r107 >= 1536 && r107 <= 1541 || r107 === 1757 || r107 === 1807 || r107 === 2274 || r107 === 4447 || r107 === 4448 || r107 === 6068 || r107 === 6069 || r107 === 6155 || r107 === 6156 || r107 === 6157 || r107 === 6158 || r107 === 8203 || r107 === 8204 || r107 === 8205 || r107 === 8288 || r107 === 8289 || r107 === 8290 || r107 === 8291 || r107 === 8292 || r107 === 8293 || r107 >= 8298 && r107 <= 8303 || r107 === 12644 || r107 >= 65520 && r107 <= 65528 || r107 >= 65024 && r107 <= 65039 || r107 === 65279 || r107 === 65440 || r107 === 65529 || r107 === 65530 || r107 === 65531 || r107 === 69821 || r107 === 69837 || r107 >= 78896 && r107 <= 78904 || r107 >= 113824 && r107 <= 113827 || r107 >= 119155 && r107 <= 119162 || r107 >= 917504 && r107 <= 921599) ? r106 : r127);
r125 = r105.substring(r103);
r124 = r104.substring(r127.length);
} else {
const r118 = String.fromCodePoint(r99);
r119 = r101 + r118;
const r121 = r105.substring(r118.length);
r124 = r104.substring(r118.length);
r125 = r121;
}
length = r125.length;
r95 = r124;
r94 = r125;
r93 = r119;
r114 = r93;
} while (length > 0);
}
return r114;
};
const r21 = ["͏", "឴", "឵", "ᅠ", "ㅤ", "ᅠ"];
c2822_2 = new RegExp(`${/(?:[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F])|\u2028|\u2029|[\0-\t\x0B-\x1F\x7F-\x9F]|[\xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/g.source}|${r21.join("|")}`, "gu");
c2822_3 = new RegExp(`${/(?:[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F])|\u2028|\u2029|[\0-\x08\x0B-\x1F\x7F-\x9F]|[\xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/g.source}|${r21.join("|")}`, "gu");
c2822_4 = [{
character: "h",
matcher: new RegExp(["H", "һ", "հ", "Ꮒ", "ℎ", "𝐡", "𝒉", "𝒽", "𝓱", "𝔥", "𝕙", "𝖍", "𝗁", "𝗵", "𝘩", "𝙝", "𝚑", "h"].join("|"), "gu")
}, {
character: "t",
matcher: new RegExp(["T", "𝐭", "𝑡", "𝒕", "𝓉", "𝓽", "𝔱", "𝕥", "𝖙", "𝗍", "𝘁", "𝘵", "𝙩", "𝚝"].join("|"), "gu")
}, {
character: "p",
matcher: new RegExp(["P", "ρ", "ϱ", "р", "⍴", "ⲣ", "𝐩", "𝑝", "𝒑", "𝓅", "𝓹", "𝔭", "𝕡", "𝖕", "𝗉", "𝗽", "𝘱", "𝙥", "𝚙", "𝛒", "𝛠", "𝜌", "𝜚", "𝝆", "𝝔", "𝞀", "𝞎", "𝞺", "𝟈", "p", "ҏ"].join("|"), "gu")
}, {
character: "s",
matcher: new RegExp(["S", "ƽ", "ѕ", "ꜱ", "ꮪ", "𐑈", "𑣁", "𝐬", "𝑠", "𝒔", "𝓈", "𝓼", "𝔰", "𝕤", "𝖘", "𝗌", "𝘀", "𝘴", "𝙨", "𝚜", "s"].join("|"), "gu")
}, {
character: ":",
matcher: new RegExp(["ː", "˸", "։", "׃", "܃", "܄", "ः", "ઃ", "᛬", "᠃", "᠉", "⁚", "∶", "ꓽ", "꞉", "︰", ":", ";", ";"].join("|"), "gu")
}, {
character: "/",
matcher: new RegExp(["᜵", "⁁", "⁄", "∕", "╱", "⟋", "⧸", "Ⳇ", "⼃", "〳", "ノ", "㇓", "丿", "𝈺"].join("|"), "gu")
}];
c2822_5 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0];
export { c2822_2 as BLANK_CHARACTERS_TO_SANITIZE_REGEX };
export { c2822_3 as BLANK_CHARACTERS_TO_SANITIZE_REGEX_EXCLUDING_TABS };
export function sanitizeWhitespace(a0) {
return a0.replace(c2822_2, "");
}
export function sanitizeWhitespaceExcludingTabs(a0) {
return a0.replace(c2822_3, "");
}
export { c2822_4 as UNICODE_CONFUSABLES_FOR_URL_DETECTION };
export function sanitizeUnicodeConfusables(c14367_0) {
c2822_4.forEach((item) => {
c14367_0 = c14367_0.replace(item.matcher, item.character);
});
return c14367_0;
}
export function safelyMakeUrlHumanReadable(a0) {
let protocol;
if (a0.origin === "null" && a0.pathname.startsWith("//")) {
protocol = a0.protocol;
} else {
const r16 = a0.username !== "" ? "" + a0.username : "";
const r19 = a0.password !== "" ? r16 + (":" + a0.password) : r16;
let r6 = r19;
if (r6 !== "") {
r6 = r19 + "@";
}
protocol = `${a0.protocol}${a0.href.substr(a0.protocol.length, 2) === "//" ? "//" : ""}${r6}${a0.host}`;
}
return protocol + safelyPartiallyDecodeURIComponent(a0.pathname) + safelyPartiallyDecodeURIComponent(a0.search) + safelyPartiallyDecodeURIComponent(a0.hash);
}
+22
View File
@@ -0,0 +1,22 @@
// Metro module 4621 (f4622).
import { HermesBuiltin } from "../../_hermes/prelude";
export default function combineMarkupRules(a0) {
let r36;
const r0 = {};
for (const item of a0) {
for (const key in item) {
const r11 = key in r0;
const r13 = {};
if (r11) {
HermesBuiltin.copyDataProperties(r13, r0[key]);
HermesBuiltin.copyDataProperties(r13, item[key]);
r36 = r13;
} else {
HermesBuiltin.copyDataProperties(r13, item[key]);
r36 = r13;
}
r0[key] = r36;
}
}
return r0;
};
@@ -0,0 +1,83 @@
// Metro module 10292 (f10293).
import { smartOutput } from "../MarkupRulesUtils";
import { LegacyText } from "../../../design/void/native";
function $mk84356($env) {
return function(a0, a1, a2) {
let r6, r8;
L5: {
const iconType = a0.iconType;
r6 = void 0;
r8 = void 0;
switch (iconType) {
case "text":
case "text-nsfw":
case "text-spoiler":
case "announcement":
case "announcement-nsfw":
case "announcement-spoiler":
case "forum":
case "forum-nsfw":
case "forum-spoiler":
case "media":
case "media-nsfw":
r8 = "#";
r6 = void 0;
break L5;
case "thread":
case "post":
r6 = "\"";
r8 = "\"";
break L5;
case "message":
r8 = $env[0];
r6 = void 0;
break L5;
case "voice":
case "voice-locked":
case "voice-nsfw":
case "voice-spoiler":
case "stage":
case "stage-locked":
case "locked":
case "guide":
case "home":
case "browse":
case "customize":
case "linked-roles":
break L5;
default:
const r11 = $env.$parent;
(0, r11[0])(r11[1][4]).assertNever(iconType);
r6 = void 0;
r8 = void 0;
}
}
const r7 = $env.$parent;
return (0, r7[2])((0, r7[0])(r7[1][3]).LegacyText, {
children: [r8, (0, r7[0])(r7[1][2]).smartOutput(a0, a1, a2), r6]
}, a2.key);
};
}
let env6874;
let env6875;
const r3 = env6874 = {};
const r17 = env6875 = {
$parent: r3
};
const c6875_0 = "💬";
export function inlineChannelMentionReact(a0, a1, a2) {
return a0.inContent == null ? smartOutput(a0, a1, a2) : <LegacyText key={a2.key}>
{a1(a0.inContent, a2)}
{" › "}
{smartOutput(a0, a1, a2)}
</LegacyText>;
}
export function createInlineChannelReact(r2 = "💬") {
let env17845;
const r1 = env17845 = {
$parent: env6874
};
env17845[0] = r2;
return $mk84356(r1);
}
export const inlineChannelReact = $mk84356(r17);
@@ -0,0 +1,186 @@
// Metro module 10283 (f10284).
import { MUTED_OPACITY_CONTENT } from "../../channel_list_v2/native/RedesignChannelListConstants";
import { ANSI_CONTROL_SEQUENCE_RE } from "../../../utils/HighlightJsAnsiLanguage";
import { smartOutput, isStaticRouteIconType } from "../MarkupRulesUtils";
import { makeSizeStyle, getLayoutStyles } from "../../main_tabs_v2/native/shared_components/guild_channels/layouts/ChannelListLayout";
import { ICON_SIZE } from "../../../design/components/Icon/IconSize";
import { AST_KEY } from "../MarkupTypes";
import MarkupRules from "../MarkupRules";
import HighlightText from "../../search/native/components/HighlightText";
import FastImage from "../../../components_native/common/FastImage";
import { isAndroid } from "../../../_bundle/Module501";
import Spoiler from "./Spoiler";
import { inlineChannelMentionReact, createInlineChannelReact } from "./MarkupInlineChannelMentionRules";
import { LegacyText, ThemedIcon } from "../../../design/void/native";
import { isFabric } from "../../../utils/native/FabricUtils";
import { AttachmentIcon } from "../../../design/components/Icon/native/redesign/generated/AttachmentIcon";
import Module4669 from "../../../_bundle/Module4669";
import Timestamp_native from "../Timestamp.native";
let c6867_6, createMessagePreviewReactRules;
const defaultReactFn = function defaultReactFn(a0, a1, a2) {
return typeof a0.content === "string" ? a0.content : smartOutput(a0, a1, a2);
};
createMessagePreviewReactRules = function createMessagePreviewReactRules({ iconColor, iconSize, channelIconSize, customEmojiSize = 15 }) {
let c17842_2 = customEmojiSize;
const r21 = {};
r21[AST_KEY.TEXT] = {
react: defaultReactFn
};
r21[AST_KEY.STRIKETHROUGH] = {
...MarkupRules.RULES[AST_KEY.STRIKETHROUGH],
react: defaultReactFn
};
r21[AST_KEY.UNDERLINE] = {
...MarkupRules.RULES[AST_KEY.UNDERLINE],
react: defaultReactFn
};
r21[AST_KEY.ITALICS] = {
...MarkupRules.RULES[AST_KEY.ITALICS],
react: defaultReactFn
};
r21[AST_KEY.STRONG] = {
...MarkupRules.RULES[AST_KEY.STRONG],
react: defaultReactFn
};
r21[AST_KEY.LINK] = {
...MarkupRules.RULES[AST_KEY.LINK],
react: defaultReactFn
};
r21[AST_KEY.URL] = {
...MarkupRules.RULES[AST_KEY.URL],
react: defaultReactFn
};
r21[AST_KEY.AUTOLINK] = {
...MarkupRules.RULES[AST_KEY.AUTOLINK],
react: defaultReactFn
};
r21[AST_KEY.LINE_BREAK] = {
...MarkupRules.RULES[AST_KEY.LINE_BREAK],
react: () => "\n"
};
r21[AST_KEY.HIGHLIGHT] = {
react: (a0, a1, a2) => <HighlightText key={a2.key}>
{smartOutput(a0, a1, a2)}
</HighlightText>
};
r21[AST_KEY.BLOCK_QUOTE] = {
...MarkupRules.RULES[AST_KEY.BLOCK_QUOTE],
react: defaultReactFn
};
r21[AST_KEY.PARAGRAPH] = {
...MarkupRules.RULES[AST_KEY.PARAGRAPH],
order: 600,
react: defaultReactFn
};
r21[AST_KEY.EMOJI] = {
react: (a0) => a0.surrogate || a0.content
};
r21[AST_KEY.CUSTOM_EMOJI] = {
react: (a0, a1, a2) => {
if (a0.src) {
return <FastImage key={a2.key} style={[makeSizeStyle(c17842_2), {
resizeMode: "contain"
}, isAndroid() && {
transform: [{
translateY: 3
}]
}, a2.muted && {
opacity: MUTED_OPACITY_CONTENT
}]} source={{
uri: a0.src
}} />;
}
return a0.alt;
}
};
r21[AST_KEY.SPOILER] = {
react: (a0, a1, a2) => <Spoiler key={a2.key} disableReveal muted={a2.muted}>
{smartOutput(a0, a1, a2)}
</Spoiler>
};
r21[AST_KEY.STATIC_ROUTE_LINK] = {
react: (a0, a1, a2) => isStaticRouteIconType(a0.channelId) ? smartOutput(a0, a1, a2) : null
};
r21[AST_KEY.INLINE_CODE] = {
...MarkupRules.RULES[AST_KEY.INLINE_CODE],
react: defaultReactFn
};
r21[AST_KEY.CODE_BLOCK] = {
...MarkupRules.RULES[AST_KEY.CODE_BLOCK],
parse: (a0, a1, a2) => {
const r17 = MarkupRules.RULES[AST_KEY.CODE_BLOCK].parse(a0, a1, a2);
if (r17.lang.toLowerCase() === "ansi") {
r17.content = r17.content.replaceAll(c6867_6, "");
}
return r17;
},
react: defaultReactFn
};
r21[AST_KEY.MENTION] = {
...MarkupRules.RULES[AST_KEY.MENTION],
react: defaultReactFn
};
r21[AST_KEY.CHANNEL_MENTION] = {
...MarkupRules.RULES[AST_KEY.CHANNEL_MENTION],
react: inlineChannelMentionReact
};
r21[AST_KEY.ATTACHMENT_LINK] = {
...MarkupRules.RULES[AST_KEY.ATTACHMENT_LINK],
react: (a0, a1, a2) => <LegacyText key={a2.key}>
{isFabric() ? "📎 " : <AttachmentIcon color={iconColor} size={iconSize} />}
{smartOutput(a0, a1, a2)}
</LegacyText>
};
r21[AST_KEY.SOUNDBOARD] = {
...MarkupRules.RULES[AST_KEY.SOUNDBOARD],
react: defaultReactFn
};
r21[AST_KEY.GUILD] = {
react: defaultReactFn
};
r21[AST_KEY.CHANNEL] = {
react: createInlineChannelReact(isFabric() ? "💬" : <ThemedIcon source={Module4669} size={channelIconSize} themedColor={iconColor} />)
};
r21[AST_KEY.COMMAND_MENTION] = {
...MarkupRules.RULES[AST_KEY.COMMAND_MENTION],
react: (a0, a1, a2) => <LegacyText key={a2.key}>
/
{smartOutput(a0, a1, a2)}
</LegacyText>
};
r21[AST_KEY.TIMESTAMP] = {
...MarkupRules.RULES[AST_KEY.TIMESTAMP],
react: (a0, a1, a2) => <Timestamp_native key={a2.key} node={a0} style={null} />
};
r21[AST_KEY.LIST] = {
...MarkupRules.RULES[AST_KEY.LIST],
react: (a0, a1, a2) => {
const r8 = a0.items[0];
const r6 = Array.isArray(r8) ? r8[0] : r8;
return r6 != null ? smartOutput(r6, a1, a2) : null;
}
};
r21[AST_KEY.HEADING] = {
react: defaultReactFn
};
r21[AST_KEY.SUBTEXT] = {
react: defaultReactFn
};
return r21;
};
c6867_6 = new RegExp(ANSI_CONTROL_SEQUENCE_RE, "g");
export default function createChannelListMessagePreviewReactRules(a0, a1, a2, a3) {
const styles = getLayoutStyles(a0);
const r14 = a3 != null ? Math.min(a2, a3) : a2;
let r29 = ICON_SIZE[styles.messagePreview.messageTypeIconSizeNew];
if (r29 == null) {
r29 = 0;
}
return createMessagePreviewReactRules({
iconColor: a1,
iconSize: styles.messagePreview.messageTypeIconSizeNew,
channelIconSize: styles.messagePreview.messageTypeIconSize,
customEmojiSize: r29 * r14
});
};
export { createMessagePreviewReactRules };
@@ -0,0 +1,152 @@
// Metro module 10921 (f10922).
import { useContext } from "react";
import ChannelStore from "../../../stores/ChannelStore";
import { AppLauncherRouteName, useAppLauncherNavigation } from "../../app_launcher/native/AppLauncherNativeConstants";
import { SUB_COMMAND_KEY_SEPARATOR } from "../../application_commands/ApplicationCommandConstants";
import { COMMAND_SENTINEL } from "../../channel_autocomplete/ChannelAutocompleteConstants";
import { ApplicationCommandTriggerLocations } from "../../application_commands/ApplicationCommandTypes";
import { getRootNavigationRef } from "../../main_tabs_v2/RootNavigationRef.native";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { KeyboardTypes } from "../../keyboard/native/KeyboardTypes";
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
import { intl, t } from "../../../intl/index.native";
import { ButtonColors } from "../../../design/void/native";
import { SlashBoxIcon } from "../../../design/components/Icon/native/redesign/generated/SlashBoxIcon";
import { presentCommandCopied, presentIdCopied } from "../../toast/native/ToastUtils";
import { copy } from "../../../utils/ClipboardUtils.native";
import { DeveloperMode } from "../../user_settings/UserSettings";
import { IdIcon } from "../../../design/components/Icon/native/redesign/generated/IdIcon";
import { showSimpleActionSheet } from "../../action_sheet/native/showSimpleActionSheet";
import { AppLauncherContext } from "../../app_launcher/native/AppLauncherContext";
import { Text } from "../../../design/components/Text/native/Text";
import { getBestActiveInput } from "../../../utils/native/ChatInputUtils";
import navigateToLastChannel from "../../main_tabs_v2/native/navigateToLastChannel";
import { smartOutput } from "../MarkupRulesUtils";
let handleLongPressCommandMention;
const handleTapCommandMention = function handleTapCommandMention({ appLauncherNavigator, channelId, currentText, onSetCommand: onSetCommand2, onOpenCustomKeyboard: onOpenCustomKeyboard2, commandId: commandId2, commandName }) {
let commandId;
commandId = void 0;
const channel = ChannelStore.getChannel(channelId);
if (channel != null && channel.guild_id != null) {
commandId = commandName.includes(" ") ? commandId2 + SUB_COMMAND_KEY_SEPARATOR + commandName.split(" ").slice(1).join(SUB_COMMAND_KEY_SEPARATOR) : commandId2;
if (appLauncherNavigator != null && channel != null) {
appLauncherNavigator.navigate({
name: AppLauncherRouteName.COMMAND_VIEW,
params: {
analyticsLocation: ApplicationCommandTriggerLocations.MENTION,
preSelectedCommand: {
commandId
},
context: {
type: "channel",
channel
}
}
});
return void 0;
}
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null) {
const state = rootNavigationRef.getState();
if ((state == null ? void 0 : state.routes?.length) > 1) {
const state2 = rootNavigationRef.getState();
let r97 = state2 == null ? void 0 : state2.routes?.length;
if (r97 == null) {
r97 = 0;
}
while (r97 > 1) {
rootNavigationRef.goBack();
r97 = r97 - 1;
}
}
}
ActionSheetActionCreators.hideActionSheet();
setTimeout(() => onOpenCustomKeyboard2({
type: KeyboardTypes.APP_LAUNCHER,
context: {
initialRouteName: AppLauncherRouteName.COMMAND_VIEW,
analyticsLocation: ApplicationCommandTriggerLocations.MENTION,
preSelectedCommand: {
commandId
}
}
}), 0);
} else if (currentText === "") {
onSetCommand2();
} else {
AlertActionCreators.show({
title: intl.string(t.pe26Cj),
confirmText: intl.string(t.VkKicb),
onConfirm: () => onSetCommand2(),
cancelText: intl.string(t["ETE/oC"]),
confirmColor: ButtonColors.BRAND,
body: intl.string(t["+awCIy"])
});
}
};
handleLongPressCommandMention = function handleLongPressCommandMention(c18367_0, c18367_1) {
const options = [{
label: intl.string(t["42H+Nb"]),
IconComponent: SlashBoxIcon,
onPress: () => {
presentCommandCopied();
copy(`${COMMAND_SENTINEL}${c18367_0}`);
}
}];
if (DeveloperMode.getSetting()) {
options.push({
label: intl.string(t.oJ1Muw),
IconComponent: IdIcon,
onPress: () => {
presentIdCopied();
copy(c18367_1);
}
});
}
showSimpleActionSheet({
key: "LongPressCommandMention",
options,
hasIcons: true
});
};
export default function MarkupReactCommandRule(props) {
const { node, output, state, style } = props;
let c18368_1 = useContext(AppLauncherContext) != null;
const appLauncherNavigation = useAppLauncherNavigation();
return <Text style={style} variant="text-md/bold" onPress={() => {
const bestActiveInput = getBestActiveInput();
const appLauncherNavigator = c18368_1 ? appLauncherNavigation : void 0;
let currentText = bestActiveInput == null ? void 0 : bestActiveInput.getText();
if (currentText == null) {
currentText = "";
}
handleTapCommandMention({
appLauncherNavigator,
channelId: node.channelId,
commandId: node.commandId,
commandName: node.commandName,
currentText,
onOpenCustomKeyboard: (a0) => bestActiveInput == null ? void 0 : bestActiveInput.openCustomKeyboard(a0),
onSetCommand: () => {
navigateToLastChannel();
ActionSheetActionCreators.hideActionSheet();
if (bestActiveInput != null) {
bestActiveInput.openSystemKeyboard();
}
if (bestActiveInput != null) {
const applicationCommandManager = bestActiveInput.getApplicationCommandManager();
if (applicationCommandManager != null) {
applicationCommandManager.setPartialCommand(node.commandId, node.commandName, ApplicationCommandTriggerLocations.MENTION);
}
}
}
});
}} onLongPress={() => {
handleLongPressCommandMention(node.commandName, node.commandId);
}}>
/
{smartOutput(node, output, state)}
</Text>;
};
export { handleTapCommandMention };
export { handleLongPressCommandMention };
@@ -0,0 +1,57 @@
// Metro module 12985 (f12986).
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { intl, t } from "../../../intl/index.native";
import { MarkupText } from "../MarkupReactRules.native";
import { UnknownGameIcon } from "../../../design/components/Icon/native/redesign/generated/UnknownGameIcon";
import FastImage from "../../../components_native/common/FastImage";
import GameProfileActionCreators_native from "../../game_profile/GameProfileActionCreators.native";
import { GameProfileSources } from "../../game_profile/GameProfileAnalyticUtils";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles({
icon: {
width: 16,
height: 16,
borderRadius: Module712.radii.xs,
marginRight: 2
},
chip: {
backgroundColor: Module712.colors.BORDER_SUBTLE,
borderRadius: Module712.radii.xs,
paddingHorizontal: 2
},
chipText: {
color: Module712.unsafe_rawColors.BRAND_500
}
});
export default function MarkupGameMention(props) {
const { node, state } = props;
const styles = useStyles();
const { gameId, gameName, icon } = node;
const r14 = intl.string(t["11pdXZ"]);
const r0 = gameName != null && gameName !== "";
const r12 = r0 ? gameName : r14;
if (r0) {
const r43 = <UnknownGameIcon size="sm" style={styles.icon} />;
return <MarkupText key={state.key} accessibilityRole={state.noStyleAndInteraction ? "text" : "button"} style={styles.chip} color={state?.textColor} onPress={state.noStyleAndInteraction ? void 0 : function() {
GameProfileActionCreators_native.openGameProfileModal({
gameId,
gameProfileModalChecks: {
shouldOpenGameProfile: true,
gameId
},
source: GameProfileSources.GameMention,
sourceUserId: state.authorId
});
}}>
{icon != null && icon !== "" ? <FastImage style={styles.icon} source={{
uri: icon
}} /> : r43}
<Text variant="text-sm/medium" style={styles.chipText}>{r12}</Text>
</MarkupText>;
}
return <MarkupText key={state.key} color={state?.textColor}>
@
{r14}
</MarkupText>;
};
@@ -0,0 +1,11 @@
// Metro module 15514 (f15515).
import { createMessagePreviewReactRules } from "./MarkupMessagePreviewReactRules";
import { IconSizes } from "../../../design/void/native";
export function createSearchResultLinkPreviewReactRules() {
return createMessagePreviewReactRules({
iconColor: "mobile-text-heading-primary",
iconSize: "xs",
channelIconSize: IconSizes.SMALL_14,
customEmojiSize: 16
});
}
+123
View File
@@ -0,0 +1,123 @@
// Metro module 10291 (f10292).
import * as Module19 from "react";
import { PureComponent, Children } from "react";
import { View } from "react-native";
import { EMOJI_CHAT_SIZE } from "../../../Constants";
import { MUTED_OPACITY_CONTENT } from "../../channel_list_v2/native/RedesignChannelListConstants";
import { jsx } from "react/jsx-runtime";
import { createLegacyClassComponentStyles } from "../../../design/components/Styles/native/createStyles";
import { isAndroid } from "../../../utils/PlatformUtils";
import Module712 from "../../../_bundle/Module712";
import { ThemeContext } from "../../../_bundle/Module3901";
import { LegacyText } from "../../../design/void/native";
function $mk84353($env) {
return (a0) => {
const r4 = $env.$parent;
const r2 = r4[2];
if (r2.isValidElement(a0)) {
const style = a0.props.style;
const r6 = Array.isArray(style) ? r4[4].flatten(style) : style;
let env26645;
const r17 = $env;
const children = a0.props.children;
const r19 = r17[0];
const r20 = env26645 = {
$parent: r4
};
env26645[0] = r19;
return r2.cloneElement(a0, {
children: r2.Children.map(children, $mk84353(r20)),
style: [r6, r19.spoiler],
onPress: void 0
});
}
return a0;
};
}
let c6873_7;
let env6873 = {};
const c6873_6 = createLegacyClassComponentStyles({
spoiler: {
color: isAndroid() ? "rgba(0,0,0,0.0019607844)" : "transparent",
backgroundColor: Module712.colors.SPOILER_HIDDEN_BACKGROUND
},
placeholder: {
width: EMOJI_CHAT_SIZE,
height: EMOJI_CHAT_SIZE,
backgroundColor: Module712.colors.SPOILER_HIDDEN_BACKGROUND
},
spoilerRevealed: {
color: Module712.colors.TEXT_DEFAULT,
backgroundColor: Module712.colors.SPOILER_REVEALED_BACKGROUND
},
muted: {
opacity: MUTED_OPACITY_CONTENT
}
});
class Spoiler extends PureComponent {
static contextType = ThemeContext;
state = {
revealed: false
};
handleTap = () => {
if (!(this.state.revealed || this.props.disableReveal)) {
this.setState({
revealed: !this.state.revealed
});
}
};
render() {
const r11 = c6873_6(this.context);
let c17844_0 = r11;
const revealed = this.state.revealed;
const props = this.props;
const { children, spoilerStyle, spoilerRevealedStyle } = props;
const r15 = revealed ? [r11.spoilerRevealed, spoilerRevealedStyle] : [r11.spoiler, spoilerStyle];
if (Children.count(children) === 0) {
return null;
}
return <LegacyText accessibilityRole="button" style={[r15, this.props.muted && r11.muted]} onPress={this.props.disableReveal ? void 0 : this.handleTap}>
{Children.map(children, (a0) => {
let r21;
const r5 = env6873;
const isValidElement = Module19.isValidElement(a0);
let r11 = a0;
if (isValidElement) {
L11: {
L7: {
if (a0.type.displayName !== "Image") {
if (a0.props?.source == null) {
break L7;
}
}
if (!revealed) {
r21 = (0, jsx)(View, {
style: c17844_0.placeholder
});
break L11;
}
}
const props = a0.props;
let r24 = a0;
if (props != null) {
r24 = a0;
if (!revealed) {
let env26646;
const r27 = env26646 = {
$parent: r5
};
env26646[0] = c17844_0;
r24 = Children.map(a0, $mk84353(r27));
}
}
r21 = r24;
}
r11 = r21;
}
return r11;
})}
</LegacyText>;
}
}
c6873_7 = Spoiler;
export default Spoiler;
+9
View File
@@ -0,0 +1,9 @@
// Metro module 11187 (f11188).
import { Svg, Path } from "../../../_bundle/Module8531";
export default function Spoiler(props) {
const { width = 24, height = 24, color = "currentColor", ...rest } = props;
return <Svg viewBox="0 0 24 24" {...rest} width={width} height={height}>
<Path fill={color} d="M9.09091 12C9.09091 13.5786 10.3935 14.8571 12 14.8571C13.6065 14.8571 14.9091 13.5786 14.9091 12C14.9091 10.4214 13.6065 9.14286 12 9.14286C10.3935 9.14286 9.09091 10.4214 9.09091 12ZM13.3402 12C13.3402 12.789 12.689 13.4286 11.8857 13.4286C11.0823 13.4286 10.4311 12.789 10.4311 12C10.4311 11.211 11.0823 10.5714 11.8857 10.5714C12.689 10.5714 13.3402 11.211 13.3402 12Z" />
<Path fill={color} d="M4 2C2.89543 2 2 2.89543 2 4V20C2 21.1046 2.89543 22 4 22H20C21.1046 22 22 21.1046 22 20V4C22 2.89543 21.1046 2 20 2H4ZM4 12C4 12 7.38036 7 12 7C16.6196 7 20 12 20 12C20 12 16.6196 17 12 17C7.38036 17 4 12 4 12Z" />
</Svg>;
};
+31
View File
@@ -0,0 +1,31 @@
// Metro module 10294 (f10295).
import { useEffect } from "react";
import Durations from "../../utils/Durations";
import { useForceUpdate } from "../../_bundle/Module6235";
import Module3771 from "../../_bundle/Module3771";
import { TIMESTAMP_FORMATS } from "./TimestampUtils";
let c6877_5 = [[2 * Durations.Seconds.MINUTE, Durations.Seconds.SECOND], [5 * Durations.Seconds.MINUTE, Durations.Seconds.MINUTE], [45 * Durations.Seconds.MINUTE, 2 * Durations.Seconds.MINUTE], [21 * Durations.Seconds.HOUR, 5 * Durations.Seconds.MINUTE]];
let c6877_6 = 2 * Durations.Seconds.HOUR;
export default function useFormattedTimestamp(a0) {
const forceUpdate = useForceUpdate();
useEffect(() => {
if (a0.format !== "R") {
return void 0;
}
let r27 = 1000 * c6877_6;
const r34 = Math.abs(a0.parsed.diff(Module3771()));
for (const item of c6877_5) {
const [r45, r46] = item;
if (!(r34 < 1000 * r45)) {
continue;
}
r27 = 1000 * r46;
break;
}
let c26647_0 = setInterval(() => {
forceUpdate();
}, r27);
return () => clearInterval(c26647_0);
}, [forceUpdate, a0.format, a0.parsed]);
return a0.format === "R" ? TIMESTAMP_FORMATS.R(a0.parsed) : a0.formatted;
};