import { jsxDEV } from "react/jsx-dev-runtime";
import { Stack, VisuallyHidden } from "@contember/ui";
import { isNonEmptyTrimmedString, assert } from "@contember/utilities";
import { ArrowLeftIcon } from "lucide-react";
import { memo } from "react";
import { Link } from "./Link.js";
import { useMessageFormatter } from "../../i18n/useMessageFormatter.js";
const navigationBackLinkDictionary = {
  navigationBackLink: {
    back: "Back"
  }
};
const NavigateBackLink = memo(({
  icon,
  ariaLabel,
  children,
  visuallyHidden = true,
  ...props
}) => {
  const formatMessage = useMessageFormatter(navigationBackLinkDictionary);
  const finalAriaLabel = isNonEmptyTrimmedString(children) ? children : ariaLabel ?? formatMessage("navigationBackLink.back");
  assert("ariaLabel to be present when children is empty", finalAriaLabel, isNonEmptyTrimmedString);
  return /* @__PURE__ */ jsxDEV(Link, { ...props, "aria-label": finalAriaLabel, children: /* @__PURE__ */ jsxDEV(Stack, { direction: "horizontal", align: "center", children: [
    icon ?? /* @__PURE__ */ jsxDEV(ArrowLeftIcon, {}, void 0, false, {
      fileName: "/__w/interface/interface/packages/admin/src/routing/binding/NavigateBackLink.tsx",
      lineNumber: 45,
      columnNumber: 14
    }, globalThis),
    /* @__PURE__ */ jsxDEV(VisuallyHidden, { hidden: visuallyHidden, children: children ?? formatMessage("navigationBackLink.back") }, void 0, false, {
      fileName: "/__w/interface/interface/packages/admin/src/routing/binding/NavigateBackLink.tsx",
      lineNumber: 46,
      columnNumber: 5
    }, globalThis)
  ] }, void 0, true, {
    fileName: "/__w/interface/interface/packages/admin/src/routing/binding/NavigateBackLink.tsx",
    lineNumber: 44,
    columnNumber: 4
  }, globalThis) }, void 0, false, {
    fileName: "/__w/interface/interface/packages/admin/src/routing/binding/NavigateBackLink.tsx",
    lineNumber: 43,
    columnNumber: 3
  }, globalThis);
});
NavigateBackLink.displayName = "NavigateBackLink";
export {
  NavigateBackLink,
  navigationBackLinkDictionary
};
//# sourceMappingURL=NavigateBackLink.js.map
