"use client"; import { jsxs as f, Fragment as p, jsx as h } from "react/jsx-runtime"; import { useState as w, useRef as m, useEffect as x } from "react"; import { d as y } from "./chunks/feature-registry-B2iuEiEx.js"; function b({ endpoint: t = "/version.json", interval: s = 3e4, children: c, message: u = "نسخه جدید سامانه در دسترس است" }) { const [d, l] = w(!1), a = m(null); return x(() => { if (typeof window > "u" || process.env.NODE_ENV !== "production") return; let r = !0, n; const i = async () => { const o = t.includes("?") ? "&" : "?", e = await fetch(`${t}${o}t=${Date.now()}`, { cache: "no-store" }); if (!e.ok) throw new Error(`Version HTTP ${e.status}`); return String((await e.json()).version); }; return i().then((o) => { r && (a.current = o, n = setInterval(async () => { try { const e = await i(); r && e !== a.current && (l(!0), clearInterval(n)); } catch { } }, s)); }).catch(() => { }), () => { r = !1, clearInterval(n); }; }, [t, s]), /* @__PURE__ */ f(p, { children: [ c, d && /* @__PURE__ */ h("button", { type: "button", onClick: () => window.location.reload(), style: { position: "fixed", bottom: 16, right: 16, zIndex: 9999, padding: "12px 16px", color: "white", background: "#111", border: 0, borderRadius: 8, cursor: "pointer", fontFamily: "inherit" }, children: u }) ] }); } const j = y("Updates", 70, b); export { j as Updates };