import { a5 as _e, a6 as be, ao as ee, an as Se, a7 as ke, a8 as Fe, _ as l, g as zt, l as qt, a9 as vt, aa as Pe, at as ve, aB as D, ad as Ce, bb as Le } from "./index-DeBlJN4f.js";
import { f as te } from "./linear-Bkwca0xU-DC0DlB3Q.js";
var Et = function() {
  var t = /* @__PURE__ */ l(function(Q, n, d, c) {
    for (d = d || {}, c = Q.length; c--; d[Q[c]] = n) ;
    return d;
  }, "o"), a = [1, 3], g = [1, 4], u = [1, 5], o = [1, 6], x = [1, 7], _ = [1, 4, 5, 10, 12, 13, 14, 18, 25, 35, 37, 39, 41, 42, 48, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 63, 64, 65, 66, 67], h = [1, 4, 5, 10, 12, 13, 14, 18, 25, 28, 35, 37, 39, 41, 42, 48, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 63, 64, 65, 66, 67], s = [55, 56, 57], b = [2, 36], p = [1, 37], m = [1, 36], T = [1, 38], y = [1, 35], f = [1, 43], q = [1, 41], H = [1, 14], C = [1, 23], ct = [1, 18], dt = [1, 19], ut = [1, 20], xt = [1, 21], gt = [1, 22], ot = [1, 24], ht = [1, 25], i = [1, 26], It = [1, 27], Wt = [1, 28], Rt = [1, 29], N = [1, 32], O = [1, 33], S = [1, 34], k = [1, 39], F = [1, 40], P = [1, 42], v = [1, 44], Y = [1, 62], M = [1, 61], L = [4, 5, 8, 10, 12, 13, 14, 18, 44, 47, 49, 55, 56, 57, 63, 64, 65, 66, 67], Bt = [1, 65], wt = [1, 66], $t = [1, 67], Ut = [1, 68], Nt = [1, 69], Ot = [1, 70], Qt = [1, 71], Xt = [1, 72], Ht = [1, 73], Yt = [1, 74], Mt = [1, 75], jt = [1, 76], W = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18], K = [1, 90], J = [1, 91], Z = [1, 92], tt = [1, 99], et = [1, 93], it = [1, 96], at = [1, 94], nt = [1, 95], st = [1, 97], rt = [1, 98], _t = [1, 102], Gt = [10, 55, 56, 57], $ = [4, 5, 6, 8, 10, 11, 13, 17, 18, 19, 20, 55, 56, 57], bt = {
    trace: /* @__PURE__ */ l(function() {
    }, "trace"),
    yy: {},
    symbols_: { error: 2, idStringToken: 3, ALPHA: 4, NUM: 5, NODE_STRING: 6, DOWN: 7, MINUS: 8, DEFAULT: 9, COMMA: 10, COLON: 11, AMP: 12, BRKT: 13, MULT: 14, UNICODE_TEXT: 15, styleComponent: 16, UNIT: 17, SPACE: 18, STYLE: 19, PCT: 20, idString: 21, style: 22, stylesOpt: 23, classDefStatement: 24, CLASSDEF: 25, start: 26, eol: 27, QUADRANT: 28, document: 29, line: 30, statement: 31, axisDetails: 32, quadrantDetails: 33, points: 34, title: 35, title_value: 36, acc_title: 37, acc_title_value: 38, acc_descr: 39, acc_descr_value: 40, acc_descr_multiline_value: 41, section: 42, text: 43, point_start: 44, point_x: 45, point_y: 46, class_name: 47, "X-AXIS": 48, "AXIS-TEXT-DELIMITER": 49, "Y-AXIS": 50, QUADRANT_1: 51, QUADRANT_2: 52, QUADRANT_3: 53, QUADRANT_4: 54, NEWLINE: 55, SEMI: 56, EOF: 57, alphaNumToken: 58, textNoTagsToken: 59, STR: 60, MD_STR: 61, alphaNum: 62, PUNCTUATION: 63, PLUS: 64, EQUALS: 65, DOT: 66, UNDERSCORE: 67, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 4: "ALPHA", 5: "NUM", 6: "NODE_STRING", 7: "DOWN", 8: "MINUS", 9: "DEFAULT", 10: "COMMA", 11: "COLON", 12: "AMP", 13: "BRKT", 14: "MULT", 15: "UNICODE_TEXT", 17: "UNIT", 18: "SPACE", 19: "STYLE", 20: "PCT", 25: "CLASSDEF", 28: "QUADRANT", 35: "title", 36: "title_value", 37: "acc_title", 38: "acc_title_value", 39: "acc_descr", 40: "acc_descr_value", 41: "acc_descr_multiline_value", 42: "section", 44: "point_start", 45: "point_x", 46: "point_y", 47: "class_name", 48: "X-AXIS", 49: "AXIS-TEXT-DELIMITER", 50: "Y-AXIS", 51: "QUADRANT_1", 52: "QUADRANT_2", 53: "QUADRANT_3", 54: "QUADRANT_4", 55: "NEWLINE", 56: "SEMI", 57: "EOF", 60: "STR", 61: "MD_STR", 63: "PUNCTUATION", 64: "PLUS", 65: "EQUALS", 66: "DOT", 67: "UNDERSCORE" },
    productions_: [0, [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [21, 1], [21, 2], [22, 1], [22, 2], [23, 1], [23, 3], [24, 5], [26, 2], [26, 2], [26, 2], [29, 0], [29, 2], [30, 2], [31, 0], [31, 1], [31, 2], [31, 1], [31, 1], [31, 1], [31, 2], [31, 2], [31, 2], [31, 1], [31, 1], [34, 4], [34, 5], [34, 5], [34, 6], [32, 4], [32, 3], [32, 2], [32, 4], [32, 3], [32, 2], [33, 2], [33, 2], [33, 2], [33, 2], [27, 1], [27, 1], [27, 1], [43, 1], [43, 2], [43, 1], [43, 1], [62, 1], [62, 2], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [59, 1], [59, 1], [59, 1]],
    performAction: /* @__PURE__ */ l(function(Q, n, d, c, A, e, R) {
      var r = e.length - 1;
      switch (A) {
        case 23:
          this.$ = e[r];
          break;
        case 24:
          this.$ = e[r - 1] + "" + e[r];
          break;
        case 26:
          this.$ = e[r - 1] + e[r];
          break;
        case 27:
          this.$ = [e[r].trim()];
          break;
        case 28:
          e[r - 2].push(e[r].trim()), this.$ = e[r - 2];
          break;
        case 29:
          this.$ = e[r - 4], c.addClass(e[r - 2], e[r]);
          break;
        case 37:
          this.$ = [];
          break;
        case 42:
          this.$ = e[r].trim(), c.setDiagramTitle(this.$);
          break;
        case 43:
          this.$ = e[r].trim(), c.setAccTitle(this.$);
          break;
        case 44:
        case 45:
          this.$ = e[r].trim(), c.setAccDescription(this.$);
          break;
        case 46:
          c.addSection(e[r].substr(8)), this.$ = e[r].substr(8);
          break;
        case 47:
          c.addPoint(e[r - 3], "", e[r - 1], e[r], []);
          break;
        case 48:
          c.addPoint(e[r - 4], e[r - 3], e[r - 1], e[r], []);
          break;
        case 49:
          c.addPoint(e[r - 4], "", e[r - 2], e[r - 1], e[r]);
          break;
        case 50:
          c.addPoint(e[r - 5], e[r - 4], e[r - 2], e[r - 1], e[r]);
          break;
        case 51:
          c.setXAxisLeftText(e[r - 2]), c.setXAxisRightText(e[r]);
          break;
        case 52:
          e[r - 1].text += " ⟶ ", c.setXAxisLeftText(e[r - 1]);
          break;
        case 53:
          c.setXAxisLeftText(e[r]);
          break;
        case 54:
          c.setYAxisBottomText(e[r - 2]), c.setYAxisTopText(e[r]);
          break;
        case 55:
          e[r - 1].text += " ⟶ ", c.setYAxisBottomText(e[r - 1]);
          break;
        case 56:
          c.setYAxisBottomText(e[r]);
          break;
        case 57:
          c.setQuadrant1Text(e[r]);
          break;
        case 58:
          c.setQuadrant2Text(e[r]);
          break;
        case 59:
          c.setQuadrant3Text(e[r]);
          break;
        case 60:
          c.setQuadrant4Text(e[r]);
          break;
        case 64:
          this.$ = { text: e[r], type: "text" };
          break;
        case 65:
          this.$ = { text: e[r - 1].text + "" + e[r], type: e[r - 1].type };
          break;
        case 66:
          this.$ = { text: e[r], type: "text" };
          break;
        case 67:
          this.$ = { text: e[r], type: "markdown" };
          break;
        case 68:
          this.$ = e[r];
          break;
        case 69:
          this.$ = e[r - 1] + "" + e[r];
          break;
      }
    }, "anonymous"),
    table: [{ 18: a, 26: 1, 27: 2, 28: g, 55: u, 56: o, 57: x }, { 1: [3] }, { 18: a, 26: 8, 27: 2, 28: g, 55: u, 56: o, 57: x }, { 18: a, 26: 9, 27: 2, 28: g, 55: u, 56: o, 57: x }, t(_, [2, 33], { 29: 10 }), t(h, [2, 61]), t(h, [2, 62]), t(h, [2, 63]), { 1: [2, 30] }, { 1: [2, 31] }, t(s, b, { 30: 11, 31: 12, 24: 13, 32: 15, 33: 16, 34: 17, 43: 30, 58: 31, 1: [2, 32], 4: p, 5: m, 10: T, 12: y, 13: f, 14: q, 18: H, 25: C, 35: ct, 37: dt, 39: ut, 41: xt, 42: gt, 48: ot, 50: ht, 51: i, 52: It, 53: Wt, 54: Rt, 60: N, 61: O, 63: S, 64: k, 65: F, 66: P, 67: v }), t(_, [2, 34]), { 27: 45, 55: u, 56: o, 57: x }, t(s, [2, 37]), t(s, b, { 24: 13, 32: 15, 33: 16, 34: 17, 43: 30, 58: 31, 31: 46, 4: p, 5: m, 10: T, 12: y, 13: f, 14: q, 18: H, 25: C, 35: ct, 37: dt, 39: ut, 41: xt, 42: gt, 48: ot, 50: ht, 51: i, 52: It, 53: Wt, 54: Rt, 60: N, 61: O, 63: S, 64: k, 65: F, 66: P, 67: v }), t(s, [2, 39]), t(s, [2, 40]), t(s, [2, 41]), { 36: [1, 47] }, { 38: [1, 48] }, { 40: [1, 49] }, t(s, [2, 45]), t(s, [2, 46]), { 18: [1, 50] }, { 4: p, 5: m, 10: T, 12: y, 13: f, 14: q, 43: 51, 58: 31, 60: N, 61: O, 63: S, 64: k, 65: F, 66: P, 67: v }, { 4: p, 5: m, 10: T, 12: y, 13: f, 14: q, 43: 52, 58: 31, 60: N, 61: O, 63: S, 64: k, 65: F, 66: P, 67: v }, { 4: p, 5: m, 10: T, 12: y, 13: f, 14: q, 43: 53, 58: 31, 60: N, 61: O, 63: S, 64: k, 65: F, 66: P, 67: v }, { 4: p, 5: m, 10: T, 12: y, 13: f, 14: q, 43: 54, 58: 31, 60: N, 61: O, 63: S, 64: k, 65: F, 66: P, 67: v }, { 4: p, 5: m, 10: T, 12: y, 13: f, 14: q, 43: 55, 58: 31, 60: N, 61: O, 63: S, 64: k, 65: F, 66: P, 67: v }, { 4: p, 5: m, 10: T, 12: y, 13: f, 14: q, 43: 56, 58: 31, 60: N, 61: O, 63: S, 64: k, 65: F, 66: P, 67: v }, { 4: p, 5: m, 8: Y, 10: T, 12: y, 13: f, 14: q, 18: M, 44: [1, 57], 47: [1, 58], 58: 60, 59: 59, 63: S, 64: k, 65: F, 66: P, 67: v }, t(L, [2, 64]), t(L, [2, 66]), t(L, [2, 67]), t(L, [2, 70]), t(L, [2, 71]), t(L, [2, 72]), t(L, [2, 73]), t(L, [2, 74]), t(L, [2, 75]), t(L, [2, 76]), t(L, [2, 77]), t(L, [2, 78]), t(L, [2, 79]), t(L, [2, 80]), t(_, [2, 35]), t(s, [2, 38]), t(s, [2, 42]), t(s, [2, 43]), t(s, [2, 44]), { 3: 64, 4: Bt, 5: wt, 6: $t, 7: Ut, 8: Nt, 9: Ot, 10: Qt, 11: Xt, 12: Ht, 13: Yt, 14: Mt, 15: jt, 21: 63 }, t(s, [2, 53], { 59: 59, 58: 60, 4: p, 5: m, 8: Y, 10: T, 12: y, 13: f, 14: q, 18: M, 49: [1, 77], 63: S, 64: k, 65: F, 66: P, 67: v }), t(s, [2, 56], { 59: 59, 58: 60, 4: p, 5: m, 8: Y, 10: T, 12: y, 13: f, 14: q, 18: M, 49: [1, 78], 63: S, 64: k, 65: F, 66: P, 67: v }), t(s, [2, 57], { 59: 59, 58: 60, 4: p, 5: m, 8: Y, 10: T, 12: y, 13: f, 14: q, 18: M, 63: S, 64: k, 65: F, 66: P, 67: v }), t(s, [2, 58], { 59: 59, 58: 60, 4: p, 5: m, 8: Y, 10: T, 12: y, 13: f, 14: q, 18: M, 63: S, 64: k, 65: F, 66: P, 67: v }), t(s, [2, 59], { 59: 59, 58: 60, 4: p, 5: m, 8: Y, 10: T, 12: y, 13: f, 14: q, 18: M, 63: S, 64: k, 65: F, 66: P, 67: v }), t(s, [2, 60], { 59: 59, 58: 60, 4: p, 5: m, 8: Y, 10: T, 12: y, 13: f, 14: q, 18: M, 63: S, 64: k, 65: F, 66: P, 67: v }), { 45: [1, 79] }, { 44: [1, 80] }, t(L, [2, 65]), t(L, [2, 81]), t(L, [2, 82]), t(L, [2, 83]), { 3: 82, 4: Bt, 5: wt, 6: $t, 7: Ut, 8: Nt, 9: Ot, 10: Qt, 11: Xt, 12: Ht, 13: Yt, 14: Mt, 15: jt, 18: [1, 81] }, t(W, [2, 23]), t(W, [2, 1]), t(W, [2, 2]), t(W, [2, 3]), t(W, [2, 4]), t(W, [2, 5]), t(W, [2, 6]), t(W, [2, 7]), t(W, [2, 8]), t(W, [2, 9]), t(W, [2, 10]), t(W, [2, 11]), t(W, [2, 12]), t(s, [2, 52], { 58: 31, 43: 83, 4: p, 5: m, 10: T, 12: y, 13: f, 14: q, 60: N, 61: O, 63: S, 64: k, 65: F, 66: P, 67: v }), t(s, [2, 55], { 58: 31, 43: 84, 4: p, 5: m, 10: T, 12: y, 13: f, 14: q, 60: N, 61: O, 63: S, 64: k, 65: F, 66: P, 67: v }), { 46: [1, 85] }, { 45: [1, 86] }, { 4: K, 5: J, 6: Z, 8: tt, 11: et, 13: it, 16: 89, 17: at, 18: nt, 19: st, 20: rt, 22: 88, 23: 87 }, t(W, [2, 24]), t(s, [2, 51], { 59: 59, 58: 60, 4: p, 5: m, 8: Y, 10: T, 12: y, 13: f, 14: q, 18: M, 63: S, 64: k, 65: F, 66: P, 67: v }), t(s, [2, 54], { 59: 59, 58: 60, 4: p, 5: m, 8: Y, 10: T, 12: y, 13: f, 14: q, 18: M, 63: S, 64: k, 65: F, 66: P, 67: v }), t(s, [2, 47], { 22: 88, 16: 89, 23: 100, 4: K, 5: J, 6: Z, 8: tt, 11: et, 13: it, 17: at, 18: nt, 19: st, 20: rt }), { 46: [1, 101] }, t(s, [2, 29], { 10: _t }), t(Gt, [2, 27], { 16: 103, 4: K, 5: J, 6: Z, 8: tt, 11: et, 13: it, 17: at, 18: nt, 19: st, 20: rt }), t($, [2, 25]), t($, [2, 13]), t($, [2, 14]), t($, [2, 15]), t($, [2, 16]), t($, [2, 17]), t($, [2, 18]), t($, [2, 19]), t($, [2, 20]), t($, [2, 21]), t($, [2, 22]), t(s, [2, 49], { 10: _t }), t(s, [2, 48], { 22: 88, 16: 89, 23: 104, 4: K, 5: J, 6: Z, 8: tt, 11: et, 13: it, 17: at, 18: nt, 19: st, 20: rt }), { 4: K, 5: J, 6: Z, 8: tt, 11: et, 13: it, 16: 89, 17: at, 18: nt, 19: st, 20: rt, 22: 105 }, t($, [2, 26]), t(s, [2, 50], { 10: _t }), t(Gt, [2, 28], { 16: 103, 4: K, 5: J, 6: Z, 8: tt, 11: et, 13: it, 17: at, 18: nt, 19: st, 20: rt })],
    defaultActions: { 8: [2, 30], 9: [2, 31] },
    parseError: /* @__PURE__ */ l(function(Q, n) {
      if (n.recoverable)
        this.trace(Q);
      else {
        var d = new Error(Q);
        throw d.hash = n, d;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ l(function(Q) {
      var n = this, d = [0], c = [], A = [null], e = [], R = this.table, r = "", pt = 0, Vt = 0, Te = 2, Kt = 1, me = e.slice.call(arguments, 1), E = Object.create(this.lexer), G = { yy: {} };
      for (var St in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, St) && (G.yy[St] = this.yy[St]);
      E.setInput(Q, G.yy), G.yy.lexer = E, G.yy.parser = this, typeof E.yylloc > "u" && (E.yylloc = {});
      var kt = E.yylloc;
      e.push(kt);
      var qe = E.options && E.options.ranges;
      typeof G.yy.parseError == "function" ? this.parseError = G.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function Ae(w) {
        d.length = d.length - 2 * w, A.length = A.length - w, e.length = e.length - w;
      }
      l(Ae, "popStack");
      function Jt() {
        var w;
        return w = c.pop() || E.lex() || Kt, typeof w != "number" && (w instanceof Array && (c = w, w = c.pop()), w = n.symbols_[w] || w), w;
      }
      l(Jt, "lex");
      for (var B, V, U, Ft, lt = {}, yt, j, Zt, Tt; ; ) {
        if (V = d[d.length - 1], this.defaultActions[V] ? U = this.defaultActions[V] : ((B === null || typeof B > "u") && (B = Jt()), U = R[V] && R[V][B]), typeof U > "u" || !U.length || !U[0]) {
          var Pt = "";
          Tt = [];
          for (yt in R[V])
            this.terminals_[yt] && yt > Te && Tt.push("'" + this.terminals_[yt] + "'");
          E.showPosition ? Pt = "Parse error on line " + (pt + 1) + `:
` + E.showPosition() + `
Expecting ` + Tt.join(", ") + ", got '" + (this.terminals_[B] || B) + "'" : Pt = "Parse error on line " + (pt + 1) + ": Unexpected " + (B == Kt ? "end of input" : "'" + (this.terminals_[B] || B) + "'"), this.parseError(Pt, {
            text: E.match,
            token: this.terminals_[B] || B,
            line: E.yylineno,
            loc: kt,
            expected: Tt
          });
        }
        if (U[0] instanceof Array && U.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + V + ", token: " + B);
        switch (U[0]) {
          case 1:
            d.push(B), A.push(E.yytext), e.push(E.yylloc), d.push(U[1]), B = null, Vt = E.yyleng, r = E.yytext, pt = E.yylineno, kt = E.yylloc;
            break;
          case 2:
            if (j = this.productions_[U[1]][1], lt.$ = A[A.length - j], lt._$ = {
              first_line: e[e.length - (j || 1)].first_line,
              last_line: e[e.length - 1].last_line,
              first_column: e[e.length - (j || 1)].first_column,
              last_column: e[e.length - 1].last_column
            }, qe && (lt._$.range = [
              e[e.length - (j || 1)].range[0],
              e[e.length - 1].range[1]
            ]), Ft = this.performAction.apply(lt, [
              r,
              Vt,
              pt,
              G.yy,
              U[1],
              A,
              e
            ].concat(me)), typeof Ft < "u")
              return Ft;
            j && (d = d.slice(0, -1 * j * 2), A = A.slice(0, -1 * j), e = e.slice(0, -1 * j)), d.push(this.productions_[U[1]][0]), A.push(lt.$), e.push(lt._$), Zt = R[d[d.length - 2]][d[d.length - 1]], d.push(Zt);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, ye = /* @__PURE__ */ function() {
    var Q = {
      EOF: 1,
      parseError: /* @__PURE__ */ l(function(n, d) {
        if (this.yy.parser)
          this.yy.parser.parseError(n, d);
        else
          throw new Error(n);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ l(function(n, d) {
        return this.yy = d || this.yy || {}, this._input = n, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
          first_line: 1,
          first_column: 0,
          last_line: 1,
          last_column: 0
        }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ l(function() {
        var n = this._input[0];
        this.yytext += n, this.yyleng++, this.offset++, this.match += n, this.matched += n;
        var d = n.match(/(?:\r\n?|\n).*/g);
        return d ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), n;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ l(function(n) {
        var d = n.length, c = n.split(/(?:\r\n?|\n)/g);
        this._input = n + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - d), this.offset -= d;
        var A = this.match.split(/(?:\r\n?|\n)/g);
        this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), c.length - 1 && (this.yylineno -= c.length - 1);
        var e = this.yylloc.range;
        return this.yylloc = {
          first_line: this.yylloc.first_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.first_column,
          last_column: c ? (c.length === A.length ? this.yylloc.first_column : 0) + A[A.length - c.length].length - c[0].length : this.yylloc.first_column - d
        }, this.options.ranges && (this.yylloc.range = [e[0], e[0] + this.yyleng - d]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ l(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ l(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ l(function(n) {
        this.unput(this.match.slice(n));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ l(function() {
        var n = this.matched.substr(0, this.matched.length - this.match.length);
        return (n.length > 20 ? "..." : "") + n.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ l(function() {
        var n = this.match;
        return n.length < 20 && (n += this._input.substr(0, 20 - n.length)), (n.substr(0, 20) + (n.length > 20 ? "..." : "")).replace(/\n/g, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ l(function() {
        var n = this.pastInput(), d = new Array(n.length + 1).join("-");
        return n + this.upcomingInput() + `
` + d + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ l(function(n, d) {
        var c, A, e;
        if (this.options.backtrack_lexer && (e = {
          yylineno: this.yylineno,
          yylloc: {
            first_line: this.yylloc.first_line,
            last_line: this.last_line,
            first_column: this.yylloc.first_column,
            last_column: this.yylloc.last_column
          },
          yytext: this.yytext,
          match: this.match,
          matches: this.matches,
          matched: this.matched,
          yyleng: this.yyleng,
          offset: this.offset,
          _more: this._more,
          _input: this._input,
          yy: this.yy,
          conditionStack: this.conditionStack.slice(0),
          done: this.done
        }, this.options.ranges && (e.yylloc.range = this.yylloc.range.slice(0))), A = n[0].match(/(?:\r\n?|\n).*/g), A && (this.yylineno += A.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: A ? A[A.length - 1].length - A[A.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + n[0].length
        }, this.yytext += n[0], this.match += n[0], this.matches = n, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(n[0].length), this.matched += n[0], c = this.performAction.call(this, this.yy, this, d, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), c)
          return c;
        if (this._backtrack) {
          for (var R in e)
            this[R] = e[R];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ l(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var n, d, c, A;
        this._more || (this.yytext = "", this.match = "");
        for (var e = this._currentRules(), R = 0; R < e.length; R++)
          if (c = this._input.match(this.rules[e[R]]), c && (!d || c[0].length > d[0].length)) {
            if (d = c, A = R, this.options.backtrack_lexer) {
              if (n = this.test_match(c, e[R]), n !== !1)
                return n;
              if (this._backtrack) {
                d = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return d ? (n = this.test_match(d, e[A]), n !== !1 ? n : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ l(function() {
        var n = this.next();
        return n || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ l(function(n) {
        this.conditionStack.push(n);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ l(function() {
        var n = this.conditionStack.length - 1;
        return n > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ l(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ l(function(n) {
        return n = this.conditionStack.length - 1 - Math.abs(n || 0), n >= 0 ? this.conditionStack[n] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ l(function(n) {
        this.begin(n);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ l(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ l(function(n, d, c, A) {
        switch (c) {
          case 0:
            break;
          case 1:
            break;
          case 2:
            return 55;
          case 3:
            break;
          case 4:
            return this.begin("title"), 35;
          case 5:
            return this.popState(), "title_value";
          case 6:
            return this.begin("acc_title"), 37;
          case 7:
            return this.popState(), "acc_title_value";
          case 8:
            return this.begin("acc_descr"), 39;
          case 9:
            return this.popState(), "acc_descr_value";
          case 10:
            this.begin("acc_descr_multiline");
            break;
          case 11:
            this.popState();
            break;
          case 12:
            return "acc_descr_multiline_value";
          case 13:
            return 48;
          case 14:
            return 50;
          case 15:
            return 49;
          case 16:
            return 51;
          case 17:
            return 52;
          case 18:
            return 53;
          case 19:
            return 54;
          case 20:
            return 25;
          case 21:
            this.begin("md_string");
            break;
          case 22:
            return "MD_STR";
          case 23:
            this.popState();
            break;
          case 24:
            this.begin("string");
            break;
          case 25:
            this.popState();
            break;
          case 26:
            return "STR";
          case 27:
            this.begin("class_name");
            break;
          case 28:
            return this.popState(), 47;
          case 29:
            return this.begin("point_start"), 44;
          case 30:
            return this.begin("point_x"), 45;
          case 31:
            this.popState();
            break;
          case 32:
            this.popState(), this.begin("point_y");
            break;
          case 33:
            return this.popState(), 46;
          case 34:
            return 28;
          case 35:
            return 4;
          case 36:
            return 11;
          case 37:
            return 64;
          case 38:
            return 10;
          case 39:
            return 65;
          case 40:
            return 65;
          case 41:
            return 14;
          case 42:
            return 13;
          case 43:
            return 67;
          case 44:
            return 66;
          case 45:
            return 12;
          case 46:
            return 8;
          case 47:
            return 5;
          case 48:
            return 18;
          case 49:
            return 56;
          case 50:
            return 63;
          case 51:
            return 57;
        }
      }, "anonymous"),
      rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:title\b)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?: *x-axis *)/i, /^(?: *y-axis *)/i, /^(?: *--+> *)/i, /^(?: *quadrant-1 *)/i, /^(?: *quadrant-2 *)/i, /^(?: *quadrant-3 *)/i, /^(?: *quadrant-4 *)/i, /^(?:classDef\b)/i, /^(?:["][`])/i, /^(?:[^`"]+)/i, /^(?:[`]["])/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?::::)/i, /^(?:^\w+)/i, /^(?:\s*:\s*\[\s*)/i, /^(?:(1)|(0(.\d+)?))/i, /^(?:\s*\] *)/i, /^(?:\s*,\s*)/i, /^(?:(1)|(0(.\d+)?))/i, /^(?: *quadrantChart *)/i, /^(?:[A-Za-z]+)/i, /^(?::)/i, /^(?:\+)/i, /^(?:,)/i, /^(?:=)/i, /^(?:=)/i, /^(?:\*)/i, /^(?:#)/i, /^(?:[\_])/i, /^(?:\.)/i, /^(?:&)/i, /^(?:-)/i, /^(?:[0-9]+)/i, /^(?:\s)/i, /^(?:;)/i, /^(?:[!"#$%&'*+,-.`?\\_/])/i, /^(?:$)/i],
      conditions: { class_name: { rules: [28], inclusive: !1 }, point_y: { rules: [33], inclusive: !1 }, point_x: { rules: [32], inclusive: !1 }, point_start: { rules: [30, 31], inclusive: !1 }, acc_descr_multiline: { rules: [11, 12], inclusive: !1 }, acc_descr: { rules: [9], inclusive: !1 }, acc_title: { rules: [7], inclusive: !1 }, title: { rules: [5], inclusive: !1 }, md_string: { rules: [22, 23], inclusive: !1 }, string: { rules: [25, 26], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 27, 29, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51], inclusive: !0 } }
    };
    return Q;
  }();
  bt.lexer = ye;
  function ft() {
    this.yy = {};
  }
  return l(ft, "Parser"), ft.prototype = bt, bt.Parser = ft, new ft();
}();
Et.parser = Et;
var Ee = Et, I = Le(), Ct, De = (Ct = class {
  constructor() {
    this.classes = /* @__PURE__ */ new Map(), this.config = this.getDefaultConfig(), this.themeConfig = this.getDefaultThemeConfig(), this.data = this.getDefaultData();
  }
  getDefaultData() {
    return {
      titleText: "",
      quadrant1Text: "",
      quadrant2Text: "",
      quadrant3Text: "",
      quadrant4Text: "",
      xAxisLeftText: "",
      xAxisRightText: "",
      yAxisBottomText: "",
      yAxisTopText: "",
      points: []
    };
  }
  getDefaultConfig() {
    var t, a, g, u, o, x, _, h, s, b, p, m, T, y, f, q, H, C;
    return {
      showXAxis: !0,
      showYAxis: !0,
      showTitle: !0,
      chartHeight: ((t = D.quadrantChart) == null ? void 0 : t.chartWidth) || 500,
      chartWidth: ((a = D.quadrantChart) == null ? void 0 : a.chartHeight) || 500,
      titlePadding: ((g = D.quadrantChart) == null ? void 0 : g.titlePadding) || 10,
      titleFontSize: ((u = D.quadrantChart) == null ? void 0 : u.titleFontSize) || 20,
      quadrantPadding: ((o = D.quadrantChart) == null ? void 0 : o.quadrantPadding) || 5,
      xAxisLabelPadding: ((x = D.quadrantChart) == null ? void 0 : x.xAxisLabelPadding) || 5,
      yAxisLabelPadding: ((_ = D.quadrantChart) == null ? void 0 : _.yAxisLabelPadding) || 5,
      xAxisLabelFontSize: ((h = D.quadrantChart) == null ? void 0 : h.xAxisLabelFontSize) || 16,
      yAxisLabelFontSize: ((s = D.quadrantChart) == null ? void 0 : s.yAxisLabelFontSize) || 16,
      quadrantLabelFontSize: ((b = D.quadrantChart) == null ? void 0 : b.quadrantLabelFontSize) || 16,
      quadrantTextTopPadding: ((p = D.quadrantChart) == null ? void 0 : p.quadrantTextTopPadding) || 5,
      pointTextPadding: ((m = D.quadrantChart) == null ? void 0 : m.pointTextPadding) || 5,
      pointLabelFontSize: ((T = D.quadrantChart) == null ? void 0 : T.pointLabelFontSize) || 12,
      pointRadius: ((y = D.quadrantChart) == null ? void 0 : y.pointRadius) || 5,
      xAxisPosition: ((f = D.quadrantChart) == null ? void 0 : f.xAxisPosition) || "top",
      yAxisPosition: ((q = D.quadrantChart) == null ? void 0 : q.yAxisPosition) || "left",
      quadrantInternalBorderStrokeWidth: ((H = D.quadrantChart) == null ? void 0 : H.quadrantInternalBorderStrokeWidth) || 1,
      quadrantExternalBorderStrokeWidth: ((C = D.quadrantChart) == null ? void 0 : C.quadrantExternalBorderStrokeWidth) || 2
    };
  }
  getDefaultThemeConfig() {
    return {
      quadrant1Fill: I.quadrant1Fill,
      quadrant2Fill: I.quadrant2Fill,
      quadrant3Fill: I.quadrant3Fill,
      quadrant4Fill: I.quadrant4Fill,
      quadrant1TextFill: I.quadrant1TextFill,
      quadrant2TextFill: I.quadrant2TextFill,
      quadrant3TextFill: I.quadrant3TextFill,
      quadrant4TextFill: I.quadrant4TextFill,
      quadrantPointFill: I.quadrantPointFill,
      quadrantPointTextFill: I.quadrantPointTextFill,
      quadrantXAxisTextFill: I.quadrantXAxisTextFill,
      quadrantYAxisTextFill: I.quadrantYAxisTextFill,
      quadrantTitleFill: I.quadrantTitleFill,
      quadrantInternalBorderStrokeFill: I.quadrantInternalBorderStrokeFill,
      quadrantExternalBorderStrokeFill: I.quadrantExternalBorderStrokeFill
    };
  }
  clear() {
    this.config = this.getDefaultConfig(), this.themeConfig = this.getDefaultThemeConfig(), this.data = this.getDefaultData(), this.classes = /* @__PURE__ */ new Map(), qt.info("clear called");
  }
  setData(t) {
    this.data = { ...this.data, ...t };
  }
  addPoints(t) {
    this.data.points = [...t, ...this.data.points];
  }
  addClass(t, a) {
    this.classes.set(t, a);
  }
  setConfig(t) {
    qt.trace("setConfig called with: ", t), this.config = { ...this.config, ...t };
  }
  setThemeConfig(t) {
    qt.trace("setThemeConfig called with: ", t), this.themeConfig = { ...this.themeConfig, ...t };
  }
  calculateSpace(t, a, g, u) {
    const o = this.config.xAxisLabelPadding * 2 + this.config.xAxisLabelFontSize, x = {
      top: t === "top" && a ? o : 0,
      bottom: t === "bottom" && a ? o : 0
    }, _ = this.config.yAxisLabelPadding * 2 + this.config.yAxisLabelFontSize, h = {
      left: this.config.yAxisPosition === "left" && g ? _ : 0,
      right: this.config.yAxisPosition === "right" && g ? _ : 0
    }, s = this.config.titleFontSize + this.config.titlePadding * 2, b = {
      top: u ? s : 0
    }, p = this.config.quadrantPadding + h.left, m = this.config.quadrantPadding + x.top + b.top, T = this.config.chartWidth - this.config.quadrantPadding * 2 - h.left - h.right, y = this.config.chartHeight - this.config.quadrantPadding * 2 - x.top - x.bottom - b.top, f = T / 2, q = y / 2;
    return {
      xAxisSpace: x,
      yAxisSpace: h,
      titleSpace: b,
      quadrantSpace: {
        quadrantLeft: p,
        quadrantTop: m,
        quadrantWidth: T,
        quadrantHalfWidth: f,
        quadrantHeight: y,
        quadrantHalfHeight: q
      }
    };
  }
  getAxisLabels(t, a, g, u) {
    const { quadrantSpace: o, titleSpace: x } = u, {
      quadrantHalfHeight: _,
      quadrantHeight: h,
      quadrantLeft: s,
      quadrantHalfWidth: b,
      quadrantTop: p,
      quadrantWidth: m
    } = o, T = !!this.data.xAxisRightText, y = !!this.data.yAxisTopText, f = [];
    return this.data.xAxisLeftText && a && f.push({
      text: this.data.xAxisLeftText,
      fill: this.themeConfig.quadrantXAxisTextFill,
      x: s + (T ? b / 2 : 0),
      y: t === "top" ? this.config.xAxisLabelPadding + x.top : this.config.xAxisLabelPadding + p + h + this.config.quadrantPadding,
      fontSize: this.config.xAxisLabelFontSize,
      verticalPos: T ? "center" : "left",
      horizontalPos: "top",
      rotation: 0
    }), this.data.xAxisRightText && a && f.push({
      text: this.data.xAxisRightText,
      fill: this.themeConfig.quadrantXAxisTextFill,
      x: s + b + (T ? b / 2 : 0),
      y: t === "top" ? this.config.xAxisLabelPadding + x.top : this.config.xAxisLabelPadding + p + h + this.config.quadrantPadding,
      fontSize: this.config.xAxisLabelFontSize,
      verticalPos: T ? "center" : "left",
      horizontalPos: "top",
      rotation: 0
    }), this.data.yAxisBottomText && g && f.push({
      text: this.data.yAxisBottomText,
      fill: this.themeConfig.quadrantYAxisTextFill,
      x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + s + m + this.config.quadrantPadding,
      y: p + h - (y ? _ / 2 : 0),
      fontSize: this.config.yAxisLabelFontSize,
      verticalPos: y ? "center" : "left",
      horizontalPos: "top",
      rotation: -90
    }), this.data.yAxisTopText && g && f.push({
      text: this.data.yAxisTopText,
      fill: this.themeConfig.quadrantYAxisTextFill,
      x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + s + m + this.config.quadrantPadding,
      y: p + _ - (y ? _ / 2 : 0),
      fontSize: this.config.yAxisLabelFontSize,
      verticalPos: y ? "center" : "left",
      horizontalPos: "top",
      rotation: -90
    }), f;
  }
  getQuadrants(t) {
    const { quadrantSpace: a } = t, { quadrantHalfHeight: g, quadrantLeft: u, quadrantHalfWidth: o, quadrantTop: x } = a, _ = [
      {
        text: {
          text: this.data.quadrant1Text,
          fill: this.themeConfig.quadrant1TextFill,
          x: 0,
          y: 0,
          fontSize: this.config.quadrantLabelFontSize,
          verticalPos: "center",
          horizontalPos: "middle",
          rotation: 0
        },
        x: u + o,
        y: x,
        width: o,
        height: g,
        fill: this.themeConfig.quadrant1Fill
      },
      {
        text: {
          text: this.data.quadrant2Text,
          fill: this.themeConfig.quadrant2TextFill,
          x: 0,
          y: 0,
          fontSize: this.config.quadrantLabelFontSize,
          verticalPos: "center",
          horizontalPos: "middle",
          rotation: 0
        },
        x: u,
        y: x,
        width: o,
        height: g,
        fill: this.themeConfig.quadrant2Fill
      },
      {
        text: {
          text: this.data.quadrant3Text,
          fill: this.themeConfig.quadrant3TextFill,
          x: 0,
          y: 0,
          fontSize: this.config.quadrantLabelFontSize,
          verticalPos: "center",
          horizontalPos: "middle",
          rotation: 0
        },
        x: u,
        y: x + g,
        width: o,
        height: g,
        fill: this.themeConfig.quadrant3Fill
      },
      {
        text: {
          text: this.data.quadrant4Text,
          fill: this.themeConfig.quadrant4TextFill,
          x: 0,
          y: 0,
          fontSize: this.config.quadrantLabelFontSize,
          verticalPos: "center",
          horizontalPos: "middle",
          rotation: 0
        },
        x: u + o,
        y: x + g,
        width: o,
        height: g,
        fill: this.themeConfig.quadrant4Fill
      }
    ];
    for (const h of _)
      h.text.x = h.x + h.width / 2, this.data.points.length === 0 ? (h.text.y = h.y + h.height / 2, h.text.horizontalPos = "middle") : (h.text.y = h.y + this.config.quadrantTextTopPadding, h.text.horizontalPos = "top");
    return _;
  }
  getQuadrantPoints(t) {
    const { quadrantSpace: a } = t, { quadrantHeight: g, quadrantLeft: u, quadrantTop: o, quadrantWidth: x } = a, _ = te().domain([0, 1]).range([u, x + u]), h = te().domain([0, 1]).range([g + o, o]);
    return this.data.points.map((s) => {
      const b = this.classes.get(s.className);
      return b && (s = { ...b, ...s }), {
        x: _(s.x),
        y: h(s.y),
        fill: s.color ?? this.themeConfig.quadrantPointFill,
        radius: s.radius ?? this.config.pointRadius,
        text: {
          text: s.text,
          fill: this.themeConfig.quadrantPointTextFill,
          x: _(s.x),
          y: h(s.y) + this.config.pointTextPadding,
          verticalPos: "center",
          horizontalPos: "top",
          fontSize: this.config.pointLabelFontSize,
          rotation: 0
        },
        strokeColor: s.strokeColor ?? this.themeConfig.quadrantPointFill,
        strokeWidth: s.strokeWidth ?? "0px"
      };
    });
  }
  getBorders(t) {
    const a = this.config.quadrantExternalBorderStrokeWidth / 2, { quadrantSpace: g } = t, {
      quadrantHalfHeight: u,
      quadrantHeight: o,
      quadrantLeft: x,
      quadrantHalfWidth: _,
      quadrantTop: h,
      quadrantWidth: s
    } = g;
    return [
      // top border
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: x - a,
        y1: h,
        x2: x + s + a,
        y2: h
      },
      // right border
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: x + s,
        y1: h + a,
        x2: x + s,
        y2: h + o - a
      },
      // bottom border
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: x - a,
        y1: h + o,
        x2: x + s + a,
        y2: h + o
      },
      // left border
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: x,
        y1: h + a,
        x2: x,
        y2: h + o - a
      },
      // vertical inner border
      {
        strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill,
        strokeWidth: this.config.quadrantInternalBorderStrokeWidth,
        x1: x + _,
        y1: h + a,
        x2: x + _,
        y2: h + o - a
      },
      // horizontal inner border
      {
        strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill,
        strokeWidth: this.config.quadrantInternalBorderStrokeWidth,
        x1: x + a,
        y1: h + u,
        x2: x + s - a,
        y2: h + u
      }
    ];
  }
  getTitle(t) {
    if (t)
      return {
        text: this.data.titleText,
        fill: this.themeConfig.quadrantTitleFill,
        fontSize: this.config.titleFontSize,
        horizontalPos: "top",
        verticalPos: "center",
        rotation: 0,
        y: this.config.titlePadding,
        x: this.config.chartWidth / 2
      };
  }
  build() {
    const t = this.config.showXAxis && !!(this.data.xAxisLeftText || this.data.xAxisRightText), a = this.config.showYAxis && !!(this.data.yAxisTopText || this.data.yAxisBottomText), g = this.config.showTitle && !!this.data.titleText, u = this.data.points.length > 0 ? "bottom" : this.config.xAxisPosition, o = this.calculateSpace(u, t, a, g);
    return {
      points: this.getQuadrantPoints(o),
      quadrants: this.getQuadrants(o),
      axisLabels: this.getAxisLabels(u, t, a, o),
      borderLines: this.getBorders(o),
      title: this.getTitle(g)
    };
  }
}, l(Ct, "QuadrantBuilder"), Ct), Lt, mt = (Lt = class extends Error {
  constructor(t, a, g) {
    super(`value for ${t} ${a} is invalid, please use a valid ${g}`), this.name = "InvalidStyleError";
  }
}, l(Lt, "InvalidStyleError"), Lt);
function Dt(t) {
  return !/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/.test(t);
}
l(Dt, "validateHexCode");
function ie(t) {
  return !/^\d+$/.test(t);
}
l(ie, "validateNumber");
function ae(t) {
  return !/^\d+px$/.test(t);
}
l(ae, "validateSizeInPixels");
var ze = zt();
function X(t) {
  return Ce(t.trim(), ze);
}
l(X, "textSanitizer");
var z = new De();
function ne(t) {
  z.setData({ quadrant1Text: X(t.text) });
}
l(ne, "setQuadrant1Text");
function se(t) {
  z.setData({ quadrant2Text: X(t.text) });
}
l(se, "setQuadrant2Text");
function re(t) {
  z.setData({ quadrant3Text: X(t.text) });
}
l(re, "setQuadrant3Text");
function le(t) {
  z.setData({ quadrant4Text: X(t.text) });
}
l(le, "setQuadrant4Text");
function oe(t) {
  z.setData({ xAxisLeftText: X(t.text) });
}
l(oe, "setXAxisLeftText");
function he(t) {
  z.setData({ xAxisRightText: X(t.text) });
}
l(he, "setXAxisRightText");
function ce(t) {
  z.setData({ yAxisTopText: X(t.text) });
}
l(ce, "setYAxisTopText");
function de(t) {
  z.setData({ yAxisBottomText: X(t.text) });
}
l(de, "setYAxisBottomText");
function At(t) {
  const a = {};
  for (const g of t) {
    const [u, o] = g.trim().split(/\s*:\s*/);
    if (u === "radius") {
      if (ie(o))
        throw new mt(u, o, "number");
      a.radius = parseInt(o);
    } else if (u === "color") {
      if (Dt(o))
        throw new mt(u, o, "hex code");
      a.color = o;
    } else if (u === "stroke-color") {
      if (Dt(o))
        throw new mt(u, o, "hex code");
      a.strokeColor = o;
    } else if (u === "stroke-width") {
      if (ae(o))
        throw new mt(u, o, "number of pixels (eg. 10px)");
      a.strokeWidth = o;
    } else
      throw new Error(`style named ${u} is not supported.`);
  }
  return a;
}
l(At, "parseStyles");
function ue(t, a, g, u, o) {
  const x = At(o);
  z.addPoints([
    {
      x: g,
      y: u,
      text: X(t.text),
      className: a,
      ...x
    }
  ]);
}
l(ue, "addPoint");
function xe(t, a) {
  z.addClass(t, At(a));
}
l(xe, "addClass");
function ge(t) {
  z.setConfig({ chartWidth: t });
}
l(ge, "setWidth");
function fe(t) {
  z.setConfig({ chartHeight: t });
}
l(fe, "setHeight");
function pe() {
  const t = zt(), { themeVariables: a, quadrantChart: g } = t;
  return g && z.setConfig(g), z.setThemeConfig({
    quadrant1Fill: a.quadrant1Fill,
    quadrant2Fill: a.quadrant2Fill,
    quadrant3Fill: a.quadrant3Fill,
    quadrant4Fill: a.quadrant4Fill,
    quadrant1TextFill: a.quadrant1TextFill,
    quadrant2TextFill: a.quadrant2TextFill,
    quadrant3TextFill: a.quadrant3TextFill,
    quadrant4TextFill: a.quadrant4TextFill,
    quadrantPointFill: a.quadrantPointFill,
    quadrantPointTextFill: a.quadrantPointTextFill,
    quadrantXAxisTextFill: a.quadrantXAxisTextFill,
    quadrantYAxisTextFill: a.quadrantYAxisTextFill,
    quadrantExternalBorderStrokeFill: a.quadrantExternalBorderStrokeFill,
    quadrantInternalBorderStrokeFill: a.quadrantInternalBorderStrokeFill,
    quadrantTitleFill: a.quadrantTitleFill
  }), z.setData({ titleText: ee() }), z.build();
}
l(pe, "getQuadrantData");
var Ie = /* @__PURE__ */ l(function() {
  z.clear(), ve();
}, "clear"), We = {
  setWidth: ge,
  setHeight: fe,
  setQuadrant1Text: ne,
  setQuadrant2Text: se,
  setQuadrant3Text: re,
  setQuadrant4Text: le,
  setXAxisLeftText: oe,
  setXAxisRightText: he,
  setYAxisTopText: ce,
  setYAxisBottomText: de,
  parseStyles: At,
  addPoint: ue,
  addClass: xe,
  getQuadrantData: pe,
  clear: Ie,
  setAccTitle: Fe,
  getAccTitle: ke,
  setDiagramTitle: Se,
  getDiagramTitle: ee,
  getAccDescription: be,
  setAccDescription: _e
}, Re = /* @__PURE__ */ l((t, a, g, u) => {
  var o, x, _;
  function h(i) {
    return i === "top" ? "hanging" : "middle";
  }
  l(h, "getDominantBaseLine");
  function s(i) {
    return i === "left" ? "start" : "middle";
  }
  l(s, "getTextAnchor");
  function b(i) {
    return `translate(${i.x}, ${i.y}) rotate(${i.rotation || 0})`;
  }
  l(b, "getTransformation");
  const p = zt();
  qt.debug(`Rendering quadrant chart
` + t);
  const m = p.securityLevel;
  let T;
  m === "sandbox" && (T = vt("#i" + a));
  const y = (m === "sandbox" ? vt(T.nodes()[0].contentDocument.body) : vt("body")).select(`[id="${a}"]`), f = y.append("g").attr("class", "main"), q = ((o = p.quadrantChart) == null ? void 0 : o.chartWidth) ?? 500, H = ((x = p.quadrantChart) == null ? void 0 : x.chartHeight) ?? 500;
  Pe(y, H, q, ((_ = p.quadrantChart) == null ? void 0 : _.useMaxWidth) ?? !0), y.attr("viewBox", "0 0 " + q + " " + H), u.db.setHeight(H), u.db.setWidth(q);
  const C = u.db.getQuadrantData(), ct = f.append("g").attr("class", "quadrants"), dt = f.append("g").attr("class", "border"), ut = f.append("g").attr("class", "data-points"), xt = f.append("g").attr("class", "labels"), gt = f.append("g").attr("class", "title");
  C.title && gt.append("text").attr("x", 0).attr("y", 0).attr("fill", C.title.fill).attr("font-size", C.title.fontSize).attr("dominant-baseline", h(C.title.horizontalPos)).attr("text-anchor", s(C.title.verticalPos)).attr("transform", b(C.title)).text(C.title.text), C.borderLines && dt.selectAll("line").data(C.borderLines).enter().append("line").attr("x1", (i) => i.x1).attr("y1", (i) => i.y1).attr("x2", (i) => i.x2).attr("y2", (i) => i.y2).style("stroke", (i) => i.strokeFill).style("stroke-width", (i) => i.strokeWidth);
  const ot = ct.selectAll("g.quadrant").data(C.quadrants).enter().append("g").attr("class", "quadrant");
  ot.append("rect").attr("x", (i) => i.x).attr("y", (i) => i.y).attr("width", (i) => i.width).attr("height", (i) => i.height).attr("fill", (i) => i.fill), ot.append("text").attr("x", 0).attr("y", 0).attr("fill", (i) => i.text.fill).attr("font-size", (i) => i.text.fontSize).attr(
    "dominant-baseline",
    (i) => h(i.text.horizontalPos)
  ).attr("text-anchor", (i) => s(i.text.verticalPos)).attr("transform", (i) => b(i.text)).text((i) => i.text.text), xt.selectAll("g.label").data(C.axisLabels).enter().append("g").attr("class", "label").append("text").attr("x", 0).attr("y", 0).text((i) => i.text).attr("fill", (i) => i.fill).attr("font-size", (i) => i.fontSize).attr("dominant-baseline", (i) => h(i.horizontalPos)).attr("text-anchor", (i) => s(i.verticalPos)).attr("transform", (i) => b(i));
  const ht = ut.selectAll("g.data-point").data(C.points).enter().append("g").attr("class", "data-point");
  ht.append("circle").attr("cx", (i) => i.x).attr("cy", (i) => i.y).attr("r", (i) => i.radius).attr("fill", (i) => i.fill).attr("stroke", (i) => i.strokeColor).attr("stroke-width", (i) => i.strokeWidth), ht.append("text").attr("x", 0).attr("y", 0).text((i) => i.text.text).attr("fill", (i) => i.text.fill).attr("font-size", (i) => i.text.fontSize).attr(
    "dominant-baseline",
    (i) => h(i.text.horizontalPos)
  ).attr("text-anchor", (i) => s(i.text.verticalPos)).attr("transform", (i) => b(i.text));
}, "draw"), Be = {
  draw: Re
}, Ue = {
  parser: Ee,
  db: We,
  renderer: Be,
  styles: /* @__PURE__ */ l(() => "", "styles")
};
export {
  Ue as diagram
};
