// Module ID: 4456 // Function ID: 4457 // Name: ClientThemesBackgroundStore // Dependencies: [1182, 1181, 1183, 1219, 1961, 1957, 1371, 1228, 1184, 4457, 1943, 4481, 4294, 1935, 4484, 4485, 504, 1227, 573, 2] // Module 4456 (ClientThemesBackgroundStore) import initializeDefault from "initialize" /* 504 */; import DispatcherDefault from "Dispatcher" /* 573 */; import ClientThemesUtils from "ClientThemesUtils" /* 1227 */; import UserSettings from "UserSettings" /* 1935 */; import dismissible_content from "dismissible_content" /* 1943 */; import PremiumUtilsDefault from "PremiumUtils" /* 4294 */; import DismissibleContentUnsafeUtils from "DismissibleContentUnsafeUtils" /* 4457 */; import SelectivelySyncedUserSettingsStore from "SelectivelySyncedUserSettingsStore" /* 1182 */; import ThemeStore from "ThemeStore" /* 1181 */; import UnsyncedUserSettingsStore from "UnsyncedUserSettingsStore" /* 1183 */; import UserSettingsProtoStore from "UserSettingsProtoStore" /* 1219 */; import ChannelStore from "ChannelStore" /* 1957 */; import UserStore from "UserStore" /* 1371 */; require = fn; function reset() { if (closure_14) { c3 = undefined; } c16 = false; c15 = false; } function handleUserStoreChange() { const tmp = !PremiumUtilsDefault.canUseClientThemes(UserStore.getCurrentUser()); if (tmp === closure_14) { return false; } else { closure_14 = tmp; c16 = false; } } function handleSelectivelySyncedStoreChange() { const ClientThemeSettings = UserSettings.ClientThemeSettings; const backgroundGradientPresetId = ClientThemeSettings.getSetting().backgroundGradientPresetId; if (null == backgroundGradientPresetId) { if (null == c3) { return false; } else { c3 = undefined; } } else if (dependencyMap[backgroundGradientPresetId] === c3) { return false; } else { c3 = tmp2; } } function handleSyncedModeChange() { return require("isPerModeThemingActive").isPerModeThemingActive(); } function handleSameAsDeviceThemeToggle() { return true; } function handleUserSettingsProtoStoreUpdate() { const ClientThemeSettings = UserSettings.ClientThemeSettings; const backgroundGradientPresetId = ClientThemeSettings.getSetting().backgroundGradientPresetId; let result = UnsyncedUserSettingsStore.useSystemTheme !== SystemThemeState.ON; if (!result) { result = null == backgroundGradientPresetId; } if (!result) { result = tmp(4484).isPerModeThemingActive(); const tmpResult = tmp(4484); } if (!result) { tmp(4485).setUseSystemTheme(SystemThemeState.OFF); const tmpResult2 = tmp(4485); } if (null != backgroundGradientPresetId) { let tmp10 = null == tmp9; if (!tmp10) { let id; if (_undefined != null) { id = _undefined.id; } let id1; if (tmp9 != null) { id1 = tmp9.id; } tmp10 = id === id1; } if (!tmp10) { _undefined = tmp9; } } else if (null != _undefined) { _undefined = undefined; } } const isGuildTextChannelType = fn(1961).isGuildTextChannelType; const dependencyMap = fn(1228).BACKGROUND_GRADIENT_PRESETS_MAP; const SystemThemeState = fn(1184).SystemThemeState; let closure_14 = true; let c15 = false; let c16 = false; const PersistedStore = initializeDefault.PersistedStore; class ClientThemesBackgroundStore extends PersistedStore { constructor() { applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target); items = []; items[0] = (gradientPreset) => { let gradientPresetId; if (gradientPreset != null) { gradientPreset = gradientPreset.gradientPreset; if (gradientPreset != null) { gradientPresetId = gradientPreset.id; } } return { gradientPresetId }; }; applyArgumentsResult.migrations = items; return applyArgumentsResult; } } const prototype = ClientThemesBackgroundStore.prototype; prototype["initialize"] = function initialize(gradientPresetId) { c16 = false; if (null != gradientPresetId) { let tmp; if (null != gradientPresetId.gradientPresetId) { tmp = dependencyMap[gradientPresetId.gradientPresetId]; } c3 = tmp; closure_14 = true !== gradientPresetId.canUseClientThemes; } this.waitFor(ChannelStore, SelectivelySyncedUserSettingsStore, ThemeStore, UnsyncedUserSettingsStore, UserSettingsProtoStore, UserStore); const items = [UserStore]; this.syncWith(items, handleUserStoreChange); const items1 = [SelectivelySyncedUserSettingsStore]; this.syncWith(items1, handleSelectivelySyncedStoreChange); }; prototype["getState"] = function getState() { if (closure_14) { let obj = {}; } else { let id; if (_undefined != null) { id = _undefined.id; } obj = { gradientPresetId: id, canUseClientThemes: true }; } return obj; }; Object.defineProperty(prototype, "gradientPreset", { get: function gradientPreset() { if (obj.isPerModeThemingActive()) { if (closure_14) { let tmp10; if (c16) { tmp10 = c3; } return tmp10; } else { const syncedClientTheme = ThemeStore.getSyncedClientTheme(ThemeStore.systemTheme); let prop; if (syncedClientTheme != null) { prop = syncedClientTheme.backgroundGradientPresetId; } let tmp7; if (null != prop) { tmp7 = dependencyMap[prop]; } return tmp7; } } else { return c3; } obj = require("isPerModeThemingActive"); }, set: undefined }); prototype["getLinearGradient"] = function getLinearGradient() { let linearGradientForBackgroundGradient = null; if (null != this.gradientPreset) { linearGradientForBackgroundGradient = ClientThemesUtils.getLinearGradientForBackgroundGradient(tmp.gradientPreset); } return linearGradientForBackgroundGradient; }; Object.defineProperty(prototype, "isPreview", { get: function isPreview() { return closure_14; }, set: undefined }); Object.defineProperty(prototype, "isCoachmark", { get: function isCoachmark() { return c15; }, set: undefined }); Object.defineProperty(prototype, "mobilePendingThemeIndex", { get: function mobilePendingThemeIndex() { return mobileThemesIndex; }, set: undefined }); ClientThemesBackgroundStore.displayName = "ClientThemesBackgroundStore"; ClientThemesBackgroundStore.persistKey = "ClientThemesBackgroundStore"; const clientThemesBackgroundStore = new ClientThemesBackgroundStore(DispatcherDefault, { UPDATE_BACKGROUND_GRADIENT_PRESET: function handleUpdateBackgroundGradientPreset(presetId) { presetId = presetId.presetId; c16 = closure_14; let tmp; if (null != presetId) { tmp = dependencyMap[presetId]; } c3 = tmp; }, UPDATE_MOBILE_PENDING_THEME_INDEX: function handleUpdateMobilePendingThemeIndex(mobileThemesIndex) { mobileThemesIndex = mobileThemesIndex.mobileThemesIndex; let tmp; if (null != mobileThemesIndex) { tmp = mobileThemesIndex; } mobileThemesIndex = tmp; }, RESET_PREVIEW_CLIENT_THEME: function handleResetPreviewClientTheme() { c3 = undefined; c16 = false; }, CLIENT_THEMES_EDITOR_CLOSE: reset, CHANNEL_SELECT: function handleChannelSelect(channelId) { channelId = channelId.channelId; if (null != channelId) { if (null != channelId.guildId) { if (!obj2.UNSAFE_isDismissibleContentDismissed(dismissible_content.DismissibleContent.CLIENT_THEMES_COACHMARK)) { if (tmp6Result.ageEligibleForPremiumUpsell(tmp)) { const channel = ChannelStore.getChannel(channelId); let tmp4 = null != channel; if (tmp4) { tmp4 = isGuildTextChannelType(channel.type); } if (tmp4) { c15 = true; } } tmp6Result = tmp6(4481); } obj2 = DismissibleContentUnsafeUtils; tmp6 = require; } } }, LOGOUT: reset, CACHE_LOADED: handleUserSettingsProtoStoreUpdate, CONNECTION_OPEN: handleUserSettingsProtoStoreUpdate, OVERLAY_INITIALIZE: handleUserSettingsProtoStoreUpdate, SELECTIVELY_SYNCED_USER_SETTINGS_UPDATE: handleUserSettingsProtoStoreUpdate, UNSYNCED_USER_SETTINGS_UPDATE: handleUserSettingsProtoStoreUpdate, USER_SETTINGS_PROTO_UPDATE: handleUserSettingsProtoStoreUpdate, SYSTEM_THEME_CHANGE: handleSyncedModeChange, UPDATE_SYNCED_CLIENT_THEME: handleSyncedModeChange, SET_SAME_AS_DEVICE_THEME_ENABLED: handleSameAsDeviceThemeToggle, CLEAR_SYNCED_CLIENT_THEMES: handleSameAsDeviceThemeToggle }); const size = fn(2); let result = size.fileFinishedImporting("modules/client_themes/ClientThemesBackgroundStore.tsx"); export default clientThemesBackgroundStore;