Initial commit

This commit is contained in:
janisslsm committed 2026-07-27 16:20:00 +03:00
commit af3b49f756
16065 files changed
+2938410

No files matched your search

@@ -0,0 +1,54 @@
/* Metro module 9523; source: modules/quests/utils/MobileQuestVideoWatchCtaCopy.tsx; dependencies: [7116, 1244, 2] */
function _fun74303(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#74303, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9709:6, offset: 0x01d896a8, size: 128 bytes, params: 8, frame: 19
const env0_0 = require;
const closure = formatWatchRemainingDurationShort;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/utils/MobileQuestVideoWatchCtaCopy.tsx');
exports.formatWatchRemainingDurationShort = closure;
exports.getVideoQuestWatchCtaText = function(a0) {
var value = a0.percentComplete > 0;
var value3 = formatWatchRemainingDurationShort(a0);
var intl = require(dependencyMap[1]).intl;
var formatToPlainString = intl.formatToPlainString;
var t = require(dependencyMap[1]).t;
return value ? Reflect.apply(formatToPlainString, intl, [t['pF/deA'],
{durationShort: value3}]) : Reflect.apply(formatToPlainString, intl, [t.CHrvqg, {durationShort: value3}]);
};
exports.getVideoQuestWatchCtaAccessibilityLabel = getVideoQuestWatchCtaAccessibilityLabel;
}
function formatWatchRemainingDurationShort(a0) { // fn#74304, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9709:43, offset: 0x01d89728, size: 219 bytes, params: 2, frame: 18
var r0;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var formatToPlainString;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
var object2;
var PHhTXX;
const remainingTaskTime = (require(7116) /* metro dependency 7116: QuestTaskUtils */).getRemainingTaskTime(a0);
const value4 = 60 * remainingTaskTime.minutes + remainingTaskTime.seconds;
if (value4 >= 60) {
formatToPlainString = intl.formatToPlainString;
PHhTXX = t.PHhTXX;
object2 = {};
object2.count = global.Math.round(value4 / 60);
r0 = Reflect.apply(formatToPlainString, intl, [PHhTXX, object2]);
} else {
r0 = intl.formatToPlainString(t.rUfeQx, {count: value4});
}
return r0;
}
function getVideoQuestWatchCtaAccessibilityLabel(a0) { // fn#74306, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9709:832, offset: 0x01d8987d, size: 364 bytes, params: 2, frame: 20
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
const value = a0.percentComplete > 0;
const {minutes, seconds} = (require(7116) /* metro dependency 7116: QuestTaskUtils */).getRemainingTaskTime(a0);
const r5 = minutes > 0 && seconds > 0 ? intl.formatToPlainString(t['lW/66D'], {minutes: minutes,
seconds: seconds}) : minutes > 0 ? intl.formatToPlainString(t['SxnF/O'],
{count: minutes}) : intl.formatToPlainString(t['0BZpdi'], {count: seconds});
const formatToPlainString = intl.formatToPlainString;
return value ? Reflect.apply(formatToPlainString, intl, [t['ch+yrN'],
{remainTime: r5}]) : Reflect.apply(formatToPlainString, intl, [t.Bwc5Dg, {remainTime: r5}]);
}
@@ -0,0 +1,153 @@
/* Metro module 9505; source: modules/quests/utils/QuestCopyUtils.tsx; dependencies: [6528, 1244, 7110, 6797, 2] */
function _fun74183(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#74183, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9691:6, offset: 0x01d83745, size: 258 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const questConstantsModule = require(6528) /* metro dependency 6528: QuestConstants */;
const env0_2 = questConstantsModule.QuestHomeSortMethods;
const env0_3 = questConstantsModule.RewardFilterTypes;
const env0_4 = questConstantsModule.TaskFilterTypes;
const closure = function(a0) {
return '' + global.location.protocol + '//' + global.location.host + '/quests/' + a0;
};
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/utils/QuestCopyUtils.tsx');
exports.getContextualEntrypointHeading = getContextualEntrypointHeading;
exports.getDisclosureText = getDisclosureText;
exports.getExternalCtaLabel = function(a0) {
return a0.config.ctaConfig.buttonLabel;
};
exports.getSortMethodText = getSortMethodText;
exports.getFilterTypeText = getFilterTypeText;
exports.getFilterGroupHeadingText = getFilterGroupHeadingText;
exports.getQuestUrl = closure;
exports.getCtaLink = function(a0) {
return a0.ctaConfig.link;
};
exports.copyShareLink = copyShareLink;
exports.getDefaultReward = function(a0) {
var Error;
var value;
if (a0.rewardsConfig.rewards.length === 0) {
Error = global.Error;
value = 'Quest ' + a0.id + ' has no rewards configured';
value = new Error();
throw value;
}
return a0.rewardsConfig.rewards[0];
};
}
function getContextualEntrypointHeading({quest, taskDetails, thirdPartyTaskDetails}) { // fn#74185, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9691:351, offset: 0x01d83885, size: 542 bytes, params: 2, frame: 19
var percentComplete;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
let userStatus = quest.userStatus;
const value = undefined;
if ((userStatus == null ? value : userStatus.completedAt) != null) {
return intl.string(t.BzFeTF);
}
userStatus = quest.userStatus;
if ((userStatus == null ? value : userStatus.enrolledAt) != null) {
percentComplete = taskDetails.percentComplete;
percentComplete = thirdPartyTaskDetails != null ? thirdPartyTaskDetails.percentComplete : percentComplete;
return percentComplete >= 0.75 ? intl.string(t.gvCR4H) : percentComplete >= 0.45 && percentComplete <= 0.55 ? intl.string(t.JNx8sG) : percentComplete > 0 ? intl.string(t.JMbfnc) : intl.string(t['7e5k7L']);
}
const formatToPlainString = intl.formatToPlainString;
const EQa7os = t.EQa7os;
return Reflect.apply(formatToPlainString, intl, [EQa7os, {questName: quest.config.messages.questName}]);
}
function getDisclosureText({isTargetedDisclosure, isContextualDisclosure, isVideoQuest, gamePublisher, gameTitle, cosponsorName}) { // fn#74186, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9691:964, offset: 0x01d83aa3, size: 468 bytes, params: 2, frame: 21
var r0;
var r5;
var r1;
var value;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var formatToPlainString;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
if (isTargetedDisclosure) {
if (isContextualDisclosure) {
r1 = intl.string(t.nPg6f1);
} else {
r5 = cosponsorName == null ? intl.formatToPlainString(t.Piihy1,
{gamePublisher: gamePublisher}) : intl.formatToPlainString(t.DV47Gy, {gamePublisher: gamePublisher,
cosponsorName: cosponsorName});
value = intl.string(t.fEbrT8);
value = '' + r5 + ' ' + value;
r1 = value;
}
r0 = r1;
} else {
formatToPlainString = intl.formatToPlainString;
r0 = isVideoQuest ? Reflect.apply(formatToPlainString, intl, [t.rctMRl,
{gamePublisher: gamePublisher}]) : Reflect.apply(formatToPlainString, intl, [t['5bQWNG'],
{gamePublisher: gamePublisher, gameTitle: gameTitle}]);
}
return r0;
}
function getSortMethodText(a0) { // fn#74188, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9691:1627, offset: 0x01d83c8e, size: 316 bytes, params: 2, frame: 15
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
const SUGGESTED = QuestHomeSortMethods.SUGGESTED;
if (SUGGESTED === a0) {
return intl.string(t.gBfXPZ);
}
const MOST_RECENT = QuestHomeSortMethods.MOST_RECENT;
if (MOST_RECENT === a0) {
return intl.string(t.K6oEu2);
}
const EXPIRING_SOON = QuestHomeSortMethods.EXPIRING_SOON;
if (EXPIRING_SOON === a0) {
return intl.string(t.IB22n3);
}
const RECENTLY_ENROLLED = QuestHomeSortMethods.RECENTLY_ENROLLED;
if (RECENTLY_ENROLLED === a0) {
return intl.string(t['BB+2tX']);
}
}
function getFilterTypeText(a0) { // fn#74189, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9691:1954, offset: 0x01d83dca, size: 392 bytes, params: 2, frame: 15
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
const VIRTUAL_CURRENCY = RewardFilterTypes.VIRTUAL_CURRENCY;
if (VIRTUAL_CURRENCY === a0) {
return intl.string(t.ElYQFS);
}
const COLLECTIBLE = RewardFilterTypes.COLLECTIBLE;
if (COLLECTIBLE === a0) {
return intl.string(t.Jg17Ut);
}
const IN_GAME = RewardFilterTypes.IN_GAME;
if (IN_GAME === a0) {
return intl.string(t['O/J2kr']);
}
const VIDEO = TaskFilterTypes.VIDEO;
if (VIDEO === a0) {
return intl.string(t.e0iISA);
}
const PLAY = TaskFilterTypes.PLAY;
if (PLAY === a0) {
return intl.string(t['1nJR4p']);
}
}
function getFilterGroupHeadingText(a0) { // fn#74190, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9691:2338, offset: 0x01d83f52, size: 151 bytes, params: 2, frame: 14
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
if (a0 === 'reward') {
return intl.string(t.vjLqAU);
}
if (a0 === 'task') {
return intl.string(t.Hufmss);
}
}
function copyShareLink(a0, {content, ctaContent, position, impressionId, sourceQuestContent}) { // fn#74192, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9691:2605, offset: 0x01d83ffa, size: 136 bytes, params: 3, frame: 18
(require(7110) /* metro dependency 7110: AnalyticsActions */).trackQuestContentClicked({questId: a0,
questContent: content, questContentCTA: ctaContent, questContentPosition: position, impressionId: impressionId,
sourceQuestContent: sourceQuestContent});
const clipboardUtilsNativeModule = require(6797) /* metro dependency 6797: ClipboardUtilsNative */;
clipboardUtilsNativeModule.copy(getQuestUrl(a0));
}
@@ -0,0 +1,501 @@
/* Metro module 7091; source: modules/quests/utils/QuestDataUtils.tsx; dependencies: [1949, 7092, 7093, 6528, 661, 6531, 1391, 7108, 1216, 2] */
function _fun56551(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#56551, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7269:6, offset: 0x013cb5c0, size: 484 bytes, params: 8, frame: 23
const env0_0 = require;
const _arrayLikeToArray_56554 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const closure = function(a0) {
return global.Object.keys(DismissibleQuestContentFlags).includes(require(dependencyMap[5]).QuestContent[a0]);
};
const closure2 = function(a0) {
var Date = global.Date;
var value2 = new Date(a0.expiresAt);
value2 = value2.valueOf();
Date = global.Date;
return value2 <= Date.now();
};
const closure3 = function(a0) {
return isQuestConfigExpired(a0.config);
};
const closure4 = getQuestPlacementFromQuestContent;
const mapQuestAdDecision = function(a0) {
return {questId: a0.questId, adCreativeId: a0.adCreativeId, adDecisionData: a0.adDecisionData,
adContext: a0.adContext, metadataSealed: a0.metadataSealed,
trafficMetadataSealed: a0.trafficMetadataSealed};
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const localeStore = importDefault(1949) /* metro dependency 1949: LocaleStore */;
const bountyStore = importDefault(7092) /* metro dependency 7092: BountyStore */;
const questStore = importDefault(7093) /* metro dependency 7093: QuestStore */;
const questConstantsModule = require(6528) /* metro dependency 6528: QuestConstants */;
const env0_6 = questConstantsModule.DismissibleQuestContentFlags;
const env0_7 = questConstantsModule.BILLABLE_PLACEMENTS;
const env0_8 = questConstantsModule.EMPTY_AD_DECISION_DATA;
const env0_9 = (require(661) /* metro dependency 661: Constants */).Routes;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/utils/QuestDataUtils.tsx');
exports.THIRTY_DAYS_MS = 2592000000;
exports.earnedDecisionIsValid = function(a0) {
var r0;
var property;
var value = a0 != null;
if (value) {
property = a0.fetchedAt;
value = property + a0.ttlMillis;
property = global.Date;
value = value >= property.now();
r0 = value;
} else {
r0 = value;
}
return r0;
};
exports.findQuestOrReplacement = findQuestOrReplacement;
exports.isDismissible = closure;
exports.isDismissed = function(a0, a1) {
if (isDismissible(a1)) {
return require(dependencyMap[6]).hasFlag(a0.dismissedQuestContent,
DismissibleQuestContentFlags[require(dependencyMap[5]).QuestContent[a1]]);
}
return false;
};
exports.isQuestConfigExpired = closure2;
exports.isQuestExpired = closure3;
exports.getIsQuestExpiredButWithinThirtyDayLookback = getIsQuestExpiredButWithinThirtyDayLookback;
exports.findNextUpcomingExpirationEpochMs = findNextUpcomingExpirationEpochMs;
exports.hasUnclaimedReward = function(a0) {
return a0 != null && a0.completedAt != null && a0.claimedAt == null;
};
exports.getQuestFormattedDate = getQuestFormattedDate;
exports.getQuestForPlacement = function(a0, a1, a2) {
var value = a1.get(a2);
if (value != null) {
value = a0.get(value.quest.id);
return value == null || isQuestExpired(value) ? undefined : value;
}
};
exports.getQuestPlacementFromQuestContent = closure4;
exports.isBillableQuestContent = isBillableQuestContent;
exports.getAdDecisionData = function(a0, a1) {
var r2;
var value2 = getQuestPlacementFromQuestContent(a1);
if (value2 == null) {
return EMPTY_AD_DECISION_DATA;
}
r2 = getQuestDeliveryDataForPlacement(value2, a0) ?? ({});
var adDecisionData = r2.adDecisionData;
return adDecisionData == null ? EMPTY_AD_DECISION_DATA : r2.questId === a0 || r2.adCreativeId === a0 || adDecisionData.ad_id === a0 ? adDecisionData : EMPTY_AD_DECISION_DATA;
};
exports.getAdMetadataSealed = getAdMetadataSealed;
exports.getAdTrafficMetadataSealed = getAdTrafficMetadataSealed;
exports.getAdContext = getAdContext;
exports.captureQuestsException = captureQuestsException;
exports.isOnDiscoverQuestHomeRoute = function() {
return global.window.location.pathname.startsWith(Routes.QUEST_HOME_DEPRECATED);
};
}
function _createForOfIteratorHelperLoose_56552(a0, a1) { // fn#56552, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7269:243, offset: 0x013cb7a4, size: 370 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun56553;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_56554(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_56554(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_56554(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun56553;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
}
function getQuestPlacementFromQuestContent(a0) { // fn#56558, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7269:1398, offset: 0x013cb9ba, size: 356 bytes, params: 2, frame: 15
const object2 = {};
const QuestContent = (require(6531) /* metro dependency 6531: QuestTypes */).QuestContent;
const QUEST_BAR = QuestContent.QUEST_BAR;
const QuestPlacement = (require(6531) /* metro dependency 6531: QuestTypes */).QuestPlacement;
let DESKTOP_ACCOUNT_PANEL_AREA = QuestPlacement.DESKTOP_ACCOUNT_PANEL_AREA;
object2[QUEST_BAR] = DESKTOP_ACCOUNT_PANEL_AREA;
const QUEST_BAR_V2 = QuestContent.QUEST_BAR_V2;
DESKTOP_ACCOUNT_PANEL_AREA = QuestPlacement.DESKTOP_ACCOUNT_PANEL_AREA;
object2[QUEST_BAR_V2] = DESKTOP_ACCOUNT_PANEL_AREA;
const QUEST_BAR_MOBILE = QuestContent.QUEST_BAR_MOBILE;
const MOBILE_HOME_DOCK_AREA = QuestPlacement.MOBILE_HOME_DOCK_AREA;
object2[QUEST_BAR_MOBILE] = MOBILE_HOME_DOCK_AREA;
const QUEST_HOME_HERO = QuestContent.QUEST_HOME_HERO;
let QUEST_HOME_BANNER_DESKTOP = QuestPlacement.QUEST_HOME_BANNER_DESKTOP;
object2[QUEST_HOME_HERO] = QUEST_HOME_BANNER_DESKTOP;
const QUEST_HOME_HERO_SHELF = QuestContent.QUEST_HOME_HERO_SHELF;
QUEST_HOME_BANNER_DESKTOP = QuestPlacement.QUEST_HOME_BANNER_DESKTOP;
object2[QUEST_HOME_HERO_SHELF] = QUEST_HOME_BANNER_DESKTOP;
const QUEST_HOME_MOBILE_CAROUSEL = QuestContent.QUEST_HOME_MOBILE_CAROUSEL;
const QUEST_HOME_MOBILE_CAROUSEL2 = QuestPlacement.QUEST_HOME_MOBILE_CAROUSEL;
object2[QUEST_HOME_MOBILE_CAROUSEL] = QUEST_HOME_MOBILE_CAROUSEL2;
const VIDEO_MODAL_MOBILE = QuestContent.VIDEO_MODAL_MOBILE;
const VIDEO_MODAL_MOBILE2 = QuestPlacement.VIDEO_MODAL_MOBILE;
object2[VIDEO_MODAL_MOBILE] = VIDEO_MODAL_MOBILE2;
return object2[a0];
}
function getQuestDeliveryDataForPlacement(a0, a1) { // fn#56560, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7269:2306, offset: 0x013cbb67, size: 394 bytes, params: 3, frame: 20
var r0;
var r5;
var value3;
var adDecisionByPlacementAndAdCreativeId;
var quest;
var id;
const QuestPlacement = (require(6531) /* metro dependency 6531: QuestTypes */).QuestPlacement;
const QUEST_HOME_MOBILE_CAROUSEL = QuestPlacement.QUEST_HOME_MOBILE_CAROUSEL;
if (a0 === QUEST_HOME_MOBILE_CAROUSEL) {
value3 = null;
if (value3 == a1) {
r0 = value3;
} else {
adDecisionByPlacementAndAdCreativeId = BountyStore.getAdDecisionByPlacementAndAdCreativeId(a0, a1);
r0 = value3 != adDecisionByPlacementAndAdCreativeId ? mapQuestAdDecision(adDecisionByPlacementAndAdCreativeId) : value3;
}
} else if (a0 !== QuestPlacement.VIDEO_MODAL_MOBILE) {
r0 = null;
} else {
value3 = null;
if (value3 == a1) {
r0 = value3;
} else {
adDecisionByPlacementAndAdCreativeId = BountyStore.getAdDecisionByPlacementAndAdCreativeId(a0, a1);
r0 = value3 != adDecisionByPlacementAndAdCreativeId ? mapQuestAdDecision(adDecisionByPlacementAndAdCreativeId) : value3;
}
}
const value6 = null;
if (value6 != r0) {
return r0;
}
const defaultImport = importDefault(7108) /* metro dependency 7108: NewAdRequestBehaviorExperiment */;
const getConfig = defaultImport.getConfig;
let object2 = {location: 'getQuestDeliveryDataForPlacement'};
const enableNewRequestBehavior = Reflect.apply(getConfig, defaultImport, [object2]).enableNewRequestBehavior;
const value7 = QuestStore.questAdDecisionByPlacement.get(a0);
const QUEST_HOME_BANNER_DESKTOP = QuestPlacement.QUEST_HOME_BANNER_DESKTOP;
if (a0 === QUEST_HOME_BANNER_DESKTOP) {
if (value6 != value7) {
return mapQuestAdDecision(value7);
}
}
if (enableNewRequestBehavior) {
return value6 == value7 ? value6 : mapQuestAdDecision(value7);
}
const value = QuestStore.questToDeliverForPlacement.get(a0);
if (value6 == value) {
r5 = value6;
} else {
object2 = {};
quest = value.quest;
id = quest.id;
object2.questId = id;
quest = value.quest;
id = quest.id;
object2.adCreativeId = id;
object2.adDecisionData = value.adDecisionData;
object2.adContext = value.adContext;
object2.metadataSealed = value.metadataSealed;
object2.trafficMetadataSealed = value.trafficMetadataSealed;
r5 = object2;
}
return r5;
}
function findQuestOrReplacement(a0, a1, a2) { // fn#56562, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7269:3402, offset: 0x013cbd24, size: 203 bytes, params: 4, frame: 17
var r4;
var Map;
let value = a1;
const value2 = a2;
let Array = global.Array;
if (Array.isArray(value)) {
Map = global.Map;
value = value.map(function(a0) {
return [a0.id, a0];
});
r4 = new Map(value);
} else {
r4 = value;
}
Array = global.Array;
const r3 = Array.isArray(value2) ? new global.Map(value2.map(function(a0) {
return [a0.id, a0];
})) : value2;
value = r4.get(a0);
if (value != null) {
return value;
}
value = r3.get(a0);
const value5 = undefined;
const replacementId = value == null ? value5 : value.replacementId;
return replacementId != null ? r4.get(replacementId) : value5;
}
function getIsQuestExpiredButWithinThirtyDayLookback(a0) { // fn#56566, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7269:3973, offset: 0x013cbe50, size: 132 bytes, params: 2, frame: 13
var Date;
var config;
var expiresAt;
var value2;
var date;
var value4;
var value;
if (isQuestExpired(a0)) {
Date = global.Date;
value = Date.now();
value -= 2592000000;
Date = global.Date;
config = a0.config;
expiresAt = config.expiresAt;
value2 = Object.create(Date.prototype, {constructor: {value: Date}});
date = new Date();
value4 = (date instanceof Object ? date : value2).valueOf();
config = a0.config;
expiresAt = config.expiresAt;
return expiresAt != null && !(value4 <= value);
}
return false;
}
function findNextUpcomingExpirationEpochMs(a0) { // fn#56567, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7269:4199, offset: 0x013cbed4, size: 157 bytes, params: 2, frame: 20
var r2;
var r3;
var r10;
var r9;
var r0;
var value6;
var config;
var expiresAt;
var prototype;
var value7;
var date;
var value8;
var value9;
var value10;
var value11;
var value12;
let Date = global.Date;
const value = Date.now();
const value3 = _createForOfIteratorHelperLoose_56552(a0);
const value4 = value3();
let done = value4.done;
const value5 = null;
if (done) {
r0 = value5;
} else {
r2 = value5;
r3 = value4;
while (true) {
value6 = r3.value;
Date = global.Date;
config = value6.config;
expiresAt = config.expiresAt;
prototype = Date.prototype;
value7 = Object.create(prototype, {constructor: {value: Date}});
date = new Date();
value8 = date instanceof Object ? date : value7;
value9 = value8.valueOf();
if (value9 <= value) {
r9 = r2;
} else {
value10 = value5 == r2;
if (value10) {
r10 = value10;
continue;
}
value11 = value9 < r2;
r10 = value11;
if (r10) {
r2 = value9;
continue;
}
continue;
r9 = r2;
}
value12 = value3();
done = value12.done;
if (done) {
r0 = r9;
break;
}
r2 = r9;
r3 = value12;
continue;
}
}
return r0;
}
function getQuestFormattedDate(a0) { // fn#56569, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7269:4555, offset: 0x013cbf96, size: 97 bytes, params: 2, frame: 14
var r0;
var date;
const value = a1;
if (a0 == null) {
r0 = '';
} else {
date = new global.Date(a0);
date = date.toLocaleDateString(LocaleStore.locale, value !== undefined ? value : {dateStyle: 'short'});
r0 = date;
}
return r0;
}
function isBillableQuestContent(a0) { // fn#56571, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7269:4927, offset: 0x013cc04a, size: 42 bytes, params: 2, frame: 12
const questPlacementFromQuestContent = getQuestPlacementFromQuestContent(a0);
return questPlacementFromQuestContent != null && BILLABLE_PLACEMENTS.has(questPlacementFromQuestContent);
}
function getAdMetadataSealed(a0, a1) { // fn#56573, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7269:5327, offset: 0x013cc0e1, size: 55 bytes, params: 3, frame: 14
var questDeliveryDataForPlacement;
const getQuestPlacementFromQuestContentBinding = getQuestPlacementFromQuestContent;
const value2 = undefined;
const questPlacementFromQuestContentBinding = getQuestPlacementFromQuestContentBinding(a0);
if (questPlacementFromQuestContentBinding != null) {
questDeliveryDataForPlacement = getQuestDeliveryDataForPlacement(questPlacementFromQuestContentBinding, a1);
return questDeliveryDataForPlacement == null ? value2 : questDeliveryDataForPlacement.metadataSealed;
}
return value2;
}
function getAdTrafficMetadataSealed(a0, a1, a2) { // fn#56574, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7269:5527, offset: 0x013cc118, size: 109 bytes, params: 4, frame: 17
var quest;
const getQuestPlacementFromQuestContentBinding = getQuestPlacementFromQuestContent;
const value2 = undefined;
const questPlacementFromQuestContentBinding = getQuestPlacementFromQuestContentBinding(a0);
if (questPlacementFromQuestContentBinding != null) {
var {trafficMetadataSealed, questId} = getQuestDeliveryDataForPlacement(questPlacementFromQuestContentBinding,
a2) ?? ({});
if (trafficMetadataSealed == null) {
if (a1 != null) {
quest = QuestStore.getQuest(a1);
return quest == null ? value2 : quest.trafficMetadataSealed;
}
return value2;
}
if (a2 != null) {
return trafficMetadataSealed;
}
if (questId === a1) {
return trafficMetadataSealed;
}
}
if (a1 != null) {
quest = QuestStore.getQuest(a1);
return quest == null ? value2 : quest.trafficMetadataSealed;
}
return value2;
}
function getAdContext(a0, a1) { // fn#56575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7269:5858, offset: 0x013cc185, size: 55 bytes, params: 3, frame: 14
var questDeliveryDataForPlacement;
const getQuestPlacementFromQuestContentBinding = getQuestPlacementFromQuestContent;
const value2 = undefined;
const questPlacementFromQuestContentBinding = getQuestPlacementFromQuestContentBinding(a0);
if (questPlacementFromQuestContentBinding != null) {
questDeliveryDataForPlacement = getQuestDeliveryDataForPlacement(questPlacementFromQuestContentBinding, a1);
return questDeliveryDataForPlacement == null ? value2 : questDeliveryDataForPlacement.adContext;
}
return value2;
}
function captureQuestsException(a0, a1) { // fn#56576, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7269:6042, offset: 0x013cc1bc, size: 108 bytes, params: 3, frame: 17
const value = undefined;
const defaultImport = importDefault(1216) /* metro dependency 1216: SentryUtilsNative */;
const captureException = defaultImport.captureException;
const object3 = {};
copyDataProperties(object3, a1, undefined);
const object4 = {};
const value2 = a1 == null;
copyDataProperties(object4, value2 ? value : a1.tags, value2);
object4['app_context'] = 'quests';
object3['tags'] = object4;
Reflect.apply(captureException, defaultImport, [a0, object3]);
return value;
}
@@ -0,0 +1,375 @@
/* Metro module 9524; source: modules/quests/utils/QuestMatchingUtils.tsx; dependencies: [57, 4234, 6528, 661, 4237, 7116, 7091, 7114, 2] */
function _fun74307(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#74307, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9710:6, offset: 0x01d899e9, size: 330 bytes, params: 8, frame: 21
let env0_0 = require;
const _arrayLikeToArray_74310 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const closure = questMatchesActivity;
const closure2 = getQuestByActivity;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(57) /* metro dependency 57 */;
const applicationStore = importDefault(4234) /* metro dependency 4234: ApplicationStore */;
const questConstantsModule = require(6528) /* metro dependency 6528: QuestConstants */;
const env0_4 = questConstantsModule.DISCORD_APPLICATION_ID;
const env0_5 = questConstantsModule.PLAY_ACTIVITY_CLOUD_GAMING_QUEST_ID;
const env0_6 = questConstantsModule.PLAY_ACTIVITY_SOCIAL_ENTRY_APPLICATION_ID;
const env0_7 = (require(661) /* metro dependency 661: Constants */).ActivityGamePlatforms;
const env0_8 = (require(4237) /* metro dependency 4237: Constants */).XBOX_ACTIVITY_APPLICATION_ID;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/utils/QuestMatchingUtils.tsx');
exports.questMatchesActivity = closure;
exports.getQuestByActivity = closure2;
exports.getQuestByApplicationId = getQuestByApplicationId;
exports.allPlayOnDesktopQuestsByApplicationId = function(a0, a1) {
var env0_0 = a1;
var Array = global.Array;
return Array.from(a0.values()).filter(_fun74317);
};
exports.getQuestsFromActivities = function(a0, a1) {
var value4;
var value5;
if (a1 == null) {
return null;
}
if (a0 == null) {
return null;
}
var value2 = _createForOfIteratorHelperLoose_74308(a1);
var value3 = value2();
if (value3.done) {
return null;
}
var r3 = value3;
loopExit3: while (true) {
value4 = getQuestByActivity(a0, r3.value);
if (value4 != null) {
break loopExit3;
}
value5 = value2();
if (value5.done) {
return null;
}
r3 = value5;
continue;
}
return value4;
};
exports.getEligibleQuestsForApplicationId = function(a0, a1) {
var r0;
var value = a2;
var env0_0 = a1;
var env0_1 = value !== undefined ? value : false;
if (a1 == null) {
r0 = [];
} else {
value = global.Array.from(a0.values());
value = value.filter(_fun74320);
r0 = value;
}
return r0;
};
}
function _createForOfIteratorHelperLoose_74308(a0, a1) { // fn#74308, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9710:317, offset: 0x01d89b33, size: 372 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun74309;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_74310(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_74310(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_74310(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun74309;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
}
function questMatchesActivity(a0, a1) { // fn#74311, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9710:1227, offset: 0x01d89ca7, size: 295 bytes, params: 3, frame: 19
var r1;
var r2;
var r0;
var value10;
var consoleApplicationId;
let value = a0 != null;
if (value) {
r1 = a0.application_id === XBOX_ACTIVITY_APPLICATION_ID || a0.platform === ActivityGamePlatforms.XBOX;
if (r1) {
value10 = a0.name.toLowerCase();
consoleApplicationId = (require(7116) /* metro dependency 7116: QuestTaskUtils */).getConsoleApplicationId(a1);
if (consoleApplicationId == null) {
r2 = false;
} else {
value = ApplicationStore.getApplication(consoleApplicationId);
r2 = value != null && value10 === value.name.toLowerCase();
}
r1 = r2;
} else {
r1 = a0.platform === ActivityGamePlatforms.PS4 || a0.platform === ActivityGamePlatforms.PS5;
if (r1) {
value10 = a0.name.toLowerCase();
consoleApplicationId = (require(7116) /* metro dependency 7116: QuestTaskUtils */).getConsoleApplicationId(a1);
if (consoleApplicationId == null) {
r2 = false;
} else {
value = ApplicationStore.getApplication(consoleApplicationId);
r2 = value != null && value10 === value.name.toLowerCase();
}
r1 = r2;
} else {
r1 = a1 != null && a1.id === PLAY_ACTIVITY_CLOUD_GAMING_QUEST_ID;
r1 = r1 && a0.application_id === PLAY_ACTIVITY_SOCIAL_ENTRY_APPLICATION_ID;
r1 = !r1 ? a0.application_id != null && questMatchesApplicationId(a0.application_id, a1) : r1;
}
}
r0 = r1;
} else {
r0 = value;
}
return r0;
}
function getQuestByActivity(a0, a1) { // fn#74312, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9710:1685, offset: 0x01d89dce, size: 129 bytes, params: 3, frame: 21
var r2;
var value4;
var value5;
var property;
var moduleValue;
var isQuestExpired;
var value6;
const value2 = _createForOfIteratorHelperLoose_74308(a0);
const value3 = value2();
let done = value3.done;
if (!done) {
r2 = value3;
reducibleLoop1: while (true) {
value4 = r2.value;
value5 = env0_2(value4, 2);
value5[0];
property = value5[1];
if (questMatchesActivity(a1, property)) {
moduleValue = require(7091) /* metro dependency 7091: QuestDataUtils */;
isQuestExpired = moduleValue.isQuestExpired;
reducibleJoin4: while (true) {
if (!Reflect.apply(isQuestExpired, moduleValue, [property])) {
return property;
}
break reducibleJoin4;
}
}
value6 = value2();
done = value6.done;
if (done) {
return undefined;
}
r2 = value6;
continue reducibleLoop1;
}
}
}
function questMatchesApplicationId(a0, a1) { // fn#74313, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9710:1888, offset: 0x01d89e4f, size: 77 bytes, params: 3, frame: 12
var r0;
const env0_0 = a0;
let value = require(7116) /* metro dependency 7116: QuestTaskUtils */;
value = value.getAllApplicationIds(a1);
const value2 = value != null;
if (value2) {
value = value.some(_fun74314);
r0 = value;
} else {
r0 = value2;
}
return r0;
}
function getQuestByApplicationId(a0, a1) { // fn#74315, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9710:2193, offset: 0x01d89e9c, size: 137 bytes, params: 3, frame: 22
var r2;
var r0;
var value5;
var value6;
var property;
var moduleValue;
var isQuestExpired;
var value7;
const _createForOfIteratorHelperLoose_74308Binding = _createForOfIteratorHelperLoose_74308;
const value2 = undefined;
const value3 = _createForOfIteratorHelperLoose_74308Binding(a0);
const value4 = value3();
let done = value4.done;
if (done) {
r0 = value2;
} else {
r2 = value4;
reducibleLoop1: while (true) {
value5 = r2.value;
value6 = env0_2(value5, 2);
value6[0];
property = value6[1];
if (questMatchesApplicationId(a1, property)) {
moduleValue = require(7091) /* metro dependency 7091: QuestDataUtils */;
isQuestExpired = moduleValue.isQuestExpired;
reducibleJoin3: while (true) {
if (Reflect.apply(isQuestExpired, moduleValue, [property])) {
break reducibleJoin3;
}
r0 = property;
break reducibleLoop1;
}
}
value7 = value3();
done = value7.done;
if (done) {
r0 = value2;
break reducibleLoop1;
}
r2 = value7;
continue reducibleLoop1;
}
}
return r0;
}
function allPlayOnDesktopQuestsByApplicationId(a0, a1) { // fn#74316, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9710:2461, offset: 0x01d89f25, size: 58 bytes, params: 3, frame: 13
const env0_0 = a1;
const Array = global.Array;
return Array.from(a0.values()).filter(_fun74317);
}
function getEligibleQuestsForApplicationId(a0, a1) { // fn#74319, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9710:2925, offset: 0x01d8a01f, size: 85 bytes, params: 3, frame: 13
var r0;
var Array;
let value = a2;
const env0_0 = a1;
if (value !== undefined) {
}
if (a1 == null) {
r0 = [];
} else {
Array = global.Array;
value = Array.from(a0.values());
value = value.filter(_fun74320);
r0 = value;
}
return r0;
}
function _fun74317(a0) { // fn#74317, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9710:2551, offset: 0x01d89f5f, size: 105 bytes, params: 2, frame: 16
var r0;
var moduleValue;
let value = environment.__proto__;
const value3 = questMatchesApplicationId(require, a0);
if (value3) {
moduleValue = require(7091) /* metro dependency 7091: QuestDataUtils */;
r0 = !moduleValue.isQuestExpired(a0);
} else {
r0 = value3;
}
if (r0) {
value = require(7116) /* metro dependency 7116: QuestTaskUtils */;
value = value.hasPlayOnDesktopTask({quest: a0});
r0 = value;
}
return r0;
}
function _fun74320(a0) { // fn#74320, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9710:3027, offset: 0x01d8a074, size: 225 bytes, params: 2, frame: 17
var moduleValue3;
const value = environment.__proto__;
const value2 = undefined;
const activityApplicationId = (require(7116) /* metro dependency 7116: QuestTaskUtils */).getActivityApplicationId(a0);
let r0 = a0 != null && (require(7114) /* metro dependency 7114: QuestUtils */).canLaunchActivity(a0);
if (r0) {
moduleValue3 = require(7091) /* metro dependency 7091: QuestDataUtils */;
r0 = !moduleValue3.isQuestExpired(a0);
}
r0 = r0 && activityApplicationId === require && activityApplicationId !== DISCORD_APPLICATION_ID;
r0 = r0 && ((a0.userStatus == null ? value2 : a0.userStatus.completedAt) == null || env0_1) && ((a0.userStatus == null ? value2 : a0.userStatus.enrolledAt) == null || env0_1);
return r0;
}
@@ -0,0 +1,51 @@
/* Metro module 9503; source: modules/quests/utils/QuestOrbMultiplierUtils.tsx; dependencies: [3802, 1893, 1895, 5136, 2] */
function _fun74173(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#74173, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9689:6, offset: 0x01d83224, size: 228 bytes, params: 8, frame: 18
var object2;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
object2 = {UPSELL: 'UPSELL', NITRO: 'NITRO', CREPE: 'CREPE', INELIGIBLE: 'INELIGIBLE'};
const CREPE = object2.CREPE;
const items2 = [CREPE];
const NITRO = object2.NITRO;
items2[1] = NITRO;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/utils/QuestOrbMultiplierUtils.tsx');
exports.QuestOrbMultiplierEligibilityType = object2;
exports.QuestOrbMultiplierSource = {NITRO: 'nitro', CREPE: 'crepe'};
exports.shouldReceiveQuestOrbMultiplier = shouldReceiveQuestOrbMultiplier;
exports.getQuestOrbMultiplierSource = getQuestOrbMultiplierSource;
}
function getQuestOrbMultiplierSource(a0) { // fn#74175, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9689:559, offset: 0x01d83308, size: 335 bytes, params: 2, frame: 18
var r1;
var defaultImport2;
var moduleValue;
var value3;
var perkSource;
const PerkSource = (require(1895) /* metro dependency 1895: user */).PerkSource;
var moduleValue2;
const value2 = undefined;
const defaultImport = importDefault(3802) /* metro dependency 3802: PremiumUtils */;
if (defaultImport.canUseMoreQuestOrbs(a0)) {
defaultImport2 = defaultImport;
if (defaultImport2.canUseQuestOrbMultiplier(a0)) {
return env0_3.NITRO;
}
moduleValue = require(1893) /* metro dependency 1893: PerksStateUtils */;
value3 = null;
perkSource = moduleValue.getPerkSource(value3 == a0 ? value2 : a0.perks,
(require(1895) /* metro dependency 1895: user */).Perk.MORE_QUEST_ORBS);
if (value3 == perkSource) {
moduleValue2 = require(5136) /* metro dependency 5136: CrepeExperiment */;
r1 = moduleValue2.getIsCrepeEnabled('getQuestOrbMultiplierSource') && value3 != perkSource && perkSource.includes(PerkSource.SOURCE_THIRDPARTY_CROISSANT) ? env0_3.CREPE : value3;
} else if (perkSource.includes(PerkSource.SOURCE_NITRO)) {
r1 = env0_3.NITRO;
} else {
moduleValue2 = require(5136) /* metro dependency 5136: CrepeExperiment */;
r1 = moduleValue2.getIsCrepeEnabled('getQuestOrbMultiplierSource') && value3 != perkSource && perkSource.includes(PerkSource.SOURCE_THIRDPARTY_CROISSANT) ? env0_3.CREPE : value3;
}
return r1;
}
return null;
}
@@ -0,0 +1,584 @@
/* Metro module 9520; source: modules/quests/utils/QuestPlatformUtils.tsx; dependencies: [6528, 661, 7116, 6535, 9519, 9517, 9518, 7121, 7110, 9354, 1244, 477, 9505, 4078, 9521, 1239, 491, 9511, 3847, 7007, 694, 2] */
function _fun74261(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#74261, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:6, offset: 0x01d8797a, size: 395 bytes, params: 8, frame: 20
const env0_0 = require;
const closure = supportedConsoles;
const closure2 = function(a0) {
return a0.connected_account_type === 'xbox' ? PlatformTypes.XBOX : PlatformTypes.PLAYSTATION;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = (require(6528) /* metro dependency 6528: QuestConstants */).QuestTaskPlatform;
const constantsModule = require(661) /* metro dependency 661: Constants */;
const env0_4 = constantsModule.AnalyticEvents;
const env0_5 = constantsModule.ComponentActions;
const env0_6 = constantsModule.PlatformTypes;
const env0_7 = constantsModule.UserSettingsSections;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/utils/QuestPlatformUtils.tsx');
exports.supportedTaskPlatforms = supportedTaskPlatforms;
exports.supportedConsoles = closure;
exports.isQuestSupportedOnWeb = isQuestSupportedOnWeb;
exports.PlayQuestPlatform = {DESKTOP: 'desktop', XBOX: 'xbox', PLAYSTATION: 'playstation'};
exports.getPlatformTypeForHintMessage = closure2;
exports.openAuthorizationConnectionModal = openAuthorizationConnectionModal;
exports.getExpiredCredentialsHintMessage = function(a0) {
return getPlatformTypeForHintMessage(a0) === PlatformTypes.XBOX ? require(dependencyMap[10]).t['mytEv+'] : require(dependencyMap[10]).t.iDiwby;
};
exports.openGameLinkDirectly = openGameLinkDirectly;
exports.openAdGameLinkDirectly = openAdGameLinkDirectly;
exports.openConsoleConnectionSettings = openConsoleConnectionSettings;
exports.openAddConsoleConnectionModal = openAddConsoleConnectionModal;
exports.openSingleConsoleConnectionModal = openSingleConsoleConnectionModal;
}
function supportedConsoles({config}) { // fn#74262, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:217, offset: 0x01d87b05, size: 194 bytes, params: 2, frame: 17
var r5;
var property;
const FirstPartyQuestTaskTypes = (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypes;
var PLAY_ON_XBOX;
var PLAY_ON_PLAYSTATION;
var push;
var PLAYSTATION;
var XBOX;
var value4;
const items2 = [];
const Object = global.Object;
const value = Object.keys(config.taskConfigV2.tasks);
let length = value.length;
if (0 < length) {
r5 = 0;
while (true) {
property = value[r5];
PLAY_ON_XBOX = FirstPartyQuestTaskTypes.PLAY_ON_XBOX;
if (PLAY_ON_XBOX !== property) {
PLAY_ON_PLAYSTATION = FirstPartyQuestTaskTypes.PLAY_ON_PLAYSTATION;
if (PLAY_ON_PLAYSTATION !== property) {
break;
}
push = items2.push;
PLAYSTATION = PlatformTypes.PLAYSTATION;
Reflect.apply(push, items2, [PLAYSTATION]);
break;
}
push = items2.push;
XBOX = PlatformTypes.XBOX;
Reflect.apply(push, items2, [XBOX]);
value4 = typeof r5 === 'bigint' ? r5 + 1n : +r5 + 1;
length = value.length;
if (value4 < length) {
r5 = value4;
continue;
}
break;
}
}
return items2;
}
function getDirectAppStoreLinkFromCta(a0) { // fn#74264, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:695, offset: 0x01d87bf6, size: 340 bytes, params: 2, frame: 16
var iosAppId;
var r1;
var r0;
var ios;
var moduleValue3;
var android;
var value;
const value2 = undefined;
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
if (platformUtilsModule.isIOS()) {
ios = a0.ios;
iosAppId = ios == null ? value2 : ios.iosAppId;
if (iosAppId == null) {
moduleValue3 = platformUtilsModule;
if (moduleValue3.isAndroid()) {
android = a0.android;
value = null;
r1 = value == (value == android ? value2 : android.androidAppId) ? value : 'https://play.google.com/store/apps/details?id=' + a0.android.androidAppId;
} else {
value = require(477) /* metro dependency 477: PlatformUtils */;
value = value.getOS();
r1 = value !== 'android' || (a0.android == null ? value2 : a0.android.androidAppId) == null ? null : 'https://play.google.com/store/apps/details?id=' + a0.android.androidAppId;
}
r0 = r1;
} else {
ios = a0.ios;
iosAppId = ios.iosAppId;
value = iosAppId.startsWith('id');
ios = a0.ios;
iosAppId = ios.iosAppId;
value = 'https://apps.apple.com/app/' + (value ? iosAppId : 'id' + iosAppId);
r0 = value;
}
} else if ((require(477) /* metro dependency 477: PlatformUtils */).getOS() !== 'ios') {
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
if (moduleValue3.isAndroid()) {
android = a0.android;
value = null;
r1 = value == (value == android ? value2 : android.androidAppId) ? value : 'https://play.google.com/store/apps/details?id=' + a0.android.androidAppId;
} else {
value = require(477) /* metro dependency 477: PlatformUtils */;
value = value.getOS();
r1 = value !== 'android' || (a0.android == null ? value2 : a0.android.androidAppId) == null ? null : 'https://play.google.com/store/apps/details?id=' + a0.android.androidAppId;
}
r0 = r1;
} else {
ios = a0.ios;
iosAppId = ios == null ? value2 : ios.iosAppId;
if (iosAppId == null) {
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
if (moduleValue3.isAndroid()) {
android = a0.android;
value = null;
r1 = value == (value == android ? value2 : android.androidAppId) ? value : 'https://play.google.com/store/apps/details?id=' + a0.android.androidAppId;
} else {
value = require(477) /* metro dependency 477: PlatformUtils */;
value = value.getOS();
r1 = value !== 'android' || (a0.android == null ? value2 : a0.android.androidAppId) == null ? null : 'https://play.google.com/store/apps/details?id=' + a0.android.androidAppId;
}
r0 = r1;
} else {
ios = a0.ios;
iosAppId = ios.iosAppId;
value = iosAppId.startsWith('id');
ios = a0.ios;
iosAppId = ios.iosAppId;
value = 'https://apps.apple.com/app/' + (value ? iosAppId : 'id' + iosAppId);
r0 = value;
}
}
return r0;
}
function getInlineStoreParamsFromCta(a0) { // fn#74265, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:1120, offset: 0x01d87d4a, size: 266 bytes, params: 2, frame: 18
var iosAppId;
var r0;
var android;
var value3;
var ios;
var object2;
var parseInt;
var value;
const value2 = undefined;
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
if (platformUtilsModule.isAndroid()) {
android = a0.android;
if ((android == null ? value2 : android.androidAppId) != null) {
r0 = {url: 'https://play.google.com/d?id=' + a0.android.androidAppId, appId: null};
} else {
value = platformUtilsModule;
value = value.isIOS();
value3 = null;
if (value) {
ios = a0.ios;
iosAppId = value3 == ios ? value2 : ios.iosAppId;
if (value3 != iosAppId) {
object2 = {};
ios = a0.ios;
iosAppId = ios.iosAppId;
object2.url = 'https://apps.apple.com/app/id' + iosAppId;
parseInt = global.parseInt;
ios = a0.ios;
iosAppId = ios.iosAppId;
object2.appId = parseInt(iosAppId, 10);
r0 = object2;
} else {
r0 = value3;
}
} else {
r0 = value3;
}
}
} else {
value = require(477) /* metro dependency 477: PlatformUtils */;
value = value.isIOS();
value3 = null;
if (value) {
ios = a0.ios;
iosAppId = value3 == ios ? value2 : ios.iosAppId;
if (value3 != iosAppId) {
object2 = {};
ios = a0.ios;
iosAppId = ios.iosAppId;
object2.url = 'https://apps.apple.com/app/id' + iosAppId;
parseInt = global.parseInt;
ios = a0.ios;
iosAppId = ios.iosAppId;
object2.appId = parseInt(iosAppId, 10);
r0 = object2;
} else {
r0 = value3;
}
} else {
r0 = value3;
}
}
return r0;
}
function openAppStoreOverlay({url, appId}, a1) { // fn#74266, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:1475, offset: 0x01d87e54, size: 161 bytes, params: 3, frame: 17
var value2;
const env0_0 = a1;
const openPlayStoreInlineInstall = (require(4078) /* metro dependency 4078: BrowserManager */).openPlayStoreInlineInstall;
const appStoreOverlayTelemetryManagerModule = require(9521) /* metro dependency 9521: AppStoreOverlayTelemetryManager */;
const env0_1 = appStoreOverlayTelemetryManagerModule.clearAppStoreOverlayOpen;
const env0_2 = appStoreOverlayTelemetryManagerModule.setAppStoreOverlayOpen;
if (appId != null) {
value2 = appId.toString();
}
openPlayStoreInlineInstall(url, appId, _fun74267).then(_fun74268).catch(_fun74270);
}
function supportedTaskPlatforms(a0) { // fn#74271, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:2256, offset: 0x01d8805d, size: 195 bytes, params: 2, frame: 17
let r3 = (require(7116) /* metro dependency 7116: QuestTaskUtils */).hasPlayOnDesktopTask({quest: a0}) || (require(7116) /* metro dependency 7116: QuestTaskUtils */).hasStreamOnDesktopTask({quest: a0});
r3 = !r3 ? (require(7116) /* metro dependency 7116: QuestTaskUtils */).hasAchievementInGameTask(a0) : r3;
const hasSomeConsoleTasks2 = (require(7116) /* metro dependency 7116: QuestTaskUtils */).hasSomeConsoleTasks(a0);
items = [];
if (r3) {
items.push(QuestTaskPlatform.DESKTOP);
}
if (hasSomeConsoleTasks2) {
items.push(QuestTaskPlatform.CONSOLE);
}
return items;
}
function isQuestSupportedOnWeb(a0) { // fn#74272, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:2569, offset: 0x01d88120, size: 67 bytes, params: 2, frame: 15
let value = require(7116) /* metro dependency 7116: QuestTaskUtils */;
value = value.hasWatchVideoTasks(a0);
return value || (require(7116) /* metro dependency 7116: QuestTaskUtils */).hasPlayActivityTask(a0);
}
function openAuthorizationConnectionModal({platformType, quest}, a1) { // fn#74273, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:2804, offset: 0x01d88163, size: 355 bytes, params: 3, frame: 20
var object2;
var moduleValue3;
var captureAdUserAction;
const adAnalyticsInterfaceExperimentModule = require(9519) /* metro dependency 9519: AdAnalyticsInterfaceExperiment */;
const shouldMigrateToAdAnalyticsInterface = adAnalyticsInterfaceExperimentModule.shouldMigrateToAdAnalyticsInterface;
const AdAnalyticsInterfaceExperimentStep = adAnalyticsInterfaceExperimentModule.AdAnalyticsInterfaceExperimentStep;
const STEP_2_CLICKED_INTERNAL = AdAnalyticsInterfaceExperimentStep.STEP_2_CLICKED_INTERNAL;
if (Reflect.apply(shouldMigrateToAdAnalyticsInterface, adAnalyticsInterfaceExperimentModule,
[STEP_2_CLICKED_INTERNAL, 'open_authorization_connection_modal'])) {
moduleValue3 = require(9517) /* metro dependency 9517: captureAdUserAction */;
captureAdUserAction = moduleValue3.captureAdUserAction;
object2 = {};
object2.type = (require(9518) /* metro dependency 9518: captureAdUserActionTypes */).AdUserActionType.CLICK_INTERNAL;
object2.adCreativeType = (require(7121) /* metro dependency 7121: AdCreativeType */).AdCreativeType.QUEST;
object2.adCreativeId = quest.id;
object2.questContentCTA = a1.ctaContent;
object2.surfaceId = a1.content;
object2.sourceQuestContent = a1.sourceQuestContent;
object2.impressionId = a1.impressionId;
Reflect.apply(captureAdUserAction, moduleValue3, [object2]);
} else {
(require(7110) /* metro dependency 7110: AnalyticsActions */).trackQuestContentClicked({questId: quest.id,
questContent: a1.content, sourceQuestContent: a1.sourceQuestContent, questContentCTA: a1.ctaContent,
impressionId: a1.impressionId});
}
(importDefault(9354) /* metro dependency 9354: authorizeConnectionNative */)({platformType: platformType,
location: a1.ctaContent});
}
function openGameLinkDirectly(a0, a1) { // fn#74275, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:3689, offset: 0x01d8832b, size: 684 bytes, params: 3, frame: 26
var r5;
var r6;
var r2;
var r13;
var getDirectAppStoreLinkFromCtaBinding;
var moduleValue2;
var URL;
var prototype;
var value6;
var uRL;
var value7;
var searchParams;
var value8;
var error;
var value9;
var value10;
var value11;
var value12;
var value13;
var getInlineStoreParamsFromCtaBinding;
var moduleValue5;
const env0_0 = a0;
const env0_1 = a1;
const value2 = undefined;
const ctaLink = (require(9505) /* metro dependency 9505: QuestCopyUtils */).getCtaLink(a0.config);
let ctaConfig = a0.config.ctaConfig;
const value4 = null;
if (value4 == ctaConfig) {
r5 = value4;
} else {
getDirectAppStoreLinkFromCtaBinding = getDirectAppStoreLinkFromCta;
moduleValue2 = require(9505) /* metro dependency 9505: QuestCopyUtils */;
r5 = getDirectAppStoreLinkFromCtaBinding({url: moduleValue2.getCtaLink(a0.config), android: ctaConfig.android,
ios: ctaConfig.ios});
}
const r10 = value4 == r5 ? ctaLink : r5;
try {
URL = global.URL;
prototype = URL.prototype;
value6 = Object.create(prototype, {constructor: {value: URL}});
uRL = new URL(r10);
value7 = uRL instanceof Object ? uRL : value6;
searchParams = value7.searchParams;
value8 = searchParams.has('dclid');
r6 = value8;
} catch (error) {
value9 = false;
r6 = value9;
}
if (r6) {
value10 = (require(491) /* metro dependency 491 */).v4();
try {
URL = global.URL;
prototype = URL.prototype;
value11 = Object.create(prototype, {constructor: {value: URL}});
uRL = new URL(r10);
value12 = uRL instanceof Object ? uRL : value11;
searchParams = value12.searchParams;
searchParams.set('dclid', value10);
value13 = value12.toString();
r6 = value13;
} catch (error) {
r6 = r10;
}
r2 = r6;
r13 = value10;
} else {
r2 = r10;
r13 = value2;
}
(require(7110) /* metro dependency 7110: AnalyticsActions */).trackQuestContentClicked({questId: a0.id,
questContent: a1.content, questContentCTA: a1.ctaContent, questContentPosition: a1.position,
impressionId: a1.impressionId, sourceQuestContent: a1.sourceQuestContent, clickId: r13});
const ComponentDispatch = (require(1239) /* metro dependency 1239: ComponentDispatchUtils */).ComponentDispatch;
const dispatch = ComponentDispatch.dispatch;
const QUEST_GAME_LINK_OPENED = ComponentActions.QUEST_GAME_LINK_OPENED;
Reflect.apply(dispatch, ComponentDispatch, [QUEST_GAME_LINK_OPENED]);
const AppStoreBottomSheetOverlayFeatureGate = (require(9511) /* metro dependency 9511: experiments */).AppStoreBottomSheetOverlayFeatureGate;
const getConfig = AppStoreBottomSheetOverlayFeatureGate.getConfig;
if (Reflect.apply(getConfig, AppStoreBottomSheetOverlayFeatureGate, [{location: 'quest_open_game_link'}]).enabled) {
(importDefault(3847) /* metro dependency 3847: openURL */)(r2);
} else {
if (value4 == r5) {
(importDefault(3847) /* metro dependency 3847: openURL */)(r2);
return value2;
}
ctaConfig = a0.config.ctaConfig;
if (value4 == ctaConfig) {
r5 = value4;
} else {
getInlineStoreParamsFromCtaBinding = getInlineStoreParamsFromCta;
moduleValue5 = require(9505) /* metro dependency 9505: QuestCopyUtils */;
r5 = getInlineStoreParamsFromCtaBinding({url: moduleValue5.getCtaLink(a0.config),
android: ctaConfig.android,
ios: ctaConfig.ios});
}
if (value4 == r5) {
(importDefault(3847) /* metro dependency 3847: openURL */)(r2);
return value2;
}
openAppStoreOverlay(r5, _fun74276);
}
return value2;
}
function openAdGameLinkDirectly({adContentId, adCreativeType, cta}, a1) { // fn#74277, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:4920, offset: 0x01d88613, size: 312 bytes, params: 3, frame: 24
const env0_2 = a1;
const url = cta.url;
const directAppStoreLinkFromCta = getDirectAppStoreLinkFromCta(cta);
const r2 = directAppStoreLinkFromCta ?? url;
(require(7110) /* metro dependency 7110: AnalyticsActions */).trackAdContentClicked({adContentId: adContentId,
adCreativeType: adCreativeType, questContent: a1.content, questContentCTA: a1.ctaContent,
questContentPosition: a1.position, impressionId: a1.impressionId, sourceQuestContent: a1.sourceQuestContent});
const ComponentDispatch = (require(1239) /* metro dependency 1239: ComponentDispatchUtils */).ComponentDispatch;
const dispatch = ComponentDispatch.dispatch;
const QUEST_GAME_LINK_OPENED = ComponentActions.QUEST_GAME_LINK_OPENED;
Reflect.apply(dispatch, ComponentDispatch, [QUEST_GAME_LINK_OPENED]);
const AppStoreBottomSheetOverlayFeatureGate = (require(9511) /* metro dependency 9511: experiments */).AppStoreBottomSheetOverlayFeatureGate;
const getConfig = AppStoreBottomSheetOverlayFeatureGate.getConfig;
if (Reflect.apply(getConfig, AppStoreBottomSheetOverlayFeatureGate, [{location: 'quest_open_game_link'}]).enabled) {
(importDefault(3847) /* metro dependency 3847: openURL */)(r2);
} else {
if (directAppStoreLinkFromCta == null) {
(importDefault(3847) /* metro dependency 3847: openURL */)(r2);
return undefined;
}
var inlineStoreParamsFromCta = getInlineStoreParamsFromCta(cta);
if (inlineStoreParamsFromCta == null) {
(importDefault(3847) /* metro dependency 3847: openURL */)(r2);
return undefined;
}
openAppStoreOverlay(inlineStoreParamsFromCta, _fun74278);
}
}
function openConsoleConnectionSettings({quest}, a1) { // fn#74279, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:5671, offset: 0x01d8879a, size: 375 bytes, params: 3, frame: 19
var object2;
var moduleValue3;
var captureAdUserAction;
const adAnalyticsInterfaceExperimentModule = require(9519) /* metro dependency 9519: AdAnalyticsInterfaceExperiment */;
const shouldMigrateToAdAnalyticsInterface = adAnalyticsInterfaceExperimentModule.shouldMigrateToAdAnalyticsInterface;
const AdAnalyticsInterfaceExperimentStep = adAnalyticsInterfaceExperimentModule.AdAnalyticsInterfaceExperimentStep;
const STEP_2_CLICKED_INTERNAL = AdAnalyticsInterfaceExperimentStep.STEP_2_CLICKED_INTERNAL;
if (Reflect.apply(shouldMigrateToAdAnalyticsInterface, adAnalyticsInterfaceExperimentModule,
[STEP_2_CLICKED_INTERNAL, 'open_console_connection_settings'])) {
moduleValue3 = require(9517) /* metro dependency 9517: captureAdUserAction */;
captureAdUserAction = moduleValue3.captureAdUserAction;
object2 = {};
object2.type = (require(9518) /* metro dependency 9518: captureAdUserActionTypes */).AdUserActionType.CLICK_INTERNAL;
object2.adCreativeType = (require(7121) /* metro dependency 7121: AdCreativeType */).AdCreativeType.QUEST;
object2.adCreativeId = quest.id;
object2.questContentCTA = a1.ctaContent;
object2.surfaceId = a1.content;
object2.sourceQuestContent = a1.sourceQuestContent;
object2.impressionId = a1.impressionId;
object2.questContentPosition = a1.position;
Reflect.apply(captureAdUserAction, moduleValue3, [object2]);
} else {
(require(7110) /* metro dependency 7110: AnalyticsActions */).trackQuestContentClicked({questId: quest.id,
questContent: a1.content, questContentPosition: a1.position, questContentCTA: a1.ctaContent,
impressionId: a1.impressionId, sourceQuestContent: a1.sourceQuestContent});
}
const openUserSettings = (require(7007) /* metro dependency 7007: openUserSettings */).openUserSettings;
const CONNECTIONS = UserSettingsSections.CONNECTIONS;
openUserSettings({screen: CONNECTIONS});
}
function openAddConsoleConnectionModal({quest}, a1) { // fn#74280, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:6487, offset: 0x01d88911, size: 520 bytes, params: 3, frame: 19
var object2;
var moduleValue3;
var captureAdUserAction;
var value;
const adAnalyticsInterfaceExperimentModule = require(9519) /* metro dependency 9519: AdAnalyticsInterfaceExperiment */;
const shouldMigrateToAdAnalyticsInterface = adAnalyticsInterfaceExperimentModule.shouldMigrateToAdAnalyticsInterface;
const AdAnalyticsInterfaceExperimentStep = adAnalyticsInterfaceExperimentModule.AdAnalyticsInterfaceExperimentStep;
const STEP_2_CLICKED_INTERNAL = AdAnalyticsInterfaceExperimentStep.STEP_2_CLICKED_INTERNAL;
if (Reflect.apply(shouldMigrateToAdAnalyticsInterface, adAnalyticsInterfaceExperimentModule,
[STEP_2_CLICKED_INTERNAL, 'open_add_console_connection_modal'])) {
moduleValue3 = require(9517) /* metro dependency 9517: captureAdUserAction */;
captureAdUserAction = moduleValue3.captureAdUserAction;
object2 = {};
object2.type = (require(9518) /* metro dependency 9518: captureAdUserActionTypes */).AdUserActionType.CLICK_INTERNAL;
object2.adCreativeType = (require(7121) /* metro dependency 7121: AdCreativeType */).AdCreativeType.QUEST;
object2.adCreativeId = quest.id;
object2.questContentCTA = a1.ctaContent;
object2.surfaceId = a1.content;
object2.sourceQuestContent = a1.sourceQuestContent;
object2.impressionId = a1.impressionId;
object2.questContentPosition = a1.position;
object2.questContentRowIndex = a1.rowIndex;
Reflect.apply(captureAdUserAction, moduleValue3, [object2]);
} else {
(require(7110) /* metro dependency 7110: AnalyticsActions */).trackQuestContentClicked({questId: quest.id,
questContent: a1.content, questContentPosition: a1.position, questContentRowIndex: a1.rowIndex,
questContentCTA: a1.ctaContent, impressionId: a1.impressionId, sourceQuestContent: a1.sourceQuestContent});
}
const value2 = supportedConsoles(quest);
if (value2.length === 1) {
value = importDefault(9354) /* metro dependency 9354: authorizeConnectionNative */;
object2 = {};
object2.platformType = value2.at(0);
return value(object2);
}
value = importDefault(694) /* metro dependency 694: Dispatcher */;
const dispatch = value.dispatch;
object2 = {type: 'CONNECTIONS_GRID_MODAL_SHOW', onComplete: onComplete};
const Set = global.Set;
const value3 = Object.create(Set.prototype, {constructor: {value: Set}});
const set = new Set(value2);
object2.includedPlatformTypes = set instanceof Object ? set : value3;
object2.includeApplicationConnections = false;
Reflect.apply(dispatch, value, [object2]);
}
function openSingleConsoleConnectionModal({quest}, a1, a2) { // fn#74282, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:7519, offset: 0x01d88b43, size: 384 bytes, params: 4, frame: 19
var object2;
var moduleValue3;
var captureAdUserAction;
const adAnalyticsInterfaceExperimentModule = require(9519) /* metro dependency 9519: AdAnalyticsInterfaceExperiment */;
const shouldMigrateToAdAnalyticsInterface = adAnalyticsInterfaceExperimentModule.shouldMigrateToAdAnalyticsInterface;
const AdAnalyticsInterfaceExperimentStep = adAnalyticsInterfaceExperimentModule.AdAnalyticsInterfaceExperimentStep;
const STEP_2_CLICKED_INTERNAL = AdAnalyticsInterfaceExperimentStep.STEP_2_CLICKED_INTERNAL;
if (Reflect.apply(shouldMigrateToAdAnalyticsInterface, adAnalyticsInterfaceExperimentModule,
[STEP_2_CLICKED_INTERNAL, 'open_single_console_connection_modal'])) {
moduleValue3 = require(9517) /* metro dependency 9517: captureAdUserAction */;
captureAdUserAction = moduleValue3.captureAdUserAction;
object2 = {};
object2.type = (require(9518) /* metro dependency 9518: captureAdUserActionTypes */).AdUserActionType.CLICK_INTERNAL;
object2.adCreativeType = (require(7121) /* metro dependency 7121: AdCreativeType */).AdCreativeType.QUEST;
object2.adCreativeId = quest.id;
object2.questContentCTA = a1.ctaContent;
object2.surfaceId = a1.content;
object2.sourceQuestContent = a1.sourceQuestContent;
object2.impressionId = a1.impressionId;
object2.questContentPosition = a1.position;
object2.questContentRowIndex = a1.rowIndex;
Reflect.apply(captureAdUserAction, moduleValue3, [object2]);
} else {
(require(7110) /* metro dependency 7110: AnalyticsActions */).trackQuestContentClicked({questId: quest.id,
questContent: a1.content, questContentPosition: a1.position, questContentRowIndex: a1.rowIndex,
questContentCTA: a1.ctaContent, impressionId: a1.impressionId, sourceQuestContent: a1.sourceQuestContent});
}
return (importDefault(9354) /* metro dependency 9354: authorizeConnectionNative */)({platformType: a2});
}
function _fun74267(a0) { // fn#74267, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:1673, offset: 0x01d87ef5, size: 92 bytes, params: 2, frame: 16
clearAppStoreOverlayOpen();
const QUEST_APP_STORE_OVERLAY_CLOSED = AnalyticEvents.QUEST_APP_STORE_OVERLAY_CLOSED;
require(QUEST_APP_STORE_OVERLAY_CLOSED, env0_3, a0);
const ComponentDispatch = (require(1239) /* metro dependency 1239: ComponentDispatchUtils */).ComponentDispatch;
const dispatch = ComponentDispatch.dispatch;
const QUEST_APP_STORE_OVERLAY_FINISHED = ComponentActions.QUEST_APP_STORE_OVERLAY_FINISHED;
Reflect.apply(dispatch, ComponentDispatch, [QUEST_APP_STORE_OVERLAY_FINISHED]);
}
function _fun74268(a0) { // fn#74268, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:1802, offset: 0x01d87f51, size: 152 bytes, params: 2, frame: 15
var environment;
var value2;
var ComponentDispatch;
var value3;
if (a0) {
setAppStoreOverlayOpen({trackOverlayEvent: trackOverlayEvent});
value3 = environment.__proto__;
require(AnalyticEvents.QUEST_APP_STORE_OVERLAY_OPEN_SUCCEEDED, env0_3);
} else {
clearAppStoreOverlayOpen();
value2 = environment.__proto__;
require(AnalyticEvents.QUEST_APP_STORE_OVERLAY_OPEN_FAILED, env0_3);
ComponentDispatch = (require(1239) /* metro dependency 1239: ComponentDispatchUtils */).ComponentDispatch;
ComponentDispatch.dispatch(ComponentActions.QUEST_APP_STORE_OVERLAY_FINISHED);
}
}
function _fun74270() { // fn#74270, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:2026, offset: 0x01d88005, size: 88 bytes, params: 1, frame: 14
clearAppStoreOverlayOpen();
const QUEST_APP_STORE_OVERLAY_OPEN_FAILED = AnalyticEvents.QUEST_APP_STORE_OVERLAY_OPEN_FAILED;
require(QUEST_APP_STORE_OVERLAY_OPEN_FAILED, env0_3);
const ComponentDispatch = (require(1239) /* metro dependency 1239: ComponentDispatchUtils */).ComponentDispatch;
const dispatch = ComponentDispatch.dispatch;
const QUEST_APP_STORE_OVERLAY_FINISHED = ComponentActions.QUEST_APP_STORE_OVERLAY_FINISHED;
Reflect.apply(dispatch, ComponentDispatch, [QUEST_APP_STORE_OVERLAY_FINISHED]);
}
function _fun74276(a0, a1, a2) { // fn#74276, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:4826, offset: 0x01d885d7, size: 60 bytes, params: 4, frame: 19
let value = environment.__proto__;
value = require(7110) /* metro dependency 7110: AnalyticsActions */;
return value.trackAppStoreOverlayEvent(env0_0, require, a1, a0, a2);
}
function _fun74278(a0, a1, a2) { // fn#74278, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:5530, offset: 0x01d8874b, size: 79 bytes, params: 4, frame: 19
const value = environment.__proto__;
return (require(7110) /* metro dependency 7110: AnalyticsActions */).trackAdContentAppStoreOverlayEvent({adContentId: adContentId,
adCreativeType: adCreativeType}, require, a1, a0, a2);
}
function openAddConsoleConnectionModalOnComplete(a0) { // fn#74281, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:7386, owner: openAddConsoleConnectionModal.onComplete, offset: 0x01d88b19, size: 42 bytes, params: 2, frame: 12
const value = environment.__proto__;
return (importDefault(9354) /* metro dependency 9354: authorizeConnectionNative */)({platformType: a0});
}
function trackOverlayEvent(a0, a1) { // fn#74269, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9706:1830, offset: 0x01d87fe9, size: 28 bytes, params: 3, frame: 15
return require(a0, env1_3, a1);
}
@@ -0,0 +1,382 @@
/* Metro module 9500; source: modules/quests/utils/QuestRewardUtils.tsx; dependencies: [5121, 9501, 7098, 7091, 3381, 1244, 9502, 9503, 9504, 9505, 9506, 6531, 2] */
function _fun74129(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#74129, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:6, offset: 0x01d82096, size: 573 bytes, params: 8, frame: 27
const env0_0 = require;
const closure = function(a0) {
var value = a0.rewardsConfig.rewards.find(_fun74131);
var value2 = null;
return (value2 == value ? undefined : value.type) !== require(dependencyMap[2]).QuestRewardTypes.COLLECTIBLE ? value2 : value;
};
const closure2 = function(a0) {
return a0.rewardsConfig.rewards.some(_fun74133);
};
const closure3 = function(a0) {
return a0.rewardsConfig.rewards.some(_fun74135);
};
const closure4 = function(a0) {
var r2;
r2 = a0.rewardsConfig.rewards.find(_fun74137)?.premiumOrbQuantity;
return r2 != null && r2 > 0;
};
const closure5 = function(a0) {
return a0.rewardsConfig.rewards.find(_fun74139)?.orbQuantity;
};
const closure6 = isCollectibleQuestRewardPremiumExtendable;
const closure7 = getQuestOrbMultiplier;
const closure8 = getQuestOrbRewardQuantityForUser;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const collectiblesCategoryStore = importDefault(5121) /* metro dependency 5121: CollectiblesCategoryStore */;
const Set = global.Set;
const {PREMIUM_EXTENSION,
PREMIUM_PERMANENT} = (require(9501) /* metro dependency 9501: QuestRewardExpirationMode */).QuestRewardExpirationMode;
const set = new Set([PREMIUM_EXTENSION, PREMIUM_PERMANENT]);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/utils/QuestRewardUtils.tsx');
exports.getCollectiblesQuestReward = closure;
exports.getCollectibleQuestRewardExtendableExpirationDate = getCollectibleQuestRewardExtendableExpirationDate;
exports.getCollectibleQuestRewardDuration = getCollectibleQuestRewardDuration;
exports.hasFractionalPremiumQuestReward = closure2;
exports.hasVirtualCurrencyReward = closure3;
exports.hasPremiumOrbQuantity = closure4;
exports.hasCollectiblesQuestReward = hasCollectiblesQuestReward;
exports.hasInGameQuestReward = function(a0) {
return a0.rewardsConfig.rewards.some(_fun74150);
};
exports.hasQuestRewardCode = function(a0) {
return a0.rewardsConfig.rewards.some(_fun74152);
};
exports.getInGameQuestReward = function(a0) {
var value = a0.rewardsConfig.rewards.find(_fun74154);
var value2 = null;
return value2 != value ? value : value2;
};
exports.getCollectiblesQuestRewardItem = getCollectiblesQuestRewardItem;
exports.getVirtualCurrencyRewardOrbQuantity = closure5;
exports.getVirtualCurrencyRewardPremiumOrbQuantity = function(a0) {
var value = a0.rewardsConfig.rewards.find(_fun74157);
var value2 = undefined;
if ((value == null ? value2 : value.type) === require(dependencyMap[2]).QuestRewardTypes.VIRTUAL_CURRENCY) {
return value.premiumOrbQuantity;
}
return value2;
};
exports.isCollectibleQuestRewardPremiumExtendable = closure6;
exports.isCollectibleQuestRewardPermanentWithPremiumSubscription = isCollectibleQuestRewardPermanentWithPremiumSubscription;
exports.getQuestPrimaryReward = function(a0) {
var property = a0.userStatus;
var r2 = property?.claimedTier ?? 0;
value = 'rewardsConfig' in a0.config;
property = a0.config;
return value ? property.rewardsConfig.rewards[r2] : property.rewards[r2];
};
exports.getQuestOrbMultiplier = closure7;
exports.getQuestOrbMultiplierForUser = getQuestOrbMultiplierForUser;
exports.getQuestOrbRewardQuantityForUser = closure8;
exports.getDefaultRewardName = function(a0, a1) {
return _getDefaultRewardName(a0, a1, false);
};
exports.getDefaultRewardNameWithArticle = function(a0, a1) {
return _getDefaultRewardName(a0, a1, true);
};
exports.getRewardCodeQuestReward = function({quest, idx}) {
var value = null;
if (value == idx) {
return value;
}
quest = quest.config.rewardsConfig.rewards[idx];
return quest.type !== require(dependencyMap[2]).QuestRewardTypes.REWARD_CODE ? value : quest;
};
exports.isTieredRewardCodeQuest = isTieredRewardCodeQuest;
exports.getDefaultPlatform = function(a0) {
var property = a0.rewardsConfig.platforms;
return property.length > 0 ? property[0] : require(dependencyMap[11]).QuestRewardCodePlatforms.CROSS_PLATFORM;
};
exports.getPlatformString = getPlatformString;
}
function getCollectiblesQuestReward({rewardsConfig}) { // fn#74130, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:226, offset: 0x01d822d3, size: 99 bytes, params: 2, frame: 15
const value = rewardsConfig.rewards.find(function({type}) {
return type === require(dependencyMap[2]).QuestRewardTypes.COLLECTIBLE;
});
const type = value?.type;
const QuestRewardTypes = (require(7098) /* metro dependency 7098: QuestRewardTypes */).QuestRewardTypes;
const COLLECTIBLE = QuestRewardTypes.COLLECTIBLE;
return type !== COLLECTIBLE ? null : value;
}
function hasFractionalPremiumQuestReward({rewardsConfig}) { // fn#74132, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:430, offset: 0x01d82369, size: 37 bytes, params: 2, frame: 11
return rewardsConfig.rewards.some(function({type}) {
return type === require(dependencyMap[2]).QuestRewardTypes.FRACTIONAL_PREMIUM;
});
}
function hasVirtualCurrencyReward({rewardsConfig}) { // fn#74134, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:570, offset: 0x01d823c1, size: 37 bytes, params: 2, frame: 11
return rewardsConfig.rewards.some(function({type}) {
return type === require(dependencyMap[2]).QuestRewardTypes.VIRTUAL_CURRENCY;
});
}
function hasPremiumOrbQuantity({rewardsConfig}) { // fn#74136, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:701, offset: 0x01d82419, size: 67 bytes, params: 2, frame: 12
const premiumOrbQuantity = rewardsConfig.rewards.find(function({type}) {
return type === require(dependencyMap[2]).QuestRewardTypes.VIRTUAL_CURRENCY;
})?.premiumOrbQuantity;
return premiumOrbQuantity != null && premiumOrbQuantity > 0;
}
function getVirtualCurrencyRewardOrbQuantity({rewardsConfig}) { // fn#74138, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:886, offset: 0x01d8245c, size: 54 bytes, params: 2, frame: 11
return rewardsConfig.rewards.find(function({type}) {
return type === require(dependencyMap[2]).QuestRewardTypes.VIRTUAL_CURRENCY;
})?.orbQuantity;
}
function isCollectibleQuestRewardPremiumExtendable(a0) { // fn#74140, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:1063, offset: 0x01d82492, size: 55 bytes, params: 2, frame: 13
const getCollectiblesQuestRewardBinding = getCollectiblesQuestReward;
const value2 = undefined;
const collectiblesQuestRewardBinding = getCollectiblesQuestRewardBinding(a0);
const expirationMode = collectiblesQuestRewardBinding == null ? value2 : collectiblesQuestRewardBinding.expirationMode;
return expirationMode != null && env0_3.has(expirationMode);
}
function getQuestOrbMultiplier({rewardsConfig}) { // fn#74141, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:1214, offset: 0x01d824c9, size: 158 bytes, params: 2, frame: 15
const value = rewardsConfig.rewards.find(function({type}) {
return type === require(dependencyMap[2]).QuestRewardTypes.VIRTUAL_CURRENCY;
});
const type = value?.type;
const QuestRewardTypes = (require(7098) /* metro dependency 7098: QuestRewardTypes */).QuestRewardTypes;
const VIRTUAL_CURRENCY = QuestRewardTypes.VIRTUAL_CURRENCY;
if (type !== VIRTUAL_CURRENCY) {
return null;
}
const premiumOrbQuantity = value.premiumOrbQuantity;
const orbQuantity = value.orbQuantity;
return premiumOrbQuantity == null || orbQuantity === 0 ? null : global.Math.round(premiumOrbQuantity / orbQuantity * 100) / 100;
}
function getQuestOrbRewardQuantityForUser(a0, a1) { // fn#74143, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:1519, offset: 0x01d82567, size: 158 bytes, params: 3, frame: 16
var r2;
var moduleValue2;
const value = a0.rewardsConfig.rewards.find(function({type}) {
return type === require(dependencyMap[2]).QuestRewardTypes.VIRTUAL_CURRENCY;
});
if (value == null) {
return null;
}
if (a1 == null) {
return value.orbQuantity;
}
if (hasPremiumOrbQuantity(a0)) {
moduleValue2 = require(9503) /* metro dependency 9503: QuestOrbMultiplierUtils */;
r2 = moduleValue2.shouldReceiveQuestOrbMultiplier((require(9502) /* metro dependency 9502: QuestOrbMultiplierHooks */).getQuestOrbMultiplierEligibilityForUser(a1)) && value.premiumOrbQuantity != null ? value.premiumOrbQuantity : value.orbQuantity;
} else {
r2 = value.orbQuantity;
}
return r2;
}
function _getDefaultRewardName(a0, a1, a2) { // fn#74145, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:1899, offset: 0x01d82605, size: 231 bytes, params: 4, frame: 18
var r7;
var intl;
if (hasFractionalPremiumQuestReward(a0)) {
return (require(9504) /* metro dependency 9504: FractionalPremiumUtils */).getFractionalPremiumQuestRewardName(a0);
}
if (hasVirtualCurrencyReward(a0)) {
r7 = getQuestOrbRewardQuantityForUser(a0, a1) ?? getVirtualCurrencyRewardOrbQuantity(a0) ?? 0;
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
return intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t['nLXlh+'],
{orbAmount: r7});
}
const value = require(9505) /* metro dependency 9505: QuestCopyUtils */;
const getDefaultReward = value.getDefaultReward;
const messages = Reflect.apply(getDefaultReward, value, [a0]).messages;
return a2 ? messages.nameWithArticle : messages.name;
}
function getCollectibleQuestRewardExtendableExpirationDate(a0) { // fn#74146, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:2580, offset: 0x01d826ec, size: 95 bytes, params: 2, frame: 14
var r0;
var value;
const collectiblesQuestReward = getCollectiblesQuestReward(a0);
const value3 = null;
if (value3 != collectiblesQuestReward) {
if ('expiresAtPremium' in collectiblesQuestReward) {
if (value3 != collectiblesQuestReward.expiresAtPremium) {
value = require(7091) /* metro dependency 7091: QuestDataUtils */;
value = value.getQuestFormattedDate(collectiblesQuestReward.expiresAtPremium);
r0 = value;
} else {
r0 = value3;
}
} else {
r0 = value3;
}
} else {
r0 = value3;
}
return r0;
}
function getCollectibleQuestRewardDuration(a0) { // fn#74147, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:2836, offset: 0x01d8274b, size: 554 bytes, params: 2, frame: 22
var expiresAt;
var Date;
var prototype;
var value3;
var date;
var value4;
var value5;
var value6;
var value7;
var value8;
var value9;
var value11;
var value12;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
const collectiblesQuestReward = getCollectiblesQuestReward(a0);
if (collectiblesQuestReward != null) {
if ('expiresAt' in collectiblesQuestReward) {
expiresAt = collectiblesQuestReward.expiresAt;
if (expiresAt == null) {
return null;
}
Date = global.Date;
expiresAt = a0.expiresAt;
prototype = Date.prototype;
value3 = Object.create(prototype, {constructor: {value: Date}});
date = new Date();
value4 = date instanceof Object ? date : value3;
Date = global.Date;
expiresAt = collectiblesQuestReward.expiresAt;
prototype = Date.prototype;
value5 = Object.create(prototype, {constructor: {value: Date}});
date = new Date();
value6 = date instanceof Object ? date : value5;
value7 = (require(3381) /* metro dependency 3381 */).differenceInDays(value6, value4);
value8 = global.Math.floor(value7 / 30);
value9 = 0;
value11 = value8 + (value7 % 30 >= 25 ? 1 : value9);
if (value11 >= 12) {
return intl.formatToPlainString(t.PClsrw, {years: global.Math.floor(value11 / 12)});
}
if (value11 > value9) {
return intl.formatToPlainString(t.kridzK, {months: value11});
}
value12 = (require(3381) /* metro dependency 3381 */).differenceInDays(value6, value4);
if (value12 >= 7) {
return intl.formatToPlainString(t.EmoBD2, {weeks: global.Math.ceil(value12 / 7)});
}
return intl.formatToPlainString(t['k2UNz+'], {days: value12});
}
}
return null;
}
function hasCollectiblesQuestReward(a0) { // fn#74148, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:3683, offset: 0x01d82975, size: 25 bytes, params: 2, frame: 11
return getCollectiblesQuestReward(a0) != null;
}
function hasInGameQuestReward({rewardsConfig}) { // fn#74149, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:3789, offset: 0x01d8298e, size: 37 bytes, params: 2, frame: 11
return rewardsConfig.rewards.some(function({type}) {
return type === require(dependencyMap[2]).QuestRewardTypes.IN_GAME;
});
}
function hasQuestRewardCode({rewardsConfig}) { // fn#74151, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:3929, offset: 0x01d829e6, size: 37 bytes, params: 2, frame: 11
return rewardsConfig.rewards.some(function({type}) {
return type === require(dependencyMap[2]).QuestRewardTypes.REWARD_CODE;
});
}
function getInGameQuestReward({rewardsConfig}) { // fn#74153, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:4073, offset: 0x01d82a3e, size: 49 bytes, params: 2, frame: 11
return rewardsConfig.rewards.find(function({type}) {
return type === require(dependencyMap[2]).QuestRewardTypes.IN_GAME;
}) ?? null;
}
function getCollectiblesQuestRewardItem(a0) { // fn#74155, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:4248, offset: 0x01d82a6f, size: 92 bytes, params: 2, frame: 14
const getCollectiblesQuestRewardBinding = getCollectiblesQuestReward;
const value2 = undefined;
const collectiblesQuestRewardBinding = getCollectiblesQuestRewardBinding(a0);
const value4 = null;
const product = CollectiblesCategoryStore.getProduct(value4 == collectiblesQuestRewardBinding ? value2 : collectiblesQuestRewardBinding.skuId);
const r1 = value4 == product || value4 == product.items ? value2 : product.items[0];
return value4 != r1 ? r1 : value4;
}
function getVirtualCurrencyRewardPremiumOrbQuantity({rewardsConfig}) { // fn#74156, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:4559, offset: 0x01d82acb, size: 102 bytes, params: 2, frame: 14
const value = rewardsConfig.rewards.find(function({type}) {
return type === require(dependencyMap[2]).QuestRewardTypes.VIRTUAL_CURRENCY;
});
const type = value?.type;
const QuestRewardTypes = (require(7098) /* metro dependency 7098: QuestRewardTypes */).QuestRewardTypes;
const VIRTUAL_CURRENCY = QuestRewardTypes.VIRTUAL_CURRENCY;
if (type === VIRTUAL_CURRENCY) {
return value.premiumOrbQuantity;
}
}
function isCollectibleQuestRewardPermanentWithPremiumSubscription(a0) { // fn#74158, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:4953, offset: 0x01d82b31, size: 84 bytes, params: 2, frame: 14
var r0;
var collectiblesQuestReward;
const isCollectibleQuestRewardPremiumExtendableBinding = isCollectibleQuestRewardPremiumExtendable;
const value2 = undefined;
const isCollectibleQuestRewardPremiumExtendable2 = isCollectibleQuestRewardPremiumExtendableBinding(a0);
if (isCollectibleQuestRewardPremiumExtendable2) {
collectiblesQuestReward = getCollectiblesQuestReward(a0);
r0 = (collectiblesQuestReward == null ? value2 : collectiblesQuestReward.expirationMode) === (require(9501) /* metro dependency 9501: QuestRewardExpirationMode */).QuestRewardExpirationMode.PREMIUM_PERMANENT;
} else {
r0 = isCollectibleQuestRewardPremiumExtendable2;
}
return r0;
}
function getQuestOrbMultiplierForUser(a0, a1) { // fn#74160, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:5494, offset: 0x01d82be0, size: 132 bytes, params: 3, frame: 17
var r0;
if (a1 == null) {
return 1;
}
var value;
const questOrbMultiplier = getQuestOrbMultiplier(a0);
const value3 = 1;
if (hasPremiumOrbQuantity(a0)) {
value = require(9503) /* metro dependency 9503: QuestOrbMultiplierUtils */;
r0 = value.shouldReceiveQuestOrbMultiplier((require(9502) /* metro dependency 9502: QuestOrbMultiplierHooks */).getQuestOrbMultiplierEligibilityForUser(a1)) ? questOrbMultiplier ?? value3 : value3;
} else {
r0 = value3;
}
return r0;
}
function isTieredRewardCodeQuest({quest}) { // fn#74164, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:6255, offset: 0x01d82cfa, size: 119 bytes, params: 2, frame: 13
const rewardsConfig = quest.config.rewardsConfig;
const assignmentMethod = rewardsConfig.assignmentMethod;
const QuestRewardAssignmentMethods = (require(9506) /* metro dependency 9506: QuestRewardAssignmentMethods */).QuestRewardAssignmentMethods;
const TIERED = QuestRewardAssignmentMethods.TIERED;
return assignmentMethod === TIERED && rewardsConfig.rewards.length > 0 && rewardsConfig.rewards.every(function({type}) {
return type === require(dependencyMap[2]).QuestRewardTypes.REWARD_CODE;
});
}
function getPlatformString(a0) { // fn#74167, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:6673, offset: 0x01d82db8, size: 482 bytes, params: 2, frame: 15
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
const QuestRewardCodePlatforms = (require(6531) /* metro dependency 6531: QuestTypes */).QuestRewardCodePlatforms;
const XBOX = QuestRewardCodePlatforms.XBOX;
if (XBOX === a0) {
return intl.string(t.G84UWZ);
}
const PLAYSTATION = QuestRewardCodePlatforms.PLAYSTATION;
if (PLAYSTATION === a0) {
return intl.string(t['6IeKx2']);
}
const SWITCH = QuestRewardCodePlatforms.SWITCH;
if (SWITCH === a0) {
return intl.string(t['1pp0su']);
}
const PC = QuestRewardCodePlatforms.PC;
if (PC === a0) {
return intl.string(t['YK+wUg']);
}
const CROSS_PLATFORM = QuestRewardCodePlatforms.CROSS_PLATFORM;
if (CROSS_PLATFORM === a0) {
return intl.string(t.UWVbzV);
}
}
@@ -0,0 +1,229 @@
/* Metro module 7100; source: modules/quests/utils/QuestServerUtils.tsx; dependencies: [57, 4242, 7101, 7098, 2] */
function _fun56749(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#56749, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7278:6, offset: 0x013d03df, size: 246 bytes, params: 8, frame: 21
const env0_0 = require;
const closure = questConfigFromServer;
const closure2 = questUserStatusFromServer;
const closure3 = function(a0) {
var tier = a0.tier;
var value = null;
return {userId: a0.user_id, questId: a0.quest_id, code: a0.code, platform: a0.platform,
claimedAt: a0.claimed_at,
tier: value != tier ? tier : value};
};
const _questsEntitlementFromServer = function(a0) {
var object = {skuId: a0.sku_id};
object.tenantMetadata = _questsTenantMetadataFromServer(a0.tenant_metadata);
object.consumed = a0.consumed;
return object;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(57) /* metro dependency 57 */;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/utils/QuestServerUtils.tsx');
exports.isQuestWithKnownConfigVersion = isQuestWithKnownConfigVersion;
exports.questConfigFromServer = closure;
exports.questUserStatusFromServer = closure2;
exports.questWithUserStatusFromServer = questWithUserStatusFromServer;
exports.excludedQuestFromServer = function(a0) {
return {id: a0.id, replacementId: a0.replacement_id};
};
exports.getClaimedQuestWithUserStatusFromServer = getClaimedQuestWithUserStatusFromServer;
exports.questsRewardCodeFromServer = closure3;
exports.questsEntitlementsFromServer = function(a0) {
var object = {claimedAt: a0.claimed_at};
object.items = a0.entitlements.map(_questsEntitlementFromServer);
object.errors = a0.errors;
return object;
};
}
function questConfigFromServer(a0) { // fn#56750, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7278:108, offset: 0x013d04d5, size: 80 bytes, params: 2, frame: 13
let value = require(4242) /* metro dependency 4242 */;
value = value.match(a0);
value = value.with({config_version: 2}, _fun56751);
return value.exhaustive();
}
function progressFromServer(a0) { // fn#56752, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7278:238, offset: 0x013d054e, size: 189 bytes, params: 2, frame: 24
var r2;
var r11;
var property;
var value5;
var property2;
var event_name;
var value6;
var updated_at;
var completed_at;
var heartbeat;
var last_beat_at;
var expires_at;
var value7;
const object2 = {};
const Object = global.Object;
const value = Object.entries(a0);
let length = value.length;
const value2 = 0;
const value4 = null;
if (value2 < length) {
r2 = value2;
while (true) {
property = value[r2];
value5 = env0_2(property, 2);
property = value5[value2];
property2 = value5[1];
event_name = property2.event_name;
value6 = property2.value;
updated_at = property2.updated_at;
completed_at = property2.completed_at;
heartbeat = property2.heartbeat;
if (value4 == heartbeat) {
r11 = value4;
} else {
last_beat_at = heartbeat.last_beat_at;
expires_at = heartbeat.expires_at;
r11 = {lastBeatAt: last_beat_at, expiresAt: expires_at};
}
object2[property] = {eventName: event_name, value: value6, updatedAt: updated_at, completedAt: completed_at,
heartbeat: r11};
value7 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
length = value.length;
if (value7 < length) {
r2 = value7;
continue;
}
break;
}
}
return object2;
}
function questUserStatusFromServer({user_id, quest_id, enrolled_at, completed_at, claimed_at, claimed_tier, orb_quantity_claimed, last_stream_heartbeat_at, stream_progress_seconds, dismissed_quest_content, progress}) { // fn#56753, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7278:551, offset: 0x013d060b, size: 179 bytes, params: 2, frame: 14
const object2 = {};
object2.userId = user_id;
object2.questId = quest_id;
object2.enrolledAt = enrolled_at;
object2.completedAt = completed_at;
object2.claimedAt = claimed_at;
object2.claimedTier = claimed_tier ?? null;
object2.orbQuantityClaimed = orb_quantity_claimed ?? null;
object2.lastStreamHeartbeatAt = last_stream_heartbeat_at;
object2.streamProgressSeconds = stream_progress_seconds;
object2.dismissedQuestContent = dismissed_quest_content;
object2.progress = progressFromServer(progress);
return object2;
}
function getSimpleRewardFromServer(a0) { // fn#56754, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7278:1004, offset: 0x013d06be, size: 193 bytes, params: 2, frame: 13
const type = a0.type;
const QuestRewardTypes = (require(7098) /* metro dependency 7098: QuestRewardTypes */).QuestRewardTypes;
const VIRTUAL_CURRENCY = QuestRewardTypes.VIRTUAL_CURRENCY;
return type === VIRTUAL_CURRENCY ? {skuId: a0.sku_id, type: a0.type, name: a0.name,
nameWithArticle: a0.name_with_article, collectibleProduct: a0.collectible_product,
orbQuantity: a0.orb_quantity} : {skuId: a0.sku_id, type: a0.type, name: a0.name,
nameWithArticle: a0.name_with_article, asset: a0.asset, assetVideo: a0.asset_video,
collectibleProduct: a0.collectible_product};
}
function getClaimedQuestFromServer(a0) { // fn#56755, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7278:1402, offset: 0x013d077f, size: 394 bytes, params: 2, frame: 14
const object2 = {};
object2.id = a0.id;
object2.startsAt = a0.starts_at;
object2.expiresAt = a0.expires_at;
object2.features = a0.features;
object2.messages = {questName: a0.messages.quest_name, gamePublisher: a0.messages.game_publisher,
gameTitle: a0.messages.game_title};
object2.assets = {hero: a0.assets.hero, heroVideo: a0.assets.hero_video, questBarHero: a0.assets.quest_bar_hero,
questBarHeroVideo: a0.assets.quest_bar_hero_video, gameTile: a0.assets.game_tile, logotype: a0.assets.logotype,
logotypeLight: a0.assets.logotype_light, logotypeDark: a0.assets.logotype_dark,
gameTileLight: a0.assets.game_tile_light, gameTileDark: a0.assets.game_tile_dark};
object2.colors = {primary: a0.colors.primary, secondary: a0.colors.secondary};
const rewards = a0.rewards;
object2.rewards = rewards.map(getSimpleRewardFromServer);
const value = require(7101) /* metro dependency 7101: Quest */;
object2.cosponsorMetadata = value.questCosponsorMetadataFromServer(a0.cosponsor_metadata);
return object2;
}
function _questsTenantMetadataFromServer(a0) { // fn#56757, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7278:2349, offset: 0x013d095b, size: 216 bytes, params: 2, frame: 16
var object;
var questsRewardCodeFromServerBinding;
const value = undefined;
let quest_rewards = a0 == null ? value : a0.quest_rewards;
if (quest_rewards == null) {
return null;
}
quest_rewards = a0.quest_rewards;
let reward = quest_rewards.reward;
const tag = reward.tag;
const QuestRewardTypes = (require(7098) /* metro dependency 7098: QuestRewardTypes */).QuestRewardTypes;
const IN_GAME = QuestRewardTypes.IN_GAME;
if (IN_GAME === tag) {
return {questRewards: {reward: {tag: quest_rewards.reward.tag}}};
}
const REWARD_CODE = QuestRewardTypes.REWARD_CODE;
if (REWARD_CODE === tag) {
object = {};
reward = quest_rewards.reward;
object.tag = reward.tag;
questsRewardCodeFromServerBinding = questsRewardCodeFromServer;
reward = quest_rewards.reward;
object.rewardCode = questsRewardCodeFromServerBinding(reward.reward_code);
return {questRewards: {reward: object}};
}
return value;
}
function isQuestWithKnownConfigVersion(a0) { // fn#56759, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7278:2987, offset: 0x013d0a68, size: 92 bytes, params: 2, frame: 13
var environment;
var value;
var property;
var match;
var config;
var closure;
var error;
try {
value = environment;
property = dependencyMap[1];
value = require(property);
match = value.match;
config = a0.config;
value = Reflect.apply(match, value, [config]);
closure = function() {
return true;
};
value = value.with({config_version: 2}, closure);
value = value.exhaustive();
} catch (error) {
return false;
}
return value;
}
function questWithUserStatusFromServer(a0) { // fn#56761, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7278:3266, offset: 0x013d0ac4, size: 111 bytes, params: 2, frame: 14
const object2 = {};
object2.id = a0.id;
object2.preview = a0.preview;
object2.config = questConfigFromServer(a0.config);
const user_status = a0.user_status;
const value2 = null;
object2.userStatus = value2 == user_status ? value2 : questUserStatusFromServer(a0.user_status);
object2.targetedContent = a0.targeted_content;
object2.trafficMetadataSealed = a0.traffic_metadata_sealed;
return object2;
}
function getClaimedQuestWithUserStatusFromServer(a0) { // fn#56763, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7278:3696, offset: 0x013d0b50, size: 76 bytes, params: 2, frame: 14
const object2 = {};
object2.id = a0.id;
object2.config = getClaimedQuestFromServer(a0.config);
const user_status = a0.user_status;
const value2 = null;
object2.userStatus = value2 == user_status ? value2 : questUserStatusFromServer(a0.user_status);
return object2;
}
function _fun56751(a0) { // fn#56751, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7278:191, offset: 0x013d0525, size: 41 bytes, params: 2, frame: 11
const value = environment.__proto__;
return (require(7101) /* metro dependency 7101: Quest */).questFromServerV2(a0);
}
@@ -0,0 +1,830 @@
/* Metro module 7116; source: modules/quests/utils/QuestTaskUtils.tsx; dependencies: [7093, 6535, 22, 672, 7091, 1360, 2] */
function _fun56879(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#56879, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:6, offset: 0x013d45e3, size: 987 bytes, params: 8, frame: 34
let env0_0 = require;
const _arrayLikeToArray_56882 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const closure = function(a0) {
var property = a0.quest.config.taskConfigV2.tasks;
property = property[require(dependencyMap[1]).FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP];
return property != null;
};
const closure2 = function(a0) {
var property = a0.config.taskConfigV2.tasks;
property = property[require(dependencyMap[1]).FirstPartyQuestTaskTypes.PLAY_ACTIVITY];
return property != null;
};
const closure3 = shouldUsePlayOnDesktopTask;
const closure4 = isInGameQuest;
const closure5 = function(a0) {
return a0.userStatus != null && (hasUnsavedProgress(a0.userStatus,
require(dependencyMap[1]).FirstPartyQuestTaskTypes.PLAY_ON_XBOX) || hasUnsavedProgress(a0.userStatus,
require(dependencyMap[1]).FirstPartyQuestTaskTypes.PLAY_ON_PLAYSTATION));
};
const _isPlayOnDesktopTaskType = function(a0) {
return a0?.type === require(dependencyMap[1]).FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP;
};
const closure6 = getDefaultWatchVideoTask;
const closure7 = getDefaultInGameTask;
const closure8 = function(a0) {
return parseMinutesAndSecondsFromSeconds(a0.targetSeconds - a0.progressSeconds);
};
const closure9 = function(a0) {
var object = {};
var Math = global.Math;
var Math2 = global.Math;
object.minutes = Math.max(0, Math2.floor(a0 / 60));
Math = global.Math;
var Math3 = global.Math;
object.seconds = Math.max(0, Math3.floor(a0 % 60));
return object;
};
const closure10 = function(a0, a1) {
var value = (0, global.String)(a0);
value = value.padStart(2, '0');
return '' + value + ':' + (0, global.String)(a1).padStart(2, '0');
};
let Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const questStore = importDefault(7093) /* metro dependency 7093: QuestStore */;
const closure11 = function(a0) {
var env0_0 = a0;
return _fun56897;
};
const FirstPartyQuestTaskTypes = (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypes;
let PLAY_ON_XBOX = FirstPartyQuestTaskTypes.PLAY_ON_XBOX;
let PLAY_ON_PLAYSTATION = FirstPartyQuestTaskTypes.PLAY_ON_PLAYSTATION;
let value = closure11([PLAY_ON_XBOX, PLAY_ON_PLAYSTATION]);
let WATCH_VIDEO = FirstPartyQuestTaskTypes.WATCH_VIDEO;
let value2 = closure11([WATCH_VIDEO]);
let WATCH_VIDEO_ON_MOBILE = FirstPartyQuestTaskTypes.WATCH_VIDEO_ON_MOBILE;
let value3 = closure11([WATCH_VIDEO_ON_MOBILE]);
WATCH_VIDEO = FirstPartyQuestTaskTypes.WATCH_VIDEO;
WATCH_VIDEO_ON_MOBILE = FirstPartyQuestTaskTypes.WATCH_VIDEO_ON_MOBILE;
let value4 = closure11([WATCH_VIDEO, WATCH_VIDEO_ON_MOBILE]);
let PLAY_ON_DESKTOP = FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP;
const STREAM_ON_DESKTOP = FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP;
PLAY_ON_PLAYSTATION = FirstPartyQuestTaskTypes.PLAY_ON_PLAYSTATION;
PLAY_ON_XBOX = FirstPartyQuestTaskTypes.PLAY_ON_XBOX;
const ACHIEVEMENT_IN_GAME = FirstPartyQuestTaskTypes.ACHIEVEMENT_IN_GAME;
let value5 = closure11([PLAY_ON_DESKTOP, STREAM_ON_DESKTOP, PLAY_ON_PLAYSTATION, PLAY_ON_XBOX, ACHIEVEMENT_IN_GAME]);
const ACHIEVEMENT_IN_ACTIVITY = FirstPartyQuestTaskTypes.ACHIEVEMENT_IN_ACTIVITY;
const PLAY_ACTIVITY = FirstPartyQuestTaskTypes.PLAY_ACTIVITY;
const value6 = closure11([ACHIEVEMENT_IN_ACTIVITY, PLAY_ACTIVITY]);
const _parseFirstPartyTaskType = function(a0) {
var value = a0;
var ALL = require(dependencyMap[1]).FirstPartyQuestTaskTypesSets.ALL;
return ALL.has(value) ? value : null;
};
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/utils/QuestTaskUtils.tsx');
exports.getAllApplicationIds = getAllApplicationIds;
exports.getDesktopApplicationIds = function(a0) {
var getApplicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypes;
var PLAY_ON_DESKTOP = require(dependencyMap[1]).FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP;
return getApplicationIdsByTaskTypesBinding(a0, [PLAY_ON_DESKTOP]);
};
exports.getConsoleApplicationId = getConsoleApplicationId;
exports.getPlayActivityApplicationId = getPlayActivityApplicationId;
exports.getInGameApplicationId = getInGameApplicationId;
exports.getActivityApplicationId = getActivityApplicationId;
exports.getStreamingApplicationId = getStreamingApplicationId;
exports.hasPlayOnDesktopTask = closure;
exports.hasStreamOnDesktopTask = function(a0) {
var property = a0.quest.config.taskConfigV2.tasks;
property = property[require(dependencyMap[1]).FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP];
return property != null;
};
exports.hasAchievementActivityTask = function(a0) {
var property = a0.config.taskConfigV2.tasks;
property = property[require(dependencyMap[1]).FirstPartyQuestTaskTypes.ACHIEVEMENT_IN_ACTIVITY];
return property != null;
};
exports.hasAchievementInGameTask = function(a0) {
var property = a0.config.taskConfigV2.tasks;
property = property[require(dependencyMap[1]).FirstPartyQuestTaskTypes.ACHIEVEMENT_IN_GAME];
return property != null;
};
exports.hasPlayActivityTask = closure2;
exports.shouldUsePlayOnDesktopTask = closure3;
exports.hasSomeFirstPartyTasks = closure11;
exports.isInGameQuest = closure4;
exports.hasSomeConsoleTasks = value;
exports.hasWatchVideoOnDesktopTasks = value2;
exports.hasWatchVideoOnMobileTasks = value3;
exports.hasWatchVideoTasks = value4;
exports.hasStandaloneGameplayTasks = value5;
exports.hasActivityTasks = value6;
exports.isVideoQuestForMobilePlatformOnly = isVideoQuestForMobilePlatformOnly;
exports.isConsoleQuest = isConsoleQuest;
exports.isQuestProgressingOnConsole = closure5;
exports.getQuestTaskTypes = function(a0) {
var Set = global.Set;
var Object = global.Object;
var value = Object.keys(a0.config.taskConfigV2.tasks);
var value2 = Object.create(Set.prototype, {constructor: {value: Set}});
value = new Set(value);
return value instanceof Object ? value : value2;
};
exports.getDefaultWatchVideoTask = closure6;
exports.getQuestTaskDetails = function(a0, a1) {
var r1;
var value2 = _getQuestTaskDetails(a0, a1);
if (value2 != null) {
return value2;
}
var _getTaskDetailsForTypeBinding = _getTaskDetailsForType;
var object = {quest: a0};
var value3 = _getTaskDetailsForTypeBinding(object);
if (value3 != null) {
r1 = value3;
} else {
object = {'progressSeconds': 0, 'targetSeconds': 1, 'targetMinutes': 1, 'percentComplete': 0};
object.taskType = require(dependencyMap[1]).FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP;
r1 = object;
}
return r1;
};
exports.getDefaultInGameTask = closure7;
exports.getThirdPartyTaskDetails = getThirdPartyTaskDetails;
exports.getRemainingTaskTime = closure8;
exports.parseMinutesAndSecondsFromSeconds = closure9;
exports.formatWatchTaskRemainingTime = function(a0) {
var value2 = getRemainingTaskTime(a0);
return formatWatchTaskTime(value2.minutes, value2.seconds);
};
exports.formatWatchTaskTime = closure10;
}
function _createForOfIteratorHelperLoose_56880(a0, a1) { // fn#56880, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:110, offset: 0x013d49be, size: 370 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun56881;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_56882(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_56882(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_56882(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun56881;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
}
function getApplicationIdsByTaskTypes(a0, a1) { // fn#56883, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:1020, offset: 0x013d4b30, size: 303 bytes, params: 3, frame: 25
var r6;
var r14;
var r0;
var set;
var _createForOfIteratorHelperLoose_56880Binding;
var value3;
var value4;
var value5;
var done;
var value6;
var config;
var taskConfigV2;
var tasks;
var property;
var Array;
var isArray;
var applications;
var value7;
var value8;
var value9;
var add;
var id;
var value10;
var value11;
var from;
if (a0 != null) {
set = new global.Set();
_createForOfIteratorHelperLoose_56880Binding = _createForOfIteratorHelperLoose_56880;
value3 = undefined;
value4 = _createForOfIteratorHelperLoose_56880Binding(a1);
value5 = value4();
done = value5.done;
if (!done) {
r6 = value5;
reducibleLoop3: while (true) {
value6 = r6.value;
config = a0.config;
taskConfigV2 = config.taskConfigV2;
tasks = taskConfigV2.tasks;
property = tasks[value6];
reducibleJoin8: while (true) {
if (property == null) {
break reducibleJoin8;
}
if (!('applications' in property)) {
break reducibleJoin8;
}
Array = global.Array;
isArray = Array.isArray;
applications = property.applications;
if (!Reflect.apply(isArray, Array, [applications])) {
break reducibleJoin8;
}
_createForOfIteratorHelperLoose_56880Binding = _createForOfIteratorHelperLoose_56880;
applications = property.applications;
value7 = _createForOfIteratorHelperLoose_56880Binding(applications);
value8 = value7();
done = value8.done;
if (done) {
break reducibleJoin8;
}
r14 = value8;
reducibleLoop7: while (true) {
value9 = r14.value;
add = set.add;
id = value9.id;
Reflect.apply(add, set, [id]);
value10 = value7();
done = value10.done;
if (done) {
break reducibleJoin8;
}
r14 = value10;
continue reducibleLoop7;
}
}
value11 = value4();
done = value11.done;
if (done) {
break reducibleLoop3;
}
r6 = value11;
continue reducibleLoop3;
}
}
reducibleJoin11: while (true) {
if (set.size > 0) {
Array = global.Array;
from = Array.from;
set = Reflect.apply(from, Array, [set]);
r0 = set;
break reducibleJoin11;
}
r0 = value3;
break reducibleJoin11;
}
return r0;
}
}
function shouldUsePlayOnDesktopTask(a0) { // fn#56886, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:1710, offset: 0x013d4cf1, size: 35 bytes, params: 2, frame: 12
return a0 != null && hasPlayOnDesktopTask({quest: a0});
}
function isInGameQuest(a0) { // fn#56887, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:1880, offset: 0x013d4d14, size: 82 bytes, params: 2, frame: 14
const env0_0 = a0;
const Array = global.Array;
const from = Array.from;
const FirstPartyQuestTaskTypesSets = (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypesSets;
const IN_GAME = FirstPartyQuestTaskTypesSets.IN_GAME;
return Reflect.apply(from, Array, [IN_GAME]).some(_fun56888);
}
function getDefaultWatchVideoTask(a0) { // fn#56891, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:5269, offset: 0x013d4e48, size: 130 bytes, params: 2, frame: 15
let tasks = a0.taskConfigV2.tasks;
const FirstPartyQuestTaskTypes = (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypes;
const WATCH_VIDEO = FirstPartyQuestTaskTypes.WATCH_VIDEO;
const property = tasks[WATCH_VIDEO];
tasks = a0.taskConfigV2.tasks;
const WATCH_VIDEO_ON_MOBILE = FirstPartyQuestTaskTypes.WATCH_VIDEO_ON_MOBILE;
const property2 = tasks[WATCH_VIDEO_ON_MOBILE];
const value = null;
return value == property ? value != (value == property2 ? property : property2) ? value == property2 ? property : property2 : value : value != property2 ? property2 : value != (value == property2 ? property : property2) ? value == property2 ? property : property2 : value;
}
function getDefaultInGameTask({taskConfigV2}) { // fn#56892, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:7177, offset: 0x013d4eca, size: 104 bytes, params: 2, frame: 14
const tasks = taskConfigV2.tasks;
const FirstPartyQuestTaskTypes = (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypes;
const ACHIEVEMENT_IN_ACTIVITY = FirstPartyQuestTaskTypes.ACHIEVEMENT_IN_ACTIVITY;
const property = tasks[ACHIEVEMENT_IN_ACTIVITY];
const ACHIEVEMENT_IN_GAME = FirstPartyQuestTaskTypes.ACHIEVEMENT_IN_GAME;
return property ?? tasks[ACHIEVEMENT_IN_GAME] ?? null;
}
function hasSomeFirstPartyTasks(a0) { // fn#56896, offset: 0x013d5016, size: 16 bytes, params: 2, frame: 2
const env0_0 = a0;
return function(a0) {
return a0.some(_fun56898);
};
}
function hasUnsavedProgress(a0, a1) { // fn#56899, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:2882, offset: 0x013d5048, size: 145 bytes, params: 3, frame: 13
const expiresAt = a0 == null || a0.progress[a1] == null || a0.progress[a1].heartbeat == null ? undefined : a0.progress[a1].heartbeat.expiresAt;
if (expiresAt == null) {
return false;
}
const Date = global.Date;
const value2 = Object.create(Date.prototype, {constructor: {value: Date}});
const date = new Date(expiresAt);
const value4 = (date instanceof Object ? date : value2).valueOf();
return !global.isNaN(value4) && value4 > global.Date.now();
}
function _computePercentComplete(a0, a1) { // fn#56900, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:3436, offset: 0x013d50d9, size: 83 bytes, params: 3, frame: 16
var r0;
let value = 0;
if (a0 > value) {
value = require(22) /* metro dependency 22 */;
value = value.floor(global.Math.min(a1 / a0, 1), 4);
r0 = value;
} else {
r0 = value;
}
return r0;
}
function getTimeSinceLastBeatSeconds(a0, a1) { // fn#56901, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:3511, offset: 0x013d512c, size: 256 bytes, params: 3, frame: 17
var Date;
var value3;
var date;
var value6;
var moduleValue;
const userStatus = a0.userStatus;
const lastBeatAt = userStatus == null || userStatus.progress == null || (userStatus.progress[a1.type] == null || userStatus.progress[a1.type].heartbeat == null) ? undefined : userStatus.progress[a1.type].heartbeat.lastBeatAt;
if (lastBeatAt != null) {
if (isQuestProgressingOnConsole(a0) || QuestStore.isProgressingOnDesktop(a0.id)) {
Date = global.Date;
value3 = Date.now();
Date = global.Date;
date = new Date(lastBeatAt);
value6 = value3 - date.valueOf();
moduleValue = require(22) /* metro dependency 22 */;
return moduleValue.floor(value6 / (importDefault(672) /* metro dependency 672: Durations */).Millis.SECOND, 2);
}
}
return 0;
}
function getProgressSeconds(a0, a1) { // fn#56902, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:3837, offset: 0x013d522c, size: 296 bytes, params: 3, frame: 20
const target = a1.target;
let userStatus = a0.userStatus;
let value = undefined;
if ((userStatus == null ? value : userStatus.completedAt) != null) {
return target;
}
userStatus = a0.userStatus;
let r3 = userStatus == null || userStatus.progress == null ? value : userStatus.progress[a1.type];
let r1 = r3 == null ? value : r3.value;
r1 = r1 ?? (a0.userStatus == null ? value : a0.userStatus.streamProgressSeconds);
const value3 = 0;
r3 = r1 ?? value3;
const r7 = env0_7(a0) ? QuestStore.getOptimisticProgress(a0.id,
a1.type) == null || QuestStore.getOptimisticProgress(a0.id,
a1.type) < r3 ? r3 : QuestStore.getOptimisticProgress(a0.id, a1.type) : r3 + getTimeSinceLastBeatSeconds(a0, a1);
let Math = global.Math;
const value7 = Math.min(0.99 * target, r7);
Math = global.Math;
const max = Math.max;
value = require(22) /* metro dependency 22 */;
return Reflect.apply(max, Math, [value.floor(value7, 2), value3]);
}
function _getTaskDetailsForType({quest, taskType, includeTaskTypes}) { // fn#56903, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:4330, offset: 0x013d5354, size: 580 bytes, params: 2, frame: 25
var r4;
var Object;
var property;
var captureQuestsException;
var Error;
var id;
var value12;
var error;
var Array;
var from;
let value = undefined;
let r8 = includeTaskTypes !== value ? includeTaskTypes : (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypesSets.ALL;
const taskConfigV2 = quest.config.taskConfigV2;
if (taskType != null) {
r4 = taskType;
} else {
Object = global.Object;
property = Object.values(taskConfigV2.tasks).filter(_fun56904)[0];
r4 = property == null ? value : property.type;
}
const r11 = taskConfigV2.tasks[r4] ?? taskConfigV2.tasks[(require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP];
if (r11 == null) {
value = require(7091) /* metro dependency 7091: QuestDataUtils */;
captureQuestsException = value.captureQuestsException;
Error = global.Error;
id = quest.id;
value12 = 'Quest ' + id + ' has no task matching the include filters';
error = new Error();
id = quest.id;
Array = global.Array;
from = Array.from;
r8 = r8 ?? [];
Reflect.apply(captureQuestsException, value, [error, {tags: {source: '_getTaskDetailsForType'},
extra: {questId: id,
taskType: taskType, includeTaskTypes: Reflect.apply(from, Array, [r8])}}]);
return null;
}
const target = r11.target;
const progressSeconds = getProgressSeconds(quest, r11);
Object = global.Object;
const value8 = Object.values(taskConfigV2.tasks);
const value9 = value8.find(_isPlayOnDesktopTaskType);
const r2 = value9 == null || value9.applications == null ? value : value9.applications.map(function(a0) {
return a0.id;
});
const object2 = {progressSeconds: progressSeconds, targetSeconds: target};
const Math = global.Math;
const ceil = Math.ceil;
const Seconds = (importDefault(672) /* metro dependency 672: Durations */).Seconds;
const MINUTE = Seconds.MINUTE;
object2.targetMinutes = Reflect.apply(ceil, Math, [target / MINUTE]);
object2.percentComplete = _computePercentComplete(target, progressSeconds);
object2.taskType = r4;
object2.applications = r2;
return object2;
}
function _getQuestTaskDetails(a0, a1) { // fn#56907, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:5542, offset: 0x013d55ef, size: 405 bytes, params: 3, frame: 18
var r0;
var r1;
var _getTaskDetailsForTypeBinding;
var object2;
const FirstPartyQuestTaskTypes = (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypes;
var FirstPartyQuestTaskTypesSets;
let value = a1;
if (isInGameQuest(a0)) {
r0 = {'progressSeconds': 0, 'targetSeconds': 1, 'targetMinutes': 1, 'percentComplete': 0,
taskType: FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP};
} else if (env0_4(a0)) {
if (value != null) {
r1 = value;
} else {
value = isQuestProgressingOnConsole(a0);
FirstPartyQuestTaskTypesSets = (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypesSets;
r1 = value ? FirstPartyQuestTaskTypesSets.CONSOLE : FirstPartyQuestTaskTypesSets.ALL;
}
value = _fun56908({quest: a0, includeTaskTypes: r1});
r0 = value;
} else if (env0_7(a0)) {
_getTaskDetailsForTypeBinding = _getTaskDetailsForType;
value = getDefaultWatchVideoTask(a0.config);
value = _getTaskDetailsForTypeBinding({quest: a0, taskType: value?.type});
r0 = value;
} else if (shouldUsePlayOnDesktopTask(a0)) {
r0 = _getTaskDetailsForType({quest: a0, taskType: FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP});
} else {
value = hasPlayActivityTask(a0);
_getTaskDetailsForTypeBinding = _getTaskDetailsForType;
object2 = {quest: a0};
if (value) {
object2.taskType = FirstPartyQuestTaskTypes.PLAY_ACTIVITY;
r0 = _getTaskDetailsForTypeBinding(object2);
} else {
object2.taskType = FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP;
r0 = _getTaskDetailsForTypeBinding(object2);
}
}
return r0;
}
function getAllApplicationIds(a0) { // fn#56910, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:7832, offset: 0x013d5a26, size: 66 bytes, params: 2, frame: 14
var getApplicationIdsByTaskTypesBinding;
var Object;
if (a0 != null) {
getApplicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypes;
Object = global.Object;
return getApplicationIdsByTaskTypesBinding(a0, Object.keys(a0.config.taskConfigV2.tasks));
}
}
function getConsoleApplicationId(a0) { // fn#56912, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:8141, offset: 0x013d5aa4, size: 100 bytes, params: 2, frame: 16
const getApplicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypes;
const value = undefined;
const {PLAY_ON_XBOX,
PLAY_ON_PLAYSTATION} = (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypes;
const applicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypesBinding(a0, [PLAY_ON_XBOX,
PLAY_ON_PLAYSTATION]);
return applicationIdsByTaskTypesBinding == null ? value : applicationIdsByTaskTypesBinding[0];
}
function getPlayActivityApplicationId(a0) { // fn#56913, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:8378, offset: 0x013d5b08, size: 75 bytes, params: 2, frame: 13
const getApplicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypes;
const value = undefined;
const FirstPartyQuestTaskTypes = (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypes;
const PLAY_ACTIVITY = FirstPartyQuestTaskTypes.PLAY_ACTIVITY;
const applicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypesBinding(a0, [PLAY_ACTIVITY]);
return applicationIdsByTaskTypesBinding == null ? value : applicationIdsByTaskTypesBinding[0];
}
function getInGameApplicationId(a0) { // fn#56914, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:8561, offset: 0x013d5b53, size: 75 bytes, params: 2, frame: 13
const getApplicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypes;
const value = undefined;
const FirstPartyQuestTaskTypes = (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypes;
const ACHIEVEMENT_IN_GAME = FirstPartyQuestTaskTypes.ACHIEVEMENT_IN_GAME;
const applicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypesBinding(a0, [ACHIEVEMENT_IN_GAME]);
return applicationIdsByTaskTypesBinding == null ? value : applicationIdsByTaskTypesBinding[0];
}
function getActivityApplicationId(a0) { // fn#56915, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:8746, offset: 0x013d5b9e, size: 100 bytes, params: 2, frame: 16
const getApplicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypes;
const value = undefined;
const {PLAY_ACTIVITY,
ACHIEVEMENT_IN_ACTIVITY} = (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypes;
const applicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypesBinding(a0, [PLAY_ACTIVITY,
ACHIEVEMENT_IN_ACTIVITY]);
return applicationIdsByTaskTypesBinding == null ? value : applicationIdsByTaskTypesBinding[0];
}
function getStreamingApplicationId(a0) { // fn#56916, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:8986, offset: 0x013d5c02, size: 75 bytes, params: 2, frame: 13
const getApplicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypes;
const value = undefined;
const FirstPartyQuestTaskTypes = (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypes;
const STREAM_ON_DESKTOP = FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP;
const applicationIdsByTaskTypesBinding = getApplicationIdsByTaskTypesBinding(a0, [STREAM_ON_DESKTOP]);
return applicationIdsByTaskTypesBinding == null ? value : applicationIdsByTaskTypesBinding[0];
}
function isVideoQuestForMobilePlatformOnly(a0) { // fn#56920, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:10070, offset: 0x013d5d25, size: 34 bytes, params: 2, frame: 13
return env0_6(a0) && !env0_5(a0);
}
function getThirdPartyTaskDetails({config, userStatus}) { // fn#56924, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:10709, offset: 0x013d5e06, size: 172 bytes, params: 2, frame: 16
const defaultInGameTask = getDefaultInGameTask(config);
if (defaultInGameTask == null) {
return null;
}
const r3 = (userStatus == null || userStatus.progress == null ? undefined : userStatus.progress[defaultInGameTask.type]?.value) ?? 0;
return {title: defaultInGameTask.messages.taskTitle, description: defaultInGameTask.messages.taskDescription,
target: defaultInGameTask.target, progress: r3,
percentComplete: _computePercentComplete(defaultInGameTask.target, r3)};
}
function _fun56888(a0) { // fn#56888, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:1977, offset: 0x013d4d66, size: 40 bytes, params: 2, frame: 2
return env0_0.config.taskConfigV2.tasks[a0] != null;
}
function _fun56897(a0) { // fn#56897, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:1827, offset: 0x013d5026, size: 34 bytes, params: 2, frame: 11
return a0.some(_fun56898);
}
function _fun56908({quest, includeTaskTypes}) { // fn#56908, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:5711, offset: 0x013d5784, size: 314 bytes, params: 2, frame: 21
var environment;
var r3;
var progress;
var r1;
var r7;
var value2;
var FirstPartyQuestTaskTypesSets;
var ALL;
var value8;
var _parseFirstPartyTaskTypeBinding;
var eventName;
var value9;
var has;
var value10;
var value11;
reducibleJoin2: while (true) {
if (includeTaskTypes !== undefined) {
r3 = includeTaskTypes;
break reducibleJoin2;
}
value2 = environment.__proto__;
FirstPartyQuestTaskTypesSets = (require(6535) /* metro dependency 6535: FirstPartyQuestTaskTypes */).FirstPartyQuestTaskTypesSets;
ALL = FirstPartyQuestTaskTypesSets.ALL;
r3 = ALL;
break reducibleJoin2;
}
const _createForOfIteratorHelperLoose_56880Binding = _createForOfIteratorHelperLoose_56880;
const Object = global.Object;
const values = Object.values;
const userStatus = quest.userStatus;
reducibleJoin4: while (true) {
if (userStatus == null) {
progress = undefined;
break reducibleJoin4;
}
progress = userStatus.progress;
break reducibleJoin4;
}
reducibleJoin6: while (true) {
if (progress != null) {
r1 = progress;
break reducibleJoin6;
}
r1 = {};
break reducibleJoin6;
}
const value5 = Reflect.apply(values, Object, [r1]).sort(_fun56909);
const value6 = _createForOfIteratorHelperLoose_56880Binding(value5.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish));
const value7 = value6();
let done = value7.done;
if (!done) {
r7 = value7;
reducibleLoop7: while (true) {
value8 = r7.value;
_parseFirstPartyTaskTypeBinding = _parseFirstPartyTaskType;
eventName = value8.eventName;
value9 = _parseFirstPartyTaskTypeBinding(eventName);
if (value9 != null) {
reducibleJoin11: while (true) {
if (r3 == null) {
break reducibleJoin11;
}
has = r3.has;
if (Reflect.apply(has, r3, [value9])) {
value10 = _getTaskDetailsForType({quest: quest, taskType: value9, includeTaskTypes: r3});
if (value10 != null) {
return value10;
}
break reducibleJoin11;
}
break reducibleJoin11;
}
}
value11 = value6();
done = value11.done;
if (done) {
return _getTaskDetailsForType({quest: quest, includeTaskTypes: r3});
}
r7 = value11;
continue reducibleLoop7;
}
}
return _getTaskDetailsForType({quest: quest, includeTaskTypes: r3});
}
function _fun56909(a0, a1) { // fn#56909, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7294:5911, offset: 0x013d58be, size: 360 bytes, params: 3, frame: 16
var updatedAt;
var r0;
var Date;
var prototype;
var date;
var value2;
var value3;
var value5;
var value6;
let value = undefined;
const lastBeatAt = a0 == null || a0.heartbeat == null ? value : a0.heartbeat.lastBeatAt;
const lastBeatAt2 = a1 == null || a1.heartbeat == null ? value : a1.heartbeat.lastBeatAt;
if (lastBeatAt == null) {
if (lastBeatAt != null) {
r0 = lastBeatAt != null && lastBeatAt2 == null ? -1 : 1;
} else if (lastBeatAt2 != null) {
r0 = lastBeatAt != null && lastBeatAt2 == null ? -1 : 1;
} else {
updatedAt = a0 == null ? value : a0.updatedAt;
if (updatedAt == null) {
r0 = lastBeatAt != null && lastBeatAt2 == null ? -1 : 1;
} else {
updatedAt = a1 == null ? value : a1.updatedAt;
if (updatedAt != null) {
Date = global.Date;
updatedAt = a0.updatedAt;
prototype = Date.prototype;
value = Object.create(prototype, {constructor: {value: Date}});
date = new Date();
value = date instanceof Object ? date : value;
value = value.valueOf();
Date = global.Date;
updatedAt = a1.updatedAt;
prototype = Date.prototype;
value2 = Object.create(prototype, {constructor: {value: Date}});
date = new Date();
value3 = date instanceof Object ? date : value2;
value = value > value3.valueOf();
r0 = value ? -1 : 1;
} else {
r0 = lastBeatAt != null && lastBeatAt2 == null ? -1 : 1;
}
}
}
} else if (lastBeatAt2 != null) {
Date = global.Date;
prototype = Date.prototype;
value = Object.create(prototype, {constructor: {value: Date}});
date = new Date(lastBeatAt);
value = date instanceof Object ? date : value;
value = value.valueOf();
Date = global.Date;
prototype = Date.prototype;
value5 = Object.create(prototype, {constructor: {value: Date}});
date = new Date(lastBeatAt2);
value6 = date instanceof Object ? date : value5;
value = value > value6.valueOf();
r0 = value ? -1 : 1;
} else if (lastBeatAt != null) {
r0 = lastBeatAt != null && lastBeatAt2 == null ? -1 : 1;
} else if (lastBeatAt2 != null) {
r0 = lastBeatAt != null && lastBeatAt2 == null ? -1 : 1;
} else {
updatedAt = a0 == null ? value : a0.updatedAt;
if (updatedAt == null) {
r0 = lastBeatAt != null && lastBeatAt2 == null ? -1 : 1;
} else {
updatedAt = a1 == null ? value : a1.updatedAt;
if (updatedAt != null) {
Date = global.Date;
updatedAt = a0.updatedAt;
prototype = Date.prototype;
value = Object.create(prototype, {constructor: {value: Date}});
date = new Date();
value = date instanceof Object ? date : value;
value = value.valueOf();
Date = global.Date;
updatedAt = a1.updatedAt;
prototype = Date.prototype;
value2 = Object.create(prototype, {constructor: {value: Date}});
date = new Date();
value3 = date instanceof Object ? date : value2;
value = value > value3.valueOf();
r0 = value ? -1 : 1;
} else {
r0 = lastBeatAt != null && lastBeatAt2 == null ? -1 : 1;
}
}
}
return r0;
}
+284
View File
@@ -0,0 +1,284 @@
/* Metro module 7114; source: modules/quests/utils/QuestUtils.tsx; dependencies: [57, 4295, 1867, 3784, 4297, 7115, 6528, 7116, 7117, 7118, 7119, 7120, 2] */
function _fun56858(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#56858, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:6, offset: 0x013d3ddf, size: 372 bytes, params: 8, frame: 21
const env0_0 = require;
const _arrayLikeToArray_56861 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const closure = isSponsoredPlayQuest;
const closure2 = function(a0, a1) {
var Set = global.Set;
return new Set(a0.config.features).has(a1);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(57) /* metro dependency 57 */;
const gameConsoleStore = importDefault(4295) /* metro dependency 4295: GameConsoleStore */;
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
const voiceStateStore = importDefault(4297) /* metro dependency 4297: VoiceStateStore */;
const questUtmStore = importDefault(7115) /* metro dependency 7115: QuestUtmStore */;
const questConstantsModule = require(6528) /* metro dependency 6528: QuestConstants */;
const env0_8 = questConstantsModule.DISCORD_APPLICATION_ID;
const env0_9 = questConstantsModule.QuestVariants;
const env0_10 = questConstantsModule.RewardFilterTypes;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/utils/QuestUtils.tsx');
exports.isSponsoredPlayQuest = closure;
exports.isPlayAnyActivityQuest = function(a0) {
return require(dependencyMap[7]).getPlayActivityApplicationId(a0) === DISCORD_APPLICATION_ID;
};
exports.hasVariant = closure2;
exports.canLaunchActivity = canLaunchActivity;
exports.filterQuestsForSocialEntrypoints = filterQuestsForSocialEntrypoints;
exports.isShareableQuest = function({sharePolicy}) {
return sharePolicy !== require(dependencyMap[8]).QuestSharePolicy.NOT_SHAREABLE;
};
exports.isStreamingAndCanWatch = isStreamingAndCanWatch;
exports.getQuestType = function(a0) {
var hasWatchVideoTasks = require(dependencyMap[7]).hasWatchVideoTasks({config: a0});
var property = require(dependencyMap[10]).QuestType;
return hasWatchVideoTasks ? property.VIDEO : property.GAMEPLAY;
};
exports.isQuestFeaturedByHero = function({questIds}, a1) {
var r1;
r1 = questIds?.includes(a1);
return r1 != null && r1;
};
exports.shouldShowBountiesGivenFilters = function(a0) {
return !a0.some(_fun56872) && (a0.length === 0 || a0.some(_fun56873));
};
exports.setQuestHomeUtmContext = setQuestHomeUtmContext;
}
function _createForOfIteratorHelperLoose_56859(a0, a1) { // fn#56859, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:238, offset: 0x013d3f53, size: 370 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun56860;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_56861(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_56861(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_56861(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun56860;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
}
function isSponsoredPlayQuest(a0) { // fn#56862, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:1148, offset: 0x013d40c5, size: 70 bytes, params: 2, frame: 13
if (a0 == null) {
return false;
}
let value = require(7116) /* metro dependency 7116: QuestTaskUtils */;
value = value.getDesktopApplicationIds(a0);
return value != null && value.length > 1;
}
function canLaunchActivity(a0) { // fn#56865, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:1613, offset: 0x013d4176, size: 72 bytes, params: 2, frame: 14
var r0;
var value;
const hasPlayActivityTask2 = (require(7116) /* metro dependency 7116: QuestTaskUtils */).hasPlayActivityTask(a0);
if (hasPlayActivityTask2) {
r0 = hasPlayActivityTask2;
} else {
value = require(7116) /* metro dependency 7116: QuestTaskUtils */;
value = value.hasAchievementActivityTask(a0);
r0 = value;
}
return r0;
}
function filterQuestsForSocialEntrypoints(a0, a1) { // fn#56866, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:1759, offset: 0x013d41be, size: 299 bytes, params: 3, frame: 30
var r4;
var r19;
var value5;
var value6;
var property;
var property2;
var hasVariantBinding;
var NON_GAMING_PLAY_QUEST;
var moduleValue;
var getQuestTaskTypes;
var value7;
var value8;
var value9;
var has;
var value10;
var set;
var value11;
const Map = global.Map;
const map = new Map();
const value3 = _createForOfIteratorHelperLoose_56859(a0);
const value4 = value3();
let done = value4.done;
if (!done) {
r4 = value4;
while (true) {
value5 = r4.value;
value6 = env0_2(value5, 2);
property = value6[0];
property2 = value6[1];
if (!isSponsoredPlayQuest(property2)) {
hasVariantBinding = hasVariant;
NON_GAMING_PLAY_QUEST = QuestVariants.NON_GAMING_PLAY_QUEST;
if (hasVariantBinding(property2, NON_GAMING_PLAY_QUEST)) {
break;
}
_createForOfIteratorHelperLoose_56859Binding = _createForOfIteratorHelperLoose_56859;
moduleValue = require(7116) /* metro dependency 7116: QuestTaskUtils */;
getQuestTaskTypes = moduleValue.getQuestTaskTypes;
value7 = _createForOfIteratorHelperLoose_56859Binding(Reflect.apply(getQuestTaskTypes, moduleValue,
[property2]));
value8 = value7();
done = value8.done;
if (done) {
break;
}
r19 = value8;
loopExit4: while (true) {
value9 = r19.value;
has = a1.has;
if (Reflect.apply(has, a1, [value9])) {
set = map.set;
Reflect.apply(set, map, [property, property2]);
break loopExit4;
}
value10 = value7();
done = value10.done;
if (done) {
break loopExit4;
}
r19 = value10;
continue;
}
}
value11 = value3();
done = value11.done;
if (done) {
break;
}
r4 = value11;
continue;
}
}
return map;
}
function isStreamingAndCanWatch(a0, a1) { // fn#56868, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:2270, offset: 0x013d431d, size: 87 bytes, params: 3, frame: 20
return a0 != null && a1 != null && (require(7118) /* metro dependency 7118: StreamPermissionUtils */).canWatchStream(a1,
VoiceStateStore, GuildStore, PermissionStore, GameConsoleStore)[0];
}
function shouldShowBountiesGivenFilters(a0) { // fn#56871, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:2681, offset: 0x013d43fc, size: 62 bytes, params: 2, frame: 13
return !a0.some(function(a0) {
return a0.group === 'task';
}) && (a0.length === 0 || a0.some(_fun56873));
}
function setQuestHomeUtmContext({questId, fromContent, utmSource, utmMedium}) { // fn#56874, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:2868, offset: 0x013d4479, size: 112 bytes, params: 2, frame: 16
const state = QuestUtmStore.getState();
const setUtmCurrentContext = state.setUtmCurrentContext;
const object2 = {utmSourceCurrent: utmSource, utmMediumCurrent: utmMedium, utmCampaignCurrent: questId};
object2.utmContentCurrent = (require(7120) /* metro dependency 7120: AnalyticsTypes */).getQuestContentName(fromContent);
Reflect.apply(setUtmCurrentContext, state, [object2]);
}
function _fun56873(a0) { // fn#56873, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7292:2785, offset: 0x013d444d, size: 44 bytes, params: 2, frame: 3
var r0;
var filter;
let value = a0.group === 'reward';
if (value) {
filter = a0.filter;
value = environment.__proto__;
value = filter === RewardFilterTypes.VIRTUAL_CURRENCY;
r0 = value;
} else {
r0 = value;
}
return r0;
}
@@ -0,0 +1,145 @@
/* Metro module 9522; source: modules/quests/utils/VideoQuestUtils.tsx; dependencies: [4401, 7093, 7095, 661, 7091, 9484, 7116, 1244, 7110, 4007, 2, 9523] */
function _fun74293(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#74293, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9708:6, offset: 0x01d89035, size: 312 bytes, params: 8, frame: 22
const env0_0 = require;
const closure = sendVideoProgress;
const closure2 = function(a0, a1) {
var r1;
var r0;
var value = 0;
if (a0 <= value) {
r0 = value;
} else if (a1 <= value) {
r0 = value;
} else {
value = 1;
if (a0 >= a1) {
r1 = value;
} else {
value = global.Math.min(value, global.Math.round(a0 / a1 * 100) / 100);
r1 = value;
}
r0 = r1;
}
return r0;
};
const closure3 = function(a0) {
return 'VIDEO-QUEST-' + a0;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const networkStore = importDefault(4401) /* metro dependency 4401: NetworkStore */;
const questStore = importDefault(7093) /* metro dependency 7093: QuestStore */;
const videoQuestUIStore = importDefault(7095) /* metro dependency 7095: VideoQuestUIStore */;
const env0_5 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/utils/VideoQuestUtils.tsx');
const getVideoQuestWatchCtaText = (require(9523) /* metro dependency 9523: MobileQuestVideoWatchCtaCopy */).getVideoQuestWatchCtaText;
exports.getVideoQuestWatchCtaText = getVideoQuestWatchCtaText;
exports.sendVideoProgress = closure;
exports.getVideoOrientation = function(a0) {
var video = a0.assets.video;
var value = 'portrait';
return video == null || video.width == null || video.height == null ? value : video.width > video.height ? 'landscape' : value;
};
exports.getVideoQuestProgressRemainingAccessibilityLabel = getVideoQuestProgressRemainingAccessibilityLabel;
exports.formatVideoProgressRatio = closure2;
exports.getVideoQuestEndCardCtaText = getVideoQuestEndCardCtaText;
exports.handleVideoQuestModalClose = handleVideoQuestModalClose;
exports.getVideoQuestModalKey = closure3;
exports.computeMaxSeekableTime = function(a0, a1) {
var r0;
var value = a0;
if (value >= a1 - 1) {
value = global.Math.max(value, a1);
r0 = value;
} else {
r0 = value;
}
return r0;
};
exports.isVideoQuestProgressing = isVideoQuestProgressing;
}
function sendVideoProgress(a0, a1) { // fn#74294, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9708:151, offset: 0x01d8916d, size: 144 bytes, params: 3, frame: 17
var value;
const value2 = undefined;
let r3 = (require(7091) /* metro dependency 7091: QuestDataUtils */).isQuestExpired(a0) || (a0.userStatus == null ? value2 : a0.userStatus.enrolledAt) == null;
r3 = !r3 ? (a0.userStatus == null ? value2 : a0.userStatus.completedAt) != null : r3;
if (!r3) {
value = require(9484) /* metro dependency 9484: QuestActionCreators */;
value.updateVideoProgress(a0.id, a1);
}
return value2;
}
function getVideoQuestProgressRemainingAccessibilityLabel(a0, a1) { // fn#74298, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9708:928, offset: 0x01d892d1, size: 393 bytes, params: 3, frame: 21
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
if (a1) {
return intl.string(t['ij5E/5']);
}
const {minutes, seconds} = (require(7116) /* metro dependency 7116: QuestTaskUtils */).getRemainingTaskTime(a0);
return intl.formatToPlainString(t.nzYZrt,
{remainingTime: minutes > 0 && seconds > 0 ? intl.formatToPlainString(t['lW/66D'], {minutes: minutes,
seconds: seconds}) : minutes > 0 ? intl.formatToPlainString(t['SxnF/O'],
{count: minutes}) : intl.formatToPlainString(t['0BZpdi'], {count: seconds})});
}
function getVideoQuestEndCardCtaText({ctaConfig}) { // fn#74299, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9708:1548, offset: 0x01d8945a, size: 85 bytes, params: 2, frame: 15
var r0;
var intl;
const buttonLabel = ctaConfig.buttonLabel;
if (buttonLabel != null) {
r0 = buttonLabel;
} else {
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
r0 = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.iiTtpJ);
}
return r0;
}
function handleVideoQuestModalClose({questId, sourceQuestContent, videoSessionId}) { // fn#74300, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9708:1705, offset: 0x01d894af, size: 369 bytes, params: 2, frame: 25
var r0;
var quest;
var maxTimestampSec;
var formatVideoProgressRatioBinding;
var value11;
var moduleValue;
var trackQuestEvent;
var object2;
var moduleValue2;
var object4;
VideoQuestUIStore.getState().setTranscriptEnabled(false);
const videoProgress = VideoQuestUIStore.getState().getVideoProgress(questId);
if (videoProgress != null) {
quest = QuestStore.getQuest(questId);
r0 = quest != null && quest.userStatus?.enrolledAt != null;
r0 = r0 && quest.userStatus?.completedAt == null;
if (r0) {
sendVideoProgress(quest, videoProgress.maxTimestampSec);
}
formatVideoProgressRatioBinding = formatVideoProgressRatio;
maxTimestampSec = videoProgress.maxTimestampSec;
value11 = formatVideoProgressRatioBinding(maxTimestampSec, videoProgress.duration);
moduleValue = require(7110) /* metro dependency 7110: AnalyticsActions */;
trackQuestEvent = moduleValue.trackQuestEvent;
maxTimestampSec = videoProgress.maxTimestampSec;
Reflect.apply(trackQuestEvent, moduleValue, [{questId: questId, event: AnalyticEvents.QUEST_VIDEO_PROGRESSED,
properties: {progress: value11, video_timestamp_seconds: maxTimestampSec, video_session_id: videoSessionId},
sourceQuestContent: sourceQuestContent}]);
moduleValue2 = require(7110) /* metro dependency 7110: AnalyticsActions */;
trackQuestEvent = moduleValue2.trackQuestEvent;
object2 = {questId: questId};
object2.event = AnalyticEvents.QUEST_VIDEO_MODAL_CLOSED;
object4 = {video_progress: value11, video_session_id: videoSessionId};
object4.network_connection_speed = NetworkStore.getEffectiveConnectionSpeed();
object2.properties = object4;
object2.sourceQuestContent = sourceQuestContent;
Reflect.apply(trackQuestEvent, moduleValue2, [object2]);
}
}
function isVideoQuestProgressing(a0) { // fn#74302, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9708:2661, offset: 0x01d89649, size: 95 bytes, params: 2, frame: 15
const hasWatchVideoTasks2 = (require(7116) /* metro dependency 7116: QuestTaskUtils */).hasWatchVideoTasks(a0);
return hasWatchVideoTasks2 ? (require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */).isModalOpen(getVideoQuestModalKey(a0.id)) : !!hasWatchVideoTasks2;
}