/* Metro module 8629; source: actions/EmojiActionCreators.tsx; dependencies: [5, 6540, 4257, 4646, 661, 670, 1362, 1345, 694, 507, 7618, 4002, 1244, 4132, 3797, 1360, 6546, 22, 4647, 2] */ import Module00005 from '../by-id/module-00005.js'; /* Metro dependency 5 */ import Module00022 from '../by-id/module-00022.js'; /* Metro dependency 22 */ import Dispatcher from '../Dispatcher.tsx'; /* Metro dependency 694 */ import GatewayConnectionStore from '../modules/gateway/GatewayConnectionStore.tsx'; /* Metro dependency 4257 */ import GuildAvailabilityStore from '../stores/GuildAvailabilityStore.tsx'; /* Metro dependency 4646 */ import EmojiStore from '../modules/emojis/EmojiStore.tsx'; /* Metro dependency 6540 */ import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as HTTPUtilsModule from '../external/discord_common/js/packages/http-utils/HTTPUtils.tsx'; /* Metro dependency 507 */ import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */ import * as UserSettingsConstantsModule from '../modules/user_settings/UserSettingsConstants.tsx'; /* Metro dependency 670 */ import * as IndexNativeModule from '../intl/index.native.tsx'; /* Metro dependency 1244 */ import * as WrappersModule from '../external/discord_common/js/packages/protos/google/protobuf/wrappers.tsx'; /* Metro dependency 1345 */ import * as UserSettingsProtoActionCreatorsModule from '../modules/user_settings/UserSettingsProtoActionCreators.tsx'; /* Metro dependency 1362 */ function _fun68075(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#68075, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:6, offset: 0x01c3ddb3, size: 333 bytes, params: 8, frame: 19 let env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('actions/EmojiActionCreators.tsx'); exports.setDiversityColor = function(a0) { var env0_0 = a0; var PreloadedUserSettingsActionCreators = require(dependencyMap[6]).PreloadedUserSettingsActionCreators; var FREQUENT_USER_ACTION = UserSettingsDelay.FREQUENT_USER_ACTION; PreloadedUserSettingsActionCreators.updateAsync('textAndImages', _fun68083, FREQUENT_USER_ACTION); }; exports.fetchEmoji = fetchEmoji; exports.uploadEmoji = uploadEmoji; exports.deleteEmoji = deleteEmoji; exports.updateEmoji = function() { return _updateEmoji.apply(this, arguments); }; exports.favoriteEmoji = function(a0) { var value2 = getFavoriteEmojiNameOrId(a0); var env0_0 = value2; if (value2 != null) { require(dependencyMap[6]).FrecencyUserSettingsActionCreators.updateAsync('favoriteEmojis', _fun68094, UserSettingsDelay.INFREQUENT_USER_ACTION); } }; exports.unfavoriteEmoji = function(a0) { var value2 = getFavoriteEmojiNameOrId(a0); var env0_0 = value2; if (value2 != null) { require(dependencyMap[6]).FrecencyUserSettingsActionCreators.updateAsync('favoriteEmojis', _fun68096, UserSettingsDelay.INFREQUENT_USER_ACTION); } }; function _updateEmoji() { // fn#68076, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:208, offset: 0x01c3df00, size: 50 bytes, params: 1, frame: 14 return Module00005(_fun68078).apply(this, arguments); async function _fun68078({guildId, emojiId, name, roles}) { // fn#68078, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:255, offset: 0x01c3df46, size: 209 bytes, params: 2, frame: 21 var binding; var binding2; var property; var value4; var HTTP; var patch; var object; var GUILD_EMOJI; var value5; var object2; var value6; var value7; var value8; var error; var prototype; var value9; if (false) { return undefined; } await undefined; if (false) { return undefined; } value = environment.__proto__.__proto__; try { binding = env2_0; } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { binding2 = env2_2; } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { property = binding2[9]; } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { value4 = binding(property); } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { HTTP = value4.HTTP; } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { patch = HTTP.patch; } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { object = {}; } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { binding = env2_7; } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { GUILD_EMOJI = binding.GUILD_EMOJI; } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { value5 = Reflect.apply(GUILD_EMOJI, binding, [guildId, emojiId]); } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { object.url = value5; } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { object2 = {}; } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { object2.name = name; } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { object2.roles = roles; } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { object.body = object2; } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { object.oldFormErrors = true; } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { object.rejectWithError = true; } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } try { value6 = Reflect.apply(patch, HTTP, [object]); } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } await value6; try { value7 = undefined; value8 = false; } catch (error) { binding = env2_1; value = binding(env2_2[13]); prototype = value.prototype; value9 = Object.create(prototype, {constructor: {value: value}}); value = new value(); value = value instanceof Object ? value : value9; throw value; } return value8 ? value7 : value7; } } function dedupeFavoriteEmojis(a0) { // fn#68079, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:482, offset: 0x01c3e017, size: 148 bytes, params: 2, frame: 19 var value2; var items2; var value; if (!(GuildAvailabilityStore.totalUnavailableGuilds > 0)) { var gatewayConnectionStoreBinding = GatewayConnectionStore; if (gatewayConnectionStoreBinding.isConnected()) { value2 = a0.map(_fun68080); value = (importDefault(6546) /* metro dependency 6546: dedupeEmojisByNameOrId */)(value2.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish)); value = value.keys(); items2 = []; arraySpread(items2, value, 0, require); return items2; } } return a0; function _fun68080(a0) { // fn#68080, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:596, offset: 0x01c3e0ab, size: 62 bytes, params: 2, frame: 13 var r0; let value = environment.__proto__; const customEmojiById = EmojiStore.getCustomEmojiById(a0); if (customEmojiById != null) { r0 = customEmojiById; } else { value = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */; value = value.getByName(a0); r0 = value; } return r0; } } function getFavoriteEmojiNameOrId(a0) { // fn#68081, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:734, offset: 0x01c3e0e9, size: 93 bytes, params: 2, frame: 16 var r1; var r0; var id; var value3; var defaultImport; var value4; const value = null; if (value == a0) { r0 = value; } else { id = a0.id; if (value != id) { r1 = id; } else { value3 = undefined; defaultImport = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */; value4 = defaultImport.convertSurrogateToBase(a0.surrogates); r1 = value == value4 ? value3 : value4.name; } r1 = value == r1 ? a0.name : r1; r0 = r1; } return r0; } function setDiversityColor(a0) { // fn#68082, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:994, offset: 0x01c3e146, size: 76 bytes, params: 2, frame: 16 const env0_0 = a0; const PreloadedUserSettingsActionCreators = (UserSettingsProtoActionCreatorsModule).PreloadedUserSettingsActionCreators; const updateAsync = PreloadedUserSettingsActionCreators.updateAsync; const FREQUENT_USER_ACTION = UserSettingsDelay.FREQUENT_USER_ACTION; Reflect.apply(updateAsync, PreloadedUserSettingsActionCreators, ['textAndImages', _fun68083, FREQUENT_USER_ACTION]); function _fun68083(a0) { // fn#68083, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:1097, offset: 0x01c3e192, size: 70 bytes, params: 2, frame: 12 const StringValue = (WrappersModule).StringValue; a0.diversitySurrogate = StringValue.create(); a0.diversitySurrogate.value = env0_0; } } function fetchEmoji(a0) { // fn#68084, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:1221, offset: 0x01c3e1d8, size: 149 bytes, params: 2, frame: 18 const env0_0 = a0; (Dispatcher).dispatch({type: 'EMOJI_FETCH', guildId: a0}); const HTTP = (HTTPUtilsModule).HTTP; const get = HTTP.get; object = {'url': null, 'oldFormErrors': true, 'rejectWithError': true}; object.url = Endpoints.GUILD_EMOJIS(a0); Reflect.apply(get, HTTP, [object]).then(_fun68085, _fun68086); function _fun68085({body}) { // fn#68085, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:1377, offset: 0x01c3e26d, size: 73 bytes, params: 2, frame: 12 const value = environment.__proto__; return (Dispatcher).dispatch({type: 'EMOJI_FETCH_SUCCESS', guildId: env0_0, emojis: body}); } function _fun68086() { // fn#68086, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:1453, offset: 0x01c3e2b6, size: 60 bytes, params: 1, frame: 12 const value = environment.__proto__; return (Dispatcher).dispatch({type: 'EMOJI_FETCH_FAILURE', guildId: env0_0}); } } function uploadEmoji({guildId, image, name, roles, analyticsLocation, originalMd5}) { // fn#68087, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:1532, offset: 0x01c3e2f2, size: 261 bytes, params: 2, frame: 24 (Dispatcher).dispatch({type: 'EMOJI_UPLOAD_START', guildId: guildId}); const HTTP = (HTTPUtilsModule).HTTP; const post = HTTP.post; object = {}; object.url = Endpoints.GUILD_EMOJIS(guildId); object.body = {image: image, name: name, roles: roles}; object.headers = (importDefault(7618) /* metro dependency 7618: InlineUploader */).buildHeadersForMd5(originalMd5); object.context = {client_event_source: analyticsLocation?.page}; object.oldFormErrors = true; object.rejectWithError = false; return Reflect.apply(post, HTTP, [object]).then(_fun68088, _fun68089); function _fun68088(a0) { // fn#68088, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:1892, offset: 0x01c3e3f7, size: 68 bytes, params: 2, frame: 12 const value = environment.__proto__; (Dispatcher).dispatch({type: 'EMOJI_UPLOAD_STOP', guildId: guildId}); return a0.body; } function _fun68089(a0) { // fn#68089, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:1961, offset: 0x01c3e43b, size: 82 bytes, params: 2, frame: 12 const value = environment.__proto__; (Dispatcher).dispatch({type: 'EMOJI_UPLOAD_STOP', guildId: guildId}); const Promise = global.Promise; return Promise.reject(a0); } } function deleteEmoji(a0, a1, a2) { // fn#68090, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:2057, offset: 0x01c3e48d, size: 176 bytes, params: 4, frame: 19 const value2 = undefined; (Dispatcher).dispatch({type: 'EMOJI_DELETE', guildId: a0, emojiId: a1}); const HTTP = (HTTPUtilsModule).HTTP; const del = HTTP.del; object = {}; object.url = Endpoints.GUILD_EMOJI(a0, a1); object.body = a2 != null ? {replaced_by: a2} : value2; object.oldFormErrors = true; object.rejectWithError = false; return Reflect.apply(del, HTTP, [object]).then(function() { var AccessibilityAnnouncer = require(dependencyMap[11]).AccessibilityAnnouncer; AccessibilityAnnouncer.announce(require(dependencyMap[12]).intl.string(require(dependencyMap[12]).t.L3UUha)); }); } function favoriteEmoji(a0) { // fn#68093, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:2462, offset: 0x01c3e59a, size: 91 bytes, params: 2, frame: 16 var FrecencyUserSettingsActionCreators; if (getFavoriteEmojiNameOrId(a0) != null) { FrecencyUserSettingsActionCreators = (require(1362) /* metro dependency 1362: UserSettingsProtoActionCreators */).FrecencyUserSettingsActionCreators; FrecencyUserSettingsActionCreators.updateAsync('favoriteEmojis', _fun68094, UserSettingsDelay.INFREQUENT_USER_ACTION); } function _fun68094(a0) { // fn#68094, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:2604, offset: 0x01c3e5f5, size: 280 bytes, params: 2, frame: 21 var r0; var value4; var defaultImport2; var show; var object; const intl = (IndexNativeModule).intl; const t = (IndexNativeModule).t; const value = environment.__proto__; const dedupeFavoriteEmojisBinding = dedupeFavoriteEmojis; const emojis = a0.emojis; const value2 = undefined; a0.emojis = dedupeFavoriteEmojisBinding(emojis); const defaultImport = Module00022; if (defaultImport.size(a0.emojis) >= MAX_FAVORITES) { defaultImport2 = importDefault(4647) /* metro dependency 4647: AlertActionCreators */; show = defaultImport2.show; object = {}; object.title = intl.string(t['+XYXtZ']); object.body = intl.formatToPlainString(t.JaIyFi, {count: MAX_FAVORITES}); Reflect.apply(show, defaultImport2, [object]); r0 = false; } else { value4 = a0.emojis.includes(env0_0); if (value4) { r0 = !value4; } else { a0.emojis.push(env0_0); r0 = value2; } } return r0; } } function unfavoriteEmoji(a0) { // fn#68095, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:2907, offset: 0x01c3e70d, size: 91 bytes, params: 2, frame: 16 var FrecencyUserSettingsActionCreators; if (getFavoriteEmojiNameOrId(a0) != null) { FrecencyUserSettingsActionCreators = (require(1362) /* metro dependency 1362: UserSettingsProtoActionCreators */).FrecencyUserSettingsActionCreators; FrecencyUserSettingsActionCreators.updateAsync('favoriteEmojis', _fun68096, UserSettingsDelay.INFREQUENT_USER_ACTION); } function _fun68096(a0) { // fn#68096, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8814:3051, offset: 0x01c3e768, size: 92 bytes, params: 2, frame: 13 const dedupeFavoriteEmojisBinding = dedupeFavoriteEmojis; let emojis = a0.emojis; a0.emojis = dedupeFavoriteEmojisBinding(emojis); if (Reflect.apply(a0.emojis.includes, emojis, [env0_0])) { emojis = a0.emojis; a0.emojis = emojis.filter(_fun68097); return undefined; } return false; function _fun68097(a0) { // fn#68097, offset: 0x00c956fc, size: 16 bytes, params: 2, frame: 2 return env1_0 !== a0; } } } } global.__d(_fun68075, 8629, [5, 6540, 4257, 4646, 661, 670, 1362, 1345, 694, 507, 7618, 4002, 1244, 4132, 3797, 1360, 6546, 22, 4647, 2]) /* metro module 8629, dependencies: [5, 6540, 4257, 4646, 661, 670, 1362, 1345, 694, 507, 7618, 4002, 1244, 4132, 3797, 1360, 6546, 22, 4647, 2] */;