// Metro module 11386 (f11387).
import { useState, useMemo } from "react";
import { ActivityIndicator } from "react-native";
import { DraftType } from "../../../stores/DraftStore";
import UploadAttachmentStore from "../../../stores/UploadAttachmentStore";
import { EMOJI_URL_BASE_SIZE } from "../../emojis/EmojiConstants";
import { useStateFromStores } from "../../../_bundle/Module589";
import { PollMediaUploadAttachmentStatus } from "../PollTypes";
import FastImage from "../../../components_native/common/FastImage";
import Emoji from "../../emojis/native/Emoji";
import { EmojiTypes } from "../../emojis/EmojiTypes";
import AvatarUtils from "../../../utils/AvatarUtils";
export default function useRenderPollAnswerImage(c18797_0, c18797_1, a2, a3, a4) {
let c18797_7;
const width = a4;
const stateFromStores = useStateFromStores([UploadAttachmentStore], () => UploadAttachmentStore.getUpload(c18797_0, c18797_1, DraftType.Poll));
const [state, setUploadSize] = useState();
const r34 = (a2 == null ? void 0 : a2.mediaAttachmentState?.status) === PollMediaUploadAttachmentStatus.PREPARING;
c18797_7 = r34;
return {
renderImage: useMemo(() => {
if (c18797_7) {
return ;
}
if (stateFromStores != null) {
const item = stateFromStores.item;
let width2 = a3;
if (width2 == null) {
width2 = state;
}
return ;
}
if (a2?.emoji != null) {
const emoji = a2.emoji;
let name = emoji.type === EmojiTypes.UNICODE ? emoji.surrogates : emoji.name;
if (name == null) {
name = "";
}
return ;
}
}, [a2, a4, a3, stateFromStores, r34, state]),
upload: stateFromStores,
setUploadSize
};
};