2026-07-25 08:10:48 +00:00
// Module ID: 4325
2026-07-27 11:26:19 +00:00
// Function ID: 37894
2026-07-20 16:05:17 +00:00
// Name: _createForOfIteratorHelperLoose
2026-07-25 08:10:48 +00:00
// Dependencies: [1352, 1194, 1348, 1908, 4052, 1918, 1911, 1838, 4178, 3759, 4218, 4203, 4143, 3768, 1907, 3948, 4326, 1850, 4147, 653, 1355, 3764, 483, 4328, 675, 664, 4329, 4333, 22, 2]
2026-07-20 16:05:17 +00:00
// Exports: collectChannelAnalyticsMetadataFromId, collectVoiceAnalyticsMetadata, getChannelOpenedMetadata, getCustomStatusMetadata, trackWithMetadata
2026-07-25 08:10:48 +00:00
// Module 4325 (_createForOfIteratorHelperLoose)
2026-07-23 10:11:24 +00:00
import { THREAD_CHANNEL_TYPES } from "_callSuper" ;
import closure_5 from "_isNativeReflectConstruct" ;
import closure_6 from "_isNativeReflectConstruct" ;
import _isNativeReflectConstruct from "_isNativeReflectConstruct" ;
import closure_9 from "_isNativeReflectConstruct" ;
import closure_10 from "_isNativeReflectConstruct" ;
import closure_11 from "_isNativeReflectConstruct" ;
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose" ;
import closure_13 from "_createForOfIteratorHelperLoose" ;
import closure_14 from "_isNativeReflectConstruct" ;
import closure_15 from "_isNativeReflectConstruct" ;
import closure_16 from "_isNativeReflectConstruct" ;
import closure_17 from "_isNativeReflectConstruct" ;
import closure_18 from "_isNativeReflectConstruct" ;
import closure_19 from "_isNativeReflectConstruct" ;
import closure_20 from "_isNativeReflectConstruct" ;
import closure_21 from "_isNativeReflectConstruct" ;
import closure_22 from "_isNativeReflectConstruct" ;
import closure_23 from "_isNativeReflectConstruct" ;
import closure_24 from "_isNativeReflectConstruct" ;
import ME from "ME" ;
import { isStaticChannelRoute } from "set" ;
let closure_25 ;
let closure_26 ;
let closure_27 ;
let closure_28 ;
let closure_7 ;
let closure_8 ;
function _createForOfIteratorHelperLoose ( iterable ) {
let closure_0 = iterable ;
iterable = "undefined" !== typeof Symbol ;
if ( iterable ) {
2026-07-20 16:05:17 +00:00
const _Symbol = Symbol ;
2026-07-23 10:11:24 +00:00
iterable = iterable [ Symbol . iterator ] ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if ( ! iterable ) {
iterable = iterable [ Symbol . iterator ] ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if ( iterable ) {
const iter = iterable . call ( iterable ) ;
2026-07-20 16:05:17 +00:00
const next = iter . next ;
return next . bind ( iter ) ;
} else {
const _Array = Array ;
2026-07-23 10:11:24 +00:00
let tmp = iterable ;
if ( ! Array . isArray ( iterable ) ) {
2026-07-20 16:05:17 +00:00
let tmp2 ;
2026-07-23 10:11:24 +00:00
if ( iterable ) {
if ( "string" === typeof iterable ) {
tmp2 = _arrayLikeToArray ( iterable , undefined ) ;
2026-07-20 16:05:17 +00:00
} else {
const toString = { } . toString ;
2026-07-23 10:11:24 +00:00
const substr = toString . call ( iterable ) . slice ( 8 , - 1 ) ;
2026-07-20 16:05:17 +00:00
let name = substr ;
if ( tmp3 ) {
2026-07-23 10:11:24 +00:00
name = iterable . constructor . name ;
2026-07-20 16:05:17 +00:00
}
if ( "Map" !== name ) {
if ( "Set" !== name ) {
if ( "Arguments" === name ) {
2026-07-23 10:11:24 +00:00
let arr = _arrayLikeToArray ( iterable , undefined ) ;
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
let obj = /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/ ;
2026-07-20 16:05:17 +00:00
}
}
tmp2 = arr ;
}
const _Array2 = Array ;
2026-07-23 10:11:24 +00:00
arr = Array . from ( iterable ) ;
const callResult = toString . call ( iterable ) ;
tmp3 = "Object" === substr && iterable . constructor ;
2026-07-20 16:05:17 +00:00
}
}
tmp = tmp2 ;
if ( ! tmp2 ) {
const _TypeError = TypeError ;
const typeError = new TypeError ( "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) ;
throw typeError ;
}
}
if ( tmp ) {
2026-07-23 10:11:24 +00:00
closure_0 = tmp ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let c1 = 0 ;
2026-07-20 16:05:17 +00:00
return ( ) = > {
2026-07-23 10:11:24 +00:00
if ( closure_1 >= length . length ) {
2026-07-20 16:05:17 +00:00
let obj = { done : true } ;
} else {
obj = { done : false } ;
closure_1 = tmp3 + 1 ;
2026-07-23 10:11:24 +00:00
obj . value = length [ + closure_1 ] ;
2026-07-20 16:05:17 +00:00
}
return obj ;
} ;
}
}
function _arrayLikeToArray ( arg0 , arg1 ) {
let length ;
if ( tmp ) {
length = arg0 . length ;
}
const ArrayResult = Array ( length ) ;
for ( let num = 0 ; num < length ; num = num + 1 ) {
ArrayResult [ num ] = arg0 [ num ] ;
}
return ArrayResult ;
}
function countKeys ( voiceStates ) {
let num = 0 ;
let num2 = 0 ;
const keys = Object . keys ( ) ;
if ( keys !== undefined ) {
num2 = num ;
while ( keys [ tmp ] !== undefined ) {
num = num + 1 ;
2026-07-23 10:11:24 +00:00
continue ;
2026-07-20 16:05:17 +00:00
}
}
return num2 ;
}
function collectGuildAnalyticsMetadata ( guildId ) {
if ( null == guildId ) {
return null ;
} else {
const guild = store2 . getGuild ( guildId ) ;
if ( null == guild ) {
return null ;
} else {
2026-07-23 10:11:24 +00:00
numRoles = numRoles . getNumRoles ( guild . id ) ;
member = member . getMember ( guildId , id . getId ( ) ) ;
channels = channels . getChannels ( guildId ) ;
2026-07-20 16:05:17 +00:00
const obj = { guild_id : guild.id } ;
const voiceStates = store4 . getVoiceStates ( guildId ) ;
obj . guild_size_total = memberCount . getMemberCount ( guildId ) ;
obj . guild_num_channels = channels [ closure_7 ] . length + channels [ closure_8 ] . length ;
obj . guild_num_text_channels = channels [ closure_7 ] . length ;
obj . guild_num_voice_channels = channels [ closure_8 ] . length ;
obj . guild_num_roles = numRoles ;
let num = 0 ;
if ( null != member ) {
num = member . roles . length ;
}
obj . guild_member_num_roles = num ;
let NONE = store3 . getGuildPermissions ( guild ) ;
if ( null == NONE ) {
2026-07-25 08:10:48 +00:00
NONE = importAll ( 3764 ) . NONE ;
2026-07-20 16:05:17 +00:00
}
obj . guild_member_perms = String ( NONE ) ;
const features = guild . features ;
obj . guild_is_vip = features . has ( constants . VIP_REGIONS ) ;
obj . is_member = null != member ;
obj . num_voice_channels_active = countKeys ( voiceStates ) ;
return obj ;
}
}
}
function collectStaticChannelRouteAnalyticsMetadata ( arg0 , channel_id ) {
return { channel_static_route : channel_id , channel_hidden : false } ;
}
function collectChannelAnalyticsMetadata ( channel ) {
function isHidden ( channel ) {
if ( null == guildId ) {
return false ;
} else if ( null == channel ) {
return false ;
} else {
let hasItem = null != tmp2 ;
if ( hasItem ) {
2026-07-23 10:11:24 +00:00
hasItem = outer1_2 ( outer1_3 [ 22 ] ) . has ( tmp2 . deny , outer1_27 . VIEW_CHANNEL ) ;
const obj = outer1_2 ( outer1_3 [ 22 ] ) ;
2026-07-20 16:05:17 +00:00
}
return hasItem ;
}
}
if ( null == channel ) {
return null ;
} else {
const guildId = channel . getGuildId ( ) ;
if ( null == guildId ) {
2026-07-23 10:11:24 +00:00
let obj = { } ;
2026-07-20 16:05:17 +00:00
( { id : obj.channel_id , type : obj . channel_type } = channel ) ;
let num = 0 ;
if ( channel . isPrivate ( ) ) {
num = channel . recipients . length ;
}
obj . channel_size_total = num ;
if ( null == guildId ) {
2026-07-25 08:10:48 +00:00
let NONE = importAll ( 3764 ) . NONE ;
2026-07-20 16:05:17 +00:00
} else {
NONE = store3 . getChannelPermissions ( channel ) ;
}
obj . channel_member_perms = String ( NONE ) ;
obj . channel_hidden = false ;
return obj ;
} else {
if ( ! THREAD_CHANNEL_TYPES . has ( channel . type ) ) {
let isHiddenResult = isHidden ( channel ) ;
}
isHiddenResult = isHidden ( store . getChannel ( channel . parent_id ) ) ;
}
}
}
function trackWithMetadata ( TEXT_AREA_CTA_CLICKED , trackWithMetadataResult , hasItem ) {
let obj = trackWithMetadataResult ;
let flag = hasItem ;
if ( trackWithMetadataResult === undefined ) {
obj = { } ;
}
if ( flag === undefined ) {
flag = false ;
}
let num = 24 ;
if ( ! obj2 . isThrottled ( TEXT_AREA_CTA_CLICKED ) ) {
let tmp2 = ! tmp ;
if ( "location" in obj ) {
tmp2 = obj . location !== constants2 . GUILD_CREATE_INVITE_SUGGESTION ;
}
if ( "guild_id" in obj ) {
let guild_id = obj . guild_id ;
} else {
guild_id = null ;
if ( tmp2 ) {
guild_id = guildId . getGuildId ( ) ;
}
}
if ( "channel_id" in obj ) {
let channel_id = obj . channel_id ;
} else {
channel_id = null ;
if ( tmp2 ) {
channel_id = channelId . getChannelId ( guild_id ) ;
}
}
const channel = store . getChannel ( channel_id ) ;
if ( null == channel ) {
let tmp15 = null ;
if ( null != guild_id ) {
tmp15 = guild_id ;
}
let tmp11 = tmp15 ;
} else {
tmp11 = null ;
if ( ! channel . isPrivate ( ) ) {
2026-07-23 10:11:24 +00:00
guildId = channel . getGuildId ( ) ;
2026-07-20 16:05:17 +00:00
let tmp13 = guild_id ;
if ( null != guildId ) {
tmp13 = guildId ;
}
let tmp14 = null ;
if ( null != tmp13 ) {
tmp14 = tmp13 ;
}
tmp11 = tmp14 ;
}
}
obj = { } ;
const merged = Object . assign ( obj ) ;
const merged1 = Object . assign ( collectGuildAnalyticsMetadata ( tmp11 ) ) ;
if ( null != guild_id ) {
if ( null != channel_id ) {
const merged2 = Object . assign ( tmp24 ) ;
num = importDefault ( dependencyMap [ num ] ) ;
obj = { flush : flag } ;
num . track ( TEXT_AREA_CTA_CLICKED , obj , obj ) ;
}
2026-07-23 10:11:24 +00:00
tmp24 = collectStaticChannelRouteAnalyticsMetadata ( 0 , channel_id ) ;
2026-07-20 16:05:17 +00:00
}
tmp24 = collectChannelAnalyticsMetadata ( channel ) ;
}
}
function getRecipientFriendCounts ( recipients ) {
let iter3 ;
const tmp = _createForOfIteratorHelperLoose ( recipients ) ;
const iter = tmp ( ) ;
let iter2 = iter ;
let num = 0 ;
let num2 = 0 ;
if ( ! iter . done ) {
do {
2026-07-23 10:11:24 +00:00
let tmp2 = friend ;
2026-07-20 16:05:17 +00:00
let sum = num ;
2026-07-23 10:11:24 +00:00
if ( friend . isFriend ( iter2 . value ) ) {
2026-07-20 16:05:17 +00:00
sum = num + 1 ;
}
iter3 = tmp ( ) ;
num = sum ;
iter2 = iter3 ;
num2 = sum ;
} while ( ! iter3 . done ) ;
}
const obj = { friendCount : num2 , nonFriendCount : recipients.length - num2 } ;
return obj ;
}
function getVoiceStateMetadata ( guildId , channelId , videoEnabled ) {
2026-07-23 10:11:24 +00:00
let closure_0 = channelId ;
const obj = { voice_state_count : 0 , video_stream_count : 0 , video_enabled : videoEnabled } ;
const tmp = obj ( 22 ) ;
const found = obj ( 22 ) ( store4 . getVoiceStates ( guildId ) ) . filter ( ( channelId ) = > channelId . channelId === closure_0 ) ;
const found1 = found . filter ( ( userId ) = > userId . userId !== outer1_5 . getId ( ) ) ;
2026-07-20 16:05:17 +00:00
const item = found1 . forEach ( ( selfVideo ) = > {
obj . voice_state_count = obj . voice_state_count + 1 ;
if ( tmp ) {
obj . video_stream_count = obj . video_stream_count + 1 ;
}
} ) ;
return obj ;
}
2026-07-23 10:11:24 +00:00
( { GUILD_SELECTABLE_CHANNELS_KEY : closure_7 , GUILD_VOCAL_CHANNELS_KEY : closure_8 } = _isNativeReflectConstruct ) ;
( { GuildFeatures : closure_25 , AnalyticsLocations : closure_26 , Permissions : closure_27 , ActivityTypes : closure_28 } = ME ) ;
const result = require ( "_isNativeReflectConstruct" ) . fileFinishedImporting ( "modules/app_analytics/AppAnalyticsUtils.tsx" ) ;
2026-07-20 16:05:17 +00:00
export default { trackWithMetadata , getVoiceStateMetadata } ;
export { collectGuildAnalyticsMetadata } ;
export { collectStaticChannelRouteAnalyticsMetadata } ;
export const collectChannelAnalyticsMetadataFromId = function collectChannelAnalyticsMetadataFromId ( channelId ) {
if ( null == channelId ) {
return null ;
} else {
const channel = store . getChannel ( channelId ) ;
let tmp3 = null ;
if ( null != channel ) {
tmp3 = collectChannelAnalyticsMetadata ( channel ) ;
}
return tmp3 ;
}
} ;
export { collectChannelAnalyticsMetadata } ;
export const collectVoiceAnalyticsMetadata = function collectVoiceAnalyticsMetadata ( id ) {
if ( null == id ) {
return null ;
} else {
const channel = store . getChannel ( id ) ;
if ( null == channel ) {
return null ;
} else {
const obj = { } ;
( { id : obj2.channel_id , type : obj2 . channel_type } = channel ) ;
2026-07-23 10:11:24 +00:00
mediaSessionId = mediaSessionId . getMediaSessionId ( ) ;
2026-07-20 16:05:17 +00:00
obj . guild_id = channel . getGuildId ( ) ;
obj . media_session_id = mediaSessionId ;
const merged = Object . assign ( getVoiceStateMetadata ( channel . getGuildId ( ) , channel . id , videoEnabled . isVideoEnabled ( ) ) ) ;
const isVideoEnabledResult = videoEnabled . isVideoEnabled ( ) ;
2026-07-25 08:10:48 +00:00
const merged1 = Object . assign ( require ( 4328 ) /* getVoiceAnalyticsMetadataAdditional */ . getVoiceAnalyticsMetadataAdditional ( ) ) ;
2026-07-20 16:05:17 +00:00
return obj ;
}
}
} ;
export { trackWithMetadata } ;
export const getChannelOpenedMetadata = function getChannelOpenedMetadata ( selectedChannelId ) {
if ( isStaticChannelRoute ( selectedChannelId ) ) {
let obj = { channel_static_route : selectedChannelId } ;
return obj ;
} else {
const channel = store . getChannel ( selectedChannelId ) ;
if ( null == channel ) {
obj = { channel_id : selectedChannelId } ;
return obj ;
} else {
const guild = store2 . getGuild ( channel . guild_id ) ;
if ( null == guild ) {
let flag = false ;
if ( channel . isDM ( ) ) {
2026-07-23 10:11:24 +00:00
user = user . getUser ( channel . recipients [ 0 ] ) ;
2026-07-20 16:05:17 +00:00
flag = false ;
if ( null != user ) {
flag = user . bot ;
}
}
if ( channel . isDM ( ) ) {
let tmp5 = getRecipientFriendCounts ( channel . recipients ) ;
} else {
tmp5 = null ;
}
const obj1 = { channel_id : selectedChannelId , is_app_dm : flag } ;
let tmp7 = null ;
if ( null != tmp5 ) {
( { friendCount : obj3.friend_recipient_count , nonFriendCount : obj3.non_friend_recipient_count } = tmp5 ) ;
tmp7 = { } ;
const obj2 = { } ;
}
const merged = Object . assign ( tmp7 ) ;
return obj1 ;
} else {
2026-07-23 10:11:24 +00:00
snapshot = snapshot . getSnapshot ( selectedChannelId , 10 * importDefault ( 664 ) . Millis . SECOND ) ;
2026-07-20 16:05:17 +00:00
const obj3 = { channel_id : selectedChannelId } ;
( { unread : obj6.channel_was_unread , mentionCount : obj6.channel_mention_count } = snapshot ) ;
obj3 . channel_is_muted = closure_22 . isChannelMuted ( channel . guild_id , channel . id ) ;
obj3 . channel_is_nsfw = channel . isNSFW ( ) ;
obj3 . channel_is_spoiler = channel . isSpoilerChannel ( ) ;
obj3 . channel_resolved_unread_setting = closure_22 . resolveUnreadSetting ( channel ) ;
const unreadSetting = closure_22 . resolveUnreadSetting ( channel ) ;
2026-07-25 08:10:48 +00:00
obj3 . channel_preset = require ( 4329 ) /* Presets */ . presetFromSettings ( unreadSetting , closure_22 . resolvedMessageNotifications ( channel ) ) ;
2026-07-20 16:05:17 +00:00
obj3 . guild_id = channel . guild_id ;
( { guildUnread : obj6.guild_was_unread , guildMentionCount : obj6.guild_mention_count } = snapshot ) ;
obj3 . guild_is_muted = closure_22 . isMuted ( channel . guild_id ) ;
obj3 . guild_resolved_unread_setting = closure_22 . resolveGuildUnreadSetting ( guild ) ;
2026-07-25 08:10:48 +00:00
const obj7 = require ( 4329 ) /* Presets */ ;
2026-07-20 16:05:17 +00:00
const guildUnreadSetting = closure_22 . resolveGuildUnreadSetting ( guild ) ;
2026-07-25 08:10:48 +00:00
obj3 . guild_preset = require ( 4329 ) /* Presets */ . presetFromSettings ( guildUnreadSetting , closure_22 . getMessageNotifications ( channel . guild_id ) ) ;
2026-07-20 16:05:17 +00:00
( { parent_id : obj6.parent_id , parentChannelThreadType : obj6.parent_channel_type } = channel ) ;
2026-07-25 08:10:48 +00:00
const obj8 = require ( 4329 ) /* Presets */ ;
obj3 . has_pending_member_action = require ( 4333 ) /* hasPendingMemberAction */ . hasPendingMemberAction ( channel . guild_id , selectedChannelId ) ;
2026-07-20 16:05:17 +00:00
obj3 . can_send_message = store3 . can ( constants3 . SEND_MESSAGES , channel ) ;
obj3 . is_app_dm = false ;
return obj3 ;
}
}
}
} ;
export { getRecipientFriendCounts } ;
export { getVoiceStateMetadata } ;
2026-07-23 10:11:24 +00:00
export const getCustomStatusMetadata = function getCustomStatusMetadata ( closure_0 ) {
closure_0 = arg1 ;
2026-07-20 16:05:17 +00:00
const obj = { custom_status_count : 0 } ;
2026-07-23 10:11:24 +00:00
let tmp = obj ( 22 ) ;
const item = obj ( 22 ) ( store4 . getVoiceStates ( closure_0 ) ) . forEach ( ( channelId ) = > {
let tmp = channelId . channelId === closure_0 ;
2026-07-20 16:05:17 +00:00
if ( tmp ) {
2026-07-23 10:11:24 +00:00
tmp = null != outer1_16 . findActivity ( channelId . userId , ( type ) = > type . type === outer2_28 . CUSTOM_STATUS ) ;
2026-07-20 16:05:17 +00:00
}
if ( tmp ) {
obj . custom_status_count = obj . custom_status_count + 1 ;
}
} ) ;
return obj ;
} ;