import { useUser as f, reactive as b, computed as k, useBackground as x, unref as s, openBlock as r, createElementBlock as a, createBaseVNode as u, createCommentVNode as l, withDirectives as v, vModelText as y, createVNode as g, withCtx as w, Transition as C, normalizeStyle as B, SEA as N, createRoom as V } from "./composables-9e873712.js";
const R = { class: "flex" }, A = {
  __name: "RoomForm",
  emits: ["room"],
  setup(_, { emit: $ }) {
    const { user: m } = f(), e = b({
      pair: null,
      name: ""
    });
    async function p() {
      let n = await N.pair();
      e.pair = n;
    }
    function i() {
      e.pair = null, e.name = "";
    }
    function d() {
      V(e), i();
    }
    const c = k(() => {
      var n;
      return x({ pub: (n = e.pair) == null ? void 0 : n.pub, size: 620 });
    });
    return (n, t) => s(m).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: B({ ...s(c) })
    }, [
      u("div", R, [
        u("button", {
          class: "button m-2 flex-1",
          onClick: t[0] || (t[0] = (o) => p())
        }, "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) => d())
          }, "Add room")) : l("", !0)
        ]),
        _: 1
      })
    ], 4)) : l("", !0);
  }
};
export {
  A as default
};
//# sourceMappingURL=RoomForm-83e09706.js.map
