import { markdownLineEnding } from "../../../micromark-util-character/index.js";
import { factorySpace } from "../../../micromark-factory-space/index.js";
const content = { tokenize: initializeContent };
function initializeContent(n) {
	let r = n.attempt(this.parser.constructs.contentInitial, a, o), i;
	return r;
	function a(e) {
		if (e === null) {
			n.consume(e);
			return;
		}
		return n.enter("lineEnding"), n.consume(e), n.exit("lineEnding"), factorySpace(n, r, "linePrefix");
	}
	function o(e) {
		return n.enter("paragraph"), s(e);
	}
	function s(e) {
		let t = n.enter("chunkText", {
			contentType: "text",
			previous: i
		});
		return i && (i.next = t), i = t, c(e);
	}
	function c(t) {
		if (t === null) {
			n.exit("chunkText"), n.exit("paragraph"), n.consume(t);
			return;
		}
		return markdownLineEnding(t) ? (n.consume(t), n.exit("chunkText"), s) : (n.consume(t), c);
	}
}
export { content };
