decord/source/modules/guild_profile/native/GuildProfileUtils.tsx
2026-08-26 06:04:24 +00:00

83 lines
2.9 KiB
TypeScript

// Module ID: 9474
// Function ID: 9475
// Name: useProfilePrimaryColor
// Dependencies: [32, 4436, 1435, 8457, 7224, 2]
// Exports: getProfilePrimaryColor, useProfilePrimaryColor
// Module 9474 (useProfilePrimaryColor)
import getAvatarURLDefault from "getAvatarURL" /* 1435 */;
import hasFetchedColors from "hasFetchedColors" /* 8457 */;
import hasFetchedColorsDefault from "hasFetchedColors" /* 8457 */;
import closure_3 from "_slicedToArray" /* 32 */;
import closure_4 from "maybeApplyNoTextColorForLightCustomTheme" /* 4436 */;
require = arg1;
const result = require("set").fileFinishedImporting("modules/guild_profile/native/GuildProfileUtils.tsx");
export const useProfilePrimaryColor = function useProfilePrimaryColor(guildProfile, token) {
let guildIconURL = null;
if (null != guildProfile) {
guildIconURL = null;
if (null == guildProfile.brandColorPrimary) {
let obj = getAvatarURLDefault;
obj = { id: null, icon: null, size: 64 };
({ id: obj2[0], icon: obj2[1] } = guildProfile);
guildIconURL = obj.getGuildIconURL(obj);
}
}
let brandColorPrimary = hasFetchedColorsDefault(guildIconURL, token);
brandColorPrimary = undefined;
if (guildProfile != null) {
brandColorPrimary = guildProfile.brandColorPrimary;
}
if (null != brandColorPrimary) {
brandColorPrimary = guildProfile.brandColorPrimary;
}
return brandColorPrimary;
};
export const getProfilePrimaryColor = function getProfilePrimaryColor(guildProfileFromInvite) {
if (null == guildProfileFromInvite) {
return null;
} else if (null != guildProfileFromInvite.brandColorPrimary) {
return guildProfileFromInvite.brandColorPrimary;
} else {
let obj = { id: null, icon: null, size: 64 };
({ id: obj6[0], icon: obj6[1] } = guildProfileFromInvite);
const guildIconURL = getAvatarURLDefault.getGuildIconURL(obj);
if (null == guildIconURL) {
return null;
} else {
hasFetchedColors.maybeFetchColors(guildIconURL);
const useColorStore = hasFetchedColors.useColorStore;
const tmp13 = useColorStore.getState().palette[guildIconURL];
let first;
if (tmp13 != null) {
first = tmp13[0];
}
if (null != first) {
[tmp4, tmp5, tmp6] = callback(first, 3);
obj = { r: null, g: null, b: null };
obj[0] = tmp4;
obj[1] = tmp5;
obj[2] = tmp6;
const tmp3 = callback(first, 3);
const obj2 = tmp8(7224)(obj);
let num2 = 1;
({ h, s, l } = tmp8(7224)(obj).toHsl());
if (closure_4.desaturateUserColors) {
num2 = closure_4.saturation;
}
obj = { h: null, s: null, l: null };
obj[0] = h;
obj[1] = s * num2;
obj[2] = l;
const toHslResult = tmp8(7224)(obj).toHsl();
return tmp8(7224)(obj).toHexString();
} else {
return null;
}
const obj7 = hasFetchedColors;
}
const obj5 = getAvatarURLDefault;
}
};