/* Metro module 4006; source: modules/guild_themes/native/useRoutedActiveGuildTheme.tsx; dependencies: [57, 31, 661, 4007, 4008, 4037, 4038, 2] */ function _fun32972(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#32972, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:6, offset: 0x01023fe8, size: 175 bytes, params: 8, frame: 19 const env0_0 = require; const getActiveGuildThemeGuildIdSnapshot = function() { var value5; var value2 = require(dependencyMap[4]).getRootNavigationRef(); var value3 = null; if (value3 != value2) { if (value2.isReady()) { value5 = _fun32975(value2.getRootState()); return value3 == value5 || value5 === ME ? value3 : value5; } } return value3; }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importDefault(57) /* metro dependency 57 */; const env0_4 = importAll(31) /* metro dependency 31 */; const env0_5 = (require(661) /* metro dependency 661: Constants */).ME; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guild_themes/native/useRoutedActiveGuildTheme.tsx'); exports.default = function() { return require(dependencyMap[6]).useActiveGuildThemeForGuildId(_fun32978()); }; } function getGuildIdFromNavigationState(a0) { // fn#32973, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:129, offset: 0x01024097, size: 95 bytes, params: 2, frame: 14 var guildId; var r0; var property; var value; if (a0 != null) { var routes = a0.routes; if (routes != null) { property = routes[a0.index]; value = undefined; guildId = property == null || property.params == null ? value : property.params.guildId; if (guildId != null) { r0 = guildId; } else { value = getGuildIdFromNavigationState(property == null ? value : property.state); r0 = value; } return r0; } } } function getActiveGuildThemeGuildIdSnapshot() { // fn#32974, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:353, offset: 0x010240f6, size: 102 bytes, params: 1, frame: 13 var value5; const rootNavigationRef = (require(4008) /* metro dependency 4008: RootNavigationRefNative */).getRootNavigationRef(); let value3 = null; if (value3 != rootNavigationRef) { if (rootNavigationRef.isReady()) { value5 = ((a0) => { var r4; var getGuildIdFromNavigationStateBinding = getGuildIdFromNavigationState; var value2 = undefined; var value3 = getGuildIdFromNavigationStateBinding(a0); if (value3 != null) { return value3; } r4 = a0 == null || a0.routes == null ? value2 : a0.routes.map((require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */).coerceMainRoute).find(_fun32976); return getGuildIdFromNavigationState(r4 == null ? value2 : r4.state); })(rootNavigationRef.getRootState()); return value3 == value5 || value5 === ME ? value3 : value5; } } return value3; } function useRoutedActiveGuildTheme() { // fn#32977, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:887, offset: 0x010241dc, size: 49 bytes, params: 1, frame: 13 return (require(4038) /* metro dependency 4038: GuildThemeResolver */).useActiveGuildThemeForGuildId(useRoutedActiveGuildThemeGuildId()); } function getGuildIdFromRootNavigationState(a0) { // fn#32975, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:479, owner: getActiveGuildThemeGuildIdSnapshot.getGuildIdFromRootNavigationState, offset: 0x0102415c, size: 128 bytes, params: 2, frame: 18 const getGuildIdFromNavigationStateBinding = getGuildIdFromNavigationState; const value2 = undefined; const guildIdFromNavigationStateBinding = getGuildIdFromNavigationStateBinding(a0); if (guildIdFromNavigationStateBinding != null) { return guildIdFromNavigationStateBinding; } const r4 = a0 == null || a0.routes == null ? value2 : a0.routes.map((require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */).coerceMainRoute).find(function(a0) { return a0 != null; }); return getGuildIdFromNavigationState(r4 == null ? value2 : r4.state); } function useRoutedActiveGuildThemeGuildId() { // fn#32978, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:930, owner: useRoutedActiveGuildTheme.useRoutedActiveGuildThemeGuildId, offset: 0x0102420d, size: 128 bytes, params: 1, frame: 17 var environment; const value = environment.__proto__; const binding = env1_4; const value2 = binding.useContext(importDefault(4037) /* metro dependency 4037: GuildThemeGuildIdOverrideContext */); const useState = binding.useState; const value4 = env1_3(Reflect.apply(useState, binding, [getActiveGuildThemeGuildIdSnapshot]), 2); const property = value4[0]; const env0_0 = value4[1]; binding.useEffect(_fun32979, []); return value2 === undefined ? property : value2 === ME ? null : value2; } function _fun32979() { // fn#32979, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:1094, offset: 0x0102428d, size: 72 bytes, params: 1, frame: 13 var environment; var closure; let value = environment.__proto__.__proto__; value = require(4008) /* metro dependency 4008: RootNavigationRefNative */; value = value.getRootNavigationRef(); if (value != null) { closure = handleStateChange_32980; closure(); return value.addListener('state', closure); } } function handleStateChange_32980() { // fn#32980, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4164:1170, offset: 0x010242d5, size: 27 bytes, params: 1, frame: 11 env1_0(getActiveGuildThemeGuildIdSnapshot()); }