'use strict';

const MESSAGE_MARKER = "eHgtF5hmbrXyiEvo";
function describeParentCallSite(ErrorConstructor = Error) {
  const { stack } = new ErrorConstructor(MESSAGE_MARKER);
  if (!stack) {
    return "<unknown>";
  }
  const startIndex = stack.includes(MESSAGE_MARKER) ? stack.indexOf("\n") + 1 : 0;
  const secondEntryStart = stack.indexOf("\n", stack.indexOf("\n", startIndex) + 1) + 1;
  const secondEntryEnd = stack.indexOf("\n", secondEntryStart);
  const line = stack.substring(secondEntryStart, secondEntryEnd).trim();
  if (!line) {
    return "unknown";
  }
  if (line.includes("(")) {
    return line.substring(line.indexOf("(") + 1, line.indexOf(")"));
  }
  if (line.includes("@")) {
    return line.substring(line.indexOf("@") + 1);
  }
  return line;
}

exports.describeParentCallSite = describeParentCallSite;
//# sourceMappingURL=describeParentCallSite.cjs.js.map
