import { whitespace as e } from "../../../hast-util-whitespace/lib/index.js";
import { siblingAfter as t, siblingBefore as n } from "./util/siblings.js";
import { omission as r } from "./omission.js";
import { closing as i } from "./closing.js";
//#region ../../node_modules/hast-util-to-html/lib/omission/opening.js
var a = r({
	body: c,
	colgroup: l,
	head: s,
	html: o,
	tbody: u
});
function o(e) {
	let n = t(e, -1);
	return !n || n.type !== "comment";
}
function s(e) {
	let t = /* @__PURE__ */ new Set();
	for (let n of e.children) if (n.type === "element" && (n.tagName === "base" || n.tagName === "title")) {
		if (t.has(n.tagName)) return !1;
		t.add(n.tagName);
	}
	let n = e.children[0];
	return !n || n.type === "element";
}
function c(n) {
	let r = t(n, -1, !0);
	return !r || r.type !== "comment" && !(r.type === "text" && e(r.value.charAt(0))) && !(r.type === "element" && (r.tagName === "meta" || r.tagName === "link" || r.tagName === "script" || r.tagName === "style" || r.tagName === "template"));
}
function l(e, r, a) {
	let o = n(a, r), s = t(e, -1, !0);
	return a && o && o.type === "element" && o.tagName === "colgroup" && i(o, a.children.indexOf(o), a) ? !1 : !!(s && s.type === "element" && s.tagName === "col");
}
function u(e, r, a) {
	let o = n(a, r), s = t(e, -1);
	return a && o && o.type === "element" && (o.tagName === "thead" || o.tagName === "tbody") && i(o, a.children.indexOf(o), a) ? !1 : !!(s && s.type === "element" && s.tagName === "tr");
}
//#endregion
export { a as opening };
