import { jsx } from "react/jsx-runtime";
import { Link as Link$1, NavLink as NavLink$1 } from "react-router";
import { useTransitionDirection } from "./use-transition-direction.js";
function Link({
  dontAnimate = false,
  href,
  onClick,
  ...props
}) {
  const direction = useTransitionDirection(
    typeof href === "string" ? href : href.pathname || "/",
    dontAnimate
  );
  const handleClick = (event) => {
    document.documentElement.classList.remove("push", "pop");
    if (direction !== "none") {
      document.documentElement.classList.add(direction);
    }
    if (onClick) {
      onClick(event);
    }
  };
  return /* @__PURE__ */ jsx(Link$1, { viewTransition: true, to: href, ...props, onClick: handleClick });
}
function NavLink({ href, onClick, ...props }) {
  const handleClick = (event) => {
    document.documentElement.classList.remove("push", "pop");
    if (onClick) {
      onClick(event);
    }
  };
  return /* @__PURE__ */ jsx(NavLink$1, { viewTransition: true, to: href, ...props, onClick: handleClick });
}
export {
  Link,
  NavLink
};
