import { defineComponent as $, resolveComponent as n, openBlock as i, createElementBlock as a, createVNode as m, unref as l, withCtx as d, createBlock as p, createElementVNode as r, createCommentVNode as C, normalizeStyle as w, renderSlot as x, createTextVNode as g } from "vue";
import { useUser as h } from "./composables-5f691338.js";
const B = { class: "flex flex-col items-center w-full" }, N = /* @__PURE__ */ r("div", { class: "i-la-check" }, null, -1), U = /* @__PURE__ */ r("div", { class: "ml-2" }, "I've stored my key securely", -1), V = [
  N,
  U
], S = {
  key: 1,
  class: "flex flex-col"
}, E = { class: "p-4 flex flex-col items-start" }, M = /* @__PURE__ */ $({
  __name: "UserHome",
  emits: ["user", "room", "close", "chat", "browse"],
  setup(R, { emit: j }) {
    const { user: t } = h();
    function u() {
      t.db.get("safe").get("saved").put(!0);
    }
    return (s, e) => {
      var c;
      const f = n("auth-credentials"), _ = n("ui-layer"), v = n("auth-login"), y = n("user-panel"), b = n("user-profile"), k = n("UserRooms");
      return i(), a("div", B, [
        m(_, {
          open: l(t).is && !((c = l(t).safe) != null && c.saved),
          "close-button": "",
          onClose: e[1] || (e[1] = (o) => u())
        }, {
          default: d(() => {
            var o;
            return [
              (o = l(t).safe) != null && o.saved ? C("", !0) : (i(), p(f, { key: 0 }, {
                default: d(() => [
                  r("button", {
                    class: "button mx-8 justify-center",
                    onClick: e[0] || (e[0] = (z) => u())
                  }, V)
                ]),
                _: 1
              }))
            ];
          }),
          _: 1
        }, 8, ["open"]),
        l(t).is ? (i(), a("div", S, [
          m(y, {
            onBrowse: e[2] || (e[2] = (o) => {
              s.$emit("browse", o), s.$emit("close");
            })
          }),
          r("div", E, [
            m(b),
            m(k, {
              onBrowse: e[3] || (e[3] = (o) => s.$emit("room", o))
            })
          ]),
          r("button", {
            class: "p-4 m-4 rounded-xl font-bold text-lg shadow-md",
            style: w({ backgroundColor: l(t).color }),
            onClick: e[4] || (e[4] = (o) => {
              s.$emit("user", l(t).pub), s.$emit("close");
            })
          }, [
            x(s.$slots, "default", {}, () => [
              g(" My public profile")
            ])
          ], 4)
        ])) : (i(), p(v, { key: 0 }))
      ]);
    };
  }
});
export {
  M as default
};
//# sourceMappingURL=UserHome-6c9b7d28.js.map
