import { computed as v, ref as V, resolveComponent as g, openBlock as o, createElementBlock as r, createElementVNode as h, toDisplayString as a, unref as e, createVNode as i, TransitionGroup as k, withCtx as b, Fragment as x, renderList as y, withModifiers as u, createCommentVNode as C, withDirectives as D, createBlock as E, vShow as z } from "vue";
import { useColor as A, useUser as F, useReaction as G, useReactions as L, countRating as M } from "./composables-5f691338.js";
const O = { class: "p-1 flex flex-wrap gap-2 items-center" }, P = { class: "p-2 font-bold" }, T = ["onClick"], U = {
  key: 0,
  class: "pl-2 text-xl"
}, q = ["onClick"], K = {
  __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;
    A("deep");
    const { user: w } = F(), { reaction: R, react: p } = G({ ...c }), B = v(() => L(c.authors)), f = v(() => M(c.authors)), l = V();
    return (S, m) => {
      var _;
      const $ = g("post-reaction-button"), N = g("account-badge");
      return o(), r("div", O, [
        h("div", P, a(e(f) > 0 ? "+" : "") + a(e(f)), 1),
        i($, {
          "is-my": (_ = d.authors) == null ? void 0 : _[e(w).pub],
          reaction: e(R),
          onReact: m[0] || (m[0] = (s) => e(p)(s))
        }, null, 8, ["is-my", "reaction"]),
        i(k, { name: "fade" }, {
          default: b(() => [
            (o(!0), r(x, null, y(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", U, a(t), 1)) : C("", !0),
              h("div", {
                class: "font-bold px-1",
                onClick: u((n) => l.value = l.value ? null : t, ["stop", "prevent"])
              }, a(s.length), 9, q),
              i(k, { name: "fade" }, {
                default: b(() => [
                  4 > s.length || l.value == t ? (o(!0), r(x, { key: 0 }, y(s, (n) => D((o(), E(N, {
                    class: "rounded-full shadow-md min-w-6",
                    key: n,
                    size: 20,
                    selectable: !0,
                    pub: n,
                    "show-name": !1,
                    onClick: u((H) => S.$emit("user", n), ["stop", "prevent"])
                  }, null, 8, ["pub", "onClick"])), [
                    [z, n]
                  ])), 128)) : C("", !0)
                ]),
                _: 2
              }, 1024)
            ], 8, T))), 128))
          ]),
          _: 1
        })
      ]);
    };
  }
};
export {
  K as default
};
//# sourceMappingURL=PostActionReact-dac4813c.js.map
