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