Files
discord-decomp/_bundle/Module712.js
T
2026-11-01 12:12:55 +02:00

203 lines
6.5 KiB
JavaScript

// Metro module 712 (f713).
import { _private } from "./Module713";
import * as _Module714 from "./Module714";
import * as _Module715 from "./Module715";
import * as _Module716 from "./Module716";
import * as _Module717 from "./Module717";
import * as _Module718 from "./Module718";
import mapValues from "./mapValues";
import { Radius } from "./Module806";
import { SpacePx } from "./Module807";
import Module689 from "./Module689";
import { transformColorForReducedSaturation, transformColorContrast } from "./interpolate";
function $mk101400($env) {
return (a0) => (0, $env[0])($env.$parent[0][a0.theme].nativeStyles, a0.isAndroid);
}
const Themes = _private.Themes;
const SemanticColors = _Module714._private.SemanticColors;
const SemanticColorExperiments = _Module715._private.SemanticColorExperiments;
const RawColors = _Module716._private.RawColors;
const Modules = _Module717._private.Modules;
const Shadows = _Module718._private.Shadows;
let c601_7 = Symbol("semanticColor");
const r43 = {
themes: Themes,
colors: mapValues(SemanticColors, (a0, a1) => {
const r0 = {};
r0[c601_7] = a1;
return r0;
}),
unsafe_rawColors: RawColors,
shadows: mapValues(Shadows, (a0) => {
let env12470;
let env12471;
let env12472;
let env12473;
let env12474;
let env12475;
const r2 = env12470 = {};
env12470[0] = a0;
const r4 = env12471 = {
$parent: r2
};
env12471[0] = (a0, a1) => a1 ? void 0 : a0.shadowOffset;
const r7 = {
shadowOffset: {
resolve: $mk101400(r4)
},
shadowColor: null,
shadowOpacity: null,
shadowRadius: null,
elevation: null
};
const r8 = env12472 = {
$parent: r2
};
env12472[0] = (a0, a1) => a1 ? a0.shadowColorAndroid : a0.shadowColor;
r7.shadowColor = {
resolve: $mk101400(r8)
};
const r12 = env12473 = {
$parent: r2
};
env12473[0] = (a0) => a0.shadowOpacity;
r7.shadowOpacity = {
resolve: $mk101400(r12)
};
const r16 = env12474 = {
$parent: r2
};
env12474[0] = (a0) => a0.shadowRadius;
r7.shadowRadius = {
resolve: $mk101400(r16)
};
const r20 = env12475 = {
$parent: r2
};
env12475[0] = (a0) => a0.elevation;
r7.elevation = {
resolve: $mk101400(r20)
};
return r7;
}),
radii: Radius,
modules: mapValues(Modules, (a0) => mapValues(a0, (c23836_0) => ({
resolve: (a0) => {
let enabledExperiments = a0.enabledExperiments;
let density = a0.density;
if (enabledExperiments == null) {
enabledExperiments = [];
}
if (density == null) {
density = "compact";
}
return c23836_0.resolve({
enabledExperiments,
density
});
}
}))),
space: SpacePx,
internal: {
isSemanticColor: (a0) => (typeof a0 === "object" ? a0 !== null : typeof a0 === "object") && c601_7 in a0,
getSemanticColorName: (a0) => a0[c601_7],
resolveSemanticColor: (a0, a1, a2) => {
const r10 = (function sanitizeTheme(a0) {
let r1 = a0;
if (typeof a0 === "string") {
const r10 = a0.toUpperCase();
if (!(r10 in Themes)) {
throw new Error(`Invalid theme: ${a0}`);
}
r1 = Themes[r10];
}
return r1;
})(a0);
const r40 = SemanticColors[a1[c601_7]];
const category = r40.category;
const r41 = r40[r10];
let r42 = RawColors[r41.raw];
let opacity = r41.opacity;
if (a2?.enabledExperiments != null && a2.enabledExperiments.length > 0) {
const r51 = SemanticColorExperiments[a1[c601_7]];
if (r51 != null) {
for (const enabledExperiment of a2.enabledExperiments) {
const r57 = enabledExperiment;
const r58 = r51 == null;
let r59 = void 0;
if (!r58) {
const r61 = r51[r57];
r59 = r61 == null ? void 0 : r61[r10];
}
const r62 = r59;
if (r59 == null) {
continue;
}
r42 = RawColors[r62.raw];
opacity = r62.opacity;
break;
}
}
}
const isProfileTheme = a2?.isProfileTheme;
L63: {
if (isProfileTheme && "userProfileThemes" in r40) {
const userProfileThemes = r40.userProfileThemes;
const r142 = a2 == null ? void 0 : a2.gradient?.theme;
const r146 = r142 != null ? userProfileThemes[r142] : null;
if (r146 == null) {
break L63;
}
r42 = RawColors[r146.raw];
opacity = r146.opacity;
} else if (a2?.gradient != null) {
let r77 = "gradient" in r40 ? r40.gradient : null;
if (a2?.enabledExperiments != null && a2.enabledExperiments.length > 0) {
const r85 = SemanticColorExperiments[a1[c601_7]];
if (r85 != null) {
for (const enabledExperiment2 of a2.enabledExperiments) {
const r95 = r85 == null ? void 0 : r85[enabledExperiment2]?.gradient;
if (r95 == null) {
continue;
}
r77 = r95;
break;
}
}
}
const r102 = r77;
const r104 = r102 == null ? void 0 : r102[a2 == null ? void 0 : a2.gradient.theme];
if (r104 != null) {
const r123 = Module689(r104.color in RawColors ? RawColors[r104.color] : a2 == null ? void 0 : a2.gradient.colors[r104.color]);
const r126 = "saturation" in r104 ? r123.set("hsl.s", r104.saturation) : r123;
r42 = ("lightness" in r104 ? r126.set("hsl.l", r104.lightness) : r126).hex();
opacity = "opacity" in r104 ? r104.opacity : 1;
}
}
}
let r151 = a2?.contrast;
if (r151 == null) {
r151 = 1;
}
let r153 = a2?.saturation;
if (r153 == null) {
r153 = 1;
}
if (r153 < 1) {
r42 = transformColorForReducedSaturation(r42, category, r153);
}
if (r151 !== 1) {
r42 = transformColorContrast(r42, category, r10, r151);
}
return opacity === 1 ? r42 : Module689(r42).alpha(opacity).hex();
},
adjustColorSaturation: (a0, a1, a2) => transformColorForReducedSaturation(a0, a2, a1),
adjustColorContrast: (a0, a1, a2, a3) => transformColorContrast(a0, a2, a3, a1)
}
};
export default r43;
export { Themes as Theme };
export { RawColors as RawColor };
export { SemanticColors as SemanticColor };
export { Shadows as Shadow };