import { splice } from "../micromark-util-chunked/index.js";
var hasOwnProperty = {}.hasOwnProperty;
function combineExtensions(e) {
	let t = {}, n = -1;
	for (; ++n < e.length;) syntaxExtension(t, e[n]);
	return t;
}
function syntaxExtension(e, n) {
	let r;
	for (r in n) {
		let a = (hasOwnProperty.call(e, r) ? e[r] : void 0) || (e[r] = {}), o = n[r], s;
		if (o) for (s in o) {
			hasOwnProperty.call(a, s) || (a[s] = []);
			let e = o[s];
			constructs(a[s], Array.isArray(e) ? e : e ? [e] : []);
		}
	}
}
function constructs(t, n) {
	let r = -1, i = [];
	for (; ++r < n.length;) (n[r].add === "after" ? t : i).push(n[r]);
	splice(t, 0, 0, i);
}
export { combineExtensions };
