Files
2026-07-28 01:06:53 +03:00

186 lines
9.7 KiB
TypeScript

/* Metro module 6582; source: modules/stickers/StickersPersistedStore.tsx; dependencies: [6, 7, 15, 17, 18, 1348, 6583, 670, 672, 4393, 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 Durations from '../../utils/Durations.tsx'; /* Metro dependency 672 */
import UserSettingsProtoStore from '../user_settings/UserSettingsProtoStore.tsx'; /* Metro dependency 1348 */
import Frecency from '../../lib/Frecency.tsx'; /* Metro dependency 4393 */
import StickersStore from './StickersStore.tsx'; /* Metro dependency 6583 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as UserSettingsConstantsModule from '../user_settings/UserSettingsConstants.tsx'; /* Metro dependency 670 */
function _fun51717(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#51717, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6760:6, offset: 0x012e35e8, size: 498 bytes, params: 8, frame: 20
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
object = {pendingUsages: []};
const Millis = (Durations).Millis;
const DAY = Millis.DAY;
let value = Frecency;
value = new value({computeBonus: function() {
return 100;
}, lookupKey: function(a0) {
return StickersStore.getStickerById(a0);
}, afterCompute: function() {
}, numFrequentlyItems: 20});
const handleStickersStoreUpdate = function() {
recomputeStickerFrecency();
};
const PersistedStore = (Flux).PersistedStore;
value = _fun51729(PersistedStore);
value.displayName = 'StickersPersistedStore';
value.persistKey = 'StickersPersistedStoreV2';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
{STICKER_TRACK_USAGE: function({stickerIds}) {
if (stickerIds != null) {
stickerIds.forEach(_fun51736);
}
recomputeStickerFrecency();
}, USER_SETTINGS_PROTO_UPDATE: USER_SETTINGS_PROTO_UPDATE_51737});
(FileImportTrackerModule).fileFinishedImporting('modules/stickers/StickersPersistedStore.tsx');
exports.default = value;
exports.STICKER_PACK_NEW_TIMESTAMP_THRESHOLD = DAY;
function _isNativeReflectConstruct_51718() { // fn#51718, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6760:196, offset: 0x012e37da, size: 94 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_51718_isNativeReflectConstruct = function() {
return !!result;
})();
}
function handleUserSettingsProtoStoreChange_51721() { // fn#51721, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6760:663, offset: 0x012e3838, size: 113 bytes, params: 1, frame: 17
const stickerFrecency = UserSettingsProtoStore.frecencyWithoutFetchingLatest.stickerFrecency;
const value2 = undefined;
const stickers = stickerFrecency == null ? value2 : stickerFrecency.stickers;
if (stickers == null) {
return false;
}
const binding = env0_11;
binding.overwriteHistory((importDefault(22) /* metro dependency 22 */).mapValues(stickers, function(a0) {
var r3;
var object = {};
copyDataProperties(object, a0, r3);
var value = a0.recentUses.map(global.Number);
value = value.filter(_fun51723);
object['recentUses'] = value;
return object;
}), env0_10.pendingUsages);
return value2;
function _fun51722(a0) { // fn#51722, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6760:854, offset: 0x012e38a9, size: 67 bytes, params: 2, frame: 13
const object = {};
copyDataProperties(object, a0, undefined);
const recentUses = a0.recentUses;
const map = recentUses.map;
const Number = global.Number;
let value = Reflect.apply(map, recentUses, [Number]);
value = value.filter(function(a0) {
return a0 > 0;
});
object['recentUses'] = value;
return object;
}
}
function recomputeStickerFrecency() { // fn#51727, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6760:574, offset: 0x012e3903, size: 34 bytes, params: 1, frame: 9
if (StickersStore.isLoaded) {
env0_11.compute();
}
}
function _fun51729(a0) { // fn#51729, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6760:944, offset: 0x012e3934, size: 137 bytes, params: 2, frame: 16
const StickersPersistedStore2 = StickersPersistedStore;
Inherits(StickersPersistedStore2, a0);
return CreateClass(StickersPersistedStore2, [{key: 'initialize', value: function(a0) {
this.waitFor(StickersStore, UserSettingsProtoStore);
if (a0 != null) {
env1_10 = a0;
}
this.syncWith([StickersStore], handleStickersStoreUpdate);
this.syncWith([UserSettingsProtoStore], handleUserSettingsProtoStoreChange_51721);
}}, {key: 'getState', value: value_51732}, {key: 'hasPendingUsage', value: value_51733},
{key: 'stickerFrecencyWithoutFetchingLatest', get: get_51734}]);
function StickersPersistedStore() { // fn#51730, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6760:956, offset: 0x0118e06f, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_2(this, StickersPersistedStore);
const value3 = env1_5(StickersPersistedStore);
return env1_4(this, _isNativeReflectConstruct_51718() ? global.Reflect.construct(value3, arguments,
env1_5(this).constructor) : value3.apply(this, arguments));
}
function value_51732() { // fn#51732, offset: 0x00fbd9ec, size: 9 bytes, params: 1, frame: 1
return env1_10;
}
function value_51733() { // fn#51733, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6760:1503, offset: 0x012e3a20, size: 26 bytes, params: 1, frame: 2
return env1_10.pendingUsages.length > 0;
}
function get_51734() { // fn#51734, offset: 0x00ef8482, size: 9 bytes, params: 1, frame: 1
return env1_11;
}
}
function STICKER_TRACK_USAGE({stickerIds}) { // fn#51735, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6760:1767, offset: 0x012e3a3a, size: 47 bytes, params: 2, frame: 11
if (stickerIds != null) {
stickerIds.forEach(_fun51736);
}
recomputeStickerFrecency();
function _fun51736(a0) { // fn#51736, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6760:1806, offset: 0x012e3a69, size: 72 bytes, params: 2, frame: 13
env1_11.track(a0);
const pendingUsages = env1_10.pendingUsages;
const push = pendingUsages.push;
const object = {key: a0};
const Date = global.Date;
object.timestamp = Date.now();
Reflect.apply(push, pendingUsages, [object]);
}
}
function USER_SETTINGS_PROTO_UPDATE_51737({settings, wasSaved}) { // fn#51737, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6760:1930, offset: 0x012e3ab1, size: 62 bytes, params: 2, frame: 4
const type = settings.type;
const FRECENCY_AND_FAVORITES_SETTINGS = UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS;
if (type === FRECENCY_AND_FAVORITES_SETTINGS) {
if (wasSaved) {
env0_10.pendingUsages = [];
return undefined;
}
}
return false;
}
}
function _fun51723(a0) { // fn#51723, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6760:908, offset: 0x011bbce4, size: 11 bytes, params: 2, frame: 2
return a0 > 0;
}
global.__d(_fun51717, 6582, [6, 7, 15, 17, 18, 1348, 6583, 670, 672, 4393, 22, 566, 694,
2]) /* metro module 6582, dependencies: [6, 7, 15, 17, 18, 1348, 6583, 670, 672, 4393, 22, 566, 694, 2] */;