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