/* Metro module 4838; source: modules/explicit_media_redaction/ObscuredMediaUtils.tsx; dependencies: [57, 4649, 1379, 4814, 3793, 1878, 4822, 4839, 1360, 4841, 1909, 4630, 1391, 1314, 4845, 2] */ import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */ import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */ import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */ import RelationshipStore from '../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */ import DevSettingsStore from '../devtools/dev_settings/DevSettingsStore.tsx'; /* Metro dependency 4649 */ import MessageStore from '../../stores/MessageStore.tsx'; /* Metro dependency 4814 */ import ExplicitMediaStore from './ExplicitMediaStore.tsx'; /* Metro dependency 4822 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as Preloaded_user_settingsModule from '../../external/discord_common/js/packages/protos/discord_protos/discord_users/v1/preloaded_user_settings.tsx'; /* Metro dependency 1314 */ import * as ServerModule from '../../flow/Server.tsx'; /* Metro dependency 1909 */ import * as HarmTypeConfigurationModule from './HarmTypeConfiguration.tsx'; /* Metro dependency 4839 */ import * as ExplicitMediaRedactionModelsModule from './ExplicitMediaRedactionModels.tsx'; /* Metro dependency 4841 */ function _fun42330(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#42330, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:6, offset: 0x01135fcb, size: 493 bytes, params: 8, frame: 29 const env0_0 = require; const _arrayLikeToArray_42333 = function(a0, a1) { var r0; var r1; var r2; var value3; var length; var value5; var value = undefined; var value2 = value == null; reducibleJoin2: while (true) { if (value2) { r0 = value2; break reducibleJoin2; } value3 = value > a0.length; r0 = value3; break reducibleJoin2; } reducibleJoin4: while (true) { if (r0) { length = a0.length; r1 = length; break reducibleJoin4; } r1 = value; break reducibleJoin4; } value = (0, global.Array)(r1); var value4 = 0; if (value4 < r1) { r2 = value4; reducibleLoop5: while (true) { value[r2] = a0[r2]; value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1; if (value5 < r1) { r2 = value5; continue reducibleLoop5; } break reducibleLoop5; } } return value; }; const messageHasObscurableMediaForBitmask2 = messageHasObscurableMediaForBitmask; const findComponentMedia = function(a0) { var value = a0; var Array = global.Array; return (Array.isArray(value) ? value : [value]).flatMap(_fun42338).map(_fun42340); }; const getMediaObscuredReasonFromBitmask2 = getMediaObscuredReasonFromBitmask; const isMediaScanPending2 = isMediaScanPending; const isMediaFlaggedForHarmType2 = isMediaFlaggedForHarmType; const contentHarmTypesToFlags2 = contentHarmTypesToFlags; const getHarmTypeFromBitmask2 = getHarmTypeFromBitmask; const getChannelTypeById2 = getChannelTypeById; const shouldRedactForSettingValue2 = shouldRedactForSettingValue; const getChannelIdAndAuthorIdFromMessage2 = getChannelIdAndAuthorIdFromMessage; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const getEligibleHarmTypesConfigsForContext2 = getEligibleHarmTypesConfigsForContext; const getEnabledHarmTypesForMessage2 = getEnabledHarmTypesForMessage; const getEnabledHarmTypesForChannelAndAuthorId2 = getEnabledHarmTypesForChannelAndAuthorId; const getEnabledHarmTypesBitmaskForChannelType2 = getEnabledHarmTypesBitmaskForChannelType; (FileImportTrackerModule).fileFinishedImporting('modules/explicit_media_redaction/ObscuredMediaUtils.tsx'); exports.getEligibleHarmTypesConfigsForContext = getEligibleHarmTypesConfigsForContext2; exports.getEnabledHarmTypesForMessage = getEnabledHarmTypesForMessage2; exports.getEnabledHarmTypesForChannelAndAuthorId = getEnabledHarmTypesForChannelAndAuthorId2; exports.getEnabledHarmTypesBitmaskForChannelType = getEnabledHarmTypesBitmaskForChannelType2; exports.messageHasObscurableMedia = function(a0) { return messageHasObscurableMediaForBitmask(a0, getEnabledHarmTypesForMessage(a0)); }; exports.messageHasObscurableMediaForBitmask = messageHasObscurableMediaForBitmask2; exports.hasUnscannedMedia = hasUnscannedMedia; exports.isEligibleForScanning = isEligibleForScanning; exports.getUnscannedMediaIds = getUnscannedMediaIds; exports.getMediaObscuredReasonFromBitmask = getMediaObscuredReasonFromBitmask2; exports.isMediaObscuredForHarmTypes = isMediaObscuredForHarmTypes; exports.isMediaScanPending = isMediaScanPending2; exports.isMediaFlaggedForHarmType = isMediaFlaggedForHarmType2; exports.contentHarmTypesToFlags = contentHarmTypesToFlags2; exports.getHarmTypeFromBitmask = getHarmTypeFromBitmask2; exports.getChannelTypeById = getChannelTypeById2; exports.shouldRedactForSettingValue = shouldRedactForSettingValue2; exports.getChannelIdAndAuthorIdFromMessage = getChannelIdAndAuthorIdFromMessage2; function _createForOfIteratorHelperLoose_42331(a0, a1) { // fn#42331, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:170, offset: 0x011361b8, size: 370 bytes, params: 3, frame: 20 var r6; var r9; var r5; var value3; var regexp; const env0_0 = a0; const Symbol = global.Symbol; let value = typeof Symbol !== 'undefined'; let r1 = value && a0[global.Symbol.iterator]; r1 = !r1 ? a0['@@iterator'] : r1; if (r1) { value = r1.call(a0); return value.next.bind(value); } const Array = global.Array; if (Array.isArray(a0)) { if (r1) { } return _fun42332; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_42333(a0, value); r5 = value; } else { value3 = ({}).toString.call(a0).slice(8, -1); r6 = value3 === 'Object' && a0.constructor; r9 = r6 ? a0.constructor.name : value3; if (r9 === 'Map') { r6 = global.Array.from(a0); } else if (r9 === 'Set') { r6 = global.Array.from(a0); } else if (r9 === 'Arguments') { value = _arrayLikeToArray_42333(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_42333(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun42332; } const TypeError = global.TypeError; throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); function _fun42332() { // fn#42332, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:741, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5 return env0_1 >= env0_0.length ? {done: true} : {done: false, value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]}; } } function messageHasObscurableMediaForBitmask(a0, a1) { // fn#42334, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:2029, offset: 0x0113632a, size: 277 bytes, params: 3, frame: 19 var messageHasObscurableMediaForBitmaskBinding; var value8; var message; var value9; const env0_0 = a1; const value2 = undefined; const ContentHarmTypeBitMask = (HarmTypeConfigurationModule).ContentHarmTypeBitMask; const NONE = ContentHarmTypeBitMask.NONE; if (a1 === NONE) { return false; } const value3 = null; if (value3 == a0) { return false; } const attachments = a0.attachments; let r1 = value3 == attachments ? value2 : attachments.some(function(a0) { var getMediaObscuredReasonFromBitmaskBinding = getMediaObscuredReasonFromBitmask; var object = {}; object.type = require(dependencyMap[9]).ObscuredMediaTypes.Attachment; object.media = a0; return getMediaObscuredReasonFromBitmaskBinding(object, require).length > 0; }); if (!r1) { var embeds = a0.embeds; r1 = value3 == embeds ? value2 : embeds.some(function(a0) { var getMediaObscuredReasonFromBitmaskBinding = getMediaObscuredReasonFromBitmask; var object = {}; object.type = require(dependencyMap[9]).ObscuredMediaTypes.Embed; object.media = a0; return getMediaObscuredReasonFromBitmaskBinding(object, require).length > 0; }); if (r1) { return true; } r1 = 'messageSnapshots' in a0 ? a0.messageSnapshots : 'message_snapshots' in a0 ? a0.message_snapshots : value3; if (value3 == r1) { return false; } if (r1.length === 0) { return false; } var value6 = _createForOfIteratorHelperLoose_42331(r1); var value7 = value6(); var done = value7.done; if (done) { return false; } r1 = value7; loopExit15: while (true) { messageHasObscurableMediaForBitmaskBinding = messageHasObscurableMediaForBitmask; value8 = r1.value; message = value8.message; if (messageHasObscurableMediaForBitmaskBinding(message, a1)) { break loopExit15; } value9 = value6(); done = value9.done; if (done) { return false; } r1 = value9; continue; } } return true; } function findComponentMedia(a0) { // fn#42337, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:2728, offset: 0x011364e1, size: 73 bytes, params: 2, frame: 12 let value = a0; const Array = global.Array; value = (Array.isArray(value) ? value : [value]).flatMap(_fun42338); return value.map(_fun42340); function _fun42338(a0) { // fn#42338, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:2799, offset: 0x0113652a, size: 293 bytes, params: 2, frame: 15 var components; const type = a0.type; const ComponentType = (ServerModule).ComponentType; const MEDIA_GALLERY = ComponentType.MEDIA_GALLERY; if (MEDIA_GALLERY === type) { return a0.items.map(function(a0) { return a0.media; }); } const THUMBNAIL = ComponentType.THUMBNAIL; if (THUMBNAIL === type) { return a0.media; } const FILE = ComponentType.FILE; if (FILE === type) { return a0.file; } const SECTION = ComponentType.SECTION; if (SECTION === type) { components = a0.components; return components.flatMap(findComponentMedia); } const ACTION_ROW = ComponentType.ACTION_ROW; if (ACTION_ROW === type) { components = a0.components; return components.flatMap(findComponentMedia); } const CONTAINER = ComponentType.CONTAINER; if (CONTAINER === type) { components = a0.components; return components.flatMap(findComponentMedia); } return []; } function _fun42340(a0) { // fn#42340, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:3186, offset: 0x0113665a, size: 55 bytes, params: 2, frame: 13 var r0; var value2; let value = a0; if ('proxy_url' in value) { value2 = environment.__proto__; value = (require(4630) /* metro dependency 4630: MediaTypes */).toUnfurledMediaItem(value); r0 = value; } else { r0 = value; } return r0; } } function getMediaObscuredReasonFromBitmask(a0, a1) { // fn#42341, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:3242, offset: 0x01136691, size: 117 bytes, params: 3, frame: 14 var r0; const env0_0 = a0; var value; const ContentHarmTypeBitMask = (HarmTypeConfigurationModule).ContentHarmTypeBitMask; const NONE = ContentHarmTypeBitMask.NONE; if (a1 === NONE) { return []; } if (getHarmTypeFromBitmask(a1).length === 0) { r0 = []; } else { value = value.filter(_fun42342); value = value.map(function(a0) { var CONTENT_SCAN_TYPE_REGISTRY = require(dependencyMap[7]).CONTENT_SCAN_TYPE_REGISTRY; return CONTENT_SCAN_TYPE_REGISTRY[a0].obscureReason; }); r0 = value; } return r0; function _fun42342(a0) { // fn#42342, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:3408, offset: 0x01136706, size: 27 bytes, params: 2, frame: 13 return isMediaFlaggedForHarmType(a0, env0_0); } } function isMediaScanPending(a0, a1) { // fn#42344, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:3507, offset: 0x0113674f, size: 281 bytes, params: 3, frame: 18 const ContentHarmTypeBitMask = (HarmTypeConfigurationModule).ContentHarmTypeBitMask; const NONE = ContentHarmTypeBitMask.NONE; if (a1 !== NONE) { var devSettingsStoreBinding = DevSettingsStore; var get = devSettingsStoreBinding.get; if (Reflect.apply(get, devSettingsStoreBinding, ['explicit_media_redaction_ignore_pending_scan'])) { return false; } var harmTypeFromBitmask = getHarmTypeFromBitmask(a1); if (harmTypeFromBitmask.length === 0) { return false; } var type = a0.type; var ObscuredMediaTypes = (require(4841) /* metro dependency 4841: ExplicitMediaRedactionModels */).ObscuredMediaTypes; var Embed = ObscuredMediaTypes.Embed; if (Embed === type) { return shouldScanEmbed(a0.media, harmTypeFromBitmask); } ObscuredMediaTypes = (require(4841) /* metro dependency 4841: ExplicitMediaRedactionModels */).ObscuredMediaTypes; var Attachment = ObscuredMediaTypes.Attachment; if (Attachment === type) { return shouldScanAttachment(a0.media, harmTypeFromBitmask); } ObscuredMediaTypes = (require(4841) /* metro dependency 4841: ExplicitMediaRedactionModels */).ObscuredMediaTypes; var GenericMedia = ObscuredMediaTypes.GenericMedia; if (GenericMedia === type) { return shouldScanGenericMedia(a0.media, harmTypeFromBitmask); } } return false; function shouldScanEmbed(a0, a1) { // fn#42345, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:3777, owner: isMediaScanPending.shouldScanEmbed, offset: 0x01136868, size: 413 bytes, params: 3, frame: 18 var environment; var width; var height; var r2; var value; var filter; var video; var value2; var thumbnail; var value3; var image; var value4; var images; var some; var value5; var shouldScanForContentScanVersionBinding; var content_scan_version; var contentScanVersion; const env0_0 = a0; let length = a1.length; if (length !== 0) { value = null; reducibleJoin42: while (true) { if (value != a0) { filter = a1.filter; length = Reflect.apply(filter, a1, [_fun42346]).length; if (length === 0) { return false; } if ('video' in a0) { video = a0.video; reducibleJoin11: while (true) { if (value == video) { break reducibleJoin11; } video = a0.video; value2 = undefined; reducibleJoin7: while (true) { if (value == video) { width = value2; break reducibleJoin7; } width = video.width; break reducibleJoin7; } if (width !== 0) { break reducibleJoin11; } video = a0.video; reducibleJoin10: while (true) { if (value == video) { height = value2; break reducibleJoin10; } height = video.height; break reducibleJoin10; } if (height === 0) { return false; } break reducibleJoin11; } } if ('thumbnail' in a0) { thumbnail = a0.thumbnail; reducibleJoin19: while (true) { if (value == thumbnail) { break reducibleJoin19; } thumbnail = a0.thumbnail; value3 = undefined; reducibleJoin15: while (true) { if (value == thumbnail) { width = value3; break reducibleJoin15; } width = thumbnail.width; break reducibleJoin15; } if (width !== 0) { break reducibleJoin19; } thumbnail = a0.thumbnail; reducibleJoin18: while (true) { if (value == thumbnail) { height = value3; break reducibleJoin18; } height = thumbnail.height; break reducibleJoin18; } if (height === 0) { return false; } break reducibleJoin19; } } if ('image' in a0) { image = a0.image; reducibleJoin27: while (true) { if (value == image) { break reducibleJoin27; } image = a0.image; value4 = undefined; reducibleJoin23: while (true) { if (value == image) { width = value4; break reducibleJoin23; } width = image.width; break reducibleJoin23; } if (width !== 0) { break reducibleJoin27; } image = a0.image; reducibleJoin26: while (true) { if (value == image) { height = value4; break reducibleJoin26; } height = image.height; break reducibleJoin26; } if (height === 0) { return false; } break reducibleJoin27; } } if ('images' in a0) { images = a0.images; reducibleJoin30: while (true) { if (value == images) { break reducibleJoin30; } some = images.some; if (Reflect.apply(some, images, [function(a0) { return a0 != null && a0.width === 0 && a0.height === 0; }])) { return false; } break reducibleJoin30; } } value5 = environment.__proto__; shouldScanForContentScanVersionBinding = shouldScanForContentScanVersion; content_scan_version = a0.content_scan_version; if (value != content_scan_version) { content_scan_version = a0.content_scan_version; r2 = content_scan_version; } else { contentScanVersion = a0.contentScanVersion; if (value != contentScanVersion) { contentScanVersion = a0.contentScanVersion; r2 = contentScanVersion; } else { contentScanVersion = a0.contentScanVersion; reducibleJoin36: while (true) { if (value != contentScanVersion) { contentScanVersion = a0.contentScanVersion; r2 = contentScanVersion; break reducibleJoin36; } r2 = value; break reducibleJoin36; } } } return shouldScanForContentScanVersionBinding(r2, a1); } break reducibleJoin42; } } return false; function _fun42346(a0) { // fn#42346, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:3876, offset: 0x01136a05, size: 73 bytes, params: 2, frame: 14 const isMediaFlaggedForHarmTypeBinding = isMediaFlaggedForHarmType; const ObscuredMediaTypes = (ExplicitMediaRedactionModelsModule).ObscuredMediaTypes; const Embed = ObscuredMediaTypes.Embed; return !isMediaFlaggedForHarmTypeBinding(a0, {type: Embed, media: env0_0}); } } function shouldScanAttachment(a0, a1) { // fn#42348, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:4788, owner: isMediaScanPending.shouldScanAttachment, offset: 0x01136a75, size: 91 bytes, params: 3, frame: 16 var environment; var r1; var r0; const env0_0 = a0; let value = a1.length !== 0; if (value) { value = a1.filter(_fun42349).length !== 0; if (value) { value = environment.__proto__; value = shouldScanForContentScanVersion(a0.content_scan_version ?? a0.contentScanVersion, a1); r1 = value; } else { r1 = value; } r0 = r1; } else { r0 = value; } return r0; function _fun42349(a0) { // fn#42349, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:4865, offset: 0x01136ad0, size: 73 bytes, params: 2, frame: 14 const isMediaFlaggedForHarmTypeBinding = isMediaFlaggedForHarmType; const ObscuredMediaTypes = (ExplicitMediaRedactionModelsModule).ObscuredMediaTypes; const Attachment = ObscuredMediaTypes.Attachment; return !isMediaFlaggedForHarmTypeBinding(a0, {type: Attachment, media: env0_0}); } } function shouldScanGenericMedia(a0, a1) { // fn#42350, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:5119, owner: isMediaScanPending.shouldScanGenericMedia, offset: 0x01136b19, size: 96 bytes, params: 3, frame: 17 var environment; var r1; var r0; var shouldScanForContentScanVersionBinding; var contentScanMetadata; const env0_0 = a0; let value = a1.length !== 0; if (value) { value = a1.filter(_fun42351).length !== 0; if (value) { value = environment.__proto__; shouldScanForContentScanVersionBinding = shouldScanForContentScanVersion; contentScanMetadata = a0.contentScanMetadata; value = undefined; value = shouldScanForContentScanVersionBinding(contentScanMetadata == null ? value : contentScanMetadata.version, a1); r1 = value; } else { r1 = value; } r0 = r1; } else { r0 = value; } return r0; function _fun42351(a0) { // fn#42351, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:5198, offset: 0x01136b79, size: 73 bytes, params: 2, frame: 14 const isMediaFlaggedForHarmTypeBinding = isMediaFlaggedForHarmType; const ObscuredMediaTypes = (ExplicitMediaRedactionModelsModule).ObscuredMediaTypes; const GenericMedia = ObscuredMediaTypes.GenericMedia; return !isMediaFlaggedForHarmTypeBinding(a0, {type: GenericMedia, media: env0_0}); } } } function isMediaFlaggedForHarmType(a0, a1) { // fn#42352, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:5412, offset: 0x01136bc2, size: 412 bytes, params: 3, frame: 19 var type; const ObscuredMediaTypes = (ExplicitMediaRedactionModelsModule).ObscuredMediaTypes; var hasFlag; var contentScanMetadata; if (a0 != null) { var value; var value2 = undefined; var CONTENT_SCAN_TYPE_REGISTRY = (require(4839) /* metro dependency 4839: HarmTypeConfiguration */).CONTENT_SCAN_TYPE_REGISTRY; var property = CONTENT_SCAN_TYPE_REGISTRY[a0]; var devSettingKey = property.devSettingKey; if (devSettingKey == null) { type = a1.type; if (ObscuredMediaTypes.Embed === type) { value = require(1391) /* metro dependency 1391: FlagUtils */; return value.hasFlag(a1.media.flags ?? 0, property.embedFlag); } if (ObscuredMediaTypes.Attachment === type) { value = require(1391) /* metro dependency 1391: FlagUtils */; return value.hasFlag(a1.media.flags ?? 0, property.attachmentFlag); } if (ObscuredMediaTypes.GenericMedia === type) { value = require(1391) /* metro dependency 1391: FlagUtils */; hasFlag = value.hasFlag; contentScanMetadata = a1.media.contentScanMetadata; return Reflect.apply(hasFlag, value, [(contentScanMetadata == null ? value2 : contentScanMetadata.flags) ?? 0, property.genericMediaFlag]); } return false; } var devSettingsStoreBinding = DevSettingsStore; var get = devSettingsStoreBinding.get; devSettingKey = property.devSettingKey; if (Reflect.apply(get, devSettingsStoreBinding, [devSettingKey])) { return true; } type = a1.type; if (ObscuredMediaTypes.Embed === type) { value = require(1391) /* metro dependency 1391: FlagUtils */; return value.hasFlag(a1.media.flags ?? 0, property.embedFlag); } if (ObscuredMediaTypes.Attachment === type) { value = require(1391) /* metro dependency 1391: FlagUtils */; return value.hasFlag(a1.media.flags ?? 0, property.attachmentFlag); } if (ObscuredMediaTypes.GenericMedia === type) { value = require(1391) /* metro dependency 1391: FlagUtils */; hasFlag = value.hasFlag; contentScanMetadata = a1.media.contentScanMetadata; return Reflect.apply(hasFlag, value, [(contentScanMetadata == null ? value2 : contentScanMetadata.flags) ?? 0, property.genericMediaFlag]); } } return false; } function contentHarmTypesToFlags(a0) { // fn#42353, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:5998, offset: 0x01136d5e, size: 312 bytes, params: 2, frame: 18 var r2; var r3; var r8; var r0; var value4; const ContentHarmType = (HarmTypeConfigurationModule).ContentHarmType; var EXPLICIT; var GORE; var SELF_HARM; var value5; var value6; var value7; var value8; const ContentHarmTypeBitMask = (HarmTypeConfigurationModule).ContentHarmTypeBitMask; const NONE = ContentHarmTypeBitMask.NONE; const value2 = _createForOfIteratorHelperLoose_42331(a0); const value3 = value2(); let done = value3.done; if (done) { r0 = NONE; } else { r2 = NONE; r3 = value3; while (true) { value4 = r3.value; EXPLICIT = ContentHarmType.EXPLICIT; if (EXPLICIT !== value4) { GORE = ContentHarmType.GORE; if (GORE === value4) { GORE = ContentHarmTypeBitMask.GORE; value6 = r2 | GORE; r8 = value6; break; } SELF_HARM = ContentHarmType.SELF_HARM; if (SELF_HARM !== value4) { r8 = r2; break; } SELF_HARM = ContentHarmTypeBitMask.SELF_HARM; value5 = r2 | SELF_HARM; r8 = value5; break; } EXPLICIT = ContentHarmTypeBitMask.EXPLICIT; value7 = r2 | EXPLICIT; r8 = value7; value8 = value2(); done = value8.done; if (done) { r0 = r8; break; } r2 = r8; r3 = value8; continue; } } return r0; } function getHarmTypeFromBitmask(a0) { // fn#42354, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:6417, offset: 0x01136e96, size: 137 bytes, params: 2, frame: 16 var r2; var value3; var bitmask; var push; var harmType; var value4; const ContentHarmTypeBitMask = (HarmTypeConfigurationModule).ContentHarmTypeBitMask; const NONE = ContentHarmTypeBitMask.NONE; if (a0 === NONE) { return []; } const items2 = []; const value = _createForOfIteratorHelperLoose_42331(getEligibleHarmTypesConfigsForContext()); const value2 = value(); let done = value2.done; if (!done) { r2 = value2; while (true) { value3 = r2.value; bitmask = value3.bitmask; if ((a0 & bitmask) > 0) { push = items2.push; harmType = value3.harmType; Reflect.apply(push, items2, [harmType]); } value4 = value(); done = value4.done; if (done) { break; } r2 = value4; continue; } } return items2; } function getChannelTypeById(a0, a1) { // fn#42355, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:6670, offset: 0x01136f1f, size: 298 bytes, params: 3, frame: 18 var r2; var r1; var r0; const ContentHarmTypeChannel = (ExplicitMediaRedactionModelsModule).ContentHarmTypeChannel; var friendIDs; const value = a2; const value2 = Module00057(value !== undefined ? value : [ExplicitMediaStore, global.l], 2); const property = value2[0]; const property2 = value2[1]; const channel = property.getChannel(a0); const currentUser = UserStore.getCurrentUser(); const value5 = null; if (value5 == currentUser) { r0 = value5; } else if (a1 === currentUser.id) { r0 = value5; } else if (value5 == channel) { r0 = value5; } else { if (channel.isDM()) { if (value5 == a1) { r2 = ContentHarmTypeChannel.NON_FRIEND_DM; } else { friendIDs = property2.getFriendIDs(); r2 = friendIDs.includes(a1) ? ContentHarmTypeChannel.FRIEND_DM : ContentHarmTypeChannel.NON_FRIEND_DM; } r1 = r2; } else if (channel.isGroupDM()) { if (value5 == a1) { r2 = ContentHarmTypeChannel.NON_FRIEND_DM; } else { friendIDs = property2.getFriendIDs(); r2 = friendIDs.includes(a1) ? ContentHarmTypeChannel.FRIEND_DM : ContentHarmTypeChannel.NON_FRIEND_DM; } r1 = r2; } else { r1 = ContentHarmTypeChannel.GUILD; } r0 = r1; } return r0; } function shouldScanForContentScanVersion(a0, a1) { // fn#42356, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:7004, offset: 0x01137049, size: 150 bytes, params: 3, frame: 18 const ContentHarmType = (HarmTypeConfigurationModule).ContentHarmType; return a0 !== -1 && (a1.includes(ContentHarmType.GORE) || a1.includes(ContentHarmType.SELF_HARM) ? a0 == null || a0 < ExplicitMediaStore.validContentScanVersion : a0 == null); } function shouldRedactForSettingValue(a0) { // fn#42357, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:7209, offset: 0x011370df, size: 94 bytes, params: 2, frame: 16 const ExplicitContentRedaction = (Preloaded_user_settingsModule).ExplicitContentRedaction; return a0 != null && [ExplicitContentRedaction.BLOCK, ExplicitContentRedaction.BLUR].includes(a0); } function getChannelIdAndAuthorIdFromMessage(a0) { // fn#42358, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:7360, offset: 0x0113713d, size: 374 bytes, params: 2, frame: 18 var r7; var items2; var moduleValue; var message_id; var messageStoreBinding; var getMessage; var channel_id2; var value7; const value = null; if (value == a0) { return {'channelId': null, 'authorId': null}; } const channel_id = 'channel_id' in a0 ? a0.channel_id : value; if ('messageReference' in a0) { items2 = [a0.messageReference]; items2[1] = (importDefault(4845) /* metro dependency 4845: isForwardMessage */)(a0); r7 = items2; } else if ('message_reference' in a0) { items2 = [a0.message_reference]; moduleValue = require(4845) /* metro dependency 4845: isForwardMessage */; items2[1] = moduleValue.isForwardServerMessage(a0); r7 = items2; } else { r7 = []; } const value5 = undefined; const value6 = Module00057(r7, 2); const property = value6[0]; if (value != property) { if (value6[1]) { message_id = property.message_id; if (value == message_id) { return {channelId: channel_id, authorId: value}; } messageStoreBinding = MessageStore; getMessage = messageStoreBinding.getMessage; channel_id2 = property.channel_id; message_id = property.message_id; value7 = Reflect.apply(getMessage, messageStoreBinding, [channel_id2, message_id]); return {channelId: channel_id, authorId: value != value7 ? value == value7.author ? value5 : value7.author.id : value}; } } return {channelId: channel_id, authorId: 'author' in a0 ? value == a0.author ? value5 : a0.author.id : 'author_id' in a0 ? a0.author_id : value}; } function getEligibleHarmTypesConfigsForContext() { // fn#42359, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:1122, offset: 0x011372b3, size: 68 bytes, params: 1, frame: 13 const Object = global.Object; const values = Object.values; const CONTENT_SCAN_TYPE_REGISTRY = (HarmTypeConfigurationModule).CONTENT_SCAN_TYPE_REGISTRY; return Reflect.apply(values, Object, [CONTENT_SCAN_TYPE_REGISTRY]).filter(function(a0) { return a0.isEligible == null || a0.isEligible?.(); }); } function getEnabledHarmTypesForMessage(a0) { // fn#42361, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:1283, offset: 0x01137327, size: 84 bytes, params: 2, frame: 16 const ContentHarmTypeBitMask = (HarmTypeConfigurationModule).ContentHarmTypeBitMask; const channelIdAndAuthorIdFromMessage = getChannelIdAndAuthorIdFromMessage(a0); const channelId = channelIdAndAuthorIdFromMessage.channelId; return channelId == null || a0 == null ? ContentHarmTypeBitMask.NONE : getEnabledHarmTypesForChannelAndAuthorId(channelId, channelIdAndAuthorIdFromMessage.authorId); } function getEnabledHarmTypesForChannelAndAuthorId(a0, a1) { // fn#42362, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:1507, offset: 0x0113737b, size: 155 bytes, params: 3, frame: 17 const ContentHarmTypeBitMask = (HarmTypeConfigurationModule).ContentHarmTypeBitMask; const currentUser = UserStore.getCurrentUser(); if (currentUser == null) { return ContentHarmTypeBitMask.NONE; } if (a1 === currentUser.id) { return ContentHarmTypeBitMask.NONE; } const channelTypeById = getChannelTypeById(a0, a1, [ChannelStore, RelationshipStore]); return channelTypeById == null ? ContentHarmTypeBitMask.NONE : getEnabledHarmTypesBitmaskForChannelType(channelTypeById); } function getEnabledHarmTypesBitmaskForChannelType(a0) { // fn#42363, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:1779, offset: 0x01137416, size: 124 bytes, params: 2, frame: 16 var r0; var contentHarmTypesToFlagsBinding; var value3; const env0_0 = a0; if (a0 == null) { r0 = (require(4839) /* metro dependency 4839: HarmTypeConfiguration */).ContentHarmTypeBitMask.NONE; } else { contentHarmTypesToFlagsBinding = contentHarmTypesToFlags; value3 = getEligibleHarmTypesConfigsForContext().map(_fun42364); r0 = contentHarmTypesToFlagsBinding(value3.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish)); } return r0; function _fun42364(a0) { // fn#42364, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:1912, offset: 0x01137492, size: 51 bytes, params: 2, frame: 12 let value = environment.__proto__; const shouldRedactForSettingValueBinding = shouldRedactForSettingValue; value = a0.getUserSettingsWithDefaults(); value = shouldRedactForSettingValueBinding(value[env0_0]); return value ? a0.harmType : null; } } function hasUnscannedMedia(a0, a1) { // fn#42366, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:8606, offset: 0x011374e2, size: 339 bytes, params: 3, frame: 19 var environment; var r5; var r6; var r1; var some; var value4; var value5; var componentMedia; var message_snapshots; var value6; var value7; var done; var hasUnscannedMediaBinding; var value8; var message; var value9; let value = a1; const value2 = null; reducibleJoin2: while (true) { if (value2 != value) { r5 = value; break reducibleJoin2; } value = environment; value = getEnabledHarmTypesForMessage(a0); r5 = value; break reducibleJoin2; } const value3 = undefined; const ContentHarmTypeBitMask = (HarmTypeConfigurationModule).ContentHarmTypeBitMask; const NONE = ContentHarmTypeBitMask.NONE; if (r5 !== NONE) { var attachments = a0.attachments; reducibleJoin5: while (true) { if (value2 == attachments) { r6 = value3; break reducibleJoin5; } some = attachments.some; value4 = Reflect.apply(some, attachments, [_fun42367]); r6 = value4; break reducibleJoin5; } if (r6) { return true; } var embeds = a0.embeds; reducibleJoin8: while (true) { if (value2 == embeds) { r6 = value3; break reducibleJoin8; } some = embeds.some; value5 = Reflect.apply(some, embeds, [_fun42368]); r6 = value5; break reducibleJoin8; } if (r6) { return true; } if (value2 != a0.components) { componentMedia = findComponentMedia(a0.components); reducibleJoin11: while (true) { if (componentMedia.some(_fun42369)) { return true; } break reducibleJoin11; } } if ('messageSnapshots' in a0) { r1 = a0.messageSnapshots; } else { reducibleJoin15: while (true) { if ('message_snapshots' in a0) { message_snapshots = a0.message_snapshots; r1 = message_snapshots; break reducibleJoin15; } r1 = value2; break reducibleJoin15; } } if (value2 != r1) { reducibleJoin22: while (true) { if (r1.length !== 0) { value6 = _createForOfIteratorHelperLoose_42331(r1); value7 = value6(); done = value7.done; if (!done) { r1 = value7; reducibleLoop18: while (true) { hasUnscannedMediaBinding = hasUnscannedMedia; value8 = r1.value; message = value8.message; if (hasUnscannedMediaBinding(message, r5)) { return true; } value9 = value6(); done = value9.done; if (done) { return false; } r1 = value9; continue reducibleLoop18; } } return false; } break reducibleJoin22; } } } return false; function _fun42367(a0) { // fn#42367, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:8786, offset: 0x01137635, size: 70 bytes, params: 2, frame: 14 const isMediaScanPendingBinding = isMediaScanPending; const ObscuredMediaTypes = (ExplicitMediaRedactionModelsModule).ObscuredMediaTypes; const Attachment = ObscuredMediaTypes.Attachment; return isMediaScanPendingBinding({type: Attachment, media: a0}, env0_0); } function _fun42368(a0) { // fn#42368, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:8913, offset: 0x0113767b, size: 70 bytes, params: 2, frame: 14 const isMediaScanPendingBinding = isMediaScanPending; const ObscuredMediaTypes = (ExplicitMediaRedactionModelsModule).ObscuredMediaTypes; const Embed = ObscuredMediaTypes.Embed; return isMediaScanPendingBinding({type: Embed, media: a0}, env0_0); } function _fun42369(a0) { // fn#42369, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:9060, offset: 0x011376c1, size: 70 bytes, params: 2, frame: 14 const isMediaScanPendingBinding = isMediaScanPending; const ObscuredMediaTypes = (ExplicitMediaRedactionModelsModule).ObscuredMediaTypes; const GenericMedia = ObscuredMediaTypes.GenericMedia; return isMediaScanPendingBinding({type: GenericMedia, media: a0}, env0_0); } } function isEligibleForScanning(a0) { // fn#42370, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:9437, offset: 0x01137707, size: 61 bytes, params: 2, frame: 12 var r0; let value = a0.components == null; if (value) { r0 = value; } else { value = findComponentMedia(a0.components); value = !value.some(function({loadingState}) { return loadingState === require(dependencyMap[10]).UnfurledMediaLoadingState.LOADING; }); r0 = value; } return r0; } function getUnscannedMediaIds(a0) { // fn#42372, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:9629, offset: 0x01137778, size: 260 bytes, params: 2, frame: 17 var r4; var r1; var value; const getEnabledHarmTypesForMessageBinding = getEnabledHarmTypesForMessage; const value2 = undefined; const enabledHarmTypesForMessageBinding = getEnabledHarmTypesForMessageBinding(a0); const ContentHarmTypeBitMask = (HarmTypeConfigurationModule).ContentHarmTypeBitMask; const NONE = ContentHarmTypeBitMask.NONE; if (enabledHarmTypesForMessageBinding === NONE) { return {attachmentIds: [], embedIds: []}; } const attachments = a0.attachments; const r8 = attachments == null ? value2 : attachments.filter(_fun42373); const embeds = a0.embeds; const r5 = embeds == null ? value2 : embeds.filter(_fun42374); const object = {}; if (r8 == null) { r4 = value2; } else { value = r8.map(function(a0) { return a0.id; }); value = value.filter(global.Boolean); r4 = value; } r4 = r4 ?? []; object.attachmentIds = r4; if (r5 == null) { r1 = value2; } else { value = r5.map(function(a0, a1) { return 'embed_' + a1; }); value = value.filter(global.Boolean); r1 = value; } r1 = r1 ?? []; object.embedIds = r1; return object; function _fun42373(a0) { // fn#42373, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:9837, offset: 0x01137635, size: 70 bytes, params: 2, frame: 14 const isMediaScanPendingBinding = isMediaScanPending; const ObscuredMediaTypes = (ExplicitMediaRedactionModelsModule).ObscuredMediaTypes; const Attachment = ObscuredMediaTypes.Attachment; return isMediaScanPendingBinding({type: Attachment, media: a0}, env0_0); } function _fun42374(a0) { // fn#42374, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:9956, offset: 0x0113767b, size: 70 bytes, params: 2, frame: 14 const isMediaScanPendingBinding = isMediaScanPending; const ObscuredMediaTypes = (ExplicitMediaRedactionModelsModule).ObscuredMediaTypes; const Embed = ObscuredMediaTypes.Embed; return isMediaScanPendingBinding({type: Embed, media: a0}, env0_0); } } function isMediaObscuredForHarmTypes(a0, a1) { // fn#42377, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:10304, offset: 0x01137899, size: 106 bytes, params: 3, frame: 14 const env0_0 = a0; const ContentHarmTypeBitMask = (HarmTypeConfigurationModule).ContentHarmTypeBitMask; const NONE = ContentHarmTypeBitMask.NONE; if (a1 === NONE) { return false; } const harmTypeFromBitmask = getHarmTypeFromBitmask(a1); return harmTypeFromBitmask.length !== 0 && harmTypeFromBitmask.filter(_fun42378).length > 0; function _fun42378(a0) { // fn#42378, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5016:10462, offset: 0x01136706, size: 27 bytes, params: 2, frame: 13 return isMediaFlaggedForHarmType(a0, env0_0); } } } global.__d(_fun42330, 4838, [57, 4649, 1379, 4814, 3793, 1878, 4822, 4839, 1360, 4841, 1909, 4630, 1391, 1314, 4845, 2]) /* metro module 4838, dependencies: [57, 4649, 1379, 4814, 3793, 1878, 4822, 4839, 1360, 4841, 1909, 4630, 1391, 1314, 4845, 2] */;