2026-07-23 10:11:24 +00:00
// Module ID: 11225
// Function ID: 87385
2026-07-20 16:05:17 +00:00
// Name: _createForOfIteratorHelperLoose
2026-07-23 10:11:24 +00:00
// Dependencies: [7, 6, 31, 5039, 1352, 1907, 1917, 1910, 3767, 1849, 4567, 22, 1327, 4320, 4974, 1881, 6924, 2]
2026-07-20 16:05:17 +00:00
// Exports: parseOptionValuesForSend, useApplicationCommandOptionValueParser
2026-07-23 10:11:24 +00:00
// Module 11225 (_createForOfIteratorHelperLoose)
import _isNativeReflectConstruct from "_isNativeReflectConstruct" ;
import result from "result" ;
import closure_5 from "_isNativeReflectConstruct" ;
import { isGuildSelectableChannelType as closure_6 } from "_callSuper" ;
import closure_7 from "_isNativeReflectConstruct" ;
import closure_8 from "_isNativeReflectConstruct" ;
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose" ;
import closure_10 from "_isNativeReflectConstruct" ;
import closure_11 from "_isNativeReflectConstruct" ;
import MENTION_SENTINEL from "MENTION_SENTINEL" ;
import importDefaultResult from "_createForOfIteratorHelperLoose" ;
let closure_12 ;
let closure_13 ;
const require = arg1 ;
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 getUsers ( getGuildId ) {
const guildId = getGuildId . getGuildId ( ) ;
if ( getGuildId . isPrivate ( ) ) {
2026-07-23 10:11:24 +00:00
let mapped = importDefault ( 22 ) ( getGuildId . recipients ) . map ( ( userId ) = > ( { userId } ) ) ;
const arr3 = importDefault ( 22 ) ( getGuildId . recipients ) ;
2026-07-20 16:05:17 +00:00
} else if ( null != guildId ) {
2026-07-23 10:11:24 +00:00
const tmp7 = importDefault ( 22 ) ;
mapped = importDefault ( 22 ) ( members . getMembers ( guildId ) ) . map ( ( userId ) = > ( { userId : userId.userId } ) ) ;
const tmp7Result = importDefault ( 22 ) ( members . getMembers ( guildId ) ) ;
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
mapped = importDefault ( 22 ) ( [ ] ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const mapped1 = mapped . map ( ( userId ) = > outer1_11 . getUser ( userId . userId ) ) ;
const found = mapped1 . filter ( require ( 1327 ) /* isDiscordFrontendDevelopment */ . isNotNullish ) ;
2026-07-20 16:05:17 +00:00
return found . map ( ( id ) = > ( { id : id.id , text : id.tag } ) ) ;
}
function getRoles ( guild_id ) {
guild_id = guild_id . guild_id ;
if ( null != guild_id ) {
2026-07-23 10:11:24 +00:00
sortedRoles = sortedRoles . getSortedRoles ( guild_id ) ;
2026-07-20 16:05:17 +00:00
} else {
sortedRoles = [ ] ;
}
2026-07-23 10:11:24 +00:00
return importDefault ( 22 ) ( sortedRoles ) . map ( ( id ) = > ( { id : id.id , text : id.name } ) ) ;
2026-07-20 16:05:17 +00:00
}
function getChannels ( getGuildId , arr ) {
2026-07-23 10:11:24 +00:00
const _require = arr ;
2026-07-20 16:05:17 +00:00
const guildId = getGuildId . getGuildId ( ) ;
if ( null == guildId ) {
const items = [ ] ;
if ( tmp2 ) {
items . push ( getGuildId ) ;
}
2026-07-23 10:11:24 +00:00
tmp2 = null == arr || arr . includes ( getGuildId . type ) ;
return guildId ( 22 ) ( items ) . map ( ( id ) = > {
const obj = { id : id.id , text : arr ( 4320 ) . computeChannelName ( id , outer1_11 , outer1_10 ) } ;
2026-07-20 16:05:17 +00:00
return obj ;
} ) ;
} else {
2026-07-23 10:11:24 +00:00
const dependencyMap = textChannelNameDisambiguations . getTextChannelNameDisambiguations ( guildId ) ;
const tmp9 = guildId ( 22 ) ;
const tmp9Result = guildId ( 22 ) ( _require ( 4974 ) . COMMAND_SUPPORTED_CHANNEL_TYPE_KEYS ) ;
const combined = guildId ( 22 ) ( _require ( 4974 ) . COMMAND_SUPPORTED_CHANNEL_TYPE_KEYS ) . flatMap ( ( arg0 ) = > outer1_7 . getChannels ( guildId ) [ arg0 ] . map ( ( channel ) = > channel . channel ) ) . concat ( closure_5 . computeAllActiveJoinedThreads ( guildId ) ) ;
2026-07-20 16:05:17 +00:00
const found = combined . filter ( ( type ) = > {
2026-07-23 10:11:24 +00:00
let hasItem = null == arr ;
2026-07-20 16:05:17 +00:00
if ( ! hasItem ) {
2026-07-23 10:11:24 +00:00
hasItem = arr . includes ( type . type ) ;
2026-07-20 16:05:17 +00:00
}
return hasItem ;
} ) ;
return found . map ( ( id ) = > {
const obj = { id : id.id } ;
2026-07-23 10:11:24 +00:00
if ( ! outer1_6 ( id . type ) ) {
let channelName = arr ( 4320 ) . computeChannelName ( id , outer1_11 , outer1_10 ) ;
const obj2 = arr ( 4320 ) ;
2026-07-20 16:05:17 +00:00
} else {
channelName = undefined ;
2026-07-23 10:11:24 +00:00
if ( null != dependencyMap [ id . id ] ) {
2026-07-20 16:05:17 +00:00
channelName = tmp2 . name ;
}
}
obj . text = channelName ;
return obj ;
} ) ;
}
}
2026-07-23 10:11:24 +00:00
( { MENTION_SENTINEL : closure_12 , CHANNEL_SENTINEL : closure_13 } = MENTION_SENTINEL ) ;
const re14 = /^@(([^@#:]+)#([0-9]{4}))$/i ;
2026-07-20 16:05:17 +00:00
function matchPrefix ( arg0 , str , sortBy ) {
2026-07-23 10:11:24 +00:00
let closure_0 = arg0 ;
2026-07-20 16:05:17 +00:00
if ( str [ 0 ] !== arg0 ) {
return null ;
} else {
let closure_1 = str . substr ( arg0 . length ) ;
const found = sortBy . sortBy ( ( text ) = > - text . text . length ) . filter ( ( text ) = > {
const formatted = closure_1 . toLowerCase ( ) ;
return formatted === text . text . toLowerCase ( ) ;
} ) ;
2026-07-23 10:11:24 +00:00
const mapped = found . map ( ( id ) = > ( { text : closure_0 + id . text , id : id.id } ) ) ;
2026-07-20 16:05:17 +00:00
return mapped . first ( ) ;
}
}
class ApplicationCommandOptionValueParser {
constructor ( arg0 ) {
2026-07-23 10:11:24 +00:00
self = this ;
tmp = c3 ( this , ApplicationCommandOptionValueParser ) ;
2026-07-20 16:05:17 +00:00
this . parse = ( text , type ) = > {
const trimmed = text . trim ( ) ;
2026-07-23 10:11:24 +00:00
const arr = outer1_19 ( trimmed . channel ) ;
let closure_2 = outer1_20 ( trimmed . channel ) ;
let _isNativeReflectConstruct = arr . map ( ( text ) = > {
2026-07-20 16:05:17 +00:00
const obj = { } ;
const merged = Object . assign ( text ) ;
obj [ "text" ] = text . text . split ( "#" ) [ 0 ] ;
return obj ;
} ) ;
function matchUser() {
2026-07-23 10:11:24 +00:00
let tmp = outer2_15 ( outer2_12 , trimmed , arr ) ;
2026-07-20 16:05:17 +00:00
let id ;
if ( null != tmp ) {
id = tmp . id ;
}
if ( null != id ) {
const obj = { type : "userMention" , userId : tmp.id } ;
const tmp9 = obj ;
} else {
2026-07-23 10:11:24 +00:00
const tmp7 = outer2_15 ( outer2_12 , trimmed , _isNativeReflectConstruct ) ;
2026-07-20 16:05:17 +00:00
let id1 ;
if ( null != tmp7 ) {
id1 = tmp7 . id ;
}
tmp = tmp7 ;
}
return tmp9 ;
}
function matchRole() {
2026-07-23 10:11:24 +00:00
const tmp = outer2_15 ( outer2_12 , trimmed , closure_2 ) ;
2026-07-20 16:05:17 +00:00
let id ;
if ( null != tmp ) {
id = tmp . id ;
}
if ( null != id ) {
let obj = { type : "roleMention" , roleId : tmp.id } ;
} else if ( "@everyone" === trimmed ) {
2026-07-23 10:11:24 +00:00
obj = { type : "textMention" , text : "@everyone" } ;
2026-07-20 16:05:17 +00:00
}
return obj ;
}
2026-07-23 10:11:24 +00:00
if ( type . type === self ( outer1_2 [ 15 ] ) . ApplicationCommandOptionType . USER ) {
2026-07-20 16:05:17 +00:00
const matchUserResult = matchUser ( ) ;
if ( null != matchUserResult ) {
return matchUserResult ;
} else {
2026-07-23 10:11:24 +00:00
outer1_14 . lastIndex = 0 ;
const match = outer1_14 . exec ( trimmed ) ;
2026-07-20 16:05:17 +00:00
if ( null != match ) {
2026-07-23 10:11:24 +00:00
const findByTagResult = outer1_11 . findByTag ( match [ 2 ] , match [ 3 ] ) ;
2026-07-20 16:05:17 +00:00
if ( null != findByTagResult ) {
let obj = { type : "userMention" , userId : findByTagResult.id } ;
return obj ;
}
}
}
}
2026-07-23 10:11:24 +00:00
if ( type . type === self ( outer1_2 [ 15 ] ) . ApplicationCommandOptionType . ROLE ) {
2026-07-20 16:05:17 +00:00
const matchRoleResult = matchRole ( ) ;
if ( null != matchRoleResult ) {
return matchRoleResult ;
}
}
2026-07-23 10:11:24 +00:00
if ( type . type === self ( outer1_2 [ 15 ] ) . ApplicationCommandOptionType . CHANNEL ) {
const tmp12 = outer1_15 ( outer1_13 , trimmed , outer1_21 ( trimmed . channel , type . channelTypes ) ) ;
2026-07-20 16:05:17 +00:00
if ( null != tmp12 ) {
if ( null != tmp12 . id ) {
obj = { type : "channelMention" , channelId : tmp12.id } ;
return obj ;
}
}
}
2026-07-23 10:11:24 +00:00
if ( type . type === self ( outer1_2 [ 15 ] ) . ApplicationCommandOptionType . MENTIONABLE ) {
2026-07-20 16:05:17 +00:00
const matchRoleResult1 = matchRole ( ) ;
if ( null != matchRoleResult1 ) {
return matchRoleResult1 ;
} else {
const matchUserResult1 = matchUser ( ) ;
if ( null != matchUserResult1 ) {
return matchUserResult1 ;
} else {
2026-07-23 10:11:24 +00:00
outer1_14 . lastIndex = 0 ;
const match1 = outer1_14 . exec ( trimmed ) ;
2026-07-20 16:05:17 +00:00
if ( null != match1 ) {
2026-07-23 10:11:24 +00:00
const findByTagResult1 = outer1_11 . findByTag ( match1 [ 2 ] , match1 [ 3 ] ) ;
2026-07-20 16:05:17 +00:00
if ( null != findByTagResult1 ) {
const obj1 = { type : "userMention" , userId : findByTagResult1.id } ;
return obj1 ;
}
}
}
}
}
obj = { type : "text" , text } ;
return obj ;
} ;
this . channel = global ;
return ;
}
}
2026-07-23 10:11:24 +00:00
const importDefaultResultResult = require ( "_createForOfIteratorHelperLoose" ) ( ApplicationCommandOptionValueParser ) ;
const result = require ( "result" ) . fileFinishedImporting ( "modules/chat_input/native/ApplicationCommandOptionValueParser.tsx" ) ;
2026-07-20 16:05:17 +00:00
export { getUsers } ;
export { getRoles } ;
export { getChannels } ;
export const ApplicationCommandOptionValueParser = importDefaultResultResult ;
export const parseOptionValuesForSend = function parseOptionValuesForSend ( channel , activeCommand , current ) {
let iter ;
if ( null == activeCommand . options ) {
return { } ;
} else {
let obj = { } ;
2026-07-23 10:11:24 +00:00
const parserState = require ( 6924 ) /* _createForOfIteratorHelperLoose */ . createParserState ( channel ) ;
2026-07-20 16:05:17 +00:00
const tmp8 = _createForOfIteratorHelperLoose ( activeCommand . options ) ;
let iter2 = tmp8 ( ) ;
if ( ! iter2 . done ) {
do {
let value = iter2 . value ;
let tmp = current [ value . name ] ;
if ( null != tmp ) {
if ( "text" === tmp [ 0 ] . type ) {
2026-07-23 10:11:24 +00:00
let tmp9 = require ;
let tmp10 = dependencyMap ;
if ( value . type === require ( 1881 ) /* PermissionOverwriteType */ . ApplicationCommandOptionType . STRING ) {
2026-07-20 16:05:17 +00:00
if ( null == value . choices ) {
if ( ! value . autocomplete ) {
obj = { type : "text" } ;
2026-07-23 10:11:24 +00:00
let tmp2 = importDefault ;
let tmp3 = dependencyMap ;
let obj2 = importDefault ( 6924 ) ;
2026-07-20 16:05:17 +00:00
obj . text = obj2 . parse ( channel , tmp [ 0 ] . text , parserState ) . content ;
let items = [ obj ] ;
obj [ value . name ] = items ;
}
}
}
}
obj [ value . name ] = tmp ;
}
iter = tmp8 ( ) ;
iter2 = iter ;
} while ( ! iter . done ) ;
}
return obj ;
}
} ;
export const useApplicationCommandOptionValueParser = function useApplicationCommandOptionValueParser ( channel ) {
channel = channel . channel ;
const items = [ channel ] ;
2026-07-23 10:11:24 +00:00
return React . useMemo ( ( ) = > new outer1_16 ( channel ) , items ) ;
2026-07-20 16:05:17 +00:00
} ;