239 lines
12 KiB
TypeScript
239 lines
12 KiB
TypeScript
/* Metro module 11017; source: modules/autocompleter/native/AutocompleteUtils.tsx; dependencies: [31, 27, 1383, 1935, 3793, 1878, 661, 11018, 6625, 33, 4501, 697, 4805, 6526, 3995, 7331, 2] */
|
|
import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
|
|
import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import GuildChannelStore from '../../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */
|
|
import RelationshipStore from '../../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
|
|
import FormDivider from '../../../design/void/Form/native/FormDivider.tsx'; /* Metro dependency 7331 */
|
|
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
|
|
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
|
|
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as ChannelRecordModule from '../../../records/ChannelRecord.tsx'; /* Metro dependency 1383 */
|
|
import * as ApplicationCommandsConstantsModule from '../../application_commands/native/ApplicationCommandsConstants.tsx'; /* Metro dependency 11018 */
|
|
|
|
function _fun84394(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#84394, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11203:6, offset: 0x01f482fc, size: 479 bytes, params: 8, frame: 23
|
|
const env0_0 = require;
|
|
const getMentionTextWithUser2 = getMentionTextWithUser;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
ReactModule;
|
|
const StyleSheet = (ReactNativeModule).StyleSheet;
|
|
let value = ApplicationCommandsConstantsModule;
|
|
const env0_8 = value.AUTOCOMPLETE_EMOJI_ROW_HEIGHT;
|
|
const env0_9 = value.AUTOCOMPLETE_ROW_HEIGHT;
|
|
value = require(6625) /* metro dependency 6625: ChannelAutocompleteConstants */;
|
|
const env0_10 = value.CHANNEL_SENTINEL;
|
|
const env0_11 = value.EMOJI_SENTINEL;
|
|
const env0_12 = value.MENTION_SENTINEL;
|
|
const env0_14 = StyleSheet.hairlineWidth;
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = value.createStyles;
|
|
const BORDER_SUBTLE = (Native).colors.BORDER_SUBTLE;
|
|
const env0_15 = Reflect.apply(createStyles, value, [{itemDivider: {marginLeft: 16,
|
|
backgroundColor: BORDER_SUBTLE}}]);
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/autocompleter/native/AutocompleteUtils.tsx');
|
|
exports.getItemLayout = getItemLayout;
|
|
exports.getAutocompleteResultText = getAutocompleteResultText;
|
|
exports.getMentionTextWithUser = getMentionTextWithUser2;
|
|
exports.getItemSeparator = getItemSeparator;
|
|
exports.getPrefix = function(a0) {
|
|
return a0[0];
|
|
};
|
|
exports.getQuery = function(a0) {
|
|
return a0.slice(1).toLowerCase();
|
|
};
|
|
function getMentionTextWithUser(a0, a1) { // fn#84395, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11203:504, offset: 0x01f484db, size: 136 bytes, params: 3, frame: 15
|
|
var r0;
|
|
var value;
|
|
if ((importDefault(6526) /* metro dependency 6526: AutocompleteUtils */).hasSameRoleAsUsername(a0, a1)) {
|
|
r0 = '' + MENTION_SENTINEL + a1.tag;
|
|
} else {
|
|
value = importDefault(3995) /* metro dependency 3995: UserUtils */;
|
|
value = value.getUserTag(a1);
|
|
value = '' + MENTION_SENTINEL + value;
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function AutocompleteFormDivider() { // fn#84396, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11203:631, offset: 0x01f48563, size: 57 bytes, params: 1, frame: 15
|
|
const styles = useStyles();
|
|
return ((Component) => <Component style={styles.itemDivider} />)(FormDivider);
|
|
}
|
|
|
|
function getItemLayout(a0, a1) { // fn#84397, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11203:818, offset: 0x01f4859c, size: 123 bytes, params: 3, frame: 16
|
|
const type = a0 == null || a0[a1] == null ? undefined : a0[a1].type;
|
|
const EMOJI = AutoCompleteResultTypes.EMOJI;
|
|
const r3 = type === EMOJI ? AUTOCOMPLETE_EMOJI_ROW_HEIGHT : AUTOCOMPLETE_ROW_HEIGHT;
|
|
const value2 = a1 * r3;
|
|
const Math = global.Math;
|
|
return {length: r3, offset: value2 + Math.max(0, (a1 - 1) * hairlineWidth), index: a1};
|
|
}
|
|
|
|
function getAutocompleteResultText(a0, a1, a2) { // fn#84398, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11203:973, offset: 0x01f48617, size: 728 bytes, params: 4, frame: 21
|
|
var name;
|
|
var r5;
|
|
var type;
|
|
var channel;
|
|
var guildId;
|
|
var isGuildSelectableChannelTypeBinding;
|
|
var moduleValue;
|
|
var computeChannelName;
|
|
var moduleValue2;
|
|
var moduleValue3;
|
|
var escapeChannelName;
|
|
var moduleValue4;
|
|
if (a2 == null) {
|
|
type = a0.type;
|
|
if (AutoCompleteResultTypes.USER === type) {
|
|
return getMentionTextWithUser(a1, a0.user);
|
|
}
|
|
if (AutoCompleteResultTypes.GLOBAL === type) {
|
|
return a0.text;
|
|
}
|
|
if (AutoCompleteResultTypes.ROLE === type) {
|
|
return '' + MENTION_SENTINEL + a0.name;
|
|
}
|
|
if (AutoCompleteResultTypes.CHANNEL === type) {
|
|
channel = a0.channel;
|
|
if (channel.isThread()) {
|
|
moduleValue3 = require(4805) /* metro dependency 4805: useChannelName */;
|
|
escapeChannelName = moduleValue3.escapeChannelName;
|
|
moduleValue4 = require(4805) /* metro dependency 4805: useChannelName */;
|
|
return '#"' + Reflect.apply(escapeChannelName, moduleValue3,
|
|
[moduleValue4.computeChannelName(a0.channel,
|
|
UserStore,
|
|
RelationshipStore)]) + '"';
|
|
}
|
|
channel = a0.channel;
|
|
guildId = channel.getGuildId();
|
|
if (guildId == null) {
|
|
moduleValue = require(4805) /* metro dependency 4805: useChannelName */;
|
|
return '' + CHANNEL_SENTINEL + moduleValue.computeChannelName(a0.channel, UserStore, RelationshipStore);
|
|
}
|
|
isGuildSelectableChannelTypeBinding = isGuildSelectableChannelType;
|
|
channel = a0.channel;
|
|
if (isGuildSelectableChannelTypeBinding(channel.type)) {
|
|
name = GuildChannelStore.getTextChannelNameDisambiguations(guildId)[a0.channel.id]?.name;
|
|
if (name != null) {
|
|
r5 = name;
|
|
} else {
|
|
moduleValue2 = require(4805) /* metro dependency 4805: useChannelName */;
|
|
r5 = moduleValue2.computeChannelName(a0.channel, UserStore, RelationshipStore);
|
|
}
|
|
return '' + CHANNEL_SENTINEL + r5;
|
|
}
|
|
moduleValue = require(4805) /* metro dependency 4805: useChannelName */;
|
|
computeChannelName = moduleValue.computeChannelName;
|
|
channel = a0.channel;
|
|
return '' + CHANNEL_SENTINEL + Reflect.apply(computeChannelName, moduleValue, [channel, UserStore,
|
|
RelationshipStore]);
|
|
}
|
|
if (AutoCompleteResultTypes.EMOJI === type) {
|
|
return '' + EMOJI_SENTINEL + a0.name + ':';
|
|
}
|
|
if (AutoCompleteResultTypes.EMOJI_PREMIUM_UPSELL === type) {
|
|
return '';
|
|
}
|
|
if (AutoCompleteResultTypes.SLASH === type) {
|
|
return '';
|
|
}
|
|
if (AutoCompleteResultTypes.CHOICE === type) {
|
|
return '' + a0.choice.displayName;
|
|
}
|
|
if (AutoCompleteResultTypes.STICKER === type) {
|
|
return '';
|
|
}
|
|
if (AutoCompleteResultTypes.CHOICE_LOADING === type) {
|
|
return '';
|
|
}
|
|
if (AutoCompleteResultTypes.LABEL === type) {
|
|
return '';
|
|
}
|
|
return undefined;
|
|
}
|
|
const has = a2.has;
|
|
type = a0.type;
|
|
if (Reflect.apply(has, a2, [type])) {
|
|
type = a0.type;
|
|
if (AutoCompleteResultTypes.USER === type) {
|
|
return getMentionTextWithUser(a1, a0.user);
|
|
}
|
|
if (AutoCompleteResultTypes.GLOBAL === type) {
|
|
return a0.text;
|
|
}
|
|
if (AutoCompleteResultTypes.ROLE === type) {
|
|
return '' + MENTION_SENTINEL + a0.name;
|
|
}
|
|
if (AutoCompleteResultTypes.CHANNEL === type) {
|
|
channel = a0.channel;
|
|
if (channel.isThread()) {
|
|
moduleValue3 = require(4805) /* metro dependency 4805: useChannelName */;
|
|
escapeChannelName = moduleValue3.escapeChannelName;
|
|
moduleValue4 = require(4805) /* metro dependency 4805: useChannelName */;
|
|
return '#"' + Reflect.apply(escapeChannelName, moduleValue3,
|
|
[moduleValue4.computeChannelName(a0.channel,
|
|
UserStore,
|
|
RelationshipStore)]) + '"';
|
|
}
|
|
channel = a0.channel;
|
|
guildId = channel.getGuildId();
|
|
if (guildId == null) {
|
|
moduleValue = require(4805) /* metro dependency 4805: useChannelName */;
|
|
return '' + CHANNEL_SENTINEL + moduleValue.computeChannelName(a0.channel, UserStore, RelationshipStore);
|
|
}
|
|
isGuildSelectableChannelTypeBinding = isGuildSelectableChannelType;
|
|
channel = a0.channel;
|
|
if (isGuildSelectableChannelTypeBinding(channel.type)) {
|
|
name = GuildChannelStore.getTextChannelNameDisambiguations(guildId)[a0.channel.id]?.name;
|
|
if (name != null) {
|
|
r5 = name;
|
|
} else {
|
|
moduleValue2 = require(4805) /* metro dependency 4805: useChannelName */;
|
|
r5 = moduleValue2.computeChannelName(a0.channel, UserStore, RelationshipStore);
|
|
}
|
|
return '' + CHANNEL_SENTINEL + r5;
|
|
}
|
|
moduleValue = require(4805) /* metro dependency 4805: useChannelName */;
|
|
computeChannelName = moduleValue.computeChannelName;
|
|
channel = a0.channel;
|
|
return '' + CHANNEL_SENTINEL + Reflect.apply(computeChannelName, moduleValue, [channel, UserStore,
|
|
RelationshipStore]);
|
|
}
|
|
if (AutoCompleteResultTypes.EMOJI === type) {
|
|
return '' + EMOJI_SENTINEL + a0.name + ':';
|
|
}
|
|
if (AutoCompleteResultTypes.EMOJI_PREMIUM_UPSELL === type) {
|
|
return '';
|
|
}
|
|
if (AutoCompleteResultTypes.SLASH === type) {
|
|
return '';
|
|
}
|
|
if (AutoCompleteResultTypes.CHOICE === type) {
|
|
return '' + a0.choice.displayName;
|
|
}
|
|
if (AutoCompleteResultTypes.STICKER === type) {
|
|
return '';
|
|
}
|
|
if (AutoCompleteResultTypes.CHOICE_LOADING === type) {
|
|
return '';
|
|
}
|
|
if (AutoCompleteResultTypes.LABEL === type) {
|
|
return '';
|
|
}
|
|
return undefined;
|
|
}
|
|
return '';
|
|
}
|
|
|
|
function getItemSeparator() { // fn#84399, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11203:1839, offset: 0x01f488ef, size: 23 bytes, params: 1, frame: 13
|
|
return <AutocompleteFormDivider />;
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun84394, 11017, [31, 27, 1383, 1935, 3793, 1878, 661, 11018, 6625, 33, 4501, 697, 4805, 6526, 3995,
|
|
7331,
|
|
2]) /* metro module 11017, dependencies: [31, 27, 1383, 1935, 3793, 1878, 661, 11018, 6625, 33, 4501, 697, 4805, 6526, 3995, 7331, 2] */;
|