import { cn } from "./cva.js";
import { jsx, jsxs } from "react/jsx-runtime";
//#region src/RefreshSignal.tsx
function readDocumentDirection() {
	if (typeof document === "undefined") return "ltr";
	return document.documentElement.dir === "rtl" ? "rtl" : "ltr";
}
const KEYFRAMES = `@keyframes refresh-signal-sweep-ltr{0%{transform:translateX(-100%)}100%{transform:translateX(300%)}}
@keyframes refresh-signal-sweep-rtl{0%{transform:translateX(100%)}100%{transform:translateX(-300%)}}`;
function RefreshSignal({ className, variant = "refreshing" }) {
	const direction = readDocumentDirection();
	return /* @__PURE__ */ jsxs("div", {
		"aria-hidden": "true",
		"data-testid": "refresh-signal",
		"data-variant": variant,
		className: cn("pointer-events-none absolute inset-x-0 top-0 h-0.5 overflow-hidden", className),
		children: [/* @__PURE__ */ jsx("style", { children: KEYFRAMES }), /* @__PURE__ */ jsx("div", {
			"data-testid": "refresh-signal-bar",
			className: cn("h-full w-1/3 motion-reduce:animate-none", variant === "error" ? "bg-danger" : "bg-accent", direction === "rtl" ? "animate-[refresh-signal-sweep-rtl_1.2s_ease-in-out_infinite]" : "animate-[refresh-signal-sweep-ltr_1.2s_ease-in-out_infinite]")
		})]
	});
}
//#endregion
export { RefreshSignal };
