import { checkQuote as e } from "../util/check-quote.js";
//#region ../../node_modules/mdast-util-to-markdown/lib/handle/image.js
t.peek = n;
function t(t, n, r, i) {
	let a = e(r), o = a === "\"" ? "Quote" : "Apostrophe", s = r.enter("image"), c = r.enter("label"), l = r.createTracker(i), u = l.move("![");
	return u += l.move(r.safe(t.alt, {
		before: u,
		after: "]",
		...l.current()
	})), u += l.move("]("), c(), !t.url && t.title || /[\0- \u007F]/.test(t.url) ? (c = r.enter("destinationLiteral"), u += l.move("<"), u += l.move(r.safe(t.url, {
		before: u,
		after: ">",
		...l.current()
	})), u += l.move(">")) : (c = r.enter("destinationRaw"), u += l.move(r.safe(t.url, {
		before: u,
		after: t.title ? " " : ")",
		...l.current()
	}))), c(), t.title && (c = r.enter(`title${o}`), u += l.move(" " + a), u += l.move(r.safe(t.title, {
		before: u,
		after: a,
		...l.current()
	})), u += l.move(a), c()), u += l.move(")"), s(), u;
}
function n() {
	return "!";
}
//#endregion
export { t as image };
