import { normalizeUri as e } from "../../../micromark-util-sanitize-uri/index.js";
//#region ../../node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js
function t(t, n) {
	let r = typeof t.options.clobberPrefix == "string" ? t.options.clobberPrefix : "user-content-", i = String(n.identifier).toUpperCase(), a = e(i.toLowerCase()), o = t.footnoteOrder.indexOf(i), s, c = t.footnoteCounts.get(i);
	c === void 0 ? (c = 0, t.footnoteOrder.push(i), s = t.footnoteOrder.length) : s = o + 1, c += 1, t.footnoteCounts.set(i, c);
	let l = {
		type: "element",
		tagName: "a",
		properties: {
			href: "#" + r + "fn-" + a,
			id: r + "fnref-" + a + (c > 1 ? "-" + c : ""),
			dataFootnoteRef: !0,
			ariaDescribedBy: ["footnote-label"]
		},
		children: [{
			type: "text",
			value: String(s)
		}]
	};
	t.patch(n, l);
	let u = {
		type: "element",
		tagName: "sup",
		properties: {},
		children: [l]
	};
	return t.patch(n, u), t.applyData(n, u);
}
//#endregion
export { t as footnoteReference };
