/* Metro module 4046; source: modules/client_themes/SavedCustomThemeStore.tsx; dependencies: [6, 7, 15, 17, 18, 1313, 1216, 566, 694, 2] */ function _fun33372(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#33372, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:6, offset: 0x0102d43b, size: 422 bytes, params: 8, frame: 22 var object2; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_2 = importDefault(6) /* metro dependency 6 */; const env0_3 = importDefault(7) /* metro dependency 7 */; const env0_4 = importDefault(15) /* metro dependency 15 */; const env0_5 = importDefault(17) /* metro dependency 17 */; const env0_6 = importDefault(18) /* metro dependency 18 */; let value = require(1313) /* metro dependency 1313: ThemeConstants */; value.PROTO_THEME_MAP_WEB_REFRESH; const env0_7 = value.PROTO_THEME_MAP_MOBILE; object2 = {NOT_FETCHED: 0}; object2[0] = 'NOT_FETCHED'; object2.IS_FETCHING = 1; object2[1] = 'IS_FETCHING'; object2.HAS_FETCHED = 2; object2[2] = 'HAS_FETCHED'; object2.ERROR = 3; object2[3] = 'ERROR'; const env0_9 = []; const env0_10 = object2.NOT_FETCHED; const PersistedStore = (importDefault(566) /* metro dependency 566: flux */).PersistedStore; value = _fun33377(PersistedStore); value.displayName = 'SavedCustomThemeStore'; value.persistKey = 'SavedCustomThemeStore'; value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {SAVED_CUSTOM_THEMES_FETCH_START: SAVED_CUSTOM_THEMES_FETCH_START, SAVED_CUSTOM_THEMES_FETCH_SUCCESS: SAVED_CUSTOM_THEMES_FETCH_SUCCESS, SAVED_CUSTOM_THEMES_FETCH_FAILURE: SAVED_CUSTOM_THEMES_FETCH_FAILURE}); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/client_themes/SavedCustomThemeStore.tsx'); exports.default = value; exports.FetchState = object2; } function _isNativeReflectConstruct_33373() { // fn#33373, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:217, offset: 0x0102d5e1, 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_33373_isNativeReflectConstruct = function() { return !!result; })(); } function validateSavedTheme(a0) { // fn#33376, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:583, offset: 0x0102d63f, size: 180 bytes, params: 2, frame: 17 var r5; var r2; var r0; var value; var base_theme; var property; var colors; var length; var value2; var gradient_angle; var value3; var base_mix; var value4; var value5; var error; var captureMessage; var value6; try { value = environment; base_theme = a0.base_theme; property = PROTO_THEME_MAP_MOBILE[base_theme]; colors = a0.colors; length = colors.length; value2 = length > 0; if (value2) { gradient_angle = a0.gradient_angle; value3 = typeof gradient_angle === 'number'; r5 = value3; } else { r5 = value2; } if (r5) { base_mix = a0.base_mix; value4 = typeof base_mix === 'number'; r2 = value4; } else { r2 = r5; } if (r2) { value5 = property != null; r0 = value5; } else { r0 = r2; } } catch (error) { value = importDefault(1216) /* metro dependency 1216: SentryUtilsNative */; captureMessage = value.captureMessage; value6 = 'Invalid saved custom theme: ' + error; Reflect.apply(captureMessage, value, [value6, {tags: {app_context: 'SavedCustomThemeStore'}}]); return false; } return r0; } function _fun33377(a0) { // fn#33377, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:866, offset: 0x0102d6f3, size: 233 bytes, params: 2, frame: 16 const closure = SavedCustomThemeStore; env0_6(closure, a0); return env0_3(closure, [{key: 'initialize', value: value_33379}, {key: 'getState', value: value_33380}, {key: 'getSavedCustomTheme', value: value_33381}, {key: 'getFetchState', value: function() { return NOT_FETCHED; }}, {key: 'hasSavedCustomThemes', value: value_33383}, {key: 'isFetching', value: value_33384}, {key: 'hasFetched', value: value_33385}, {key: 'hasError', value: value_33386}]); } function SAVED_CUSTOM_THEMES_FETCH_START() { // fn#33387, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:1933, offset: 0x0102d8d2, size: 21 bytes, params: 1, frame: 2 env0_10 = env0_8.IS_FETCHING; } function SAVED_CUSTOM_THEMES_FETCH_SUCCESS({themes}) { // fn#33388, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:2024, offset: 0x0102d8e7, size: 65 bytes, params: 2, frame: 12 env0_10 = env0_8.HAS_FETCHED; env0_9 = themes.filter(validateSavedTheme).map(function(a0) { return {colors: a0.colors, gradient_angle: a0.gradient_angle, base_mix: a0.base_mix, base_theme: PROTO_THEME_MAP_MOBILE[a0.base_theme]}; }); } function SAVED_CUSTOM_THEMES_FETCH_FAILURE({error}) { // fn#33390, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:2244, offset: 0x0102d964, size: 81 bytes, params: 2, frame: 16 env0_10 = env0_8.ERROR; (importDefault(1216) /* metro dependency 1216: SentryUtilsNative */).captureException(error, {tags: {app_context: 'SavedCustomThemeStore'}}); } function value_33379(a0) { // fn#33379, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:1201, offset: 0x0102d7dc, size: 43 bytes, params: 2, frame: 2 var savedCustomThemes; var value; if (a0 != null) { savedCustomThemes = a0.savedCustomThemes; value = environment.__proto__; } env1_10 = env1_8.NOT_FETCHED; } function value_33380() { // fn#33380, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:1286, offset: 0x0102d807, size: 32 bytes, params: 1, frame: 4 return {savedCustomThemes: env1_9 ?? []}; } function value_33381() { // fn#33381, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:1371, offset: 0x0102d827, size: 71 bytes, params: 1, frame: 5 const binding = env1_9; const value2 = null; return (value2 == binding ? undefined : binding.length) > 0 && env1_9[0].colors.length > 0 ? env1_9[0] : value2; } function value_33383() { // fn#33383, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:1543, offset: 0x0102d86e, size: 31 bytes, params: 1, frame: 3 const value = environment.__proto__; return env1_9?.length > 0; } function value_33384() { // fn#33384, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:1624, offset: 0x0102d88d, size: 23 bytes, params: 1, frame: 2 const IS_FETCHING = env1_8.IS_FETCHING; return NOT_FETCHED === IS_FETCHING; } function value_33385() { // fn#33385, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:1686, offset: 0x0102d8a4, size: 23 bytes, params: 1, frame: 2 const HAS_FETCHED = env1_8.HAS_FETCHED; return NOT_FETCHED === HAS_FETCHED; } function value_33386() { // fn#33386, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:1746, offset: 0x0102d8bb, size: 23 bytes, params: 1, frame: 2 const ERROR = env1_8.ERROR; return NOT_FETCHED === ERROR; }