"use client";
import { normalizeUri as f } from "../../../micromark-util-sanitize-uri/index.js";
import { revert as o } from "../revert.js";
function u(e, i) {
  const l = String(i.identifier).toUpperCase(), t = e.definitionById.get(l);
  if (!t)
    return o(e, i);
  const r = { href: f(t.url || "") };
  t.title !== null && t.title !== void 0 && (r.title = t.title);
  const n = {
    type: "element",
    tagName: "a",
    properties: r,
    children: e.all(i)
  };
  return e.patch(i, n), e.applyData(i, n);
}
export {
  u as linkReference
};
