186 lines
10 KiB
TypeScript
186 lines
10 KiB
TypeScript
/* Metro module 11884; source: modules/chat_input/native/ChatInputAppCommandManager.tsx; dependencies: [57, 31, 7167, 7168, 4501, 697, 11647, 566, 11857, 8060, 1909, 11885, 11858, 2] */
|
|
function _fun91167(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#91167, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12070:6, offset: 0x02054604, size: 448 bytes, params: 8, frame: 24
|
|
var object4;
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_4 = importDefault(57) /* metro dependency 57 */;
|
|
let value = importAll(31) /* metro dependency 31 */;
|
|
const applicationCommandAutocompleteStore = importDefault(7167) /* metro dependency 7167: ApplicationCommandAutocompleteStore */;
|
|
const applicationCommandStore = importDefault(7168) /* metro dependency 7168: ApplicationCommandStore */;
|
|
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = createStylesModule.createStyles;
|
|
object4 = {};
|
|
const object5 = {};
|
|
let BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
|
|
object5.backgroundColor = BACKGROUND_BASE_LOWER;
|
|
const TEXT_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_DEFAULT;
|
|
object5.color = TEXT_DEFAULT;
|
|
object5.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
|
|
object5.fontSize = 14;
|
|
object4.commandOption = object5;
|
|
const object6 = {};
|
|
BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
|
|
object6.backgroundColor = BACKGROUND_BASE_LOWER;
|
|
const TEXT_FEEDBACK_CRITICAL = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_FEEDBACK_CRITICAL;
|
|
object6.color = TEXT_FEEDBACK_CRITICAL;
|
|
object6.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
|
|
object6.fontSize = 14;
|
|
object4.commandErrorOption = object6;
|
|
const TEXT_BRAND = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_BRAND;
|
|
object4.autocomplete = {color: TEXT_BRAND, fontWeight: 'bold'};
|
|
const env0_8 = Reflect.apply(createStyles, createStylesModule, [object4]);
|
|
const value3 = value.forwardRef(_fun91168);
|
|
value3.displayName = 'ChatInputAppCommandManager';
|
|
value = value.memo(value3);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/chat_input/native/ChatInputAppCommandManager.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function _fun91168({chatInputRef, chatInputStateRef, channel, commandsDisabled}, a1) { // fn#91168, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12070:548, offset: 0x020547c4, size: 517 bytes, params: 3, frame: 28
|
|
var object2;
|
|
const styles = useStyles();
|
|
const env0_4 = styles;
|
|
const value2 = (require(11647) /* metro dependency 11647: ApplicationCommandOptionValueParser */).useApplicationCommandOptionValueParser({channel: channel});
|
|
const env0_5 = value2;
|
|
const activeCommand = (require(566) /* metro dependency 566: flux */).useStateFromStores([ApplicationCommandStore],
|
|
function() {
|
|
return ApplicationCommandStore.getActiveCommand(channel.id);
|
|
});
|
|
const lastResponseNonce = (require(566) /* metro dependency 566: flux */).useStateFromStores([ApplicationCommandAutocompleteStore],
|
|
function() {
|
|
return ApplicationCommandAutocompleteStore.getLastResponseNonce(channel.id);
|
|
});
|
|
const binding = env0_5;
|
|
const useRef = binding.useRef;
|
|
const chatInputCommandOptionParserModule = require(11857) /* metro dependency 11857: ChatInputCommandOptionParser */;
|
|
const getTextBeforeFirstOption = chatInputCommandOptionParserModule.getTextBeforeFirstOption;
|
|
let text = chatInputStateRef.current.text;
|
|
text = Reflect.apply(getTextBeforeFirstOption, chatInputCommandOptionParserModule, [text]).text;
|
|
const value3 = text.slice(1);
|
|
const value4 = Reflect.apply(useRef, binding, [value3.trimEnd()]);
|
|
const useState = binding.useState;
|
|
const value6 = env0_4(Reflect.apply(useState, binding, [value4.current]), 2);
|
|
const property = value6[0];
|
|
const env0_9 = value6[1];
|
|
const applicationCommandQueryApiModule = importAll(8060) /* metro dependency 8060: ApplicationCommandQueryApi */;
|
|
const useCachedResults = applicationCommandQueryApiModule.useCachedResults;
|
|
object2 = {type: 'channel', channel: channel};
|
|
const ApplicationCommandType = (require(1909) /* metro dependency 1909: Server */).ApplicationCommandType;
|
|
const CHAT = ApplicationCommandType.CHAT;
|
|
const commands = Reflect.apply(useCachedResults, applicationCommandQueryApiModule, [object2, CHAT,
|
|
property]).commands;
|
|
const env0_11 = binding.useRef(undefined);
|
|
binding.useEffect(_fun91175, [binding.useCallback(_fun91171, [activeCommand, channel, chatInputRef,
|
|
chatInputStateRef, commandsDisabled, lastResponseNonce, value2, commands, styles])]);
|
|
binding.useImperativeHandle(a1, function() {
|
|
return {getApplicationCommandManager: _fun91177, updateState: _fun91178};
|
|
});
|
|
return null;
|
|
}
|
|
|
|
function _fun91171() { // fn#91171, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12070:1103, offset: 0x02054a0b, size: 382 bytes, params: 1, frame: 17
|
|
var environment;
|
|
var binding;
|
|
var value2;
|
|
var defaultImport;
|
|
var object2;
|
|
var value3;
|
|
var defaultImport2;
|
|
let current = chatInputStateRef.current;
|
|
const editId = current.editId;
|
|
const focused = current.focused;
|
|
const selectionStart = current.selectionStart;
|
|
const selectionEnd = current.selectionEnd;
|
|
let text = current.text;
|
|
const object4 = {};
|
|
object4.activeCommand = activeCommand;
|
|
object4.channel = channel;
|
|
object4.commandsDisabled = commandsDisabled;
|
|
object4.editId = editId;
|
|
object4.focused = focused;
|
|
object4.lastCommandAutocompleteResponseNonce = lastResponseNonce;
|
|
object4.queryCommands = commands;
|
|
object4.selectionStart = selectionStart;
|
|
object4.selectionEnd = selectionEnd;
|
|
object4.text = text;
|
|
current = env0_11.current;
|
|
if (current == null) {
|
|
binding = env0_11;
|
|
value2 = environment.__proto__;
|
|
defaultImport = importDefault(11885) /* metro dependency 11885: ApplicationCommandManager */;
|
|
object2 = {props: object4};
|
|
object2.ref = chatInputRef;
|
|
object2.optionValueParser = env0_5;
|
|
object2.styles = {commandOption: commandOption, commandErrorOption: commandErrorOption,
|
|
autocomplete: autocomplete};
|
|
value3 = Object.create(defaultImport.prototype, {constructor: {value: defaultImport}});
|
|
defaultImport2 = new defaultImport();
|
|
binding.current = defaultImport2 instanceof Object ? defaultImport2 : value3;
|
|
} else {
|
|
current = env0_11.current;
|
|
current.updateApplicationCommandManagerState({newState: object4});
|
|
}
|
|
const chatInputCommandOptionParserModule = require(11857) /* metro dependency 11857: ChatInputCommandOptionParser */;
|
|
const getTextBeforeFirstOption = chatInputCommandOptionParserModule.getTextBeforeFirstOption;
|
|
text = Reflect.apply(getTextBeforeFirstOption, chatInputCommandOptionParserModule, [text]).text;
|
|
const value8 = text.slice(1).trimEnd();
|
|
if (env0_8.current !== value8) {
|
|
env0_9(value8);
|
|
env0_8.current = value8;
|
|
}
|
|
}
|
|
|
|
function _fun91176() { // fn#91176, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12070:1954, offset: 0x02054c70, size: 30 bytes, params: 1, frame: 3
|
|
return {getApplicationCommandManager: getApplicationCommandManager_91177, updateState: updateState_91178};
|
|
}
|
|
|
|
function commandOption() { // fn#91172, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12070:1451, offset: 0x02054b89, size: 51 bytes, params: 1, frame: 11
|
|
let value = environment.__proto__.__proto__;
|
|
value = require(11858) /* metro dependency 11858: ChatInputParser */;
|
|
return value.convertToNativeStyle(styles.commandOption);
|
|
}
|
|
|
|
function commandErrorOption() { // fn#91173, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12070:1521, offset: 0x02054bbc, size: 51 bytes, params: 1, frame: 11
|
|
let value = environment.__proto__.__proto__;
|
|
value = require(11858) /* metro dependency 11858: ChatInputParser */;
|
|
return value.convertToNativeStyle(styles.commandErrorOption);
|
|
}
|
|
|
|
function autocomplete(a0) { // fn#91174, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12070:1590, offset: 0x02054bef, size: 129 bytes, params: 2, frame: 14
|
|
var r0;
|
|
var value;
|
|
var convertToNativeStyle;
|
|
var object2;
|
|
var value2;
|
|
var value3;
|
|
if (a0 == null) {
|
|
value = environment.__proto__.__proto__;
|
|
value = require(11858) /* metro dependency 11858: ChatInputParser */;
|
|
convertToNativeStyle = value.convertToNativeStyle;
|
|
value3 = environment.__proto__;
|
|
value = Reflect.apply(convertToNativeStyle, value, [styles.autocomplete]);
|
|
r0 = value;
|
|
} else {
|
|
value = environment.__proto__.__proto__;
|
|
value = require(11858) /* metro dependency 11858: ChatInputParser */;
|
|
convertToNativeStyle = value.convertToNativeStyle;
|
|
object2 = {};
|
|
value2 = environment.__proto__;
|
|
copyDataProperties(object2, styles.autocomplete, a0);
|
|
object2['color'] = a0;
|
|
value = Reflect.apply(convertToNativeStyle, value, [object2]);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function getApplicationCommandManager_91177() { // fn#91177, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12070:1989, offset: 0x02054c8e, size: 14 bytes, params: 1, frame: 1
|
|
return env1_11.current;
|
|
}
|
|
|
|
function updateState_91178() { // fn#91178, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12070:2015, offset: 0x02054c9c, size: 15 bytes, params: 1, frame: 9
|
|
return env1_12();
|
|
}
|
|
|