/* Metro module 13210; source: modules/user_profile/native/UserProfileEditTheme.tsx; dependencies: [31, 27, 33, 4501, 697, 673, 6813, 5278, 1244, 9646, 4573, 8490, 8494, 8372, 5062, 3968, 1365, 13189, 4080, 13211, 1962, 8638, 2] */
import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import UseDisplayProfile from '../hooks/useDisplayProfile.tsx'; /* Metro dependency 8490 */
import UseProfileTheme from '../hooks/useProfileTheme.tsx'; /* Metro dependency 8494 */
import ShowCustomColorPickerActionSheet from '../../color_picker/native/showCustomColorPickerActionSheet.tsx'; /* Metro dependency 13189 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as ColorUtilsModule from '../../../external/discord_common/js/shared/utils/ColorUtils.tsx'; /* Metro dependency 673 */
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as Dismissible_contentModule from '../../../external/discord_common/js/packages/protos/discord_protos/discord_users/v1/dismissible_content.tsx'; /* Metro dependency 1365 */
import * as DismissibleContentUnsafeUtilsModule from '../../dismissible_content/DismissibleContentUnsafeUtils.tsx'; /* Metro dependency 3968 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as PressablesModule from '../../../design/void/Pressables/native/Pressables.tsx'; /* Metro dependency 5278 */
import * as GetHigherContrastColorModule from '../utils/getHigherContrastColor.tsx'; /* Metro dependency 6813 */
import * as UseAvatarColorModule from '../../avatar/useAvatarColor.tsx'; /* Metro dependency 8372 */
import * as PencilIconModule from '../../../design/components/Icon/native/redesign/generated/PencilIcon.tsx'; /* Metro dependency 9646 */
function _fun100786(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#100786, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13400:6, offset: 0x021f88d1, size: 422 bytes, params: 8, frame: 22
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
ReactModule;
let value = JsxRuntimeModule;
const env0_4 = value.jsx;
const env0_5 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
object.container = {gap: 6};
object.sectionHeader = {'display': 'flex', 'flexDirection': 'row', 'justifyContent': 'space-between',
'alignItems': 'center'};
object.themeColorContainer = {'flexDirection': 'row', 'gap': 12, 'justifyContent': 'center'};
object.colorSwatchContainer = {'position': 'relative', 'flex': 1, 'flexDirection': 'column', 'alignItems': 'center',
'gap': 4};
const object3 = {'height': 50, 'width': '100%'};
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object.colorSwatch = object3;
object.dropperIcon = {'position': 'absolute', 'top': 10, 'right': 10};
const TEXT_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_SUBTLE;
object.overflowMenu = {tintColor: TEXT_SUBTLE};
const env0_6 = Reflect.apply(createStyles, value, [object]);
const env0_7 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.WHITE;
const env0_8 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.PRIMARY_530;
(FileImportTrackerModule).fileFinishedImporting('modules/user_profile/native/UserProfileEditTheme.tsx');
exports.default = UserProfileEditTheme;
function ColorSwatch({color, label, accessibilityLabel, onPress, style}) { // fn#100787, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13400:705, offset: 0x021f8a77, size: 403 bytes, params: 2, frame: 30
const styles = useStyles();
const value2 = (ColorUtilsModule).int2hex(color);
const higherContrastColor = (GetHigherContrastColorModule).getHigherContrastColor({backgroundColor: value2,
colors: [WHITE, PRIMARY_530]});
const PressableOpacity = (PressablesModule).PressableOpacity;
const intl = (IndexNativeModule).intl;
const string = intl.string;
const Qp04hK = (IndexNativeModule).t.Qp04hK;
const items2 = [styles.colorSwatch];
items2[1] = {backgroundColor: value2};
items2[2] = style;
const PencilIcon = (PencilIconModule).PencilIcon;
const pressableOpacity = (
);
const Text = (TextModule).Text;
return (
{pressableOpacity}
{label}
);
}
function UserProfileEditTheme({user, onProfileThemeColorsChanged, pendingThemeColors, guildId, pendingAvatarSrc, showResetMenu, isTryItOut}) { // fn#100788, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13400:1449, offset: 0x021f8c0a, size: 1033 bytes, params: 2, frame: 37
showResetMenu = !(showResetMenu === undefined) && showResetMenu;
isTryItOut = !(isTryItOut === undefined) && isTryItOut;
const styles = useStyles();
const {primaryColor,
secondaryColor} = (UseProfileTheme)({user: user,
displayProfile: (UseDisplayProfile)(user.id, guildId),
pendingThemeColors: pendingThemeColors, isPreview: isTryItOut});
const r6 = pendingAvatarSrc ?? user.getAvatarURL(guildId, 80);
const useAvatarColors = UseAvatarColorModule.useAvatarColors;
const PRIMARY_530 = (Native).unsafe_rawColors.PRIMARY_530;
const env0_4 = Reflect.apply(useAvatarColors, UseAvatarColorModule, [r6, PRIMARY_530, false]);
if (primaryColor == null) {
return null;
}
if (secondaryColor == null) {
return null;
}
const closure = function(a0, a1) {
var env0_0 = a0;
var env0_1 = a1;
return _fun100791;
};
const Text = (TextModule).Text;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
let string = intl.string;
const DMeO2X = (require(1244) /* metro dependency 1244: indexNative */).t.DMeO2X;
const view = (
{Reflect.apply(string, intl, [DMeO2X])}
{showResetMenu && ((PressableOpacity) => {((MoreHorizontalIcon) => )((require(8638) /* metro dependency 8638: MoreHorizontalIcon */).MoreHorizontalIcon)})((require(5278) /* metro dependency 5278: Pressables */).PressableOpacity)}
);
const object3 = {onPress: closure(primaryColor, function(a0) {
if (a0 !== primaryColor) {
handleProfileThemeColorsChanged([a0, secondaryColor]);
}
}), color: primaryColor};
string = intl.string;
const C3KTQk = (require(1244) /* metro dependency 1244: indexNative */).t.C3KTQk;
object3.label = Reflect.apply(string, intl, [C3KTQk]);
let formatToPlainString = intl.formatToPlainString;
const v4X2kc = (require(1244) /* metro dependency 1244: indexNative */).t.v4X2kc;
const object5 = {};
object5.colorHex = (require(673) /* metro dependency 673: ColorUtils */).int2hex(primaryColor);
object3.accessibilityLabel = Reflect.apply(formatToPlainString, intl, [v4X2kc, object5]);
const colorSwatch = ;
const colorSwatchProps = {color: secondaryColor, onPress: closure(secondaryColor, function(a0) {
if (a0 !== secondaryColor) {
handleProfileThemeColorsChanged([primaryColor, a0]);
}
}), label: intl.string((require(1244) /* metro dependency 1244: indexNative */).t['8elvy6'])};
formatToPlainString = intl.formatToPlainString;
const I0tmru = (require(1244) /* metro dependency 1244: indexNative */).t.I0tmru;
const object6 = {};
object6.colorHex = (require(673) /* metro dependency 673: ColorUtils */).int2hex(secondaryColor);
colorSwatchProps.accessibilityLabel = Reflect.apply(formatToPlainString, intl, [I0tmru, object6]);
return (
{view}
{colorSwatch}
);
function handleProfileThemeColorsChanged(a0) { // fn#100789, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13400:1911, owner: UserProfileEditTheme.handleProfileThemeColorsChanged, offset: 0x021f9013, size: 81 bytes, params: 2, frame: 15
const value = a0;
const value3 = undefined;
onProfileThemeColorsChanged((importDefault(5062) /* metro dependency 5062 */)(value,
env0_1 == null ? value3 : env0_1.themeColors) ? value3 : value);
return value3;
}
function makeOnPress(a0, a1) { // fn#100790, owner: UserProfileEditTheme.makeOnPress, offset: 0x021f9064, size: 25 bytes, params: 3, frame: 2
const env0_0 = a0;
const env0_1 = a1;
return _fun100791;
function _fun100791() { // fn#100791, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13400:1996, offset: 0x021f907d, size: 117 bytes, params: 1, frame: 15
const value = environment.__proto__.__proto__;
const UNSAFE_markDismissibleContentAsDismissed = DismissibleContentUnsafeUtilsModule.UNSAFE_markDismissibleContentAsDismissed;
const DismissibleContent = (Dismissible_contentModule).DismissibleContent;
const PROFILE_THEMES_SETTINGS_VIEWED_V2 = DismissibleContent.PROFILE_THEMES_SETTINGS_VIEWED_V2;
Reflect.apply(UNSAFE_markDismissibleContentAsDismissed, DismissibleContentUnsafeUtilsModule,
[PROFILE_THEMES_SETTINGS_VIEWED_V2]);
(ShowCustomColorPickerActionSheet)({color: env0_0,
onSelect: require, suggestedColors: env1_4});
}
}
function UserProfileEditThemeOnPress() { // fn#100792, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13400:2480, owner: UserProfileEditTheme.onPress, offset: 0x021f90f2, size: 96 bytes, params: 1, frame: 16
var environment;
let value = environment.__proto__;
const defaultImport = importDefault(dependencyMap[18]);
const openLazy = defaultImport.openLazy;
value = require(dependencyMap[20]);
value = value(dependencyMap[19], dependencyMap.paths);
Reflect.apply(openLazy, defaultImport, [value, 'Profile Theme', {onResetTheme: function() {
return handleProfileThemeColorsChanged([null, null]);
}}]);
}
}
}
global.__d(_fun100786, 13210, [31, 27, 33, 4501, 697, 673, 6813, 5278, 1244, 9646, 4573, 8490, 8494, 8372, 5062,
3968, 1365, 13189, 4080, 13211, 1962, 8638,
2]) /* metro module 13210, dependencies: [31, 27, 33, 4501, 697, 673, 6813, 5278, 1244, 9646, 4573, 8490, 8494, 8372, 5062, 3968, 1365, 13189, 4080, 13211, 1962, 8638, 2] */;