import { __exports as b } from "../../../../../../../_virtual/index16.js";
import { __require as O } from "../../../../../@babel_highlight@7.16.10/node_modules/@babel/highlight/lib/index.js";
var x;
function P() {
  if (x)
    return b;
  x = 1, Object.defineProperty(b, "__esModule", {
    value: !0
  }), b.codeFrameColumns = j, b.default = E;
  var M = O();
  let C = !1;
  function y(r) {
    return {
      gutter: r.grey,
      marker: r.red.bold,
      message: r.red.bold
    };
  }
  const W = /\r\n|[\n\r\u2028\u2029]/;
  function q(r, o, e) {
    const c = Object.assign({
      column: 0,
      line: -1
    }, r.start), d = Object.assign({}, c, r.end), {
      linesAbove: s = 2,
      linesBelow: l = 3
    } = e || {}, u = c.line, i = c.column, g = d.line, f = d.column;
    let L = Math.max(u - (s + 1), 0), h = Math.min(o.length, g + l);
    u === -1 && (L = 0), g === -1 && (h = o.length);
    const p = g - u, t = {};
    if (p)
      for (let n = 0; n <= p; n++) {
        const a = n + u;
        if (!i)
          t[a] = !0;
        else if (n === 0) {
          const m = o[a - 1].length;
          t[a] = [i, m - i + 1];
        } else if (n === p)
          t[a] = [0, f];
        else {
          const m = o[a - n].length;
          t[a] = [0, m];
        }
      }
    else
      i === f ? i ? t[u] = [i, 0] : t[u] = !0 : t[u] = [i, f - i];
    return {
      start: L,
      end: h,
      markerLines: t
    };
  }
  function j(r, o, e = {}) {
    const c = (e.highlightCode || e.forceColor) && (0, M.shouldHighlight)(e), d = (0, M.getChalk)(e), s = y(d), l = (n, a) => c ? n(a) : a, u = r.split(W), {
      start: i,
      end: g,
      markerLines: f
    } = q(o, u, e), L = o.start && typeof o.start.column == "number", h = String(g).length;
    let t = (c ? (0, M.default)(r, e) : r).split(W, g).slice(i, g).map((n, a) => {
      const m = i + 1 + a, _ = ` ${` ${m}`.slice(-h)} |`, k = f[m], N = !f[m + 1];
      if (k) {
        let $ = "";
        if (Array.isArray(k)) {
          const v = n.slice(0, Math.max(k[0] - 1, 0)).replace(/[^\t]/g, " "), D = k[1] || 1;
          $ = [`
 `, l(s.gutter, _.replace(/\d/g, " ")), " ", v, l(s.marker, "^").repeat(D)].join(""), N && e.message && ($ += " " + l(s.message, e.message));
        }
        return [l(s.marker, ">"), l(s.gutter, _), n.length > 0 ? ` ${n}` : "", $].join("");
      } else
        return ` ${l(s.gutter, _)}${n.length > 0 ? ` ${n}` : ""}`;
    }).join(`
`);
    return e.message && !L && (t = `${" ".repeat(h + 1)}${e.message}
${t}`), c ? d.reset(t) : t;
  }
  function E(r, o, e, c = {}) {
    if (!C) {
      C = !0;
      const s = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
      if (process.emitWarning)
        process.emitWarning(s, "DeprecationWarning");
      else {
        const l = new Error(s);
        l.name = "DeprecationWarning", console.warn(new Error(s));
      }
    }
    return e = Math.max(e, 0), j(r, {
      start: {
        column: e,
        line: o
      }
    }, c);
  }
  return b;
}
export {
  P as __require
};
//# sourceMappingURL=index.js.map
