2026-07-23 10:11:24 +00:00
// Module ID: 6753
// Function ID: 52556
2026-07-20 16:05:17 +00:00
// Name: _createForOfIteratorHelperLoose
2026-07-23 10:11:24 +00:00
// Dependencies: [1352, 4468, 4566, 653, 482, 6754, 1881, 6755, 483, 22, 44, 24, 4324, 2]
2026-07-20 16:05:17 +00:00
// Exports: allChannelsSentinel, applicationPermissionsList, buildApplicationCommands, canUseApplicationCommands, extractInteractionDataProps, getApplicationCommandOptionQueryOptions, getApplicationCommandSection, getCommandAttachmentDraftType, getCommandTriggerSection, getInitialInteractionMetadata, getMatchingGroupCommands, hasAccess, hasCommandIndexForApp, isSnowflake, trackCommandSelected
2026-07-23 10:11:24 +00:00
// Module 6753 (_createForOfIteratorHelperLoose)
import { isReadableType } from "_callSuper" ;
import { DraftType } from "_isNativeReflectConstruct" ;
import TRUE_OPTION_NAME from "TRUE_OPTION_NAME" ;
import ME from "ME" ;
import { Permissions } from "sum" ;
import deserializeResult from "_callSuper" ;
import importAllResult from "fromHexReverseArray" ;
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
let closure_6 ;
let closure_7 ;
let closure_8 ;
let closure_9 ;
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 buildCommand ( arg0 ) {
let applicationId ;
let command ;
let rootCommand ;
let subCommandPath ;
let useKeyedPermissions ;
( { rootCommand , command , subCommandPath } = arg0 ) ;
2026-07-23 10:11:24 +00:00
let obj ;
2026-07-20 16:05:17 +00:00
let tmp = null != rootCommand . permissions ;
( { applicationId , useKeyedPermissions } = arg0 ) ;
if ( tmp ) {
tmp = rootCommand . permissions . length > 0 ;
}
if ( ! tmp ) {
let items = subCommandPath ;
if ( null == subCommandPath ) {
items = [ ] ;
}
const mapped = items . map ( ( name ) = > name . name ) ;
let items1 = subCommandPath ;
if ( null == subCommandPath ) {
items1 = [ ] ;
}
const mapped1 = items1 . map ( ( displayName ) = > displayName . displayName ) ;
2026-07-23 10:11:24 +00:00
obj = { } ;
2026-07-20 16:05:17 +00:00
( { version : obj3.version , guild_id : obj3.guildId } = rootCommand ) ;
const items2 = [ rootCommand . id ] ;
HermesBuiltin . arraySpread ( mapped , 1 ) ;
obj . id = items2 . join ( closure_7 ) ;
const items3 = [ rootCommand . name ] ;
HermesBuiltin . arraySpread ( mapped , 1 ) ;
obj . untranslatedName = items3 . join ( " " ) ;
obj . serverLocalizedName = command . name_localized ;
obj . applicationId = applicationId ;
let CHAT = rootCommand . type ;
if ( null == CHAT ) {
2026-07-23 10:11:24 +00:00
CHAT = obj ( 1881 ) . ApplicationCommandType . CHAT ;
2026-07-20 16:05:17 +00:00
}
obj . type = CHAT ;
2026-07-23 10:11:24 +00:00
obj . inputType = obj ( 6755 ) . ApplicationCommandInputType . BOT ;
2026-07-20 16:05:17 +00:00
obj . untranslatedDescription = command . description ;
obj . options = mapOptions ( command . options ) ;
obj . rootCommand = rootCommand ;
obj . subCommandPath = subCommandPath ;
let deserializeResult ;
if ( null != rootCommand . default_member_permissions ) {
2026-07-23 10:11:24 +00:00
deserializeResult = importAll ( 483 ) . deserialize ( rootCommand . default_member_permissions ) ;
const obj4 = importAll ( 483 ) ;
2026-07-20 16:05:17 +00:00
}
obj . defaultMemberPermissions = deserializeResult ;
obj . dmPermission = rootCommand . dm_permission ;
obj . permissions = undefined ;
let name = rootCommand . name_localized ;
if ( null == name ) {
name = rootCommand . name ;
}
const items4 = [ name ] ;
HermesBuiltin . arraySpread ( mapped1 , 1 ) ;
obj . displayName = items4 . join ( " " ) ;
let description = command . description_localized ;
if ( null == description ) {
description = command . description ;
}
obj . displayDescription = description ;
( { nsfw : obj3.nsfw , contexts : obj3.contexts , integration_types : obj3.integration_types , global_popularity_rank : obj3.global_popularity_rank , handler : obj3.handler } = rootCommand ) ;
return obj ;
} else if ( useKeyedPermissions ) {
2026-07-23 10:11:24 +00:00
const keyPermissionsResult = obj ( 6754 ) . keyPermissions ( rootCommand . permissions ) ;
obj = keyPermissionsResult ;
2026-07-20 16:05:17 +00:00
obj = keyPermissionsResult ;
2026-07-23 10:11:24 +00:00
const obj2 = obj ( 6754 ) ;
2026-07-20 16:05:17 +00:00
} else {
obj = { } ;
const permissions = rootCommand . permissions ;
const item = permissions . forEach ( ( id ) = > {
obj [ id . id ] = id ;
} ) ;
}
}
function mapOptions ( options ) {
let mapped ;
if ( null != options ) {
mapped = options . map ( ( choices ) = > {
let name_localized ;
let obj = { } ;
2026-07-23 10:11:24 +00:00
let merged = Object . assign ( choices ) ;
2026-07-20 16:05:17 +00:00
choices = choices . choices ;
let mapped ;
if ( null != choices ) {
mapped = choices . map ( ( name_localized ) = > {
const obj = { } ;
const merged = Object . assign ( name_localized ) ;
let name = name_localized . name_localized ;
if ( null == name ) {
name = name_localized . name ;
}
obj [ "displayName" ] = name ;
return obj ;
} ) ;
}
obj [ "choices" ] = mapped ;
2026-07-23 10:11:24 +00:00
obj [ "options" ] = outer1_15 ( choices . options ) ;
2026-07-20 16:05:17 +00:00
( { name_localized : obj [ "serverLocalizedName" ] , name_localized } = choices ) ;
if ( null == name_localized ) {
name_localized = choices . name ;
}
obj [ "displayName" ] = name_localized ;
let description = choices . description_localized ;
if ( null == description ) {
description = choices . description ;
}
obj [ "displayDescription" ] = description ;
2026-07-23 10:11:24 +00:00
if ( choices . type === outer1_0 ( outer1_3 [ 6 ] ) . ApplicationCommandOptionType . CHANNEL ) {
2026-07-20 16:05:17 +00:00
if ( "channel_types" in choices ) {
obj = { } ;
const merged1 = Object . assign ( obj ) ;
obj [ "channelTypes" ] = choices . channel_types ;
}
return obj ;
}
2026-07-23 10:11:24 +00:00
if ( choices . type === outer1_0 ( outer1_3 [ 6 ] ) . ApplicationCommandOptionType . NUMBER ) {
2026-07-20 16:05:17 +00:00
obj = { } ;
const merged2 = Object . assign ( obj ) ;
obj [ "minValue" ] = choices . min_value ;
obj [ "maxValue" ] = choices . max_value ;
}
2026-07-23 10:11:24 +00:00
if ( choices . type !== outer1_0 ( outer1_3 [ 6 ] ) . ApplicationCommandOptionType . STRING ) {
2026-07-20 16:05:17 +00:00
let tmp10 = obj ;
2026-07-23 10:11:24 +00:00
if ( choices . type === outer1_0 ( outer1_3 [ 6 ] ) . ApplicationCommandOptionType . ATTACHMENT ) {
2026-07-20 16:05:17 +00:00
tmp10 = obj ;
if ( "file_types" in choices ) {
const obj1 = { } ;
const merged3 = Object . assign ( obj ) ;
obj1 [ "fileTypes" ] = choices . file_types ;
tmp10 = obj1 ;
}
}
}
const obj2 = { } ;
const merged4 = Object . assign ( obj ) ;
obj2 [ "minLength" ] = choices . min_length ;
obj2 [ "maxLength" ] = choices . max_length ;
tmp10 = obj2 ;
} ) ;
}
return mapped ;
}
function buildSubCommands ( arg0 ) {
let applicationId ;
let command ;
let rootCommand ;
let subCommandPath ;
let useKeyedPermissions ;
( { rootCommand , command , applicationId , subCommandPath , useKeyedPermissions } = arg0 ) ;
if ( command . hasOwnProperty ( "id" ) ) {
let obj = { rootCommand , command , applicationId , subCommandPath , useKeyedPermissions } ;
const items = [ buildCommand ( obj ) ] ;
return items ;
2026-07-23 10:11:24 +00:00
} else if ( command . type !== require ( 1881 ) /* PermissionOverwriteType */ . ApplicationCommandOptionType . SUB_COMMAND ) {
if ( command . type !== require ( 1881 ) /* PermissionOverwriteType */ . ApplicationCommandOptionType . SUB_COMMAND_GROUP ) {
2026-07-20 16:05:17 +00:00
obj = { rootCommand , command , applicationId , subCommandPath , useKeyedPermissions } ;
const items1 = [ buildCommand ( obj ) ] ;
return items1 ;
}
}
const items2 = [ ] ;
if ( null == command . options ) {
return items2 ;
} else {
const options = command . options ;
2026-07-23 10:11:24 +00:00
const found = options . filter ( ( type ) = > type . type === outer1_0 ( outer1_3 [ 6 ] ) . ApplicationCommandOptionType . SUB_COMMAND_GROUP ) ;
2026-07-20 16:05:17 +00:00
for ( let num4 = 0 ; num4 < found . length ; num4 = num4 + 1 ) {
let push = items2 . push ;
obj = { rootCommand , command : found [ num4 ] , applicationId } ;
let items3 = subCommandPath ;
let tmp6 = buildSubCommands ;
if ( null == subCommandPath ) {
items3 = [ ] ;
}
let obj1 = { name : found [ num4 ] . name } ;
let tmp7 = require ;
let tmp8 = dependencyMap ;
2026-07-23 10:11:24 +00:00
obj1 . type = require ( 1881 ) /* PermissionOverwriteType */ . ApplicationCommandOptionType . SUB_COMMAND_GROUP ;
2026-07-20 16:05:17 +00:00
let name = found [ num4 ] . name_localized ;
if ( null == name ) {
name = found [ num4 ] . name ;
}
obj1 . displayName = name ;
let items4 = [ obj1 ] ;
obj . subCommandPath = items3 . concat ( items4 ) ;
obj . useKeyedPermissions = useKeyedPermissions ;
let items5 = [ ] ;
let tmp9 = items5 ;
let num3 = 0 ;
let arraySpreadResult = HermesBuiltin . arraySpread ( tmp6 ( obj ) , 0 ) ;
let tmp11 = push ;
let tmp12 = items5 ;
let tmp13 = items2 ;
let applyResult = HermesBuiltin . apply ( items5 , items2 ) ;
}
const options1 = command . options ;
2026-07-23 10:11:24 +00:00
const found1 = options1 . filter ( ( type ) = > type . type === outer1_0 ( outer1_3 [ 6 ] ) . ApplicationCommandOptionType . SUB_COMMAND ) ;
2026-07-20 16:05:17 +00:00
for ( let num5 = 0 ; num5 < found1 . length ; num5 = num5 + 1 ) {
let obj2 = { rootCommand , command : found1 [ num5 ] , applicationId } ;
let items6 = subCommandPath ;
let tmp15 = buildCommand ;
if ( null == subCommandPath ) {
items6 = [ ] ;
}
let obj3 = { name : found1 [ num5 ] . name } ;
let tmp16 = require ;
let tmp17 = dependencyMap ;
2026-07-23 10:11:24 +00:00
obj3 . type = require ( 1881 ) /* PermissionOverwriteType */ . ApplicationCommandOptionType . SUB_COMMAND ;
2026-07-20 16:05:17 +00:00
let name2 = found1 [ num5 ] . name_localized ;
if ( null == name2 ) {
name2 = found1 [ num5 ] . name ;
}
obj3 . displayName = name2 ;
let items7 = [ obj3 ] ;
obj2 . subCommandPath = items6 . concat ( items7 ) ;
obj2 . useKeyedPermissions = useKeyedPermissions ;
let arr = items2 . push ( tmp15 ( obj2 ) ) ;
}
if ( tmp19 ) {
const obj4 = { rootCommand , command , applicationId , subCommandPath , useKeyedPermissions } ;
items2 . push ( buildCommand ( obj4 ) ) ;
}
return items2 ;
}
}
function hasAccessGivenPerms ( selfMember , id , commandLevelPermissions ) {
2026-07-23 10:11:24 +00:00
const obj = require ( 6754 ) /* toPermissionKey */ ;
const tmp = commandLevelPermissions [ obj . toPermissionKey ( obj , selfMember . userId , require ( undefined , 6755 ) /* ApplicationCommandSectionType */ . ApplicationCommandPermissionType . USER ) ] ;
if ( null != tmp ) {
2026-07-20 16:05:17 +00:00
return tmp . permission ;
} else {
const tmp11 = _createForOfIteratorHelperLoose ( selfMember . roles ) ;
const iter3 = tmp11 ( ) ;
let iter2 = iter3 ;
let flag = false ;
let flag2 = false ;
if ( ! iter3 . done ) {
while ( true ) {
let tmp2 = require ;
let tmp3 = dependencyMap ;
2026-07-23 10:11:24 +00:00
let obj2 = require ( 6754 ) /* toPermissionKey */ ;
let tmp4 = commandLevelPermissions [ obj2 . toPermissionKey ( obj2 , iter2 . value , require ( undefined , 6755 ) /* ApplicationCommandSectionType */ . ApplicationCommandPermissionType . ROLE ) ] ;
2026-07-20 16:05:17 +00:00
if ( null != tmp4 ) {
flag = true ;
if ( tmp4 . permission ) {
break ;
}
}
let iter = tmp11 ( ) ;
iter2 = iter ;
flag2 = flag ;
}
return true ;
}
if ( flag2 ) {
return false ;
} else {
2026-07-23 10:11:24 +00:00
const obj3 = require ( 6754 ) /* toPermissionKey */ ;
const tmp8 = commandLevelPermissions [ obj3 . toPermissionKey ( obj3 , id , require ( undefined , 6755 ) /* ApplicationCommandSectionType */ . ApplicationCommandPermissionType . ROLE ) ] ;
2026-07-20 16:05:17 +00:00
let permission = null ;
2026-07-23 10:11:24 +00:00
if ( null != tmp8 ) {
2026-07-20 16:05:17 +00:00
permission = tmp8 . permission ;
}
return permission ;
}
}
}
2026-07-23 10:11:24 +00:00
( { BuiltInSectionId : closure_6 , SUB_COMMAND_KEY_SEPARATOR : closure_7 } = TRUE_OPTION_NAME ) ;
( { AnalyticEvents : closure_8 , ID_REGEX : closure_9 } = ME ) ;
let result = require ( "TRUE_OPTION_NAME" ) . fileFinishedImporting ( "modules/application_commands/ApplicationCommandUtils.tsx" ) ;
2026-07-20 16:05:17 +00:00
export { buildCommand } ;
export const buildApplicationCommands = function buildApplicationCommands ( application_commands , arg1 ) {
2026-07-23 10:11:24 +00:00
let closure_0 = arg1 ;
return importDefault ( 22 ) . flatMap ( application_commands , ( id ) = > {
outer1_1 ( outer1_3 [ 10 ] ) ( null != id . id , "Missing command id" ) ;
return outer1_16 ( { rootCommand : id , command : id , applicationId : id.application_id , subCommandPath : undefined , useKeyedPermissions : closure_0 } ) ;
2026-07-20 16:05:17 +00:00
} ) ;
} ;
export const applicationPermissionsList = function applicationPermissionsList ( arr ) {
let reduced ;
if ( null != arr ) {
reduced = arr . reduce ( ( arr , applicationCommandPermissions ) = > {
if ( null != applicationCommandPermissions . applicationCommandPermissions ) {
const obj = { } ;
( { id : obj.id , applicationCommandPermissions : obj.permissions } = applicationCommandPermissions ) ;
arr . push ( obj ) ;
}
return arr ;
} , [ ] ) ;
}
return reduced ;
} ;
export const isSnowflake = function isSnowflake ( text ) {
return regex . test ( text . trim ( ) ) ;
} ;
export const getMatchingGroupCommands = function getMatchingGroupCommands ( contextCommands , regExp , closure_3 , arg3 ) {
2026-07-23 10:11:24 +00:00
let closure_0 = regExp ;
2026-07-20 16:05:17 +00:00
const importDefault = closure_3 ;
const items = [ ] ;
2026-07-23 10:11:24 +00:00
const item = importDefault ( 22 ) ( contextCommands ) . forEach ( ( displayName ) = > {
let isMatch = regex . test ( displayName . displayName ) ;
2026-07-20 16:05:17 +00:00
if ( isMatch ) {
let predicateResult = null == displayName . predicate ;
if ( ! predicateResult ) {
2026-07-23 10:11:24 +00:00
predicateResult = displayName . predicate ( closure_1 ) ;
2026-07-20 16:05:17 +00:00
}
isMatch = predicateResult ;
}
if ( isMatch ) {
items . push ( displayName ) ;
}
} ) ;
return items . slice ( 0 , arg3 ) ;
} ;
export const getApplicationCommandOptionQueryOptions = function getApplicationCommandOptionQueryOptions ( activeOption ) {
2026-07-23 10:11:24 +00:00
const tmp = activeOption . type === require ( 1881 ) /* PermissionOverwriteType */ . ApplicationCommandOptionType . STRING ;
let tmp3 = activeOption . type === require ( 1881 ) /* PermissionOverwriteType */ . ApplicationCommandOptionType . USER ;
2026-07-20 16:05:17 +00:00
if ( ! tmp3 ) {
2026-07-23 10:11:24 +00:00
tmp3 = activeOption . type === require ( 1881 ) /* PermissionOverwriteType */ . ApplicationCommandOptionType . MENTIONABLE ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let tmp6 = activeOption . type === require ( 1881 ) /* PermissionOverwriteType */ . ApplicationCommandOptionType . ROLE ;
2026-07-20 16:05:17 +00:00
if ( ! tmp6 ) {
2026-07-23 10:11:24 +00:00
tmp6 = activeOption . type === require ( 1881 ) /* PermissionOverwriteType */ . ApplicationCommandOptionType . MENTIONABLE ;
2026-07-20 16:05:17 +00:00
}
const obj = { } ;
let tmp9 = tmp ;
if ( ! tmp ) {
tmp9 = tmp6 ;
}
obj . canMentionEveryone = tmp9 ;
obj . canMentionHere = tmp ;
let tmp10 = tmp ;
if ( ! tmp ) {
tmp10 = tmp2 ;
}
obj . canMentionChannels = tmp10 ;
let tmp11 = tmp ;
if ( ! tmp ) {
tmp11 = tmp3 ;
}
obj . canMentionUsers = tmp11 ;
let tmp12 = tmp ;
if ( ! tmp ) {
tmp12 = tmp6 ;
}
obj . canMentionRoles = tmp12 ;
obj . canMentionAnyGuildUser = tmp3 ;
obj . canMentionNonMentionableRoles = tmp6 ;
obj . canMentionOtherGlobals = tmp ;
return obj ;
} ;
export const allChannelsSentinel = function allChannelsSentinel ( guild_id ) {
2026-07-23 10:11:24 +00:00
const obj = importDefault ( 24 ) ( guild_id ) ;
return importDefault ( 24 ) ( guild_id ) . subtract ( 1 ) . toString ( ) ;
2026-07-20 16:05:17 +00:00
} ;
export const canUseApplicationCommands = function canUseApplicationCommands ( can , arg1 , isMultiUserDM ) {
let tmp = ! arg1 ;
if ( tmp ) {
const tmp2 = ! isMultiUserDM . isMultiUserDM ( ) ;
if ( ! tmp2 ) {
tmp = ! tmp2 ;
} else if ( isMultiUserDM . isDM ( ) ) {
let canResult = ! isMultiUserDM . isSystemDM ( ) ;
} else if ( isMultiUserDM . isArchivedLockedThread ( ) ) {
2026-07-23 10:11:24 +00:00
canResult = can . can ( importAll ( 483 ) . combine ( Permissions . USE_APPLICATION_COMMANDS , Permissions . MANAGE_THREADS ) , isMultiUserDM ) ;
const obj2 = importAll ( 483 ) ;
2026-07-20 16:05:17 +00:00
} else {
const tmp4 = ! isReadableType ( isMultiUserDM . type ) ;
canResult = ! tmp4 ;
if ( ! tmp4 ) {
2026-07-23 10:11:24 +00:00
canResult = can . can ( importAll ( 483 ) . combine ( Permissions . USE_APPLICATION_COMMANDS , Permissions . SEND_MESSAGES ) , isMultiUserDM ) ;
const obj = importAll ( 483 ) ;
2026-07-20 16:05:17 +00:00
}
}
}
return tmp ;
} ;
export const DISABLED_BY_DEFAULT_PERMISSION_FLAG = deserializeResult ;
export const hasAccess = function hasAccess ( arg0 ) {
let PermissionStore ;
let commandLevelPermissions ;
let defaultMemberPermissions ;
let guild ;
let selfMember ;
( { PermissionStore , guild , selfMember , commandLevelPermissions , defaultMemberPermissions } = arg0 ) ;
if ( guild . ownerId !== selfMember . userId ) {
if ( ! PermissionStore . can ( Permissions . ADMINISTRATOR , guild ) ) {
const id = guild . id ;
if ( null != commandLevelPermissions ) {
const tmp4 = hasAccessGivenPerms ( selfMember , id , commandLevelPermissions ) ;
if ( "boolean" === typeof tmp4 ) {
return tmp4 ;
}
}
const tmp6 = hasAccessGivenPerms ( selfMember , id , tmp ) ;
let tmp8 = ! tmp7 ;
if ( ! ( "boolean" === typeof tmp6 && ! tmp6 ) ) {
let tmp9 = null == defaultMemberPermissions ;
if ( ! tmp9 ) {
2026-07-23 10:11:24 +00:00
const obj = importAll ( 483 ) ;
tmp9 = ! importAll ( 483 ) . equals ( defaultMemberPermissions , closure_11 ) && PermissionStore . can ( defaultMemberPermissions , guild ) ;
const tmp13 = ! importAll ( 483 ) . equals ( defaultMemberPermissions , closure_11 ) && PermissionStore . can ( defaultMemberPermissions , guild ) ;
2026-07-20 16:05:17 +00:00
}
tmp8 = tmp9 ;
}
return tmp8 ;
}
}
return true ;
} ;
export const getCommandAttachmentDraftType = function getCommandAttachmentDraftType ( commandOrigin ) {
2026-07-23 10:11:24 +00:00
if ( require ( 6755 ) /* ApplicationCommandSectionType */ . CommandOrigin . CHAT === commandOrigin ) {
2026-07-20 16:05:17 +00:00
return DraftType . SlashCommand ;
} else {
return DraftType . ApplicationLauncherCommand ;
}
} ;
export const getCommandTriggerSection = function getCommandTriggerSection ( closure_3 ) {
if ( null != closure_3 ) {
if ( closure_3 . id === constants . BUILT_IN ) {
2026-07-23 10:11:24 +00:00
let APP = require ( 6755 ) /* ApplicationCommandSectionType */ . ApplicationCommandTriggerSections . BUILT_IN ;
2026-07-20 16:05:17 +00:00
} else if ( closure_3 . id === constants . FRECENCY ) {
2026-07-23 10:11:24 +00:00
APP = require ( 6755 ) /* ApplicationCommandSectionType */ . ApplicationCommandTriggerSections . FRECENCY ;
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
APP = require ( 6755 ) /* ApplicationCommandSectionType */ . ApplicationCommandTriggerSections . APP ;
2026-07-20 16:05:17 +00:00
}
return APP ;
}
} ;
export const getApplicationCommandSection = function getApplicationCommandSection ( application , arg1 , arg2 ) {
let name = arg2 ;
2026-07-23 10:11:24 +00:00
const obj = { type : require ( 6755 ) /* ApplicationCommandSectionType */ . ApplicationCommandSectionType . APPLICATION , id : application.id } ;
2026-07-20 16:05:17 +00:00
if ( null == arg2 ) {
let username ;
if ( null != application ) {
const bot = application . bot ;
if ( null != bot ) {
username = bot . username ;
}
}
name = username ;
}
if ( null == name ) {
name = application . name ;
}
obj . name = name ;
obj . icon = application . icon ;
obj . application = application ;
obj . isUserApp = null != arg1 && arg1 ;
return obj ;
} ;
export const extractInteractionDataProps = function extractInteractionDataProps ( parsed ) {
let id ;
let options ;
( { id , options } = parsed ) ;
let found ;
if ( null != options ) {
2026-07-23 10:11:24 +00:00
found = options . find ( ( type ) = > type . type === outer1_0 ( outer1_3 [ 6 ] ) . ApplicationCommandOptionType . SUB_COMMAND_GROUP ) ;
2026-07-20 16:05:17 +00:00
}
let sum = id ;
if ( null != found ) {
const _HermesInternal = HermesInternal ;
sum = id + "" + closure_7 + found . name ;
options = found . options ;
}
let found1 ;
if ( null != options ) {
2026-07-23 10:11:24 +00:00
found1 = options . find ( ( type ) = > type . type === outer1_0 ( outer1_3 [ 6 ] ) . ApplicationCommandOptionType . SUB_COMMAND ) ;
2026-07-20 16:05:17 +00:00
}
let sum1 = sum ;
if ( null != found1 ) {
const _HermesInternal2 = HermesInternal ;
sum1 = sum + "" + closure_7 + found1 . name ;
options = found1 . options ;
}
const obj = { commandKey : sum1 , interactionOptions : options } ;
return obj ;
} ;
export const trackCommandSelected = function trackCommandSelected ( command ) {
let _location ;
let query ;
let queryLength ;
let searchResultsPosition ;
let sectionName ;
let source ;
let triggerSection ;
command = command . command ;
( { location : _location , triggerSection , queryLength , sectionName , query , searchResultsPosition , source } = command ) ;
2026-07-23 10:11:24 +00:00
let obj = require ( 4324 ) /* _createForOfIteratorHelperLoose */ ;
2026-07-20 16:05:17 +00:00
obj = { } ;
const rootCommand = command . rootCommand ;
let id ;
if ( null != rootCommand ) {
id = rootCommand . id ;
}
if ( null == id ) {
id = command . id ;
}
obj . command_id = id ;
obj . application_id = command . applicationId ;
obj . location = _location ;
obj . section = triggerSection ;
obj . query_length = queryLength ;
obj . command_text_length = command . displayName . length ;
obj . section_name = sectionName ;
obj . query = query ;
obj . search_results_position = searchResultsPosition ;
obj . source = source ;
obj . trackWithMetadata ( constants2 . APPLICATION_COMMAND_SELECTED , obj ) ;
} ;
export const getInitialInteractionMetadata = function getInitialInteractionMetadata ( interactionMetadata ) {
interactionMetadata = interactionMetadata . interactionMetadata ;
let tmp = null ;
if ( null != interactionMetadata ) {
let triggering_interaction_metadata = interactionMetadata ;
if ( "triggering_interaction_metadata" in interactionMetadata ) {
triggering_interaction_metadata = interactionMetadata . triggering_interaction_metadata ;
}
tmp = triggering_interaction_metadata ;
}
return tmp ;
} ;
export const hasCommandIndexForApp = function hasCommandIndexForApp ( id , guildState ) {
const result = guildState . result ;
let sections ;
if ( null != result ) {
sections = result . sections ;
}
let tmp2 = null != sections ;
if ( tmp2 ) {
tmp2 = id in sections ;
}
return tmp2 ;
} ;