import { features as B, useUser as C, computed as k, currentRoom as f, useRoom as L, useMd as U, reactive as F, useColor as S, useBackground as T, openBlock as n, createElementBlock as a, createBaseVNode as s, createVNode as u, unref as e, toDisplayString as z, Fragment as h, renderList as y, normalizeStyle as H, renderSlot as M, createBlock as _, createCommentVNode as N } from "./composables-Ci32s3jE.js";
import { RoomLogo as P, FormTitle as V, AccountBadge as A, RoomActions as j, RoomFeature as D, FormText as E, GuestList as w } from "./components.js";
const G = { class: "flex flex-col items-stretch" }, O = { class: "max-w-full flex flex-col items-stretche bg-light-100 bg-opacity-20 dark-bg-dark-800 dark-bg-opacity-40 p-4 md-p-12 shadow-xl backdrop-blur-md backdrop-filter rounded-t-xl" }, q = { class: "flex flex-wrap items-center gap-8" }, I = {
  class: "flex flex-col flex-auto",
  style: { flex: "100" }
}, J = { class: "text-md" }, K = { class: "flex items-center flex-wrap" }, Q = /* @__PURE__ */ s("div", { class: "font-bold mr-2" }, "Hosts: ", -1), W = { class: "flex flex-col items-center bg-light-300 dark-bg-dark-400" }, X = { class: "flex flex-wrap items-center gap-2 p-4" }, Y = { class: "relative" }, Z = {
  key: 0,
  class: "flex items-center"
}, ee = ["innerHTML"], te = /* @__PURE__ */ s("div", { class: "i-la-pen" }, null, -1), se = [
  te
], oe = { class: "p-2 flex flex-col gap-2" }, ue = {
  __name: "RoomPage",
  props: {
    pub: { type: String, default: "" },
    titles: {
      type: Object,
      default: () => B
    }
  },
  emits: ["rooms", "browse", "user"],
  setup(p) {
    const m = p, { user: x } = C(), d = k(() => m.pub ? m.pub : f.pub), { room: r, leaveRoom: le, updateRoomProfile: b, enterRoom: re } = L(d.value), R = U(), i = F({
      name: !1,
      description: !1,
      text: !1
    });
    S("deep");
    const $ = k(() => T({ pub: d.value, size: 1200, attachment: "local" }));
    return (c, o) => {
      var v, g;
      return n(), a("div", G, [
        s("div", {
          class: "pt-32 px-2 md-px-8 bg-cover relative flex flex-col items-center",
          style: H({ ...$.value })
        }, [
          s("div", O, [
            s("div", q, [
              u(e(P), {
                class: "flex-1 rounded-2xl overflow-hidden min-w-20",
                pub: p.pub
              }, null, 8, ["pub"]),
              s("div", I, [
                u(e(V), {
                  class: "font-bold text-2xl",
                  text: e(r).profile.name || d.value.substring(0, 12),
                  editable: e(r).hosts[e(x).pub] && d.value == e(f).pub && !i.name,
                  onUpdate: o[0] || (o[0] = (l) => e(b)("name", l))
                }, null, 8, ["text", "editable"]),
                s("div", J, z(e(r).profile.description), 1),
                s("div", K, [
                  Q,
                  (n(!0), a(h, null, y(e(r).hosts, (l, t) => (n(), a("div", {
                    class: "p-2 flex flex-col items-start gap-2",
                    key: t
                  }, [
                    u(e(A), {
                      pub: t,
                      selectable: !0
                    }, null, 8, ["pub"])
                  ]))), 128))
                ]),
                u(e(j), { pub: d.value }, null, 8, ["pub"])
              ])
            ])
          ])
        ], 4),
        M(c.$slots, "default"),
        s("div", W, [
          s("div", X, [
            (n(!0), a(h, null, y(p.titles, (l, t) => (n(), _(e(D), {
              key: t,
              cert: e(r).features[t],
              type: t,
              title: l,
              pub: p.pub || e(f).pub,
              open: e(r).features[t] || t == "users" && e(r).features.space || t == "chat" && e(r).features.chat,
              onClick: (ne) => c.$emit("browse", t)
            }, null, 8, ["cert", "type", "title", "pub", "open", "onClick"]))), 128))
          ]),
          s("div", Y, [
            i.text === !1 ? (n(), a("div", Z, [
              s("div", {
                class: "p-8 markdown-body prose",
                innerHTML: e(R).render(((v = e(r).profile) == null ? void 0 : v.text) || "")
              }, null, 8, ee),
              (g = e(r).hosts) != null && g[e(x).pub] ? (n(), a("button", {
                key: 0,
                class: "button absolute top-4 right-4 z-200",
                onClick: o[1] || (o[1] = (l) => {
                  var t;
                  return i.text = ((t = e(r).profile) == null ? void 0 : t.text) || "";
                })
              }, se)) : N("", !0)
            ])) : (n(), _(e(E), {
              key: 1,
              text: i.text,
              "onUpdate:text": o[2] || (o[2] = (l) => i.text = l),
              onClose: o[3] || (o[3] = (l) => {
                e(b)("text", i.text), i.text = !1;
              })
            }, null, 8, ["text"]))
          ]),
          s("div", oe, [
            u(e(w), {
              onUser: o[4] || (o[4] = (l) => c.$emit("user", l))
            }),
            u(e(w), {
              state: "offline",
              onUser: o[5] || (o[5] = (l) => c.$emit("user", l))
            })
          ])
        ])
      ]);
    };
  }
};
export {
  ue as default
};
//# sourceMappingURL=RoomPage-DAOdxIyZ.js.map
