import { ref as x, resolveComponent as u, openBlock as r, createElementBlock as d, createElementVNode as t, toDisplayString as l, createCommentVNode as c, normalizeStyle as p, unref as e, createVNode as _, withCtx as b, createTextVNode as k, withDirectives as g, vModelText as w, pushScopeId as h, popScopeId as C } from "vue";
import { useRelay as S } from "./composables-5f691338.js";
import { _export_sfc as R } from "./_plugin-vue_export-helper-6a641814.js";
const V = (n) => (h("data-v-a6728374"), n = n(), C(), n), D = { class: "cursor-pointer relative text-left" }, I = /* @__PURE__ */ V(() => /* @__PURE__ */ t("div", { class: "i-carbon-bare-metal-server-01 text-xl -mt-1" }, null, -1)), N = {
  key: 0,
  class: "ml-2 font-bold"
}, $ = { class: "p-4 min-w-60vw max-w-full" }, G = { class: "flex flex-col items-start" }, P = { class: "p-0 flex items-center flex-wrap w-full" }, B = {
  key: 0,
  class: "info"
}, E = { class: "p-0" }, T = { class: "num p-0" }, z = { class: "num p-0" }, A = { class: "num p-0" }, H = { class: "p-0" }, M = {
  __name: "GunRelay",
  props: {
    text: { type: String, default: "" }
  },
  setup(n) {
    const { relay: s, setPeer: m, resetPeer: v } = S(), i = x(!1);
    return (U, o) => {
      const f = u("gun-relay-list"), y = u("ui-layer");
      return r(), d("div", D, [
        t("button", {
          class: "flex",
          onClick: o[0] || (o[0] = (a) => i.value = !0)
        }, [
          I,
          n.text ? (r(), d("div", N, l(n.text), 1)) : c("", !0),
          t("div", {
            class: "p-1 bottom-0 left-2 rounded-full transition duration-300ms ease-in-out opacity-50 absolute",
            style: p({ backgroundColor: e(s).blink ? "white" : "black" })
          }, null, 4)
        ]),
        _(y, {
          open: i.value,
          onClose: o[4] || (o[4] = (a) => i.value = !1)
        }, {
          default: b(() => [
            t("div", $, [
              t("div", {
                class: "h-2 w-full mb-2 rounded-full transition-all duration-300 ease-in-out opacity-40",
                style: p({ backgroundColor: e(s).blink ? "white" : "black" })
              }, null, 4),
              t("div", G, [
                t("div", P, [
                  k(" Host: "),
                  g(t("input", {
                    class: "mx-1 p-2 rounded-lg flex-auto dark-bg-dark-800",
                    "onUpdate:modelValue": o[1] || (o[1] = (a) => e(s).peer = a)
                  }, null, 512), [
                    [w, e(s).peer]
                  ]),
                  t("button", {
                    class: "button m-1",
                    onClick: o[2] || (o[2] = (a) => e(m)(e(s).peer))
                  }, "Set"),
                  t("button", {
                    class: "button m-1",
                    onClick: o[3] || (o[3] = (a) => e(v)())
                  }, "Reset")
                ]),
                e(s).status != "offline" ? (r(), d("div", B, [
                  t("div", E, "Relay server is " + l(e(s).status) + " for " + l(e(s).age), 1),
                  t("div", T, "Delay: " + l(e(s).delay) + " ms", 1),
                  t("div", z, "Pulse drift: " + l(e(s).lag) + " ms", 1),
                  t("div", A, "Active wires: " + l(e(s).activeWires) + " / " + l(e(s).totalConnections), 1),
                  t("div", H, "Data storage is " + l(e(s).store ? "enabled" : "disabled"), 1)
                ])) : c("", !0)
              ]),
              _(f)
            ])
          ]),
          _: 1
        }, 8, ["open"])
      ]);
    };
  }
}, F = /* @__PURE__ */ R(M, [["__scopeId", "data-v-a6728374"]]);
export {
  F as default
};
//# sourceMappingURL=GunRelay-e3d93afb.js.map
