import { ref as B, computed as v, useRoom as $, currentRoom as r, useColor as R, useBackground as y, useRoomLogo as C, openBlock as l, createElementBlock as m, createBaseVNode as u, unref as e, createCommentVNode as c, toDisplayString as w, normalizeStyle as x, createVNode as N, withCtx as k, createBlock as V } from "./composables-108ad332.js";
import { RoomPage as z, UiPanel as P } from "./components.js";
const S = { class: "mx-2" }, _ = ["src"], D = /* @__PURE__ */ u("div", { class: "text-2xl font-normal" }, "@", -1), E = {
  key: 1,
  class: "ml-1 text-sm"
}, q = {
  __name: "RoomButton",
  emits: ["room", "rooms", "browse"],
  setup(L) {
    const s = B(!1), a = v(() => $(r.pub));
    R("deep");
    const g = v(() => y({
      pub: r.pub,
      size: 200,
      attachment: "local"
    })), { logo: i } = C(r.pub);
    return (n, o) => {
      var p, d, f, b;
      return l(), m("div", S, [
        u("button", {
          class: "button",
          style: x({ ...e(g) }),
          onClick: o[0] || (o[0] = (t) => s.value = !0)
        }, [
          e(i) ? (l(), m("img", {
            key: 0,
            class: "h-12 rounded-xl mr-2",
            src: e(i)
          }, null, 8, _)) : c("", !0),
          D,
          (f = (d = (p = e(a)) == null ? void 0 : p.room) == null ? void 0 : d.profile) != null && f.name ? (l(), m("div", E, w((b = e(a)) == null ? void 0 : b.room.profile.name.substring(0, 15)), 1)) : c("", !0)
        ], 4),
        N(e(P), {
          class: "break-all",
          open: s.value,
          "close-button": !1,
          onClose: o[5] || (o[5] = (t) => s.value = !1)
        }, {
          default: k(() => [
            (l(), V(e(z), {
              key: e(r).pub,
              onRoom: o[2] || (o[2] = (t) => n.$emit("room", t)),
              onRooms: o[3] || (o[3] = (t) => n.$emit("rooms")),
              onBrowse: o[4] || (o[4] = (t) => {
                n.$emit("browse", t), s.value = !1;
              })
            }, {
              default: k(() => [
                u("button", {
                  class: "button m-4",
                  onClick: o[1] || (o[1] = (t) => {
                    n.$emit("rooms"), s.value = !1;
                  })
                }, "Browse rooms")
              ]),
              _: 1
            }))
          ]),
          _: 1
        }, 8, ["open"])
      ]);
    };
  }
};
export {
  q as default
};
//# sourceMappingURL=RoomButton-3bff8c54.js.map
