import { computed as d, useProjects as m, currentRoom as v, openBlock as s, createElementBlock as o, createBaseVNode as c, withDirectives as f, vModelText as p, createVNode as h, withCtx as _, Fragment as x, renderList as k, createBlock as u, unref as y, normalizeStyle as g, TransitionGroup as C, createCommentVNode as w } from "./composables-Ci32s3jE.js";
import { ProjectCard as B } from "./components.js";
import V from "./ProjectForm-DNHrkWrQ.js";
const $ = { class: "flex flex-col" }, N = { class: "p-2 flex flex-col gap-2" }, P = { class: "flex flex-wrap gap-4 p-2" }, b = { class: "p-2 flex flex-col gap-2" }, D = {
  __name: "ProjectList",
  emits: ["open"],
  setup(L) {
    const t = d(() => {
      var l;
      return m((l = v) == null ? void 0 : l.pub);
    });
    return (l, a) => (s(), o("div", $, [
      c("div", N, [
        f(c("input", {
          class: "p-2 rounded-xl shadow dark-bg-dark-400",
          "onUpdate:modelValue": a[0] || (a[0] = (e) => t.value.search.value = e),
          placeholder: "Start typing a project title"
        }, null, 512), [
          [p, t.value.search.value]
        ])
      ]),
      c("div", P, [
        h(C, { name: "list" }, {
          default: _(() => [
            (s(!0), o(x, null, k(t.value.candidates.value, (e, r) => {
              var n;
              return s(), u(y(B), {
                key: r,
                project: e == null ? void 0 : e.item,
                path: (n = e == null ? void 0 : e.item) == null ? void 0 : n.path,
                style: g({ opacity: 1 - (e == null ? void 0 : e.score) }),
                onClick: (S) => {
                  var i;
                  return l.$emit("open", (i = e == null ? void 0 : e.item) == null ? void 0 : i.path);
                }
              }, null, 8, ["project", "path", "style", "onClick"]);
            }), 128))
          ]),
          _: 1
        })
      ]),
      c("div", b, [
        t.value.search.value ? (s(), u(V, {
          key: 0,
          title: t.value.search.value,
          onAdded: a[1] || (a[1] = (e) => t.value.search.value = "")
        }, null, 8, ["title"])) : w("", !0)
      ])
    ]));
  }
};
export {
  D as default
};
//# sourceMappingURL=ProjectList-GYb6BV3x.js.map
