import { __exports as n } from "../../../../../../../_virtual/index40.js";
import "../../../../../js-tokens@4.0.0/node_modules/js-tokens/index.js";
import "../../../../../@babel_helper-validator-identifier@7.18.6/node_modules/@babel/helper-validator-identifier/lib/index.js";
import "../../../../../chalk@2.4.2/node_modules/chalk/index.js";
import { c as m } from "../../../../../../../_virtual/index26.js";
import { __exports as g } from "../../../../../../../_virtual/index24.js";
import { __exports as v } from "../../../../../../../_virtual/index25.js";
Object.defineProperty(n, "__esModule", {
  value: !0
});
n.default = b;
n.getChalk = p;
n.shouldHighlight = f;
var s = g, a = v, l = m.exports;
const y = /* @__PURE__ */ new Set(["as", "async", "from", "get", "of", "set"]);
function h(t) {
  return {
    keyword: t.cyan,
    capitalized: t.yellow,
    jsxIdentifier: t.yellow,
    punctuator: t.yellow,
    number: t.magenta,
    string: t.green,
    regex: t.magenta,
    comment: t.grey,
    invalid: t.white.bgRed.bold
  };
}
const w = /\r\n|[\n\r\u2028\u2029]/, _ = /^[()[\]{}]$/;
let c;
{
  const t = /^[a-z][\w-]*$/i, o = function(e, r, i) {
    if (e.type === "name") {
      if ((0, a.isKeyword)(e.value) || (0, a.isStrictReservedWord)(e.value, !0) || y.has(e.value))
        return "keyword";
      if (t.test(e.value) && (i[r - 1] === "<" || i.slice(r - 2, r) == "</"))
        return "jsxIdentifier";
      if (e.value[0] !== e.value[0].toLowerCase())
        return "capitalized";
    }
    return e.type === "punctuator" && _.test(e.value) ? "bracket" : e.type === "invalid" && (e.value === "@" || e.value === "#") ? "punctuator" : e.type;
  };
  c = function* (e) {
    let r;
    for (; r = s.default.exec(e); ) {
      const i = s.matchToToken(r);
      yield {
        type: o(i, r.index, e),
        value: i.value
      };
    }
  };
}
function T(t, o) {
  let e = "";
  for (const {
    type: r,
    value: i
  } of c(o)) {
    const u = t[r];
    u ? e += i.split(w).map((d) => u(d)).join(`
`) : e += i;
  }
  return e;
}
function f(t) {
  return !!l.supportsColor || t.forceColor;
}
function p(t) {
  return t.forceColor ? new l.constructor({
    enabled: !0,
    level: 1
  }) : l;
}
function b(t, o = {}) {
  if (t !== "" && f(o)) {
    const e = p(o), r = h(e);
    return T(r, t);
  } else
    return t;
}
//# sourceMappingURL=index.js.map
