import "../../../../picocolors@1.0.0/node_modules/picocolors/picocolors.browser.js";
import g from "../../../../../../_virtual/___vite-browser-external.js";
import { p as S } from "../../../../../../_virtual/picocolors.browser.js";
let p = S.exports, m = g;
class o extends Error {
  constructor(e, t, s, n, h, a) {
    super(e), this.name = "CssSyntaxError", this.reason = e, h && (this.file = h), n && (this.source = n), a && (this.plugin = a), typeof t < "u" && typeof s < "u" && (typeof t == "number" ? (this.line = t, this.column = s) : (this.line = t.line, this.column = t.column, this.endLine = s.line, this.endColumn = s.column)), this.setMessage(), Error.captureStackTrace && Error.captureStackTrace(this, o);
  }
  setMessage() {
    this.message = this.plugin ? this.plugin + ": " : "", this.message += this.file ? this.file : "<css input>", typeof this.line < "u" && (this.message += ":" + this.line + ":" + this.column), this.message += ": " + this.reason;
  }
  showSourceCode(e) {
    if (!this.source)
      return "";
    let t = this.source;
    e == null && (e = p.isColorSupported), m && e && (t = m(t));
    let s = t.split(/\r?\n/), n = Math.max(this.line - 3, 0), h = Math.min(this.line + 2, s.length), a = String(h).length, u, l;
    if (e) {
      let { bold: i, red: f, gray: c } = p.createColors(!0);
      u = (r) => i(f(r)), l = (r) => c(r);
    } else
      u = l = (i) => i;
    return s.slice(n, h).map((i, f) => {
      let c = n + 1 + f, r = " " + (" " + c).slice(-a) + " | ";
      if (c === this.line) {
        let d = l(r.replace(/\d/g, " ")) + i.slice(0, this.column - 1).replace(/[^\t]/g, " ");
        return u(">") + l(r) + i + `
 ` + d + u("^");
      }
      return " " + l(r) + i;
    }).join(`
`);
  }
  toString() {
    let e = this.showSourceCode();
    return e && (e = `

` + e + `
`), this.name + ": " + this.message + e;
  }
}
var E = o;
o.default = o;
export {
  E as default
};
//# sourceMappingURL=css-syntax-error.js.map
