286 lines
14 KiB
TypeScript
286 lines
14 KiB
TypeScript
/* Metro module 15903; source: modules/guild_settings/native/GuildSettingsModalEmoji.tsx; dependencies: [57, 31, 27, 1867, 15904, 33, 22, 8629, 4501, 697, 1244, 6545, 8249, 566, 9077, 4573, 15906, 15910, 1305, 15911, 5461, 5462, 1484, 5282, 2] */
|
|
function _fun122689(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#122689, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:6, offset: 0x02571329, size: 520 bytes, params: 8, frame: 24
|
|
var object2;
|
|
const env0_0 = require;
|
|
const closure = ManageEmojisModal;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_4 = importAll(31) /* metro dependency 31 */;
|
|
let value = require(27) /* metro dependency 27 */;
|
|
const env0_5 = value.View;
|
|
const env0_6 = value.FlatList;
|
|
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
|
|
const guildSettingsEmojiStore = importDefault(15904) /* metro dependency 15904: GuildSettingsEmojiStore */;
|
|
value = require(33) /* metro dependency 33 */;
|
|
const env0_9 = value.jsx;
|
|
const env0_10 = value.jsxs;
|
|
const env0_11 = value.Fragment;
|
|
value = importDefault(22) /* metro dependency 22 */;
|
|
const env0_12 = value.throttle((require(8629) /* metro dependency 8629: EmojiActionCreators */).fetchEmoji, 1000);
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = value.createStyles;
|
|
object2 = {loadingContainer: {'flex': 1, 'paddingTop': 40}};
|
|
object2.emptyState = {paddingTop: 30};
|
|
const PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
|
|
object2.list = {paddingHorizontal: PX_12};
|
|
const PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object2.section = {paddingVertical: PX_16};
|
|
object2.titleContainer = {'paddingLeft': 16, 'paddingRight': 16};
|
|
const env0_13 = Reflect.apply(createStyles, value, [object2]);
|
|
const closure2 = computeSectionItem;
|
|
const closure3 = function(a0) {
|
|
return {type: 'EMOJI', key: a0.id, emoji: a0};
|
|
};
|
|
const env0_16 = (importDefault(22) /* metro dependency 22 */).memoize(_fun122700);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guild_settings/native/GuildSettingsModalEmoji.tsx');
|
|
exports.default = GuildSettingsModalEmoji;
|
|
exports.computeSectionItem = closure2;
|
|
exports.computeEmojiItem = closure3;
|
|
exports.ManageEmojisModal = closure;
|
|
}
|
|
|
|
function ManageEmojisModal({computeEmojiItems, contentContainerStyle, disabled, guild, headerDescription, onSelectRolesForEmoji}) { // fn#122690, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:1150, offset: 0x02571531, size: 689 bytes, params: 2, frame: 27
|
|
var r0;
|
|
disabled = !(disabled === undefined) && disabled;
|
|
const value4 = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([GuildSettingsEmojiStore],
|
|
function() {
|
|
var object = {};
|
|
var guildBinding = guild;
|
|
object.emojis = GuildSettingsEmojiStore.getEmojis(guildBinding.id);
|
|
object.revision = GuildSettingsEmojiStore.getEmojiRevision(guildBinding.id);
|
|
return object;
|
|
});
|
|
const emojis = value4.emojis;
|
|
const env0_4 = emojis;
|
|
const revision = value4.revision;
|
|
const useManageResourcePermissionsModule = require(9077) /* metro dependency 9077: useManageResourcePermissions */;
|
|
const useManageResourcePermissions = useManageResourcePermissionsModule.useManageResourcePermissions;
|
|
const canManageGuildExpression = Reflect.apply(useManageResourcePermissions, useManageResourcePermissionsModule,
|
|
[guild]).canManageGuildExpression;
|
|
const emojiItems = computeEmojiItems(emojis ?? [], guild);
|
|
const styles = useStyles();
|
|
let binding = env0_4;
|
|
const env0_9 = binding.useRef(revision);
|
|
env0_4.useEffect(_fun122692, [guild.id]);
|
|
env0_4.useEffect(_fun122693, [guild.id, revision]);
|
|
binding = env0_4;
|
|
let useCallback = binding.useCallback;
|
|
const value5 = Reflect.apply(useCallback, binding, [_fun122694, [guild.id, disabled, emojiItems, styles,
|
|
onSelectRolesForEmoji, canManageGuildExpression]]);
|
|
binding = env0_4;
|
|
useCallback = binding.useCallback;
|
|
items = [guild];
|
|
items[1] = emojis?.length;
|
|
items[2] = headerDescription;
|
|
items[3] = onSelectRolesForEmoji;
|
|
items[4] = disabled;
|
|
const value6 = Reflect.apply(useCallback, binding, [_fun122695, items]);
|
|
binding = env0_4;
|
|
useCallback = binding.useCallback;
|
|
if (emojis == null) {
|
|
r0 = <View style={styles.loadingContainer}>{((ActivityIndicator) => <ActivityIndicator />)((require(5461) /* metro dependency 5461: ActivityIndicatorNative */).ActivityIndicator)}{((NavScrim) => <NavScrim />)((require(5462) /* metro dependency 5462: NavScrimAndroid */).NavScrim)}</View>;
|
|
} else {
|
|
r0 = <FlatList initialNumToRender={12} ListHeaderComponent={value6} ListEmptyComponent={Reflect.apply(useCallback,
|
|
|
|
binding, [_fun122696,
|
|
[styles]])} windowSize={4} data={emojiItems} keyExtractor={env0_4.useCallback(function(a0) {
|
|
return a0.key;
|
|
}, [])} renderItem={value5} contentContainerStyle={[contentContainerStyle, styles.list]} />;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function computeSectionItem(a0, a1, a2) { // fn#122698, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:502, offset: 0x02571b11, size: 162 bytes, params: 4, frame: 18
|
|
const Math = global.Math;
|
|
let value = Math.max(a2 - a1, 0);
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
value = intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.sgL8sI, {count: value});
|
|
value = '' + a0 + ' - ' + value;
|
|
value = value.toUpperCase();
|
|
return {type: 'SECTION', key: value, section: value};
|
|
}
|
|
|
|
function _fun122700(a0, a1) { // fn#122700, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:738, offset: 0x02571bd0, size: 380 bytes, params: 3, frame: 23
|
|
var r1;
|
|
var items2;
|
|
var items3;
|
|
const env0_0 = a1;
|
|
let value = a0.filter(_fun122701);
|
|
value = value.map(computeEmojiItem);
|
|
value = value.reverse();
|
|
const maxEmojiSlots = require(dependencyMap[12]).getMaxEmojiSlots(a1);
|
|
value = importDefault(dependencyMap[6]).partition(value, function(a0) {
|
|
return !a0.emoji.animated;
|
|
});
|
|
value = env0_3(value, 2);
|
|
const property = value[0];
|
|
const property2 = value[1];
|
|
const computeSectionItemBinding = computeSectionItem;
|
|
const intl = require(dependencyMap[10]).intl;
|
|
const string = intl.string;
|
|
const t = require(dependencyMap[10]).t;
|
|
value = Reflect.apply(string, intl, [t.sMOuuS]);
|
|
value = computeSectionItemBinding(value, property.length, maxEmojiSlots);
|
|
const sectionItem = computeSectionItemBinding(intl.string(t.wWjQye), property2.length, maxEmojiSlots);
|
|
if (property.length > 0) {
|
|
items2 = [value];
|
|
arraySpread(items2, property, 1, dependencyMap);
|
|
r1 = items2;
|
|
} else {
|
|
r1 = [];
|
|
}
|
|
items2 = [];
|
|
value = arraySpread(items2, r1, 0, dependencyMap);
|
|
if (property2.length > 0) {
|
|
items3 = [sectionItem];
|
|
arraySpread(items3, property2, 1, dependencyMap);
|
|
r1 = items3;
|
|
} else {
|
|
r1 = [];
|
|
}
|
|
arraySpread(items2, r1, value, dependencyMap);
|
|
return items2;
|
|
}
|
|
|
|
function GuildSettingsModalEmoji({guildId, contentContainerStyle, isLandingScreen}) { // fn#122703, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:2954, offset: 0x02571d99, size: 373 bytes, params: 2, frame: 23
|
|
const guild = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildStore], function() {
|
|
return GuildStore.getGuild(guildId);
|
|
});
|
|
const value2 = (require(1484) /* metro dependency 1484: useNavigationNative */).useNavigation();
|
|
const styles = useStyles();
|
|
styles.useLayoutEffect(_fun122705, [value2, guild, isLandingScreen, styles]);
|
|
if (guild == null) {
|
|
return null;
|
|
}
|
|
const maxEmojiSlots = (require(8249) /* metro dependency 8249: GuildBoostingUtils */).getMaxEmojiSlots(guild);
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const formatToPlainString = intl.formatToPlainString;
|
|
const TA1BR0 = (require(1244) /* metro dependency 1244: indexNative */).t.TA1BR0;
|
|
const value4 = Reflect.apply(formatToPlainString, intl, [TA1BR0, {count: maxEmojiSlots}]);
|
|
const jsxRuntimeEnv0_11Binding = jsxRuntimeEnv0_11;
|
|
const manageEmojisModal = <ManageEmojisModal guild={guild} headerDescription={value4} computeEmojiItems={env0_16} contentContainerStyle={contentContainerStyle} />;
|
|
const NavScrim = (require(5462) /* metro dependency 5462: NavScrimAndroid */).NavScrim;
|
|
return (
|
|
<>
|
|
{manageEmojisModal}
|
|
<NavScrim />
|
|
</>
|
|
);
|
|
}
|
|
|
|
function _fun122692() { // fn#122692, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:1549, offset: 0x02571826, size: 28 bytes, params: 1, frame: 11
|
|
env1_12(guild.id);
|
|
}
|
|
|
|
function _fun122693() { // fn#122693, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:1585, offset: 0x02571842, size: 61 bytes, params: 1, frame: 12
|
|
var value2;
|
|
if (env0_9.current < revision) {
|
|
value2 = environment.__proto__;
|
|
env1_12(guild.id);
|
|
}
|
|
env0_9.current = revision;
|
|
}
|
|
|
|
function _fun122694({item, index}) { // fn#122694, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:1656, offset: 0x0257187f, size: 347 bytes, params: 2, frame: 21
|
|
var r5;
|
|
var r9;
|
|
var value;
|
|
var binding;
|
|
var property;
|
|
var value2;
|
|
var value5;
|
|
var EmojiRow;
|
|
var object2;
|
|
var Text;
|
|
var section;
|
|
let type = item.type;
|
|
if (type === 'SECTION') {
|
|
value = environment.__proto__;
|
|
Text = (require(4573) /* metro dependency 4573: Text */).Text;
|
|
object2 = {'style': null, 'variant': 'text-xs/bold', 'color': 'text-default'};
|
|
section = styles.section;
|
|
object2.style = section;
|
|
section = item.section;
|
|
return (
|
|
<Text {...object2}>
|
|
{section}
|
|
</Text>
|
|
);
|
|
}
|
|
if (type === 'EMOJI') {
|
|
binding = env0_7;
|
|
property = binding[index - 1];
|
|
value2 = undefined;
|
|
type = property == null ? value2 : property.type;
|
|
binding = env0_7;
|
|
property = binding[index + 1];
|
|
r5 = (property == null ? value2 : property.type) === 'SECTION' || index === env0_7.length - 1;
|
|
value5 = environment.__proto__;
|
|
EmojiRow = (require(15906) /* metro dependency 15906: EmojiRow */).EmojiRow;
|
|
var emojiRowProps = {emoji: item.emoji, guildId: guild.id};
|
|
r9 = disabled || !item.emoji.available;
|
|
r9 = !r9 ? !canManageGuildExpression(item.emoji) : r9;
|
|
emojiRowProps.disabled = r9;
|
|
emojiRowProps.onSelectRolesForEmoji = onSelectRolesForEmoji;
|
|
emojiRowProps.start = type === 'SECTION';
|
|
emojiRowProps.end = r5;
|
|
return <EmojiRow {...emojiRowProps} />;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function _fun122695() { // fn#122695, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:2142, offset: 0x025719da, size: 123 bytes, params: 1, frame: 17
|
|
let value = environment.__proto__;
|
|
value = undefined;
|
|
const ConnectedHeaderRow = (require(15910) /* metro dependency 15910: HeaderRow */).ConnectedHeaderRow;
|
|
return (
|
|
<ConnectedHeaderRow
|
|
guild={guild}
|
|
emojisLength={(emojis == null ? value : emojis.length) ?? 0}
|
|
description={headerDescription}
|
|
onSelectRolesForEmoji={onSelectRolesForEmoji}
|
|
uploadDisabled={disabled}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function _fun122696() { // fn#122696, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:2361, offset: 0x02571a55, size: 188 bytes, params: 1, frame: 19
|
|
const EmptyState = (require(1305) /* metro dependency 1305: native */).EmptyState;
|
|
const object2 = {};
|
|
const EmptyServerSettingsEmoji = (require(15911) /* metro dependency 15911: EmptyServerSettingsEmoji */).EmptyServerSettingsEmoji;
|
|
object2.Illustration = EmptyServerSettingsEmoji;
|
|
object2.style = styles.emptyState;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
let string = intl.string;
|
|
object2.title = Reflect.apply(string, intl, [(require(1244) /* metro dependency 1244: indexNative */).t.lxsmBd]);
|
|
string = intl.string;
|
|
const RBbtMy = (require(1244) /* metro dependency 1244: indexNative */).t.RBbtMy;
|
|
object2.body = Reflect.apply(string, intl, [RBbtMy]);
|
|
return <EmptyState {...object2} />;
|
|
}
|
|
|
|
function _fun122701(a0) { // fn#122701, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:762, offset: 0x02571d4c, size: 57 bytes, params: 2, frame: 13
|
|
let value = environment.__proto__;
|
|
value = require(6545) /* metro dependency 6545: RoleSubscriptionEmojiUtils */;
|
|
return !value.isRoleSubscriptionEmoji(a0, require.id);
|
|
}
|
|
|
|
function _fun122705() { // fn#122705, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:3156, offset: 0x02571f0e, size: 58 bytes, params: 1, frame: 12
|
|
var binding;
|
|
if (isLandingScreen && guild !== undefined) {
|
|
binding = env0_3;
|
|
binding.setOptions({headerTitle: headerTitle_122706});
|
|
}
|
|
}
|
|
|
|
function headerTitle_122706() { // fn#122706, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:3202, offset: 0x02571f48, size: 95 bytes, params: 1, frame: 17
|
|
const NavigatorHeader = (require(5282) /* metro dependency 5282: NavigatorHeaderNative */).NavigatorHeader;
|
|
return (
|
|
<View style={styles.titleContainer}>
|
|
<NavigatorHeader title={guild.name} />
|
|
</View>
|
|
);
|
|
}
|
|
|