/* Metro module 13552; source: modules/quests/native/BountiesModal/BountiesModalContent.tsx; dependencies: [5, 31, 27, 7092, 6528, 661, 482, 33, 1478, 1585, 4501, 697, 566, 10069, 9530, 13533, 13537, 9532, 13534, 13536, 7110, 7121, 7120, 6533, 9522, 13515, 13538, 10183, 13553, 13550, 6618, 13554, 9483, 3868, 2] */ function _fun102937(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#102937, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13742:6, offset: 0x022503b2, size: 338 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importDefault(5) /* metro dependency 5 */; const env0_4 = importAll(31) /* metro dependency 31 */; const env0_5 = (require(27) /* metro dependency 27 */).View; const bountyStore = importDefault(7092) /* metro dependency 7092: BountyStore */; const env0_7 = (require(6528) /* metro dependency 6528: QuestConstants */).QuestsExperimentLocations; const env0_8 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents; const env0_9 = (require(482) /* metro dependency 482: Constants */).ThemeTypes; const value = require(33) /* metro dependency 33 */; const env0_10 = value.jsx; const env0_11 = value.Fragment; const env0_12 = value.jsxs; const env0_14 = (require(4501) /* metro dependency 4501: createStyles */).createStyles(_fun102952); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/native/BountiesModal/BountiesModalContent.tsx'); exports.default = BountiesModalContent; } function BountiesModalContentInner({bounty, sourceQuestContent}) { // fn#102938, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13742:648, offset: 0x02250504, size: 1397 bytes, params: 2, frame: 45 let env0_4 = undefined; const styles = useStyles(); const value2 = useBountiesModalVideoLayout(); const env0_3 = value2; const value3 = env0_4.useMemo(_fun102941, [styles.videoWrapper, value2]); const value4 = env0_4.useMemo(_fun102942, [styles.closeButton, value2.top, value2.left, value2.width]); const value5 = env0_4.useMemo(_fun102943, [styles.bottomContainer, styles.bottomContainerFullWidth, styles.bottomContainerNotFullWidth, value2.isFullWidth, value2.left, value2.width]); const value6 = (require(566) /* metro dependency 566: flux */).useStateFromStores([BountyStore], function() { return BountyStore.isBountyCompleted(bounty.id); }); const hooksModule = require(10069) /* metro dependency 10069: hooks */; const useFetchVirtualCurrencyBalance = hooksModule.useFetchVirtualCurrencyBalance; const balance = Reflect.apply(useFetchVirtualCurrencyBalance, hooksModule, []).balance; const BountiesStage1Experiment = (require(9530) /* metro dependency 9530: BountiesStage1Experiment */).BountiesStage1Experiment; const useConfig = BountiesStage1Experiment.useConfig; const VIDEO_MODAL_MOBILE = QuestsExperimentLocations.VIDEO_MODAL_MOBILE; const {enabled, loopingEnabled, rewardTimerSeconds} = Reflect.apply(useConfig, BountiesStage1Experiment, [{location: VIDEO_MODAL_MOBILE}]); const BountyVideoEndMode = (require(13533) /* metro dependency 13533: useBountiesModalTiming */).BountyVideoEndMode; const r19 = loopingEnabled ? BountyVideoEndMode.LOOP : BountyVideoEndMode.END_CARD; const r7 = enabled ? 1000 * rewardTimerSeconds : 1000 * bounty.rewardTimerSeconds; env0_4 = r7; const {initialProgress, handleProgress, flushProgress} = (require(13537) /* metro dependency 13537: useBountyVideoProgressPersistence */).useBountyVideoProgressPersistence({bountyId: bounty.id, endMode: r19}); const value12 = env0_4.useCallback(env0_3(_fun102946), [bounty.id, sourceQuestContent]); const {handleVideoProgressAnalytics, handleVideoEndAnalytics, handleVideoLoopedAnalytics, handleVideoPausedAnalytics, handleVideoResumedAnalytics} = (require(13536) /* metro dependency 13536: useBountiesModalVideoAnalytics */).useBountiesModalVideoAnalytics({bountyId: bounty.id, sourceQuestContent: sourceQuestContent, rewardDurationMs: r7}); const value14 = env0_4.useCallback(function(a0, a1, a2) { handleVideoProgressAnalytics(a0, a1); handleProgress(a0, a1, a2); }, [handleVideoProgressAnalytics, handleProgress]); const useBountiesModalTimingModule = require(13533) /* metro dependency 13533: useBountiesModalTiming */; const useBountiesModalTiming = useBountiesModalTimingModule.useBountiesModalTiming; let duration = initialProgress.duration; duration = duration > 0 ? initialProgress.duration : null; const {isCtaVisible, isEndCardVisible, handleVideoEnd, handleVideoProgress, handleVideoPaused, handleVideoResumed, rewardRemainingSeconds, rewardTotalSeconds, normalizedProgress, maxVideoProgressSeconds, videoDuration} = Reflect.apply(useBountiesModalTiming, useBountiesModalTimingModule, [{endMode: r19, rewardDurationMs: r7, isCompleted: value6, onRewardEarned: value12, onVideoProgress: value14, onVideoEnd: handleVideoEndAnalytics, onVideoLooped: handleVideoLoopedAnalytics, onVideoPaused: handleVideoPausedAnalytics, onVideoResumed: handleVideoResumedAnalytics, initialProgressSec: initialProgress.timestampSec, initialMaxVideoProgressSec: initialProgress.maxTimestampSec, initialVideoDurationSec: duration}]); const value17 = env0_4.useCallback(_fun102948, [bounty.id, maxVideoProgressSeconds, r7, sourceQuestContent, videoDuration, flushProgress]); const value18 = env0_4.useCallback(_fun102949, [bounty.id, maxVideoProgressSeconds, r7, sourceQuestContent, videoDuration, flushProgress]); const jsxRuntimeEnv0_11Binding = jsxRuntimeEnv0_11; const BountyVideo = (require(13538) /* metro dependency 13538: BountyVideo */).BountyVideo; const items2 = []; items2[1] = {((Component) => )(importDefault(13550) /* metro dependency 13550: BountiesModalCloseButton */)}; const SafeAreaPaddingView = (require(6618) /* metro dependency 6618: SafeAreaView */).SafeAreaPaddingView; items2[2] = {((Component) => )(importDefault(13554) /* metro dependency 13554: BountiesModalEndedCtaButtons */)}; return ( <> {items2} ); } function _fun102952() { // fn#102952, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13742:300, offset: 0x0225113b, size: 199 bytes, params: 1, frame: 15 const object2 = {}; object2.videoWrapper = {position: 'absolute'}; object2.closeButton = {position: 'absolute'}; const PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24; object2.bottomContainer = {'position': 'absolute', 'bottom': null, 'justifyContent': 'flex-end', bottom: PX_24}; const object3 = {}; let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16; object3.left = PX_16; PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16; object3.right = PX_16; object2.bottomContainerFullWidth = object3; const object4 = {}; PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16; object4.paddingLeft = PX_16; PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16; object4.paddingRight = PX_16; object2.bottomContainerNotFullWidth = object4; return object2; } function BountiesModalContent({bountyId, sourceQuestContent}) { // fn#102953, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13742:5002, offset: 0x02251202, size: 280 bytes, params: 2, frame: 22 const questHooksModule = require(9483) /* metro dependency 9483: QuestHooks */; const useQuestHomeBounties = questHooksModule.useQuestHomeBounties; const value2 = Reflect.apply(useQuestHomeBounties, questHooksModule, []).questHomeBounties.find(function({id}) { return id === bountyId; }); if (value2 == null) { return null; } else { const ThemeContextProvider = (require(3868) /* metro dependency 3868: native */).ThemeContextProvider; return ( {((QuestContentImpressionTrackerNative) => {children_102955})((require(10183) /* metro dependency 10183: QuestContentImpressionTrackerNative */).QuestContentImpressionTrackerNative)} ); } } function useBountiesModalVideoLayout() { // fn#102939, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13742:728, owner: BountiesModalContentInner.useBountiesModalVideoLayout, offset: 0x02250a79, size: 141 bytes, params: 1, frame: 17 const {width, height} = (importDefault(1478) /* metro dependency 1478: useWindowDimensionsNative */)(); const value3 = (importDefault(1585) /* metro dependency 1585: useSafeAreaInsetsNative */)(); return env1_4.useMemo(_fun102940, [width, height, value3.top, value3.bottom, value3.left, value3.right]); } function _fun102941() { // fn#102941, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13742:1099, offset: 0x02250be2, size: 69 bytes, params: 1, frame: 4 const binding = env0_3; return [styles.videoWrapper, {top: binding.top, left: binding.left, width: binding.width, height: binding.height}]; } function _fun102942() { // fn#102942, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13742:1208, offset: 0x02250c27, size: 146 bytes, params: 1, frame: 17 const items2 = [styles.closeButton]; const object2 = {}; const binding = env0_3; const top = binding.top; let value = environment.__proto__; let PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8; object2.top = top + PX_8; value = binding.left + binding.width; const PX_32 = (importDefault(697) /* metro dependency 697: native */).space.PX_32; value -= PX_32; PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8; object2.left = value - PX_8; items2[1] = object2; return items2; } function _fun102943() { // fn#102943, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13742:1373, offset: 0x02250cb9, size: 97 bytes, params: 1, frame: 6 const isFullWidth = env0_3.isFullWidth; const stylesBinding = styles; const bottomContainer = stylesBinding.bottomContainer; return isFullWidth ? [bottomContainer, stylesBinding.bottomContainerFullWidth] : [bottomContainer, stylesBinding.bottomContainerNotFullWidth, {left: env0_3.left, width: env0_3.width}]; } function* _fun102946() { // fn#102946, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13742:2133, offset: 0x02250d45, size: 121 bytes, params: 1, frame: 14 var binding; var binding2; var property; var value3; var claimBountyReward; var id; var value5; var value6; var value7; var error; if (true) { value = environment.__proto__.__proto__; try { binding = env2_0; } catch (error) { binding = env2_0; value = binding(env2_2[18]); value.openBountyRewardClaimErrorToast(error); return undefined; } try { binding2 = env2_2; } catch (error) { binding = env2_0; value = binding(env2_2[18]); value.openBountyRewardClaimErrorToast(error); return undefined; } try { property = binding2[17]; } catch (error) { binding = env2_0; value = binding(env2_2[18]); value.openBountyRewardClaimErrorToast(error); return undefined; } try { value3 = binding(property); } catch (error) { binding = env2_0; value = binding(env2_2[18]); value.openBountyRewardClaimErrorToast(error); return undefined; } try { claimBountyReward = value3.claimBountyReward; } catch (error) { binding = env2_0; value = binding(env2_2[18]); value.openBountyRewardClaimErrorToast(error); return undefined; } try { } catch (error) { binding = env2_0; value = binding(env2_2[18]); value.openBountyRewardClaimErrorToast(error); return undefined; } try { id = require.id; } catch (error) { binding = env2_0; value = binding(env2_2[18]); value.openBountyRewardClaimErrorToast(error); return undefined; } try { } catch (error) { binding = env2_0; value = binding(env2_2[18]); value.openBountyRewardClaimErrorToast(error); return undefined; } try { value5 = Reflect.apply(claimBountyReward, value3, [id, importDefault]); } catch (error) { binding = env2_0; value = binding(env2_2[18]); value.openBountyRewardClaimErrorToast(error); return undefined; } yield value5; try { value6 = undefined; value7 = false; } catch (error) { binding = env2_0; value = binding(env2_2[18]); value.openBountyRewardClaimErrorToast(error); return undefined; } if (value7) { return value6; } } } function _fun102948() { // fn#102948, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13742:3138, offset: 0x02250de3, size: 325 bytes, params: 1, frame: 22 const value = environment.__proto__; const analyticsActionsModule = require(7110) /* metro dependency 7110: AnalyticsActions */; const trackAdContentEvent = analyticsActionsModule.trackAdContentEvent; const object3 = {}; object3.adContentId = bounty.id; const AdCreativeType = (require(7121) /* metro dependency 7121: AdCreativeType */).AdCreativeType; const BOUNTY = AdCreativeType.BOUNTY; object3.adCreativeType = BOUNTY; const AD_VIDEO_MODAL_CLOSED = AnalyticEvents.AD_VIDEO_MODAL_CLOSED; object3.event = AD_VIDEO_MODAL_CLOSED; const object4 = {}; const analyticsTypesModule = require(7120) /* metro dependency 7120: AnalyticsTypes */; const getQuestContentName = analyticsTypesModule.getQuestContentName; const QuestContent = (require(6533) /* metro dependency 6533: QuestContent */).QuestContent; let VIDEO_MODAL_MOBILE = QuestContent.VIDEO_MODAL_MOBILE; object4.content_name = Reflect.apply(getQuestContentName, analyticsTypesModule, [VIDEO_MODAL_MOBILE]); VIDEO_MODAL_MOBILE = QuestContent.VIDEO_MODAL_MOBILE; object4.content_id = VIDEO_MODAL_MOBILE; const videoQuestUtilsModule = require(9522) /* metro dependency 9522: VideoQuestUtils */; object4.video_progress = videoQuestUtilsModule.formatVideoProgressRatio(maxVideoProgressSeconds, videoDuration ?? 0); object4.threshold_met = 1000 * maxVideoProgressSeconds >= env0_4; object4.reward_timer_seconds = env0_4 / 1000; object3.properties = object4; object3.sourceQuestContent = sourceQuestContent; Reflect.apply(trackAdContentEvent, analyticsActionsModule, [object3]); flushProgress(); (importDefault(13515) /* metro dependency 13515: BountiesModalActionCreators */).hideModal(); } function _fun102949() { // fn#102949, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13742:3621, offset: 0x02250f28, size: 311 bytes, params: 1, frame: 22 const value = environment.__proto__; const analyticsActionsModule = require(7110) /* metro dependency 7110: AnalyticsActions */; const trackAdContentEvent = analyticsActionsModule.trackAdContentEvent; const object3 = {}; object3.adContentId = bounty.id; const AdCreativeType = (require(7121) /* metro dependency 7121: AdCreativeType */).AdCreativeType; const BOUNTY = AdCreativeType.BOUNTY; object3.adCreativeType = BOUNTY; const AD_VIDEO_MODAL_CLOSED = AnalyticEvents.AD_VIDEO_MODAL_CLOSED; object3.event = AD_VIDEO_MODAL_CLOSED; const object4 = {}; const analyticsTypesModule = require(7120) /* metro dependency 7120: AnalyticsTypes */; const getQuestContentName = analyticsTypesModule.getQuestContentName; const QuestContent = (require(6533) /* metro dependency 6533: QuestContent */).QuestContent; let VIDEO_MODAL_END_CARD = QuestContent.VIDEO_MODAL_END_CARD; object4.content_name = Reflect.apply(getQuestContentName, analyticsTypesModule, [VIDEO_MODAL_END_CARD]); VIDEO_MODAL_END_CARD = QuestContent.VIDEO_MODAL_END_CARD; object4.content_id = VIDEO_MODAL_END_CARD; const videoQuestUtilsModule = require(9522) /* metro dependency 9522: VideoQuestUtils */; object4.video_progress = videoQuestUtilsModule.formatVideoProgressRatio(maxVideoProgressSeconds, videoDuration ?? 0); object4.threshold_met = true; object4.reward_timer_seconds = env0_4 / 1000; object3.properties = object4; object3.sourceQuestContent = sourceQuestContent; Reflect.apply(trackAdContentEvent, analyticsActionsModule, [object3]); flushProgress(); (importDefault(13515) /* metro dependency 13515: BountiesModalActionCreators */).hideModal(); } function BountiesModalContentInnerRenderEndCard() { // fn#102950, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13742:4468, owner: BountiesModalContentInner.renderEndCard, offset: 0x0225105f, size: 151 bytes, params: 1, frame: 17 const QuestContentImpressionTrackerNative = (require(10183) /* metro dependency 10183: QuestContentImpressionTrackerNative */).QuestContentImpressionTrackerNative; const id = bounty.id; const AdCreativeType = (require(7121) /* metro dependency 7121: AdCreativeType */).AdCreativeType; const BOUNTY = AdCreativeType.BOUNTY; const QuestContent = (require(6533) /* metro dependency 6533: QuestContent */).QuestContent; const VIDEO_MODAL_END_CARD = QuestContent.VIDEO_MODAL_END_CARD; return ( {children_102951} ); } function BountiesModalContentChildren() { // fn#102955, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13742:5437, owner: BountiesModalContent.children, offset: 0x0225131a, size: 44 bytes, params: 1, frame: 14 return ; } function _fun102940() { // fn#102940, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13742:834, offset: 0x02250b06, size: 220 bytes, params: 1, frame: 20 var r1; var r4; var r6; var value9; const widthBinding = width; let binding = env0_2; const value3 = widthBinding - binding.left - binding.right; const value5 = height - binding.top - binding.bottom; const value7 = value3 / env2_13; if (value7 > value5) { value9 = value5 * env2_13; r1 = false; r4 = value5; r6 = value9; } else { r1 = true; r4 = value7; r6 = value3; } const object2 = {}; let Math = global.Math; const floor = Math.floor; binding = env0_2; object2.top = Reflect.apply(floor, Math, [binding.top + (value5 - r4) / 2]); Math = global.Math; object2.left = Math.floor(binding.left + (value3 - r6) / 2); Math = global.Math; object2.width = Math.floor(r6); Math = global.Math; object2.height = Math.floor(r4); object2.isFullWidth = r1; return object2; } function renderEndCardChildren_102951() { // fn#102951, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13742:4690, owner: BountiesModalContentInner.renderEndCard.children, offset: 0x022510f6, size: 69 bytes, params: 1, frame: 15 const value = environment.__proto__.__proto__; return ((Component) => )(importDefault(13553) /* metro dependency 13553: BountiesModalEndCard */); }