1 | import { E as getThemeVariables, B as defaultConfig, l as log, s as setAccTitle, g as getAccTitle, q as setDiagramTitle, t as getDiagramTitle, a as getAccDescription, b as setAccDescription, c as getConfig, v as clear$1, d as sanitizeText, i as configureSvgSize } from "./mermaid-6dc72991.js";
|
2 | import { scaleLinear, select } from "d3";
|
3 | import "ts-dedent";
|
4 | import "dayjs";
|
5 | import "@braintree/sanitize-url";
|
6 | import "dompurify";
|
7 | import "khroma";
|
8 | import "lodash-es/memoize.js";
|
9 | import "lodash-es/merge.js";
|
10 | import "stylis";
|
11 | import "lodash-es/isEmpty.js";
|
12 | var parser = function() {
|
13 | var o = function(k, v, o2, l) {
|
14 | for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
|
15 | ;
|
16 | return o2;
|
17 | }, $V0 = [1, 3], $V1 = [1, 4], $V2 = [1, 5], $V3 = [1, 6], $V4 = [1, 7], $V5 = [1, 5, 13, 15, 17, 19, 20, 25, 27, 28, 29, 30, 31, 32, 33, 34, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], $V6 = [1, 5, 6, 13, 15, 17, 19, 20, 25, 27, 28, 29, 30, 31, 32, 33, 34, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], $V7 = [32, 33, 34], $V8 = [2, 7], $V9 = [1, 13], $Va = [1, 17], $Vb = [1, 18], $Vc = [1, 19], $Vd = [1, 20], $Ve = [1, 21], $Vf = [1, 22], $Vg = [1, 23], $Vh = [1, 24], $Vi = [1, 25], $Vj = [1, 26], $Vk = [1, 27], $Vl = [1, 30], $Vm = [1, 31], $Vn = [1, 32], $Vo = [1, 33], $Vp = [1, 34], $Vq = [1, 35], $Vr = [1, 36], $Vs = [1, 37], $Vt = [1, 38], $Vu = [1, 39], $Vv = [1, 40], $Vw = [1, 41], $Vx = [1, 42], $Vy = [1, 57], $Vz = [1, 58], $VA = [5, 22, 26, 32, 33, 34, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51];
|
18 | var parser2 = {
|
19 | trace: function trace() {
|
20 | },
|
21 | yy: {},
|
22 | symbols_: { "error": 2, "start": 3, "eol": 4, "SPACE": 5, "QUADRANT": 6, "document": 7, "line": 8, "statement": 9, "axisDetails": 10, "quadrantDetails": 11, "points": 12, "title": 13, "title_value": 14, "acc_title": 15, "acc_title_value": 16, "acc_descr": 17, "acc_descr_value": 18, "acc_descr_multiline_value": 19, "section": 20, "text": 21, "point_start": 22, "point_x": 23, "point_y": 24, "X-AXIS": 25, "AXIS-TEXT-DELIMITER": 26, "Y-AXIS": 27, "QUADRANT_1": 28, "QUADRANT_2": 29, "QUADRANT_3": 30, "QUADRANT_4": 31, "NEWLINE": 32, "SEMI": 33, "EOF": 34, "alphaNumToken": 35, "textNoTagsToken": 36, "STR": 37, "MD_STR": 38, "alphaNum": 39, "PUNCTUATION": 40, "AMP": 41, "NUM": 42, "ALPHA": 43, "COMMA": 44, "PLUS": 45, "EQUALS": 46, "MULT": 47, "DOT": 48, "BRKT": 49, "UNDERSCORE": 50, "MINUS": 51, "$accept": 0, "$end": 1 },
|
23 | terminals_: { 2: "error", 5: "SPACE", 6: "QUADRANT", 13: "title", 14: "title_value", 15: "acc_title", 16: "acc_title_value", 17: "acc_descr", 18: "acc_descr_value", 19: "acc_descr_multiline_value", 20: "section", 22: "point_start", 23: "point_x", 24: "point_y", 25: "X-AXIS", 26: "AXIS-TEXT-DELIMITER", 27: "Y-AXIS", 28: "QUADRANT_1", 29: "QUADRANT_2", 30: "QUADRANT_3", 31: "QUADRANT_4", 32: "NEWLINE", 33: "SEMI", 34: "EOF", 37: "STR", 38: "MD_STR", 40: "PUNCTUATION", 41: "AMP", 42: "NUM", 43: "ALPHA", 44: "COMMA", 45: "PLUS", 46: "EQUALS", 47: "MULT", 48: "DOT", 49: "BRKT", 50: "UNDERSCORE", 51: "MINUS" },
|
24 | productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [9, 0], [9, 2], [9, 1], [9, 1], [9, 1], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [12, 4], [10, 4], [10, 3], [10, 2], [10, 4], [10, 3], [10, 2], [11, 2], [11, 2], [11, 2], [11, 2], [4, 1], [4, 1], [4, 1], [21, 1], [21, 2], [21, 1], [21, 1], [39, 1], [39, 2], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [36, 1], [36, 1], [36, 1]],
|
25 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
|
26 | var $0 = $$.length - 1;
|
27 | switch (yystate) {
|
28 | case 12:
|
29 | this.$ = $$[$0].trim();
|
30 | yy.setDiagramTitle(this.$);
|
31 | break;
|
32 | case 13:
|
33 | this.$ = $$[$0].trim();
|
34 | yy.setAccTitle(this.$);
|
35 | break;
|
36 | case 14:
|
37 | case 15:
|
38 | this.$ = $$[$0].trim();
|
39 | yy.setAccDescription(this.$);
|
40 | break;
|
41 | case 16:
|
42 | yy.addSection($$[$0].substr(8));
|
43 | this.$ = $$[$0].substr(8);
|
44 | break;
|
45 | case 17:
|
46 | yy.addPoint($$[$0 - 3], $$[$0 - 1], $$[$0]);
|
47 | break;
|
48 | case 18:
|
49 | yy.setXAxisLeftText($$[$0 - 2]);
|
50 | yy.setXAxisRightText($$[$0]);
|
51 | break;
|
52 | case 19:
|
53 | $$[$0 - 1].text += " ⟶ ";
|
54 | yy.setXAxisLeftText($$[$0 - 1]);
|
55 | break;
|
56 | case 20:
|
57 | yy.setXAxisLeftText($$[$0]);
|
58 | break;
|
59 | case 21:
|
60 | yy.setYAxisBottomText($$[$0 - 2]);
|
61 | yy.setYAxisTopText($$[$0]);
|
62 | break;
|
63 | case 22:
|
64 | $$[$0 - 1].text += " ⟶ ";
|
65 | yy.setYAxisBottomText($$[$0 - 1]);
|
66 | break;
|
67 | case 23:
|
68 | yy.setYAxisBottomText($$[$0]);
|
69 | break;
|
70 | case 24:
|
71 | yy.setQuadrant1Text($$[$0]);
|
72 | break;
|
73 | case 25:
|
74 | yy.setQuadrant2Text($$[$0]);
|
75 | break;
|
76 | case 26:
|
77 | yy.setQuadrant3Text($$[$0]);
|
78 | break;
|
79 | case 27:
|
80 | yy.setQuadrant4Text($$[$0]);
|
81 | break;
|
82 | case 31:
|
83 | this.$ = { text: $$[$0], type: "text" };
|
84 | break;
|
85 | case 32:
|
86 | this.$ = { text: $$[$0 - 1].text + "" + $$[$0], type: $$[$0 - 1].type };
|
87 | break;
|
88 | case 33:
|
89 | this.$ = { text: $$[$0], type: "text" };
|
90 | break;
|
91 | case 34:
|
92 | this.$ = { text: $$[$0], type: "markdown" };
|
93 | break;
|
94 | case 35:
|
95 | this.$ = $$[$0];
|
96 | break;
|
97 | case 36:
|
98 | this.$ = $$[$0 - 1] + "" + $$[$0];
|
99 | break;
|
100 | }
|
101 | },
|
102 | table: [{ 3: 1, 4: 2, 5: $V0, 6: $V1, 32: $V2, 33: $V3, 34: $V4 }, { 1: [3] }, { 3: 8, 4: 2, 5: $V0, 6: $V1, 32: $V2, 33: $V3, 34: $V4 }, { 3: 9, 4: 2, 5: $V0, 6: $V1, 32: $V2, 33: $V3, 34: $V4 }, o($V5, [2, 4], { 7: 10 }), o($V6, [2, 28]), o($V6, [2, 29]), o($V6, [2, 30]), { 1: [2, 1] }, { 1: [2, 2] }, o($V7, $V8, { 8: 11, 9: 12, 10: 14, 11: 15, 12: 16, 21: 28, 35: 29, 1: [2, 3], 5: $V9, 13: $Va, 15: $Vb, 17: $Vc, 19: $Vd, 20: $Ve, 25: $Vf, 27: $Vg, 28: $Vh, 29: $Vi, 30: $Vj, 31: $Vk, 37: $Vl, 38: $Vm, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx }), o($V5, [2, 5]), { 4: 43, 32: $V2, 33: $V3, 34: $V4 }, o($V7, $V8, { 10: 14, 11: 15, 12: 16, 21: 28, 35: 29, 9: 44, 5: $V9, 13: $Va, 15: $Vb, 17: $Vc, 19: $Vd, 20: $Ve, 25: $Vf, 27: $Vg, 28: $Vh, 29: $Vi, 30: $Vj, 31: $Vk, 37: $Vl, 38: $Vm, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx }), o($V7, [2, 9]), o($V7, [2, 10]), o($V7, [2, 11]), { 14: [1, 45] }, { 16: [1, 46] }, { 18: [1, 47] }, o($V7, [2, 15]), o($V7, [2, 16]), { 21: 48, 35: 29, 37: $Vl, 38: $Vm, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx }, { 21: 49, 35: 29, 37: $Vl, 38: $Vm, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx }, { 21: 50, 35: 29, 37: $Vl, 38: $Vm, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx }, { 21: 51, 35: 29, 37: $Vl, 38: $Vm, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx }, { 21: 52, 35: 29, 37: $Vl, 38: $Vm, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx }, { 21: 53, 35: 29, 37: $Vl, 38: $Vm, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx }, { 5: $Vy, 22: [1, 54], 35: 56, 36: 55, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx, 51: $Vz }, o($VA, [2, 31]), o($VA, [2, 33]), o($VA, [2, 34]), o($VA, [2, 37]), o($VA, [2, 38]), o($VA, [2, 39]), o($VA, [2, 40]), o($VA, [2, 41]), o($VA, [2, 42]), o($VA, [2, 43]), o($VA, [2, 44]), o($VA, [2, 45]), o($VA, [2, 46]), o($VA, [2, 47]), o($V5, [2, 6]), o($V7, [2, 8]), o($V7, [2, 12]), o($V7, [2, 13]), o($V7, [2, 14]), o($V7, [2, 20], { 36: 55, 35: 56, 5: $Vy, 26: [1, 59], 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx, 51: $Vz }), o($V7, [2, 23], { 36: 55, 35: 56, 5: $Vy, 26: [1, 60], 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx, 51: $Vz }), o($V7, [2, 24], { 36: 55, 35: 56, 5: $Vy, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx, 51: $Vz }), o($V7, [2, 25], { 36: 55, 35: 56, 5: $Vy, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx, 51: $Vz }), o($V7, [2, 26], { 36: 55, 35: 56, 5: $Vy, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx, 51: $Vz }), o($V7, [2, 27], { 36: 55, 35: 56, 5: $Vy, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx, 51: $Vz }), { 23: [1, 61] }, o($VA, [2, 32]), o($VA, [2, 48]), o($VA, [2, 49]), o($VA, [2, 50]), o($V7, [2, 19], { 35: 29, 21: 62, 37: $Vl, 38: $Vm, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx }), o($V7, [2, 22], { 35: 29, 21: 63, 37: $Vl, 38: $Vm, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx }), { 24: [1, 64] }, o($V7, [2, 18], { 36: 55, 35: 56, 5: $Vy, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx, 51: $Vz }), o($V7, [2, 21], { 36: 55, 35: 56, 5: $Vy, 40: $Vn, 41: $Vo, 42: $Vp, 43: $Vq, 44: $Vr, 45: $Vs, 46: $Vt, 47: $Vu, 48: $Vv, 49: $Vw, 50: $Vx, 51: $Vz }), o($V7, [2, 17])],
|
103 | defaultActions: { 8: [2, 1], 9: [2, 2] },
|
104 | parseError: function parseError(str, hash) {
|
105 | if (hash.recoverable) {
|
106 | this.trace(str);
|
107 | } else {
|
108 | var error = new Error(str);
|
109 | error.hash = hash;
|
110 | throw error;
|
111 | }
|
112 | },
|
113 | parse: function parse(input) {
|
114 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
|
115 | var args = lstack.slice.call(arguments, 1);
|
116 | var lexer2 = Object.create(this.lexer);
|
117 | var sharedState = { yy: {} };
|
118 | for (var k in this.yy) {
|
119 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
120 | sharedState.yy[k] = this.yy[k];
|
121 | }
|
122 | }
|
123 | lexer2.setInput(input, sharedState.yy);
|
124 | sharedState.yy.lexer = lexer2;
|
125 | sharedState.yy.parser = this;
|
126 | if (typeof lexer2.yylloc == "undefined") {
|
127 | lexer2.yylloc = {};
|
128 | }
|
129 | var yyloc = lexer2.yylloc;
|
130 | lstack.push(yyloc);
|
131 | var ranges = lexer2.options && lexer2.options.ranges;
|
132 | if (typeof sharedState.yy.parseError === "function") {
|
133 | this.parseError = sharedState.yy.parseError;
|
134 | } else {
|
135 | this.parseError = Object.getPrototypeOf(this).parseError;
|
136 | }
|
137 | function lex() {
|
138 | var token;
|
139 | token = tstack.pop() || lexer2.lex() || EOF;
|
140 | if (typeof token !== "number") {
|
141 | if (token instanceof Array) {
|
142 | tstack = token;
|
143 | token = tstack.pop();
|
144 | }
|
145 | token = self.symbols_[token] || token;
|
146 | }
|
147 | return token;
|
148 | }
|
149 | var symbol, state, action, r, yyval = {}, p, len, newState, expected;
|
150 | while (true) {
|
151 | state = stack[stack.length - 1];
|
152 | if (this.defaultActions[state]) {
|
153 | action = this.defaultActions[state];
|
154 | } else {
|
155 | if (symbol === null || typeof symbol == "undefined") {
|
156 | symbol = lex();
|
157 | }
|
158 | action = table[state] && table[state][symbol];
|
159 | }
|
160 | if (typeof action === "undefined" || !action.length || !action[0]) {
|
161 | var errStr = "";
|
162 | expected = [];
|
163 | for (p in table[state]) {
|
164 | if (this.terminals_[p] && p > TERROR) {
|
165 | expected.push("'" + this.terminals_[p] + "'");
|
166 | }
|
167 | }
|
168 | if (lexer2.showPosition) {
|
169 | errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
|
170 | } else {
|
171 | errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
|
172 | }
|
173 | this.parseError(errStr, {
|
174 | text: lexer2.match,
|
175 | token: this.terminals_[symbol] || symbol,
|
176 | line: lexer2.yylineno,
|
177 | loc: yyloc,
|
178 | expected
|
179 | });
|
180 | }
|
181 | if (action[0] instanceof Array && action.length > 1) {
|
182 | throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
|
183 | }
|
184 | switch (action[0]) {
|
185 | case 1:
|
186 | stack.push(symbol);
|
187 | vstack.push(lexer2.yytext);
|
188 | lstack.push(lexer2.yylloc);
|
189 | stack.push(action[1]);
|
190 | symbol = null;
|
191 | {
|
192 | yyleng = lexer2.yyleng;
|
193 | yytext = lexer2.yytext;
|
194 | yylineno = lexer2.yylineno;
|
195 | yyloc = lexer2.yylloc;
|
196 | }
|
197 | break;
|
198 | case 2:
|
199 | len = this.productions_[action[1]][1];
|
200 | yyval.$ = vstack[vstack.length - len];
|
201 | yyval._$ = {
|
202 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
203 | last_line: lstack[lstack.length - 1].last_line,
|
204 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
205 | last_column: lstack[lstack.length - 1].last_column
|
206 | };
|
207 | if (ranges) {
|
208 | yyval._$.range = [
|
209 | lstack[lstack.length - (len || 1)].range[0],
|
210 | lstack[lstack.length - 1].range[1]
|
211 | ];
|
212 | }
|
213 | r = this.performAction.apply(yyval, [
|
214 | yytext,
|
215 | yyleng,
|
216 | yylineno,
|
217 | sharedState.yy,
|
218 | action[1],
|
219 | vstack,
|
220 | lstack
|
221 | ].concat(args));
|
222 | if (typeof r !== "undefined") {
|
223 | return r;
|
224 | }
|
225 | if (len) {
|
226 | stack = stack.slice(0, -1 * len * 2);
|
227 | vstack = vstack.slice(0, -1 * len);
|
228 | lstack = lstack.slice(0, -1 * len);
|
229 | }
|
230 | stack.push(this.productions_[action[1]][0]);
|
231 | vstack.push(yyval.$);
|
232 | lstack.push(yyval._$);
|
233 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
234 | stack.push(newState);
|
235 | break;
|
236 | case 3:
|
237 | return true;
|
238 | }
|
239 | }
|
240 | return true;
|
241 | }
|
242 | };
|
243 | var lexer = function() {
|
244 | var lexer2 = {
|
245 | EOF: 1,
|
246 | parseError: function parseError(str, hash) {
|
247 | if (this.yy.parser) {
|
248 | this.yy.parser.parseError(str, hash);
|
249 | } else {
|
250 | throw new Error(str);
|
251 | }
|
252 | },
|
253 |
|
254 | setInput: function(input, yy) {
|
255 | this.yy = yy || this.yy || {};
|
256 | this._input = input;
|
257 | this._more = this._backtrack = this.done = false;
|
258 | this.yylineno = this.yyleng = 0;
|
259 | this.yytext = this.matched = this.match = "";
|
260 | this.conditionStack = ["INITIAL"];
|
261 | this.yylloc = {
|
262 | first_line: 1,
|
263 | first_column: 0,
|
264 | last_line: 1,
|
265 | last_column: 0
|
266 | };
|
267 | if (this.options.ranges) {
|
268 | this.yylloc.range = [0, 0];
|
269 | }
|
270 | this.offset = 0;
|
271 | return this;
|
272 | },
|
273 |
|
274 | input: function() {
|
275 | var ch = this._input[0];
|
276 | this.yytext += ch;
|
277 | this.yyleng++;
|
278 | this.offset++;
|
279 | this.match += ch;
|
280 | this.matched += ch;
|
281 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
282 | if (lines) {
|
283 | this.yylineno++;
|
284 | this.yylloc.last_line++;
|
285 | } else {
|
286 | this.yylloc.last_column++;
|
287 | }
|
288 | if (this.options.ranges) {
|
289 | this.yylloc.range[1]++;
|
290 | }
|
291 | this._input = this._input.slice(1);
|
292 | return ch;
|
293 | },
|
294 |
|
295 | unput: function(ch) {
|
296 | var len = ch.length;
|
297 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
298 | this._input = ch + this._input;
|
299 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
300 | this.offset -= len;
|
301 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
302 | this.match = this.match.substr(0, this.match.length - 1);
|
303 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
304 | if (lines.length - 1) {
|
305 | this.yylineno -= lines.length - 1;
|
306 | }
|
307 | var r = this.yylloc.range;
|
308 | this.yylloc = {
|
309 | first_line: this.yylloc.first_line,
|
310 | last_line: this.yylineno + 1,
|
311 | first_column: this.yylloc.first_column,
|
312 | last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
|
313 | };
|
314 | if (this.options.ranges) {
|
315 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
316 | }
|
317 | this.yyleng = this.yytext.length;
|
318 | return this;
|
319 | },
|
320 |
|
321 | more: function() {
|
322 | this._more = true;
|
323 | return this;
|
324 | },
|
325 |
|
326 | reject: function() {
|
327 | if (this.options.backtrack_lexer) {
|
328 | this._backtrack = true;
|
329 | } else {
|
330 | 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).\n" + this.showPosition(), {
|
331 | text: "",
|
332 | token: null,
|
333 | line: this.yylineno
|
334 | });
|
335 | }
|
336 | return this;
|
337 | },
|
338 |
|
339 | less: function(n) {
|
340 | this.unput(this.match.slice(n));
|
341 | },
|
342 |
|
343 | pastInput: function() {
|
344 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
345 | return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
|
346 | },
|
347 |
|
348 | upcomingInput: function() {
|
349 | var next = this.match;
|
350 | if (next.length < 20) {
|
351 | next += this._input.substr(0, 20 - next.length);
|
352 | }
|
353 | return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
|
354 | },
|
355 |
|
356 | showPosition: function() {
|
357 | var pre = this.pastInput();
|
358 | var c = new Array(pre.length + 1).join("-");
|
359 | return pre + this.upcomingInput() + "\n" + c + "^";
|
360 | },
|
361 |
|
362 | test_match: function(match, indexed_rule) {
|
363 | var token, lines, backup;
|
364 | if (this.options.backtrack_lexer) {
|
365 | backup = {
|
366 | yylineno: this.yylineno,
|
367 | yylloc: {
|
368 | first_line: this.yylloc.first_line,
|
369 | last_line: this.last_line,
|
370 | first_column: this.yylloc.first_column,
|
371 | last_column: this.yylloc.last_column
|
372 | },
|
373 | yytext: this.yytext,
|
374 | match: this.match,
|
375 | matches: this.matches,
|
376 | matched: this.matched,
|
377 | yyleng: this.yyleng,
|
378 | offset: this.offset,
|
379 | _more: this._more,
|
380 | _input: this._input,
|
381 | yy: this.yy,
|
382 | conditionStack: this.conditionStack.slice(0),
|
383 | done: this.done
|
384 | };
|
385 | if (this.options.ranges) {
|
386 | backup.yylloc.range = this.yylloc.range.slice(0);
|
387 | }
|
388 | }
|
389 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
390 | if (lines) {
|
391 | this.yylineno += lines.length;
|
392 | }
|
393 | this.yylloc = {
|
394 | first_line: this.yylloc.last_line,
|
395 | last_line: this.yylineno + 1,
|
396 | first_column: this.yylloc.last_column,
|
397 | last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
|
398 | };
|
399 | this.yytext += match[0];
|
400 | this.match += match[0];
|
401 | this.matches = match;
|
402 | this.yyleng = this.yytext.length;
|
403 | if (this.options.ranges) {
|
404 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
405 | }
|
406 | this._more = false;
|
407 | this._backtrack = false;
|
408 | this._input = this._input.slice(match[0].length);
|
409 | this.matched += match[0];
|
410 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
411 | if (this.done && this._input) {
|
412 | this.done = false;
|
413 | }
|
414 | if (token) {
|
415 | return token;
|
416 | } else if (this._backtrack) {
|
417 | for (var k in backup) {
|
418 | this[k] = backup[k];
|
419 | }
|
420 | return false;
|
421 | }
|
422 | return false;
|
423 | },
|
424 |
|
425 | next: function() {
|
426 | if (this.done) {
|
427 | return this.EOF;
|
428 | }
|
429 | if (!this._input) {
|
430 | this.done = true;
|
431 | }
|
432 | var token, match, tempMatch, index;
|
433 | if (!this._more) {
|
434 | this.yytext = "";
|
435 | this.match = "";
|
436 | }
|
437 | var rules = this._currentRules();
|
438 | for (var i = 0; i < rules.length; i++) {
|
439 | tempMatch = this._input.match(this.rules[rules[i]]);
|
440 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
441 | match = tempMatch;
|
442 | index = i;
|
443 | if (this.options.backtrack_lexer) {
|
444 | token = this.test_match(tempMatch, rules[i]);
|
445 | if (token !== false) {
|
446 | return token;
|
447 | } else if (this._backtrack) {
|
448 | match = false;
|
449 | continue;
|
450 | } else {
|
451 | return false;
|
452 | }
|
453 | } else if (!this.options.flex) {
|
454 | break;
|
455 | }
|
456 | }
|
457 | }
|
458 | if (match) {
|
459 | token = this.test_match(match, rules[index]);
|
460 | if (token !== false) {
|
461 | return token;
|
462 | }
|
463 | return false;
|
464 | }
|
465 | if (this._input === "") {
|
466 | return this.EOF;
|
467 | } else {
|
468 | return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
|
469 | text: "",
|
470 | token: null,
|
471 | line: this.yylineno
|
472 | });
|
473 | }
|
474 | },
|
475 |
|
476 | lex: function lex() {
|
477 | var r = this.next();
|
478 | if (r) {
|
479 | return r;
|
480 | } else {
|
481 | return this.lex();
|
482 | }
|
483 | },
|
484 |
|
485 | begin: function begin(condition) {
|
486 | this.conditionStack.push(condition);
|
487 | },
|
488 |
|
489 | popState: function popState() {
|
490 | var n = this.conditionStack.length - 1;
|
491 | if (n > 0) {
|
492 | return this.conditionStack.pop();
|
493 | } else {
|
494 | return this.conditionStack[0];
|
495 | }
|
496 | },
|
497 |
|
498 | _currentRules: function _currentRules() {
|
499 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
500 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
501 | } else {
|
502 | return this.conditions["INITIAL"].rules;
|
503 | }
|
504 | },
|
505 |
|
506 | topState: function topState(n) {
|
507 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
508 | if (n >= 0) {
|
509 | return this.conditionStack[n];
|
510 | } else {
|
511 | return "INITIAL";
|
512 | }
|
513 | },
|
514 |
|
515 | pushState: function pushState(condition) {
|
516 | this.begin(condition);
|
517 | },
|
518 |
|
519 | stateStackSize: function stateStackSize() {
|
520 | return this.conditionStack.length;
|
521 | },
|
522 | options: { "case-insensitive": true },
|
523 | performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
|
524 | switch ($avoiding_name_collisions) {
|
525 | case 0:
|
526 | break;
|
527 | case 1:
|
528 | break;
|
529 | case 2:
|
530 | return 32;
|
531 | case 3:
|
532 | break;
|
533 | case 4:
|
534 | this.begin("title");
|
535 | return 13;
|
536 | case 5:
|
537 | this.popState();
|
538 | return "title_value";
|
539 | case 6:
|
540 | this.begin("acc_title");
|
541 | return 15;
|
542 | case 7:
|
543 | this.popState();
|
544 | return "acc_title_value";
|
545 | case 8:
|
546 | this.begin("acc_descr");
|
547 | return 17;
|
548 | case 9:
|
549 | this.popState();
|
550 | return "acc_descr_value";
|
551 | case 10:
|
552 | this.begin("acc_descr_multiline");
|
553 | break;
|
554 | case 11:
|
555 | this.popState();
|
556 | break;
|
557 | case 12:
|
558 | return "acc_descr_multiline_value";
|
559 | case 13:
|
560 | return 25;
|
561 | case 14:
|
562 | return 27;
|
563 | case 15:
|
564 | return 26;
|
565 | case 16:
|
566 | return 28;
|
567 | case 17:
|
568 | return 29;
|
569 | case 18:
|
570 | return 30;
|
571 | case 19:
|
572 | return 31;
|
573 | case 20:
|
574 | this.begin("md_string");
|
575 | break;
|
576 | case 21:
|
577 | return "MD_STR";
|
578 | case 22:
|
579 | this.popState();
|
580 | break;
|
581 | case 23:
|
582 | this.begin("string");
|
583 | break;
|
584 | case 24:
|
585 | this.popState();
|
586 | break;
|
587 | case 25:
|
588 | return "STR";
|
589 | case 26:
|
590 | this.begin("point_start");
|
591 | return 22;
|
592 | case 27:
|
593 | this.begin("point_x");
|
594 | return 23;
|
595 | case 28:
|
596 | this.popState();
|
597 | break;
|
598 | case 29:
|
599 | this.popState();
|
600 | this.begin("point_y");
|
601 | break;
|
602 | case 30:
|
603 | this.popState();
|
604 | return 24;
|
605 | case 31:
|
606 | return 6;
|
607 | case 32:
|
608 | return 43;
|
609 | case 33:
|
610 | return "COLON";
|
611 | case 34:
|
612 | return 45;
|
613 | case 35:
|
614 | return 44;
|
615 | case 36:
|
616 | return 46;
|
617 | case 37:
|
618 | return 46;
|
619 | case 38:
|
620 | return 47;
|
621 | case 39:
|
622 | return 49;
|
623 | case 40:
|
624 | return 50;
|
625 | case 41:
|
626 | return 48;
|
627 | case 42:
|
628 | return 41;
|
629 | case 43:
|
630 | return 51;
|
631 | case 44:
|
632 | return 42;
|
633 | case 45:
|
634 | return 5;
|
635 | case 46:
|
636 | return 33;
|
637 | case 47:
|
638 | return 40;
|
639 | case 48:
|
640 | return 34;
|
641 | }
|
642 | },
|
643 | 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, /^(?:["][`])/i, /^(?:[^`"]+)/i, /^(?:[`]["])/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/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],
|
644 | conditions: { "point_y": { "rules": [30], "inclusive": false }, "point_x": { "rules": [29], "inclusive": false }, "point_start": { "rules": [27, 28], "inclusive": false }, "acc_descr_multiline": { "rules": [11, 12], "inclusive": false }, "acc_descr": { "rules": [9], "inclusive": false }, "acc_title": { "rules": [7], "inclusive": false }, "title": { "rules": [5], "inclusive": false }, "md_string": { "rules": [21, 22], "inclusive": false }, "string": { "rules": [24, 25], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 23, 26, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48], "inclusive": true } }
|
645 | };
|
646 | return lexer2;
|
647 | }();
|
648 | parser2.lexer = lexer;
|
649 | function Parser() {
|
650 | this.yy = {};
|
651 | }
|
652 | Parser.prototype = parser2;
|
653 | parser2.Parser = Parser;
|
654 | return new Parser();
|
655 | }();
|
656 | parser.parser = parser;
|
657 | const parser$1 = parser;
|
658 | const defaultThemeVariables = getThemeVariables();
|
659 | class QuadrantBuilder {
|
660 | constructor() {
|
661 | this.config = this.getDefaultConfig();
|
662 | this.themeConfig = this.getDefaultThemeConfig();
|
663 | this.data = this.getDefaultData();
|
664 | }
|
665 | getDefaultData() {
|
666 | return {
|
667 | titleText: "",
|
668 | quadrant1Text: "",
|
669 | quadrant2Text: "",
|
670 | quadrant3Text: "",
|
671 | quadrant4Text: "",
|
672 | xAxisLeftText: "",
|
673 | xAxisRightText: "",
|
674 | yAxisBottomText: "",
|
675 | yAxisTopText: "",
|
676 | points: []
|
677 | };
|
678 | }
|
679 | getDefaultConfig() {
|
680 | var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
681 | return {
|
682 | showXAxis: true,
|
683 | showYAxis: true,
|
684 | showTitle: true,
|
685 | chartHeight: ((_a = defaultConfig.quadrantChart) == null ? void 0 : _a.chartWidth) || 500,
|
686 | chartWidth: ((_b = defaultConfig.quadrantChart) == null ? void 0 : _b.chartHeight) || 500,
|
687 | titlePadding: ((_c = defaultConfig.quadrantChart) == null ? void 0 : _c.titlePadding) || 10,
|
688 | titleFontSize: ((_d = defaultConfig.quadrantChart) == null ? void 0 : _d.titleFontSize) || 20,
|
689 | quadrantPadding: ((_e = defaultConfig.quadrantChart) == null ? void 0 : _e.quadrantPadding) || 5,
|
690 | xAxisLabelPadding: ((_f = defaultConfig.quadrantChart) == null ? void 0 : _f.xAxisLabelPadding) || 5,
|
691 | yAxisLabelPadding: ((_g = defaultConfig.quadrantChart) == null ? void 0 : _g.yAxisLabelPadding) || 5,
|
692 | xAxisLabelFontSize: ((_h = defaultConfig.quadrantChart) == null ? void 0 : _h.xAxisLabelFontSize) || 16,
|
693 | yAxisLabelFontSize: ((_i = defaultConfig.quadrantChart) == null ? void 0 : _i.yAxisLabelFontSize) || 16,
|
694 | quadrantLabelFontSize: ((_j = defaultConfig.quadrantChart) == null ? void 0 : _j.quadrantLabelFontSize) || 16,
|
695 | quadrantTextTopPadding: ((_k = defaultConfig.quadrantChart) == null ? void 0 : _k.quadrantTextTopPadding) || 5,
|
696 | pointTextPadding: ((_l = defaultConfig.quadrantChart) == null ? void 0 : _l.pointTextPadding) || 5,
|
697 | pointLabelFontSize: ((_m = defaultConfig.quadrantChart) == null ? void 0 : _m.pointLabelFontSize) || 12,
|
698 | pointRadius: ((_n = defaultConfig.quadrantChart) == null ? void 0 : _n.pointRadius) || 5,
|
699 | xAxisPosition: ((_o = defaultConfig.quadrantChart) == null ? void 0 : _o.xAxisPosition) || "top",
|
700 | yAxisPosition: ((_p = defaultConfig.quadrantChart) == null ? void 0 : _p.yAxisPosition) || "left",
|
701 | quadrantInternalBorderStrokeWidth: ((_q = defaultConfig.quadrantChart) == null ? void 0 : _q.quadrantInternalBorderStrokeWidth) || 1,
|
702 | quadrantExternalBorderStrokeWidth: ((_r = defaultConfig.quadrantChart) == null ? void 0 : _r.quadrantExternalBorderStrokeWidth) || 2
|
703 | };
|
704 | }
|
705 | getDefaultThemeConfig() {
|
706 | return {
|
707 | quadrant1Fill: defaultThemeVariables.quadrant1Fill,
|
708 | quadrant2Fill: defaultThemeVariables.quadrant2Fill,
|
709 | quadrant3Fill: defaultThemeVariables.quadrant3Fill,
|
710 | quadrant4Fill: defaultThemeVariables.quadrant4Fill,
|
711 | quadrant1TextFill: defaultThemeVariables.quadrant1TextFill,
|
712 | quadrant2TextFill: defaultThemeVariables.quadrant2TextFill,
|
713 | quadrant3TextFill: defaultThemeVariables.quadrant3TextFill,
|
714 | quadrant4TextFill: defaultThemeVariables.quadrant4TextFill,
|
715 | quadrantPointFill: defaultThemeVariables.quadrantPointFill,
|
716 | quadrantPointTextFill: defaultThemeVariables.quadrantPointTextFill,
|
717 | quadrantXAxisTextFill: defaultThemeVariables.quadrantXAxisTextFill,
|
718 | quadrantYAxisTextFill: defaultThemeVariables.quadrantYAxisTextFill,
|
719 | quadrantTitleFill: defaultThemeVariables.quadrantTitleFill,
|
720 | quadrantInternalBorderStrokeFill: defaultThemeVariables.quadrantInternalBorderStrokeFill,
|
721 | quadrantExternalBorderStrokeFill: defaultThemeVariables.quadrantExternalBorderStrokeFill
|
722 | };
|
723 | }
|
724 | clear() {
|
725 | this.config = this.getDefaultConfig();
|
726 | this.themeConfig = this.getDefaultThemeConfig();
|
727 | this.data = this.getDefaultData();
|
728 | log.info("clear called");
|
729 | }
|
730 | setData(data) {
|
731 | this.data = { ...this.data, ...data };
|
732 | }
|
733 | addPoints(points) {
|
734 | this.data.points = [...points, ...this.data.points];
|
735 | }
|
736 | setConfig(config2) {
|
737 | log.trace("setConfig called with: ", config2);
|
738 | this.config = { ...this.config, ...config2 };
|
739 | }
|
740 | setThemeConfig(themeConfig) {
|
741 | log.trace("setThemeConfig called with: ", themeConfig);
|
742 | this.themeConfig = { ...this.themeConfig, ...themeConfig };
|
743 | }
|
744 | calculateSpace(xAxisPosition, showXAxis, showYAxis, showTitle) {
|
745 | const xAxisSpaceCalculation = this.config.xAxisLabelPadding * 2 + this.config.xAxisLabelFontSize;
|
746 | const xAxisSpace = {
|
747 | top: xAxisPosition === "top" && showXAxis ? xAxisSpaceCalculation : 0,
|
748 | bottom: xAxisPosition === "bottom" && showXAxis ? xAxisSpaceCalculation : 0
|
749 | };
|
750 | const yAxisSpaceCalculation = this.config.yAxisLabelPadding * 2 + this.config.yAxisLabelFontSize;
|
751 | const yAxisSpace = {
|
752 | left: this.config.yAxisPosition === "left" && showYAxis ? yAxisSpaceCalculation : 0,
|
753 | right: this.config.yAxisPosition === "right" && showYAxis ? yAxisSpaceCalculation : 0
|
754 | };
|
755 | const titleSpaceCalculation = this.config.titleFontSize + this.config.titlePadding * 2;
|
756 | const titleSpace = {
|
757 | top: showTitle ? titleSpaceCalculation : 0
|
758 | };
|
759 | const quadrantLeft = this.config.quadrantPadding + yAxisSpace.left;
|
760 | const quadrantTop = this.config.quadrantPadding + xAxisSpace.top + titleSpace.top;
|
761 | const quadrantWidth = this.config.chartWidth - this.config.quadrantPadding * 2 - yAxisSpace.left - yAxisSpace.right;
|
762 | const quadrantHeight = this.config.chartHeight - this.config.quadrantPadding * 2 - xAxisSpace.top - xAxisSpace.bottom - titleSpace.top;
|
763 | const quadrantHalfWidth = quadrantWidth / 2;
|
764 | const quadrantHalfHeight = quadrantHeight / 2;
|
765 | const quadrantSpace = {
|
766 | quadrantLeft,
|
767 | quadrantTop,
|
768 | quadrantWidth,
|
769 | quadrantHalfWidth,
|
770 | quadrantHeight,
|
771 | quadrantHalfHeight
|
772 | };
|
773 | return {
|
774 | xAxisSpace,
|
775 | yAxisSpace,
|
776 | titleSpace,
|
777 | quadrantSpace
|
778 | };
|
779 | }
|
780 | getAxisLabels(xAxisPosition, showXAxis, showYAxis, spaceData) {
|
781 | const { quadrantSpace, titleSpace } = spaceData;
|
782 | const {
|
783 | quadrantHalfHeight,
|
784 | quadrantHeight,
|
785 | quadrantLeft,
|
786 | quadrantHalfWidth,
|
787 | quadrantTop,
|
788 | quadrantWidth
|
789 | } = quadrantSpace;
|
790 | const drawXAxisLabelsInMiddle = Boolean(this.data.xAxisRightText);
|
791 | const drawYAxisLabelsInMiddle = Boolean(this.data.yAxisTopText);
|
792 | const axisLabels = [];
|
793 | if (this.data.xAxisLeftText && showXAxis) {
|
794 | axisLabels.push({
|
795 | text: this.data.xAxisLeftText,
|
796 | fill: this.themeConfig.quadrantXAxisTextFill,
|
797 | x: quadrantLeft + (drawXAxisLabelsInMiddle ? quadrantHalfWidth / 2 : 0),
|
798 | y: xAxisPosition === "top" ? this.config.xAxisLabelPadding + titleSpace.top : this.config.xAxisLabelPadding + quadrantTop + quadrantHeight + this.config.quadrantPadding,
|
799 | fontSize: this.config.xAxisLabelFontSize,
|
800 | verticalPos: drawXAxisLabelsInMiddle ? "center" : "left",
|
801 | horizontalPos: "top",
|
802 | rotation: 0
|
803 | });
|
804 | }
|
805 | if (this.data.xAxisRightText && showXAxis) {
|
806 | axisLabels.push({
|
807 | text: this.data.xAxisRightText,
|
808 | fill: this.themeConfig.quadrantXAxisTextFill,
|
809 | x: quadrantLeft + quadrantHalfWidth + (drawXAxisLabelsInMiddle ? quadrantHalfWidth / 2 : 0),
|
810 | y: xAxisPosition === "top" ? this.config.xAxisLabelPadding + titleSpace.top : this.config.xAxisLabelPadding + quadrantTop + quadrantHeight + this.config.quadrantPadding,
|
811 | fontSize: this.config.xAxisLabelFontSize,
|
812 | verticalPos: drawXAxisLabelsInMiddle ? "center" : "left",
|
813 | horizontalPos: "top",
|
814 | rotation: 0
|
815 | });
|
816 | }
|
817 | if (this.data.yAxisBottomText && showYAxis) {
|
818 | axisLabels.push({
|
819 | text: this.data.yAxisBottomText,
|
820 | fill: this.themeConfig.quadrantYAxisTextFill,
|
821 | x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + quadrantLeft + quadrantWidth + this.config.quadrantPadding,
|
822 | y: quadrantTop + quadrantHeight - (drawYAxisLabelsInMiddle ? quadrantHalfHeight / 2 : 0),
|
823 | fontSize: this.config.yAxisLabelFontSize,
|
824 | verticalPos: drawYAxisLabelsInMiddle ? "center" : "left",
|
825 | horizontalPos: "top",
|
826 | rotation: -90
|
827 | });
|
828 | }
|
829 | if (this.data.yAxisTopText && showYAxis) {
|
830 | axisLabels.push({
|
831 | text: this.data.yAxisTopText,
|
832 | fill: this.themeConfig.quadrantYAxisTextFill,
|
833 | x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + quadrantLeft + quadrantWidth + this.config.quadrantPadding,
|
834 | y: quadrantTop + quadrantHalfHeight - (drawYAxisLabelsInMiddle ? quadrantHalfHeight / 2 : 0),
|
835 | fontSize: this.config.yAxisLabelFontSize,
|
836 | verticalPos: drawYAxisLabelsInMiddle ? "center" : "left",
|
837 | horizontalPos: "top",
|
838 | rotation: -90
|
839 | });
|
840 | }
|
841 | return axisLabels;
|
842 | }
|
843 | getQuadrants(spaceData) {
|
844 | const { quadrantSpace } = spaceData;
|
845 | const { quadrantHalfHeight, quadrantLeft, quadrantHalfWidth, quadrantTop } = quadrantSpace;
|
846 | const quadrants = [
|
847 | {
|
848 | text: {
|
849 | text: this.data.quadrant1Text,
|
850 | fill: this.themeConfig.quadrant1TextFill,
|
851 | x: 0,
|
852 | y: 0,
|
853 | fontSize: this.config.quadrantLabelFontSize,
|
854 | verticalPos: "center",
|
855 | horizontalPos: "middle",
|
856 | rotation: 0
|
857 | },
|
858 | x: quadrantLeft + quadrantHalfWidth,
|
859 | y: quadrantTop,
|
860 | width: quadrantHalfWidth,
|
861 | height: quadrantHalfHeight,
|
862 | fill: this.themeConfig.quadrant1Fill
|
863 | },
|
864 | {
|
865 | text: {
|
866 | text: this.data.quadrant2Text,
|
867 | fill: this.themeConfig.quadrant2TextFill,
|
868 | x: 0,
|
869 | y: 0,
|
870 | fontSize: this.config.quadrantLabelFontSize,
|
871 | verticalPos: "center",
|
872 | horizontalPos: "middle",
|
873 | rotation: 0
|
874 | },
|
875 | x: quadrantLeft,
|
876 | y: quadrantTop,
|
877 | width: quadrantHalfWidth,
|
878 | height: quadrantHalfHeight,
|
879 | fill: this.themeConfig.quadrant2Fill
|
880 | },
|
881 | {
|
882 | text: {
|
883 | text: this.data.quadrant3Text,
|
884 | fill: this.themeConfig.quadrant3TextFill,
|
885 | x: 0,
|
886 | y: 0,
|
887 | fontSize: this.config.quadrantLabelFontSize,
|
888 | verticalPos: "center",
|
889 | horizontalPos: "middle",
|
890 | rotation: 0
|
891 | },
|
892 | x: quadrantLeft,
|
893 | y: quadrantTop + quadrantHalfHeight,
|
894 | width: quadrantHalfWidth,
|
895 | height: quadrantHalfHeight,
|
896 | fill: this.themeConfig.quadrant3Fill
|
897 | },
|
898 | {
|
899 | text: {
|
900 | text: this.data.quadrant4Text,
|
901 | fill: this.themeConfig.quadrant4TextFill,
|
902 | x: 0,
|
903 | y: 0,
|
904 | fontSize: this.config.quadrantLabelFontSize,
|
905 | verticalPos: "center",
|
906 | horizontalPos: "middle",
|
907 | rotation: 0
|
908 | },
|
909 | x: quadrantLeft + quadrantHalfWidth,
|
910 | y: quadrantTop + quadrantHalfHeight,
|
911 | width: quadrantHalfWidth,
|
912 | height: quadrantHalfHeight,
|
913 | fill: this.themeConfig.quadrant4Fill
|
914 | }
|
915 | ];
|
916 | for (const quadrant of quadrants) {
|
917 | quadrant.text.x = quadrant.x + quadrant.width / 2;
|
918 | if (this.data.points.length === 0) {
|
919 | quadrant.text.y = quadrant.y + quadrant.height / 2;
|
920 | quadrant.text.horizontalPos = "middle";
|
921 | } else {
|
922 | quadrant.text.y = quadrant.y + this.config.quadrantTextTopPadding;
|
923 | quadrant.text.horizontalPos = "top";
|
924 | }
|
925 | }
|
926 | return quadrants;
|
927 | }
|
928 | getQuadrantPoints(spaceData) {
|
929 | const { quadrantSpace } = spaceData;
|
930 | const { quadrantHeight, quadrantLeft, quadrantTop, quadrantWidth } = quadrantSpace;
|
931 | const xAxis = scaleLinear().domain([0, 1]).range([quadrantLeft, quadrantWidth + quadrantLeft]);
|
932 | const yAxis = scaleLinear().domain([0, 1]).range([quadrantHeight + quadrantTop, quadrantTop]);
|
933 | const points = this.data.points.map((point) => {
|
934 | const props = {
|
935 | x: xAxis(point.x),
|
936 | y: yAxis(point.y),
|
937 | fill: this.themeConfig.quadrantPointFill,
|
938 | radius: this.config.pointRadius,
|
939 | text: {
|
940 | text: point.text,
|
941 | fill: this.themeConfig.quadrantPointTextFill,
|
942 | x: xAxis(point.x),
|
943 | y: yAxis(point.y) + this.config.pointTextPadding,
|
944 | verticalPos: "center",
|
945 | horizontalPos: "top",
|
946 | fontSize: this.config.pointLabelFontSize,
|
947 | rotation: 0
|
948 | }
|
949 | };
|
950 | return props;
|
951 | });
|
952 | return points;
|
953 | }
|
954 | getBorders(spaceData) {
|
955 | const halfExternalBorderWidth = this.config.quadrantExternalBorderStrokeWidth / 2;
|
956 | const { quadrantSpace } = spaceData;
|
957 | const {
|
958 | quadrantHalfHeight,
|
959 | quadrantHeight,
|
960 | quadrantLeft,
|
961 | quadrantHalfWidth,
|
962 | quadrantTop,
|
963 | quadrantWidth
|
964 | } = quadrantSpace;
|
965 | const borderLines = [
|
966 |
|
967 | {
|
968 | strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
|
969 | strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
|
970 | x1: quadrantLeft - halfExternalBorderWidth,
|
971 | y1: quadrantTop,
|
972 | x2: quadrantLeft + quadrantWidth + halfExternalBorderWidth,
|
973 | y2: quadrantTop
|
974 | },
|
975 |
|
976 | {
|
977 | strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
|
978 | strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
|
979 | x1: quadrantLeft + quadrantWidth,
|
980 | y1: quadrantTop + halfExternalBorderWidth,
|
981 | x2: quadrantLeft + quadrantWidth,
|
982 | y2: quadrantTop + quadrantHeight - halfExternalBorderWidth
|
983 | },
|
984 |
|
985 | {
|
986 | strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
|
987 | strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
|
988 | x1: quadrantLeft - halfExternalBorderWidth,
|
989 | y1: quadrantTop + quadrantHeight,
|
990 | x2: quadrantLeft + quadrantWidth + halfExternalBorderWidth,
|
991 | y2: quadrantTop + quadrantHeight
|
992 | },
|
993 |
|
994 | {
|
995 | strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
|
996 | strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
|
997 | x1: quadrantLeft,
|
998 | y1: quadrantTop + halfExternalBorderWidth,
|
999 | x2: quadrantLeft,
|
1000 | y2: quadrantTop + quadrantHeight - halfExternalBorderWidth
|
1001 | },
|
1002 |
|
1003 | {
|
1004 | strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill,
|
1005 | strokeWidth: this.config.quadrantInternalBorderStrokeWidth,
|
1006 | x1: quadrantLeft + quadrantHalfWidth,
|
1007 | y1: quadrantTop + halfExternalBorderWidth,
|
1008 | x2: quadrantLeft + quadrantHalfWidth,
|
1009 | y2: quadrantTop + quadrantHeight - halfExternalBorderWidth
|
1010 | },
|
1011 |
|
1012 | {
|
1013 | strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill,
|
1014 | strokeWidth: this.config.quadrantInternalBorderStrokeWidth,
|
1015 | x1: quadrantLeft + halfExternalBorderWidth,
|
1016 | y1: quadrantTop + quadrantHalfHeight,
|
1017 | x2: quadrantLeft + quadrantWidth - halfExternalBorderWidth,
|
1018 | y2: quadrantTop + quadrantHalfHeight
|
1019 | }
|
1020 | ];
|
1021 | return borderLines;
|
1022 | }
|
1023 | getTitle(showTitle) {
|
1024 | if (showTitle) {
|
1025 | return {
|
1026 | text: this.data.titleText,
|
1027 | fill: this.themeConfig.quadrantTitleFill,
|
1028 | fontSize: this.config.titleFontSize,
|
1029 | horizontalPos: "top",
|
1030 | verticalPos: "center",
|
1031 | rotation: 0,
|
1032 | y: this.config.titlePadding,
|
1033 | x: this.config.chartWidth / 2
|
1034 | };
|
1035 | }
|
1036 | return;
|
1037 | }
|
1038 | build() {
|
1039 | const showXAxis = this.config.showXAxis && !!(this.data.xAxisLeftText || this.data.xAxisRightText);
|
1040 | const showYAxis = this.config.showYAxis && !!(this.data.yAxisTopText || this.data.yAxisBottomText);
|
1041 | const showTitle = this.config.showTitle && !!this.data.titleText;
|
1042 | const xAxisPosition = this.data.points.length > 0 ? "bottom" : this.config.xAxisPosition;
|
1043 | const calculatedSpace = this.calculateSpace(xAxisPosition, showXAxis, showYAxis, showTitle);
|
1044 | return {
|
1045 | points: this.getQuadrantPoints(calculatedSpace),
|
1046 | quadrants: this.getQuadrants(calculatedSpace),
|
1047 | axisLabels: this.getAxisLabels(xAxisPosition, showXAxis, showYAxis, calculatedSpace),
|
1048 | borderLines: this.getBorders(calculatedSpace),
|
1049 | title: this.getTitle(showTitle)
|
1050 | };
|
1051 | }
|
1052 | }
|
1053 | const config = getConfig();
|
1054 | function textSanitizer(text) {
|
1055 | return sanitizeText(text.trim(), config);
|
1056 | }
|
1057 | const quadrantBuilder = new QuadrantBuilder();
|
1058 | function setQuadrant1Text(textObj) {
|
1059 | quadrantBuilder.setData({ quadrant1Text: textSanitizer(textObj.text) });
|
1060 | }
|
1061 | function setQuadrant2Text(textObj) {
|
1062 | quadrantBuilder.setData({ quadrant2Text: textSanitizer(textObj.text) });
|
1063 | }
|
1064 | function setQuadrant3Text(textObj) {
|
1065 | quadrantBuilder.setData({ quadrant3Text: textSanitizer(textObj.text) });
|
1066 | }
|
1067 | function setQuadrant4Text(textObj) {
|
1068 | quadrantBuilder.setData({ quadrant4Text: textSanitizer(textObj.text) });
|
1069 | }
|
1070 | function setXAxisLeftText(textObj) {
|
1071 | quadrantBuilder.setData({ xAxisLeftText: textSanitizer(textObj.text) });
|
1072 | }
|
1073 | function setXAxisRightText(textObj) {
|
1074 | quadrantBuilder.setData({ xAxisRightText: textSanitizer(textObj.text) });
|
1075 | }
|
1076 | function setYAxisTopText(textObj) {
|
1077 | quadrantBuilder.setData({ yAxisTopText: textSanitizer(textObj.text) });
|
1078 | }
|
1079 | function setYAxisBottomText(textObj) {
|
1080 | quadrantBuilder.setData({ yAxisBottomText: textSanitizer(textObj.text) });
|
1081 | }
|
1082 | function addPoint(textObj, x, y) {
|
1083 | quadrantBuilder.addPoints([{ x, y, text: textSanitizer(textObj.text) }]);
|
1084 | }
|
1085 | function setWidth(width) {
|
1086 | quadrantBuilder.setConfig({ chartWidth: width });
|
1087 | }
|
1088 | function setHeight(height) {
|
1089 | quadrantBuilder.setConfig({ chartHeight: height });
|
1090 | }
|
1091 | function getQuadrantData() {
|
1092 | const config2 = getConfig();
|
1093 | const { themeVariables, quadrantChart: quadrantChartConfig } = config2;
|
1094 | if (quadrantChartConfig) {
|
1095 | quadrantBuilder.setConfig(quadrantChartConfig);
|
1096 | }
|
1097 | quadrantBuilder.setThemeConfig({
|
1098 | quadrant1Fill: themeVariables.quadrant1Fill,
|
1099 | quadrant2Fill: themeVariables.quadrant2Fill,
|
1100 | quadrant3Fill: themeVariables.quadrant3Fill,
|
1101 | quadrant4Fill: themeVariables.quadrant4Fill,
|
1102 | quadrant1TextFill: themeVariables.quadrant1TextFill,
|
1103 | quadrant2TextFill: themeVariables.quadrant2TextFill,
|
1104 | quadrant3TextFill: themeVariables.quadrant3TextFill,
|
1105 | quadrant4TextFill: themeVariables.quadrant4TextFill,
|
1106 | quadrantPointFill: themeVariables.quadrantPointFill,
|
1107 | quadrantPointTextFill: themeVariables.quadrantPointTextFill,
|
1108 | quadrantXAxisTextFill: themeVariables.quadrantXAxisTextFill,
|
1109 | quadrantYAxisTextFill: themeVariables.quadrantYAxisTextFill,
|
1110 | quadrantExternalBorderStrokeFill: themeVariables.quadrantExternalBorderStrokeFill,
|
1111 | quadrantInternalBorderStrokeFill: themeVariables.quadrantInternalBorderStrokeFill,
|
1112 | quadrantTitleFill: themeVariables.quadrantTitleFill
|
1113 | });
|
1114 | quadrantBuilder.setData({ titleText: getDiagramTitle() });
|
1115 | return quadrantBuilder.build();
|
1116 | }
|
1117 | const clear = function() {
|
1118 | quadrantBuilder.clear();
|
1119 | clear$1();
|
1120 | };
|
1121 | const db = {
|
1122 | setWidth,
|
1123 | setHeight,
|
1124 | setQuadrant1Text,
|
1125 | setQuadrant2Text,
|
1126 | setQuadrant3Text,
|
1127 | setQuadrant4Text,
|
1128 | setXAxisLeftText,
|
1129 | setXAxisRightText,
|
1130 | setYAxisTopText,
|
1131 | setYAxisBottomText,
|
1132 | addPoint,
|
1133 | getQuadrantData,
|
1134 | clear,
|
1135 | setAccTitle,
|
1136 | getAccTitle,
|
1137 | setDiagramTitle,
|
1138 | getDiagramTitle,
|
1139 | getAccDescription,
|
1140 | setAccDescription
|
1141 | };
|
1142 | const draw = (txt, id, _version, diagObj) => {
|
1143 | var _a, _b, _c;
|
1144 | function getDominantBaseLine(horizontalPos) {
|
1145 | return horizontalPos === "top" ? "hanging" : "middle";
|
1146 | }
|
1147 | function getTextAnchor(verticalPos) {
|
1148 | return verticalPos === "left" ? "start" : "middle";
|
1149 | }
|
1150 | function getTransformation(data) {
|
1151 | return `translate(${data.x}, ${data.y}) rotate(${data.rotation || 0})`;
|
1152 | }
|
1153 | const conf = getConfig();
|
1154 | log.debug("Rendering quadrant chart\n" + txt);
|
1155 | const securityLevel = conf.securityLevel;
|
1156 | let sandboxElement;
|
1157 | if (securityLevel === "sandbox") {
|
1158 | sandboxElement = select("#i" + id);
|
1159 | }
|
1160 | const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
|
1161 | const svg = root.select(`[id="${id}"]`);
|
1162 | const group = svg.append("g").attr("class", "main");
|
1163 | const width = ((_a = conf.quadrantChart) == null ? void 0 : _a.chartWidth) || 500;
|
1164 | const height = ((_b = conf.quadrantChart) == null ? void 0 : _b.chartHeight) || 500;
|
1165 | configureSvgSize(svg, height, width, ((_c = conf.quadrantChart) == null ? void 0 : _c.useMaxWidth) || true);
|
1166 | svg.attr("viewBox", "0 0 " + width + " " + height);
|
1167 | diagObj.db.setHeight(height);
|
1168 | diagObj.db.setWidth(width);
|
1169 | const quadrantData = diagObj.db.getQuadrantData();
|
1170 | const quadrantsGroup = group.append("g").attr("class", "quadrants");
|
1171 | const borderGroup = group.append("g").attr("class", "border");
|
1172 | const dataPointGroup = group.append("g").attr("class", "data-points");
|
1173 | const labelGroup = group.append("g").attr("class", "labels");
|
1174 | const titleGroup = group.append("g").attr("class", "title");
|
1175 | if (quadrantData.title) {
|
1176 | titleGroup.append("text").attr("x", 0).attr("y", 0).attr("fill", quadrantData.title.fill).attr("font-size", quadrantData.title.fontSize).attr("dominant-baseline", getDominantBaseLine(quadrantData.title.horizontalPos)).attr("text-anchor", getTextAnchor(quadrantData.title.verticalPos)).attr("transform", getTransformation(quadrantData.title)).text(quadrantData.title.text);
|
1177 | }
|
1178 | if (quadrantData.borderLines) {
|
1179 | borderGroup.selectAll("line").data(quadrantData.borderLines).enter().append("line").attr("x1", (data) => data.x1).attr("y1", (data) => data.y1).attr("x2", (data) => data.x2).attr("y2", (data) => data.y2).style("stroke", (data) => data.strokeFill).style("stroke-width", (data) => data.strokeWidth);
|
1180 | }
|
1181 | const quadrants = quadrantsGroup.selectAll("g.quadrant").data(quadrantData.quadrants).enter().append("g").attr("class", "quadrant");
|
1182 | quadrants.append("rect").attr("x", (data) => data.x).attr("y", (data) => data.y).attr("width", (data) => data.width).attr("height", (data) => data.height).attr("fill", (data) => data.fill);
|
1183 | quadrants.append("text").attr("x", 0).attr("y", 0).attr("fill", (data) => data.text.fill).attr("font-size", (data) => data.text.fontSize).attr(
|
1184 | "dominant-baseline",
|
1185 | (data) => getDominantBaseLine(data.text.horizontalPos)
|
1186 | ).attr("text-anchor", (data) => getTextAnchor(data.text.verticalPos)).attr("transform", (data) => getTransformation(data.text)).text((data) => data.text.text);
|
1187 | const labels = labelGroup.selectAll("g.label").data(quadrantData.axisLabels).enter().append("g").attr("class", "label");
|
1188 | labels.append("text").attr("x", 0).attr("y", 0).text((data) => data.text).attr("fill", (data) => data.fill).attr("font-size", (data) => data.fontSize).attr("dominant-baseline", (data) => getDominantBaseLine(data.horizontalPos)).attr("text-anchor", (data) => getTextAnchor(data.verticalPos)).attr("transform", (data) => getTransformation(data));
|
1189 | const dataPoints = dataPointGroup.selectAll("g.data-point").data(quadrantData.points).enter().append("g").attr("class", "data-point");
|
1190 | dataPoints.append("circle").attr("cx", (data) => data.x).attr("cy", (data) => data.y).attr("r", (data) => data.radius).attr("fill", (data) => data.fill);
|
1191 | dataPoints.append("text").attr("x", 0).attr("y", 0).text((data) => data.text.text).attr("fill", (data) => data.text.fill).attr("font-size", (data) => data.text.fontSize).attr(
|
1192 | "dominant-baseline",
|
1193 | (data) => getDominantBaseLine(data.text.horizontalPos)
|
1194 | ).attr("text-anchor", (data) => getTextAnchor(data.text.verticalPos)).attr("transform", (data) => getTransformation(data.text));
|
1195 | };
|
1196 | const renderer = {
|
1197 | draw
|
1198 | };
|
1199 | const diagram = {
|
1200 | parser: parser$1,
|
1201 | db,
|
1202 | renderer,
|
1203 | styles: () => ""
|
1204 | };
|
1205 | export {
|
1206 | diagram
|
1207 | };
|