/* Metro module 16153; source: modules/quests/managers/QuestMobileEmbedVisibilityManager.native.tsx; dependencies: [57, 6, 7, 15, 17, 102, 18, 3849, 4606, 9613, 7710, 1383, 1379, 1934, 9878, 7030, 7093, 9515, 661, 7099, 1393, 4101, 6531, 7121, 9514, 10915, 4007, 676, 677, 4497, 7120, 4008, 4860, 2] */ function _fun124830(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#124830, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:6, offset: 0x025c44c8, size: 532 bytes, params: 8, frame: 19 const env0_0 = require; const _arrayLikeToArray_124833 = 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 Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importDefault(57) /* metro dependency 57 */; const env0_4 = importDefault(6) /* metro dependency 6 */; const env0_5 = importDefault(7) /* metro dependency 7 */; const env0_6 = importDefault(15) /* metro dependency 15 */; const env0_7 = importDefault(17) /* metro dependency 17 */; const env0_8 = importDefault(102) /* metro dependency 102 */; const env0_9 = importDefault(18) /* metro dependency 18 */; const actionSheetStore = importDefault(3849) /* metro dependency 3849: ActionSheetStore */; const channelRTCStore = importDefault(4606) /* metro dependency 4606: ChannelRTCStore */; let value = require(9613) /* metro dependency 9613: ChannelDetailsStore */; const env0_12 = value.useChannelDetailsStore; const env0_13 = value.getIsChannelDetailsSearchActive; const voicePanelStore = importDefault(7710) /* metro dependency 7710: VoicePanelStore */; const env0_15 = (require(1383) /* metro dependency 1383: ChannelRecord */).isTextChannel; const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */; const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */; const alertStore = importDefault(9878) /* metro dependency 9878: AlertStore */; const appStateStore = importDefault(7030) /* metro dependency 7030: AppStateStore */; const questStore = importDefault(7093) /* metro dependency 7093: QuestStore */; const env0_21 = (require(9515) /* metro dependency 9515: ContentImpressionTrackerConstants */).MIN_QUEST_CONTENT_VISIBILITY_PERCENTAGE; const env0_22 = (require(661) /* metro dependency 661: Constants */).MessageStates; value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */; value = _fun124840(value); value = new value(); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/managers/QuestMobileEmbedVisibilityManager.native.tsx'); exports.default = value; } function _createForOfIteratorHelperLoose_124831(a0, a1) { // fn#124831, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:434, offset: 0x025c46dc, 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 _fun124832; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_124833(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_124833(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_124833(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun124832; } 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 _isNativeReflectConstruct_124834() { // fn#124834, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:1344, offset: 0x025c4850, size: 98 bytes, params: 1, frame: 18 var Boolean; var prototype; var valueOf; var call; var Reflect; var construct; var closure; var value; var error; try { Boolean = global.Boolean; prototype = Boolean.prototype; valueOf = prototype.valueOf; call = valueOf.call; Reflect = global.Reflect; construct = Reflect.construct; Boolean = global.Boolean; closure = function() { }; value = Reflect.apply(construct, Reflect, [Boolean, [], closure]); value = Reflect.apply(call, valueOf, [value]); var result = !value; } catch (error) { } return (_isNativeReflectConstruct_124834_isNativeReflectConstruct = function() { return !!result; })(); } function _superPropGet_124837(a0, a1, a2, a3) { // fn#124837, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:1537, offset: 0x025c48b2, size: 101 bytes, params: 5, frame: 18 let value = a0; const env0_0 = a2; const binding = env0_8; value = env0_7(1 & 3 ? value.prototype : value); value = binding(value, a1, a2); return 2 & 3 ? typeof value !== 'function' ? value : _fun124838 : value; } function log_124839(a0) { // fn#124839, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:1681, offset: 0x025c4917, size: 78 bytes, params: 2, frame: 13 var value2; copyRestArgs(0, undefined); if (env0_23 == null) { value2 = (require(7099) /* metro dependency 7099: getQuestLogger */).getQuestLogger({location: 'QuestMobileEmbedVisibilityManager'}); } } function _fun124840(a0) { // fn#124840, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:1782, offset: 0x025c4965, size: 97 bytes, params: 2, frame: 16 const closure = QuestMobileEmbedVisibilityManager; env0_9(closure, a0); return env0_5(closure, [{key: '_initialize', value: value_124874}, {key: '_terminate', value: value_124875}]); } function QuestMobileEmbedVisibilityManager(a0) { // fn#124841, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:1794, offset: 0x025c49c6, size: 789 bytes, params: 2, frame: 21 var r0; var Reflect; let value = copyRestArgs(0, undefined); let binding = env1_4; binding(this, QuestMobileEmbedVisibilityManager); const items = []; arraySpread(items, value, 0, items); value = env1_7(QuestMobileEmbedVisibilityManager); binding = env1_6; if (_isNativeReflectConstruct_124834()) { Reflect = global.Reflect; value = Reflect.construct(value, items, env1_7(this).constructor); r0 = value; } else { value = value.apply(this, items); r0 = value; } value = binding(this, r0); const defaultImport = importDefault(1393) /* metro dependency 1393 */; const value4 = Object.create(defaultImport.prototype, {constructor: {value: defaultImport}}); const defaultImport2 = new defaultImport({max: 50}); value.impressionCache = defaultImport2 instanceof Object ? defaultImport2 : value4; value.questStatuses = {}; value.chatChannelId = undefined; value.previousChatChannelId = undefined; value.channelsWithChatOpen = {}; value.handleVisibleMessagesChanged = handleVisibleMessagesChanged; value.findQuestEmbedsInMessage = function(a0) { var env0_0 = a0; var env0_2 = new global.Set(); a0.codedLinks.forEach(_fun124844); return []; }; value.updateImpressionsForVisibleEmbeds = updateImpressionsForVisibleEmbeds; value.ensureImpression = ensureImpression; value.stopOne = stopOne; value.stopMany = stopMany; value.getCacheKey = function({channelId, messageId, questId}) { return channelId + ':' + messageId + ':' + questId; }; value.parseCacheKey = parseCacheKey; value.isOnChannelNavigationRoute = isOnChannelNavigationRoute; value.isSearchShowing = isSearchShowing; value.getIsChatViewable = getIsChatViewable; value.updateImpressionsForChatBecameViewable = updateImpressionsForChatBecameViewable; value.refreshImpressions = refreshImpressions; value.checkChatViewable = checkChatViewable; value.checkIsOnChannelNavigationRoute = checkIsOnChannelNavigationRoute; value.checkSearchShowing = checkSearchShowing; value.onChannelChanged = onChannelChanged; value.checkOpenModalKey = checkOpenModalKey; value.handleQuestStoreChanged = handleQuestStoreChanged; value.handleSelectedChannelStoreChanged = handleSelectedChannelStoreChanged_124863; value.handleActionSheetStoreChanged = handleActionSheetStoreChanged; value.handleAppStateStoreChanged = handleAppStateStoreChanged; value.handleVoicePanelStoreChanged = handleVoicePanelStoreChanged; value.handleChannelDetailsStoreChanged = handleChannelDetailsStoreChanged; value.handleChannelRTCStoreChanged = handleChannelRTCStoreChanged; value.handleNavigationStateChanged = handleNavigationStateChanged; value.handleAlertStoreChanged = handleAlertStoreChanged; value.unsubscribeFromVoicePanelStore = function() { }; value.unsubscribeFromChannelDetailsStore = function() { }; value.unsubscribeFromAlertStore = function() { }; const Map = global.Map; const map = new Map(); let set = map.set; var handleQuestStoreChanged = value.handleQuestStoreChanged; const value9 = Reflect.apply(set, map, [QuestStore, handleQuestStoreChanged]); const value10 = value9.set(SelectedChannelStore, value.handleSelectedChannelStoreChanged); set = value10.set; var handleActionSheetStoreChanged = value.handleActionSheetStoreChanged; const value11 = Reflect.apply(set, value10, [ActionSheetStore, handleActionSheetStoreChanged]); set = value11.set; var handleAppStateStoreChanged = value.handleAppStateStoreChanged; const value12 = Reflect.apply(set, value11, [AppStateStore, handleAppStateStoreChanged]); set = value12.set; var handleChannelRTCStoreChanged = value.handleChannelRTCStoreChanged; const value13 = Reflect.apply(set, value12, [ChannelRTCStore, handleChannelRTCStoreChanged]); set = value13.set; var handleAlertStoreChanged = value.handleAlertStoreChanged; value.stores = Reflect.apply(set, value13, [AlertStore, handleAlertStoreChanged]); var handleVisibleMessagesChanged = value.handleVisibleMessagesChanged; value.actions = {QUESTS_VISIBLE_MOBILE_MESSAGES_CHANGED: handleVisibleMessagesChanged}; return value; } function value_124874() { // fn#124874, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:9726, offset: 0x025c5f2f, size: 207 bytes, params: 1, frame: 18 const value = environment.__proto__; const rootNavigationRef = (require(4008) /* metro dependency 4008: RootNavigationRefNative */).getRootNavigationRef(); if (rootNavigationRef != null) { rootNavigationRef.addListener('state', this.handleNavigationStateChanged); } this.unsubscribeFromVoicePanelStore = VoicePanelStore.subscribe(this.handleVoicePanelStoreChanged); this.unsubscribeFromChannelDetailsStore = useChannelDetailsStore.subscribe(this.handleChannelDetailsStoreChanged); const useAlertStore = (require(4497) /* metro dependency 4497: useAlertStoreNative */).useAlertStore; this.unsubscribeFromAlertStore = useAlertStore.subscribe(this.handleAlertStoreChanged); _superPropGet_124837(QuestMobileEmbedVisibilityManager, '_initialize', this, 3)([]); } function value_124875() { // fn#124875, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:10213, offset: 0x025c5ffe, size: 134 bytes, params: 1, frame: 18 const value = environment.__proto__; const rootNavigationRef = (require(4008) /* metro dependency 4008: RootNavigationRefNative */).getRootNavigationRef(); if (rootNavigationRef != null) { rootNavigationRef.removeListener('state', this.handleNavigationStateChanged); } this.unsubscribeFromVoicePanelStore(); this.unsubscribeFromChannelDetailsStore(); this.unsubscribeFromAlertStore(); _superPropGet_124837(QuestMobileEmbedVisibilityManager, '_terminate', this, 3)([]); } function handleVisibleMessagesChanged({payload}) { // fn#124842, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:2251, owner: QuestMobileEmbedVisibilityManager.handleVisibleMessagesChanged, offset: 0x025c4cdb, size: 286 bytes, params: 2, frame: 26 var r15; var r3; var r2; var value5; var message; var percentVisible; var state; var codedLinks; var length; var value6; var SENDING; var SEND_FAILED; var value7; var Math; var round; var push; var binding; var questEmbedsInMessage; var items3; var value8; const visibleMessages = payload.visibleMessages; payload.source; log_124839(); const items2 = []; const value2 = _createForOfIteratorHelperLoose_124831(visibleMessages); const value3 = value2(); let done = value3.done; if (!done) { r3 = value3; while (true) { value5 = r3.value; message = value5.message; percentVisible = value5.percentVisible; state = value5.state; codedLinks = message.codedLinks; length = codedLinks.length; value6 = length <= 0; if (value6) { r2 = value6; } else { SENDING = MessageStates.SENDING; SEND_FAILED = MessageStates.SEND_FAILED; value7 = [SENDING, SEND_FAILED].includes(state); r2 = value7; r15 = SENDING; } if (r2) { continue; } log_124839Binding = log_124839; message.id; message.content; Math = global.Math; round = Math.round; log_124839Binding(Reflect.apply(round, Math, [100 * percentVisible])); if (!(percentVisible > MIN_QUEST_CONTENT_VISIBILITY_PERCENTAGE)) { continue; } push = items2.push; binding = env0_0; questEmbedsInMessage = binding.findQuestEmbedsInMessage(message); items3 = []; arraySpread(items3, questEmbedsInMessage, 0, r15); apply(push, items3, items2, r15); value8 = value2(); done = value8.done; if (done) { break; } r3 = value8; continue; } } binding = env0_0; binding.updateImpressionsForVisibleEmbeds({visibleEmbeds: items2}); } function findQuestEmbedsInMessage(a0) { // fn#124843, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:2657, owner: QuestMobileEmbedVisibilityManager.findQuestEmbedsInMessage, offset: 0x025c4df9, size: 74 bytes, params: 2, frame: 13 const env0_0 = a0; const Set = global.Set; const set = new Set(); a0.codedLinks.forEach(_fun124844); return []; } function updateImpressionsForVisibleEmbeds({visibleEmbeds}) { // fn#124845, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:2925, owner: QuestMobileEmbedVisibilityManager.updateImpressionsForVisibleEmbeds, offset: 0x025c4ed0, size: 304 bytes, params: 2, frame: 28 var r3; var value5; var questId; var questContentPosition; var messageId; var channelId; var quest; var binding; var ensureImpression; var object2; const QuestContent = (require(6531) /* metro dependency 6531: QuestTypes */).QuestContent; var QUEST_EMBED_MOBILE; var id; var questEnrollmentBlockedUntil; var AdCreativeType; var QUEST; var value7; const value2 = _createForOfIteratorHelperLoose_124831(visibleEmbeds); const value3 = value2(); let done = value3.done; if (!done) { r3 = value3; while (true) { value5 = r3.value; questId = value5.questId; questContentPosition = value5.questContentPosition; messageId = value5.messageId; channelId = value5.channelId; quest = QuestStore.getQuest(questId); if (quest != null) { binding = env0_0; ensureImpression = binding.ensureImpression; object2 = {quest: quest}; QUEST_EMBED_MOBILE = QuestContent.QUEST_EMBED_MOBILE; object2.questContent = QUEST_EMBED_MOBILE; object2.triggeredByStatusChange = false; object2.questContentPosition = questContentPosition; object2.channelId = channelId; object2.messageId = messageId; id = quest.id; object2.questId = id; questEnrollmentBlockedUntil = QuestStore.questEnrollmentBlockedUntil; object2.isQuestEnrollmentBlocked = questEnrollmentBlockedUntil != null; QUEST_EMBED_MOBILE = QuestContent.QUEST_EMBED_MOBILE; object2.sourceQuestContent = QUEST_EMBED_MOBILE; AdCreativeType = (require(7121) /* metro dependency 7121: AdCreativeType */).AdCreativeType; QUEST = AdCreativeType.QUEST; object2.adCreativeType = QUEST; Reflect.apply(ensureImpression, binding, [object2]); } value7 = value2(); done = value7.done; if (done) { break; } r3 = value7; continue; } } binding = env0_0; binding.stopMany({visibleEmbeds: visibleEmbeds, shouldDeleteHiddenEmbeds: true}); } function ensureImpression(a0) { // fn#124846, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:3532, owner: QuestMobileEmbedVisibilityManager.ensureImpression, offset: 0x025c5000, size: 274 bytes, params: 2, frame: 21 var r3; var r6; var value10; var QuestContentImpression; const quest = a0.quest; const value = Object.create(null); value.quest = 0; const value2 = copyDataProperties({}, a0, value, undefined); const binding = env0_0; const cacheKey = binding.getCacheKey(value2); const value5 = binding.impressionCache.get(cacheKey); const value6 = value5 != null; const value7 = undefined; if (value6) { r3 = value5 != null; r6 = value5; } else { r3 = value6; r6 = value7; } r3 = r3 && r6.isRunning; if (!r3) { r3 = value5 == null ? value5 : value5.clone({triggeredByStatusChange: value2.triggeredByStatusChange}); if (r3 == null) { value10 = environment.__proto__.__proto__; QuestContentImpression = (require(9514) /* metro dependency 9514: ContentImpressionTracker */).QuestContentImpression; copyDataProperties({adContentIds: [quest.id]}, value2, value); r3 = new QuestContentImpression(); } if (env0_0.isChatViewable && !r3.isRunning) { r3.start(); } env0_0.impressionCache.set(cacheKey, r3); } return value7; } function stopOne({key, shouldDelete}) { // fn#124847, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:3872, owner: QuestMobileEmbedVisibilityManager.stopOne, offset: 0x025c5112, size: 117 bytes, params: 2, frame: 17 var value5; const value2 = env0_0.impressionCache.get(key); const isRunning = value2?.isRunning; const r0 = isRunning != null && isRunning; if (value2 != null) { value2.stop(); } if (shouldDelete) { value5 = environment.__proto__.__proto__; log_124839(); env0_0.impressionCache.del(key); } return r0; } function stopMany() { // fn#124848, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:4049, owner: QuestMobileEmbedVisibilityManager.stopMany, offset: 0x025c5187, size: 210 bytes, params: 1, frame: 18 var r2; var value7; var has; var binding; var value8; const value = a0; const r1 = value !== undefined ? value : {visibleEmbeds: [], shouldDeleteHiddenEmbeds: false}; const visibleEmbeds = r1.visibleEmbeds; const r4 = visibleEmbeds !== undefined ? visibleEmbeds : []; let shouldDeleteHiddenEmbeds = r1.shouldDeleteHiddenEmbeds; shouldDeleteHiddenEmbeds = !(shouldDeleteHiddenEmbeds === undefined) && shouldDeleteHiddenEmbeds; const Set = global.Set; const set = new Set(r4.map(_fun124849)); const _createForOfIteratorHelperLoose_124831Binding = _createForOfIteratorHelperLoose_124831; const impressionCache = env0_0.impressionCache; const value5 = _createForOfIteratorHelperLoose_124831Binding(impressionCache.keys()); const value6 = value5(); let done = value6.done; if (!done) { r2 = value6; while (true) { value7 = r2.value; has = set.has; if (!Reflect.apply(has, set, [value7])) { binding = env0_0; binding.stopOne({key: value7, shouldDelete: shouldDeleteHiddenEmbeds}); } value8 = value5(); done = value8.done; if (done) { break; } r2 = value8; continue; } } } function parseCacheKey(a0) { // fn#124851, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:4420, owner: QuestMobileEmbedVisibilityManager.parseCacheKey, offset: 0x025c5299, size: 72 bytes, params: 2, frame: 13 let value = a0.split(':'); value = env2_3(value, 3); return {channelId: value[0], messageId: value[1], questId: value[2]}; } function isOnChannelNavigationRoute() { // fn#124852, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:4533, owner: QuestMobileEmbedVisibilityManager.isOnChannelNavigationRoute, offset: 0x025c52e1, size: 70 bytes, params: 1, frame: 13 let value = environment.__proto__.__proto__; value = require(10915) /* metro dependency 10915: isChannelFocusedNative */; value = value.isChannelFocused(); return value && (require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */).getCurrentNavigationRouteName() === 'channel'; } function isSearchShowing() { // fn#124853, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:4660, owner: QuestMobileEmbedVisibilityManager.isSearchShowing, offset: 0x025c5327, size: 48 bytes, params: 1, frame: 12 return env0_0.chatChannelId != null && getIsChannelDetailsSearchActive(env0_0.chatChannelId); } function getIsChatViewable() { // fn#124854, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:4726, owner: QuestMobileEmbedVisibilityManager.getIsChatViewable, offset: 0x025c5357, size: 603 bytes, params: 1, frame: 20 var r4; var r1; var binding; const useAlertStore = (require(4497) /* metro dependency 4497: useAlertStoreNative */).useAlertStore; var isAnyVoicePanelOpen2; let chatChannelId = env0_0.chatChannelId; if (chatChannelId == null) { value = environment.__proto__.__proto__; log_124839(); } else { if (ActionSheetStore.isOpen()) { log_124839(); return false; } var state = AppStateStore.getState(); var value4 = undefined; var AppStates = (require(676) /* metro dependency 676: ConstantsIOS */).AppStates; var ACTIVE = AppStates.ACTIVE; if (state !== ACTIVE) { log_124839(); return false; } var getChannel = ChannelStore.getChannel; chatChannelId = env0_0.chatChannelId; var value5 = Reflect.apply(getChannel, ChannelStore, [chatChannelId]); var type = value5 == null ? value4 : value5.type; var getChatOpen = ChannelRTCStore.getChatOpen; chatChannelId = env0_0.chatChannelId; var value6 = Reflect.apply(getChatOpen, ChannelRTCStore, [chatChannelId]); var ChannelTypes = (require(677) /* metro dependency 677: ChannelTypes */).ChannelTypes; var GUILD_STAGE_VOICE = ChannelTypes.GUILD_STAGE_VOICE; var r5 = type === GUILD_STAGE_VOICE && value6; var openModalKey = (require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */).getOpenModalKey(); chatChannelId = env0_0.chatChannelId; var value9 = 'voice-channel-' + chatChannelId; if (openModalKey == null) { binding = env0_0; if (binding.isSearchShowing()) { log_124839(); return false; } if (AlertStore.getAlert() != null) { log_124839(); return false; } if (useAlertStore.getState().alerts.length > 0) { log_124839(); return false; } r4 = type === (require(677) /* metro dependency 677: ChannelTypes */).ChannelTypes.GUILD_VOICE && value6; r1 = type != null && isTextChannel(type); isAnyVoicePanelOpen2 = VoicePanelStore.getState().isAnyVoicePanelOpen(); binding = env0_0; r1 = r1 && binding.isOnChannelNavigationRoute(); r1 = r1 && !isAnyVoicePanelOpen2; r1 = r1 && !r5; r1 = r1 && !r4; r1 = !r1 ? r5 : r1; r1 = !r1 ? r4 : r1; log_124839(env0_0.chatChannelId); return r1; } if (openModalKey === value9) { binding = env0_0; if (binding.isSearchShowing()) { log_124839(); return false; } if (AlertStore.getAlert() != null) { log_124839(); return false; } if (useAlertStore.getState().alerts.length > 0) { log_124839(); return false; } r4 = type === (require(677) /* metro dependency 677: ChannelTypes */).ChannelTypes.GUILD_VOICE && value6; r1 = type != null && isTextChannel(type); isAnyVoicePanelOpen2 = VoicePanelStore.getState().isAnyVoicePanelOpen(); binding = env0_0; r1 = r1 && binding.isOnChannelNavigationRoute(); r1 = r1 && !isAnyVoicePanelOpen2; r1 = r1 && !r5; r1 = r1 && !r4; r1 = !r1 ? r5 : r1; r1 = !r1 ? r4 : r1; log_124839(env0_0.chatChannelId); return r1; } log_124839(); } return false; } function updateImpressionsForChatBecameViewable() { // fn#124855, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:5472, owner: QuestMobileEmbedVisibilityManager.updateImpressionsForChatBecameViewable, offset: 0x025c55b2, size: 273 bytes, params: 1, frame: 24 var r3; var value5; var value6; var binding; var parseCacheKey; var channelId; var isRunning; var chatChannelId; var value7; var value8; log_124839(); const _createForOfIteratorHelperLoose_124831Binding = _createForOfIteratorHelperLoose_124831; let impressionCache = env0_0.impressionCache; const value3 = _createForOfIteratorHelperLoose_124831Binding(impressionCache.keys()); const value4 = value3(); let done = value4.done; if (!done) { r3 = value4; while (true) { value5 = r3.value; impressionCache = env0_0.impressionCache; value6 = impressionCache.get(value5); if (value6 != null) { binding = env0_0; parseCacheKey = binding.parseCacheKey; channelId = Reflect.apply(parseCacheKey, binding, [value5]).channelId; isRunning = value6.isRunning; if (!isRunning) { continue; } log_124839Binding = log_124839; binding = env0_0; log_124839Binding(binding.chatChannelId); binding.stopOne({key: value5, shouldDelete: false}); chatChannelId = env0_0.chatChannelId; if (channelId !== chatChannelId) { break; } log_124839Binding = log_124839; binding = env0_0; chatChannelId = binding.chatChannelId; log_124839Binding(chatChannelId); value7 = value6.clone({triggeredByStatusChange: false}); value7.start(); impressionCache = binding.impressionCache; impressionCache.set(value5, value7); break; } value8 = value3(); done = value8.done; if (done) { break; } r3 = value8; continue; } } } function refreshImpressions() { // fn#124856, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:5879, owner: QuestMobileEmbedVisibilityManager.refreshImpressions, offset: 0x025c56c3, size: 63 bytes, params: 1, frame: 10 var value2; if (env0_0.isChatViewable) { env0_0.updateImpressionsForChatBecameViewable(); } else { value2 = environment.__proto__.__proto__; log_124839(); env0_0.stopMany(); } } function checkChatViewable() { // fn#124857, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:5986, owner: QuestMobileEmbedVisibilityManager.checkChatViewable, offset: 0x025c5702, size: 67 bytes, params: 1, frame: 12 var r0; var value4; let binding = env0_0; const isChatViewable = binding.getIsChatViewable(); const value3 = isChatViewable !== binding.isChatViewable; if (value3) { value4 = environment.__proto__.__proto__; log_124839(); binding = env0_0; binding.isChatViewable = isChatViewable; binding.refreshImpressions(); r0 = true; } else { r0 = value3; } return r0; } function checkIsOnChannelNavigationRoute() { // fn#124858, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:6136, owner: QuestMobileEmbedVisibilityManager.checkIsOnChannelNavigationRoute, offset: 0x025c5745, size: 64 bytes, params: 1, frame: 11 var value2; let binding = env0_0; const isOnChannelNavigationRoute2 = binding.isOnChannelNavigationRoute(); if (isOnChannelNavigationRoute2 !== binding.wasOnChannelNavigationRoute) { value2 = environment.__proto__.__proto__; log_124839(); binding = env0_0; binding.checkChatViewable(); binding.wasOnChannelNavigationRoute = isOnChannelNavigationRoute2; } } function checkSearchShowing() { // fn#124859, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:6297, owner: QuestMobileEmbedVisibilityManager.checkSearchShowing, offset: 0x025c5785, size: 64 bytes, params: 1, frame: 11 var value2; let binding = env0_0; const isSearchShowing2 = binding.isSearchShowing(); if (isSearchShowing2 !== binding.wasSearchShowing) { value2 = environment.__proto__.__proto__; log_124839(); binding = env0_0; binding.checkChatViewable(); binding.wasSearchShowing = isSearchShowing2; } } function onChannelChanged(a0) { // fn#124860, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:6423, owner: QuestMobileEmbedVisibilityManager.onChannelChanged, offset: 0x025c57c5, size: 103 bytes, params: 2, frame: 14 const binding = env0_0; binding.previousChatChannelId = binding.chatChannelId; binding.chatChannelId = a0; const log_124839Binding = log_124839; binding.previousChatChannelId; log_124839Binding(binding.chatChannelId); binding.stopMany({shouldDeleteHiddenEmbeds: true}); if (!binding.checkChatViewable()) { env0_0.refreshImpressions(); } } function checkOpenModalKey() { // fn#124861, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:6641, owner: QuestMobileEmbedVisibilityManager.checkOpenModalKey, offset: 0x025c582c, size: 89 bytes, params: 1, frame: 13 var log_124839Binding; var binding; const openModalKey = (require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */).getOpenModalKey(); if (openModalKey !== env0_0.previouslyOpenModalKey) { log_124839Binding = log_124839; binding = env0_0; log_124839Binding(binding.previouslyOpenModalKey); binding.checkChatViewable(); binding.previouslyOpenModalKey = openModalKey; } } function handleQuestStoreChanged() { // fn#124862, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:6818, owner: QuestMobileEmbedVisibilityManager.handleQuestStoreChanged, offset: 0x025c5885, size: 483 bytes, params: 1, frame: 33 var r6; var r16; var isRunning; var value10; var binding; var cacheKey; var has; var questId; var get; var value11; var questStatuses; var property; var moduleValue; var questStatus; var isChatViewable; var value13; var value14; var value15; const log_124839Binding = log_124839; const value2 = undefined; log_124839Binding(); const quests = QuestStore.quests; const Set = global.Set; const set = new Set(quests.keys()); const _createForOfIteratorHelperLoose_124831Binding = _createForOfIteratorHelperLoose_124831; let impressionCache = env0_0.impressionCache; const value7 = _createForOfIteratorHelperLoose_124831Binding(impressionCache.keys()); const value8 = value7(); let done = value8.done; const value9 = null; if (!done) { r6 = value8; while (true) { value10 = r6.value; binding = env0_0; cacheKey = binding.parseCacheKey(value10); has = set.has; questId = cacheKey.questId; if (Reflect.apply(has, set, [questId])) { get = quests.get; questId = cacheKey.questId; value11 = Reflect.apply(get, quests, [questId]); questStatuses = env0_0.questStatuses; questId = cacheKey.questId; property = questStatuses[questId]; if (value9 == value11) { r16 = value9; continue; } moduleValue = require(7120) /* metro dependency 7120: AnalyticsTypes */; questStatus = moduleValue.getQuestStatus(value11); r16 = questStatus; if (r16 === property) { break; } binding = env0_0; questStatuses = binding.questStatuses; questId = cacheKey.questId; questStatuses[questId] = r16; isChatViewable = binding.isChatViewable; if (isChatViewable) { impressionCache = env0_0.impressionCache; value13 = impressionCache.get(value10); if (value9 == value13) { isRunning = value2; continue; } isRunning = value13.isRunning; if (isRunning !== true) { break; } if (value9 != value11) { value14 = value13.clone({triggeredByStatusChange: true}); value14.start(); impressionCache = env0_0.impressionCache; impressionCache.set(value10, value14); break; } binding = env0_0; binding.stopOne({key: value10, shouldDelete: true}); break; } break; } value15 = value7(); done = value15.done; if (done) { break; } r6 = value15; continue; } } return value2; } function QuestMobileEmbedVisibilityManagerHandleSelectedChannelStoreChanged() { // fn#124863, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:7397, owner: QuestMobileEmbedVisibilityManager.handleSelectedChannelStoreChanged, offset: 0x025c5a68, size: 238 bytes, params: 1, frame: 20 var r5; var getChannel; var value5; var value6; const ChannelTypes = (require(677) /* metro dependency 677: ChannelTypes */).ChannelTypes; var items2; var binding; let log_124839Binding = log_124839; const value2 = undefined; log_124839Binding(); const channelId = SelectedChannelStore.getChannelId(); let chatChannelId = env0_0.chatChannelId; if (channelId !== chatChannelId) { getChannel = ChannelStore.getChannel; chatChannelId = env0_0.chatChannelId; value5 = Reflect.apply(getChannel, ChannelStore, [chatChannelId]); value6 = (value5 == null ? value2 : value5.type) != null; if (value6) { items2 = [ChannelTypes.GUILD_STAGE_VOICE]; items2[1] = ChannelTypes.GUILD_VOICE; r5 = items2.includes(value5 == null ? value2 : value5.type); } else { r5 = value6; } chatChannelId = env0_0.chatChannelId; if (!(chatChannelId != null && r5)) { log_124839Binding = log_124839; binding = env0_0; log_124839Binding(binding.chatChannelId); binding.onChannelChanged(channelId); } } return value2; } function handleActionSheetStoreChanged() { // fn#124864, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:7739, owner: QuestMobileEmbedVisibilityManager.handleActionSheetStoreChanged, offset: 0x025c5b56, size: 74 bytes, params: 1, frame: 12 var binding; log_124839(); const isOpen2 = ActionSheetStore.isOpen(); if (isOpen2 !== env0_0.wasActionSheetOpen) { log_124839(); binding = env0_0; binding.checkChatViewable(); binding.wasActionSheetOpen = isOpen2; } } function handleAppStateStoreChanged() { // fn#124865, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:7876, owner: QuestMobileEmbedVisibilityManager.handleAppStateStoreChanged, offset: 0x025c5ba0, size: 110 bytes, params: 1, frame: 14 var binding; log_124839(); const state = AppStateStore.getState(); const AppStates = (require(676) /* metro dependency 676: ConstantsIOS */).AppStates; const ACTIVE = AppStates.ACTIVE; const value3 = state === ACTIVE; if (env0_0.wasAppActive !== value3) { log_124839(); binding = env0_0; binding.checkChatViewable(); binding.wasAppActive = value3; } } function handleVoicePanelStoreChanged() { // fn#124866, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:8034, owner: QuestMobileEmbedVisibilityManager.handleVoicePanelStoreChanged, offset: 0x025c5c0e, size: 84 bytes, params: 1, frame: 12 var binding; log_124839(); const isAnyVoicePanelOpen2 = VoicePanelStore.getState().isAnyVoicePanelOpen(); if (isAnyVoicePanelOpen2 !== env0_0.wasAnyVoicePanelOpen) { log_124839(); binding = env0_0; binding.checkChatViewable(); binding.wasAnyVoicePanelOpen = isAnyVoicePanelOpen2; } } function handleChannelDetailsStoreChanged() { // fn#124867, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:8205, owner: QuestMobileEmbedVisibilityManager.handleChannelDetailsStoreChanged, offset: 0x025c5c62, size: 21 bytes, params: 1, frame: 9 env0_0.checkSearchShowing(); } function handleChannelRTCStoreChanged() { // fn#124868, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:8265, owner: QuestMobileEmbedVisibilityManager.handleChannelRTCStoreChanged, offset: 0x025c5c77, size: 522 bytes, params: 1, frame: 32 var r10; var type; var r4; var r2; var value11; var getChannel; var value12; const ChannelTypes = (require(677) /* metro dependency 677: ChannelTypes */).ChannelTypes; var GUILD_STAGE_VOICE; var GUILD_VOICE; var includes; var property; var value13; var value14; var value15; var chatChannelId; var binding; var previousChatChannelId; var onChannelChanged; var checkChatViewable; const log_124839Binding = log_124839; const value2 = undefined; log_124839Binding(); const allChatOpen = ChannelRTCStore.getAllChatOpen(); const _createForOfIteratorHelperLoose_124831Binding = _createForOfIteratorHelperLoose_124831; const Set = global.Set; let Object = global.Object; const keys = Object.keys; let channelsWithChatOpen = env0_0.channelsWithChatOpen; const value5 = Reflect.apply(keys, Object, [channelsWithChatOpen]); let object = []; const value6 = arraySpread(object, value5, 0, undefined); Object = global.Object; arraySpread(object, Object.keys(allChatOpen), value6, undefined); const value7 = Object.create(Set.prototype, {constructor: {value: Set}}); const set = new Set(object); const value9 = _createForOfIteratorHelperLoose_124831Binding(set instanceof Object ? set : value7); const value10 = value9(); let done = value10.done; if (!done) { r10 = value10; reducibleLoop1: while (true) { value11 = r10.value; getChannel = ChannelStore.getChannel; value12 = Reflect.apply(getChannel, ChannelStore, [value11]); reducibleJoin3: while (true) { if (value12 == null) { type = value2; break reducibleJoin3; } type = value12.type; break reducibleJoin3; } if (type != null) { GUILD_STAGE_VOICE = ChannelTypes.GUILD_STAGE_VOICE; object = [GUILD_STAGE_VOICE]; GUILD_VOICE = ChannelTypes.GUILD_VOICE; object[1] = GUILD_VOICE; includes = object.includes; reducibleJoin6: while (true) { if (value12 == null) { type = value2; break reducibleJoin6; } type = value12.type; break reducibleJoin6; } reducibleJoin10: while (true) { if (Reflect.apply(includes, object, [type])) { channelsWithChatOpen = env0_0.channelsWithChatOpen; property = channelsWithChatOpen[value11]; value13 = property != null; r4 = value13 && property; property = allChatOpen[value11]; value14 = property != null; r2 = value14 && property; if (r4 !== r2) { reducibleJoin18: while (true) { reducibleJoin16: while (true) { if (r2) { chatChannelId = env0_0.chatChannelId; if (value11 !== chatChannelId) { binding = env0_0; binding.onChannelChanged(value11); break reducibleJoin18; } if (r2) { break reducibleJoin16; } binding = env0_0; previousChatChannelId = binding.previousChatChannelId; chatChannelId = binding.chatChannelId; if (previousChatChannelId === chatChannelId) { break reducibleJoin16; } binding = env0_0; onChannelChanged = binding.onChannelChanged; previousChatChannelId = binding.previousChatChannelId; Reflect.apply(onChannelChanged, binding, [previousChatChannelId]); break reducibleJoin18; } if (r2) { break reducibleJoin16; } binding = env0_0; previousChatChannelId = binding.previousChatChannelId; chatChannelId = binding.chatChannelId; if (previousChatChannelId === chatChannelId) { break reducibleJoin16; } binding = env0_0; onChannelChanged = binding.onChannelChanged; previousChatChannelId = binding.previousChatChannelId; Reflect.apply(onChannelChanged, binding, [previousChatChannelId]); break reducibleJoin18; } binding = env0_0; checkChatViewable = binding.checkChatViewable; Reflect.apply(checkChatViewable, binding, []); break reducibleJoin18; } break reducibleLoop1; } break reducibleJoin10; } break reducibleJoin10; } } value15 = value9(); done = value15.done; if (done) { break reducibleLoop1; } r10 = value15; continue reducibleLoop1; } } binding = env0_0; object = {}; copyDataProperties(object, allChatOpen, value6); binding.channelsWithChatOpen = object; return value2; } function QuestMobileEmbedVisibilityManagerHandleNavigationStateChanged() { // fn#124869, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:8928, owner: QuestMobileEmbedVisibilityManager.handleNavigationStateChanged, offset: 0x025c5e81, size: 42 bytes, params: 1, frame: 10 log_124839(); const binding = env0_0; binding.checkIsOnChannelNavigationRoute(); binding.checkOpenModalKey(); } function handleAlertStoreChanged() { // fn#124870, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:9024, owner: QuestMobileEmbedVisibilityManager.handleAlertStoreChanged, offset: 0x025c5eab, size: 132 bytes, params: 1, frame: 13 var r1; var useAlertStore; var binding; const value3 = AlertStore.getAlert() != null; if (value3) { r1 = value3; } else { useAlertStore = (require(4497) /* metro dependency 4497: useAlertStoreNative */).useAlertStore; r1 = useAlertStore.getState().alerts.length > 0; } if (r1 !== env0_0.wasAlertOpen) { log_124839(); binding = env0_0; binding.checkChatViewable(); binding.wasAlertOpen = r1; } } function _fun124844(a0, a1) { // fn#124844, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:2709, offset: 0x025c4e43, size: 141 bytes, params: 3, frame: 16 var code; var binding; var push; var binding2; const type = a0.type; const CodedLinkType = (require(4101) /* metro dependency 4101: CodedLink */).CodedLinkType; const QUESTS_EMBED = CodedLinkType.QUESTS_EMBED; if (type === QUESTS_EMBED) { code = a0.code; binding = env0_2; if (!binding.has(code)) { binding = env0_1; push = binding.push; binding2 = env0_0; Reflect.apply(push, binding, [{questId: code, questContentPosition: a1, messageId: binding2.id, channelId: binding2.channel_id}]); binding = env0_2; binding.add(code); } } } function _fun124849(a0) { // fn#124849, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16361:4178, offset: 0x025c5259, size: 23 bytes, params: 2, frame: 11 return env1_0.getCacheKey(a0); }