decord/beta/source/modules/polls/native/PollVotesActionSheet.tsx
2026-10-12 16:32:48 +00:00

1009 lines
35 KiB
TypeScript

// Module ID: 11512
// Function ID: 11513
// Name: PollVotesActionSheet
// Dependencies: [32, 5, 19, 17, 5081, 5987, 2065, 5432, 1390, 21, 5092, 587, 558, 576, 1415, 504, 6820, 1126, 5088, 6185, 7898, 6335, 11513, 6852, 11519, 9585, 7901, 5409, 4962, 6180, 1200, 8766, 8304, 4850, 5093, 8625, 5031, 4969, 11520, 11521, 6157, 6879, 5056, 6840, 2]
// Exports: default
// Module 11512 (PollVotesActionSheet)
import react2 from "react" /* 576 */;
import nativeDefault from "native" /* 587 */;
import intl3 from "intl" /* 1126 */;
import AvatarUtilsDefault from "AvatarUtils" /* 1415 */;
import shared from "shared" /* 4969 */;
import useThemeDefault from "useTheme" /* 5031 */;
import ActionSheetActionCreatorsDefault from "ActionSheetActionCreators" /* 5056 */;
import Text_Text from "Text/Text" /* 5088 */;
import timing from "timing" /* 5093 */;
import FastImageDefault from "FastImage" /* 6157 */;
import Pressables from "Pressables" /* 6185 */;
import EmojiDefault from "Emoji" /* 6820 */;
import PollsUtils from "PollsUtils" /* 7898 */;
import showUserProfileActionSheetDefault from "showUserProfileActionSheet" /* 8304 */;
import formatPollMessageChatData from "formatPollMessageChatData" /* 11513 */;
import _slicedToArray from "_slicedToArray" /* 32 */;
import _asyncToGenerator_mod from "_asyncToGenerator" /* 5 */;
import react_mod from "react" /* 19 */;
import react_native from "react-native" /* 17 */;
import AccessibilityStore from "AccessibilityStore" /* 5081 */;
import EmojiStore from "EmojiStore" /* 5987 */;
import ChannelStore from "ChannelStore" /* 2065 */;
import MessageStore from "MessageStore" /* 5432 */;
import UserStore from "UserStore" /* 1390 */;
import Fragment from "Fragment" /* 21 */;
import createStyles_mod from "createStyles" /* 5092 */;
import ReactCompilerGating_mod from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
let BottomSheet, c2, item, ref2, set, user;
let closure_14;
let map1;
let metroImportDefault;
let metroRequire;
let obj2;
let obj3;
function VotersList(channelId) {
let obj6;
channelId = channelId.channelId;
const messageId = channelId.messageId;
const reaction = channelId.reaction;
let analyticsLocations;
let sharedValue;
const tmp3 = analyticsLocations;
const tmp = closure_15();
const tmp2 = messageId;
analyticsLocations = messageId(analyticsLocations[23])().analyticsLocations;
const tmp4 = messageId(analyticsLocations[24])({ channelId, messageId, reaction });
const reactors = tmp4.reactors;
const hasMore = tmp4.hasMore;
let obj = channelId(analyticsLocations[25]);
let obj2 = { channelId, messageId, reactionSelected: reaction, reactors, reactorsHasMore: hasMore, reactionType: channelId(analyticsLocations[26]).ReactionTypes.VOTE };
const reactorsOnScrollNative = obj.useReactorsOnScrollNative(obj2);
let obj3 = channelId(analyticsLocations[15]);
const items = [ChannelStore];
const stateFromStores = obj3.useStateFromStores(items, () => ChannelStore.getChannel(channelId));
const items1 = [stateFromStores, reactors.length, channelId, messageId, analyticsLocations];
const callback = sharedValue.useCallback((item) => {
let Avatar;
let obj2;
let tmp10Result;
let tmp14;
item = item.item;
const index = item.index;
let guild_id;
const getNickname = messageId(analyticsLocations[27]).getNickname;
messageId(analyticsLocations[27]);
if (stateFromStores != null) {
guild_id = tmp4.guild_id;
}
let id;
if (stateFromStores != null) {
id = tmp4.id;
}
let nickname = getNickname(guild_id, id, item);
if (nickname == null) {
const tmpResult = messageId(analyticsLocations[28]);
nickname = tmpResult.getGlobalName(item);
}
const tmpResult2 = messageId(analyticsLocations[28]);
const userTag = tmpResult2.getUserTag(item);
user = user.getUser(item.id);
let obj = {
start: 0 === index,
end: reactors.length - 1 === index,
icon: closure_1_13(Avatar, obj2),
label: tmp10Result,
subLabel: tmp14,
onPress() {
const obj = { userId: item.id, localUser: item, sourceAnalyticsLocations: analyticsLocations, channelId, messageId };
return showUserProfileActionSheetDefault(obj);
}
};
const TableRow = channelId(tmp2[29]).TableRow;
let guild_id1;
Avatar = channelId(tmp2[30]).Avatar;
const tmp11 = channelId;
if (stateFromStores != null) {
guild_id1 = tmp4.guild_id;
}
obj2 = { guildId: guild_id1, user, size: tmp11(analyticsLocations[30]).AvatarSizes.SMALL };
if (user == null) {
user = item;
}
tmp10Result = nickname;
if (nickname == null) {
const obj3 = { user: item };
tmp10Result = tmp10(tmp(tmp2[31]), obj3);
}
tmp14 = null;
if (null != nickname) {
tmp14 = userTag;
}
return closure_1_13(TableRow, obj);
}, items1);
let num = 1;
const useSharedValue = channelId(analyticsLocations[33]).useSharedValue;
channelId(analyticsLocations[33]);
const obj4 = sharedValue;
if (0 === reactors.length) {
num = 0;
}
sharedValue = useSharedValue(num);
const items2 = [sharedValue, reactors.length];
const effect = obj4.useEffect(() => {
if (0 !== reactors.length) {
set = sharedValue.set;
const obj = timing;
const result = set(obj.withTiming(1, { duration: 200 }));
} else {
const result1 = sharedValue.set(0);
}
}, items2);
const tmp5Result = channelId(tmp3[33]);
class T {
constructor() {
const obj = { flex: 1, opacity: sharedValue.get(), marginBottom: 32 };
return obj;
}
}
T.__closure = { opacity: sharedValue };
T.__workletHash = 8593850252158;
T.__initData = __initData;
const animatedStyle = tmp5Result.useAnimatedStyle(T);
const obj5 = { style: animatedStyle, children: closure_13(channelId(tmp3[35]).BottomSheetFlashList, obj6) };
const View = tmp2(tmp3[33]).View;
obj6 = { contentContainerStyle: tmp.list, data: reactors, renderItem: callback, onScroll: reactorsOnScrollNative };
return closure_13(View, obj5);
}
let _asyncToGenerator = _asyncToGenerator_mod;
let react = react_mod;
({ View: metroRequire, ScrollView: metroImportDefault } = react_native);
({ jsx: map1, jsxs: closure_14 } = Fragment);
let createStyles = createStyles_mod;
let obj = { headerText: { textAlign: "center", paddingHorizontal: 16 }, subheaderText: { textAlign: "center", marginTop: 2, paddingHorizontal: 16 }, answerScroll: { marginTop: 24 }, answerScrollContainer: { gap: 4, paddingHorizontal: 16 }, answerName: { marginTop: 16, marginHorizontal: 16, marginBottom: 8 }, list: { paddingHorizontal: 16 }, answerButton: obj2, answerSelected: obj3, answerEmoji: { marginRight: 8 }, answerText: { flexShrink: 1 }, emojiText: { fontSize: 16 }, emojiImage: { height: 16, width: 16, flexShrink: 0 }, noResultsContainer: { flexDirection: "column", alignItems: "center", paddingHorizontal: 16 }, noResultsImage: { marginTop: 32, width: 138 }, noResultsTitle: { marginTop: 16, textAlign: "center" }, noResultsSubtitle: { marginTop: 4, textAlign: "center" } };
obj2 = { padding: 8, flexDirection: "row", alignItems: "center", borderRadius: nativeDefault.radii.xs, maxWidth: 200 };
createStyles = createStyles.createStyles;
obj3 = { backgroundColor: nativeDefault.colors.BORDER_SUBTLE };
let closure_15 = createStyles(obj);
let ReactCompilerGating = ReactCompilerGating_mod;
let closure_16 = ReactCompilerGating.isReactCompilerEnabled() ? (function PollEmoji(arg0) {
let emoji;
let first;
let style;
const tmp = emoji;
let obj = emoji(576);
const cResult = obj.c(10);
({ style, emoji } = arg0);
const tmp4 = closure_15();
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [EmojiStore];
cResult[0] = items;
first = items;
} else {
first = cResult[0];
}
if (cResult[1] === emoji.animated) {
let tmp7;
if (cResult[2] === emoji.id) {
tmp7 = cResult[3];
}
const tmpResult = tmp(504);
const stateFromStores = tmpResult.useStateFromStores(first, tmp7);
if (cResult[4] === emoji.name) {
if (cResult[5] === stateFromStores) {
if (cResult[6] === style) {
if (cResult[7] === tmp4.emojiImage) {
let tmp9;
if (cResult[8] === tmp4.emojiText) {
tmp9 = cResult[9];
}
return tmp9;
}
}
}
}
let obj2 = { style, src: stateFromStores, name: emoji.name, textEmojiStyle: null, fastImageStyle: null };
({ emojiText: obj3.textEmojiStyle, emojiImage: obj3.fastImageStyle } = tmp4);
const tmp12 = closure_13(EmojiDefault, obj2);
cResult[4] = emoji.name;
cResult[5] = stateFromStores;
cResult[6] = style;
cResult[7] = tmp4.emojiImage;
cResult[8] = tmp4.emojiText;
cResult[9] = tmp12;
tmp9 = tmp12;
}
const fn = function n() {
if (null != emoji.id) {
let animated = tmp.animated;
if (!animated) {
const customEmojiById = EmojiStore.getCustomEmojiById(tmp.id);
let flag;
if (customEmojiById != null) {
flag = customEmojiById.animated;
}
if (flag == null) {
flag = false;
}
animated = flag;
}
const obj2 = { id: emoji.id, animated, size: 16 };
const obj = AvatarUtilsDefault;
return obj.getEmojiURL(obj2);
}
};
cResult[1] = emoji.animated;
cResult[2] = emoji.id;
cResult[3] = fn;
tmp7 = fn;
}) : (function PollEmoji(emoji) {
emoji = emoji.emoji;
const style = emoji.style;
const tmp = closure_15();
let obj = emoji(504);
const items = [EmojiStore];
const stateFromStores = obj.useStateFromStores(items, () => {
if (null != emoji.id) {
let animated = tmp.animated;
if (!animated) {
const customEmojiById = EmojiStore.getCustomEmojiById(tmp.id);
let flag;
if (customEmojiById != null) {
flag = customEmojiById.animated;
}
if (flag == null) {
flag = false;
}
animated = flag;
}
const obj2 = { id: emoji.id, animated, size: 16 };
const obj = AvatarUtilsDefault;
return obj.getEmojiURL(obj2);
}
});
let obj2 = { style, src: stateFromStores, name: emoji.name, textEmojiStyle: tmp.emojiText, fastImageStyle: tmp.emojiImage };
return closure_13(EmojiDefault, obj2);
});
ReactCompilerGating = ReactCompilerGating_mod;
let closure_17 = ReactCompilerGating.isReactCompilerEnabled() ? (function PollAnswerButton(answer) {
let items;
let items1;
let reaction;
let selected;
let setSelectedAnswerId;
const obj = react2;
const cResult = obj.c(32);
answer = answer.answer;
({ reaction, selected, setSelectedAnswerId } = answer);
const tmp4 = closure_15();
let num;
if (reaction != null) {
const count_details = reaction.count_details;
if (count_details != null) {
num = count_details.vote;
}
}
if (num == null) {
num = 0;
}
if (cResult[0] === answer.answer_id) {
let tmp5;
if (cResult[1] === setSelectedAnswerId) {
tmp5 = cResult[2];
}
let str = "text-default";
if (selected) {
str = "interactive-text-active";
}
if (cResult[3] === answer.poll_media.text) {
let tmp6;
if (cResult[4] === num) {
tmp6 = cResult[5];
}
let answerSelected;
if (selected) {
answerSelected = tmp4.answerSelected;
}
if (cResult[6] === tmp4.answerButton) {
let tmp9;
let tmp10;
if (cResult[7] === answerSelected) {
tmp9 = cResult[8];
}
if (cResult[9] !== selected) {
const obj2 = { selected };
cResult[9] = selected;
cResult[10] = obj2;
tmp10 = obj2;
} else {
tmp10 = cResult[10];
}
if (cResult[11] === answer.poll_media.emoji) {
let tmp11;
if (cResult[12] === tmp4.answerEmoji) {
tmp11 = cResult[13];
}
if (cResult[14] === answer.poll_media.text) {
if (cResult[15] === tmp4.answerText) {
let tmp15;
let tmp18;
if (cResult[16] === str) {
tmp15 = cResult[17];
}
if (cResult[18] !== num) {
const toLocaleStringResult = num.toLocaleString();
cResult[18] = num;
cResult[19] = toLocaleStringResult;
tmp18 = toLocaleStringResult;
} else {
tmp18 = cResult[19];
}
if (cResult[20] === tmp18) {
let tmp20;
if (cResult[21] === str) {
tmp20 = cResult[22];
}
if (cResult[23] === tmp6) {
if (cResult[24] === tmp5) {
if (cResult[25] === answer.ref) {
if (cResult[26] === tmp9) {
if (cResult[27] === tmp10) {
if (cResult[28] === tmp11) {
if (cResult[29] === tmp15) {
let tmp23;
if (cResult[30] === tmp20) {
tmp23 = cResult[31];
}
return tmp23;
}
}
}
}
}
}
}
const obj3 = { ref: answer.ref, onPress: tmp5, style: tmp9, accessibilityRole: "tab", accessibilityState: tmp10, accessibilityLabel: tmp6, children: items };
items = [tmp11, tmp15, tmp20];
const tmp25 = syncedClientThemes(Pressables.PressableHighlight, obj3);
cResult[23] = tmp6;
cResult[24] = tmp5;
cResult[25] = answer.ref;
cResult[26] = tmp9;
cResult[27] = tmp10;
cResult[28] = tmp11;
cResult[29] = tmp15;
cResult[30] = tmp20;
cResult[31] = tmp25;
tmp23 = tmp25;
}
const obj4 = { variant: "text-sm/semibold", color: str, lineClamp: 1, children: items1 };
items1 = [" ", "(", tmp18, ")"];
const tmp22 = syncedClientThemes(Text_Text.Text, obj4);
cResult[20] = tmp18;
cResult[21] = str;
cResult[22] = tmp22;
tmp20 = tmp22;
}
}
let tmp16 = null;
if (null != answer.poll_media.text) {
const obj5 = { style: tmp4.answerText, variant: "text-sm/semibold", color: str, lineClamp: 1, children: answer.poll_media.text };
tmp16 = map1(tmp(5088).Text, obj5);
}
cResult[14] = answer.poll_media.text;
cResult[15] = tmp4.answerText;
cResult[16] = str;
cResult[17] = tmp16;
tmp15 = tmp16;
}
let tmp12 = null;
if (null != answer.poll_media.emoji) {
const obj6 = { style: tmp4.answerEmoji, emoji: answer.poll_media.emoji };
tmp12 = map1(closure_16, obj6);
}
cResult[11] = answer.poll_media.emoji;
cResult[12] = tmp4.answerEmoji;
cResult[13] = tmp12;
tmp11 = tmp12;
}
const items2 = [tmp4.answerButton, answerSelected];
cResult[6] = tmp4.answerButton;
cResult[7] = answerSelected;
cResult[8] = items2;
tmp9 = items2;
}
const intl = tmp(1126).intl;
const obj7 = { numVotes: num, option: answer.poll_media.text };
const formatToPlainStringResult = intl.formatToPlainString(intl3.t.wqBc7A, obj7);
cResult[3] = answer.poll_media.text;
cResult[4] = num;
cResult[5] = formatToPlainStringResult;
tmp6 = formatToPlainStringResult;
}
const fn = function l() {
setSelectedAnswerId(String(answer.answer_id));
};
cResult[0] = answer.answer_id;
cResult[1] = setSelectedAnswerId;
cResult[2] = fn;
tmp5 = fn;
}) : (function PollAnswerButton(answer) {
let formatToPlainStringResult;
let items1;
let items2;
let items3;
let reaction;
let selected;
let setSelectedAnswerId;
answer = answer.answer;
({ reaction, selected, setSelectedAnswerId } = answer);
const ref = answer.ref;
const tmp = closure_15();
let num;
if (reaction != null) {
const count_details = reaction.count_details;
if (count_details != null) {
num = count_details.vote;
}
}
if (num == null) {
num = 0;
}
const items = [setSelectedAnswerId, answer.answer_id];
let str = "text-default";
const callback = react.useCallback(() => {
setSelectedAnswerId(String(answer.answer_id));
}, items);
if (selected) {
str = "interactive-text-active";
}
const intl = intl3.intl;
const obj2 = { ref, onPress: callback, style: items1, accessibilityRole: "tab", accessibilityState: { selected }, accessibilityLabel: formatToPlainStringResult, children: items2 };
items1 = [tmp.answerButton, ];
let answerSelected;
const obj = { numVotes: num, option: answer.poll_media.text };
formatToPlainStringResult = intl.formatToPlainString(intl3.t.wqBc7A, obj);
const PressableHighlight = Pressables.PressableHighlight;
if (selected) {
answerSelected = tmp.answerSelected;
}
items1[1] = answerSelected;
let tmp8 = null;
if (null != answer.poll_media.emoji) {
const obj3 = { style: tmp.answerEmoji, emoji: answer.poll_media.emoji };
tmp8 = map1(closure_16, obj3);
}
items2 = [tmp8, , ];
let tmp11 = null;
if (null != answer.poll_media.text) {
const obj4 = { style: tmp.answerText, variant: "text-sm/semibold", color: str, lineClamp: 1, children: answer.poll_media.text };
tmp11 = map1(tmp3(5088).Text, obj4);
}
items2[1] = tmp11;
const obj5 = { variant: "text-sm/semibold", color: str, lineClamp: 1, children: items3 };
const Text = tmp3(5088).Text;
items3 = [" ", "(", num.toLocaleString(), ")"];
items2[2] = syncedClientThemes(Text, obj5);
return syncedClientThemes(PressableHighlight, obj2);
});
ReactCompilerGating = ReactCompilerGating_mod;
let closure_18 = ReactCompilerGating.isReactCompilerEnabled() ? (function PollVotesHeader(message) {
let closure_4;
let closure_5;
let setSelectedAnswerId;
let tmp12;
let tmp8;
let tmp9;
let tmp = message;
let tmp2 = setSelectedAnswerId;
let obj = message(setSelectedAnswerId[13]);
const cResult = obj.c(31);
message = message.message;
const selectedAnswerId = message.selectedAnswerId;
setSelectedAnswerId = message.setSelectedAnswerId;
let tmp4 = closure_15();
if (cResult[0] !== message.reactions) {
const tmpResult = tmp(tmp2[20]);
const totalVotes = tmpResult.getTotalVotes(message.reactions);
cResult[0] = message.reactions;
cResult[1] = totalVotes;
}
let obj3 = react;
let ref = react.useRef(null);
_asyncToGenerator = react.useRef(null);
react = react.useRef(false);
if (cResult[2] === Symbol.for("react.memo_cache_sentinel")) {
class T {
constructor() {
timerId = setTimeout(closure_4(function() { /* body not rendered: F143886 */ }), 0);
return;
}
}
cResult[2] = T;
tmp8 = T;
} else {
class T {
constructor() {
timerId = setTimeout(closure_4(function() { /* body not rendered: F143886 */ }), 0);
return;
}
}
}
if (cResult[3] !== selectedAnswerId) {
class T {
constructor() {
timerId = setTimeout(closure_4(function() { /* body not rendered: F143886 */ }), 0);
return;
}
}
tmp10[0] = selectedAnswerId;
cResult[3] = selectedAnswerId;
cResult[4] = tmp10;
tmp9 = tmp10;
} else {
class T {
constructor() {
timerId = setTimeout(closure_4(function() { /* body not rendered: F143886 */ }), 0);
return;
}
}
}
const effect = obj3.useEffect(tmp8, tmp9);
if (cResult[5] === Symbol.for("react.memo_cache_sentinel")) {
class T {
constructor() {
timerId = setTimeout(closure_4(function() { /* body not rendered: F143886 */ }), 0);
return;
}
}
cResult[5] = tmp13;
tmp12 = tmp13;
} else {
class T {
constructor() {
timerId = setTimeout(closure_4(function() { /* body not rendered: F143886 */ }), 0);
return;
}
}
}
const tmpResult2 = tmp(tmp2[21]);
const nativeGesture = tmpResult2.useNativeGesture(tmp12);
if (null == message.poll) {
class T {
constructor() {
timerId = setTimeout(closure_4(function() { /* body not rendered: F143886 */ }), 0);
return;
}
}
} else {
class T {
constructor() {
timerId = setTimeout(closure_4(function() { /* body not rendered: F143886 */ }), 0);
return;
}
}
let obj2 = { style: tmp4.headerText, variant: "redesign/heading-18/bold", color: "mobile-text-heading-primary", accessibilityRole: "header", children: message.poll.question.text };
const tmp17 = closure_13(tmp(tmp2[18]).Text, obj2);
cResult[6] = message.poll.question.text;
cResult[7] = tmp4.headerText;
cResult[8] = tmp17;
}
}) : (function PollVotesHeader(message) {
let answers;
let closure_5;
let intl;
let intl2;
let items2;
let obj11;
let obj4;
message = message.message;
const selectedAnswerId = message.selectedAnswerId;
const setSelectedAnswerId = message.setSelectedAnswerId;
react = undefined;
let tmp = closure_15();
let items = [message.reactions];
const memo = react.useMemo(() => {
const obj = PollsUtils;
return obj.getTotalVotes(message.reactions);
}, items);
let ref = react.useRef(null);
let closure_4 = react.useRef(null);
react = react.useRef(false);
const items1 = [selectedAnswerId];
const effect = react.useEffect(() => {
const timerId = setTimeout(_asyncToGenerator(async function(arg0, value) {
let c3;
if (ref === 2) {
ref = 3;
throw new TypeError("Generator functions may not be called on executing generators");
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
let obj = { value, done: true };
return obj;
} else {
return { value: "IconComponent", done: null };
}
} else {
try {
let closure_2;
let scrollWidth;
let scrollPageX;
let styles;
let width;
let pageX;
let x;
let animated;
ref = 2;
if (0 === c2) {
if (arg0 === 1) {
ref = 3;
throw value;
} else if (arg0 === 2) {
ref = 3;
const obj2 = { value, done: true };
return obj2;
} else {
let closure_1 = tmp4;
let closure_0 = tmp;
closure_2 = undefined;
ref = undefined;
ref2 = undefined;
scrollWidth = undefined;
scrollPageX = undefined;
styles = undefined;
width = undefined;
pageX = undefined;
x = undefined;
animated = undefined;
const current4 = ref.current;
const current5 = ref2.current;
if (null != current4) {
if (null != current5) {
const self = this;
const self2 = this;
const promise = new Promise((arg0) => {
closure_0 = arg0;
closure_1_0.measure((arg0, arg1, scrollWidth, arg3, scrollPageX) => {
const obj = { scrollWidth, scrollPageX };
return closure_0(obj);
});
});
const self3 = this;
const self4 = this;
const promise3 = new Promise((arg0) => {
closure_0 = arg0;
closure_1_1.measure((arg0, arg1, width, arg3, pageX) => {
const obj = { width, pageX };
return closure_0(obj);
});
});
const self5 = this;
const self6 = this;
const promise4 = new Promise((arg0) => {
closure_0 = arg0;
closure_1_1.measureLayout(closure_1_0, (x) => {
const obj = { x };
return closure_0(obj);
});
});
const items = [promise, promise3, promise4];
c2 = 1;
ref = 1;
const obj3 = { value: Promise.all(items), done: false };
return obj3;
}
}
}
} else if (arg0 === 1) {
ref = 3;
throw value;
} else if (arg0 === 2) {
ref = 3;
const obj4 = { value, done: true };
return obj4;
} else {
closure_2 = value;
ref = ref(closure_2, 3);
ref2 = ref[0];
scrollWidth = ref2.scrollWidth;
scrollPageX = ref2.scrollPageX;
styles = ref[1];
width = styles.width;
pageX = styles.pageX;
x = ref[2].x;
animated = !useReducedMotion.useReducedMotion;
if (ref2.current) {
if (pageX < scrollPageX) {
const current2 = ref.current;
if (current2 != null) {
const point = { x: x - 16, y: 0, animated };
current2.scrollTo(point);
}
} else if (pageX + width > scrollPageX + scrollWidth) {
const current3 = ref.current;
if (current3 != null) {
const point1 = { x: x + width - scrollWidth + 16, y: 0, animated };
current3.scrollTo(point1);
}
}
} else {
const current = ref.current;
if (current != null) {
const point2 = { x: x + width / 2 - scrollWidth / 2, y: 0, animated };
current.scrollTo(point2);
}
ref2.current = true;
ref = 3;
return { value: "IconComponent", done: null };
}
}
ref = 3;
return { value: "IconComponent", done: null };
} catch (tmp29) {
ref = 3;
throw tmp29;
}
}
}), 0);
}, items1);
message(setSelectedAnswerId[21]);
let tmp9 = null;
if (null != message.poll) {
let obj = { children: items2 };
let obj2 = { style: tmp.headerText, variant: "redesign/heading-18/bold", color: "mobile-text-heading-primary", accessibilityRole: "header", children: message.poll.question.text };
items2 = [closure_13(tmp5(tmp6[18]).Text, obj2), , ];
let obj3 = { style: tmp.subheaderText, variant: "text-md/medium", color: "text-default", children: intl.format(tmp5(tmp6[17]).t.XRkuof, obj4) };
const Text = tmp5(tmp6[18]).Text;
intl = tmp5(tmp6[17]).intl;
obj4 = { count: memo };
items2[1] = closure_13(Text, obj3);
const obj5 = { gesture: tmp8, children: closure_13(closure_7, obj11) };
({ answerScroll: obj6.style, answerScrollContainer: obj6.contentContainerStyle } = tmp);
obj11 = {
ref,
style: null,
contentContainerStyle: null,
horizontal: true,
showsHorizontalScrollIndicator: false,
accessibilityRole: "tablist",
accessibilityLabel: intl2.string(message(setSelectedAnswerId[17]).t["qbir+4"]),
children: answers.map((answer) => {
let obj2;
const tmp = selectedAnswerId === String(answer.answer_id);
let tmp4;
const tmp2 = map1;
const tmp3 = closure_17;
if (tmp) {
tmp4 = closure_4;
}
const obj = { ref: tmp4, answer, selected: tmp, reaction: obj2.reactionForId(message.reactions, String(answer.answer_id)), setSelectedAnswerId };
obj2 = formatPollMessageChatData;
return tmp2(tmp3, obj, answer.answer_id);
})
};
const GestureDetector = tmp5(tmp6[21]).GestureDetector;
intl2 = tmp5(tmp6[17]).intl;
answers = message.poll.answers;
items2[2] = closure_13(GestureDetector, obj5);
tmp9 = closure_14(closure_6, obj);
}
return tmp9;
});
const __initData = { code: "function PollVotesActionSheetTsx1(){const{opacity}=this.__closure;return{flex:1,opacity:opacity.get(),marginBottom:32};}" };
ReactCompilerGating = ReactCompilerGating_mod;
let closure_21 = ReactCompilerGating.isReactCompilerEnabled() ? (function NoResults() {
let items;
let tmp5Result;
const obj = react2;
const cResult = obj.c(14);
const tmp4 = closure_15();
const noResultsContainer = tmp4.noResultsContainer;
const tmp6 = useThemeDefault();
const obj2 = shared;
if (obj2.isThemeDark(tmp6)) {
tmp5Result = tmp5(11520);
} else {
tmp5Result = tmp5(11521);
}
if (cResult[0] === tmp4.noResultsImage) {
let tmp8;
let tmp11;
let tmp13;
let tmp16;
let tmp18;
if (cResult[1] === tmp5Result) {
tmp8 = cResult[2];
}
const _Symbol = Symbol;
const noResultsTitle = tmp4.noResultsTitle;
if (cResult[3] === Symbol.for("react.memo_cache_sentinel")) {
const intl = tmp(1126).intl;
const stringResult = intl.string(intl3.t.vhQK3o);
cResult[3] = stringResult;
tmp11 = stringResult;
} else {
tmp11 = cResult[3];
}
if (cResult[4] !== tmp4.noResultsTitle) {
const obj3 = { style: noResultsTitle, variant: "heading-md/bold", color: "mobile-text-heading-primary", children: tmp11 };
const tmp15 = map1(Text_Text.Text, obj3);
cResult[4] = tmp4.noResultsTitle;
cResult[5] = tmp15;
tmp13 = tmp15;
} else {
tmp13 = cResult[5];
}
const _Symbol2 = Symbol;
const noResultsSubtitle = tmp4.noResultsSubtitle;
if (cResult[6] === Symbol.for("react.memo_cache_sentinel")) {
const intl2 = tmp(1126).intl;
const stringResult1 = intl2.string(intl3.t.bwytdh);
cResult[6] = stringResult1;
tmp16 = stringResult1;
} else {
tmp16 = cResult[6];
}
if (cResult[7] !== tmp4.noResultsSubtitle) {
const obj4 = { style: noResultsSubtitle, variant: "text-sm/semibold", color: "text-default", children: tmp16 };
const tmp20 = map1(Text_Text.Text, obj4);
cResult[7] = tmp4.noResultsSubtitle;
cResult[8] = tmp20;
tmp18 = tmp20;
} else {
tmp18 = cResult[8];
}
if (cResult[9] === tmp4.noResultsContainer) {
if (cResult[10] === tmp8) {
if (cResult[11] === tmp13) {
let tmp21;
if (cResult[12] === tmp18) {
tmp21 = cResult[13];
}
return tmp21;
}
}
}
const obj5 = { style: noResultsContainer, children: items };
items = [tmp8, tmp13, tmp18];
const tmp24 = syncedClientThemes(metroRequire, obj5);
cResult[9] = tmp4.noResultsContainer;
cResult[10] = tmp8;
cResult[11] = tmp13;
cResult[12] = tmp18;
cResult[13] = tmp24;
tmp21 = tmp24;
}
const obj6 = { style: tmp4.noResultsImage, source: tmp5Result };
const tmp9 = map1(FastImageDefault, obj6);
cResult[0] = tmp4.noResultsImage;
cResult[1] = tmp5Result;
cResult[2] = tmp9;
tmp8 = tmp9;
}) : (function NoResults() {
let intl;
let intl2;
let items;
let tmp2Result;
const tmp = closure_15();
const obj = { style: tmp.noResultsContainer, children: items };
const obj2 = { style: tmp.noResultsImage, source: tmp2Result };
const tmp4 = useThemeDefault();
const tmp8 = FastImageDefault;
const obj3 = shared;
const tmp5 = syncedClientThemes;
const tmp6 = metroRequire;
if (obj3.isThemeDark(tmp4)) {
tmp2Result = tmp2(11520);
} else {
tmp2Result = tmp2(11521);
}
items = [map1(tmp8, obj2), , ];
const obj4 = { style: tmp.noResultsTitle, variant: "heading-md/bold", color: "mobile-text-heading-primary", children: intl.string(intl3.t.vhQK3o) };
const Text = tmp9(5088).Text;
intl = tmp9(1126).intl;
items[1] = map1(Text, obj4);
const obj5 = { style: tmp.noResultsSubtitle, variant: "text-sm/semibold", color: "text-default", children: intl2.string(intl3.t.bwytdh) };
const Text2 = tmp9(5088).Text;
intl2 = tmp9(1126).intl;
items[2] = map1(Text2, obj5);
return tmp5(tmp6, obj);
});
let result = size.fileFinishedImporting("modules/polls/native/PollVotesActionSheet.tsx");
export default function PollVotesActionSheet(channelId) {
let items3;
let obj5;
channelId = channelId.channelId;
const messageId = channelId.messageId;
let selectedAnswerId;
let stateFromStores;
const initialAnswerId = channelId.initialAnswerId;
let tmp = closure_15();
let obj = react;
const tmp3 = messageId(selectedAnswerId[23]);
const analyticsLocations = tmp3(messageId(selectedAnswerId[41]).POLL_VOTES).analyticsLocations;
const tmp4 = stateFromStores(react.useState(initialAnswerId), 2);
selectedAnswerId = tmp4[0];
const items = [MessageStore];
const tmp6 = tmp4[1];
const obj2 = channelId(selectedAnswerId[15]);
stateFromStores = obj2.useStateFromStores(items, () => MessageStore.getMessage(channelId, messageId));
let closure_4 = tmp9;
const items1 = [null != stateFromStores && null != stateFromStores.poll];
const effect = obj.useEffect(() => {
const tmp = closure_4;
if (!tmp) {
const obj = ActionSheetActionCreatorsDefault;
obj.hideActionSheet("PollVotesActionSheet");
}
}, items1);
let reactions;
const useMemo = obj.useMemo;
if (stateFromStores != null) {
reactions = stateFromStores.reactions;
}
const items2 = [reactions, selectedAnswerId];
const memo = useMemo(() => {
let reactions;
if (stateFromStores != null) {
reactions = tmp.reactions;
}
if (null != reactions) {
const obj = formatPollMessageChatData;
return obj.reactionForId(stateFromStores.reactions, first);
}
}, items2);
if (null != stateFromStores && null != stateFromStores.poll) {
let found;
if (stateFromStores != null) {
const poll = stateFromStores.poll;
if (poll != null) {
const answers = poll.answers;
found = answers.find((answer_id) => String(answer_id.answer_id) === first);
}
}
let num;
if (memo != null) {
const count_details = memo.count_details;
if (count_details != null) {
num = count_details.vote;
}
}
if (num == null) {
num = 0;
}
const obj3 = { value: analyticsLocations, children: null };
const AnalyticsLocationProvider = tmp7(tmp2[23]).AnalyticsLocationProvider;
const obj4 = { scrollable: true, header: closure_13(closure_18, obj5), children: null };
obj5 = { message: stateFromStores, selectedAnswerId, setSelectedAnswerId: tmp6 };
BottomSheet = tmp7(tmp2[43]).BottomSheet;
let text;
const obj6 = { style: tmp.answerName, variant: "text-sm/semibold", color: "text-default", children: items3 };
const Text = tmp7(tmp2[18]).Text;
if (found != null) {
text = found.poll_media.text;
}
items3 = [text, , ];
items3[1] = " - ";
const intl = tmp7(tmp2[17]).intl;
const obj7 = { count: num };
items3[2] = intl.format(channelId(selectedAnswerId[17]).t["SG/Cyy"], obj7);
const items4 = [closure_14(Text, obj6), ];
if (null != memo) {
let tmp14Result;
if (num > 0) {
const obj8 = { channelId, messageId, reaction: memo };
tmp14Result = tmp14(VotersList, obj8);
}
items4[1] = tmp14Result;
obj4.children = items4;
obj3.children = closure_14(BottomSheet, obj4);
return closure_13(AnalyticsLocationProvider, obj3);
}
tmp14Result = tmp14(closure_21, {});
} else {
return null;
}
};