// Module ID: 14180 // Function ID: 14181 // Name: SafetyHubViolationsHeader // Dependencies: [32, 19, 17, 11100, 5443, 676, 21, 4668, 712, 8947, 8117, 4739, 1236, 13061, 9501, 5442, 11, 14181, 5444, 5265, 11097, 2008, 11107, 589, 698, 11105, 2] // Exports: ConnectedSafetyHubViolationsContainer // Module 14180 (SafetyHubViolationsHeader) import ThemesDefault from "Themes" /* 712 */; import getSystemLocale from "getSystemLocale" /* 1236 */; import Text from "Text" /* 4739 */; import parseMessageEmbedForProps from "parseMessageEmbedForProps" /* 5442 */; import WarningIcon from "WarningIcon" /* 8117 */; import renderDefault from "render" /* 8947 */; import useSafetyHubClassifications from "useSafetyHubClassifications" /* 11105 */; import closure_3 from "_slicedToArray" /* 32 */; import closure_4 from "noop" /* 19 */; import get_ActivityIndicator from "get ActivityIndicator" /* 17 */; import closure_7 from "handleSafetyHubRequestAgeVerificationResetModalAction" /* 11100 */; import SafetyHubView from "SafetyHubView" /* 5443 */; import { AnalyticEvents } from "ME" /* 676 */; import jsxProd from "jsxProd" /* 21 */; import createCacheKey from "createCacheKey" /* 4668 */; require = arg1; function SafetyHubViolationsHeader(count) { ({ onClick, opened, status } = count); const tmp = callback3(); let obj = { onPress: onClick, style: items, children: null }; items = [tmp.header]; obj = { style: items1, children: null }; items1 = [tmp.iconBackground]; const colors = ThemesDefault.colors; obj = { color: tmp8 ? colors.INTERACTIVE_TEXT_DEFAULT : colors.ICON_MUTED, size: "xs" }; obj[1] = closure_11(WarningIcon.WarningIcon, obj); const items2 = [closure_11(closure_6, obj), , ]; obj1 = { style: items3, children: null }; items3 = [tmp.headerTextContainer]; const intl = tmp7(1236).intl; const formatToPlainString = intl.formatToPlainString; const t = tmp7(1236).t; if ("active" === status) { const obj2 = { count: null }; obj2[0] = str.toString(); let formatToPlainStringResult = formatToPlainString(t.IeV2oY, obj2); } else { const obj3 = { count: null }; obj3[0] = str.toString(); formatToPlainStringResult = formatToPlainString(t.fZAHBT, obj3); } const items4 = [closure_11(Text.Text, { variant: "heading-sm/semibold", children: formatToPlainStringResult }), ]; const intl2 = tmp7(1236).intl; const string = intl2.string; const t2 = tmp7(1236).t; if ("active" === status) { let stringResult = string(t2.XJ2YVR); } else { stringResult = string(t2.SzGV0g); } items4[1] = closure_11(Text.Text, { variant: "text-xxs/normal", color: "text-muted", children: stringResult }); obj1[1] = items4; items2[1] = closure_12(closure_6, obj1); if (opened) { let ChevronSmallDownIcon = tmp7(13061).ChevronSmallUpIcon; } else { ChevronSmallDownIcon = tmp7(9501).ChevronSmallDownIcon; } const items5 = [tmp.chevron]; items2[2] = closure_11(ChevronSmallDownIcon, { size: "md", style: items5 }); obj[2] = items2; return closure_12(renderDefault, obj); } function EmptyActiveState() { let obj = { style: null, children: null }; const items = [callback3().emptyState]; obj[0] = items; obj = { variant: "heading-sm/extrabold", children: null }; const intl = getSystemLocale.intl; obj[1] = intl.string(getSystemLocale.t.reLFaV); const items1 = [callback(Text.Text, obj), ]; obj = { variant: "text-xs/normal", children: null }; const intl2 = getSystemLocale.intl; obj[1] = intl2.string(getSystemLocale.t.ERdH1o); items1[1] = callback(Text.Text, obj); obj[1] = items1; return callback2(closure_6, obj); } function EmptyExpiredState() { let obj = { style: null, children: null }; const items = [callback3().emptyState]; obj[0] = items; obj = { variant: "text-xs/normal", children: null }; const intl = getSystemLocale.intl; obj[1] = intl.string(getSystemLocale.t.RV3AXf); obj[1] = callback(Text.Text, obj); return callback(closure_6, obj); } function RelativeIncidentTime(timestamp) { let obj = { style: callback3().incidentDate, children: null }; obj = { variant: "text-xs/medium", children: parseMessageEmbedForProps.getClassificationRelativeIncidentTime(timestamp.timestamp) }; obj[1] = callback(Text.Text, obj); return callback(closure_6, obj); } function NewBadge() { const tmp = callback3(); let obj = { style: items, children: null }; items = [, ]; ({ incidentDate: arr[0], incidentDateNew: arr[1] } = tmp); obj = { variant: "text-xs/medium", color: "text-overlay-light", style: tmp.newText, children: null }; const intl = getSystemLocale.intl; obj[3] = intl.string(getSystemLocale.t.QKMRC4); obj[1] = callback(Text.Text, obj); return callback(closure_6, obj); } function ClassificationDetail(classification) { classification = classification.classification; let id; let description; let guild_metadata; const tmp = callback3(); id = classification.id; description = classification.description; guild_metadata = classification.guild_metadata; let obj = description(guild_metadata[16]); obj1 = id(guild_metadata[17]); const isNewClassification = obj1.useIsNewClassification(classification); const items = [description, guild_metadata]; const items1 = [tmp.detailContainerOuter, ]; let prop = null; const memo = React.useMemo(() => { function hook(children) { return callback2(callback(table[11]).Text, { variant: "heading-md/extrabold", children }, arg1); } let name = { description, descriptionHook: hook }; let tmp4 = null; if (null != guild_metadata) { let member_type; if (tmp3 != tmp4) { member_type = tmp3.member_type; } let Lb0HVv = id; name = guild_metadata; if (member_type === id(guild_metadata[18]).MemberType.OWNER) { const intl3 = Lb0HVv(name[12]).intl; Lb0HVv = Lb0HVv(name[12]).t.Lb0HVv; name = {}; const merged = Object.assign(name); tmp4 = tmp3 == tmp4; name = undefined; if (!tmp4) { name = tmp3.name; } name.guildName = name; let formatResult = intl3.format(Lb0HVv, name); } else { const intl2 = Lb0HVv(name[12]).intl; const obj = { classification_type: null, classificationHook: null, guildName: null }; obj[0] = tmp2; obj[1] = hook; name = undefined; if (tmp3 != tmp4) { name = tmp3.name; } obj[2] = name; formatResult = intl2.format(Lb0HVv(name[12]).t.rmpEPD, obj); } } else { const intl = id(guild_metadata[12]).intl; return intl.format(id(guild_metadata[12]).t.QY4g5t, name); } }, items); if (isNewClassification) { prop = tmp.detailContainerOuterNew; } obj = { style: items1, children: null }; items1[1] = prop; obj = { onPress() { let obj = description(guild_metadata[19]); obj = { classificationId: id, source: closure_1_8.StandingTab }; obj.pushLazy(id(guild_metadata[21])(guild_metadata[20], guild_metadata.paths), obj); }, children: null }; obj1 = { style: items2, children: null }; items2 = [tmp.detailContainerInner]; const extractTimestampResult = obj.extractTimestamp(id); const tmp2 = description; const tmp5 = id; if (isNewClassification) { let tmp8Result = tmp8(NewBadge, {}); } else { const obj2 = { timestamp: null }; obj2[0] = extractTimestampResult; tmp8Result = tmp8(RelativeIncidentTime, obj2); } const items3 = [tmp8Result, closure_11(tmp5(guild_metadata[11]).Text, { variant: "heading-md/normal", children: memo })]; obj1[1] = items3; obj[1] = closure_12(closure_6, obj1); obj[1] = closure_11(description(guild_metadata[9]), obj); return closure_11(closure_6, obj); } class SafetyHubViolationsContainer { constructor(arg0) { ({ status, classifications } = global); closure_1 = undefined; closure_2 = undefined; closure_3 = undefined; closure_4 = undefined; closure_5 = undefined; closure_6 = undefined; closure_7 = undefined; closure_8 = undefined; tmp = closure_14(); tmp2 = closure_3(closure_4.useState(false), 2); first = tmp2[0]; closure_1 = first; closure_2 = tmp2[1]; tmp4 = closure_3(require("module_3"), 2); first1 = tmp4[0]; closure_3 = first1; closure_4 = tmp4[1]; tmp6 = classifications; tmp7 = closure_2; obj = require("useSafetyHubAccountStanding"); safetyHubAccountStanding = obj.useSafetyHubAccountStanding(); closure_5 = safetyHubAccountStanding; obj2 = require("initialize"); items = []; items[0] = closure_7; stateFromStores = obj2.useStateFromStores(items, () => memo.getIsDsaEligible()); closure_6 = stateFromStores; items1 = [, ]; items1[0] = classifications; items1[1] = first1; memo = closure_4.useMemo(() => classifications.slice(0, first1), items1); closure_7 = memo; items2 = [, , , ]; items2[0] = first; items2[1] = safetyHubAccountStanding.state; items2[2] = memo; items2[3] = stateFromStores; effect = closure_4.useEffect(() => { if (first) { let obj = first(698); obj = { action: null, account_standing: null, classification_ids: null, source: null, is_violative_content_shown: false, is_dsa_eligible: null }; obj[0] = closure_1_9.ViewViolationsDropdown; obj[1] = safetyHubAccountStanding.state; obj[2] = memo.map((id) => Number(id.id)); obj[3] = num.StandingTab; obj[5] = stateFromStores; obj.track(closure_1_10.SAFETY_HUB_ACTION, obj); } }, items2); num = 3; if (classifications.length - memo.length <= 3) { num = classifications.length - memo.length; } closure_8 = num; tmp11 = jsxs; tmp12 = closure_6; obj = { style: items3, children: null }; items3 = []; items3[0] = tmp.container; tmp13 = jsx; obj1 = { status, onClick() { return dependencyMap((arg0) => !arg0); }, opened: first, count: classifications.length }; items4 = [, ]; items4[0] = jsx(SafetyHubViolationsHeader, obj1); if (first) { obj2 = { style: null }; items5 = []; items5[0] = tmp.separator; obj2[0] = items5; items6 = [, , , , ]; items6[0] = tmp13(tmp12, obj2); num2 = 0; tmp14 = memo.length > 0 && memo.map((classification) => callback2(closure_20, { classification }, classification.id)); items6[1] = tmp14; tmp11Result = memo.length < classifications.length; if (tmp11Result) { tmp16 = Fragment; obj3 = { children: null }; obj4 = { style: null }; items7 = []; items7[0] = tmp.separator; obj4[0] = items7; items8 = [, ]; items8[0] = tmp13(tmp12, obj4); obj5 = { style: null, children: null }; items9 = []; items9[0] = tmp.moreButtonContainer; obj5[0] = items9; tmp17 = closure_5; obj6 = { style: null, onPress: null, children: null }; items10 = []; items10[0] = tmp.moreButton; obj6[0] = items10; obj6[1] = function onPress() { return callback((arg0) => arg0 + closure_8); }; obj7 = { variant: "heading-sm/semibold", children: null }; intl = require("getSystemLocale").intl; obj8 = { nextPageSize: null }; obj8[0] = num; obj7[1] = intl.format(require("getSystemLocale").t["9Ml56H"], obj8); obj6[2] = tmp13(require("Text").Text, obj7); obj5[1] = tmp13(closure_5, obj6); items8[1] = tmp13(tmp12, obj5); obj3[0] = items8; tmp11Result = tmp11(Fragment, obj3); } items6[2] = tmp11Result; tmp13Result = 0 === memo.length; if (tmp13Result) { str = "active"; tmp13Result = "active" === status; } if (tmp13Result) { tmp19 = EmptyActiveState; tmp13Result = tmp13(EmptyActiveState, {}); } items6[3] = tmp13Result; tmp13Result1 = 0 === memo.length; if (tmp13Result1) { str2 = "expired"; tmp13Result1 = "expired" === status; } if (tmp13Result1) { tmp21 = EmptyExpiredState; tmp13Result1 = tmp13(EmptyExpiredState, {}); } obj9 = { children: null }; items6[4] = tmp13Result1; obj9[0] = items6; first = tmp11(tmp12, obj9); } items4[1] = first; obj[1] = items4; return tmp11(tmp12, obj); } } ({ Pressable: c5, View: closure_6 } = get_ActivityIndicator); ({ SafetyHubAnalyticsActionSource: closure_8, SafetyHubAnalyticsActions: c9 } = SafetyHubView); ({ jsx: unpackModuleId, jsxs: closure_12, Fragment: map1 } = jsxProd); createCacheKey = { connectedContainer: null, container: null, header: null, detailContainerOuter: null, detailContainerOuterNew: null, detailContainerInner: null, iconBackground: null, chevron: null, incidentDate: null, incidentDateNew: null, newText: null, emptyState: null, separator: null, moreButtonContainer: null, moreButton: null, headerTextContainer: null }; createCacheKey = { display: "flex", marginTop: ThemesDefault.space.PX_12, marginBottom: 36, gap: ThemesDefault.space.PX_12 }; createCacheKey[0] = createCacheKey; createCacheKey[1] = { backgroundColor: ThemesDefault.colors.CARD_BACKGROUND_DEFAULT, borderRadius: ThemesDefault.radii.md, padding: ThemesDefault.space.PX_8, width: "100%" }; let obj1 = { backgroundColor: ThemesDefault.colors.CARD_BACKGROUND_DEFAULT, borderRadius: ThemesDefault.radii.md, padding: ThemesDefault.space.PX_8, width: "100%" }; createCacheKey[2] = { display: "flex", flexDirection: "row", alignItems: "center", gap: ThemesDefault.space.PX_16, width: "100%" }; let obj2 = { display: "flex", flexDirection: "row", alignItems: "center", gap: ThemesDefault.space.PX_16, width: "100%" }; createCacheKey[3] = { backgroundColor: ThemesDefault.colors.BACKGROUND_MOD_STRONG, borderRadius: ThemesDefault.radii.md, padding: ThemesDefault.space.PX_12, marginTop: 10 }; let obj3 = { backgroundColor: ThemesDefault.colors.BACKGROUND_MOD_STRONG, borderRadius: ThemesDefault.radii.md, padding: ThemesDefault.space.PX_12, marginTop: 10 }; createCacheKey[4] = { borderColor: ThemesDefault.colors.CONTROL_PRIMARY_BACKGROUND_DEFAULT, borderWidth: 1, borderStyle: "solid" }; let obj4 = { borderColor: ThemesDefault.colors.CONTROL_PRIMARY_BACKGROUND_DEFAULT, borderWidth: 1, borderStyle: "solid" }; createCacheKey[5] = { display: "flex", gap: ThemesDefault.space.PX_8 }; let obj5 = { display: "flex", gap: ThemesDefault.space.PX_8 }; createCacheKey[6] = { display: "flex", borderRadius: ThemesDefault.radii.round, backgroundColor: ThemesDefault.colors.BACKGROUND_BASE_LOWEST, justifyContent: "center", alignItems: "center", padding: 6 }; createCacheKey[7] = { marginLeft: "auto" }; let obj6 = { display: "flex", borderRadius: ThemesDefault.radii.round, backgroundColor: ThemesDefault.colors.BACKGROUND_BASE_LOWEST, justifyContent: "center", alignItems: "center", padding: 6 }; createCacheKey[8] = { alignSelf: "flex-start", backgroundColor: ThemesDefault.colors.BACKGROUND_BASE_LOWEST, borderRadius: ThemesDefault.radii.md, paddingVertical: ThemesDefault.space.PX_4, paddingHorizontal: ThemesDefault.space.PX_8 }; let obj7 = { alignSelf: "flex-start", backgroundColor: ThemesDefault.colors.BACKGROUND_BASE_LOWEST, borderRadius: ThemesDefault.radii.md, paddingVertical: ThemesDefault.space.PX_4, paddingHorizontal: ThemesDefault.space.PX_8 }; createCacheKey[9] = { backgroundColor: ThemesDefault.colors.BACKGROUND_BRAND, color: ThemesDefault.colors.CONTROL_PRIMARY_TEXT_DEFAULT }; createCacheKey[10] = { textTransform: "capitalize" }; let obj8 = { backgroundColor: ThemesDefault.colors.BACKGROUND_BRAND, color: ThemesDefault.colors.CONTROL_PRIMARY_TEXT_DEFAULT }; createCacheKey[11] = { display: "flex", alignItems: "center", backgroundColor: ThemesDefault.colors.BACKGROUND_BASE_LOWER, borderRadius: ThemesDefault.radii.md, gap: ThemesDefault.space.PX_8, marginTop: ThemesDefault.space.PX_8, paddingTop: ThemesDefault.space.PX_24, paddingBottom: ThemesDefault.space.PX_24 }; const obj9 = { display: "flex", alignItems: "center", backgroundColor: ThemesDefault.colors.BACKGROUND_BASE_LOWER, borderRadius: ThemesDefault.radii.md, gap: ThemesDefault.space.PX_8, marginTop: ThemesDefault.space.PX_8, paddingTop: ThemesDefault.space.PX_24, paddingBottom: ThemesDefault.space.PX_24 }; createCacheKey[12] = { height: 1, width: "100%", backgroundColor: ThemesDefault.colors.BORDER_SUBTLE, marginTop: 10 }; createCacheKey[13] = { display: "flex", alignItems: "center", justifyContent: "center" }; const obj10 = { height: 1, width: "100%", backgroundColor: ThemesDefault.colors.BORDER_SUBTLE, marginTop: 10 }; createCacheKey[14] = { display: "flex", alignItems: "center", justifyContent: "center", borderBottomEndRadius: ThemesDefault.radii.xs, borderBottomStartRadius: ThemesDefault.radii.xs, backgroundColor: ThemesDefault.colors.BACKGROUND_MOD_MUTED, height: 29, width: 207 }; createCacheKey[15] = { flexShrink: 0, flexGrow: 1, gap: 2 }; let closure_14 = createCacheKey.createStyles(createCacheKey); const obj11 = { display: "flex", alignItems: "center", justifyContent: "center", borderBottomEndRadius: ThemesDefault.radii.xs, borderBottomStartRadius: ThemesDefault.radii.xs, backgroundColor: ThemesDefault.colors.BACKGROUND_MOD_MUTED, height: 29, width: 207 }; const result = require("set").fileFinishedImporting("modules/safety_hub/native/SafetyHubViolationsContainer.tsx"); export default SafetyHubViolationsContainer; export const ConnectedSafetyHubViolationsContainer = function ConnectedSafetyHubViolationsContainer() { let obj = useSafetyHubClassifications; const activeSafetyHubClassifications = obj.useActiveSafetyHubClassifications(); obj1 = useSafetyHubClassifications; const expiredSafetyHubClassifications = obj1.useExpiredSafetyHubClassifications(); if (0 !== activeSafetyHubClassifications.length) { obj = { style: null, children: null }; const items = [tmp.connectedContainer]; obj[0] = items; obj = { status: "active", classifications: null }; obj[1] = activeSafetyHubClassifications; const items1 = [callback(SafetyHubViolationsContainer, obj), ]; obj1 = { status: "expired", classifications: null }; obj1[1] = expiredSafetyHubClassifications; items1[1] = callback(SafetyHubViolationsContainer, obj1); obj[1] = items1; let tmp2 = callback2(closure_6, obj); } else { tmp2 = null; } return tmp2; };