/* Metro module 15715; source: modules/user_settings/FrecencyUserSettingsManager.tsx; dependencies: [5, 6, 7, 15, 17, 18, 7863, 7862, 6540, 6582, 6586, 1348, 670, 4238, 672, 1362, 1349, 1350, 4860, 22, 2] */ function _fun120600(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120600, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:6, offset: 0x02530c68, size: 634 bytes, params: 8, frame: 23 const env0_0 = require; const saveProtos = function() { return _saveProtos.apply(this, arguments); }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importDefault(5) /* metro dependency 5 */; const env0_4 = importDefault(6) /* metro dependency 6 */; const env0_5 = importDefault(7) /* metro dependency 7 */; const env0_6 = importDefault(15) /* metro dependency 15 */; const env0_7 = importDefault(17) /* metro dependency 17 */; const env0_8 = importDefault(18) /* metro dependency 18 */; const applicationCommandFrecencyStore = importDefault(7863) /* metro dependency 7863: ApplicationCommandFrecencyStore */; const applicationFrecencyStore = importDefault(7862) /* metro dependency 7862: ApplicationFrecencyStore */; const emojiStore = importDefault(6540) /* metro dependency 6540: EmojiStore */; const stickersPersistedStore = importDefault(6582) /* metro dependency 6582: StickersPersistedStore */; const frecencyStore = importDefault(6586) /* metro dependency 6586: FrecencyStore */; const env0_14 = (require(6586) /* metro dependency 6586: FrecencyStore */).MAX_NUM_SELECTED_ITEMS; const userSettingsProtoStore = importDefault(1348) /* metro dependency 1348: UserSettingsProtoStore */; const env0_16 = (require(670) /* metro dependency 670: UserSettingsConstants */).UserSettingsTypes; const env0_17 = (require(4238) /* metro dependency 4238: ApplicationConstants */).FREQUENCY_ITEM_LIMIT; let Math = global.Math; let value = Math.random(); let Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; const SECOND = Millis.SECOND; const env0_18 = 10 + value * (10 * SECOND); Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; const HOUR = Millis.HOUR; value = 2 * HOUR; Math = global.Math; const floor = Math.floor; const Math2 = global.Math; const value2 = Math2.random(); Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; const MINUTE = Millis.MINUTE; const env0_19 = value + Reflect.apply(floor, Math, [value2 * (10 * MINUTE)]); value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */; value = _fun120614(value); value = new value(); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/user_settings/FrecencyUserSettingsManager.tsx'); exports.default = value; } function _isNativeReflectConstruct_120601() { // fn#120601, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:315, offset: 0x02530ee2, 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_120601_isNativeReflectConstruct = function() { return !!result; })(); } function handleConnectionOpen_120604() { // fn#120604, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:650, offset: 0x02530f44, size: 27 bytes, params: 1, frame: 13 resetTimer(env0_18, true); } function handleAppStateUpdate_120605(a0) { // fn#120605, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:704, offset: 0x02530f5f, size: 69 bytes, params: 2, frame: 12 if (env0_21 && a0.state !== 'active') { global.clearTimeout(env0_20); saveProtos(false); } } function handleConnectionClosed_120606() { // fn#120606, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:800, offset: 0x02530fa4, size: 50 bytes, params: 1, frame: 12 if (env0_21) { global.clearTimeout(env0_20); saveProtos(false); } } function _saveProtos() { // fn#120608, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:940, offset: 0x02530fd6, size: 50 bytes, params: 1, frame: 14 return env0_3(_fun120610).apply(this, arguments); } function resetTimer(a0, a1) { // fn#120612, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:1419, offset: 0x0253114d, size: 73 bytes, params: 3, frame: 14 const env0_0 = a1; if (env0_20 != null) { global.clearTimeout(env0_20); } env0_20 = global.setTimeout(function() { return saveProtos(require); }, a0); } function _fun120614(a0) { // fn#120614, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:1515, offset: 0x025311ad, size: 72 bytes, params: 2, frame: 15 const closure = FrecencyUserSettingsManager; env0_8(closure, a0); return env0_5(closure, [{key: '_initialize', value: value_120616}]); } function* _fun120610(a0) { // fn#120610, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:985, offset: 0x02531013, size: 295 bytes, params: 2, frame: 17 var environment; var r3; var binding2; var FrecencyUserSettingsActionCreators; var binding3; var value7; var forEach; if (true) { value = environment.__proto__.__proto__; var binding = env2_28; binding(env2_19, false); var hasLoaded = env2_15.hasLoaded; var FRECENCY_AND_FAVORITES_SETTINGS = env2_16.FRECENCY_AND_FAVORITES_SETTINGS; if (Reflect.apply(hasLoaded, binding, [FRECENCY_AND_FAVORITES_SETTINGS])) { binding = env2_1; binding3 = env2_2; value7 = binding(binding3[19]); forEach = value7.forEach; binding = env2_0; Reflect.apply(forEach, value7, [binding(binding3[15]).UserSettingsActionCreatorsByType, function(a0) { a0.markDirtyIfHasPendingChange(); }]); } else { binding = env2_12; r3 = binding.hasPendingUsage() || env2_11.hasPendingUsage(); r3 = !r3 ? env2_9.hasPendingUsage() : r3; r3 = !r3 ? env2_10.hasPendingUsage() : r3; r3 = !r3 ? env2_13.hasPendingUsage() && !a0 : r3; if (r3) { binding = env2_0; binding2 = env2_2; binding(binding2[15]).markUserSettingsLoadOkayForDevelopment(); FrecencyUserSettingsActionCreators = binding(binding2[15]).FrecencyUserSettingsActionCreators; yield FrecencyUserSettingsActionCreators.loadIfNecessary(); if (false) { return undefined; } binding = env2_1; binding3 = env2_2; value7 = binding(binding3[19]); forEach = value7.forEach; binding = env2_0; Reflect.apply(forEach, value7, [binding(binding3[15]).UserSettingsActionCreatorsByType, function(a0) { a0.markDirtyIfHasPendingChange(); }]); return undefined; } binding = env2_1; binding3 = env2_2; value7 = binding(binding3[19]); forEach = value7.forEach; binding = env2_0; Reflect.apply(forEach, value7, [binding(binding3[15]).UserSettingsActionCreatorsByType, function(a0) { a0.markDirtyIfHasPendingChange(); }]); } } } function FrecencyUserSettingsManager(a0) { // fn#120615, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:1527, offset: 0x025311f5, size: 166 bytes, params: 2, frame: 20 var r0; var Reflect; let value = copyRestArgs(0, undefined); let binding = env1_4; binding(this, FrecencyUserSettingsManager); const items = []; arraySpread(items, value, 0, items); value = env1_7(FrecencyUserSettingsManager); binding = env1_6; if (_isNativeReflectConstruct_120601()) { Reflect = global.Reflect; value = Reflect.construct(value, items, env1_7(this).constructor); r0 = value; } else { value = value.apply(this, items); r0 = value; } value = binding(this, r0); const handleConnectionOpen_120604Binding = handleConnectionOpen_120604; value.actions = {POST_CONNECTION_OPEN: handleConnectionOpen_120604Binding, CONNECTION_RESUMED: handleConnectionOpen_120604Binding, CONNECTION_CLOSED: handleConnectionClosed_120606, APP_STATE_UPDATE: handleAppStateUpdate_120605}; return value; } function value_120616() { // fn#120616, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:2065, offset: 0x0253129b, size: 362 bytes, params: 1, frame: 17 const FrecencyUserSettingsActionCreators = (require(1362) /* metro dependency 1362: UserSettingsProtoActionCreators */).FrecencyUserSettingsActionCreators; let beforeSendCallbacks = FrecencyUserSettingsActionCreators.beforeSendCallbacks; beforeSendCallbacks.push({hasChanges: function() { return false; }, processProto: processProto}); beforeSendCallbacks = FrecencyUserSettingsActionCreators.beforeSendCallbacks; beforeSendCallbacks.push({hasChanges: hasChanges_120619, processProto: processProto_120620}); beforeSendCallbacks = FrecencyUserSettingsActionCreators.beforeSendCallbacks; beforeSendCallbacks.push({hasChanges: hasChanges_120621, processProto: processProto_120622}); beforeSendCallbacks = FrecencyUserSettingsActionCreators.beforeSendCallbacks; beforeSendCallbacks.push({hasChanges: hasChanges_120623, processProto: processProto_120624}); beforeSendCallbacks = FrecencyUserSettingsActionCreators.beforeSendCallbacks; beforeSendCallbacks.push({hasChanges: hasChanges_120625, processProto: processProto_120626}); beforeSendCallbacks = FrecencyUserSettingsActionCreators.beforeSendCallbacks; beforeSendCallbacks.push({hasChanges: hasChanges_120627, processProto: processProto_120628}); } function value_120616ProcessProto() { // fn#120618, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:2177, owner: value_120616.processProto, offset: 0x02531405, size: 23 bytes, params: 1, frame: 13 resetTimer(env2_19, false); } function value_120616HasChanges_120619() { // fn#120619, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:2283, owner: value_120616.hasChanges, offset: 0x0253141c, size: 47 bytes, params: 1, frame: 12 const value = environment.__proto__.__proto__; return StickersPersistedStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS); } function value_120616ProcessProto_120620(a0) { // fn#120620, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:2368, owner: value_120616.processProto, offset: 0x0253144b, size: 153 bytes, params: 2, frame: 16 var StickerFrecency; var stickerFrecency; var moduleValue; if (StickersPersistedStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS)) { StickerFrecency = (require(1349) /* metro dependency 1349: frecency_user_settings */).StickerFrecency; a0.stickerFrecency = StickerFrecency.create(); stickerFrecency = a0.stickerFrecency; moduleValue = require(1350) /* metro dependency 1350: UserSettingsUtils */; stickerFrecency.stickers = moduleValue.serializeUsageHistory(StickersPersistedStore.stickerFrecencyWithoutFetchingLatest.usageHistory, 100); } } function value_120616HasChanges_120621() { // fn#120621, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:2694, owner: value_120616.hasChanges, offset: 0x025314e4, size: 47 bytes, params: 1, frame: 12 const value = environment.__proto__.__proto__; return EmojiStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS); } function value_120616ProcessProto_120622(a0) { // fn#120622, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:2779, owner: value_120616.processProto, offset: 0x02531513, size: 235 bytes, params: 2, frame: 20 const EmojiFrecency = (require(1349) /* metro dependency 1349: frecency_user_settings */).EmojiFrecency; var create; var emojiFrecency; var moduleValue; var serializeUsageHistory; var usageHistory; var emojiReactionFrecency; var moduleValue2; if (EmojiStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS)) { create = EmojiFrecency.create; a0.emojiFrecency = Reflect.apply(create, EmojiFrecency, []); create = EmojiFrecency.create; a0.emojiReactionFrecency = Reflect.apply(create, EmojiFrecency, []); emojiFrecency = a0.emojiFrecency; moduleValue = require(1350) /* metro dependency 1350: UserSettingsUtils */; serializeUsageHistory = moduleValue.serializeUsageHistory; usageHistory = EmojiStore.emojiFrecencyWithoutFetchingLatest.usageHistory; emojiFrecency.emojis = Reflect.apply(serializeUsageHistory, moduleValue, [usageHistory, 100]); emojiReactionFrecency = a0.emojiReactionFrecency; moduleValue2 = require(1350) /* metro dependency 1350: UserSettingsUtils */; serializeUsageHistory = moduleValue2.serializeUsageHistory; usageHistory = EmojiStore.emojiReactionFrecencyWithoutFetchingLatest.usageHistory; emojiReactionFrecency.emojis = Reflect.apply(serializeUsageHistory, moduleValue2, [usageHistory, 100]); } } function value_120616HasChanges_120623() { // fn#120623, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:3276, owner: value_120616.hasChanges, offset: 0x025315fe, size: 47 bytes, params: 1, frame: 12 const value = environment.__proto__.__proto__; return ApplicationCommandFrecencyStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS); } function value_120616ProcessProto_120624(a0) { // fn#120624, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:3361, owner: value_120616.processProto, offset: 0x0253162d, size: 162 bytes, params: 2, frame: 16 var ApplicationCommandFrecency; var applicationCommandFrecency; var moduleValue; if (ApplicationCommandFrecencyStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS)) { ApplicationCommandFrecency = (require(1349) /* metro dependency 1349: frecency_user_settings */).ApplicationCommandFrecency; a0.applicationCommandFrecency = ApplicationCommandFrecency.create(); applicationCommandFrecency = a0.applicationCommandFrecency; moduleValue = require(1350) /* metro dependency 1350: UserSettingsUtils */; applicationCommandFrecency.applicationCommands = moduleValue.serializeUsageHistory(ApplicationCommandFrecencyStore.getCommandFrecencyWithoutLoadingLatest().usageHistory, 500); } } function value_120616HasChanges_120625() { // fn#120625, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:3735, owner: value_120616.hasChanges, offset: 0x025316cf, size: 47 bytes, params: 1, frame: 12 const value = environment.__proto__.__proto__; return ApplicationFrecencyStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS); } function value_120616ProcessProto_120626(a0) { // fn#120626, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:3820, owner: value_120616.processProto, offset: 0x025316fe, size: 158 bytes, params: 2, frame: 16 var ApplicationFrecency; var applicationFrecency; var moduleValue; if (ApplicationFrecencyStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS)) { ApplicationFrecency = (require(1349) /* metro dependency 1349: frecency_user_settings */).ApplicationFrecency; a0.applicationFrecency = ApplicationFrecency.create(); applicationFrecency = a0.applicationFrecency; moduleValue = require(1350) /* metro dependency 1350: UserSettingsUtils */; applicationFrecency.applications = moduleValue.serializeUsageHistory(ApplicationFrecencyStore.getApplicationFrecencyWithoutLoadingLatest().usageHistory, FREQUENCY_ITEM_LIMIT); } } function value_120616HasChanges_120627() { // fn#120627, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:4168, owner: value_120616.hasChanges, offset: 0x0253179c, size: 47 bytes, params: 1, frame: 12 const value = environment.__proto__.__proto__; return FrecencyStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS); } function value_120616ProcessProto_120628(a0) { // fn#120628, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15923:4253, owner: value_120616.processProto, offset: 0x025317cb, size: 154 bytes, params: 2, frame: 16 var GuildAndChannelFrecency; var guildAndChannelFrecency; var moduleValue; if (FrecencyStore.hasPendingUsage() && UserSettingsProtoStore.hasLoaded(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS)) { GuildAndChannelFrecency = (require(1349) /* metro dependency 1349: frecency_user_settings */).GuildAndChannelFrecency; a0.guildAndChannelFrecency = GuildAndChannelFrecency.create(); guildAndChannelFrecency = a0.guildAndChannelFrecency; moduleValue = require(1350) /* metro dependency 1350: UserSettingsUtils */; guildAndChannelFrecency.guildAndChannels = moduleValue.serializeUsageHistory(FrecencyStore.frecencyWithoutFetchingLatest.usageHistory, MAX_NUM_SELECTED_ITEMS); } }