/* Metro module 15204; source: stores/WebhooksStore.tsx; dependencies: [6, 7, 15, 17, 18, 15205, 22, 566, 694, 2] */ import ClassCallCheck from '../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import PossibleConstructorReturn from '../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */ import Module00017 from '../by-id/module-00017.js'; /* Metro dependency 17 */ import Inherits from '../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */ import Flux from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ function _fun116274(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#116274, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15401:6, offset: 0x02483b02, size: 352 bytes, params: 8, frame: 19 const fetchingKey = function(a0, a1) { return '' + a0 + ':' + (a1 ?? 'guild'); }; const WEBHOOK_CREATE2 = WEBHOOK_CREATE; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_8 = {}; const env0_9 = {}; const Store = (Flux).Store; let value = _fun116281(Store); value.displayName = 'WebhooksStore'; value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {WEBHOOKS_UPDATE: WEBHOOKS_UPDATE, WEBHOOKS_FETCHING: WEBHOOKS_FETCHING, WEBHOOK_CREATE: WEBHOOK_CREATE2, WEBHOOK_UPDATE: WEBHOOK_CREATE2, WEBHOOK_DELETE: function({guildId, webhookId}) { delete getOrCreateGuild(guildId)[webhookId]; }}); (FileImportTrackerModule).fileFinishedImporting('stores/WebhooksStore.tsx'); exports.default = value; function _isNativeReflectConstruct_116275() { // fn#116275, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15401:148, offset: 0x02483c62, size: 98 bytes, params: 1, frame: 18 var Boolean; var prototype; var valueOf; var call; var Reflect; var construct; var closure; var value; var error; try { Boolean = global.Boolean; prototype = Boolean.prototype; valueOf = prototype.valueOf; call = valueOf.call; Reflect = global.Reflect; construct = Reflect.construct; Boolean = global.Boolean; closure = function() { }; value = Reflect.apply(construct, Reflect, [Boolean, [], closure]); value = Reflect.apply(call, valueOf, [value]); var result = !value; } catch (error) { } return (_isNativeReflectConstruct_116275_isNativeReflectConstruct = function() { return !!result; })(); } function getOrCreateGuild(a0) { // fn#116279, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15401:423, offset: 0x02483cf2, size: 40 bytes, params: 2, frame: 4 if (env0_8[a0] == null) { env0_8[a0] = {}; } return env0_8[a0]; } function WEBHOOK_CREATE({guildId, webhook}) { // fn#116280, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15401:486, offset: 0x02483d1a, size: 39 bytes, params: 2, frame: 12 getOrCreateGuild(guildId)[webhook.id] = webhook; } function _fun116281(a0) { // fn#116281, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15401:578, offset: 0x02483d41, size: 151 bytes, params: 2, frame: 16 const WebhooksStore2 = WebhooksStore; Inherits(WebhooksStore2, a0); return CreateClass(WebhooksStore2, [{key: 'isFetching', value: value_116283}, {key: 'getWebhooksForGuild', value: function(a0) { return importDefault(dependencyMap[6]).values(getOrCreateGuild(a0)); }}, {key: 'getWebhooksForChannel', value: value_116285}, {key: 'error', get: get_116287}]); function WebhooksStore() { // fn#116282, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15401:590, offset: 0x00ec62ac, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_2(this, WebhooksStore); const value3 = env1_5(WebhooksStore); return env1_4(this, _isNativeReflectConstruct_116275() ? global.Reflect.construct(value3, arguments, env1_5(this).constructor) : value3.apply(this, arguments)); } function value_116283(a0, a1) { // fn#116283, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15401:873, offset: 0x02483dd8, size: 37 bytes, params: 3, frame: 14 return env1_9[fetchingKey(a0, a1)] != null; } function value_116285(a0, a1) { // fn#116285, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15401:1047, offset: 0x02483e2e, size: 88 bytes, params: 3, frame: 13 var environment; const env0_0 = a1; let value = environment.__proto__; value = (importDefault(22) /* metro dependency 22 */)(getOrCreateGuild(a0)); value = value.values(); value = value.filter(function({channel_id}) { return channel_id === require; }); return value.value(); } function get_116287() { // fn#116287, offset: 0x00fbd9cb, size: 9 bytes, params: 1, frame: 1 return env1_7; } } function WEBHOOKS_UPDATE({guildId, channelId, webhooks, error}) { // fn#116288, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15401:1270, offset: 0x02483e9b, size: 293 bytes, params: 2, frame: 19 var r6; var binding; if (webhooks != null) { r6 = channelId == null ? [] : (importDefault(22) /* metro dependency 22 */)(getOrCreateGuild(guildId)).values().filter(function({channel_id}) { return channel_id !== channelId; }).value(); binding = env0_8; binding[guildId] = {}; r6.concat(webhooks).forEach(_fun116290); binding = env0_9; delete binding[fetchingKey(guildId, channelId)]; } else if (error != null) { delete env0_9[fetchingKey(guildId, channelId)]; } else if (channelId != null && env0_8[guildId] != null) { (importDefault(15205) /* metro dependency 15205: WebhooksActionCreators */).fetchForChannel(guildId, channelId); } function _fun116290(a0) { // fn#116290, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15401:1496, offset: 0x02483fd5, size: 21 bytes, params: 2, frame: 3 env0_1[a0.id] = a0; return a0; } } function WEBHOOKS_FETCHING({guildId, channelId}) { // fn#116291, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15401:1662, offset: 0x02483fea, size: 40 bytes, params: 2, frame: 14 env0_9[fetchingKey(guildId, channelId)] = true; } } global.__d(_fun116274, 15204, [6, 7, 15, 17, 18, 15205, 22, 566, 694, 2]) /* metro module 15204, dependencies: [6, 7, 15, 17, 18, 15205, 22, 566, 694, 2] */;