/* Metro module 14635; source: modules/premium/powerups/hooks/usePowerupActiveStatus.tsx; dependencies: [1867, 8258, 8260, 8259, 661, 566, 2] */ import GuildStore from '../../../../stores/GuildStore.tsx'; /* Metro dependency 1867 */ import GuildPowerupsStore from '../GuildPowerupsStore.tsx'; /* Metro dependency 8258 */ import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as FluxModule from '../../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import * as ConstantsModule from '../../../../Constants.tsx'; /* Metro dependency 661 */ import * as GuildPowerupsConstantsModule from '../constants/GuildPowerupsConstants.tsx'; /* Metro dependency 8259 */ import * as GameServerConstantsModule from '../../game_server/GameServerConstants.tsx'; /* Metro dependency 8260 */ function _fun110610(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#110610, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14832:6, offset: 0x0237f806, size: 256 bytes, params: 8, frame: 20 const env0_0 = require; const usePowerupsActiveStatuses2 = usePowerupsActiveStatuses; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('modules/premium/powerups/hooks/usePowerupActiveStatus.tsx'); exports.default = function(a0, a1) { var value2 = usePowerupsActiveStatuses(a0, a1 == null ? [] : [a1]); return value2.length <= 0 ? {type: PowerupActiveStatusType.INACTIVE, sourceEntitlement: undefined, sourcePowerup: undefined} : value2[0]; }; exports.isPowerupActiveStatusActive = function({type}) { return type !== PowerupActiveStatusType.INACTIVE; }; exports.usePowerupsActiveStatuses = usePowerupsActiveStatuses2; function usePowerupsActiveStatuses(a0, a1) { // fn#110611, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14832:321, offset: 0x0237f906, size: 204 bytes, params: 3, frame: 20 const env0_0 = a0; const value2 = undefined; const guild = (FluxModule).useStateFromStores([GuildStore], _fun110613); const env0_2 = (FluxModule).useStateFromStores([GuildPowerupsStore], _fun110614); const r3 = guild == null || guild.features == null ? value2 : guild.features.has(GuildFeatures.PREMIUM_TIER_3_OVERRIDE); const env0_3 = r3 != null && r3; return a1.map(function(a0) { return getPowerupActiveStatus(a0); }); function getPowerupActiveStatus(a0) { // fn#110612, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14832:570, owner: usePowerupsActiveStatuses.getPowerupActiveStatus, offset: 0x0237f9d2, size: 596 bytes, params: 2, frame: 19 var r3; var guildBinding; var value10; if (a0.skuId === GAME_SERVER_POWERUP_SKU_ID) { guildBinding = guild; value10 = undefined; r3 = guildBinding == null || guild.features == null ? value10 : guild.features.has(GuildFeatures.GAME_SERVERS); r3 = r3 == null ? PowerupActiveStatusType.INACTIVE : r3 ? PowerupActiveStatusType.POWERUP_ACTIVATED : PowerupActiveStatusType.INACTIVE; return {type: r3, powerup: a0, sourceEntitlement: value10, sourcePowerup: value10}; } const value2 = null; let r0 = value2 == a0 || value2 == guild || (value2 == stateForGuild || value2 == POWERUPS_INCLUDED_IN_LEVEL[a0.skuId]) ? {isActiveFromLevel: false, levelEntitlement: undefined, levelPowerup: undefined} : {isActiveFromLevel: guild.premiumTier >= POWERUPS_INCLUDED_IN_LEVEL[a0.skuId], levelEntitlement: value2 != BOOSTING_TIER_TO_LEVEL_SKU_ID[POWERUPS_INCLUDED_IN_LEVEL[a0.skuId]] ? value2 == stateForGuild.unlockedPowerups ? undefined : stateForGuild.unlockedPowerups[BOOSTING_TIER_TO_LEVEL_SKU_ID[POWERUPS_INCLUDED_IN_LEVEL[a0.skuId]]] : undefined, levelPowerup: value2 != BOOSTING_TIER_TO_LEVEL_SKU_ID[POWERUPS_INCLUDED_IN_LEVEL[a0.skuId]] ? value2 == stateForGuild.allPowerups ? undefined : stateForGuild.allPowerups[BOOSTING_TIER_TO_LEVEL_SKU_ID[POWERUPS_INCLUDED_IN_LEVEL[a0.skuId]]] : undefined}; const isActiveFromLevel = r0.isActiveFromLevel; const levelEntitlement = r0.levelEntitlement; const levelPowerup = r0.levelPowerup; const r8 = env0_3 && GUILD_POWERUP_TIER_3_OVERRIDDEN_SKUS.has(a0.skuId); const stateForGuildBinding = stateForGuild; const value8 = undefined; r0 = value2 == stateForGuildBinding || value2 == stateForGuild.unlockedPowerups ? value8 : stateForGuild.unlockedPowerups[a0.skuId]; const r7 = value2 != r0 ? r0 : value2; const INACTIVE = PowerupActiveStatusType.INACTIVE; return isActiveFromLevel ? {type: PowerupActiveStatusType.LEVEL_ACTIVATED, powerup: a0, sourceEntitlement: levelEntitlement, sourcePowerup: levelPowerup} : r8 ? {type: PowerupActiveStatusType.TIER_OVERRIDE_ACTIVATED, powerup: a0, sourceEntitlement: value8, sourcePowerup: a0} : value2 == r7 ? {type: INACTIVE, powerup: a0, sourceEntitlement: value8, sourcePowerup: value8} : {type: PowerupActiveStatusType.POWERUP_ACTIVATED, powerup: a0, sourceEntitlement: r7, sourcePowerup: a0}; } function _fun110613() { // fn#110613, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14832:403, offset: 0x01125050, size: 27 bytes, params: 1, frame: 11 return GuildStore.getGuild(env0_0); } function _fun110614() { // fn#110614, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14832:457, offset: 0x0237bb76, size: 27 bytes, params: 1, frame: 11 return GuildPowerupsStore.getStateForGuild(env0_0); } } } global.__d(_fun110610, 14635, [1867, 8258, 8260, 8259, 661, 566, 2]) /* metro module 14635, dependencies: [1867, 8258, 8260, 8259, 661, 566, 2] */;