Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4823.js (118.4 MB)
271 lines
14 KiB
TypeScript
271 lines
14 KiB
TypeScript
// Module ID: 11938
|
|
// Function ID: 11939
|
|
// Name: AcceptGuildTemplate
|
|
// Dependencies: [19, 17, 1962, 2017, 1074, 7436, 21, 4638, 576, 5610, 5663, 1177, 11939, 1115, 7089, 38, 1612, 2018, 4634, 11941, 6713, 5060, 8734, 12, 9853, 11946, 11947, 11097, 1092, 2]
|
|
// Exports: default
|
|
|
|
// Module 11938 (AcceptGuildTemplate)
|
|
import _modDef12 from "module_12" /* 12 */;
|
|
import _modDef38 from "module_38" /* 38 */;
|
|
import nativeDefault from "native" /* 576 */;
|
|
import utils_ColorUtils from "utils/ColorUtils" /* 1092 */;
|
|
import util from "util" /* 1115 */;
|
|
import native from "native" /* 1177 */;
|
|
import useSafeAreaInsetsDefault from "useSafeAreaInsets" /* 1612 */;
|
|
import GuildRoleRecordUtilsAll from "GuildRoleRecordUtils" /* 2018 */;
|
|
import ActivityIndicator_ActivityIndicator from "ActivityIndicator/ActivityIndicator" /* 5663 */;
|
|
import FreeFormInputGroupDefault from "FreeFormInputGroup" /* 6713 */;
|
|
import RolePillDefault from "RolePill" /* 11097 */;
|
|
import InvalidLink from "InvalidLink" /* 11939 */;
|
|
import GuildIconUploaderDefault from "GuildIconUploader" /* 11941 */;
|
|
import noop from "module_19" /* 19 */;
|
|
import TextStyles_mod from "TextStyles" /* 5610 */;
|
|
|
|
const FormDividerDefault = tmp5(8734);
|
|
require = fn;
|
|
function GuildTemplateResolving() {
|
|
return closure_1_11(React4, { style: closure_14().resolvingContainer, children: closure_1_11(ActivityIndicator_ActivityIndicator.ActivityIndicator, {}) });
|
|
}
|
|
function GuildTemplateResolved(guildTemplate) {
|
|
guildTemplate = guildTemplate.guildTemplate;
|
|
const errors = guildTemplate.errors;
|
|
({ createServer, name, setName, icon, chooseIcon } = guildTemplate);
|
|
const tmp = closure_14();
|
|
const typeConsolidationTextTransform = guildTemplate(7089).useTypeConsolidationTextTransform("AcceptGuildTemplate");
|
|
_modDef38(null != guildTemplate, "guild template cannot be null");
|
|
_modDef38(guildTemplate.state !== GuildTemplateStates.RESOLVING, "guild must be resolved");
|
|
const roles = guildTemplate.serializedSourceGuild.roles;
|
|
const mapped = roles.map((item) => GuildRoleRecordUtilsAll.fromServer(guildTemplate.serializedSourceGuild.id, item));
|
|
const found = mapped.filter((item) => !isEveryoneRole(item));
|
|
const obj2 = { contentContainerStyle: null, keyboardShouldPersistTaps: "handled", children: null };
|
|
const items = [tmp.wrapper, { marginBottom: useSafeAreaInsetsDefault().bottom }];
|
|
obj2.contentContainerStyle = items;
|
|
const obj3 = { style: tmp.header, variant: "heading-xl/extrabold", color: "mobile-text-heading-primary", children: null };
|
|
const intl = guildTemplate(1115).intl;
|
|
obj3.children = intl.string(guildTemplate(1115).t.QzUORX);
|
|
const items1 = [closure_11(guildTemplate(4634).Text, obj3), closure_11(guildTemplate(4634).Text, { style: tmp.description, variant: "text-lg/medium", color: "text-default", children: guildTemplate.name }), closure_11(GuildIconUploaderDefault, { iconBackgroundColor: tmp.wrapper.backgroundColor, style: tmp.iconUploader, onPress: chooseIcon, icon }), , , , , , , , ];
|
|
const obj6 = { label: null, error: null, hint: null, value: null, onChangeText: null, autoFocus: true, autoCorrect: false, returnKeyType: "done" };
|
|
const obj = guildTemplate(7089);
|
|
const obj4 = { style: tmp.description, variant: "text-lg/medium", color: "text-default", children: guildTemplate.name };
|
|
const obj5 = { iconBackgroundColor: tmp.wrapper.backgroundColor, style: tmp.iconUploader, onPress: chooseIcon, icon };
|
|
const tmp10 = closure_5;
|
|
const intl2 = guildTemplate(1115).intl;
|
|
obj6.label = intl2.string(guildTemplate(1115).t.dBih7e);
|
|
let name1;
|
|
if (errors != null) {
|
|
name1 = errors.name;
|
|
}
|
|
obj6.error = name1;
|
|
const intl3 = tmp2(1115).intl;
|
|
obj6.hint = intl3.format(guildTemplate(1115).t["2bprXx"], { guidelinesURL: constants.GUIDELINES });
|
|
obj6.value = name;
|
|
obj6.onChangeText = setName;
|
|
items1[3] = closure_11(FreeFormInputGroupDefault, obj6);
|
|
const obj8 = { style: tmp.createButtonWrapper, children: null };
|
|
const obj9 = { size: "md", text: null, onPress: null, loading: null, disabled: null, grow: true };
|
|
const intl4 = tmp2(1115).intl;
|
|
obj9.text = intl4.string(guildTemplate(1115).t["O0p/lS"]);
|
|
obj9.onPress = createServer;
|
|
obj9.loading = guildTemplate.state === GuildTemplateStates.ACCEPTING;
|
|
obj9.disabled = guildTemplate.state === GuildTemplateStates.ACCEPTING;
|
|
obj8.children = closure_11(guildTemplate(5060).Button, obj9);
|
|
items1[4] = closure_11(closure_4, obj8);
|
|
items1[5] = closure_11(FormDividerDefault, { style: tmp.divider, outer: true });
|
|
const obj11 = { style: tmp.sectionHeader, variant: "heading-md/extrabold", color: "mobile-text-heading-primary", children: null };
|
|
const intl5 = tmp2(1115).intl;
|
|
obj11.children = intl5.string(guildTemplate(1115).t.OGiMXJ);
|
|
items1[6] = closure_11(guildTemplate(4634).Text, obj11);
|
|
const obj12 = { variant: "text-xs/medium", color: "text-default", children: null };
|
|
const intl6 = tmp2(1115).intl;
|
|
obj12.children = intl6.string(guildTemplate(1115).t.Ztwyoz);
|
|
items1[7] = closure_11(guildTemplate(4634).Text, obj12);
|
|
items1[8] = closure_11(Channels, { channels: guildTemplate.serializedSourceGuild.channels });
|
|
const obj14 = { style: tmp.sectionTip, variant: "text-xs/medium", color: "interactive-text-default", children: null };
|
|
const obj15 = { style: null, children: null };
|
|
const items2 = [tmp.protip, typeConsolidationTextTransform];
|
|
obj15.style = items2;
|
|
const intl7 = tmp2(1115).intl;
|
|
const items3 = [intl7.string(guildTemplate(1115).t["8tvIiN"]), ": "];
|
|
obj15.children = items3;
|
|
const items4 = [closure_12(guildTemplate(1177).LegacyText, obj15), ];
|
|
const intl8 = tmp2(1115).intl;
|
|
items4[1] = intl8.string(guildTemplate(1115).t.de7DpI);
|
|
obj14.children = items4;
|
|
items1[9] = closure_12(guildTemplate(4634).Text, obj14);
|
|
let tmp9Result = null;
|
|
if (found.length > 0) {
|
|
const obj16 = { children: null };
|
|
const obj17 = { style: tmp.sectionHeader, variant: "heading-md/extrabold", color: "mobile-text-heading-primary", children: null };
|
|
const intl9 = tmp2(1115).intl;
|
|
obj17.children = intl9.string(tmp2(1115).t.mQ0H1p);
|
|
const items5 = [tmp11(tmp2(4634).Text, obj17), , ];
|
|
const obj18 = { variant: "text-xs/medium", color: "text-default", children: null };
|
|
const intl10 = tmp2(1115).intl;
|
|
obj18.children = intl10.string(tmp2(1115).t.jOPEYC);
|
|
items5[1] = tmp11(tmp2(4634).Text, obj18);
|
|
const obj19 = { roles: found };
|
|
items5[2] = tmp11(Roles, obj19);
|
|
obj16.children = items5;
|
|
tmp9Result = tmp9(closure_13, obj16);
|
|
}
|
|
items1[10] = tmp9Result;
|
|
obj2.children = items1;
|
|
return closure_12(tmp10, obj2);
|
|
}
|
|
function Channels(channels) {
|
|
const tmp = closure_14();
|
|
closure_0 = tmp;
|
|
let obj = _modDef12(channels.channels);
|
|
const sortByResult = _modDef12(channels.channels).sortBy((parent_id) => {
|
|
if (null == parent_id.parent_id) {
|
|
const _Number2 = Number;
|
|
let result = 10000 * Number(parent_id.id);
|
|
} else {
|
|
const _Number = Number;
|
|
result = 10000 * Number(parent_id.parent_id) + parent_id.id;
|
|
}
|
|
return result;
|
|
});
|
|
let obj2 = {
|
|
style: null,
|
|
children: _modDef12(channels.channels).sortBy((parent_id) => {
|
|
if (null == parent_id.parent_id) {
|
|
const _Number2 = Number;
|
|
let result = 10000 * Number(parent_id.id);
|
|
} else {
|
|
const _Number = Number;
|
|
result = 10000 * Number(parent_id.parent_id) + parent_id.id;
|
|
}
|
|
return result;
|
|
}).map((children) => {
|
|
const obj = { style: closure_0.channelRow, children: null };
|
|
const items = [closure_0.channelIcon, ];
|
|
let channelCategoryIcon = null;
|
|
if (children.type === constants2.GUILD_CATEGORY) {
|
|
channelCategoryIcon = tmp5.channelCategoryIcon;
|
|
}
|
|
const obj2 = { style: items, color: nativeDefault.unsafe_rawColors.PRIMARY_400, size: native.Icon.Sizes.CUSTOM, source: null };
|
|
items[1] = channelCategoryIcon;
|
|
const type = children.type;
|
|
if (isGuildVocalChannelType(type)) {
|
|
let tmp10Result = tmp10(9853);
|
|
} else if (type === constants2.GUILD_CATEGORY) {
|
|
tmp10Result = tmp10(11946);
|
|
} else {
|
|
tmp10Result = tmp10(11947);
|
|
}
|
|
obj2.source = tmp10Result;
|
|
const items1 = [closure_2_11(native.Icon, obj2), ];
|
|
const items2 = [closure_0.channelName, ];
|
|
let channelCategoryName = null;
|
|
if (children.type === constants2.GUILD_CATEGORY) {
|
|
channelCategoryName = tmp5.channelCategoryName;
|
|
}
|
|
items2[1] = channelCategoryName;
|
|
items1[1] = closure_2_11(native.LegacyText, { numberOfLines: 1, style: items2, children: children.name });
|
|
obj.children = items1;
|
|
return closure_2_12(React4, obj, children.id);
|
|
}).value()
|
|
};
|
|
let items = [, ];
|
|
({ rolesChannelsWrapper: arr2[0], channelsWrapper: arr2[1] } = tmp);
|
|
obj2.style = items;
|
|
return closure_11(closure_4, obj2);
|
|
}
|
|
function Roles(roles) {
|
|
roles = roles.roles;
|
|
const substr = roles.slice();
|
|
const reversed = substr.reverse();
|
|
let obj = {
|
|
style: null,
|
|
children: reversed.map((role) => {
|
|
const obj = { disableInteraction: true, role, color: null };
|
|
let int2hexResult;
|
|
if (0 !== role.color) {
|
|
int2hexResult = utils_ColorUtils.int2hex(role.color);
|
|
}
|
|
obj.color = int2hexResult;
|
|
return closure_1_11(RolePillDefault, obj, role.id);
|
|
})
|
|
};
|
|
const items = [, ];
|
|
({ rolesChannelsWrapper: arr3[0], rolesWrapper: arr3[1] } = closure_14());
|
|
obj.style = items;
|
|
return closure_1_11(React4, obj);
|
|
}
|
|
get_ActivityIndicator = fn(17);
|
|
({ View: closure_4, ScrollView: hasOwnProperty } = get_ActivityIndicator);
|
|
const isGuildVocalChannelType = fn(1962).isGuildVocalChannelType;
|
|
const isEveryoneRole = fn(2017).isEveryoneRole;
|
|
const Constants = fn(1074);
|
|
({ MarketingURLs: closure_8, Fonts, ChannelTypes: closure_9 } = Constants);
|
|
const GuildTemplateStates = fn(7436).GuildTemplateStates;
|
|
const jsxProd = fn(21);
|
|
({ jsx: closure_11, jsxs: closure_12, Fragment: map1 } = jsxProd);
|
|
const createStyles = fn(4638);
|
|
let obj = { wrapper: { backgroundColor: nativeDefault.colors.BACKGROUND_BASE_LOWER, padding: 16 }, header: null, description: null, iconUploader: null, createButtonWrapper: null, resolvingContainer: null, divider: null, sectionHeader: null, rolesChannelsWrapper: null, channelsWrapper: null, rolesWrapper: null, channelRow: null, channelIcon: null, channelCategoryIcon: null, channelName: null, channelCategoryName: null, sectionTip: null, protip: null };
|
|
let TextStyles = TextStyles_mod;
|
|
let merged = Object.assign(TextStyles(Fonts.DISPLAY_EXTRABOLD, nativeDefault.colors.MOBILE_TEXT_HEADING_PRIMARY, 24));
|
|
obj.header = { textAlign: "center" };
|
|
obj.description = { textAlign: "center", marginTop: 8, marginBottom: 32 };
|
|
obj.iconUploader = { alignSelf: "center", marginBottom: 12 };
|
|
obj.createButtonWrapper = { marginTop: 8 };
|
|
obj.resolvingContainer = { alignItems: "center", flex: 1, justifyContent: "center" };
|
|
obj.divider = { marginTop: 8 };
|
|
let obj5 = {};
|
|
let TextStyles = TextStyles_mod;
|
|
let merged1 = Object.assign(TextStyles(Fonts.DISPLAY_EXTRABOLD, nativeDefault.colors.MOBILE_TEXT_HEADING_PRIMARY, 16));
|
|
obj5.marginTop = 24;
|
|
obj.sectionHeader = obj5;
|
|
let obj3 = { backgroundColor: nativeDefault.colors.BACKGROUND_BASE_LOWER, padding: 16 };
|
|
let obj4 = { textAlign: "center" };
|
|
obj.rolesChannelsWrapper = { backgroundColor: nativeDefault.colors.BACKGROUND_SURFACE_HIGH, borderRadius: nativeDefault.radii.sm, marginTop: 8, padding: 8 };
|
|
obj.channelsWrapper = { flexDirection: "column", paddingVertical: 0 };
|
|
obj.rolesWrapper = { flexDirection: "row", flexWrap: "wrap" };
|
|
obj.channelRow = { alignItems: "center", flexDirection: "row", height: 40 };
|
|
obj.channelIcon = { marginLeft: 12, marginRight: 8, height: 20, width: 20 };
|
|
obj.channelCategoryIcon = { marginLeft: 0, marginRight: 2, height: 12, width: 12 };
|
|
let obj6 = { backgroundColor: nativeDefault.colors.BACKGROUND_SURFACE_HIGH, borderRadius: nativeDefault.radii.sm, marginTop: 8, padding: 8 };
|
|
obj.channelName = { color: nativeDefault.colors.CHANNELS_DEFAULT, fontSize: 16, flex: 1 };
|
|
let merged2 = Object.assign(TextStyles(Fonts.DISPLAY_EXTRABOLD, undefined, 12, { uppercase: true }));
|
|
obj.channelCategoryName = {};
|
|
obj.sectionTip = { marginTop: 8 };
|
|
const obj7 = { color: nativeDefault.colors.CHANNELS_DEFAULT, fontSize: 16, flex: 1 };
|
|
let obj8 = {};
|
|
obj.protip = { color: nativeDefault.unsafe_rawColors.GREEN_360, fontFamily: Fonts.PRIMARY_BOLD, textTransform: "uppercase" };
|
|
let closure_14 = createStyles.createStyles(obj);
|
|
let closure_16 = noop.memo(() => {
|
|
const obj = { Illustration: InvalidLink.InvalidLink, title: null, body: null };
|
|
const intl = util.intl;
|
|
obj.title = intl.string(util.t.C7ZRNw);
|
|
const intl2 = util.intl;
|
|
obj.body = intl2.string(util.t.A6MwXE);
|
|
return closure_1_11(native.EmptyState, obj);
|
|
});
|
|
const size = fn(2);
|
|
let result = size.fileFinishedImporting("modules/create_guild/native/AcceptGuildTemplate.tsx");
|
|
|
|
export default function AcceptGuildTemplate(guildTemplate) {
|
|
guildTemplate = guildTemplate.guildTemplate;
|
|
if (null != guildTemplate) {
|
|
const state = guildTemplate.state;
|
|
if (GuildTemplateStates.RESOLVED !== state) {
|
|
if (tmp.ACCEPTING !== state) {
|
|
if (tmp.ACCEPTED !== state) {
|
|
if (tmp.RESOLVING === state) {
|
|
const obj2 = {};
|
|
const merged = Object.assign(guildTemplate);
|
|
return closure_1_11(GuildTemplateResolving, obj2);
|
|
} else if (tmp.EXPIRED === state) {
|
|
return closure_1_11(closure_16, {});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const obj3 = {};
|
|
const merged1 = Object.assign(guildTemplate);
|
|
return closure_1_11(GuildTemplateResolved, obj3);
|
|
}
|
|
const merged2 = Object.assign(guildTemplate);
|
|
return closure_1_11(GuildTemplateResolving, {});
|
|
};
|