import { checkEmphasis as e } from "../util/check-emphasis.js";
import { encodeCharacterReference as t } from "../util/encode-character-reference.js";
import { encodeInfo as n } from "../util/encode-info.js";
//#region ../../node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
r.peek = i;
function r(r, i, a, o) {
	let s = e(a), c = a.enter("emphasis"), l = a.createTracker(o), u = l.move(s), d = l.move(a.containerPhrasing(r, {
		after: s,
		before: u,
		...l.current()
	})), f = d.charCodeAt(0), p = n(o.before.charCodeAt(o.before.length - 1), f, s);
	p.inside && (d = t(f) + d.slice(1));
	let m = d.charCodeAt(d.length - 1), h = n(o.after.charCodeAt(0), m, s);
	h.inside && (d = d.slice(0, -1) + t(m));
	let g = l.move(s);
	return c(), a.attentionEncodeSurroundingInfo = {
		after: h.outside,
		before: p.outside
	}, u + d + g;
}
function i(e, t, n) {
	return n.options.emphasis || "*";
}
//#endregion
export { r as emphasis };
