import { defineComponent as v, computed as f, ref as p, resolveComponent as k, unref as n, openBlock as t, createElementBlock as l, createElementVNode as e, toDisplayString as b, createVNode as x, Transition as g, withCtx as _, Fragment as y, renderList as C, createBlock as w, createCommentVNode as u } from "vue";
import { useUser as $, enterRoom as R, recreateRoom as V } from "./composables-5f691338.js";
const B = {
  key: 0,
  class: "flex flex-col"
}, E = /* @__PURE__ */ e("div", { class: "text-lg font-bold" }, "My rooms", -1), N = /* @__PURE__ */ e("div", { class: "flex-1" }, null, -1), j = { class: "text-md font-bold mr-2" }, O = {
  key: 0,
  class: "i-la-angle-down"
}, U = {
  key: 1,
  class: "i-la-angle-up"
}, D = {
  key: 0,
  class: "flex flex-wrap gap-2 mb-8"
}, F = { class: "p-4 flex flex-wrap gap-1" }, L = ["onClick"], M = /* @__PURE__ */ e("div", { class: "i-la-eye" }, null, -1), S = /* @__PURE__ */ e("div", { class: "ml-2" }, "View", -1), T = [
  M,
  S
], q = ["onClick"], z = /* @__PURE__ */ e("div", { class: "i-ion-enter-outline" }, null, -1), A = /* @__PURE__ */ e("div", { class: "ml-2" }, "Enter", -1), G = [
  z,
  A
], H = ["onClick"], I = /* @__PURE__ */ e("div", { class: "i-la-tools" }, null, -1), J = /* @__PURE__ */ e("div", { class: "ml-2" }, "Renew", -1), K = [
  I,
  J
], Y = /* @__PURE__ */ v({
  __name: "UserRooms",
  emits: ["browse"],
  setup(P, { emit: Q }) {
    const { user: m } = $(), d = f(() => {
      var s;
      let o = (s = m.safe) == null ? void 0 : s.rooms;
      return o ? (delete o._, o) : {};
    }), i = p(!1);
    return (o, s) => {
      const h = k("room-card");
      return Object.keys(n(d)).length > 0 ? (t(), l("div", B, [
        e("div", {
          class: "flex p-4 bg-light-900 dark-bg-dark-700 rounded-xl mb-2 items-center cursor-pointer shadow-sm hover-shadow-md transition",
          onClick: s[0] || (s[0] = (r) => i.value = !i.value)
        }, [
          E,
          N,
          e("div", j, b(Object.keys(n(d)).length), 1),
          i.value ? (t(), l("div", U)) : (t(), l("div", O))
        ]),
        x(g, {
          name: "fade",
          mode: "out-in"
        }, {
          default: _(() => [
            i.value ? (t(), l("div", D, [
              (t(!0), l(y, null, C(n(d), (r, c) => (t(), w(h, {
                key: c,
                style: { flex: "1 1 200px" },
                pub: c
              }, {
                default: _(() => [
                  e("div", F, [
                    e("button", {
                      class: "button",
                      onClick: (a) => o.$emit("browse", c)
                    }, T, 8, L),
                    e("button", {
                      class: "button",
                      onClick: (a) => n(R)(c)
                    }, G, 8, q),
                    e("button", {
                      class: "button",
                      onClick: (a) => n(V)(r)
                    }, K, 8, H)
                  ])
                ]),
                _: 2
              }, 1032, ["pub"]))), 128))
            ])) : u("", !0)
          ]),
          _: 1
        })
      ])) : u("", !0);
    };
  }
});
export {
  Y as default
};
//# sourceMappingURL=UserRooms-62752628.js.map
