const f = (
  // Note: overloads in JSDoc can’t yet use different `@template`s.
  /**
   * @type {(
   *   (<Condition extends TestFunction>(test: Condition) => (element: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & Predicate<Condition, Element>) &
   *   (<Condition extends string>(test: Condition) => (element: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & {tagName: Condition}) &
   *   ((test?: null | undefined) => (element?: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element) &
   *   ((test?: Test) => Check)
   * )}
   */
  /**
   * @param {Test | null | undefined} [test]
   * @returns {Check}
   */
  (function(n) {
    if (n == null)
      return y;
    if (typeof n == "string")
      return a(n);
    if (typeof n == "object")
      return u(n);
    if (typeof n == "function")
      return i(n);
    throw new Error("Expected function, string, or array as `test`");
  })
);
function u(n) {
  const r = [];
  let t = -1;
  for (; ++t < n.length; )
    r[t] = f(n[t]);
  return i(e);
  function e(...o) {
    let c = -1;
    for (; ++c < r.length; )
      if (r[c].apply(this, o)) return !0;
    return !1;
  }
}
function a(n) {
  return i(r);
  function r(t) {
    return t.tagName === n;
  }
}
function i(n) {
  return r;
  function r(t, e, o) {
    return !!(p(t) && n.call(
      this,
      t,
      typeof e == "number" ? e : void 0,
      o || void 0
    ));
  }
}
function y(n) {
  return !!(n && typeof n == "object" && "type" in n && n.type === "element" && "tagName" in n && typeof n.tagName == "string");
}
function p(n) {
  return n !== null && typeof n == "object" && "type" in n && "tagName" in n;
}
export {
  f as convertElement
};
//# sourceMappingURL=index.es.js.map
