function listItem(e, r, i) {
	let a = e.all(r), o = i ? listLoose(i) : listItemLoose(r), s = {}, c = [];
	if (typeof r.checked == "boolean") {
		let e = a[0], n;
		e && e.type === "element" && e.tagName === "p" ? n = e : (n = {
			type: "element",
			tagName: "p",
			properties: {},
			children: []
		}, a.unshift(n)), n.children.length > 0 && n.children.unshift({
			type: "text",
			value: " "
		}), n.children.unshift({
			type: "element",
			tagName: "input",
			properties: {
				type: "checkbox",
				checked: r.checked,
				disabled: !0
			},
			children: []
		}), s.className = ["task-list-item"];
	}
	let l = -1;
	for (; ++l < a.length;) {
		let e = a[l];
		(o || l !== 0 || e.type !== "element" || e.tagName !== "p") && c.push({
			type: "text",
			value: "\n"
		}), e.type === "element" && e.tagName === "p" && !o ? c.push(...e.children) : c.push(e);
	}
	let u = a[a.length - 1];
	u && (o || u.type !== "element" || u.tagName !== "p") && c.push({
		type: "text",
		value: "\n"
	});
	let d = {
		type: "element",
		tagName: "li",
		properties: s,
		children: c
	};
	return e.patch(r, d), e.applyData(r, d);
}
function listLoose(e) {
	let n = !1;
	if (e.type === "list") {
		n = e.spread || !1;
		let r = e.children, i = -1;
		for (; !n && ++i < r.length;) n = listItemLoose(r[i]);
	}
	return n;
}
function listItemLoose(e) {
	return e.spread ?? e.children.length > 1;
}
export { listItem };
