117 lines
3.2 KiB
TypeScript
117 lines
3.2 KiB
TypeScript
// Metro module 7998 (f7999).
|
|
import { createWithEqualityFn } from "../../_bundle/identity_700";
|
|
import { batchUpdates } from "../../_bundle/Module705";
|
|
import shallowEqual from "../../_bundle/shallowEqual";
|
|
import SnowflakeUtils from "../../utils/SnowflakeUtils";
|
|
let c5061_3 = {};
|
|
const withEqualityFn = createWithEqualityFn((c16157_0) => ({
|
|
pollsByChannelId: {},
|
|
pollsByMessageId: {},
|
|
updatePollState: (c26072_0, c26072_1, c26072_2) => {
|
|
batchUpdates(() => {
|
|
c16157_0((a0) => {
|
|
const pollsByChannelId = a0.pollsByChannelId;
|
|
const r7 = pollsByChannelId[c26072_0];
|
|
const r14 = c26072_2(r7 == null ? void 0 : r7[c26072_1]);
|
|
const pollsByChannelId2 = {
|
|
...a0.pollsByChannelId
|
|
};
|
|
const r17 = {
|
|
...a0.pollsByChannelId[c26072_0]
|
|
};
|
|
r17[c26072_1] = r14;
|
|
pollsByChannelId2[c26072_0] = r17;
|
|
const pollsByMessageId = {
|
|
...a0.pollsByMessageId
|
|
};
|
|
pollsByMessageId[c26072_1] = r14;
|
|
return {
|
|
pollsByChannelId: pollsByChannelId2,
|
|
pollsByMessageId
|
|
};
|
|
});
|
|
});
|
|
}
|
|
}));
|
|
export function useMessagePollInteractions(c16158_0) {
|
|
return withEqualityFn((c26073_0) => {
|
|
const r4 = {};
|
|
let c26073_1 = r4;
|
|
c16158_0.forEach((item) => {
|
|
const r5 = c26073_0.pollsByMessageId[item];
|
|
if (r5 != null) {
|
|
c26073_1[item] = r5;
|
|
}
|
|
});
|
|
return r4;
|
|
}, shallowEqual);
|
|
}
|
|
export function useChannelPollInteractions(c16159_0) {
|
|
return withEqualityFn((a0) => {
|
|
let r5 = a0.pollsByChannelId[c16159_0];
|
|
if (r5 == null) {
|
|
r5 = c5061_3;
|
|
}
|
|
return r5;
|
|
}, shallowEqual);
|
|
}
|
|
export function clearChannelPollState(c16160_0) {
|
|
batchUpdates(() => {
|
|
withEqualityFn.setState(({ pollsByChannelId, pollsByMessageId }) => {
|
|
let r8 = pollsByChannelId[c16160_0];
|
|
if (r8 == null) {
|
|
r8 = c5061_3;
|
|
}
|
|
const r18 = SnowflakeUtils.keys(r8);
|
|
const pollsByMessageId2 = {
|
|
...pollsByMessageId
|
|
};
|
|
let c29871_0 = pollsByMessageId2;
|
|
r18.forEach((item) => {
|
|
delete c29871_0[item];
|
|
});
|
|
const pollsByChannelId2 = {
|
|
...pollsByChannelId
|
|
};
|
|
delete pollsByChannelId2[c16160_0];
|
|
return {
|
|
pollsByChannelId: pollsByChannelId2,
|
|
pollsByMessageId: pollsByMessageId2
|
|
};
|
|
});
|
|
});
|
|
}
|
|
export function clearPollState(c16161_0, c16161_1) {
|
|
batchUpdates(() => {
|
|
withEqualityFn.setState(({ pollsByChannelId, pollsByMessageId }) => {
|
|
let r9 = pollsByChannelId[c16161_0];
|
|
if (r9 == null) {
|
|
r9 = {};
|
|
}
|
|
const r4 = {
|
|
...r9
|
|
};
|
|
delete r4[c16161_1];
|
|
const pollsByMessageId2 = {
|
|
...pollsByMessageId
|
|
};
|
|
delete pollsByMessageId2[c16161_1];
|
|
const pollsByChannelId2 = {
|
|
...pollsByChannelId
|
|
};
|
|
pollsByChannelId2[c16161_0] = r4;
|
|
return {
|
|
pollsByChannelId: pollsByChannelId2,
|
|
pollsByMessageId: pollsByMessageId2
|
|
};
|
|
});
|
|
});
|
|
}
|
|
export function updatePollState(a0, a1, a2) {
|
|
withEqualityFn.getState().updatePollState(a0, a1, a2);
|
|
}
|
|
export function getPollState(a0, a1) {
|
|
const r3 = withEqualityFn.getState().pollsByChannelId[a0];
|
|
return r3 == null ? void 0 : r3[a1];
|
|
}
|