import { ref as $, resolveComponent as g, openBlock as l, createElementBlock as r, normalizeStyle as y, unref as t, createElementVNode as s, createTextVNode as I, toDisplayString as u, normalizeClass as P, withModifiers as V, createCommentVNode as C, Fragment as B, renderList as z, createBlock as E, withCtx as F, createVNode as O, pushScopeId as R, popScopeId as j } from "vue";
import { useColor as G, useGun as J, useUser as L, useDictRecordsFor as M, langParts as T, dictRecord as d } from "./composables-5f691338.js";
import { _export_sfc as U } from "./_plugin-vue_export-helper-6a641814.js";
const w = (e) => (R("data-v-585e9f93"), e = e(), j(), e), q = { class: "flex flex-col mb-4" }, A = /* @__PURE__ */ w(() => /* @__PURE__ */ s("div", { class: "flex-1" }, null, -1)), H = /* @__PURE__ */ w(() => /* @__PURE__ */ s("div", { class: "i-la-times text-xl" }, null, -1)), K = [
  H
], Q = { class: "flex" }, W = { class: "inline-flex text-sm gap-2" }, X = { class: "font-bold" }, Y = { class: "flex flex-wrap gap-2" }, Z = {
  __name: "DictDefPage",
  props: {
    hash: {
      type: String,
      default: ""
    }
  },
  emits: ["word", "close"],
  setup(e) {
    const f = e, p = G("light"), D = J(), { user: S } = L(), o = $();
    D.get("dict").get("#def").get(f.hash).once((n) => {
      o.value = JSON.parse(n);
    });
    const h = M(f.hash);
    return (n, i) => {
      var x, _, v, m, k;
      const b = g("dict-link-list"), N = g("dict-word-card");
      return l(), r("div", {
        class: "flex flex-col rounded-xl text-xl p-4",
        style: y({ backgroundColor: t(p).hex(e.hash) })
      }, [
        s("div", q, [
          s("div", {
            class: "text-xl flex flex-wrap items-center",
            style: y([{ "text-decoration-line": "underline" }, { textDecorationStyle: (_ = t(T)[(x = o.value) == null ? void 0 : x.part]) == null ? void 0 : _.underline, textDecorationColor: t(p).hex(e.hash) }])
          }, [
            I(u((v = o.value) == null ? void 0 : v.text), 1),
            t(S).is ? (l(), r("div", {
              key: 0,
              class: P(["i-la-link link", { active: t(d).def == e.hash || t(h)[t(d).word] }]),
              onClick: i[0] || (i[0] = V((c) => t(d).def = t(d).def == e.hash ? null : e.hash, ["stop", "prevent"]))
            }, null, 2)) : C("", !0),
            A,
            s("button", {
              class: "cursor-pointer p-2",
              onClick: i[1] || (i[1] = (c) => n.$emit("close"))
            }, K)
          ], 4),
          s("div", Q, [
            s("div", W, [
              s("div", X, u((m = o.value) == null ? void 0 : m.lang), 1),
              s("p", null, u((k = o.value) == null ? void 0 : k.part), 1)
            ])
          ])
        ]),
        s("div", Y, [
          (l(!0), r(B, null, z(t(h), (c, a) => (l(), r("div", {
            class: "p-0",
            key: a
          }, [
            Object.keys(c).length > 0 ? (l(), E(N, {
              key: 0,
              class: "cursor-pointer",
              hash: a,
              onClick: (ee) => n.$emit("word", a)
            }, {
              default: F(() => [
                O(b, {
                  links: { [a]: c },
                  avatar: !0
                }, null, 8, ["links"])
              ]),
              _: 2
            }, 1032, ["hash", "onClick"])) : C("", !0)
          ]))), 128))
        ])
      ], 4);
    };
  }
}, le = /* @__PURE__ */ U(Z, [["__scopeId", "data-v-585e9f93"]]);
export {
  le as default
};
//# sourceMappingURL=DictDefPage-e54863fb.js.map
