/* Metro module 14787; source: modules/notification_center/getNotificationCenterItemBody.tsx; dependencies: [4117, 1867, 3793, 1878, 661, 1244, 3995, 4624, 1861, 44, 2] */ import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */ import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */ import RelationshipStore from '../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */ import GuildScheduledEventStore from '../guild_scheduled_events/GuildScheduledEventStore.tsx'; /* Metro dependency 4117 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */ import * as GuildScheduledEventStoreModule from '../guild_scheduled_events/GuildScheduledEventStore.tsx'; /* Metro dependency 4117 */ import * as NotificationCenterItemsTypesModule from './NotificationCenterItemsTypes.tsx'; /* Metro dependency 4624 */ function _fun111695(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#111695, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14984:6, offset: 0x023acf2c, size: 257 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_10 = RegExp('[\\\\`*_~|<>[\\]:]', 'g'); (FileImportTrackerModule).fileFinishedImporting('modules/notification_center/getNotificationCenterItemBody.tsx'); exports.default = getNotificationCenterItemBody; function escapeMarkdown(a0) { // fn#111696, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14984:247, offset: 0x023ad02d, size: 37 bytes, params: 2, frame: 13 if (a0 !== undefined) { return a0.replace(env0_10, '\\$&'); } } function getFriendRequestItemBody({username, applicationId, renderApplication, withApplication, withDefault}) { // fn#111697, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14984:315, offset: 0x023ad052, size: 160 bytes, params: 2, frame: 17 const intl = (IndexNativeModule).intl; return applicationId != null ? intl.format(withApplication, {username: username, applicationName: function() { return renderApplication(applicationId); }}) : intl.format(withDefault, {username: username}); } function getNotificationCenterItemBody({item, renderApplication}) { // fn#111699, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14984:649, offset: 0x023ad0f2, size: 1960 bytes, params: 2, frame: 25 var r3; var r6; var name; var name2; var length; const intl = (IndexNativeModule).intl; var format; const t = (IndexNativeModule).t; var object; var guild_scheduled_event_id; var guildStoreBinding; var value9; var isGuildEventEndedBinding; var isGuildEventEnded2; var moduleValue; var moduleValue2; var AyvfXR; var local_id; var defaultImport4; var other_users; var value11; var defaultImport5; var value12; var Math; var max; var value13; let value = undefined; let other_user = item.other_user; let id = other_user == null ? value : other_user.id; const r5 = id ?? EMPTY_STRING_SNOWFLAKE_ID; let escapeMarkdownBinding = escapeMarkdown; const defaultImport = importDefault(3995) /* metro dependency 3995: UserUtils */; let getName = defaultImport.getName; let userStoreBinding = UserStore; let getUser = userStoreBinding.getUser; other_user = item.other_user; const value5 = escapeMarkdownBinding(Reflect.apply(getName, defaultImport, [Reflect.apply(getUser, userStoreBinding, [other_user == null ? value : other_user.id])])); const applicationId = item.applicationId; const type = item.type; const NotificationCenterLocalItems = (NotificationCenterItemsTypesModule).NotificationCenterLocalItems; const FRIEND_REQUESTS_GROUPED = NotificationCenterLocalItems.FRIEND_REQUESTS_GROUPED; if (FRIEND_REQUESTS_GROUPED === type) { escapeMarkdownBinding = escapeMarkdown; defaultImport4 = defaultImport; getName = defaultImport4.getName; userStoreBinding = UserStore; getUser = userStoreBinding.getUser; other_users = item.other_users; id = other_users == null || other_users[0] == null ? value : other_users[0].id; value11 = escapeMarkdownBinding(Reflect.apply(getName, defaultImport4, [Reflect.apply(getUser, userStoreBinding, [id])])); escapeMarkdownBinding = escapeMarkdown; defaultImport5 = importDefault(3995) /* metro dependency 3995: UserUtils */; getName = defaultImport5.getName; userStoreBinding = UserStore; getUser = userStoreBinding.getUser; other_users = item.other_users; id = other_users == null || other_users[1] == null ? value : other_users[1].id; value12 = escapeMarkdownBinding(Reflect.apply(getName, defaultImport5, [Reflect.apply(getUser, userStoreBinding, [id])])); Math = global.Math; max = Math.max; other_users = item.other_users; length = other_users == null ? value : other_users.length; value13 = 0; return intl.format(t.g5xyIC, {user: value11, user2: value12, count: Reflect.apply(max, Math, [(length ?? value13) - 2, value13])}); } const MOBILE_NATIVE_UPDATE_AVAILABLE = NotificationCenterLocalItems.MOBILE_NATIVE_UPDATE_AVAILABLE; if (MOBILE_NATIVE_UPDATE_AVAILABLE === type) { local_id = item.local_id; if (local_id == null) { r3 = value; } else { value = local_id.split('_'); value = value.pop(); r3 = value; } value = 'unknown'; return 'Update to build ' + (r3 ?? value) + ' available!'; } const NotificationCenterItems = (NotificationCenterItemsTypesModule).NotificationCenterItems; const FRIEND_SUGGESTION_CREATED = NotificationCenterItems.FRIEND_SUGGESTION_CREATED; if (FRIEND_SUGGESTION_CREATED === type) { return RelationshipStore.getRelationshipType(r5) === RelationshipTypes.PENDING_OUTGOING ? intl.format(t.gZVTy2, {user: value5}) : item.body ?? ''; } const GUILD_SCHEDULED_EVENT_STARTED = NotificationCenterItems.GUILD_SCHEDULED_EVENT_STARTED; if (GUILD_SCHEDULED_EVENT_STARTED === type) { guild_scheduled_event_id = item.guild_scheduled_event_id; r6 = guild_scheduled_event_id != null ? GuildScheduledEventStore.getGuildScheduledEvent(guild_scheduled_event_id) : null; name = r6 == null ? value : r6.name; guildStoreBinding = GuildStore; value9 = guildStoreBinding.getGuild(r6 == null ? value : r6.guild_id); name2 = value9 == null ? value : value9.name; isGuildEventEndedBinding = isGuildEventEnded; r3 = r6 ?? value; isGuildEventEnded2 = isGuildEventEndedBinding(r3); moduleValue = require(1861) /* metro dependency 1861: StringUtils */; if (moduleValue.isNullOrEmpty(name2)) { r3 = item.body ?? ''; } else { moduleValue2 = require(1861) /* metro dependency 1861: StringUtils */; if (moduleValue2.isNullOrEmpty(name)) { r3 = item.body ?? ''; } else if (isGuildEventEnded2) { format = intl.format; AyvfXR = t.AyvfXR; object = {}; escapeMarkdownBinding = escapeMarkdown; object.event_name = escapeMarkdownBinding(name); object.guild_name = escapeMarkdownBinding(name2); r3 = Reflect.apply(format, intl, [AyvfXR, object]); } else { r3 = item.body ?? ''; } } return r3; } const INCOMING_FRIEND_REQUESTS = NotificationCenterLocalItems.INCOMING_FRIEND_REQUESTS; if (INCOMING_FRIEND_REQUESTS === type) { return getFriendRequestItemBody({username: value5, applicationId: applicationId, renderApplication: renderApplication, withApplication: t['9Dgf1L'], withDefault: t.uIomXw}); } const INCOMING_FRIEND_REQUESTS_ACCEPTED = NotificationCenterLocalItems.INCOMING_FRIEND_REQUESTS_ACCEPTED; if (INCOMING_FRIEND_REQUESTS_ACCEPTED === type) { return getFriendRequestItemBody({username: value5, applicationId: applicationId, renderApplication: renderApplication, withApplication: t.nnC1q9, withDefault: t['5Uzkdp']}); } const FRIEND_REQUEST_ACCEPTED = NotificationCenterItems.FRIEND_REQUEST_ACCEPTED; if (FRIEND_REQUEST_ACCEPTED === type) { return getFriendRequestItemBody({username: value5, applicationId: applicationId, renderApplication: renderApplication, withApplication: t.jXlYiF, withDefault: t.McYRBk}); } const INCOMING_GAME_FRIEND_REQUESTS_ACCEPTED = NotificationCenterLocalItems.INCOMING_GAME_FRIEND_REQUESTS_ACCEPTED; if (INCOMING_GAME_FRIEND_REQUESTS_ACCEPTED === type) { (importDefault(44) /* metro dependency 44 */)(applicationId != null, 'Expected application id for ' + item.type); return intl.format(t['BB/0vn'], {username: value5, applicationName: function() { return renderApplication(applicationId); }}); } const INCOMING_GAME_FRIEND_REQUESTS = NotificationCenterLocalItems.INCOMING_GAME_FRIEND_REQUESTS; if (INCOMING_GAME_FRIEND_REQUESTS === type) { (importDefault(44) /* metro dependency 44 */)(applicationId != null, 'Expected application id for ' + item.type); return intl.format(t['7cqOLI'], {username: value5, applicationName: function() { return renderApplication(applicationId); }}); } const GAME_FRIEND_REQUEST_ACCEPTED = NotificationCenterItems.GAME_FRIEND_REQUEST_ACCEPTED; if (GAME_FRIEND_REQUEST_ACCEPTED === type) { return applicationId == null ? item.body : intl.format(t.Wi64vN, {username: value5, applicationName: function() { return renderApplication(applicationId); }}); } return item.body ?? ''; } } global.__d(_fun111695, 14787, [4117, 1867, 3793, 1878, 661, 1244, 3995, 4624, 1861, 44, 2]) /* metro module 14787, dependencies: [4117, 1867, 3793, 1878, 661, 1244, 3995, 4624, 1861, 44, 2] */;