/* Metro module 1310; source: modules/user_settings/ThemeStore.tsx; dependencies: [6, 7, 15, 17, 18, 1311, 1312, 1348, 1313, 670, 661, 1347, 1353, 1361, 566, 1362, 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 Dispatcher from '../../Dispatcher.tsx'; /* Metro dependency 694 */ import SelectivelySyncedUserSettingsStore from './SelectivelySyncedUserSettingsStore.tsx'; /* Metro dependency 1311 */ import UnsyncedUserSettingsStore from './UnsyncedUserSettingsStore.tsx'; /* Metro dependency 1312 */ import GetSystemThemeNative from '../themes/getSystemTheme.native.tsx'; /* Metro dependency 1347 */ import UserSettingsProtoStore from './UserSettingsProtoStore.tsx'; /* Metro dependency 1348 */ import ResolveThemeNative from '../themes/resolveTheme.native.tsx'; /* Metro dependency 1353 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ import * as UserSettingsConstantsModule from './UserSettingsConstants.tsx'; /* Metro dependency 670 */ import * as ThemeConstantsModule from './ThemeConstants.tsx'; /* Metro dependency 1313 */ function _fun14439(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#14439, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1437:6, offset: 0x00e07076, size: 616 bytes, params: 8, frame: 22 const env0_0 = require; const CACHE_LOADED2 = CACHE_LOADED; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = ThemeConstantsModule; const env0_11 = value.SystemTheme; const THEME_PREFERENCES_MOBILE = value.THEME_PREFERENCES_MOBILE; value.THEME_PREFERENCES_WEB_REFRESH; const env0_15 = ({UNSET: 0, [0]: 'UNSET', SET: 1, [1]: 'SET'}).UNSET; const env0_18 = THEME_PREFERENCES_MOBILE[(GetSystemThemeNative)()]; const PersistedStore = (Flux).PersistedStore; value = _fun14444(PersistedStore); value.displayName = 'ThemeStore'; value.persistKey = 'ThemeStore'; value.migrations = [function(a0) { var r2; var theme = a0.theme; r2 = theme !== 'amoled' ? theme : 'midnight'; var object = {}; copyDataProperties(object, a0, r2); object['theme'] = r2; return object; }, _fun14452]; value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {CACHE_LOADED: CACHE_LOADED2, CONNECTION_OPEN: function() { _fun14454(); return CACHE_LOADED(); }, LOGOUT: LOGOUT_14457, OVERLAY_INITIALIZE: CACHE_LOADED2, SELECTIVELY_SYNCED_USER_SETTINGS_UPDATE: CACHE_LOADED2, UNSYNCED_USER_SETTINGS_UPDATE: CACHE_LOADED2, USER_SETTINGS_PROTO_UPDATE: CACHE_LOADED2, RESET_PREVIEW_CLIENT_THEME: CACHE_LOADED2, SYSTEM_THEME_CHANGE: function(a0) { env0_17 = a0.systemTheme; return CACHE_LOADED(); }, UPDATE_THEME_PREFERENCES: function(a0) { var r2; var object = {}; copyDataProperties(object, THEME_PREFERENCES_MOBILE, r2); copyDataProperties(object, a0.preferences, a0); env0_16 = object; return CACHE_LOADED(); }, SET_THEME_OVERRIDE: function(a0) { a0.theme; return CACHE_LOADED(); }, CLEAR_THEME_OVERRIDE: function() { return CACHE_LOADED(); }, REFRESH_THEME: function() { return CACHE_LOADED(); }}); (FileImportTrackerModule).fileFinishedImporting('modules/user_settings/ThemeStore.tsx'); exports.default = value; function _isNativeReflectConstruct_14440() { // fn#14440, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1437:317, offset: 0x00e072de, 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_14440_isNativeReflectConstruct = function() { return !!result; })(); } function CACHE_LOADED() { // fn#14443, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1437:617, offset: 0x00e0733c, size: 87 bytes, params: 1, frame: 15 var r0; const value2 = (ResolveThemeNative)(env0_17, THEME_PREFERENCES_MOBILE); const value3 = value2 !== env0_18; if (value3) { (importDefault(1361) /* metro dependency 1361: updateBackgroundColorNative */)(value2); r0 = true; } else { r0 = value3; } return r0; } function _fun14444(a0) { // fn#14444, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1437:741, offset: 0x00e07393, size: 162 bytes, params: 2, frame: 16 const ThemeStore2 = ThemeStore; Inherits(ThemeStore2, a0); return CreateClass(ThemeStore2, [{key: 'initialize', value: value_14446}, {key: 'getState', value: function() { return {theme: this.theme, preferences: THEME_PREFERENCES_MOBILE, status: UNSET}; }}, {key: 'theme', get: get_14448}, {key: 'systemTheme', get: get_14449}, {key: 'themePreferenceForSystemTheme', value: function(a0) { return THEME_PREFERENCES_MOBILE[a0]; }}]); function ThemeStore() { // fn#14445, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1437:753, offset: 0x00e07435, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_3(this, ThemeStore); const value3 = env1_6(ThemeStore); return env1_5(this, _isNativeReflectConstruct_14440() ? global.Reflect.construct(value3, arguments, env1_6(this).constructor) : value3.apply(this, arguments)); } function value_14446(a0) { // fn#14446, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1437:1021, offset: 0x00e074a6, size: 135 bytes, params: 2, frame: 18 var value2; var SET; var preferences; const value = undefined; if ((a0 == null ? value : a0.theme) != null) { value2 = environment.__proto__; SET = env1_14.SET; (importDefault(1361) /* metro dependency 1361: updateBackgroundColorNative */)(a0.theme); preferences = a0.preferences; if (preferences != null) { preferences = a0.preferences; } } this.waitFor(UnsyncedUserSettingsStore, SelectivelySyncedUserSettingsStore, UserSettingsProtoStore); return value; } function get_14448() { // fn#14448, offset: 0x00df0e82, size: 9 bytes, params: 1, frame: 1 return env1_18; } function get_14449() { // fn#14449, offset: 0x00e07553, size: 9 bytes, params: 1, frame: 1 return env1_17; } } function _fun14452(a0) { // fn#14452, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1437:1558, offset: 0x00e0758a, size: 121 bytes, params: 2, frame: 14 var r0; var DARK; var property; var object; var object2; const value = a0; let preferences = value.preferences; if (preferences == null) { r0 = value; } else { preferences = value.preferences; DARK = SystemTheme.DARK; property = preferences[DARK]; DARK = ThemeTypes.DARK; if (property !== DARK) { r0 = value; } else { object = {}; copyDataProperties(object, value, value); object2 = {}; copyDataProperties(object2, value.preferences, value); object2[SystemTheme.DARK] = ThemeTypes.DARKER; object['preferences'] = object2; r0 = object; } } return r0; } function CONNECTION_OPEN_14453() { // fn#14453, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1437:1741, offset: 0x00e07603, size: 26 bytes, params: 1, frame: 9 migrateDarkSidebarToProto(); return CACHE_LOADED(); function migrateDarkSidebarToProto() { // fn#14454, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1437:1780, owner: CONNECTION_OPEN_14453.migrateDarkSidebarToProto, offset: 0x00e0761d, size: 157 bytes, params: 1, frame: 18 var environment; var PreloadedUserSettingsActionCreators; const value = environment.__proto__; if (UnsyncedUserSettingsStore.darkSidebar) { if (!UserSettingsProtoStore.settings.appearance?.darkSidebar) { PreloadedUserSettingsActionCreators = (require(1362) /* metro dependency 1362: UserSettingsProtoActionCreators */).PreloadedUserSettingsActionCreators; PreloadedUserSettingsActionCreators.updateAsync('appearance', function(a0) { a0.darkSidebar = true; }, UserSettingsDelay.INFREQUENT_USER_ACTION); } (importDefault(694) /* metro dependency 694: Dispatcher */).wait(_fun14456); } function _fun14456() { // fn#14456, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1437:2030, offset: 0x00e076c9, size: 61 bytes, params: 1, frame: 14 const value = environment.__proto__.__proto__; (Dispatcher).dispatch({type: 'UNSYNCED_USER_SETTINGS_UPDATE', settings: {darkSidebar: false}}); } } } function LOGOUT_14457({isSwitchingAccount}) { // fn#14457, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1437:2154, offset: 0x00e07706, size: 30 bytes, params: 2, frame: 10 return !isSwitchingAccount && CACHE_LOADED(); } } global.__d(_fun14439, 1310, [6, 7, 15, 17, 18, 1311, 1312, 1348, 1313, 670, 661, 1347, 1353, 1361, 566, 1362, 694, 2]) /* metro module 1310, dependencies: [6, 7, 15, 17, 18, 1311, 1312, 1348, 1313, 670, 661, 1347, 1353, 1361, 566, 1362, 694, 2] */;