import { isValidElement as n, Children as i } from "react";
const o = (e) => n(e) && !!e.props.children, s = (e) => typeof e > "u" || e === null || typeof e == "boolean" || JSON.stringify(e) === "{}" ? "" : e.toString(), p = (e) => !(e instanceof Array) && !n(e) ? s(e) : i.toArray(e).reduce((f, r) => {
  let t = "";
  return n(r) && o(r) ? typeof r.type == "string" ? t = `<${r.type}>${p(r.props.children)}</${r.type}>` : t = p(r.props.children) : n(r) && !o(r) ? t = "" : t = s(r), f.concat(`${t}`);
}, "");
export {
  s as childToString,
  p as childrenAsText
};
