import { defineComponent as v, useUser as h, computed as f, ref as p, openBlock as t, createElementBlock as n, createBaseVNode as e, toDisplayString as k, createVNode as b, withCtx as _, Fragment as x, renderList as g, createBlock as y, unref as a, enterRoom as C, recreateRoom as w, createCommentVNode as u, Transition as R } from "./composables-Ci32s3jE.js";
import { RoomCard as $ } from "./components.js";
const B = {
  key: 0,
  class: "flex flex-col"
}, V = /* @__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" }, E = {
  key: 0,
  class: "i-la-angle-down"
}, O = {
  key: 1,
  class: "i-la-angle-up"
}, U = {
  key: 0,
  class: "flex flex-wrap gap-2 mb-8"
}, D = { class: "p-4 flex flex-wrap gap-1" }, F = ["onClick"], L = /* @__PURE__ */ e("div", { class: "i-la-eye" }, null, -1), M = /* @__PURE__ */ e("div", { class: "ml-2" }, "View", -1), S = [
  L,
  M
], T = ["onClick"], q = /* @__PURE__ */ e("div", { class: "i-ion-enter-outline" }, null, -1), z = /* @__PURE__ */ e("div", { class: "ml-2" }, "Enter", -1), A = [
  q,
  z
], G = ["onClick"], H = /* @__PURE__ */ e("div", { class: "i-la-tools" }, null, -1), I = /* @__PURE__ */ e("div", { class: "ml-2" }, "Renew", -1), J = [
  H,
  I
], X = /* @__PURE__ */ v({
  __name: "UserRooms",
  emits: ["browse"],
  setup(K, { emit: P }) {
    const { user: m } = h(), c = f(() => {
      var o;
      let s = (o = m.safe) == null ? void 0 : o.rooms;
      return s ? (delete s._, s) : {};
    }), l = p(!1);
    return (s, o) => Object.keys(c.value).length > 0 ? (t(), n("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: o[0] || (o[0] = (d) => l.value = !l.value)
      }, [
        V,
        N,
        e("div", j, k(Object.keys(c.value).length), 1),
        l.value ? (t(), n("div", O)) : (t(), n("div", E))
      ]),
      b(R, {
        name: "fade",
        mode: "out-in"
      }, {
        default: _(() => [
          l.value ? (t(), n("div", U, [
            (t(!0), n(x, null, g(c.value, (d, i) => (t(), y(a($), {
              key: i,
              style: { flex: "1 1 200px" },
              pub: i
            }, {
              default: _(() => [
                e("div", D, [
                  e("button", {
                    class: "button",
                    onClick: (r) => s.$emit("browse", i)
                  }, S, 8, F),
                  e("button", {
                    class: "button",
                    onClick: (r) => a(C)(i)
                  }, A, 8, T),
                  e("button", {
                    class: "button",
                    onClick: (r) => a(w)(d)
                  }, J, 8, G)
                ])
              ]),
              _: 2
            }, 1032, ["pub"]))), 128))
          ])) : u("", !0)
        ]),
        _: 1
      })
    ])) : u("", !0);
  }
});
export {
  X as default
};
//# sourceMappingURL=UserRooms-CJtx3uTA.js.map
