Initial commit
This commit is contained in:
commit
af3b49f756
16065 files changed
+2938410
No files matched your search
@@ -0,0 +1,354 @@
|
||||
/* Metro module 3963; source: modules/client_themes/native/ClientThemesUtils.tsx; dependencies: [57, 31, 1310, 3964, 1354, 697, 674, 4000, 4001, 3966, 4002, 4003, 4048, 4045, 2] */
|
||||
function _fun32428(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#32428, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4112:6, offset: 0x0101522b, size: 844 bytes, params: 8, frame: 25
|
||||
var object4;
|
||||
const env0_0 = require;
|
||||
const closure = getClientThemesGradientColorByPercentage;
|
||||
const closure2 = function({colors}) {
|
||||
return colors.map(_fun32433);
|
||||
};
|
||||
const getGradientAngle = function(a0) {
|
||||
return a0.type === require(dependencyMap[9]).ClientThemeType.BACKGROUND_GRADIENT_PRESET ? a0.angle : a0.customThemeSettings.gradientAngle;
|
||||
};
|
||||
const closure3 = function(a0, a1) {
|
||||
return calculateGradientValueWithOpacity(a0, a1, a0.theme);
|
||||
};
|
||||
const Object = global.Object;
|
||||
Object.defineProperty(exports, '__esModule', {value: true});
|
||||
const env0_3 = importDefault(57) /* metro dependency 57 */;
|
||||
const env0_4 = importAll(31) /* metro dependency 31 */;
|
||||
const themeStore = importDefault(1310) /* metro dependency 1310: ThemeStore */;
|
||||
const clientThemesBackgroundStore = importDefault(3964) /* metro dependency 3964: ClientThemesBackgroundStore */;
|
||||
const customThemeMobileStore = importDefault(1354) /* metro dependency 1354: CustomThemeMobileStore */;
|
||||
object4 = {LEVEL_9: 0.9};
|
||||
object4[0.9] = 'LEVEL_9';
|
||||
object4.LEVEL_85 = 0.85;
|
||||
object4[0.85] = 'LEVEL_85';
|
||||
object4.LEVEL_8 = 0.8;
|
||||
object4[0.8] = 'LEVEL_8';
|
||||
object4.LEVEL_75 = 0.75;
|
||||
object4[0.75] = 'LEVEL_75';
|
||||
object4.LEVEL_7 = 0.7;
|
||||
object4[0.7] = 'LEVEL_7';
|
||||
object4.LEVEL_6 = 0.6;
|
||||
object4[0.6] = 'LEVEL_6';
|
||||
object4.LEVEL_5 = 0.5;
|
||||
object4[0.5] = 'LEVEL_5';
|
||||
object4.LEVEL_4 = 0.4;
|
||||
object4[0.4] = 'LEVEL_4';
|
||||
object4.LEVEL_35 = 0.35;
|
||||
object4[0.35] = 'LEVEL_35';
|
||||
object4.LEVEL_3 = 0.3;
|
||||
object4[0.3] = 'LEVEL_3';
|
||||
object4.LEVEL_25 = 0.25;
|
||||
object4[0.25] = 'LEVEL_25';
|
||||
object4.LEVEL_2 = 0.2;
|
||||
object4[0.2] = 'LEVEL_2';
|
||||
object4.LEVEL_15 = 0.15;
|
||||
object4[0.15] = 'LEVEL_15';
|
||||
object4.LEVEL_1 = 0.1;
|
||||
object4[0.1] = 'LEVEL_1';
|
||||
const object5 = {};
|
||||
const BLACK = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.BLACK;
|
||||
object5.DARK = BLACK;
|
||||
const WHITE = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.WHITE;
|
||||
object5.LIGHT = WHITE;
|
||||
const object6 = {START: 0};
|
||||
object6[0] = 'START';
|
||||
object6.MID = 50;
|
||||
object6[50] = 'MID';
|
||||
object6.END = 100;
|
||||
object6[100] = 'END';
|
||||
const closure4 = colorToHex;
|
||||
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/client_themes/native/ClientThemesUtils.tsx');
|
||||
exports.GRADIENT_ANGLE_BREAKPOINT = 128;
|
||||
exports.OverlayOpacity = object4;
|
||||
exports.OverlayColors = object5;
|
||||
exports.GradientPercentage = object6;
|
||||
exports.colorToHex = closure4;
|
||||
exports.getClientThemesGradientColorByPercentage = closure;
|
||||
exports.getClientThemesGradientHexColors = closure2;
|
||||
exports.getGradientThemeMetadata = getGradientThemeMetadata;
|
||||
exports.getGradientValue = closure3;
|
||||
exports.useGradientValue = useGradientValue;
|
||||
exports.getEmbedScrollGradientBackground = getEmbedScrollGradientBackground;
|
||||
exports.getEmbedBackground = getEmbedBackground;
|
||||
}
|
||||
|
||||
function getMixWithOpacity({r, g, b}, {r, g, b}, a2) { // fn#32429, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4112:791, offset: 0x01015577, size: 164 bytes, params: 4, frame: 25
|
||||
const colorToHexBinding = colorToHex;
|
||||
const colorUtilsModule = require(4000) /* metro dependency 4000: ColorUtils */;
|
||||
const mixColors = colorUtilsModule.mixColors;
|
||||
let value = importDefault(4001) /* metro dependency 4001: Color */;
|
||||
value = new value(r, g, b, a2);
|
||||
const defaultImport = importDefault(4001) /* metro dependency 4001: Color */;
|
||||
const value3 = 1 - a2;
|
||||
const value4 = Object.create(defaultImport.prototype, {constructor: {value: defaultImport}});
|
||||
const defaultImport2 = new defaultImport(r, g, b, value3);
|
||||
return colorToHexBinding(Reflect.apply(mixColors, colorUtilsModule, [value,
|
||||
defaultImport2 instanceof Object ? defaultImport2 : value4]));
|
||||
}
|
||||
|
||||
function getClientThemesGradientColorByPercentage(a0, a1) { // fn#32430, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4112:924, offset: 0x0101561b, size: 149 bytes, params: 3, frame: 16
|
||||
const value = env0_3((importDefault(674) /* metro dependency 674 */).scale(getClientThemesGradientHexColors(a0)).domain(a0.colors.map(function(a0) {
|
||||
return a0.stop;
|
||||
}))(a1).rgb(), 3);
|
||||
return {r: value[0], g: value[1], b: value[2]};
|
||||
}
|
||||
|
||||
function getClientThemesGradientHexColors({colors}) { // fn#32432, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4112:1126, offset: 0x010156bb, size: 27 bytes, params: 2, frame: 11
|
||||
return colors.map(function(a0) {
|
||||
return importDefault(dependencyMap[5]).unsafe_rawColors[a0.token];
|
||||
});
|
||||
}
|
||||
|
||||
function getGradientColorByPercentage(a0, a1) { // fn#32435, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4112:1373, offset: 0x0101574a, size: 254 bytes, params: 3, frame: 19
|
||||
const type = a0.type;
|
||||
const ClientThemeType = (require(3966) /* metro dependency 3966: ClientThemesTypes */).ClientThemeType;
|
||||
const BACKGROUND_GRADIENT_PRESET = ClientThemeType.BACKGROUND_GRADIENT_PRESET;
|
||||
if (type === BACKGROUND_GRADIENT_PRESET) {
|
||||
return getClientThemesGradientColorByPercentage(a0, a1);
|
||||
}
|
||||
const colors = a0.customThemeSettings.colors;
|
||||
if (colors.length === 1) {
|
||||
return (require(4000) /* metro dependency 4000: ColorUtils */).hexToRgb(colors[0]);
|
||||
}
|
||||
const value2 = colors.map(function(a0, a1) {
|
||||
return a1 / (colors.length - 1) * 100;
|
||||
});
|
||||
const value3 = (importDefault(674) /* metro dependency 674 */).scale(colors);
|
||||
const value = env0_3(value3.domain(value2)(a1).rgb(), 3);
|
||||
return {r: value[0], g: value[1], b: value[2]};
|
||||
}
|
||||
|
||||
function getBottomColorWithOpacity(a0, a1, a2) { // fn#32437, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4112:1733, offset: 0x0101586b, size: 76 bytes, params: 4, frame: 17
|
||||
return getMixWithOpacity(getGradientColorByPercentage(a0,
|
||||
getGradientAngle(a0) > env0_8 ? env0_11.END : env0_11.START), a1, a2);
|
||||
}
|
||||
|
||||
function getTopColorWithOpacity(a0, a1, a2) { // fn#32438, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4112:1873, offset: 0x010158b7, size: 76 bytes, params: 4, frame: 17
|
||||
return getMixWithOpacity(getGradientColorByPercentage(a0,
|
||||
getGradientAngle(a0) > env0_8 ? env0_11.START : env0_11.END), a1, a2);
|
||||
}
|
||||
|
||||
function calculateGradientValueWithOpacity(a0, a1, a2, a3) { // fn#32439, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4112:2010, offset: 0x01015903, size: 512 bytes, params: 5, frame: 23
|
||||
var r3;
|
||||
var r0;
|
||||
var isThemeDark3;
|
||||
let value = a1;
|
||||
const value2 = a3;
|
||||
const isThemeDark2 = (require(4002) /* metro dependency 4002: shared */).isThemeDark(a2);
|
||||
const colorUtilsModule = require(4000) /* metro dependency 4000: ColorUtils */;
|
||||
const hexToRgb = colorUtilsModule.hexToRgb;
|
||||
let binding = env0_10;
|
||||
const r4 = isThemeDark2 ? Reflect.apply(hexToRgb, colorUtilsModule, [binding.DARK]) : Reflect.apply(hexToRgb,
|
||||
colorUtilsModule, [binding.LIGHT]);
|
||||
let type = a0.type;
|
||||
const ClientThemeType = (require(3966) /* metro dependency 3966: ClientThemesTypes */).ClientThemeType;
|
||||
const BACKGROUND_GRADIENT_PRESET = ClientThemeType.BACKGROUND_GRADIENT_PRESET;
|
||||
let r8 = type !== BACKGROUND_GRADIENT_PRESET ? env0_11.MID : a0.midpointPercentage ?? env0_11.MID;
|
||||
r8 = value ?? r8;
|
||||
type = a0.type;
|
||||
const CUSTOM_BACKGROUND_GRADIENT = ClientThemeType.CUSTOM_BACKGROUND_GRADIENT;
|
||||
if (type === CUSTOM_BACKGROUND_GRADIENT) {
|
||||
value = a0.customThemeSettings.baseMix / 100;
|
||||
if (value2 != null) {
|
||||
r0 = value2;
|
||||
} else {
|
||||
isThemeDark3 = (require(4002) /* metro dependency 4002: shared */).isThemeDark(a2);
|
||||
value = 0.2 * value;
|
||||
r0 = isThemeDark3 ? 0.12 + value : 0.3 + value;
|
||||
}
|
||||
r3 = r0;
|
||||
} else if (value2 != null) {
|
||||
r3 = value2;
|
||||
} else {
|
||||
value = require(4002) /* metro dependency 4002: shared */;
|
||||
value = value.isThemeDark(a2);
|
||||
binding = env0_9;
|
||||
r3 = value ? binding.LEVEL_2 : binding.LEVEL_4;
|
||||
}
|
||||
value = getGradientAngle(a0);
|
||||
const START = env0_11.START;
|
||||
return r8 === START ? value < env0_8 ? getBottomColorWithOpacity(a0, r4, r3) : getTopColorWithOpacity(a0, r4,
|
||||
r3) : r8 === env0_11.END ? value > env0_8 ? getBottomColorWithOpacity(a0, r4, r3) : getTopColorWithOpacity(a0,
|
||||
r4, r3) : getMixWithOpacity(getGradientColorByPercentage(a0, r8), r4, r3);
|
||||
}
|
||||
|
||||
function colorToHex({red, green, blue}) { // fn#32441, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4112:742, offset: 0x01015b21, size: 76 bytes, params: 2, frame: 15
|
||||
let value = importDefault(674) /* metro dependency 674 */;
|
||||
value = value.rgb(red, green, blue);
|
||||
return value.hex('rgb');
|
||||
}
|
||||
|
||||
function getGradientThemeMetadata(a0, a1) { // fn#32442, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4112:3241, offset: 0x01015b6d, size: 608 bytes, params: 3, frame: 33
|
||||
var r10;
|
||||
var r3;
|
||||
var r4;
|
||||
var colors;
|
||||
var value7;
|
||||
var indexOf;
|
||||
var Math;
|
||||
var min;
|
||||
var items;
|
||||
var value9;
|
||||
var defaultImport;
|
||||
var max;
|
||||
var value10;
|
||||
if (a0 == null) {
|
||||
return null;
|
||||
}
|
||||
if (a1 == null) {
|
||||
return null;
|
||||
}
|
||||
var value;
|
||||
const getGradientValueBinding = getGradientValue;
|
||||
const START = env0_11.START;
|
||||
const gradientValueBinding = getGradientValueBinding(a1, START);
|
||||
const MID = env0_11.MID;
|
||||
const gradientValueBinding2 = getGradientValueBinding(a1, MID);
|
||||
const END = env0_11.END;
|
||||
const gradientValueBinding3 = getGradientValueBinding(a1, END);
|
||||
const gradientAngle = getGradientAngle(a1);
|
||||
const r6 = gradientAngle > env0_8 ? gradientValueBinding : gradientValueBinding3;
|
||||
const r5 = gradientAngle > env0_8 ? gradientValueBinding3 : gradientValueBinding;
|
||||
let type = a1.type;
|
||||
const ClientThemeType = (require(3966) /* metro dependency 3966: ClientThemesTypes */).ClientThemeType;
|
||||
const BACKGROUND_GRADIENT_PRESET = ClientThemeType.BACKGROUND_GRADIENT_PRESET;
|
||||
const r11 = type === BACKGROUND_GRADIENT_PRESET ? getClientThemesGradientHexColors(a1) : a1.customThemeSettings.colors;
|
||||
const property = r11[0];
|
||||
const property2 = r11[r11.length - 1];
|
||||
type = a1.type;
|
||||
const CUSTOM_BACKGROUND_GRADIENT = ClientThemeType.CUSTOM_BACKGROUND_GRADIENT;
|
||||
if (type !== CUSTOM_BACKGROUND_GRADIENT) {
|
||||
r3 = property2;
|
||||
r4 = property;
|
||||
} else {
|
||||
colors = a1.customThemeSettings.colors;
|
||||
value7 = colors.map(_fun32443);
|
||||
value = importDefault(674) /* metro dependency 674 */;
|
||||
indexOf = value7.indexOf;
|
||||
Math = global.Math;
|
||||
min = Math.min;
|
||||
items = [];
|
||||
value = value(colors[Reflect.apply(indexOf, value7, [apply(min, items, Math, arraySpread(items, value7, 0,
|
||||
undefined))])]);
|
||||
value = value.set('hsl.s', 0.2);
|
||||
value9 = value.set('hsl.l', 0.7).hex();
|
||||
defaultImport = importDefault(674) /* metro dependency 674 */;
|
||||
indexOf = value7.indexOf;
|
||||
Math = global.Math;
|
||||
max = Math.max;
|
||||
items = [];
|
||||
arraySpread(items, value7, 0, value);
|
||||
value = defaultImport(colors[Reflect.apply(indexOf, value7, [apply(max, items, Math, value)])]);
|
||||
value = value.set('hsl.s', 0.2);
|
||||
value = value.set('hsl.l', 0.9);
|
||||
value = value.hex();
|
||||
value10 = a0 === 'dark';
|
||||
r10 = value10 ? value9 : value;
|
||||
r3 = value10 ? value : value9;
|
||||
r4 = r10;
|
||||
}
|
||||
return {theme: a0, colors: {['gradient.start']: gradientValueBinding, ['gradient.mid']: gradientValueBinding2,
|
||||
['gradient.end']: gradientValueBinding3, ['gradient.top']: r6, ['gradient.bottom']: r5,
|
||||
['gradient.primary']: r4, ['gradient.secondary']: r3}};
|
||||
}
|
||||
|
||||
function useGradientValue(a0, a1) { // fn#32444, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4112:4184, offset: 0x01015dfa, size: 147 bytes, params: 3, frame: 20
|
||||
const env0_0 = a0;
|
||||
const env0_1 = a1;
|
||||
const value2 = undefined;
|
||||
return env0_4.useMemo(_fun32445, [(importDefault(4003) /* metro dependency 4003: useColorThemeBackground */)(),
|
||||
a1 == null ? value2 : a1.dark, a1 == null ? value2 : a1.light, a0,
|
||||
(importDefault(4048) /* metro dependency 4048: useTheme */)()]);
|
||||
}
|
||||
|
||||
function getEmbedScrollGradientBackground() { // fn#32446, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4112:4682, offset: 0x01015fa7, size: 83 bytes, params: 1, frame: 14
|
||||
const customBackgroundGradient = (require(4045) /* metro dependency 4045: MobileThemesUtils */).getCustomBackgroundGradient();
|
||||
const value3 = null;
|
||||
const r4 = value3 != customBackgroundGradient ? customBackgroundGradient : ClientThemesBackgroundStore.gradientPreset;
|
||||
const r2 = value3 != r4 ? r4 : value3;
|
||||
return value3 == r2 ? value3 : getGradientValue(r2);
|
||||
}
|
||||
|
||||
function getEmbedBackground() { // fn#32447, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4112:4884, offset: 0x01015ffa, size: 144 bytes, params: 1, frame: 15
|
||||
var r3;
|
||||
var moduleValue;
|
||||
var isThemeDark2;
|
||||
var binding;
|
||||
var moduleValue2;
|
||||
const hasCustomTheme2 = CustomThemeMobileStore.hasCustomTheme();
|
||||
if (ClientThemesBackgroundStore.gradientPreset != null) {
|
||||
moduleValue = require(4002) /* metro dependency 4002: shared */;
|
||||
isThemeDark2 = moduleValue.isThemeDark(ThemeStore.theme);
|
||||
binding = env0_10;
|
||||
r3 = isThemeDark2 ? binding.DARK : binding.LIGHT;
|
||||
moduleValue2 = require(4000) /* metro dependency 4000: ColorUtils */;
|
||||
return moduleValue2.hexWithOpacity(r3, env0_9.LEVEL_1);
|
||||
}
|
||||
if (hasCustomTheme2) {
|
||||
moduleValue = require(4002) /* metro dependency 4002: shared */;
|
||||
isThemeDark2 = moduleValue.isThemeDark(ThemeStore.theme);
|
||||
binding = env0_10;
|
||||
r3 = isThemeDark2 ? binding.DARK : binding.LIGHT;
|
||||
moduleValue2 = require(4000) /* metro dependency 4000: ColorUtils */;
|
||||
return moduleValue2.hexWithOpacity(r3, env0_9.LEVEL_1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function _fun32443(a0) { // fn#32443, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4112:3748, offset: 0x01015dcd, size: 45 bytes, params: 2, frame: 11
|
||||
let value = environment.__proto__;
|
||||
value = importDefault(674) /* metro dependency 674 */;
|
||||
value = value(a0);
|
||||
return value.luminance();
|
||||
}
|
||||
|
||||
function _fun32445() { // fn#32445, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4112:4265, offset: 0x01015e8d, size: 282 bytes, params: 1, frame: 20
|
||||
var r5;
|
||||
var r7;
|
||||
var calculateGradientValueWithOpacityBinding;
|
||||
var binding;
|
||||
var value4;
|
||||
var isThemeDark2;
|
||||
var isThemeDark3;
|
||||
var value5;
|
||||
var binding3;
|
||||
var binding4;
|
||||
if (env0_2 == null) {
|
||||
return null;
|
||||
}
|
||||
const value2 = undefined;
|
||||
if ((require == null ? value2 : require.dark) != null) {
|
||||
value4 = environment.__proto__;
|
||||
isThemeDark2 = (require(4002) /* metro dependency 4002: shared */).isThemeDark(env0_3);
|
||||
binding = env1_9;
|
||||
r5 = isThemeDark2 ? binding.LEVEL_2 : binding.LEVEL_4;
|
||||
isThemeDark3 = (require(4002) /* metro dependency 4002: shared */).isThemeDark(env0_3);
|
||||
value5 = require == null;
|
||||
r7 = isThemeDark3 ? value5 ? value2 : require.dark : value5 ? value2 : require.light;
|
||||
calculateGradientValueWithOpacityBinding = calculateGradientValueWithOpacity;
|
||||
binding = env0_2;
|
||||
binding3 = env0_0;
|
||||
binding4 = env0_3;
|
||||
r5 = r7 ?? r5;
|
||||
return calculateGradientValueWithOpacityBinding(binding, binding3, binding4, r5);
|
||||
}
|
||||
if ((require == null ? value2 : require.light) != null) {
|
||||
value4 = environment.__proto__;
|
||||
isThemeDark2 = (require(4002) /* metro dependency 4002: shared */).isThemeDark(env0_3);
|
||||
binding = env1_9;
|
||||
r5 = isThemeDark2 ? binding.LEVEL_2 : binding.LEVEL_4;
|
||||
isThemeDark3 = (require(4002) /* metro dependency 4002: shared */).isThemeDark(env0_3);
|
||||
value5 = require == null;
|
||||
r7 = isThemeDark3 ? value5 ? value2 : require.dark : value5 ? value2 : require.light;
|
||||
calculateGradientValueWithOpacityBinding = calculateGradientValueWithOpacity;
|
||||
binding = env0_2;
|
||||
binding3 = env0_0;
|
||||
binding4 = env0_3;
|
||||
r5 = r7 ?? r5;
|
||||
return calculateGradientValueWithOpacityBinding(binding, binding3, binding4, r5);
|
||||
}
|
||||
return calculateGradientValueWithOpacity(env0_2, env0_0, env0_3);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user