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