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,28 @@
// Metro module 11104 (f11105).
import ExplicitMediaStore from "./ExplicitMediaStore";
import { EXPLICIT_MEDIA_SENDER_FALSE_POSITIVE_ACTION_SHEET_KEY } from "./ExplicitMediaRedactionConstants";
import { trackMediaRedactionAction, TrackMediaRedactionActionType } from "./ExplicitMediaRedactionUtils";
import AlertActionCreators from "../../actions/native/AlertActionCreators";
import { intl, t } from "../../intl/index.native";
import ExplicitMediaFalsePositiveActionCreators from "./ExplicitMediaFalsePositiveActionCreators";
import ActionSheetActionCreators from "../action_sheet/native/ActionSheetActionCreators";
export function handleSenderFalsePositiveFlow(a0, a1) {
trackMediaRedactionAction({
action: TrackMediaRedactionActionType.EXPLICIT_MEDIA_SENDER_FALSE_POSITIVE_BUTTON_CLICKED,
messageId: a1,
channelId: a0
});
if (ExplicitMediaStore.canSubmitFpReport(a1)) {
ActionSheetActionCreators.openLazy(import("./native/false_positive_reporting/ExplicitMediaSenderFalsePositiveActionSheet"), EXPLICIT_MEDIA_SENDER_FALSE_POSITIVE_ACTION_SHEET_KEY, {
channelId: a0,
messageId: a1
});
return void 0;
}
AlertActionCreators.show({
title: intl.string(t["iS/eFN"]),
body: intl.string(t.YrjcgR),
confirmText: intl.string(t.BddRzS)
});
ExplicitMediaFalsePositiveActionCreators.disableFalsePositiveButton(a0, a1);
}
@@ -0,0 +1,13 @@
// Metro module 11105 (f11106).
import Dispatcher from "../../Dispatcher";
export function disableFalsePositiveButton(a0, a1) {
Dispatcher.dispatch({
type: "MESSAGE_EXPLICIT_CONTENT_FP_SUBMIT",
messageId: a1,
channelId: a0
});
}
const r12 = {
disableFalsePositiveButton
};
export default r12;
@@ -0,0 +1,546 @@
// Metro module 5873 (f5874).
import ReferencedMessageStore, { ReferencedMessageState } from "../replies/ReferencedMessageStore";
import AuthenticationStore from "../../stores/AuthenticationStore";
import ChannelSectionStore from "../../stores/ChannelSectionStore";
import ChannelStore from "../../stores/ChannelStore";
import MessageStore from "../../stores/MessageStore";
import SelectedChannelStore from "../../stores/SelectedChannelStore";
import SelectedGuildStore from "../../stores/SelectedGuildStore";
import ExplicitMediaSearchStore from "./ExplicitMediaSearchStore";
import { MessageTypesWithLazyLoadedReferences } from "../../Constants";
import { UserSettingsTypes } from "../user_settings/UserSettingsConstants";
import { TimeoutCancelSource, trackExplicitMediaScanComplete, trackScanTiming, trackScanningTimedOut, trackExplicitMediaRedactableMessagedLoaded, trackRedactableMessageLoaded, hasMessageSnapshotsWithAttachmentsOrEmbeds } from "./ExplicitMediaRedactionUtils";
import { isMediaFlaggedForHarmType, isEligibleForScanning, hasUnscannedMedia, getUnscannedMediaIds, getEnabledHarmTypesForMessage, getChannelIdAndAuthorIdFromMessage } from "./ObscuredMediaUtils";
import { ContentHarmType } from "./HarmTypeConfiguration";
import { ObscuredMediaTypes } from "./ExplicitMediaRedactionModels";
import Dispatcher from "../../Dispatcher";
import { sendMultiChannelMessagesForScanning, sendMessagesForScanning } from "./ExplicitMediaRedactionActionCreators";
import MonitoringAgent from "../monitoring/MonitoringAgent";
import { MetricEvents } from "../../_bundle/Module5872";
import { hasAttachmentsEmbedsComponentsOrSnapshots } from "./ExplicitMediaManagerUtils";
import uniqWith from "../../_bundle/uniqWith";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import { updateMessageRecord } from "../messages/MessageRecordUtils";
import flatten from "../../_bundle/flatten";
import AutomaticLifecycleManager from "../../lib/AutomaticLifecycleManager";
function $mk77264() {
return (a0) => a0.id;
}
function $mk77270($env) {
return (a0) => {
const r5 = $env;
const r12 = r5[0];
if (r12[a0.channel_id] == null) {
r12[a0.channel_id] = {
numOfAttachments: 0,
numOfAttachmentsPendingScan: 0,
numOfEmbeds: 0,
numOfEmbedsPendingScan: 0
};
}
const r15 = r5[1];
if (r15[a0.id] == null) {
r15[a0.id] = {
channelId: a0.channel_id,
numOfAttachments: 0,
numOfSelfHarmAttachments: 0,
numOfGoreAttachments: 0,
numOfExplicitAttachments: 0,
numOfEmbeds: 0,
numOfSelfHarmEmbeds: 0,
numOfGoreEmbeds: 0,
numOfExplicitEmbeds: 0
};
}
let r9 = a0.attachments?.length;
if (r9 == null) {
r9 = 0;
}
let r23 = a0.embeds?.length;
if (r23 == null) {
r23 = 0;
}
const r24 = $env.$parent;
const unscannedMediaIds = (0, r24[0])(r24[2][11]).getUnscannedMediaIds(a0);
const { attachmentIds, embedIds } = unscannedMediaIds;
const r32 = r12[a0.channel_id];
r32.numOfAttachments = r32.numOfAttachments + r9;
r32.numOfEmbeds = r32.numOfEmbeds + r23;
r32.numOfAttachmentsPendingScan = r32.numOfAttachmentsPendingScan + attachmentIds.length;
r32.numOfEmbedsPendingScan = r32.numOfEmbedsPendingScan + embedIds.length;
const r44 = r15[a0.id];
r44.numOfAttachments = r44.numOfAttachments + r9;
r44.numOfEmbeds = r44.numOfEmbeds + r23;
const attachments = a0.attachments;
let numOfExplicitAttachments = attachments == null ? void 0 : attachments.filter($mk104760(r24)).length;
if (numOfExplicitAttachments == null) {
numOfExplicitAttachments = 0;
}
r44.numOfExplicitAttachments = numOfExplicitAttachments;
const embeds = a0.embeds;
let numOfExplicitEmbeds = embeds == null ? void 0 : embeds.filter($mk104761(r24)).length;
if (numOfExplicitEmbeds == null) {
numOfExplicitEmbeds = 0;
}
r44.numOfExplicitEmbeds = numOfExplicitEmbeds;
const attachments2 = a0.attachments;
let numOfGoreAttachments = attachments2 == null ? void 0 : attachments2.filter($mk104762(r24)).length;
if (numOfGoreAttachments == null) {
numOfGoreAttachments = 0;
}
r44.numOfGoreAttachments = numOfGoreAttachments;
const embeds2 = a0.embeds;
let numOfGoreEmbeds = embeds2 == null ? void 0 : embeds2.filter($mk104763(r24)).length;
if (numOfGoreEmbeds == null) {
numOfGoreEmbeds = 0;
}
r44.numOfGoreEmbeds = numOfGoreEmbeds;
const attachments3 = a0.attachments;
let numOfSelfHarmAttachments = attachments3 == null ? void 0 : attachments3.filter($mk104764(r24)).length;
if (numOfSelfHarmAttachments == null) {
numOfSelfHarmAttachments = 0;
}
r44.numOfSelfHarmAttachments = numOfSelfHarmAttachments;
const embeds3 = a0.embeds;
let numOfSelfHarmEmbeds = embeds3 == null ? void 0 : embeds3.filter($mk104765(r24)).length;
if (numOfSelfHarmEmbeds == null) {
numOfSelfHarmEmbeds = 0;
}
r44.numOfSelfHarmEmbeds = numOfSelfHarmEmbeds;
};
}
function $mk104760($env) {
return (a0) => {
const r1 = $env;
const r6 = r1[0];
const r5 = r1[2];
return r6(r5[11]).isMediaFlaggedForHarmType(r6(r5[12]).ContentHarmType.EXPLICIT, {
type: r6(r5[13]).ObscuredMediaTypes.Attachment,
media: a0
});
};
}
function $mk104761($env) {
return (a0) => {
const r1 = $env;
const r6 = r1[0];
const r5 = r1[2];
return r6(r5[11]).isMediaFlaggedForHarmType(r6(r5[12]).ContentHarmType.EXPLICIT, {
type: r6(r5[13]).ObscuredMediaTypes.Embed,
media: a0
});
};
}
function $mk104762($env) {
return (a0) => {
const r1 = $env;
const r6 = r1[0];
const r5 = r1[2];
return r6(r5[11]).isMediaFlaggedForHarmType(r6(r5[12]).ContentHarmType.GORE, {
type: r6(r5[13]).ObscuredMediaTypes.Attachment,
media: a0
});
};
}
function $mk104763($env) {
return (a0) => {
const r1 = $env;
const r6 = r1[0];
const r5 = r1[2];
return r6(r5[11]).isMediaFlaggedForHarmType(r6(r5[12]).ContentHarmType.GORE, {
type: r6(r5[13]).ObscuredMediaTypes.Embed,
media: a0
});
};
}
function $mk104764($env) {
return (a0) => {
const r1 = $env;
const r6 = r1[0];
const r5 = r1[2];
return r6(r5[11]).isMediaFlaggedForHarmType(r6(r5[12]).ContentHarmType.SELF_HARM, {
type: r6(r5[13]).ObscuredMediaTypes.Attachment,
media: a0
});
};
}
function $mk104765($env) {
return (a0) => {
const r1 = $env;
const r6 = r1[0];
const r5 = r1[2];
return r6(r5[11]).isMediaFlaggedForHarmType(r6(r5[12]).ContentHarmType.SELF_HARM, {
type: r6(r5[13]).ObscuredMediaTypes.Embed,
media: a0
});
};
}
let maybeCancelTimeout, withoutScheduledTimeout, handleUnscannedMessages, processMessagesFromAction, handleMessageUpdate, handleMessageCreate, handleMessagesLoad, handleSearchMessagesSuccess, handleLoadPinnedMessages, handleForumPostsLoad, handleThreadsLoad, handleSidebarViewChannel, handleChannelSelect, handleUserSettingsUpdate, handleVoiceChannelChatOpen, maybeScanMessagesForChannelId, c3675_32;
let env3675 = {};
const resetManager = function resetManager() {
Object.values(env3675[14]).forEach((item) => {
clearTimeout(item.timeout);
});
env3675[14] = {};
};
maybeCancelTimeout = function maybeCancelTimeout(a0, a1) {
if (a0.id != null && a0.channel_id != null) {
const r22 = `${a0.channel_id}:${a0.id}`;
if (env3675[14][r22] != null) {
const r26 = env3675[14][r22];
const { timeout, setAt } = r26;
if (a1 === TimeoutCancelSource.UPDATE) {
let attachments = a0.attachments;
if (attachments == null) {
attachments = [];
}
let embeds = a0.embeds;
if (embeds == null) {
embeds = [];
}
trackExplicitMediaScanComplete({
messageId: a0.id,
channelId: a0.channel_id,
numOfAttachments: attachments.length,
numOfEmbeds: embeds.length,
numOfExplicitAttachments: attachments.filter((attachment) => isMediaFlaggedForHarmType(ContentHarmType.EXPLICIT, {
type: ObscuredMediaTypes.Attachment,
media: attachment
})).length,
numOfExplicitEmbeds: embeds.filter((embed) => isMediaFlaggedForHarmType(ContentHarmType.EXPLICIT, {
type: ObscuredMediaTypes.Embed,
media: embed
})).length
});
}
trackScanTiming(setAt, a1);
clearTimeout(timeout);
delete env3675[14][r22];
return true;
}
return false;
}
return false;
};
withoutScheduledTimeout = function withoutScheduledTimeout(a0) {
return env3675[14][`${a0.channel_id}:${a0.id}`] == null;
};
handleUnscannedMessages = function handleUnscannedMessages(a0, a1) {
const r3 = a1 == null ? {} : a1;
const forceBatchScan = r3.forceBatchScan;
let r4 = forceBatchScan !== void 0 && forceBatchScan;
const jitter = r3.jitter;
const r7 = jitter !== void 0 && jitter;
const isMessageUpdate = a1?.isMessageUpdate;
const filter = a0.filter;
const r21 = isMessageUpdate ? filter.call(a0, (a0) => isEligibleForScanning(a0) && hasUnscannedMedia(a0)).filter(withoutScheduledTimeout) : filter.call(a0, (a0) => isEligibleForScanning(a0)).filter(withoutScheduledTimeout);
let c15224_1;
let c15224_0 = r21;
r21.forEach((item) => {
const r13 = `${item.channel_id}:${item.id}`;
if (env3675[14][r13] == null) {
MonitoringAgent.increment({
name: MetricEvents.EXPLICIT_MEDIA_SCAN_CLIENT_TIMEOUT_CREATE
});
env3675[14][r13] = {
setAt: Date.now(),
timeout: setTimeout(() => {
if (maybeCancelTimeout(item, TimeoutCancelSource.TIMEOUT)) {
const message = MessageStore.getMessage(item.channel_id, item.id);
if (message != null) {
const unscannedMediaIds = getUnscannedMediaIds(message);
trackScanningTimedOut({
channelId: item.channel_id,
messageId: item.id,
attachmentIds: unscannedMediaIds.attachmentIds,
embedIds: unscannedMediaIds.embedIds
});
}
Dispatcher.dispatch({
type: "MESSAGE_EXPLICIT_CONTENT_SCAN_TIMEOUT",
messageId: item.id,
channelId: item.channel_id
});
}
}, 3000)
};
}
});
if (!r4) {
r4 = new Set(r21.map((item) => item.channel_id)).size > 1;
}
c15224_1 = r4;
if (r7) {
setTimeout(() => {
const r8 = c15224_0.filter((item) => env3675[14][`${item.channel_id}:${item.id}`] != null);
if (r8.length !== 0) {
if (c15224_1) {
sendMultiChannelMessagesForScanning(r8);
} else {
sendMessagesForScanning(r8[0].channel_id, r8.map($mk77264()));
}
}
}, 800 * Math.random());
} else if (r21.length !== 0) {
if (r4) {
sendMultiChannelMessagesForScanning(r21);
} else {
sendMessagesForScanning(r21[0].channel_id, r21.map($mk77264()));
}
}
};
processMessagesFromAction = function processMessagesFromAction(a0, a1) {
const r7 = a0.filter((item) => {
let r9 = hasAttachmentsEmbedsComponentsOrSnapshots(item);
const enabledHarmTypesForMessage = getEnabledHarmTypesForMessage(item);
if (r9) {
r9 = enabledHarmTypesForMessage !== 0;
}
return r9;
});
const r21 = a0.map((item) => {
if (item != null && "referenced_message" in item && item.referenced_message != null) {
if (hasAttachmentsEmbedsComponentsOrSnapshots(item.referenced_message) && getEnabledHarmTypesForMessage(item.referenced_message) !== 0) {
return item.referenced_message;
}
}
}).filter(function(item) {
return item != null;
});
const r9 = r21.length > 0 ? [...r7, ...r21] : r7;
let env15225;
const r12 = uniqWith(r9, (a0, a1) => a0.id === a1.id && a0.channel_id === a1.channel_id);
const r34 = r12.filter((item) => hasUnscannedMedia(item));
const r35 = env15225 = {
$parent: env3675
};
const r11 = {};
env15225[0] = r11;
const r36 = {};
env15225[1] = r36;
r12.forEach($mk77270(r35));
SnowflakeUtils.entries(r11).forEach((item) => {
const [channelId, r22] = item;
trackExplicitMediaRedactableMessagedLoaded({
channelId,
numOfAttachments: r22.numOfAttachments,
numOfAttachmentsPendingScan: r22.numOfAttachmentsPendingScan,
numOfEmbeds: r22.numOfEmbeds,
numOfEmbedsPendingScan: r22.numOfEmbedsPendingScan
});
});
SnowflakeUtils.entries(r36).forEach((item) => {
const [messageId, r22] = item;
trackRedactableMessageLoaded({
messageId,
channelId: r22.channelId,
numOfAttachments: r22.numOfAttachments,
numOfGoreAttachments: r22.numOfGoreAttachments,
numOfExplicitAttachments: r22.numOfExplicitAttachments,
numOfSelfHarmAttachments: r22.numOfSelfHarmAttachments,
numOfEmbeds: r22.numOfEmbeds,
numOfGoreEmbeds: r22.numOfGoreEmbeds,
numOfExplicitEmbeds: r22.numOfExplicitEmbeds,
numOfSelfHarmEmbeds: r22.numOfSelfHarmEmbeds
});
});
let r54 = r34.length > 0;
if (r54) {
handleUnscannedMessages(r34, a1);
r54 = true;
}
return r54;
};
handleMessageUpdate = function handleMessageUpdate({ message }) {
if (message.channel_id != null && message.id != null) {
if (getChannelIdAndAuthorIdFromMessage(message).authorId !== AuthenticationStore.getId()) {
if (message.embeds == null && message.attachments == null && !hasMessageSnapshotsWithAttachmentsOrEmbeds(message)) {
return false;
}
if (message.embeds?.length === 0) {
if (message.attachments?.length === 0 && !hasMessageSnapshotsWithAttachmentsOrEmbeds(message)) {
return false;
}
}
if (!hasUnscannedMedia(message)) {
let r46 = MessageStore.getMessage(message.channel_id, message.id);
if (r46 == null) {
r46 = ExplicitMediaSearchStore.getMessage(message.id, message.channel_id);
}
if (r46 == null) {
r46 = ReferencedMessageStore.getMessage(message.channel_id, message.id)?.message;
}
if (!(r46 == null || hasUnscannedMedia(updateMessageRecord(r46, message)))) {
maybeCancelTimeout(r46, TimeoutCancelSource.UPDATE);
}
}
const channelId = SelectedChannelStore.getChannelId();
const currentSidebarChannelId = ChannelSectionStore.getCurrentSidebarChannelId(channelId);
if (message.channel_id !== channelId && message.channel_id !== currentSidebarChannelId) {
return false;
}
const message2 = MessageStore.getMessage(message.channel_id, message.id);
return message2 != null && processMessagesFromAction([message2], {
isMessageUpdate: true
});
}
}
return false;
};
handleMessageCreate = function handleMessageCreate({ channelId, message, optimistic, isPushNotification }) {
if (!optimistic && !isPushNotification && channelId != null && getChannelIdAndAuthorIdFromMessage(message).authorId !== AuthenticationStore.getId()) {
const channelId2 = SelectedChannelStore.getChannelId();
const currentSidebarChannelId = ChannelSectionStore.getCurrentSidebarChannelId(channelId2);
const channel = ChannelStore.getChannel(channelId);
let r1 = channelId === channelId2 || channelId === currentSidebarChannelId;
if (r1) {
const r31 = [message];
let jitter = channel == null ? void 0 : channel.isPrivate();
if (jitter == null) {
jitter = true;
}
if (jitter) {
jitter = channel?.memberCount == null || channel?.memberCount > 100;
}
r1 = processMessagesFromAction(r31, {
jitter
});
}
return r1;
}
return false;
};
handleMessagesLoad = function handleMessagesLoad({ channelId, messages }) {
if (channelId != null && messages != null) {
const channelId2 = SelectedChannelStore.getChannelId();
const currentSidebarChannelId = ChannelSectionStore.getCurrentSidebarChannelId(channelId2);
return (channelId === channelId2 || channelId === currentSidebarChannelId) && processMessagesFromAction(messages);
}
return false;
};
handleSearchMessagesSuccess = function handleSearchMessagesSuccess({ data }) {
let c15226_0 = false;
data.forEach((item) => {
c15226_0 = processMessagesFromAction(uniqWith(flatten(item.messages), (a0, a1) => a0.id === a1.id && a0.channel_id === a1.channel_id)) || c15226_0;
});
return c15226_0;
};
handleLoadPinnedMessages = function handleLoadPinnedMessages(a0) {
return processMessagesFromAction(a0.pins.map((pin) => pin.message));
};
handleForumPostsLoad = function handleForumPostsLoad({ guildId, threads }) {
return threads != null && (SelectedGuildStore.getGuildId() === guildId && processMessagesFromAction(SnowflakeUtils.keys(threads).map((item) => threads[item].first_message)));
};
handleThreadsLoad = function handleThreadsLoad({ guildId, firstMessages }) {
return firstMessages != null && (!(SelectedGuildStore.getGuildId() !== guildId) && processMessagesFromAction(firstMessages, {
forceBatchScan: true
}));
};
handleSidebarViewChannel = function handleSidebarViewChannel({ channelId }) {
return channelId != null && maybeScanMessagesForChannelId(channelId);
};
handleChannelSelect = function handleChannelSelect({ channelId }) {
return channelId != null && (!(channelId !== SelectedChannelStore.getChannelId()) && maybeScanMessagesForChannelId(channelId));
};
handleUserSettingsUpdate = function handleUserSettingsUpdate(a0) {
const settings = a0.settings;
if (a0.local && settings.type === UserSettingsTypes.PRELOADED_USER_SETTINGS) {
const channelId = SelectedChannelStore.getChannelId();
return channelId != null && maybeScanMessagesForChannelId(channelId);
}
return false;
};
handleVoiceChannelChatOpen = function handleVoiceChannelChatOpen(a0) {
const channelId = a0.channelId;
return !!a0.chatOpen && maybeScanMessagesForChannelId(channelId);
};
maybeScanMessagesForChannelId = function maybeScanMessagesForChannelId(a0) {
const messages = MessageStore.getMessages(a0);
let r3 = messages.length !== 0;
if (r3) {
const r20 = messages.filter((message) => hasAttachmentsEmbedsComponentsOrSnapshots(message) && getEnabledHarmTypesForMessage(message) !== 0);
const r26 = messages.map((message) => {
if (MessageTypesWithLazyLoadedReferences.has(message.type) && message.messageReference != null) {
const messageByReference = ReferencedMessageStore.getMessageByReference(message.messageReference);
if (messageByReference.state === ReferencedMessageState.LOADED && messageByReference.message != null) {
if (hasAttachmentsEmbedsComponentsOrSnapshots(messageByReference.message) && getEnabledHarmTypesForMessage(messageByReference.message) !== 0) {
return messageByReference.message;
}
}
}
}).filter(function(item) {
return item != null;
});
const r10 = r26.length > 0 ? [...r20, ...r26] : r20;
let env15228;
const r13 = uniqWith(r10, (a0, a1) => a0.id === a1.id && a0.channel_id === a1.channel_id);
const r39 = r13.filter((item) => hasUnscannedMedia(item));
const r40 = env15228 = {
$parent: env3675
};
const r12 = {};
env15228[0] = r12;
const r41 = {};
env15228[1] = r41;
r13.forEach($mk77270(r40));
SnowflakeUtils.entries(r12).forEach((item) => {
const [channelId, r22] = item;
trackExplicitMediaRedactableMessagedLoaded({
channelId,
numOfAttachments: r22.numOfAttachments,
numOfAttachmentsPendingScan: r22.numOfAttachmentsPendingScan,
numOfEmbeds: r22.numOfEmbeds,
numOfEmbedsPendingScan: r22.numOfEmbedsPendingScan
});
});
SnowflakeUtils.entries(r41).forEach((item) => {
const [messageId, r22] = item;
trackRedactableMessageLoaded({
messageId,
channelId: r22.channelId,
numOfAttachments: r22.numOfAttachments,
numOfGoreAttachments: r22.numOfGoreAttachments,
numOfSelfHarmAttachments: r22.numOfSelfHarmAttachments,
numOfExplicitAttachments: r22.numOfExplicitAttachments,
numOfEmbeds: r22.numOfEmbeds,
numOfGoreEmbeds: r22.numOfGoreEmbeds,
numOfExplicitEmbeds: r22.numOfExplicitEmbeds,
numOfSelfHarmEmbeds: r22.numOfSelfHarmEmbeds
});
});
let r59 = r39.length > 0;
if (r59) {
handleUnscannedMessages(r39);
r59 = true;
}
r3 = r59;
}
return r3;
};
env3675[14] = {};
class ExplicitMediaManager extends AutomaticLifecycleManager {
constructor() {
super(...arguments);
this.actions = {
LOAD_MESSAGES_SUCCESS: handleMessagesLoad,
LOAD_FORUM_POSTS: handleForumPostsLoad,
LOAD_THREADS_SUCCESS: handleThreadsLoad,
LOAD_ARCHIVED_THREADS_SUCCESS: handleThreadsLoad,
SIDEBAR_VIEW_CHANNEL: handleSidebarViewChannel,
MESSAGE_CREATE: handleMessageCreate,
MESSAGE_UPDATE: handleMessageUpdate,
LOGOUT: resetManager,
SEARCH_MESSAGES_SUCCESS: handleSearchMessagesSuccess,
MOD_VIEW_SEARCH_MESSAGES_SUCCESS: handleSearchMessagesSuccess,
CHANNEL_SELECT: handleChannelSelect,
LOAD_PINNED_MESSAGES_SUCCESS: handleLoadPinnedMessages,
USER_SETTINGS_PROTO_UPDATE: handleUserSettingsUpdate,
CHANNEL_RTC_UPDATE_CHAT_OPEN: handleVoiceChannelChatOpen
};
}
}
c3675_32 = ExplicitMediaManager;
const r63 = new ExplicitMediaManager();
export default r63;
export const MESSAGE_SCAN_TIMEOUT = 3000;
export const MAX_TIMEOUT_FOR_JITTER = 800;
@@ -0,0 +1,8 @@
// Metro module 5886 (f5887).
export function hasAttachmentsEmbedsComponentsOrSnapshots(a0) {
if (a0 == null) {
return false;
}
const r9 = "messageSnapshots" in a0 ? a0.messageSnapshots : a0.message_snapshots;
return a0.attachments != null && a0.attachments.length > 0 || a0.embeds != null && a0.embeds.length > 0 || a0.components != null && a0.components.length > 0 || r9 != null && (r9 == null ? void 0 : r9.some(({ message }) => message.attachments != null && message.attachments.length > 0 || message.embeds != null && message.embeds.length > 0 || message.components != null && message.components.length > 0));
}
@@ -0,0 +1,48 @@
// Metro module 5885 (f5886).
import { Endpoints } from "../../Constants";
import { HTTP } from "../../_bundle/sendRequest";
export function reportFalsePositive(a0, a1, a2, a3) {
return HTTP.post({
url: Endpoints.EXPLICIT_MEDIA_REPORT_FALSE_POSITIVE,
body: {
channel_id: a0,
message_id: a1,
attachment_ids: a2,
embed_ids: a3
},
rejectWithError: false
});
}
export function reportFailedSendFalsePositive(a0, a1, a2, a3) {
return HTTP.post({
url: Endpoints.EXPLICIT_MEDIA_SENDER_REPORT_FALSE_POSITIVE,
body: {
channel_id: a0,
message_id: a1,
attachment_ids: a2,
filenames: a3
},
rejectWithError: false
});
}
export function sendMessagesForScanning(a0, a1) {
return HTTP.patch({
url: Endpoints.EXPLICIT_MEDIA_SCAN_MESSAGES(a0),
body: {
message_ids: a1
},
rejectWithError: false
});
}
export function sendMultiChannelMessagesForScanning(a0) {
return HTTP.patch({
url: Endpoints.EXPLICIT_MEDIA_SCAN_MULTI_CHANNEL_MESSAGES,
body: {
messages: a0.map((item) => ({
channel_id: item.channel_id,
message_id: item.id
}))
},
rejectWithError: false
});
}
@@ -0,0 +1,11 @@
// Metro module 5865 (f5866).
import { MessageEmbedTypes } from "../../_bundle/Module693";
const set = new Set([MessageEmbedTypes.IMAGE, MessageEmbedTypes.VIDEO, MessageEmbedTypes.GIFV]);
export const USER_SETTING_ACTION_SHEET_KEY = "SensitiveMediaFilterSetting";
export const EXPLICIT_MEDIA_FALSE_POSITIVE_ACTION_SHEET_KEY = "ExplicitMediaFalsePositiveActionSheet";
export const EXPLICIT_MEDIA_LEARN_MORE_ACTION_SHEET_KEY = "ExplicitMediaLearnMoreActionSheet";
export const EXPLICIT_MEDIA_SENDER_FALSE_POSITIVE_ACTION_SHEET_KEY = "ExplicitMediaSenderFalsePositiveActionSheet";
export const EXPLICIT_MEDIA_SETTINGS_ACTION_SHEET_KEY = "ExplicitMediaSettingsActionSheet";
export { set as SUPPORTED_EMBED_TYPES };
export const EXPLICIT_MEDIA_MIN_WIDTH = 146;
export const EXPLICIT_MEDIA_MIN_HEIGHT = 212;
@@ -0,0 +1,16 @@
// Metro module 5880 (f5881).
const r10 = {
GUILD: "guild",
FRIEND_DM: "friend_dm",
NON_FRIEND_DM: "non_friend_dm"
};
const r14 = {
Attachment: 0,
0: "Attachment",
Embed: 1,
1: "Embed",
GenericMedia: 2,
2: "GenericMedia"
};
export { r10 as ContentHarmTypeChannel };
export { r14 as ObscuredMediaTypes };
@@ -0,0 +1,254 @@
// Metro module 5862 (f5863).
import DevSettingsStore from "../devtools/dev_settings/DevSettingsStore";
import ChannelStore from "../../stores/ChannelStore";
import ExplicitMediaStore from "./ExplicitMediaStore";
import { EXPLICIT_MEDIA_MIN_HEIGHT, EXPLICIT_MEDIA_MIN_WIDTH } from "./ExplicitMediaRedactionConstants";
import { AnalyticEvents } from "../../Constants";
import { ExplicitContentRedaction } from "../../_bundle/Module1306";
import { intl, t } from "../../intl/index.native";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import { isCurrentUserTeen } from "../self_mod/SelfModUtils";
import MonitoringAgent from "../monitoring/MonitoringAgent";
import { MetricEvents } from "../../_bundle/Module5872";
import { MESSAGE_SCAN_TIMEOUT } from "./ExplicitMediaManager";
import { isFeatureAgeGated, useIsFeatureAgeGated } from "../regional_feature_config/RegionalFeatureConfigUtils";
import { AgeGatedFeature } from "../../_bundle/Module5013";
import * as _AgeVerificationUtils from "../age_assurance/AgeVerificationUtils";
import { useShouldShowTiggerPawtect, isVerifiedAdult } from "../age_assurance/AgeVerificationUtils";
import { AGE_VERIFICATION_OBSCURABLE_REASONS } from "./ObscureMediaModels";
function $mk77251() {
return (a0) => {
a0.content_scan_version = -1;
return a0;
};
}
function $mk77252() {
return (a0) => {
a0.contentScanVersion = -1;
return a0;
};
}
const r25 = {
EXPLICIT_MEDIA_LEARN_MORE_VIEWED: "explicit_media_learn_more_viewed",
EXPLICIT_MEDIA_LEARN_MORE_CLICK_SETTINGS: "explicit_media_learn_more_click_settings",
EXPLICIT_MEDIA_LEARN_MORE_CLICK_LEARN_MORE: "explicit_media_learn_more_click_learn_more",
EXPLICIT_MEDIA_LEARN_MORE_CLICK_DISMISS: "explicit_media_learn_more_click_dismiss",
EXPLICIT_MEDIA_LEARN_MORE_CLICK_FALSE_POSITIVE: "explicit_media_learn_more_click_false_positive",
EXPLICIT_MEDIA_LEARN_MORE_CLICK_AGE_VERIFY_REVERIFY: "explicit_media_learn_more_click_age_verify_reverify",
EXPLICIT_MEDIA_LEARN_MORE_CLICK_AGE_VERIFY_LEARN_MORE: "explicit_media_learn_more_click_age_verify_learn_more",
EXPLICIT_MEDIA_FALSE_POSITIVE_VIEWED: "explicit_media_false_positive_viewed",
EXPLICIT_MEDIA_FALSE_POSITIVE_CLICK_CONFIRM: "explicit_media_false_positive_click_confirm",
EXPLICIT_MEDIA_FALSE_POSITIVE_CLICK_CANCEL: "explicit_media_false_positive_click_cancel",
EXPLICIT_MEDIA_SENDER_FALSE_POSITIVE_BUTTON_CLICKED: "explicit_media_sender_false_positive_button_clicked",
EXPLICIT_MEDIA_FALSE_POSITIVE_CLYDE_MESSAGE_SENT: "explicit_media_false_positive_clyde_message_sent"
};
const r38 = {
EXPLICIT_MEDIA_OBSCURED_FALSE_POSITIVE_FLOW: "explicit_media_obscured_false_positive_flow",
EXPLICIT_MEDIA_SENDER_FALSE_POSITIVE_FLOW: "explicit_media_sender_false_positive_flow",
EXPLICIT_MEDIA_MESSAGE_SEND_BLOCKED: "explicit_media_message_send_blocked",
EXPLICIT_MEDIA_ADD_MEDIA_TO_FORUM_POST_BLOCKED: "explicit_media_add_media_to_forum_post_blocked"
};
const r43 = {
UPDATE: "update",
TIMEOUT: "timeout"
};
export function redactionSettingToRenderedString(a0) {
if (ExplicitContentRedaction.SHOW === a0) {
return () => intl.string(t["5k5OFp"]);
}
if (ExplicitContentRedaction.BLUR === a0) {
return () => intl.string(t.S49Uad);
}
if (ExplicitContentRedaction.BLOCK === a0) {
return () => intl.string(t["D/157Y"]);
}
}
export function isPendingScanVersion(a0) {
const r9 = DevSettingsStore.get("explicit_media_redaction_ignore_pending_scan");
return r9 ? !r9 : a0 !== 0 && a0 !== -1 && (a0 == null || a0 !== ExplicitMediaStore.validContentScanVersion);
}
export { r25 as TrackMediaRedactionActionType };
export { r38 as TrackMediaRedactionContext };
export function trackMediaRedactionAction({ action, channelId, messageId, context }) {
if (channelId != null && messageId != null) {
AnalyticsUtils.track(AnalyticEvents.EXPLICIT_MEDIA_ACTION, {
action,
guild_id: ChannelStore.getChannel(channelId)?.guild_id,
channel_id: channelId,
message_id: messageId,
user_is_underage: isCurrentUserTeen(),
context
});
}
}
export { r43 as TimeoutCancelSource };
export function trackScanTiming(a0, a1) {
MonitoringAgent.increment({
name: MetricEvents.EXPLICIT_MEDIA_SCAN_CLIENT_TIMING,
tags: [`timingBucket:${Math.min(Math.floor((Date.now() - a0) / 1000), 3)}`, `source:${a1}`, "metricVersion:1"]
});
}
export function trackScanningTimedOut(a0) {
L23: {
const { channelId, messageId, attachmentIds, embedIds } = a0;
if (channelId != null && messageId != null) {
let r16 = attachmentIds?.length;
if (r16 == null) {
r16 = 0;
}
if (r16 === 0) {
let r18 = embedIds?.length;
if (r18 == null) {
r18 = 0;
}
if (r18 === 0) {
break L23;
}
}
AnalyticsUtils.track(AnalyticEvents.EXPLICIT_MEDIA_SCAN_CLIENT_TIMED_OUT, {
channel_id: channelId,
guild_id: ChannelStore.getChannel(channelId)?.guild_id,
message_id: messageId,
embed_ids: embedIds,
user_is_underage: isCurrentUserTeen(),
scan_timeout_duration: MESSAGE_SCAN_TIMEOUT,
attachment_ids_v2: attachmentIds
});
MonitoringAgent.increment({
name: MetricEvents.EXPLICIT_MEDIA_SCAN_CLIENT_TIMED_OUT,
tags: ["metricVersion:1"]
});
const r52 = {
name: MetricEvents.EXPLICIT_MEDIA_SCAN_CLIENT_TIMED_OUT_DISTRIBUTION
};
let r54 = attachmentIds?.length;
if (r54 == null) {
r54 = 0;
}
let r56 = embedIds?.length;
if (r56 == null) {
r56 = 0;
}
MonitoringAgent.distribution(r52, r54 + r56);
}
}
}
export function trackExplicitMediaRedactableMessagedLoaded({ channelId, numOfAttachments, numOfAttachmentsPendingScan, numOfEmbeds, numOfEmbedsPendingScan }) {
if (channelId != null) {
AnalyticsUtils.track(AnalyticEvents.EXPLICIT_MEDIA_REDACTABLE_MESSAGES_LOADED, {
channel_id: channelId,
guild_id: ChannelStore.getChannel(channelId)?.guild_id,
num_of_attachments: numOfAttachments,
num_of_attachments_pending_scan: numOfAttachmentsPendingScan,
num_of_embeds: numOfEmbeds,
num_of_embeds_pending_scan: numOfEmbedsPendingScan
});
const r24 = numOfAttachmentsPendingScan + numOfEmbedsPendingScan;
if (r24 > 0) {
MonitoringAgent.distribution({
name: MetricEvents.EXPLICIT_MEDIA_PENDING_MESSAGE_LOADED_V2
}, r24);
}
}
}
export function trackRedactableMessageLoaded({ messageId, channelId, numOfAttachments, numOfSelfHarmAttachments, numOfEmbeds, numOfGoreAttachments, numOfExplicitAttachments, numOfSelfHarmEmbeds, numOfGoreEmbeds, numOfExplicitEmbeds }) {
const has_redactable_explicit = numOfExplicitAttachments > 0 || numOfExplicitEmbeds > 0;
const has_redactable_gore = numOfGoreAttachments > 0 || numOfGoreEmbeds > 0;
const has_redactable_self_harm = numOfSelfHarmAttachments > 0 || numOfSelfHarmEmbeds > 0;
L16: {
if (channelId != null && messageId != null) {
if (!has_redactable_explicit && !has_redactable_gore && !has_redactable_self_harm) {
break L16;
}
const channel = ChannelStore.getChannel(channelId);
AnalyticsUtils.track(AnalyticEvents.REDACTABLE_MESSAGE_LOADED, {
message_id: messageId,
channel_id: channelId,
channel_type: channel?.type,
guild_id: channel?.guild_id,
num_of_attachments: numOfAttachments,
num_of_gore_attachments: numOfGoreAttachments,
num_of_explicit_attachments: numOfExplicitAttachments,
num_of_self_harm_attachments: numOfSelfHarmAttachments,
num_of_embeds: numOfEmbeds,
num_of_gore_embeds: numOfGoreEmbeds,
num_of_explicit_embeds: numOfExplicitEmbeds,
num_of_self_harm_embeds: numOfSelfHarmEmbeds,
has_redactable_explicit,
has_redactable_gore,
has_redactable_self_harm
});
}
}
}
export function trackExplicitMediaScanComplete({ messageId, channelId, numOfAttachments, numOfExplicitAttachments, numOfEmbeds, numOfExplicitEmbeds }) {
if (channelId != null) {
const channel = ChannelStore.getChannel(channelId);
AnalyticsUtils.track(AnalyticEvents.EXPLICIT_MEDIA_RETROACTIVE_SCAN_COMPLETE, {
message_id: messageId,
channel_id: channelId,
channel_type: channel?.type,
guild_id: channel?.guild_id,
num_of_attachments: numOfAttachments,
num_of_explicit_attachments: numOfExplicitAttachments,
num_of_embeds: numOfEmbeds,
num_of_explicit_embeds: numOfExplicitEmbeds
});
}
}
export function handleExplicitMediaScanTimeoutForMessage(a0) {
const attachments = a0.attachments.map($mk77251());
const embeds = a0.embeds.map($mk77252());
const messageSnapshots = a0.messageSnapshots;
return a0.merge({
attachments,
embeds,
messageSnapshots: messageSnapshots != null ? messageSnapshots.length !== 0 ? messageSnapshots.map((messageSnapshot) => {
const message = messageSnapshot.message;
return messageSnapshot.merge({
message: message.merge({
attachments: message.attachments.map($mk77251()),
embeds: message.embeds.map($mk77252())
})
});
}) : messageSnapshots : messageSnapshots
});
}
export function isObscuredMediaBelowConstraints(a0, a1) {
return a0 != null && a1 != null && (a0 <= EXPLICIT_MEDIA_MIN_WIDTH || a1 <= EXPLICIT_MEDIA_MIN_HEIGHT);
}
export function shouldAgeVerifyForExplicitMedia() {
let r11 = isFeatureAgeGated(AgeGatedFeature.SENSITIVE_CONTENT_SHOW_SETTING);
const shouldShowTiggerPawtect = _AgeVerificationUtils.shouldShowTiggerPawtect();
if (r11) {
r11 = shouldShowTiggerPawtect;
}
return r11;
}
export function useShouldAgeVerifyForExplicitMedia() {
let r11 = useIsFeatureAgeGated(AgeGatedFeature.SENSITIVE_CONTENT_SHOW_SETTING);
const shouldShowTiggerPawtect = useShouldShowTiggerPawtect();
if (r11) {
r11 = shouldShowTiggerPawtect;
}
return r11;
}
export function useShouldAgeVerifyForReason(a0) {
let r13 = useIsFeatureAgeGated(AgeGatedFeature.SENSITIVE_CONTENT_SHOW_SETTING);
const shouldShowTiggerPawtect = useShouldShowTiggerPawtect();
if (r13) {
r13 = shouldShowTiggerPawtect;
}
const r0 = r13 ? a0 == null : !r13;
return r0 ? !r0 : AGE_VERIFICATION_OBSCURABLE_REASONS.has(a0);
}
export function trackToggleMediaObscurityV2({ obscure }) {
if (isVerifiedAdult()) {
AnalyticsUtils.track(AnalyticEvents.EXPLICIT_MEDIA_OBSCURITY_TOGGLE_V2, {
toggle_direction: obscure ? "hide" : "show"
});
}
}
export function hasMessageSnapshotsWithAttachmentsOrEmbeds({ message_snapshots }) {
return message_snapshots == null ? void 0 : message_snapshots.some((message_snapshot) => message_snapshot.message?.attachments != null && message_snapshot.message.attachments.length > 0 || message_snapshot.message?.embeds != null && message_snapshot.message.embeds.length > 0);
}
@@ -0,0 +1,57 @@
// Metro module 5876 (f5877).
import { createMessageRecord, updateMessageRecord } from "../messages/MessageRecordUtils";
import { handleExplicitMediaScanTimeoutForMessage } from "./ExplicitMediaRedactionUtils";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c3678_2;
const handleSearchMessagesSuccess = function handleSearchMessagesSuccess({ data }) {
c3678_2 = {};
data.forEach((item) => {
item.messages.forEach((message) => {
message.forEach((item) => {
c3678_2[`${item.channel_id}:${item.id}`] = createMessageRecord(item);
});
});
});
};
c3678_2 = {};
class ExplicitMediaSearchStore extends Module589.Store {
static displayName = "SearchMessageStore";
getMessage(a0, a1) {
return c3678_2[`${a1}:${a0}`];
}
}
const explicitMediaSearchStore = new ExplicitMediaSearchStore(Dispatcher, {
SEARCH_MESSAGES_SUCCESS: handleSearchMessagesSuccess,
MOD_VIEW_SEARCH_MESSAGES_SUCCESS: handleSearchMessagesSuccess,
MESSAGE_UPDATE: function handleMessageUpdate({ message }) {
if (message.id != null && message.channel_id != null) {
const r15 = `${message.channel_id}:${message.id}`;
const r17 = c3678_2[r15];
let r18 = r17 != null;
if (r18) {
c3678_2[r15] = updateMessageRecord(r17, {
attachments: message.attachments,
embeds: message.embeds
});
r18 = true;
}
return r18;
}
return false;
},
LOGOUT: function handleLogout() {
c3678_2 = {};
},
CONNECTION_OPEN: function handleConnectionOpen() {
c3678_2 = {};
},
MESSAGE_EXPLICIT_CONTENT_SCAN_TIMEOUT: function handleScanTimeout(a0) {
const r10 = `${a0.channelId}:${a0.messageId}`;
const r12 = c3678_2[r10];
if (r12 != null) {
c3678_2[r10] = handleExplicitMediaScanTimeoutForMessage(r12);
}
}
});
export default explicitMediaSearchStore;
@@ -0,0 +1,85 @@
// Metro module 5863 (f5864).
import Durations from "../../utils/Durations";
import Module589 from "../../_bundle/Module589";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import * as _SensitiveContentSelfHarmExperiment from "./SensitiveContentSelfHarmExperiment";
import Dispatcher from "../../Dispatcher";
let explicitContentScanVersion;
let c3669_3 = 14 * Durations.Millis.DAY;
let c3669_4 = Object.freeze([]);
explicitContentScanVersion = void 0;
let c3669_6 = {};
let c3669_7 = {};
class ExplicitMediaStore extends Module589.Store {
static displayName = "FalsePositiveStore";
getFpMessageInfo(a0) {
return c3669_6[a0];
}
getChannelFpInfo(a0) {
let r4 = c3669_7[a0];
if (r4 == null) {
r4 = c3669_4;
}
return r4;
}
canSubmitFpReport(a0) {
const r7 = c3669_6[a0];
let r8 = r7 != null;
if (r8) {
const reportSubmit = r7.reportSubmit;
r8 = reportSubmit ? !reportSubmit : SnowflakeUtils.age(r7.messageId) < c3669_3;
}
return r8;
}
get validContentScanVersion() {
const isSensitiveContentSelfHarmEnabled = _SensitiveContentSelfHarmExperiment.isSensitiveContentSelfHarmEnabled("ExplicitMediaStore.validContentScanVersion");
let r10 = explicitContentScanVersion;
if (isSensitiveContentSelfHarmEnabled) {
if (explicitContentScanVersion == null) {
r10 = 5;
}
return r10;
}
return Math.min(explicitContentScanVersion == null ? 4 : explicitContentScanVersion, 4);
}
}
const explicitMediaStore = new ExplicitMediaStore(Dispatcher, {
LOGOUT: function handleLogout() {
c3669_6 = {};
c3669_7 = {};
},
CONNECTION_OPEN: function handleConnectionOpen(a0) {
explicitContentScanVersion = a0.explicitContentScanVersion;
c3669_6 = {};
c3669_7 = {};
},
MESSAGE_EXPLICIT_CONTENT_FP_CREATE: function handleFalsePositiveCreate(a0) {
const { messageId: messageId2, channelId } = a0;
const r12 = {
messageId: messageId2,
channelId,
attachments: a0.attachments,
reportSubmit: false
};
let r8 = c3669_7[channelId];
if (r8 == null) {
r8 = c3669_4;
}
c3669_7[channelId] = [...r8, r12];
c3669_6[messageId2] = r12;
},
MESSAGE_EXPLICIT_CONTENT_FP_SUBMIT: function handleFalsePositiveSubmit({ messageId, channelId }) {
const r7 = c3669_7[channelId];
if (r7 != null) {
c3669_7[channelId] = r7.map((item) => item.messageId === messageId ? {
...item,
reportSubmit: true
} : item);
c3669_6[messageId] = {
...c3669_6[messageId],
reportSubmit: true
};
}
}
});
export default explicitMediaStore;
@@ -0,0 +1,151 @@
// Metro module 5878 (f5879).
import * as _Constants from "../../Constants";
import { ObscureReason } from "./ObscureMediaModels";
import { ContentScanFlags } from "../media/MediaTypes";
import { ContentHarmTypeChannel } from "./ExplicitMediaRedactionModels";
import { ExplicitContentSettings, GoreContentSettings } from "../user_settings/UserSettings";
import { resolveExplicitContentSettingWithDefaults } from "./SensitiveMediaExplicitRedactionSettingsUtils";
import { resolveGoreSettingWithDefaults } from "./SensitiveMediaGoreRedactionSettingsUtils";
import { ExplicitContentRedaction } from "../../_bundle/Module1306";
const { MessageAttachmentFlags, MessageEmbedFlags } = _Constants;
const r18 = {
EXPLICIT: "explicit",
GORE: "gore",
SELF_HARM: "self_harm"
};
const r22 = {
NONE: 0,
0: "NONE",
EXPLICIT: 1,
1: "EXPLICIT",
GORE: 2,
2: "GORE",
SELF_HARM: 4,
4: "SELF_HARM",
ALL: 7,
7: "ALL"
};
const r32 = {};
r32[r18.EXPLICIT] = {
harmType: r18.EXPLICIT,
obscureReason: ObscureReason.EXPLICIT_CONTENT,
attachmentFlag: MessageAttachmentFlags.CONTAINS_EXPLICIT_MEDIA,
embedFlag: MessageEmbedFlags.CONTAINS_EXPLICIT_MEDIA,
genericMediaFlag: ContentScanFlags.EXPLICIT,
bitmask: r22.EXPLICIT,
devSettingKey: "obscure_blur_effect_explicit_content_enabled",
getProtoUserSettings: (a0) => {
const r6 = a0 == null ? void 0 : a0.textAndImages?.explicitContentSettings;
const GUILD = ContentHarmTypeChannel.GUILD;
const explicitContentGuilds = r6?.explicitContentGuilds;
const r16 = {};
r16[GUILD] = explicitContentGuilds;
r16[ContentHarmTypeChannel.FRIEND_DM] = r6?.explicitContentFriendDm;
r16[ContentHarmTypeChannel.NON_FRIEND_DM] = r6?.explicitContentNonFriendDm;
return r16;
},
getUserSettingsWithDefaults: (a0) => {
let r9 = a0;
if (a0 == null) {
const GUILD = ContentHarmTypeChannel.GUILD;
const explicitContentGuilds = ExplicitContentSettings.getSetting()?.explicitContentGuilds;
const r19 = {};
r19[GUILD] = explicitContentGuilds;
r19[ContentHarmTypeChannel.FRIEND_DM] = ExplicitContentSettings.getSetting()?.explicitContentFriendDm;
r19[ContentHarmTypeChannel.NON_FRIEND_DM] = ExplicitContentSettings.getSetting()?.explicitContentNonFriendDm;
r9 = r19;
}
const GUILD2 = ContentHarmTypeChannel.GUILD;
const setting = r9 == null ? void 0 : r9[ContentHarmTypeChannel.GUILD];
const r56 = {};
r56[GUILD2] = resolveExplicitContentSettingWithDefaults({
setting
});
r56[ContentHarmTypeChannel.FRIEND_DM] = resolveExplicitContentSettingWithDefaults({
setting: r9 == null ? void 0 : r9[ContentHarmTypeChannel.FRIEND_DM],
isDm: true,
isFriend: true
});
r56[ContentHarmTypeChannel.NON_FRIEND_DM] = resolveExplicitContentSettingWithDefaults({
setting: r9 == null ? void 0 : r9[ContentHarmTypeChannel.NON_FRIEND_DM],
isDm: true
});
return r56;
}
};
r32[r18.GORE] = {
harmType: r18.GORE,
obscureReason: ObscureReason.GORE_CONTENT,
attachmentFlag: MessageAttachmentFlags.CONTAINS_GORE_CONTENT,
embedFlag: MessageEmbedFlags.CONTAINS_GORE_CONTENT,
genericMediaFlag: ContentScanFlags.GORE,
bitmask: r22.GORE,
devSettingKey: "obscure_blur_effect_gore_content_enabled",
getProtoUserSettings: (a0) => {
const r6 = a0 == null ? void 0 : a0.textAndImages?.goreContentSettings;
const GUILD = ContentHarmTypeChannel.GUILD;
const goreContentGuilds = r6?.goreContentGuilds;
const r16 = {};
r16[GUILD] = goreContentGuilds;
r16[ContentHarmTypeChannel.FRIEND_DM] = r6?.goreContentFriendDm;
r16[ContentHarmTypeChannel.NON_FRIEND_DM] = r6?.goreContentNonFriendDm;
return r16;
},
getUserSettingsWithDefaults: (a0) => {
let r9 = a0;
if (a0 == null) {
const GUILD = ContentHarmTypeChannel.GUILD;
const goreContentGuilds = GoreContentSettings.getSetting()?.goreContentGuilds;
const r19 = {};
r19[GUILD] = goreContentGuilds;
r19[ContentHarmTypeChannel.FRIEND_DM] = GoreContentSettings.getSetting()?.goreContentFriendDm;
r19[ContentHarmTypeChannel.NON_FRIEND_DM] = GoreContentSettings.getSetting()?.goreContentNonFriendDm;
r9 = r19;
}
const GUILD2 = ContentHarmTypeChannel.GUILD;
const setting = r9 == null ? void 0 : r9[ContentHarmTypeChannel.GUILD];
const r56 = {};
r56[GUILD2] = resolveGoreSettingWithDefaults({
setting
});
r56[ContentHarmTypeChannel.FRIEND_DM] = resolveGoreSettingWithDefaults({
setting: r9 == null ? void 0 : r9[ContentHarmTypeChannel.FRIEND_DM],
isDm: true,
isFriend: true
});
r56[ContentHarmTypeChannel.NON_FRIEND_DM] = resolveGoreSettingWithDefaults({
setting: r9 == null ? void 0 : r9[ContentHarmTypeChannel.NON_FRIEND_DM],
isDm: true
});
return r56;
}
};
r32[r18.SELF_HARM] = {
harmType: r18.SELF_HARM,
obscureReason: ObscureReason.SELF_HARM_CONTENT,
attachmentFlag: MessageAttachmentFlags.CONTAINS_SELF_HARM_CONTENT,
embedFlag: MessageEmbedFlags.CONTAINS_SELF_HARM_CONTENT,
genericMediaFlag: ContentScanFlags.SELF_HARM,
bitmask: r22.SELF_HARM,
devSettingKey: "obscure_blur_effect_self_harm_content_enabled",
getProtoUserSettings: (a0) => {
const r6 = a0 == null ? void 0 : a0.textAndImages?.selfHarmContentSettings;
const GUILD = ContentHarmTypeChannel.GUILD;
const selfHarmContentGuilds = r6?.selfHarmContentGuilds;
const r16 = {};
r16[GUILD] = selfHarmContentGuilds;
r16[ContentHarmTypeChannel.FRIEND_DM] = r6?.selfHarmContentFriendDm;
r16[ContentHarmTypeChannel.NON_FRIEND_DM] = r6?.selfHarmContentNonFriendDm;
return r16;
},
getUserSettingsWithDefaults: () => {
const r1 = {};
r1[ContentHarmTypeChannel.GUILD] = ExplicitContentRedaction.UNSET_EXPLICIT_CONTENT_REDACTION;
r1[ContentHarmTypeChannel.FRIEND_DM] = ExplicitContentRedaction.UNSET_EXPLICIT_CONTENT_REDACTION;
r1[ContentHarmTypeChannel.NON_FRIEND_DM] = ExplicitContentRedaction.UNSET_EXPLICIT_CONTENT_REDACTION;
return r1;
}
};
export { r18 as ContentHarmType };
export { r22 as ContentHarmTypeBitMask };
export { r32 as CONTENT_SCAN_TYPE_REGISTRY };
@@ -0,0 +1,13 @@
// Metro module 5879 (f5880).
const r15 = {
SPOILER: "spoiler",
EXPLICIT_CONTENT: "explicit_content",
POTENTIAL_EXPLICIT_CONTENT: "potential_explicit_content",
GORE_CONTENT: "gore_content",
SELF_HARM_CONTENT: "self_harm_content"
};
const set = new Set([r15.EXPLICIT_CONTENT, r15.GORE_CONTENT, r15.SELF_HARM_CONTENT, r15.POTENTIAL_EXPLICIT_CONTENT]);
const set2 = new Set([r15.EXPLICIT_CONTENT, r15.GORE_CONTENT, r15.SELF_HARM_CONTENT]);
export { r15 as ObscureReason };
export { set as SENSITIVE_CONTENT_OBSCURABLE_REASONS };
export { set2 as AGE_VERIFICATION_OBSCURABLE_REASONS };
@@ -0,0 +1,493 @@
// Metro module 5877 (f5878).
import DevSettingsStore from "../devtools/dev_settings/DevSettingsStore";
import ChannelStore from "../../stores/ChannelStore";
import MessageStore from "../../stores/MessageStore";
import RelationshipStore from "../../stores/RelationshipStore";
import UserStore from "../../stores/UserStore";
import ExplicitMediaStore from "./ExplicitMediaStore";
import { CONTENT_SCAN_TYPE_REGISTRY, ContentHarmTypeBitMask, ContentHarmType } from "./HarmTypeConfiguration";
import { isNotNullish } from "../../utils/GlobalUtils";
import { ObscuredMediaTypes, ContentHarmTypeChannel } from "./ExplicitMediaRedactionModels";
import { ComponentType, UnfurledMediaLoadingState } from "../../flow/Server";
import { toUnfurledMediaItem } from "../media/MediaTypes";
import { hasFlag } from "../../_bundle/Module1384";
import { ExplicitContentRedaction } from "../../_bundle/Module1306";
import isForwardMessage, { isForwardServerMessage } from "../forwarding/isForwardMessage";
function $mk77285() {
return (a0) => {
let r5 = a0.isEligible == null;
if (!r5) {
const isEligible = a0.isEligible;
r5 = isEligible == null ? void 0 : isEligible.call(a0);
}
return r5;
};
}
function $mk77286($env) {
return (a0) => {
const r6 = a0.getUserSettingsWithDefaults()[$env[0]];
let r12 = r6 != null;
if (r12) {
const r4 = $env.$parent;
const r7 = r4[0];
const r13 = r4[2];
r12 = [r7(r13[13]).ExplicitContentRedaction.BLOCK, r7(r13[13]).ExplicitContentRedaction.BLUR].includes(r6);
}
return r12 ? a0.harmType : null;
};
}
function $mk77291($env) {
return (a0) => (0, $env.$parent[16])(a0, $env[0]);
}
function $mk77292($env) {
return (a0) => CONTENT_SCAN_TYPE_REGISTRY[a0].obscureReason;
}
let getEnabledHarmTypesForMessage, getEnabledHarmTypesForChannelAndAuthorId, messageHasObscurableMediaForBitmask, findComponentMedia, isMediaScanPending, isMediaFlaggedForHarmType, contentHarmTypesToFlags, getHarmTypeFromBitmask, getChannelTypeById, getChannelIdAndAuthorIdFromMessage, hasUnscannedMedia;
let $mk77289 = function() {
return (a0) => {
const type = a0.type;
if (ComponentType.MEDIA_GALLERY === type) {
return a0.items.map((item) => item.media);
}
if (ComponentType.THUMBNAIL === type) {
return a0.media;
}
if (ComponentType.FILE === type) {
return a0.file;
}
if (ComponentType.SECTION !== type && ComponentType.ACTION_ROW !== type && ComponentType.CONTAINER !== type) {
return [];
}
return a0.components.flatMap(findComponentMedia);
};
}, $mk77290 = function() {
return (a0) => "proxy_url" in a0 ? toUnfurledMediaItem(a0) : a0;
};
let env3679 = {};
export function getEligibleHarmTypesConfigsForContext() {
return Object.values(CONTENT_SCAN_TYPE_REGISTRY).filter($mk77285());
}
getEnabledHarmTypesForMessage = function getEnabledHarmTypesForMessage(a0) {
const channelIdAndAuthorIdFromMessage = getChannelIdAndAuthorIdFromMessage(a0);
const { channelId, authorId } = channelIdAndAuthorIdFromMessage;
return channelId != null && a0 != null ? getEnabledHarmTypesForChannelAndAuthorId(channelId, authorId) : ContentHarmTypeBitMask.NONE;
};
getEnabledHarmTypesForChannelAndAuthorId = function getEnabledHarmTypesForChannelAndAuthorId(a0, a1) {
let NONE2;
const currentUser = UserStore.getCurrentUser();
if (currentUser != null && a1 !== currentUser.id) {
const channelTypeById = getChannelTypeById(a0, a1, [ChannelStore, RelationshipStore]);
if (channelTypeById == null) {
NONE2 = ContentHarmTypeBitMask.NONE;
} else {
let env15231;
const r16 = env15231 = {
$parent: env3679
};
env15231[0] = channelTypeById;
const r26 = Object.values(CONTENT_SCAN_TYPE_REGISTRY).filter($mk77285());
NONE2 = channelTypeById == null ? ContentHarmTypeBitMask.NONE : contentHarmTypesToFlags(r26.map($mk77286(r16)).filter(isNotNullish));
}
return NONE2;
}
return ContentHarmTypeBitMask.NONE;
};
messageHasObscurableMediaForBitmask = function messageHasObscurableMediaForBitmask(a0, a1) {
if (a1 !== ContentHarmTypeBitMask.NONE && a0 != null) {
const attachments = a0.attachments;
if (attachments == null ? void 0 : attachments.some((attachment) => {
let r26;
let env25636;
const r2 = env3679;
const r7 = {
type: ObscuredMediaTypes.Attachment,
media: attachment
};
const r13 = env25636 = {
$parent: r2
};
env25636[0] = r7;
if (a1 === ContentHarmTypeBitMask.NONE) {
r26 = [];
} else {
const harmTypeFromBitmask = getHarmTypeFromBitmask(a1);
r26 = harmTypeFromBitmask.length === 0 ? [] : harmTypeFromBitmask.filter($mk77291(r13)).map($mk77292(r2));
}
return r26.length > 0;
})) {
return true;
}
const embeds = a0.embeds;
if (embeds == null ? void 0 : embeds.some((embed) => {
let r26;
let env25637;
const r2 = env3679;
const r7 = {
type: ObscuredMediaTypes.Embed,
media: embed
};
const r13 = env25637 = {
$parent: r2
};
env25637[0] = r7;
if (a1 === ContentHarmTypeBitMask.NONE) {
r26 = [];
} else {
const harmTypeFromBitmask = getHarmTypeFromBitmask(a1);
r26 = harmTypeFromBitmask.length === 0 ? [] : harmTypeFromBitmask.filter($mk77291(r13)).map($mk77292(r2));
}
return r26.length > 0;
})) {
return true;
}
const r38 = "messageSnapshots" in a0 ? a0.messageSnapshots : "message_snapshots" in a0 ? a0.message_snapshots : null;
if (r38 != null && r38.length !== 0) {
for (const item of r38) {
if (!messageHasObscurableMediaForBitmask(item.message, a1)) {
continue;
}
return true;
}
return false;
}
return false;
}
return false;
};
findComponentMedia = function findComponentMedia(a0) {
return (Array.isArray(a0) ? a0 : [a0]).flatMap($mk77289()).map($mk77290());
};
isMediaScanPending = function isMediaScanPending(a0, a1) {
let r95;
if (a1 === ContentHarmTypeBitMask.NONE) {
return false;
}
if (DevSettingsStore.get("explicit_media_redaction_ignore_pending_scan")) {
return false;
}
const harmTypeFromBitmask = getHarmTypeFromBitmask(a1);
if (harmTypeFromBitmask.length === 0) {
return false;
}
const type = a0.type;
if (ObscuredMediaTypes.Embed === type) {
let media3;
L82: {
media3 = a0.media;
const length3 = harmTypeFromBitmask.length;
r95 = false;
if (length3 !== 0) {
const r97 = media3 == null;
r95 = false;
if (!r97) {
const length4 = harmTypeFromBitmask.filter((item) => !isMediaFlaggedForHarmType(item, {
type: ObscuredMediaTypes.Embed,
media: media3
})).length;
r95 = false;
if (length4 !== 0) {
if ("video" in media3 && media3.video != null) {
if (media3.video?.width === 0) {
const height = media3.video?.height;
r95 = false;
if (height === 0) {
break L82;
}
}
}
if ("thumbnail" in media3 && media3.thumbnail != null) {
if (media3.thumbnail?.width === 0) {
const height2 = media3.thumbnail?.height;
r95 = false;
if (height2 === 0) {
break L82;
}
}
}
if ("image" in media3 && media3.image != null) {
if (media3.image?.width === 0) {
const height3 = media3.image?.height;
r95 = false;
if (height3 === 0) {
break L82;
}
}
}
if ("images" in media3) {
const images = media3.images;
const r133 = images == null ? void 0 : images.some((image) => image != null && image.width === 0 && image.height === 0);
r95 = false;
if (r133) {
break L82;
}
}
const r140 = media3.content_scan_version != null ? media3.content_scan_version : media3.contentScanVersion != null ? media3.contentScanVersion : media3.contentScanVersion != null ? media3.contentScanVersion : null;
r95 = r140 !== -1 && (!harmTypeFromBitmask.includes(ContentHarmType.GORE) && !harmTypeFromBitmask.includes(ContentHarmType.SELF_HARM) ? r140 == null : r140 == null || r140 < ExplicitMediaStore.validContentScanVersion);
}
}
}
}
return r95;
}
if (ObscuredMediaTypes.Attachment === type) {
const media2 = a0.media;
let r67 = harmTypeFromBitmask.length !== 0;
if (r67) {
let r72 = harmTypeFromBitmask.filter((item) => !isMediaFlaggedForHarmType(item, {
type: ObscuredMediaTypes.Attachment,
media: media2
})).length !== 0;
if (r72) {
let content_scan_version = media2.content_scan_version;
if (content_scan_version == null) {
content_scan_version = media2.contentScanVersion;
}
r72 = content_scan_version !== -1 && (!harmTypeFromBitmask.includes(ContentHarmType.GORE) && !harmTypeFromBitmask.includes(ContentHarmType.SELF_HARM) ? content_scan_version == null : content_scan_version == null || content_scan_version < ExplicitMediaStore.validContentScanVersion);
}
r67 = r72;
}
return r67;
}
if (ObscuredMediaTypes.GenericMedia === type) {
const media = a0.media;
const length = harmTypeFromBitmask.length;
let r42 = false;
if (length !== 0) {
const length2 = harmTypeFromBitmask.filter((item) => !isMediaFlaggedForHarmType(item, {
type: ObscuredMediaTypes.GenericMedia,
media
})).length;
r42 = false;
if (length2 !== 0) {
const version = media.contentScanMetadata?.version;
r42 = version !== -1 && (!harmTypeFromBitmask.includes(ContentHarmType.GORE) && !harmTypeFromBitmask.includes(ContentHarmType.SELF_HARM) ? version == null : version == null || version < ExplicitMediaStore.validContentScanVersion);
}
}
return r42;
}
return false;
};
isMediaFlaggedForHarmType = function isMediaFlaggedForHarmType(a0, a1) {
if (a0 == null) {
return false;
}
const r14 = CONTENT_SCAN_TYPE_REGISTRY[a0];
if (r14.devSettingKey != null && DevSettingsStore.get(r14.devSettingKey)) {
return true;
}
const type = a1.type;
if (ObscuredMediaTypes.Embed === type) {
let flags2 = a1.media.flags;
if (flags2 == null) {
flags2 = 0;
}
return hasFlag(flags2, r14.embedFlag);
}
if (ObscuredMediaTypes.Attachment === type) {
let flags = a1.media.flags;
if (flags == null) {
flags = 0;
}
return hasFlag(flags, r14.attachmentFlag);
}
if (ObscuredMediaTypes.GenericMedia === type) {
let r37 = a1.media.contentScanMetadata?.flags;
if (r37 == null) {
r37 = 0;
}
return hasFlag(r37, r14.genericMediaFlag);
}
return false;
};
contentHarmTypesToFlags = function contentHarmTypesToFlags(a0) {
let NONE2 = ContentHarmTypeBitMask.NONE;
for (const item of a0) {
if (ContentHarmType.EXPLICIT === item) {
NONE2 = NONE2 | require(dependencyMap[7]).ContentHarmTypeBitMask.EXPLICIT;
} else if (require(dependencyMap[7]).ContentHarmType.GORE === item) {
NONE2 = NONE2 | require(dependencyMap[7]).ContentHarmTypeBitMask.GORE;
} else if (require(dependencyMap[7]).ContentHarmType.SELF_HARM === item) {
NONE2 = NONE2 | require(dependencyMap[7]).ContentHarmTypeBitMask.SELF_HARM;
}
}
return NONE2;
};
getHarmTypeFromBitmask = function getHarmTypeFromBitmask(a0) {
if (a0 === ContentHarmTypeBitMask.NONE) {
return [];
}
const r24 = [];
for (const item of getEligibleHarmTypesConfigsForContext()) {
if ((a0 & item.bitmask) > 0) {
r24.push(item.harmType);
}
}
return r24;
};
getChannelTypeById = function getChannelTypeById(a0, a1, r5 = [ExplicitMediaStore, p]) {
const [r15, r8] = r5;
const channel = r15.getChannel(a0);
const currentUser = UserStore.getCurrentUser();
return currentUser == null ? null : a1 !== currentUser.id ? channel == null ? null : !channel.isDM() && !channel.isGroupDM() ? ContentHarmTypeChannel.GUILD : a1 != null && r8.getFriendIDs().includes(a1) ? ContentHarmTypeChannel.FRIEND_DM : ContentHarmTypeChannel.NON_FRIEND_DM : null;
};
getChannelIdAndAuthorIdFromMessage = function getChannelIdAndAuthorIdFromMessage(a0) {
let authorId;
if (a0 == null) {
return {
channelId: null,
authorId: null
};
}
const channelId = "channel_id" in a0 ? a0.channel_id : null;
const r6 = "messageReference" in a0 ? [a0.messageReference, isForwardMessage(a0)] : "message_reference" in a0 ? [a0.message_reference, isForwardServerMessage(a0)] : [];
L22: {
const [r33, r34] = r6;
if (r33 != null && r34) {
if (r33.message_id == null) {
return {
channelId,
authorId: null
};
}
const message = MessageStore.getMessage(r33.channel_id, r33.message_id);
const r48 = message != null;
authorId = null;
if (!r48) {
break L22;
}
authorId = message.author?.id;
} else {
authorId = "author" in a0 ? a0.author?.id : "author_id" in a0 ? a0.author_id : null;
}
}
return {
channelId,
authorId
};
};
export { getEnabledHarmTypesForMessage };
export { getEnabledHarmTypesForChannelAndAuthorId };
export function getEnabledHarmTypesBitmaskForChannelType(a0) {
let env15232;
const r2 = env15232 = {
$parent: env3679
};
env15232[0] = a0;
const r16 = Object.values(CONTENT_SCAN_TYPE_REGISTRY).filter($mk77285());
return a0 == null ? ContentHarmTypeBitMask.NONE : contentHarmTypesToFlags(r16.map($mk77286(r2)).filter(isNotNullish));
}
export function messageHasObscurableMedia(a0) {
const channelIdAndAuthorIdFromMessage = getChannelIdAndAuthorIdFromMessage(a0);
const { channelId, authorId } = channelIdAndAuthorIdFromMessage;
return messageHasObscurableMediaForBitmask(a0, channelId != null && a0 != null ? getEnabledHarmTypesForChannelAndAuthorId(channelId, authorId) : ContentHarmTypeBitMask.NONE);
}
export { messageHasObscurableMediaForBitmask };
hasUnscannedMedia = function hasUnscannedMedia(a0, a1) {
const r3 = a1 == null ? getEnabledHarmTypesForMessage(a0) : a1;
let c15238_0 = r3;
if (r3 === ContentHarmTypeBitMask.NONE) {
return false;
}
const attachments = a0.attachments;
if (attachments == null ? void 0 : attachments.some((attachment) => isMediaScanPending({
type: ObscuredMediaTypes.Attachment,
media: attachment
}, c15238_0))) {
return true;
}
const embeds = a0.embeds;
if (embeds == null ? void 0 : embeds.some((embed) => isMediaScanPending({
type: ObscuredMediaTypes.Embed,
media: embed
}, c15238_0))) {
return true;
}
if (a0.components != null && findComponentMedia(a0.components).some((item) => isMediaScanPending({
type: ObscuredMediaTypes.GenericMedia,
media: item
}, c15238_0))) {
return true;
}
const r47 = "messageSnapshots" in a0 ? a0.messageSnapshots : "message_snapshots" in a0 ? a0.message_snapshots : null;
if (r47 != null && r47.length !== 0) {
for (const item of r47) {
if (!hasUnscannedMedia(item.message, r3)) {
continue;
}
return true;
}
return false;
}
return false;
};
export { hasUnscannedMedia };
export function isEligibleForScanning(a0) {
let r6 = a0.components == null;
if (!r6) {
const components = a0.components;
r6 = !(Array.isArray(components) ? components : [components]).flatMap($mk77289()).map($mk77290()).some((item) => item.loadingState === UnfurledMediaLoadingState.LOADING);
}
return r6;
}
export function getUnscannedMediaIds(a0) {
const channelIdAndAuthorIdFromMessage = getChannelIdAndAuthorIdFromMessage(a0);
const { channelId, authorId } = channelIdAndAuthorIdFromMessage;
const NONE = channelId != null && a0 != null ? getEnabledHarmTypesForChannelAndAuthorId(channelId, authorId) : ContentHarmTypeBitMask.NONE;
if (NONE === ContentHarmTypeBitMask.NONE) {
return {
attachmentIds: [],
embedIds: []
};
}
const attachments = a0.attachments;
const r24 = attachments == null ? void 0 : attachments.filter((attachment) => isMediaScanPending({
type: ObscuredMediaTypes.Attachment,
media: attachment
}, NONE));
const embeds = a0.embeds;
const r29 = embeds == null ? void 0 : embeds.filter((embed) => isMediaScanPending({
type: ObscuredMediaTypes.Embed,
media: embed
}, NONE));
let attachmentIds = r24 == null ? void 0 : r24.map((item) => item.id).filter(Boolean);
if (attachmentIds == null) {
attachmentIds = [];
}
let embedIds = r29 == null ? void 0 : r29.map((item, index) => `embed_${index}`).filter(Boolean);
if (embedIds == null) {
embedIds = [];
}
return {
attachmentIds,
embedIds
};
}
export function getMediaObscuredReasonFromBitmask(a0, a1) {
let env15234;
const r2 = env3679;
const r3 = env15234 = {
$parent: env3679
};
env15234[0] = a0;
if (a1 === ContentHarmTypeBitMask.NONE) {
return [];
}
const harmTypeFromBitmask = getHarmTypeFromBitmask(a1);
return harmTypeFromBitmask.length === 0 ? [] : harmTypeFromBitmask.filter($mk77291(r3)).map($mk77292(r2));
}
export function isMediaObscuredForHarmTypes(c15240_0, a1) {
if (a1 === ContentHarmTypeBitMask.NONE) {
return false;
}
const harmTypeFromBitmask = getHarmTypeFromBitmask(a1);
return harmTypeFromBitmask.length !== 0 && harmTypeFromBitmask.filter((item) => isMediaFlaggedForHarmType(item, c15240_0)).length > 0;
}
export { isMediaScanPending };
export { isMediaFlaggedForHarmType };
export { contentHarmTypesToFlags };
export { getHarmTypeFromBitmask };
export { getChannelTypeById };
export function shouldRedactForSettingValue(a0) {
return a0 != null && [ExplicitContentRedaction.BLOCK, ExplicitContentRedaction.BLUR].includes(a0);
}
export { getChannelIdAndAuthorIdFromMessage };
@@ -0,0 +1,25 @@
// Metro module 5864 (f5865).
import { createApexExperiment } from "../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2025-09-sensitive-content-self-harm",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
export { apexExperiment as SensitiveContentSelfHarmExperiment };
export function useIsSensitiveContentSelfHarmEnabled(a0) {
return apexExperiment.useConfig({
location: a0
}).enabled;
}
export function isSensitiveContentSelfHarmEnabled(a0) {
return apexExperiment.getConfig({
location: a0
}).enabled;
}
@@ -0,0 +1,140 @@
// Metro module 5881 (f5882).
import UserStore from "../../stores/UserStore";
import { ExplicitContentFilterTypes } from "../user_settings/privacy_and_safety/DMSafetyConstants";
import { ExplicitContentRedaction } from "../../_bundle/Module1306";
import { isSettingTeenByDefault } from "../regional_feature_config/RegionalFeatureConfigUtils";
import { SettingsDefaultFeature } from "../../_bundle/Module3875";
import { ExplicitContentFilter, ExplicitContentSettings } from "../user_settings/UserSettings";
import { getShouldObscureForSetting } from "./SensitiveMediaRedactionSettingUtils";
let c3681_3, c3681_4, c3681_5, c3681_6;
const resolveExplicitContentSettingWithDefaults = function resolveExplicitContentSettingWithDefaults(a0) {
let r35, r48;
const setting = a0.setting;
let isDm = a0.isDm;
if (isDm === void 0) {
isDm = false;
}
let isFriend = a0.isFriend;
if (isFriend === void 0) {
isFriend = false;
}
if (setting != null && setting !== ExplicitContentRedaction.UNSET_EXPLICIT_CONTENT_REDACTION) {
return setting;
}
const currentUser = UserStore.getCurrentUser();
if (isSettingTeenByDefault(SettingsDefaultFeature.SENSITIVE_CONTENT)) {
if (isDm === void 0) {
isDm = false;
}
if (isFriend === void 0) {
isFriend = false;
}
r35 = isDm && !isFriend ? ExplicitContentRedaction.BLOCK : ExplicitContentRedaction.BLUR;
} else if (currentUser?.nsfwAllowed === false) {
const r43 = isDm === void 0 ? false : isDm;
const r44 = isFriend === void 0 ? false : isFriend;
if (r43) {
const setting3 = ExplicitContentFilter.getSetting();
r48 = r44 ? c3681_5[setting3] : c3681_6[setting3];
} else {
r48 = ExplicitContentRedaction.BLUR;
}
r35 = r48;
} else {
const r30 = isDm === void 0 ? false : isDm;
const r31 = isFriend === void 0 ? false : isFriend;
if (r30) {
const setting2 = ExplicitContentFilter.getSetting();
r35 = r31 ? c3681_3[setting2] : c3681_4[setting2];
} else {
r35 = ExplicitContentRedaction.SHOW;
}
}
return r35;
};
const r19 = {};
r19[ExplicitContentFilterTypes.DISABLED.valueOf()] = ExplicitContentRedaction.SHOW;
r19[ExplicitContentFilterTypes.NON_FRIENDS.valueOf()] = ExplicitContentRedaction.SHOW;
r19[ExplicitContentFilterTypes.FRIENDS_AND_NON_FRIENDS.valueOf()] = ExplicitContentRedaction.BLOCK;
c3681_3 = r19;
const r41 = {};
r41[ExplicitContentFilterTypes.DISABLED.valueOf()] = ExplicitContentRedaction.SHOW;
r41[ExplicitContentFilterTypes.NON_FRIENDS.valueOf()] = ExplicitContentRedaction.BLOCK;
r41[ExplicitContentFilterTypes.FRIENDS_AND_NON_FRIENDS.valueOf()] = ExplicitContentRedaction.BLOCK;
c3681_4 = r41;
const r63 = {};
r63[ExplicitContentFilterTypes.DISABLED.valueOf()] = ExplicitContentRedaction.BLUR;
r63[ExplicitContentFilterTypes.NON_FRIENDS.valueOf()] = ExplicitContentRedaction.BLUR;
r63[ExplicitContentFilterTypes.FRIENDS_AND_NON_FRIENDS.valueOf()] = ExplicitContentRedaction.BLOCK;
c3681_5 = r63;
const r85 = {};
r85[ExplicitContentFilterTypes.DISABLED.valueOf()] = ExplicitContentRedaction.BLUR;
r85[ExplicitContentFilterTypes.NON_FRIENDS.valueOf()] = ExplicitContentRedaction.BLOCK;
r85[ExplicitContentFilterTypes.FRIENDS_AND_NON_FRIENDS.valueOf()] = ExplicitContentRedaction.BLOCK;
c3681_6 = r85;
export { c3681_5 as TEEN_EXPLICIT_CONTENT_FILTER_TO_EXPLICIT_CONTENT_REDACTION_FRIEND_DM };
export { c3681_6 as TEEN_EXPLICIT_CONTENT_FILTER_TO_EXPLICIT_CONTENT_REDACTION_NON_FRIEND_DM };
export { resolveExplicitContentSettingWithDefaults };
export function resolveSettingWithDefaultsForTeen({ isDm = false, isFriend = false }) {
if (isDm) {
const setting = ExplicitContentFilter.getSetting();
return isFriend ? c3681_5[setting] : c3681_6[setting];
}
return ExplicitContentRedaction.BLUR;
}
export function getExplicitContentSettingOrDefault(a0) {
const r4 = a0 == null ? ExplicitContentSettings.getSetting() : a0;
return {
explicitContentGuilds: resolveExplicitContentSettingWithDefaults({
setting: r4?.explicitContentGuilds
}),
explicitContentNonFriendDm: resolveExplicitContentSettingWithDefaults({
setting: r4?.explicitContentNonFriendDm,
isDm: true
}),
explicitContentFriendDm: resolveExplicitContentSettingWithDefaults({
setting: r4?.explicitContentFriendDm,
isDm: true,
isFriend: true
})
};
}
export function updateExplicitContentSetting(a0) {
const setting = ExplicitContentSettings.getSetting();
ExplicitContentSettings.updateSetting({
...{
explicitContentGuilds: resolveExplicitContentSettingWithDefaults({
setting: setting?.explicitContentGuilds
}),
explicitContentNonFriendDm: resolveExplicitContentSettingWithDefaults({
setting: setting?.explicitContentNonFriendDm,
isDm: true
}),
explicitContentFriendDm: resolveExplicitContentSettingWithDefaults({
setting: setting?.explicitContentFriendDm,
isDm: true,
isFriend: true
})
},
...a0
});
}
export function shouldRedactMessageMediaForForum() {
if (UserStore.getCurrentUser() == null) {
return false;
}
const setting = ExplicitContentSettings.getSetting();
const r18 = resolveExplicitContentSettingWithDefaults({
setting: setting?.explicitContentGuilds
});
resolveExplicitContentSettingWithDefaults({
setting: setting?.explicitContentNonFriendDm,
isDm: true
});
resolveExplicitContentSettingWithDefaults({
setting: setting?.explicitContentFriendDm,
isDm: true,
isFriend: true
});
return getShouldObscureForSetting(r18);
}
@@ -0,0 +1,92 @@
// Metro module 5883 (f5884).
import { useMemo } from "react";
import UserStore from "../../stores/UserStore";
import { HelpdeskArticles } from "../../Constants";
import { ExplicitContentRedaction } from "../../_bundle/Module1306";
import { isSettingTeenByDefault } from "../regional_feature_config/RegionalFeatureConfigUtils";
import { SettingsDefaultFeature } from "../../_bundle/Module3875";
import { GoreContentSettings } from "../user_settings/UserSettings";
const resolveGoreSettingWithDefaults = function resolveGoreSettingWithDefaults(a0) {
let r34;
const setting = a0.setting;
let isDm = a0.isDm;
if (isDm === void 0) {
isDm = false;
}
let isFriend = a0.isFriend;
if (isFriend === void 0) {
isFriend = false;
}
if (setting != null && setting !== ExplicitContentRedaction.UNSET_EXPLICIT_CONTENT_REDACTION) {
return setting;
}
L43: {
const currentUser = UserStore.getCurrentUser();
if (isSettingTeenByDefault(SettingsDefaultFeature.SENSITIVE_CONTENT)) {
if (isDm === void 0) {
isDm = false;
}
if (isFriend === void 0) {
isFriend = false;
}
r34 = isDm && !isFriend ? ExplicitContentRedaction.BLOCK : ExplicitContentRedaction.BLUR;
} else if (currentUser?.nsfwAllowed === false) {
const r38 = isDm === void 0 ? false : isDm;
const r39 = isFriend === void 0 ? false : isFriend;
r34 = r38 && r39 ? ExplicitContentRedaction.BLUR : r38 ? ExplicitContentRedaction.BLOCK : ExplicitContentRedaction.BLUR;
} else {
const r29 = isDm === void 0 ? false : isDm;
const r30 = isFriend === void 0 ? false : isFriend;
if (r29 && r30) {
r34 = ExplicitContentRedaction.SHOW;
break L43;
}
r34 = r29 ? ExplicitContentRedaction.BLOCK : ExplicitContentRedaction.SHOW;
}
}
return r34;
};
export { resolveGoreSettingWithDefaults };
export function resolveGoreSettingWithDefaultsForTeen({ isDm = false, isFriend = false }) {
return isDm && isFriend ? ExplicitContentRedaction.BLUR : isDm ? ExplicitContentRedaction.BLOCK : ExplicitContentRedaction.BLUR;
}
export function getGoreContentSettingOrDefault(a0) {
const r4 = a0 == null ? GoreContentSettings.getSetting() : a0;
return {
goreContentGuilds: resolveGoreSettingWithDefaults({
setting: r4?.goreContentGuilds
}),
goreContentNonFriendDm: resolveGoreSettingWithDefaults({
setting: r4?.goreContentNonFriendDm,
isDm: true
}),
goreContentFriendDm: resolveGoreSettingWithDefaults({
setting: r4?.goreContentFriendDm,
isDm: true,
isFriend: true
})
};
}
export function updateGoreContentSetting(a0) {
const setting = GoreContentSettings.getSetting();
GoreContentSettings.updateSetting({
...{
goreContentGuilds: resolveGoreSettingWithDefaults({
setting: setting?.goreContentGuilds
}),
goreContentNonFriendDm: resolveGoreSettingWithDefaults({
setting: setting?.goreContentNonFriendDm,
isDm: true
}),
goreContentFriendDm: resolveGoreSettingWithDefaults({
setting: setting?.goreContentFriendDm,
isDm: true,
isFriend: true
})
},
...a0
});
}
export function useSensitiveContentFilterHelpArticle() {
return useMemo(() => HelpdeskArticles.EXPLICIT_MEDIA_REDACTION, []);
}
@@ -0,0 +1,9 @@
// Metro module 5882 (f5883).
import { ExplicitContentRedaction } from "../../_bundle/Module1306";
import { isEqual } from "../../_bundle/Module12";
export function getShouldObscureForSetting(a0) {
return a0 === ExplicitContentRedaction.BLUR || a0 === ExplicitContentRedaction.BLOCK;
}
export function areSettingsEqual(a0, a1) {
return isEqual(a0, a1);
}
@@ -0,0 +1,33 @@
// Metro module 9888 (f9889).
import { useMemo } from "react";
import UserSettingsProtoStore from "../../user_settings/UserSettingsProtoStore";
import ChannelStore from "../../../stores/ChannelStore";
import RelationshipStore from "../../../stores/RelationshipStore";
import UserStore from "../../../stores/UserStore";
import { getEligibleHarmTypesConfigsForContext, getChannelTypeById, shouldRedactForSettingValue, contentHarmTypesToFlags, getChannelIdAndAuthorIdFromMessage } from "../ObscuredMediaUtils";
import { useStateFromStores } from "../../../_bundle/Module589";
import { areSettingsEqual } from "../SensitiveMediaRedactionSettingUtils";
import { ContentHarmTypeBitMask } from "../HarmTypeConfiguration";
const useEnabledHarmTypesBitmaskForChannelAndAuthorId = function useEnabledHarmTypesBitmaskForChannelAndAuthorId(c17542_0, authorId) {
let stateFromStores2, stateFromStores3;
const eligibleHarmTypesConfigsForContext = getEligibleHarmTypesConfigsForContext();
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
stateFromStores2 = useStateFromStores([ChannelStore, RelationshipStore], () => getChannelTypeById(c17542_0, authorId, [ChannelStore, RelationshipStore]));
stateFromStores3 = useStateFromStores([UserSettingsProtoStore], () => eligibleHarmTypesConfigsForContext.reduce((acc, item) => {
const r0 = {
...acc
};
r0[item.harmType] = item.getProtoUserSettings(UserSettingsProtoStore.settings);
return r0;
}, {}), [eligibleHarmTypesConfigsForContext], areSettingsEqual);
const memo = useMemo(() => stateFromStores2 != null ? authorId !== stateFromStores?.id && stateFromStores != null ? eligibleHarmTypesConfigsForContext.map((item) => {
const r6 = stateFromStores3[item.harmType];
return shouldRedactForSettingValue(stateFromStores2 == null ? null : item.getUserSettingsWithDefaults(r6)[stateFromStores2]) ? item.harmType : null;
}).filter((item) => item != null) : [] : [], [stateFromStores2, eligibleHarmTypesConfigsForContext, stateFromStores3, authorId, stateFromStores]);
return memo.length === 0 ? ContentHarmTypeBitMask.NONE : contentHarmTypesToFlags(memo);
};
export { useEnabledHarmTypesBitmaskForChannelAndAuthorId };
export function useEnabledHarmTypesBitmaskForMessage(a0) {
const r9 = a0 == null ? {} : getChannelIdAndAuthorIdFromMessage(a0);
return useEnabledHarmTypesBitmaskForChannelAndAuthorId(r9.channelId, r9.authorId);
}
@@ -0,0 +1,51 @@
// Metro module 13851 (f13852).
import UserSettingsProtoStore from "../../user_settings/UserSettingsProtoStore";
import { useStateFromStoresObject } from "../../../_bundle/defaultAreStatesEqual";
import { getExplicitContentSettingOrDefault, resolveExplicitContentSettingWithDefaults } from "../SensitiveMediaExplicitRedactionSettingsUtils";
import { getGoreContentSettingOrDefault, resolveGoreSettingWithDefaults } from "../SensitiveMediaGoreRedactionSettingsUtils";
export function useExplicitContentSettingOrDefault() {
const stateFromStoresObject = useStateFromStoresObject([UserSettingsProtoStore], () => {
let r7 = UserSettingsProtoStore.settings.textAndImages?.explicitContentSettings;
if (r7 == null) {
r7 = getExplicitContentSettingOrDefault();
}
return r7;
});
return {
explicitContentGuilds: resolveExplicitContentSettingWithDefaults({
setting: stateFromStoresObject?.explicitContentGuilds
}),
explicitContentNonFriendDm: resolveExplicitContentSettingWithDefaults({
setting: stateFromStoresObject?.explicitContentNonFriendDm,
isDm: true
}),
explicitContentFriendDm: resolveExplicitContentSettingWithDefaults({
setting: stateFromStoresObject?.explicitContentFriendDm,
isDm: true,
isFriend: true
})
};
}
export function useGoreContentSettingOrDefault() {
const stateFromStoresObject = useStateFromStoresObject([UserSettingsProtoStore], () => {
let r7 = UserSettingsProtoStore.settings.textAndImages?.goreContentSettings;
if (r7 == null) {
r7 = getGoreContentSettingOrDefault();
}
return r7;
});
return {
goreContentGuilds: resolveGoreSettingWithDefaults({
setting: stateFromStoresObject?.goreContentGuilds
}),
goreContentNonFriendDm: resolveGoreSettingWithDefaults({
setting: stateFromStoresObject?.goreContentNonFriendDm,
isDm: true
}),
goreContentFriendDm: resolveGoreSettingWithDefaults({
setting: stateFromStoresObject?.goreContentFriendDm,
isDm: true,
isFriend: true
})
};
}
@@ -0,0 +1,80 @@
// Metro module 9889 (f9890).
import { useState, useCallback } from "react";
import { APIError } from "../../../errors/index";
export function useExplicitMediaActions({ onError, onSuccess, report }) {
const [state2, setState] = useState(false);
const state = state2;
return {
reportFalsePositive: useCallback(async () => {
let c26559_2;
let c26559_3 = 0;
let c30155_0, c30155_1;
L16: {
L15: {
try {
c30155_0 = void 0;
if (state) {
break L16;
}
setState(true);
c26559_3 = 2;
await report();
if (onSuccess != null) {
onSuccess();
}
c26559_3 = 1;
c26559_3 = 0;
(0, setState)(false);
} catch ($e) {
const r27 = $e;
let r7 = r27;
c26559_2 = r27;
let r28 = c26559_3;
if (r28 !== 0) {
while (true) {
if (r28 === 1) {
try {
const r86 = c26559_2;
c26559_3 = 0;
(0, setState)(false);
throw r86;
} catch (r84) {
r7 = r84;
c26559_2 = r84;
r28 = c26559_3;
if (r28 === 0) {
break;
}
}
} else {
try {
const r65 = c26559_2;
c26559_3 = 1;
c30155_1 = r65;
c30155_0 = new APIError(c30155_1);
if (onError != null) {
onError(c30155_0);
}
c26559_3 = 0;
(0, setState)(false);
break L15;
} catch (r63) {
r7 = r63;
c26559_2 = r63;
r28 = c26559_3;
if (r28 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
return void 0;
}
}, [state, onError, onSuccess, report]),
isReportFalsePositiveLoading: state
};
}
@@ -0,0 +1,53 @@
// Metro module 9887 (f9888).
import MessageStore from "../../../stores/MessageStore";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import { useEnabledHarmTypesBitmaskForMessage } from "./useContentHarmTypes";
import { isMediaObscuredForHarmTypes } from "../ObscuredMediaUtils";
import { ObscuredMediaTypes } from "../ExplicitMediaRedactionModels";
export function useRedactableMediaAttachmentsForMessage(c17540_0, c17540_1, a2) {
let enabledHarmTypesBitmaskForMessage;
const stateFromStores = useStateFromStores([MessageStore], () => MessageStore.getMessage(c17540_0, c17540_1));
enabledHarmTypesBitmaskForMessage = useEnabledHarmTypesBitmaskForMessage(stateFromStores);
if (stateFromStores == null) {
return [];
}
const r21 = a2 !== void 0 ? (a0) => {
const url = a0.url;
return url === a2 || a0.id === a2;
} : (a0) => isMediaObscuredForHarmTypes({
type: ObscuredMediaTypes.Attachment,
media: a0
}, enabledHarmTypesBitmaskForMessage);
const r2 = stateFromStores == null;
let r22 = void 0;
if (!r2) {
const attachments = stateFromStores.attachments;
r22 = attachments == null ? void 0 : attachments.filter(r21);
}
if (r22 == null) {
r22 = [];
}
return r22;
}
export function useRedactableMediaEmbedsForMessage(c17541_0, c17541_1, a2) {
let enabledHarmTypesBitmaskForMessage2;
const stateFromStores = useStateFromStores([MessageStore], () => MessageStore.getMessage(c17541_0, c17541_1));
enabledHarmTypesBitmaskForMessage2 = useEnabledHarmTypesBitmaskForMessage(stateFromStores);
if (stateFromStores == null) {
return [];
}
const r21 = a2 !== void 0 ? (a0) => a0.id === a2 : (a0) => isMediaObscuredForHarmTypes({
type: ObscuredMediaTypes.Embed,
media: a0
}, enabledHarmTypesBitmaskForMessage2);
const r2 = stateFromStores == null;
let r22 = void 0;
if (!r2) {
const embeds = stateFromStores.embeds;
r22 = embeds == null ? void 0 : embeds.filter(r21);
}
if (r22 == null) {
r22 = [];
}
return r22;
}
@@ -0,0 +1,5 @@
// Metro module 13854 (f13855).
import { useIsParentallyControlled } from "../../parent_tools/hooks/useParentalControlSettings";
export function useSensitiveMediaSettingDisabled() {
return useIsParentallyControlled();
}
@@ -0,0 +1,9 @@
// Metro module 11103 (f11104).
import ExplicitMediaStore from "../ExplicitMediaStore";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
export function shouldRenderReportFalsePositiveButton(a0) {
return ExplicitMediaStore.getFpMessageInfo(a0) != null;
}
export function useShouldRenderReportFalsePositiveButton(c18537_0) {
return useStateFromStores([ExplicitMediaStore], () => ExplicitMediaStore.getFpMessageInfo(c18537_0)) != null;
}
@@ -0,0 +1,165 @@
// Metro module 11067 (f11068).
import { useMemo, useCallback, useEffect } from "react";
import { View } from "react-native";
import { EXPLICIT_MEDIA_FALSE_POSITIVE_ACTION_SHEET_KEY } from "../ExplicitMediaRedactionConstants";
import { HelpdeskArticles, UserSettingsSections } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useUserIsConsideredAdult from "../../parent_tools/hooks/useUserIsConsideredAdult";
import { useIsVerifiedTeen } from "../../age_assurance/AgeVerificationUtils";
import { useShouldAgeVerifyForExplicitMedia, trackMediaRedactionAction, TrackMediaRedactionActionType } from "../ExplicitMediaRedactionUtils";
import { intl, t } from "../../../intl/index.native";
import { openUserSettings } from "../../user_settings/core/native/openUserSettings";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import Linking from "../../../lib/native/Linking";
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
import AgeVerificationActionCreators_native from "../../age_assurance/AgeVerificationActionCreators.native";
import { AgeVerificationModalEntryPoint } from "../../age_assurance/AgeVerificationAnalyticsUtils";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import { ShieldSpotIllustration } from "../../../design/assets/native";
import { Text } from "../../../design/components/Text/native/Text";
import { Button } from "../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
paddingVertical: Module712.space.PX_24,
paddingHorizontal: Module712.space.PX_24,
justifyContent: "center"
},
art: {
alignSelf: "center",
marginBottom: Module712.space.PX_16
},
infoHeader: {
marginBottom: Module712.space.PX_8,
alignItems: "center"
},
info: {
marginBottom: Module712.space.PX_24,
alignItems: "center"
},
infoDesc: {
textAlign: "center"
},
buttonsContainer: {
gap: Module712.space.PX_8
},
linkSubtext: {
textAlign: "center",
marginBottom: Module712.space.PX_8
}
});
export default function ExplicitMediaLearnMoreActionSheet(props) {
let props2;
let callback;
const { channelId, messageId, attachmentId, embedId } = props;
callback = void 0;
const styles = useStyles();
const userIsConsideredAdult = useUserIsConsideredAdult();
const isVerifiedTeen = useIsVerifiedTeen();
const shouldAgeVerifyForExplicitMedia = useShouldAgeVerifyForExplicitMedia();
const text = intl.string(t["9KiIz6"]);
let r20 = intl.string(t["5e0geG"]);
const memo = useMemo(() => {
let r0 = isVerifiedTeen;
if (isVerifiedTeen) {
r0 = shouldAgeVerifyForExplicitMedia;
}
return r0;
}, [isVerifiedTeen, shouldAgeVerifyForExplicitMedia]);
callback = useCallback((a0) => {
trackMediaRedactionAction({
action: a0,
channelId,
messageId
});
}, [channelId, messageId]);
useEffect(() => {
trackMediaRedactionAction({
action: TrackMediaRedactionActionType.EXPLICIT_MEDIA_LEARN_MORE_VIEWED,
channelId,
messageId
});
}, [channelId, messageId]);
const callback2 = useCallback(() => memo ? intl.format(t["TGqx+i"], {
handleOnHelpUrlHook: () => {
AgeVerificationActionCreators_native.openUrl(HelpdeskUtils.getArticleURL(HelpdeskArticles.TIGGER_PAWTECT_LEARN_MORE));
callback(TrackMediaRedactionActionType.EXPLICIT_MEDIA_LEARN_MORE_CLICK_AGE_VERIFY_LEARN_MORE);
}
}) : shouldAgeVerifyForExplicitMedia ? null : intl.format(t.Ge0HUi, {
handleFalsePositiveHook: () => {
ActionSheetActionCreators.hideActionSheet();
callback(TrackMediaRedactionActionType.EXPLICIT_MEDIA_LEARN_MORE_CLICK_FALSE_POSITIVE);
ActionSheetActionCreators.openLazy(import("./false_positive_reporting/ExplicitMediaObscuredFalsePositiveActionSheet"), EXPLICIT_MEDIA_FALSE_POSITIVE_ACTION_SHEET_KEY, {
channelId,
messageId,
attachmentId,
embedId
});
}
}), [memo, shouldAgeVerifyForExplicitMedia, callback, channelId, messageId, attachmentId, embedId]);
const r80 = [<View style={styles.art}>
<ShieldSpotIllustration height={120} width={120} />
</View>, , ,];
const r95 = [<Text style={styles.infoHeader} accessibilityRole="header" variant="heading-xl/bold" color="mobile-text-heading-primary">
{intl.string(t.sGW77l)}
</Text>, ,];
if (!memo) {
const r108 = intl.string(t.RUw0ZC);
let r116 = intl.string(t["E/oQYL"]);
if (userIsConsideredAdult) {
r116 = r108;
}
r20 = r116;
}
r95[1] = <Text style={styles.infoDesc} variant="text-md/medium" color="text-default">{r20}</Text>;
r80[1] = <View style={styles.info}>{r95}</View>;
const r124 = {
variant: "primary",
size: "md",
text: null,
onPress: null
};
if (memo) {
const handleAgeVerifyButtonPress = function handleAgeVerifyButtonPress() {
callback(TrackMediaRedactionActionType.EXPLICIT_MEDIA_LEARN_MORE_CLICK_AGE_VERIFY_REVERIFY);
AgeVerificationActionCreators_native.showAgeVerificationGetStartedModal({
entryPoint: AgeVerificationModalEntryPoint.SENSITIVE_MEDIA_LEARN_MORE
});
ActionSheetActionCreators.hideActionSheet();
};
r124.text = text;
r124.onPress = handleAgeVerifyButtonPress;
props2 = r124;
} else if (userIsConsideredAdult) {
const handleNavigateToSettingsButtonPress = function handleNavigateToSettingsButtonPress() {
callback(TrackMediaRedactionActionType.EXPLICIT_MEDIA_LEARN_MORE_CLICK_SETTINGS);
openUserSettings({
screen: UserSettingsSections.CONTENT_AND_SOCIAL
});
ActionSheetActionCreators.hideActionSheet();
};
r124.text = intl.string(t["9D+zGX"]);
r124.onPress = handleNavigateToSettingsButtonPress;
props2 = r124;
} else {
const handleNavigateToHelpCenterLearnMore = function handleNavigateToHelpCenterLearnMore() {
Linking.openURL(HelpdeskUtils.getArticleURL(HelpdeskArticles.EXPLICIT_MEDIA_REDACTION));
};
r124.text = intl.string(t.hvVgAZ);
r124.onPress = handleNavigateToHelpCenterLearnMore;
props2 = r124;
}
r80[2] = <View style={styles.buttonsContainer}>
<Button {...props2} />
<Button variant="secondary" size="md" text={intl.string(t.bmbHPA)} onPress={function onPress() {
callback(TrackMediaRedactionActionType.EXPLICIT_MEDIA_LEARN_MORE_CLICK_DISMISS);
ActionSheetActionCreators.hideActionSheet();
}} />
<Text style={styles.linkSubtext} variant="text-sm/medium" color="text-muted">
{callback2()}
</Text>
</View>;
return <BottomSheet startExpanded>
<View style={styles.container}>{r80}</View>
</BottomSheet>;
};
@@ -0,0 +1,77 @@
// Metro module 13852 (f13853).
import UserStore from "../../../stores/UserStore";
import { EXPLICIT_MEDIA_SETTINGS_ACTION_SHEET_KEY } from "../ExplicitMediaRedactionConstants";
import { SearchMediaTypes } from "../../search/SearchConstants";
import { ExplicitContentRedaction } from "../../../_bundle/Module1306";
import { intl, t } from "../../../intl/index.native";
import { shouldAgeVerifyForExplicitMedia } from "../ExplicitMediaRedactionUtils";
import AgeVerificationActionCreators_native from "../../age_assurance/AgeVerificationActionCreators.native";
import { AgeVerificationModalEntryPoint } from "../../age_assurance/AgeVerificationAnalyticsUtils";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { getEnabledHarmTypesForMessage, isMediaObscuredForHarmTypes } from "../ObscuredMediaUtils";
import { ObscuredMediaTypes } from "../ExplicitMediaRedactionModels";
export function handleSensitiveMediaFilterPress({ title, subtitle, handlePress, excluded, currentValue }) {
const nsfwAllowed = UserStore.getCurrentUser()?.nsfwAllowed;
const r7 = excluded == null ? void 0 : excluded.includes(ExplicitContentRedaction.SHOW);
const r26 = r7 ? !r7 : nsfwAllowed;
const options = [];
if (r26) {
options.push({
value: ExplicitContentRedaction.SHOW,
label: intl.string(t["5k5OFp"]),
onPress: () => {
if (shouldAgeVerifyForExplicitMedia()) {
AgeVerificationActionCreators_native.showAgeVerificationGetStartedModal({
entryPoint: AgeVerificationModalEntryPoint.OBSCURED_MEDIA
});
} else {
handlePress(ExplicitContentRedaction.SHOW);
}
}
});
}
if (!(excluded == null ? void 0 : excluded.includes(ExplicitContentRedaction.BLUR))) {
options.push({
value: ExplicitContentRedaction.BLUR,
label: intl.string(t.S49Uad),
onPress: () => {
handlePress(ExplicitContentRedaction.BLUR);
}
});
}
if (!(excluded == null ? void 0 : excluded.includes(ExplicitContentRedaction.BLOCK))) {
options.push({
value: ExplicitContentRedaction.BLOCK,
label: intl.string(t["D/157Y"]),
onPress: () => {
handlePress(ExplicitContentRedaction.BLOCK);
}
});
}
ActionSheetActionCreators.openLazy(import("./ExplicitMediaSettingsActionSheet"), EXPLICIT_MEDIA_SETTINGS_ACTION_SHEET_KEY, {
title,
subtitle,
options,
currentValue
});
}
export function shouldAgeVerifyForSearchMedia(a0, a1) {
if (a1 == null) {
return false;
}
const enabledHarmTypesForMessage = getEnabledHarmTypesForMessage(a1);
if (enabledHarmTypesForMessage === 0) {
return false;
}
const r19 = a0.type === SearchMediaTypes.ATTACHMENT ? {
type: ObscuredMediaTypes.Attachment,
media: a0.attachment
} : a0.type === SearchMediaTypes.EMBED ? {
type: ObscuredMediaTypes.Embed,
media: a0.embed
} : a0.type === SearchMediaTypes.COMPONENT ? {
type: ObscuredMediaTypes.GenericMedia,
media: a0.unfurledMediaItem
} : null;
return r19 != null && (isMediaObscuredForHarmTypes(r19, enabledHarmTypesForMessage) && shouldAgeVerifyForExplicitMedia());
}
@@ -0,0 +1,39 @@
// Metro module 13853 (f13854).
import { useCallback } from "react";
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetTitleHeader } from "../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { TableRadioGroup } from "../../../design/components/TableRow/native/TableRadioGroup.native";
import { ExplicitContentRedaction } from "../../../_bundle/Module1306";
import { TableRadioRow } from "../../../design/components/TableRow/native/TableRadioRow.native";
const useStyles = createStyles({
content: {
marginTop: Module712.space.PX_24,
paddingHorizontal: Module712.space.PX_16
}
});
export default function ExplicitMediaSettingsActionSheet(props) {
const { title, subtitle, options } = props;
let currentValue = props.currentValue;
const styles = useStyles();
const callback = useCallback((c27580_0) => {
const r7 = options.find((option) => option.value === c27580_0);
if (r7 != null) {
r7.onPress();
ActionSheetActionCreators.hideActionSheet();
}
}, [options]);
const r28 = [<BottomSheetTitleHeader title={title} subtitle={subtitle} />, ,];
if (currentValue == null) {
currentValue = ExplicitContentRedaction.SHOW;
}
r28[1] = <View style={styles.content}>
<TableRadioGroup defaultValue={currentValue} onChange={callback} hasIcons={false}>
{options.map((option) => <TableRadioRow key={option.value} label={option.label} value={option.value} />)}
</TableRadioGroup>
</View>;
return <BottomSheet startExpanded>{r28}</BottomSheet>;
};
@@ -0,0 +1,137 @@
// Metro module 9890 (f9891).
import { useCallback, useEffect } from "react";
import { Image as Image2, ScrollView, View } from "react-native";
import { isVideo } from "../../../../utils/native/UploadUtils";
import Video from "../../../../_bundle/Video_8143";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { generateBoxShadowStyle, FOUR_DP_ELEVATION_SHADOW_PARAMS } from "../../../../design/void/native";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import ToastActionCreators from "../../../toast/native/ToastActionCreators";
import Module9029 from "../../../../_bundle/Module9029";
import { ShieldIcon } from "../../../../design/components/Icon/native/redesign/generated/ShieldIcon";
import { intl, t } from "../../../../intl/index.native";
import { presentError } from "../../../toast/native/ToastUtils";
import { trackMediaRedactionAction, TrackMediaRedactionActionType } from "../../ExplicitMediaRedactionUtils";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import { Text } from "../../../../design/components/Text/native/Text";
import { Button } from "../../../../design/components/Button/native/Button.native";
let ExplicitMediaFalsePositivePreviewAttachment, ExplicitMediaFalsePositivePreview, useStyles;
const ExplicitMediaFalsePositivePreviewEmbed = function ExplicitMediaFalsePositivePreviewEmbed(props) {
const embed = props.embed;
const url = embed.video !== void 0 && embed.type !== "gifv" ? embed.video.url : embed.thumbnail?.url;
return url != null ? <ExplicitMediaFalsePositivePreview url={url} /> : null;
};
ExplicitMediaFalsePositivePreviewAttachment = function ExplicitMediaFalsePositivePreviewAttachment(props) {
const url = props.attachment.url;
return url != null ? <ExplicitMediaFalsePositivePreview url={url} /> : null;
};
ExplicitMediaFalsePositivePreview = function ExplicitMediaFalsePositivePreview(props) {
const url = props.url;
const styles = useStyles();
return <View style={[styles.mediaContainer, styles.elevationShadow]}>
{isVideo(url) ? <Video volume={0} resizeMode="cover" repeat style={styles.media} source={{
uri: url
}} controls paused /> : <Image2 style={[styles.media, styles.image]} source={{
uri: url
}} />}
</View>;
};
useStyles = createStyles({
content: {
padding: Module712.space.PX_16
},
contentContainer: {
justifyContent: "center",
textAlign: "center",
alignItems: "center"
},
heading: {
marginBottom: Module712.space.PX_8
},
mediaContainer: {
width: "100%",
padding: Module712.space.PX_16,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.xs,
marginTop: Module712.space.PX_8,
aspectRatio: "4 / 3"
},
elevationShadow: generateBoxShadowStyle(FOUR_DP_ELEVATION_SHADOW_PARAMS),
image: {
resizeMode: "contain"
},
media: {
flex: 1,
borderRadius: Module712.radii.xs
},
footer: {
backgroundColor: Module712.colors.MOBILE_ACTIONSHEET_GRADIENT_BACKGROUND_DEFAULT,
paddingVertical: Module712.space.PX_12,
paddingHorizontal: Module712.space.PX_16,
gap: Module712.space.PX_8
}
});
export function handleSuccess(a0) {
ActionSheetActionCreators.hideActionSheet(a0);
ToastActionCreators.open({
key: "explicit_media_report_false_positive_success",
icon: Module9029,
IconComponent: ShieldIcon,
iconColor: "text-brand",
content: intl.string(t.gFsTKu)
});
}
export function handleError() {
presentError(intl.string(t.R0RpRX));
}
export function ExplicitMediaFalsePositiveActionSheet(props) {
const { channelId, messageId, isReportFalsePositiveLoading, attachmentPreview, embedPreview, onConfirmPress, analyticsContext } = props;
const styles = useStyles();
const callback = useCallback(() => {
trackMediaRedactionAction({
action: TrackMediaRedactionActionType.EXPLICIT_MEDIA_FALSE_POSITIVE_CLICK_CANCEL,
channelId,
messageId,
context: analyticsContext
});
ActionSheetActionCreators.hideActionSheet();
}, [channelId, messageId, analyticsContext]);
const callback2 = useCallback(() => {
if (onConfirmPress != null) {
onConfirmPress();
}
trackMediaRedactionAction({
action: TrackMediaRedactionActionType.EXPLICIT_MEDIA_FALSE_POSITIVE_CLICK_CONFIRM,
channelId,
messageId,
context: analyticsContext
});
}, [channelId, messageId, analyticsContext, onConfirmPress]);
useEffect(() => {
trackMediaRedactionAction({
action: TrackMediaRedactionActionType.EXPLICIT_MEDIA_FALSE_POSITIVE_VIEWED,
channelId,
messageId,
context: analyticsContext
});
}, [channelId, messageId, analyticsContext]);
return <BottomSheet startExpanded>
<View>
<ScrollView style={styles.content} contentContainerStyle={styles.contentContainer}>
<Text style={styles.heading} variant="heading-lg/bold">
{intl.string(t.TPpVkI)}
</Text>
<Text variant="text-sm/normal">
{intl.string(t["z4du/I"])}
</Text>
{attachmentPreview != null && <ExplicitMediaFalsePositivePreviewAttachment attachment={attachmentPreview} />}
{embedPreview != null && <ExplicitMediaFalsePositivePreviewEmbed embed={embedPreview} />}
</ScrollView>
<View style={styles.footer}>
<Button variant="primary" size="md" disabled={isReportFalsePositiveLoading} loading={isReportFalsePositiveLoading} text={intl.string(t["cY+Oob"])} onPress={callback2} />
<Button variant="secondary" size="md" text={intl.string(t["ETE/oC"])} onPress={callback} />
</View>
</View>
</BottomSheet>;
}
@@ -0,0 +1,51 @@
// Metro module 9886 (f9887).
import { useCallback } from "react";
import { EXPLICIT_MEDIA_FALSE_POSITIVE_ACTION_SHEET_KEY } from "../../ExplicitMediaRedactionConstants";
import { useRedactableMediaAttachmentsForMessage, useRedactableMediaEmbedsForMessage } from "../../hooks/useExplicitMediaAttachmentsForMessage";
import { useExplicitMediaActions } from "../../hooks/useExplicitMediaActions";
import { handleSuccess, handleError, ExplicitMediaFalsePositiveActionSheet } from "./ExplicitMediaFalsePositiveActionSheet";
import * as _ExplicitMediaRedactionActionCreators from "../../ExplicitMediaRedactionActionCreators";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { TrackMediaRedactionContext } from "../../ExplicitMediaRedactionUtils";
export default function ExplicitMediaObscuredFalsePositiveActionSheet(props) {
let reportFalsePositive;
const { channelId, messageId, attachmentId, embedId } = props;
reportFalsePositive = void 0;
const redactableMediaAttachmentsForMessage = useRedactableMediaAttachmentsForMessage(channelId, messageId, attachmentId);
const redactableMediaEmbedsForMessage = useRedactableMediaEmbedsForMessage(channelId, messageId, embedId);
const explicitMediaActions = useExplicitMediaActions({
onSuccess: () => handleSuccess(EXPLICIT_MEDIA_FALSE_POSITIVE_ACTION_SHEET_KEY),
onError: () => handleError(),
report: () => {
let r20 = redactableMediaAttachmentsForMessage == null ? void 0 : redactableMediaAttachmentsForMessage.map((item) => item.id);
if (r20 == null) {
r20 = [];
}
let r24 = redactableMediaEmbedsForMessage.map((item) => item.id);
if (r24 == null) {
r24 = [];
}
return _ExplicitMediaRedactionActionCreators.reportFalsePositive(channelId, messageId, r20, r24);
}
});
reportFalsePositive = explicitMediaActions.reportFalsePositive;
const isReportFalsePositiveLoading = explicitMediaActions.isReportFalsePositiveLoading;
let r32 = redactableMediaAttachmentsForMessage?.length;
if (r32 == null) {
r32 = 0;
}
let r33 = r32 > 0;
if (!r33) {
let r34 = redactableMediaEmbedsForMessage?.length;
if (r34 == null) {
r34 = 0;
}
r33 = r34 > 0;
}
if (!r33) {
ActionSheetActionCreators.hideActionSheet();
}
return <ExplicitMediaFalsePositiveActionSheet channelId={channelId} messageId={messageId} isReportFalsePositiveLoading={isReportFalsePositiveLoading} attachmentPreview={redactableMediaAttachmentsForMessage.length === 1 ? redactableMediaAttachmentsForMessage[0] : void 0} embedPreview={redactableMediaEmbedsForMessage.length === 1 ? redactableMediaEmbedsForMessage[0] : void 0} onConfirmPress={useCallback(() => {
reportFalsePositive();
}, [reportFalsePositive])} analyticsContext={TrackMediaRedactionContext.EXPLICIT_MEDIA_OBSCURED_FALSE_POSITIVE_FLOW} />;
};
@@ -0,0 +1,37 @@
// Metro module 11106 (f11107).
import { useCallback } from "react";
import ExplicitMediaStore from "../../ExplicitMediaStore";
import { EXPLICIT_MEDIA_SENDER_FALSE_POSITIVE_ACTION_SHEET_KEY } from "../../ExplicitMediaRedactionConstants";
import { useStateFromStores } from "../../../../_bundle/defaultAreStatesEqual";
import { useExplicitMediaActions } from "../../hooks/useExplicitMediaActions";
import { handleSuccess, handleError, ExplicitMediaFalsePositiveActionSheet } from "./ExplicitMediaFalsePositiveActionSheet";
import ExplicitMediaFalsePositiveActionCreators from "../../ExplicitMediaFalsePositiveActionCreators";
import { reportFailedSendFalsePositive } from "../../ExplicitMediaRedactionActionCreators";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { TrackMediaRedactionContext } from "../../ExplicitMediaRedactionUtils";
export default function ExplicitMediaObscuredFalsePositiveActionSheet(props) {
let c18538_2, c18538_3, reportFalsePositive;
const { channelId, messageId } = props;
c18538_2 = void 0;
c18538_3 = void 0;
reportFalsePositive = void 0;
const stateFromStores = useStateFromStores([ExplicitMediaStore], () => ExplicitMediaStore.getFpMessageInfo(messageId));
c18538_2 = stateFromStores.attachments.map((attachment) => attachment.id);
c18538_3 = stateFromStores.attachments.map((attachment) => attachment.filename);
const explicitMediaActions = useExplicitMediaActions({
onSuccess: () => {
handleSuccess(EXPLICIT_MEDIA_SENDER_FALSE_POSITIVE_ACTION_SHEET_KEY);
ExplicitMediaFalsePositiveActionCreators.disableFalsePositiveButton(channelId, messageId);
},
onError: () => handleError(),
report: () => reportFailedSendFalsePositive(channelId, messageId, c18538_2, c18538_3)
});
reportFalsePositive = explicitMediaActions.reportFalsePositive;
const isReportFalsePositiveLoading = explicitMediaActions.isReportFalsePositiveLoading;
if (!(stateFromStores.attachments.length > 0)) {
ActionSheetActionCreators.hideActionSheet();
}
return <ExplicitMediaFalsePositiveActionSheet channelId={channelId} messageId={messageId} isReportFalsePositiveLoading={isReportFalsePositiveLoading} onConfirmPress={useCallback(() => {
reportFalsePositive();
}, [reportFalsePositive])} analyticsContext={TrackMediaRedactionContext.EXPLICIT_MEDIA_SENDER_FALSE_POSITIVE_FLOW} />;
};