143 lines
8.0 KiB
TypeScript
143 lines
8.0 KiB
TypeScript
/* Metro module 7593; source: modules/user_profile/UserProfileGradientUtils.tsx; dependencies: [57, 661, 673, 4001, 22, 4002, 674, 2] */
|
|
import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import Module00674 from '../../by-id/module-00674.js'; /* Metro dependency 674 */
|
|
import Color from '../../utils/Color.tsx'; /* Metro dependency 4001 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as ColorUtilsModule from '../../external/discord_common/js/shared/utils/ColorUtils.tsx'; /* Metro dependency 673 */
|
|
import * as SharedModule from '../../design/shared.tsx'; /* Metro dependency 4002 */
|
|
|
|
function _fun60898(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#60898, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7771:6, offset: 0x01714407, size: 290 bytes, params: 8, frame: 23
|
|
const env0_0 = require;
|
|
const closure = function(a0) {
|
|
var value = null;
|
|
return value == a0 ? value : require(dependencyMap[2]).getDarkness(a0) > 0.5 ? ThemeTypes.DARK : ThemeTypes.LIGHT;
|
|
};
|
|
const getValueInColorGradientByPercentage2 = getValueInColorGradientByPercentage;
|
|
const getGradientPercentageColorInRgb2 = getGradientPercentageColorInRgb;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = require(22) /* metro dependency 22 */;
|
|
value = value.memoize(_fun60902, function(a0) {
|
|
return a0;
|
|
});
|
|
const value3 = (require(22) /* metro dependency 22 */).memoize(_fun60904, function(a0, a1, a2) {
|
|
return '' + a0 + '-' + a1 + '-' + a2;
|
|
});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/user_profile/UserProfileGradientUtils.tsx');
|
|
exports.getProfileTheme = closure;
|
|
exports.getValueInColorGradientByPercentage = getValueInColorGradientByPercentage2;
|
|
exports.calculateOverlayedColor = calculateOverlayedColor;
|
|
exports.calculateButtonColor = value;
|
|
exports.calculateModalV2BackgroundColor = value3;
|
|
exports.getGradientPercentageColorInRgb = getGradientPercentageColorInRgb2;
|
|
exports.calculateGradientSplitColors = calculateGradientSplitColors;
|
|
exports.getUserProfileGradientContainerColors = getUserProfileGradientContainerColors;
|
|
function getGradientPercentageColorInRgb(a0, a1, a2) { // fn#60901, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7771:835, offset: 0x0171461c, size: 88 bytes, params: 4, frame: 20
|
|
const valueInColorGradientByPercentage = getValueInColorGradientByPercentage(a0, a1, a2);
|
|
return 'rgba(' + valueInColorGradientByPercentage[0] + ', ' + valueInColorGradientByPercentage[1] + ', ' + valueInColorGradientByPercentage[2] + ', 1)';
|
|
}
|
|
|
|
function _fun60902(a0) { // fn#60902, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7771:400, offset: 0x01714674, size: 104 bytes, params: 2, frame: 17
|
|
var value;
|
|
const getContrastingColor = (SharedModule).getContrastingColor;
|
|
const WCAGContrastRatios = (SharedModule).WCAGContrastRatios;
|
|
const HighContrastText = WCAGContrastRatios.HighContrastText;
|
|
value = Reflect.apply(getContrastingColor, value, [a0, {base: '#ffffff', contrastRatio: HighContrastText}]);
|
|
return (ColorUtilsModule).hex2int(value);
|
|
}
|
|
|
|
function _fun60904(a0, a1, a2) { // fn#60904, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7771:575, offset: 0x017146dc, size: 308 bytes, params: 4, frame: 22
|
|
const r5 = a2 ?? getProfileTheme(a0);
|
|
const LIGHT = ThemeTypes.LIGHT;
|
|
const defaultImport = Module00674;
|
|
const value4 = defaultImport.mix(defaultImport(a0), defaultImport(a1), 0.5, 'lab');
|
|
const Math = global.Math;
|
|
const value6 = Math.round(100 * value4.get('hsl.l')) / 100;
|
|
const r2 = r5 !== LIGHT ? (require(22) /* metro dependency 22 */).clamp(value6, 0,
|
|
0.1) : (require(22) /* metro dependency 22 */).clamp(value6, 0.8, 1);
|
|
value = defaultImport(value4);
|
|
value = value.set('hsl.l', r2);
|
|
return value.num();
|
|
}
|
|
|
|
function calculateOverlayedColor(a0, a1) { // fn#60906, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7771:1193, offset: 0x0171483a, size: 291 bytes, params: 3, frame: 25
|
|
const value2 = (ColorUtilsModule).int2rgbArray(a0);
|
|
if (a1 == null) {
|
|
return 0;
|
|
}
|
|
const string = (Color).parseString(a1);
|
|
if (string == null) {
|
|
return 0;
|
|
}
|
|
const env0_0 = [value2[0], value2[1], value2[2]];
|
|
const env0_1 = string.alpha;
|
|
const value4 = Module00057([string.red, string.green, string.blue].map(_fun60907), 3);
|
|
return (ColorUtilsModule).rgb2int('rgba(' + value4[0] + ', ' + value4[1] + ', ' + value4[2] + ')');
|
|
function _fun60907(a0, a1) { // fn#60907, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7771:1398, offset: 0x0171495d, size: 65 bytes, params: 3, frame: 14
|
|
const Math = global.Math;
|
|
return Math.floor(alpha * a0 + (1 - alpha) * env0_0[a1]);
|
|
}
|
|
|
|
}
|
|
|
|
function calculateGradientSplitColors(a0, a1, a2, a3, a4) { // fn#60908, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7771:1673, offset: 0x0171499e, size: 134 bytes, params: 6, frame: 19
|
|
if (a2 === 0) {
|
|
return [];
|
|
}
|
|
const value2 = (ColorUtilsModule).int2rgbArray(a0);
|
|
const value3 = (ColorUtilsModule).int2rgbArray(a1);
|
|
const getGradientPercentageColorInRgbBinding = getGradientPercentageColorInRgb;
|
|
return [getGradientPercentageColorInRgbBinding(value2, value3,
|
|
100 * a3 / a2), getGradientPercentageColorInRgbBinding(value2, value3, 100 * a4 / a2)];
|
|
}
|
|
|
|
function getUserProfileGradientContainerColors(a0, a1, a2) { // fn#60909, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7771:1937, offset: 0x01714a24, size: 254 bytes, params: 4, frame: 18
|
|
var r1;
|
|
var r2;
|
|
var r0;
|
|
var items2;
|
|
let value = a2;
|
|
if (typeof value === 'string') {
|
|
items2 = [a0 == null ? value : (require(673) /* metro dependency 673: ColorUtils */).int2rgba(a0, 1)];
|
|
if (a1 == null) {
|
|
r2 = value;
|
|
} else {
|
|
value = require(673) /* metro dependency 673: ColorUtils */;
|
|
value = value.int2rgba(a1, 1);
|
|
r2 = value;
|
|
}
|
|
items2[1] = r2;
|
|
r0 = items2;
|
|
} else {
|
|
items2 = [a0 != null ? (require(673) /* metro dependency 673: ColorUtils */).int2rgba(a0, 1) : value[0]];
|
|
if (a1 != null) {
|
|
value = require(673) /* metro dependency 673: ColorUtils */;
|
|
value = value.int2rgba(a1, 1);
|
|
r1 = value;
|
|
} else {
|
|
r1 = value[1];
|
|
}
|
|
items2[1] = r1;
|
|
r0 = items2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
}
|
|
|
|
function getValueInColorGradientByPercentage(a0, a1, a2) { // fn#60900, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7771:220, offset: 0x01714580, size: 156 bytes, params: 4, frame: 18
|
|
const value = a2 / 100;
|
|
const value2 = 1 - value;
|
|
let Math = global.Math;
|
|
const items2 = [Math.round(a0[0] * value2 + a1[0] * value)];
|
|
Math = global.Math;
|
|
items2[1] = Math.round(a0[1] * value2 + a1[1] * value);
|
|
Math = global.Math;
|
|
items2[2] = Math.round(a0[2] * value2 + a1[2] * value);
|
|
return items2;
|
|
}
|
|
|
|
global.__d(_fun60898, 7593, [57, 661, 673, 4001, 22, 4002, 674,
|
|
2]) /* metro module 7593, dependencies: [57, 661, 673, 4001, 22, 4002, 674, 2] */;
|