// Module ID: 10971 // Function ID: 10972 // Name: OrbsBalance // Dependencies: [32, 5, 19, 17, 4181, 1874, 6328, 5033, 676, 21, 4395, 10971, 1959, 4189, 712, 8705, 5150, 5175, 1236, 5141, 6207, 501, 10972, 8142, 10973, 10974, 10975, 10976, 589, 8719, 691, 9484, 8167, 10960, 5036, 5177, 4185, 4600, 2] // Exports: default, openQuestOrbsRewardModal // Module 10971 (OrbsBalance) import handleOrientationChange from "handleOrientationChange"; import mergeGuildAvatar from "mergeGuildAvatar"; import importAllResult from "preload"; import get_ActivityIndicator from "XSmallIcon"; import maybeApplyNoTextColorForLightCustomTheme from "maybeApplyNoTextColorForLightCustomTheme"; import closure_10 from "mergeGuildAvatar"; import getState from "getState"; import { RewardFilterTypes } from "QuestsExperimentLocations"; import { Orientation } from "ME"; import jsxProd from "PlatformTypes"; import createCacheKey from "createCacheKey"; import createCacheKey from "createCacheKey"; import createCacheKey from "createCacheKey"; import createCacheKey from "createCacheKey"; let closure_14; let closure_15; let closure_16; let closure_6; let error; let metroImportAll; let require = arg1; function OrbsBalance(balance) { const tmp = callback7(); let obj = { children: null }; obj = { size: "xs", color: null, style: null }; obj[1] = importDefault(712).colors.WHITE; obj[2] = tmp.orbsIcon; const items = [callback3(require(8705) /* OrbsIcon */.OrbsIcon, obj), , ]; obj = { style: tmp.spacer }; items[1] = callback3(closure_8, obj); items[2] = balance.balance; obj[0] = items; return callback4(closure_15, obj); } function CancelButton() { const tmp = callback5(); const require = tmp; const obj = { onPress() { callback(table[10]).popWithKey(closure_17); }, backImage() { const style = [tmp.closeButtonIcon]; return outer1_14(tmp(outer1_2[17]).XSmallIcon, { size: "lg", style }); }, accessibilityLabel: null, labelVisible: false, style: null }; const intl = require(1236) /* getSystemLocale */.intl; obj[2] = intl.string(require(1236) /* getSystemLocale */.t.cpT0Cq); obj[4] = tmp.closeButton; return callback3(require(5150) /* Background */.HeaderBackButton, obj); } function StaticOrb() { let obj = { style: { width: "100%", height: "100%" }, children: null }; obj = { source: null, style: null, fade: false }; obj = { uri: null }; const tmp = callback8(); obj[0] = importDefault(10974); obj[0] = obj; obj[1] = tmp.animatedOrb; obj[1] = callback3(importDefault(5141), obj); return callback3(closure_8, obj); } function AnimatedOrbContainer(isAppActive) { let c4; let tmp7; isAppActive = isAppActive.isAppActive; let first; let importDefault; let first1; let callback; c4 = undefined; const tmp = callback8(); const tmp2 = callback(importAllResult.useState(false), 2); first = tmp2[0]; importDefault = tmp2[1]; const tmp4 = callback(importAllResult.useState(false), 2); first1 = tmp4[0]; callback = tmp4[1]; [tmp7, c4] = callback(importAllResult.useState(true), 2); callback = importAllResult.useCallback(() => { callback(true); }, []); const items = [first, first1]; const callback1 = importAllResult.useCallback(() => { callback2(true); }, []); const effect = importAllResult.useEffect(() => { if (timeout) { if (first1) { const _setTimeout = setTimeout; timeout = setTimeout(() => { callback(false); }, 1450); return () => clearTimeout(closure_0); } } }, items); let obj = { style: { width: "100%", height: "100%" }, children: null }; let tmp13 = !first; if (!first) { tmp13 = !first1; } if (tmp13) { obj = { style: null }; obj[0] = { height: "100%" }; tmp13 = callback3(tmp12, obj); } const items1 = [tmp13, , ]; obj = { uri: importDefault(first1[26]), style: null, onLoad: null, animate: null }; const items2 = [tmp.animatedOrb, ]; let obj1 = tmp15Result; if (!tmp15Result) { obj1 = !first1; } if (obj1) { obj1 = { opacity: 0 }; } items2[1] = obj1; obj[1] = items2; obj[2] = callback1; let tmp19 = !tmp15Result; if (!tmp15Result) { tmp19 = isAppActive; } obj[3] = tmp19; items1[1] = callback3(closure_25, obj); if (tmp15Result) { const obj2 = { uri: null, style: null, onLoad: null, animate: null }; obj2[0] = importDefault(first1[27]); const items3 = [tmp.animatedOrb]; obj2[1] = items3; obj2[2] = callback; obj2[3] = isAppActive; tmp15Result = tmp15(tmp16, obj2); } items1[2] = tmp15Result; obj[1] = items1; return closure_16(closure_8, obj); } let c5 = importAllResult; ({ ActivityIndicator: closure_6, StyleSheet: error, View: metroImportAll } = get_ActivityIndicator); ({ jsx: closure_14, Fragment: closure_15, jsxs: closure_16 } = jsxProd); const QuestOrbsRewardModal = "QuestOrbsRewardModal"; let obj = { closeButton: null, closeButtonIcon: null }; obj = { alignSelf: "flex-start", marginHorizontal: require("Themes").space.PX_16, zIndex: 999 }; obj[0] = obj; createCacheKey = { tintColor: require("Themes").colors.WHITE }; obj[1] = createCacheKey; let closure_18 = createCacheKey.createStyles(obj); let closure_19 = createCacheKey.createStyles(() => { let obj = { root: null, background: null, loading: null, header: null, main: null, animation: null, body: null, title: null, buttonsContainer: null }; obj = { flex: 1, backgroundColor: importDefault(712).colors.BACKGROUND_BASE_LOW }; obj[0] = obj; obj[1] = closure_7.absoluteFillObject; obj = { justifyContent: "center", alignItems: "center", backgroundColor: importDefault(712).colors.BACKGROUND_BASE_LOW }; const merged = Object.assign(closure_7.absoluteFillObject); obj[2] = obj; obj[3] = { flexDirection: "row", alignItems: "flex-end", justifyContent: "flex-end" }; obj[4] = { flex: 2 }; obj[5] = { flex: 3 }; obj[6] = { flex: 2, flexDirection: "column", justifyContent: "center", gap: importDefault(712).space.PX_16 }; const obj1 = { flex: 2, flexDirection: "column", justifyContent: "center", gap: importDefault(712).space.PX_16 }; obj[7] = { textAlign: "center", marginHorizontal: importDefault(712).space.PX_32 }; const obj2 = { textAlign: "center", marginHorizontal: importDefault(712).space.PX_32 }; obj[8] = { padding: importDefault(712).space.PX_24, gap: importDefault(712).space.PX_16 }; return obj; }); let items = [{ translateY: 3 }]; let closure_20 = createCacheKey.createStyles({ orbsIcon: { transform: items }, spacer: { width: 2 } }); let closure_23 = importAllResult.memo((onLoad) => { const uri = onLoad.uri; let enableAnimation = onLoad.animate; if (enableAnimation === undefined) { enableAnimation = true; } const items = [uri]; const effect = importAllResult.useEffect(() => { outer1_1(outer1_2[19]).preload(uri); }, items); return callback3(importDefault(5141), { source: { uri }, style: { width: "100%", height: "100%" }, resizeMode: "cover", enableAnimation, onLoad: onLoad.onLoad, usesSmallCache: false, fade: false }, "orb-animate-" + enableAnimation); }); let closure_24 = importAllResult.memo((animate) => { let onLoad; let uri; let flag = animate.animate; ({ uri, onLoad } = animate); if (flag === undefined) { flag = true; } let aPNGPlayerControls; const ref = importAllResult.useRef(null); aPNGPlayerControls = flag(6207).useAPNGPlayerControls(ref); const items = [flag, aPNGPlayerControls]; const effect = importAllResult.useEffect(() => { if (flag) { obj.play(); } else { obj.stop(); } }, items); return callback3(flag(6207).APNGPlayer, { ref, url, autoplay: false, style: { width: "100%", height: "100%" }, onLoad }); }); let closure_25 = importAllResult.memo((animate) => { let onLoad; let style; let uri; let flag = animate.animate; ({ uri, style, onLoad } = animate); if (flag === undefined) { flag = true; } let obj = require(501) /* PlatformTypes */; obj = { style, renderToHardwareTextureAndroid: true, needsOffscreenAlphaCompositing: true, children: callback3(obj.isAndroid() ? closure_24 : closure_23, { uri, onLoad, animate: flag }) }; return callback3(closure_8, obj); }); let closure_26 = importAllResult.memo((arg0) => { let isAppActive; let onAnimatedBgLoad; let onStaticBgLoad; let style; let useReducedMotion; ({ useReducedMotion, style } = arg0); ({ onStaticBgLoad, onAnimatedBgLoad, isAppActive } = arg0); let obj = { source: null, style: null, resizeMode: "cover", onLoad: null }; obj = { uri: null }; obj[0] = importDefault(10972); obj[0] = obj; obj[1] = style; obj[3] = onStaticBgLoad; const children = [callback3(importDefault(5141), obj), ]; let tmp2Result = !useReducedMotion; if (!useReducedMotion) { tmp2Result = isAppActive; } if (tmp2Result) { obj = { source: null, style: null, resizeMode: "cover", onLoad: null, disableFocus: true, playInBackground: true, preventsDisplaySleepDuringVideoPlayback: false }; const obj1 = { uri: null }; obj1[0] = importDefault(10973); obj[0] = obj1; obj[1] = style; obj[3] = onAnimatedBgLoad; tmp2Result = callback3(require(8142) /* VideoComponent */.VideoComponent, obj); } children[1] = tmp2Result; return closure_16(importAllResult.Fragment, { children }); }); let closure_27 = createCacheKey.createStyles({ animatedOrb: { position: "absolute", height: "130%", width: "130%", left: "-15%", top: "-15%", pointerEvents: "none" } }); let result = require("noop").fileFinishedImporting("modules/quests/native/QuestOrbsRewardModal.native.tsx"); export default function QuestOrbsRewardModal(quest) { let c1; let c2; let tmp6; let tmp8; quest = quest.quest; let num; c1 = undefined; let dependencyMap; let tmp = callback6(); let stringResult = dependencyMap; let obj = num(589); const items = [maybeApplyNoTextColorForLightCustomTheme]; const stateFromStores = obj.useStateFromStores(items, () => useReducedMotion.useReducedMotion); let obj1 = num(8719); num = obj1.useFetchVirtualCurrencyBalance().balance; let obj2 = importAllResult; [tmp6, c1] = callback(importAllResult.useState(false), 2); const tmp5 = callback(importAllResult.useState(false), 2); [tmp8, c2] = callback(importAllResult.useState(false), 2); let obj3 = num(589); const items1 = [getState]; const stateFromStores1 = obj3.useStateFromStores(items1, () => state.getState()); let obj4 = num(589); const items2 = [closure_10]; const userStatus = quest.userStatus; let num2; const stateFromStores2 = obj4.useStateFromStores(items2, () => currentUser.getCurrentUser()); if (userStatus != null) { num2 = userStatus.orbQuantityClaimed; } if (num2 == null) { num2 = tmp2(9484).getQuestOrbRewardQuantityForUser(quest.config, stateFromStores2); const tmp2Result = tmp2(9484); } const tmp11 = stateFromStores1 === num(691).AppStates.ACTIVE; const effect = obj2.useEffect(() => { num(_undefined2[32]).lockOrientation(constants2.PORTRAIT); return () => { const result = callback(table[32]).restoreDefaultOrientation(); }; }, []); callback = obj2.useCallback(() => { _undefined(true); }, []); const callback1 = obj2.useCallback(() => { _undefined2(true); }, []); let string = obj2.useCallback(() => { let obj = _undefined(_undefined2[10]); obj.popWithKey(closure_17); obj = { filter: constants.VIRTUAL_CURRENCY, fromContent: num(_undefined2[34]).QuestContent.REWARD_MODAL }; num(_undefined2[33]).openQuestHome(obj); }, []); obj = { style: tmp.root, children: null }; obj = { style: closure_7.absoluteFill, accessible: false, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: callback3(closure_26, obj1) }; obj1 = { useReducedMotion: stateFromStores, style: tmp.background, onStaticBgLoad: callback, onAnimatedBgLoad: callback1, isAppActive: tmp11 }; const items3 = [callback3(closure_8, obj), , ]; let tmp17Result = !tmp6; if (!tmp6) { let tmp19 = stateFromStores; if (!stateFromStores) { tmp19 = !tmp8; } tmp17Result = tmp19; } if (tmp17Result) { obj2 = { style: null, children: null }; obj2[0] = tmp.loading; obj2[1] = tmp17(closure_6, { animating: true }); tmp17Result = tmp17(tmp16, obj2); } items3[1] = tmp17Result; if (!tmp6) { let tmp21 = !stateFromStores; if (!stateFromStores) { tmp21 = tmp8; } } if (!tmp6) { items3[2] = tmp6; obj[1] = items3; return tmp15(tmp16, obj); } else { obj3 = { style: null, top: true, bottom: true, left: true, right: true, children: null }; const items4 = [tmp.main]; obj3[0] = items4; obj4 = { style: null, children: null }; obj4[0] = tmp.header; obj4[1] = tmp17(CancelButton, {}); const items5 = [tmp17(tmp16, obj4), , , ]; const obj5 = { style: null, accessible: false, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: null }; obj5[0] = tmp.animation; if (stateFromStores) { tmp17Result = tmp17(StaticOrb, {}); } else { const obj6 = { isAppActive: null }; obj6[0] = tmp11; tmp17Result = tmp17(AnimatedOrbContainer, obj6); } obj5[4] = tmp17Result; items5[1] = tmp17(tmp16, obj5); let obj7 = { style: null, children: null }; obj7[0] = tmp.body; const obj8 = { variant: "heading-xl/bold", color: "text-overlay-light", style: null, children: null }; obj8[2] = tmp.title; let intl = tmp2(1236).intl; if (num2 == null) { num2 = 0; } const obj9 = { count: null }; obj9[0] = num2; obj8[3] = intl.format(tmp2(1236).t.FIilK5, obj9); let items6 = [tmp17(tmp2(4185).Heading, obj8), ]; let obj10 = { variant: "text-md/normal", color: "text-overlay-light", style: null, children: null }; obj10[2] = tmp.title; if (num == null) { num = 0; } if (num >= 4100) { const intl3 = tmp2(1236).intl; const obj11 = { balanceHook: null, profileDecoHook: null }; obj11[0] = function balanceHook() { return outer1_14(outer1_21, { balance: num }, "balance"); }; obj11[1] = function profileDecoHook() { const obj = { variant: "text-md/semibold", color: "text-overlay-light", children: null }; const intl = num(_undefined2[18]).intl; obj[2] = intl.string(num(_undefined2[18]).t.pGDUH9); return callback(num(_undefined2[36]).Text, obj, "profileDeco"); }; let formatResult = intl3.format(tmp2(1236).t["2dz2AL"], obj11); } else { const intl2 = tmp2(1236).intl; const obj12 = { balanceHook: null }; obj12[0] = function balanceHook() { return outer1_14(outer1_21, { balance: num }, "balance"); }; formatResult = intl2.format(tmp2(1236).t.rKHvlX, obj12); } obj10[3] = formatResult; items6[1] = tmp17(tmp2(4185).Text, obj10); obj7[1] = items6; items5[2] = tmp15(tmp16, obj7); const obj13 = { style: null, children: null }; obj13[0] = tmp.buttonsContainer; items6 = tmp2(4600).Button; const obj14 = { onPress: null, variant: "primary", size: "lg", text: null }; obj14[0] = string; obj10 = tmp2(1236).intl; string = obj10.string; stringResult = string(tmp2(1236).t.uJAMFX); obj14[3] = stringResult; tmp = tmp17(items6, obj14); obj13[1] = tmp; obj7 = tmp17(tmp16, obj13); items5[3] = obj7; obj3[5] = items5; tmp15(tmp2(5177).SafeAreaPaddingView, obj3); } }; export const openQuestOrbsRewardModal = function openQuestOrbsRewardModal(quest) { importDefault(4395).pushLazy(callback2(function*() { if (v0 === 2) { v0 = 3; HermesBuiltin.throwTypeError(); } else if (tmp3 === 3) { if (arg0 === 1) { throw arg1; } else if (arg0 === 2) { let obj = { value: null, done: true }; obj[0] = arg1; return obj; } else { return { value: "HermesInternal", done: null }; } } else { try { v0 = 2; if (0 === c1) { if (arg0 === 1) { v0 = 3; throw arg1; } else if (arg0 === 2) { v0 = 3; obj = { value: null, done: true }; obj[0] = arg1; return obj; } else { c1 = 1; v0 = 1; const obj1 = { value: null, done: false }; obj1[0] = v0(outer1_2[12])(outer1_2[11], outer1_2.paths); return obj1; } } else if (arg0 === 1) { v0 = 3; throw arg1; } else if (arg0 === 2) { v0 = 3; const obj2 = { value: null, done: true }; obj2[0] = arg1; return obj2; } else { v0 = 3; obj = { value: null, done: true }; obj[0] = arg1.default; return obj; } } catch (tmp7) { v0 = tmp; throw tmp7; } } }), { quest: quest.quest }, QuestOrbsRewardModal); };