function f(e, t) {
  e.value || (e.value = {
    items: [],
    meta: { mode: "multi" }
  });
  const u = e.value.items.find((i) => i.key === t);
  u ? (u.count++, u.reactedByMe = !0) : e.value.items.push({
    key: t,
    count: 1,
    reactedByMe: !0
  });
}
function d(e, t) {
  if (!e.value) return;
  const u = e.value.items.find((i) => i.key === t);
  u && (u.count--, u.reactedByMe = !1, u.count <= 0 && (e.value.items = e.value.items.filter((i) => i.key !== t), e.value.items.length === 0 && (e.value = void 0)));
}
function v(e, t) {
  if (!e.value) {
    f(e, t);
    return;
  }
  const u = e.value.items.find((i) => i.key === t);
  u != null && u.reactedByMe ? d(e, t) : f(e, t);
}
export {
  f as updateLocalReactionsAdd,
  d as updateLocalReactionsRemove,
  v as updateLocalReactionsToggle
};
