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

@@ -0,0 +1,64 @@
// Metro module 11172 (f11173).
import { useState, useMemo, useEffect } from "react";
import ChannelMemberStore from "../../stores/ChannelMemberStore";
import { subscribeChannel } from "../../actions/GuildSubscriptionsActionCreators";
import { DEFAULT_RANGES } from "../../lib/guild/GuildChannelSubscriptions";
import useMessageMaxLength from "../messages/useMessageMaxLength";
import Module12 from "../../_bundle/Module12";
let c7555_6 = "@here";
export function tryUpdateSubscriptionForHereMention(a0, a1, a2, a3) {
const groups = ChannelMemberStore.getProps(a2, a3).groups;
let r19 = !!(groups.length > 1 || !(groups.length === 1 && groups[0].id === "unknown"));
if (!r19) {
const r2 = a0.length < 5 || a0.length > a1;
let r24 = !r2;
if (!r2) {
let r29 = a0.indexOf(c7555_6) !== -1;
if (r29) {
subscribeChannel(a2, a3, DEFAULT_RANGES);
r29 = true;
}
r24 = r29;
}
r19 = r24;
}
return r19;
}
export function useHereMentionCallback(a0, a1, a2) {
let c18598_0 = a0;
const messageMaxLength = useMessageMaxLength();
let c18598_3 = messageMaxLength;
const [state, setState] = useState(false);
const memo = useMemo(() => Module12.debounce((a0) => {
const groups = ChannelMemberStore.getProps(a1, a2).groups;
let r20 = !!(groups.length > 1 || !(groups.length === 1 && groups[0].id === "unknown"));
if (!r20) {
const r2 = a0.length < 5 || a0.length > c18598_3;
let r25 = !r2;
if (!r2) {
let r30 = a0.indexOf(c7555_6) !== -1;
if (r30) {
subscribeChannel(a1, a2, DEFAULT_RANGES);
r30 = true;
}
r25 = r30;
}
r20 = r25;
}
if (r20) {
setState(true);
}
}, 200, {
maxWait: 500
}), [messageMaxLength, a1, a2]);
useEffect(() => {
const groups = ChannelMemberStore.getProps(a1, a2).groups;
if (a1 != null && !(groups.length > 1 || !(groups.length === 1 && groups[0].id === "unknown")) && !state) {
c18598_0.addListener("text-changed", memo);
return () => {
c18598_0.removeListener("text-changed", memo);
memo.cancel();
};
}
}, [state, memo, a0, a1, a2]);
}
@@ -0,0 +1,218 @@
// Metro module 8023 (f8024).
import EmojiStore from "../emojis/EmojiStore";
import ActiveJoinedThreadsStore from "../threads/ActiveJoinedThreadsStore";
import ChannelStore from "../../stores/ChannelStore";
import GuildChannelStore, { GUILD_SELECTABLE_CHANNELS_KEY } from "../../stores/GuildChannelStore";
import GuildMemberStore from "../../stores/GuildMemberStore";
import GuildRoleStore from "../../stores/GuildRoleStore";
import GuildStore from "../../stores/GuildStore";
import PermissionStore from "../../stores/PermissionStore";
import RelationshipStore from "../../stores/RelationshipStore";
import UserStore from "../../stores/UserStore";
import { Permissions } from "../../Constants";
import { EmojiIntention } from "../emojis/EmojiConstants";
import { voidToOptionValue } from "./slate/SlateUtils";
import { unescapeChannelName, computeChannelName } from "../channel/useChannelName";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import { COMMAND_SUPPORTED_CHANNEL_TYPE_KEYS } from "../../utils/AutocompleteUtils";
import UnicodeEmojis from "../emojis/UnicodeEmojis";
import EmojiUtils from "../../utils/EmojiUtils";
let matchesUser;
const resolvePlaintextInlineVoid = function resolvePlaintextInlineVoid(a0, a1, a2, a3) {
const r4 = a3 == null ? {} : a3;
const { allowUsers = true, allowRoles = true } = r4;
const r11 = a0[0];
if (r11 === "@") {
return (function resolveUserOrRole(a0, a1, a2, a3, a4) {
const [r32, r33] = a0.slice(1).split("#", 2);
let c26081_0 = r32;
let c26081_1 = r33;
const r35 = a1 != null ? GuildStore.getGuild(a1) : null;
if (a4 && r33 == null && r35 != null) {
for (const item of GuildRoleStore.getSortedRoles(r35.id)) {
if (r32 !== item.name) {
continue;
}
return {
type: "roleMention",
roleId: item.id,
children: [{
text: ""
}]
};
}
}
if (a3) {
const r58 = a2 != null ? ChannelStore.getChannel(a2) : null;
if (r58 == null) {
return null;
}
const r74 = (r58.isPrivate() ? r58.recipients : GuildMemberStore.getMembers(a1).map((item) => item.userId)).map((item) => UserStore.getUser(item)).filter((item) => {
let r2 = item !== void 0;
if (r2) {
let r6 = c26081_1;
let requireExact = ({}).requireExact;
if (requireExact === void 0) {
requireExact = false;
}
let r11 = item != null;
if (r11) {
const username = item.username;
let r13 = requireExact ? username === c26081_0 : username.startsWith(c26081_0);
if (r13) {
const discriminator = item.discriminator;
if (r6 == null) {
r6 = "0";
}
r13 = discriminator === r6;
}
r11 = r13;
}
r2 = r11;
}
return r2;
});
if (r74.length === 1) {
const r76 = r74[0];
if (matchesUser(r32, r33, r76, {
requireExact: true
})) {
return {
type: "userMention",
userId: r76.id,
children: [{
text: ""
}]
};
}
}
}
return null;
})(a0, a1, a2, allowUsers, allowRoles);
}
if (r11 === ":") {
const r34 = UnicodeEmojis.EMOJI_NAME_RE.exec(a0);
const r3 = r34 == null;
let r35 = null;
if (!r3) {
const r15 = r34[1];
const emoji = EmojiStore.getDisambiguatedEmojiContext(a1).getCustomEmoji().get(r15);
const channel = a2 != null ? ChannelStore.getChannel(a2) : null;
r35 = emoji != null ? EmojiUtils.isEmojiFiltered({
emoji,
channel,
intention: EmojiIntention.CHAT
}) ? null : {
type: "customEmoji",
emoji: {
emojiId: emoji.id,
name: "require_colons" in emoji && emoji.require_colons ? `:${emoji.name}:` : emoji.name,
animated: emoji.animated === true,
jumboable: false
},
children: [{
text: ""
}]
} : null;
}
return r35;
}
if (r11 === "#") {
return (function resolveChannel(a0, a1) {
let r116, r167;
if (a1 == null) {
return null;
}
const r4 = a0.length > 3 && (a0[1] === "\"" && a0[a0.length - 1] === "\"") ? unescapeChannelName(a0.slice(2, a0.length - 1)) : a0.slice(1);
const textChannelNameDisambiguations = GuildChannelStore.getTextChannelNameDisambiguations(a1);
for (const item of SnowflakeUtils.keys(textChannelNameDisambiguations)) {
const channelId = item;
if (textChannelNameDisambiguations[item].name !== r4) {
continue;
}
return {
type: "channelMention",
channelId,
children: [{
text: ""
}]
};
}
for (const item2 of COMMAND_SUPPORTED_CHANNEL_TYPE_KEYS) {
L25: {
if (item2 === GUILD_SELECTABLE_CHANNELS_KEY) {
continue;
}
for (const item3 of GuildChannelStore.getChannels(a1)[item2]) {
const channel = item3.channel;
if (computeChannelName(channel, UserStore, RelationshipStore) !== r4) {
continue;
}
if (channel.isCategory() && !PermissionStore.can(Permissions.VIEW_CHANNEL, channel)) {
continue;
}
r116 = {
type: "channelMention",
channelId: channel.id,
children: [{
text: ""
}]
};
break L25;
}
continue;
}
return r116;
}
const activeJoinedThreadsForGuild = ActiveJoinedThreadsStore.getActiveJoinedThreadsForGuild(a1);
for (const item4 of SnowflakeUtils.keys(activeJoinedThreadsForGuild)) {
done150: {
for (const item5 of SnowflakeUtils.keys(activeJoinedThreadsForGuild[item4])) {
const channel2 = activeJoinedThreadsForGuild[item4][item5].channel;
if (computeChannelName(channel2, UserStore, RelationshipStore) !== r4) {
continue;
}
r167 = {
type: "channelMention",
channelId: channel2.id,
children: [{
text: ""
}]
};
break done150;
}
continue;
}
return r167;
}
return null;
})(a0, a1);
}
return null;
};
matchesUser = function matchesUser(a0, a1, a2) {
let requireExact = arguments[3].requireExact;
if (requireExact === void 0) {
requireExact = false;
}
let r8 = a2 != null;
if (r8) {
const username = a2.username;
let r10 = requireExact ? username === a0 : username.startsWith(a0);
if (r10) {
let r11 = a1;
const discriminator = a2.discriminator;
if (a1 == null) {
r11 = "0";
}
r10 = discriminator === r11;
}
r8 = r10;
}
return r8;
};
export { resolvePlaintextInlineVoid };
export function resolveApplicationCommandOption(a0, a1, a2, a3) {
const r5 = resolvePlaintextInlineVoid(a0, a1, a2, a3);
return r5 != null ? voidToOptionValue(r5) : null;
}
@@ -0,0 +1,55 @@
// Metro module 12632 (f12633).
import ChannelStore from "../../stores/ChannelStore";
import { ChannelTypes } from "../../Constants";
export default function compareChannelsByScoreAndPosition(a0, a1) {
let r26, r51;
if (a0.score !== a1.score) {
return a1.score - a0.score;
}
const record = a0.record;
if (record.parent_id == null) {
r26 = record.type === ChannelTypes.GUILD_CATEGORY ? 1000 * (record.position + 1) : record.position;
} else {
let r18 = ChannelStore.getChannel(record.parent_id)?.position;
if (r18 == null) {
r18 = 0;
}
const r19 = r18 + 1;
const isGuildVocal = record.isGuildVocal();
const r25 = 1000 * r19 + record.position;
r26 = isGuildVocal ? r25 + 500 : r25;
}
const record2 = a1.record;
if (record2.parent_id == null) {
r51 = record2.type === ChannelTypes.GUILD_CATEGORY ? 1000 * (record2.position + 1) : record2.position;
} else {
let r42 = ChannelStore.getChannel(record2.parent_id)?.position;
if (r42 == null) {
r42 = 0;
}
const r44 = r42 + 1;
const isGuildVocal2 = record2.isGuildVocal();
const r50 = 1000 * r44 + record2.position;
r51 = isGuildVocal2 ? r50 + 500 : r50;
}
if (r26 !== r51) {
return r26 - r51;
}
let sortable = a0.sortable;
if (sortable == null) {
const comparator2 = a0.comparator;
sortable = comparator2 == null ? void 0 : comparator2.toLocaleLowerCase();
}
if (sortable == null) {
sortable = "";
}
let sortable2 = a0.sortable;
if (sortable2 == null) {
const comparator = a1.comparator;
sortable2 = comparator == null ? void 0 : comparator.toLocaleLowerCase();
}
if (sortable2 == null) {
sortable2 = "";
}
return sortable < sortable2 ? -1 : sortable > sortable2 ? 1 : 0;
};
@@ -0,0 +1,29 @@
// Metro module 11490 (f11491).
import { AnalyticEvents } from "../../../Constants";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { collectChannelAnalyticsMetadata, collectGuildAnalyticsMetadata } from "../../app_analytics/AppAnalyticsUtils";
export function iOSTrackAutocompleteOpen(a0, a1, a2) {
AnalyticsUtils.track(AnalyticEvents.CHANNEL_AUTOCOMPLETE_OPEN, {
...collectChannelAnalyticsMetadata(a1),
...collectGuildAnalyticsMetadata(a1.guild_id),
autocomplete_type: a0,
num_emoji_results: a2.numEmojiResults,
num_sticker_results: a2.numStickerResults,
game_mentions_available: a2.gameMentionsAvailable
});
}
export function iOSTrackAutocompleteSelect(a0, a1, a2) {
AnalyticsUtils.track(AnalyticEvents.CHANNEL_AUTOCOMPLETE_SELECTED, {
...collectChannelAnalyticsMetadata(a1),
...collectGuildAnalyticsMetadata(a1.guild_id),
autocomplete_type: a0,
selection_type: a2.selectionType,
sticker_id: a2.stickerId,
application_id: a2.gameId,
num_emoji_results: a2.numEmojiResults,
num_sticker_results: a2.numStickerResults,
emoji_name: a2.expressionName,
is_custom: a2.isCustom,
is_animated: a2.isAnimated
});
}
@@ -0,0 +1,11 @@
// Metro module 9660 (f9661).
const r8 = {
MENTIONS: "MENTIONS",
CHANNELS: "CHANNELS",
EMOJIS_AND_STICKERS: "EMOJIS_AND_STICKERS",
SLASHES: "SLASHES",
SLASHES_DISCOVERY: "SLASHES_DISCOVERY",
CHOICES: "CHOICES",
GAME_MENTIONS: "GAME_MENTIONS"
};
export { r8 as AutocompleteTypes };
@@ -0,0 +1,66 @@
// Metro module 11486 (f11487).
import { View } from "react-native";
import { EMOJI_URL_BASE_SIZE } from "../../emojis/EmojiConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import FastImage from "../../../components_native/common/FastImage";
import AvatarUtils from "../../../utils/AvatarUtils";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
const useStyles = createStyles({
upsell: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between"
},
title: {
lineHeight: 16,
flex: 1
},
emojis: {
height: 28
},
emojiWrapper: {
position: "absolute",
width: 28,
height: 28,
padding: 2,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
borderWidth: 2,
borderRadius: 14,
borderColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
alignItems: "center",
justifyContent: "center"
},
emoji: {
width: 16,
height: 16
}
});
export default function ChannelAutocompleteEmojiUpsell(props) {
const results = props.results;
const styles = useStyles();
const r18 = results.slice(0, 3);
const r9 = r18.map((item, index) => <View key={item.id} style={[styles.emojiWrapper, {
left: 24 * index
}]}>
<FastImage style={styles.emoji} source={{
uri: item.id != null ? AvatarUtils.getEmojiURL({
id: item.id,
animated: item.animated,
size: EMOJI_URL_BASE_SIZE
}) : item.url
}} />
</View>);
const r22 = 24 * r18.length;
return <View style={styles.upsell}>
<Text style={styles.title} accessibilityRole="header" variant="text-sm/medium">
{intl.format(t.uEky42, {
count: results.length
})}
</Text>
<View style={[styles.emojis, {
width: r22 + 16
}]}>{r9}</View>
</View>;
};
@@ -0,0 +1,88 @@
// Metro module 5970 (f5971).
function $mk77547() {
return (a0) => ({
type: "line",
children: [{
text: a0
}]
});
}
let c3766_0 = Object.freeze([Object.freeze({
type: "line",
children: Object.freeze([Object.freeze({
text: ""
})])
})]);
export function createEmptyState() {
return {
textValue: "",
richValue: [{
type: "line",
children: [{
text: ""
}]
}]
};
}
export function createState(a0) {
return {
textValue: a0,
richValue: a0 !== "" ? a0.split("\n").map($mk77547()) : c3766_0
};
}
export function toRichValue(a0) {
return a0 !== "" ? a0.split("\n").map($mk77547()) : c3766_0;
}
export function voidToOptionValue(a0) {
const type = a0.type;
if (type === "userMention") {
return {
type: "userMention",
userId: a0.userId
};
}
if (type === "channelMention") {
return {
type: "channelMention",
channelId: a0.channelId
};
}
if (type === "soundboard") {
return {
type: "soundboard",
guildId: a0.guildId,
soundId: a0.soundId
};
}
if (type === "roleMention") {
return {
type: "roleMention",
roleId: a0.roleId
};
}
if (type === "textMention") {
return {
type: "textMention",
text: a0.name
};
}
if (type === "emoji") {
return {
type: "emoji",
name: a0.emoji.name,
surrogate: a0.emoji.surrogate
};
}
if (type === "customEmoji") {
return {
type: "customEmoji",
emojiId: a0.emoji.emojiId,
name: a0.emoji.name,
animated: a0.emoji.animated
};
}
if (type === "testInlineVoid") {
throw new Error("Unable to convert test types");
}
return null;
}