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