"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const reactBinding = require("@contember/react-binding");
const useReferencedEntity = require("./useReferencedEntity.cjs");
const slateReact = require("slate-react");
const ReferenceElementWrapper = ({ children, element }) => {
  const editor = slateReact.useSlateStatic();
  const path = slateReact.ReactEditor.findPath(editor, element);
  const ref = useReferencedEntity.useReferencedEntity(path, element.referenceId);
  return /* @__PURE__ */ jsxRuntime.jsx(reactBinding.AccessorProvider, { accessor: ref, children });
};
exports.ReferenceElementWrapper = ReferenceElementWrapper;
//# sourceMappingURL=ReferenceElementWrapper.cjs.map
