/* Metro module 15124; source: components_native/AutoAnalytics.tsx; dependencies: [6, 7, 15, 17, 18, 31, 4606, 1382, 4257, 4117, 1384, 1379, 1945, 1867, 4259, 4401, 4294, 1934, 3969, 6876, 4864, 1878, 661, 1386, 1880, 33, 4863, 7163, 15125, 4878, 6892, 683, 1360, 15126, 11250, 1900, 11236, 566, 15127, 15128, 2] */ function _fun115289(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#115289, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15321:6, offset: 0x0245b474, size: 593 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importDefault(6) /* metro dependency 6 */; const env0_4 = importDefault(7) /* metro dependency 7 */; const env0_5 = importDefault(15) /* metro dependency 15 */; const env0_6 = importDefault(17) /* metro dependency 17 */; const env0_7 = importDefault(18) /* metro dependency 18 */; const value = importAll(31) /* metro dependency 31 */; const channelRTCStore = importDefault(4606) /* metro dependency 4606: ChannelRTCStore */; const favoriteStore = importDefault(1382) /* metro dependency 1382: FavoriteStore */; const gatewayConnectionStore = importDefault(4257) /* metro dependency 4257: GatewayConnectionStore */; const guildScheduledEventStore = importDefault(4117) /* metro dependency 4117: GuildScheduledEventStore */; const stageInstanceStore = importDefault(1384) /* metro dependency 1384: StageInstanceStore */; const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */; const guildMemberStore = importDefault(1945) /* metro dependency 1945: GuildMemberStore */; const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */; const mediaEngineStore = importDefault(4259) /* metro dependency 4259: MediaEngineStore */; const networkStore = importDefault(4401) /* metro dependency 4401: NetworkStore */; const rtcConnectionStore = importDefault(4294) /* metro dependency 4294: RTCConnectionStore */; const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */; const selectedGuildStore = importDefault(3969) /* metro dependency 3969: SelectedGuildStore */; const selfPresenceStore = importDefault(6876) /* metro dependency 6876: SelfPresenceStore */; const userGuildSettingsStore = importDefault(4864) /* metro dependency 4864: UserGuildSettingsStore */; const userStore = importDefault(1878) /* metro dependency 1878: UserStore */; const constantsModule = require(661) /* metro dependency 661: Constants */; const env0_24 = constantsModule.AnalyticEvents; const env0_25 = constantsModule.ActivityTypes; const env0_26 = constantsModule.GuildFeatures; const env0_27 = (require(1386) /* metro dependency 1386: ChannelConstants */).isStaticChannelRoute; const env0_28 = (require(1880) /* metro dependency 1880: PremiumConstants */).PremiumTypes; const env0_29 = (require(33) /* metro dependency 33 */).jsx; const PureComponent = value.PureComponent; const env0_30 = _fun115293(PureComponent); (require(2) /* metro dependency 2 */).fileFinishedImporting('components_native/AutoAnalytics.tsx'); exports.default = ConnectedAutoAnalytics; } function _isNativeReflectConstruct_115290() { // fn#115290, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15321:467, offset: 0x0245b6c5, 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_115290_isNativeReflectConstruct = function() { return !!result; })(); } function _fun115293(a0) { // fn#115293, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15321:666, offset: 0x0245b727, size: 224 bytes, params: 2, frame: 16 const closure = AutoAnalytics; env0_7(closure, a0); return env0_4(closure, [{key: 'componentDidMount', value: value_115295}, {key: 'componentDidUpdate', value: value_115296}, {key: 'trackFavoritesGuildViewed', value: value_115297}, {key: 'getGameMetadata', value: function() { var props = this.props; return {game_platform: props.gamePlatform, game_name: props.gameName, game_id: props.gameId}; }}, {key: '_trackWithMetadata', value: value_115299}, {key: 'collectDefaultAnalyticsMetadata', value: function(a0, a1) { var r3; var object = {guild_id: a0}; var value = null; if (value != a1) { var isStaticChannelRouteBinding = isStaticChannelRoute; var value3 = undefined; if (isStaticChannelRouteBinding(a1)) { object.channel_static_route = a1; return object; } var value4 = ChannelStore.getChannel(a1); object.channel_id = a1; r3 = value == value4 ? value3 : value4.type; object.channel_type = value != r3 ? r3 : value; } return object; }}, {key: 'render', value: function() { return null; }}]); } function ConnectedAutoAnalytics() { // fn#115302, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15321:5526, offset: 0x0245c233, size: 925 bytes, params: 1, frame: 31 const value2 = undefined; const fluxModule = require(566) /* metro dependency 566: flux */; const useStateFromStores = fluxModule.useStateFromStores; const value4 = fluxModule.useStateFromStores([ChannelStore], _fun115304, [Reflect.apply(useStateFromStores, fluxModule, [[SelectedChannelStore], function() { return SelectedChannelStore.getVoiceChannelId(); }, []])]); const channelId = fluxModule.useStateFromStores([SelectedChannelStore], function() { return SelectedChannelStore.getChannelId(undefined, false); }); const value5 = fluxModule.useStateFromStores([ChannelStore], function() { return ChannelStore.getChannel(channelId); }, [channelId]); const value6 = null; const nsfw = value6 == value5 ? value2 : value5.nsfw; const value7 = fluxModule.useStateFromStores([ChannelRTCStore], _fun115307, [channelId]); const value8 = fluxModule.useStateFromStores([SelfPresenceStore], function() { return SelfPresenceStore.findActivity(_fun115309); }, []); const value9 = fluxModule.useStateFromStores([SelectedGuildStore], function() { return SelectedGuildStore.getGuildId(); }, []); const value10 = fluxModule.useStateFromStores([GuildStore], _fun115311, [value9]); return ((Component) => )(env0_30); } function AutoAnalytics() { // fn#115294, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15321:678, offset: 0x0245b807, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_3(this, AutoAnalytics); const value3 = env1_6(AutoAnalytics); return env1_5(this, _isNativeReflectConstruct_115290() ? global.Reflect.construct(value3, arguments, env1_6(this).constructor) : value3.apply(this, arguments)); } function value_115295() { // fn#115295, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15321:968, offset: 0x0245b878, size: 433 bytes, params: 1, frame: 27 var r17; var r4; var _trackWithMetadata; var value; var CHANNEL_OPENED; var object2; var moduleValue; var moduleValue2; var GUILD_VIEWED; const props = this.props; const selectedChannelId = props.selectedChannelId; const selectedGuildId = props.selectedGuildId; const isMemberPending = props.isMemberPending; const hasPreviewEnabled = props.hasPreviewEnabled; const postableChannelCount = props.postableChannelCount; if (selectedChannelId != null) { _trackWithMetadata = this._trackWithMetadata; value = environment.__proto__; CHANNEL_OPENED = AnalyticEvents.CHANNEL_OPENED; object2 = {}; moduleValue = require(4863) /* metro dependency 4863: AppAnalyticsUtils */; copyDataProperties(object2, moduleValue.getChannelOpenedMetadata(selectedChannelId), moduleValue); object2['selected_guild_id'] = selectedGuildId; Reflect.apply(_trackWithMetadata, this, [CHANNEL_OPENED, object2]); (importDefault(7163) /* metro dependency 7163: trackChannelOpenedClickstream */)({channelId: selectedChannelId}); if (props.isTextInVoice) { moduleValue2 = require(4863) /* metro dependency 4863: AppAnalyticsUtils */; moduleValue2.trackWithMetadata(AnalyticEvents.TEXT_IN_VOICE_OPENED, {channel_is_nsfw: props.isNSFWChannel}); r17 = moduleValue; } else { r17 = moduleValue; } } if (selectedGuildId != null) { r4 = isMemberPending ? {is_pending: isMemberPending, preview_enabled: hasPreviewEnabled} : {}; _trackWithMetadata = this._trackWithMetadata; value = environment.__proto__; GUILD_VIEWED = AnalyticEvents.GUILD_VIEWED; object2 = {}; copyDataProperties(object2, r4, r17); object2['postable_channels'] = postableChannelCount; object2['viewing_all_channels'] = !UserGuildSettingsStore.isOptInEnabled(selectedGuildId); value = require(15125) /* metro dependency 15125: GuildThemeAnalyticsUtils */; copyDataProperties(object2, value.collectGuildThemeAnalyticsMetadata(selectedGuildId), r17); Reflect.apply(_trackWithMetadata, this, [GUILD_VIEWED, object2]); value = require(4878) /* metro dependency 4878: Clickstream */; value.trackClickstream(AnalyticEvents.GUILD_VIEWED_CLICKSTREAM, {guild_id: selectedGuildId}); value = require(6892) /* metro dependency 6892: FavoritesUtils */; if (value.isFavoritesGuildId(selectedGuildId)) { this.trackFavoritesGuildViewed(); } } } function value_115296(a0) { // fn#115296, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15321:1736, offset: 0x0245ba29, size: 1578 bytes, params: 2, frame: 37 var r20; var id; var r4; var voiceChannelId3; var value; var value2; var value3; var value4; var lastRTCConnectionState; var value6; var defaultImport; var track; var LEAVE_VOICE_CHANNEL; var object; var moduleValue; var stageInstanceByChannel; var activeEventByChannel; var value9; var defaultImport2; var JOIN_VOICE_CHANNEL; var filter; const isNotNullish = (require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish; var value11; var defaultImport3; var VIDEO_INPUT_TOGGLED; var _trackWithMetadata; var CHANNEL_OPENED; var moduleValue2; var moduleValue3; var moduleValue4; var moduleValue5; var GUILD_VIEWED; const {voiceChannelId, voiceChannelGuildId, voiceChannelType, voiceChannelBitrate, videoEnabled, selectedChannelId, selectedGuildId, isNSFWChannel, isMemberPending, hasPreviewEnabled, isScreenSharing, postableChannelCount, isTextInVoice} = this.props; if (a0.voiceChannelId !== voiceChannelId) { voiceChannelId3 = a0.voiceChannelId; value = null; if (value != voiceChannelId3) { value2 = environment.__proto__; value3 = StageInstanceStore.getStageInstanceByChannel(a0.voiceChannelId); value4 = GuildScheduledEventStore.getActiveEventByChannel(a0.voiceChannelId); lastRTCConnectionState = RTCConnectionStore.getLastRTCConnectionState(); value6 = undefined; r20 = (value == lastRTCConnectionState ? value6 : lastRTCConnectionState.channelId) === a0.voiceChannelId ? lastRTCConnectionState : value; defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */; track = defaultImport.track; LEAVE_VOICE_CHANNEL = AnalyticEvents.LEAVE_VOICE_CHANNEL; object = {}; object.channel_id = a0.voiceChannelId; object.channel_type = a0.voiceChannelType; object.channel_bitrate = a0.voiceChannelBitrate; object.guild_id = a0.voiceChannelGuildId; object.rtc_connection_id = value == r20 ? value6 : r20.rtcConnectionId; object.duration = value == r20 ? value6 : r20.duration; object.media_session_id = value == r20 ? value6 : r20.mediaSessionId; id = value == value3 ? value6 : value3.id; object.stage_instance_id = id; id = value == value4 ? value6 : value4.id; object.guild_scheduled_event_id = id; moduleValue = require(4863) /* metro dependency 4863: AppAnalyticsUtils */; copyDataProperties(object, moduleValue.getVoiceStateMetadata(a0.voiceChannelGuildId, a0.voiceChannelId, a0.videoEnabled), undefined); copyDataProperties(object, this.getGameMetadata(), undefined); copyDataProperties(object, value == r20 || value == r20.voiceStateAnalytics ? value6 : r20.voiceStateAnalytics.getStats(), undefined); Reflect.apply(track, defaultImport, [LEAVE_VOICE_CHANNEL, object]); } } if (a0.voiceChannelId !== voiceChannelId) { if (voiceChannelId != null) { value = environment.__proto__; stageInstanceByChannel = StageInstanceStore.getStageInstanceByChannel(voiceChannelId); activeEventByChannel = GuildScheduledEventStore.getActiveEventByChannel(voiceChannelId); value9 = undefined; defaultImport2 = importDefault(683) /* metro dependency 683: AnalyticsUtils */; track = defaultImport2.track; JOIN_VOICE_CHANNEL = AnalyticEvents.JOIN_VOICE_CHANNEL; object = {channel_id: voiceChannelId, channel_type: voiceChannelType, channel_bitrate: voiceChannelBitrate, guild_id: voiceChannelGuildId}; object.connection_type = NetworkStore.getType(); object.effective_connection_speed = NetworkStore.getEffectiveConnectionSpeed(); object.service_provider = NetworkStore.getServiceProvider(); id = stageInstanceByChannel == null ? value9 : stageInstanceByChannel.id; object.stage_instance_id = id; id = activeEventByChannel == null ? value9 : activeEventByChannel.id; object.guild_scheduled_event_id = id; object.join_voice_id = RTCConnectionStore.getJoinVoiceId(); value = require(4863) /* metro dependency 4863: AppAnalyticsUtils */; copyDataProperties(object, value.getVoiceStateMetadata(voiceChannelGuildId, voiceChannelId, videoEnabled), undefined); copyDataProperties(object, this.getGameMetadata(), undefined); Reflect.apply(track, defaultImport2, [JOIN_VOICE_CHANNEL, object]); } } if (a0.videoEnabled !== videoEnabled) { value = null; if (value != voiceChannelId) { object = [isScreenSharing ? 'screen' : value]; object[1] = videoEnabled ? 'camera' : value; filter = object.filter; value = environment.__proto__; value11 = Reflect.apply(filter, object, [isNotNullish]); r20 = isScreenSharing ? 'screen' : videoEnabled ? 'camera' : 'none'; defaultImport3 = importDefault(683) /* metro dependency 683: AnalyticsUtils */; track = defaultImport3.track; VIDEO_INPUT_TOGGLED = AnalyticEvents.VIDEO_INPUT_TOGGLED; object = {video_input_type: r20, enabled_inputs: value11, channel_id: voiceChannelId, channel_type: voiceChannelType, guild_id: voiceChannelGuildId}; copyDataProperties(object, this.getGameMetadata(), undefined); value = require(4863) /* metro dependency 4863: AppAnalyticsUtils */; copyDataProperties(object, value.collectVoiceAnalyticsMetadata(voiceChannelId), undefined); Reflect.apply(track, defaultImport3, [VIDEO_INPUT_TOGGLED, object]); } } else if (a0.isScreenSharing !== isScreenSharing) { value = null; if (value != voiceChannelId) { object = [isScreenSharing ? 'screen' : value]; object[1] = videoEnabled ? 'camera' : value; filter = object.filter; value = environment.__proto__; value11 = Reflect.apply(filter, object, [isNotNullish]); r20 = isScreenSharing ? 'screen' : videoEnabled ? 'camera' : 'none'; defaultImport3 = importDefault(683) /* metro dependency 683: AnalyticsUtils */; track = defaultImport3.track; VIDEO_INPUT_TOGGLED = AnalyticEvents.VIDEO_INPUT_TOGGLED; object = {video_input_type: r20, enabled_inputs: value11, channel_id: voiceChannelId, channel_type: voiceChannelType, guild_id: voiceChannelGuildId}; copyDataProperties(object, this.getGameMetadata(), undefined); value = require(4863) /* metro dependency 4863: AppAnalyticsUtils */; copyDataProperties(object, value.collectVoiceAnalyticsMetadata(voiceChannelId), undefined); Reflect.apply(track, defaultImport3, [VIDEO_INPUT_TOGGLED, object]); } } value = selectedChannelId == null; if (!(value || a0.selectedChannelId === selectedChannelId && a0.selectedGuildId === selectedGuildId)) { _trackWithMetadata = this._trackWithMetadata; value = environment.__proto__; CHANNEL_OPENED = AnalyticEvents.CHANNEL_OPENED; object = {}; moduleValue2 = require(15126) /* metro dependency 15126: getChannelOpenedRouteTrackingProps */; copyDataProperties(object, moduleValue2.getChannelOpenedRouteTrackingProps(selectedChannelId), undefined); moduleValue3 = require(4863) /* metro dependency 4863: AppAnalyticsUtils */; copyDataProperties(object, moduleValue3.getChannelOpenedMetadata(selectedChannelId), undefined); object['selected_guild_id'] = selectedGuildId; Reflect.apply(_trackWithMetadata, this, [CHANNEL_OPENED, object]); (importDefault(7163) /* metro dependency 7163: trackChannelOpenedClickstream */)({channelId: selectedChannelId}); if (isTextInVoice) { moduleValue4 = require(4863) /* metro dependency 4863: AppAnalyticsUtils */; moduleValue4.trackWithMetadata(AnalyticEvents.TEXT_IN_VOICE_OPENED, {channel_is_nsfw: isNSFWChannel}); } } if (isTextInVoice && !a0.isTextInVoice) { value = environment.__proto__; moduleValue5 = require(4863) /* metro dependency 4863: AppAnalyticsUtils */; moduleValue5.trackWithMetadata(AnalyticEvents.TEXT_IN_VOICE_OPENED, {channel_is_nsfw: isNSFWChannel}); } if (selectedGuildId != null) { if (a0.selectedGuildId !== selectedGuildId) { r4 = isMemberPending ? {is_pending: isMemberPending, preview_enabled: hasPreviewEnabled} : {}; _trackWithMetadata = this._trackWithMetadata; value = environment.__proto__; GUILD_VIEWED = AnalyticEvents.GUILD_VIEWED; object = {}; copyDataProperties(object, r4, undefined); object['postable_channels'] = postableChannelCount; object['viewing_all_channels'] = !UserGuildSettingsStore.isOptInEnabled(selectedGuildId); value = require(15125) /* metro dependency 15125: GuildThemeAnalyticsUtils */; copyDataProperties(object, value.collectGuildThemeAnalyticsMetadata(selectedGuildId), undefined); Reflect.apply(_trackWithMetadata, this, [GUILD_VIEWED, object]); value = require(4878) /* metro dependency 4878: Clickstream */; value.trackClickstream(AnalyticEvents.GUILD_VIEWED_CLICKSTREAM, {guild_id: selectedGuildId}); value = require(6892) /* metro dependency 6892: FavoritesUtils */; if (value.isFavoritesGuildId(selectedGuildId)) { this.trackFavoritesGuildViewed(); } } else if (isMemberPending) { if (!a0.isMemberPending) { r4 = isMemberPending ? {is_pending: isMemberPending, preview_enabled: hasPreviewEnabled} : {}; _trackWithMetadata = this._trackWithMetadata; value = environment.__proto__; GUILD_VIEWED = AnalyticEvents.GUILD_VIEWED; object = {}; copyDataProperties(object, r4, undefined); object['postable_channels'] = postableChannelCount; object['viewing_all_channels'] = !UserGuildSettingsStore.isOptInEnabled(selectedGuildId); value = require(15125) /* metro dependency 15125: GuildThemeAnalyticsUtils */; copyDataProperties(object, value.collectGuildThemeAnalyticsMetadata(selectedGuildId), undefined); Reflect.apply(_trackWithMetadata, this, [GUILD_VIEWED, object]); value = require(4878) /* metro dependency 4878: Clickstream */; value.trackClickstream(AnalyticEvents.GUILD_VIEWED_CLICKSTREAM, {guild_id: selectedGuildId}); value = require(6892) /* metro dependency 6892: FavoritesUtils */; if (value.isFavoritesGuildId(selectedGuildId)) { this.trackFavoritesGuildViewed(); } } } } } function value_115297() { // fn#115297, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15321:4567, offset: 0x0245c053, size: 159 bytes, params: 1, frame: 20 const value = environment.__proto__; const FavoritesGuildExperiment = (require(11250) /* metro dependency 11250: FavoritesGuildExperiment */).FavoritesGuildExperiment; const getConfig = FavoritesGuildExperiment.getConfig; const enabled = Reflect.apply(getConfig, FavoritesGuildExperiment, [{location: 'AutoAnalytics'}]).enabled; const defaultImport = importDefault(1900) /* metro dependency 1900: PremiumTypeUtils */; const isPremiumExactly = defaultImport.isPremiumExactly; const currentUser = UserStore.getCurrentUser(); const TIER_2 = PremiumTypes.TIER_2; const isPremiumExactly2 = Reflect.apply(isPremiumExactly, defaultImport, [currentUser, TIER_2]); const favoritesAnalyticsModule = require(11236) /* metro dependency 11236: FavoritesAnalytics */; favoritesAnalyticsModule.trackFavoritesGuildViewed('manual_browsing', FavoriteStore.getFavoritesCount(), enabled, isPremiumExactly2); } function value_115299(a0) { // fn#115299, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15321:4969, offset: 0x0245c11f, size: 177 bytes, params: 2, frame: 19 var object2; var defaultImport; let value = a1; const r3 = value !== undefined ? value : {}; const {connected, selectedGuildId, selectedChannelId} = this.props; value = environment.__proto__; if (connected) { (require(4863) /* metro dependency 4863: AppAnalyticsUtils */).trackWithMetadata(a0, r3); } else { defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */; if (!defaultImport.isThrottled(a0)) { object2 = {}; copyDataProperties(object2, r3, this); copyDataProperties(object2, this.collectDefaultAnalyticsMetadata(selectedGuildId, selectedChannelId), this); (importDefault(683) /* metro dependency 683: AnalyticsUtils */).track(a0, object2); } } } function _fun115307() { // fn#115307, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15321:5878, offset: 0x0245c630, size: 40 bytes, params: 1, frame: 12 return channelId != null && ChannelRTCStore.getChatOpen(channelId); } function _fun115308() { // fn#115308, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15321:5949, offset: 0x0245c658, size: 29 bytes, params: 1, frame: 11 return SelfPresenceStore.findActivity(function({type}) { return type === ActivityTypes.PLAYING; }); } function _fun115311() { // fn#115311, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15321:6092, offset: 0x0245c6a3, size: 27 bytes, params: 1, frame: 11 return GuildStore.getGuild(env0_2); } function _fun115313() { // fn#115313, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15321:6214, offset: 0x0245c6be, size: 89 bytes, params: 1, frame: 15 var isPending; var value4; var value; let r0 = env0_3 != null && env0_2 != null; if (r0) { value4 = environment.__proto__; value = GuildMemberStore.getMember(env0_2, env0_3.id); isPending = value?.isPending; value = isPending != null; r0 = value && isPending; } return r0; }