/* 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] */
import Module00005 from '../../../../by-id/module-00005.js'; /* Metro dependency 5 */
import UseWindowDimensionsNative from '../../../screen/useWindowDimensions.native.tsx'; /* Metro dependency 1478 */
import UseSafeAreaInsetsNative from '../../../safe_area/useSafeAreaInsets.native.tsx'; /* Metro dependency 1585 */
import BountyStore from '../../BountyStore.tsx'; /* Metro dependency 7092 */
import BountiesModalActionCreators from './BountiesModalActionCreators.tsx'; /* Metro dependency 13515 */
import BountiesModalEndCard from './BountiesModalEndCard.tsx'; /* Metro dependency 13553 */
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as ConstantsModule from '../../../../external/discord_common/js/shared/Constants.tsx'; /* Metro dependency 482 */
import * as ConstantsModule2 from '../../../../Constants.tsx'; /* Metro dependency 661 */
import * as CreateStylesModule from '../../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as QuestConstantsModule from '../../QuestConstants.tsx'; /* Metro dependency 6528 */
import * as QuestContentModule from '../../../../external/discord_common/js/shared/shared-constants/QuestContent.tsx'; /* Metro dependency 6533 */
import * as SafeAreaViewModule from '../../../../components_native/common/SafeAreaView.tsx'; /* Metro dependency 6618 */
import * as AnalyticsActionsModule from '../../lib/analytics/AnalyticsActions.tsx'; /* Metro dependency 7110 */
import * as AnalyticsTypesModule from '../../lib/analytics/AnalyticsTypes.tsx'; /* Metro dependency 7120 */
import * as AdCreativeTypeModule from '../../../../external/discord_common/js/shared/shared-constants/AdCreativeType.tsx'; /* Metro dependency 7121 */
import * as QuestHooksModule from '../../hooks/QuestHooks.tsx'; /* Metro dependency 9483 */
import * as VideoQuestUtilsModule from '../../utils/VideoQuestUtils.tsx'; /* Metro dependency 9522 */
import * as BountiesStage1ExperimentModule from '../../experiments/BountiesStage1Experiment.tsx'; /* Metro dependency 9530 */
import * as HooksModule from '../../../virtual_currency/hooks/index.tsx'; /* Metro dependency 10069 */
import * as QuestContentImpressionTrackerNativeModule from '../QuestContentImpressionTracker.native.tsx'; /* Metro dependency 10183 */
import * as UseBountiesModalTimingModule from './useBountiesModalTiming.tsx'; /* Metro dependency 13533 */
import * as UseBountiesModalVideoAnalyticsModule from './useBountiesModalVideoAnalytics.tsx'; /* Metro dependency 13536 */
import * as UseBountyVideoProgressPersistenceModule from './useBountyVideoProgressPersistence.tsx'; /* Metro dependency 13537 */
import * as BountyVideoModule from './BountyVideo.tsx'; /* Metro dependency 13538 */
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 value = JsxRuntimeModule;
const env0_10 = value.jsx;
const env0_11 = value.Fragment;
const env0_12 = value.jsxs;
const env0_14 = (CreateStylesModule).createStyles(_fun102952);
(FileImportTrackerModule).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 useFetchVirtualCurrencyBalance = HooksModule.useFetchVirtualCurrencyBalance;
const balance = Reflect.apply(useFetchVirtualCurrencyBalance, HooksModule, []).balance;
const BountiesStage1Experiment = (BountiesStage1ExperimentModule).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 = (UseBountiesModalTimingModule).BountyVideoEndMode;
const r19 = loopingEnabled ? BountyVideoEndMode.LOOP : BountyVideoEndMode.END_CARD;
const r7 = enabled ? 1000 * rewardTimerSeconds : 1000 * bounty.rewardTimerSeconds;
env0_4 = r7;
const {initialProgress, handleProgress,
flushProgress} = (UseBountyVideoProgressPersistenceModule).useBountyVideoProgressPersistence({bountyId: bounty.id,
endMode: r19});
const value12 = env0_4.useCallback(env0_3(_fun102946), [bounty.id, sourceQuestContent]);
const {handleVideoProgressAnalytics, handleVideoEndAnalytics, handleVideoLoopedAnalytics,
handleVideoPausedAnalytics,
handleVideoResumedAnalytics} = (UseBountiesModalVideoAnalyticsModule).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 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 = (BountyVideoModule).BountyVideo;
const items2 = [
,
];
items2[1] = (
{((Component) => )(importDefault(13550) /* metro dependency 13550: BountiesModalCloseButton */)}
);
const SafeAreaPaddingView = (SafeAreaViewModule).SafeAreaPaddingView;
items2[2] = (
{((Component) => )(importDefault(13554) /* metro dependency 13554: BountiesModalEndedCtaButtons */)}
);
return (
<>
{items2}
>
);
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} = (UseWindowDimensionsNative)();
const value3 = (UseSafeAreaInsetsNative)();
return env1_4.useMemo(_fun102940, [width, height, value3.top, value3.bottom, value3.left, value3.right]);
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 object = {};
let Math = global.Math;
const floor = Math.floor;
binding = env0_2;
object.top = Reflect.apply(floor, Math, [binding.top + (value5 - r4) / 2]);
Math = global.Math;
object.left = Math.floor(binding.left + (value3 - r6) / 2);
Math = global.Math;
object.width = Math.floor(r6);
Math = global.Math;
object.height = Math.floor(r4);
object.isFullWidth = r1;
return object;
}
}
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 object = {};
const binding = env0_3;
const top = binding.top;
let value = environment.__proto__;
let PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.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;
object.left = value - PX_8;
items2[1] = object;
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 trackAdContentEvent = AnalyticsActionsModule.trackAdContentEvent;
const object = {};
object.adContentId = bounty.id;
const AdCreativeType = (AdCreativeTypeModule).AdCreativeType;
const BOUNTY = AdCreativeType.BOUNTY;
object.adCreativeType = BOUNTY;
const AD_VIDEO_MODAL_CLOSED = AnalyticEvents.AD_VIDEO_MODAL_CLOSED;
object.event = AD_VIDEO_MODAL_CLOSED;
const object2 = {};
const getQuestContentName = AnalyticsTypesModule.getQuestContentName;
const QuestContent = (QuestContentModule).QuestContent;
let VIDEO_MODAL_MOBILE = QuestContent.VIDEO_MODAL_MOBILE;
object2.content_name = Reflect.apply(getQuestContentName, AnalyticsTypesModule, [VIDEO_MODAL_MOBILE]);
VIDEO_MODAL_MOBILE = QuestContent.VIDEO_MODAL_MOBILE;
object2.content_id = VIDEO_MODAL_MOBILE;
object2.video_progress = VideoQuestUtilsModule.formatVideoProgressRatio(maxVideoProgressSeconds, videoDuration ?? 0);
object2.threshold_met = 1000 * maxVideoProgressSeconds >= env0_4;
object2.reward_timer_seconds = env0_4 / 1000;
object.properties = object2;
object.sourceQuestContent = sourceQuestContent;
Reflect.apply(trackAdContentEvent, AnalyticsActionsModule, [object]);
flushProgress();
(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 trackAdContentEvent = AnalyticsActionsModule.trackAdContentEvent;
const object = {};
object.adContentId = bounty.id;
const AdCreativeType = (AdCreativeTypeModule).AdCreativeType;
const BOUNTY = AdCreativeType.BOUNTY;
object.adCreativeType = BOUNTY;
const AD_VIDEO_MODAL_CLOSED = AnalyticEvents.AD_VIDEO_MODAL_CLOSED;
object.event = AD_VIDEO_MODAL_CLOSED;
const object2 = {};
const getQuestContentName = AnalyticsTypesModule.getQuestContentName;
const QuestContent = (QuestContentModule).QuestContent;
let VIDEO_MODAL_END_CARD = QuestContent.VIDEO_MODAL_END_CARD;
object2.content_name = Reflect.apply(getQuestContentName, AnalyticsTypesModule, [VIDEO_MODAL_END_CARD]);
VIDEO_MODAL_END_CARD = QuestContent.VIDEO_MODAL_END_CARD;
object2.content_id = VIDEO_MODAL_END_CARD;
object2.video_progress = VideoQuestUtilsModule.formatVideoProgressRatio(maxVideoProgressSeconds, videoDuration ?? 0);
object2.threshold_met = true;
object2.reward_timer_seconds = env0_4 / 1000;
object.properties = object2;
object.sourceQuestContent = sourceQuestContent;
Reflect.apply(trackAdContentEvent, AnalyticsActionsModule, [object]);
flushProgress();
(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 = (QuestContentImpressionTrackerNativeModule).QuestContentImpressionTrackerNative;
const id = bounty.id;
const AdCreativeType = (AdCreativeTypeModule).AdCreativeType;
const BOUNTY = AdCreativeType.BOUNTY;
const QuestContent = (QuestContentModule).QuestContent;
const VIDEO_MODAL_END_CARD = QuestContent.VIDEO_MODAL_END_CARD;
return (
{children_102951}
);
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) => )(BountiesModalEndCard);
}
}
}
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 object = {};
object.videoWrapper = {position: 'absolute'};
object.closeButton = {position: 'absolute'};
const PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object.bottomContainer = {'position': 'absolute', 'bottom': null, 'justifyContent': 'flex-end', bottom: PX_24};
const object5 = {};
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object5.left = PX_16;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object5.right = PX_16;
object.bottomContainerFullWidth = object5;
const object6 = {};
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object6.paddingLeft = PX_16;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object6.paddingRight = PX_16;
object.bottomContainerNotFullWidth = object6;
return object;
}
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 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 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 ;
}
}
}
global.__d(_fun102937, 13552, [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]) /* metro module 13552, 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] */;