2026-07-24 07:16:23 +00:00
// Module ID: 8009
// Function ID: 63439
2026-07-20 16:05:17 +00:00
// Name: _isNativeReflectConstruct
2026-07-23 10:11:24 +00:00
// Dependencies: [6, 7, 15, 17, 18, 1316, 4566, 4156, 662, 4214, 22, 566, 686, 2]
2026-07-20 16:05:17 +00:00
// Exports: getFilteredTopCommands, getTopRealCommands
2026-07-24 07:16:23 +00:00
// Module 8009 (_isNativeReflectConstruct)
2026-07-23 10:11:24 +00:00
import closure_2 from "TRUE_OPTION_NAME" ;
import ApplicationTypes from "ApplicationTypes" ;
import _possibleConstructorReturn from "_possibleConstructorReturn" ;
import _getPrototypeOf from "_getPrototypeOf" ;
import _inherits from "_inherits" ;
import _isNativeReflectConstruct from "_isNativeReflectConstruct" ;
import TRUE_OPTION_NAME from "TRUE_OPTION_NAME" ;
import { UserSettingsTypes } from "MAX_FAVORITES" ;
import importDefaultResult from "DEFAULT_FRECENCY" ;
let closure_8 ;
let closure_9 ;
2026-07-20 16:05:17 +00:00
function _isNativeReflectConstruct() {
let closure_0 = ! valueOf . call ( Reflect . construct ( Boolean , [ ] , ( ) = > {
} ) ) ;
function _isNativeReflectConstruct() {
return closure_0 ;
}
const result = _isNativeReflectConstruct ( ) ;
}
2026-07-23 10:11:24 +00:00
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 getKey ( guild , id ) {
if ( Number ( id . id ) < 0 ) {
id = id . id ;
} else {
guild = undefined ;
if ( null != guild ) {
guild = guild . guild ;
}
if ( null != guild ) {
if ( null != id . guildId ) {
const _HermesInternal = HermesInternal ;
id = "" + id . id + ":" + guild . guild . id ;
}
}
id = id . id ;
}
return id ;
}
function handleUserSettingsProtoStoreChange() {
const applicationCommandFrecency = obj . frecencyWithoutFetchingLatest . applicationCommandFrecency ;
let applicationCommands ;
if ( null != applicationCommandFrecency ) {
applicationCommands = applicationCommandFrecency . applicationCommands ;
}
if ( null == applicationCommands ) {
applicationCommands = { } ;
}
2026-07-23 10:11:24 +00:00
importDefaultResult . overwriteHistory ( importDefault ( 22 ) . mapValues ( applicationCommands , ( recentUses ) = > {
2026-07-20 16:05:17 +00:00
const obj = { } ;
const merged = Object . assign ( recentUses ) ;
recentUses = recentUses . recentUses ;
const mapped = recentUses . map ( Number ) ;
obj [ "recentUses" ] = mapped . filter ( ( arg0 ) = > arg0 > 0 ) ;
return obj ;
} ) , closure_11 . pendingUsages ) ;
}
2026-07-23 10:11:24 +00:00
( { DISCOVERY_COMMAND_FRECENCY_GATEWAY_LIMIT : closure_8 , SUB_COMMAND_KEY_SEPARATOR : closure_9 } = TRUE_OPTION_NAME ) ;
2026-07-20 16:05:17 +00:00
let closure_11 = { pendingUsages : [ ] } ;
let obj = {
computeBonus() {
return 1 ;
} ,
lookupKey ( arg0 ) {
return arg0 ;
} ,
afterCompute() {
} ,
2026-07-23 10:11:24 +00:00
numFrequentlyItems : require ( "ApplicationTypes" ) . FREQUENCY_ITEM_LIMIT
2026-07-20 16:05:17 +00:00
} ;
importDefaultResult = new importDefaultResult ( obj ) ;
2026-07-23 10:11:24 +00:00
let tmp5 = ( ( PersistedStore ) = > {
2026-07-20 16:05:17 +00:00
class ApplicationCommandFrecencyStore {
constructor ( ) {
self = this ;
2026-07-23 10:11:24 +00:00
tmp = outer1_2 ( this , ApplicationCommandFrecencyStore ) ;
obj = outer1_5 ( ApplicationCommandFrecencyStore ) ;
tmp2 = outer1_4 ;
if ( outer1_13 ( ) ) {
2026-07-20 16:05:17 +00:00
tmp6 = globalThis ;
_Reflect = Reflect ;
2026-07-23 10:11:24 +00:00
tmp7 = outer1_5 ;
2026-07-20 16:05:17 +00:00
tmp8 = arguments ;
2026-07-23 10:11:24 +00:00
constructResult = Reflect . construct ( obj , arguments , outer1_5 ( self ) . constructor ) ;
2026-07-20 16:05:17 +00:00
} else {
tmp3 = arguments ;
tmp4 = arguments ;
constructResult = obj ( . . . arguments ) ;
}
return tmp2 ( self , constructResult ) ;
}
}
callback2 ( ApplicationCommandFrecencyStore , PersistedStore ) ;
let obj = {
key : "initialize" ,
value ( arg0 ) {
const self = this ;
2026-07-23 10:11:24 +00:00
if ( null != arg0 ) {
const outer1_11 = arg0 ;
}
const items = [ outer1_7 ] ;
self . syncWith ( items , outer1_17 ) ;
2026-07-20 16:05:17 +00:00
}
} ;
2026-07-23 10:11:24 +00:00
let items = [ obj , , , , , ] ;
2026-07-20 16:05:17 +00:00
obj = {
key : "getState" ,
value() {
2026-07-23 10:11:24 +00:00
return outer1_11 ;
2026-07-20 16:05:17 +00:00
}
} ;
items [ 1 ] = obj ;
obj = {
key : "hasPendingUsage" ,
value() {
2026-07-23 10:11:24 +00:00
return outer1_11 . pendingUsages . length > 0 ;
2026-07-20 16:05:17 +00:00
}
} ;
items [ 2 ] = obj ;
items [ 3 ] = {
key : "getCommandFrecencyWithoutLoadingLatest" ,
value() {
2026-07-23 10:11:24 +00:00
return outer1_12 ;
2026-07-20 16:05:17 +00:00
}
} ;
items [ 4 ] = {
key : "getScoreWithoutLoadingLatest" ,
value ( arg0 , arg1 ) {
2026-07-23 10:11:24 +00:00
const score = outer1_12 . getScore ( outer1_16 ( arg0 , arg1 ) ) ;
2026-07-20 16:05:17 +00:00
let num = 0 ;
if ( null != score ) {
num = score ;
}
return num ;
}
} ;
items [ 5 ] = {
key : "getTopCommandsWithoutLoadingLatest" ,
value() {
2026-07-23 10:11:24 +00:00
return outer1_12 . frequently ;
2026-07-20 16:05:17 +00:00
}
} ;
return callback ( ApplicationCommandFrecencyStore , items ) ;
2026-07-23 10:11:24 +00:00
} ) ( require ( "initialize" ) . PersistedStore ) ;
2026-07-20 16:05:17 +00:00
tmp5 . displayName = "ApplicationCommandFrecencyStore" ;
tmp5 . persistKey = "ApplicationCommandFrecencyV2" ;
obj = {
APPLICATION_COMMAND_USED : function handleApplicationCommandUsed ( context ) {
const tmp = getKey ( context . context , context . command ) ;
const pendingUsages = closure_11 . pendingUsages ;
pendingUsages . push ( { key : tmp , timestamp : Date.now ( ) } ) ;
importDefaultResult . track ( tmp ) ;
importDefaultResult . compute ( ) ;
} ,
USER_SETTINGS_PROTO_UPDATE : function handleUserSettingsProtoUpdate ( settings ) {
if ( settings . settings . type === UserSettingsTypes . FRECENCY_AND_FAVORITES_SETTINGS ) {
if ( settings . wasSaved ) {
closure_11 . pendingUsages = [ ] ;
}
}
return false ;
}
} ;
2026-07-23 10:11:24 +00:00
tmp5 = new tmp5 ( require ( "dispatcher" ) , obj ) ;
let result = require ( "_possibleConstructorReturn" ) . fileFinishedImporting ( "modules/application_commands/ApplicationCommandFrecencyStore.tsx" ) ;
2026-07-20 16:05:17 +00:00
export default tmp5 ;
export const getTopRealCommands = function getTopRealCommands ( arg0 ) {
const set = new Set ( ) ;
const tmp = _createForOfIteratorHelperLoose ( arg0 ) ;
let iter = tmp ( ) ;
if ( ! iter . done ) {
while ( true ) {
let str = iter . value ;
let tmp2 = closure_9 ;
let first = str . split ( closure_9 ) [ 0 ] ;
let _Number = Number ;
if ( Number ( first ) > 0 ) {
let addResult = set . add ( first ) ;
}
let tmp5 = closure_8 ;
if ( set . size >= closure_8 ) {
break ;
} else {
let iter2 = tmp ( ) ;
iter = iter2 ;
if ( iter2 . done ) {
break ;
}
}
}
}
const items = [ . . . set ] ;
return items ;
} ;
export const getFilteredTopCommands = function getFilteredTopCommands ( arr ) {
2026-07-23 10:11:24 +00:00
let closure_0 = arg1 ;
2026-07-20 16:05:17 +00:00
const found = arr . filter ( ( arr ) = > {
let tmp = ! arr . includes ( ":" ) ;
if ( ! tmp ) {
let guild ;
2026-07-23 10:11:24 +00:00
if ( null != closure_0 ) {
guild = closure_0 . guild ;
2026-07-20 16:05:17 +00:00
}
let tmp6 = null != guild ;
if ( tmp6 ) {
2026-07-23 10:11:24 +00:00
tmp6 = closure_0 . guild . id === arr . split ( ":" ) [ 1 ] ;
2026-07-20 16:05:17 +00:00
}
tmp = tmp6 ;
}
return tmp ;
} ) ;
return found . map ( ( arg0 ) = > arg0 . split ( ":" ) [ 0 ] ) ;
} ;