import { useUser as c, reactive as f, computed as b, useBackground as k, unref as x, openBlock as r, createElementBlock as a, createBaseVNode as s, createCommentVNode as l, withDirectives as v, vModelText as y, createVNode as g, withCtx as w, Transition as C, normalizeStyle as _, SEA as B, createRoom as N } from "./composables-Ci32s3jE.js";
const V = { class: "flex" }, A = {
  __name: "RoomForm",
  emits: ["room"],
  setup(R, { emit: $ }) {
    const { user: u } = c(), e = f({
      pair: null,
      name: ""
    });
    async function m() {
      let n = await B.pair();
      e.pair = n;
    }
    function i() {
      e.pair = null, e.name = "";
    }
    function p() {
      N(e), i();
    }
    const d = b(() => {
      var n;
      return k({ pub: (n = e.pair) == null ? void 0 : n.pub, size: 620 });
    });
    return (n, t) => x(u).pub ? (r(), a("div", {
      key: 0,
      class: "flex flex-col bg-cover rounded-2xl p-8 max-w-620px bg-light-800 dark-bg-dark-500 justify-center",
      style: _({ ...d.value })
    }, [
      s("div", V, [
        s("button", {
          class: "button m-2 flex-1",
          onClick: t[0] || (t[0] = (o) => m())
        }, "Generate a new room"),
        e.pair ? (r(), a("button", {
          key: 0,
          class: "button m-2",
          onClick: t[1] || (t[1] = (o) => i())
        }, "Reset")) : l("", !0)
      ]),
      e.pair ? v((r(), a("input", {
        key: 0,
        class: "p-2 m-2 rounded-xl dark-bg-dark-200",
        "onUpdate:modelValue": t[2] || (t[2] = (o) => e.name = o),
        type: "text",
        placeholder: "New room name"
      }, null, 512)), [
        [y, e.name]
      ]) : l("", !0),
      g(C, { name: "fade" }, {
        default: w(() => [
          e.pair && e.name ? (r(), a("button", {
            key: 0,
            class: "button m-2 flex-1",
            onClick: t[3] || (t[3] = (o) => p())
          }, "Add room")) : l("", !0)
        ]),
        _: 1
      })
    ], 4)) : l("", !0);
  }
};
export {
  A as default
};
//# sourceMappingURL=RoomForm-BBo8XiqL.js.map
