import { createElement } from "react";
import { Component, useField, SugaredField } from "@contember/binding";
const FileUrlFieldView = Component(({ fileUrlField, ...props }) => {
  const fieldAccessor = useField(fileUrlField);
  const url = fieldAccessor.value;
  return /* @__PURE__ */ createElement("a", {
    style: { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", direction: "rtl" },
    href: url,
    target: "_blank",
    rel: "noopener noreferrer",
    ...props
  }, url.substring(Math.max(0, url.lastIndexOf("/") + 1)));
}, (props) => /* @__PURE__ */ createElement(SugaredField, {
  field: props.fileUrlField
}), "FileUrlFieldView");
export { FileUrlFieldView };
//# sourceMappingURL=FileUrlFieldView.js.map
