// Metro module 13707 (f13708). import { useCallback, useRef, useEffect } from "react"; import AccessibilityStore from "../../a11y/AccessibilityStore"; import { createStyles } from "../../../design/components/Styles/native/createStyles"; import useAnalyticsLocations from "../../app_analytics/useAnalyticsLocations"; import AnalyticsLocation from "../../app_analytics/AnalyticsLocation"; import PremiumUtils from "../../../utils/PremiumUtils"; import usePendingAvatarSettings from "../hooks/usePendingAvatarSettings"; import { getPendingAvatarSrc } from "../../recent_avatars/RecentAvatarUtils"; import useUploadAvatar from "../hooks/native/useUploadAvatar"; import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators"; import { ProfileAssetType, GIFSelectionContext } from "./ProfileGIFSelectActionSheet"; import { openAvatarDecorationActionSheet } from "../../collectibles/avatar_decorations/native/AvatarDecorationUtils"; import * as _ProfileCustomizationUtils from "../../profile_customization/ProfileCustomizationUtils"; import { useStateFromStores } from "../../../_bundle/Module589"; import ReanimatedRexport, { useSharedValue, useAnimatedStyle, withRepeat, Easing, cancelAnimation } from "../../reanimated/ReanimatedRexport"; import { withTiming } from "../../../design/animation/reanimated/timing/timing"; import HeaderAvatar from "../../profile_customization/native/HeaderAvatar"; import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables"; import { intl, t } from "../../../intl/index.native"; import EditIcon from "../../profile_customization/native/EditIcon"; import { AvatarSizes } from "../../../design/void/native"; const useStyles = createStyles({ editIcon: { position: "absolute", right: -3 } }); const __initData = { code: "function EditUserProfileAvatarTsx1(){const{rotation}=this.__closure;return{transform:[{rotateZ:rotation.get()+\"deg\"}]};}" }; export default function EditUserProfileAvatar(props) { let ref, sharedValue; const { user, disabled, statusStyle, style, avatarStyle, editIconStyle, disableStatus = true, isTryItOut = false } = props; let c20653_1 = isTryItOut; let autoStartEditFlow = props.autoStartEditFlow; if (autoStartEditFlow === void 0) { autoStartEditFlow = false; } let c20653_2 = autoStartEditFlow; const size = props.size; ref = void 0; sharedValue = void 0; const styles = useStyles(); const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.EDIT_AVATAR).analyticsLocations; const canUseAnimatedAvatar = PremiumUtils.canUseAnimatedAvatar(user); const showAnimatedAvatarUpsell = canUseAnimatedAvatar ? !canUseAnimatedAvatar : !isTryItOut; const pendingAvatarSettings = usePendingAvatarSettings({ isTryItOut, analyticsLocations }); const { pendingAvatar, pendingAvatarDecoration, setPendingAvatar } = pendingAvatarSettings; const pendingAvatarSrc = getPendingAvatarSrc({ userId: user.id, image: pendingAvatar }); let r47 = pendingAvatarDecoration; if (r47 === void 0) { r47 = user.avatarDecoration; } const avatarDecoration = r47; const handleUploadAvatarSelect = useUploadAvatar({ isTryItOut, analyticsLocations }); const callback = useCallback(() => { ActionSheetActionCreators.openLazy(import("./ChangeAvatarActionSheet"), "Change Avatar", { showAnimatedAvatarUpsell, handleRemoveAvatarSelect: function handleRemoveAvatarSelect() { ActionSheetActionCreators.hideActionSheet(); setPendingAvatar(null); }, handleUploadAvatarSelect, handleUploadGIFAvatarSelect: function handleUploadGIFAvatarSelect() { ActionSheetActionCreators.hideActionSheet(); ActionSheetActionCreators.openLazy(import("./ProfileGIFSelectActionSheet"), "Select GIF Avatar", { profileAssetType: ProfileAssetType.AVATAR, selectionContext: c20653_1 ? GIFSelectionContext.PROFILE_TRY_IT_OUT : GIFSelectionContext.PROFILE_EDIT }); }, handleEditAvatarDecorationSelect: function handleEditAvatarDecorationSelect() { openAvatarDecorationActionSheet({ user, currentAvatarDecoration: avatarDecoration, analyticsLocations }); }, showRemoveAvatar: _ProfileCustomizationUtils.showRemoveAvatar(pendingAvatar, user.avatar) }); }, [user, analyticsLocations, pendingAvatar, setPendingAvatar, handleUploadAvatarSelect, showAnimatedAvatarUpsell, avatarDecoration, isTryItOut]); ref = useRef(false); useEffect(() => { if (c20653_2 && !ref.current) { ref.current = true; callback(); } }, [user, autoStartEditFlow, callback]); const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion); sharedValue = useSharedValue(0); const z = function z() { return { transform: [{ rotateZ: `${sharedValue.get()}deg` }] }; }; z.__closure = { rotation: sharedValue }; z.__workletHash = 13368223692459; z.__initData = __initData; const animatedStyle = useAnimatedStyle(z); useEffect(() => { sharedValue.set(withRepeat(withTiming(360, { duration: 3000, easing: Easing.inOut(Easing.quad) }), -1)); return () => cancelAnimation(sharedValue); }, [sharedValue]); const r90 = ; return {isTryItOut ? pendingAvatarDecoration == null ? stateFromStores ? r90 : {r90} : r90 : r90} ; };