import {r as u, S as ne, y as le, c as k, R as G, u as A, j as e, a as L, b as re, g as oe, d as _, e as K, f as D, C as P, h as R, L as B, i as V, k as X, l as o, m as O, n as E, o as ce, p as de, q as xe, s as me, t as he, v as fe, B as F, w as pe, x as je} from "./entry-index-_JNGV0lD.js";
import {o as ue, v as ge, r as ve, I as J, F as H, C as Q} from "./chunk-Instance-BUMsJWAb.js";
import {o as Ne, s as we, T as ye, P as Y, I as ee} from "./chunk-PingChart-BoZ15evw.js";
import "./chunk-react-vendor-c5ypKtDW.js";
import "./chunk-chartHelper-CoSPeqLf.js";
const be = ["none", "small", "medium", "large", "full"]
  , ke = {
    radius: {
        type: "enum",
        values: be,
        default: void 0
    }
}
  , _e = ["1", "2", "3"]
  , Ce = ["solid", "soft", "surface", "outline"]
  , $e = {
    ...ue,
    size: {
        type: "enum",
        className: "rt-r-size",
        values: _e,
        default: "1",
        responsive: !0
    },
    variant: {
        type: "enum",
        className: "rt-variant",
        values: Ce,
        default: "soft"
    },
    ...we,
    ...Ne,
    ...ke
}
  , se = u.forwardRef( (s, n) => {
    const {asChild: t, className: r, color: a, radius: h, ...x} = ge(s, $e, ve)
      , f = t ? ne : "span";
    return u.createElement(f, {
        "data-accent-color": a,
        "data-radius": h,
        ...x,
        ref: n,
        className: le("rt-reset", "rt-Badge", r)
    })
}
);
se.displayName = "Badge";
const Ae = [{
    name: "Alibaba",
    image: "/assets/logo/os-alibaba.svg",
    keywords: ["alibaba"]
}, {
    name: "AlmaLinux",
    image: "/assets/logo/os-alma.svg",
    keywords: ["alma", "almalinux"]
}, {
    name: "Alpine Linux",
    image: "/assets/logo/os-alpine.webp",
    keywords: ["alpine", "alpine linux"]
}, {
    name: "Arch Linux",
    image: "/assets/logo/os-arch.svg",
    keywords: ["arch", "archlinux", "arch linux"]
}, {
    name: "Armbian",
    image: "/assets/logo/os-armbian.svg",
    keywords: ["armbian"]
}, {
    name: "Astra Linux",
    image: "/assets/logo/os-astra.svg",
    keywords: ["astra", "astra linux"]
}, {
    name: "CentOS",
    image: "/assets/logo/os-centos.svg",
    keywords: ["centos", "cent os"]
}, {
    name: "iKuai",
    image: "/assets/logo/os-ikuai.svg",
    keywords: ["iKuai", "ikuai"]
}, {
    name: "Debian",
    image: "/assets/logo/os-debian.svg",
    keywords: ["debian", "deb"]
}, {
    name: "Fedora",
    image: "/assets/logo/os-fedora.svg",
    keywords: ["fedora"]
}, {
    name: "FreeBSD",
    image: "/assets/logo/os-freebsd.svg",
    keywords: ["freebsd", "bsd"]
}, {
    name: "Gentoo",
    image: "/assets/logo/os-gentoo.svg",
    keywords: ["gentoo"]
}, {
    name: "Huawei",
    image: "/assets/logo/os-huawei.svg",
    keywords: ["huawei", "euleros", "euler os"]
}, {
    name: "ImmortalWrt",
    image: "/assets/logo/os-openwrt.svg",
    keywords: ["immortalwrt", "immortal", "emmortal"]
}, {
    name: "Orange Pi",
    image: "/assets/logo/os-orange-pi.svg",
    keywords: ["orange pi", "orangepi"]
}, {
    name: "iStoreOS",
    image: "/assets/logo/os-istore.png",
    keywords: ["istore", "istoreos", "istore os"]
}, {
    name: "Kali Linux",
    image: "/assets/logo/os-kail.svg",
    keywords: ["kail", "kali", "kali linux"]
}, {
    name: "macOS",
    image: "/assets/logo/os-macos.svg",
    keywords: ["macos"]
}, {
    name: "Manjaro",
    image: "/assets/logo/os-manjaro.svg",
    keywords: ["manjaro"]
}, {
    name: "Linux Mint",
    image: "/assets/logo/os-mint.svg",
    keywords: ["mint", "linux mint"]
}, {
    name: "NixOS",
    image: "/assets/logo/os-nix.svg",
    keywords: ["nixos", "nix os", "nix"]
}, {
    name: "OpenCloudOS",
    image: "/assets/logo/os-opencloud.svg",
    keywords: ["opencloud"]
}, {
    name: "openSUSE",
    image: "/assets/logo/os-openSUSE.svg",
    keywords: ["opensuse", "suse"]
}, {
    name: "OpenWrt",
    image: "/assets/logo/os-openwrt.svg",
    keywords: ["openwrt", "open wrt", "open-wrt", "qwrt"]
}, {
    name: "Proxmox VE",
    image: "/assets/logo/os-proxmox.ico",
    keywords: ["proxmox", "proxmox ve"]
}, {
    name: "Red Hat",
    image: "/assets/logo/os-redhat.svg",
    keywords: ["redhat", "rhel", "red hat"]
}, {
    name: "Rocky Linux",
    image: "/assets/logo/os-rocky.svg",
    keywords: ["rocky", "rocky linux"]
}, {
    name: "Synology DSM",
    image: "/assets/logo/os-synology.ico",
    keywords: ["synology", "dsm", "synology dsm"]
}, {
    name: "Ubuntu",
    image: "/assets/logo/os-ubuntu.svg",
    keywords: ["ubuntu", "elementary"]
}, {
    name: "Unraid",
    image: "/assets/logo/os-unraid.svg",
    keywords: ["unraid"]
}, {
    name: "Windows",
    image: "/assets/logo/os-windows.svg",
    keywords: ["windows", "win", "microsoft", "ms"]
}]
  , Z = {
    name: "Unknown",
    image: "/assets/logo/linux.svg",
    keywords: ["unknown"]
};
function Pe(s) {
    if (!s)
        return Z;
    const n = s.toLowerCase().trim();
    for (const t of Ae)
        for (const r of t.keywords)
            if (n.includes(r))
                return t;
    return Z
}
function ae(s) {
    return Pe(s).image
}
/**
 * @license lucide-react v0.537.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Me = [["path", {
    d: "m21 16-4 4-4-4",
    key: "f6ql7i"
}], ["path", {
    d: "M17 20V4",
    key: "1ejh1v"
}], ["path", {
    d: "m3 8 4-4 4 4",
    key: "11wl7u"
}], ["path", {
    d: "M7 4v16",
    key: "1glfcx"
}]]
  , Se = k("arrow-up-down", Me);
/**
 * @license lucide-react v0.537.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const ze = [["path", {
    d: "M12 20v2",
    key: "1lh1kg"
}], ["path", {
    d: "M12 2v2",
    key: "tus03m"
}], ["path", {
    d: "M17 20v2",
    key: "1rnc9c"
}], ["path", {
    d: "M17 2v2",
    key: "11trls"
}], ["path", {
    d: "M2 12h2",
    key: "1t8f8n"
}], ["path", {
    d: "M2 17h2",
    key: "7oei6x"
}], ["path", {
    d: "M2 7h2",
    key: "asdhe0"
}], ["path", {
    d: "M20 12h2",
    key: "1q8mjw"
}], ["path", {
    d: "M20 17h2",
    key: "1fpfkl"
}], ["path", {
    d: "M20 7h2",
    key: "1o8tra"
}], ["path", {
    d: "M7 20v2",
    key: "4gnj0m"
}], ["path", {
    d: "M7 2v2",
    key: "1i4yhu"
}], ["rect", {
    x: "4",
    y: "4",
    width: "16",
    height: "16",
    rx: "2",
    key: "1vbyd7"
}], ["rect", {
    x: "8",
    y: "8",
    width: "8",
    height: "8",
    rx: "1",
    key: "z9xiuo"
}]]
  , W = k("cpu", ze);
/**
 * @license lucide-react v0.537.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Fe = [["path", {
    d: "m12 14 4-4",
    key: "9kzdfg"
}], ["path", {
    d: "M3.34 19a10 10 0 1 1 17.32 0",
    key: "19p75a"
}]]
  , Oe = k("gauge", Fe);
/**
 * @license lucide-react v0.537.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Ie = [["line", {
    x1: "22",
    x2: "2",
    y1: "12",
    y2: "12",
    key: "1y58io"
}], ["path", {
    d: "M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",
    key: "oot6mr"
}], ["line", {
    x1: "6",
    x2: "6.01",
    y1: "16",
    y2: "16",
    key: "sgf278"
}], ["line", {
    x1: "10",
    x2: "10.01",
    y1: "16",
    y2: "16",
    key: "1l4acy"
}]]
  , q = k("hard-drive", Ie);
/**
 * @license lucide-react v0.537.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Le = [["path", {
    d: "M6 19v-3",
    key: "1nvgqn"
}], ["path", {
    d: "M10 19v-3",
    key: "iu8nkm"
}], ["path", {
    d: "M14 19v-3",
    key: "kcehxu"
}], ["path", {
    d: "M18 19v-3",
    key: "1vh91z"
}], ["path", {
    d: "M8 11V9",
    key: "63erz4"
}], ["path", {
    d: "M16 11V9",
    key: "fru6f3"
}], ["path", {
    d: "M12 11V9",
    key: "ha00sb"
}], ["path", {
    d: "M2 15h20",
    key: "16ne18"
}], ["path", {
    d: "M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",
    key: "lhddv3"
}]]
  , I = k("memory-stick", Le);
/**
 * @license lucide-react v0.537.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Ue = [["path", {
    d: "M18 6 6 18",
    key: "1bl5f8"
}], ["path", {
    d: "m6 6 12 12",
    key: "d8bk6v"
}]]
  , Te = k("x", Ue);
/**
 * @license lucide-react v0.537.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const De = [["path", {
    d: "M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",
    key: "1xq2db"
}]]
  , Re = k("zap", De)
  , te = s => {
    const n = s.match(/<(\w+)>$/);
    if (n && n) {
        const t = n[1].toLowerCase()
          , r = s.replace(/<\w+>$/, "");
        if (re.includes(t))
            return {
                text: r,
                color: t
            }
    }
    return {
        text: s,
        color: null
    }
}
  , Be = ({tag: s, badgeColor: n, enableTransparentTags: t}) => {
    const [r,a] = u.useState(!1)
      , h = u.useRef(null)
      , {text: x} = te(s);
    u.useLayoutEffect( () => {
        const i = h.current;
        i && i.scrollWidth > i.clientWidth && a(!0)
    }
    , [x]);
    const f = t ? e.jsx("div", {
        ref: h,
        "data-accent-color": n,
        className: L("rt-reset rt-Badge rt-r-size-1 !text-xs transition-colors rt-Badge-tag-transparent !block !flex-shrink overflow-hidden text-ellipsis"),
        children: x
    }) : e.jsx(se, {
        ref: h,
        color: n,
        variant: "surface",
        className: "text-sm !block !flex-shrink overflow-hidden !text-ellipsis",
        children: e.jsx("label", {
            className: "text-xs",
            children: x
        })
    });
    return r ? e.jsx(ye, {
        className: "w-full",
        mode: "popup",
        side: "top",
        trigger: f,
        children: x
    }) : f
}
  , U = G.forwardRef( ({className: s, tags: n, ...t}, r) => {
    const {enableTransparentTags: a, tagDefaultColorList: h} = A()
      , x = G.useMemo( () => h.split(",").map(f => f.trim()), [h]);
    return e.jsx("div", {
        ref: r,
        className: L("flex flex-wrap gap-1 w-full", s),
        ...t,
        children: n.map( (f, i) => {
            const {color: c} = te(f)
              , m = c || x[i % x.length];
            return e.jsx(Be, {
                tag: f,
                badgeColor: m,
                enableTransparentTags: a
            }, i)
        }
        )
    })
}
);
U.displayName = "Tag";
const v = ({value: s, h: n="h-3", className: t}) => {
    const r = Math.max(0, Math.min(100, s))
      , a = r < 10 ? "rounded-sm" : "rounded-full";
    return e.jsx("div", {
        className: `w-full bg-(--accent-4)/50 dark:bg-(--accent-a5) rounded-full ${n} overflow-hidden`,
        children: e.jsx("div", {
            className: `${n} ${a} transition-all duration-500 ${oe(r)} ${t}`,
            style: {
                width: `${r}%`
            }
        })
    })
}
  , Ve = ({node: s, onClose: n}) => {
    const [t,r] = u.useState(!1)
      , [a,h] = u.useState(!1);
    u.useEffect( () => {
        r(!0)
    }
    , []);
    const x = () => {
        h(!0),
        r(!1),
        setTimeout(n, 300)
    }
      , {pingChartTimeInPreview: f, enableInstanceDetail: i, enablePingChart: c} = A()
      , {t: m} = _();
    return e.jsx("div", {
        className: `fixed inset-0 flex items-center justify-center z-50 transition-opacity duration-300 ${t && !a ? "opacity-100" : "opacity-0"}`,
        onClick: x,
        children: e.jsxs("div", {
            className: `purcarte-blur theme-card-style p-5 w-full max-w-4xl max-h-[80vh] transition-transform duration-300 ${t && !a ? "scale-100" : "scale-95"}`,
            onClick: g => g.stopPropagation(),
            children: [e.jsxs("div", {
                className: "flex justify-between items-center mb-2 h-full",
                children: [e.jsx("h2", {
                    className: "text-xl font-bold",
                    children: m("node.details", {
                        name: s.name
                    })
                }), e.jsx("button", {
                    onClick: x,
                    children: e.jsx(Te, {
                        className: "h-6 w-6"
                    })
                })]
            }), e.jsx(K, {
                className: "h-[calc(80vh-100px)]",
                viewportProps: {
                    className: "p-2"
                },
                children: e.jsxs("div", {
                    className: "space-y-4 @container",
                    children: [i && s && e.jsx(J, {
                        node: s
                    }), c && e.jsx(Y, {
                        node: s,
                        hours: f
                    }), !i && !c && e.jsx("div", {
                        className: "flex items-center justify-center h-[calc(80vh-132px)]",
                        children: e.jsx("div", {
                            className: "text-lg",
                            children: m("homePage.noDetailsAvailable")
                        })
                    })]
                })
            })]
        })
    })
}
  , ie = ({nodes: s, children: n}) => {
    const [t,r] = u.useState(null);
    return e.jsxs(e.Fragment, {
        children: [e.jsx("div", {
            className: "grid grid-cols-[repeat(auto-fill,minmax(18rem,1fr))] gap-4",
            children: s.map(a => n(a, () => r(a)))
        }), t && e.jsx(Ve, {
            node: t,
            onClose: () => r(null)
        })]
    })
}
  , Ee = ({nodes: s, enableSwap: n, selectTrafficProgressStyle: t}) => e.jsx(ie, {
    nodes: s,
    children: (r, a) => e.jsx(He, {
        node: r,
        enableSwap: n,
        selectTrafficProgressStyle: t,
        onShowDetails: a
    }, r.uuid)
})
  , He = ({node: s, enableSwap: n, selectTrafficProgressStyle: t, onShowDetails: r}) => {
    const {stats: a, isOnline: h, tagList: x, cpuUsage: f, memUsage: i, swapUsage: c, diskUsage: m, load: g, expired_at: N, trafficPercentage: w} = D(s)
      , {isShowHWBarInCard: y, isShowValueUnderProgressBar: j} = A()
      , {t: l} = _();
    return e.jsxs(P, {
        className: `flex flex-col mx-auto w-full max-w-sm ${h ? "" : "striped-bg-red-translucent-diagonal ring-2 ring-red-500/50"}`,
        children: [e.jsxs(R, {
            className: "flex flex-row items-center justify-between space-y-0 pb-2",
            children: [e.jsx(B, {
                to: `/instance/${s.uuid}`,
                className: "hover:underline hover:text-(--accent-11)",
                children: e.jsxs("div", {
                    className: "flex items-center gap-2",
                    children: [e.jsx(H, {
                        flag: s.region
                    }), e.jsx("img", {
                        src: ae(s.os),
                        alt: s.os,
                        className: "w-6 h-6 object-contain",
                        loading: "lazy"
                    }), e.jsx(V, {
                        className: "text-base font-bold",
                        children: s.name
                    })]
                })
            }), e.jsx("button", {
                onClick: r,
                children: e.jsx(ee, {
                    className: "h-5 w-5"
                })
            })]
        }), e.jsxs(X, {
            className: "flex-grow space-y-3 text-sm text-nowrap",
            children: [e.jsx("div", {
                className: "flex flex-wrap gap-1 mb-2",
                children: e.jsx(U, {
                    tags: x
                })
            }), e.jsx("div", {
                className: "border-t border-(--accent-4)/50 my-2"
            }), y && e.jsxs("div", {
                className: "flex items-center justify-around whitespace-nowrap",
                children: [e.jsxs("div", {
                    className: "flex items-center gap-1",
                    children: [e.jsx(W, {
                        className: "size-4 text-blue-600 flex-shrink-0"
                    }), e.jsxs("span", {
                        children: [s.cpu_cores, " ", l("node.cores")]
                    })]
                }), e.jsxs("div", {
                    className: "flex items-center gap-1",
                    children: [e.jsx(I, {
                        className: "size-4 text-green-600 flex-shrink-0"
                    }), e.jsx("span", {
                        children: o(s.mem_total)
                    })]
                }), e.jsxs("div", {
                    className: "flex items-center gap-1",
                    children: [e.jsx(q, {
                        className: "size-4 text-red-600 flex-shrink-0"
                    }), e.jsx("span", {
                        children: o(s.disk_total)
                    })]
                })]
            }), e.jsxs("div", {
                className: `${j ? "mb-1" : ""}`,
                children: [e.jsxs("div", {
                    className: "flex items-center justify-between",
                    children: [e.jsx("span", {
                        children: l("node.cpu")
                    }), e.jsxs("div", {
                        className: "w-3/4 flex items-center gap-2",
                        children: [e.jsx(v, {
                            value: f
                        }), e.jsxs("span", {
                            className: "w-12 text-right",
                            children: [f.toFixed(0), "%"]
                        })]
                    })]
                }), j && e.jsx("div", {
                    className: "flex text-xs items-center justify-between text-secondary-foreground",
                    children: e.jsxs("span", {
                        children: [s.cpu_cores, " ", l("node.cores")]
                    })
                })]
            }), e.jsxs("div", {
                className: `${j ? "mb-1" : ""}`,
                children: [e.jsxs("div", {
                    className: "flex items-center justify-between",
                    children: [e.jsx("span", {
                        children: l("node.mem")
                    }), e.jsxs("div", {
                        className: "w-3/4 flex items-center gap-2",
                        children: [e.jsx(v, {
                            value: i
                        }), e.jsxs("span", {
                            className: "w-12 text-right",
                            children: [i.toFixed(0), "%"]
                        })]
                    })]
                }), j && e.jsxs("div", {
                    className: "flex text-xs items-center justify-between text-secondary-foreground",
                    children: [e.jsx("span", {
                        children: s.mem_total > 0 ? `${o(s.mem_total)}` : l("node.notAvailable")
                    }), e.jsx("span", {
                        children: a ? `${o(a.ram)}` : l("node.notAvailable")
                    })]
                })]
            }), n && e.jsxs("div", {
                className: `${j ? "mb-1" : ""}`,
                children: [e.jsxs("div", {
                    className: "flex items-center justify-between",
                    children: [e.jsx("span", {
                        children: l("node.swap")
                    }), e.jsxs("div", {
                        className: "w-3/4 flex items-center gap-2",
                        children: [e.jsx(v, {
                            value: c
                        }), s.swap_total > 0 ? e.jsxs("span", {
                            className: "w-12 text-right",
                            children: [c.toFixed(0), "%"]
                        }) : e.jsx("span", {
                            className: "w-12 text-right",
                            children: l("node.off")
                        })]
                    })]
                }), j && e.jsxs("div", {
                    className: "flex text-xs items-center justify-between text-secondary-foreground",
                    children: [e.jsx("span", {
                        children: s.swap_total > 0 ? `${o(s.swap_total)}` : l("node.notEnabled")
                    }), e.jsx("span", {
                        children: a ? `${o(a.swap)}` : l("node.notAvailable")
                    })]
                })]
            }), e.jsxs("div", {
                className: `${j ? "mb-1" : ""}`,
                children: [e.jsxs("div", {
                    className: "flex items-center justify-between",
                    children: [e.jsx("span", {
                        children: l("node.disk")
                    }), e.jsxs("div", {
                        className: "w-3/4 flex items-center gap-2",
                        children: [e.jsx(v, {
                            value: m
                        }), e.jsxs("span", {
                            className: "w-12 text-right",
                            children: [m.toFixed(0), "%"]
                        })]
                    })]
                }), j && e.jsxs("div", {
                    className: "flex text-xs items-center justify-between text-secondary-foreground",
                    children: [e.jsx("span", {
                        children: s.disk_total > 0 ? `${o(s.disk_total)}` : l("node.notAvailable")
                    }), e.jsx("span", {
                        children: a ? `${o(a.disk)}` : l("node.notAvailable")
                    })]
                })]
            }), t === "linear" && e.jsxs("div", {
                className: "mb-1",
                children: [e.jsxs("div", {
                    className: "flex items-center justify-between",
                    children: [e.jsx("span", {
                        children: l("node.traffic")
                    }), e.jsxs("div", {
                        className: "w-3/4 flex items-center gap-2",
                        children: [e.jsx(v, {
                            value: w
                        }), e.jsx("span", {
                            className: "w-12 text-right",
                            children: s.traffic_limit !== 0 ? `${w.toFixed(0)}%` : l("node.off")
                        })]
                    })]
                }), e.jsxs("div", {
                    className: "flex text-xs items-center justify-between text-secondary-foreground",
                    children: [e.jsx("span", {
                        children: O(s.traffic_limit, s.traffic_limit_type)
                    }), e.jsx("span", {
                        children: a ? `${l("node.uploadPrefix")} ${o(a.net_total_up)} ${l("node.downloadPrefix")} ${o(a.net_total_down)}` : l("node.notAvailable")
                    })]
                })]
            }), e.jsx("div", {
                className: "border-t border-(--accent-4)/50 my-2"
            }), e.jsxs("div", {
                className: "flex justify-between text-xs",
                children: [e.jsx("span", {
                    children: l("node.network")
                }), e.jsxs("div", {
                    children: [e.jsxs("span", {
                        children: [l("node.uploadPrefix"), " ", a ? o(a.net_out, !0) : l("node.notAvailable")]
                    }), e.jsxs("span", {
                        className: "ml-2",
                        children: [l("node.downloadPrefix"), " ", a ? o(a.net_in, !0) : l("node.notAvailable")]
                    })]
                })]
            }), t === "circular" && e.jsxs("div", {
                className: "flex items-center justify-between text-xs",
                children: [e.jsx("span", {
                    className: "w-1/5",
                    children: l("node.traffic")
                }), e.jsxs("div", {
                    className: "flex items-center justify-between w-4/5",
                    children: [e.jsx("div", {
                        className: "flex items-center w-1/4",
                        children: s.traffic_limit !== 0 && e.jsx(Q, {
                            value: w,
                            maxValue: 100,
                            size: 32,
                            strokeWidth: 4,
                            showPercentage: !0
                        })
                    }), e.jsxs("div", {
                        className: "w-3/4 text-right",
                        children: [e.jsxs("div", {
                            children: [e.jsxs("span", {
                                children: [l("node.uploadPrefix"), " ", a ? o(a.net_total_up) : l("node.notAvailable")]
                            }), e.jsxs("span", {
                                className: "ml-2",
                                children: [l("node.downloadPrefix"), " ", a ? o(a.net_total_down) : l("node.notAvailable")]
                            })]
                        }), s.traffic_limit !== 0 && h && a && e.jsx("div", {
                            className: "text-right",
                            children: O(s.traffic_limit, s.traffic_limit_type)
                        })]
                    })]
                })]
            }), e.jsxs("div", {
                className: "flex justify-between text-xs",
                children: [e.jsx("span", {
                    children: l("node.load")
                }), e.jsx("span", {
                    children: g
                })]
            }), e.jsxs("div", {
                className: "flex justify-between text-xs",
                children: [e.jsxs("div", {
                    className: "flex justify-start w-full",
                    children: [e.jsx("span", {
                        className: "mr-1",
                        children: l("node.expiredAt")
                    }), e.jsx("span", {
                        children: N
                    })]
                }), e.jsx("div", {
                    className: "border-l border-(--accent-4)/50 mx-2"
                }), e.jsx("div", {
                    className: "flex justify-end w-full",
                    children: e.jsx("span", {
                        children: h && a ? e.jsxs(e.Fragment, {
                            children: [e.jsx("span", {
                                className: "mr-1",
                                children: l("node.uptime")
                            }), e.jsx("span", {
                                children: E(a.uptime)
                            })]
                        }) : l("node.offline")
                    })
                })]
            })]
        })]
    })
}
  , We = ({nodes: s}) => e.jsx(ie, {
    nodes: s,
    children: (n, t) => e.jsx(qe, {
        node: n,
        onShowDetails: t
    }, n.uuid)
})
  , qe = ({node: s, onShowDetails: n}) => {
    const {stats: t, isOnline: r, tagList: a, cpuUsage: h, memUsage: x, diskUsage: f, load: i, expired_at: c} = D(s)
      , {t: m} = _();
    return e.jsxs(P, {
        className: `flex flex-col mx-auto w-full max-w-sm ${r ? "" : "striped-bg-red-translucent-diagonal ring-2 ring-red-500/50"}`,
        children: [e.jsxs(R, {
            className: "flex flex-row items-center justify-between space-y-0 pb-1",
            children: [e.jsx(B, {
                to: `/instance/${s.uuid}`,
                className: "hover:underline hover:text-(--accent-11)",
                children: e.jsxs("div", {
                    className: "flex items-center gap-2",
                    children: [e.jsx(H, {
                        flag: s.region,
                        size: "4"
                    }), e.jsx("img", {
                        src: ae(s.os),
                        alt: s.os,
                        className: "size-4 object-contain",
                        loading: "lazy"
                    }), e.jsx(V, {
                        className: "text-sm font-bold",
                        children: s.name
                    })]
                })
            }), e.jsx("button", {
                onClick: n,
                children: e.jsx(ee, {
                    className: "size-4"
                })
            })]
        }), e.jsxs(X, {
            className: "flex-grow space-y-1 text-xs flex-shrink-0",
            children: [e.jsx("div", {
                className: "flex flex-wrap gap-1",
                children: e.jsx(U, {
                    tags: a
                })
            }), e.jsx("div", {
                className: "border-t border-(--accent-4)/50 my-1"
            }), e.jsxs("div", {
                className: "flex items-center justify-between",
                children: [e.jsxs("div", {
                    className: "flex items-center gap-1",
                    children: [e.jsx(W, {
                        className: "size-4 text-blue-600"
                    }), e.jsxs("span", {
                        children: [h.toFixed(0), "%"]
                    })]
                }), e.jsxs("div", {
                    className: "flex items-center gap-1",
                    children: [e.jsx(I, {
                        className: "size-4 text-green-600"
                    }), e.jsxs("span", {
                        children: [x.toFixed(0), "%"]
                    })]
                }), e.jsxs("div", {
                    className: "flex items-center gap-1",
                    children: [e.jsx(q, {
                        className: "size-4 text-red-600"
                    }), e.jsxs("span", {
                        children: [f.toFixed(0), "%"]
                    })]
                }), e.jsxs("div", {
                    className: "flex items-center gap-1",
                    children: [e.jsx(Re, {
                        className: "size-4 text-yellow-600"
                    }), e.jsx("span", {
                        children: i
                    })]
                })]
            }), e.jsxs("div", {
                className: "flex grid grid-cols-2",
                children: [e.jsxs("div", {
                    className: "flex items-center col-span-1",
                    children: [e.jsx(Oe, {
                        className: "size-5 text-(--accent-11) mr-2"
                    }), e.jsxs("div", {
                        children: [e.jsxs("div", {
                            children: [m("node.uploadPrefix"), " ", t ? o(t.net_out, !0) : m("node.notAvailable")]
                        }), e.jsxs("div", {
                            children: [m("node.downloadPrefix"), " ", t ? o(t.net_in, !0) : m("node.notAvailable")]
                        })]
                    })]
                }), e.jsxs("div", {
                    className: "flex items-center col-span-1",
                    children: [e.jsx(Se, {
                        className: "size-5 text-(--accent-11) mr-2"
                    }), e.jsxs("div", {
                        children: [e.jsxs("div", {
                            children: [m("node.uploadPrefix"), " ", t ? o(t.net_total_up) : m("node.notAvailable")]
                        }), e.jsxs("div", {
                            children: [m("node.downloadPrefix"), " ", t ? o(t.net_total_down) : m("node.notAvailable")]
                        })]
                    })]
                })]
            }), e.jsxs("div", {
                className: "flex grid grid-cols-2",
                children: [e.jsxs("span", {
                    className: "col-span-1",
                    children: [e.jsx("span", {
                        className: "mr-1",
                        children: m("node.expiredAt")
                    }), e.jsx("span", {
                        children: c
                    })]
                }), e.jsx("span", {
                    className: "col-span-1",
                    children: r && t ? e.jsxs(e.Fragment, {
                        children: [e.jsx("span", {
                            className: "mr-1",
                            children: m("node.uptime")
                        }), e.jsx("span", {
                            children: E(t.uptime)
                        })]
                    }) : m("node.offline")
                })]
            })]
        })]
    })
}
  , Ge = ({nodes: s, enableSwap: n, enableListItemProgressBar: t, selectTrafficProgressStyle: r}) => {
    const {t: a} = _()
      , h = n ? "grid-cols-9" : "grid-cols-8";
    return e.jsx(K, {
        className: "w-full",
        showHorizontalScrollbar: !0,
        children: e.jsx("div", {
            className: "min-w-[1080px] px-2 pb-2",
            children: e.jsxs("div", {
                className: "space-y-1",
                children: [e.jsxs(P, {
                    className: `theme-card-style text-primary font-bold grid ${h} text-center gap-4 p-2 items-center transition-colors duration-200`,
                    children: [e.jsx("div", {
                        className: "col-span-2",
                        children: a("node.name")
                    }), e.jsx("div", {
                        className: "col-span-1",
                        children: a("node.cpu")
                    }), e.jsx("div", {
                        className: "col-span-1",
                        children: a("node.mem")
                    }), n && e.jsx("div", {
                        className: "col-span-1",
                        children: a("node.swap")
                    }), e.jsx("div", {
                        className: "col-span-1",
                        children: a("node.disk")
                    }), e.jsx("div", {
                        className: "col-span-1",
                        children: a("node.network")
                    }), e.jsx("div", {
                        className: "col-span-1",
                        children: a("node.traffic")
                    }), e.jsx("div", {
                        className: "col-span-1",
                        children: a("node.load")
                    })]
                }), s.map(x => e.jsx(Ze, {
                    node: x,
                    enableSwap: n,
                    enableListItemProgressBar: t,
                    selectTrafficProgressStyle: r
                }, x.uuid))]
            })
        })
    })
}
  , Ze = ({node: s, enableSwap: n, enableListItemProgressBar: t, selectTrafficProgressStyle: r}) => {
    const [a,h] = u.useState(!1)
      , [x,f] = u.useState(!1);
    u.useEffect( () => {
        a && f(!0)
    }
    , [a]);
    const {stats: i, isOnline: c, tagList: m, cpuUsage: g, memUsage: N, swapUsage: w, diskUsage: y, load: j, expired_at: l, trafficPercentage: C} = D(s)
      , M = n ? "grid-cols-9" : "grid-cols-8"
      , {pingChartTimeInPreview: S, enableInstanceDetail: $, enablePingChart: p} = A()
      , {t: d} = _();
    return e.jsxs(P, {
        className: c ? "" : "striped-bg-red-translucent-diagonal ring-2 ring-red-500/50",
        children: [e.jsxs("div", {
            onClick: () => h(!a),
            className: `grid ${M} text-center gap-4 p-2 text-nowrap items-center text-primary transition-colors duration-200 cursor-pointer`,
            children: [e.jsxs("div", {
                className: "col-span-2 flex items-center text-left",
                children: [e.jsx(ce, {
                    className: `transition-transform size-5 duration-300 flex-shrink-0 ${a ? "rotate-90" : ""}`
                }), e.jsx(H, {
                    flag: s.region
                }), e.jsxs("div", {
                    className: "ml-2 w-[85%] space-y-1",
                    children: [e.jsx(B, {
                        to: `/instance/${s.uuid}`,
                        onClick: b => b.stopPropagation(),
                        className: "hover:underline hover:text-(--accent-11)",
                        children: e.jsx("div", {
                            className: "text-base font-bold",
                            children: s.name
                        })
                    }), e.jsx(U, {
                        className: "text-xs",
                        tags: m
                    }), e.jsx("div", {
                        className: "flex text-xs",
                        children: e.jsx("span", {
                            children: c && i ? `${l} | ${E(i.uptime)}` : d("node.offline")
                        })
                    })]
                })]
            }), e.jsxs("div", {
                className: "col-span-1 flex items-center text-left",
                children: [e.jsx(W, {
                    className: "inline-block size-5 flex-shrink-0 text-blue-600"
                }), e.jsxs("div", {
                    className: "ml-1 w-full items-center justify-center",
                    children: [e.jsxs("div", {
                        children: [s.cpu_cores, " ", d("node.cores")]
                    }), t ? e.jsxs("div", {
                        className: "flex items-center gap-1",
                        children: [e.jsx(v, {
                            value: g,
                            h: "h-2"
                        }), e.jsx("span", {
                            className: "w-10 text-right text-xs",
                            children: c ? `${g.toFixed(0)}%` : d("node.notAvailable")
                        })]
                    }) : e.jsx("div", {
                        children: c ? `${g.toFixed(0)}%` : d("node.notAvailable")
                    })]
                })]
            }), e.jsxs("div", {
                className: "col-span-1 flex items-center text-left",
                children: [e.jsx(I, {
                    className: "inline-block size-5 flex-shrink-0 text-green-600"
                }), e.jsxs("div", {
                    className: "ml-1 w-full items-center justify-center",
                    children: [e.jsx("div", {
                        children: o(s.mem_total)
                    }), t ? e.jsxs("div", {
                        className: "flex items-center gap-1",
                        children: [e.jsx(v, {
                            value: N,
                            h: "h-2"
                        }), e.jsx("span", {
                            className: "w-10 text-right text-xs",
                            children: c ? `${N.toFixed(0)}%` : d("node.notAvailable")
                        })]
                    }) : e.jsx("div", {
                        children: c ? `${N.toFixed(0)}%` : d("node.notAvailable")
                    })]
                })]
            }), n && e.jsxs("div", {
                className: "col-span-1 flex items-center text-left",
                children: [e.jsx(I, {
                    className: "inline-block size-5 flex-shrink-0 text-purple-600"
                }), s.swap_total > 0 ? e.jsxs("div", {
                    className: "ml-1 w-full items-center justify-center",
                    children: [e.jsx("div", {
                        children: o(s.swap_total)
                    }), t ? e.jsxs("div", {
                        className: "flex items-center gap-1",
                        children: [e.jsx(v, {
                            value: w,
                            h: "h-2"
                        }), e.jsx("span", {
                            className: "w-10 text-right text-xs",
                            children: c ? `${w.toFixed(0)}%` : d("node.notAvailable")
                        })]
                    }) : e.jsx("div", {
                        children: c ? `${w.toFixed(0)}%` : d("node.notAvailable")
                    })]
                }) : e.jsx("div", {
                    className: "ml-1 w-full item-center justify-center",
                    children: d("node.off")
                })]
            }), e.jsxs("div", {
                className: "col-span-1 flex items-center text-left",
                children: [e.jsx(q, {
                    className: "inline-block size-5 flex-shrink-0 text-red-600"
                }), e.jsxs("div", {
                    className: "ml-1 w-full items-center justify-center",
                    children: [e.jsx("div", {
                        children: o(s.disk_total)
                    }), t ? e.jsxs("div", {
                        className: "flex items-center gap-1",
                        children: [e.jsx(v, {
                            value: y,
                            h: "h-2"
                        }), e.jsx("span", {
                            className: "w-10 text-right text-xs",
                            children: c ? `${y.toFixed(0)}%` : d("node.notAvailable")
                        })]
                    }) : e.jsx("div", {
                        children: c ? `${y.toFixed(0)}%` : d("node.notAvailable")
                    })]
                })]
            }), e.jsxs("div", {
                className: "col-span-1 text-left",
                children: [e.jsxs("div", {
                    children: [d("node.uploadPrefix"), " ", i ? o(i.net_out, !0) : d("node.notAvailable")]
                }), e.jsxs("div", {
                    children: [d("node.downloadPrefix"), " ", i ? o(i.net_in, !0) : d("node.notAvailable")]
                })]
            }), e.jsx("div", {
                className: "col-span-1 text-left",
                children: r === "linear" && c && i ? e.jsxs("div", {
                    className: "flex flex-col",
                    children: [e.jsxs("div", {
                        children: [e.jsxs("div", {
                            children: [d("node.uploadPrefix"), " ", i ? o(i.net_total_up) : d("node.notAvailable")]
                        }), e.jsxs("div", {
                            children: [d("node.downloadPrefix"), " ", i ? o(i.net_total_down) : d("node.notAvailable")]
                        })]
                    }), s.traffic_limit !== 0 && c && i && e.jsxs(e.Fragment, {
                        children: [e.jsxs("div", {
                            className: "w-[80%] flex items-center gap-1",
                            children: [e.jsx(v, {
                                value: C,
                                h: "h-2"
                            }), e.jsx("span", {
                                className: "text-right text-xs",
                                children: s.traffic_limit !== 0 ? `${C.toFixed(0)}%` : ""
                            })]
                        }), e.jsx("div", {
                            className: "text-xs text-secondary-foreground",
                            children: O(s.traffic_limit, s.traffic_limit_type)
                        })]
                    })]
                }) : e.jsxs("div", {
                    className: "flex items-center justify-between",
                    children: [e.jsxs("div", {
                        children: [e.jsxs("div", {
                            children: [e.jsxs("div", {
                                children: [d("node.uploadPrefix"), " ", i ? o(i.net_total_up) : d("node.notAvailable")]
                            }), e.jsxs("div", {
                                children: [d("node.downloadPrefix"), " ", i ? o(i.net_total_down) : d("node.notAvailable")]
                            })]
                        }), s.traffic_limit !== 0 && c && i && e.jsx("div", {
                            children: O(s.traffic_limit, s.traffic_limit_type)
                        })]
                    }), s.traffic_limit !== 0 && c && i && e.jsx("div", {
                        children: e.jsx(Q, {
                            value: C,
                            maxValue: 100,
                            size: 32,
                            strokeWidth: 4,
                            showPercentage: !0
                        })
                    })]
                })
            }), e.jsx("div", {
                className: "col-span-1",
                children: j.split("|").map( (b, T) => e.jsx("div", {
                    children: b.trim()
                }, T))
            })]
        }), e.jsx("div", {
            className: `transition-all duration-300 ease-in-out ${a ? "max-h-[1000px] opacity-100" : "max-h-0 opacity-0 overflow-hidden"}`,
            onTransitionEnd: () => {
                a || f(!1)
            }
            ,
            children: e.jsxs("div", {
                className: L("grid gap-4 p-2", p ? "grid-cols-3" : ""),
                children: [$ && e.jsx("div", {
                    className: "col-span-1 @container",
                    children: e.jsx(J, {
                        node: s
                    })
                }), p && e.jsx("div", {
                    className: $ ? "col-span-2" : "col-span-3",
                    children: x && e.jsx(Y, {
                        node: s,
                        hours: S
                    })
                }), !$ && !p && e.jsx("div", {
                    className: "flex items-center justify-center",
                    children: e.jsx("div", {
                        className: "text-lg",
                        children: d("homePage.noDetailsAvailable")
                    })
                })]
            })
        })]
    })
}
  , es = ({searchTerm: s, setSearchTerm: n, filteredNodes: t, selectedGroup: r, setSelectedGroup: a, stats: h, groups: x, handleSort: f}) => {
    const {viewMode: i, statusCardsVisibility: c, setStatusCardsVisibility: m} = de()
      , {loading: g, error: N, refreshNodes: w} = xe()
      , {enableGroupedBar: y, enableStatsBar: j, enableSwap: l, enableListItemProgressBar: C, selectTrafficProgressStyle: M, isShowStatsInHeader: S, mergeGroupsWithStats: $} = A()
      , {t: p} = _()
      , d = me()
      , b = s.trim().length > 0;
    if (g)
        return e.jsx(he, {
            text: p("homePage.loadingData")
        });
    const T = () => i === "grid" ? e.jsx(Ee, {
        nodes: t,
        enableSwap: l,
        selectTrafficProgressStyle: M
    }) : i === "compact" ? e.jsx(We, {
        nodes: t
    }) : i === "table" ? e.jsx(Ge, {
        nodes: t,
        enableSwap: l,
        enableListItemProgressBar: C,
        selectTrafficProgressStyle: M
    }) : null;
    return e.jsxs("div", {
        className: "fade-in my-4",
        children: [j && (!S || d) && e.jsx(fe, {
            displayOptions: c,
            setDisplayOptions: m,
            stats: h,
            loading: g,
            isShowStatsInHeader: S,
            enableGroupedBar: y,
            groups: x,
            selectedGroup: r,
            onSelectGroup: a,
            onSort: f
        }), y && !$ && e.jsxs("div", {
            className: "flex purcarte-blur theme-card-style overflow-auto whitespace-nowrap overflow-x-auto items-center min-w-[300px] text-primary space-x-4 px-4 my-4",
            children: [e.jsx("span", {
                children: p("group.name")
            }), x?.map(z => e.jsx(F, {
                variant: r === z ? "secondary" : "ghost",
                size: "sm",
                onClick: () => a?.(z),
                children: z
            }, z))]
        }), e.jsx("div", {
            className: L("space-y-4", i === "table" && "-mx-2 -mb-2"),
            children: t.length > 0 ? T() : e.jsx("div", {
                className: "flex flex-grow items-center justify-center",
                children: e.jsxs(P, {
                    className: "w-full max-w-md",
                    children: [e.jsxs(R, {
                        children: [e.jsx(V, {
                            className: "text-2xl font-bold",
                            children: p(b ? "search.notFound" : N ? "homePage.errorFetchingNodes" : "homePage.noNodes")
                        }), e.jsx(pe, {
                            children: p(b ? "search.tryChangingFilters" : N ? "homePage.retryFetchingNodes" : "homePage.addNodesInAdmin")
                        })]
                    }), e.jsx(je, {
                        children: b ? e.jsx(F, {
                            onClick: () => n(""),
                            className: "w-full",
                            children: p("search.clear")
                        }) : N ? e.jsx(F, {
                            onClick: () => void w(),
                            className: "w-full",
                            children: p("search.retry")
                        }) : e.jsx(F, {
                            onClick: () => window.open("/admin", "_blank", "noopener,noreferrer"),
                            className: "w-full",
                            children: p("homePage.addNode")
                        })
                    })]
                })
            })
        })]
    })
}
;
export {es as default};
