// Module ID: 11544 // Function ID: 11545 // Name: BadgeUtils // Dependencies: [8527, 8528, 1115, 8537, 2010, 2] // Exports: getAlwaysVisibleCopy, getDirectoryBadges, getLegacyDescriptionByBadgeId, getLegacyIconUrlByBadgeId, getProfileBadgeLabel, getUnhideableBadgeIds, groupCustomizableBadges // Module 11544 (BadgeUtils) import StringUtils from "StringUtils" /* 2010 */; import Constants from "Constants" /* 8527 */; import BadgeId from "BadgeId" /* 8528 */; import BadgeIdResolution from "BadgeIdResolution" /* 8537 */; import size from "module_2" /* 2 */; function isPinnedBadge(badge_id) { return badge_id === BadgeId.BadgeId.STAFF; } function getProfileBadgeIconUrl(iconSrc) { iconSrc = iconSrc.iconSrc; if (iconSrc == null) { iconSrc = getBadgeAssetFromCDN(iconSrc.icon); } return iconSrc; } const getBadgeAssetFromCDN = Constants.getBadgeAssetFromCDN; let result = size.fileFinishedImporting("modules/badges/BadgeUtils.tsx"); export const MAX_DISPLAYED_PROFILE_BADGES = 6; export { isPinnedBadge }; export const getAlwaysVisibleCopy = function getAlwaysVisibleCopy(badge_id) { if (badge_id === BadgeId.BadgeId.STAFF) { let nPQVxb = tmp(1115).t.t3udZb; } else { nPQVxb = tmp(1115).t.nPQVxb; } return nPQVxb; }; export const getDirectoryBadges = function getDirectoryBadges(stateFromStoresArray) { const earnable = []; const owned = []; const iter = stateFromStoresArray[Symbol.iterator](); const nextResult = iter.next(); while (iter !== undefined) { let tmp2 = nextResult; if (nextResult.owned) { let arr = owned.push(tmp2); } else if (tmp2.is_earnable) { let arr2 = earnable.push(tmp2); } continue; } return { earnable, owned }; }; export const getUnhideableBadgeIds = function getUnhideableBadgeIds(tenureBadgeHideable) { const _Set = Set; const STAFF = BadgeId.BadgeId.STAFF; if (tenureBadgeHideable.tenureBadgeHideable) { const items = [STAFF]; let _Set1 = new _Set(items); } else { const items1 = [STAFF, BadgeId.BadgeId.PREMIUM_TENURE]; _Set1 = new _Set(items1); } return _Set1; }; export const groupCustomizableBadges = function groupCustomizableBadges(memo) { const fixedBadges = []; const reorderableBadges = []; const hiddenBadges = []; const iter = memo[Symbol.iterator](); const nextResult = iter.next(); while (iter !== undefined) { let tmp2 = nextResult; if (nextResult.owned) { if (isPinnedBadge(tmp2.badge_id)) { let arr = fixedBadges.push(tmp2); } else if (tmp2.hidden) { let arr2 = hiddenBadges.push(tmp2); } else { let arr3 = reorderableBadges.push(tmp2); } } continue; } return { fixedBadges, reorderableBadges, hiddenBadges }; }; export { getProfileBadgeIconUrl }; export const getProfileBadgeLabel = function getProfileBadgeLabel(description, info_label) { if (info_label != null) { info_label = info_label.info_label; } if (null != info_label) { if (!obj.isLegacyBadgeId(info_label.badge_id)) { const tmpResult = StringUtils; } return info_label; } let str = description; if (description == null) { let name; if (info_label != null) { name = info_label.name; } str = name; } if (str == null) { str = ""; } info_label = str; }; export const getLegacyDescriptionByBadgeId = function getLegacyDescriptionByBadgeId(badges) { const map = new Map(); const iter = badges[Symbol.iterator](); const nextResult = iter.next(); while (iter !== undefined) { let tmp2 = nextResult; let obj2 = BadgeIdResolution; let profileBadgeId = obj2.resolveProfileBadgeId(nextResult.id); let tmp6 = profileBadgeId; let hasItem = null == profileBadgeId; if (!hasItem) { hasItem = map.has(tmp6); } if (!hasItem) { let result = map.set(tmp6, tmp2.description); } continue; } return map; }; export const getLegacyIconUrlByBadgeId = function getLegacyIconUrlByBadgeId(badges) { const map = new Map(); const iter = badges[Symbol.iterator](); const nextResult = iter.next(); while (iter !== undefined) { let tmp2 = nextResult; let obj2 = BadgeIdResolution; let profileBadgeId = obj2.resolveProfileBadgeId(nextResult.id); let tmp6 = profileBadgeId; let hasItem = null == profileBadgeId; if (!hasItem) { hasItem = map.has(tmp6); } if (!hasItem) { let result = map.set(tmp6, getProfileBadgeIconUrl(tmp2)); } continue; } return map; };