import { useColor as S, useUser as $, useReaction as N, computed as k, useReactions as V, countRating as A, ref as D, openBlock as o, createElementBlock as r, createBaseVNode as v, toDisplayString as a, unref as e, createVNode as i, withCtx as g, Fragment as _, renderList as b, withModifiers as u, createCommentVNode as x, TransitionGroup as y, withDirectives as P, createBlock as z, vShow as E } from "./composables-61bf5e40.js";
import { PostReactionButton as F, AccountBadge as G } from "./components.js";
const L = { class: "p-1 flex flex-wrap gap-2 items-center" }, M = { class: "p-2 font-bold" }, O = ["onClick"], T = {
  key: 0,
  class: "pl-2 text-xl"
}, U = ["onClick"], J = {
  __name: "PostActionReact",
  props: {
    authors: { type: Object, default: () => ({}) },
    hash: { type: String, default: "" },
    tag: { type: String, default: "" },
    back: Boolean
  },
  emits: ["react", "user"],
  setup(d) {
    const c = d;
    S("deep");
    const { user: C } = $(), { reaction: w, react: p } = N({ ...c }), B = k(() => V(c.authors)), f = k(() => A(c.authors)), l = D();
    return (R, m) => {
      var h;
      return o(), r("div", L, [
        v("div", M, a(e(f) > 0 ? "+" : "") + a(e(f)), 1),
        i(e(F), {
          "is-my": (h = d.authors) == null ? void 0 : h[e(C).pub],
          reaction: e(w),
          onReact: m[0] || (m[0] = (s) => e(p)(s))
        }, null, 8, ["is-my", "reaction"]),
        i(y, { name: "fade" }, {
          default: g(() => [
            (o(!0), r(_, null, b(e(B), (s, t) => (o(), r("div", {
              class: "p-2px flex items-center rounded-3xl bg-light-500 dark-bg-dark-600 gap-1",
              key: t,
              onClick: u((n) => e(p)(t), ["stop", "prevent"])
            }, [
              t !== "true" ? (o(), r("div", T, a(t), 1)) : x("", !0),
              v("div", {
                class: "font-bold px-1",
                onClick: u((n) => l.value = l.value ? null : t, ["stop", "prevent"])
              }, a(s.length), 9, U),
              i(y, { name: "fade" }, {
                default: g(() => [
                  4 > s.length || l.value == t ? (o(!0), r(_, { key: 0 }, b(s, (n) => P((o(), z(e(G), {
                    class: "rounded-full shadow-md min-w-6",
                    key: n,
                    size: 20,
                    selectable: !0,
                    pub: n,
                    "show-name": !1,
                    onClick: u((q) => R.$emit("user", n), ["stop", "prevent"])
                  }, null, 8, ["pub", "onClick"])), [
                    [E, n]
                  ])), 128)) : x("", !0)
                ]),
                _: 2
              }, 1024)
            ], 8, O))), 128))
          ]),
          _: 1
        })
      ]);
    };
  }
};
export {
  J as default
};
//# sourceMappingURL=PostActionReact-26552ec6.js.map
