UNPKG

ranui

Version:

A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.

1,982 lines 54.6 kB
import { n as r } from "./chunk-Y2CYZVJY-0JxdZxki.js"; import { m as Tt, p as Pt } from "./src-DtRLxcYO.js"; import { D as _e, H as Ae, K as ke, U as Fe, a as Pe, c as ve, f as z, v as Ce, w as ae, x as Lt, y as Le, z as Ee } from "./chunk-WYO6CB5R-DDHkKowO.js"; import { t as ie } from "./linear-B2AM4ZBe.js"; var vt = (function() { var t = /* @__PURE__ */ r(function(s, c, b, u) { for (b = b || {}, u = s.length; u--; b[s[u]] = c) ; return b; }, "o"), o = [1, 3], T = [1, 4], f = [1, 5], l = [1, 6], d = [1, 7], S = [ 1, 4, 5, 10, 12, 13, 14, 15, 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, 15, 18, 25, 28, 35, 37, 39, 41, 42, 48, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 63, 64, 65, 66, 67 ], n = [ 55, 56, 57 ], I = [2, 36], m = [1, 37], q = [1, 36], p = [1, 38], y = [1, 35], g = [1, 43], _ = [1, 41], A = [1, 45], ct = [1, 14], dt = [1, 23], ut = [1, 18], lt = [1, 19], ot = [1, 20], e = [1, 21], Et = [1, 22], Dt = [1, 24], zt = [1, 25], Vt = [1, 26], It = [1, 27], wt = [1, 28], Bt = [1, 29], Q = [1, 32], O = [1, 33], F = [1, 34], P = [1, 39], v = [1, 40], C = [1, 42], L = [1, 44], X = [1, 63], M = [1, 62], E = [ 4, 5, 8, 10, 12, 13, 14, 15, 18, 44, 47, 49, 55, 56, 57, 63, 64, 65, 66, 67 ], Rt = [1, 66], Nt = [1, 67], Wt = [1, 68], Ut = [1, 69], Qt = [1, 70], Ot = [1, 71], Ht = [1, 72], Xt = [1, 73], Mt = [1, 74], Yt = [1, 75], jt = [1, 76], Gt = [1, 77], R = [ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18 ], K = [1, 91], Z = [1, 92], J = [1, 93], $ = [1, 100], tt = [1, 94], et = [1, 97], it = [1, 95], at = [1, 96], nt = [1, 98], st = [1, 99], qt = [1, 103], Kt = [ 10, 55, 56, 57 ], N = [ 4, 5, 6, 8, 10, 11, 13, 17, 18, 19, 20, 55, 56, 57 ], bt = { trace: /* @__PURE__ */ r(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], [58, 1], [59, 1], [59, 1], [59, 1] ], performAction: /* @__PURE__ */ r(function(c, b, u, x, k, i, ht) { var a = i.length - 1; switch (k) { case 23: this.$ = i[a]; break; case 24: this.$ = i[a - 1] + "" + i[a]; break; case 26: this.$ = i[a - 1] + i[a]; break; case 27: this.$ = [i[a].trim()]; break; case 28: i[a - 2].push(i[a].trim()), this.$ = i[a - 2]; break; case 29: this.$ = i[a - 4], x.addClass(i[a - 2], i[a]); break; case 37: this.$ = []; break; case 42: this.$ = i[a].trim(), x.setDiagramTitle(this.$); break; case 43: this.$ = i[a].trim(), x.setAccTitle(this.$); break; case 44: case 45: this.$ = i[a].trim(), x.setAccDescription(this.$); break; case 46: x.addSection(i[a].substr(8)), this.$ = i[a].substr(8); break; case 47: x.addPoint(i[a - 3], "", i[a - 1], i[a], []); break; case 48: x.addPoint(i[a - 4], i[a - 3], i[a - 1], i[a], []); break; case 49: x.addPoint(i[a - 4], "", i[a - 2], i[a - 1], i[a]); break; case 50: x.addPoint(i[a - 5], i[a - 4], i[a - 2], i[a - 1], i[a]); break; case 51: x.setXAxisLeftText(i[a - 2]), x.setXAxisRightText(i[a]); break; case 52: i[a - 1].text += " ⟶ ", x.setXAxisLeftText(i[a - 1]); break; case 53: x.setXAxisLeftText(i[a]); break; case 54: x.setYAxisBottomText(i[a - 2]), x.setYAxisTopText(i[a]); break; case 55: i[a - 1].text += " ⟶ ", x.setYAxisBottomText(i[a - 1]); break; case 56: x.setYAxisBottomText(i[a]); break; case 57: x.setQuadrant1Text(i[a]); break; case 58: x.setQuadrant2Text(i[a]); break; case 59: x.setQuadrant3Text(i[a]); break; case 60: x.setQuadrant4Text(i[a]); break; case 64: this.$ = { text: i[a], type: "text" }; break; case 65: this.$ = { text: i[a - 1].text + "" + i[a], type: i[a - 1].type }; break; case 66: this.$ = { text: i[a], type: "text" }; break; case 67: this.$ = { text: i[a], type: "markdown" }; break; case 68: this.$ = i[a]; break; case 69: this.$ = i[a - 1] + "" + i[a]; break; } }, "anonymous"), table: [ { 18: o, 26: 1, 27: 2, 28: T, 55: f, 56: l, 57: d }, { 1: [3] }, { 18: o, 26: 8, 27: 2, 28: T, 55: f, 56: l, 57: d }, { 18: o, 26: 9, 27: 2, 28: T, 55: f, 56: l, 57: d }, t(S, [2, 33], { 29: 10 }), t(h, [2, 61]), t(h, [2, 62]), t(h, [2, 63]), { 1: [2, 30] }, { 1: [2, 31] }, t(n, I, { 30: 11, 31: 12, 24: 13, 32: 15, 33: 16, 34: 17, 43: 30, 58: 31, 1: [2, 32], 4: m, 5: q, 10: p, 12: y, 13: g, 14: _, 15: A, 18: ct, 25: dt, 35: ut, 37: lt, 39: ot, 41: e, 42: Et, 48: Dt, 50: zt, 51: Vt, 52: It, 53: wt, 54: Bt, 60: Q, 61: O, 63: F, 64: P, 65: v, 66: C, 67: L }), t(S, [2, 34]), { 27: 46, 55: f, 56: l, 57: d }, t(n, [2, 37]), t(n, I, { 24: 13, 32: 15, 33: 16, 34: 17, 43: 30, 58: 31, 31: 47, 4: m, 5: q, 10: p, 12: y, 13: g, 14: _, 15: A, 18: ct, 25: dt, 35: ut, 37: lt, 39: ot, 41: e, 42: Et, 48: Dt, 50: zt, 51: Vt, 52: It, 53: wt, 54: Bt, 60: Q, 61: O, 63: F, 64: P, 65: v, 66: C, 67: L }), t(n, [2, 39]), t(n, [2, 40]), t(n, [2, 41]), { 36: [1, 48] }, { 38: [1, 49] }, { 40: [1, 50] }, t(n, [2, 45]), t(n, [2, 46]), { 18: [1, 51] }, { 4: m, 5: q, 10: p, 12: y, 13: g, 14: _, 15: A, 43: 52, 58: 31, 60: Q, 61: O, 63: F, 64: P, 65: v, 66: C, 67: L }, { 4: m, 5: q, 10: p, 12: y, 13: g, 14: _, 15: A, 43: 53, 58: 31, 60: Q, 61: O, 63: F, 64: P, 65: v, 66: C, 67: L }, { 4: m, 5: q, 10: p, 12: y, 13: g, 14: _, 15: A, 43: 54, 58: 31, 60: Q, 61: O, 63: F, 64: P, 65: v, 66: C, 67: L }, { 4: m, 5: q, 10: p, 12: y, 13: g, 14: _, 15: A, 43: 55, 58: 31, 60: Q, 61: O, 63: F, 64: P, 65: v, 66: C, 67: L }, { 4: m, 5: q, 10: p, 12: y, 13: g, 14: _, 15: A, 43: 56, 58: 31, 60: Q, 61: O, 63: F, 64: P, 65: v, 66: C, 67: L }, { 4: m, 5: q, 10: p, 12: y, 13: g, 14: _, 15: A, 43: 57, 58: 31, 60: Q, 61: O, 63: F, 64: P, 65: v, 66: C, 67: L }, { 4: m, 5: q, 8: X, 10: p, 12: y, 13: g, 14: _, 15: A, 18: M, 44: [1, 58], 47: [1, 59], 58: 61, 59: 60, 63: F, 64: P, 65: v, 66: C, 67: L }, t(E, [2, 64]), t(E, [2, 66]), t(E, [2, 67]), t(E, [2, 70]), t(E, [2, 71]), t(E, [2, 72]), t(E, [2, 73]), t(E, [2, 74]), t(E, [2, 75]), t(E, [2, 76]), t(E, [2, 77]), t(E, [2, 78]), t(E, [2, 79]), t(E, [2, 80]), t(E, [2, 81]), t(S, [2, 35]), t(n, [2, 38]), t(n, [2, 42]), t(n, [2, 43]), t(n, [2, 44]), { 3: 65, 4: Rt, 5: Nt, 6: Wt, 7: Ut, 8: Qt, 9: Ot, 10: Ht, 11: Xt, 12: Mt, 13: Yt, 14: jt, 15: Gt, 21: 64 }, t(n, [2, 53], { 59: 60, 58: 61, 4: m, 5: q, 8: X, 10: p, 12: y, 13: g, 14: _, 15: A, 18: M, 49: [1, 78], 63: F, 64: P, 65: v, 66: C, 67: L }), t(n, [2, 56], { 59: 60, 58: 61, 4: m, 5: q, 8: X, 10: p, 12: y, 13: g, 14: _, 15: A, 18: M, 49: [1, 79], 63: F, 64: P, 65: v, 66: C, 67: L }), t(n, [2, 57], { 59: 60, 58: 61, 4: m, 5: q, 8: X, 10: p, 12: y, 13: g, 14: _, 15: A, 18: M, 63: F, 64: P, 65: v, 66: C, 67: L }), t(n, [2, 58], { 59: 60, 58: 61, 4: m, 5: q, 8: X, 10: p, 12: y, 13: g, 14: _, 15: A, 18: M, 63: F, 64: P, 65: v, 66: C, 67: L }), t(n, [2, 59], { 59: 60, 58: 61, 4: m, 5: q, 8: X, 10: p, 12: y, 13: g, 14: _, 15: A, 18: M, 63: F, 64: P, 65: v, 66: C, 67: L }), t(n, [2, 60], { 59: 60, 58: 61, 4: m, 5: q, 8: X, 10: p, 12: y, 13: g, 14: _, 15: A, 18: M, 63: F, 64: P, 65: v, 66: C, 67: L }), { 45: [1, 80] }, { 44: [1, 81] }, t(E, [2, 65]), t(E, [2, 82]), t(E, [2, 83]), t(E, [2, 84]), { 3: 83, 4: Rt, 5: Nt, 6: Wt, 7: Ut, 8: Qt, 9: Ot, 10: Ht, 11: Xt, 12: Mt, 13: Yt, 14: jt, 15: Gt, 18: [1, 82] }, t(R, [2, 23]), t(R, [2, 1]), t(R, [2, 2]), t(R, [2, 3]), t(R, [2, 4]), t(R, [2, 5]), t(R, [2, 6]), t(R, [2, 7]), t(R, [2, 8]), t(R, [2, 9]), t(R, [2, 10]), t(R, [2, 11]), t(R, [2, 12]), t(n, [2, 52], { 58: 31, 43: 84, 4: m, 5: q, 10: p, 12: y, 13: g, 14: _, 15: A, 60: Q, 61: O, 63: F, 64: P, 65: v, 66: C, 67: L }), t(n, [2, 55], { 58: 31, 43: 85, 4: m, 5: q, 10: p, 12: y, 13: g, 14: _, 15: A, 60: Q, 61: O, 63: F, 64: P, 65: v, 66: C, 67: L }), { 46: [1, 86] }, { 45: [1, 87] }, { 4: K, 5: Z, 6: J, 8: $, 11: tt, 13: et, 16: 90, 17: it, 18: at, 19: nt, 20: st, 22: 89, 23: 88 }, t(R, [2, 24]), t(n, [2, 51], { 59: 60, 58: 61, 4: m, 5: q, 8: X, 10: p, 12: y, 13: g, 14: _, 15: A, 18: M, 63: F, 64: P, 65: v, 66: C, 67: L }), t(n, [2, 54], { 59: 60, 58: 61, 4: m, 5: q, 8: X, 10: p, 12: y, 13: g, 14: _, 15: A, 18: M, 63: F, 64: P, 65: v, 66: C, 67: L }), t(n, [2, 47], { 22: 89, 16: 90, 23: 101, 4: K, 5: Z, 6: J, 8: $, 11: tt, 13: et, 17: it, 18: at, 19: nt, 20: st }), { 46: [1, 102] }, t(n, [2, 29], { 10: qt }), t(Kt, [2, 27], { 16: 104, 4: K, 5: Z, 6: J, 8: $, 11: tt, 13: et, 17: it, 18: at, 19: nt, 20: st }), t(N, [2, 25]), t(N, [2, 13]), t(N, [2, 14]), t(N, [2, 15]), t(N, [2, 16]), t(N, [2, 17]), t(N, [2, 18]), t(N, [2, 19]), t(N, [2, 20]), t(N, [2, 21]), t(N, [2, 22]), t(n, [2, 49], { 10: qt }), t(n, [2, 48], { 22: 89, 16: 90, 23: 105, 4: K, 5: Z, 6: J, 8: $, 11: tt, 13: et, 17: it, 18: at, 19: nt, 20: st }), { 4: K, 5: Z, 6: J, 8: $, 11: tt, 13: et, 16: 90, 17: it, 18: at, 19: nt, 20: st, 22: 106 }, t(N, [2, 26]), t(n, [2, 50], { 10: qt }), t(Kt, [2, 28], { 16: 104, 4: K, 5: Z, 6: J, 8: $, 11: tt, 13: et, 17: it, 18: at, 19: nt, 20: st }) ], defaultActions: { 8: [2, 30], 9: [2, 31] }, parseError: /* @__PURE__ */ r(function(c, b) { if (b.recoverable) this.trace(c); else { var u = new Error(c); throw u.hash = b, u; } }, "parseError"), parse: /* @__PURE__ */ r(function(c) { var b = this, u = [0], x = [], k = [null], i = [], ht = this.table, a = "", ft = 0, Zt = 0, Jt = 0, me = 2, $t = 1, qe = i.slice.call(arguments, 1), D = Object.create(this.lexer), j = { yy: {} }; for (var St in this.yy) Object.prototype.hasOwnProperty.call(this.yy, St) && (j.yy[St] = this.yy[St]); D.setInput(c, j.yy), j.yy.lexer = D, j.yy.parser = this, typeof D.yylloc > "u" && (D.yylloc = {}); var _t = D.yylloc; i.push(_t); var be = D.options && D.options.ranges; typeof j.yy.parseError == "function" ? this.parseError = j.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError; function Se(U) { u.length = u.length - 2 * U, k.length = k.length - U, i.length = i.length - U; } r(Se, "popStack"); function te() { var U = x.pop() || D.lex() || $t; return typeof U != "number" && (U instanceof Array && (x = U, U = x.pop()), U = b.symbols_[U] || U), U; } r(te, "lex"); for (var w, At, G, W, kt, rt = {}, gt, Y, ee, pt; ; ) { if (G = u[u.length - 1], this.defaultActions[G] ? W = this.defaultActions[G] : ((w === null || typeof w > "u") && (w = te()), W = ht[G] && ht[G][w]), typeof W > "u" || !W.length || !W[0]) { var Ft = ""; pt = []; for (gt in ht[G]) this.terminals_[gt] && gt > me && pt.push("'" + this.terminals_[gt] + "'"); D.showPosition ? Ft = "Parse error on line " + (ft + 1) + `: ` + D.showPosition() + ` Expecting ` + pt.join(", ") + ", got '" + (this.terminals_[w] || w) + "'" : Ft = "Parse error on line " + (ft + 1) + ": Unexpected " + (w == $t ? "end of input" : "'" + (this.terminals_[w] || w) + "'"), this.parseError(Ft, { text: D.match, token: this.terminals_[w] || w, line: D.yylineno, loc: _t, expected: pt }); } if (W[0] instanceof Array && W.length > 1) throw new Error("Parse Error: multiple actions possible at state: " + G + ", token: " + w); switch (W[0]) { case 1: u.push(w), k.push(D.yytext), i.push(D.yylloc), u.push(W[1]), w = null, At ? (w = At, At = null) : (Zt = D.yyleng, a = D.yytext, ft = D.yylineno, _t = D.yylloc, Jt > 0 && Jt--); break; case 2: if (Y = this.productions_[W[1]][1], rt.$ = k[k.length - Y], rt._$ = { first_line: i[i.length - (Y || 1)].first_line, last_line: i[i.length - 1].last_line, first_column: i[i.length - (Y || 1)].first_column, last_column: i[i.length - 1].last_column }, be && (rt._$.range = [i[i.length - (Y || 1)].range[0], i[i.length - 1].range[1]]), kt = this.performAction.apply(rt, [ a, Zt, ft, j.yy, W[1], k, i ].concat(qe)), typeof kt < "u") return kt; Y && (u = u.slice(0, -1 * Y * 2), k = k.slice(0, -1 * Y), i = i.slice(0, -1 * Y)), u.push(this.productions_[W[1]][0]), k.push(rt.$), i.push(rt._$), ee = ht[u[u.length - 2]][u[u.length - 1]], u.push(ee); break; case 3: return !0; } } return !0; }, "parse") }; bt.lexer = /* @__PURE__ */ (function() { return { EOF: 1, parseError: /* @__PURE__ */ r(function(c, b) { if (this.yy.parser) this.yy.parser.parseError(c, b); else throw new Error(c); }, "parseError"), setInput: /* @__PURE__ */ r(function(s, c) { return this.yy = c || this.yy || {}, this._input = s, 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"), input: /* @__PURE__ */ r(function() { var s = this._input[0]; return this.yytext += s, this.yyleng++, this.offset++, this.match += s, this.matched += s, s.match(/(?:\r\n?|\n).*/g) ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), s; }, "input"), unput: /* @__PURE__ */ r(function(s) { var c = s.length, b = s.split(/(?:\r\n?|\n)/g); this._input = s + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - c), this.offset -= c; var u = 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), b.length - 1 && (this.yylineno -= b.length - 1); var x = 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: b ? (b.length === u.length ? this.yylloc.first_column : 0) + u[u.length - b.length].length - b[0].length : this.yylloc.first_column - c }, this.options.ranges && (this.yylloc.range = [x[0], x[0] + this.yyleng - c]), this.yyleng = this.yytext.length, this; }, "unput"), more: /* @__PURE__ */ r(function() { return this._more = !0, this; }, "more"), reject: /* @__PURE__ */ r(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"), less: /* @__PURE__ */ r(function(s) { this.unput(this.match.slice(s)); }, "less"), pastInput: /* @__PURE__ */ r(function() { var s = this.matched.substr(0, this.matched.length - this.match.length); return (s.length > 20 ? "..." : "") + s.substr(-20).replace(/\n/g, ""); }, "pastInput"), upcomingInput: /* @__PURE__ */ r(function() { var s = this.match; return s.length < 20 && (s += this._input.substr(0, 20 - s.length)), (s.substr(0, 20) + (s.length > 20 ? "..." : "")).replace(/\n/g, ""); }, "upcomingInput"), showPosition: /* @__PURE__ */ r(function() { var s = this.pastInput(), c = new Array(s.length + 1).join("-"); return s + this.upcomingInput() + ` ` + c + "^"; }, "showPosition"), test_match: /* @__PURE__ */ r(function(s, c) { var b, u, x; if (this.options.backtrack_lexer && (x = { 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 && (x.yylloc.range = this.yylloc.range.slice(0))), u = s[0].match(/(?:\r\n?|\n).*/g), u && (this.yylineno += u.length), this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: u ? u[u.length - 1].length - u[u.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + s[0].length }, this.yytext += s[0], this.match += s[0], this.matches = s, 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(s[0].length), this.matched += s[0], b = this.performAction.call(this, this.yy, this, c, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), b) return b; if (this._backtrack) { for (var k in x) this[k] = x[k]; return !1; } return !1; }, "test_match"), next: /* @__PURE__ */ r(function() { if (this.done) return this.EOF; this._input || (this.done = !0); var s, c, b, u; this._more || (this.yytext = "", this.match = ""); for (var x = this._currentRules(), k = 0; k < x.length; k++) if (b = this._input.match(this.rules[x[k]]), b && (!c || b[0].length > c[0].length)) { if (c = b, u = k, this.options.backtrack_lexer) { if (s = this.test_match(b, x[k]), s !== !1) return s; if (this._backtrack) { c = !1; continue; } else return !1; } else if (!this.options.flex) break; } return c ? (s = this.test_match(c, x[u]), s !== !1 ? s : !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"), lex: /* @__PURE__ */ r(function() { var c = this.next(); return c || this.lex(); }, "lex"), begin: /* @__PURE__ */ r(function(c) { this.conditionStack.push(c); }, "begin"), popState: /* @__PURE__ */ r(function() { return this.conditionStack.length - 1 > 0 ? this.conditionStack.pop() : this.conditionStack[0]; }, "popState"), _currentRules: /* @__PURE__ */ r(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"), topState: /* @__PURE__ */ r(function(c) { return c = this.conditionStack.length - 1 - Math.abs(c || 0), c >= 0 ? this.conditionStack[c] : "INITIAL"; }, "topState"), pushState: /* @__PURE__ */ r(function(c) { this.begin(c); }, "pushState"), stateStackSize: /* @__PURE__ */ r(function() { return this.conditionStack.length; }, "stateStackSize"), options: { "case-insensitive": !0 }, performAction: /* @__PURE__ */ r(function(c, b, u, x) { switch (u) { 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 15; case 37: return 11; case 38: return 64; case 39: return 10; case 40: return 65; case 41: return 65; case 42: return 14; case 43: return 13; case 44: return 67; case 45: return 66; case 46: return 12; case 47: return 8; case 48: return 5; case 49: return 18; case 50: return 56; case 51: return 63; case 52: 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, /^(?:[^\x00-\x7F]+)/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, 52 ], inclusive: !0 } } }; })(); function xt() { this.yy = {}; } return r(xt, "Parser"), xt.prototype = bt, bt.Parser = xt, new xt(); })(); vt.parser = vt; var De = vt, B = _e(), ze = class { constructor() { this.classes = /* @__PURE__ */ new Map(), this.config = this.getDefaultConfig(), this.themeConfig = this.getDefaultThemeConfig(), this.data = this.getDefaultData(); } static { r(this, "QuadrantBuilder"); } getDefaultData() { return { titleText: "", quadrant1Text: "", quadrant2Text: "", quadrant3Text: "", quadrant4Text: "", xAxisLeftText: "", xAxisRightText: "", yAxisBottomText: "", yAxisTopText: "", points: [] }; } getDefaultConfig() { return { showXAxis: !0, showYAxis: !0, showTitle: !0, chartHeight: z.quadrantChart?.chartWidth || 500, chartWidth: z.quadrantChart?.chartHeight || 500, titlePadding: z.quadrantChart?.titlePadding || 10, titleFontSize: z.quadrantChart?.titleFontSize || 20, quadrantPadding: z.quadrantChart?.quadrantPadding || 5, xAxisLabelPadding: z.quadrantChart?.xAxisLabelPadding || 5, yAxisLabelPadding: z.quadrantChart?.yAxisLabelPadding || 5, xAxisLabelFontSize: z.quadrantChart?.xAxisLabelFontSize || 16, yAxisLabelFontSize: z.quadrantChart?.yAxisLabelFontSize || 16, quadrantLabelFontSize: z.quadrantChart?.quadrantLabelFontSize || 16, quadrantTextTopPadding: z.quadrantChart?.quadrantTextTopPadding || 5, pointTextPadding: z.quadrantChart?.pointTextPadding || 5, pointLabelFontSize: z.quadrantChart?.pointLabelFontSize || 12, pointRadius: z.quadrantChart?.pointRadius || 5, xAxisPosition: z.quadrantChart?.xAxisPosition || "top", yAxisPosition: z.quadrantChart?.yAxisPosition || "left", quadrantInternalBorderStrokeWidth: z.quadrantChart?.quadrantInternalBorderStrokeWidth || 1, quadrantExternalBorderStrokeWidth: z.quadrantChart?.quadrantExternalBorderStrokeWidth || 2 }; } getDefaultThemeConfig() { return { quadrant1Fill: B.quadrant1Fill, quadrant2Fill: B.quadrant2Fill, quadrant3Fill: B.quadrant3Fill, quadrant4Fill: B.quadrant4Fill, quadrant1TextFill: B.quadrant1TextFill, quadrant2TextFill: B.quadrant2TextFill, quadrant3TextFill: B.quadrant3TextFill, quadrant4TextFill: B.quadrant4TextFill, quadrantPointFill: B.quadrantPointFill, quadrantPointTextFill: B.quadrantPointTextFill, quadrantXAxisTextFill: B.quadrantXAxisTextFill, quadrantYAxisTextFill: B.quadrantYAxisTextFill, quadrantTitleFill: B.quadrantTitleFill, quadrantInternalBorderStrokeFill: B.quadrantInternalBorderStrokeFill, quadrantExternalBorderStrokeFill: B.quadrantExternalBorderStrokeFill }; } clear() { this.config = this.getDefaultConfig(), this.themeConfig = this.getDefaultThemeConfig(), this.data = this.getDefaultData(), this.classes = /* @__PURE__ */ new Map(), Tt.info("clear called"); } setData(t) { this.data = { ...this.data, ...t }; } addPoints(t) { this.data.points = [...t, ...this.data.points]; } addClass(t, o) { this.classes.set(t, o); } setConfig(t) { Tt.trace("setConfig called with: ", t), this.config = { ...this.config, ...t }; } setThemeConfig(t) { Tt.trace("setThemeConfig called with: ", t), this.themeConfig = { ...this.themeConfig, ...t }; } calculateSpace(t, o, T, f) { const l = this.config.xAxisLabelPadding * 2 + this.config.xAxisLabelFontSize, d = { top: t === "top" && o ? l : 0, bottom: t === "bottom" && o ? l : 0 }, S = this.config.yAxisLabelPadding * 2 + this.config.yAxisLabelFontSize, h = { left: this.config.yAxisPosition === "left" && T ? S : 0, right: this.config.yAxisPosition === "right" && T ? S : 0 }, n = this.config.titleFontSize + this.config.titlePadding * 2, I = { top: f ? n : 0 }, m = this.config.quadrantPadding + h.left, q = this.config.quadrantPadding + d.top + I.top, p = this.config.chartWidth - this.config.quadrantPadding * 2 - h.left - h.right, y = this.config.chartHeight - this.config.quadrantPadding * 2 - d.top - d.bottom - I.top; return { xAxisSpace: d, yAxisSpace: h, titleSpace: I, quadrantSpace: { quadrantLeft: m, quadrantTop: q, quadrantWidth: p, quadrantHalfWidth: p / 2, quadrantHeight: y, quadrantHalfHeight: y / 2 } }; } getAxisLabels(t, o, T, f) { const { quadrantSpace: l, titleSpace: d } = f, { quadrantHalfHeight: S, quadrantHeight: h, quadrantLeft: n, quadrantHalfWidth: I, quadrantTop: m, quadrantWidth: q } = l, p = !!this.data.xAxisRightText, y = !!this.data.yAxisTopText, g = []; return this.data.xAxisLeftText && o && g.push({ text: this.data.xAxisLeftText, fill: this.themeConfig.quadrantXAxisTextFill, x: n + (p ? I / 2 : 0), y: t === "top" ? this.config.xAxisLabelPadding + d.top : this.config.xAxisLabelPadding + m + h + this.config.quadrantPadding, fontSize: this.config.xAxisLabelFontSize, verticalPos: p ? "center" : "left", horizontalPos: "top", rotation: 0 }), this.data.xAxisRightText && o && g.push({ text: this.data.xAxisRightText, fill: this.themeConfig.quadrantXAxisTextFill, x: n + I + (p ? I / 2 : 0), y: t === "top" ? this.config.xAxisLabelPadding + d.top : this.config.xAxisLabelPadding + m + h + this.config.quadrantPadding, fontSize: this.config.xAxisLabelFontSize, verticalPos: p ? "center" : "left", horizontalPos: "top", rotation: 0 }), this.data.yAxisBottomText && T && g.push({ text: this.data.yAxisBottomText, fill: this.themeConfig.quadrantYAxisTextFill, x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + n + q + this.config.quadrantPadding, y: m + h - (y ? S / 2 : 0), fontSize: this.config.yAxisLabelFontSize, verticalPos: y ? "center" : "left", horizontalPos: "top", rotation: -90 }), this.data.yAxisTopText && T && g.push({ text: this.data.yAxisTopText, fill: this.themeConfig.quadrantYAxisTextFill, x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + n + q + this.config.quadrantPadding, y: m + S - (y ? S / 2 : 0), fontSize: this.config.yAxisLabelFontSize, verticalPos: y ? "center" : "left", horizontalPos: "top", rotation: -90 }), g; } getQuadrants(t) { const { quadrantSpace: o } = t, { quadrantHalfHeight: T, quadrantLeft: f, quadrantHalfWidth: l, quadrantTop: d } = o, S = [ { text: { text: this.data.quadrant1Text, fill: this.themeConfig.quadrant1TextFill, x: 0, y: 0, fontSize: this.config.quadrantLabelFontSize, verticalPos: "center", horizontalPos: "middle", rotation: 0 }, x: f + l, y: d, width: l, height: T, 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: f, y: d, width: l, height: T, 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: f, y: d + T, width: l, height: T, 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: f + l, y: d + T, width: l, height: T, fill: this.themeConfig.quadrant4Fill } ]; for (const h of S) 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 S; } getQuadrantPoints(t) { const { quadrantSpace: o } = t, { quadrantHeight: T, quadrantLeft: f, quadrantTop: l, quadrantWidth: d } = o, S = ie().domain([0, 1]).range([f, d + f]), h = ie().domain([0, 1]).range([T + l, l]); return this.data.points.map((n) => { const I = this.classes.get(n.className); return I && (n = { ...I, ...n }), { x: S(n.x), y: h(n.y), fill: n.color ?? this.themeConfig.quadrantPointFill, radius: n.radius ?? this.config.pointRadius, text: { text: n.text, fill: this.themeConfig.quadrantPointTextFill, x: S(n.x), y: h(n.y) + this.config.pointTextPadding, verticalPos: "center", horizontalPos: "top", fontSize: this.config.pointLabelFontSize, rotation: 0 }, strokeColor: n.strokeColor ?? this.themeConfig.quadrantPointFill, strokeWidth: n.strokeWidth ?? "0px" }; }); } getBorders(t) { const o = this.config.quadrantExternalBorderStrokeWidth / 2, { quadrantSpace: T } = t, { quadrantHalfHeight: f, quadrantHeight: l, quadrantLeft: d, quadrantHalfWidth: S, quadrantTop: h, quadrantWidth: n } = T; return [ { strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill, strokeWidth: this.config.quadrantExternalBorderStrokeWidth, x1: d - o, y1: h, x2: d + n + o, y2: h }, { strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill, strokeWidth: this.config.quadrantExternalBorderStrokeWidth, x1: d + n, y1: h + o, x2: d + n, y2: h + l - o }, { strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill, strokeWidth: this.config.quadrantExternalBorderStrokeWidth, x1: d - o, y1: h + l, x2: d + n + o, y2: h + l }, { strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill, strokeWidth: this.config.quadrantExternalBorderStrokeWidth, x1: d, y1: h + o, x2: d, y2: h + l - o }, { strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill, strokeWidth: this.config.quadrantInternalBorderStrokeWidth, x1: d + S, y1: h + o, x2: d + S, y2: h + l - o }, { strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill, strokeWidth: this.config.quadrantInternalBorderStrokeWidth, x1: d + o, y1: h + f, x2: d + n - o, y2: h + f } ]; } 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), o = this.config.showYAxis && !!(this.data.yAxisTopText || this.data.yAxisBottomText), T = this.config.showTitle && !!this.data.titleText, f = this.data.points.length > 0 ? "bottom" : this.config.xAxisPosition, l = this.calculateSpace(f, t, o, T); return { points: this.getQuadrantPoints(l), quadrants: this.getQuadrants(l), axisLabels: this.getAxisLabels(f, t, o, l), borderLines: this.getBorders(l), title: this.getTitle(T) }; } }, yt = class extends Error { static { r(this, "InvalidStyleError"); } constructor(t, o, T) { super(`value for ${t} ${o} is invalid, please use a valid ${T}`), this.name = "InvalidStyleError"; } }; function Ct(t) { return !/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/.test(t); } r(Ct, "validateHexCode"); function ne(t) { return !/^\d+$/.test(t); } r(ne, "validateNumber"); function se(t) { return !/^\d+px$/.test(t); } r(se, "validateSizeInPixels"); function H(t) { return Ee(t.trim(), Lt()); } r(H, "textSanitizer"); var V = new ze(); function re(t) { V.setData({ quadrant1Text: H(t.text) }); } r(re, "setQuadrant1Text"); function le(t) { V.setData({ quadrant2Text: H(t.text) }); } r(le, "setQuadrant2Text"); function oe(t) { V.setData({ quadrant3Text: H(t.text) }); } r(oe, "setQuadrant3Text"); function he(t) { V.setData({ quadrant4Text: H(t.text) }); } r(he, "setQuadrant4Text"); function ce(t) { V.setData({ xAxisLeftText: H(t.text) }); } r(ce, "setXAxisLeftText"); function de(t) { V.setData({ xAxisRightText: H(t.text) }); } r(de, "setXAxisRightText"); function ue(t) { V.setData({ yAxisTopText: H(t.text) }); } r(ue, "setYAxisTopText"); function xe(t) { V.setData({ yAxisBottomText: H(t.text) }); } r(xe, "setYAxisBottomText"); function mt(t) { const o = {}; for (const T of t) { const [f, l] = T.trim().split(/\s*:\s*/); if (f === "radius") { if (ne(l)) throw new yt(f, l, "number"); o.radius = parseInt(l); } else if (f === "color") { if (Ct(l)) throw new yt(f, l, "hex code"); o.color = l; } else if (f === "stroke-color") { if (Ct(l)) throw new yt(f, l, "hex code"); o.strokeColor = l; } else if (f === "stroke-width") { if (se(l)) throw new yt(f, l, "number of pixels (eg. 10px)"); o.strokeWidth = l; } else throw new Error(`style named ${f} is not supported.`); } return o; } r(mt, "parseStyles"); function fe(t, o, T, f, l) { const d = mt(l); V.addPoints([{ x: T, y: f, text: H(t.text), className: o, ...d }]); } r(fe, "addPoint"); function ge(t, o) { V.addClass(t, mt(o)); } r(ge, "addClass"); function pe(t) { V.setConfig({ chartWidth: t }); } r(pe, "setWidth"); function ye(t) { V.setConfig({ chartHeight: t }); } r(ye, "setHeight"); function Te() { const { themeVariables: t, quadrantChart: o } = Lt(); return o && V.setConfig(o), V.setThemeConfig({ quadrant1Fill: t.quadrant1Fill, quadr