import { useUser as $, useWords as x, openBlock as n, createElementBlock as l, createBaseVNode as s, createVNode as p, withCtx as k, unref as e, dictRecord as a, createBlock as u, createCommentVNode as D, Transition as g, withDirectives as b, vModelText as W, isRef as B, Fragment as c, renderList as h, normalizeStyle as V, TransitionGroup as N } from "./composables-Ci32s3jE.js";
import { DictDefCard as T, DictWordCard as v } from "./components.js";
const E = { class: "flex flex-col gap-2" }, L = { class: "flex gap-2" }, R = { class: "flex flex-wrap gap-2" }, F = {
  __name: "DictWordList",
  emits: ["word", "root", "def"],
  setup(U) {
    const { user: f } = $(), { input: i, found: C, linked: w, addWord: y } = x();
    return (d, t) => (n(), l("div", E, [
      s("div", {
        class: "font-bold text-xl mb-2 cursor-pointer",
        onClick: t[0] || (t[0] = (o) => d.$emit("root", "words"))
      }, "Words"),
      p(g, {
        name: "fade",
        mode: "out-in"
      }, {
        default: k(() => [
          e(a).def ? (n(), u(e(T), {
            key: e(a).def,
            hash: e(a).def
          }, null, 8, ["hash"])) : D("", !0)
        ]),
        _: 1
      }),
      s("div", L, [
        b(s("input", {
          class: "p-2 rounded-lg flex-1 dark-bg-dark-400",
          "onUpdate:modelValue": t[1] || (t[1] = (o) => B(i) ? i.value = o : null),
          placeholder: "Enter a word"
        }, null, 512), [
          [W, e(i)]
        ]),
        s("button", {
          class: "button",
          onClick: t[2] || (t[2] = (o) => e(f).is ? e(y)() : e(f).auth = !0)
        }, "Add")
      ]),
      s("div", R, [
        p(N, { name: "list" }, {
          default: k(() => [
            e(i) ? (n(!0), l(c, { key: 1 }, h(e(C), (o) => (n(), u(e(v), {
              key: o.item.hash,
              style: V({ opacity: 1 - o.score }),
              hash: o.item.hash,
              onDef: t[4] || (t[4] = (r) => d.$emit("def", r)),
              onClick: (r) => d.$emit("word", o.item.hash)
            }, null, 8, ["style", "hash", "onClick"]))), 128)) : (n(!0), l(c, { key: 0 }, h(e(w), (o, r) => (n(), u(e(v), {
              key: r,
              hash: r,
              onDef: t[3] || (t[3] = (m) => d.$emit("def", m)),
              onClick: (m) => d.$emit("word", r)
            }, null, 8, ["hash", "onClick"]))), 128))
          ]),
          _: 1
        })
      ])
    ]));
  }
};
export {
  F as default
};
//# sourceMappingURL=DictWordList-G7l1yTj7.js.map
